amber-cli.js 2.2 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569
  1. #!/usr/bin/env node
  2. (function(define, require){
  3. define('__wrap__', function (requirejs) {
  4. var module = void 0; // Bad UMDs workaround
  5. requirejs.resolve = require.resolve;
  6. require = requirejs;
  7. /*!
  8. * @overview es6-promise - a tiny implementation of Promises/A+.
  9. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  10. * @license Licensed under MIT license
  11. * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
  12. * @version v4.2.5+7f2b526d
  13. */
  14. (function (global, factory) {
  15. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  16. typeof define === 'function' && define.amd ? define('amber/es6-promise',factory) :
  17. (global.ES6Promise = factory());
  18. }(this, (function () { 'use strict';
  19. function objectOrFunction(x) {
  20. var type = typeof x;
  21. return x !== null && (type === 'object' || type === 'function');
  22. }
  23. function isFunction(x) {
  24. return typeof x === 'function';
  25. }
  26. var _isArray = void 0;
  27. if (Array.isArray) {
  28. _isArray = Array.isArray;
  29. } else {
  30. _isArray = function (x) {
  31. return Object.prototype.toString.call(x) === '[object Array]';
  32. };
  33. }
  34. var isArray = _isArray;
  35. var len = 0;
  36. var vertxNext = void 0;
  37. var customSchedulerFn = void 0;
  38. var asap = function asap(callback, arg) {
  39. queue[len] = callback;
  40. queue[len + 1] = arg;
  41. len += 2;
  42. if (len === 2) {
  43. // If len is 2, that means that we need to schedule an async flush.
  44. // If additional callbacks are queued before the queue is flushed, they
  45. // will be processed by this flush that we are scheduling.
  46. if (customSchedulerFn) {
  47. customSchedulerFn(flush);
  48. } else {
  49. scheduleFlush();
  50. }
  51. }
  52. };
  53. function setScheduler(scheduleFn) {
  54. customSchedulerFn = scheduleFn;
  55. }
  56. function setAsap(asapFn) {
  57. asap = asapFn;
  58. }
  59. var browserWindow = typeof window !== 'undefined' ? window : undefined;
  60. var browserGlobal = browserWindow || {};
  61. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  62. var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
  63. // test for web worker but not in IE10
  64. var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
  65. // node
  66. function useNextTick() {
  67. // node version 0.10.x displays a deprecation warning when nextTick is used recursively
  68. // see https://github.com/cujojs/when/issues/410 for details
  69. return function () {
  70. return process.nextTick(flush);
  71. };
  72. }
  73. // vertx
  74. function useVertxTimer() {
  75. if (typeof vertxNext !== 'undefined') {
  76. return function () {
  77. vertxNext(flush);
  78. };
  79. }
  80. return useSetTimeout();
  81. }
  82. function useMutationObserver() {
  83. var iterations = 0;
  84. var observer = new BrowserMutationObserver(flush);
  85. var node = document.createTextNode('');
  86. observer.observe(node, { characterData: true });
  87. return function () {
  88. node.data = iterations = ++iterations % 2;
  89. };
  90. }
  91. // web worker
  92. function useMessageChannel() {
  93. var channel = new MessageChannel();
  94. channel.port1.onmessage = flush;
  95. return function () {
  96. return channel.port2.postMessage(0);
  97. };
  98. }
  99. function useSetTimeout() {
  100. // Store setTimeout reference so es6-promise will be unaffected by
  101. // other code modifying setTimeout (like sinon.useFakeTimers())
  102. var globalSetTimeout = setTimeout;
  103. return function () {
  104. return globalSetTimeout(flush, 1);
  105. };
  106. }
  107. var queue = new Array(1000);
  108. function flush() {
  109. for (var i = 0; i < len; i += 2) {
  110. var callback = queue[i];
  111. var arg = queue[i + 1];
  112. callback(arg);
  113. queue[i] = undefined;
  114. queue[i + 1] = undefined;
  115. }
  116. len = 0;
  117. }
  118. function attemptVertx() {
  119. try {
  120. var vertx = Function('return this')().require('vertx');
  121. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  122. return useVertxTimer();
  123. } catch (e) {
  124. return useSetTimeout();
  125. }
  126. }
  127. var scheduleFlush = void 0;
  128. // Decide what async method to use to triggering processing of queued callbacks:
  129. if (isNode) {
  130. scheduleFlush = useNextTick();
  131. } else if (BrowserMutationObserver) {
  132. scheduleFlush = useMutationObserver();
  133. } else if (isWorker) {
  134. scheduleFlush = useMessageChannel();
  135. } else if (browserWindow === undefined && typeof require === 'function') {
  136. scheduleFlush = attemptVertx();
  137. } else {
  138. scheduleFlush = useSetTimeout();
  139. }
  140. function then(onFulfillment, onRejection) {
  141. var parent = this;
  142. var child = new this.constructor(noop);
  143. if (child[PROMISE_ID] === undefined) {
  144. makePromise(child);
  145. }
  146. var _state = parent._state;
  147. if (_state) {
  148. var callback = arguments[_state - 1];
  149. asap(function () {
  150. return invokeCallback(_state, child, callback, parent._result);
  151. });
  152. } else {
  153. subscribe(parent, child, onFulfillment, onRejection);
  154. }
  155. return child;
  156. }
  157. /**
  158. `Promise.resolve` returns a promise that will become resolved with the
  159. passed `value`. It is shorthand for the following:
  160. ```javascript
  161. let promise = new Promise(function(resolve, reject){
  162. resolve(1);
  163. });
  164. promise.then(function(value){
  165. // value === 1
  166. });
  167. ```
  168. Instead of writing the above, your code now simply becomes the following:
  169. ```javascript
  170. let promise = Promise.resolve(1);
  171. promise.then(function(value){
  172. // value === 1
  173. });
  174. ```
  175. @method resolve
  176. @static
  177. @param {Any} value value that the returned promise will be resolved with
  178. Useful for tooling.
  179. @return {Promise} a promise that will become fulfilled with the given
  180. `value`
  181. */
  182. function resolve$1(object) {
  183. /*jshint validthis:true */
  184. var Constructor = this;
  185. if (object && typeof object === 'object' && object.constructor === Constructor) {
  186. return object;
  187. }
  188. var promise = new Constructor(noop);
  189. resolve(promise, object);
  190. return promise;
  191. }
  192. var PROMISE_ID = Math.random().toString(36).substring(2);
  193. function noop() {}
  194. var PENDING = void 0;
  195. var FULFILLED = 1;
  196. var REJECTED = 2;
  197. var TRY_CATCH_ERROR = { error: null };
  198. function selfFulfillment() {
  199. return new TypeError("You cannot resolve a promise with itself");
  200. }
  201. function cannotReturnOwn() {
  202. return new TypeError('A promises callback cannot return that same promise.');
  203. }
  204. function getThen(promise) {
  205. try {
  206. return promise.then;
  207. } catch (error) {
  208. TRY_CATCH_ERROR.error = error;
  209. return TRY_CATCH_ERROR;
  210. }
  211. }
  212. function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
  213. try {
  214. then$$1.call(value, fulfillmentHandler, rejectionHandler);
  215. } catch (e) {
  216. return e;
  217. }
  218. }
  219. function handleForeignThenable(promise, thenable, then$$1) {
  220. asap(function (promise) {
  221. var sealed = false;
  222. var error = tryThen(then$$1, thenable, function (value) {
  223. if (sealed) {
  224. return;
  225. }
  226. sealed = true;
  227. if (thenable !== value) {
  228. resolve(promise, value);
  229. } else {
  230. fulfill(promise, value);
  231. }
  232. }, function (reason) {
  233. if (sealed) {
  234. return;
  235. }
  236. sealed = true;
  237. reject(promise, reason);
  238. }, 'Settle: ' + (promise._label || ' unknown promise'));
  239. if (!sealed && error) {
  240. sealed = true;
  241. reject(promise, error);
  242. }
  243. }, promise);
  244. }
  245. function handleOwnThenable(promise, thenable) {
  246. if (thenable._state === FULFILLED) {
  247. fulfill(promise, thenable._result);
  248. } else if (thenable._state === REJECTED) {
  249. reject(promise, thenable._result);
  250. } else {
  251. subscribe(thenable, undefined, function (value) {
  252. return resolve(promise, value);
  253. }, function (reason) {
  254. return reject(promise, reason);
  255. });
  256. }
  257. }
  258. function handleMaybeThenable(promise, maybeThenable, then$$1) {
  259. if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {
  260. handleOwnThenable(promise, maybeThenable);
  261. } else {
  262. if (then$$1 === TRY_CATCH_ERROR) {
  263. reject(promise, TRY_CATCH_ERROR.error);
  264. TRY_CATCH_ERROR.error = null;
  265. } else if (then$$1 === undefined) {
  266. fulfill(promise, maybeThenable);
  267. } else if (isFunction(then$$1)) {
  268. handleForeignThenable(promise, maybeThenable, then$$1);
  269. } else {
  270. fulfill(promise, maybeThenable);
  271. }
  272. }
  273. }
  274. function resolve(promise, value) {
  275. if (promise === value) {
  276. reject(promise, selfFulfillment());
  277. } else if (objectOrFunction(value)) {
  278. handleMaybeThenable(promise, value, getThen(value));
  279. } else {
  280. fulfill(promise, value);
  281. }
  282. }
  283. function publishRejection(promise) {
  284. if (promise._onerror) {
  285. promise._onerror(promise._result);
  286. }
  287. publish(promise);
  288. }
  289. function fulfill(promise, value) {
  290. if (promise._state !== PENDING) {
  291. return;
  292. }
  293. promise._result = value;
  294. promise._state = FULFILLED;
  295. if (promise._subscribers.length !== 0) {
  296. asap(publish, promise);
  297. }
  298. }
  299. function reject(promise, reason) {
  300. if (promise._state !== PENDING) {
  301. return;
  302. }
  303. promise._state = REJECTED;
  304. promise._result = reason;
  305. asap(publishRejection, promise);
  306. }
  307. function subscribe(parent, child, onFulfillment, onRejection) {
  308. var _subscribers = parent._subscribers;
  309. var length = _subscribers.length;
  310. parent._onerror = null;
  311. _subscribers[length] = child;
  312. _subscribers[length + FULFILLED] = onFulfillment;
  313. _subscribers[length + REJECTED] = onRejection;
  314. if (length === 0 && parent._state) {
  315. asap(publish, parent);
  316. }
  317. }
  318. function publish(promise) {
  319. var subscribers = promise._subscribers;
  320. var settled = promise._state;
  321. if (subscribers.length === 0) {
  322. return;
  323. }
  324. var child = void 0,
  325. callback = void 0,
  326. detail = promise._result;
  327. for (var i = 0; i < subscribers.length; i += 3) {
  328. child = subscribers[i];
  329. callback = subscribers[i + settled];
  330. if (child) {
  331. invokeCallback(settled, child, callback, detail);
  332. } else {
  333. callback(detail);
  334. }
  335. }
  336. promise._subscribers.length = 0;
  337. }
  338. function tryCatch(callback, detail) {
  339. try {
  340. return callback(detail);
  341. } catch (e) {
  342. TRY_CATCH_ERROR.error = e;
  343. return TRY_CATCH_ERROR;
  344. }
  345. }
  346. function invokeCallback(settled, promise, callback, detail) {
  347. var hasCallback = isFunction(callback),
  348. value = void 0,
  349. error = void 0,
  350. succeeded = void 0,
  351. failed = void 0;
  352. if (hasCallback) {
  353. value = tryCatch(callback, detail);
  354. if (value === TRY_CATCH_ERROR) {
  355. failed = true;
  356. error = value.error;
  357. value.error = null;
  358. } else {
  359. succeeded = true;
  360. }
  361. if (promise === value) {
  362. reject(promise, cannotReturnOwn());
  363. return;
  364. }
  365. } else {
  366. value = detail;
  367. succeeded = true;
  368. }
  369. if (promise._state !== PENDING) {
  370. // noop
  371. } else if (hasCallback && succeeded) {
  372. resolve(promise, value);
  373. } else if (failed) {
  374. reject(promise, error);
  375. } else if (settled === FULFILLED) {
  376. fulfill(promise, value);
  377. } else if (settled === REJECTED) {
  378. reject(promise, value);
  379. }
  380. }
  381. function initializePromise(promise, resolver) {
  382. try {
  383. resolver(function resolvePromise(value) {
  384. resolve(promise, value);
  385. }, function rejectPromise(reason) {
  386. reject(promise, reason);
  387. });
  388. } catch (e) {
  389. reject(promise, e);
  390. }
  391. }
  392. var id = 0;
  393. function nextId() {
  394. return id++;
  395. }
  396. function makePromise(promise) {
  397. promise[PROMISE_ID] = id++;
  398. promise._state = undefined;
  399. promise._result = undefined;
  400. promise._subscribers = [];
  401. }
  402. function validationError() {
  403. return new Error('Array Methods must be provided an Array');
  404. }
  405. var Enumerator = function () {
  406. function Enumerator(Constructor, input) {
  407. this._instanceConstructor = Constructor;
  408. this.promise = new Constructor(noop);
  409. if (!this.promise[PROMISE_ID]) {
  410. makePromise(this.promise);
  411. }
  412. if (isArray(input)) {
  413. this.length = input.length;
  414. this._remaining = input.length;
  415. this._result = new Array(this.length);
  416. if (this.length === 0) {
  417. fulfill(this.promise, this._result);
  418. } else {
  419. this.length = this.length || 0;
  420. this._enumerate(input);
  421. if (this._remaining === 0) {
  422. fulfill(this.promise, this._result);
  423. }
  424. }
  425. } else {
  426. reject(this.promise, validationError());
  427. }
  428. }
  429. Enumerator.prototype._enumerate = function _enumerate(input) {
  430. for (var i = 0; this._state === PENDING && i < input.length; i++) {
  431. this._eachEntry(input[i], i);
  432. }
  433. };
  434. Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {
  435. var c = this._instanceConstructor;
  436. var resolve$$1 = c.resolve;
  437. if (resolve$$1 === resolve$1) {
  438. var _then = getThen(entry);
  439. if (_then === then && entry._state !== PENDING) {
  440. this._settledAt(entry._state, i, entry._result);
  441. } else if (typeof _then !== 'function') {
  442. this._remaining--;
  443. this._result[i] = entry;
  444. } else if (c === Promise$1) {
  445. var promise = new c(noop);
  446. handleMaybeThenable(promise, entry, _then);
  447. this._willSettleAt(promise, i);
  448. } else {
  449. this._willSettleAt(new c(function (resolve$$1) {
  450. return resolve$$1(entry);
  451. }), i);
  452. }
  453. } else {
  454. this._willSettleAt(resolve$$1(entry), i);
  455. }
  456. };
  457. Enumerator.prototype._settledAt = function _settledAt(state, i, value) {
  458. var promise = this.promise;
  459. if (promise._state === PENDING) {
  460. this._remaining--;
  461. if (state === REJECTED) {
  462. reject(promise, value);
  463. } else {
  464. this._result[i] = value;
  465. }
  466. }
  467. if (this._remaining === 0) {
  468. fulfill(promise, this._result);
  469. }
  470. };
  471. Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {
  472. var enumerator = this;
  473. subscribe(promise, undefined, function (value) {
  474. return enumerator._settledAt(FULFILLED, i, value);
  475. }, function (reason) {
  476. return enumerator._settledAt(REJECTED, i, reason);
  477. });
  478. };
  479. return Enumerator;
  480. }();
  481. /**
  482. `Promise.all` accepts an array of promises, and returns a new promise which
  483. is fulfilled with an array of fulfillment values for the passed promises, or
  484. rejected with the reason of the first passed promise to be rejected. It casts all
  485. elements of the passed iterable to promises as it runs this algorithm.
  486. Example:
  487. ```javascript
  488. let promise1 = resolve(1);
  489. let promise2 = resolve(2);
  490. let promise3 = resolve(3);
  491. let promises = [ promise1, promise2, promise3 ];
  492. Promise.all(promises).then(function(array){
  493. // The array here would be [ 1, 2, 3 ];
  494. });
  495. ```
  496. If any of the `promises` given to `all` are rejected, the first promise
  497. that is rejected will be given as an argument to the returned promises's
  498. rejection handler. For example:
  499. Example:
  500. ```javascript
  501. let promise1 = resolve(1);
  502. let promise2 = reject(new Error("2"));
  503. let promise3 = reject(new Error("3"));
  504. let promises = [ promise1, promise2, promise3 ];
  505. Promise.all(promises).then(function(array){
  506. // Code here never runs because there are rejected promises!
  507. }, function(error) {
  508. // error.message === "2"
  509. });
  510. ```
  511. @method all
  512. @static
  513. @param {Array} entries array of promises
  514. @param {String} label optional string for labeling the promise.
  515. Useful for tooling.
  516. @return {Promise} promise that is fulfilled when all `promises` have been
  517. fulfilled, or rejected if any of them become rejected.
  518. @static
  519. */
  520. function all(entries) {
  521. return new Enumerator(this, entries).promise;
  522. }
  523. /**
  524. `Promise.race` returns a new promise which is settled in the same way as the
  525. first passed promise to settle.
  526. Example:
  527. ```javascript
  528. let promise1 = new Promise(function(resolve, reject){
  529. setTimeout(function(){
  530. resolve('promise 1');
  531. }, 200);
  532. });
  533. let promise2 = new Promise(function(resolve, reject){
  534. setTimeout(function(){
  535. resolve('promise 2');
  536. }, 100);
  537. });
  538. Promise.race([promise1, promise2]).then(function(result){
  539. // result === 'promise 2' because it was resolved before promise1
  540. // was resolved.
  541. });
  542. ```
  543. `Promise.race` is deterministic in that only the state of the first
  544. settled promise matters. For example, even if other promises given to the
  545. `promises` array argument are resolved, but the first settled promise has
  546. become rejected before the other promises became fulfilled, the returned
  547. promise will become rejected:
  548. ```javascript
  549. let promise1 = new Promise(function(resolve, reject){
  550. setTimeout(function(){
  551. resolve('promise 1');
  552. }, 200);
  553. });
  554. let promise2 = new Promise(function(resolve, reject){
  555. setTimeout(function(){
  556. reject(new Error('promise 2'));
  557. }, 100);
  558. });
  559. Promise.race([promise1, promise2]).then(function(result){
  560. // Code here never runs
  561. }, function(reason){
  562. // reason.message === 'promise 2' because promise 2 became rejected before
  563. // promise 1 became fulfilled
  564. });
  565. ```
  566. An example real-world use case is implementing timeouts:
  567. ```javascript
  568. Promise.race([ajax('foo.json'), timeout(5000)])
  569. ```
  570. @method race
  571. @static
  572. @param {Array} promises array of promises to observe
  573. Useful for tooling.
  574. @return {Promise} a promise which settles in the same way as the first passed
  575. promise to settle.
  576. */
  577. function race(entries) {
  578. /*jshint validthis:true */
  579. var Constructor = this;
  580. if (!isArray(entries)) {
  581. return new Constructor(function (_, reject) {
  582. return reject(new TypeError('You must pass an array to race.'));
  583. });
  584. } else {
  585. return new Constructor(function (resolve, reject) {
  586. var length = entries.length;
  587. for (var i = 0; i < length; i++) {
  588. Constructor.resolve(entries[i]).then(resolve, reject);
  589. }
  590. });
  591. }
  592. }
  593. /**
  594. `Promise.reject` returns a promise rejected with the passed `reason`.
  595. It is shorthand for the following:
  596. ```javascript
  597. let promise = new Promise(function(resolve, reject){
  598. reject(new Error('WHOOPS'));
  599. });
  600. promise.then(function(value){
  601. // Code here doesn't run because the promise is rejected!
  602. }, function(reason){
  603. // reason.message === 'WHOOPS'
  604. });
  605. ```
  606. Instead of writing the above, your code now simply becomes the following:
  607. ```javascript
  608. let promise = Promise.reject(new Error('WHOOPS'));
  609. promise.then(function(value){
  610. // Code here doesn't run because the promise is rejected!
  611. }, function(reason){
  612. // reason.message === 'WHOOPS'
  613. });
  614. ```
  615. @method reject
  616. @static
  617. @param {Any} reason value that the returned promise will be rejected with.
  618. Useful for tooling.
  619. @return {Promise} a promise rejected with the given `reason`.
  620. */
  621. function reject$1(reason) {
  622. /*jshint validthis:true */
  623. var Constructor = this;
  624. var promise = new Constructor(noop);
  625. reject(promise, reason);
  626. return promise;
  627. }
  628. function needsResolver() {
  629. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  630. }
  631. function needsNew() {
  632. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  633. }
  634. /**
  635. Promise objects represent the eventual result of an asynchronous operation. The
  636. primary way of interacting with a promise is through its `then` method, which
  637. registers callbacks to receive either a promise's eventual value or the reason
  638. why the promise cannot be fulfilled.
  639. Terminology
  640. -----------
  641. - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
  642. - `thenable` is an object or function that defines a `then` method.
  643. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
  644. - `exception` is a value that is thrown using the throw statement.
  645. - `reason` is a value that indicates why a promise was rejected.
  646. - `settled` the final resting state of a promise, fulfilled or rejected.
  647. A promise can be in one of three states: pending, fulfilled, or rejected.
  648. Promises that are fulfilled have a fulfillment value and are in the fulfilled
  649. state. Promises that are rejected have a rejection reason and are in the
  650. rejected state. A fulfillment value is never a thenable.
  651. Promises can also be said to *resolve* a value. If this value is also a
  652. promise, then the original promise's settled state will match the value's
  653. settled state. So a promise that *resolves* a promise that rejects will
  654. itself reject, and a promise that *resolves* a promise that fulfills will
  655. itself fulfill.
  656. Basic Usage:
  657. ------------
  658. ```js
  659. let promise = new Promise(function(resolve, reject) {
  660. // on success
  661. resolve(value);
  662. // on failure
  663. reject(reason);
  664. });
  665. promise.then(function(value) {
  666. // on fulfillment
  667. }, function(reason) {
  668. // on rejection
  669. });
  670. ```
  671. Advanced Usage:
  672. ---------------
  673. Promises shine when abstracting away asynchronous interactions such as
  674. `XMLHttpRequest`s.
  675. ```js
  676. function getJSON(url) {
  677. return new Promise(function(resolve, reject){
  678. let xhr = new XMLHttpRequest();
  679. xhr.open('GET', url);
  680. xhr.onreadystatechange = handler;
  681. xhr.responseType = 'json';
  682. xhr.setRequestHeader('Accept', 'application/json');
  683. xhr.send();
  684. function handler() {
  685. if (this.readyState === this.DONE) {
  686. if (this.status === 200) {
  687. resolve(this.response);
  688. } else {
  689. reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
  690. }
  691. }
  692. };
  693. });
  694. }
  695. getJSON('/posts.json').then(function(json) {
  696. // on fulfillment
  697. }, function(reason) {
  698. // on rejection
  699. });
  700. ```
  701. Unlike callbacks, promises are great composable primitives.
  702. ```js
  703. Promise.all([
  704. getJSON('/posts'),
  705. getJSON('/comments')
  706. ]).then(function(values){
  707. values[0] // => postsJSON
  708. values[1] // => commentsJSON
  709. return values;
  710. });
  711. ```
  712. @class Promise
  713. @param {Function} resolver
  714. Useful for tooling.
  715. @constructor
  716. */
  717. var Promise$1 = function () {
  718. function Promise(resolver) {
  719. this[PROMISE_ID] = nextId();
  720. this._result = this._state = undefined;
  721. this._subscribers = [];
  722. if (noop !== resolver) {
  723. typeof resolver !== 'function' && needsResolver();
  724. this instanceof Promise ? initializePromise(this, resolver) : needsNew();
  725. }
  726. }
  727. /**
  728. The primary way of interacting with a promise is through its `then` method,
  729. which registers callbacks to receive either a promise's eventual value or the
  730. reason why the promise cannot be fulfilled.
  731. ```js
  732. findUser().then(function(user){
  733. // user is available
  734. }, function(reason){
  735. // user is unavailable, and you are given the reason why
  736. });
  737. ```
  738. Chaining
  739. --------
  740. The return value of `then` is itself a promise. This second, 'downstream'
  741. promise is resolved with the return value of the first promise's fulfillment
  742. or rejection handler, or rejected if the handler throws an exception.
  743. ```js
  744. findUser().then(function (user) {
  745. return user.name;
  746. }, function (reason) {
  747. return 'default name';
  748. }).then(function (userName) {
  749. // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
  750. // will be `'default name'`
  751. });
  752. findUser().then(function (user) {
  753. throw new Error('Found user, but still unhappy');
  754. }, function (reason) {
  755. throw new Error('`findUser` rejected and we're unhappy');
  756. }).then(function (value) {
  757. // never reached
  758. }, function (reason) {
  759. // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
  760. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
  761. });
  762. ```
  763. If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  764. ```js
  765. findUser().then(function (user) {
  766. throw new PedagogicalException('Upstream error');
  767. }).then(function (value) {
  768. // never reached
  769. }).then(function (value) {
  770. // never reached
  771. }, function (reason) {
  772. // The `PedgagocialException` is propagated all the way down to here
  773. });
  774. ```
  775. Assimilation
  776. ------------
  777. Sometimes the value you want to propagate to a downstream promise can only be
  778. retrieved asynchronously. This can be achieved by returning a promise in the
  779. fulfillment or rejection handler. The downstream promise will then be pending
  780. until the returned promise is settled. This is called *assimilation*.
  781. ```js
  782. findUser().then(function (user) {
  783. return findCommentsByAuthor(user);
  784. }).then(function (comments) {
  785. // The user's comments are now available
  786. });
  787. ```
  788. If the assimliated promise rejects, then the downstream promise will also reject.
  789. ```js
  790. findUser().then(function (user) {
  791. return findCommentsByAuthor(user);
  792. }).then(function (comments) {
  793. // If `findCommentsByAuthor` fulfills, we'll have the value here
  794. }, function (reason) {
  795. // If `findCommentsByAuthor` rejects, we'll have the reason here
  796. });
  797. ```
  798. Simple Example
  799. --------------
  800. Synchronous Example
  801. ```javascript
  802. let result;
  803. try {
  804. result = findResult();
  805. // success
  806. } catch(reason) {
  807. // failure
  808. }
  809. ```
  810. Errback Example
  811. ```js
  812. findResult(function(result, err){
  813. if (err) {
  814. // failure
  815. } else {
  816. // success
  817. }
  818. });
  819. ```
  820. Promise Example;
  821. ```javascript
  822. findResult().then(function(result){
  823. // success
  824. }, function(reason){
  825. // failure
  826. });
  827. ```
  828. Advanced Example
  829. --------------
  830. Synchronous Example
  831. ```javascript
  832. let author, books;
  833. try {
  834. author = findAuthor();
  835. books = findBooksByAuthor(author);
  836. // success
  837. } catch(reason) {
  838. // failure
  839. }
  840. ```
  841. Errback Example
  842. ```js
  843. function foundBooks(books) {
  844. }
  845. function failure(reason) {
  846. }
  847. findAuthor(function(author, err){
  848. if (err) {
  849. failure(err);
  850. // failure
  851. } else {
  852. try {
  853. findBoooksByAuthor(author, function(books, err) {
  854. if (err) {
  855. failure(err);
  856. } else {
  857. try {
  858. foundBooks(books);
  859. } catch(reason) {
  860. failure(reason);
  861. }
  862. }
  863. });
  864. } catch(error) {
  865. failure(err);
  866. }
  867. // success
  868. }
  869. });
  870. ```
  871. Promise Example;
  872. ```javascript
  873. findAuthor().
  874. then(findBooksByAuthor).
  875. then(function(books){
  876. // found books
  877. }).catch(function(reason){
  878. // something went wrong
  879. });
  880. ```
  881. @method then
  882. @param {Function} onFulfilled
  883. @param {Function} onRejected
  884. Useful for tooling.
  885. @return {Promise}
  886. */
  887. /**
  888. `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
  889. as the catch block of a try/catch statement.
  890. ```js
  891. function findAuthor(){
  892. throw new Error('couldn't find that author');
  893. }
  894. // synchronous
  895. try {
  896. findAuthor();
  897. } catch(reason) {
  898. // something went wrong
  899. }
  900. // async with promises
  901. findAuthor().catch(function(reason){
  902. // something went wrong
  903. });
  904. ```
  905. @method catch
  906. @param {Function} onRejection
  907. Useful for tooling.
  908. @return {Promise}
  909. */
  910. Promise.prototype.catch = function _catch(onRejection) {
  911. return this.then(null, onRejection);
  912. };
  913. /**
  914. `finally` will be invoked regardless of the promise's fate just as native
  915. try/catch/finally behaves
  916. Synchronous example:
  917. ```js
  918. findAuthor() {
  919. if (Math.random() > 0.5) {
  920. throw new Error();
  921. }
  922. return new Author();
  923. }
  924. try {
  925. return findAuthor(); // succeed or fail
  926. } catch(error) {
  927. return findOtherAuther();
  928. } finally {
  929. // always runs
  930. // doesn't affect the return value
  931. }
  932. ```
  933. Asynchronous example:
  934. ```js
  935. findAuthor().catch(function(reason){
  936. return findOtherAuther();
  937. }).finally(function(){
  938. // author was either found, or not
  939. });
  940. ```
  941. @method finally
  942. @param {Function} callback
  943. @return {Promise}
  944. */
  945. Promise.prototype.finally = function _finally(callback) {
  946. var promise = this;
  947. var constructor = promise.constructor;
  948. if (isFunction(callback)) {
  949. return promise.then(function (value) {
  950. return constructor.resolve(callback()).then(function () {
  951. return value;
  952. });
  953. }, function (reason) {
  954. return constructor.resolve(callback()).then(function () {
  955. throw reason;
  956. });
  957. });
  958. }
  959. return promise.then(callback, callback);
  960. };
  961. return Promise;
  962. }();
  963. Promise$1.prototype.then = then;
  964. Promise$1.all = all;
  965. Promise$1.race = race;
  966. Promise$1.resolve = resolve$1;
  967. Promise$1.reject = reject$1;
  968. Promise$1._setScheduler = setScheduler;
  969. Promise$1._setAsap = setAsap;
  970. Promise$1._asap = asap;
  971. /*global self*/
  972. function polyfill() {
  973. var local = void 0;
  974. if (typeof global !== 'undefined') {
  975. local = global;
  976. } else if (typeof self !== 'undefined') {
  977. local = self;
  978. } else {
  979. try {
  980. local = Function('return this')();
  981. } catch (e) {
  982. throw new Error('polyfill failed because global object is unavailable in this environment');
  983. }
  984. }
  985. var P = local.Promise;
  986. if (P) {
  987. var promiseToString = null;
  988. try {
  989. promiseToString = Object.prototype.toString.call(P.resolve());
  990. } catch (e) {
  991. // silently ignored
  992. }
  993. if (promiseToString === '[object Promise]' && !P.cast) {
  994. return;
  995. }
  996. }
  997. local.Promise = Promise$1;
  998. }
  999. // Strange compat..
  1000. Promise$1.polyfill = polyfill;
  1001. Promise$1.Promise = Promise$1;
  1002. return Promise$1;
  1003. })));
  1004. //# sourceMappingURL=es6-promise.map
  1005. ;
  1006. (function () {
  1007. define('app',["require", "amber/es6-promise"], function (require, promiseLib) {
  1008. promiseLib.polyfill();
  1009. return new Promise(function (resolve, reject) {
  1010. require(["__app__"], resolve, reject);
  1011. });
  1012. });
  1013. }());
  1014. //jshint eqnull:true
  1015. define('amber/kernel-runtime',[],function () {
  1016. "use strict";
  1017. function defineMethod (klass, name, method) {
  1018. Object.defineProperty(klass.prototype, name, {
  1019. value: method,
  1020. enumerable: false, configurable: true, writable: true
  1021. });
  1022. }
  1023. function installJSMethod (obj, jsSelector, fn) {
  1024. Object.defineProperty(obj, jsSelector, {
  1025. value: fn,
  1026. enumerable: false, configurable: true, writable: true
  1027. });
  1028. }
  1029. RuntimeSelectorsBrik.deps = ["selectors", "selectorConversion", "smalltalkGlobals", "classes"];
  1030. function RuntimeSelectorsBrik (brikz, st) {
  1031. var selectors = brikz.selectors.selectors;
  1032. var globals = brikz.smalltalkGlobals.globals;
  1033. var nilAsClass = brikz.classes.nilAsClass;
  1034. var st2js = brikz.selectorConversion.st2js;
  1035. var jsSelectors = this.jsSelectors = [];
  1036. /* Method not implemented handlers */
  1037. function installNewSelectors (newSelectors, targetClasses) {
  1038. newSelectors.forEach(function (selector) {
  1039. var jsSelector = st2js(selector);
  1040. jsSelectors.push(jsSelector);
  1041. var fn = createDnuHandler(selector);
  1042. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  1043. targetClasses.forEach(function (target) {
  1044. installJSMethod(target.fn.prototype, jsSelector, fn);
  1045. });
  1046. });
  1047. }
  1048. this.installNewSelectors = installNewSelectors;
  1049. /* Dnu handler method */
  1050. function createDnuHandler (stSelector) {
  1051. return function () {
  1052. return globals.Message._selector_arguments_notUnderstoodBy_(
  1053. stSelector, [].slice.call(arguments), this
  1054. );
  1055. };
  1056. }
  1057. installNewSelectors(selectors, []);
  1058. }
  1059. RuntimeClassesBrik.deps = ["event", "smalltalkGlobals", "runtimeSelectors", "behaviors", "classes", "runtimeMethods"];
  1060. function RuntimeClassesBrik (brikz, st) {
  1061. var globals = brikz.smalltalkGlobals.globals;
  1062. var jsSelectors = brikz.runtimeSelectors.jsSelectors;
  1063. var installNewSelectors = brikz.runtimeSelectors.installNewSelectors;
  1064. var installMethod = brikz.runtimeMethods.installMethod;
  1065. var traitsOrClasses = brikz.behaviors.traitsOrClasses;
  1066. var wireKlass = brikz.classes.wireKlass;
  1067. var emit = brikz.event.emit;
  1068. var detachedRootClasses = [];
  1069. function markClassDetachedRoot (klass) {
  1070. klass.detachedRoot = true;
  1071. detachedRootClasses = traitsOrClasses.filter(function (klass) {
  1072. return klass.detachedRoot;
  1073. });
  1074. }
  1075. emit.selectorsAdded = function (newSelectors) {
  1076. installNewSelectors(newSelectors, detachedRootClasses);
  1077. };
  1078. /* Initialize a class in its class hierarchy. Handle both classes and
  1079. metaclasses. */
  1080. function initClassAndMetaclass (klass) {
  1081. initClass(klass);
  1082. if (klass.a$cls && !klass.meta) {
  1083. initClass(klass.a$cls);
  1084. }
  1085. }
  1086. traitsOrClasses.forEach(function (traitOrClass) {
  1087. if (!traitOrClass.trait) initClassAndMetaclass(traitOrClass);
  1088. });
  1089. emit.classAdded = function (klass) {
  1090. initClassAndMetaclass(klass);
  1091. klass._enterOrganization();
  1092. };
  1093. emit.traitAdded = function (trait) {
  1094. trait._enterOrganization();
  1095. };
  1096. emit.classRemoved = function (klass) {
  1097. klass._leaveOrganization();
  1098. };
  1099. emit.traitRemoved = function (trait) {
  1100. trait._leaveOrganization();
  1101. };
  1102. function initClass (klass) {
  1103. wireKlass(klass);
  1104. if (klass.detachedRoot) {
  1105. copySuperclass(klass);
  1106. }
  1107. installMethods(klass);
  1108. }
  1109. function copySuperclass (klass) {
  1110. var myproto = klass.fn.prototype,
  1111. superproto = klass.superclass.fn.prototype;
  1112. jsSelectors.forEach(function (jsSelector) {
  1113. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  1114. });
  1115. }
  1116. function installMethods (klass) {
  1117. var methods = klass.methods;
  1118. Object.keys(methods).forEach(function (selector) {
  1119. installMethod(methods[selector], klass);
  1120. });
  1121. }
  1122. /* Create an alias for an existing class */
  1123. st.alias = function (traitOrClass, alias) {
  1124. globals[alias] = traitOrClass;
  1125. };
  1126. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  1127. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  1128. markClassDetachedRoot(klass);
  1129. klass.fn = constructor;
  1130. initClass(klass);
  1131. };
  1132. }
  1133. FrameBindingBrik.deps = ["smalltalkGlobals", "runtimeClasses"];
  1134. function FrameBindingBrik (brikz, st) {
  1135. var globals = brikz.smalltalkGlobals.globals;
  1136. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1137. setClassConstructor(globals.Number, Number);
  1138. setClassConstructor(globals.BlockClosure, Function);
  1139. setClassConstructor(globals.Boolean, Boolean);
  1140. setClassConstructor(globals.Date, Date);
  1141. setClassConstructor(globals.String, String);
  1142. setClassConstructor(globals.Array, Array);
  1143. setClassConstructor(globals.RegularExpression, RegExp);
  1144. setClassConstructor(globals.Error, Error);
  1145. setClassConstructor(globals.Promise, Promise);
  1146. this.__init__ = function () {
  1147. st.alias(globals.Array, "OrderedCollection");
  1148. st.alias(globals.Date, "Time");
  1149. }
  1150. }
  1151. RuntimeMethodsBrik.deps = ["event", "selectorConversion"];
  1152. function RuntimeMethodsBrik (brikz, st) {
  1153. var st2js = brikz.selectorConversion.st2js;
  1154. var emit = brikz.event.emit;
  1155. function installMethod (method, klass) {
  1156. var jsSelector = method.jsSelector;
  1157. if (!jsSelector) {
  1158. jsSelector = method.jsSelector = st2js(method.selector);
  1159. }
  1160. installJSMethod(klass.fn.prototype, jsSelector, method.fn);
  1161. }
  1162. this.installMethod = installMethod;
  1163. emit.behaviorMethodAdded = function (method, klass) {
  1164. installMethod(method, klass);
  1165. propagateMethodChange(klass, method, klass);
  1166. };
  1167. emit.behaviorMethodRemoved = function (method, klass) {
  1168. delete klass.fn.prototype[method.jsSelector];
  1169. propagateMethodChange(klass, method, null);
  1170. };
  1171. emit.methodReplaced = function (newMethod, oldMethod, traitOrBehavior) {
  1172. traitOrBehavior._methodOrganizationEnter_andLeave_(newMethod, oldMethod);
  1173. };
  1174. function propagateMethodChange (klass, method, exclude) {
  1175. var selector = method.selector;
  1176. var jsSelector = method.jsSelector;
  1177. st.traverseClassTree(klass, function (subclass, sentinel) {
  1178. if (subclass === exclude) return;
  1179. if (subclass.methods[selector]) return sentinel;
  1180. if (subclass.detachedRoot) {
  1181. installJSMethod(subclass.fn.prototype, jsSelector, subclass.superclass.fn.prototype[jsSelector]);
  1182. }
  1183. });
  1184. }
  1185. }
  1186. PrimitivesBrik.deps = ["smalltalkGlobals"];
  1187. function PrimitivesBrik (brikz, st) {
  1188. var globals = brikz.smalltalkGlobals.globals;
  1189. /* Converts a JavaScript object to valid Smalltalk Object */
  1190. st.readJSObject = function (js) {
  1191. if (js == null) return null;
  1192. else if (Array.isArray(js)) return js.map(st.readJSObject);
  1193. else if (js.constructor !== Object) return js;
  1194. var pairs = [];
  1195. for (var i in js) {
  1196. pairs.push(i, st.readJSObject(js[i]));
  1197. }
  1198. return globals.Dictionary._newFromPairs_(pairs);
  1199. };
  1200. /* Boolean assertion */
  1201. st.assert = function (shouldBeBoolean) {
  1202. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1203. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  1204. shouldBeBoolean = shouldBeBoolean.valueOf();
  1205. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1206. }
  1207. globals.NonBooleanReceiver._signalOn_(shouldBeBoolean);
  1208. };
  1209. }
  1210. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  1211. function RuntimeBrik (brikz, st) {
  1212. var globals = brikz.smalltalkGlobals.globals;
  1213. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1214. function SmalltalkMethodContext (home, setup) {
  1215. // TODO lazy fill of .sendIdx
  1216. this.sendIdx = {};
  1217. // TODO very likely .senderContext, not .homeContext here
  1218. this.homeContext = home;
  1219. this.setup = setup;
  1220. }
  1221. // Fallbacks
  1222. SmalltalkMethodContext.prototype.supercall = false;
  1223. SmalltalkMethodContext.prototype.locals = Object.freeze({});
  1224. SmalltalkMethodContext.prototype.receiver = null;
  1225. SmalltalkMethodContext.prototype.selector = null;
  1226. SmalltalkMethodContext.prototype.lookupClass = null;
  1227. SmalltalkMethodContext.prototype.outerContext = null;
  1228. SmalltalkMethodContext.prototype.index = 0;
  1229. defineMethod(SmalltalkMethodContext, "fill", function (receiver, selector, locals, lookupClass) {
  1230. this.receiver = receiver;
  1231. this.selector = selector;
  1232. if (locals != null) this.locals = locals;
  1233. this.lookupClass = lookupClass;
  1234. if (this.homeContext) {
  1235. this.homeContext.evaluatedSelector = selector;
  1236. }
  1237. });
  1238. defineMethod(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
  1239. if (locals != null) this.locals = locals;
  1240. this.outerContext = ctx;
  1241. if (index) this.index = index;
  1242. });
  1243. defineMethod(SmalltalkMethodContext, "method", function () {
  1244. var method;
  1245. var lookup = this.lookupClass || this.receiver.a$cls;
  1246. while (!method && lookup) {
  1247. method = lookup.methods[st.js2st(this.selector)];
  1248. lookup = lookup.superclass;
  1249. }
  1250. return method;
  1251. });
  1252. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  1253. /* This is the current call context object.
  1254. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  1255. In JS code, use api.getThisContext() (see below).
  1256. */
  1257. var thisContext = null;
  1258. /*
  1259. Runs worker function so that error handler is not set up
  1260. if there isn't one. This is accomplished by unconditional
  1261. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  1262. which then stops error handler setup (see st.withContext above).
  1263. The effect is, $core.seamless(fn)'s exceptions are not
  1264. handed into ST error handler and caller should process them.
  1265. */
  1266. st.seamless = function (worker) {
  1267. var oldContext = thisContext;
  1268. thisContext = new SmalltalkMethodContext(thisContext, function (ctx) {
  1269. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  1270. });
  1271. var result = worker(thisContext);
  1272. thisContext = oldContext;
  1273. return result;
  1274. };
  1275. function resultWithErrorHandling (worker) {
  1276. try {
  1277. return worker(thisContext);
  1278. } catch (error) {
  1279. globals.ErrorHandler._handleError_(error);
  1280. thisContext = null;
  1281. // Rethrow the error in any case.
  1282. throw error;
  1283. }
  1284. }
  1285. /*
  1286. Standard way to run within context.
  1287. Sets up error handler if entering first ST context in a stack.
  1288. */
  1289. st.withContext = function (worker, setup) {
  1290. var oldContext = thisContext;
  1291. thisContext = new SmalltalkMethodContext(thisContext, setup);
  1292. var result = oldContext == null ? resultWithErrorHandling(worker) : worker(thisContext);
  1293. thisContext = oldContext;
  1294. return result;
  1295. };
  1296. /* Handle thisContext pseudo variable */
  1297. st.getThisContext = function () {
  1298. if (!thisContext) return null;
  1299. for (var frame = thisContext; frame; frame = frame.homeContext) {
  1300. frame.setup(frame);
  1301. }
  1302. return thisContext;
  1303. };
  1304. }
  1305. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  1306. function MessageSendBrik (brikz, st) {
  1307. var globals = brikz.smalltalkGlobals.globals;
  1308. var nilAsReceiver = brikz.root.nilAsReceiver;
  1309. /* Send message programmatically. Used to implement #perform: & Co. */
  1310. st.send2 = function (self, selector, args, klass) {
  1311. if (self == null) {
  1312. self = nilAsReceiver;
  1313. }
  1314. var method = klass ? klass.fn.prototype[st.st2js(selector)] : self.a$cls && self[st.st2js(selector)];
  1315. return method != null ?
  1316. method.apply(self, args || []) :
  1317. globals.Message._selector_arguments_notUnderstoodBy_(
  1318. selector, [].slice.call(args), self.a$cls ? self : wrapJavaScript(self)
  1319. );
  1320. };
  1321. function wrapJavaScript (o) {
  1322. return globals.JSObjectProxy._on_(o);
  1323. }
  1324. st.wrapJavaScript = wrapJavaScript;
  1325. /* If the object property is a function, then call it, except if it starts with
  1326. an uppercase character (we probably want to answer the function itself in this
  1327. case and send it #new from Amber).
  1328. */
  1329. st.accessJavaScript = function (self, propertyName, args) {
  1330. var propertyValue = self[propertyName];
  1331. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  1332. return propertyValue.apply(self, args);
  1333. } else if (args.length === 0) {
  1334. return propertyValue;
  1335. } else {
  1336. self[propertyName] = args[0];
  1337. return self;
  1338. }
  1339. };
  1340. }
  1341. function SelectorConversionBrik (brikz, st) {
  1342. var st2jsMemo = Object.create(null);
  1343. /* Convert a Smalltalk selector into a JS selector */
  1344. function st2js (string) {
  1345. return '_' + string
  1346. .replace(/:/g, '_')
  1347. .replace(/[\&]/g, '_and')
  1348. .replace(/[\|]/g, '_or')
  1349. .replace(/[+]/g, '_plus')
  1350. .replace(/-/g, '_minus')
  1351. .replace(/[*]/g, '_star')
  1352. .replace(/[\/]/g, '_slash')
  1353. .replace(/[\\]/g, '_backslash')
  1354. .replace(/[\~]/g, '_tild')
  1355. .replace(/%/g, '_percent')
  1356. .replace(/>/g, '_gt')
  1357. .replace(/</g, '_lt')
  1358. .replace(/=/g, '_eq')
  1359. .replace(/,/g, '_comma')
  1360. .replace(/[@]/g, '_at');
  1361. };
  1362. st.st2js = function (stSelector) {
  1363. return st2jsMemo[stSelector] || st2js(stSelector);
  1364. };
  1365. this.st2js = function (stSelector) {
  1366. return st2jsMemo[stSelector] || (st2jsMemo[stSelector] = st2js(stSelector));
  1367. };
  1368. /* Convert a string to a valid smalltalk selector.
  1369. if you modify the following functions, also change st2js
  1370. accordingly */
  1371. st.js2st = function (selector) {
  1372. if (selector.match(/^__/)) {
  1373. return binaryJsToSt(selector);
  1374. } else {
  1375. return keywordJsToSt(selector);
  1376. }
  1377. };
  1378. function keywordJsToSt (selector) {
  1379. return selector.replace(/^_/, '').replace(/_/g, ':');
  1380. }
  1381. function binaryJsToSt (selector) {
  1382. return selector
  1383. .replace(/^_/, '')
  1384. .replace(/_and/g, '&')
  1385. .replace(/_or/g, '|')
  1386. .replace(/_plus/g, '+')
  1387. .replace(/_minus/g, '-')
  1388. .replace(/_star/g, '*')
  1389. .replace(/_slash/g, '/')
  1390. .replace(/_backslash/g, '\\')
  1391. .replace(/_tild/g, '~')
  1392. .replace(/_percent/g, '%')
  1393. .replace(/_gt/g, '>')
  1394. .replace(/_lt/g, '<')
  1395. .replace(/_eq/g, '=')
  1396. .replace(/_comma/g, ',')
  1397. .replace(/_at/g, '@');
  1398. }
  1399. st.st2prop = function (stSelector) {
  1400. var colonPosition = stSelector.indexOf(':');
  1401. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1402. };
  1403. }
  1404. StartImageBrik.deps = ["smalltalkGlobals"];
  1405. function StartImageBrik (brikz, st) {
  1406. var globals = brikz.smalltalkGlobals.globals;
  1407. this.run = function () {
  1408. return globals.AmberBootstrapInitialization._run();
  1409. };
  1410. }
  1411. /* Making smalltalk that can run */
  1412. function configureWithRuntime (brikz) {
  1413. brikz.runtimeSelectors = RuntimeSelectorsBrik;
  1414. brikz.runtimeClasses = RuntimeClassesBrik;
  1415. brikz.frameBinding = FrameBindingBrik;
  1416. brikz.runtimeMethods = RuntimeMethodsBrik;
  1417. brikz.messageSend = MessageSendBrik;
  1418. brikz.runtime = RuntimeBrik;
  1419. brikz.primitives = PrimitivesBrik;
  1420. brikz.selectorConversion = SelectorConversionBrik;
  1421. brikz.startImage = StartImageBrik;
  1422. brikz.rebuild();
  1423. }
  1424. return configureWithRuntime;
  1425. });
  1426. // Depend on each module that is loaded lazily.
  1427. // Add to packager tasks as dependency,
  1428. // so the lazy-loaded modules are included.
  1429. define('amber/lazypack',['./kernel-runtime'], {});
  1430. //jshint eqnull:true
  1431. define('amber/kernel-checks',[],function () {
  1432. "use strict";
  1433. function assert (fn) {
  1434. try {
  1435. if (fn()) return;
  1436. } catch (ex) {
  1437. throw new Error("Error:\n" + ex + "in assertion:\n" + fn);
  1438. }
  1439. throw new Error("Assertion failed:\n" + fn);
  1440. }
  1441. assert(function () {
  1442. return !("hasOwnProperty" in Object.create(null));
  1443. });
  1444. assert(function () {
  1445. return Object.getPrototypeOf(Object.create(null)) === null;
  1446. });
  1447. assert(function () {
  1448. var p = {};
  1449. return Object.getPrototypeOf(Object.create(p)) === p;
  1450. });
  1451. // assert(function () {
  1452. // return new Function("return this")().Object === Object;
  1453. // });
  1454. // assert(function () {
  1455. // return Object.create(new Function("return this")()).Object === Object;
  1456. // });
  1457. assert(function () {
  1458. return typeof global !== "undefined";
  1459. });
  1460. assert(function () {
  1461. return global.Object === Object;
  1462. });
  1463. assert(function () {
  1464. return Object.create(global).Object === Object;
  1465. });
  1466. assert(function () {
  1467. return (function () {
  1468. return this;
  1469. }).apply(void 0) === void 0;
  1470. });
  1471. assert(function () {
  1472. return (function () {
  1473. return this;
  1474. }).apply(null) === null;
  1475. });
  1476. assert(function () {
  1477. return (function () {
  1478. return this;
  1479. }).apply(3) === 3;
  1480. });
  1481. assert(function () {
  1482. return (function () {
  1483. return this;
  1484. }).apply("foo") === "foo";
  1485. });
  1486. assert(function () {
  1487. return (function () {
  1488. return this;
  1489. }).apply(true) === true;
  1490. });
  1491. assert(function () {
  1492. var o = Object.freeze({});
  1493. try {
  1494. o.foo = "bar";
  1495. } catch (ex) {
  1496. }
  1497. return o.foo == null;
  1498. });
  1499. assert(function () {
  1500. return typeof Promise === "function";
  1501. });
  1502. assert(function () {
  1503. return typeof Promise.resolve === "function";
  1504. });
  1505. assert(function () {
  1506. return typeof Promise.reject === "function";
  1507. });
  1508. assert(function () {
  1509. return typeof new Promise(function () {
  1510. }).then === "function";
  1511. });
  1512. });
  1513. define('amber/brikz',[], function () {
  1514. return function Brikz(api, apiKey, initKey) {
  1515. "use strict";
  1516. //jshint eqnull:true
  1517. var brikz = this,
  1518. backup = {};
  1519. apiKey = apiKey || 'exports';
  1520. initKey = initKey || '__init__';
  1521. function mixin(src, target, what) {
  1522. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  1523. if (src == null) {
  1524. target[keys[i]] = undefined;
  1525. } else {
  1526. var value = src[keys[i]];
  1527. if (typeof value !== "undefined") {
  1528. target[keys[i]] = value;
  1529. }
  1530. }
  1531. }
  1532. return target;
  1533. }
  1534. Object.defineProperties(this, {
  1535. rebuild: { value: null, enumerable: false, configurable: true, writable: true }
  1536. });
  1537. var exclude = mixin(this, {});
  1538. this.rebuild = function () {
  1539. Object.keys(backup).forEach(function (key) {
  1540. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  1541. });
  1542. var oapi = mixin(api, {}),
  1543. order = [],
  1544. chk = {};
  1545. function ensure(key) {
  1546. if (key in exclude) {
  1547. return null;
  1548. }
  1549. var b = brikz[key],
  1550. bak = backup[key];
  1551. mixin(null, api, api);
  1552. while (typeof b === "function") {
  1553. (b.deps || []).forEach(ensure);
  1554. b = new b(brikz, api, bak);
  1555. }
  1556. brikz[key] = b;
  1557. if (b && !chk[key]) {
  1558. chk[key] = true;
  1559. order.push(b);
  1560. }
  1561. if (b && !b[apiKey]) {
  1562. b[apiKey] = mixin(api, {});
  1563. }
  1564. }
  1565. Object.keys(brikz).forEach(ensure);
  1566. mixin(oapi, mixin(null, api, api));
  1567. order.forEach(function (brik) {
  1568. mixin(brik[apiKey] || {}, api);
  1569. });
  1570. order.forEach(function (brik) {
  1571. if (brik[initKey]) {
  1572. brik[initKey]();
  1573. if (brik[initKey].once) {
  1574. delete brik[initKey];
  1575. }
  1576. }
  1577. });
  1578. backup = mixin(brikz, {});
  1579. };
  1580. };
  1581. });
  1582. /* ====================================================================
  1583. |
  1584. | Amber Smalltalk
  1585. | http://amber-lang.net
  1586. |
  1587. ======================================================================
  1588. ======================================================================
  1589. |
  1590. | Copyright (c) 2010-2014
  1591. | Nicolas Petton <petton.nicolas@gmail.com>
  1592. |
  1593. | Copyright (c) 2012-2017
  1594. | The Amber team https://lolg.it/org/amber/members
  1595. | Amber contributors (see /CONTRIBUTORS)
  1596. |
  1597. | Amber is released under the MIT license
  1598. |
  1599. | Permission is hereby granted, free of charge, to any person obtaining
  1600. | a copy of this software and associated documentation files (the
  1601. | 'Software'), to deal in the Software without restriction, including
  1602. | without limitation the rights to use, copy, modify, merge, publish,
  1603. | distribute, sublicense, and/or sell copies of the Software, and to
  1604. | permit persons to whom the Software is furnished to do so, subject to
  1605. | the following conditions:
  1606. |
  1607. | The above copyright notice and this permission notice shall be
  1608. | included in all copies or substantial portions of the Software.
  1609. |
  1610. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1611. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1612. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1613. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1614. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1615. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1616. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1617. |
  1618. ==================================================================== */
  1619. //jshint eqnull:true
  1620. define('amber/kernel-fundamentals',[],function () {
  1621. "use strict";
  1622. function inherits (child, parent) {
  1623. child.prototype = Object.create(parent.prototype, {
  1624. constructor: {
  1625. value: child,
  1626. enumerable: false, configurable: true, writable: true
  1627. }
  1628. });
  1629. return child;
  1630. }
  1631. function SmalltalkGlobalsBrik (brikz, st) {
  1632. var globals = Object.create(global);
  1633. globals.SmalltalkSettings = {};
  1634. this.globals = globals;
  1635. }
  1636. function EventBrik (brikz, st) {
  1637. var emit = {};
  1638. this.emit = emit;
  1639. this.declareEvent = function (event) {
  1640. if (!emit[event]) emit[event] = function () {
  1641. };
  1642. }
  1643. }
  1644. function RootBrik (brikz, st) {
  1645. /* Smalltalk foundational objects */
  1646. var coreFns = this.coreFns = {};
  1647. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1648. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1649. Detached roots (eg. wrapped JS classes like Number or Date)
  1650. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1651. function SmalltalkRoot () {
  1652. }
  1653. function SmalltalkProtoObject () {
  1654. }
  1655. function SmalltalkObject () {
  1656. }
  1657. coreFns.ProtoObject = inherits(SmalltalkProtoObject, SmalltalkRoot);
  1658. coreFns.Object = inherits(SmalltalkObject, SmalltalkProtoObject);
  1659. this.Root = SmalltalkRoot;
  1660. this.Object = SmalltalkObject;
  1661. }
  1662. function SelectorsBrik (brikz, st) {
  1663. var selectorSet = Object.create(null);
  1664. var selectors = this.selectors = [];
  1665. this.registerSelector = function (stSelector) {
  1666. if (selectorSet[stSelector]) return false;
  1667. selectors.push(stSelector);
  1668. return selectorSet[stSelector] = true;
  1669. };
  1670. st.allSelectors = function () {
  1671. return selectors;
  1672. };
  1673. }
  1674. function PackagesBrik (brikz, st) {
  1675. st.packages = st.packageDescriptors = {};
  1676. /* Add a package load descriptor to the system */
  1677. st.addPackage = function (name, properties) {
  1678. if (!name) return null;
  1679. return st.packageDescriptors[name] = {properties: properties};
  1680. };
  1681. }
  1682. BehaviorsBrik.deps = ["root", "smalltalkGlobals", "arraySet"];
  1683. function BehaviorsBrik (brikz, st) {
  1684. var globals = brikz.smalltalkGlobals.globals;
  1685. var addElement = brikz.arraySet.addElement;
  1686. var removeElement = brikz.arraySet.removeElement;
  1687. /* Smalltalk classes and traits */
  1688. var traitsOrClasses = [];
  1689. this.buildTraitOrClass = function (category, builder) {
  1690. var traitOrClass = globals.hasOwnProperty(builder.name) && globals[builder.name];
  1691. if (traitOrClass) {
  1692. builder.updateExisting(traitOrClass);
  1693. } else {
  1694. traitOrClass = builder.make();
  1695. traitOrClass.category = category;
  1696. addTraitOrClass(traitOrClass);
  1697. }
  1698. return traitOrClass;
  1699. };
  1700. function addTraitOrClass (traitOrClass) {
  1701. globals[traitOrClass.name] = traitOrClass;
  1702. addElement(traitsOrClasses, traitOrClass);
  1703. traitOrClass.added();
  1704. }
  1705. function removeTraitOrClass (traitOrClass) {
  1706. traitOrClass.removed();
  1707. removeElement(traitsOrClasses, traitOrClass);
  1708. delete globals[traitOrClass.name];
  1709. }
  1710. this.removeTraitOrClass = removeTraitOrClass;
  1711. st.traitsOrClasses = this.traitsOrClasses = traitsOrClasses;
  1712. }
  1713. MethodsBrik.deps = ["event", "selectors", "root"];
  1714. function MethodsBrik (brikz, st) {
  1715. var registerSelector = brikz.selectors.registerSelector;
  1716. var SmalltalkObject = brikz.root.Object;
  1717. var coreFns = brikz.root.coreFns;
  1718. var emit = brikz.event.emit;
  1719. var declareEvent = brikz.event.declareEvent;
  1720. function SmalltalkMethod () {
  1721. }
  1722. coreFns.CompiledMethod = inherits(SmalltalkMethod, SmalltalkObject);
  1723. /* Smalltalk method object. To add a method to a class,
  1724. use api.addMethod() */
  1725. st.method = function (spec) {
  1726. var that = new SmalltalkMethod();
  1727. var selector = spec.selector;
  1728. that.selector = selector;
  1729. that.args = spec.args || [];
  1730. that.protocol = spec.protocol;
  1731. that.source = spec.source;
  1732. that.messageSends = spec.messageSends || [];
  1733. // TODO remove .referencedClasses, have .referencedGlobals
  1734. that.referencedClasses = spec.referencedClasses || [];
  1735. that.fn = spec.fn;
  1736. return that;
  1737. };
  1738. /* Add/remove a method to/from a class */
  1739. st.addMethod = function (method, traitOrBehavior) {
  1740. if (method.owner != null) {
  1741. throw new Error("addMethod: Method " + method.selector + " already bound to " + method.owner);
  1742. }
  1743. method.owner = traitOrBehavior;
  1744. // TODO deprecation helper; remove
  1745. Object.defineProperty(method, "methodClass", {
  1746. get: function () {
  1747. console.warn("Use of .methodClass deprecated, use .owner");
  1748. return method.owner;
  1749. },
  1750. set: function (v) {
  1751. console.warn("Use of .methodClass= deprecated, use .owner=");
  1752. method.owner = v;
  1753. }
  1754. });
  1755. registerNewSelectors(method);
  1756. traitOrBehavior.localMethods[method.selector] = method;
  1757. updateMethod(method.selector, traitOrBehavior);
  1758. };
  1759. declareEvent("selectorsAdded");
  1760. function registerNewSelectors (method) {
  1761. var newSelectors = [];
  1762. function selectorInUse (stSelector) {
  1763. if (registerSelector(stSelector)) {
  1764. newSelectors.push(stSelector);
  1765. }
  1766. }
  1767. selectorInUse(method.selector);
  1768. method.messageSends.forEach(selectorInUse);
  1769. emit.selectorsAdded(newSelectors);
  1770. }
  1771. st.removeMethod = function (method, traitOrBehavior) {
  1772. if (traitOrBehavior.localMethods[method.selector] !== method) return;
  1773. delete traitOrBehavior.localMethods[method.selector];
  1774. updateMethod(method.selector, traitOrBehavior);
  1775. };
  1776. this.setupMethods = function (traitOrBehavior) {
  1777. traitOrBehavior.localMethods = Object.create(null);
  1778. traitOrBehavior.methods = Object.create(null);
  1779. };
  1780. declareEvent("methodReplaced");
  1781. function updateMethod (selector, traitOrBehavior) {
  1782. var oldMethod = traitOrBehavior.methods[selector],
  1783. newMethod = traitOrBehavior.localMethods[selector];
  1784. if (oldMethod == null && newMethod == null) {
  1785. console.warn("Removal of nonexistent method " + traitOrBehavior + " >> " + selector);
  1786. return;
  1787. }
  1788. if (newMethod === oldMethod) return;
  1789. if (newMethod != null) {
  1790. traitOrBehavior.methods[selector] = newMethod;
  1791. traitOrBehavior.methodAdded(newMethod);
  1792. } else {
  1793. delete traitOrBehavior.methods[selector];
  1794. traitOrBehavior.methodRemoved(oldMethod);
  1795. }
  1796. emit.methodReplaced(newMethod, oldMethod, traitOrBehavior);
  1797. }
  1798. this.updateMethod = updateMethod;
  1799. }
  1800. function ArraySetBrik (brikz, st) {
  1801. st.addElement = this.addElement = function (array, el) {
  1802. if (typeof el === 'undefined') {
  1803. return;
  1804. }
  1805. if (array.indexOf(el) === -1) {
  1806. array.push(el);
  1807. }
  1808. };
  1809. st.removeElement = this.removeElement = function (array, el) {
  1810. var i = array.indexOf(el);
  1811. if (i !== -1) {
  1812. array.splice(i, 1);
  1813. }
  1814. };
  1815. }
  1816. NilBrik.deps = ["root"];
  1817. function NilBrik (brikz, st) {
  1818. var SmalltalkObject = brikz.root.Object;
  1819. var coreFns = brikz.root.coreFns;
  1820. function SmalltalkNil () {
  1821. }
  1822. coreFns.UndefinedObject = inherits(SmalltalkNil, SmalltalkObject);
  1823. this.nilAsReceiver = new SmalltalkNil();
  1824. this.nilAsValue = this.nilAsReceiver; // TODO null
  1825. // Adds an `a$nil` (and legacy `isNil`) property to the `nil` object. When sending
  1826. // nil objects from one environment to another, doing
  1827. // `anObject == nil` (in JavaScript) does not always answer
  1828. // true as the referenced nil object might come from the other
  1829. // environment.
  1830. Object.defineProperty(this.nilAsReceiver, 'a$nil', {
  1831. value: true,
  1832. enumerable: false, configurable: false, writable: false
  1833. });
  1834. Object.defineProperty(this.nilAsReceiver, 'isNil', {
  1835. value: true,
  1836. enumerable: false, configurable: false, writable: false
  1837. });
  1838. }
  1839. /* Making smalltalk that has basic building blocks */
  1840. function configureWithFundamentals (brikz) {
  1841. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1842. brikz.root = RootBrik;
  1843. brikz.nil = NilBrik;
  1844. brikz.event = EventBrik;
  1845. brikz.arraySet = ArraySetBrik;
  1846. brikz.selectors = SelectorsBrik;
  1847. brikz.packages = PackagesBrik;
  1848. brikz.behaviors = BehaviorsBrik;
  1849. brikz.methods = MethodsBrik;
  1850. brikz.rebuild();
  1851. }
  1852. return configureWithFundamentals;
  1853. });
  1854. /* ====================================================================
  1855. |
  1856. | Amber Smalltalk
  1857. | http://amber-lang.net
  1858. |
  1859. ======================================================================
  1860. ======================================================================
  1861. |
  1862. | Copyright (c) 2010-2014
  1863. | Nicolas Petton <petton.nicolas@gmail.com>
  1864. |
  1865. | Copyright (c) 2012-2017
  1866. | The Amber team https://lolg.it/org/amber/members
  1867. | Amber contributors (see /CONTRIBUTORS)
  1868. |
  1869. | Amber is released under the MIT license
  1870. |
  1871. | Permission is hereby granted, free of charge, to any person obtaining
  1872. | a copy of this software and associated documentation files (the
  1873. | 'Software'), to deal in the Software without restriction, including
  1874. | without limitation the rights to use, copy, modify, merge, publish,
  1875. | distribute, sublicense, and/or sell copies of the Software, and to
  1876. | permit persons to whom the Software is furnished to do so, subject to
  1877. | the following conditions:
  1878. |
  1879. | The above copyright notice and this permission notice shall be
  1880. | included in all copies or substantial portions of the Software.
  1881. |
  1882. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1883. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1884. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1885. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1886. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1887. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1888. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1889. |
  1890. ==================================================================== */
  1891. //jshint eqnull:true
  1892. define('amber/kernel-language',[],function () {
  1893. "use strict";
  1894. function inherits (child, parent) {
  1895. child.prototype = Object.create(parent.prototype, {
  1896. constructor: {
  1897. value: child,
  1898. enumerable: false, configurable: true, writable: true
  1899. }
  1900. });
  1901. return child;
  1902. }
  1903. function defineMethod (klass, name, method) {
  1904. Object.defineProperty(klass.prototype, name, {
  1905. value: method,
  1906. enumerable: false, configurable: true, writable: true
  1907. });
  1908. }
  1909. TraitsBrik.deps = ["event", "behaviors", "methods", "composition", "root"];
  1910. function TraitsBrik (brikz, st) {
  1911. var coreFns = brikz.root.coreFns;
  1912. var SmalltalkObject = brikz.root.Object;
  1913. var setupMethods = brikz.methods.setupMethods;
  1914. var traitMethodChanged = brikz.composition.traitMethodChanged;
  1915. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  1916. var emit = brikz.event.emit;
  1917. var declareEvent = brikz.event.declareEvent;
  1918. function SmalltalkTrait () {
  1919. }
  1920. coreFns.Trait = inherits(SmalltalkTrait, SmalltalkObject);
  1921. SmalltalkTrait.prototype.trait = true;
  1922. defineMethod(SmalltalkTrait, "toString", function () {
  1923. return 'Smalltalk Trait ' + this.name;
  1924. });
  1925. declareEvent("traitAdded");
  1926. defineMethod(SmalltalkTrait, "added", function () {
  1927. emit.traitAdded(this);
  1928. });
  1929. declareEvent("traitRemoved");
  1930. defineMethod(SmalltalkTrait, "removed", function () {
  1931. emit.traitRemoved(this);
  1932. });
  1933. declareEvent("traitMethodAdded");
  1934. defineMethod(SmalltalkTrait, "methodAdded", function (method) {
  1935. var self = this;
  1936. this.traitUsers.forEach(function (each) {
  1937. traitMethodChanged(method.selector, method, self, each);
  1938. });
  1939. emit.traitMethodAdded(method, this);
  1940. });
  1941. declareEvent("traitMethodRemoved");
  1942. defineMethod(SmalltalkTrait, "methodRemoved", function (method) {
  1943. var self = this;
  1944. this.traitUsers.forEach(function (each) {
  1945. traitMethodChanged(method.selector, null, self, each);
  1946. });
  1947. emit.traitMethodRemoved(method, this);
  1948. });
  1949. function traitBuilder (traitName) {
  1950. return {
  1951. name: traitName,
  1952. make: function () {
  1953. var that = new SmalltalkTrait();
  1954. // TODO deprecation helper; remove
  1955. Object.defineProperty(that, "className", {
  1956. get: function () {
  1957. console.warn("Use of .className deprecated, use .name");
  1958. return that.name;
  1959. },
  1960. set: function (v) {
  1961. console.warn("Use of .className= deprecated, use .name=");
  1962. that.name = v;
  1963. }
  1964. });
  1965. that.name = traitName;
  1966. that.traitUsers = [];
  1967. setupMethods(that);
  1968. return that;
  1969. },
  1970. updateExisting: function (trait) {
  1971. }
  1972. };
  1973. }
  1974. st.addTrait = function (className, category) {
  1975. return buildTraitOrClass(category, traitBuilder(className));
  1976. };
  1977. }
  1978. MethodCompositionBrik.deps = ["methods", "arraySet"];
  1979. function MethodCompositionBrik (brikz, st) {
  1980. var updateMethod = brikz.methods.updateMethod;
  1981. var addElement = brikz.arraySet.addElement;
  1982. var removeElement = brikz.arraySet.removeElement;
  1983. function aliased (selector, method) {
  1984. if (method.selector === selector) return method;
  1985. var result = st.method({
  1986. selector: selector,
  1987. args: method.args,
  1988. protocol: method.protocol,
  1989. source: '"Aliased as ' + selector + '"\n' + method.source,
  1990. messageSends: method.messageSends,
  1991. referencesClasses: method.referencedClasses,
  1992. fn: method.fn
  1993. });
  1994. result.owner = method.owner;
  1995. return result;
  1996. }
  1997. function deleteKeysFrom (keys, obj) {
  1998. keys.forEach(function (each) {
  1999. delete obj[each];
  2000. });
  2001. }
  2002. function fillTraitTransformation (traitTransformation, obj) {
  2003. // assert(Object.getOwnProperties(obj).length === 0)
  2004. var traitMethods = traitTransformation.trait.methods;
  2005. Object.keys(traitMethods).forEach(function (selector) {
  2006. obj[selector] = traitMethods[selector];
  2007. });
  2008. var traitAliases = traitTransformation.aliases;
  2009. if (traitAliases) {
  2010. Object.keys(traitAliases).forEach(function (aliasSelector) {
  2011. var aliasedMethod = traitMethods[traitAliases[aliasSelector]];
  2012. if (aliasedMethod) obj[aliasSelector] = aliased(aliasSelector, aliasedMethod);
  2013. // else delete obj[aliasSelector]; // semantically correct; optimized away
  2014. });
  2015. }
  2016. var traitExclusions = traitTransformation.exclusions;
  2017. if (traitExclusions) {
  2018. deleteKeysFrom(traitExclusions, obj);
  2019. }
  2020. return obj;
  2021. }
  2022. function buildCompositionChain (traitComposition) {
  2023. return traitComposition.reduce(function (soFar, each) {
  2024. return fillTraitTransformation(each, Object.create(soFar));
  2025. }, null);
  2026. }
  2027. st.setTraitComposition = function (traitComposition, traitOrBehavior) {
  2028. var oldLocalMethods = traitOrBehavior.localMethods,
  2029. newLocalMethods = Object.create(buildCompositionChain(traitComposition));
  2030. Object.keys(oldLocalMethods).forEach(function (selector) {
  2031. newLocalMethods[selector] = oldLocalMethods[selector];
  2032. });
  2033. var selector;
  2034. traitOrBehavior.localMethods = newLocalMethods;
  2035. for (selector in newLocalMethods) {
  2036. updateMethod(selector, traitOrBehavior);
  2037. }
  2038. for (selector in oldLocalMethods) {
  2039. updateMethod(selector, traitOrBehavior);
  2040. }
  2041. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  2042. removeElement(each.trait.traitUsers, traitOrBehavior);
  2043. });
  2044. traitOrBehavior.traitComposition = traitComposition && traitComposition.length ? traitComposition : null;
  2045. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  2046. addElement(each.trait.traitUsers, traitOrBehavior);
  2047. });
  2048. };
  2049. function aliasesOfSelector (selector, traitAliases) {
  2050. if (!traitAliases) return [selector];
  2051. var result = Object.keys(traitAliases).filter(function (aliasSelector) {
  2052. return traitAliases[aliasSelector] === selector
  2053. });
  2054. if (!traitAliases[selector]) result.push(selector);
  2055. return result;
  2056. }
  2057. function applyTraitMethodAddition (selector, method, traitTransformation, obj) {
  2058. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2059. changes.forEach(function (aliasSelector) {
  2060. obj[aliasSelector] = aliased(aliasSelector, method);
  2061. });
  2062. var traitExclusions = traitTransformation.exclusions;
  2063. if (traitExclusions) {
  2064. deleteKeysFrom(traitExclusions, obj);
  2065. }
  2066. return changes;
  2067. }
  2068. function applyTraitMethodDeletion (selector, traitTransformation, obj) {
  2069. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2070. deleteKeysFrom(changes, obj);
  2071. return changes;
  2072. }
  2073. function traitMethodChanged (selector, method, trait, traitOrBehavior) {
  2074. var traitComposition = traitOrBehavior.traitComposition,
  2075. chain = traitOrBehavior.localMethods,
  2076. changes = [];
  2077. for (var i = traitComposition.length - 1; i >= 0; --i) {
  2078. chain = Object.getPrototypeOf(chain);
  2079. var traitTransformation = traitComposition[i];
  2080. if (traitTransformation.trait !== trait) continue;
  2081. changes.push.apply(changes, method ?
  2082. applyTraitMethodAddition(selector, method, traitTransformation, chain) :
  2083. applyTraitMethodDeletion(selector, traitTransformation, chain));
  2084. }
  2085. // assert(chain === null);
  2086. changes.forEach(function (each) {
  2087. updateMethod(each, traitOrBehavior);
  2088. });
  2089. }
  2090. this.traitMethodChanged = traitMethodChanged;
  2091. }
  2092. ClassesBrik.deps = ["root", "event", "behaviors", "methods", "arraySet", "smalltalkGlobals"];
  2093. function ClassesBrik (brikz, st) {
  2094. var SmalltalkRoot = brikz.root.Root;
  2095. var coreFns = brikz.root.coreFns;
  2096. var globals = brikz.smalltalkGlobals.globals;
  2097. var SmalltalkObject = brikz.root.Object;
  2098. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  2099. var setupMethods = brikz.methods.setupMethods;
  2100. var removeTraitOrClass = brikz.behaviors.removeTraitOrClass;
  2101. var addElement = brikz.arraySet.addElement;
  2102. var removeElement = brikz.arraySet.removeElement;
  2103. var emit = brikz.event.emit;
  2104. var declareEvent = brikz.event.declareEvent;
  2105. function SmalltalkBehavior () {
  2106. }
  2107. function SmalltalkClass () {
  2108. }
  2109. function SmalltalkMetaclass () {
  2110. }
  2111. coreFns.Behavior = inherits(SmalltalkBehavior, SmalltalkObject);
  2112. coreFns.Class = inherits(SmalltalkClass, SmalltalkBehavior);
  2113. coreFns.Metaclass = inherits(SmalltalkMetaclass, SmalltalkBehavior);
  2114. // Fake root class of the system.
  2115. // Effective superclass of all classes created with `nil subclass: ...`.
  2116. var nilAsClass = this.nilAsClass = {
  2117. fn: SmalltalkRoot,
  2118. a$cls: {fn: SmalltalkClass},
  2119. klass: {fn: SmalltalkClass}
  2120. };
  2121. SmalltalkMetaclass.prototype.meta = true;
  2122. defineMethod(SmalltalkClass, "toString", function () {
  2123. return 'Smalltalk ' + this.name;
  2124. });
  2125. defineMethod(SmalltalkMetaclass, "toString", function () {
  2126. return 'Smalltalk Metaclass ' + this.instanceClass.name;
  2127. });
  2128. declareEvent("classAdded");
  2129. defineMethod(SmalltalkClass, "added", function () {
  2130. addSubclass(this);
  2131. emit.classAdded(this);
  2132. });
  2133. declareEvent("classRemoved");
  2134. defineMethod(SmalltalkClass, "removed", function () {
  2135. emit.classRemoved(this);
  2136. removeSubclass(this);
  2137. });
  2138. declareEvent("behaviorMethodAdded");
  2139. defineMethod(SmalltalkBehavior, "methodAdded", function (method) {
  2140. emit.behaviorMethodAdded(method, this);
  2141. });
  2142. declareEvent("behaviorMethodRemove");
  2143. defineMethod(SmalltalkBehavior, "methodRemoved", function (method) {
  2144. emit.behaviorMethodRemoved(method, this);
  2145. });
  2146. this.bootstrapHierarchy = function () {
  2147. var nilSubclasses = [globals.ProtoObject];
  2148. nilAsClass.a$cls = nilAsClass.klass = globals.Class;
  2149. nilSubclasses.forEach(function (each) {
  2150. each.a$cls.superclass = globals.Class;
  2151. addSubclass(each.a$cls);
  2152. });
  2153. };
  2154. /* Smalltalk class creation. A class is an instance of an automatically
  2155. created metaclass object. Newly created classes (not their metaclass)
  2156. should be added to the system, see smalltalk.addClass().
  2157. Superclass linking is *not* handled here, see api.initialize() */
  2158. function classBuilder (className, superclass, iVarNames, fn) {
  2159. var logicalSuperclass = superclass;
  2160. if (superclass == null || superclass.a$nil) {
  2161. superclass = nilAsClass;
  2162. logicalSuperclass = null;
  2163. }
  2164. function klass () {
  2165. var that = metaclass().instanceClass;
  2166. that.superclass = logicalSuperclass;
  2167. that.fn = fn || inherits(function () {
  2168. }, superclass.fn);
  2169. that.iVarNames = iVarNames || [];
  2170. // TODO deprecation helper; remove
  2171. Object.defineProperty(that, "className", {
  2172. get: function () {
  2173. console.warn("Use of .className deprecated, use .name");
  2174. return that.name;
  2175. },
  2176. set: function (v) {
  2177. console.warn("Use of .className= deprecated, use .name=");
  2178. that.name = v;
  2179. }
  2180. });
  2181. that.name = className;
  2182. that.subclasses = [];
  2183. setupMethods(that);
  2184. return that;
  2185. }
  2186. function metaclass () {
  2187. var that = new SmalltalkMetaclass();
  2188. that.superclass = superclass.a$cls;
  2189. that.fn = inherits(function () {
  2190. }, that.superclass.fn);
  2191. that.iVarNames = [];
  2192. that.instanceClass = new that.fn();
  2193. wireKlass(that);
  2194. setupMethods(that);
  2195. return that;
  2196. }
  2197. return {
  2198. name: className,
  2199. make: klass,
  2200. updateExisting: function (klass) {
  2201. if (klass.superclass == logicalSuperclass && (!fn || fn === klass.fn)) {
  2202. if (iVarNames) klass.iVarNames = iVarNames;
  2203. } else throw new Error("Incompatible change of class: " + klass.name);
  2204. }
  2205. };
  2206. }
  2207. function wireKlass (klass) {
  2208. Object.defineProperty(klass.fn.prototype, "a$cls", {
  2209. value: klass,
  2210. enumerable: false, configurable: true, writable: true
  2211. });
  2212. Object.defineProperty(klass.fn.prototype, "klass", {
  2213. value: klass,
  2214. enumerable: false, configurable: true, writable: true
  2215. });
  2216. }
  2217. this.wireKlass = wireKlass;
  2218. /* Add a class to the system, creating a new one if needed.
  2219. A Package is lazily created if one with given name does not exist. */
  2220. st.addClass = function (className, superclass, iVarNames, category) {
  2221. // While subclassing nil is allowed, it might be an error, so
  2222. // warn about it.
  2223. if (typeof superclass === 'undefined' || superclass && superclass.a$nil) {
  2224. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  2225. }
  2226. return buildTraitOrClass(category, classBuilder(className, superclass, iVarNames, coreFns[className]));
  2227. };
  2228. st.removeClass = removeTraitOrClass;
  2229. function addSubclass (klass) {
  2230. if (klass.superclass) {
  2231. addElement(klass.superclass.subclasses, klass);
  2232. }
  2233. }
  2234. function removeSubclass (klass) {
  2235. if (klass.superclass) {
  2236. removeElement(klass.superclass.subclasses, klass);
  2237. }
  2238. }
  2239. function metaSubclasses (metaclass) {
  2240. return metaclass.instanceClass.subclasses
  2241. .filter(function (each) {
  2242. return !each.meta;
  2243. })
  2244. .map(function (each) {
  2245. return each.a$cls;
  2246. });
  2247. }
  2248. st.metaSubclasses = metaSubclasses;
  2249. st.traverseClassTree = function (klass, fn) {
  2250. var queue = [klass], sentinel = {};
  2251. for (var i = 0; i < queue.length; ++i) {
  2252. var item = queue[i];
  2253. if (fn(item, sentinel) === sentinel) continue;
  2254. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  2255. queue.push.apply(queue, subclasses);
  2256. }
  2257. };
  2258. }
  2259. /* Making smalltalk that can load */
  2260. function configureWithHierarchy (brikz) {
  2261. brikz.traits = TraitsBrik;
  2262. brikz.composition = MethodCompositionBrik;
  2263. brikz.classes = ClassesBrik;
  2264. brikz.rebuild();
  2265. }
  2266. return configureWithHierarchy;
  2267. });
  2268. /* ====================================================================
  2269. |
  2270. | Amber Smalltalk
  2271. | http://amber-lang.net
  2272. |
  2273. ======================================================================
  2274. ======================================================================
  2275. |
  2276. | Copyright (c) 2010-2014
  2277. | Nicolas Petton <petton.nicolas@gmail.com>
  2278. |
  2279. | Copyright (c) 2012-2017
  2280. | The Amber team https://lolg.it/org/amber/members
  2281. | Amber contributors (see /CONTRIBUTORS)
  2282. |
  2283. | Amber is released under the MIT license
  2284. |
  2285. | Permission is hereby granted, free of charge, to any person obtaining
  2286. | a copy of this software and associated documentation files (the
  2287. | 'Software'), to deal in the Software without restriction, including
  2288. | without limitation the rights to use, copy, modify, merge, publish,
  2289. | distribute, sublicense, and/or sell copies of the Software, and to
  2290. | permit persons to whom the Software is furnished to do so, subject to
  2291. | the following conditions:
  2292. |
  2293. | The above copyright notice and this permission notice shall be
  2294. | included in all copies or substantial portions of the Software.
  2295. |
  2296. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  2297. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  2298. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  2299. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  2300. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  2301. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  2302. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  2303. |
  2304. ==================================================================== */
  2305. //jshint eqnull:true
  2306. define('amber/boot',[
  2307. 'require', './kernel-checks', './brikz', './kernel-fundamentals', './kernel-language'
  2308. ], function (require, _, Brikz, configureWithFundamentals, configureWithHierarchy) {
  2309. "use strict";
  2310. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  2311. require(['./kernel-runtime'], resolve, reject);
  2312. });
  2313. function SmalltalkInitBrik (brikz, st) {
  2314. var initialized = false;
  2315. /* Smalltalk initialization. Called on page load */
  2316. st.initialize = function () {
  2317. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  2318. if (initialized) return;
  2319. brikz.classes.bootstrapHierarchy();
  2320. configureWithRuntime(brikz);
  2321. // TODO deprecation helper; remove
  2322. Object.defineProperty(st, "packages", {
  2323. get: function () {
  2324. console.warn("Use of .packages deprecated, use .packageDescriptors");
  2325. return st.packageDescriptors;
  2326. },
  2327. set: function (v) {
  2328. console.trace();
  2329. throw new Error("No one should be setting st.packages directly on initialized Amber.");
  2330. }
  2331. });
  2332. return Promise.resolve(brikz.startImage.run())
  2333. .then(function () {
  2334. initialized = true;
  2335. });
  2336. });
  2337. };
  2338. }
  2339. /* Adds AMD and requirejs related methods to the api */
  2340. function AMDBrik (brikz, st) {
  2341. st.amdRequire = require;
  2342. st.defaultTransportType = st.defaultTransportType || "amd";
  2343. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  2344. }
  2345. /* Defines asReceiver to be present at load time */
  2346. /* (logically it belongs more to PrimitiveBrik) */
  2347. AsReceiverBrik.deps = ["nil"];
  2348. function AsReceiverBrik (brikz, st) {
  2349. var nilAsReceiver = brikz.nil.nilAsReceiver;
  2350. /**
  2351. * This function is used all over the compiled amber code.
  2352. * It takes any value (JavaScript or Smalltalk)
  2353. * and returns a proper Amber Smalltalk receiver.
  2354. *
  2355. * null or undefined -> nilAsReceiver,
  2356. * object having Smalltalk signature -> unchanged,
  2357. * otherwise wrapped foreign (JS) object
  2358. */
  2359. this.asReceiver = function (o) {
  2360. if (o == null) return nilAsReceiver;
  2361. else if (o.a$cls != null) return o;
  2362. else return st.wrapJavaScript(o);
  2363. };
  2364. }
  2365. var api = {};
  2366. var brikz = new Brikz(api);
  2367. configureWithFundamentals(brikz);
  2368. configureWithHierarchy(brikz);
  2369. brikz.asReceiver = AsReceiverBrik;
  2370. brikz.stInit = SmalltalkInitBrik;
  2371. brikz.amd = AMDBrik;
  2372. brikz.rebuild();
  2373. // TODO deprecated, remove
  2374. Object.defineProperty(brikz.smalltalkGlobals.globals, "CharacterArray", {
  2375. enumerable: true,
  2376. configurable: true,
  2377. get: function () {
  2378. return this.String;
  2379. }
  2380. });
  2381. return {
  2382. api: api,
  2383. nilAsReceiver: brikz.nil.nilAsReceiver,
  2384. nilAsValue: brikz.nil.nilAsValue,
  2385. nilAsClass: brikz.classes.nilAsClass,
  2386. globals: brikz.smalltalkGlobals.globals,
  2387. asReceiver: brikz.asReceiver.asReceiver
  2388. };
  2389. });
  2390. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  2391. var globals = boot.globals,
  2392. exports = {},
  2393. api = boot.api,
  2394. nil = boot.nilAsReceiver;
  2395. // API
  2396. exports.popupHelios = function () {
  2397. require(['helios/index'], function (helios) {
  2398. helios.popup();
  2399. }, function (err) {
  2400. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  2401. });
  2402. };
  2403. Object.defineProperty(exports, "api", {
  2404. value: api,
  2405. enumerable: true, configurable: true, writable: false
  2406. });
  2407. Object.defineProperty(exports, "globals", {
  2408. value: globals,
  2409. enumerable: true, configurable: true, writable: false
  2410. });
  2411. Object.defineProperty(exports, "nil", {
  2412. value: nil,
  2413. enumerable: true, configurable: true, writable: false
  2414. });
  2415. function mixinToSettings (source) {
  2416. var settings = globals.SmalltalkSettings;
  2417. Object.keys(source).forEach(function (key) {
  2418. settings[key] = source[key];
  2419. });
  2420. }
  2421. function settingsInLocalStorage () {
  2422. //jshint evil:true
  2423. var storage = 'localStorage' in global && global.localStorage;
  2424. if (storage) {
  2425. var fromStorage;
  2426. try {
  2427. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  2428. } catch (ex) {
  2429. // pass
  2430. }
  2431. mixinToSettings(fromStorage || {});
  2432. if (typeof window !== "undefined") {
  2433. window.addEventListener('beforeunload', function () {
  2434. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  2435. });
  2436. }
  2437. }
  2438. }
  2439. exports.initialize = function (options) {
  2440. return new Promise(function (resolve) {
  2441. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  2442. settingsInLocalStorage();
  2443. mixinToSettings(options || {});
  2444. resolve(api.initialize());
  2445. });
  2446. };
  2447. exports.loadPackages = function (modules) {
  2448. return new Promise(function (resolve, reject) {
  2449. require(modules, resolve, reject);
  2450. }).then(function () {
  2451. return globals.Smalltalk._postLoad();
  2452. });
  2453. };
  2454. // Exports
  2455. return exports;
  2456. });
  2457. define('amber_core/Kernel-Helpers',["amber/boot"], function($boot){"use strict";
  2458. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2459. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2460. var $pkg = $core.addPackage("Kernel-Helpers");
  2461. $pkg.innerEval = function (expr) { return eval(expr); };
  2462. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  2463. $core.addTrait("TSubclassable", "Kernel-Helpers");
  2464. $core.addMethod(
  2465. $core.method({
  2466. selector: "subclass:",
  2467. protocol: "class creation",
  2468. fn: function (aString){
  2469. var self=this,$self=this;
  2470. return $core.withContext(function($ctx1) {
  2471. return $self._subclass_instanceVariableNames_package_(aString,"",nil);
  2472. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString},$globals.TSubclassable)});
  2473. },
  2474. args: ["aString"],
  2475. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: '' package: nil",
  2476. referencedClasses: [],
  2477. messageSends: ["subclass:instanceVariableNames:package:"]
  2478. }),
  2479. $globals.TSubclassable);
  2480. $core.addMethod(
  2481. $core.method({
  2482. selector: "subclass:instanceVariableNames:",
  2483. protocol: "class creation",
  2484. fn: function (aString,anotherString){
  2485. var self=this,$self=this;
  2486. return $core.withContext(function($ctx1) {
  2487. return $self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  2488. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.TSubclassable)});
  2489. },
  2490. args: ["aString", "anotherString"],
  2491. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  2492. referencedClasses: [],
  2493. messageSends: ["subclass:instanceVariableNames:package:"]
  2494. }),
  2495. $globals.TSubclassable);
  2496. $core.addMethod(
  2497. $core.method({
  2498. selector: "subclass:instanceVariableNames:category:",
  2499. protocol: "class creation",
  2500. fn: function (aString,aString2,aString3){
  2501. var self=this,$self=this;
  2502. return $core.withContext(function($ctx1) {
  2503. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2504. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2505. },
  2506. args: ["aString", "aString2", "aString3"],
  2507. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2508. referencedClasses: [],
  2509. messageSends: ["subclass:instanceVariableNames:package:"]
  2510. }),
  2511. $globals.TSubclassable);
  2512. $core.addMethod(
  2513. $core.method({
  2514. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2515. protocol: "class creation",
  2516. fn: function (aString,aString2,classVars,pools,aString3){
  2517. var self=this,$self=this;
  2518. return $core.withContext(function($ctx1) {
  2519. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2520. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  2521. },
  2522. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  2523. source: "subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2524. referencedClasses: [],
  2525. messageSends: ["subclass:instanceVariableNames:package:"]
  2526. }),
  2527. $globals.TSubclassable);
  2528. $core.addMethod(
  2529. $core.method({
  2530. selector: "subclass:instanceVariableNames:package:",
  2531. protocol: "class creation",
  2532. fn: function (aString,aString2,aString3){
  2533. var self=this,$self=this;
  2534. return $core.withContext(function($ctx1) {
  2535. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  2536. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2537. },
  2538. args: ["aString", "aString2", "aString3"],
  2539. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  2540. referencedClasses: ["ClassBuilder"],
  2541. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  2542. }),
  2543. $globals.TSubclassable);
  2544. $core.addMethod(
  2545. $core.method({
  2546. selector: "subclass:uses:",
  2547. protocol: "class creation",
  2548. fn: function (aString,aTraitCompositionDescription){
  2549. var self=this,$self=this;
  2550. return $core.withContext(function($ctx1) {
  2551. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,"",nil);
  2552. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription},$globals.TSubclassable)});
  2553. },
  2554. args: ["aString", "aTraitCompositionDescription"],
  2555. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: '' package: nil",
  2556. referencedClasses: [],
  2557. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2558. }),
  2559. $globals.TSubclassable);
  2560. $core.addMethod(
  2561. $core.method({
  2562. selector: "subclass:uses:instanceVariableNames:",
  2563. protocol: "class creation",
  2564. fn: function (aString,aTraitCompositionDescription,anotherString){
  2565. var self=this,$self=this;
  2566. return $core.withContext(function($ctx1) {
  2567. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  2568. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString},$globals.TSubclassable)});
  2569. },
  2570. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  2571. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: anotherString package: nil",
  2572. referencedClasses: [],
  2573. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2574. }),
  2575. $globals.TSubclassable);
  2576. $core.addMethod(
  2577. $core.method({
  2578. selector: "subclass:uses:instanceVariableNames:category:",
  2579. protocol: "class creation",
  2580. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2581. var self=this,$self=this;
  2582. return $core.withContext(function($ctx1) {
  2583. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2584. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2585. },
  2586. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2587. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3",
  2588. referencedClasses: [],
  2589. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2590. }),
  2591. $globals.TSubclassable);
  2592. $core.addMethod(
  2593. $core.method({
  2594. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2595. protocol: "class creation",
  2596. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  2597. var self=this,$self=this;
  2598. return $core.withContext(function($ctx1) {
  2599. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2600. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  2601. },
  2602. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  2603. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3",
  2604. referencedClasses: [],
  2605. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2606. }),
  2607. $globals.TSubclassable);
  2608. $core.addMethod(
  2609. $core.method({
  2610. selector: "subclass:uses:instanceVariableNames:package:",
  2611. protocol: "class creation",
  2612. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2613. var self=this,$self=this;
  2614. var cls;
  2615. return $core.withContext(function($ctx1) {
  2616. cls=$self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2617. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  2618. return cls;
  2619. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3,cls:cls},$globals.TSubclassable)});
  2620. },
  2621. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2622. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3\x0a\x09| cls |\x0a\x09cls := self subclass: aString instanceVariableNames: aString2 package: aString3.\x0a\x09cls setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ cls",
  2623. referencedClasses: [],
  2624. messageSends: ["subclass:instanceVariableNames:package:", "setTraitComposition:", "asTraitComposition"]
  2625. }),
  2626. $globals.TSubclassable);
  2627. });
  2628. define('amber_core/Kernel-Objects',["amber/boot", "amber_core/Kernel-Helpers"], function($boot){"use strict";
  2629. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2630. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2631. var $pkg = $core.addPackage("Kernel-Objects");
  2632. $pkg.innerEval = function (expr) { return eval(expr); };
  2633. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  2634. $core.addClass("ProtoObject", null, [], "Kernel-Objects");
  2635. $globals.ProtoObject.comment="I implement the basic behavior required for any object in Amber.\x0a\x0aIn most cases, subclassing `ProtoObject` is wrong and `Object` should be used instead. However subclassing `ProtoObject` can be useful in some special cases like proxy implementations.";
  2636. $core.addMethod(
  2637. $core.method({
  2638. selector: "=",
  2639. protocol: "comparing",
  2640. fn: function (anObject){
  2641. var self=this,$self=this;
  2642. return $core.withContext(function($ctx1) {
  2643. return $self.__eq_eq(anObject);
  2644. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  2645. },
  2646. args: ["anObject"],
  2647. source: "= anObject\x0a\x09^ self == anObject",
  2648. referencedClasses: [],
  2649. messageSends: ["=="]
  2650. }),
  2651. $globals.ProtoObject);
  2652. $core.addMethod(
  2653. $core.method({
  2654. selector: "==",
  2655. protocol: "comparing",
  2656. fn: function (anObject){
  2657. var self=this,$self=this;
  2658. return $core.withContext(function($ctx1) {
  2659. return self === anObject;
  2660. return self;
  2661. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  2662. },
  2663. args: ["anObject"],
  2664. source: "== anObject\x0a<inlineJS: 'return self === anObject'>",
  2665. referencedClasses: [],
  2666. messageSends: []
  2667. }),
  2668. $globals.ProtoObject);
  2669. $core.addMethod(
  2670. $core.method({
  2671. selector: "asString",
  2672. protocol: "converting",
  2673. fn: function (){
  2674. var self=this,$self=this;
  2675. return $core.withContext(function($ctx1) {
  2676. return $self._printString();
  2677. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  2678. },
  2679. args: [],
  2680. source: "asString\x0a\x09^ self printString",
  2681. referencedClasses: [],
  2682. messageSends: ["printString"]
  2683. }),
  2684. $globals.ProtoObject);
  2685. $core.addMethod(
  2686. $core.method({
  2687. selector: "class",
  2688. protocol: "accessing",
  2689. fn: function (){
  2690. var self=this,$self=this;
  2691. return $core.withContext(function($ctx1) {
  2692. return $self.a$cls;
  2693. return self;
  2694. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  2695. },
  2696. args: [],
  2697. source: "class\x0a\x09<inlineJS: 'return $self.a$cls'>",
  2698. referencedClasses: [],
  2699. messageSends: []
  2700. }),
  2701. $globals.ProtoObject);
  2702. $core.addMethod(
  2703. $core.method({
  2704. selector: "doesNotUnderstand:",
  2705. protocol: "error handling",
  2706. fn: function (aMessage){
  2707. var self=this,$self=this;
  2708. return $core.withContext(function($ctx1) {
  2709. var $1;
  2710. $1=$recv($globals.MessageNotUnderstood)._new();
  2711. $recv($1)._receiver_(self);
  2712. $recv($1)._message_(aMessage);
  2713. $recv($1)._signal();
  2714. return self;
  2715. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  2716. },
  2717. args: ["aMessage"],
  2718. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  2719. referencedClasses: ["MessageNotUnderstood"],
  2720. messageSends: ["receiver:", "new", "message:", "signal"]
  2721. }),
  2722. $globals.ProtoObject);
  2723. $core.addMethod(
  2724. $core.method({
  2725. selector: "evaluate:on:",
  2726. protocol: "evaluating",
  2727. fn: function (aString,anEvaluator){
  2728. var self=this,$self=this;
  2729. return $core.withContext(function($ctx1) {
  2730. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  2731. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  2732. },
  2733. args: ["aString", "anEvaluator"],
  2734. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  2735. referencedClasses: [],
  2736. messageSends: ["evaluate:receiver:"]
  2737. }),
  2738. $globals.ProtoObject);
  2739. $core.addMethod(
  2740. $core.method({
  2741. selector: "identityHash",
  2742. protocol: "accessing",
  2743. fn: function (){
  2744. var self=this,$self=this;
  2745. return $core.withContext(function($ctx1) {
  2746. self._deprecatedAPI();
  2747. var hash=self.identityHash;
  2748. if (hash) return hash;
  2749. hash=$core.nextId();
  2750. Object.defineProperty(self, 'identityHash', {value:hash});
  2751. return hash;
  2752. ;
  2753. return self;
  2754. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  2755. },
  2756. args: [],
  2757. source: "identityHash\x0a\x09<inlineJS: '\x0a\x09\x09self._deprecatedAPI();\x0a\x09\x09var hash=self.identityHash;\x0a\x09\x09if (hash) return hash;\x0a\x09\x09hash=$core.nextId();\x0a\x09\x09Object.defineProperty(self, ''identityHash'', {value:hash});\x0a\x09\x09return hash;\x0a\x09'>",
  2758. referencedClasses: [],
  2759. messageSends: []
  2760. }),
  2761. $globals.ProtoObject);
  2762. $core.addMethod(
  2763. $core.method({
  2764. selector: "ifNil:",
  2765. protocol: "testing",
  2766. fn: function (aBlock){
  2767. var self=this,$self=this;
  2768. return self;
  2769. },
  2770. args: ["aBlock"],
  2771. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2772. referencedClasses: [],
  2773. messageSends: []
  2774. }),
  2775. $globals.ProtoObject);
  2776. $core.addMethod(
  2777. $core.method({
  2778. selector: "ifNil:ifNotNil:",
  2779. protocol: "testing",
  2780. fn: function (aBlock,anotherBlock){
  2781. var self=this,$self=this;
  2782. return $core.withContext(function($ctx1) {
  2783. return $recv(anotherBlock)._value_(self);
  2784. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2785. },
  2786. args: ["aBlock", "anotherBlock"],
  2787. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2788. referencedClasses: [],
  2789. messageSends: ["value:"]
  2790. }),
  2791. $globals.ProtoObject);
  2792. $core.addMethod(
  2793. $core.method({
  2794. selector: "ifNotNil:",
  2795. protocol: "testing",
  2796. fn: function (aBlock){
  2797. var self=this,$self=this;
  2798. return $core.withContext(function($ctx1) {
  2799. return $recv(aBlock)._value_(self);
  2800. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  2801. },
  2802. args: ["aBlock"],
  2803. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2804. referencedClasses: [],
  2805. messageSends: ["value:"]
  2806. }),
  2807. $globals.ProtoObject);
  2808. $core.addMethod(
  2809. $core.method({
  2810. selector: "ifNotNil:ifNil:",
  2811. protocol: "testing",
  2812. fn: function (aBlock,anotherBlock){
  2813. var self=this,$self=this;
  2814. return $core.withContext(function($ctx1) {
  2815. return $recv(aBlock)._value_(self);
  2816. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2817. },
  2818. args: ["aBlock", "anotherBlock"],
  2819. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2820. referencedClasses: [],
  2821. messageSends: ["value:"]
  2822. }),
  2823. $globals.ProtoObject);
  2824. $core.addMethod(
  2825. $core.method({
  2826. selector: "initialize",
  2827. protocol: "initialization",
  2828. fn: function (){
  2829. var self=this,$self=this;
  2830. return self;
  2831. },
  2832. args: [],
  2833. source: "initialize",
  2834. referencedClasses: [],
  2835. messageSends: []
  2836. }),
  2837. $globals.ProtoObject);
  2838. $core.addMethod(
  2839. $core.method({
  2840. selector: "inspect",
  2841. protocol: "inspecting",
  2842. fn: function (){
  2843. var self=this,$self=this;
  2844. return $core.withContext(function($ctx1) {
  2845. $recv($globals.Inspector)._inspect_(self);
  2846. return self;
  2847. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  2848. },
  2849. args: [],
  2850. source: "inspect\x0a\x09Inspector inspect: self",
  2851. referencedClasses: ["Inspector"],
  2852. messageSends: ["inspect:"]
  2853. }),
  2854. $globals.ProtoObject);
  2855. $core.addMethod(
  2856. $core.method({
  2857. selector: "inspectOn:",
  2858. protocol: "inspecting",
  2859. fn: function (anInspector){
  2860. var self=this,$self=this;
  2861. return self;
  2862. },
  2863. args: ["anInspector"],
  2864. source: "inspectOn: anInspector",
  2865. referencedClasses: [],
  2866. messageSends: []
  2867. }),
  2868. $globals.ProtoObject);
  2869. $core.addMethod(
  2870. $core.method({
  2871. selector: "instVarAt:",
  2872. protocol: "accessing",
  2873. fn: function (aString){
  2874. var self=this,$self=this;
  2875. return $core.withContext(function($ctx1) {
  2876. return $self['@'+aString];
  2877. return self;
  2878. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  2879. },
  2880. args: ["aString"],
  2881. source: "instVarAt: aString\x0a\x09<inlineJS: 'return $self[''@''+aString]'>",
  2882. referencedClasses: [],
  2883. messageSends: []
  2884. }),
  2885. $globals.ProtoObject);
  2886. $core.addMethod(
  2887. $core.method({
  2888. selector: "instVarAt:put:",
  2889. protocol: "accessing",
  2890. fn: function (aString,anObject){
  2891. var self=this,$self=this;
  2892. return $core.withContext(function($ctx1) {
  2893. $self['@' + aString] = anObject;
  2894. return self;
  2895. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  2896. },
  2897. args: ["aString", "anObject"],
  2898. source: "instVarAt: aString put: anObject\x0a\x09<inlineJS: '$self[''@'' + aString] = anObject'>",
  2899. referencedClasses: [],
  2900. messageSends: []
  2901. }),
  2902. $globals.ProtoObject);
  2903. $core.addMethod(
  2904. $core.method({
  2905. selector: "isKindOf:",
  2906. protocol: "testing",
  2907. fn: function (aClass){
  2908. var self=this,$self=this;
  2909. return $core.withContext(function($ctx1) {
  2910. var $1;
  2911. $1=$self._isMemberOf_(aClass);
  2912. if($core.assert($1)){
  2913. return true;
  2914. } else {
  2915. return $recv($self._class())._inheritsFrom_(aClass);
  2916. }
  2917. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  2918. },
  2919. args: ["aClass"],
  2920. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  2921. referencedClasses: [],
  2922. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  2923. }),
  2924. $globals.ProtoObject);
  2925. $core.addMethod(
  2926. $core.method({
  2927. selector: "isNil",
  2928. protocol: "testing",
  2929. fn: function (){
  2930. var self=this,$self=this;
  2931. return false;
  2932. },
  2933. args: [],
  2934. source: "isNil\x0a\x09^ false",
  2935. referencedClasses: [],
  2936. messageSends: []
  2937. }),
  2938. $globals.ProtoObject);
  2939. $core.addMethod(
  2940. $core.method({
  2941. selector: "notNil",
  2942. protocol: "testing",
  2943. fn: function (){
  2944. var self=this,$self=this;
  2945. return $core.withContext(function($ctx1) {
  2946. return $recv($self._isNil())._not();
  2947. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  2948. },
  2949. args: [],
  2950. source: "notNil\x0a\x09^ self isNil not",
  2951. referencedClasses: [],
  2952. messageSends: ["not", "isNil"]
  2953. }),
  2954. $globals.ProtoObject);
  2955. $core.addMethod(
  2956. $core.method({
  2957. selector: "perform:",
  2958. protocol: "message handling",
  2959. fn: function (aString){
  2960. var self=this,$self=this;
  2961. return $core.withContext(function($ctx1) {
  2962. return $self._perform_withArguments_(aString,[]);
  2963. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  2964. },
  2965. args: ["aString"],
  2966. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  2967. referencedClasses: [],
  2968. messageSends: ["perform:withArguments:"]
  2969. }),
  2970. $globals.ProtoObject);
  2971. $core.addMethod(
  2972. $core.method({
  2973. selector: "perform:withArguments:",
  2974. protocol: "message handling",
  2975. fn: function (aString,aCollection){
  2976. var self=this,$self=this;
  2977. return $core.withContext(function($ctx1) {
  2978. return $core.send2(self, aString, aCollection);
  2979. return self;
  2980. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  2981. },
  2982. args: ["aString", "aCollection"],
  2983. source: "perform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return $core.send2(self, aString, aCollection)'>",
  2984. referencedClasses: [],
  2985. messageSends: []
  2986. }),
  2987. $globals.ProtoObject);
  2988. $core.addMethod(
  2989. $core.method({
  2990. selector: "printOn:",
  2991. protocol: "printing",
  2992. fn: function (aStream){
  2993. var self=this,$self=this;
  2994. return $core.withContext(function($ctx1) {
  2995. var $5,$4,$3,$2,$1;
  2996. $5=$self._class();
  2997. $ctx1.sendIdx["class"]=1;
  2998. $4=$recv($5)._name();
  2999. $ctx1.sendIdx["name"]=1;
  3000. $3=$recv($4)._first();
  3001. $2=$recv($3)._isVowel();
  3002. if($core.assert($2)){
  3003. $1="an ";
  3004. } else {
  3005. $1="a ";
  3006. }
  3007. $recv(aStream)._nextPutAll_($1);
  3008. $ctx1.sendIdx["nextPutAll:"]=1;
  3009. $recv(aStream)._nextPutAll_($recv($self._class())._name());
  3010. return self;
  3011. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  3012. },
  3013. args: ["aStream"],
  3014. source: "printOn: aStream\x0a\x09aStream nextPutAll: (self class name first isVowel\x0a\x09\x09ifTrue: [ 'an ' ]\x0a\x09\x09ifFalse: [ 'a ' ]).\x0a\x09aStream nextPutAll: self class name",
  3015. referencedClasses: [],
  3016. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  3017. }),
  3018. $globals.ProtoObject);
  3019. $core.addMethod(
  3020. $core.method({
  3021. selector: "printString",
  3022. protocol: "printing",
  3023. fn: function (){
  3024. var self=this,$self=this;
  3025. return $core.withContext(function($ctx1) {
  3026. return $recv($globals.String)._streamContents_((function(str){
  3027. return $core.withContext(function($ctx2) {
  3028. return $self._printOn_(str);
  3029. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3030. }));
  3031. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  3032. },
  3033. args: [],
  3034. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  3035. referencedClasses: ["String"],
  3036. messageSends: ["streamContents:", "printOn:"]
  3037. }),
  3038. $globals.ProtoObject);
  3039. $core.addMethod(
  3040. $core.method({
  3041. selector: "yourself",
  3042. protocol: "accessing",
  3043. fn: function (){
  3044. var self=this,$self=this;
  3045. return self;
  3046. },
  3047. args: [],
  3048. source: "yourself\x0a\x09^ self",
  3049. referencedClasses: [],
  3050. messageSends: []
  3051. }),
  3052. $globals.ProtoObject);
  3053. $core.addMethod(
  3054. $core.method({
  3055. selector: "~=",
  3056. protocol: "comparing",
  3057. fn: function (anObject){
  3058. var self=this,$self=this;
  3059. return $core.withContext(function($ctx1) {
  3060. var $1;
  3061. $1=$recv($self.__eq(anObject)).__eq(false);
  3062. $ctx1.sendIdx["="]=1;
  3063. return $1;
  3064. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  3065. },
  3066. args: ["anObject"],
  3067. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  3068. referencedClasses: [],
  3069. messageSends: ["="]
  3070. }),
  3071. $globals.ProtoObject);
  3072. $core.addMethod(
  3073. $core.method({
  3074. selector: "~~",
  3075. protocol: "comparing",
  3076. fn: function (anObject){
  3077. var self=this,$self=this;
  3078. return $core.withContext(function($ctx1) {
  3079. return $recv($self.__eq_eq(anObject)).__eq(false);
  3080. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  3081. },
  3082. args: ["anObject"],
  3083. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  3084. referencedClasses: [],
  3085. messageSends: ["=", "=="]
  3086. }),
  3087. $globals.ProtoObject);
  3088. $core.addMethod(
  3089. $core.method({
  3090. selector: "initialize",
  3091. protocol: "initialization",
  3092. fn: function (){
  3093. var self=this,$self=this;
  3094. return self;
  3095. },
  3096. args: [],
  3097. source: "initialize",
  3098. referencedClasses: [],
  3099. messageSends: []
  3100. }),
  3101. $globals.ProtoObject.a$cls);
  3102. $core.addClass("Object", $globals.ProtoObject, [], "Kernel-Objects");
  3103. $globals.Object.comment="**I am the root of the Smalltalk class system**. With the exception of unual subclasses of `ProtoObject`, all other classes in the system are subclasses of me.\x0a\x0aI provide default behavior common to all normal objects (some of it inherited from `ProtoObject`), such as:\x0a\x0a- accessing\x0a- copying\x0a- comparison\x0a- error handling\x0a- message sending\x0a- reflection\x0a\x0aAlso utility messages that all objects should respond to are defined here.\x0a\x0aI have no instance variable.\x0a\x0a##Access\x0a\x0aInstance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `#instanceVariableNames` answers a collection of all instance variable names.\x0aAccessing JavaScript properties of an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.\x0a\x0a##Copying\x0a\x0aCopying an object is handled by `#copy` and `#deepCopy`. The first one performs a shallow copy of the receiver, while the second one performs a deep copy.\x0aThe hook method `#postCopy` can be overriden in subclasses to copy fields as necessary to complete the full copy. It will be sent by the copy of the receiver.\x0a\x0a##Comparison\x0a\x0aI understand equality `#=` and identity `#==` comparison.\x0a\x0a##Error handling\x0a\x0a- `#halt` is the typical message to use for inserting breakpoints during debugging.\x0a- `#error:` throws a generic error exception\x0a- `#doesNotUnderstand:` handles the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message.\x0a\x09Overriding this message can be useful to implement proxies for example.";
  3104. $core.addMethod(
  3105. $core.method({
  3106. selector: "->",
  3107. protocol: "converting",
  3108. fn: function (anObject){
  3109. var self=this,$self=this;
  3110. return $core.withContext(function($ctx1) {
  3111. return $recv($globals.Association)._key_value_(self,anObject);
  3112. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  3113. },
  3114. args: ["anObject"],
  3115. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  3116. referencedClasses: ["Association"],
  3117. messageSends: ["key:value:"]
  3118. }),
  3119. $globals.Object);
  3120. $core.addMethod(
  3121. $core.method({
  3122. selector: "asJSONString",
  3123. protocol: "converting",
  3124. fn: function (){
  3125. var self=this,$self=this;
  3126. return $core.withContext(function($ctx1) {
  3127. return $recv($globals.JSON)._stringify_($self._asJavaScriptObject());
  3128. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  3129. },
  3130. args: [],
  3131. source: "asJSONString\x0a\x09^ JSON stringify: self asJavaScriptObject",
  3132. referencedClasses: ["JSON"],
  3133. messageSends: ["stringify:", "asJavaScriptObject"]
  3134. }),
  3135. $globals.Object);
  3136. $core.addMethod(
  3137. $core.method({
  3138. selector: "asJavaScriptObject",
  3139. protocol: "converting",
  3140. fn: function (){
  3141. var self=this,$self=this;
  3142. var variables;
  3143. return $core.withContext(function($ctx1) {
  3144. variables=$recv($globals.HashedCollection)._new();
  3145. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  3146. return $core.withContext(function($ctx2) {
  3147. return $recv(variables)._at_put_(each,$recv($self._instVarAt_(each))._asJavaScriptObject());
  3148. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3149. }));
  3150. return variables;
  3151. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{variables:variables},$globals.Object)});
  3152. },
  3153. args: [],
  3154. source: "asJavaScriptObject\x0a\x09| variables |\x0a\x09variables := HashedCollection new.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) asJavaScriptObject ].\x0a\x09^ variables",
  3155. referencedClasses: ["HashedCollection"],
  3156. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJavaScriptObject", "instVarAt:"]
  3157. }),
  3158. $globals.Object);
  3159. $core.addMethod(
  3160. $core.method({
  3161. selector: "asJavaScriptSource",
  3162. protocol: "converting",
  3163. fn: function (){
  3164. var self=this,$self=this;
  3165. return $core.withContext(function($ctx1) {
  3166. return $self._asString();
  3167. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Object)});
  3168. },
  3169. args: [],
  3170. source: "asJavaScriptSource\x0a\x09^ self asString",
  3171. referencedClasses: [],
  3172. messageSends: ["asString"]
  3173. }),
  3174. $globals.Object);
  3175. $core.addMethod(
  3176. $core.method({
  3177. selector: "basicAt:",
  3178. protocol: "accessing",
  3179. fn: function (aString){
  3180. var self=this,$self=this;
  3181. return $core.withContext(function($ctx1) {
  3182. return self[aString];
  3183. return self;
  3184. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  3185. },
  3186. args: ["aString"],
  3187. source: "basicAt: aString\x0a\x09<inlineJS: 'return self[aString]'>",
  3188. referencedClasses: [],
  3189. messageSends: []
  3190. }),
  3191. $globals.Object);
  3192. $core.addMethod(
  3193. $core.method({
  3194. selector: "basicAt:put:",
  3195. protocol: "accessing",
  3196. fn: function (aString,anObject){
  3197. var self=this,$self=this;
  3198. return $core.withContext(function($ctx1) {
  3199. return self[aString] = anObject;
  3200. return self;
  3201. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  3202. },
  3203. args: ["aString", "anObject"],
  3204. source: "basicAt: aString put: anObject\x0a\x09<inlineJS: 'return self[aString] = anObject'>",
  3205. referencedClasses: [],
  3206. messageSends: []
  3207. }),
  3208. $globals.Object);
  3209. $core.addMethod(
  3210. $core.method({
  3211. selector: "basicDelete:",
  3212. protocol: "accessing",
  3213. fn: function (aString){
  3214. var self=this,$self=this;
  3215. return $core.withContext(function($ctx1) {
  3216. delete self[aString]; return aString;
  3217. return self;
  3218. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  3219. },
  3220. args: ["aString"],
  3221. source: "basicDelete: aString\x0a\x09<inlineJS: 'delete self[aString]; return aString'>",
  3222. referencedClasses: [],
  3223. messageSends: []
  3224. }),
  3225. $globals.Object);
  3226. $core.addMethod(
  3227. $core.method({
  3228. selector: "basicPerform:",
  3229. protocol: "message handling",
  3230. fn: function (aString){
  3231. var self=this,$self=this;
  3232. return $core.withContext(function($ctx1) {
  3233. return $self._basicPerform_withArguments_(aString,[]);
  3234. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  3235. },
  3236. args: ["aString"],
  3237. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  3238. referencedClasses: [],
  3239. messageSends: ["basicPerform:withArguments:"]
  3240. }),
  3241. $globals.Object);
  3242. $core.addMethod(
  3243. $core.method({
  3244. selector: "basicPerform:withArguments:",
  3245. protocol: "message handling",
  3246. fn: function (aString,aCollection){
  3247. var self=this,$self=this;
  3248. return $core.withContext(function($ctx1) {
  3249. return self[aString].apply(self, aCollection);;
  3250. return self;
  3251. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  3252. },
  3253. args: ["aString", "aCollection"],
  3254. source: "basicPerform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return self[aString].apply(self, aCollection);'>",
  3255. referencedClasses: [],
  3256. messageSends: []
  3257. }),
  3258. $globals.Object);
  3259. $core.addMethod(
  3260. $core.method({
  3261. selector: "browse",
  3262. protocol: "browsing",
  3263. fn: function (){
  3264. var self=this,$self=this;
  3265. return $core.withContext(function($ctx1) {
  3266. $recv($globals.Finder)._findClass_($self._class());
  3267. return self;
  3268. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  3269. },
  3270. args: [],
  3271. source: "browse\x0a\x09Finder findClass: self class",
  3272. referencedClasses: ["Finder"],
  3273. messageSends: ["findClass:", "class"]
  3274. }),
  3275. $globals.Object);
  3276. $core.addMethod(
  3277. $core.method({
  3278. selector: "copy",
  3279. protocol: "copying",
  3280. fn: function (){
  3281. var self=this,$self=this;
  3282. return $core.withContext(function($ctx1) {
  3283. return $recv($self._shallowCopy())._postCopy();
  3284. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  3285. },
  3286. args: [],
  3287. source: "copy\x0a\x09^ self shallowCopy postCopy",
  3288. referencedClasses: [],
  3289. messageSends: ["postCopy", "shallowCopy"]
  3290. }),
  3291. $globals.Object);
  3292. $core.addMethod(
  3293. $core.method({
  3294. selector: "deepCopy",
  3295. protocol: "copying",
  3296. fn: function (){
  3297. var self=this,$self=this;
  3298. return $core.withContext(function($ctx1) {
  3299. var copy = self.a$cls._new();
  3300. Object.keys(self).forEach(function (i) {
  3301. if(/^@.+/.test(i)) {
  3302. copy[i] = $recv(self[i])._deepCopy();
  3303. }
  3304. });
  3305. return copy;
  3306. ;
  3307. return self;
  3308. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  3309. },
  3310. args: [],
  3311. source: "deepCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = $recv(self[i])._deepCopy();\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  3312. referencedClasses: [],
  3313. messageSends: []
  3314. }),
  3315. $globals.Object);
  3316. $core.addMethod(
  3317. $core.method({
  3318. selector: "deprecatedAPI",
  3319. protocol: "error handling",
  3320. fn: function (){
  3321. var self=this,$self=this;
  3322. return $core.withContext(function($ctx1) {
  3323. var $1,$6,$5,$4,$8,$7,$3,$2;
  3324. $1=console;
  3325. $6=$core.getThisContext()._home();
  3326. $ctx1.sendIdx["home"]=1;
  3327. $5=$recv($6)._asString();
  3328. $ctx1.sendIdx["asString"]=1;
  3329. $4=$recv($5).__comma(" is deprecated! (in ");
  3330. $8=$recv($core.getThisContext()._home())._home();
  3331. $ctx1.sendIdx["home"]=2;
  3332. $7=$recv($8)._asString();
  3333. $3=$recv($4).__comma($7);
  3334. $ctx1.sendIdx[","]=2;
  3335. $2=$recv($3).__comma(")");
  3336. $ctx1.sendIdx[","]=1;
  3337. $recv($1)._warn_($2);
  3338. return self;
  3339. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  3340. },
  3341. args: [],
  3342. source: "deprecatedAPI\x0a\x09\x22Just a simple way to deprecate methods.\x0a\x09#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,\x0a\x09but it could in the future.\x22\x0a\x09console warn: thisContext home asString, ' is deprecated! (in ', thisContext home home asString, ')'.",
  3343. referencedClasses: [],
  3344. messageSends: ["warn:", ",", "asString", "home"]
  3345. }),
  3346. $globals.Object);
  3347. $core.addMethod(
  3348. $core.method({
  3349. selector: "deprecatedAPI:",
  3350. protocol: "error handling",
  3351. fn: function (aString){
  3352. var self=this,$self=this;
  3353. return $core.withContext(function($ctx1) {
  3354. var $1,$6,$5,$4,$8,$7,$3,$2;
  3355. $1=console;
  3356. $6=$core.getThisContext()._home();
  3357. $ctx1.sendIdx["home"]=1;
  3358. $5=$recv($6)._asString();
  3359. $ctx1.sendIdx["asString"]=1;
  3360. $4=$recv($5).__comma(" is deprecated! (in ");
  3361. $8=$recv($core.getThisContext()._home())._home();
  3362. $ctx1.sendIdx["home"]=2;
  3363. $7=$recv($8)._asString();
  3364. $3=$recv($4).__comma($7);
  3365. $ctx1.sendIdx[","]=2;
  3366. $2=$recv($3).__comma(")");
  3367. $ctx1.sendIdx[","]=1;
  3368. $recv($1)._warn_($2);
  3369. $ctx1.sendIdx["warn:"]=1;
  3370. $recv(console)._warn_(aString);
  3371. return self;
  3372. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  3373. },
  3374. args: ["aString"],
  3375. source: "deprecatedAPI: aString\x0a\x09\x22Just a simple way to deprecate methods.\x0a\x09#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,\x0a\x09but it could in the future.\x22\x0a\x09console warn: thisContext home asString, ' is deprecated! (in ', thisContext home home asString, ')'.\x0a\x09console warn: aString",
  3376. referencedClasses: [],
  3377. messageSends: ["warn:", ",", "asString", "home"]
  3378. }),
  3379. $globals.Object);
  3380. $core.addMethod(
  3381. $core.method({
  3382. selector: "error:",
  3383. protocol: "error handling",
  3384. fn: function (aString){
  3385. var self=this,$self=this;
  3386. return $core.withContext(function($ctx1) {
  3387. $recv($globals.Error)._signal_(aString);
  3388. return self;
  3389. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  3390. },
  3391. args: ["aString"],
  3392. source: "error: aString\x0a\x09Error signal: aString",
  3393. referencedClasses: ["Error"],
  3394. messageSends: ["signal:"]
  3395. }),
  3396. $globals.Object);
  3397. $core.addMethod(
  3398. $core.method({
  3399. selector: "halt",
  3400. protocol: "error handling",
  3401. fn: function (){
  3402. var self=this,$self=this;
  3403. return $core.withContext(function($ctx1) {
  3404. $recv($globals.Halt)._signal();
  3405. return self;
  3406. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  3407. },
  3408. args: [],
  3409. source: "halt\x0a\x09Halt signal",
  3410. referencedClasses: ["Halt"],
  3411. messageSends: ["signal"]
  3412. }),
  3413. $globals.Object);
  3414. $core.addMethod(
  3415. $core.method({
  3416. selector: "in:",
  3417. protocol: "evaluating",
  3418. fn: function (aValuable){
  3419. var self=this,$self=this;
  3420. return $core.withContext(function($ctx1) {
  3421. return $recv(aValuable)._value_(self);
  3422. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  3423. },
  3424. args: ["aValuable"],
  3425. source: "in: aValuable\x0a\x09^ aValuable value: self",
  3426. referencedClasses: [],
  3427. messageSends: ["value:"]
  3428. }),
  3429. $globals.Object);
  3430. $core.addMethod(
  3431. $core.method({
  3432. selector: "isBehavior",
  3433. protocol: "testing",
  3434. fn: function (){
  3435. var self=this,$self=this;
  3436. return false;
  3437. },
  3438. args: [],
  3439. source: "isBehavior\x0a\x09^ false",
  3440. referencedClasses: [],
  3441. messageSends: []
  3442. }),
  3443. $globals.Object);
  3444. $core.addMethod(
  3445. $core.method({
  3446. selector: "isBoolean",
  3447. protocol: "testing",
  3448. fn: function (){
  3449. var self=this,$self=this;
  3450. return false;
  3451. },
  3452. args: [],
  3453. source: "isBoolean\x0a\x09^ false",
  3454. referencedClasses: [],
  3455. messageSends: []
  3456. }),
  3457. $globals.Object);
  3458. $core.addMethod(
  3459. $core.method({
  3460. selector: "isClass",
  3461. protocol: "testing",
  3462. fn: function (){
  3463. var self=this,$self=this;
  3464. return false;
  3465. },
  3466. args: [],
  3467. source: "isClass\x0a\x09^ false",
  3468. referencedClasses: [],
  3469. messageSends: []
  3470. }),
  3471. $globals.Object);
  3472. $core.addMethod(
  3473. $core.method({
  3474. selector: "isCompiledMethod",
  3475. protocol: "testing",
  3476. fn: function (){
  3477. var self=this,$self=this;
  3478. return false;
  3479. },
  3480. args: [],
  3481. source: "isCompiledMethod\x0a\x09^ false",
  3482. referencedClasses: [],
  3483. messageSends: []
  3484. }),
  3485. $globals.Object);
  3486. $core.addMethod(
  3487. $core.method({
  3488. selector: "isImmutable",
  3489. protocol: "testing",
  3490. fn: function (){
  3491. var self=this,$self=this;
  3492. return false;
  3493. },
  3494. args: [],
  3495. source: "isImmutable\x0a\x09^ false",
  3496. referencedClasses: [],
  3497. messageSends: []
  3498. }),
  3499. $globals.Object);
  3500. $core.addMethod(
  3501. $core.method({
  3502. selector: "isMemberOf:",
  3503. protocol: "testing",
  3504. fn: function (aClass){
  3505. var self=this,$self=this;
  3506. return $core.withContext(function($ctx1) {
  3507. return $recv($self._class()).__eq(aClass);
  3508. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  3509. },
  3510. args: ["aClass"],
  3511. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  3512. referencedClasses: [],
  3513. messageSends: ["=", "class"]
  3514. }),
  3515. $globals.Object);
  3516. $core.addMethod(
  3517. $core.method({
  3518. selector: "isMetaclass",
  3519. protocol: "testing",
  3520. fn: function (){
  3521. var self=this,$self=this;
  3522. return false;
  3523. },
  3524. args: [],
  3525. source: "isMetaclass\x0a\x09^ false",
  3526. referencedClasses: [],
  3527. messageSends: []
  3528. }),
  3529. $globals.Object);
  3530. $core.addMethod(
  3531. $core.method({
  3532. selector: "isNumber",
  3533. protocol: "testing",
  3534. fn: function (){
  3535. var self=this,$self=this;
  3536. return false;
  3537. },
  3538. args: [],
  3539. source: "isNumber\x0a\x09^ false",
  3540. referencedClasses: [],
  3541. messageSends: []
  3542. }),
  3543. $globals.Object);
  3544. $core.addMethod(
  3545. $core.method({
  3546. selector: "isPackage",
  3547. protocol: "testing",
  3548. fn: function (){
  3549. var self=this,$self=this;
  3550. return false;
  3551. },
  3552. args: [],
  3553. source: "isPackage\x0a\x09^ false",
  3554. referencedClasses: [],
  3555. messageSends: []
  3556. }),
  3557. $globals.Object);
  3558. $core.addMethod(
  3559. $core.method({
  3560. selector: "isParseFailure",
  3561. protocol: "testing",
  3562. fn: function (){
  3563. var self=this,$self=this;
  3564. return false;
  3565. },
  3566. args: [],
  3567. source: "isParseFailure\x0a\x09^ false",
  3568. referencedClasses: [],
  3569. messageSends: []
  3570. }),
  3571. $globals.Object);
  3572. $core.addMethod(
  3573. $core.method({
  3574. selector: "isString",
  3575. protocol: "testing",
  3576. fn: function (){
  3577. var self=this,$self=this;
  3578. return false;
  3579. },
  3580. args: [],
  3581. source: "isString\x0a\x09^ false",
  3582. referencedClasses: [],
  3583. messageSends: []
  3584. }),
  3585. $globals.Object);
  3586. $core.addMethod(
  3587. $core.method({
  3588. selector: "isSymbol",
  3589. protocol: "testing",
  3590. fn: function (){
  3591. var self=this,$self=this;
  3592. return false;
  3593. },
  3594. args: [],
  3595. source: "isSymbol\x0a\x09^ false",
  3596. referencedClasses: [],
  3597. messageSends: []
  3598. }),
  3599. $globals.Object);
  3600. $core.addMethod(
  3601. $core.method({
  3602. selector: "postCopy",
  3603. protocol: "copying",
  3604. fn: function (){
  3605. var self=this,$self=this;
  3606. return self;
  3607. },
  3608. args: [],
  3609. source: "postCopy",
  3610. referencedClasses: [],
  3611. messageSends: []
  3612. }),
  3613. $globals.Object);
  3614. $core.addMethod(
  3615. $core.method({
  3616. selector: "putOn:",
  3617. protocol: "streaming",
  3618. fn: function (aStream){
  3619. var self=this,$self=this;
  3620. return $core.withContext(function($ctx1) {
  3621. $recv(aStream)._nextPut_(self);
  3622. return self;
  3623. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  3624. },
  3625. args: ["aStream"],
  3626. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  3627. referencedClasses: [],
  3628. messageSends: ["nextPut:"]
  3629. }),
  3630. $globals.Object);
  3631. $core.addMethod(
  3632. $core.method({
  3633. selector: "respondsTo:",
  3634. protocol: "testing",
  3635. fn: function (aSelector){
  3636. var self=this,$self=this;
  3637. return $core.withContext(function($ctx1) {
  3638. return $recv($self._class())._canUnderstand_(aSelector);
  3639. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  3640. },
  3641. args: ["aSelector"],
  3642. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  3643. referencedClasses: [],
  3644. messageSends: ["canUnderstand:", "class"]
  3645. }),
  3646. $globals.Object);
  3647. $core.addMethod(
  3648. $core.method({
  3649. selector: "shallowCopy",
  3650. protocol: "copying",
  3651. fn: function (){
  3652. var self=this,$self=this;
  3653. return $core.withContext(function($ctx1) {
  3654. var copy = self.a$cls._new();
  3655. Object.keys(self).forEach(function(i) {
  3656. if(/^@.+/.test(i)) {
  3657. copy[i] = self[i];
  3658. }
  3659. });
  3660. return copy;
  3661. ;
  3662. return self;
  3663. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  3664. },
  3665. args: [],
  3666. source: "shallowCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function(i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  3667. referencedClasses: [],
  3668. messageSends: []
  3669. }),
  3670. $globals.Object);
  3671. $core.addMethod(
  3672. $core.method({
  3673. selector: "shouldNotImplement",
  3674. protocol: "error handling",
  3675. fn: function (){
  3676. var self=this,$self=this;
  3677. return $core.withContext(function($ctx1) {
  3678. $self._error_("This method should not be implemented in ".__comma($recv($self._class())._name()));
  3679. return self;
  3680. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  3681. },
  3682. args: [],
  3683. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  3684. referencedClasses: [],
  3685. messageSends: ["error:", ",", "name", "class"]
  3686. }),
  3687. $globals.Object);
  3688. $core.addMethod(
  3689. $core.method({
  3690. selector: "size",
  3691. protocol: "accessing",
  3692. fn: function (){
  3693. var self=this,$self=this;
  3694. return $core.withContext(function($ctx1) {
  3695. $self._error_("Object not indexable");
  3696. return self;
  3697. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  3698. },
  3699. args: [],
  3700. source: "size\x0a\x09self error: 'Object not indexable'",
  3701. referencedClasses: [],
  3702. messageSends: ["error:"]
  3703. }),
  3704. $globals.Object);
  3705. $core.addMethod(
  3706. $core.method({
  3707. selector: "subclassResponsibility",
  3708. protocol: "error handling",
  3709. fn: function (){
  3710. var self=this,$self=this;
  3711. return $core.withContext(function($ctx1) {
  3712. $self._error_("This method is a responsibility of a subclass");
  3713. return self;
  3714. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  3715. },
  3716. args: [],
  3717. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  3718. referencedClasses: [],
  3719. messageSends: ["error:"]
  3720. }),
  3721. $globals.Object);
  3722. $core.addMethod(
  3723. $core.method({
  3724. selector: "value",
  3725. protocol: "evaluating",
  3726. fn: function (){
  3727. var self=this,$self=this;
  3728. return $core.withContext(function($ctx1) {
  3729. return self.valueOf();
  3730. return self;
  3731. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  3732. },
  3733. args: [],
  3734. source: "value\x0a\x09<inlineJS: 'return self.valueOf()'>",
  3735. referencedClasses: [],
  3736. messageSends: []
  3737. }),
  3738. $globals.Object);
  3739. $core.addMethod(
  3740. $core.method({
  3741. selector: "accessorProtocolWith:",
  3742. protocol: "helios",
  3743. fn: function (aGenerator){
  3744. var self=this,$self=this;
  3745. return $core.withContext(function($ctx1) {
  3746. $recv(aGenerator)._accessorProtocolForObject();
  3747. return self;
  3748. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3749. },
  3750. args: ["aGenerator"],
  3751. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  3752. referencedClasses: [],
  3753. messageSends: ["accessorProtocolForObject"]
  3754. }),
  3755. $globals.Object.a$cls);
  3756. $core.addMethod(
  3757. $core.method({
  3758. selector: "accessorsSourceCodesWith:",
  3759. protocol: "helios",
  3760. fn: function (aGenerator){
  3761. var self=this,$self=this;
  3762. return $core.withContext(function($ctx1) {
  3763. $recv(aGenerator)._accessorsForObject();
  3764. return self;
  3765. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3766. },
  3767. args: ["aGenerator"],
  3768. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  3769. referencedClasses: [],
  3770. messageSends: ["accessorsForObject"]
  3771. }),
  3772. $globals.Object.a$cls);
  3773. $core.addMethod(
  3774. $core.method({
  3775. selector: "initialize",
  3776. protocol: "initialization",
  3777. fn: function (){
  3778. var self=this,$self=this;
  3779. return self;
  3780. },
  3781. args: [],
  3782. source: "initialize\x0a\x09\x22no op\x22",
  3783. referencedClasses: [],
  3784. messageSends: []
  3785. }),
  3786. $globals.Object.a$cls);
  3787. $core.addMethod(
  3788. $core.method({
  3789. selector: "initializeProtocolWith:",
  3790. protocol: "helios",
  3791. fn: function (aGenerator){
  3792. var self=this,$self=this;
  3793. return $core.withContext(function($ctx1) {
  3794. $recv(aGenerator)._initializeProtocolForObject();
  3795. return self;
  3796. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3797. },
  3798. args: ["aGenerator"],
  3799. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  3800. referencedClasses: [],
  3801. messageSends: ["initializeProtocolForObject"]
  3802. }),
  3803. $globals.Object.a$cls);
  3804. $core.addMethod(
  3805. $core.method({
  3806. selector: "initializeSourceCodesWith:",
  3807. protocol: "helios",
  3808. fn: function (aGenerator){
  3809. var self=this,$self=this;
  3810. return $core.withContext(function($ctx1) {
  3811. $recv(aGenerator)._initializeForObject();
  3812. return self;
  3813. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3814. },
  3815. args: ["aGenerator"],
  3816. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  3817. referencedClasses: [],
  3818. messageSends: ["initializeForObject"]
  3819. }),
  3820. $globals.Object.a$cls);
  3821. $core.addClass("Boolean", $globals.Object, [], "Kernel-Objects");
  3822. $globals.Boolean.comment="I define the protocol for logic testing operations and conditional control structures for the logical values (see the `controlling` protocol).\x0a\x0aI have two instances, `true` and `false`.\x0a\x0aI am directly mapped to JavaScript Boolean. The `true` and `false` objects are the JavaScript boolean objects.\x0a\x0a## Usage Example:\x0a\x0a aBoolean not ifTrue: [ ... ] ifFalse: [ ... ]";
  3823. $core.addMethod(
  3824. $core.method({
  3825. selector: "&",
  3826. protocol: "controlling",
  3827. fn: function (aBoolean){
  3828. var self=this,$self=this;
  3829. return $core.withContext(function($ctx1) {
  3830. if(self == true) {
  3831. return aBoolean;
  3832. } else {
  3833. return false;
  3834. }
  3835. ;
  3836. return self;
  3837. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  3838. },
  3839. args: ["aBoolean"],
  3840. source: "& aBoolean\x0a\x09<inlineJS: '\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09'>",
  3841. referencedClasses: [],
  3842. messageSends: []
  3843. }),
  3844. $globals.Boolean);
  3845. $core.addMethod(
  3846. $core.method({
  3847. selector: "==",
  3848. protocol: "comparing",
  3849. fn: function (aBoolean){
  3850. var self=this,$self=this;
  3851. return $core.withContext(function($ctx1) {
  3852. if (typeof aBoolean === "boolean") return (self == true) === aBoolean;
  3853. else if (aBoolean != null && typeof aBoolean === "object") return (self == true) === aBoolean.valueOf();
  3854. else return false;;
  3855. return self;
  3856. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  3857. },
  3858. args: ["aBoolean"],
  3859. source: "== aBoolean\x0a<inlineJS: '\x0a\x09if (typeof aBoolean === \x22boolean\x22) return (self == true) === aBoolean;\x0a\x09else if (aBoolean != null && typeof aBoolean === \x22object\x22) return (self == true) === aBoolean.valueOf();\x0a\x09else return false;\x0a'>",
  3860. referencedClasses: [],
  3861. messageSends: []
  3862. }),
  3863. $globals.Boolean);
  3864. $core.addMethod(
  3865. $core.method({
  3866. selector: "and:",
  3867. protocol: "controlling",
  3868. fn: function (aBlock){
  3869. var self=this,$self=this;
  3870. return $core.withContext(function($ctx1) {
  3871. if($core.assert(self)){
  3872. return $recv(aBlock)._value();
  3873. } else {
  3874. return false;
  3875. }
  3876. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  3877. },
  3878. args: ["aBlock"],
  3879. source: "and: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ false ]",
  3880. referencedClasses: [],
  3881. messageSends: ["ifTrue:ifFalse:", "value"]
  3882. }),
  3883. $globals.Boolean);
  3884. $core.addMethod(
  3885. $core.method({
  3886. selector: "asBit",
  3887. protocol: "converting",
  3888. fn: function (){
  3889. var self=this,$self=this;
  3890. return $core.withContext(function($ctx1) {
  3891. if($core.assert(self)){
  3892. return (1);
  3893. } else {
  3894. return (0);
  3895. }
  3896. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  3897. },
  3898. args: [],
  3899. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3900. referencedClasses: [],
  3901. messageSends: ["ifTrue:ifFalse:"]
  3902. }),
  3903. $globals.Boolean);
  3904. $core.addMethod(
  3905. $core.method({
  3906. selector: "asJavaScriptObject",
  3907. protocol: "converting",
  3908. fn: function (){
  3909. var self=this,$self=this;
  3910. return self;
  3911. },
  3912. args: [],
  3913. source: "asJavaScriptObject\x0a\x09^ self",
  3914. referencedClasses: [],
  3915. messageSends: []
  3916. }),
  3917. $globals.Boolean);
  3918. $core.addMethod(
  3919. $core.method({
  3920. selector: "asString",
  3921. protocol: "converting",
  3922. fn: function (){
  3923. var self=this,$self=this;
  3924. return $core.withContext(function($ctx1) {
  3925. return self.toString();
  3926. return self;
  3927. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  3928. },
  3929. args: [],
  3930. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3931. referencedClasses: [],
  3932. messageSends: []
  3933. }),
  3934. $globals.Boolean);
  3935. $core.addMethod(
  3936. $core.method({
  3937. selector: "deepCopy",
  3938. protocol: "copying",
  3939. fn: function (){
  3940. var self=this,$self=this;
  3941. return self;
  3942. },
  3943. args: [],
  3944. source: "deepCopy\x0a\x09^ self",
  3945. referencedClasses: [],
  3946. messageSends: []
  3947. }),
  3948. $globals.Boolean);
  3949. $core.addMethod(
  3950. $core.method({
  3951. selector: "ifFalse:",
  3952. protocol: "controlling",
  3953. fn: function (aBlock){
  3954. var self=this,$self=this;
  3955. return $core.withContext(function($ctx1) {
  3956. return $self._ifTrue_ifFalse_((function(){
  3957. }),aBlock);
  3958. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  3959. },
  3960. args: ["aBlock"],
  3961. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3962. referencedClasses: [],
  3963. messageSends: ["ifTrue:ifFalse:"]
  3964. }),
  3965. $globals.Boolean);
  3966. $core.addMethod(
  3967. $core.method({
  3968. selector: "ifFalse:ifTrue:",
  3969. protocol: "controlling",
  3970. fn: function (aBlock,anotherBlock){
  3971. var self=this,$self=this;
  3972. return $core.withContext(function($ctx1) {
  3973. return $self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3974. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3975. },
  3976. args: ["aBlock", "anotherBlock"],
  3977. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3978. referencedClasses: [],
  3979. messageSends: ["ifTrue:ifFalse:"]
  3980. }),
  3981. $globals.Boolean);
  3982. $core.addMethod(
  3983. $core.method({
  3984. selector: "ifTrue:",
  3985. protocol: "controlling",
  3986. fn: function (aBlock){
  3987. var self=this,$self=this;
  3988. return $core.withContext(function($ctx1) {
  3989. return $self._ifTrue_ifFalse_(aBlock,(function(){
  3990. }));
  3991. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  3992. },
  3993. args: ["aBlock"],
  3994. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3995. referencedClasses: [],
  3996. messageSends: ["ifTrue:ifFalse:"]
  3997. }),
  3998. $globals.Boolean);
  3999. $core.addMethod(
  4000. $core.method({
  4001. selector: "ifTrue:ifFalse:",
  4002. protocol: "controlling",
  4003. fn: function (aBlock,anotherBlock){
  4004. var self=this,$self=this;
  4005. return $core.withContext(function($ctx1) {
  4006. if(self == true) {
  4007. return aBlock._value();
  4008. } else {
  4009. return anotherBlock._value();
  4010. }
  4011. ;
  4012. return self;
  4013. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  4014. },
  4015. args: ["aBlock", "anotherBlock"],
  4016. source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<inlineJS: '\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBlock._value();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock._value();\x0a\x09\x09}\x0a\x09'>",
  4017. referencedClasses: [],
  4018. messageSends: []
  4019. }),
  4020. $globals.Boolean);
  4021. $core.addMethod(
  4022. $core.method({
  4023. selector: "isBoolean",
  4024. protocol: "testing",
  4025. fn: function (){
  4026. var self=this,$self=this;
  4027. return true;
  4028. },
  4029. args: [],
  4030. source: "isBoolean\x0a\x09^ true",
  4031. referencedClasses: [],
  4032. messageSends: []
  4033. }),
  4034. $globals.Boolean);
  4035. $core.addMethod(
  4036. $core.method({
  4037. selector: "isImmutable",
  4038. protocol: "testing",
  4039. fn: function (){
  4040. var self=this,$self=this;
  4041. return true;
  4042. },
  4043. args: [],
  4044. source: "isImmutable\x0a\x09^ true",
  4045. referencedClasses: [],
  4046. messageSends: []
  4047. }),
  4048. $globals.Boolean);
  4049. $core.addMethod(
  4050. $core.method({
  4051. selector: "not",
  4052. protocol: "controlling",
  4053. fn: function (){
  4054. var self=this,$self=this;
  4055. return $core.withContext(function($ctx1) {
  4056. return $self.__eq(false);
  4057. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  4058. },
  4059. args: [],
  4060. source: "not\x0a\x09^ self = false",
  4061. referencedClasses: [],
  4062. messageSends: ["="]
  4063. }),
  4064. $globals.Boolean);
  4065. $core.addMethod(
  4066. $core.method({
  4067. selector: "or:",
  4068. protocol: "controlling",
  4069. fn: function (aBlock){
  4070. var self=this,$self=this;
  4071. return $core.withContext(function($ctx1) {
  4072. if($core.assert(self)){
  4073. return true;
  4074. } else {
  4075. return $recv(aBlock)._value();
  4076. }
  4077. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  4078. },
  4079. args: ["aBlock"],
  4080. source: "or: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: \x22aBlock\x22 [ aBlock value ]",
  4081. referencedClasses: [],
  4082. messageSends: ["ifTrue:ifFalse:", "value"]
  4083. }),
  4084. $globals.Boolean);
  4085. $core.addMethod(
  4086. $core.method({
  4087. selector: "printOn:",
  4088. protocol: "printing",
  4089. fn: function (aStream){
  4090. var self=this,$self=this;
  4091. return $core.withContext(function($ctx1) {
  4092. $recv(aStream)._nextPutAll_($self._asString());
  4093. return self;
  4094. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  4095. },
  4096. args: ["aStream"],
  4097. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4098. referencedClasses: [],
  4099. messageSends: ["nextPutAll:", "asString"]
  4100. }),
  4101. $globals.Boolean);
  4102. $core.addMethod(
  4103. $core.method({
  4104. selector: "shallowCopy",
  4105. protocol: "copying",
  4106. fn: function (){
  4107. var self=this,$self=this;
  4108. return self;
  4109. },
  4110. args: [],
  4111. source: "shallowCopy\x0a\x09^ self",
  4112. referencedClasses: [],
  4113. messageSends: []
  4114. }),
  4115. $globals.Boolean);
  4116. $core.addMethod(
  4117. $core.method({
  4118. selector: "|",
  4119. protocol: "controlling",
  4120. fn: function (aBoolean){
  4121. var self=this,$self=this;
  4122. return $core.withContext(function($ctx1) {
  4123. if(self == true) {
  4124. return true;
  4125. } else {
  4126. return aBoolean;
  4127. }
  4128. ;
  4129. return self;
  4130. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  4131. },
  4132. args: ["aBoolean"],
  4133. source: "| aBoolean\x0a\x09<inlineJS: '\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09'>",
  4134. referencedClasses: [],
  4135. messageSends: []
  4136. }),
  4137. $globals.Boolean);
  4138. $core.addClass("Date", $globals.Object, [], "Kernel-Objects");
  4139. $globals.Date.comment="I am used to work with both dates and times. Therefore `Date today` and `Date now` are both valid in\x0aAmber and answer the same date object.\x0a\x0aDate directly maps to the `Date()` JavaScript constructor, and Amber date objects are JavaScript date objects.\x0a\x0a## API\x0a\x0aThe class-side `instance creation` protocol contains some convenience methods for creating date/time objects such as `#fromSeconds:`.\x0a\x0aArithmetic and comparison is supported (see the `comparing` and `arithmetic` protocols).\x0a\x0aThe `converting` protocol provides convenience methods for various convertions (to numbers, strings, etc.).";
  4140. $core.addMethod(
  4141. $core.method({
  4142. selector: "+",
  4143. protocol: "arithmetic",
  4144. fn: function (aDate){
  4145. var self=this,$self=this;
  4146. return $core.withContext(function($ctx1) {
  4147. return self + aDate;
  4148. return self;
  4149. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  4150. },
  4151. args: ["aDate"],
  4152. source: "+ aDate\x0a\x09<inlineJS: 'return self + aDate'>",
  4153. referencedClasses: [],
  4154. messageSends: []
  4155. }),
  4156. $globals.Date);
  4157. $core.addMethod(
  4158. $core.method({
  4159. selector: "-",
  4160. protocol: "arithmetic",
  4161. fn: function (aDate){
  4162. var self=this,$self=this;
  4163. return $core.withContext(function($ctx1) {
  4164. return self - aDate;
  4165. return self;
  4166. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  4167. },
  4168. args: ["aDate"],
  4169. source: "- aDate\x0a\x09<inlineJS: 'return self - aDate'>",
  4170. referencedClasses: [],
  4171. messageSends: []
  4172. }),
  4173. $globals.Date);
  4174. $core.addMethod(
  4175. $core.method({
  4176. selector: "<",
  4177. protocol: "comparing",
  4178. fn: function (aDate){
  4179. var self=this,$self=this;
  4180. return $core.withContext(function($ctx1) {
  4181. return self < aDate;
  4182. return self;
  4183. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  4184. },
  4185. args: ["aDate"],
  4186. source: "< aDate\x0a\x09<inlineJS: 'return self < aDate'>",
  4187. referencedClasses: [],
  4188. messageSends: []
  4189. }),
  4190. $globals.Date);
  4191. $core.addMethod(
  4192. $core.method({
  4193. selector: "<=",
  4194. protocol: "comparing",
  4195. fn: function (aDate){
  4196. var self=this,$self=this;
  4197. return $core.withContext(function($ctx1) {
  4198. return self <= aDate;
  4199. return self;
  4200. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  4201. },
  4202. args: ["aDate"],
  4203. source: "<= aDate\x0a\x09<inlineJS: 'return self <= aDate'>",
  4204. referencedClasses: [],
  4205. messageSends: []
  4206. }),
  4207. $globals.Date);
  4208. $core.addMethod(
  4209. $core.method({
  4210. selector: "=",
  4211. protocol: "comparing",
  4212. fn: function (aDate){
  4213. var self=this,$self=this;
  4214. return $core.withContext(function($ctx1) {
  4215. var $2,$1,$3;
  4216. $2=$recv(aDate)._class();
  4217. $ctx1.sendIdx["class"]=1;
  4218. $1=$recv($2).__eq_eq($self._class());
  4219. $ctx1.sendIdx["=="]=1;
  4220. return $recv($1)._and_((function(){
  4221. return $core.withContext(function($ctx2) {
  4222. $3=$self._asMilliseconds();
  4223. $ctx2.sendIdx["asMilliseconds"]=1;
  4224. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  4225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4226. }));
  4227. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  4228. },
  4229. args: ["aDate"],
  4230. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  4231. referencedClasses: [],
  4232. messageSends: ["and:", "==", "class", "asMilliseconds"]
  4233. }),
  4234. $globals.Date);
  4235. $core.addMethod(
  4236. $core.method({
  4237. selector: ">",
  4238. protocol: "comparing",
  4239. fn: function (aDate){
  4240. var self=this,$self=this;
  4241. return $core.withContext(function($ctx1) {
  4242. return self > aDate;
  4243. return self;
  4244. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  4245. },
  4246. args: ["aDate"],
  4247. source: "> aDate\x0a\x09<inlineJS: 'return self > aDate'>",
  4248. referencedClasses: [],
  4249. messageSends: []
  4250. }),
  4251. $globals.Date);
  4252. $core.addMethod(
  4253. $core.method({
  4254. selector: ">=",
  4255. protocol: "comparing",
  4256. fn: function (aDate){
  4257. var self=this,$self=this;
  4258. return $core.withContext(function($ctx1) {
  4259. return self >= aDate;
  4260. return self;
  4261. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  4262. },
  4263. args: ["aDate"],
  4264. source: ">= aDate\x0a\x09<inlineJS: 'return self >= aDate'>",
  4265. referencedClasses: [],
  4266. messageSends: []
  4267. }),
  4268. $globals.Date);
  4269. $core.addMethod(
  4270. $core.method({
  4271. selector: "asDateString",
  4272. protocol: "converting",
  4273. fn: function (){
  4274. var self=this,$self=this;
  4275. return $core.withContext(function($ctx1) {
  4276. return self.toDateString();
  4277. return self;
  4278. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  4279. },
  4280. args: [],
  4281. source: "asDateString\x0a\x09<inlineJS: 'return self.toDateString()'>",
  4282. referencedClasses: [],
  4283. messageSends: []
  4284. }),
  4285. $globals.Date);
  4286. $core.addMethod(
  4287. $core.method({
  4288. selector: "asLocaleString",
  4289. protocol: "converting",
  4290. fn: function (){
  4291. var self=this,$self=this;
  4292. return $core.withContext(function($ctx1) {
  4293. return self.toLocaleString();
  4294. return self;
  4295. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  4296. },
  4297. args: [],
  4298. source: "asLocaleString\x0a\x09<inlineJS: 'return self.toLocaleString()'>",
  4299. referencedClasses: [],
  4300. messageSends: []
  4301. }),
  4302. $globals.Date);
  4303. $core.addMethod(
  4304. $core.method({
  4305. selector: "asMilliseconds",
  4306. protocol: "converting",
  4307. fn: function (){
  4308. var self=this,$self=this;
  4309. return $core.withContext(function($ctx1) {
  4310. return $self._time();
  4311. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  4312. },
  4313. args: [],
  4314. source: "asMilliseconds\x0a\x09^ self time",
  4315. referencedClasses: [],
  4316. messageSends: ["time"]
  4317. }),
  4318. $globals.Date);
  4319. $core.addMethod(
  4320. $core.method({
  4321. selector: "asNumber",
  4322. protocol: "converting",
  4323. fn: function (){
  4324. var self=this,$self=this;
  4325. return $core.withContext(function($ctx1) {
  4326. return $self._asMilliseconds();
  4327. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  4328. },
  4329. args: [],
  4330. source: "asNumber\x0a\x09^ self asMilliseconds",
  4331. referencedClasses: [],
  4332. messageSends: ["asMilliseconds"]
  4333. }),
  4334. $globals.Date);
  4335. $core.addMethod(
  4336. $core.method({
  4337. selector: "asString",
  4338. protocol: "converting",
  4339. fn: function (){
  4340. var self=this,$self=this;
  4341. return $core.withContext(function($ctx1) {
  4342. return self.toString();
  4343. return self;
  4344. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  4345. },
  4346. args: [],
  4347. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  4348. referencedClasses: [],
  4349. messageSends: []
  4350. }),
  4351. $globals.Date);
  4352. $core.addMethod(
  4353. $core.method({
  4354. selector: "asTimeString",
  4355. protocol: "converting",
  4356. fn: function (){
  4357. var self=this,$self=this;
  4358. return $core.withContext(function($ctx1) {
  4359. return self.toTimeString();
  4360. return self;
  4361. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  4362. },
  4363. args: [],
  4364. source: "asTimeString\x0a\x09<inlineJS: 'return self.toTimeString()'>",
  4365. referencedClasses: [],
  4366. messageSends: []
  4367. }),
  4368. $globals.Date);
  4369. $core.addMethod(
  4370. $core.method({
  4371. selector: "day",
  4372. protocol: "accessing",
  4373. fn: function (){
  4374. var self=this,$self=this;
  4375. return $core.withContext(function($ctx1) {
  4376. return $self._dayOfWeek();
  4377. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  4378. },
  4379. args: [],
  4380. source: "day\x0a\x09^ self dayOfWeek",
  4381. referencedClasses: [],
  4382. messageSends: ["dayOfWeek"]
  4383. }),
  4384. $globals.Date);
  4385. $core.addMethod(
  4386. $core.method({
  4387. selector: "day:",
  4388. protocol: "accessing",
  4389. fn: function (aNumber){
  4390. var self=this,$self=this;
  4391. return $core.withContext(function($ctx1) {
  4392. $self._dayOfWeek_(aNumber);
  4393. return self;
  4394. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  4395. },
  4396. args: ["aNumber"],
  4397. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  4398. referencedClasses: [],
  4399. messageSends: ["dayOfWeek:"]
  4400. }),
  4401. $globals.Date);
  4402. $core.addMethod(
  4403. $core.method({
  4404. selector: "dayOfMonth",
  4405. protocol: "accessing",
  4406. fn: function (){
  4407. var self=this,$self=this;
  4408. return $core.withContext(function($ctx1) {
  4409. return self.getDate();
  4410. return self;
  4411. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  4412. },
  4413. args: [],
  4414. source: "dayOfMonth\x0a\x09<inlineJS: 'return self.getDate()'>",
  4415. referencedClasses: [],
  4416. messageSends: []
  4417. }),
  4418. $globals.Date);
  4419. $core.addMethod(
  4420. $core.method({
  4421. selector: "dayOfMonth:",
  4422. protocol: "accessing",
  4423. fn: function (aNumber){
  4424. var self=this,$self=this;
  4425. return $core.withContext(function($ctx1) {
  4426. self.setDate(aNumber);
  4427. return self;
  4428. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  4429. },
  4430. args: ["aNumber"],
  4431. source: "dayOfMonth: aNumber\x0a\x09<inlineJS: 'self.setDate(aNumber)'>",
  4432. referencedClasses: [],
  4433. messageSends: []
  4434. }),
  4435. $globals.Date);
  4436. $core.addMethod(
  4437. $core.method({
  4438. selector: "dayOfWeek",
  4439. protocol: "accessing",
  4440. fn: function (){
  4441. var self=this,$self=this;
  4442. return $core.withContext(function($ctx1) {
  4443. return self.getDay() + 1;
  4444. return self;
  4445. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  4446. },
  4447. args: [],
  4448. source: "dayOfWeek\x0a\x09<inlineJS: 'return self.getDay() + 1'>",
  4449. referencedClasses: [],
  4450. messageSends: []
  4451. }),
  4452. $globals.Date);
  4453. $core.addMethod(
  4454. $core.method({
  4455. selector: "dayOfWeek:",
  4456. protocol: "accessing",
  4457. fn: function (aNumber){
  4458. var self=this,$self=this;
  4459. return $core.withContext(function($ctx1) {
  4460. return self.setDay(aNumber - 1);
  4461. return self;
  4462. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  4463. },
  4464. args: ["aNumber"],
  4465. source: "dayOfWeek: aNumber\x0a\x09<inlineJS: 'return self.setDay(aNumber - 1)'>",
  4466. referencedClasses: [],
  4467. messageSends: []
  4468. }),
  4469. $globals.Date);
  4470. $core.addMethod(
  4471. $core.method({
  4472. selector: "hours",
  4473. protocol: "accessing",
  4474. fn: function (){
  4475. var self=this,$self=this;
  4476. return $core.withContext(function($ctx1) {
  4477. return self.getHours();
  4478. return self;
  4479. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  4480. },
  4481. args: [],
  4482. source: "hours\x0a\x09<inlineJS: 'return self.getHours()'>",
  4483. referencedClasses: [],
  4484. messageSends: []
  4485. }),
  4486. $globals.Date);
  4487. $core.addMethod(
  4488. $core.method({
  4489. selector: "hours:",
  4490. protocol: "accessing",
  4491. fn: function (aNumber){
  4492. var self=this,$self=this;
  4493. return $core.withContext(function($ctx1) {
  4494. self.setHours(aNumber);
  4495. return self;
  4496. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  4497. },
  4498. args: ["aNumber"],
  4499. source: "hours: aNumber\x0a\x09<inlineJS: 'self.setHours(aNumber)'>",
  4500. referencedClasses: [],
  4501. messageSends: []
  4502. }),
  4503. $globals.Date);
  4504. $core.addMethod(
  4505. $core.method({
  4506. selector: "milliseconds",
  4507. protocol: "accessing",
  4508. fn: function (){
  4509. var self=this,$self=this;
  4510. return $core.withContext(function($ctx1) {
  4511. return self.getMilliseconds();
  4512. return self;
  4513. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  4514. },
  4515. args: [],
  4516. source: "milliseconds\x0a\x09<inlineJS: 'return self.getMilliseconds()'>",
  4517. referencedClasses: [],
  4518. messageSends: []
  4519. }),
  4520. $globals.Date);
  4521. $core.addMethod(
  4522. $core.method({
  4523. selector: "milliseconds:",
  4524. protocol: "accessing",
  4525. fn: function (aNumber){
  4526. var self=this,$self=this;
  4527. return $core.withContext(function($ctx1) {
  4528. self.setMilliseconds(aNumber);
  4529. return self;
  4530. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  4531. },
  4532. args: ["aNumber"],
  4533. source: "milliseconds: aNumber\x0a\x09<inlineJS: 'self.setMilliseconds(aNumber)'>",
  4534. referencedClasses: [],
  4535. messageSends: []
  4536. }),
  4537. $globals.Date);
  4538. $core.addMethod(
  4539. $core.method({
  4540. selector: "minutes",
  4541. protocol: "accessing",
  4542. fn: function (){
  4543. var self=this,$self=this;
  4544. return $core.withContext(function($ctx1) {
  4545. return self.getMinutes();
  4546. return self;
  4547. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  4548. },
  4549. args: [],
  4550. source: "minutes\x0a\x09<inlineJS: 'return self.getMinutes()'>",
  4551. referencedClasses: [],
  4552. messageSends: []
  4553. }),
  4554. $globals.Date);
  4555. $core.addMethod(
  4556. $core.method({
  4557. selector: "minutes:",
  4558. protocol: "accessing",
  4559. fn: function (aNumber){
  4560. var self=this,$self=this;
  4561. return $core.withContext(function($ctx1) {
  4562. self.setMinutes(aNumber);
  4563. return self;
  4564. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  4565. },
  4566. args: ["aNumber"],
  4567. source: "minutes: aNumber\x0a\x09<inlineJS: 'self.setMinutes(aNumber)'>",
  4568. referencedClasses: [],
  4569. messageSends: []
  4570. }),
  4571. $globals.Date);
  4572. $core.addMethod(
  4573. $core.method({
  4574. selector: "month",
  4575. protocol: "accessing",
  4576. fn: function (){
  4577. var self=this,$self=this;
  4578. return $core.withContext(function($ctx1) {
  4579. return self.getMonth() + 1;
  4580. return self;
  4581. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  4582. },
  4583. args: [],
  4584. source: "month\x0a\x09<inlineJS: 'return self.getMonth() + 1'>",
  4585. referencedClasses: [],
  4586. messageSends: []
  4587. }),
  4588. $globals.Date);
  4589. $core.addMethod(
  4590. $core.method({
  4591. selector: "month:",
  4592. protocol: "accessing",
  4593. fn: function (aNumber){
  4594. var self=this,$self=this;
  4595. return $core.withContext(function($ctx1) {
  4596. self.setMonth(aNumber - 1);
  4597. return self;
  4598. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  4599. },
  4600. args: ["aNumber"],
  4601. source: "month: aNumber\x0a\x09<inlineJS: 'self.setMonth(aNumber - 1)'>",
  4602. referencedClasses: [],
  4603. messageSends: []
  4604. }),
  4605. $globals.Date);
  4606. $core.addMethod(
  4607. $core.method({
  4608. selector: "printOn:",
  4609. protocol: "printing",
  4610. fn: function (aStream){
  4611. var self=this,$self=this;
  4612. return $core.withContext(function($ctx1) {
  4613. $recv(aStream)._nextPutAll_($self._asString());
  4614. return self;
  4615. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  4616. },
  4617. args: ["aStream"],
  4618. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4619. referencedClasses: [],
  4620. messageSends: ["nextPutAll:", "asString"]
  4621. }),
  4622. $globals.Date);
  4623. $core.addMethod(
  4624. $core.method({
  4625. selector: "seconds",
  4626. protocol: "accessing",
  4627. fn: function (){
  4628. var self=this,$self=this;
  4629. return $core.withContext(function($ctx1) {
  4630. return self.getSeconds();
  4631. return self;
  4632. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  4633. },
  4634. args: [],
  4635. source: "seconds\x0a\x09<inlineJS: 'return self.getSeconds()'>",
  4636. referencedClasses: [],
  4637. messageSends: []
  4638. }),
  4639. $globals.Date);
  4640. $core.addMethod(
  4641. $core.method({
  4642. selector: "seconds:",
  4643. protocol: "accessing",
  4644. fn: function (aNumber){
  4645. var self=this,$self=this;
  4646. return $core.withContext(function($ctx1) {
  4647. self.setSeconds(aNumber);
  4648. return self;
  4649. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  4650. },
  4651. args: ["aNumber"],
  4652. source: "seconds: aNumber\x0a\x09<inlineJS: 'self.setSeconds(aNumber)'>",
  4653. referencedClasses: [],
  4654. messageSends: []
  4655. }),
  4656. $globals.Date);
  4657. $core.addMethod(
  4658. $core.method({
  4659. selector: "time",
  4660. protocol: "accessing",
  4661. fn: function (){
  4662. var self=this,$self=this;
  4663. return $core.withContext(function($ctx1) {
  4664. return self.getTime();
  4665. return self;
  4666. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  4667. },
  4668. args: [],
  4669. source: "time\x0a\x09<inlineJS: 'return self.getTime()'>",
  4670. referencedClasses: [],
  4671. messageSends: []
  4672. }),
  4673. $globals.Date);
  4674. $core.addMethod(
  4675. $core.method({
  4676. selector: "time:",
  4677. protocol: "accessing",
  4678. fn: function (aNumber){
  4679. var self=this,$self=this;
  4680. return $core.withContext(function($ctx1) {
  4681. self.setTime(aNumber);
  4682. return self;
  4683. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  4684. },
  4685. args: ["aNumber"],
  4686. source: "time: aNumber\x0a\x09<inlineJS: 'self.setTime(aNumber)'>",
  4687. referencedClasses: [],
  4688. messageSends: []
  4689. }),
  4690. $globals.Date);
  4691. $core.addMethod(
  4692. $core.method({
  4693. selector: "year",
  4694. protocol: "accessing",
  4695. fn: function (){
  4696. var self=this,$self=this;
  4697. return $core.withContext(function($ctx1) {
  4698. return self.getFullYear();
  4699. return self;
  4700. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  4701. },
  4702. args: [],
  4703. source: "year\x0a\x09<inlineJS: 'return self.getFullYear()'>",
  4704. referencedClasses: [],
  4705. messageSends: []
  4706. }),
  4707. $globals.Date);
  4708. $core.addMethod(
  4709. $core.method({
  4710. selector: "year:",
  4711. protocol: "accessing",
  4712. fn: function (aNumber){
  4713. var self=this,$self=this;
  4714. return $core.withContext(function($ctx1) {
  4715. self.setFullYear(aNumber);
  4716. return self;
  4717. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  4718. },
  4719. args: ["aNumber"],
  4720. source: "year: aNumber\x0a\x09<inlineJS: 'self.setFullYear(aNumber)'>",
  4721. referencedClasses: [],
  4722. messageSends: []
  4723. }),
  4724. $globals.Date);
  4725. $core.addMethod(
  4726. $core.method({
  4727. selector: "classTag",
  4728. protocol: "accessing",
  4729. fn: function (){
  4730. var self=this,$self=this;
  4731. return "magnitude";
  4732. },
  4733. args: [],
  4734. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'",
  4735. referencedClasses: [],
  4736. messageSends: []
  4737. }),
  4738. $globals.Date.a$cls);
  4739. $core.addMethod(
  4740. $core.method({
  4741. selector: "fromMilliseconds:",
  4742. protocol: "instance creation",
  4743. fn: function (aNumber){
  4744. var self=this,$self=this;
  4745. return $core.withContext(function($ctx1) {
  4746. return $self._new_(aNumber);
  4747. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4748. },
  4749. args: ["aNumber"],
  4750. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4751. referencedClasses: [],
  4752. messageSends: ["new:"]
  4753. }),
  4754. $globals.Date.a$cls);
  4755. $core.addMethod(
  4756. $core.method({
  4757. selector: "fromSeconds:",
  4758. protocol: "instance creation",
  4759. fn: function (aNumber){
  4760. var self=this,$self=this;
  4761. return $core.withContext(function($ctx1) {
  4762. return $self._fromMilliseconds_($recv(aNumber).__star((1000)));
  4763. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4764. },
  4765. args: ["aNumber"],
  4766. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4767. referencedClasses: [],
  4768. messageSends: ["fromMilliseconds:", "*"]
  4769. }),
  4770. $globals.Date.a$cls);
  4771. $core.addMethod(
  4772. $core.method({
  4773. selector: "fromString:",
  4774. protocol: "instance creation",
  4775. fn: function (aString){
  4776. var self=this,$self=this;
  4777. return $core.withContext(function($ctx1) {
  4778. return $self._new_(aString);
  4779. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.a$cls)});
  4780. },
  4781. args: ["aString"],
  4782. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4783. referencedClasses: [],
  4784. messageSends: ["new:"]
  4785. }),
  4786. $globals.Date.a$cls);
  4787. $core.addMethod(
  4788. $core.method({
  4789. selector: "millisecondsToRun:",
  4790. protocol: "instance creation",
  4791. fn: function (aBlock){
  4792. var self=this,$self=this;
  4793. var t;
  4794. return $core.withContext(function($ctx1) {
  4795. t=$recv($globals.Date)._now();
  4796. $ctx1.sendIdx["now"]=1;
  4797. $recv(aBlock)._value();
  4798. return $recv($recv($globals.Date)._now()).__minus(t);
  4799. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.a$cls)});
  4800. },
  4801. args: ["aBlock"],
  4802. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  4803. referencedClasses: ["Date"],
  4804. messageSends: ["now", "value", "-"]
  4805. }),
  4806. $globals.Date.a$cls);
  4807. $core.addMethod(
  4808. $core.method({
  4809. selector: "new:",
  4810. protocol: "instance creation",
  4811. fn: function (anObject){
  4812. var self=this,$self=this;
  4813. return $core.withContext(function($ctx1) {
  4814. return new Date(anObject);
  4815. return self;
  4816. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.a$cls)});
  4817. },
  4818. args: ["anObject"],
  4819. source: "new: anObject\x0a\x09<inlineJS: 'return new Date(anObject)'>",
  4820. referencedClasses: [],
  4821. messageSends: []
  4822. }),
  4823. $globals.Date.a$cls);
  4824. $core.addMethod(
  4825. $core.method({
  4826. selector: "now",
  4827. protocol: "instance creation",
  4828. fn: function (){
  4829. var self=this,$self=this;
  4830. return $core.withContext(function($ctx1) {
  4831. return $self._today();
  4832. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.a$cls)});
  4833. },
  4834. args: [],
  4835. source: "now\x0a\x09^ self today",
  4836. referencedClasses: [],
  4837. messageSends: ["today"]
  4838. }),
  4839. $globals.Date.a$cls);
  4840. $core.addMethod(
  4841. $core.method({
  4842. selector: "today",
  4843. protocol: "instance creation",
  4844. fn: function (){
  4845. var self=this,$self=this;
  4846. return $core.withContext(function($ctx1) {
  4847. return $self._new();
  4848. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.a$cls)});
  4849. },
  4850. args: [],
  4851. source: "today\x0a\x09^ self new",
  4852. referencedClasses: [],
  4853. messageSends: ["new"]
  4854. }),
  4855. $globals.Date.a$cls);
  4856. $core.addClass("Number", $globals.Object, [], "Kernel-Objects");
  4857. $globals.Number.comment="I am the Amber representation for all numbers.\x0aI am directly mapped to JavaScript Number.\x0a\x0a## API\x0a\x0aI provide all necessary methods for arithmetic operations, comparison, conversion and so on with numbers.\x0a\x0aMy instances can also be used to evaluate a block a fixed number of times:\x0a\x0a\x095 timesRepeat: [ Transcript show: 'This will be printed 5 times'; cr ].\x0a\x09\x0a\x091 to: 5 do: [ :aNumber| Transcript show: aNumber asString; cr ].\x0a\x09\x0a\x091 to: 10 by: 2 do: [ :aNumber| Transcript show: aNumber asString; cr ].";
  4858. $core.addMethod(
  4859. $core.method({
  4860. selector: "&",
  4861. protocol: "converting",
  4862. fn: function (aNumber){
  4863. var self=this,$self=this;
  4864. return $core.withContext(function($ctx1) {
  4865. return self & aNumber;
  4866. return self;
  4867. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  4868. },
  4869. args: ["aNumber"],
  4870. source: "& aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  4871. referencedClasses: [],
  4872. messageSends: []
  4873. }),
  4874. $globals.Number);
  4875. $core.addMethod(
  4876. $core.method({
  4877. selector: "*",
  4878. protocol: "arithmetic",
  4879. fn: function (aNumber){
  4880. var self=this,$self=this;
  4881. return $core.withContext(function($ctx1) {
  4882. return self * aNumber;
  4883. return self;
  4884. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  4885. },
  4886. args: ["aNumber"],
  4887. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self * aNumber'>",
  4888. referencedClasses: [],
  4889. messageSends: []
  4890. }),
  4891. $globals.Number);
  4892. $core.addMethod(
  4893. $core.method({
  4894. selector: "**",
  4895. protocol: "mathematical functions",
  4896. fn: function (exponent){
  4897. var self=this,$self=this;
  4898. return $core.withContext(function($ctx1) {
  4899. return $self._raisedTo_(exponent);
  4900. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  4901. },
  4902. args: ["exponent"],
  4903. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4904. referencedClasses: [],
  4905. messageSends: ["raisedTo:"]
  4906. }),
  4907. $globals.Number);
  4908. $core.addMethod(
  4909. $core.method({
  4910. selector: "+",
  4911. protocol: "arithmetic",
  4912. fn: function (aNumber){
  4913. var self=this,$self=this;
  4914. return $core.withContext(function($ctx1) {
  4915. return self + aNumber;
  4916. return self;
  4917. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  4918. },
  4919. args: ["aNumber"],
  4920. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self + aNumber'>",
  4921. referencedClasses: [],
  4922. messageSends: []
  4923. }),
  4924. $globals.Number);
  4925. $core.addMethod(
  4926. $core.method({
  4927. selector: "-",
  4928. protocol: "arithmetic",
  4929. fn: function (aNumber){
  4930. var self=this,$self=this;
  4931. return $core.withContext(function($ctx1) {
  4932. return self - aNumber;
  4933. return self;
  4934. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  4935. },
  4936. args: ["aNumber"],
  4937. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self - aNumber'>",
  4938. referencedClasses: [],
  4939. messageSends: []
  4940. }),
  4941. $globals.Number);
  4942. $core.addMethod(
  4943. $core.method({
  4944. selector: "/",
  4945. protocol: "arithmetic",
  4946. fn: function (aNumber){
  4947. var self=this,$self=this;
  4948. return $core.withContext(function($ctx1) {
  4949. return self / aNumber;
  4950. return self;
  4951. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  4952. },
  4953. args: ["aNumber"],
  4954. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self / aNumber'>",
  4955. referencedClasses: [],
  4956. messageSends: []
  4957. }),
  4958. $globals.Number);
  4959. $core.addMethod(
  4960. $core.method({
  4961. selector: "//",
  4962. protocol: "arithmetic",
  4963. fn: function (aNumber){
  4964. var self=this,$self=this;
  4965. return $core.withContext(function($ctx1) {
  4966. return $recv($self.__slash(aNumber))._floor();
  4967. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  4968. },
  4969. args: ["aNumber"],
  4970. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4971. referencedClasses: [],
  4972. messageSends: ["floor", "/"]
  4973. }),
  4974. $globals.Number);
  4975. $core.addMethod(
  4976. $core.method({
  4977. selector: "<",
  4978. protocol: "comparing",
  4979. fn: function (aNumber){
  4980. var self=this,$self=this;
  4981. return $core.withContext(function($ctx1) {
  4982. return self < aNumber;
  4983. return self;
  4984. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  4985. },
  4986. args: ["aNumber"],
  4987. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self < aNumber'>",
  4988. referencedClasses: [],
  4989. messageSends: []
  4990. }),
  4991. $globals.Number);
  4992. $core.addMethod(
  4993. $core.method({
  4994. selector: "<=",
  4995. protocol: "comparing",
  4996. fn: function (aNumber){
  4997. var self=this,$self=this;
  4998. return $core.withContext(function($ctx1) {
  4999. return self <= aNumber;
  5000. return self;
  5001. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  5002. },
  5003. args: ["aNumber"],
  5004. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self <= aNumber'>",
  5005. referencedClasses: [],
  5006. messageSends: []
  5007. }),
  5008. $globals.Number);
  5009. $core.addMethod(
  5010. $core.method({
  5011. selector: "==",
  5012. protocol: "comparing",
  5013. fn: function (aNumber){
  5014. var self=this,$self=this;
  5015. return $core.withContext(function($ctx1) {
  5016. if (typeof aNumber === "number") return Number(self) === aNumber;
  5017. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  5018. else return false;;
  5019. return self;
  5020. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  5021. },
  5022. args: ["aNumber"],
  5023. source: "== aNumber\x0a<inlineJS: '\x0a\x09if (typeof aNumber === \x22number\x22) return Number(self) === aNumber;\x0a\x09else if (aNumber != null && typeof aNumber === \x22object\x22) return Number(self) === aNumber.valueOf();\x0a\x09else return false;\x0a'>",
  5024. referencedClasses: [],
  5025. messageSends: []
  5026. }),
  5027. $globals.Number);
  5028. $core.addMethod(
  5029. $core.method({
  5030. selector: ">",
  5031. protocol: "comparing",
  5032. fn: function (aNumber){
  5033. var self=this,$self=this;
  5034. return $core.withContext(function($ctx1) {
  5035. return self > aNumber;
  5036. return self;
  5037. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  5038. },
  5039. args: ["aNumber"],
  5040. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self > aNumber'>",
  5041. referencedClasses: [],
  5042. messageSends: []
  5043. }),
  5044. $globals.Number);
  5045. $core.addMethod(
  5046. $core.method({
  5047. selector: ">=",
  5048. protocol: "comparing",
  5049. fn: function (aNumber){
  5050. var self=this,$self=this;
  5051. return $core.withContext(function($ctx1) {
  5052. return self >= aNumber;
  5053. return self;
  5054. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  5055. },
  5056. args: ["aNumber"],
  5057. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self >= aNumber'>",
  5058. referencedClasses: [],
  5059. messageSends: []
  5060. }),
  5061. $globals.Number);
  5062. $core.addMethod(
  5063. $core.method({
  5064. selector: "@",
  5065. protocol: "converting",
  5066. fn: function (aNumber){
  5067. var self=this,$self=this;
  5068. return $core.withContext(function($ctx1) {
  5069. return $recv($globals.Point)._x_y_(self,aNumber);
  5070. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  5071. },
  5072. args: ["aNumber"],
  5073. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  5074. referencedClasses: ["Point"],
  5075. messageSends: ["x:y:"]
  5076. }),
  5077. $globals.Number);
  5078. $core.addMethod(
  5079. $core.method({
  5080. selector: "\x5c\x5c",
  5081. protocol: "arithmetic",
  5082. fn: function (aNumber){
  5083. var self=this,$self=this;
  5084. return $core.withContext(function($ctx1) {
  5085. return self % aNumber;
  5086. return self;
  5087. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  5088. },
  5089. args: ["aNumber"],
  5090. source: "\x5c\x5c aNumber\x0a\x09<inlineJS: 'return self % aNumber'>",
  5091. referencedClasses: [],
  5092. messageSends: []
  5093. }),
  5094. $globals.Number);
  5095. $core.addMethod(
  5096. $core.method({
  5097. selector: "abs",
  5098. protocol: "arithmetic",
  5099. fn: function (){
  5100. var self=this,$self=this;
  5101. return $core.withContext(function($ctx1) {
  5102. return Math.abs(self);;
  5103. return self;
  5104. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  5105. },
  5106. args: [],
  5107. source: "abs\x0a\x09<inlineJS: 'return Math.abs(self);'>",
  5108. referencedClasses: [],
  5109. messageSends: []
  5110. }),
  5111. $globals.Number);
  5112. $core.addMethod(
  5113. $core.method({
  5114. selector: "arcCos",
  5115. protocol: "mathematical functions",
  5116. fn: function (){
  5117. var self=this,$self=this;
  5118. return $core.withContext(function($ctx1) {
  5119. return Math.acos(self);;
  5120. return self;
  5121. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  5122. },
  5123. args: [],
  5124. source: "arcCos\x0a\x09<inlineJS: 'return Math.acos(self);'>",
  5125. referencedClasses: [],
  5126. messageSends: []
  5127. }),
  5128. $globals.Number);
  5129. $core.addMethod(
  5130. $core.method({
  5131. selector: "arcSin",
  5132. protocol: "mathematical functions",
  5133. fn: function (){
  5134. var self=this,$self=this;
  5135. return $core.withContext(function($ctx1) {
  5136. return Math.asin(self);;
  5137. return self;
  5138. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  5139. },
  5140. args: [],
  5141. source: "arcSin\x0a\x09<inlineJS: 'return Math.asin(self);'>",
  5142. referencedClasses: [],
  5143. messageSends: []
  5144. }),
  5145. $globals.Number);
  5146. $core.addMethod(
  5147. $core.method({
  5148. selector: "arcTan",
  5149. protocol: "mathematical functions",
  5150. fn: function (){
  5151. var self=this,$self=this;
  5152. return $core.withContext(function($ctx1) {
  5153. return Math.atan(self);;
  5154. return self;
  5155. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  5156. },
  5157. args: [],
  5158. source: "arcTan\x0a\x09<inlineJS: 'return Math.atan(self);'>",
  5159. referencedClasses: [],
  5160. messageSends: []
  5161. }),
  5162. $globals.Number);
  5163. $core.addMethod(
  5164. $core.method({
  5165. selector: "arcTan:",
  5166. protocol: "mathematical functions",
  5167. fn: function (aNumber){
  5168. var self=this,$self=this;
  5169. return $core.withContext(function($ctx1) {
  5170. return Math.atan2(self, aNumber);;
  5171. return self;
  5172. }, function($ctx1) {$ctx1.fill(self,"arcTan:",{aNumber:aNumber},$globals.Number)});
  5173. },
  5174. args: ["aNumber"],
  5175. source: "arcTan: aNumber\x0a\x09<inlineJS: 'return Math.atan2(self, aNumber);'>",
  5176. referencedClasses: [],
  5177. messageSends: []
  5178. }),
  5179. $globals.Number);
  5180. $core.addMethod(
  5181. $core.method({
  5182. selector: "asJavaScriptObject",
  5183. protocol: "converting",
  5184. fn: function (){
  5185. var self=this,$self=this;
  5186. return self;
  5187. },
  5188. args: [],
  5189. source: "asJavaScriptObject\x0a\x09^ self",
  5190. referencedClasses: [],
  5191. messageSends: []
  5192. }),
  5193. $globals.Number);
  5194. $core.addMethod(
  5195. $core.method({
  5196. selector: "asJavaScriptSource",
  5197. protocol: "converting",
  5198. fn: function (){
  5199. var self=this,$self=this;
  5200. return $core.withContext(function($ctx1) {
  5201. var $1;
  5202. $1=$recv("(".__comma($self._printString())).__comma(")");
  5203. $ctx1.sendIdx[","]=1;
  5204. return $1;
  5205. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Number)});
  5206. },
  5207. args: [],
  5208. source: "asJavaScriptSource\x0a\x09^ '(', self printString, ')'",
  5209. referencedClasses: [],
  5210. messageSends: [",", "printString"]
  5211. }),
  5212. $globals.Number);
  5213. $core.addMethod(
  5214. $core.method({
  5215. selector: "asNumber",
  5216. protocol: "converting",
  5217. fn: function (){
  5218. var self=this,$self=this;
  5219. return self;
  5220. },
  5221. args: [],
  5222. source: "asNumber\x0a\x09^ self",
  5223. referencedClasses: [],
  5224. messageSends: []
  5225. }),
  5226. $globals.Number);
  5227. $core.addMethod(
  5228. $core.method({
  5229. selector: "asPoint",
  5230. protocol: "converting",
  5231. fn: function (){
  5232. var self=this,$self=this;
  5233. return $core.withContext(function($ctx1) {
  5234. return $recv($globals.Point)._x_y_(self,self);
  5235. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  5236. },
  5237. args: [],
  5238. source: "asPoint\x0a\x09^ Point x: self y: self",
  5239. referencedClasses: ["Point"],
  5240. messageSends: ["x:y:"]
  5241. }),
  5242. $globals.Number);
  5243. $core.addMethod(
  5244. $core.method({
  5245. selector: "asString",
  5246. protocol: "converting",
  5247. fn: function (){
  5248. var self=this,$self=this;
  5249. return $core.withContext(function($ctx1) {
  5250. return String(self);
  5251. return self;
  5252. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  5253. },
  5254. args: [],
  5255. source: "asString\x0a\x09<inlineJS: 'return String(self)'>",
  5256. referencedClasses: [],
  5257. messageSends: []
  5258. }),
  5259. $globals.Number);
  5260. $core.addMethod(
  5261. $core.method({
  5262. selector: "atRandom",
  5263. protocol: "converting",
  5264. fn: function (){
  5265. var self=this,$self=this;
  5266. return $core.withContext(function($ctx1) {
  5267. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  5268. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  5269. },
  5270. args: [],
  5271. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  5272. referencedClasses: ["Random"],
  5273. messageSends: ["+", "truncated", "*", "next", "new"]
  5274. }),
  5275. $globals.Number);
  5276. $core.addMethod(
  5277. $core.method({
  5278. selector: "between:and:",
  5279. protocol: "testing",
  5280. fn: function (min,max){
  5281. var self=this,$self=this;
  5282. return $core.withContext(function($ctx1) {
  5283. return $recv($self.__gt_eq(min))._and_((function(){
  5284. return $core.withContext(function($ctx2) {
  5285. return $self.__lt_eq(max);
  5286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5287. }));
  5288. }, function($ctx1) {$ctx1.fill(self,"between:and:",{min:min,max:max},$globals.Number)});
  5289. },
  5290. args: ["min", "max"],
  5291. source: "between: min and: max\x0a ^ self >= min and: [ self <= max ]",
  5292. referencedClasses: [],
  5293. messageSends: ["and:", ">=", "<="]
  5294. }),
  5295. $globals.Number);
  5296. $core.addMethod(
  5297. $core.method({
  5298. selector: "bitAnd:",
  5299. protocol: "converting",
  5300. fn: function (aNumber){
  5301. var self=this,$self=this;
  5302. return $core.withContext(function($ctx1) {
  5303. return self & aNumber;
  5304. return self;
  5305. }, function($ctx1) {$ctx1.fill(self,"bitAnd:",{aNumber:aNumber},$globals.Number)});
  5306. },
  5307. args: ["aNumber"],
  5308. source: "bitAnd: aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  5309. referencedClasses: [],
  5310. messageSends: []
  5311. }),
  5312. $globals.Number);
  5313. $core.addMethod(
  5314. $core.method({
  5315. selector: "bitNot",
  5316. protocol: "converting",
  5317. fn: function (){
  5318. var self=this,$self=this;
  5319. return $core.withContext(function($ctx1) {
  5320. return ~self;
  5321. return self;
  5322. }, function($ctx1) {$ctx1.fill(self,"bitNot",{},$globals.Number)});
  5323. },
  5324. args: [],
  5325. source: "bitNot\x0a\x09<inlineJS: 'return ~self'>",
  5326. referencedClasses: [],
  5327. messageSends: []
  5328. }),
  5329. $globals.Number);
  5330. $core.addMethod(
  5331. $core.method({
  5332. selector: "bitOr:",
  5333. protocol: "converting",
  5334. fn: function (aNumber){
  5335. var self=this,$self=this;
  5336. return $core.withContext(function($ctx1) {
  5337. return self | aNumber;
  5338. return self;
  5339. }, function($ctx1) {$ctx1.fill(self,"bitOr:",{aNumber:aNumber},$globals.Number)});
  5340. },
  5341. args: ["aNumber"],
  5342. source: "bitOr: aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  5343. referencedClasses: [],
  5344. messageSends: []
  5345. }),
  5346. $globals.Number);
  5347. $core.addMethod(
  5348. $core.method({
  5349. selector: "bitXor:",
  5350. protocol: "converting",
  5351. fn: function (aNumber){
  5352. var self=this,$self=this;
  5353. return $core.withContext(function($ctx1) {
  5354. return self ^ aNumber;
  5355. return self;
  5356. }, function($ctx1) {$ctx1.fill(self,"bitXor:",{aNumber:aNumber},$globals.Number)});
  5357. },
  5358. args: ["aNumber"],
  5359. source: "bitXor: aNumber\x0a\x09<inlineJS: 'return self ^ aNumber'>",
  5360. referencedClasses: [],
  5361. messageSends: []
  5362. }),
  5363. $globals.Number);
  5364. $core.addMethod(
  5365. $core.method({
  5366. selector: "ceiling",
  5367. protocol: "converting",
  5368. fn: function (){
  5369. var self=this,$self=this;
  5370. return $core.withContext(function($ctx1) {
  5371. return Math.ceil(self);;
  5372. return self;
  5373. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  5374. },
  5375. args: [],
  5376. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  5377. referencedClasses: [],
  5378. messageSends: []
  5379. }),
  5380. $globals.Number);
  5381. $core.addMethod(
  5382. $core.method({
  5383. selector: "copy",
  5384. protocol: "copying",
  5385. fn: function (){
  5386. var self=this,$self=this;
  5387. return self;
  5388. },
  5389. args: [],
  5390. source: "copy\x0a\x09^ self",
  5391. referencedClasses: [],
  5392. messageSends: []
  5393. }),
  5394. $globals.Number);
  5395. $core.addMethod(
  5396. $core.method({
  5397. selector: "cos",
  5398. protocol: "mathematical functions",
  5399. fn: function (){
  5400. var self=this,$self=this;
  5401. return $core.withContext(function($ctx1) {
  5402. return Math.cos(self);;
  5403. return self;
  5404. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  5405. },
  5406. args: [],
  5407. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  5408. referencedClasses: [],
  5409. messageSends: []
  5410. }),
  5411. $globals.Number);
  5412. $core.addMethod(
  5413. $core.method({
  5414. selector: "deepCopy",
  5415. protocol: "copying",
  5416. fn: function (){
  5417. var self=this,$self=this;
  5418. return $core.withContext(function($ctx1) {
  5419. return $self._copy();
  5420. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  5421. },
  5422. args: [],
  5423. source: "deepCopy\x0a\x09^ self copy",
  5424. referencedClasses: [],
  5425. messageSends: ["copy"]
  5426. }),
  5427. $globals.Number);
  5428. $core.addMethod(
  5429. $core.method({
  5430. selector: "degreesToRadians",
  5431. protocol: "converting",
  5432. fn: function (){
  5433. var self=this,$self=this;
  5434. return $core.withContext(function($ctx1) {
  5435. return $self.__star($recv($globals.Number)._radiansPerDegree());
  5436. }, function($ctx1) {$ctx1.fill(self,"degreesToRadians",{},$globals.Number)});
  5437. },
  5438. args: [],
  5439. source: "degreesToRadians\x0a\x09^ self * Number radiansPerDegree",
  5440. referencedClasses: ["Number"],
  5441. messageSends: ["*", "radiansPerDegree"]
  5442. }),
  5443. $globals.Number);
  5444. $core.addMethod(
  5445. $core.method({
  5446. selector: "even",
  5447. protocol: "testing",
  5448. fn: function (){
  5449. var self=this,$self=this;
  5450. return $core.withContext(function($ctx1) {
  5451. return (0).__eq($self.__backslash_backslash((2)));
  5452. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  5453. },
  5454. args: [],
  5455. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  5456. referencedClasses: [],
  5457. messageSends: ["=", "\x5c\x5c"]
  5458. }),
  5459. $globals.Number);
  5460. $core.addMethod(
  5461. $core.method({
  5462. selector: "floor",
  5463. protocol: "converting",
  5464. fn: function (){
  5465. var self=this,$self=this;
  5466. return $core.withContext(function($ctx1) {
  5467. return Math.floor(self);;
  5468. return self;
  5469. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  5470. },
  5471. args: [],
  5472. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  5473. referencedClasses: [],
  5474. messageSends: []
  5475. }),
  5476. $globals.Number);
  5477. $core.addMethod(
  5478. $core.method({
  5479. selector: "isImmutable",
  5480. protocol: "testing",
  5481. fn: function (){
  5482. var self=this,$self=this;
  5483. return true;
  5484. },
  5485. args: [],
  5486. source: "isImmutable\x0a\x09^ true",
  5487. referencedClasses: [],
  5488. messageSends: []
  5489. }),
  5490. $globals.Number);
  5491. $core.addMethod(
  5492. $core.method({
  5493. selector: "isNumber",
  5494. protocol: "testing",
  5495. fn: function (){
  5496. var self=this,$self=this;
  5497. return true;
  5498. },
  5499. args: [],
  5500. source: "isNumber\x0a\x09^ true",
  5501. referencedClasses: [],
  5502. messageSends: []
  5503. }),
  5504. $globals.Number);
  5505. $core.addMethod(
  5506. $core.method({
  5507. selector: "isZero",
  5508. protocol: "testing",
  5509. fn: function (){
  5510. var self=this,$self=this;
  5511. return $core.withContext(function($ctx1) {
  5512. return $self.__eq((0));
  5513. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  5514. },
  5515. args: [],
  5516. source: "isZero\x0a\x09^ self = 0",
  5517. referencedClasses: [],
  5518. messageSends: ["="]
  5519. }),
  5520. $globals.Number);
  5521. $core.addMethod(
  5522. $core.method({
  5523. selector: "ln",
  5524. protocol: "mathematical functions",
  5525. fn: function (){
  5526. var self=this,$self=this;
  5527. return $core.withContext(function($ctx1) {
  5528. return Math.log(self);;
  5529. return self;
  5530. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  5531. },
  5532. args: [],
  5533. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  5534. referencedClasses: [],
  5535. messageSends: []
  5536. }),
  5537. $globals.Number);
  5538. $core.addMethod(
  5539. $core.method({
  5540. selector: "ln1p",
  5541. protocol: "mathematical functions",
  5542. fn: function (){
  5543. var self=this,$self=this;
  5544. return $core.withContext(function($ctx1) {
  5545. return Math.log1p(self);;
  5546. return self;
  5547. }, function($ctx1) {$ctx1.fill(self,"ln1p",{},$globals.Number)});
  5548. },
  5549. args: [],
  5550. source: "ln1p\x0a\x09<inlineJS: 'return Math.log1p(self);'>",
  5551. referencedClasses: [],
  5552. messageSends: []
  5553. }),
  5554. $globals.Number);
  5555. $core.addMethod(
  5556. $core.method({
  5557. selector: "log",
  5558. protocol: "mathematical functions",
  5559. fn: function (){
  5560. var self=this,$self=this;
  5561. return $core.withContext(function($ctx1) {
  5562. return Math.log(self) / Math.LN10;;
  5563. return self;
  5564. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  5565. },
  5566. args: [],
  5567. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  5568. referencedClasses: [],
  5569. messageSends: []
  5570. }),
  5571. $globals.Number);
  5572. $core.addMethod(
  5573. $core.method({
  5574. selector: "log:",
  5575. protocol: "mathematical functions",
  5576. fn: function (aNumber){
  5577. var self=this,$self=this;
  5578. return $core.withContext(function($ctx1) {
  5579. return Math.log(self) / Math.log(aNumber);;
  5580. return self;
  5581. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  5582. },
  5583. args: ["aNumber"],
  5584. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  5585. referencedClasses: [],
  5586. messageSends: []
  5587. }),
  5588. $globals.Number);
  5589. $core.addMethod(
  5590. $core.method({
  5591. selector: "max:",
  5592. protocol: "arithmetic",
  5593. fn: function (aNumber){
  5594. var self=this,$self=this;
  5595. return $core.withContext(function($ctx1) {
  5596. return Math.max(self, aNumber);;
  5597. return self;
  5598. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  5599. },
  5600. args: ["aNumber"],
  5601. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  5602. referencedClasses: [],
  5603. messageSends: []
  5604. }),
  5605. $globals.Number);
  5606. $core.addMethod(
  5607. $core.method({
  5608. selector: "min:",
  5609. protocol: "arithmetic",
  5610. fn: function (aNumber){
  5611. var self=this,$self=this;
  5612. return $core.withContext(function($ctx1) {
  5613. return Math.min(self, aNumber);;
  5614. return self;
  5615. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  5616. },
  5617. args: ["aNumber"],
  5618. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  5619. referencedClasses: [],
  5620. messageSends: []
  5621. }),
  5622. $globals.Number);
  5623. $core.addMethod(
  5624. $core.method({
  5625. selector: "min:max:",
  5626. protocol: "arithmetic",
  5627. fn: function (aMin,aMax){
  5628. var self=this,$self=this;
  5629. return $core.withContext(function($ctx1) {
  5630. return $recv($self._min_(aMin))._max_(aMax);
  5631. }, function($ctx1) {$ctx1.fill(self,"min:max:",{aMin:aMin,aMax:aMax},$globals.Number)});
  5632. },
  5633. args: ["aMin", "aMax"],
  5634. source: "min: aMin max: aMax\x0a\x09^ (self min: aMin) max: aMax",
  5635. referencedClasses: [],
  5636. messageSends: ["max:", "min:"]
  5637. }),
  5638. $globals.Number);
  5639. $core.addMethod(
  5640. $core.method({
  5641. selector: "negated",
  5642. protocol: "arithmetic",
  5643. fn: function (){
  5644. var self=this,$self=this;
  5645. return $core.withContext(function($ctx1) {
  5646. return (0).__minus(self);
  5647. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  5648. },
  5649. args: [],
  5650. source: "negated\x0a\x09^ 0 - self",
  5651. referencedClasses: [],
  5652. messageSends: ["-"]
  5653. }),
  5654. $globals.Number);
  5655. $core.addMethod(
  5656. $core.method({
  5657. selector: "negative",
  5658. protocol: "testing",
  5659. fn: function (){
  5660. var self=this,$self=this;
  5661. return $core.withContext(function($ctx1) {
  5662. return $self.__lt((0));
  5663. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  5664. },
  5665. args: [],
  5666. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  5667. referencedClasses: [],
  5668. messageSends: ["<"]
  5669. }),
  5670. $globals.Number);
  5671. $core.addMethod(
  5672. $core.method({
  5673. selector: "odd",
  5674. protocol: "testing",
  5675. fn: function (){
  5676. var self=this,$self=this;
  5677. return $core.withContext(function($ctx1) {
  5678. return $recv($self._even())._not();
  5679. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  5680. },
  5681. args: [],
  5682. source: "odd\x0a\x09^ self even not",
  5683. referencedClasses: [],
  5684. messageSends: ["not", "even"]
  5685. }),
  5686. $globals.Number);
  5687. $core.addMethod(
  5688. $core.method({
  5689. selector: "positive",
  5690. protocol: "testing",
  5691. fn: function (){
  5692. var self=this,$self=this;
  5693. return $core.withContext(function($ctx1) {
  5694. return $self.__gt_eq((0));
  5695. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  5696. },
  5697. args: [],
  5698. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  5699. referencedClasses: [],
  5700. messageSends: [">="]
  5701. }),
  5702. $globals.Number);
  5703. $core.addMethod(
  5704. $core.method({
  5705. selector: "printOn:",
  5706. protocol: "printing",
  5707. fn: function (aStream){
  5708. var self=this,$self=this;
  5709. return $core.withContext(function($ctx1) {
  5710. $recv(aStream)._nextPutAll_($self._asString());
  5711. return self;
  5712. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  5713. },
  5714. args: ["aStream"],
  5715. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  5716. referencedClasses: [],
  5717. messageSends: ["nextPutAll:", "asString"]
  5718. }),
  5719. $globals.Number);
  5720. $core.addMethod(
  5721. $core.method({
  5722. selector: "printShowingDecimalPlaces:",
  5723. protocol: "printing",
  5724. fn: function (placesDesired){
  5725. var self=this,$self=this;
  5726. return $core.withContext(function($ctx1) {
  5727. return self.toFixed(placesDesired);
  5728. return self;
  5729. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  5730. },
  5731. args: ["placesDesired"],
  5732. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  5733. referencedClasses: [],
  5734. messageSends: []
  5735. }),
  5736. $globals.Number);
  5737. $core.addMethod(
  5738. $core.method({
  5739. selector: "printStringBase:",
  5740. protocol: "converting",
  5741. fn: function (aBase){
  5742. var self=this,$self=this;
  5743. return $core.withContext(function($ctx1) {
  5744. return self.toString(aBase);
  5745. return self;
  5746. }, function($ctx1) {$ctx1.fill(self,"printStringBase:",{aBase:aBase},$globals.Number)});
  5747. },
  5748. args: ["aBase"],
  5749. source: "printStringBase: aBase\x0a\x09<inlineJS: 'return self.toString(aBase)'>",
  5750. referencedClasses: [],
  5751. messageSends: []
  5752. }),
  5753. $globals.Number);
  5754. $core.addMethod(
  5755. $core.method({
  5756. selector: "radiansToDegrees",
  5757. protocol: "converting",
  5758. fn: function (){
  5759. var self=this,$self=this;
  5760. return $core.withContext(function($ctx1) {
  5761. return $self.__slash($recv($globals.Number)._radiansPerDegree());
  5762. }, function($ctx1) {$ctx1.fill(self,"radiansToDegrees",{},$globals.Number)});
  5763. },
  5764. args: [],
  5765. source: "radiansToDegrees\x0a\x09^ self / Number radiansPerDegree",
  5766. referencedClasses: ["Number"],
  5767. messageSends: ["/", "radiansPerDegree"]
  5768. }),
  5769. $globals.Number);
  5770. $core.addMethod(
  5771. $core.method({
  5772. selector: "raisedTo:",
  5773. protocol: "mathematical functions",
  5774. fn: function (exponent){
  5775. var self=this,$self=this;
  5776. return $core.withContext(function($ctx1) {
  5777. return Math.pow(self, exponent);;
  5778. return self;
  5779. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  5780. },
  5781. args: ["exponent"],
  5782. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  5783. referencedClasses: [],
  5784. messageSends: []
  5785. }),
  5786. $globals.Number);
  5787. $core.addMethod(
  5788. $core.method({
  5789. selector: "rounded",
  5790. protocol: "converting",
  5791. fn: function (){
  5792. var self=this,$self=this;
  5793. return $core.withContext(function($ctx1) {
  5794. return Math.round(self);;
  5795. return self;
  5796. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  5797. },
  5798. args: [],
  5799. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  5800. referencedClasses: [],
  5801. messageSends: []
  5802. }),
  5803. $globals.Number);
  5804. $core.addMethod(
  5805. $core.method({
  5806. selector: "sign",
  5807. protocol: "mathematical functions",
  5808. fn: function (){
  5809. var self=this,$self=this;
  5810. return $core.withContext(function($ctx1) {
  5811. var $1,$2;
  5812. $1=$self._isZero();
  5813. if($core.assert($1)){
  5814. return (0);
  5815. }
  5816. $2=$self._positive();
  5817. if($core.assert($2)){
  5818. return (1);
  5819. } else {
  5820. return (-1);
  5821. }
  5822. return self;
  5823. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  5824. },
  5825. args: [],
  5826. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  5827. referencedClasses: [],
  5828. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  5829. }),
  5830. $globals.Number);
  5831. $core.addMethod(
  5832. $core.method({
  5833. selector: "sin",
  5834. protocol: "mathematical functions",
  5835. fn: function (){
  5836. var self=this,$self=this;
  5837. return $core.withContext(function($ctx1) {
  5838. return Math.sin(self);;
  5839. return self;
  5840. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  5841. },
  5842. args: [],
  5843. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  5844. referencedClasses: [],
  5845. messageSends: []
  5846. }),
  5847. $globals.Number);
  5848. $core.addMethod(
  5849. $core.method({
  5850. selector: "sqrt",
  5851. protocol: "mathematical functions",
  5852. fn: function (){
  5853. var self=this,$self=this;
  5854. return $core.withContext(function($ctx1) {
  5855. return Math.sqrt(self);
  5856. return self;
  5857. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  5858. },
  5859. args: [],
  5860. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  5861. referencedClasses: [],
  5862. messageSends: []
  5863. }),
  5864. $globals.Number);
  5865. $core.addMethod(
  5866. $core.method({
  5867. selector: "squared",
  5868. protocol: "mathematical functions",
  5869. fn: function (){
  5870. var self=this,$self=this;
  5871. return $core.withContext(function($ctx1) {
  5872. return $self.__star(self);
  5873. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  5874. },
  5875. args: [],
  5876. source: "squared\x0a\x09^ self * self",
  5877. referencedClasses: [],
  5878. messageSends: ["*"]
  5879. }),
  5880. $globals.Number);
  5881. $core.addMethod(
  5882. $core.method({
  5883. selector: "tan",
  5884. protocol: "mathematical functions",
  5885. fn: function (){
  5886. var self=this,$self=this;
  5887. return $core.withContext(function($ctx1) {
  5888. return Math.tan(self);;
  5889. return self;
  5890. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  5891. },
  5892. args: [],
  5893. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  5894. referencedClasses: [],
  5895. messageSends: []
  5896. }),
  5897. $globals.Number);
  5898. $core.addMethod(
  5899. $core.method({
  5900. selector: "timesRepeat:",
  5901. protocol: "enumerating",
  5902. fn: function (aBlock){
  5903. var self=this,$self=this;
  5904. var count;
  5905. return $core.withContext(function($ctx1) {
  5906. count=(1);
  5907. $recv((function(){
  5908. return $core.withContext(function($ctx2) {
  5909. return $recv(count).__gt(self);
  5910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5911. }))._whileFalse_((function(){
  5912. return $core.withContext(function($ctx2) {
  5913. $recv(aBlock)._value();
  5914. count=$recv(count).__plus((1));
  5915. return count;
  5916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5917. }));
  5918. return self;
  5919. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  5920. },
  5921. args: ["aBlock"],
  5922. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  5923. referencedClasses: [],
  5924. messageSends: ["whileFalse:", ">", "value", "+"]
  5925. }),
  5926. $globals.Number);
  5927. $core.addMethod(
  5928. $core.method({
  5929. selector: "to:",
  5930. protocol: "converting",
  5931. fn: function (aNumber){
  5932. var self=this,$self=this;
  5933. var array,first,last,count;
  5934. return $core.withContext(function($ctx1) {
  5935. first=$self._truncated();
  5936. $ctx1.sendIdx["truncated"]=1;
  5937. last=$recv($recv(aNumber)._truncated()).__plus((1));
  5938. $ctx1.sendIdx["+"]=1;
  5939. count=(1);
  5940. array=$recv($globals.Array)._new();
  5941. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  5942. return $core.withContext(function($ctx2) {
  5943. $recv(array)._at_put_(count,first);
  5944. count=$recv(count).__plus((1));
  5945. $ctx2.sendIdx["+"]=2;
  5946. first=$recv(first).__plus((1));
  5947. return first;
  5948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5949. }));
  5950. return array;
  5951. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  5952. },
  5953. args: ["aNumber"],
  5954. source: "to: aNumber\x0a\x09| array first last count |\x0a\x09first := self truncated.\x0a\x09last := aNumber truncated + 1.\x0a\x09count := 1.\x0a\x09array := Array new.\x0a\x09(last - first) timesRepeat: [\x0a\x09\x09array at: count put: first.\x0a\x09\x09count := count + 1.\x0a\x09\x09first := first + 1 ].\x0a\x09^ array",
  5955. referencedClasses: ["Array"],
  5956. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  5957. }),
  5958. $globals.Number);
  5959. $core.addMethod(
  5960. $core.method({
  5961. selector: "to:by:",
  5962. protocol: "converting",
  5963. fn: function (stop,step){
  5964. var self=this,$self=this;
  5965. var array,value,pos;
  5966. return $core.withContext(function($ctx1) {
  5967. var $1,$2;
  5968. value=self;
  5969. array=$recv($globals.Array)._new();
  5970. pos=(1);
  5971. $1=$recv(step).__eq((0));
  5972. if($core.assert($1)){
  5973. $self._error_("step must be non-zero");
  5974. }
  5975. $2=$recv(step).__lt((0));
  5976. if($core.assert($2)){
  5977. $recv((function(){
  5978. return $core.withContext(function($ctx2) {
  5979. return $recv(value).__gt_eq(stop);
  5980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5981. }))._whileTrue_((function(){
  5982. return $core.withContext(function($ctx2) {
  5983. $recv(array)._at_put_(pos,value);
  5984. $ctx2.sendIdx["at:put:"]=1;
  5985. pos=$recv(pos).__plus((1));
  5986. $ctx2.sendIdx["+"]=1;
  5987. value=$recv(value).__plus(step);
  5988. $ctx2.sendIdx["+"]=2;
  5989. return value;
  5990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5991. }));
  5992. $ctx1.sendIdx["whileTrue:"]=1;
  5993. } else {
  5994. $recv((function(){
  5995. return $core.withContext(function($ctx2) {
  5996. return $recv(value).__lt_eq(stop);
  5997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5998. }))._whileTrue_((function(){
  5999. return $core.withContext(function($ctx2) {
  6000. $recv(array)._at_put_(pos,value);
  6001. pos=$recv(pos).__plus((1));
  6002. $ctx2.sendIdx["+"]=3;
  6003. value=$recv(value).__plus(step);
  6004. return value;
  6005. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6006. }));
  6007. }
  6008. return array;
  6009. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  6010. },
  6011. args: ["stop", "step"],
  6012. source: "to: stop by: step\x0a\x09| array value pos |\x0a\x09value := self.\x0a\x09array := Array new.\x0a\x09pos := 1.\x0a\x09step = 0 ifTrue: [ self error: 'step must be non-zero' ].\x0a\x09step < 0\x0a\x09\x09ifTrue: [ [ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step ]]\x0a\x09\x09ifFalse: [ [ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step ]].\x0a\x09^ array",
  6013. referencedClasses: ["Array"],
  6014. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  6015. }),
  6016. $globals.Number);
  6017. $core.addMethod(
  6018. $core.method({
  6019. selector: "to:by:do:",
  6020. protocol: "enumerating",
  6021. fn: function (stop,step,aBlock){
  6022. var self=this,$self=this;
  6023. var value;
  6024. return $core.withContext(function($ctx1) {
  6025. var $1,$2;
  6026. value=self;
  6027. $1=$recv(step).__eq((0));
  6028. if($core.assert($1)){
  6029. $self._error_("step must be non-zero");
  6030. }
  6031. $2=$recv(step).__lt((0));
  6032. if($core.assert($2)){
  6033. $recv((function(){
  6034. return $core.withContext(function($ctx2) {
  6035. return $recv(value).__gt_eq(stop);
  6036. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  6037. }))._whileTrue_((function(){
  6038. return $core.withContext(function($ctx2) {
  6039. $recv(aBlock)._value_(value);
  6040. $ctx2.sendIdx["value:"]=1;
  6041. value=$recv(value).__plus(step);
  6042. $ctx2.sendIdx["+"]=1;
  6043. return value;
  6044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  6045. }));
  6046. $ctx1.sendIdx["whileTrue:"]=1;
  6047. } else {
  6048. $recv((function(){
  6049. return $core.withContext(function($ctx2) {
  6050. return $recv(value).__lt_eq(stop);
  6051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  6052. }))._whileTrue_((function(){
  6053. return $core.withContext(function($ctx2) {
  6054. $recv(aBlock)._value_(value);
  6055. value=$recv(value).__plus(step);
  6056. return value;
  6057. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6058. }));
  6059. }
  6060. return self;
  6061. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  6062. },
  6063. args: ["stop", "step", "aBlock"],
  6064. source: "to: stop by: step do: aBlock\x0a\x09| value |\x0a\x09value := self.\x0a\x09step = 0 ifTrue: [ self error: 'step must be non-zero' ].\x0a\x09step < 0\x0a\x09\x09ifTrue: [ [ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step ]]\x0a\x09\x09ifFalse: [ [ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step ]]",
  6065. referencedClasses: [],
  6066. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  6067. }),
  6068. $globals.Number);
  6069. $core.addMethod(
  6070. $core.method({
  6071. selector: "to:do:",
  6072. protocol: "enumerating",
  6073. fn: function (stop,aBlock){
  6074. var self=this,$self=this;
  6075. var nextValue;
  6076. return $core.withContext(function($ctx1) {
  6077. nextValue=self;
  6078. $recv((function(){
  6079. return $core.withContext(function($ctx2) {
  6080. return $recv(nextValue).__lt_eq(stop);
  6081. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6082. }))._whileTrue_((function(){
  6083. return $core.withContext(function($ctx2) {
  6084. $recv(aBlock)._value_(nextValue);
  6085. nextValue=$recv(nextValue).__plus((1));
  6086. return nextValue;
  6087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6088. }));
  6089. return self;
  6090. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  6091. },
  6092. args: ["stop", "aBlock"],
  6093. source: "to: stop do: aBlock\x0a\x09\x22Evaluate aBlock for each number from self to aNumber.\x22\x0a\x09| nextValue |\x0a\x09nextValue := self.\x0a\x09[ nextValue <= stop ]\x0a\x09\x09whileTrue:\x0a\x09\x09\x09[ aBlock value: nextValue.\x0a\x09\x09\x09nextValue := nextValue + 1 ]",
  6094. referencedClasses: [],
  6095. messageSends: ["whileTrue:", "<=", "value:", "+"]
  6096. }),
  6097. $globals.Number);
  6098. $core.addMethod(
  6099. $core.method({
  6100. selector: "truncated",
  6101. protocol: "converting",
  6102. fn: function (){
  6103. var self=this,$self=this;
  6104. return $core.withContext(function($ctx1) {
  6105. if(self >= 0) {
  6106. return Math.floor(self);
  6107. } else {
  6108. return Math.floor(self * (-1)) * (-1);
  6109. };
  6110. ;
  6111. return self;
  6112. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  6113. },
  6114. args: [],
  6115. source: "truncated\x0a\x09<inlineJS: '\x0a\x09\x09if(self >= 0) {\x0a\x09\x09\x09return Math.floor(self);\x0a\x09\x09} else {\x0a\x09\x09\x09return Math.floor(self * (-1)) * (-1);\x0a\x09\x09};\x0a\x09'>",
  6116. referencedClasses: [],
  6117. messageSends: []
  6118. }),
  6119. $globals.Number);
  6120. $core.addMethod(
  6121. $core.method({
  6122. selector: "|",
  6123. protocol: "converting",
  6124. fn: function (aNumber){
  6125. var self=this,$self=this;
  6126. return $core.withContext(function($ctx1) {
  6127. return self | aNumber;
  6128. return self;
  6129. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  6130. },
  6131. args: ["aNumber"],
  6132. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  6133. referencedClasses: [],
  6134. messageSends: []
  6135. }),
  6136. $globals.Number);
  6137. $core.addMethod(
  6138. $core.method({
  6139. selector: "classTag",
  6140. protocol: "accessing",
  6141. fn: function (){
  6142. var self=this,$self=this;
  6143. return "magnitude";
  6144. },
  6145. args: [],
  6146. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'",
  6147. referencedClasses: [],
  6148. messageSends: []
  6149. }),
  6150. $globals.Number.a$cls);
  6151. $core.addMethod(
  6152. $core.method({
  6153. selector: "e",
  6154. protocol: "instance creation",
  6155. fn: function (){
  6156. var self=this,$self=this;
  6157. return $core.withContext(function($ctx1) {
  6158. return Math.E;;
  6159. return self;
  6160. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.a$cls)});
  6161. },
  6162. args: [],
  6163. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  6164. referencedClasses: [],
  6165. messageSends: []
  6166. }),
  6167. $globals.Number.a$cls);
  6168. $core.addMethod(
  6169. $core.method({
  6170. selector: "pi",
  6171. protocol: "instance creation",
  6172. fn: function (){
  6173. var self=this,$self=this;
  6174. return $core.withContext(function($ctx1) {
  6175. return Math.PI;
  6176. return self;
  6177. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.a$cls)});
  6178. },
  6179. args: [],
  6180. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  6181. referencedClasses: [],
  6182. messageSends: []
  6183. }),
  6184. $globals.Number.a$cls);
  6185. $core.addMethod(
  6186. $core.method({
  6187. selector: "radiansPerDegree",
  6188. protocol: "instance creation",
  6189. fn: function (){
  6190. var self=this,$self=this;
  6191. return $core.withContext(function($ctx1) {
  6192. return $recv($self._pi()).__slash((180));
  6193. }, function($ctx1) {$ctx1.fill(self,"radiansPerDegree",{},$globals.Number.a$cls)});
  6194. },
  6195. args: [],
  6196. source: "radiansPerDegree\x0a\x09^ (self pi) / 180",
  6197. referencedClasses: [],
  6198. messageSends: ["/", "pi"]
  6199. }),
  6200. $globals.Number.a$cls);
  6201. $core.addClass("Point", $globals.Object, ["x", "y"], "Kernel-Objects");
  6202. $globals.Point.comment="I represent an x-y pair of numbers usually designating a geometric coordinate.\x0a\x0a## API\x0a\x0aInstances are traditionally created using the binary `#@` message to a number:\x0a\x0a\x09100@120\x0a\x0aPoints can then be arithmetically manipulated:\x0a\x0a\x09100@100 + (10@10)\x0a\x0a...or for example:\x0a\x0a\x09(100@100) * 2\x0a\x0a**NOTE:** Creating a point with a negative y-value will need a space after `@` in order to avoid a parsing error:\x0a\x0a\x09100@ -100 \x22but 100@-100 would not parse\x22";
  6203. $core.addMethod(
  6204. $core.method({
  6205. selector: "*",
  6206. protocol: "arithmetic",
  6207. fn: function (aPoint){
  6208. var self=this,$self=this;
  6209. return $core.withContext(function($ctx1) {
  6210. var $2,$4,$3,$1,$6,$5;
  6211. $2=$self._x();
  6212. $ctx1.sendIdx["x"]=1;
  6213. $4=$recv(aPoint)._asPoint();
  6214. $ctx1.sendIdx["asPoint"]=1;
  6215. $3=$recv($4)._x();
  6216. $1=$recv($2).__star($3);
  6217. $ctx1.sendIdx["*"]=1;
  6218. $6=$self._y();
  6219. $ctx1.sendIdx["y"]=1;
  6220. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  6221. return $recv($globals.Point)._x_y_($1,$5);
  6222. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  6223. },
  6224. args: ["aPoint"],
  6225. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  6226. referencedClasses: ["Point"],
  6227. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  6228. }),
  6229. $globals.Point);
  6230. $core.addMethod(
  6231. $core.method({
  6232. selector: "+",
  6233. protocol: "arithmetic",
  6234. fn: function (aPoint){
  6235. var self=this,$self=this;
  6236. return $core.withContext(function($ctx1) {
  6237. var $2,$4,$3,$1,$6,$5;
  6238. $2=$self._x();
  6239. $ctx1.sendIdx["x"]=1;
  6240. $4=$recv(aPoint)._asPoint();
  6241. $ctx1.sendIdx["asPoint"]=1;
  6242. $3=$recv($4)._x();
  6243. $1=$recv($2).__plus($3);
  6244. $ctx1.sendIdx["+"]=1;
  6245. $6=$self._y();
  6246. $ctx1.sendIdx["y"]=1;
  6247. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  6248. return $recv($globals.Point)._x_y_($1,$5);
  6249. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  6250. },
  6251. args: ["aPoint"],
  6252. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  6253. referencedClasses: ["Point"],
  6254. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  6255. }),
  6256. $globals.Point);
  6257. $core.addMethod(
  6258. $core.method({
  6259. selector: "-",
  6260. protocol: "arithmetic",
  6261. fn: function (aPoint){
  6262. var self=this,$self=this;
  6263. return $core.withContext(function($ctx1) {
  6264. var $2,$4,$3,$1,$6,$5;
  6265. $2=$self._x();
  6266. $ctx1.sendIdx["x"]=1;
  6267. $4=$recv(aPoint)._asPoint();
  6268. $ctx1.sendIdx["asPoint"]=1;
  6269. $3=$recv($4)._x();
  6270. $1=$recv($2).__minus($3);
  6271. $ctx1.sendIdx["-"]=1;
  6272. $6=$self._y();
  6273. $ctx1.sendIdx["y"]=1;
  6274. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  6275. return $recv($globals.Point)._x_y_($1,$5);
  6276. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  6277. },
  6278. args: ["aPoint"],
  6279. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  6280. referencedClasses: ["Point"],
  6281. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  6282. }),
  6283. $globals.Point);
  6284. $core.addMethod(
  6285. $core.method({
  6286. selector: "/",
  6287. protocol: "arithmetic",
  6288. fn: function (aPoint){
  6289. var self=this,$self=this;
  6290. return $core.withContext(function($ctx1) {
  6291. var $2,$4,$3,$1,$6,$5;
  6292. $2=$self._x();
  6293. $ctx1.sendIdx["x"]=1;
  6294. $4=$recv(aPoint)._asPoint();
  6295. $ctx1.sendIdx["asPoint"]=1;
  6296. $3=$recv($4)._x();
  6297. $1=$recv($2).__slash($3);
  6298. $ctx1.sendIdx["/"]=1;
  6299. $6=$self._y();
  6300. $ctx1.sendIdx["y"]=1;
  6301. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  6302. return $recv($globals.Point)._x_y_($1,$5);
  6303. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  6304. },
  6305. args: ["aPoint"],
  6306. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  6307. referencedClasses: ["Point"],
  6308. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  6309. }),
  6310. $globals.Point);
  6311. $core.addMethod(
  6312. $core.method({
  6313. selector: "<",
  6314. protocol: "comparing",
  6315. fn: function (aPoint){
  6316. var self=this,$self=this;
  6317. return $core.withContext(function($ctx1) {
  6318. var $2,$1,$3;
  6319. $2=$self._x();
  6320. $ctx1.sendIdx["x"]=1;
  6321. $1=$recv($2).__lt($recv(aPoint)._x());
  6322. $ctx1.sendIdx["<"]=1;
  6323. return $recv($1)._and_((function(){
  6324. return $core.withContext(function($ctx2) {
  6325. $3=$self._y();
  6326. $ctx2.sendIdx["y"]=1;
  6327. return $recv($3).__lt($recv(aPoint)._y());
  6328. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6329. }));
  6330. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  6331. },
  6332. args: ["aPoint"],
  6333. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  6334. referencedClasses: [],
  6335. messageSends: ["and:", "<", "x", "y"]
  6336. }),
  6337. $globals.Point);
  6338. $core.addMethod(
  6339. $core.method({
  6340. selector: "<=",
  6341. protocol: "comparing",
  6342. fn: function (aPoint){
  6343. var self=this,$self=this;
  6344. return $core.withContext(function($ctx1) {
  6345. var $2,$1,$3;
  6346. $2=$self._x();
  6347. $ctx1.sendIdx["x"]=1;
  6348. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  6349. $ctx1.sendIdx["<="]=1;
  6350. return $recv($1)._and_((function(){
  6351. return $core.withContext(function($ctx2) {
  6352. $3=$self._y();
  6353. $ctx2.sendIdx["y"]=1;
  6354. return $recv($3).__lt_eq($recv(aPoint)._y());
  6355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6356. }));
  6357. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  6358. },
  6359. args: ["aPoint"],
  6360. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  6361. referencedClasses: [],
  6362. messageSends: ["and:", "<=", "x", "y"]
  6363. }),
  6364. $globals.Point);
  6365. $core.addMethod(
  6366. $core.method({
  6367. selector: "=",
  6368. protocol: "comparing",
  6369. fn: function (aPoint){
  6370. var self=this,$self=this;
  6371. return $core.withContext(function($ctx1) {
  6372. var $2,$1,$4,$3,$6,$5;
  6373. $2=$recv(aPoint)._class();
  6374. $ctx1.sendIdx["class"]=1;
  6375. $1=$recv($2).__eq($self._class());
  6376. $ctx1.sendIdx["="]=1;
  6377. return $recv($1)._and_((function(){
  6378. return $core.withContext(function($ctx2) {
  6379. $4=$recv(aPoint)._x();
  6380. $ctx2.sendIdx["x"]=1;
  6381. $3=$recv($4).__eq($self._x());
  6382. $ctx2.sendIdx["="]=2;
  6383. $6=$recv(aPoint)._y();
  6384. $ctx2.sendIdx["y"]=1;
  6385. $5=$recv($6).__eq($self._y());
  6386. return $recv($3).__and($5);
  6387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6388. }));
  6389. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  6390. },
  6391. args: ["aPoint"],
  6392. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  6393. referencedClasses: [],
  6394. messageSends: ["and:", "=", "class", "&", "x", "y"]
  6395. }),
  6396. $globals.Point);
  6397. $core.addMethod(
  6398. $core.method({
  6399. selector: ">",
  6400. protocol: "comparing",
  6401. fn: function (aPoint){
  6402. var self=this,$self=this;
  6403. return $core.withContext(function($ctx1) {
  6404. var $2,$1,$3;
  6405. $2=$self._x();
  6406. $ctx1.sendIdx["x"]=1;
  6407. $1=$recv($2).__gt($recv(aPoint)._x());
  6408. $ctx1.sendIdx[">"]=1;
  6409. return $recv($1)._and_((function(){
  6410. return $core.withContext(function($ctx2) {
  6411. $3=$self._y();
  6412. $ctx2.sendIdx["y"]=1;
  6413. return $recv($3).__gt($recv(aPoint)._y());
  6414. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6415. }));
  6416. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  6417. },
  6418. args: ["aPoint"],
  6419. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  6420. referencedClasses: [],
  6421. messageSends: ["and:", ">", "x", "y"]
  6422. }),
  6423. $globals.Point);
  6424. $core.addMethod(
  6425. $core.method({
  6426. selector: ">=",
  6427. protocol: "comparing",
  6428. fn: function (aPoint){
  6429. var self=this,$self=this;
  6430. return $core.withContext(function($ctx1) {
  6431. var $2,$1,$3;
  6432. $2=$self._x();
  6433. $ctx1.sendIdx["x"]=1;
  6434. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  6435. $ctx1.sendIdx[">="]=1;
  6436. return $recv($1)._and_((function(){
  6437. return $core.withContext(function($ctx2) {
  6438. $3=$self._y();
  6439. $ctx2.sendIdx["y"]=1;
  6440. return $recv($3).__gt_eq($recv(aPoint)._y());
  6441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6442. }));
  6443. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  6444. },
  6445. args: ["aPoint"],
  6446. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  6447. referencedClasses: [],
  6448. messageSends: ["and:", ">=", "x", "y"]
  6449. }),
  6450. $globals.Point);
  6451. $core.addMethod(
  6452. $core.method({
  6453. selector: "angle",
  6454. protocol: "geometry",
  6455. fn: function (){
  6456. var self=this,$self=this;
  6457. return $core.withContext(function($ctx1) {
  6458. return $recv($self._y())._arcTan_($self._x());
  6459. }, function($ctx1) {$ctx1.fill(self,"angle",{},$globals.Point)});
  6460. },
  6461. args: [],
  6462. source: "angle\x0a\x09^ self y arcTan: self x",
  6463. referencedClasses: [],
  6464. messageSends: ["arcTan:", "y", "x"]
  6465. }),
  6466. $globals.Point);
  6467. $core.addMethod(
  6468. $core.method({
  6469. selector: "asPoint",
  6470. protocol: "converting",
  6471. fn: function (){
  6472. var self=this,$self=this;
  6473. return self;
  6474. },
  6475. args: [],
  6476. source: "asPoint\x0a\x09^ self",
  6477. referencedClasses: [],
  6478. messageSends: []
  6479. }),
  6480. $globals.Point);
  6481. $core.addMethod(
  6482. $core.method({
  6483. selector: "corner:",
  6484. protocol: "rectangle creation",
  6485. fn: function (aPoint){
  6486. var self=this,$self=this;
  6487. return $core.withContext(function($ctx1) {
  6488. return $recv($globals.Rectangle)._origin_corner_(self,aPoint);
  6489. }, function($ctx1) {$ctx1.fill(self,"corner:",{aPoint:aPoint},$globals.Point)});
  6490. },
  6491. args: ["aPoint"],
  6492. source: "corner: aPoint\x0a\x09^ Rectangle origin: self corner: aPoint",
  6493. referencedClasses: ["Rectangle"],
  6494. messageSends: ["origin:corner:"]
  6495. }),
  6496. $globals.Point);
  6497. $core.addMethod(
  6498. $core.method({
  6499. selector: "dist:",
  6500. protocol: "transforming",
  6501. fn: function (aPoint){
  6502. var self=this,$self=this;
  6503. var dx,dy;
  6504. return $core.withContext(function($ctx1) {
  6505. var $2,$1;
  6506. dx=$recv($recv(aPoint)._x()).__minus($self["@x"]);
  6507. $ctx1.sendIdx["-"]=1;
  6508. dy=$recv($recv(aPoint)._y()).__minus($self["@y"]);
  6509. $2=$recv(dx).__star(dx);
  6510. $ctx1.sendIdx["*"]=1;
  6511. $1=$recv($2).__plus($recv(dy).__star(dy));
  6512. return $recv($1)._sqrt();
  6513. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  6514. },
  6515. args: ["aPoint"],
  6516. source: "dist: aPoint \x0a\x09\x22Answer the distance between aPoint and the receiver.\x22\x0a\x09| dx dy |\x0a\x09dx := aPoint x - x.\x0a\x09dy := aPoint y - y.\x0a\x09^ (dx * dx + (dy * dy)) sqrt",
  6517. referencedClasses: [],
  6518. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  6519. }),
  6520. $globals.Point);
  6521. $core.addMethod(
  6522. $core.method({
  6523. selector: "dotProduct:",
  6524. protocol: "point functions",
  6525. fn: function (aPoint){
  6526. var self=this,$self=this;
  6527. return $core.withContext(function($ctx1) {
  6528. var $1;
  6529. $1=$recv($self["@x"]).__star($recv(aPoint)._x());
  6530. $ctx1.sendIdx["*"]=1;
  6531. return $recv($1).__plus($recv($self["@y"]).__star($recv(aPoint)._y()));
  6532. }, function($ctx1) {$ctx1.fill(self,"dotProduct:",{aPoint:aPoint},$globals.Point)});
  6533. },
  6534. args: ["aPoint"],
  6535. source: "dotProduct: aPoint\x0a\x09^ (x * aPoint x) + (y * aPoint y)",
  6536. referencedClasses: [],
  6537. messageSends: ["+", "*", "x", "y"]
  6538. }),
  6539. $globals.Point);
  6540. $core.addMethod(
  6541. $core.method({
  6542. selector: "extent:",
  6543. protocol: "rectangle creation",
  6544. fn: function (aPoint){
  6545. var self=this,$self=this;
  6546. return $core.withContext(function($ctx1) {
  6547. return $recv($globals.Rectangle)._origin_extent_(self,aPoint);
  6548. }, function($ctx1) {$ctx1.fill(self,"extent:",{aPoint:aPoint},$globals.Point)});
  6549. },
  6550. args: ["aPoint"],
  6551. source: "extent: aPoint\x0a\x09^ Rectangle origin: self extent: aPoint",
  6552. referencedClasses: ["Rectangle"],
  6553. messageSends: ["origin:extent:"]
  6554. }),
  6555. $globals.Point);
  6556. $core.addMethod(
  6557. $core.method({
  6558. selector: "normal",
  6559. protocol: "point functions",
  6560. fn: function (){
  6561. var self=this,$self=this;
  6562. var n,d;
  6563. return $core.withContext(function($ctx1) {
  6564. var $4,$3,$6,$5,$2,$1;
  6565. n=$recv($recv($self["@y"])._negated()).__at($self["@x"]);
  6566. $ctx1.sendIdx["@"]=1;
  6567. $4=$recv(n)._x();
  6568. $ctx1.sendIdx["x"]=1;
  6569. $3=$recv($4).__star($recv(n)._x());
  6570. $ctx1.sendIdx["*"]=1;
  6571. $6=$recv(n)._y();
  6572. $ctx1.sendIdx["y"]=1;
  6573. $5=$recv($6).__star($recv(n)._y());
  6574. d=$recv($3).__plus($5);
  6575. $2=d;
  6576. $1=$recv($2).__eq((0));
  6577. if($core.assert($1)){
  6578. return (-1).__at((0));
  6579. }
  6580. return $recv(n).__slash($recv(d)._sqrt());
  6581. }, function($ctx1) {$ctx1.fill(self,"normal",{n:n,d:d},$globals.Point)});
  6582. },
  6583. args: [],
  6584. source: "normal\x0a\x09\x22Answer a Point representing the unit vector rotated 90 deg clockwise. For the zero point return -1@0.\x22\x0a\x0a\x09| n d |\x0a\x09n := y negated @ x.\x0a\x09(d := (n x * n x + (n y * n y))) = 0\x0a\x09\x09 ifTrue: [ ^ -1 @0 ].\x0a\x09^ n / d sqrt",
  6585. referencedClasses: [],
  6586. messageSends: ["@", "negated", "ifTrue:", "=", "+", "*", "x", "y", "/", "sqrt"]
  6587. }),
  6588. $globals.Point);
  6589. $core.addMethod(
  6590. $core.method({
  6591. selector: "normalized",
  6592. protocol: "point functions",
  6593. fn: function (){
  6594. var self=this,$self=this;
  6595. var r;
  6596. return $core.withContext(function($ctx1) {
  6597. var $1,$2,$3;
  6598. r=$self._r();
  6599. $1=$recv(r).__eq((0));
  6600. if($core.assert($1)){
  6601. $2=$recv($globals.Point)._x_y_((0),(0));
  6602. $ctx1.sendIdx["x:y:"]=1;
  6603. return $2;
  6604. } else {
  6605. $3=$recv($self["@x"]).__slash(r);
  6606. $ctx1.sendIdx["/"]=1;
  6607. return $recv($globals.Point)._x_y_($3,$recv($self["@y"]).__slash(r));
  6608. }
  6609. return self;
  6610. }, function($ctx1) {$ctx1.fill(self,"normalized",{r:r},$globals.Point)});
  6611. },
  6612. args: [],
  6613. source: "normalized\x0a\x09| r |\x0a\x09r := self r.\x0a\x09\x0a\x09r = 0\x0a\x09\x09ifTrue: [ ^ Point x: 0 y: 0 ]\x0a\x09\x09ifFalse: [ ^ Point x: x / r y: y / r ]",
  6614. referencedClasses: ["Point"],
  6615. messageSends: ["r", "ifTrue:ifFalse:", "=", "x:y:", "/"]
  6616. }),
  6617. $globals.Point);
  6618. $core.addMethod(
  6619. $core.method({
  6620. selector: "printOn:",
  6621. protocol: "printing",
  6622. fn: function (aStream){
  6623. var self=this,$self=this;
  6624. return $core.withContext(function($ctx1) {
  6625. var $1;
  6626. $recv($self["@x"])._printOn_(aStream);
  6627. $ctx1.sendIdx["printOn:"]=1;
  6628. $recv(aStream)._nextPutAll_("@");
  6629. $1=$recv($recv($self["@y"])._notNil())._and_((function(){
  6630. return $core.withContext(function($ctx2) {
  6631. return $recv($self["@y"])._negative();
  6632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6633. }));
  6634. if($core.assert($1)){
  6635. $recv(aStream)._space();
  6636. }
  6637. $recv($self["@y"])._printOn_(aStream);
  6638. return self;
  6639. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  6640. },
  6641. args: ["aStream"],
  6642. source: "printOn: aStream\x0a\x09\x22Print receiver in classic x@y notation.\x22\x0a\x0a\x09x printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: '@'.\x0a\x09(y notNil and: [ y negative ]) ifTrue: [\x0a\x09\x09\x09\x22Avoid ambiguous @- construct\x22\x0a\x09\x09\x09aStream space ].\x0a\x09\x0a\x09y printOn: aStream",
  6643. referencedClasses: [],
  6644. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  6645. }),
  6646. $globals.Point);
  6647. $core.addMethod(
  6648. $core.method({
  6649. selector: "r",
  6650. protocol: "polar coordinates",
  6651. fn: function (){
  6652. var self=this,$self=this;
  6653. return $core.withContext(function($ctx1) {
  6654. var $2,$1;
  6655. $2=$recv($self["@x"]).__star($self["@x"]);
  6656. $ctx1.sendIdx["*"]=1;
  6657. $1=$recv($2).__plus($recv($self["@y"]).__star($self["@y"]));
  6658. return $recv($1)._sqrt();
  6659. }, function($ctx1) {$ctx1.fill(self,"r",{},$globals.Point)});
  6660. },
  6661. args: [],
  6662. source: "r\x0a\x09^ ((x * x) + (y * y)) sqrt",
  6663. referencedClasses: [],
  6664. messageSends: ["sqrt", "+", "*"]
  6665. }),
  6666. $globals.Point);
  6667. $core.addMethod(
  6668. $core.method({
  6669. selector: "rectangle:",
  6670. protocol: "rectangle creation",
  6671. fn: function (aPoint){
  6672. var self=this,$self=this;
  6673. return $core.withContext(function($ctx1) {
  6674. return $recv($globals.Rectangle)._point_point_(self,aPoint);
  6675. }, function($ctx1) {$ctx1.fill(self,"rectangle:",{aPoint:aPoint},$globals.Point)});
  6676. },
  6677. args: ["aPoint"],
  6678. source: "rectangle: aPoint\x0a\x09^ Rectangle point: self point: aPoint",
  6679. referencedClasses: ["Rectangle"],
  6680. messageSends: ["point:point:"]
  6681. }),
  6682. $globals.Point);
  6683. $core.addMethod(
  6684. $core.method({
  6685. selector: "translateBy:",
  6686. protocol: "transforming",
  6687. fn: function (delta){
  6688. var self=this,$self=this;
  6689. return $core.withContext(function($ctx1) {
  6690. var $1;
  6691. $1=$recv($recv(delta)._x()).__plus($self["@x"]);
  6692. $ctx1.sendIdx["+"]=1;
  6693. return $recv($1).__at($recv($recv(delta)._y()).__plus($self["@y"]));
  6694. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  6695. },
  6696. args: ["delta"],
  6697. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  6698. referencedClasses: [],
  6699. messageSends: ["@", "+", "x", "y"]
  6700. }),
  6701. $globals.Point);
  6702. $core.addMethod(
  6703. $core.method({
  6704. selector: "x",
  6705. protocol: "accessing",
  6706. fn: function (){
  6707. var self=this,$self=this;
  6708. return $self["@x"];
  6709. },
  6710. args: [],
  6711. source: "x\x0a\x09^ x",
  6712. referencedClasses: [],
  6713. messageSends: []
  6714. }),
  6715. $globals.Point);
  6716. $core.addMethod(
  6717. $core.method({
  6718. selector: "x:",
  6719. protocol: "accessing",
  6720. fn: function (aNumber){
  6721. var self=this,$self=this;
  6722. $self["@x"]=aNumber;
  6723. return self;
  6724. },
  6725. args: ["aNumber"],
  6726. source: "x: aNumber\x0a\x09x := aNumber",
  6727. referencedClasses: [],
  6728. messageSends: []
  6729. }),
  6730. $globals.Point);
  6731. $core.addMethod(
  6732. $core.method({
  6733. selector: "y",
  6734. protocol: "accessing",
  6735. fn: function (){
  6736. var self=this,$self=this;
  6737. return $self["@y"];
  6738. },
  6739. args: [],
  6740. source: "y\x0a\x09^ y",
  6741. referencedClasses: [],
  6742. messageSends: []
  6743. }),
  6744. $globals.Point);
  6745. $core.addMethod(
  6746. $core.method({
  6747. selector: "y:",
  6748. protocol: "accessing",
  6749. fn: function (aNumber){
  6750. var self=this,$self=this;
  6751. $self["@y"]=aNumber;
  6752. return self;
  6753. },
  6754. args: ["aNumber"],
  6755. source: "y: aNumber\x0a\x09y := aNumber",
  6756. referencedClasses: [],
  6757. messageSends: []
  6758. }),
  6759. $globals.Point);
  6760. $core.addMethod(
  6761. $core.method({
  6762. selector: "classTag",
  6763. protocol: "accessing",
  6764. fn: function (){
  6765. var self=this,$self=this;
  6766. return "magnitude";
  6767. },
  6768. args: [],
  6769. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'",
  6770. referencedClasses: [],
  6771. messageSends: []
  6772. }),
  6773. $globals.Point.a$cls);
  6774. $core.addMethod(
  6775. $core.method({
  6776. selector: "x:y:",
  6777. protocol: "instance creation",
  6778. fn: function (aNumber,anotherNumber){
  6779. var self=this,$self=this;
  6780. return $core.withContext(function($ctx1) {
  6781. var $1;
  6782. $1=$self._new();
  6783. $recv($1)._x_(aNumber);
  6784. $recv($1)._y_(anotherNumber);
  6785. return $recv($1)._yourself();
  6786. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.a$cls)});
  6787. },
  6788. args: ["aNumber", "anotherNumber"],
  6789. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  6790. referencedClasses: [],
  6791. messageSends: ["x:", "new", "y:", "yourself"]
  6792. }),
  6793. $globals.Point.a$cls);
  6794. $core.addClass("Random", $globals.Object, [], "Kernel-Objects");
  6795. $globals.Random.comment="I an used to generate a random number and I am implemented as a trivial wrapper around javascript `Math.random()`.\x0a\x0a## API\x0a\x0aThe typical use case it to use the `#next` method like the following:\x0a\x0a\x09Random new next\x0a\x0aThis will return a float x where x < 1 and x > 0. If you want a random integer from 1 to 10 you can use `#atRandom`\x0a\x0a\x0910 atRandom\x0a\x0aA random number in a specific interval can be obtained with the following:\x0a\x0a\x09(3 to: 7) atRandom\x0a\x0aBe aware that `#to:` does not create an Interval as in other Smalltalk implementations but in fact an `Array` of numbers, so it's better to use:\x0a\x0a\x095 atRandom + 2\x0a\x0aSince `#atRandom` is implemented in `SequencableCollection` you can easy pick an element at random:\x0a\x0a\x09#('a' 'b' 'c') atRandom\x0a\x0aAs well as letter from a `String`:\x0a\x0a\x09'abc' atRandom\x0a\x0aSince Amber does not have Characters this will return a `String` of length 1 like for example `'b'`.";
  6796. $core.addMethod(
  6797. $core.method({
  6798. selector: "next",
  6799. protocol: "accessing",
  6800. fn: function (){
  6801. var self=this,$self=this;
  6802. return $core.withContext(function($ctx1) {
  6803. return Math.random();
  6804. return self;
  6805. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  6806. },
  6807. args: [],
  6808. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  6809. referencedClasses: [],
  6810. messageSends: []
  6811. }),
  6812. $globals.Random);
  6813. $core.addMethod(
  6814. $core.method({
  6815. selector: "next:",
  6816. protocol: "accessing",
  6817. fn: function (anInteger){
  6818. var self=this,$self=this;
  6819. return $core.withContext(function($ctx1) {
  6820. return $recv((1)._to_(anInteger))._collect_((function(each){
  6821. return $core.withContext(function($ctx2) {
  6822. return $self._next();
  6823. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6824. }));
  6825. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  6826. },
  6827. args: ["anInteger"],
  6828. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  6829. referencedClasses: [],
  6830. messageSends: ["collect:", "to:", "next"]
  6831. }),
  6832. $globals.Random);
  6833. $core.addClass("Rectangle", $globals.Object, ["origin", "corner"], "Kernel-Objects");
  6834. $globals.Rectangle.comment="I represent a Rectangle defined by my two corners.\x0a\x0aThe simplest way to create an instance is using Point methods:\x0a\x0a 1@1 corner: 2@2\x0a\x0aWIll create a rectangle with 1@1 as the top left and 2@2 at the bottom right.\x0a\x0a 1@1 extent: 1@1\x0a\x0aWill create the same rectangle, defining an origin and a size instead of an origin and a corner.";
  6835. $core.addMethod(
  6836. $core.method({
  6837. selector: "=",
  6838. protocol: "testing",
  6839. fn: function (aRectangle){
  6840. var self=this,$self=this;
  6841. return $core.withContext(function($ctx1) {
  6842. var $1;
  6843. $1=$recv($self["@origin"]).__eq($recv(aRectangle)._origin());
  6844. $ctx1.sendIdx["="]=1;
  6845. return $recv($1)._and_((function(){
  6846. return $core.withContext(function($ctx2) {
  6847. return $recv($self["@corner"]).__eq($recv(aRectangle)._corner());
  6848. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6849. }));
  6850. }, function($ctx1) {$ctx1.fill(self,"=",{aRectangle:aRectangle},$globals.Rectangle)});
  6851. },
  6852. args: ["aRectangle"],
  6853. source: "= aRectangle\x0a\x09^ origin = aRectangle origin and: [ corner = aRectangle corner ]",
  6854. referencedClasses: [],
  6855. messageSends: ["and:", "=", "origin", "corner"]
  6856. }),
  6857. $globals.Rectangle);
  6858. $core.addMethod(
  6859. $core.method({
  6860. selector: "containsPoint:",
  6861. protocol: "testing",
  6862. fn: function (aPoint){
  6863. var self=this,$self=this;
  6864. return $core.withContext(function($ctx1) {
  6865. return $recv($recv($self["@origin"]).__lt_eq(aPoint))._and_((function(){
  6866. return $core.withContext(function($ctx2) {
  6867. return $recv($self["@corner"]).__gt_eq(aPoint);
  6868. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6869. }));
  6870. }, function($ctx1) {$ctx1.fill(self,"containsPoint:",{aPoint:aPoint},$globals.Rectangle)});
  6871. },
  6872. args: ["aPoint"],
  6873. source: "containsPoint: aPoint\x0a\x09^ origin <= aPoint and: [ corner >= aPoint ]",
  6874. referencedClasses: [],
  6875. messageSends: ["and:", "<=", ">="]
  6876. }),
  6877. $globals.Rectangle);
  6878. $core.addMethod(
  6879. $core.method({
  6880. selector: "containsRect:",
  6881. protocol: "testing",
  6882. fn: function (aRect){
  6883. var self=this,$self=this;
  6884. return $core.withContext(function($ctx1) {
  6885. return $recv($recv($recv(aRect)._origin()).__gt_eq($self["@origin"]))._and_((function(){
  6886. return $core.withContext(function($ctx2) {
  6887. return $recv($recv(aRect)._corner()).__lt_eq($self["@corner"]);
  6888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6889. }));
  6890. }, function($ctx1) {$ctx1.fill(self,"containsRect:",{aRect:aRect},$globals.Rectangle)});
  6891. },
  6892. args: ["aRect"],
  6893. source: "containsRect: aRect\x0a\x09^ aRect origin >= origin and: [ aRect corner <= corner ]",
  6894. referencedClasses: [],
  6895. messageSends: ["and:", ">=", "origin", "<=", "corner"]
  6896. }),
  6897. $globals.Rectangle);
  6898. $core.addMethod(
  6899. $core.method({
  6900. selector: "corner",
  6901. protocol: "accessing",
  6902. fn: function (){
  6903. var self=this,$self=this;
  6904. return $self["@corner"];
  6905. },
  6906. args: [],
  6907. source: "corner\x0a\x09^ corner",
  6908. referencedClasses: [],
  6909. messageSends: []
  6910. }),
  6911. $globals.Rectangle);
  6912. $core.addMethod(
  6913. $core.method({
  6914. selector: "origin",
  6915. protocol: "accessing",
  6916. fn: function (){
  6917. var self=this,$self=this;
  6918. return $self["@origin"];
  6919. },
  6920. args: [],
  6921. source: "origin\x0a\x09^ origin",
  6922. referencedClasses: [],
  6923. messageSends: []
  6924. }),
  6925. $globals.Rectangle);
  6926. $core.addMethod(
  6927. $core.method({
  6928. selector: "printOn:",
  6929. protocol: "testing",
  6930. fn: function (aStream){
  6931. var self=this,$self=this;
  6932. return $core.withContext(function($ctx1) {
  6933. $recv($self["@origin"])._printOn_(aStream);
  6934. $ctx1.sendIdx["printOn:"]=1;
  6935. $recv(aStream)._nextPutAll_(" corner: ");
  6936. $recv($self["@corner"])._printOn_(aStream);
  6937. return self;
  6938. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Rectangle)});
  6939. },
  6940. args: ["aStream"],
  6941. source: "printOn: aStream\x0a\x09origin printOn: aStream.\x0a\x09aStream nextPutAll: ' corner: '.\x0a\x09corner printOn: aStream.",
  6942. referencedClasses: [],
  6943. messageSends: ["printOn:", "nextPutAll:"]
  6944. }),
  6945. $globals.Rectangle);
  6946. $core.addMethod(
  6947. $core.method({
  6948. selector: "setPoint:point:",
  6949. protocol: "private",
  6950. fn: function (pt1,pt2){
  6951. var self=this,$self=this;
  6952. return $core.withContext(function($ctx1) {
  6953. var $2,$3,$1,$5,$6,$4,$8,$7,$10,$9;
  6954. $2=$recv(pt1)._x();
  6955. $ctx1.sendIdx["x"]=1;
  6956. $3=$recv(pt2)._x();
  6957. $ctx1.sendIdx["x"]=2;
  6958. $1=$recv($2)._min_($3);
  6959. $ctx1.sendIdx["min:"]=1;
  6960. $5=$recv(pt1)._y();
  6961. $ctx1.sendIdx["y"]=1;
  6962. $6=$recv(pt2)._y();
  6963. $ctx1.sendIdx["y"]=2;
  6964. $4=$recv($5)._min_($6);
  6965. $self["@origin"]=$recv($1).__at($4);
  6966. $ctx1.sendIdx["@"]=1;
  6967. $8=$recv(pt1)._x();
  6968. $ctx1.sendIdx["x"]=3;
  6969. $7=$recv($8)._max_($recv(pt2)._x());
  6970. $ctx1.sendIdx["max:"]=1;
  6971. $10=$recv(pt1)._y();
  6972. $ctx1.sendIdx["y"]=3;
  6973. $9=$recv($10)._max_($recv(pt2)._y());
  6974. $self["@corner"]=$recv($7).__at($9);
  6975. return self;
  6976. }, function($ctx1) {$ctx1.fill(self,"setPoint:point:",{pt1:pt1,pt2:pt2},$globals.Rectangle)});
  6977. },
  6978. args: ["pt1", "pt2"],
  6979. source: "setPoint: pt1 point: pt2\x0a\x0a\x09origin := (pt1 x min: pt2 x)@(pt1 y min: pt2 y).\x0a\x09corner := (pt1 x max: pt2 x)@(pt1 y max: pt2 y).",
  6980. referencedClasses: [],
  6981. messageSends: ["@", "min:", "x", "y", "max:"]
  6982. }),
  6983. $globals.Rectangle);
  6984. $core.addMethod(
  6985. $core.method({
  6986. selector: "origin:corner:",
  6987. protocol: "instance creation",
  6988. fn: function (anOrigin,aCorner){
  6989. var self=this,$self=this;
  6990. return $core.withContext(function($ctx1) {
  6991. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  6992. }, function($ctx1) {$ctx1.fill(self,"origin:corner:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  6993. },
  6994. args: ["anOrigin", "aCorner"],
  6995. source: "origin: anOrigin corner: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  6996. referencedClasses: [],
  6997. messageSends: ["setPoint:point:", "basicNew"]
  6998. }),
  6999. $globals.Rectangle.a$cls);
  7000. $core.addMethod(
  7001. $core.method({
  7002. selector: "origin:extent:",
  7003. protocol: "instance creation",
  7004. fn: function (anOrigin,anExtent){
  7005. var self=this,$self=this;
  7006. return $core.withContext(function($ctx1) {
  7007. return $recv($self._basicNew())._setPoint_point_(anOrigin,$recv(anOrigin).__plus(anExtent));
  7008. }, function($ctx1) {$ctx1.fill(self,"origin:extent:",{anOrigin:anOrigin,anExtent:anExtent},$globals.Rectangle.a$cls)});
  7009. },
  7010. args: ["anOrigin", "anExtent"],
  7011. source: "origin: anOrigin extent: anExtent\x0a\x09^ self basicNew setPoint: anOrigin point: anOrigin + anExtent.",
  7012. referencedClasses: [],
  7013. messageSends: ["setPoint:point:", "basicNew", "+"]
  7014. }),
  7015. $globals.Rectangle.a$cls);
  7016. $core.addMethod(
  7017. $core.method({
  7018. selector: "point:point:",
  7019. protocol: "instance creation",
  7020. fn: function (anOrigin,aCorner){
  7021. var self=this,$self=this;
  7022. return $core.withContext(function($ctx1) {
  7023. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  7024. }, function($ctx1) {$ctx1.fill(self,"point:point:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  7025. },
  7026. args: ["anOrigin", "aCorner"],
  7027. source: "point: anOrigin point: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  7028. referencedClasses: [],
  7029. messageSends: ["setPoint:point:", "basicNew"]
  7030. }),
  7031. $globals.Rectangle.a$cls);
  7032. $core.addClass("UndefinedObject", $globals.Object, [], "Kernel-Objects");
  7033. $globals.UndefinedObject.comment="I describe the behavior of my sole instance, `nil`. `nil` represents a prior value for variables that have not been initialized, or for results which are meaningless.\x0a\x0a`nil` is the Smalltalk equivalent of the `undefined` JavaScript object.\x0a\x0a__note:__ When sending messages to the `undefined` JavaScript object, it will be replaced by `nil`.";
  7034. $core.addMethod(
  7035. $core.method({
  7036. selector: "==",
  7037. protocol: "testing",
  7038. fn: function (anObject){
  7039. var self=this,$self=this;
  7040. return $core.withContext(function($ctx1) {
  7041. return $recv(anObject)._isNil();
  7042. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.UndefinedObject)});
  7043. },
  7044. args: ["anObject"],
  7045. source: "== anObject\x0a\x09^ anObject isNil",
  7046. referencedClasses: [],
  7047. messageSends: ["isNil"]
  7048. }),
  7049. $globals.UndefinedObject);
  7050. $core.addMethod(
  7051. $core.method({
  7052. selector: "asJavaScriptObject",
  7053. protocol: "converting",
  7054. fn: function (){
  7055. var self=this,$self=this;
  7056. return null;
  7057. },
  7058. args: [],
  7059. source: "asJavaScriptObject\x0a\x09^ null",
  7060. referencedClasses: [],
  7061. messageSends: []
  7062. }),
  7063. $globals.UndefinedObject);
  7064. $core.addMethod(
  7065. $core.method({
  7066. selector: "deepCopy",
  7067. protocol: "copying",
  7068. fn: function (){
  7069. var self=this,$self=this;
  7070. return self;
  7071. },
  7072. args: [],
  7073. source: "deepCopy\x0a\x09^ self",
  7074. referencedClasses: [],
  7075. messageSends: []
  7076. }),
  7077. $globals.UndefinedObject);
  7078. $core.addMethod(
  7079. $core.method({
  7080. selector: "identityHash",
  7081. protocol: "accessing",
  7082. fn: function (){
  7083. var self=this,$self=this;
  7084. return "NIL";
  7085. },
  7086. args: [],
  7087. source: "identityHash\x0a\x09^ 'NIL'",
  7088. referencedClasses: [],
  7089. messageSends: []
  7090. }),
  7091. $globals.UndefinedObject);
  7092. $core.addMethod(
  7093. $core.method({
  7094. selector: "ifNil:",
  7095. protocol: "testing",
  7096. fn: function (aBlock){
  7097. var self=this,$self=this;
  7098. return $core.withContext(function($ctx1) {
  7099. return $self._ifNil_ifNotNil_(aBlock,(function(){
  7100. }));
  7101. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  7102. },
  7103. args: ["aBlock"],
  7104. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  7105. referencedClasses: [],
  7106. messageSends: ["ifNil:ifNotNil:"]
  7107. }),
  7108. $globals.UndefinedObject);
  7109. $core.addMethod(
  7110. $core.method({
  7111. selector: "ifNil:ifNotNil:",
  7112. protocol: "testing",
  7113. fn: function (aBlock,anotherBlock){
  7114. var self=this,$self=this;
  7115. return $core.withContext(function($ctx1) {
  7116. return $recv(aBlock)._value();
  7117. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7118. },
  7119. args: ["aBlock", "anotherBlock"],
  7120. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  7121. referencedClasses: [],
  7122. messageSends: ["value"]
  7123. }),
  7124. $globals.UndefinedObject);
  7125. $core.addMethod(
  7126. $core.method({
  7127. selector: "ifNotNil:",
  7128. protocol: "testing",
  7129. fn: function (aBlock){
  7130. var self=this,$self=this;
  7131. return self;
  7132. },
  7133. args: ["aBlock"],
  7134. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  7135. referencedClasses: [],
  7136. messageSends: []
  7137. }),
  7138. $globals.UndefinedObject);
  7139. $core.addMethod(
  7140. $core.method({
  7141. selector: "ifNotNil:ifNil:",
  7142. protocol: "testing",
  7143. fn: function (aBlock,anotherBlock){
  7144. var self=this,$self=this;
  7145. return $core.withContext(function($ctx1) {
  7146. return $recv(anotherBlock)._value();
  7147. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7148. },
  7149. args: ["aBlock", "anotherBlock"],
  7150. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  7151. referencedClasses: [],
  7152. messageSends: ["value"]
  7153. }),
  7154. $globals.UndefinedObject);
  7155. $core.addMethod(
  7156. $core.method({
  7157. selector: "isImmutable",
  7158. protocol: "testing",
  7159. fn: function (){
  7160. var self=this,$self=this;
  7161. return true;
  7162. },
  7163. args: [],
  7164. source: "isImmutable\x0a\x09^ true",
  7165. referencedClasses: [],
  7166. messageSends: []
  7167. }),
  7168. $globals.UndefinedObject);
  7169. $core.addMethod(
  7170. $core.method({
  7171. selector: "isNil",
  7172. protocol: "testing",
  7173. fn: function (){
  7174. var self=this,$self=this;
  7175. return true;
  7176. },
  7177. args: [],
  7178. source: "isNil\x0a\x09^ true",
  7179. referencedClasses: [],
  7180. messageSends: []
  7181. }),
  7182. $globals.UndefinedObject);
  7183. $core.addMethod(
  7184. $core.method({
  7185. selector: "notNil",
  7186. protocol: "testing",
  7187. fn: function (){
  7188. var self=this,$self=this;
  7189. return false;
  7190. },
  7191. args: [],
  7192. source: "notNil\x0a\x09^ false",
  7193. referencedClasses: [],
  7194. messageSends: []
  7195. }),
  7196. $globals.UndefinedObject);
  7197. $core.addMethod(
  7198. $core.method({
  7199. selector: "printOn:",
  7200. protocol: "printing",
  7201. fn: function (aStream){
  7202. var self=this,$self=this;
  7203. return $core.withContext(function($ctx1) {
  7204. $recv(aStream)._nextPutAll_("nil");
  7205. return self;
  7206. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  7207. },
  7208. args: ["aStream"],
  7209. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  7210. referencedClasses: [],
  7211. messageSends: ["nextPutAll:"]
  7212. }),
  7213. $globals.UndefinedObject);
  7214. $core.addMethod(
  7215. $core.method({
  7216. selector: "shallowCopy",
  7217. protocol: "copying",
  7218. fn: function (){
  7219. var self=this,$self=this;
  7220. return self;
  7221. },
  7222. args: [],
  7223. source: "shallowCopy\x0a\x09^ self",
  7224. referencedClasses: [],
  7225. messageSends: []
  7226. }),
  7227. $globals.UndefinedObject);
  7228. $core.addMethod(
  7229. $core.method({
  7230. selector: "value",
  7231. protocol: "evaluating",
  7232. fn: function (){
  7233. var self=this,$self=this;
  7234. return $core.withContext(function($ctx1) {
  7235. return null;
  7236. return self;
  7237. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.UndefinedObject)});
  7238. },
  7239. args: [],
  7240. source: "value\x0a\x09<inlineJS: 'return null'>",
  7241. referencedClasses: [],
  7242. messageSends: []
  7243. }),
  7244. $globals.UndefinedObject);
  7245. $core.addMethod(
  7246. $core.method({
  7247. selector: "new",
  7248. protocol: "instance creation",
  7249. fn: function (){
  7250. var self=this,$self=this;
  7251. return $core.withContext(function($ctx1) {
  7252. $self._error_("You cannot create new instances of UndefinedObject. Use nil");
  7253. return self;
  7254. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.a$cls)});
  7255. },
  7256. args: [],
  7257. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  7258. referencedClasses: [],
  7259. messageSends: ["error:"]
  7260. }),
  7261. $globals.UndefinedObject.a$cls);
  7262. $core.setTraitComposition([{trait: $globals.TSubclassable}], $globals.UndefinedObject);
  7263. });
  7264. define('amber_core/Kernel-Collections',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7265. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  7266. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  7267. var $pkg = $core.addPackage("Kernel-Collections");
  7268. $pkg.innerEval = function (expr) { return eval(expr); };
  7269. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  7270. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7271. $globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
  7272. $core.addMethod(
  7273. $core.method({
  7274. selector: "=",
  7275. protocol: "comparing",
  7276. fn: function (anAssociation){
  7277. var self=this,$self=this;
  7278. return $core.withContext(function($ctx1) {
  7279. var $3,$2,$5,$4,$6,$1;
  7280. $3=$self._class();
  7281. $ctx1.sendIdx["class"]=1;
  7282. $2=$recv($3).__eq($recv(anAssociation)._class());
  7283. $ctx1.sendIdx["="]=1;
  7284. $1=$recv($2)._and_((function(){
  7285. return $core.withContext(function($ctx2) {
  7286. $5=$self._key();
  7287. $ctx2.sendIdx["key"]=1;
  7288. $4=$recv($5).__eq($recv(anAssociation)._key());
  7289. $ctx2.sendIdx["="]=2;
  7290. return $recv($4)._and_((function(){
  7291. return $core.withContext(function($ctx3) {
  7292. $6=$self._value();
  7293. $ctx3.sendIdx["value"]=1;
  7294. return $recv($6).__eq($recv(anAssociation)._value());
  7295. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  7296. }));
  7297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7298. }));
  7299. $ctx1.sendIdx["and:"]=1;
  7300. return $1;
  7301. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  7302. },
  7303. args: ["anAssociation"],
  7304. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  7305. referencedClasses: [],
  7306. messageSends: ["and:", "=", "class", "key", "value"]
  7307. }),
  7308. $globals.Association);
  7309. $core.addMethod(
  7310. $core.method({
  7311. selector: "key",
  7312. protocol: "accessing",
  7313. fn: function (){
  7314. var self=this,$self=this;
  7315. return $self["@key"];
  7316. },
  7317. args: [],
  7318. source: "key\x0a\x09^ key",
  7319. referencedClasses: [],
  7320. messageSends: []
  7321. }),
  7322. $globals.Association);
  7323. $core.addMethod(
  7324. $core.method({
  7325. selector: "key:",
  7326. protocol: "accessing",
  7327. fn: function (aKey){
  7328. var self=this,$self=this;
  7329. $self["@key"]=aKey;
  7330. return self;
  7331. },
  7332. args: ["aKey"],
  7333. source: "key: aKey\x0a\x09key := aKey",
  7334. referencedClasses: [],
  7335. messageSends: []
  7336. }),
  7337. $globals.Association);
  7338. $core.addMethod(
  7339. $core.method({
  7340. selector: "printOn:",
  7341. protocol: "printing",
  7342. fn: function (aStream){
  7343. var self=this,$self=this;
  7344. return $core.withContext(function($ctx1) {
  7345. $recv($self._key())._printOn_(aStream);
  7346. $ctx1.sendIdx["printOn:"]=1;
  7347. $recv(aStream)._nextPutAll_(" -> ");
  7348. $recv($self._value())._printOn_(aStream);
  7349. return self;
  7350. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  7351. },
  7352. args: ["aStream"],
  7353. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  7354. referencedClasses: [],
  7355. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  7356. }),
  7357. $globals.Association);
  7358. $core.addMethod(
  7359. $core.method({
  7360. selector: "value",
  7361. protocol: "accessing",
  7362. fn: function (){
  7363. var self=this,$self=this;
  7364. return $self["@value"];
  7365. },
  7366. args: [],
  7367. source: "value\x0a\x09^ value",
  7368. referencedClasses: [],
  7369. messageSends: []
  7370. }),
  7371. $globals.Association);
  7372. $core.addMethod(
  7373. $core.method({
  7374. selector: "value:",
  7375. protocol: "accessing",
  7376. fn: function (aValue){
  7377. var self=this,$self=this;
  7378. $self["@value"]=aValue;
  7379. return self;
  7380. },
  7381. args: ["aValue"],
  7382. source: "value: aValue\x0a\x09value := aValue",
  7383. referencedClasses: [],
  7384. messageSends: []
  7385. }),
  7386. $globals.Association);
  7387. $core.addMethod(
  7388. $core.method({
  7389. selector: "key:value:",
  7390. protocol: "instance creation",
  7391. fn: function (aKey,aValue){
  7392. var self=this,$self=this;
  7393. return $core.withContext(function($ctx1) {
  7394. var $1;
  7395. $1=$self._new();
  7396. $recv($1)._key_(aKey);
  7397. $recv($1)._value_(aValue);
  7398. return $recv($1)._yourself();
  7399. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.a$cls)});
  7400. },
  7401. args: ["aKey", "aValue"],
  7402. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  7403. referencedClasses: [],
  7404. messageSends: ["key:", "new", "value:", "yourself"]
  7405. }),
  7406. $globals.Association.a$cls);
  7407. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  7408. $globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`.";
  7409. $core.addMethod(
  7410. $core.method({
  7411. selector: "bucketOfElement:",
  7412. protocol: "accessing",
  7413. fn: function (anObject){
  7414. var self=this,$self=this;
  7415. return $core.withContext(function($ctx1) {
  7416. var hash = $self['@hashBlock'](anObject);
  7417. if (!hash) return null;
  7418. var buckets = $self['@buckets'],
  7419. bucket = buckets[hash];
  7420. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  7421. return bucket;
  7422. ;
  7423. return self;
  7424. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  7425. },
  7426. args: ["anObject"],
  7427. source: "bucketOfElement: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var hash = $self[''@hashBlock''](anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = $self[''@buckets''],\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09'>",
  7428. referencedClasses: [],
  7429. messageSends: []
  7430. }),
  7431. $globals.BucketStore);
  7432. $core.addMethod(
  7433. $core.method({
  7434. selector: "do:",
  7435. protocol: "enumerating",
  7436. fn: function (aBlock){
  7437. var self=this,$self=this;
  7438. return $core.withContext(function($ctx1) {
  7439. var buckets = $self['@buckets'];
  7440. var keys = Object.keys(buckets);
  7441. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  7442. ;
  7443. return self;
  7444. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  7445. },
  7446. args: ["aBlock"],
  7447. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var buckets = $self[''@buckets''];\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09'>",
  7448. referencedClasses: [],
  7449. messageSends: []
  7450. }),
  7451. $globals.BucketStore);
  7452. $core.addMethod(
  7453. $core.method({
  7454. selector: "hashBlock:",
  7455. protocol: "accessing",
  7456. fn: function (aBlock){
  7457. var self=this,$self=this;
  7458. $self["@hashBlock"]=aBlock;
  7459. return self;
  7460. },
  7461. args: ["aBlock"],
  7462. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  7463. referencedClasses: [],
  7464. messageSends: []
  7465. }),
  7466. $globals.BucketStore);
  7467. $core.addMethod(
  7468. $core.method({
  7469. selector: "initialize",
  7470. protocol: "initialization",
  7471. fn: function (){
  7472. var self=this,$self=this;
  7473. return $core.withContext(function($ctx1) {
  7474. (
  7475. $ctx1.supercall = true,
  7476. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7477. $ctx1.supercall = false;
  7478. $self._removeAll();
  7479. return self;
  7480. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  7481. },
  7482. args: [],
  7483. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  7484. referencedClasses: [],
  7485. messageSends: ["initialize", "removeAll"]
  7486. }),
  7487. $globals.BucketStore);
  7488. $core.addMethod(
  7489. $core.method({
  7490. selector: "newBucket",
  7491. protocol: "private",
  7492. fn: function (){
  7493. var self=this,$self=this;
  7494. return $core.withContext(function($ctx1) {
  7495. $self._subclassResponsibility();
  7496. return self;
  7497. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  7498. },
  7499. args: [],
  7500. source: "newBucket\x0a\x09self subclassResponsibility",
  7501. referencedClasses: [],
  7502. messageSends: ["subclassResponsibility"]
  7503. }),
  7504. $globals.BucketStore);
  7505. $core.addMethod(
  7506. $core.method({
  7507. selector: "removeAll",
  7508. protocol: "adding/removing",
  7509. fn: function (){
  7510. var self=this,$self=this;
  7511. return $core.withContext(function($ctx1) {
  7512. $self['@buckets'] = Object.create(null);;
  7513. return self;
  7514. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  7515. },
  7516. args: [],
  7517. source: "removeAll\x0a\x09<inlineJS: '$self[''@buckets''] = Object.create(null);'>",
  7518. referencedClasses: [],
  7519. messageSends: []
  7520. }),
  7521. $globals.BucketStore);
  7522. $core.addMethod(
  7523. $core.method({
  7524. selector: "hashBlock:",
  7525. protocol: "instance creation",
  7526. fn: function (aBlock){
  7527. var self=this,$self=this;
  7528. return $core.withContext(function($ctx1) {
  7529. var $1;
  7530. $1=$self._new();
  7531. $recv($1)._hashBlock_(aBlock);
  7532. return $recv($1)._yourself();
  7533. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.a$cls)});
  7534. },
  7535. args: ["aBlock"],
  7536. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  7537. referencedClasses: [],
  7538. messageSends: ["hashBlock:", "new", "yourself"]
  7539. }),
  7540. $globals.BucketStore.a$cls);
  7541. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  7542. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  7543. $core.addMethod(
  7544. $core.method({
  7545. selector: "newBucket",
  7546. protocol: "private",
  7547. fn: function (){
  7548. var self=this,$self=this;
  7549. return [];
  7550. },
  7551. args: [],
  7552. source: "newBucket\x0a\x09^ #()",
  7553. referencedClasses: [],
  7554. messageSends: []
  7555. }),
  7556. $globals.ArrayBucketStore);
  7557. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  7558. $globals.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods.";
  7559. $core.addMethod(
  7560. $core.method({
  7561. selector: ",",
  7562. protocol: "copying",
  7563. fn: function (aCollection){
  7564. var self=this,$self=this;
  7565. return $core.withContext(function($ctx1) {
  7566. var $1;
  7567. $1=$self._copy();
  7568. $recv($1)._addAll_(aCollection);
  7569. return $recv($1)._yourself();
  7570. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  7571. },
  7572. args: ["aCollection"],
  7573. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  7574. referencedClasses: [],
  7575. messageSends: ["addAll:", "copy", "yourself"]
  7576. }),
  7577. $globals.Collection);
  7578. $core.addMethod(
  7579. $core.method({
  7580. selector: "add:",
  7581. protocol: "adding/removing",
  7582. fn: function (anObject){
  7583. var self=this,$self=this;
  7584. return $core.withContext(function($ctx1) {
  7585. $self._subclassResponsibility();
  7586. return self;
  7587. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  7588. },
  7589. args: ["anObject"],
  7590. source: "add: anObject\x0a\x09self subclassResponsibility",
  7591. referencedClasses: [],
  7592. messageSends: ["subclassResponsibility"]
  7593. }),
  7594. $globals.Collection);
  7595. $core.addMethod(
  7596. $core.method({
  7597. selector: "addAll:",
  7598. protocol: "adding/removing",
  7599. fn: function (aCollection){
  7600. var self=this,$self=this;
  7601. return $core.withContext(function($ctx1) {
  7602. $recv(aCollection)._do_((function(each){
  7603. return $core.withContext(function($ctx2) {
  7604. return $self._add_(each);
  7605. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7606. }));
  7607. return aCollection;
  7608. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  7609. },
  7610. args: ["aCollection"],
  7611. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  7612. referencedClasses: [],
  7613. messageSends: ["do:", "add:"]
  7614. }),
  7615. $globals.Collection);
  7616. $core.addMethod(
  7617. $core.method({
  7618. selector: "allSatisfy:",
  7619. protocol: "enumerating",
  7620. fn: function (aBlock){
  7621. var self=this,$self=this;
  7622. return $core.withContext(function($ctx1) {
  7623. var $1;
  7624. var $early={};
  7625. try {
  7626. $self._do_((function(each){
  7627. return $core.withContext(function($ctx2) {
  7628. $1=$recv(aBlock)._value_(each);
  7629. if(!$core.assert($1)){
  7630. throw $early=[false];
  7631. }
  7632. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7633. }));
  7634. return true;
  7635. }
  7636. catch(e) {if(e===$early)return e[0]; throw e}
  7637. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  7638. },
  7639. args: ["aBlock"],
  7640. source: "allSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for any element return false.\x0a\x09Otherwise return true.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  7641. referencedClasses: [],
  7642. messageSends: ["do:", "ifFalse:", "value:"]
  7643. }),
  7644. $globals.Collection);
  7645. $core.addMethod(
  7646. $core.method({
  7647. selector: "anyOne",
  7648. protocol: "accessing",
  7649. fn: function (){
  7650. var self=this,$self=this;
  7651. return $core.withContext(function($ctx1) {
  7652. var $early={};
  7653. try {
  7654. $self._ifEmpty_((function(){
  7655. return $core.withContext(function($ctx2) {
  7656. return $self._error_("Collection is empty");
  7657. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7658. }));
  7659. $self._do_((function(each){
  7660. throw $early=[each];
  7661. }));
  7662. return self;
  7663. }
  7664. catch(e) {if(e===$early)return e[0]; throw e}
  7665. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  7666. },
  7667. args: [],
  7668. source: "anyOne\x0a\x09\x22Answer a representative sample of the receiver. This method can\x0a\x09be helpful when needing to preinfer the nature of the contents of \x0a\x09semi-homogeneous collections.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self do: [ :each | ^ each ]",
  7669. referencedClasses: [],
  7670. messageSends: ["ifEmpty:", "error:", "do:"]
  7671. }),
  7672. $globals.Collection);
  7673. $core.addMethod(
  7674. $core.method({
  7675. selector: "anySatisfy:",
  7676. protocol: "enumerating",
  7677. fn: function (aBlock){
  7678. var self=this,$self=this;
  7679. return $core.withContext(function($ctx1) {
  7680. var $1;
  7681. var $early={};
  7682. try {
  7683. $self._do_((function(each){
  7684. return $core.withContext(function($ctx2) {
  7685. $1=$recv(aBlock)._value_(each);
  7686. if($core.assert($1)){
  7687. throw $early=[true];
  7688. }
  7689. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7690. }));
  7691. return false;
  7692. }
  7693. catch(e) {if(e===$early)return e[0]; throw e}
  7694. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  7695. },
  7696. args: ["aBlock"],
  7697. source: "anySatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns true for any element return true.\x0a\x09Otherwise return false.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].\x0a\x09^ false",
  7698. referencedClasses: [],
  7699. messageSends: ["do:", "ifTrue:", "value:"]
  7700. }),
  7701. $globals.Collection);
  7702. $core.addMethod(
  7703. $core.method({
  7704. selector: "asArray",
  7705. protocol: "converting",
  7706. fn: function (){
  7707. var self=this,$self=this;
  7708. return $core.withContext(function($ctx1) {
  7709. return $recv($globals.Array)._withAll_(self);
  7710. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  7711. },
  7712. args: [],
  7713. source: "asArray\x0a\x09^ Array withAll: self",
  7714. referencedClasses: ["Array"],
  7715. messageSends: ["withAll:"]
  7716. }),
  7717. $globals.Collection);
  7718. $core.addMethod(
  7719. $core.method({
  7720. selector: "asJavaScriptObject",
  7721. protocol: "converting",
  7722. fn: function (){
  7723. var self=this,$self=this;
  7724. return $core.withContext(function($ctx1) {
  7725. return $recv($self._asArray())._collect_((function(each){
  7726. return $core.withContext(function($ctx2) {
  7727. return $recv(each)._asJavaScriptObject();
  7728. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7729. }));
  7730. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  7731. },
  7732. args: [],
  7733. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  7734. referencedClasses: [],
  7735. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  7736. }),
  7737. $globals.Collection);
  7738. $core.addMethod(
  7739. $core.method({
  7740. selector: "asOrderedCollection",
  7741. protocol: "converting",
  7742. fn: function (){
  7743. var self=this,$self=this;
  7744. return $core.withContext(function($ctx1) {
  7745. return $self._asArray();
  7746. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  7747. },
  7748. args: [],
  7749. source: "asOrderedCollection\x0a\x09^ self asArray",
  7750. referencedClasses: [],
  7751. messageSends: ["asArray"]
  7752. }),
  7753. $globals.Collection);
  7754. $core.addMethod(
  7755. $core.method({
  7756. selector: "asSet",
  7757. protocol: "converting",
  7758. fn: function (){
  7759. var self=this,$self=this;
  7760. return $core.withContext(function($ctx1) {
  7761. return $recv($globals.Set)._withAll_(self);
  7762. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  7763. },
  7764. args: [],
  7765. source: "asSet\x0a\x09^ Set withAll: self",
  7766. referencedClasses: ["Set"],
  7767. messageSends: ["withAll:"]
  7768. }),
  7769. $globals.Collection);
  7770. $core.addMethod(
  7771. $core.method({
  7772. selector: "collect:",
  7773. protocol: "enumerating",
  7774. fn: function (aBlock){
  7775. var self=this,$self=this;
  7776. var stream;
  7777. return $core.withContext(function($ctx1) {
  7778. stream=$recv($recv($self._class())._new())._writeStream();
  7779. $self._do_((function(each){
  7780. return $core.withContext(function($ctx2) {
  7781. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  7782. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7783. }));
  7784. return $recv(stream)._contents();
  7785. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  7786. },
  7787. args: ["aBlock"],
  7788. source: "collect: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09stream nextPut: (aBlock value: each) ].\x0a\x09^ stream contents",
  7789. referencedClasses: [],
  7790. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  7791. }),
  7792. $globals.Collection);
  7793. $core.addMethod(
  7794. $core.method({
  7795. selector: "copyWith:",
  7796. protocol: "copying",
  7797. fn: function (anObject){
  7798. var self=this,$self=this;
  7799. return $core.withContext(function($ctx1) {
  7800. var $1;
  7801. $1=$self._copy();
  7802. $recv($1)._add_(anObject);
  7803. return $recv($1)._yourself();
  7804. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  7805. },
  7806. args: ["anObject"],
  7807. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  7808. referencedClasses: [],
  7809. messageSends: ["add:", "copy", "yourself"]
  7810. }),
  7811. $globals.Collection);
  7812. $core.addMethod(
  7813. $core.method({
  7814. selector: "copyWithAll:",
  7815. protocol: "copying",
  7816. fn: function (aCollection){
  7817. var self=this,$self=this;
  7818. return $core.withContext(function($ctx1) {
  7819. $self._deprecatedAPI_("Use #, instead.");
  7820. return $self.__comma(aCollection);
  7821. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  7822. },
  7823. args: ["aCollection"],
  7824. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  7825. referencedClasses: [],
  7826. messageSends: ["deprecatedAPI:", ","]
  7827. }),
  7828. $globals.Collection);
  7829. $core.addMethod(
  7830. $core.method({
  7831. selector: "copyWithout:",
  7832. protocol: "copying",
  7833. fn: function (anObject){
  7834. var self=this,$self=this;
  7835. return $core.withContext(function($ctx1) {
  7836. return $self._reject_((function(each){
  7837. return $core.withContext(function($ctx2) {
  7838. return $recv(each).__eq(anObject);
  7839. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7840. }));
  7841. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  7842. },
  7843. args: ["anObject"],
  7844. source: "copyWithout: anObject\x0a\x09\x22Answer a copy of the receiver that does not contain\x0a\x09any occurrences of anObject.\x22\x0a\x0a\x09^ self reject: [ :each | each = anObject ]",
  7845. referencedClasses: [],
  7846. messageSends: ["reject:", "="]
  7847. }),
  7848. $globals.Collection);
  7849. $core.addMethod(
  7850. $core.method({
  7851. selector: "copyWithoutAll:",
  7852. protocol: "copying",
  7853. fn: function (aCollection){
  7854. var self=this,$self=this;
  7855. return $core.withContext(function($ctx1) {
  7856. return $self._reject_((function(each){
  7857. return $core.withContext(function($ctx2) {
  7858. return $recv(aCollection)._includes_(each);
  7859. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7860. }));
  7861. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  7862. },
  7863. args: ["aCollection"],
  7864. source: "copyWithoutAll: aCollection\x0a\x09\x22Answer a copy of the receiver that does not contain any elements\x0a\x09equal to those in aCollection.\x22\x0a\x0a\x09^ self reject: [ :each | aCollection includes: each ]",
  7865. referencedClasses: [],
  7866. messageSends: ["reject:", "includes:"]
  7867. }),
  7868. $globals.Collection);
  7869. $core.addMethod(
  7870. $core.method({
  7871. selector: "deepCopy",
  7872. protocol: "copying",
  7873. fn: function (){
  7874. var self=this,$self=this;
  7875. return $core.withContext(function($ctx1) {
  7876. return $self._collect_((function(each){
  7877. return $core.withContext(function($ctx2) {
  7878. return $recv(each)._deepCopy();
  7879. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7880. }));
  7881. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  7882. },
  7883. args: [],
  7884. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  7885. referencedClasses: [],
  7886. messageSends: ["collect:", "deepCopy"]
  7887. }),
  7888. $globals.Collection);
  7889. $core.addMethod(
  7890. $core.method({
  7891. selector: "detect:",
  7892. protocol: "enumerating",
  7893. fn: function (aBlock){
  7894. var self=this,$self=this;
  7895. return $core.withContext(function($ctx1) {
  7896. return $self._detect_ifNone_(aBlock,(function(){
  7897. return $core.withContext(function($ctx2) {
  7898. return $self._errorNotFound();
  7899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7900. }));
  7901. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  7902. },
  7903. args: ["aBlock"],
  7904. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  7905. referencedClasses: [],
  7906. messageSends: ["detect:ifNone:", "errorNotFound"]
  7907. }),
  7908. $globals.Collection);
  7909. $core.addMethod(
  7910. $core.method({
  7911. selector: "detect:ifNone:",
  7912. protocol: "enumerating",
  7913. fn: function (aBlock,anotherBlock){
  7914. var self=this,$self=this;
  7915. return $core.withContext(function($ctx1) {
  7916. var $1;
  7917. var $early={};
  7918. try {
  7919. $self._do_((function(each){
  7920. return $core.withContext(function($ctx2) {
  7921. $1=$recv(aBlock)._value_(each);
  7922. if($core.assert($1)){
  7923. throw $early=[each];
  7924. }
  7925. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7926. }));
  7927. return $recv(anotherBlock)._value();
  7928. }
  7929. catch(e) {if(e===$early)return e[0]; throw e}
  7930. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7931. },
  7932. args: ["aBlock", "anotherBlock"],
  7933. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  7934. referencedClasses: [],
  7935. messageSends: ["do:", "ifTrue:", "value:", "value"]
  7936. }),
  7937. $globals.Collection);
  7938. $core.addMethod(
  7939. $core.method({
  7940. selector: "do:",
  7941. protocol: "enumerating",
  7942. fn: function (aBlock){
  7943. var self=this,$self=this;
  7944. return $core.withContext(function($ctx1) {
  7945. $self._subclassResponsibility();
  7946. return self;
  7947. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  7948. },
  7949. args: ["aBlock"],
  7950. source: "do: aBlock\x0a\x09self subclassResponsibility",
  7951. referencedClasses: [],
  7952. messageSends: ["subclassResponsibility"]
  7953. }),
  7954. $globals.Collection);
  7955. $core.addMethod(
  7956. $core.method({
  7957. selector: "do:separatedBy:",
  7958. protocol: "enumerating",
  7959. fn: function (aBlock,anotherBlock){
  7960. var self=this,$self=this;
  7961. var actionBeforeElement;
  7962. return $core.withContext(function($ctx1) {
  7963. actionBeforeElement=(function(){
  7964. actionBeforeElement=anotherBlock;
  7965. return actionBeforeElement;
  7966. });
  7967. $self._do_((function(each){
  7968. return $core.withContext(function($ctx2) {
  7969. $recv(actionBeforeElement)._value();
  7970. return $recv(aBlock)._value_(each);
  7971. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7972. }));
  7973. return self;
  7974. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  7975. },
  7976. args: ["aBlock", "anotherBlock"],
  7977. source: "do: aBlock separatedBy: anotherBlock\x0a\x09| actionBeforeElement |\x0a\x09actionBeforeElement := [ actionBeforeElement := anotherBlock ].\x0a\x09self do: [ :each |\x0a\x09\x09actionBeforeElement value.\x0a\x09\x09aBlock value: each ]",
  7978. referencedClasses: [],
  7979. messageSends: ["do:", "value", "value:"]
  7980. }),
  7981. $globals.Collection);
  7982. $core.addMethod(
  7983. $core.method({
  7984. selector: "errorNotFound",
  7985. protocol: "error handling",
  7986. fn: function (){
  7987. var self=this,$self=this;
  7988. return $core.withContext(function($ctx1) {
  7989. $self._error_("Object is not in the collection");
  7990. return self;
  7991. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  7992. },
  7993. args: [],
  7994. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  7995. referencedClasses: [],
  7996. messageSends: ["error:"]
  7997. }),
  7998. $globals.Collection);
  7999. $core.addMethod(
  8000. $core.method({
  8001. selector: "ifEmpty:",
  8002. protocol: "testing",
  8003. fn: function (aBlock){
  8004. var self=this,$self=this;
  8005. return $core.withContext(function($ctx1) {
  8006. var $1;
  8007. $1=$self._isEmpty();
  8008. if($core.assert($1)){
  8009. return $recv(aBlock)._value();
  8010. } else {
  8011. return self;
  8012. }
  8013. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  8014. },
  8015. args: ["aBlock"],
  8016. source: "ifEmpty: aBlock\x0a\x09\x22Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver. \x0a\x09Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: \x0a\x09\x09self classifyMethodAs:\x0a\x09\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ self ]",
  8017. referencedClasses: [],
  8018. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  8019. }),
  8020. $globals.Collection);
  8021. $core.addMethod(
  8022. $core.method({
  8023. selector: "ifEmpty:ifNotEmpty:",
  8024. protocol: "testing",
  8025. fn: function (aBlock,anotherBlock){
  8026. var self=this,$self=this;
  8027. return $core.withContext(function($ctx1) {
  8028. var $1;
  8029. $1=$self._isEmpty();
  8030. if($core.assert($1)){
  8031. return $recv(aBlock)._value();
  8032. } else {
  8033. return $recv(anotherBlock)._value_(self);
  8034. }
  8035. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  8036. },
  8037. args: ["aBlock", "anotherBlock"],
  8038. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  8039. referencedClasses: [],
  8040. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  8041. }),
  8042. $globals.Collection);
  8043. $core.addMethod(
  8044. $core.method({
  8045. selector: "ifNotEmpty:",
  8046. protocol: "testing",
  8047. fn: function (aBlock){
  8048. var self=this,$self=this;
  8049. return $core.withContext(function($ctx1) {
  8050. var $1;
  8051. $1=$self._notEmpty();
  8052. if($core.assert($1)){
  8053. return $recv(aBlock)._value_(self);
  8054. } else {
  8055. return self;
  8056. }
  8057. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  8058. },
  8059. args: ["aBlock"],
  8060. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  8061. referencedClasses: [],
  8062. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  8063. }),
  8064. $globals.Collection);
  8065. $core.addMethod(
  8066. $core.method({
  8067. selector: "ifNotEmpty:ifEmpty:",
  8068. protocol: "testing",
  8069. fn: function (aBlock,anotherBlock){
  8070. var self=this,$self=this;
  8071. return $core.withContext(function($ctx1) {
  8072. var $1;
  8073. $1=$self._notEmpty();
  8074. if($core.assert($1)){
  8075. return $recv(aBlock)._value_(self);
  8076. } else {
  8077. return $recv(anotherBlock)._value();
  8078. }
  8079. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  8080. },
  8081. args: ["aBlock", "anotherBlock"],
  8082. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  8083. referencedClasses: [],
  8084. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  8085. }),
  8086. $globals.Collection);
  8087. $core.addMethod(
  8088. $core.method({
  8089. selector: "includes:",
  8090. protocol: "testing",
  8091. fn: function (anObject){
  8092. var self=this,$self=this;
  8093. return $core.withContext(function($ctx1) {
  8094. return $self._anySatisfy_((function(each){
  8095. return $core.withContext(function($ctx2) {
  8096. return $recv(each).__eq(anObject);
  8097. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8098. }));
  8099. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  8100. },
  8101. args: ["anObject"],
  8102. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  8103. referencedClasses: [],
  8104. messageSends: ["anySatisfy:", "="]
  8105. }),
  8106. $globals.Collection);
  8107. $core.addMethod(
  8108. $core.method({
  8109. selector: "inject:into:",
  8110. protocol: "enumerating",
  8111. fn: function (anObject,aBlock){
  8112. var self=this,$self=this;
  8113. var result;
  8114. return $core.withContext(function($ctx1) {
  8115. result=anObject;
  8116. $self._do_((function(each){
  8117. return $core.withContext(function($ctx2) {
  8118. result=$recv(aBlock)._value_value_(result,each);
  8119. return result;
  8120. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8121. }));
  8122. return result;
  8123. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  8124. },
  8125. args: ["anObject", "aBlock"],
  8126. source: "inject: anObject into: aBlock\x0a\x09| result |\x0a\x09result := anObject.\x0a\x09self do: [ :each |\x0a\x09\x09result := aBlock value: result value: each ].\x0a\x09^ result",
  8127. referencedClasses: [],
  8128. messageSends: ["do:", "value:value:"]
  8129. }),
  8130. $globals.Collection);
  8131. $core.addMethod(
  8132. $core.method({
  8133. selector: "intersection:",
  8134. protocol: "enumerating",
  8135. fn: function (aCollection){
  8136. var self=this,$self=this;
  8137. var set,outputSet;
  8138. return $core.withContext(function($ctx1) {
  8139. var $2,$1;
  8140. set=$self._asSet();
  8141. outputSet=$recv($globals.Set)._new();
  8142. $recv(aCollection)._do_((function(each){
  8143. return $core.withContext(function($ctx2) {
  8144. $2=$recv(set)._includes_(each);
  8145. $ctx2.sendIdx["includes:"]=1;
  8146. $1=$recv($2)._and_((function(){
  8147. return $core.withContext(function($ctx3) {
  8148. return $recv($recv(outputSet)._includes_(each))._not();
  8149. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8150. }));
  8151. if($core.assert($1)){
  8152. return $recv(outputSet)._add_(each);
  8153. }
  8154. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8155. }));
  8156. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  8157. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  8158. },
  8159. args: ["aCollection"],
  8160. source: "intersection: aCollection\x0a\x09\x22Answer the set theoretic intersection of two collections.\x22\x0a\x0a\x09| set outputSet |\x0a\x09\x0a\x09set := self asSet.\x0a\x09outputSet := Set new.\x0a\x09\x0a\x09aCollection do: [ :each |\x0a\x09\x09((set includes: each) and: [ (outputSet includes: each) not ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09outputSet add: each ]].\x0a\x09\x09\x0a\x09^ self class withAll: outputSet asArray",
  8161. referencedClasses: ["Set"],
  8162. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  8163. }),
  8164. $globals.Collection);
  8165. $core.addMethod(
  8166. $core.method({
  8167. selector: "isEmpty",
  8168. protocol: "testing",
  8169. fn: function (){
  8170. var self=this,$self=this;
  8171. return $core.withContext(function($ctx1) {
  8172. return $recv($self._size()).__eq((0));
  8173. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  8174. },
  8175. args: [],
  8176. source: "isEmpty\x0a\x09^ self size = 0",
  8177. referencedClasses: [],
  8178. messageSends: ["=", "size"]
  8179. }),
  8180. $globals.Collection);
  8181. $core.addMethod(
  8182. $core.method({
  8183. selector: "noneSatisfy:",
  8184. protocol: "enumerating",
  8185. fn: function (aBlock){
  8186. var self=this,$self=this;
  8187. return $core.withContext(function($ctx1) {
  8188. var $1;
  8189. var $early={};
  8190. try {
  8191. $self._do_((function(item){
  8192. return $core.withContext(function($ctx2) {
  8193. $1=$recv(aBlock)._value_(item);
  8194. if($core.assert($1)){
  8195. throw $early=[false];
  8196. }
  8197. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  8198. }));
  8199. return true;
  8200. }
  8201. catch(e) {if(e===$early)return e[0]; throw e}
  8202. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  8203. },
  8204. args: ["aBlock"],
  8205. source: "noneSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for all elements return true.\x0a\x09Otherwise return false\x22\x0a\x0a\x09self do: [ :item | (aBlock value: item) ifTrue: [ ^ false ] ].\x0a\x09^ true",
  8206. referencedClasses: [],
  8207. messageSends: ["do:", "ifTrue:", "value:"]
  8208. }),
  8209. $globals.Collection);
  8210. $core.addMethod(
  8211. $core.method({
  8212. selector: "notEmpty",
  8213. protocol: "testing",
  8214. fn: function (){
  8215. var self=this,$self=this;
  8216. return $core.withContext(function($ctx1) {
  8217. return $recv($self._isEmpty())._not();
  8218. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  8219. },
  8220. args: [],
  8221. source: "notEmpty\x0a\x09^ self isEmpty not",
  8222. referencedClasses: [],
  8223. messageSends: ["not", "isEmpty"]
  8224. }),
  8225. $globals.Collection);
  8226. $core.addMethod(
  8227. $core.method({
  8228. selector: "occurrencesOf:",
  8229. protocol: "accessing",
  8230. fn: function (anObject){
  8231. var self=this,$self=this;
  8232. var tally;
  8233. return $core.withContext(function($ctx1) {
  8234. var $1;
  8235. tally=(0);
  8236. $self._do_((function(each){
  8237. return $core.withContext(function($ctx2) {
  8238. $1=$recv(anObject).__eq(each);
  8239. if($core.assert($1)){
  8240. tally=$recv(tally).__plus((1));
  8241. return tally;
  8242. }
  8243. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8244. }));
  8245. return tally;
  8246. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  8247. },
  8248. args: ["anObject"],
  8249. source: "occurrencesOf: anObject\x0a\x09\x22Answer how many of the receiver's elements are equal to anObject.\x22\x0a\x0a\x09| tally |\x0a\x09tally := 0.\x0a\x09self do: [ :each | anObject = each ifTrue: [ tally := tally + 1 ]].\x0a\x09^ tally",
  8250. referencedClasses: [],
  8251. messageSends: ["do:", "ifTrue:", "=", "+"]
  8252. }),
  8253. $globals.Collection);
  8254. $core.addMethod(
  8255. $core.method({
  8256. selector: "putOn:",
  8257. protocol: "streaming",
  8258. fn: function (aStream){
  8259. var self=this,$self=this;
  8260. return $core.withContext(function($ctx1) {
  8261. $self._do_((function(each){
  8262. return $core.withContext(function($ctx2) {
  8263. return $recv(each)._putOn_(aStream);
  8264. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8265. }));
  8266. return self;
  8267. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  8268. },
  8269. args: ["aStream"],
  8270. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  8271. referencedClasses: [],
  8272. messageSends: ["do:", "putOn:"]
  8273. }),
  8274. $globals.Collection);
  8275. $core.addMethod(
  8276. $core.method({
  8277. selector: "reject:",
  8278. protocol: "enumerating",
  8279. fn: function (aBlock){
  8280. var self=this,$self=this;
  8281. return $core.withContext(function($ctx1) {
  8282. return $self._select_((function(each){
  8283. return $core.withContext(function($ctx2) {
  8284. return $recv($recv(aBlock)._value_(each)).__eq(false);
  8285. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8286. }));
  8287. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  8288. },
  8289. args: ["aBlock"],
  8290. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  8291. referencedClasses: [],
  8292. messageSends: ["select:", "=", "value:"]
  8293. }),
  8294. $globals.Collection);
  8295. $core.addMethod(
  8296. $core.method({
  8297. selector: "remove:",
  8298. protocol: "adding/removing",
  8299. fn: function (anObject){
  8300. var self=this,$self=this;
  8301. return $core.withContext(function($ctx1) {
  8302. return $self._remove_ifAbsent_(anObject,(function(){
  8303. return $core.withContext(function($ctx2) {
  8304. return $self._errorNotFound();
  8305. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8306. }));
  8307. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  8308. },
  8309. args: ["anObject"],
  8310. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  8311. referencedClasses: [],
  8312. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  8313. }),
  8314. $globals.Collection);
  8315. $core.addMethod(
  8316. $core.method({
  8317. selector: "remove:ifAbsent:",
  8318. protocol: "adding/removing",
  8319. fn: function (anObject,aBlock){
  8320. var self=this,$self=this;
  8321. return $core.withContext(function($ctx1) {
  8322. $self._subclassResponsibility();
  8323. return self;
  8324. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  8325. },
  8326. args: ["anObject", "aBlock"],
  8327. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  8328. referencedClasses: [],
  8329. messageSends: ["subclassResponsibility"]
  8330. }),
  8331. $globals.Collection);
  8332. $core.addMethod(
  8333. $core.method({
  8334. selector: "removeAll",
  8335. protocol: "adding/removing",
  8336. fn: function (){
  8337. var self=this,$self=this;
  8338. return $core.withContext(function($ctx1) {
  8339. $self._subclassResponsibility();
  8340. return self;
  8341. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  8342. },
  8343. args: [],
  8344. source: "removeAll\x0a\x09self subclassResponsibility",
  8345. referencedClasses: [],
  8346. messageSends: ["subclassResponsibility"]
  8347. }),
  8348. $globals.Collection);
  8349. $core.addMethod(
  8350. $core.method({
  8351. selector: "select:",
  8352. protocol: "enumerating",
  8353. fn: function (aBlock){
  8354. var self=this,$self=this;
  8355. var stream;
  8356. return $core.withContext(function($ctx1) {
  8357. var $1;
  8358. stream=$recv($recv($self._class())._new())._writeStream();
  8359. $self._do_((function(each){
  8360. return $core.withContext(function($ctx2) {
  8361. $1=$recv(aBlock)._value_(each);
  8362. if($core.assert($1)){
  8363. return $recv(stream)._nextPut_(each);
  8364. }
  8365. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8366. }));
  8367. return $recv(stream)._contents();
  8368. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  8369. },
  8370. args: ["aBlock"],
  8371. source: "select: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: each ] ].\x0a\x09^ stream contents",
  8372. referencedClasses: [],
  8373. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8374. }),
  8375. $globals.Collection);
  8376. $core.addMethod(
  8377. $core.method({
  8378. selector: "select:thenCollect:",
  8379. protocol: "enumerating",
  8380. fn: function (selectBlock,collectBlock){
  8381. var self=this,$self=this;
  8382. var stream;
  8383. return $core.withContext(function($ctx1) {
  8384. var $1;
  8385. stream=$recv($recv($self._class())._new())._writeStream();
  8386. $self._do_((function(each){
  8387. return $core.withContext(function($ctx2) {
  8388. $1=$recv(selectBlock)._value_(each);
  8389. $ctx2.sendIdx["value:"]=1;
  8390. if($core.assert($1)){
  8391. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  8392. }
  8393. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8394. }));
  8395. return $recv(stream)._contents();
  8396. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  8397. },
  8398. args: ["selectBlock", "collectBlock"],
  8399. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: (collectBlock value: each) ] ].\x0a\x09^ stream contents",
  8400. referencedClasses: [],
  8401. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8402. }),
  8403. $globals.Collection);
  8404. $core.addMethod(
  8405. $core.method({
  8406. selector: "shallowCopy",
  8407. protocol: "copying",
  8408. fn: function (){
  8409. var self=this,$self=this;
  8410. return $core.withContext(function($ctx1) {
  8411. return $self._collect_((function(each){
  8412. return each;
  8413. }));
  8414. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  8415. },
  8416. args: [],
  8417. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  8418. referencedClasses: [],
  8419. messageSends: ["collect:"]
  8420. }),
  8421. $globals.Collection);
  8422. $core.addMethod(
  8423. $core.method({
  8424. selector: "single",
  8425. protocol: "accessing",
  8426. fn: function (){
  8427. var self=this,$self=this;
  8428. return $core.withContext(function($ctx1) {
  8429. var $1;
  8430. $self._ifEmpty_((function(){
  8431. return $core.withContext(function($ctx2) {
  8432. return $self._error_("Collection is empty");
  8433. $ctx2.sendIdx["error:"]=1;
  8434. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8435. }));
  8436. $1=$recv($self._size()).__gt((1));
  8437. if($core.assert($1)){
  8438. $self._error_("Collection holds more than one element");
  8439. }
  8440. return $self._anyOne();
  8441. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  8442. },
  8443. args: [],
  8444. source: "single\x0a\x09\x22Answer a single element.\x0a\x09Raise an error if collection holds less or more than one element.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self size > 1 ifTrue: [ self error: 'Collection holds more than one element' ].\x0a\x09^ self anyOne",
  8445. referencedClasses: [],
  8446. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  8447. }),
  8448. $globals.Collection);
  8449. $core.addMethod(
  8450. $core.method({
  8451. selector: "size",
  8452. protocol: "accessing",
  8453. fn: function (){
  8454. var self=this,$self=this;
  8455. return $core.withContext(function($ctx1) {
  8456. $self._subclassResponsibility();
  8457. return self;
  8458. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  8459. },
  8460. args: [],
  8461. source: "size\x0a\x09self subclassResponsibility",
  8462. referencedClasses: [],
  8463. messageSends: ["subclassResponsibility"]
  8464. }),
  8465. $globals.Collection);
  8466. $core.addMethod(
  8467. $core.method({
  8468. selector: "classTag",
  8469. protocol: "accessing",
  8470. fn: function (){
  8471. var self=this,$self=this;
  8472. return "collection";
  8473. },
  8474. args: [],
  8475. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'collection'",
  8476. referencedClasses: [],
  8477. messageSends: []
  8478. }),
  8479. $globals.Collection.a$cls);
  8480. $core.addMethod(
  8481. $core.method({
  8482. selector: "new:",
  8483. protocol: "instance creation",
  8484. fn: function (anInteger){
  8485. var self=this,$self=this;
  8486. return $core.withContext(function($ctx1) {
  8487. return $self._new();
  8488. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  8489. },
  8490. args: ["anInteger"],
  8491. source: "new: anInteger\x0a\x09^ self new",
  8492. referencedClasses: [],
  8493. messageSends: ["new"]
  8494. }),
  8495. $globals.Collection.a$cls);
  8496. $core.addMethod(
  8497. $core.method({
  8498. selector: "with:",
  8499. protocol: "instance creation",
  8500. fn: function (anObject){
  8501. var self=this,$self=this;
  8502. return $core.withContext(function($ctx1) {
  8503. var $1;
  8504. $1=$self._new();
  8505. $recv($1)._add_(anObject);
  8506. return $recv($1)._yourself();
  8507. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  8508. },
  8509. args: ["anObject"],
  8510. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  8511. referencedClasses: [],
  8512. messageSends: ["add:", "new", "yourself"]
  8513. }),
  8514. $globals.Collection.a$cls);
  8515. $core.addMethod(
  8516. $core.method({
  8517. selector: "with:with:",
  8518. protocol: "instance creation",
  8519. fn: function (anObject,anotherObject){
  8520. var self=this,$self=this;
  8521. return $core.withContext(function($ctx1) {
  8522. var $1;
  8523. $1=$self._new();
  8524. $recv($1)._add_(anObject);
  8525. $ctx1.sendIdx["add:"]=1;
  8526. $recv($1)._add_(anotherObject);
  8527. return $recv($1)._yourself();
  8528. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  8529. },
  8530. args: ["anObject", "anotherObject"],
  8531. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  8532. referencedClasses: [],
  8533. messageSends: ["add:", "new", "yourself"]
  8534. }),
  8535. $globals.Collection.a$cls);
  8536. $core.addMethod(
  8537. $core.method({
  8538. selector: "with:with:with:",
  8539. protocol: "instance creation",
  8540. fn: function (firstObject,secondObject,thirdObject){
  8541. var self=this,$self=this;
  8542. return $core.withContext(function($ctx1) {
  8543. var $1;
  8544. $1=$self._new();
  8545. $recv($1)._add_(firstObject);
  8546. $ctx1.sendIdx["add:"]=1;
  8547. $recv($1)._add_(secondObject);
  8548. $ctx1.sendIdx["add:"]=2;
  8549. $recv($1)._add_(thirdObject);
  8550. return $recv($1)._yourself();
  8551. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  8552. },
  8553. args: ["firstObject", "secondObject", "thirdObject"],
  8554. source: "with: firstObject with: secondObject with: thirdObject\x0a\x09\x09^ self new\x0a\x09\x09add: firstObject;\x0a\x09\x09add: secondObject;\x0a\x09\x09add: thirdObject;\x0a\x09\x09yourself",
  8555. referencedClasses: [],
  8556. messageSends: ["add:", "new", "yourself"]
  8557. }),
  8558. $globals.Collection.a$cls);
  8559. $core.addMethod(
  8560. $core.method({
  8561. selector: "withAll:",
  8562. protocol: "instance creation",
  8563. fn: function (aCollection){
  8564. var self=this,$self=this;
  8565. return $core.withContext(function($ctx1) {
  8566. var $1;
  8567. $1=$self._new();
  8568. $recv($1)._addAll_(aCollection);
  8569. return $recv($1)._yourself();
  8570. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  8571. },
  8572. args: ["aCollection"],
  8573. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  8574. referencedClasses: [],
  8575. messageSends: ["addAll:", "new", "yourself"]
  8576. }),
  8577. $globals.Collection.a$cls);
  8578. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  8579. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  8580. $core.addMethod(
  8581. $core.method({
  8582. selector: "=",
  8583. protocol: "comparing",
  8584. fn: function (anAssocitativeCollection){
  8585. var self=this,$self=this;
  8586. return $core.withContext(function($ctx1) {
  8587. var $2,$1,$4,$3,$5;
  8588. $2=$self._class();
  8589. $ctx1.sendIdx["class"]=1;
  8590. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  8591. $ctx1.sendIdx["="]=1;
  8592. if(!$core.assert($1)){
  8593. return false;
  8594. }
  8595. $4=$self._size();
  8596. $ctx1.sendIdx["size"]=1;
  8597. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  8598. $ctx1.sendIdx["="]=2;
  8599. if(!$core.assert($3)){
  8600. return false;
  8601. }
  8602. $5=$self._associations();
  8603. $ctx1.sendIdx["associations"]=1;
  8604. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  8605. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  8606. },
  8607. args: ["anAssocitativeCollection"],
  8608. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  8609. referencedClasses: [],
  8610. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  8611. }),
  8612. $globals.AssociativeCollection);
  8613. $core.addMethod(
  8614. $core.method({
  8615. selector: "add:",
  8616. protocol: "adding/removing",
  8617. fn: function (anAssociation){
  8618. var self=this,$self=this;
  8619. return $core.withContext(function($ctx1) {
  8620. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  8621. return self;
  8622. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  8623. },
  8624. args: ["anAssociation"],
  8625. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  8626. referencedClasses: [],
  8627. messageSends: ["at:put:", "key", "value"]
  8628. }),
  8629. $globals.AssociativeCollection);
  8630. $core.addMethod(
  8631. $core.method({
  8632. selector: "addAll:",
  8633. protocol: "adding/removing",
  8634. fn: function (anAssociativeCollection){
  8635. var self=this,$self=this;
  8636. return $core.withContext(function($ctx1) {
  8637. (
  8638. $ctx1.supercall = true,
  8639. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  8640. $ctx1.supercall = false;
  8641. return anAssociativeCollection;
  8642. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  8643. },
  8644. args: ["anAssociativeCollection"],
  8645. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  8646. referencedClasses: [],
  8647. messageSends: ["addAll:", "associations"]
  8648. }),
  8649. $globals.AssociativeCollection);
  8650. $core.addMethod(
  8651. $core.method({
  8652. selector: "asDictionary",
  8653. protocol: "converting",
  8654. fn: function (){
  8655. var self=this,$self=this;
  8656. return $core.withContext(function($ctx1) {
  8657. return $recv($globals.Dictionary)._from_($self._associations());
  8658. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  8659. },
  8660. args: [],
  8661. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  8662. referencedClasses: ["Dictionary"],
  8663. messageSends: ["from:", "associations"]
  8664. }),
  8665. $globals.AssociativeCollection);
  8666. $core.addMethod(
  8667. $core.method({
  8668. selector: "asHashedCollection",
  8669. protocol: "converting",
  8670. fn: function (){
  8671. var self=this,$self=this;
  8672. return $core.withContext(function($ctx1) {
  8673. return $recv($globals.HashedCollection)._from_($self._associations());
  8674. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  8675. },
  8676. args: [],
  8677. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  8678. referencedClasses: ["HashedCollection"],
  8679. messageSends: ["from:", "associations"]
  8680. }),
  8681. $globals.AssociativeCollection);
  8682. $core.addMethod(
  8683. $core.method({
  8684. selector: "asJavaScriptObject",
  8685. protocol: "converting",
  8686. fn: function (){
  8687. var self=this,$self=this;
  8688. var hash;
  8689. return $core.withContext(function($ctx1) {
  8690. hash=$recv($globals.HashedCollection)._new();
  8691. $self._keysAndValuesDo_((function(key,value){
  8692. return $core.withContext(function($ctx2) {
  8693. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  8694. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8695. }));
  8696. return hash;
  8697. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  8698. },
  8699. args: [],
  8700. source: "asJavaScriptObject\x0a\x09| hash |\x0a\x09hash := HashedCollection new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09hash at: key put: value asJavaScriptObject ].\x0a\x09^ hash",
  8701. referencedClasses: ["HashedCollection"],
  8702. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  8703. }),
  8704. $globals.AssociativeCollection);
  8705. $core.addMethod(
  8706. $core.method({
  8707. selector: "associations",
  8708. protocol: "accessing",
  8709. fn: function (){
  8710. var self=this,$self=this;
  8711. var associations;
  8712. return $core.withContext(function($ctx1) {
  8713. associations=[];
  8714. $self._associationsDo_((function(each){
  8715. return $core.withContext(function($ctx2) {
  8716. return $recv(associations)._add_(each);
  8717. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8718. }));
  8719. return associations;
  8720. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  8721. },
  8722. args: [],
  8723. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  8724. referencedClasses: [],
  8725. messageSends: ["associationsDo:", "add:"]
  8726. }),
  8727. $globals.AssociativeCollection);
  8728. $core.addMethod(
  8729. $core.method({
  8730. selector: "associationsDo:",
  8731. protocol: "enumerating",
  8732. fn: function (aBlock){
  8733. var self=this,$self=this;
  8734. return $core.withContext(function($ctx1) {
  8735. $self._keysAndValuesDo_((function(key,value){
  8736. return $core.withContext(function($ctx2) {
  8737. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  8738. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8739. }));
  8740. return self;
  8741. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8742. },
  8743. args: ["aBlock"],
  8744. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  8745. referencedClasses: ["Association"],
  8746. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  8747. }),
  8748. $globals.AssociativeCollection);
  8749. $core.addMethod(
  8750. $core.method({
  8751. selector: "at:ifPresent:ifAbsent:",
  8752. protocol: "accessing",
  8753. fn: function (aKey,aBlock,anotherBlock){
  8754. var self=this,$self=this;
  8755. return $core.withContext(function($ctx1) {
  8756. var $1;
  8757. $1=$self._includesKey_(aKey);
  8758. if($core.assert($1)){
  8759. return $recv(aBlock)._value_($self._at_(aKey));
  8760. } else {
  8761. return $recv(anotherBlock)._value();
  8762. }
  8763. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8764. },
  8765. args: ["aKey", "aBlock", "anotherBlock"],
  8766. source: "at: aKey ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given key in the receiver.\x0a\x09If it is present, answer the value of evaluating the oneArgBlock \x0a\x09with the value associated with the key, otherwise answer the value \x0a\x09of absentBlock.\x22\x0a\x09\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: [ anotherBlock value ]",
  8767. referencedClasses: [],
  8768. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  8769. }),
  8770. $globals.AssociativeCollection);
  8771. $core.addMethod(
  8772. $core.method({
  8773. selector: "collect:",
  8774. protocol: "enumerating",
  8775. fn: function (aBlock){
  8776. var self=this,$self=this;
  8777. var newDict;
  8778. return $core.withContext(function($ctx1) {
  8779. newDict=$recv($self._class())._new();
  8780. $self._keysAndValuesDo_((function(key,value){
  8781. return $core.withContext(function($ctx2) {
  8782. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  8783. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8784. }));
  8785. return newDict;
  8786. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  8787. },
  8788. args: ["aBlock"],
  8789. source: "collect: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09newDict at: key put: (aBlock value: value) ].\x0a\x09^ newDict",
  8790. referencedClasses: [],
  8791. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  8792. }),
  8793. $globals.AssociativeCollection);
  8794. $core.addMethod(
  8795. $core.method({
  8796. selector: "deepCopy",
  8797. protocol: "copying",
  8798. fn: function (){
  8799. var self=this,$self=this;
  8800. var copy;
  8801. return $core.withContext(function($ctx1) {
  8802. copy=$recv($self._class())._new();
  8803. $self._keysAndValuesDo_((function(key,value){
  8804. return $core.withContext(function($ctx2) {
  8805. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  8806. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8807. }));
  8808. return copy;
  8809. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  8810. },
  8811. args: [],
  8812. source: "deepCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value deepCopy ].\x0a\x09^ copy",
  8813. referencedClasses: [],
  8814. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  8815. }),
  8816. $globals.AssociativeCollection);
  8817. $core.addMethod(
  8818. $core.method({
  8819. selector: "detect:ifNone:",
  8820. protocol: "enumerating",
  8821. fn: function (aBlock,anotherBlock){
  8822. var self=this,$self=this;
  8823. return $core.withContext(function($ctx1) {
  8824. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  8825. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8826. },
  8827. args: ["aBlock", "anotherBlock"],
  8828. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  8829. referencedClasses: [],
  8830. messageSends: ["detect:ifNone:", "values"]
  8831. }),
  8832. $globals.AssociativeCollection);
  8833. $core.addMethod(
  8834. $core.method({
  8835. selector: "do:",
  8836. protocol: "enumerating",
  8837. fn: function (aBlock){
  8838. var self=this,$self=this;
  8839. return $core.withContext(function($ctx1) {
  8840. $self._valuesDo_(aBlock);
  8841. return self;
  8842. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8843. },
  8844. args: ["aBlock"],
  8845. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  8846. referencedClasses: [],
  8847. messageSends: ["valuesDo:"]
  8848. }),
  8849. $globals.AssociativeCollection);
  8850. $core.addMethod(
  8851. $core.method({
  8852. selector: "includes:",
  8853. protocol: "enumerating",
  8854. fn: function (anObject){
  8855. var self=this,$self=this;
  8856. return $core.withContext(function($ctx1) {
  8857. return $recv($self._values())._includes_(anObject);
  8858. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  8859. },
  8860. args: ["anObject"],
  8861. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  8862. referencedClasses: [],
  8863. messageSends: ["includes:", "values"]
  8864. }),
  8865. $globals.AssociativeCollection);
  8866. $core.addMethod(
  8867. $core.method({
  8868. selector: "includesKey:",
  8869. protocol: "testing",
  8870. fn: function (aKey){
  8871. var self=this,$self=this;
  8872. return $core.withContext(function($ctx1) {
  8873. $self._subclassResponsibility();
  8874. return self;
  8875. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  8876. },
  8877. args: ["aKey"],
  8878. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  8879. referencedClasses: [],
  8880. messageSends: ["subclassResponsibility"]
  8881. }),
  8882. $globals.AssociativeCollection);
  8883. $core.addMethod(
  8884. $core.method({
  8885. selector: "indexOf:ifAbsent:",
  8886. protocol: "accessing",
  8887. fn: function (anObject,aBlock){
  8888. var self=this,$self=this;
  8889. return $core.withContext(function($ctx1) {
  8890. return $recv($self._keys())._detect_ifNone_((function(each){
  8891. return $core.withContext(function($ctx2) {
  8892. return $recv($self._at_(each)).__eq(anObject);
  8893. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8894. }),aBlock);
  8895. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  8896. },
  8897. args: ["anObject", "aBlock"],
  8898. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  8899. referencedClasses: [],
  8900. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  8901. }),
  8902. $globals.AssociativeCollection);
  8903. $core.addMethod(
  8904. $core.method({
  8905. selector: "keyAtValue:",
  8906. protocol: "accessing",
  8907. fn: function (anObject){
  8908. var self=this,$self=this;
  8909. return $core.withContext(function($ctx1) {
  8910. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  8911. return $core.withContext(function($ctx2) {
  8912. return $self._errorNotFound();
  8913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8914. }));
  8915. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  8916. },
  8917. args: ["anObject"],
  8918. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  8919. referencedClasses: [],
  8920. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  8921. }),
  8922. $globals.AssociativeCollection);
  8923. $core.addMethod(
  8924. $core.method({
  8925. selector: "keyAtValue:ifAbsent:",
  8926. protocol: "accessing",
  8927. fn: function (anObject,aBlock){
  8928. var self=this,$self=this;
  8929. return $core.withContext(function($ctx1) {
  8930. return $self._indexOf_ifAbsent_(anObject,aBlock);
  8931. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  8932. },
  8933. args: ["anObject", "aBlock"],
  8934. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  8935. referencedClasses: [],
  8936. messageSends: ["indexOf:ifAbsent:"]
  8937. }),
  8938. $globals.AssociativeCollection);
  8939. $core.addMethod(
  8940. $core.method({
  8941. selector: "keys",
  8942. protocol: "accessing",
  8943. fn: function (){
  8944. var self=this,$self=this;
  8945. return $core.withContext(function($ctx1) {
  8946. $self._subclassResponsibility();
  8947. return self;
  8948. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  8949. },
  8950. args: [],
  8951. source: "keys\x0a\x09self subclassResponsibility",
  8952. referencedClasses: [],
  8953. messageSends: ["subclassResponsibility"]
  8954. }),
  8955. $globals.AssociativeCollection);
  8956. $core.addMethod(
  8957. $core.method({
  8958. selector: "keysAndValuesDo:",
  8959. protocol: "enumerating",
  8960. fn: function (aBlock){
  8961. var self=this,$self=this;
  8962. return $core.withContext(function($ctx1) {
  8963. $self._keysDo_((function(each){
  8964. return $core.withContext(function($ctx2) {
  8965. return $recv(aBlock)._value_value_(each,$self._at_(each));
  8966. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8967. }));
  8968. return self;
  8969. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8970. },
  8971. args: ["aBlock"],
  8972. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  8973. referencedClasses: [],
  8974. messageSends: ["keysDo:", "value:value:", "at:"]
  8975. }),
  8976. $globals.AssociativeCollection);
  8977. $core.addMethod(
  8978. $core.method({
  8979. selector: "keysDo:",
  8980. protocol: "enumerating",
  8981. fn: function (aBlock){
  8982. var self=this,$self=this;
  8983. return $core.withContext(function($ctx1) {
  8984. $self._subclassResponsibility();
  8985. return self;
  8986. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8987. },
  8988. args: ["aBlock"],
  8989. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  8990. referencedClasses: [],
  8991. messageSends: ["subclassResponsibility"]
  8992. }),
  8993. $globals.AssociativeCollection);
  8994. $core.addMethod(
  8995. $core.method({
  8996. selector: "printOn:",
  8997. protocol: "printing",
  8998. fn: function (aStream){
  8999. var self=this,$self=this;
  9000. return $core.withContext(function($ctx1) {
  9001. (
  9002. $ctx1.supercall = true,
  9003. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  9004. $ctx1.supercall = false;
  9005. $ctx1.sendIdx["printOn:"]=1;
  9006. $recv(aStream)._nextPutAll_(" (");
  9007. $ctx1.sendIdx["nextPutAll:"]=1;
  9008. $recv($self._associations())._do_separatedBy_((function(each){
  9009. return $core.withContext(function($ctx2) {
  9010. return $recv(each)._printOn_(aStream);
  9011. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9012. }),(function(){
  9013. return $core.withContext(function($ctx2) {
  9014. return $recv(aStream)._nextPutAll_(" , ");
  9015. $ctx2.sendIdx["nextPutAll:"]=2;
  9016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9017. }));
  9018. $recv(aStream)._nextPutAll_(")");
  9019. return self;
  9020. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  9021. },
  9022. args: ["aStream"],
  9023. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self associations\x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' , ' ].\x0a\x09aStream nextPutAll: ')'",
  9024. referencedClasses: [],
  9025. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  9026. }),
  9027. $globals.AssociativeCollection);
  9028. $core.addMethod(
  9029. $core.method({
  9030. selector: "remove:ifAbsent:",
  9031. protocol: "adding/removing",
  9032. fn: function (aKey,aBlock){
  9033. var self=this,$self=this;
  9034. return $core.withContext(function($ctx1) {
  9035. return $self._removeKey_ifAbsent_(aKey,aBlock);
  9036. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9037. },
  9038. args: ["aKey", "aBlock"],
  9039. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  9040. referencedClasses: [],
  9041. messageSends: ["removeKey:ifAbsent:"]
  9042. }),
  9043. $globals.AssociativeCollection);
  9044. $core.addMethod(
  9045. $core.method({
  9046. selector: "removeAll",
  9047. protocol: "adding/removing",
  9048. fn: function (){
  9049. var self=this,$self=this;
  9050. return $core.withContext(function($ctx1) {
  9051. return $recv($self._keys())._do_((function(each){
  9052. return $core.withContext(function($ctx2) {
  9053. return $self._removeKey_(each);
  9054. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9055. }));
  9056. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  9057. },
  9058. args: [],
  9059. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  9060. referencedClasses: [],
  9061. messageSends: ["do:", "keys", "removeKey:"]
  9062. }),
  9063. $globals.AssociativeCollection);
  9064. $core.addMethod(
  9065. $core.method({
  9066. selector: "removeKey:",
  9067. protocol: "adding/removing",
  9068. fn: function (aKey){
  9069. var self=this,$self=this;
  9070. return $core.withContext(function($ctx1) {
  9071. return $self._remove_(aKey);
  9072. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  9073. },
  9074. args: ["aKey"],
  9075. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  9076. referencedClasses: [],
  9077. messageSends: ["remove:"]
  9078. }),
  9079. $globals.AssociativeCollection);
  9080. $core.addMethod(
  9081. $core.method({
  9082. selector: "removeKey:ifAbsent:",
  9083. protocol: "adding/removing",
  9084. fn: function (aKey,aBlock){
  9085. var self=this,$self=this;
  9086. return $core.withContext(function($ctx1) {
  9087. $self._subclassResponsibility();
  9088. return self;
  9089. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9090. },
  9091. args: ["aKey", "aBlock"],
  9092. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9093. referencedClasses: [],
  9094. messageSends: ["subclassResponsibility"]
  9095. }),
  9096. $globals.AssociativeCollection);
  9097. $core.addMethod(
  9098. $core.method({
  9099. selector: "select:",
  9100. protocol: "enumerating",
  9101. fn: function (aBlock){
  9102. var self=this,$self=this;
  9103. var newDict;
  9104. return $core.withContext(function($ctx1) {
  9105. var $1;
  9106. newDict=$recv($self._class())._new();
  9107. $self._keysAndValuesDo_((function(key,value){
  9108. return $core.withContext(function($ctx2) {
  9109. $1=$recv(aBlock)._value_(value);
  9110. if($core.assert($1)){
  9111. return $recv(newDict)._at_put_(key,value);
  9112. }
  9113. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9114. }));
  9115. return newDict;
  9116. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  9117. },
  9118. args: ["aBlock"],
  9119. source: "select: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(aBlock value: value) ifTrue: [ newDict at: key put: value ]].\x0a\x09^ newDict",
  9120. referencedClasses: [],
  9121. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9122. }),
  9123. $globals.AssociativeCollection);
  9124. $core.addMethod(
  9125. $core.method({
  9126. selector: "select:thenCollect:",
  9127. protocol: "enumerating",
  9128. fn: function (selectBlock,collectBlock){
  9129. var self=this,$self=this;
  9130. var newDict;
  9131. return $core.withContext(function($ctx1) {
  9132. var $1;
  9133. newDict=$recv($self._class())._new();
  9134. $self._keysAndValuesDo_((function(key,value){
  9135. return $core.withContext(function($ctx2) {
  9136. $1=$recv(selectBlock)._value_(value);
  9137. $ctx2.sendIdx["value:"]=1;
  9138. if($core.assert($1)){
  9139. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  9140. }
  9141. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9142. }));
  9143. return newDict;
  9144. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  9145. },
  9146. args: ["selectBlock", "collectBlock"],
  9147. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(selectBlock value: value) ifTrue: [ newDict at: key put: (collectBlock value: value) ]].\x0a\x09^ newDict",
  9148. referencedClasses: [],
  9149. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9150. }),
  9151. $globals.AssociativeCollection);
  9152. $core.addMethod(
  9153. $core.method({
  9154. selector: "shallowCopy",
  9155. protocol: "copying",
  9156. fn: function (){
  9157. var self=this,$self=this;
  9158. var copy;
  9159. return $core.withContext(function($ctx1) {
  9160. copy=$recv($self._class())._new();
  9161. $self._keysAndValuesDo_((function(key,value){
  9162. return $core.withContext(function($ctx2) {
  9163. return $recv(copy)._at_put_(key,value);
  9164. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9165. }));
  9166. return copy;
  9167. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  9168. },
  9169. args: [],
  9170. source: "shallowCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value ].\x0a\x09^ copy",
  9171. referencedClasses: [],
  9172. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  9173. }),
  9174. $globals.AssociativeCollection);
  9175. $core.addMethod(
  9176. $core.method({
  9177. selector: "size",
  9178. protocol: "accessing",
  9179. fn: function (){
  9180. var self=this,$self=this;
  9181. return $core.withContext(function($ctx1) {
  9182. return $recv($self._keys())._size();
  9183. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  9184. },
  9185. args: [],
  9186. source: "size\x0a\x09^ self keys size",
  9187. referencedClasses: [],
  9188. messageSends: ["size", "keys"]
  9189. }),
  9190. $globals.AssociativeCollection);
  9191. $core.addMethod(
  9192. $core.method({
  9193. selector: "values",
  9194. protocol: "accessing",
  9195. fn: function (){
  9196. var self=this,$self=this;
  9197. return $core.withContext(function($ctx1) {
  9198. $self._subclassResponsibility();
  9199. return self;
  9200. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  9201. },
  9202. args: [],
  9203. source: "values\x0a\x09self subclassResponsibility",
  9204. referencedClasses: [],
  9205. messageSends: ["subclassResponsibility"]
  9206. }),
  9207. $globals.AssociativeCollection);
  9208. $core.addMethod(
  9209. $core.method({
  9210. selector: "valuesDo:",
  9211. protocol: "enumerating",
  9212. fn: function (aBlock){
  9213. var self=this,$self=this;
  9214. return $core.withContext(function($ctx1) {
  9215. $self._subclassResponsibility();
  9216. return self;
  9217. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9218. },
  9219. args: ["aBlock"],
  9220. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  9221. referencedClasses: [],
  9222. messageSends: ["subclassResponsibility"]
  9223. }),
  9224. $globals.AssociativeCollection);
  9225. $core.addMethod(
  9226. $core.method({
  9227. selector: "withIndexDo:",
  9228. protocol: "enumerating",
  9229. fn: function (aBlock){
  9230. var self=this,$self=this;
  9231. return $core.withContext(function($ctx1) {
  9232. $self._keysAndValuesDo_((function(key,value){
  9233. return $core.withContext(function($ctx2) {
  9234. return $recv(aBlock)._value_value_(value,key);
  9235. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9236. }));
  9237. return self;
  9238. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9239. },
  9240. args: ["aBlock"],
  9241. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  9242. referencedClasses: [],
  9243. messageSends: ["keysAndValuesDo:", "value:value:"]
  9244. }),
  9245. $globals.AssociativeCollection);
  9246. $core.addMethod(
  9247. $core.method({
  9248. selector: "from:",
  9249. protocol: "instance creation",
  9250. fn: function (aCollection){
  9251. var self=this,$self=this;
  9252. var newCollection;
  9253. return $core.withContext(function($ctx1) {
  9254. newCollection=$self._new();
  9255. $recv(aCollection)._do_((function(each){
  9256. return $core.withContext(function($ctx2) {
  9257. return $recv(newCollection)._add_(each);
  9258. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9259. }));
  9260. return newCollection;
  9261. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9262. },
  9263. args: ["aCollection"],
  9264. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  9265. referencedClasses: [],
  9266. messageSends: ["new", "do:", "add:"]
  9267. }),
  9268. $globals.AssociativeCollection.a$cls);
  9269. $core.addMethod(
  9270. $core.method({
  9271. selector: "fromPairs:",
  9272. protocol: "instance creation",
  9273. fn: function (aCollection){
  9274. var self=this,$self=this;
  9275. return $core.withContext(function($ctx1) {
  9276. return $self._from_(aCollection);
  9277. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  9278. },
  9279. args: ["aCollection"],
  9280. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  9281. referencedClasses: [],
  9282. messageSends: ["from:"]
  9283. }),
  9284. $globals.AssociativeCollection.a$cls);
  9285. $core.addMethod(
  9286. $core.method({
  9287. selector: "newFromPairs:",
  9288. protocol: "instance creation",
  9289. fn: function (aCollection){
  9290. var self=this,$self=this;
  9291. var newCollection;
  9292. return $core.withContext(function($ctx1) {
  9293. var $2,$1,$3,$4;
  9294. $2=$recv(aCollection)._size();
  9295. $ctx1.sendIdx["size"]=1;
  9296. $1=$recv($2)._even();
  9297. if(!$core.assert($1)){
  9298. $self._error_("#newFromPairs only accepts arrays of an even length");
  9299. }
  9300. newCollection=$self._new();
  9301. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  9302. return $core.withContext(function($ctx2) {
  9303. $3=newCollection;
  9304. $4=$recv(aCollection)._at_(each);
  9305. $ctx2.sendIdx["at:"]=1;
  9306. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  9307. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  9308. }));
  9309. return newCollection;
  9310. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9311. },
  9312. args: ["aCollection"],
  9313. source: "newFromPairs: aCollection\x0a\x09\x22Accept an array of elements where every two elements form an \x0a\x09association - the odd element being the key, and the even element the value.\x22\x0a\x09\x0a\x09| newCollection |\x0a\x09\x0a\x09aCollection size even ifFalse: [ \x0a\x09\x09self error: '#newFromPairs only accepts arrays of an even length' ].\x0a\x09\x09\x0a\x09newCollection := self new.\x0a\x09( 1 to: aCollection size by: 2 ) do: [ :each | \x0a\x09\x09newCollection at: (aCollection at: each) put: (aCollection at: each + 1) ].\x0a\x09\x09\x0a\x09^ newCollection",
  9314. referencedClasses: [],
  9315. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  9316. }),
  9317. $globals.AssociativeCollection.a$cls);
  9318. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  9319. $globals.Dictionary.comment="I represent a set of elements that can be viewed from one of two perspectives: a set of associations,\x0aor a container of values that are externally named where the name can be any object that responds to `=`.\x0a\x0aThe external name is referred to as the key.";
  9320. $core.addMethod(
  9321. $core.method({
  9322. selector: "at:ifAbsent:",
  9323. protocol: "accessing",
  9324. fn: function (aKey,aBlock){
  9325. var self=this,$self=this;
  9326. return $core.withContext(function($ctx1) {
  9327. var index = $self._positionOfKey_(aKey);
  9328. return index >=0 ? $self['@values'][index] : aBlock._value();
  9329. ;
  9330. return self;
  9331. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9332. },
  9333. args: ["aKey", "aBlock"],
  9334. source: "at: aKey ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self[''@values''][index] : aBlock._value();\x0a\x09'>",
  9335. referencedClasses: [],
  9336. messageSends: []
  9337. }),
  9338. $globals.Dictionary);
  9339. $core.addMethod(
  9340. $core.method({
  9341. selector: "at:put:",
  9342. protocol: "accessing",
  9343. fn: function (aKey,aValue){
  9344. var self=this,$self=this;
  9345. return $core.withContext(function($ctx1) {
  9346. var index = $self._positionOfKey_(aKey);
  9347. if(index === -1) {
  9348. var keys = $self['@keys'];
  9349. index = keys.length;
  9350. keys.push(aKey);
  9351. }
  9352. return $self['@values'][index] = aValue;
  9353. ;
  9354. return self;
  9355. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  9356. },
  9357. args: ["aKey", "aValue"],
  9358. source: "at: aKey put: aValue\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = $self[''@keys''];\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return $self[''@values''][index] = aValue;\x0a\x09'>",
  9359. referencedClasses: [],
  9360. messageSends: []
  9361. }),
  9362. $globals.Dictionary);
  9363. $core.addMethod(
  9364. $core.method({
  9365. selector: "includesKey:",
  9366. protocol: "testing",
  9367. fn: function (aKey){
  9368. var self=this,$self=this;
  9369. return $core.withContext(function($ctx1) {
  9370. return $self._positionOfKey_(aKey) >= 0;;
  9371. return self;
  9372. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  9373. },
  9374. args: ["aKey"],
  9375. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  9376. referencedClasses: [],
  9377. messageSends: []
  9378. }),
  9379. $globals.Dictionary);
  9380. $core.addMethod(
  9381. $core.method({
  9382. selector: "indexOf:ifAbsent:",
  9383. protocol: "accessing",
  9384. fn: function (anObject,aBlock){
  9385. var self=this,$self=this;
  9386. var index;
  9387. return $core.withContext(function($ctx1) {
  9388. var $1;
  9389. index=$recv($self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  9390. return (0);
  9391. }));
  9392. $1=$recv(index).__eq((0));
  9393. if($core.assert($1)){
  9394. return $recv(aBlock)._value();
  9395. } else {
  9396. return $recv($self["@keys"])._at_(index);
  9397. }
  9398. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  9399. },
  9400. args: ["anObject", "aBlock"],
  9401. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := values \x0a\x09\x09indexOf: anObject \x0a\x09\x09ifAbsent: [ 0 ].\x0a\x09^ index = 0 \x0a\x09\x09ifTrue: [ aBlock value ] \x0a\x09\x09ifFalse: [ keys at: index ]",
  9402. referencedClasses: [],
  9403. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  9404. }),
  9405. $globals.Dictionary);
  9406. $core.addMethod(
  9407. $core.method({
  9408. selector: "initialize",
  9409. protocol: "initialization",
  9410. fn: function (){
  9411. var self=this,$self=this;
  9412. return $core.withContext(function($ctx1) {
  9413. (
  9414. $ctx1.supercall = true,
  9415. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  9416. $ctx1.supercall = false;
  9417. $self["@keys"]=[];
  9418. $self["@values"]=[];
  9419. return self;
  9420. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  9421. },
  9422. args: [],
  9423. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  9424. referencedClasses: [],
  9425. messageSends: ["initialize"]
  9426. }),
  9427. $globals.Dictionary);
  9428. $core.addMethod(
  9429. $core.method({
  9430. selector: "keys",
  9431. protocol: "accessing",
  9432. fn: function (){
  9433. var self=this,$self=this;
  9434. return $core.withContext(function($ctx1) {
  9435. return $recv($self["@keys"])._copy();
  9436. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  9437. },
  9438. args: [],
  9439. source: "keys\x0a\x09^ keys copy",
  9440. referencedClasses: [],
  9441. messageSends: ["copy"]
  9442. }),
  9443. $globals.Dictionary);
  9444. $core.addMethod(
  9445. $core.method({
  9446. selector: "keysAndValuesDo:",
  9447. protocol: "enumerating",
  9448. fn: function (aBlock){
  9449. var self=this,$self=this;
  9450. return $core.withContext(function($ctx1) {
  9451. return $recv($self["@keys"])._with_do_($self["@values"],aBlock);
  9452. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9453. },
  9454. args: ["aBlock"],
  9455. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  9456. referencedClasses: [],
  9457. messageSends: ["with:do:"]
  9458. }),
  9459. $globals.Dictionary);
  9460. $core.addMethod(
  9461. $core.method({
  9462. selector: "keysDo:",
  9463. protocol: "enumerating",
  9464. fn: function (aBlock){
  9465. var self=this,$self=this;
  9466. return $core.withContext(function($ctx1) {
  9467. return $recv($self["@keys"])._do_(aBlock);
  9468. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  9469. },
  9470. args: ["aBlock"],
  9471. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  9472. referencedClasses: [],
  9473. messageSends: ["do:"]
  9474. }),
  9475. $globals.Dictionary);
  9476. $core.addMethod(
  9477. $core.method({
  9478. selector: "positionOfKey:",
  9479. protocol: "private",
  9480. fn: function (anObject){
  9481. var self=this,$self=this;
  9482. return $core.withContext(function($ctx1) {
  9483. var keys = $self['@keys'];
  9484. for(var i=0;i<keys.length;i++){
  9485. if(keys[i].__eq(anObject)) { return i;}
  9486. }
  9487. return -1;
  9488. ;
  9489. return self;
  9490. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  9491. },
  9492. args: ["anObject"],
  9493. source: "positionOfKey: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var keys = $self[''@keys''];\x0a\x09\x09for(var i=0;i<keys.length;i++){\x0a\x09\x09\x09if(keys[i].__eq(anObject)) { return i;}\x0a\x09\x09}\x0a\x09\x09return -1;\x0a\x09'>",
  9494. referencedClasses: [],
  9495. messageSends: []
  9496. }),
  9497. $globals.Dictionary);
  9498. $core.addMethod(
  9499. $core.method({
  9500. selector: "removeAll",
  9501. protocol: "adding/removing",
  9502. fn: function (){
  9503. var self=this,$self=this;
  9504. return $core.withContext(function($ctx1) {
  9505. $recv($self["@keys"])._removeAll();
  9506. $ctx1.sendIdx["removeAll"]=1;
  9507. $recv($self["@values"])._removeAll();
  9508. return self;
  9509. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  9510. },
  9511. args: [],
  9512. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  9513. referencedClasses: [],
  9514. messageSends: ["removeAll"]
  9515. }),
  9516. $globals.Dictionary);
  9517. $core.addMethod(
  9518. $core.method({
  9519. selector: "removeKey:ifAbsent:",
  9520. protocol: "adding/removing",
  9521. fn: function (aKey,aBlock){
  9522. var self=this,$self=this;
  9523. return $core.withContext(function($ctx1) {
  9524. var index = $self._positionOfKey_(aKey);
  9525. if(index === -1) {
  9526. return aBlock._value()
  9527. } else {
  9528. var keys = $self['@keys'], values = $self['@values'];
  9529. var value = values[index], l = keys.length;
  9530. keys[index] = keys[l-1];
  9531. keys.pop();
  9532. values[index] = values[l-1];
  9533. values.pop();
  9534. return value;
  9535. }
  9536. ;
  9537. return self;
  9538. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9539. },
  9540. args: ["aKey", "aBlock"],
  9541. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock._value()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = $self[''@keys''], values = $self[''@values''];\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09'>",
  9542. referencedClasses: [],
  9543. messageSends: []
  9544. }),
  9545. $globals.Dictionary);
  9546. $core.addMethod(
  9547. $core.method({
  9548. selector: "values",
  9549. protocol: "accessing",
  9550. fn: function (){
  9551. var self=this,$self=this;
  9552. return $self["@values"];
  9553. },
  9554. args: [],
  9555. source: "values\x0a\x09^ values",
  9556. referencedClasses: [],
  9557. messageSends: []
  9558. }),
  9559. $globals.Dictionary);
  9560. $core.addMethod(
  9561. $core.method({
  9562. selector: "valuesDo:",
  9563. protocol: "enumerating",
  9564. fn: function (aBlock){
  9565. var self=this,$self=this;
  9566. return $core.withContext(function($ctx1) {
  9567. return $recv($self["@values"])._do_(aBlock);
  9568. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9569. },
  9570. args: ["aBlock"],
  9571. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  9572. referencedClasses: [],
  9573. messageSends: ["do:"]
  9574. }),
  9575. $globals.Dictionary);
  9576. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  9577. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  9578. $core.addMethod(
  9579. $core.method({
  9580. selector: "at:ifAbsent:",
  9581. protocol: "accessing",
  9582. fn: function (aKey,aBlock){
  9583. var self=this,$self=this;
  9584. return $core.withContext(function($ctx1) {
  9585. var $1;
  9586. $1=$self._includesKey_(aKey);
  9587. if($core.assert($1)){
  9588. return $self._basicAt_(aKey);
  9589. } else {
  9590. return $recv(aBlock)._value();
  9591. }
  9592. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9593. },
  9594. args: ["aKey", "aBlock"],
  9595. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  9596. referencedClasses: [],
  9597. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  9598. }),
  9599. $globals.HashedCollection);
  9600. $core.addMethod(
  9601. $core.method({
  9602. selector: "at:put:",
  9603. protocol: "accessing",
  9604. fn: function (aKey,aValue){
  9605. var self=this,$self=this;
  9606. return $core.withContext(function($ctx1) {
  9607. return $self._basicAt_put_(aKey,aValue);
  9608. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  9609. },
  9610. args: ["aKey", "aValue"],
  9611. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  9612. referencedClasses: [],
  9613. messageSends: ["basicAt:put:"]
  9614. }),
  9615. $globals.HashedCollection);
  9616. $core.addMethod(
  9617. $core.method({
  9618. selector: "includesKey:",
  9619. protocol: "testing",
  9620. fn: function (aKey){
  9621. var self=this,$self=this;
  9622. return $core.withContext(function($ctx1) {
  9623. return self.hasOwnProperty(aKey);
  9624. return self;
  9625. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  9626. },
  9627. args: ["aKey"],
  9628. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  9629. referencedClasses: [],
  9630. messageSends: []
  9631. }),
  9632. $globals.HashedCollection);
  9633. $core.addMethod(
  9634. $core.method({
  9635. selector: "keys",
  9636. protocol: "accessing",
  9637. fn: function (){
  9638. var self=this,$self=this;
  9639. return $core.withContext(function($ctx1) {
  9640. return Object.keys(self);
  9641. return self;
  9642. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  9643. },
  9644. args: [],
  9645. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  9646. referencedClasses: [],
  9647. messageSends: []
  9648. }),
  9649. $globals.HashedCollection);
  9650. $core.addMethod(
  9651. $core.method({
  9652. selector: "keysDo:",
  9653. protocol: "enumerating",
  9654. fn: function (aBlock){
  9655. var self=this,$self=this;
  9656. return $core.withContext(function($ctx1) {
  9657. $recv($self._keys())._do_(aBlock);
  9658. return self;
  9659. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9660. },
  9661. args: ["aBlock"],
  9662. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  9663. referencedClasses: [],
  9664. messageSends: ["do:", "keys"]
  9665. }),
  9666. $globals.HashedCollection);
  9667. $core.addMethod(
  9668. $core.method({
  9669. selector: "removeKey:ifAbsent:",
  9670. protocol: "adding/removing",
  9671. fn: function (aKey,aBlock){
  9672. var self=this,$self=this;
  9673. return $core.withContext(function($ctx1) {
  9674. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  9675. return $core.withContext(function($ctx2) {
  9676. $self._basicDelete_(aKey);
  9677. return removed;
  9678. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  9679. }),(function(){
  9680. return $core.withContext(function($ctx2) {
  9681. return $recv(aBlock)._value();
  9682. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9683. }));
  9684. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9685. },
  9686. args: ["aKey", "aBlock"],
  9687. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^ self\x0a\x09\x09at: aKey\x0a\x09\x09ifPresent: [ :removed | self basicDelete: aKey. removed ]\x0a\x09\x09ifAbsent: [ aBlock value ]",
  9688. referencedClasses: [],
  9689. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  9690. }),
  9691. $globals.HashedCollection);
  9692. $core.addMethod(
  9693. $core.method({
  9694. selector: "values",
  9695. protocol: "accessing",
  9696. fn: function (){
  9697. var self=this,$self=this;
  9698. return $core.withContext(function($ctx1) {
  9699. return $self._keys().map(function(key){
  9700. return $self._at_(key);
  9701. });
  9702. ;
  9703. return self;
  9704. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  9705. },
  9706. args: [],
  9707. source: "values\x0a\x09<inlineJS: '\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09'>",
  9708. referencedClasses: [],
  9709. messageSends: []
  9710. }),
  9711. $globals.HashedCollection);
  9712. $core.addMethod(
  9713. $core.method({
  9714. selector: "valuesDo:",
  9715. protocol: "enumerating",
  9716. fn: function (aBlock){
  9717. var self=this,$self=this;
  9718. return $core.withContext(function($ctx1) {
  9719. $recv($self._values())._do_(aBlock);
  9720. return self;
  9721. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9722. },
  9723. args: ["aBlock"],
  9724. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  9725. referencedClasses: [],
  9726. messageSends: ["do:", "values"]
  9727. }),
  9728. $globals.HashedCollection);
  9729. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  9730. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  9731. $core.addMethod(
  9732. $core.method({
  9733. selector: "=",
  9734. protocol: "comparing",
  9735. fn: function (aCollection){
  9736. var self=this,$self=this;
  9737. return $core.withContext(function($ctx1) {
  9738. var $3,$2,$4,$1,$5;
  9739. var $early={};
  9740. try {
  9741. $3=$self._class();
  9742. $ctx1.sendIdx["class"]=1;
  9743. $2=$recv($3).__eq($recv(aCollection)._class());
  9744. $ctx1.sendIdx["="]=1;
  9745. $1=$recv($2)._and_((function(){
  9746. return $core.withContext(function($ctx2) {
  9747. $4=$self._size();
  9748. $ctx2.sendIdx["size"]=1;
  9749. return $recv($4).__eq($recv(aCollection)._size());
  9750. $ctx2.sendIdx["="]=2;
  9751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9752. }));
  9753. if(!$core.assert($1)){
  9754. return false;
  9755. }
  9756. $self._withIndexDo_((function(each,i){
  9757. return $core.withContext(function($ctx2) {
  9758. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  9759. if(!$core.assert($5)){
  9760. throw $early=[false];
  9761. }
  9762. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  9763. }));
  9764. return true;
  9765. }
  9766. catch(e) {if(e===$early)return e[0]; throw e}
  9767. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  9768. },
  9769. args: ["aCollection"],
  9770. source: "= aCollection\x0a\x09(self class = aCollection class and: [\x0a\x09\x09self size = aCollection size ]) ifFalse: [ ^ false ].\x0a\x09self withIndexDo: [ :each :i |\x0a\x09\x09\x09\x09(aCollection at: i) = each ifFalse: [ ^ false ]].\x0a\x09^ true",
  9771. referencedClasses: [],
  9772. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  9773. }),
  9774. $globals.SequenceableCollection);
  9775. $core.addMethod(
  9776. $core.method({
  9777. selector: "addLast:",
  9778. protocol: "adding/removing",
  9779. fn: function (anObject){
  9780. var self=this,$self=this;
  9781. return $core.withContext(function($ctx1) {
  9782. $self._add_(anObject);
  9783. return self;
  9784. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  9785. },
  9786. args: ["anObject"],
  9787. source: "addLast: anObject\x0a\x09self add: anObject",
  9788. referencedClasses: [],
  9789. messageSends: ["add:"]
  9790. }),
  9791. $globals.SequenceableCollection);
  9792. $core.addMethod(
  9793. $core.method({
  9794. selector: "allButFirst",
  9795. protocol: "accessing",
  9796. fn: function (){
  9797. var self=this,$self=this;
  9798. return $core.withContext(function($ctx1) {
  9799. return $self._copyFrom_to_((2),$self._size());
  9800. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  9801. },
  9802. args: [],
  9803. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  9804. referencedClasses: [],
  9805. messageSends: ["copyFrom:to:", "size"]
  9806. }),
  9807. $globals.SequenceableCollection);
  9808. $core.addMethod(
  9809. $core.method({
  9810. selector: "allButLast",
  9811. protocol: "accessing",
  9812. fn: function (){
  9813. var self=this,$self=this;
  9814. return $core.withContext(function($ctx1) {
  9815. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  9816. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  9817. },
  9818. args: [],
  9819. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  9820. referencedClasses: [],
  9821. messageSends: ["copyFrom:to:", "-", "size"]
  9822. }),
  9823. $globals.SequenceableCollection);
  9824. $core.addMethod(
  9825. $core.method({
  9826. selector: "anyOne",
  9827. protocol: "accessing",
  9828. fn: function (){
  9829. var self=this,$self=this;
  9830. return $core.withContext(function($ctx1) {
  9831. return $self._at_((1));
  9832. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  9833. },
  9834. args: [],
  9835. source: "anyOne\x0a\x09^ self at: 1",
  9836. referencedClasses: [],
  9837. messageSends: ["at:"]
  9838. }),
  9839. $globals.SequenceableCollection);
  9840. $core.addMethod(
  9841. $core.method({
  9842. selector: "atRandom",
  9843. protocol: "accessing",
  9844. fn: function (){
  9845. var self=this,$self=this;
  9846. return $core.withContext(function($ctx1) {
  9847. return $self._at_($recv($self._size())._atRandom());
  9848. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  9849. },
  9850. args: [],
  9851. source: "atRandom\x0a\x09^ self at: self size atRandom",
  9852. referencedClasses: [],
  9853. messageSends: ["at:", "atRandom", "size"]
  9854. }),
  9855. $globals.SequenceableCollection);
  9856. $core.addMethod(
  9857. $core.method({
  9858. selector: "beginsWith:",
  9859. protocol: "testing",
  9860. fn: function (prefix){
  9861. var self=this,$self=this;
  9862. return $core.withContext(function($ctx1) {
  9863. var $2,$3,$1;
  9864. $2=$self._size();
  9865. $ctx1.sendIdx["size"]=1;
  9866. $3=$recv(prefix)._size();
  9867. $ctx1.sendIdx["size"]=2;
  9868. $1=$recv($2).__lt($3);
  9869. if($core.assert($1)){
  9870. return false;
  9871. }
  9872. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  9873. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  9874. },
  9875. args: ["prefix"],
  9876. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  9877. referencedClasses: [],
  9878. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  9879. }),
  9880. $globals.SequenceableCollection);
  9881. $core.addMethod(
  9882. $core.method({
  9883. selector: "copyFrom:to:",
  9884. protocol: "copying",
  9885. fn: function (anIndex,anotherIndex){
  9886. var self=this,$self=this;
  9887. return $core.withContext(function($ctx1) {
  9888. $self._subclassResponsibility();
  9889. return self;
  9890. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  9891. },
  9892. args: ["anIndex", "anotherIndex"],
  9893. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  9894. referencedClasses: [],
  9895. messageSends: ["subclassResponsibility"]
  9896. }),
  9897. $globals.SequenceableCollection);
  9898. $core.addMethod(
  9899. $core.method({
  9900. selector: "endsWith:",
  9901. protocol: "testing",
  9902. fn: function (suffix){
  9903. var self=this,$self=this;
  9904. return $core.withContext(function($ctx1) {
  9905. var $2,$3,$1;
  9906. $2=$self._size();
  9907. $ctx1.sendIdx["size"]=1;
  9908. $3=$recv(suffix)._size();
  9909. $ctx1.sendIdx["size"]=2;
  9910. $1=$recv($2).__lt($3);
  9911. if($core.assert($1)){
  9912. return false;
  9913. }
  9914. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  9915. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  9916. },
  9917. args: ["suffix"],
  9918. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  9919. referencedClasses: [],
  9920. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  9921. }),
  9922. $globals.SequenceableCollection);
  9923. $core.addMethod(
  9924. $core.method({
  9925. selector: "first",
  9926. protocol: "accessing",
  9927. fn: function (){
  9928. var self=this,$self=this;
  9929. return $core.withContext(function($ctx1) {
  9930. return $self._at_((1));
  9931. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  9932. },
  9933. args: [],
  9934. source: "first\x0a\x09^ self at: 1",
  9935. referencedClasses: [],
  9936. messageSends: ["at:"]
  9937. }),
  9938. $globals.SequenceableCollection);
  9939. $core.addMethod(
  9940. $core.method({
  9941. selector: "first:",
  9942. protocol: "accessing",
  9943. fn: function (aNumber){
  9944. var self=this,$self=this;
  9945. return $core.withContext(function($ctx1) {
  9946. var $1;
  9947. $1=$recv($self._size()).__lt(aNumber);
  9948. if($core.assert($1)){
  9949. $self._error_("Invalid number of elements");
  9950. }
  9951. return $self._copyFrom_to_((1),aNumber);
  9952. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  9953. },
  9954. args: ["aNumber"],
  9955. source: "first: aNumber\x0a\x09\x22Answer the first `aNumber` elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: 1 to: aNumber",
  9956. referencedClasses: [],
  9957. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  9958. }),
  9959. $globals.SequenceableCollection);
  9960. $core.addMethod(
  9961. $core.method({
  9962. selector: "fourth",
  9963. protocol: "accessing",
  9964. fn: function (){
  9965. var self=this,$self=this;
  9966. return $core.withContext(function($ctx1) {
  9967. return $self._at_((4));
  9968. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  9969. },
  9970. args: [],
  9971. source: "fourth\x0a\x09^ self at: 4",
  9972. referencedClasses: [],
  9973. messageSends: ["at:"]
  9974. }),
  9975. $globals.SequenceableCollection);
  9976. $core.addMethod(
  9977. $core.method({
  9978. selector: "includes:",
  9979. protocol: "testing",
  9980. fn: function (anObject){
  9981. var self=this,$self=this;
  9982. return $core.withContext(function($ctx1) {
  9983. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  9984. return nil;
  9985. })))._notNil();
  9986. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  9987. },
  9988. args: ["anObject"],
  9989. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  9990. referencedClasses: [],
  9991. messageSends: ["notNil", "indexOf:ifAbsent:"]
  9992. }),
  9993. $globals.SequenceableCollection);
  9994. $core.addMethod(
  9995. $core.method({
  9996. selector: "indexOf:startingAt:",
  9997. protocol: "accessing",
  9998. fn: function (anObject,start){
  9999. var self=this,$self=this;
  10000. return $core.withContext(function($ctx1) {
  10001. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  10002. return (0);
  10003. }));
  10004. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  10005. },
  10006. args: ["anObject", "start"],
  10007. source: "indexOf: anObject startingAt: start\x0a\x09\x22Answer the index of the first occurence of anElement after start\x0a\x09within the receiver. If the receiver does not contain anElement,\x0a\x09answer 0.\x22\x0a\x09^ self indexOf: anObject startingAt: start ifAbsent: [ 0 ]",
  10008. referencedClasses: [],
  10009. messageSends: ["indexOf:startingAt:ifAbsent:"]
  10010. }),
  10011. $globals.SequenceableCollection);
  10012. $core.addMethod(
  10013. $core.method({
  10014. selector: "indexOf:startingAt:ifAbsent:",
  10015. protocol: "accessing",
  10016. fn: function (anObject,start,aBlock){
  10017. var self=this,$self=this;
  10018. return $core.withContext(function($ctx1) {
  10019. $self._subclassResponsibility();
  10020. return self;
  10021. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  10022. },
  10023. args: ["anObject", "start", "aBlock"],
  10024. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  10025. referencedClasses: [],
  10026. messageSends: ["subclassResponsibility"]
  10027. }),
  10028. $globals.SequenceableCollection);
  10029. $core.addMethod(
  10030. $core.method({
  10031. selector: "last",
  10032. protocol: "accessing",
  10033. fn: function (){
  10034. var self=this,$self=this;
  10035. return $core.withContext(function($ctx1) {
  10036. return $self._at_($self._size());
  10037. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  10038. },
  10039. args: [],
  10040. source: "last\x0a\x09^ self at: self size",
  10041. referencedClasses: [],
  10042. messageSends: ["at:", "size"]
  10043. }),
  10044. $globals.SequenceableCollection);
  10045. $core.addMethod(
  10046. $core.method({
  10047. selector: "last:",
  10048. protocol: "accessing",
  10049. fn: function (aNumber){
  10050. var self=this,$self=this;
  10051. return $core.withContext(function($ctx1) {
  10052. var $2,$1,$5,$4,$3;
  10053. $2=$self._size();
  10054. $ctx1.sendIdx["size"]=1;
  10055. $1=$recv($2).__lt(aNumber);
  10056. if($core.assert($1)){
  10057. $self._error_("Invalid number of elements");
  10058. }
  10059. $5=$self._size();
  10060. $ctx1.sendIdx["size"]=2;
  10061. $4=$recv($5).__minus(aNumber);
  10062. $3=$recv($4).__plus((1));
  10063. return $self._copyFrom_to_($3,$self._size());
  10064. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10065. },
  10066. args: ["aNumber"],
  10067. source: "last: aNumber\x0a\x09\x22Answer the last aNumber elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: self size - aNumber + 1 to: self size",
  10068. referencedClasses: [],
  10069. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  10070. }),
  10071. $globals.SequenceableCollection);
  10072. $core.addMethod(
  10073. $core.method({
  10074. selector: "newStream",
  10075. protocol: "streaming",
  10076. fn: function (){
  10077. var self=this,$self=this;
  10078. return $core.withContext(function($ctx1) {
  10079. return $recv($self._streamClass())._on_(self);
  10080. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  10081. },
  10082. args: [],
  10083. source: "newStream\x0a\x09^ self streamClass on: self",
  10084. referencedClasses: [],
  10085. messageSends: ["on:", "streamClass"]
  10086. }),
  10087. $globals.SequenceableCollection);
  10088. $core.addMethod(
  10089. $core.method({
  10090. selector: "readStream",
  10091. protocol: "streaming",
  10092. fn: function (){
  10093. var self=this,$self=this;
  10094. return $core.withContext(function($ctx1) {
  10095. return $self._stream();
  10096. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  10097. },
  10098. args: [],
  10099. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10100. referencedClasses: [],
  10101. messageSends: ["stream"]
  10102. }),
  10103. $globals.SequenceableCollection);
  10104. $core.addMethod(
  10105. $core.method({
  10106. selector: "removeLast",
  10107. protocol: "adding/removing",
  10108. fn: function (){
  10109. var self=this,$self=this;
  10110. return $core.withContext(function($ctx1) {
  10111. return $self._remove_($self._last());
  10112. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  10113. },
  10114. args: [],
  10115. source: "removeLast\x0a\x09^ self remove: self last",
  10116. referencedClasses: [],
  10117. messageSends: ["remove:", "last"]
  10118. }),
  10119. $globals.SequenceableCollection);
  10120. $core.addMethod(
  10121. $core.method({
  10122. selector: "reverseDo:",
  10123. protocol: "enumerating",
  10124. fn: function (aBlock){
  10125. var self=this,$self=this;
  10126. return $core.withContext(function($ctx1) {
  10127. $recv($self._reversed())._do_(aBlock);
  10128. return self;
  10129. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10130. },
  10131. args: ["aBlock"],
  10132. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  10133. referencedClasses: [],
  10134. messageSends: ["do:", "reversed"]
  10135. }),
  10136. $globals.SequenceableCollection);
  10137. $core.addMethod(
  10138. $core.method({
  10139. selector: "reversed",
  10140. protocol: "converting",
  10141. fn: function (){
  10142. var self=this,$self=this;
  10143. return $core.withContext(function($ctx1) {
  10144. $self._subclassResponsibility();
  10145. return self;
  10146. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  10147. },
  10148. args: [],
  10149. source: "reversed\x0a\x09self subclassResponsibility",
  10150. referencedClasses: [],
  10151. messageSends: ["subclassResponsibility"]
  10152. }),
  10153. $globals.SequenceableCollection);
  10154. $core.addMethod(
  10155. $core.method({
  10156. selector: "second",
  10157. protocol: "accessing",
  10158. fn: function (){
  10159. var self=this,$self=this;
  10160. return $core.withContext(function($ctx1) {
  10161. return $self._at_((2));
  10162. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  10163. },
  10164. args: [],
  10165. source: "second\x0a\x09^ self at: 2",
  10166. referencedClasses: [],
  10167. messageSends: ["at:"]
  10168. }),
  10169. $globals.SequenceableCollection);
  10170. $core.addMethod(
  10171. $core.method({
  10172. selector: "stream",
  10173. protocol: "streaming",
  10174. fn: function (){
  10175. var self=this,$self=this;
  10176. return $core.withContext(function($ctx1) {
  10177. return $self._newStream();
  10178. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  10179. },
  10180. args: [],
  10181. source: "stream\x0a\x09^ self newStream",
  10182. referencedClasses: [],
  10183. messageSends: ["newStream"]
  10184. }),
  10185. $globals.SequenceableCollection);
  10186. $core.addMethod(
  10187. $core.method({
  10188. selector: "streamClass",
  10189. protocol: "streaming",
  10190. fn: function (){
  10191. var self=this,$self=this;
  10192. return $core.withContext(function($ctx1) {
  10193. return $recv($self._class())._streamClass();
  10194. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  10195. },
  10196. args: [],
  10197. source: "streamClass\x0a\x09^ self class streamClass",
  10198. referencedClasses: [],
  10199. messageSends: ["streamClass", "class"]
  10200. }),
  10201. $globals.SequenceableCollection);
  10202. $core.addMethod(
  10203. $core.method({
  10204. selector: "third",
  10205. protocol: "accessing",
  10206. fn: function (){
  10207. var self=this,$self=this;
  10208. return $core.withContext(function($ctx1) {
  10209. return $self._at_((3));
  10210. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  10211. },
  10212. args: [],
  10213. source: "third\x0a\x09^ self at: 3",
  10214. referencedClasses: [],
  10215. messageSends: ["at:"]
  10216. }),
  10217. $globals.SequenceableCollection);
  10218. $core.addMethod(
  10219. $core.method({
  10220. selector: "writeStream",
  10221. protocol: "streaming",
  10222. fn: function (){
  10223. var self=this,$self=this;
  10224. return $core.withContext(function($ctx1) {
  10225. return $self._stream();
  10226. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  10227. },
  10228. args: [],
  10229. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10230. referencedClasses: [],
  10231. messageSends: ["stream"]
  10232. }),
  10233. $globals.SequenceableCollection);
  10234. $core.addMethod(
  10235. $core.method({
  10236. selector: "streamClass",
  10237. protocol: "accessing",
  10238. fn: function (){
  10239. var self=this,$self=this;
  10240. return $globals.Stream;
  10241. },
  10242. args: [],
  10243. source: "streamClass\x0a\x09\x09^ Stream",
  10244. referencedClasses: ["Stream"],
  10245. messageSends: []
  10246. }),
  10247. $globals.SequenceableCollection.a$cls);
  10248. $core.addMethod(
  10249. $core.method({
  10250. selector: "streamContents:",
  10251. protocol: "streaming",
  10252. fn: function (aBlock){
  10253. var self=this,$self=this;
  10254. var stream;
  10255. return $core.withContext(function($ctx1) {
  10256. stream=$recv($self._streamClass())._on_($self._new());
  10257. $recv(aBlock)._value_(stream);
  10258. return $recv(stream)._contents();
  10259. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  10260. },
  10261. args: ["aBlock"],
  10262. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  10263. referencedClasses: [],
  10264. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  10265. }),
  10266. $globals.SequenceableCollection.a$cls);
  10267. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  10268. $globals.Array.comment="I represent a collection of objects ordered by the collector. The size of arrays is dynamic.\x0a\x0aI am directly mapped to JavaScript Number.\x0a\x0a*Note* In Amber, `OrderedCollection` is an alias for `Array`.";
  10269. $core.addMethod(
  10270. $core.method({
  10271. selector: "add:",
  10272. protocol: "adding/removing",
  10273. fn: function (anObject){
  10274. var self=this,$self=this;
  10275. return $core.withContext(function($ctx1) {
  10276. self.push(anObject); return anObject;;
  10277. return self;
  10278. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  10279. },
  10280. args: ["anObject"],
  10281. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  10282. referencedClasses: [],
  10283. messageSends: []
  10284. }),
  10285. $globals.Array);
  10286. $core.addMethod(
  10287. $core.method({
  10288. selector: "addAll:",
  10289. protocol: "adding/removing",
  10290. fn: function (aCollection){
  10291. var self=this,$self=this;
  10292. return $core.withContext(function($ctx1) {
  10293. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  10294. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  10295. return aCollection;;
  10296. return self;
  10297. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  10298. },
  10299. args: ["aCollection"],
  10300. source: "addAll: aCollection\x0a<inlineJS: '\x0a\x09if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);\x0a\x09else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);\x0a\x09return aCollection;\x0a'>",
  10301. referencedClasses: [],
  10302. messageSends: []
  10303. }),
  10304. $globals.Array);
  10305. $core.addMethod(
  10306. $core.method({
  10307. selector: "addFirst:",
  10308. protocol: "adding/removing",
  10309. fn: function (anObject){
  10310. var self=this,$self=this;
  10311. return $core.withContext(function($ctx1) {
  10312. self.unshift(anObject); return anObject;;
  10313. return self;
  10314. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  10315. },
  10316. args: ["anObject"],
  10317. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  10318. referencedClasses: [],
  10319. messageSends: []
  10320. }),
  10321. $globals.Array);
  10322. $core.addMethod(
  10323. $core.method({
  10324. selector: "asJavaScriptSource",
  10325. protocol: "converting",
  10326. fn: function (){
  10327. var self=this,$self=this;
  10328. return $core.withContext(function($ctx1) {
  10329. var $1;
  10330. $1=$recv("[".__comma($recv($self._collect_((function(each){
  10331. return $core.withContext(function($ctx2) {
  10332. return $recv(each)._asJavaScriptSource();
  10333. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10334. })))._join_(", "))).__comma("]");
  10335. $ctx1.sendIdx[","]=1;
  10336. return $1;
  10337. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  10338. },
  10339. args: [],
  10340. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  10341. referencedClasses: [],
  10342. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  10343. }),
  10344. $globals.Array);
  10345. $core.addMethod(
  10346. $core.method({
  10347. selector: "at:put:",
  10348. protocol: "accessing",
  10349. fn: function (anIndex,anObject){
  10350. var self=this,$self=this;
  10351. return $core.withContext(function($ctx1) {
  10352. return self[anIndex - 1] = anObject;
  10353. return self;
  10354. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  10355. },
  10356. args: ["anIndex", "anObject"],
  10357. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  10358. referencedClasses: [],
  10359. messageSends: []
  10360. }),
  10361. $globals.Array);
  10362. $core.addMethod(
  10363. $core.method({
  10364. selector: "collect:",
  10365. protocol: "enumerating",
  10366. fn: function (aBlock){
  10367. var self=this,$self=this;
  10368. return $core.withContext(function($ctx1) {
  10369. return self.map(function(each) {return aBlock._value_(each)});
  10370. return self;
  10371. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  10372. },
  10373. args: ["aBlock"],
  10374. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  10375. referencedClasses: [],
  10376. messageSends: []
  10377. }),
  10378. $globals.Array);
  10379. $core.addMethod(
  10380. $core.method({
  10381. selector: "copyFrom:to:",
  10382. protocol: "copying",
  10383. fn: function (anIndex,anotherIndex){
  10384. var self=this,$self=this;
  10385. return $core.withContext(function($ctx1) {
  10386. if (anIndex >= 1 && anotherIndex <= self.length) {
  10387. return self.slice(anIndex - 1, anotherIndex);
  10388. } else {
  10389. self._at_(anIndex);
  10390. self._at_(self.length + 1);
  10391. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  10392. };
  10393. return self;
  10394. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  10395. },
  10396. args: ["anIndex", "anotherIndex"],
  10397. source: "copyFrom: anIndex to: anotherIndex\x0a<inlineJS: '\x0a\x09if (anIndex >= 1 && anotherIndex <= self.length) {\x0a\x09\x09return self.slice(anIndex - 1, anotherIndex);\x0a\x09} else {\x0a\x09\x09self._at_(anIndex);\x0a\x09\x09self._at_(self.length + 1);\x0a\x09\x09throw new Error(\x22Incorrect indexes in #copyFrom:to: not caught by #at:\x22);\x0a\x09}\x0a'>",
  10398. referencedClasses: [],
  10399. messageSends: []
  10400. }),
  10401. $globals.Array);
  10402. $core.addMethod(
  10403. $core.method({
  10404. selector: "join:",
  10405. protocol: "enumerating",
  10406. fn: function (aString){
  10407. var self=this,$self=this;
  10408. return $core.withContext(function($ctx1) {
  10409. return self.join(aString);
  10410. return self;
  10411. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  10412. },
  10413. args: ["aString"],
  10414. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  10415. referencedClasses: [],
  10416. messageSends: []
  10417. }),
  10418. $globals.Array);
  10419. $core.addMethod(
  10420. $core.method({
  10421. selector: "printOn:",
  10422. protocol: "printing",
  10423. fn: function (aStream){
  10424. var self=this,$self=this;
  10425. return $core.withContext(function($ctx1) {
  10426. (
  10427. $ctx1.supercall = true,
  10428. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  10429. $ctx1.supercall = false;
  10430. $ctx1.sendIdx["printOn:"]=1;
  10431. $recv(aStream)._nextPutAll_(" (");
  10432. $ctx1.sendIdx["nextPutAll:"]=1;
  10433. $self._do_separatedBy_((function(each){
  10434. return $core.withContext(function($ctx2) {
  10435. return $recv(each)._printOn_(aStream);
  10436. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10437. }),(function(){
  10438. return $core.withContext(function($ctx2) {
  10439. return $recv(aStream)._nextPutAll_(" ");
  10440. $ctx2.sendIdx["nextPutAll:"]=2;
  10441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10442. }));
  10443. $recv(aStream)._nextPutAll_(")");
  10444. return self;
  10445. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  10446. },
  10447. args: ["aStream"],
  10448. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
  10449. referencedClasses: [],
  10450. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  10451. }),
  10452. $globals.Array);
  10453. $core.addMethod(
  10454. $core.method({
  10455. selector: "remove:ifAbsent:",
  10456. protocol: "adding/removing",
  10457. fn: function (anObject,aBlock){
  10458. var self=this,$self=this;
  10459. var index;
  10460. return $core.withContext(function($ctx1) {
  10461. var $1;
  10462. index=$self._indexOf_ifAbsent_(anObject,(function(){
  10463. return (0);
  10464. }));
  10465. $1=$recv(index).__eq((0));
  10466. if($core.assert($1)){
  10467. return $recv(aBlock)._value();
  10468. } else {
  10469. $self._removeIndex_(index);
  10470. return anObject;
  10471. }
  10472. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  10473. },
  10474. args: ["anObject", "aBlock"],
  10475. source: "remove: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := self indexOf: anObject ifAbsent: [ 0 ].\x0a\x09^ index = 0\x0a\x09\x09ifFalse: [ self removeIndex: index. anObject ]\x0a\x09\x09ifTrue: [ aBlock value ]",
  10476. referencedClasses: [],
  10477. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  10478. }),
  10479. $globals.Array);
  10480. $core.addMethod(
  10481. $core.method({
  10482. selector: "removeAll",
  10483. protocol: "adding/removing",
  10484. fn: function (){
  10485. var self=this,$self=this;
  10486. return $core.withContext(function($ctx1) {
  10487. self.length = 0;
  10488. return self;
  10489. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  10490. },
  10491. args: [],
  10492. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  10493. referencedClasses: [],
  10494. messageSends: []
  10495. }),
  10496. $globals.Array);
  10497. $core.addMethod(
  10498. $core.method({
  10499. selector: "removeFrom:to:",
  10500. protocol: "adding/removing",
  10501. fn: function (aNumber,anotherNumber){
  10502. var self=this,$self=this;
  10503. return $core.withContext(function($ctx1) {
  10504. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  10505. return self;
  10506. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  10507. },
  10508. args: ["aNumber", "anotherNumber"],
  10509. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  10510. referencedClasses: [],
  10511. messageSends: []
  10512. }),
  10513. $globals.Array);
  10514. $core.addMethod(
  10515. $core.method({
  10516. selector: "removeIndex:",
  10517. protocol: "adding/removing",
  10518. fn: function (anInteger){
  10519. var self=this,$self=this;
  10520. return $core.withContext(function($ctx1) {
  10521. self.splice(anInteger - 1, 1);
  10522. return self;
  10523. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  10524. },
  10525. args: ["anInteger"],
  10526. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  10527. referencedClasses: [],
  10528. messageSends: []
  10529. }),
  10530. $globals.Array);
  10531. $core.addMethod(
  10532. $core.method({
  10533. selector: "removeLast",
  10534. protocol: "adding/removing",
  10535. fn: function (){
  10536. var self=this,$self=this;
  10537. return $core.withContext(function($ctx1) {
  10538. return self.pop();;
  10539. return self;
  10540. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  10541. },
  10542. args: [],
  10543. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  10544. referencedClasses: [],
  10545. messageSends: []
  10546. }),
  10547. $globals.Array);
  10548. $core.addMethod(
  10549. $core.method({
  10550. selector: "reversed",
  10551. protocol: "converting",
  10552. fn: function (){
  10553. var self=this,$self=this;
  10554. return $core.withContext(function($ctx1) {
  10555. return self.slice().reverse();
  10556. return self;
  10557. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  10558. },
  10559. args: [],
  10560. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  10561. referencedClasses: [],
  10562. messageSends: []
  10563. }),
  10564. $globals.Array);
  10565. $core.addMethod(
  10566. $core.method({
  10567. selector: "select:",
  10568. protocol: "enumerating",
  10569. fn: function (aBlock){
  10570. var self=this,$self=this;
  10571. return $core.withContext(function($ctx1) {
  10572. return self.filter(function(each) {return aBlock._value_(each)});
  10573. return self;
  10574. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  10575. },
  10576. args: ["aBlock"],
  10577. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  10578. referencedClasses: [],
  10579. messageSends: []
  10580. }),
  10581. $globals.Array);
  10582. $core.addMethod(
  10583. $core.method({
  10584. selector: "shallowCopy",
  10585. protocol: "copying",
  10586. fn: function (){
  10587. var self=this,$self=this;
  10588. return $core.withContext(function($ctx1) {
  10589. return self.slice();
  10590. return self;
  10591. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  10592. },
  10593. args: [],
  10594. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  10595. referencedClasses: [],
  10596. messageSends: []
  10597. }),
  10598. $globals.Array);
  10599. $core.addMethod(
  10600. $core.method({
  10601. selector: "sort",
  10602. protocol: "enumerating",
  10603. fn: function (){
  10604. var self=this,$self=this;
  10605. return $core.withContext(function($ctx1) {
  10606. return $self._sort_((function(a,b){
  10607. return $core.withContext(function($ctx2) {
  10608. return $recv(a).__lt(b);
  10609. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  10610. }));
  10611. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  10612. },
  10613. args: [],
  10614. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  10615. referencedClasses: [],
  10616. messageSends: ["sort:", "<"]
  10617. }),
  10618. $globals.Array);
  10619. $core.addMethod(
  10620. $core.method({
  10621. selector: "sort:",
  10622. protocol: "enumerating",
  10623. fn: function (aBlock){
  10624. var self=this,$self=this;
  10625. return $core.withContext(function($ctx1) {
  10626. return self.sort(function(a, b) {
  10627. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  10628. })
  10629. ;
  10630. return self;
  10631. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  10632. },
  10633. args: ["aBlock"],
  10634. source: "sort: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock._value_value_(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09'>",
  10635. referencedClasses: [],
  10636. messageSends: []
  10637. }),
  10638. $globals.Array);
  10639. $core.addMethod(
  10640. $core.method({
  10641. selector: "sorted",
  10642. protocol: "enumerating",
  10643. fn: function (){
  10644. var self=this,$self=this;
  10645. return $core.withContext(function($ctx1) {
  10646. return $recv($self._copy())._sort();
  10647. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  10648. },
  10649. args: [],
  10650. source: "sorted\x0a\x09^ self copy sort",
  10651. referencedClasses: [],
  10652. messageSends: ["sort", "copy"]
  10653. }),
  10654. $globals.Array);
  10655. $core.addMethod(
  10656. $core.method({
  10657. selector: "sorted:",
  10658. protocol: "enumerating",
  10659. fn: function (aBlock){
  10660. var self=this,$self=this;
  10661. return $core.withContext(function($ctx1) {
  10662. return $recv($self._copy())._sort_(aBlock);
  10663. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  10664. },
  10665. args: ["aBlock"],
  10666. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  10667. referencedClasses: [],
  10668. messageSends: ["sort:", "copy"]
  10669. }),
  10670. $globals.Array);
  10671. $core.addMethod(
  10672. $core.method({
  10673. selector: "new:",
  10674. protocol: "instance creation",
  10675. fn: function (anInteger){
  10676. var self=this,$self=this;
  10677. return $core.withContext(function($ctx1) {
  10678. return new Array(anInteger);
  10679. return self;
  10680. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  10681. },
  10682. args: ["anInteger"],
  10683. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  10684. referencedClasses: [],
  10685. messageSends: []
  10686. }),
  10687. $globals.Array.a$cls);
  10688. $core.addMethod(
  10689. $core.method({
  10690. selector: "with:",
  10691. protocol: "instance creation",
  10692. fn: function (anObject){
  10693. var self=this,$self=this;
  10694. return $core.withContext(function($ctx1) {
  10695. var $1;
  10696. $1=$self._new_((1));
  10697. $recv($1)._at_put_((1),anObject);
  10698. return $recv($1)._yourself();
  10699. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  10700. },
  10701. args: ["anObject"],
  10702. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  10703. referencedClasses: [],
  10704. messageSends: ["at:put:", "new:", "yourself"]
  10705. }),
  10706. $globals.Array.a$cls);
  10707. $core.addMethod(
  10708. $core.method({
  10709. selector: "with:with:",
  10710. protocol: "instance creation",
  10711. fn: function (anObject,anObject2){
  10712. var self=this,$self=this;
  10713. return $core.withContext(function($ctx1) {
  10714. var $1;
  10715. $1=$self._new_((2));
  10716. $recv($1)._at_put_((1),anObject);
  10717. $ctx1.sendIdx["at:put:"]=1;
  10718. $recv($1)._at_put_((2),anObject2);
  10719. return $recv($1)._yourself();
  10720. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  10721. },
  10722. args: ["anObject", "anObject2"],
  10723. source: "with: anObject with: anObject2\x0a\x09\x09^ (self new: 2)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09yourself",
  10724. referencedClasses: [],
  10725. messageSends: ["at:put:", "new:", "yourself"]
  10726. }),
  10727. $globals.Array.a$cls);
  10728. $core.addMethod(
  10729. $core.method({
  10730. selector: "with:with:with:",
  10731. protocol: "instance creation",
  10732. fn: function (anObject,anObject2,anObject3){
  10733. var self=this,$self=this;
  10734. return $core.withContext(function($ctx1) {
  10735. var $1;
  10736. $1=$self._new_((3));
  10737. $recv($1)._at_put_((1),anObject);
  10738. $ctx1.sendIdx["at:put:"]=1;
  10739. $recv($1)._at_put_((2),anObject2);
  10740. $ctx1.sendIdx["at:put:"]=2;
  10741. $recv($1)._at_put_((3),anObject3);
  10742. return $recv($1)._yourself();
  10743. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  10744. },
  10745. args: ["anObject", "anObject2", "anObject3"],
  10746. source: "with: anObject with: anObject2 with: anObject3\x0a\x09\x09^ (self new: 3)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09at: 3 put: anObject3;\x0a\x09\x09yourself",
  10747. referencedClasses: [],
  10748. messageSends: ["at:put:", "new:", "yourself"]
  10749. }),
  10750. $globals.Array.a$cls);
  10751. $core.addMethod(
  10752. $core.method({
  10753. selector: "withAll:",
  10754. protocol: "instance creation",
  10755. fn: function (aCollection){
  10756. var self=this,$self=this;
  10757. var instance,index;
  10758. return $core.withContext(function($ctx1) {
  10759. index=(1);
  10760. instance=$self._new_($recv(aCollection)._size());
  10761. $recv(aCollection)._do_((function(each){
  10762. return $core.withContext(function($ctx2) {
  10763. $recv(instance)._at_put_(index,each);
  10764. index=$recv(index).__plus((1));
  10765. return index;
  10766. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10767. }));
  10768. return instance;
  10769. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  10770. },
  10771. args: ["aCollection"],
  10772. source: "withAll: aCollection\x0a\x09| instance index |\x0a\x09index := 1.\x0a\x09instance := self new: aCollection size.\x0a\x09aCollection do: [ :each |\x0a\x09\x09instance at: index put: each.\x0a\x09\x09index := index + 1 ].\x0a\x09^ instance",
  10773. referencedClasses: [],
  10774. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  10775. }),
  10776. $globals.Array.a$cls);
  10777. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  10778. $globals.String.comment="I am an indexed collection of Characters. Unlike most Smalltalk dialects, Amber doesn't provide the Character class. Instead, elements of a String are single character strings.\x0a\x0aString inherits many useful methods from its hierarchy, such as\x0a\x09`Collection >> #,`";
  10779. $core.addMethod(
  10780. $core.method({
  10781. selector: ",",
  10782. protocol: "copying",
  10783. fn: function (aString){
  10784. var self=this,$self=this;
  10785. return $core.withContext(function($ctx1) {
  10786. return String(self) + aString;
  10787. return self;
  10788. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  10789. },
  10790. args: ["aString"],
  10791. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  10792. referencedClasses: [],
  10793. messageSends: []
  10794. }),
  10795. $globals.String);
  10796. $core.addMethod(
  10797. $core.method({
  10798. selector: "<",
  10799. protocol: "comparing",
  10800. fn: function (aString){
  10801. var self=this,$self=this;
  10802. return $core.withContext(function($ctx1) {
  10803. return String(self) < aString._asString();
  10804. return self;
  10805. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  10806. },
  10807. args: ["aString"],
  10808. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  10809. referencedClasses: [],
  10810. messageSends: []
  10811. }),
  10812. $globals.String);
  10813. $core.addMethod(
  10814. $core.method({
  10815. selector: "<=",
  10816. protocol: "comparing",
  10817. fn: function (aString){
  10818. var self=this,$self=this;
  10819. return $core.withContext(function($ctx1) {
  10820. return String(self) <= aString._asString();
  10821. return self;
  10822. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  10823. },
  10824. args: ["aString"],
  10825. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  10826. referencedClasses: [],
  10827. messageSends: []
  10828. }),
  10829. $globals.String);
  10830. $core.addMethod(
  10831. $core.method({
  10832. selector: "=",
  10833. protocol: "comparing",
  10834. fn: function (aString){
  10835. var self=this,$self=this;
  10836. return $core.withContext(function($ctx1) {
  10837. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  10838. return self;
  10839. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  10840. },
  10841. args: ["aString"],
  10842. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  10843. referencedClasses: [],
  10844. messageSends: []
  10845. }),
  10846. $globals.String);
  10847. $core.addMethod(
  10848. $core.method({
  10849. selector: "==",
  10850. protocol: "comparing",
  10851. fn: function (aString){
  10852. var self=this,$self=this;
  10853. return $core.withContext(function($ctx1) {
  10854. if (typeof aString === "string") return String(self) === aString;
  10855. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  10856. else return false;;
  10857. return self;
  10858. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  10859. },
  10860. args: ["aString"],
  10861. source: "== aString\x0a<inlineJS: '\x0a\x09if (typeof aString === \x22string\x22) return String(self) === aString;\x0a\x09else if (aString != null && typeof aString === \x22object\x22) return String(self) === aString.valueOf();\x0a\x09else return false;\x0a'>",
  10862. referencedClasses: [],
  10863. messageSends: []
  10864. }),
  10865. $globals.String);
  10866. $core.addMethod(
  10867. $core.method({
  10868. selector: ">",
  10869. protocol: "comparing",
  10870. fn: function (aString){
  10871. var self=this,$self=this;
  10872. return $core.withContext(function($ctx1) {
  10873. return String(self) > aString._asString();
  10874. return self;
  10875. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  10876. },
  10877. args: ["aString"],
  10878. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  10879. referencedClasses: [],
  10880. messageSends: []
  10881. }),
  10882. $globals.String);
  10883. $core.addMethod(
  10884. $core.method({
  10885. selector: ">=",
  10886. protocol: "comparing",
  10887. fn: function (aString){
  10888. var self=this,$self=this;
  10889. return $core.withContext(function($ctx1) {
  10890. return String(self) >= aString._asString();
  10891. return self;
  10892. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  10893. },
  10894. args: ["aString"],
  10895. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  10896. referencedClasses: [],
  10897. messageSends: []
  10898. }),
  10899. $globals.String);
  10900. $core.addMethod(
  10901. $core.method({
  10902. selector: "add:",
  10903. protocol: "adding/removing",
  10904. fn: function (anObject){
  10905. var self=this,$self=this;
  10906. return $core.withContext(function($ctx1) {
  10907. $self._errorReadOnly();
  10908. return self;
  10909. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.String)});
  10910. },
  10911. args: ["anObject"],
  10912. source: "add: anObject\x0a\x09self errorReadOnly",
  10913. referencedClasses: [],
  10914. messageSends: ["errorReadOnly"]
  10915. }),
  10916. $globals.String);
  10917. $core.addMethod(
  10918. $core.method({
  10919. selector: "asJavaScriptMethodName",
  10920. protocol: "converting",
  10921. fn: function (){
  10922. var self=this,$self=this;
  10923. return $core.withContext(function($ctx1) {
  10924. return $core.st2js(self);
  10925. return self;
  10926. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  10927. },
  10928. args: [],
  10929. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  10930. referencedClasses: [],
  10931. messageSends: []
  10932. }),
  10933. $globals.String);
  10934. $core.addMethod(
  10935. $core.method({
  10936. selector: "asJavaScriptObject",
  10937. protocol: "converting",
  10938. fn: function (){
  10939. var self=this,$self=this;
  10940. return self;
  10941. },
  10942. args: [],
  10943. source: "asJavaScriptObject\x0a\x09^ self",
  10944. referencedClasses: [],
  10945. messageSends: []
  10946. }),
  10947. $globals.String);
  10948. $core.addMethod(
  10949. $core.method({
  10950. selector: "asJavaScriptSource",
  10951. protocol: "converting",
  10952. fn: function (){
  10953. var self=this,$self=this;
  10954. return $core.withContext(function($ctx1) {
  10955. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  10956. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  10957. else
  10958. return "\"" + self + "\"";
  10959. ;
  10960. return self;
  10961. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  10962. },
  10963. args: [],
  10964. source: "asJavaScriptSource\x0a\x09<inlineJS: '\x0a\x09\x09if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self.replace(/[\x5cx00-\x5cx1f\x22\x5c\x5c\x5cx7f-\x5cx9f]/g, function(ch){var c=ch.charCodeAt(0);return \x22\x5c\x5cx\x22+(\x220\x22+c.toString(16)).slice(-2)}) + \x22\x5c\x22\x22;\x0a\x09\x09else\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self + \x22\x5c\x22\x22;\x0a\x09'>",
  10965. referencedClasses: [],
  10966. messageSends: []
  10967. }),
  10968. $globals.String);
  10969. $core.addMethod(
  10970. $core.method({
  10971. selector: "asLowercase",
  10972. protocol: "converting",
  10973. fn: function (){
  10974. var self=this,$self=this;
  10975. return $core.withContext(function($ctx1) {
  10976. return self.toLowerCase();
  10977. return self;
  10978. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  10979. },
  10980. args: [],
  10981. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  10982. referencedClasses: [],
  10983. messageSends: []
  10984. }),
  10985. $globals.String);
  10986. $core.addMethod(
  10987. $core.method({
  10988. selector: "asMutator",
  10989. protocol: "converting",
  10990. fn: function (){
  10991. var self=this,$self=this;
  10992. return $core.withContext(function($ctx1) {
  10993. var $1;
  10994. $1=$recv($self._last()).__eq(":");
  10995. if(!$core.assert($1)){
  10996. return $self.__comma(":");
  10997. }
  10998. return self;
  10999. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  11000. },
  11001. args: [],
  11002. source: "asMutator\x0a\x09\x22Answer a setter selector. For example,\x0a\x09#name asMutator returns #name:\x22\x0a\x0a\x09self last = ':' ifFalse: [ ^ self, ':' ].\x0a\x09^ self",
  11003. referencedClasses: [],
  11004. messageSends: ["ifFalse:", "=", "last", ","]
  11005. }),
  11006. $globals.String);
  11007. $core.addMethod(
  11008. $core.method({
  11009. selector: "asNumber",
  11010. protocol: "converting",
  11011. fn: function (){
  11012. var self=this,$self=this;
  11013. return $core.withContext(function($ctx1) {
  11014. return Number(self);
  11015. return self;
  11016. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  11017. },
  11018. args: [],
  11019. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  11020. referencedClasses: [],
  11021. messageSends: []
  11022. }),
  11023. $globals.String);
  11024. $core.addMethod(
  11025. $core.method({
  11026. selector: "asRegexp",
  11027. protocol: "converting",
  11028. fn: function (){
  11029. var self=this,$self=this;
  11030. return $core.withContext(function($ctx1) {
  11031. return $recv($globals.RegularExpression)._fromString_(self);
  11032. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  11033. },
  11034. args: [],
  11035. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  11036. referencedClasses: ["RegularExpression"],
  11037. messageSends: ["fromString:"]
  11038. }),
  11039. $globals.String);
  11040. $core.addMethod(
  11041. $core.method({
  11042. selector: "asString",
  11043. protocol: "converting",
  11044. fn: function (){
  11045. var self=this,$self=this;
  11046. return self;
  11047. },
  11048. args: [],
  11049. source: "asString\x0a\x09^ self",
  11050. referencedClasses: [],
  11051. messageSends: []
  11052. }),
  11053. $globals.String);
  11054. $core.addMethod(
  11055. $core.method({
  11056. selector: "asSymbol",
  11057. protocol: "converting",
  11058. fn: function (){
  11059. var self=this,$self=this;
  11060. return self;
  11061. },
  11062. args: [],
  11063. source: "asSymbol\x0a\x09^ self",
  11064. referencedClasses: [],
  11065. messageSends: []
  11066. }),
  11067. $globals.String);
  11068. $core.addMethod(
  11069. $core.method({
  11070. selector: "asSymbolPrintOn:",
  11071. protocol: "printing",
  11072. fn: function (aStream){
  11073. var self=this,$self=this;
  11074. return $core.withContext(function($ctx1) {
  11075. var $1;
  11076. $recv(aStream)._nextPutAll_("#");
  11077. $1=$recv($self._asString())._isSelector();
  11078. if($core.assert($1)){
  11079. $recv(aStream)._nextPut_(self);
  11080. } else {
  11081. $self._printOn_(aStream);
  11082. }
  11083. return self;
  11084. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.String)});
  11085. },
  11086. args: ["aStream"],
  11087. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  11088. referencedClasses: [],
  11089. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  11090. }),
  11091. $globals.String);
  11092. $core.addMethod(
  11093. $core.method({
  11094. selector: "asUppercase",
  11095. protocol: "converting",
  11096. fn: function (){
  11097. var self=this,$self=this;
  11098. return $core.withContext(function($ctx1) {
  11099. return self.toUpperCase();
  11100. return self;
  11101. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  11102. },
  11103. args: [],
  11104. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  11105. referencedClasses: [],
  11106. messageSends: []
  11107. }),
  11108. $globals.String);
  11109. $core.addMethod(
  11110. $core.method({
  11111. selector: "asciiValue",
  11112. protocol: "accessing",
  11113. fn: function (){
  11114. var self=this,$self=this;
  11115. return $core.withContext(function($ctx1) {
  11116. return self.charCodeAt(0);;
  11117. return self;
  11118. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  11119. },
  11120. args: [],
  11121. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  11122. referencedClasses: [],
  11123. messageSends: []
  11124. }),
  11125. $globals.String);
  11126. $core.addMethod(
  11127. $core.method({
  11128. selector: "at:ifAbsent:",
  11129. protocol: "accessing",
  11130. fn: function (anIndex,aBlock){
  11131. var self=this,$self=this;
  11132. return $core.withContext(function($ctx1) {
  11133. return String(self)[anIndex - 1] || aBlock._value();
  11134. return self;
  11135. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  11136. },
  11137. args: ["anIndex", "aBlock"],
  11138. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  11139. referencedClasses: [],
  11140. messageSends: []
  11141. }),
  11142. $globals.String);
  11143. $core.addMethod(
  11144. $core.method({
  11145. selector: "at:ifPresent:ifAbsent:",
  11146. protocol: "accessing",
  11147. fn: function (anIndex,aBlock,anotherBlock){
  11148. var self=this,$self=this;
  11149. return $core.withContext(function($ctx1) {
  11150. var result = String(self)[anIndex - 1];
  11151. return result ? aBlock._value_(result) : anotherBlock._value();
  11152. ;
  11153. return self;
  11154. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  11155. },
  11156. args: ["anIndex", "aBlock", "anotherBlock"],
  11157. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09'>",
  11158. referencedClasses: [],
  11159. messageSends: []
  11160. }),
  11161. $globals.String);
  11162. $core.addMethod(
  11163. $core.method({
  11164. selector: "at:put:",
  11165. protocol: "accessing",
  11166. fn: function (anIndex,anObject){
  11167. var self=this,$self=this;
  11168. return $core.withContext(function($ctx1) {
  11169. $self._errorReadOnly();
  11170. return self;
  11171. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.String)});
  11172. },
  11173. args: ["anIndex", "anObject"],
  11174. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  11175. referencedClasses: [],
  11176. messageSends: ["errorReadOnly"]
  11177. }),
  11178. $globals.String);
  11179. $core.addMethod(
  11180. $core.method({
  11181. selector: "capitalized",
  11182. protocol: "converting",
  11183. fn: function (){
  11184. var self=this,$self=this;
  11185. return $core.withContext(function($ctx1) {
  11186. return $self._ifNotEmpty_((function(){
  11187. return $core.withContext(function($ctx2) {
  11188. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  11189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11190. }));
  11191. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  11192. },
  11193. args: [],
  11194. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  11195. referencedClasses: [],
  11196. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  11197. }),
  11198. $globals.String);
  11199. $core.addMethod(
  11200. $core.method({
  11201. selector: "charCodeAt:",
  11202. protocol: "accessing",
  11203. fn: function (anInteger){
  11204. var self=this,$self=this;
  11205. return $core.withContext(function($ctx1) {
  11206. return self.charCodeAt(anInteger - 1);
  11207. return self;
  11208. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  11209. },
  11210. args: ["anInteger"],
  11211. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  11212. referencedClasses: [],
  11213. messageSends: []
  11214. }),
  11215. $globals.String);
  11216. $core.addMethod(
  11217. $core.method({
  11218. selector: "copyFrom:to:",
  11219. protocol: "copying",
  11220. fn: function (anIndex,anotherIndex){
  11221. var self=this,$self=this;
  11222. return $core.withContext(function($ctx1) {
  11223. return self.substring(anIndex - 1, anotherIndex);
  11224. return self;
  11225. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  11226. },
  11227. args: ["anIndex", "anotherIndex"],
  11228. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  11229. referencedClasses: [],
  11230. messageSends: []
  11231. }),
  11232. $globals.String);
  11233. $core.addMethod(
  11234. $core.method({
  11235. selector: "crlfSanitized",
  11236. protocol: "converting",
  11237. fn: function (){
  11238. var self=this,$self=this;
  11239. return $core.withContext(function($ctx1) {
  11240. return $recv($self._lines())._join_($recv($globals.String)._lf());
  11241. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  11242. },
  11243. args: [],
  11244. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  11245. referencedClasses: ["String"],
  11246. messageSends: ["join:", "lines", "lf"]
  11247. }),
  11248. $globals.String);
  11249. $core.addMethod(
  11250. $core.method({
  11251. selector: "deepCopy",
  11252. protocol: "copying",
  11253. fn: function (){
  11254. var self=this,$self=this;
  11255. return $core.withContext(function($ctx1) {
  11256. return $self._shallowCopy();
  11257. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  11258. },
  11259. args: [],
  11260. source: "deepCopy\x0a\x09^ self shallowCopy",
  11261. referencedClasses: [],
  11262. messageSends: ["shallowCopy"]
  11263. }),
  11264. $globals.String);
  11265. $core.addMethod(
  11266. $core.method({
  11267. selector: "errorReadOnly",
  11268. protocol: "error handling",
  11269. fn: function (){
  11270. var self=this,$self=this;
  11271. return $core.withContext(function($ctx1) {
  11272. $self._error_("Object is read-only");
  11273. return self;
  11274. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.String)});
  11275. },
  11276. args: [],
  11277. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  11278. referencedClasses: [],
  11279. messageSends: ["error:"]
  11280. }),
  11281. $globals.String);
  11282. $core.addMethod(
  11283. $core.method({
  11284. selector: "escaped",
  11285. protocol: "converting",
  11286. fn: function (){
  11287. var self=this,$self=this;
  11288. return $core.withContext(function($ctx1) {
  11289. return escape(self);
  11290. return self;
  11291. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  11292. },
  11293. args: [],
  11294. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  11295. referencedClasses: [],
  11296. messageSends: []
  11297. }),
  11298. $globals.String);
  11299. $core.addMethod(
  11300. $core.method({
  11301. selector: "includesSubString:",
  11302. protocol: "testing",
  11303. fn: function (subString){
  11304. var self=this,$self=this;
  11305. return $core.withContext(function($ctx1) {
  11306. return self.indexOf(subString) != -1;
  11307. return self;
  11308. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  11309. },
  11310. args: ["subString"],
  11311. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  11312. referencedClasses: [],
  11313. messageSends: []
  11314. }),
  11315. $globals.String);
  11316. $core.addMethod(
  11317. $core.method({
  11318. selector: "isCapitalized",
  11319. protocol: "testing",
  11320. fn: function (){
  11321. var self=this,$self=this;
  11322. return $core.withContext(function($ctx1) {
  11323. var $2,$1;
  11324. $2=$self._first();
  11325. $ctx1.sendIdx["first"]=1;
  11326. $1=$recv($2)._asUppercase();
  11327. return $recv($1).__eq_eq($self._first());
  11328. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  11329. },
  11330. args: [],
  11331. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  11332. referencedClasses: [],
  11333. messageSends: ["==", "asUppercase", "first"]
  11334. }),
  11335. $globals.String);
  11336. $core.addMethod(
  11337. $core.method({
  11338. selector: "isImmutable",
  11339. protocol: "testing",
  11340. fn: function (){
  11341. var self=this,$self=this;
  11342. return true;
  11343. },
  11344. args: [],
  11345. source: "isImmutable\x0a\x09^ true",
  11346. referencedClasses: [],
  11347. messageSends: []
  11348. }),
  11349. $globals.String);
  11350. $core.addMethod(
  11351. $core.method({
  11352. selector: "isSelector",
  11353. protocol: "testing",
  11354. fn: function (){
  11355. var self=this,$self=this;
  11356. return $core.withContext(function($ctx1) {
  11357. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  11358. return self;
  11359. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  11360. },
  11361. args: [],
  11362. source: "isSelector\x0a<inlineJS:\x0a\x09'return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)'\x0a>",
  11363. referencedClasses: [],
  11364. messageSends: []
  11365. }),
  11366. $globals.String);
  11367. $core.addMethod(
  11368. $core.method({
  11369. selector: "isString",
  11370. protocol: "testing",
  11371. fn: function (){
  11372. var self=this,$self=this;
  11373. return true;
  11374. },
  11375. args: [],
  11376. source: "isString\x0a\x09^ true",
  11377. referencedClasses: [],
  11378. messageSends: []
  11379. }),
  11380. $globals.String);
  11381. $core.addMethod(
  11382. $core.method({
  11383. selector: "isVowel",
  11384. protocol: "testing",
  11385. fn: function (){
  11386. var self=this,$self=this;
  11387. return $core.withContext(function($ctx1) {
  11388. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  11389. return $core.withContext(function($ctx2) {
  11390. return "aeiou"._includes_($self._asLowercase());
  11391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11392. }));
  11393. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  11394. },
  11395. args: [],
  11396. source: "isVowel\x0a\x09\x22Answer true if the receiver is a one character string containing a voyel\x22\x0a\x09\x0a\x09^ self size = 1 and: [ 'aeiou' includes: self asLowercase ]",
  11397. referencedClasses: [],
  11398. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  11399. }),
  11400. $globals.String);
  11401. $core.addMethod(
  11402. $core.method({
  11403. selector: "join:",
  11404. protocol: "split join",
  11405. fn: function (aCollection){
  11406. var self=this,$self=this;
  11407. return $core.withContext(function($ctx1) {
  11408. return $recv($globals.String)._streamContents_((function(stream){
  11409. return $core.withContext(function($ctx2) {
  11410. return $recv(aCollection)._do_separatedBy_((function(each){
  11411. return $core.withContext(function($ctx3) {
  11412. return $recv(stream)._nextPutAll_($recv(each)._asString());
  11413. $ctx3.sendIdx["nextPutAll:"]=1;
  11414. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  11415. }),(function(){
  11416. return $core.withContext(function($ctx3) {
  11417. return $recv(stream)._nextPutAll_(self);
  11418. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11419. }));
  11420. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  11421. }));
  11422. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  11423. },
  11424. args: ["aCollection"],
  11425. source: "join: aCollection\x0a\x09^ String\x0a\x09\x09streamContents: [ :stream | aCollection\x0a\x09\x09\x09\x09do: [ :each | stream nextPutAll: each asString ]\x0a\x09\x09\x09\x09separatedBy: [ stream nextPutAll: self ]]",
  11426. referencedClasses: ["String"],
  11427. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  11428. }),
  11429. $globals.String);
  11430. $core.addMethod(
  11431. $core.method({
  11432. selector: "lineIndicesDo:",
  11433. protocol: "split join",
  11434. fn: function (aBlock){
  11435. var self=this,$self=this;
  11436. var cr,lf,start,sz,nextLF,nextCR;
  11437. return $core.withContext(function($ctx1) {
  11438. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  11439. var $early={};
  11440. try {
  11441. start=(1);
  11442. sz=$self._size();
  11443. cr=$recv($globals.String)._cr();
  11444. nextCR=$self._indexOf_startingAt_(cr,(1));
  11445. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  11446. lf=$recv($globals.String)._lf();
  11447. nextLF=$self._indexOf_startingAt_(lf,(1));
  11448. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  11449. $recv((function(){
  11450. return $core.withContext(function($ctx2) {
  11451. return $recv(start).__lt_eq(sz);
  11452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11453. }))._whileTrue_((function(){
  11454. return $core.withContext(function($ctx2) {
  11455. $2=$recv(nextLF).__eq((0));
  11456. $ctx2.sendIdx["="]=1;
  11457. $1=$recv($2)._and_((function(){
  11458. return $core.withContext(function($ctx3) {
  11459. return $recv(nextCR).__eq((0));
  11460. $ctx3.sendIdx["="]=2;
  11461. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11462. }));
  11463. $ctx2.sendIdx["and:"]=1;
  11464. if($core.assert($1)){
  11465. $recv(aBlock)._value_value_value_(start,sz,sz);
  11466. $ctx2.sendIdx["value:value:value:"]=1;
  11467. throw $early=[self];
  11468. }
  11469. $4=$recv(nextCR).__eq((0));
  11470. $ctx2.sendIdx["="]=3;
  11471. $3=$recv($4)._or_((function(){
  11472. return $core.withContext(function($ctx3) {
  11473. $5=(0).__lt(nextLF);
  11474. $ctx3.sendIdx["<"]=1;
  11475. return $recv($5)._and_((function(){
  11476. return $core.withContext(function($ctx4) {
  11477. return $recv(nextLF).__lt(nextCR);
  11478. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  11479. }));
  11480. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  11481. }));
  11482. if($core.assert($3)){
  11483. $6=start;
  11484. $7=$recv(nextLF).__minus((1));
  11485. $ctx2.sendIdx["-"]=1;
  11486. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  11487. $ctx2.sendIdx["value:value:value:"]=2;
  11488. start=(1).__plus(nextLF);
  11489. $ctx2.sendIdx["+"]=1;
  11490. nextLF=$self._indexOf_startingAt_(lf,start);
  11491. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  11492. return nextLF;
  11493. } else {
  11494. $9=(1).__plus(nextCR);
  11495. $ctx2.sendIdx["+"]=2;
  11496. $8=$recv($9).__eq(nextLF);
  11497. if($core.assert($8)){
  11498. $10=start;
  11499. $11=$recv(nextCR).__minus((1));
  11500. $ctx2.sendIdx["-"]=2;
  11501. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  11502. $ctx2.sendIdx["value:value:value:"]=3;
  11503. start=(1).__plus(nextLF);
  11504. $ctx2.sendIdx["+"]=3;
  11505. nextCR=$self._indexOf_startingAt_(cr,start);
  11506. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  11507. nextLF=$self._indexOf_startingAt_(lf,start);
  11508. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  11509. return nextLF;
  11510. } else {
  11511. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  11512. start=(1).__plus(nextCR);
  11513. nextCR=$self._indexOf_startingAt_(cr,start);
  11514. return nextCR;
  11515. }
  11516. }
  11517. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  11518. }));
  11519. return self;
  11520. }
  11521. catch(e) {if(e===$early)return e[0]; throw e}
  11522. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  11523. },
  11524. args: ["aBlock"],
  11525. source: "lineIndicesDo: aBlock\x0a\x09\x22execute aBlock with 3 arguments for each line:\x0a\x09- start index of line\x0a\x09- end index of line without line delimiter\x0a\x09- end index of line including line delimiter(s) CR, LF or CRLF\x22\x0a\x09\x0a\x09| cr lf start sz nextLF nextCR |\x0a\x09start := 1.\x0a\x09sz := self size.\x0a\x09cr := String cr.\x0a\x09nextCR := self indexOf: cr startingAt: 1.\x0a\x09lf := String lf.\x0a\x09nextLF := self indexOf: lf startingAt: 1.\x0a\x09[ start <= sz ] whileTrue: [ \x0a\x09\x09(nextLF = 0 and: [ nextCR = 0 ])\x0a\x09\x09\x09ifTrue: [ \x22No more CR, nor LF, the string is over\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: sz value: sz.\x0a\x09\x09\x09\x09\x09^ self ].\x0a\x09\x09(nextCR = 0 or: [ 0 < nextLF and: [ nextLF < nextCR ] ])\x0a\x09\x09\x09ifTrue: [ \x22Found a LF\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextLF - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09ifFalse: [ 1 + nextCR = nextLF\x0a\x09\x09\x09\x09ifTrue: [ \x22Found a CR-LF pair\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09\x09ifFalse: [ \x22Found a CR\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextCR.\x0a\x09\x09\x09\x09\x09start := 1 + nextCR.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start ] ]]",
  11526. referencedClasses: ["String"],
  11527. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  11528. }),
  11529. $globals.String);
  11530. $core.addMethod(
  11531. $core.method({
  11532. selector: "lineNumber:",
  11533. protocol: "split join",
  11534. fn: function (anIndex){
  11535. var self=this,$self=this;
  11536. var lineCount;
  11537. return $core.withContext(function($ctx1) {
  11538. var $2,$1;
  11539. var $early={};
  11540. try {
  11541. lineCount=(0);
  11542. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  11543. return $core.withContext(function($ctx2) {
  11544. lineCount=$recv(lineCount).__plus((1));
  11545. $2=lineCount;
  11546. $1=$recv($2).__eq(anIndex);
  11547. if($core.assert($1)){
  11548. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  11549. }
  11550. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  11551. }));
  11552. return nil;
  11553. }
  11554. catch(e) {if(e===$early)return e[0]; throw e}
  11555. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  11556. },
  11557. args: ["anIndex"],
  11558. source: "lineNumber: anIndex\x0a\x09\x22Answer a string containing the characters in the given line number.\x22\x0a\x0a\x09| lineCount |\x0a\x09lineCount := 0.\x0a\x09self lineIndicesDo: [ :start :endWithoutDelimiters :end |\x0a\x09\x09(lineCount := lineCount + 1) = anIndex ifTrue: [ ^ self copyFrom: start to: endWithoutDelimiters ]].\x0a\x09^ nil",
  11559. referencedClasses: [],
  11560. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  11561. }),
  11562. $globals.String);
  11563. $core.addMethod(
  11564. $core.method({
  11565. selector: "lines",
  11566. protocol: "split join",
  11567. fn: function (){
  11568. var self=this,$self=this;
  11569. return $core.withContext(function($ctx1) {
  11570. var result = self.split(/\r\n|\r|\n/);
  11571. if (!result[result.length-1]) result.pop();
  11572. return result;;
  11573. return self;
  11574. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  11575. },
  11576. args: [],
  11577. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a<inlineJS: '\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;\x0a'>",
  11578. referencedClasses: [],
  11579. messageSends: []
  11580. }),
  11581. $globals.String);
  11582. $core.addMethod(
  11583. $core.method({
  11584. selector: "linesDo:",
  11585. protocol: "split join",
  11586. fn: function (aBlock){
  11587. var self=this,$self=this;
  11588. return $core.withContext(function($ctx1) {
  11589. $recv($self._lines())._do_(aBlock);
  11590. return self;
  11591. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  11592. },
  11593. args: ["aBlock"],
  11594. source: "linesDo: aBlock\x0a\x09\x22Execute aBlock with each line in this string. The terminating line\x0a\x09delimiters CR, LF or CRLF pairs are not included in what is passed to aBlock\x22\x0a\x0a\x09self lines do: aBlock",
  11595. referencedClasses: [],
  11596. messageSends: ["do:", "lines"]
  11597. }),
  11598. $globals.String);
  11599. $core.addMethod(
  11600. $core.method({
  11601. selector: "match:",
  11602. protocol: "regular expressions",
  11603. fn: function (aRegexp){
  11604. var self=this,$self=this;
  11605. return $core.withContext(function($ctx1) {
  11606. return self.search(aRegexp) != -1;
  11607. return self;
  11608. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  11609. },
  11610. args: ["aRegexp"],
  11611. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  11612. referencedClasses: [],
  11613. messageSends: []
  11614. }),
  11615. $globals.String);
  11616. $core.addMethod(
  11617. $core.method({
  11618. selector: "matchesOf:",
  11619. protocol: "regular expressions",
  11620. fn: function (aRegularExpression){
  11621. var self=this,$self=this;
  11622. return $core.withContext(function($ctx1) {
  11623. return self.match(aRegularExpression);
  11624. return self;
  11625. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  11626. },
  11627. args: ["aRegularExpression"],
  11628. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  11629. referencedClasses: [],
  11630. messageSends: []
  11631. }),
  11632. $globals.String);
  11633. $core.addMethod(
  11634. $core.method({
  11635. selector: "printNl",
  11636. protocol: "printing",
  11637. fn: function (){
  11638. var self=this,$self=this;
  11639. return $core.withContext(function($ctx1) {
  11640. console.log(self);
  11641. return self;
  11642. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  11643. },
  11644. args: [],
  11645. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  11646. referencedClasses: [],
  11647. messageSends: []
  11648. }),
  11649. $globals.String);
  11650. $core.addMethod(
  11651. $core.method({
  11652. selector: "printOn:",
  11653. protocol: "printing",
  11654. fn: function (aStream){
  11655. var self=this,$self=this;
  11656. return $core.withContext(function($ctx1) {
  11657. $recv(aStream)._nextPutAll_("'");
  11658. $ctx1.sendIdx["nextPutAll:"]=1;
  11659. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  11660. $ctx1.sendIdx["nextPutAll:"]=2;
  11661. $recv(aStream)._nextPutAll_("'");
  11662. return self;
  11663. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  11664. },
  11665. args: ["aStream"],
  11666. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  11667. referencedClasses: [],
  11668. messageSends: ["nextPutAll:", "replace:with:"]
  11669. }),
  11670. $globals.String);
  11671. $core.addMethod(
  11672. $core.method({
  11673. selector: "putOn:",
  11674. protocol: "streaming",
  11675. fn: function (aStream){
  11676. var self=this,$self=this;
  11677. return $core.withContext(function($ctx1) {
  11678. $recv(aStream)._nextPutString_(self);
  11679. return self;
  11680. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.String)});
  11681. },
  11682. args: ["aStream"],
  11683. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  11684. referencedClasses: [],
  11685. messageSends: ["nextPutString:"]
  11686. }),
  11687. $globals.String);
  11688. $core.addMethod(
  11689. $core.method({
  11690. selector: "remove:",
  11691. protocol: "adding/removing",
  11692. fn: function (anObject){
  11693. var self=this,$self=this;
  11694. return $core.withContext(function($ctx1) {
  11695. $self._errorReadOnly();
  11696. return self;
  11697. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.String)});
  11698. },
  11699. args: ["anObject"],
  11700. source: "remove: anObject\x0a\x09self errorReadOnly",
  11701. referencedClasses: [],
  11702. messageSends: ["errorReadOnly"]
  11703. }),
  11704. $globals.String);
  11705. $core.addMethod(
  11706. $core.method({
  11707. selector: "remove:ifAbsent:",
  11708. protocol: "adding/removing",
  11709. fn: function (anObject,aBlock){
  11710. var self=this,$self=this;
  11711. return $core.withContext(function($ctx1) {
  11712. $self._errorReadOnly();
  11713. return self;
  11714. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.String)});
  11715. },
  11716. args: ["anObject", "aBlock"],
  11717. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  11718. referencedClasses: [],
  11719. messageSends: ["errorReadOnly"]
  11720. }),
  11721. $globals.String);
  11722. $core.addMethod(
  11723. $core.method({
  11724. selector: "replace:with:",
  11725. protocol: "regular expressions",
  11726. fn: function (aString,anotherString){
  11727. var self=this,$self=this;
  11728. return $core.withContext(function($ctx1) {
  11729. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  11730. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  11731. },
  11732. args: ["aString", "anotherString"],
  11733. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  11734. referencedClasses: ["RegularExpression"],
  11735. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  11736. }),
  11737. $globals.String);
  11738. $core.addMethod(
  11739. $core.method({
  11740. selector: "replaceRegexp:with:",
  11741. protocol: "regular expressions",
  11742. fn: function (aRegexp,aString){
  11743. var self=this,$self=this;
  11744. return $core.withContext(function($ctx1) {
  11745. return self.replace(aRegexp, aString);
  11746. return self;
  11747. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  11748. },
  11749. args: ["aRegexp", "aString"],
  11750. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  11751. referencedClasses: [],
  11752. messageSends: []
  11753. }),
  11754. $globals.String);
  11755. $core.addMethod(
  11756. $core.method({
  11757. selector: "reversed",
  11758. protocol: "converting",
  11759. fn: function (){
  11760. var self=this,$self=this;
  11761. return $core.withContext(function($ctx1) {
  11762. return self.split("").reverse().join("");
  11763. return self;
  11764. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  11765. },
  11766. args: [],
  11767. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  11768. referencedClasses: [],
  11769. messageSends: []
  11770. }),
  11771. $globals.String);
  11772. $core.addMethod(
  11773. $core.method({
  11774. selector: "shallowCopy",
  11775. protocol: "copying",
  11776. fn: function (){
  11777. var self=this,$self=this;
  11778. return self;
  11779. },
  11780. args: [],
  11781. source: "shallowCopy\x0a\x09^ self",
  11782. referencedClasses: [],
  11783. messageSends: []
  11784. }),
  11785. $globals.String);
  11786. $core.addMethod(
  11787. $core.method({
  11788. selector: "subStrings:",
  11789. protocol: "split join",
  11790. fn: function (aString){
  11791. var self=this,$self=this;
  11792. return $core.withContext(function($ctx1) {
  11793. return $self._tokenize_(aString);
  11794. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  11795. },
  11796. args: ["aString"],
  11797. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  11798. referencedClasses: [],
  11799. messageSends: ["tokenize:"]
  11800. }),
  11801. $globals.String);
  11802. $core.addMethod(
  11803. $core.method({
  11804. selector: "symbolPrintString",
  11805. protocol: "printing",
  11806. fn: function (){
  11807. var self=this,$self=this;
  11808. return $core.withContext(function($ctx1) {
  11809. return $recv($globals.String)._streamContents_((function(str){
  11810. return $core.withContext(function($ctx2) {
  11811. return $self._asSymbolPrintOn_(str);
  11812. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  11813. }));
  11814. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.String)});
  11815. },
  11816. args: [],
  11817. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  11818. referencedClasses: ["String"],
  11819. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  11820. }),
  11821. $globals.String);
  11822. $core.addMethod(
  11823. $core.method({
  11824. selector: "tokenize:",
  11825. protocol: "split join",
  11826. fn: function (aString){
  11827. var self=this,$self=this;
  11828. return $core.withContext(function($ctx1) {
  11829. return self.split(aString);
  11830. return self;
  11831. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  11832. },
  11833. args: ["aString"],
  11834. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  11835. referencedClasses: [],
  11836. messageSends: []
  11837. }),
  11838. $globals.String);
  11839. $core.addMethod(
  11840. $core.method({
  11841. selector: "trimBoth",
  11842. protocol: "regular expressions",
  11843. fn: function (){
  11844. var self=this,$self=this;
  11845. return $core.withContext(function($ctx1) {
  11846. return $self._trimBoth_("\x5cs");
  11847. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  11848. },
  11849. args: [],
  11850. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  11851. referencedClasses: [],
  11852. messageSends: ["trimBoth:"]
  11853. }),
  11854. $globals.String);
  11855. $core.addMethod(
  11856. $core.method({
  11857. selector: "trimBoth:",
  11858. protocol: "regular expressions",
  11859. fn: function (separators){
  11860. var self=this,$self=this;
  11861. return $core.withContext(function($ctx1) {
  11862. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  11863. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  11864. },
  11865. args: ["separators"],
  11866. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  11867. referencedClasses: [],
  11868. messageSends: ["trimRight:", "trimLeft:"]
  11869. }),
  11870. $globals.String);
  11871. $core.addMethod(
  11872. $core.method({
  11873. selector: "trimLeft",
  11874. protocol: "regular expressions",
  11875. fn: function (){
  11876. var self=this,$self=this;
  11877. return $core.withContext(function($ctx1) {
  11878. return $self._trimLeft_("\x5cs");
  11879. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  11880. },
  11881. args: [],
  11882. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  11883. referencedClasses: [],
  11884. messageSends: ["trimLeft:"]
  11885. }),
  11886. $globals.String);
  11887. $core.addMethod(
  11888. $core.method({
  11889. selector: "trimLeft:",
  11890. protocol: "regular expressions",
  11891. fn: function (separators){
  11892. var self=this,$self=this;
  11893. return $core.withContext(function($ctx1) {
  11894. var $2,$1;
  11895. $2=$recv("^[".__comma(separators)).__comma("]+");
  11896. $ctx1.sendIdx[","]=1;
  11897. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  11898. return $self._replaceRegexp_with_($1,"");
  11899. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  11900. },
  11901. args: ["separators"],
  11902. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  11903. referencedClasses: ["RegularExpression"],
  11904. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  11905. }),
  11906. $globals.String);
  11907. $core.addMethod(
  11908. $core.method({
  11909. selector: "trimRight",
  11910. protocol: "regular expressions",
  11911. fn: function (){
  11912. var self=this,$self=this;
  11913. return $core.withContext(function($ctx1) {
  11914. return $self._trimRight_("\x5cs");
  11915. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  11916. },
  11917. args: [],
  11918. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  11919. referencedClasses: [],
  11920. messageSends: ["trimRight:"]
  11921. }),
  11922. $globals.String);
  11923. $core.addMethod(
  11924. $core.method({
  11925. selector: "trimRight:",
  11926. protocol: "regular expressions",
  11927. fn: function (separators){
  11928. var self=this,$self=this;
  11929. return $core.withContext(function($ctx1) {
  11930. var $2,$1;
  11931. $2=$recv("[".__comma(separators)).__comma("]+$");
  11932. $ctx1.sendIdx[","]=1;
  11933. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  11934. return $self._replaceRegexp_with_($1,"");
  11935. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  11936. },
  11937. args: ["separators"],
  11938. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  11939. referencedClasses: ["RegularExpression"],
  11940. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  11941. }),
  11942. $globals.String);
  11943. $core.addMethod(
  11944. $core.method({
  11945. selector: "unescaped",
  11946. protocol: "converting",
  11947. fn: function (){
  11948. var self=this,$self=this;
  11949. return $core.withContext(function($ctx1) {
  11950. return unescape(self);
  11951. return self;
  11952. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  11953. },
  11954. args: [],
  11955. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  11956. referencedClasses: [],
  11957. messageSends: []
  11958. }),
  11959. $globals.String);
  11960. $core.addMethod(
  11961. $core.method({
  11962. selector: "uriComponentDecoded",
  11963. protocol: "converting",
  11964. fn: function (){
  11965. var self=this,$self=this;
  11966. return $core.withContext(function($ctx1) {
  11967. return decodeURIComponent(self);
  11968. return self;
  11969. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  11970. },
  11971. args: [],
  11972. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  11973. referencedClasses: [],
  11974. messageSends: []
  11975. }),
  11976. $globals.String);
  11977. $core.addMethod(
  11978. $core.method({
  11979. selector: "uriComponentEncoded",
  11980. protocol: "converting",
  11981. fn: function (){
  11982. var self=this,$self=this;
  11983. return $core.withContext(function($ctx1) {
  11984. return encodeURIComponent(self);
  11985. return self;
  11986. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  11987. },
  11988. args: [],
  11989. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  11990. referencedClasses: [],
  11991. messageSends: []
  11992. }),
  11993. $globals.String);
  11994. $core.addMethod(
  11995. $core.method({
  11996. selector: "uriDecoded",
  11997. protocol: "converting",
  11998. fn: function (){
  11999. var self=this,$self=this;
  12000. return $core.withContext(function($ctx1) {
  12001. return decodeURI(self);
  12002. return self;
  12003. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  12004. },
  12005. args: [],
  12006. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  12007. referencedClasses: [],
  12008. messageSends: []
  12009. }),
  12010. $globals.String);
  12011. $core.addMethod(
  12012. $core.method({
  12013. selector: "uriEncoded",
  12014. protocol: "converting",
  12015. fn: function (){
  12016. var self=this,$self=this;
  12017. return $core.withContext(function($ctx1) {
  12018. return encodeURI(self);
  12019. return self;
  12020. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  12021. },
  12022. args: [],
  12023. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  12024. referencedClasses: [],
  12025. messageSends: []
  12026. }),
  12027. $globals.String);
  12028. $core.addMethod(
  12029. $core.method({
  12030. selector: "value:",
  12031. protocol: "evaluating",
  12032. fn: function (anObject){
  12033. var self=this,$self=this;
  12034. return $core.withContext(function($ctx1) {
  12035. return $recv(anObject)._perform_(self);
  12036. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  12037. },
  12038. args: ["anObject"],
  12039. source: "value: anObject \x0a\x09^ anObject perform: self",
  12040. referencedClasses: [],
  12041. messageSends: ["perform:"]
  12042. }),
  12043. $globals.String);
  12044. $core.addMethod(
  12045. $core.method({
  12046. selector: "cr",
  12047. protocol: "accessing",
  12048. fn: function (){
  12049. var self=this,$self=this;
  12050. return $core.withContext(function($ctx1) {
  12051. return "\r";
  12052. return self;
  12053. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  12054. },
  12055. args: [],
  12056. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  12057. referencedClasses: [],
  12058. messageSends: []
  12059. }),
  12060. $globals.String.a$cls);
  12061. $core.addMethod(
  12062. $core.method({
  12063. selector: "crlf",
  12064. protocol: "accessing",
  12065. fn: function (){
  12066. var self=this,$self=this;
  12067. return $core.withContext(function($ctx1) {
  12068. return "\r\n";
  12069. return self;
  12070. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  12071. },
  12072. args: [],
  12073. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  12074. referencedClasses: [],
  12075. messageSends: []
  12076. }),
  12077. $globals.String.a$cls);
  12078. $core.addMethod(
  12079. $core.method({
  12080. selector: "esc",
  12081. protocol: "accessing",
  12082. fn: function (){
  12083. var self=this,$self=this;
  12084. return $core.withContext(function($ctx1) {
  12085. return $self._fromCharCode_((27));
  12086. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  12087. },
  12088. args: [],
  12089. source: "esc\x0a\x09^ self fromCharCode: 27",
  12090. referencedClasses: [],
  12091. messageSends: ["fromCharCode:"]
  12092. }),
  12093. $globals.String.a$cls);
  12094. $core.addMethod(
  12095. $core.method({
  12096. selector: "fromCharCode:",
  12097. protocol: "instance creation",
  12098. fn: function (anInteger){
  12099. var self=this,$self=this;
  12100. return $core.withContext(function($ctx1) {
  12101. return String.fromCharCode(anInteger);
  12102. return self;
  12103. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  12104. },
  12105. args: ["anInteger"],
  12106. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  12107. referencedClasses: [],
  12108. messageSends: []
  12109. }),
  12110. $globals.String.a$cls);
  12111. $core.addMethod(
  12112. $core.method({
  12113. selector: "fromString:",
  12114. protocol: "instance creation",
  12115. fn: function (aString){
  12116. var self=this,$self=this;
  12117. return $core.withContext(function($ctx1) {
  12118. return String(aString);
  12119. return self;
  12120. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  12121. },
  12122. args: ["aString"],
  12123. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  12124. referencedClasses: [],
  12125. messageSends: []
  12126. }),
  12127. $globals.String.a$cls);
  12128. $core.addMethod(
  12129. $core.method({
  12130. selector: "lf",
  12131. protocol: "accessing",
  12132. fn: function (){
  12133. var self=this,$self=this;
  12134. return $core.withContext(function($ctx1) {
  12135. return "\n";
  12136. return self;
  12137. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  12138. },
  12139. args: [],
  12140. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  12141. referencedClasses: [],
  12142. messageSends: []
  12143. }),
  12144. $globals.String.a$cls);
  12145. $core.addMethod(
  12146. $core.method({
  12147. selector: "random",
  12148. protocol: "random",
  12149. fn: function (){
  12150. var self=this,$self=this;
  12151. return $core.withContext(function($ctx1) {
  12152. return ((10+22*Math.random())/32).toString(32).slice(2);;
  12153. return self;
  12154. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  12155. },
  12156. args: [],
  12157. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return ((10+22*Math.random())/32).toString(32).slice(2);'>",
  12158. referencedClasses: [],
  12159. messageSends: []
  12160. }),
  12161. $globals.String.a$cls);
  12162. $core.addMethod(
  12163. $core.method({
  12164. selector: "randomNotIn:",
  12165. protocol: "random",
  12166. fn: function (aString){
  12167. var self=this,$self=this;
  12168. var result;
  12169. return $core.withContext(function($ctx1) {
  12170. $recv((function(){
  12171. return $core.withContext(function($ctx2) {
  12172. result=$self._random();
  12173. return $recv(aString)._includesSubString_(result);
  12174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12175. }))._whileTrue();
  12176. return result;
  12177. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  12178. },
  12179. args: ["aString"],
  12180. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  12181. referencedClasses: [],
  12182. messageSends: ["whileTrue", "random", "includesSubString:"]
  12183. }),
  12184. $globals.String.a$cls);
  12185. $core.addMethod(
  12186. $core.method({
  12187. selector: "space",
  12188. protocol: "accessing",
  12189. fn: function (){
  12190. var self=this,$self=this;
  12191. return $core.withContext(function($ctx1) {
  12192. return " ";
  12193. return self;
  12194. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  12195. },
  12196. args: [],
  12197. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  12198. referencedClasses: [],
  12199. messageSends: []
  12200. }),
  12201. $globals.String.a$cls);
  12202. $core.addMethod(
  12203. $core.method({
  12204. selector: "streamClass",
  12205. protocol: "accessing",
  12206. fn: function (){
  12207. var self=this,$self=this;
  12208. return $globals.StringStream;
  12209. },
  12210. args: [],
  12211. source: "streamClass\x0a\x09\x09^ StringStream",
  12212. referencedClasses: ["StringStream"],
  12213. messageSends: []
  12214. }),
  12215. $globals.String.a$cls);
  12216. $core.addMethod(
  12217. $core.method({
  12218. selector: "tab",
  12219. protocol: "accessing",
  12220. fn: function (){
  12221. var self=this,$self=this;
  12222. return $core.withContext(function($ctx1) {
  12223. return "\t";
  12224. return self;
  12225. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  12226. },
  12227. args: [],
  12228. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  12229. referencedClasses: [],
  12230. messageSends: []
  12231. }),
  12232. $globals.String.a$cls);
  12233. $core.addMethod(
  12234. $core.method({
  12235. selector: "value:",
  12236. protocol: "instance creation",
  12237. fn: function (aUTFCharCode){
  12238. var self=this,$self=this;
  12239. return $core.withContext(function($ctx1) {
  12240. return String.fromCharCode(aUTFCharCode);;
  12241. return self;
  12242. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  12243. },
  12244. args: ["aUTFCharCode"],
  12245. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  12246. referencedClasses: [],
  12247. messageSends: []
  12248. }),
  12249. $globals.String.a$cls);
  12250. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  12251. $globals.Set.comment="I represent an unordered set of objects without duplicates.\x0a\x0a## Implementation notes\x0a\x0aI put elements into different stores based on their type.\x0aThe goal is to store some elements into native JS object property names to be fast.\x0a\x0aIf an unboxed element has typeof 'string', 'boolean' or 'number', or an element is nil, null or undefined,\x0aI store it as a property name in an empty (== Object.create(null)) JS object, different for each type\x0a(for simplicity, nil/null/undefined is treated as one and included with the two booleans).\x0a\x0aIf element happen to be an object, I try to store them in `ArrayBucketStore`. I have two of them by default,\x0aone hashed using the Smalltalk class name, the other one using the JS constructor name. It is possible to have more or less\x0ainstances of `ArrayBucketStores`, see `#initializeSlowBucketStores`.\x0a\x0aAs a last resort, if none of the `ArrayBucketStore` instances can find a suitable bucket, the `defaultBucket` is used,\x0awhich is an `Array`.";
  12252. $core.addMethod(
  12253. $core.method({
  12254. selector: "=",
  12255. protocol: "comparing",
  12256. fn: function (aCollection){
  12257. var self=this,$self=this;
  12258. return $core.withContext(function($ctx1) {
  12259. var $2,$1,$4,$3,$5;
  12260. var $early={};
  12261. try {
  12262. $2=$self._class();
  12263. $ctx1.sendIdx["class"]=1;
  12264. $1=$recv($2).__eq($recv(aCollection)._class());
  12265. $ctx1.sendIdx["="]=1;
  12266. if(!$core.assert($1)){
  12267. return false;
  12268. }
  12269. $4=$self._size();
  12270. $ctx1.sendIdx["size"]=1;
  12271. $3=$recv($4).__eq($recv(aCollection)._size());
  12272. if(!$core.assert($3)){
  12273. return false;
  12274. }
  12275. $self._do_((function(each){
  12276. return $core.withContext(function($ctx2) {
  12277. $5=$recv(aCollection)._includes_(each);
  12278. if(!$core.assert($5)){
  12279. throw $early=[false];
  12280. }
  12281. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  12282. }));
  12283. return true;
  12284. }
  12285. catch(e) {if(e===$early)return e[0]; throw e}
  12286. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  12287. },
  12288. args: ["aCollection"],
  12289. source: "= aCollection\x0a\x09self class = aCollection class ifFalse: [ ^ false ].\x0a\x09self size = aCollection size ifFalse: [ ^ false ].\x0a\x09self do: [ :each | (aCollection includes: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  12290. referencedClasses: [],
  12291. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  12292. }),
  12293. $globals.Set);
  12294. $core.addMethod(
  12295. $core.method({
  12296. selector: "add:",
  12297. protocol: "adding/removing",
  12298. fn: function (anObject){
  12299. var self=this,$self=this;
  12300. var bucket;
  12301. return $core.withContext(function($ctx1) {
  12302. var $1,$receiver;
  12303. bucket=$self._bucketsOfElement_(anObject);
  12304. $1=$recv(bucket)._second();
  12305. if(($receiver = $1) == null || $receiver.a$nil){
  12306. var object,slowBucket;
  12307. object=$recv(bucket)._first();
  12308. $ctx1.sendIdx["first"]=1;
  12309. slowBucket=$recv(bucket)._third();
  12310. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  12311. return $core.withContext(function($ctx2) {
  12312. $recv(slowBucket)._add_(object);
  12313. $self["@size"]=$recv($self["@size"]).__plus((1));
  12314. return $self["@size"];
  12315. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12316. }));
  12317. return object;
  12318. } else {
  12319. var primitiveBucket;
  12320. primitiveBucket=$receiver;
  12321. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  12322. }
  12323. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12324. },
  12325. args: ["anObject"],
  12326. source: "add: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [\x0a\x09\x09\x09| object slowBucket |\x0a\x09\x09\x09object := bucket first.\x0a\x09\x09\x09slowBucket := bucket third.\x0a\x09\x09\x09slowBucket \x0a\x09\x09\x09\x09indexOf: object \x0a\x09\x09\x09\x09ifAbsent: [ \x0a\x09\x09\x09\x09\x09slowBucket add: object. \x0a\x09\x09\x09\x09\x09size := size + 1 ].\x0a\x09\x09\x09object ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09add: bucket first \x0a\x09\x09\x09\x09in: primitiveBucket ]",
  12327. referencedClasses: [],
  12328. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  12329. }),
  12330. $globals.Set);
  12331. $core.addMethod(
  12332. $core.method({
  12333. selector: "add:in:",
  12334. protocol: "private",
  12335. fn: function (anObject,anotherObject){
  12336. var self=this,$self=this;
  12337. return $core.withContext(function($ctx1) {
  12338. if (anObject in anotherObject.store) { return anObject; }
  12339. $self['@size']++;
  12340. anotherObject.store[anObject] = true;
  12341. return anObject;
  12342. ;
  12343. return self;
  12344. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12345. },
  12346. args: ["anObject", "anotherObject"],
  12347. source: "add: anObject in: anotherObject\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) { return anObject; }\x0a\x09\x09$self[''@size'']++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09'>",
  12348. referencedClasses: [],
  12349. messageSends: []
  12350. }),
  12351. $globals.Set);
  12352. $core.addMethod(
  12353. $core.method({
  12354. selector: "bucketsOfElement:",
  12355. protocol: "private",
  12356. fn: function (anObject){
  12357. var self=this,$self=this;
  12358. return $core.withContext(function($ctx1) {
  12359. // include nil to well-known objects under "boolean" fastBucket
  12360. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  12361. var prim = anObject.valueOf();
  12362. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  12363. var bucket = null;
  12364. $self['@slowBucketStores'].some(function (store) {
  12365. return bucket = store._bucketOfElement_(anObject);
  12366. });
  12367. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  12368. }
  12369. return [ prim, $self['@fastBuckets'][typeof prim] ];
  12370. ;
  12371. return self;
  12372. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  12373. },
  12374. args: ["anObject"],
  12375. source: "bucketsOfElement: anObject\x0a\x09\x22Find the appropriate bucket for `anObject`.\x0a\x09For optimization purposes, directly answer an array with: \x0a\x09- the object to be store\x0a\x09- the primitive bucket\x0a\x09- the slow bucket\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09// include nil to well-known objects under \x22boolean\x22 fastBucket\x0a\x09\x09if (anObject == null || anObject.a$nil) return [ null, $self[''@fastBuckets''].boolean ];\x0a\x09\x09\x0a\x09\x09var prim = anObject.valueOf();\x0a\x09\x09if (typeof prim === \x22object\x22 || typeof prim === \x22function\x22 || !$self[''@fastBuckets''][typeof prim]) {\x0a\x09\x09\x09var bucket = null;\x0a\x09\x09\x09$self[''@slowBucketStores''].some(function (store) {\x0a\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09});\x0a\x09\x09\x09return [ anObject, null, bucket || $self[''@defaultBucket''] ];\x0a\x09\x09}\x0a\x09\x09return [ prim, $self[''@fastBuckets''][typeof prim] ];\x0a\x09'>",
  12376. referencedClasses: [],
  12377. messageSends: []
  12378. }),
  12379. $globals.Set);
  12380. $core.addMethod(
  12381. $core.method({
  12382. selector: "classNameOf:",
  12383. protocol: "private",
  12384. fn: function (anObject){
  12385. var self=this,$self=this;
  12386. return $core.withContext(function($ctx1) {
  12387. return anObject.a$cls != null && anObject.a$cls.name;
  12388. return self;
  12389. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  12390. },
  12391. args: ["anObject"],
  12392. source: "classNameOf: anObject\x0a\x09\x22Answer the class name of `anObject`, or `undefined` \x0a\x09if `anObject` is not an Smalltalk object\x22\x0a\x09\x0a\x09<inlineJS: 'return anObject.a$cls != null && anObject.a$cls.name'>",
  12393. referencedClasses: [],
  12394. messageSends: []
  12395. }),
  12396. $globals.Set);
  12397. $core.addMethod(
  12398. $core.method({
  12399. selector: "collect:",
  12400. protocol: "enumerating",
  12401. fn: function (aBlock){
  12402. var self=this,$self=this;
  12403. var collection;
  12404. return $core.withContext(function($ctx1) {
  12405. collection=$recv($self._class())._new();
  12406. $self._do_((function(each){
  12407. return $core.withContext(function($ctx2) {
  12408. return $recv(collection)._add_($recv(aBlock)._value_(each));
  12409. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12410. }));
  12411. return collection;
  12412. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12413. },
  12414. args: ["aBlock"],
  12415. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  12416. referencedClasses: [],
  12417. messageSends: ["new", "class", "do:", "add:", "value:"]
  12418. }),
  12419. $globals.Set);
  12420. $core.addMethod(
  12421. $core.method({
  12422. selector: "do:",
  12423. protocol: "enumerating",
  12424. fn: function (aBlock){
  12425. var self=this,$self=this;
  12426. return $core.withContext(function($ctx1) {
  12427. var el, keys, i;
  12428. el = $self['@fastBuckets'];
  12429. keys = Object.keys(el);
  12430. for (i = 0; i < keys.length; ++i) {
  12431. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  12432. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  12433. else { store._do_(aBlock); }
  12434. }
  12435. el = $self['@slowBucketStores'];
  12436. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  12437. $self['@defaultBucket']._do_(aBlock);
  12438. ;
  12439. return self;
  12440. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  12441. },
  12442. args: ["aBlock"],
  12443. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var el, keys, i;\x0a\x09\x09el = $self[''@fastBuckets''];\x0a\x09\x09keys = Object.keys(el);\x0a\x09\x09for (i = 0; i < keys.length; ++i) {\x0a\x09\x09\x09var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);\x0a\x09\x09\x09if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }\x0a\x09\x09\x09else { store._do_(aBlock); }\x0a\x09\x09}\x0a\x09\x09el = $self[''@slowBucketStores''];\x0a\x09\x09for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }\x0a\x09\x09$self[''@defaultBucket'']._do_(aBlock);\x0a\x09'>",
  12444. referencedClasses: [],
  12445. messageSends: []
  12446. }),
  12447. $globals.Set);
  12448. $core.addMethod(
  12449. $core.method({
  12450. selector: "includes:",
  12451. protocol: "testing",
  12452. fn: function (anObject){
  12453. var self=this,$self=this;
  12454. var bucket;
  12455. return $core.withContext(function($ctx1) {
  12456. var $1,$2,$3,$receiver;
  12457. bucket=$self._bucketsOfElement_(anObject);
  12458. $1=$recv(bucket)._second();
  12459. if(($receiver = $1) == null || $receiver.a$nil){
  12460. $2=$recv(bucket)._third();
  12461. $3=$recv(bucket)._first();
  12462. $ctx1.sendIdx["first"]=1;
  12463. return $recv($2)._includes_($3);
  12464. } else {
  12465. var primitiveBucket;
  12466. primitiveBucket=$receiver;
  12467. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  12468. }
  12469. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12470. },
  12471. args: ["anObject"],
  12472. source: "includes: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third includes: bucket first ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self includes: bucket first in: primitiveBucket ]",
  12473. referencedClasses: [],
  12474. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  12475. }),
  12476. $globals.Set);
  12477. $core.addMethod(
  12478. $core.method({
  12479. selector: "includes:in:",
  12480. protocol: "private",
  12481. fn: function (anObject,anotherObject){
  12482. var self=this,$self=this;
  12483. return $core.withContext(function($ctx1) {
  12484. return anObject in anotherObject.store;
  12485. return self;
  12486. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12487. },
  12488. args: ["anObject", "anotherObject"],
  12489. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  12490. referencedClasses: [],
  12491. messageSends: []
  12492. }),
  12493. $globals.Set);
  12494. $core.addMethod(
  12495. $core.method({
  12496. selector: "initialize",
  12497. protocol: "initialization",
  12498. fn: function (){
  12499. var self=this,$self=this;
  12500. return $core.withContext(function($ctx1) {
  12501. (
  12502. $ctx1.supercall = true,
  12503. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  12504. $ctx1.supercall = false;
  12505. $self["@defaultBucket"]=[];
  12506. $self._initializeSlowBucketStores();
  12507. $self._removeAll();
  12508. return self;
  12509. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  12510. },
  12511. args: [],
  12512. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  12513. referencedClasses: [],
  12514. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  12515. }),
  12516. $globals.Set);
  12517. $core.addMethod(
  12518. $core.method({
  12519. selector: "initializeSlowBucketStores",
  12520. protocol: "initialization",
  12521. fn: function (){
  12522. var self=this,$self=this;
  12523. return $core.withContext(function($ctx1) {
  12524. var $1;
  12525. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  12526. return $core.withContext(function($ctx2) {
  12527. return $self._classNameOf_(x);
  12528. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  12529. }));
  12530. $ctx1.sendIdx["hashBlock:"]=1;
  12531. $self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  12532. return $core.withContext(function($ctx2) {
  12533. return $self._jsConstructorNameOf_(x);
  12534. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  12535. }))];
  12536. return self;
  12537. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  12538. },
  12539. args: [],
  12540. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  12541. referencedClasses: ["ArrayBucketStore"],
  12542. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  12543. }),
  12544. $globals.Set);
  12545. $core.addMethod(
  12546. $core.method({
  12547. selector: "jsConstructorNameOf:",
  12548. protocol: "private",
  12549. fn: function (anObject){
  12550. var self=this,$self=this;
  12551. return $core.withContext(function($ctx1) {
  12552. return anObject.constructor && anObject.constructor.name;
  12553. return self;
  12554. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  12555. },
  12556. args: ["anObject"],
  12557. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  12558. referencedClasses: [],
  12559. messageSends: []
  12560. }),
  12561. $globals.Set);
  12562. $core.addMethod(
  12563. $core.method({
  12564. selector: "printOn:",
  12565. protocol: "printing",
  12566. fn: function (aStream){
  12567. var self=this,$self=this;
  12568. return $core.withContext(function($ctx1) {
  12569. (
  12570. $ctx1.supercall = true,
  12571. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  12572. $ctx1.supercall = false;
  12573. $ctx1.sendIdx["printOn:"]=1;
  12574. $recv(aStream)._nextPutAll_(" (");
  12575. $ctx1.sendIdx["nextPutAll:"]=1;
  12576. $self._do_separatedBy_((function(each){
  12577. return $core.withContext(function($ctx2) {
  12578. return $recv(each)._printOn_(aStream);
  12579. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12580. }),(function(){
  12581. return $core.withContext(function($ctx2) {
  12582. return $recv(aStream)._nextPutAll_(" ");
  12583. $ctx2.sendIdx["nextPutAll:"]=2;
  12584. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12585. }));
  12586. $recv(aStream)._nextPutAll_(")");
  12587. return self;
  12588. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  12589. },
  12590. args: ["aStream"],
  12591. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
  12592. referencedClasses: [],
  12593. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  12594. }),
  12595. $globals.Set);
  12596. $core.addMethod(
  12597. $core.method({
  12598. selector: "remove:ifAbsent:",
  12599. protocol: "adding/removing",
  12600. fn: function (anObject,aBlock){
  12601. var self=this,$self=this;
  12602. var bucket;
  12603. return $core.withContext(function($ctx1) {
  12604. var $1,$2,$3,$receiver;
  12605. var $early={};
  12606. try {
  12607. bucket=$self._bucketsOfElement_(anObject);
  12608. $1=$recv(bucket)._second();
  12609. if(($receiver = $1) == null || $receiver.a$nil){
  12610. $2=$recv(bucket)._third();
  12611. $3=$recv(bucket)._first();
  12612. $ctx1.sendIdx["first"]=1;
  12613. $recv($2)._remove_ifAbsent_($3,(function(){
  12614. return $core.withContext(function($ctx2) {
  12615. throw $early=[$recv(aBlock)._value()];
  12616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12617. }));
  12618. $self["@size"]=$recv($self["@size"]).__minus((1));
  12619. return $self["@size"];
  12620. } else {
  12621. var primitiveBucket;
  12622. primitiveBucket=$receiver;
  12623. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  12624. }
  12625. }
  12626. catch(e) {if(e===$early)return e[0]; throw e}
  12627. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  12628. },
  12629. args: ["anObject", "aBlock"],
  12630. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third remove: bucket first ifAbsent: [ ^aBlock value ]. size := size - 1 ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ifAbsent: aBlock ]",
  12631. referencedClasses: [],
  12632. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:ifAbsent:"]
  12633. }),
  12634. $globals.Set);
  12635. $core.addMethod(
  12636. $core.method({
  12637. selector: "remove:in:ifAbsent:",
  12638. protocol: "private",
  12639. fn: function (anObject,anotherObject,aBlock){
  12640. var self=this,$self=this;
  12641. return $core.withContext(function($ctx1) {
  12642. if (anObject in anotherObject.store) {
  12643. delete anotherObject.store[anObject];
  12644. $self['@size']--;
  12645. return anObject;
  12646. } else {
  12647. return aBlock._value();
  12648. };
  12649. return self;
  12650. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock},$globals.Set)});
  12651. },
  12652. args: ["anObject", "anotherObject", "aBlock"],
  12653. source: "remove: anObject in: anotherObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) {\x0a\x09\x09\x09delete anotherObject.store[anObject];\x0a\x09\x09\x09$self[''@size'']--;\x0a\x09\x09\x09return anObject;\x0a\x09\x09} else {\x0a\x09\x09\x09return aBlock._value();\x0a\x09\x09}'>",
  12654. referencedClasses: [],
  12655. messageSends: []
  12656. }),
  12657. $globals.Set);
  12658. $core.addMethod(
  12659. $core.method({
  12660. selector: "removeAll",
  12661. protocol: "adding/removing",
  12662. fn: function (){
  12663. var self=this,$self=this;
  12664. return $core.withContext(function($ctx1) {
  12665. $self['@fastBuckets'] = {
  12666. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  12667. "number": { store: Object.create(null), fn: Number },
  12668. "string": { store: Object.create(null) }
  12669. };
  12670. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  12671. $self['@defaultBucket']._removeAll();
  12672. $self['@size'] = 0;
  12673. ;
  12674. return self;
  12675. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  12676. },
  12677. args: [],
  12678. source: "removeAll\x0a\x09<inlineJS: '\x0a\x09\x09$self[''@fastBuckets''] = {\x0a\x09\x09\x09\x22boolean\x22: { store: Object.create(null), fn: function (x) { return {\x22true\x22: true, \x22false\x22: false, \x22null\x22: null}[x]; } },\x0a\x09\x09\x09\x22number\x22: { store: Object.create(null), fn: Number },\x0a\x09\x09\x09\x22string\x22: { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09$self[''@slowBucketStores''].forEach(function (x) { x._removeAll(); });\x0a\x09\x09$self[''@defaultBucket'']._removeAll();\x0a\x09\x09$self[''@size''] = 0;\x0a\x09'>",
  12679. referencedClasses: [],
  12680. messageSends: []
  12681. }),
  12682. $globals.Set);
  12683. $core.addMethod(
  12684. $core.method({
  12685. selector: "select:",
  12686. protocol: "enumerating",
  12687. fn: function (aBlock){
  12688. var self=this,$self=this;
  12689. var collection;
  12690. return $core.withContext(function($ctx1) {
  12691. var $1;
  12692. collection=$recv($self._class())._new();
  12693. $self._do_((function(each){
  12694. return $core.withContext(function($ctx2) {
  12695. $1=$recv(aBlock)._value_(each);
  12696. if($core.assert($1)){
  12697. return $recv(collection)._add_(each);
  12698. }
  12699. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12700. }));
  12701. return collection;
  12702. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12703. },
  12704. args: ["aBlock"],
  12705. source: "select: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09\x09collection add: each ] ].\x0a\x09^ collection",
  12706. referencedClasses: [],
  12707. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  12708. }),
  12709. $globals.Set);
  12710. $core.addMethod(
  12711. $core.method({
  12712. selector: "select:thenCollect:",
  12713. protocol: "enumerating",
  12714. fn: function (selectBlock,collectBlock){
  12715. var self=this,$self=this;
  12716. var collection;
  12717. return $core.withContext(function($ctx1) {
  12718. var $1;
  12719. collection=$recv($self._class())._new();
  12720. $self._do_((function(each){
  12721. return $core.withContext(function($ctx2) {
  12722. $1=$recv(selectBlock)._value_(each);
  12723. $ctx2.sendIdx["value:"]=1;
  12724. if($core.assert($1)){
  12725. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  12726. }
  12727. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12728. }));
  12729. return collection;
  12730. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  12731. },
  12732. args: ["selectBlock", "collectBlock"],
  12733. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09\x09collection add: (collectBlock value: each) ] ].\x0a\x09^ collection",
  12734. referencedClasses: [],
  12735. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  12736. }),
  12737. $globals.Set);
  12738. $core.addMethod(
  12739. $core.method({
  12740. selector: "size",
  12741. protocol: "accessing",
  12742. fn: function (){
  12743. var self=this,$self=this;
  12744. return $self["@size"];
  12745. },
  12746. args: [],
  12747. source: "size\x0a\x09^ size",
  12748. referencedClasses: [],
  12749. messageSends: []
  12750. }),
  12751. $globals.Set);
  12752. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  12753. $globals.ProtoStream.comment="I am the abstract base for different accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams modifying the contents.";
  12754. $core.addMethod(
  12755. $core.method({
  12756. selector: "<<",
  12757. protocol: "writing",
  12758. fn: function (anObject){
  12759. var self=this,$self=this;
  12760. return $core.withContext(function($ctx1) {
  12761. $self._write_(anObject);
  12762. return self;
  12763. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  12764. },
  12765. args: ["anObject"],
  12766. source: "<< anObject\x0a\x09self write: anObject",
  12767. referencedClasses: [],
  12768. messageSends: ["write:"]
  12769. }),
  12770. $globals.ProtoStream);
  12771. $core.addMethod(
  12772. $core.method({
  12773. selector: "atEnd",
  12774. protocol: "testing",
  12775. fn: function (){
  12776. var self=this,$self=this;
  12777. return $core.withContext(function($ctx1) {
  12778. $self._subclassResponsibility();
  12779. return self;
  12780. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  12781. },
  12782. args: [],
  12783. source: "atEnd\x0a\x09self subclassResponsibility",
  12784. referencedClasses: [],
  12785. messageSends: ["subclassResponsibility"]
  12786. }),
  12787. $globals.ProtoStream);
  12788. $core.addMethod(
  12789. $core.method({
  12790. selector: "atStart",
  12791. protocol: "testing",
  12792. fn: function (){
  12793. var self=this,$self=this;
  12794. return $core.withContext(function($ctx1) {
  12795. $self._subclassResponsibility();
  12796. return self;
  12797. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  12798. },
  12799. args: [],
  12800. source: "atStart\x0a\x09self subclassResponsibility",
  12801. referencedClasses: [],
  12802. messageSends: ["subclassResponsibility"]
  12803. }),
  12804. $globals.ProtoStream);
  12805. $core.addMethod(
  12806. $core.method({
  12807. selector: "contents",
  12808. protocol: "accessing",
  12809. fn: function (){
  12810. var self=this,$self=this;
  12811. return $core.withContext(function($ctx1) {
  12812. $self._subclassResponsibility();
  12813. return self;
  12814. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  12815. },
  12816. args: [],
  12817. source: "contents\x0a\x09self subclassResponsibility",
  12818. referencedClasses: [],
  12819. messageSends: ["subclassResponsibility"]
  12820. }),
  12821. $globals.ProtoStream);
  12822. $core.addMethod(
  12823. $core.method({
  12824. selector: "do:",
  12825. protocol: "enumerating",
  12826. fn: function (aBlock){
  12827. var self=this,$self=this;
  12828. return $core.withContext(function($ctx1) {
  12829. $recv((function(){
  12830. return $core.withContext(function($ctx2) {
  12831. return $self._atEnd();
  12832. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12833. }))._whileFalse_((function(){
  12834. return $core.withContext(function($ctx2) {
  12835. return $recv(aBlock)._value_($self._next());
  12836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12837. }));
  12838. return self;
  12839. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  12840. },
  12841. args: ["aBlock"],
  12842. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  12843. referencedClasses: [],
  12844. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  12845. }),
  12846. $globals.ProtoStream);
  12847. $core.addMethod(
  12848. $core.method({
  12849. selector: "isEmpty",
  12850. protocol: "testing",
  12851. fn: function (){
  12852. var self=this,$self=this;
  12853. return $core.withContext(function($ctx1) {
  12854. return $recv($self._atStart())._and_((function(){
  12855. return $core.withContext(function($ctx2) {
  12856. return $self._atEnd();
  12857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12858. }));
  12859. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  12860. },
  12861. args: [],
  12862. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  12863. referencedClasses: [],
  12864. messageSends: ["and:", "atStart", "atEnd"]
  12865. }),
  12866. $globals.ProtoStream);
  12867. $core.addMethod(
  12868. $core.method({
  12869. selector: "next",
  12870. protocol: "reading",
  12871. fn: function (){
  12872. var self=this,$self=this;
  12873. return $core.withContext(function($ctx1) {
  12874. var $1;
  12875. $1=$self._atEnd();
  12876. if($core.assert($1)){
  12877. return nil;
  12878. } else {
  12879. return $self._subclassResponsibility();
  12880. }
  12881. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  12882. },
  12883. args: [],
  12884. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  12885. referencedClasses: [],
  12886. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  12887. }),
  12888. $globals.ProtoStream);
  12889. $core.addMethod(
  12890. $core.method({
  12891. selector: "nextPut:",
  12892. protocol: "writing",
  12893. fn: function (anObject){
  12894. var self=this,$self=this;
  12895. return $core.withContext(function($ctx1) {
  12896. $self._subclassResponsibility();
  12897. return self;
  12898. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  12899. },
  12900. args: ["anObject"],
  12901. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  12902. referencedClasses: [],
  12903. messageSends: ["subclassResponsibility"]
  12904. }),
  12905. $globals.ProtoStream);
  12906. $core.addMethod(
  12907. $core.method({
  12908. selector: "nextPutAll:",
  12909. protocol: "writing",
  12910. fn: function (aCollection){
  12911. var self=this,$self=this;
  12912. return $core.withContext(function($ctx1) {
  12913. $recv(aCollection)._do_((function(each){
  12914. return $core.withContext(function($ctx2) {
  12915. return $self._nextPut_(each);
  12916. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12917. }));
  12918. return self;
  12919. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  12920. },
  12921. args: ["aCollection"],
  12922. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  12923. referencedClasses: [],
  12924. messageSends: ["do:", "nextPut:"]
  12925. }),
  12926. $globals.ProtoStream);
  12927. $core.addMethod(
  12928. $core.method({
  12929. selector: "nextPutString:",
  12930. protocol: "writing",
  12931. fn: function (aString){
  12932. var self=this,$self=this;
  12933. return $core.withContext(function($ctx1) {
  12934. $self._nextPut_(aString);
  12935. return self;
  12936. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  12937. },
  12938. args: ["aString"],
  12939. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  12940. referencedClasses: [],
  12941. messageSends: ["nextPut:"]
  12942. }),
  12943. $globals.ProtoStream);
  12944. $core.addMethod(
  12945. $core.method({
  12946. selector: "peek",
  12947. protocol: "reading",
  12948. fn: function (){
  12949. var self=this,$self=this;
  12950. return $core.withContext(function($ctx1) {
  12951. var $1;
  12952. $1=$self._atEnd();
  12953. if($core.assert($1)){
  12954. return nil;
  12955. } else {
  12956. return $self._subclassResponsibility();
  12957. }
  12958. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  12959. },
  12960. args: [],
  12961. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  12962. referencedClasses: [],
  12963. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  12964. }),
  12965. $globals.ProtoStream);
  12966. $core.addMethod(
  12967. $core.method({
  12968. selector: "reset",
  12969. protocol: "actions",
  12970. fn: function (){
  12971. var self=this,$self=this;
  12972. return $core.withContext(function($ctx1) {
  12973. $self._subclassResponsibility();
  12974. return self;
  12975. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  12976. },
  12977. args: [],
  12978. source: "reset\x0a\x09self subclassResponsibility",
  12979. referencedClasses: [],
  12980. messageSends: ["subclassResponsibility"]
  12981. }),
  12982. $globals.ProtoStream);
  12983. $core.addMethod(
  12984. $core.method({
  12985. selector: "resetContents",
  12986. protocol: "actions",
  12987. fn: function (){
  12988. var self=this,$self=this;
  12989. return $core.withContext(function($ctx1) {
  12990. $self._subclassResponsibility();
  12991. return self;
  12992. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  12993. },
  12994. args: [],
  12995. source: "resetContents\x0a\x09self subclassResponsibility",
  12996. referencedClasses: [],
  12997. messageSends: ["subclassResponsibility"]
  12998. }),
  12999. $globals.ProtoStream);
  13000. $core.addMethod(
  13001. $core.method({
  13002. selector: "setToEnd",
  13003. protocol: "positioning",
  13004. fn: function (){
  13005. var self=this,$self=this;
  13006. return $core.withContext(function($ctx1) {
  13007. $self._subclassResponsibility();
  13008. return self;
  13009. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  13010. },
  13011. args: [],
  13012. source: "setToEnd\x0a\x09self subclassResponsibility",
  13013. referencedClasses: [],
  13014. messageSends: ["subclassResponsibility"]
  13015. }),
  13016. $globals.ProtoStream);
  13017. $core.addMethod(
  13018. $core.method({
  13019. selector: "setToStart",
  13020. protocol: "positioning",
  13021. fn: function (){
  13022. var self=this,$self=this;
  13023. return $core.withContext(function($ctx1) {
  13024. $self._reset();
  13025. return self;
  13026. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  13027. },
  13028. args: [],
  13029. source: "setToStart\x0a\x09self reset",
  13030. referencedClasses: [],
  13031. messageSends: ["reset"]
  13032. }),
  13033. $globals.ProtoStream);
  13034. $core.addMethod(
  13035. $core.method({
  13036. selector: "write:",
  13037. protocol: "writing",
  13038. fn: function (anObject){
  13039. var self=this,$self=this;
  13040. return $core.withContext(function($ctx1) {
  13041. $recv(anObject)._putOn_(self);
  13042. return self;
  13043. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  13044. },
  13045. args: ["anObject"],
  13046. source: "write: anObject\x0a\x09anObject putOn: self",
  13047. referencedClasses: [],
  13048. messageSends: ["putOn:"]
  13049. }),
  13050. $globals.ProtoStream);
  13051. $core.addMethod(
  13052. $core.method({
  13053. selector: "on:",
  13054. protocol: "instance creation",
  13055. fn: function (aCollection){
  13056. var self=this,$self=this;
  13057. return $core.withContext(function($ctx1) {
  13058. var $1;
  13059. $1=$self._new();
  13060. $recv($1)._setCollection_(aCollection);
  13061. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13062. return $recv($1)._yourself();
  13063. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  13064. },
  13065. args: ["aCollection"],
  13066. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13067. referencedClasses: [],
  13068. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13069. }),
  13070. $globals.ProtoStream.a$cls);
  13071. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  13072. $globals.Stream.comment="I represent an accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams to the contents sequence collection.";
  13073. $core.addMethod(
  13074. $core.method({
  13075. selector: "atEnd",
  13076. protocol: "testing",
  13077. fn: function (){
  13078. var self=this,$self=this;
  13079. return $core.withContext(function($ctx1) {
  13080. return $recv($self._position()).__eq($self._size());
  13081. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  13082. },
  13083. args: [],
  13084. source: "atEnd\x0a\x09^ self position = self size",
  13085. referencedClasses: [],
  13086. messageSends: ["=", "position", "size"]
  13087. }),
  13088. $globals.Stream);
  13089. $core.addMethod(
  13090. $core.method({
  13091. selector: "atStart",
  13092. protocol: "testing",
  13093. fn: function (){
  13094. var self=this,$self=this;
  13095. return $core.withContext(function($ctx1) {
  13096. return $recv($self._position()).__eq((0));
  13097. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  13098. },
  13099. args: [],
  13100. source: "atStart\x0a\x09^ self position = 0",
  13101. referencedClasses: [],
  13102. messageSends: ["=", "position"]
  13103. }),
  13104. $globals.Stream);
  13105. $core.addMethod(
  13106. $core.method({
  13107. selector: "close",
  13108. protocol: "actions",
  13109. fn: function (){
  13110. var self=this,$self=this;
  13111. return self;
  13112. },
  13113. args: [],
  13114. source: "close",
  13115. referencedClasses: [],
  13116. messageSends: []
  13117. }),
  13118. $globals.Stream);
  13119. $core.addMethod(
  13120. $core.method({
  13121. selector: "collection",
  13122. protocol: "accessing",
  13123. fn: function (){
  13124. var self=this,$self=this;
  13125. return $self["@collection"];
  13126. },
  13127. args: [],
  13128. source: "collection\x0a\x09^ collection",
  13129. referencedClasses: [],
  13130. messageSends: []
  13131. }),
  13132. $globals.Stream);
  13133. $core.addMethod(
  13134. $core.method({
  13135. selector: "contents",
  13136. protocol: "accessing",
  13137. fn: function (){
  13138. var self=this,$self=this;
  13139. return $core.withContext(function($ctx1) {
  13140. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  13141. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  13142. },
  13143. args: [],
  13144. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  13145. referencedClasses: [],
  13146. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  13147. }),
  13148. $globals.Stream);
  13149. $core.addMethod(
  13150. $core.method({
  13151. selector: "flush",
  13152. protocol: "actions",
  13153. fn: function (){
  13154. var self=this,$self=this;
  13155. return self;
  13156. },
  13157. args: [],
  13158. source: "flush",
  13159. referencedClasses: [],
  13160. messageSends: []
  13161. }),
  13162. $globals.Stream);
  13163. $core.addMethod(
  13164. $core.method({
  13165. selector: "isEmpty",
  13166. protocol: "testing",
  13167. fn: function (){
  13168. var self=this,$self=this;
  13169. return $core.withContext(function($ctx1) {
  13170. return $recv($self._size()).__eq((0));
  13171. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  13172. },
  13173. args: [],
  13174. source: "isEmpty\x0a\x09^ self size = 0",
  13175. referencedClasses: [],
  13176. messageSends: ["=", "size"]
  13177. }),
  13178. $globals.Stream);
  13179. $core.addMethod(
  13180. $core.method({
  13181. selector: "next",
  13182. protocol: "reading",
  13183. fn: function (){
  13184. var self=this,$self=this;
  13185. return $core.withContext(function($ctx1) {
  13186. var $1,$3,$2;
  13187. $1=$self._atEnd();
  13188. if($core.assert($1)){
  13189. return nil;
  13190. } else {
  13191. $3=$self._position();
  13192. $ctx1.sendIdx["position"]=1;
  13193. $2=$recv($3).__plus((1));
  13194. $self._position_($2);
  13195. return $recv($self["@collection"])._at_($self._position());
  13196. }
  13197. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  13198. },
  13199. args: [],
  13200. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09self position: self position + 1.\x0a\x09\x09\x09collection at: self position ]",
  13201. referencedClasses: [],
  13202. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  13203. }),
  13204. $globals.Stream);
  13205. $core.addMethod(
  13206. $core.method({
  13207. selector: "next:",
  13208. protocol: "reading",
  13209. fn: function (anInteger){
  13210. var self=this,$self=this;
  13211. var tempCollection;
  13212. return $core.withContext(function($ctx1) {
  13213. var $1;
  13214. tempCollection=$recv($recv($self._collection())._class())._new();
  13215. $recv(anInteger)._timesRepeat_((function(){
  13216. return $core.withContext(function($ctx2) {
  13217. $1=$self._atEnd();
  13218. if(!$core.assert($1)){
  13219. return $recv(tempCollection)._add_($self._next());
  13220. }
  13221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13222. }));
  13223. return tempCollection;
  13224. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  13225. },
  13226. args: ["anInteger"],
  13227. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection add: self next ]].\x0a\x09^ tempCollection",
  13228. referencedClasses: [],
  13229. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  13230. }),
  13231. $globals.Stream);
  13232. $core.addMethod(
  13233. $core.method({
  13234. selector: "nextPut:",
  13235. protocol: "writing",
  13236. fn: function (anObject){
  13237. var self=this,$self=this;
  13238. return $core.withContext(function($ctx1) {
  13239. var $2,$1,$3,$4;
  13240. $2=$self._position();
  13241. $ctx1.sendIdx["position"]=1;
  13242. $1=$recv($2).__plus((1));
  13243. $self._position_($1);
  13244. $3=$self._collection();
  13245. $4=$self._position();
  13246. $ctx1.sendIdx["position"]=2;
  13247. $recv($3)._at_put_($4,anObject);
  13248. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13249. return self;
  13250. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  13251. },
  13252. args: ["anObject"],
  13253. source: "nextPut: anObject\x0a\x09self position: self position + 1.\x0a\x09self collection at: self position put: anObject.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  13254. referencedClasses: [],
  13255. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  13256. }),
  13257. $globals.Stream);
  13258. $core.addMethod(
  13259. $core.method({
  13260. selector: "peek",
  13261. protocol: "reading",
  13262. fn: function (){
  13263. var self=this,$self=this;
  13264. return $core.withContext(function($ctx1) {
  13265. var $1;
  13266. $1=$self._atEnd();
  13267. if(!$core.assert($1)){
  13268. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  13269. }
  13270. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  13271. },
  13272. args: [],
  13273. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  13274. referencedClasses: [],
  13275. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  13276. }),
  13277. $globals.Stream);
  13278. $core.addMethod(
  13279. $core.method({
  13280. selector: "position",
  13281. protocol: "accessing",
  13282. fn: function (){
  13283. var self=this,$self=this;
  13284. return $core.withContext(function($ctx1) {
  13285. var $1,$receiver;
  13286. $1=$self["@position"];
  13287. if(($receiver = $1) == null || $receiver.a$nil){
  13288. $self["@position"]=(0);
  13289. return $self["@position"];
  13290. } else {
  13291. return $1;
  13292. }
  13293. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  13294. },
  13295. args: [],
  13296. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  13297. referencedClasses: [],
  13298. messageSends: ["ifNil:"]
  13299. }),
  13300. $globals.Stream);
  13301. $core.addMethod(
  13302. $core.method({
  13303. selector: "position:",
  13304. protocol: "accessing",
  13305. fn: function (anInteger){
  13306. var self=this,$self=this;
  13307. $self["@position"]=anInteger;
  13308. return self;
  13309. },
  13310. args: ["anInteger"],
  13311. source: "position: anInteger\x0a\x09position := anInteger",
  13312. referencedClasses: [],
  13313. messageSends: []
  13314. }),
  13315. $globals.Stream);
  13316. $core.addMethod(
  13317. $core.method({
  13318. selector: "reset",
  13319. protocol: "actions",
  13320. fn: function (){
  13321. var self=this,$self=this;
  13322. return $core.withContext(function($ctx1) {
  13323. $self._position_((0));
  13324. return self;
  13325. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  13326. },
  13327. args: [],
  13328. source: "reset\x0a\x09self position: 0",
  13329. referencedClasses: [],
  13330. messageSends: ["position:"]
  13331. }),
  13332. $globals.Stream);
  13333. $core.addMethod(
  13334. $core.method({
  13335. selector: "resetContents",
  13336. protocol: "actions",
  13337. fn: function (){
  13338. var self=this,$self=this;
  13339. return $core.withContext(function($ctx1) {
  13340. $self._reset();
  13341. $self._setStreamSize_((0));
  13342. return self;
  13343. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  13344. },
  13345. args: [],
  13346. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  13347. referencedClasses: [],
  13348. messageSends: ["reset", "setStreamSize:"]
  13349. }),
  13350. $globals.Stream);
  13351. $core.addMethod(
  13352. $core.method({
  13353. selector: "setCollection:",
  13354. protocol: "accessing",
  13355. fn: function (aCollection){
  13356. var self=this,$self=this;
  13357. $self["@collection"]=aCollection;
  13358. return self;
  13359. },
  13360. args: ["aCollection"],
  13361. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  13362. referencedClasses: [],
  13363. messageSends: []
  13364. }),
  13365. $globals.Stream);
  13366. $core.addMethod(
  13367. $core.method({
  13368. selector: "setStreamSize:",
  13369. protocol: "accessing",
  13370. fn: function (anInteger){
  13371. var self=this,$self=this;
  13372. $self["@streamSize"]=anInteger;
  13373. return self;
  13374. },
  13375. args: ["anInteger"],
  13376. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  13377. referencedClasses: [],
  13378. messageSends: []
  13379. }),
  13380. $globals.Stream);
  13381. $core.addMethod(
  13382. $core.method({
  13383. selector: "setToEnd",
  13384. protocol: "positioning",
  13385. fn: function (){
  13386. var self=this,$self=this;
  13387. return $core.withContext(function($ctx1) {
  13388. $self._position_($self._size());
  13389. return self;
  13390. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  13391. },
  13392. args: [],
  13393. source: "setToEnd\x0a\x09self position: self size",
  13394. referencedClasses: [],
  13395. messageSends: ["position:", "size"]
  13396. }),
  13397. $globals.Stream);
  13398. $core.addMethod(
  13399. $core.method({
  13400. selector: "size",
  13401. protocol: "accessing",
  13402. fn: function (){
  13403. var self=this,$self=this;
  13404. return $core.withContext(function($ctx1) {
  13405. return $self._streamSize();
  13406. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  13407. },
  13408. args: [],
  13409. source: "size\x0a\x09^ self streamSize",
  13410. referencedClasses: [],
  13411. messageSends: ["streamSize"]
  13412. }),
  13413. $globals.Stream);
  13414. $core.addMethod(
  13415. $core.method({
  13416. selector: "skip:",
  13417. protocol: "positioning",
  13418. fn: function (anInteger){
  13419. var self=this,$self=this;
  13420. return $core.withContext(function($ctx1) {
  13421. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  13422. return self;
  13423. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  13424. },
  13425. args: ["anInteger"],
  13426. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  13427. referencedClasses: [],
  13428. messageSends: ["position:", "min:max:", "+", "position", "size"]
  13429. }),
  13430. $globals.Stream);
  13431. $core.addMethod(
  13432. $core.method({
  13433. selector: "streamSize",
  13434. protocol: "accessing",
  13435. fn: function (){
  13436. var self=this,$self=this;
  13437. return $self["@streamSize"];
  13438. },
  13439. args: [],
  13440. source: "streamSize\x0a\x09^ streamSize",
  13441. referencedClasses: [],
  13442. messageSends: []
  13443. }),
  13444. $globals.Stream);
  13445. $core.addMethod(
  13446. $core.method({
  13447. selector: "on:",
  13448. protocol: "instance creation",
  13449. fn: function (aCollection){
  13450. var self=this,$self=this;
  13451. return $core.withContext(function($ctx1) {
  13452. var $1;
  13453. $1=$self._new();
  13454. $recv($1)._setCollection_(aCollection);
  13455. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13456. return $recv($1)._yourself();
  13457. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  13458. },
  13459. args: ["aCollection"],
  13460. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13461. referencedClasses: [],
  13462. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13463. }),
  13464. $globals.Stream.a$cls);
  13465. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  13466. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  13467. $core.addMethod(
  13468. $core.method({
  13469. selector: "cr",
  13470. protocol: "writing",
  13471. fn: function (){
  13472. var self=this,$self=this;
  13473. return $core.withContext(function($ctx1) {
  13474. return $self._nextPutAll_($recv($globals.String)._cr());
  13475. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  13476. },
  13477. args: [],
  13478. source: "cr\x0a\x09^ self nextPutAll: String cr",
  13479. referencedClasses: ["String"],
  13480. messageSends: ["nextPutAll:", "cr"]
  13481. }),
  13482. $globals.StringStream);
  13483. $core.addMethod(
  13484. $core.method({
  13485. selector: "crlf",
  13486. protocol: "writing",
  13487. fn: function (){
  13488. var self=this,$self=this;
  13489. return $core.withContext(function($ctx1) {
  13490. return $self._nextPutAll_($recv($globals.String)._crlf());
  13491. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  13492. },
  13493. args: [],
  13494. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  13495. referencedClasses: ["String"],
  13496. messageSends: ["nextPutAll:", "crlf"]
  13497. }),
  13498. $globals.StringStream);
  13499. $core.addMethod(
  13500. $core.method({
  13501. selector: "lf",
  13502. protocol: "writing",
  13503. fn: function (){
  13504. var self=this,$self=this;
  13505. return $core.withContext(function($ctx1) {
  13506. return $self._nextPutAll_($recv($globals.String)._lf());
  13507. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  13508. },
  13509. args: [],
  13510. source: "lf\x0a\x09^ self nextPutAll: String lf",
  13511. referencedClasses: ["String"],
  13512. messageSends: ["nextPutAll:", "lf"]
  13513. }),
  13514. $globals.StringStream);
  13515. $core.addMethod(
  13516. $core.method({
  13517. selector: "next:",
  13518. protocol: "reading",
  13519. fn: function (anInteger){
  13520. var self=this,$self=this;
  13521. var tempCollection;
  13522. return $core.withContext(function($ctx1) {
  13523. var $1;
  13524. tempCollection=$recv($recv($self._collection())._class())._new();
  13525. $recv(anInteger)._timesRepeat_((function(){
  13526. return $core.withContext(function($ctx2) {
  13527. $1=$self._atEnd();
  13528. if(!$core.assert($1)){
  13529. tempCollection=$recv(tempCollection).__comma($self._next());
  13530. return tempCollection;
  13531. }
  13532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13533. }));
  13534. return tempCollection;
  13535. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  13536. },
  13537. args: ["anInteger"],
  13538. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection := tempCollection, self next ]].\x0a\x09^ tempCollection",
  13539. referencedClasses: [],
  13540. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  13541. }),
  13542. $globals.StringStream);
  13543. $core.addMethod(
  13544. $core.method({
  13545. selector: "nextPut:",
  13546. protocol: "writing",
  13547. fn: function (aString){
  13548. var self=this,$self=this;
  13549. return $core.withContext(function($ctx1) {
  13550. $self._nextPutAll_(aString);
  13551. return self;
  13552. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  13553. },
  13554. args: ["aString"],
  13555. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  13556. referencedClasses: [],
  13557. messageSends: ["nextPutAll:"]
  13558. }),
  13559. $globals.StringStream);
  13560. $core.addMethod(
  13561. $core.method({
  13562. selector: "nextPutAll:",
  13563. protocol: "writing",
  13564. fn: function (aString){
  13565. var self=this,$self=this;
  13566. var pre,post;
  13567. return $core.withContext(function($ctx1) {
  13568. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  13569. $1=$self._atEnd();
  13570. if($core.assert($1)){
  13571. $3=$self._collection();
  13572. $ctx1.sendIdx["collection"]=1;
  13573. $2=$recv($3).__comma(aString);
  13574. $ctx1.sendIdx[","]=1;
  13575. $self._setCollection_($2);
  13576. $ctx1.sendIdx["setCollection:"]=1;
  13577. } else {
  13578. $4=$self._collection();
  13579. $ctx1.sendIdx["collection"]=2;
  13580. $5=$self._position();
  13581. $ctx1.sendIdx["position"]=1;
  13582. pre=$recv($4)._copyFrom_to_((1),$5);
  13583. $ctx1.sendIdx["copyFrom:to:"]=1;
  13584. $6=$self._collection();
  13585. $ctx1.sendIdx["collection"]=3;
  13586. $9=$self._position();
  13587. $ctx1.sendIdx["position"]=2;
  13588. $8=$recv($9).__plus((1));
  13589. $ctx1.sendIdx["+"]=2;
  13590. $10=$recv(aString)._size();
  13591. $ctx1.sendIdx["size"]=1;
  13592. $7=$recv($8).__plus($10);
  13593. $ctx1.sendIdx["+"]=1;
  13594. $11=$recv($self._collection())._size();
  13595. $ctx1.sendIdx["size"]=2;
  13596. post=$recv($6)._copyFrom_to_($7,$11);
  13597. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  13598. $ctx1.sendIdx[","]=2;
  13599. $self._setCollection_($12);
  13600. }
  13601. $14=$self._position();
  13602. $ctx1.sendIdx["position"]=3;
  13603. $13=$recv($14).__plus($recv(aString)._size());
  13604. $self._position_($13);
  13605. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13606. return self;
  13607. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  13608. },
  13609. args: ["aString"],
  13610. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self atEnd ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  13611. referencedClasses: [],
  13612. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  13613. }),
  13614. $globals.StringStream);
  13615. $core.addMethod(
  13616. $core.method({
  13617. selector: "nextPutString:",
  13618. protocol: "writing",
  13619. fn: function (aString){
  13620. var self=this,$self=this;
  13621. return $core.withContext(function($ctx1) {
  13622. $self._nextPutAll_(aString);
  13623. return self;
  13624. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  13625. },
  13626. args: ["aString"],
  13627. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  13628. referencedClasses: [],
  13629. messageSends: ["nextPutAll:"]
  13630. }),
  13631. $globals.StringStream);
  13632. $core.addMethod(
  13633. $core.method({
  13634. selector: "print:",
  13635. protocol: "writing",
  13636. fn: function (anObject){
  13637. var self=this,$self=this;
  13638. return $core.withContext(function($ctx1) {
  13639. $recv(anObject)._printOn_(self);
  13640. return self;
  13641. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  13642. },
  13643. args: ["anObject"],
  13644. source: "print: anObject\x0a\x09anObject printOn: self",
  13645. referencedClasses: [],
  13646. messageSends: ["printOn:"]
  13647. }),
  13648. $globals.StringStream);
  13649. $core.addMethod(
  13650. $core.method({
  13651. selector: "printSymbol:",
  13652. protocol: "writing",
  13653. fn: function (anObject){
  13654. var self=this,$self=this;
  13655. return $core.withContext(function($ctx1) {
  13656. $recv(anObject)._asSymbolPrintOn_(self);
  13657. return self;
  13658. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  13659. },
  13660. args: ["anObject"],
  13661. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  13662. referencedClasses: [],
  13663. messageSends: ["asSymbolPrintOn:"]
  13664. }),
  13665. $globals.StringStream);
  13666. $core.addMethod(
  13667. $core.method({
  13668. selector: "space",
  13669. protocol: "writing",
  13670. fn: function (){
  13671. var self=this,$self=this;
  13672. return $core.withContext(function($ctx1) {
  13673. $self._nextPut_(" ");
  13674. return self;
  13675. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  13676. },
  13677. args: [],
  13678. source: "space\x0a\x09self nextPut: ' '",
  13679. referencedClasses: [],
  13680. messageSends: ["nextPut:"]
  13681. }),
  13682. $globals.StringStream);
  13683. $core.addMethod(
  13684. $core.method({
  13685. selector: "tab",
  13686. protocol: "writing",
  13687. fn: function (){
  13688. var self=this,$self=this;
  13689. return $core.withContext(function($ctx1) {
  13690. return $self._nextPutAll_($recv($globals.String)._tab());
  13691. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  13692. },
  13693. args: [],
  13694. source: "tab\x0a\x09^ self nextPutAll: String tab",
  13695. referencedClasses: ["String"],
  13696. messageSends: ["nextPutAll:", "tab"]
  13697. }),
  13698. $globals.StringStream);
  13699. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  13700. $globals.Queue.comment="I am a one-sided queue.\x0a\x0a## Usage\x0a\x0aUse `#nextPut:` to add items to the queue.\x0aUse `#next` or `#nextIfAbsent:` to get (and remove) the next item in the queue.\x0a\x0a## Implementation notes\x0a\x0aA Queue uses two OrderedCollections inside,\x0a`read` is at the front, is not modified and only read using `readIndex`.\x0a`write` is at the back and is appended new items.\x0aWhen `read` is exhausted, `write` is promoted to `read` and new `write` is created.\x0a\x0aAs a consequence, no data moving is done by me, write appending may do data moving\x0awhen growing `write`, but this is left to engine to implement as good as it chooses to.";
  13701. $core.addMethod(
  13702. $core.method({
  13703. selector: "initialize",
  13704. protocol: "initialization",
  13705. fn: function (){
  13706. var self=this,$self=this;
  13707. return $core.withContext(function($ctx1) {
  13708. (
  13709. $ctx1.supercall = true,
  13710. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  13711. $ctx1.supercall = false;
  13712. $self["@read"]=$recv($globals.OrderedCollection)._new();
  13713. $ctx1.sendIdx["new"]=1;
  13714. $self["@write"]=$recv($globals.OrderedCollection)._new();
  13715. $self["@readIndex"]=(1);
  13716. return self;
  13717. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  13718. },
  13719. args: [],
  13720. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  13721. referencedClasses: ["OrderedCollection"],
  13722. messageSends: ["initialize", "new"]
  13723. }),
  13724. $globals.Queue);
  13725. $core.addMethod(
  13726. $core.method({
  13727. selector: "next",
  13728. protocol: "accessing",
  13729. fn: function (){
  13730. var self=this,$self=this;
  13731. return $core.withContext(function($ctx1) {
  13732. return $self._nextIfAbsent_((function(){
  13733. return $core.withContext(function($ctx2) {
  13734. return $self._error_("Cannot read from empty Queue.");
  13735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13736. }));
  13737. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  13738. },
  13739. args: [],
  13740. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  13741. referencedClasses: [],
  13742. messageSends: ["nextIfAbsent:", "error:"]
  13743. }),
  13744. $globals.Queue);
  13745. $core.addMethod(
  13746. $core.method({
  13747. selector: "nextIfAbsent:",
  13748. protocol: "accessing",
  13749. fn: function (aBlock){
  13750. var self=this,$self=this;
  13751. var result;
  13752. return $core.withContext(function($ctx1) {
  13753. var $1;
  13754. var $early={};
  13755. try {
  13756. result=$recv($self["@read"])._at_ifAbsent_($self["@readIndex"],(function(){
  13757. return $core.withContext(function($ctx2) {
  13758. $recv($self["@write"])._ifEmpty_((function(){
  13759. return $core.withContext(function($ctx3) {
  13760. $1=$recv($self["@readIndex"]).__gt((1));
  13761. if($core.assert($1)){
  13762. $self["@read"]=[];
  13763. $self["@readIndex"]=(1);
  13764. $self["@readIndex"];
  13765. }
  13766. throw $early=[$recv(aBlock)._value()];
  13767. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  13768. }));
  13769. $self["@read"]=$self["@write"];
  13770. $self["@readIndex"]=(1);
  13771. $self["@write"]=$recv($globals.OrderedCollection)._new();
  13772. return $recv($self["@read"])._first();
  13773. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13774. }));
  13775. $recv($self["@read"])._at_put_($self["@readIndex"],nil);
  13776. $self["@readIndex"]=$recv($self["@readIndex"]).__plus((1));
  13777. return result;
  13778. }
  13779. catch(e) {if(e===$early)return e[0]; throw e}
  13780. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  13781. },
  13782. args: ["aBlock"],
  13783. source: "nextIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write ifEmpty: [\x0a\x09\x09\x09readIndex > 1 ifTrue: [ read := #(). readIndex := 1 ].\x0a\x09\x09\x09^ aBlock value ].\x0a\x09\x09read := write.\x0a\x09\x09readIndex := 1.\x0a\x09\x09write := OrderedCollection new.\x0a\x09\x09read first ].\x0a\x09read at: readIndex put: nil.\x0a\x09readIndex := readIndex + 1.\x0a\x09^ result",
  13784. referencedClasses: ["OrderedCollection"],
  13785. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  13786. }),
  13787. $globals.Queue);
  13788. $core.addMethod(
  13789. $core.method({
  13790. selector: "nextPut:",
  13791. protocol: "accessing",
  13792. fn: function (anObject){
  13793. var self=this,$self=this;
  13794. return $core.withContext(function($ctx1) {
  13795. $recv($self["@write"])._add_(anObject);
  13796. return self;
  13797. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  13798. },
  13799. args: ["anObject"],
  13800. source: "nextPut: anObject\x0a\x09write add: anObject",
  13801. referencedClasses: [],
  13802. messageSends: ["add:"]
  13803. }),
  13804. $globals.Queue);
  13805. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  13806. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  13807. $core.addMethod(
  13808. $core.method({
  13809. selector: "compile:",
  13810. protocol: "evaluating",
  13811. fn: function (aString){
  13812. var self=this,$self=this;
  13813. return $core.withContext(function($ctx1) {
  13814. return self.compile(aString);
  13815. return self;
  13816. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  13817. },
  13818. args: ["aString"],
  13819. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  13820. referencedClasses: [],
  13821. messageSends: []
  13822. }),
  13823. $globals.RegularExpression);
  13824. $core.addMethod(
  13825. $core.method({
  13826. selector: "exec:",
  13827. protocol: "evaluating",
  13828. fn: function (aString){
  13829. var self=this,$self=this;
  13830. return $core.withContext(function($ctx1) {
  13831. return self.exec(aString) || nil;
  13832. return self;
  13833. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  13834. },
  13835. args: ["aString"],
  13836. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  13837. referencedClasses: [],
  13838. messageSends: []
  13839. }),
  13840. $globals.RegularExpression);
  13841. $core.addMethod(
  13842. $core.method({
  13843. selector: "test:",
  13844. protocol: "evaluating",
  13845. fn: function (aString){
  13846. var self=this,$self=this;
  13847. return $core.withContext(function($ctx1) {
  13848. return self.test(aString);
  13849. return self;
  13850. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  13851. },
  13852. args: ["aString"],
  13853. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  13854. referencedClasses: [],
  13855. messageSends: []
  13856. }),
  13857. $globals.RegularExpression);
  13858. $core.addMethod(
  13859. $core.method({
  13860. selector: "fromString:",
  13861. protocol: "instance creation",
  13862. fn: function (aString){
  13863. var self=this,$self=this;
  13864. return $core.withContext(function($ctx1) {
  13865. return $self._fromString_flag_(aString,"");
  13866. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  13867. },
  13868. args: ["aString"],
  13869. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  13870. referencedClasses: [],
  13871. messageSends: ["fromString:flag:"]
  13872. }),
  13873. $globals.RegularExpression.a$cls);
  13874. $core.addMethod(
  13875. $core.method({
  13876. selector: "fromString:flag:",
  13877. protocol: "instance creation",
  13878. fn: function (aString,anotherString){
  13879. var self=this,$self=this;
  13880. return $core.withContext(function($ctx1) {
  13881. return new RegExp(aString, anotherString);
  13882. return self;
  13883. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  13884. },
  13885. args: ["aString", "anotherString"],
  13886. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  13887. referencedClasses: [],
  13888. messageSends: []
  13889. }),
  13890. $globals.RegularExpression.a$cls);
  13891. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  13892. $core.addMethod(
  13893. $core.method({
  13894. selector: "at:",
  13895. protocol: "accessing",
  13896. fn: function (anIndex){
  13897. var self=this,$self=this;
  13898. return $core.withContext(function($ctx1) {
  13899. return $self._at_ifAbsent_(anIndex,(function(){
  13900. return $core.withContext(function($ctx2) {
  13901. return $self._errorNotFound();
  13902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13903. }));
  13904. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.TKeyValueCollection)});
  13905. },
  13906. args: ["anIndex"],
  13907. source: "at: anIndex\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, raise an error.\x22\x0a\x0a\x09^ self at: anIndex ifAbsent: [ self errorNotFound ]",
  13908. referencedClasses: [],
  13909. messageSends: ["at:ifAbsent:", "errorNotFound"]
  13910. }),
  13911. $globals.TKeyValueCollection);
  13912. $core.addMethod(
  13913. $core.method({
  13914. selector: "at:ifAbsent:",
  13915. protocol: "accessing",
  13916. fn: function (anIndex,aBlock){
  13917. var self=this,$self=this;
  13918. return $core.withContext(function($ctx1) {
  13919. $self._subclassResponsibility();
  13920. return self;
  13921. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
  13922. },
  13923. args: ["anIndex", "aBlock"],
  13924. source: "at: anIndex ifAbsent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, answer the value of aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  13925. referencedClasses: [],
  13926. messageSends: ["subclassResponsibility"]
  13927. }),
  13928. $globals.TKeyValueCollection);
  13929. $core.addMethod(
  13930. $core.method({
  13931. selector: "at:ifAbsentPut:",
  13932. protocol: "accessing",
  13933. fn: function (aKey,aBlock){
  13934. var self=this,$self=this;
  13935. return $core.withContext(function($ctx1) {
  13936. return $self._at_ifAbsent_(aKey,(function(){
  13937. return $core.withContext(function($ctx2) {
  13938. return $self._at_put_(aKey,$recv(aBlock)._value());
  13939. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13940. }));
  13941. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.TKeyValueCollection)});
  13942. },
  13943. args: ["aKey", "aBlock"],
  13944. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  13945. referencedClasses: [],
  13946. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  13947. }),
  13948. $globals.TKeyValueCollection);
  13949. $core.addMethod(
  13950. $core.method({
  13951. selector: "at:ifPresent:",
  13952. protocol: "accessing",
  13953. fn: function (anIndex,aBlock){
  13954. var self=this,$self=this;
  13955. return $core.withContext(function($ctx1) {
  13956. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  13957. return nil;
  13958. }));
  13959. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.TKeyValueCollection)});
  13960. },
  13961. args: ["anIndex", "aBlock"],
  13962. source: "at: anIndex ifPresent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer nil.\x22\x0a\x0a\x09^ self at: anIndex ifPresent: aBlock ifAbsent: [ nil ]",
  13963. referencedClasses: [],
  13964. messageSends: ["at:ifPresent:ifAbsent:"]
  13965. }),
  13966. $globals.TKeyValueCollection);
  13967. $core.addMethod(
  13968. $core.method({
  13969. selector: "at:ifPresent:ifAbsent:",
  13970. protocol: "accessing",
  13971. fn: function (anIndex,aBlock,anotherBlock){
  13972. var self=this,$self=this;
  13973. return $core.withContext(function($ctx1) {
  13974. $self._subclassResponsibility();
  13975. return self;
  13976. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TKeyValueCollection)});
  13977. },
  13978. args: ["anIndex", "aBlock", "anotherBlock"],
  13979. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer the value of anotherBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  13980. referencedClasses: [],
  13981. messageSends: ["subclassResponsibility"]
  13982. }),
  13983. $globals.TKeyValueCollection);
  13984. $core.addMethod(
  13985. $core.method({
  13986. selector: "at:put:",
  13987. protocol: "accessing",
  13988. fn: function (anIndex,anObject){
  13989. var self=this,$self=this;
  13990. return $core.withContext(function($ctx1) {
  13991. $self._subclassResponsibility();
  13992. return self;
  13993. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.TKeyValueCollection)});
  13994. },
  13995. args: ["anIndex", "anObject"],
  13996. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  13997. referencedClasses: [],
  13998. messageSends: ["subclassResponsibility"]
  13999. }),
  14000. $globals.TKeyValueCollection);
  14001. $core.addMethod(
  14002. $core.method({
  14003. selector: "indexOf:",
  14004. protocol: "accessing",
  14005. fn: function (anObject){
  14006. var self=this,$self=this;
  14007. return $core.withContext(function($ctx1) {
  14008. return $self._indexOf_ifAbsent_(anObject,(function(){
  14009. return $core.withContext(function($ctx2) {
  14010. return $self._errorNotFound();
  14011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14012. }));
  14013. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.TKeyValueCollection)});
  14014. },
  14015. args: ["anObject"],
  14016. source: "indexOf: anObject\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, raise an error.\x22\x0a\x0a\x09^ self indexOf: anObject ifAbsent: [ self errorNotFound ]",
  14017. referencedClasses: [],
  14018. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  14019. }),
  14020. $globals.TKeyValueCollection);
  14021. $core.addMethod(
  14022. $core.method({
  14023. selector: "indexOf:ifAbsent:",
  14024. protocol: "accessing",
  14025. fn: function (anObject,aBlock){
  14026. var self=this,$self=this;
  14027. return $core.withContext(function($ctx1) {
  14028. $self._subclassResponsibility();
  14029. return self;
  14030. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.TKeyValueCollection)});
  14031. },
  14032. args: ["anObject", "aBlock"],
  14033. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, return value of executing aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  14034. referencedClasses: [],
  14035. messageSends: ["subclassResponsibility"]
  14036. }),
  14037. $globals.TKeyValueCollection);
  14038. $core.addMethod(
  14039. $core.method({
  14040. selector: "with:do:",
  14041. protocol: "enumerating",
  14042. fn: function (anotherCollection,aBlock){
  14043. var self=this,$self=this;
  14044. return $core.withContext(function($ctx1) {
  14045. $self._withIndexDo_((function(each,index){
  14046. return $core.withContext(function($ctx2) {
  14047. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  14048. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  14049. }));
  14050. return self;
  14051. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.TKeyValueCollection)});
  14052. },
  14053. args: ["anotherCollection", "aBlock"],
  14054. source: "with: anotherCollection do: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with indetically-indexed value from anotherCollection\x22\x0a\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09aBlock value: each value: (anotherCollection at: index) ]",
  14055. referencedClasses: [],
  14056. messageSends: ["withIndexDo:", "value:value:", "at:"]
  14057. }),
  14058. $globals.TKeyValueCollection);
  14059. $core.addMethod(
  14060. $core.method({
  14061. selector: "withIndexDo:",
  14062. protocol: "enumerating",
  14063. fn: function (aBlock){
  14064. var self=this,$self=this;
  14065. return $core.withContext(function($ctx1) {
  14066. $self._subclassResponsibility();
  14067. return self;
  14068. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.TKeyValueCollection)});
  14069. },
  14070. args: ["aBlock"],
  14071. source: "withIndexDo: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with its index as the second argument\x22\x0a\x0a\x09self subclassResponsibility",
  14072. referencedClasses: [],
  14073. messageSends: ["subclassResponsibility"]
  14074. }),
  14075. $globals.TKeyValueCollection);
  14076. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  14077. $core.addMethod(
  14078. $core.method({
  14079. selector: "at:ifAbsent:",
  14080. protocol: "accessing",
  14081. fn: function (anIndex,aBlock){
  14082. var self=this,$self=this;
  14083. return $core.withContext(function($ctx1) {
  14084. return anIndex >= 1 && anIndex <= self.length
  14085. ? self[anIndex - 1]
  14086. : aBlock._value()
  14087. ;
  14088. return self;
  14089. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14090. },
  14091. args: ["anIndex", "aBlock"],
  14092. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09'>",
  14093. referencedClasses: [],
  14094. messageSends: []
  14095. }),
  14096. $globals.TNativeZeroBasedCollection);
  14097. $core.addMethod(
  14098. $core.method({
  14099. selector: "at:ifPresent:ifAbsent:",
  14100. protocol: "accessing",
  14101. fn: function (anIndex,aBlock,anotherBlock){
  14102. var self=this,$self=this;
  14103. return $core.withContext(function($ctx1) {
  14104. return anIndex >= 1 && anIndex <= self.length
  14105. ? aBlock._value_(self[anIndex - 1])
  14106. : anotherBlock._value()
  14107. ;
  14108. return self;
  14109. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TNativeZeroBasedCollection)});
  14110. },
  14111. args: ["anIndex", "aBlock", "anotherBlock"],
  14112. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? aBlock._value_(self[anIndex - 1])\x0a\x09\x09\x09: anotherBlock._value()\x0a\x09'>",
  14113. referencedClasses: [],
  14114. messageSends: []
  14115. }),
  14116. $globals.TNativeZeroBasedCollection);
  14117. $core.addMethod(
  14118. $core.method({
  14119. selector: "detect:ifNone:",
  14120. protocol: "enumerating",
  14121. fn: function (aBlock,anotherBlock){
  14122. var self=this,$self=this;
  14123. return $core.withContext(function($ctx1) {
  14124. for(var i = 0; i < self.length; i++)
  14125. if(aBlock._value_(self[i]))
  14126. return self[i];
  14127. return anotherBlock._value();
  14128. ;
  14129. return self;
  14130. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.TNativeZeroBasedCollection)});
  14131. },
  14132. args: ["aBlock", "anotherBlock"],
  14133. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09'>",
  14134. referencedClasses: [],
  14135. messageSends: []
  14136. }),
  14137. $globals.TNativeZeroBasedCollection);
  14138. $core.addMethod(
  14139. $core.method({
  14140. selector: "do:",
  14141. protocol: "enumerating",
  14142. fn: function (aBlock){
  14143. var self=this,$self=this;
  14144. return $core.withContext(function($ctx1) {
  14145. for(var i=0; i < self.length; i++) {
  14146. aBlock._value_(self[i]);
  14147. }
  14148. ;
  14149. return self;
  14150. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14151. },
  14152. args: ["aBlock"],
  14153. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09'>",
  14154. referencedClasses: [],
  14155. messageSends: []
  14156. }),
  14157. $globals.TNativeZeroBasedCollection);
  14158. $core.addMethod(
  14159. $core.method({
  14160. selector: "indexOf:ifAbsent:",
  14161. protocol: "accessing",
  14162. fn: function (anObject,aBlock){
  14163. var self=this,$self=this;
  14164. return $core.withContext(function($ctx1) {
  14165. for(var i=0; i < self.length; i++) {
  14166. if($recv(self[i]).__eq(anObject)) {return i+1}
  14167. };
  14168. return aBlock._value();
  14169. ;
  14170. return self;
  14171. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14172. },
  14173. args: ["anObject", "aBlock"],
  14174. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  14175. referencedClasses: [],
  14176. messageSends: []
  14177. }),
  14178. $globals.TNativeZeroBasedCollection);
  14179. $core.addMethod(
  14180. $core.method({
  14181. selector: "indexOf:startingAt:ifAbsent:",
  14182. protocol: "accessing",
  14183. fn: function (anObject,start,aBlock){
  14184. var self=this,$self=this;
  14185. return $core.withContext(function($ctx1) {
  14186. for(var i=start - 1; i < self.length; i++){
  14187. if($recv(self[i]).__eq(anObject)) {return i+1}
  14188. }
  14189. return aBlock._value();
  14190. ;
  14191. return self;
  14192. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14193. },
  14194. args: ["anObject", "start", "aBlock"],
  14195. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  14196. referencedClasses: [],
  14197. messageSends: []
  14198. }),
  14199. $globals.TNativeZeroBasedCollection);
  14200. $core.addMethod(
  14201. $core.method({
  14202. selector: "single",
  14203. protocol: "accessing",
  14204. fn: function (){
  14205. var self=this,$self=this;
  14206. return $core.withContext(function($ctx1) {
  14207. if (self.length == 0) throw new Error("Collection is empty");
  14208. if (self.length > 1) throw new Error("Collection holds more than one element.");
  14209. return self[0];;
  14210. return self;
  14211. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.TNativeZeroBasedCollection)});
  14212. },
  14213. args: [],
  14214. source: "single\x0a<inlineJS: '\x0a\x09if (self.length == 0) throw new Error(\x22Collection is empty\x22);\x0a\x09if (self.length > 1) throw new Error(\x22Collection holds more than one element.\x22);\x0a\x09return self[0];\x0a'>",
  14215. referencedClasses: [],
  14216. messageSends: []
  14217. }),
  14218. $globals.TNativeZeroBasedCollection);
  14219. $core.addMethod(
  14220. $core.method({
  14221. selector: "size",
  14222. protocol: "accessing",
  14223. fn: function (){
  14224. var self=this,$self=this;
  14225. return $core.withContext(function($ctx1) {
  14226. return self.length;
  14227. return self;
  14228. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.TNativeZeroBasedCollection)});
  14229. },
  14230. args: [],
  14231. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  14232. referencedClasses: [],
  14233. messageSends: []
  14234. }),
  14235. $globals.TNativeZeroBasedCollection);
  14236. $core.addMethod(
  14237. $core.method({
  14238. selector: "with:do:",
  14239. protocol: "enumerating",
  14240. fn: function (anotherCollection,aBlock){
  14241. var self=this,$self=this;
  14242. return $core.withContext(function($ctx1) {
  14243. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  14244. for(var i=0; i<self.length; i++) {
  14245. aBlock._value_value_(self[i], anotherCollection[i]);
  14246. }
  14247. ;
  14248. return self;
  14249. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14250. },
  14251. args: ["anotherCollection", "aBlock"],
  14252. source: "with: anotherCollection do: aBlock\x0a\x09<inlineJS: '\x0a\x09 $recv(anotherCollection)._first_(0); // #guardSequenceableCollection\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09'>",
  14253. referencedClasses: [],
  14254. messageSends: []
  14255. }),
  14256. $globals.TNativeZeroBasedCollection);
  14257. $core.addMethod(
  14258. $core.method({
  14259. selector: "withIndexDo:",
  14260. protocol: "enumerating",
  14261. fn: function (aBlock){
  14262. var self=this,$self=this;
  14263. return $core.withContext(function($ctx1) {
  14264. for(var i=0; i < self.length; i++) {
  14265. aBlock._value_value_(self[i], i+1);
  14266. }
  14267. ;
  14268. return self;
  14269. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.TNativeZeroBasedCollection)});
  14270. },
  14271. args: ["aBlock"],
  14272. source: "withIndexDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09'>",
  14273. referencedClasses: [],
  14274. messageSends: []
  14275. }),
  14276. $globals.TNativeZeroBasedCollection);
  14277. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  14278. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  14279. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  14280. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  14281. });
  14282. define('amber_core/Kernel-Classes',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Helpers", "amber_core/Kernel-Objects"], function($boot){"use strict";
  14283. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  14284. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  14285. var $pkg = $core.addPackage("Kernel-Classes");
  14286. $pkg.innerEval = function (expr) { return eval(expr); };
  14287. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  14288. $core.addClass("Behavior", $globals.Object, ["organization"], "Kernel-Classes");
  14289. $globals.Behavior.comment="I am the superclass of all class objects.\x0a\x0aIn addition to BehaviorBody, I define superclass/subclass relationships and instantiation.\x0a\x0aI define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0a\x0aMy instances know about the subclass/superclass relationships between classes and contain the description that instances are created from.\x0a\x0aI also provide iterating over the class hierarchy.";
  14290. $core.addMethod(
  14291. $core.method({
  14292. selector: "allInstanceVariableNames",
  14293. protocol: "accessing",
  14294. fn: function (){
  14295. var self=this,$self=this;
  14296. var result;
  14297. return $core.withContext(function($ctx1) {
  14298. var $1,$receiver;
  14299. result=$recv($self._instanceVariableNames())._copy();
  14300. $1=$self._superclass();
  14301. $ctx1.sendIdx["superclass"]=1;
  14302. if(($receiver = $1) == null || $receiver.a$nil){
  14303. $1;
  14304. } else {
  14305. $recv(result)._addAll_($recv($self._superclass())._allInstanceVariableNames());
  14306. }
  14307. return result;
  14308. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  14309. },
  14310. args: [],
  14311. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  14312. referencedClasses: [],
  14313. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  14314. }),
  14315. $globals.Behavior);
  14316. $core.addMethod(
  14317. $core.method({
  14318. selector: "allSelectors",
  14319. protocol: "accessing",
  14320. fn: function (){
  14321. var self=this,$self=this;
  14322. return $core.withContext(function($ctx1) {
  14323. var $1,$2;
  14324. $1=$self._allSuperclasses();
  14325. $2=$self._selectors();
  14326. $ctx1.sendIdx["selectors"]=1;
  14327. return $recv($1)._inject_into_($2,(function(acc,each){
  14328. return $core.withContext(function($ctx2) {
  14329. $recv(acc)._addAll_($recv(each)._selectors());
  14330. return $recv(acc)._yourself();
  14331. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  14332. }));
  14333. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  14334. },
  14335. args: [],
  14336. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  14337. referencedClasses: [],
  14338. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  14339. }),
  14340. $globals.Behavior);
  14341. $core.addMethod(
  14342. $core.method({
  14343. selector: "allSubclasses",
  14344. protocol: "accessing",
  14345. fn: function (){
  14346. var self=this,$self=this;
  14347. return $core.withContext(function($ctx1) {
  14348. return $recv($globals.Array)._streamContents_((function(str){
  14349. return $core.withContext(function($ctx2) {
  14350. return $self._allSubclassesDo_((function(each){
  14351. return $core.withContext(function($ctx3) {
  14352. return $recv(str)._nextPut_(each);
  14353. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14354. }));
  14355. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  14356. }));
  14357. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  14358. },
  14359. args: [],
  14360. source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09^ Array streamContents: [ :str | self allSubclassesDo: [ :each | str nextPut: each ] ]",
  14361. referencedClasses: ["Array"],
  14362. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  14363. }),
  14364. $globals.Behavior);
  14365. $core.addMethod(
  14366. $core.method({
  14367. selector: "allSubclassesDo:",
  14368. protocol: "enumerating",
  14369. fn: function (aBlock){
  14370. var self=this,$self=this;
  14371. return $core.withContext(function($ctx1) {
  14372. $core.traverseClassTree(self, function(subclass) {
  14373. if (subclass !== self) aBlock._value_(subclass);
  14374. });
  14375. return self;
  14376. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  14377. },
  14378. args: ["aBlock"],
  14379. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a<inlineJS: '$core.traverseClassTree(self, function(subclass) {\x0a\x09if (subclass !== self) aBlock._value_(subclass);\x0a})'>",
  14380. referencedClasses: [],
  14381. messageSends: []
  14382. }),
  14383. $globals.Behavior);
  14384. $core.addMethod(
  14385. $core.method({
  14386. selector: "allSuperclasses",
  14387. protocol: "accessing",
  14388. fn: function (){
  14389. var self=this,$self=this;
  14390. return $core.withContext(function($ctx1) {
  14391. var $1,$3,$2,$receiver;
  14392. $1=$self._superclass();
  14393. $ctx1.sendIdx["superclass"]=1;
  14394. if(($receiver = $1) == null || $receiver.a$nil){
  14395. return [];
  14396. } else {
  14397. $1;
  14398. }
  14399. $3=$self._superclass();
  14400. $ctx1.sendIdx["superclass"]=2;
  14401. $2=$recv($globals.OrderedCollection)._with_($3);
  14402. $recv($2)._addAll_($recv($self._superclass())._allSuperclasses());
  14403. return $recv($2)._yourself();
  14404. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  14405. },
  14406. args: [],
  14407. source: "allSuperclasses\x0a\x09\x0a\x09self superclass ifNil: [ ^ #() ].\x0a\x09\x0a\x09^ (OrderedCollection with: self superclass)\x0a\x09\x09addAll: self superclass allSuperclasses;\x0a\x09\x09yourself",
  14408. referencedClasses: ["OrderedCollection"],
  14409. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  14410. }),
  14411. $globals.Behavior);
  14412. $core.addMethod(
  14413. $core.method({
  14414. selector: "basicNew",
  14415. protocol: "instance creation",
  14416. fn: function (){
  14417. var self=this,$self=this;
  14418. return $core.withContext(function($ctx1) {
  14419. return new self.fn();
  14420. return self;
  14421. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  14422. },
  14423. args: [],
  14424. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  14425. referencedClasses: [],
  14426. messageSends: []
  14427. }),
  14428. $globals.Behavior);
  14429. $core.addMethod(
  14430. $core.method({
  14431. selector: "basicOrganization",
  14432. protocol: "accessing",
  14433. fn: function (){
  14434. var self=this,$self=this;
  14435. return $self["@organization"];
  14436. },
  14437. args: [],
  14438. source: "basicOrganization\x0a\x09^ organization",
  14439. referencedClasses: [],
  14440. messageSends: []
  14441. }),
  14442. $globals.Behavior);
  14443. $core.addMethod(
  14444. $core.method({
  14445. selector: "basicOrganization:",
  14446. protocol: "accessing",
  14447. fn: function (aClassOrganizer){
  14448. var self=this,$self=this;
  14449. $self["@organization"]=aClassOrganizer;
  14450. return self;
  14451. },
  14452. args: ["aClassOrganizer"],
  14453. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  14454. referencedClasses: [],
  14455. messageSends: []
  14456. }),
  14457. $globals.Behavior);
  14458. $core.addMethod(
  14459. $core.method({
  14460. selector: "canUnderstand:",
  14461. protocol: "testing",
  14462. fn: function (aSelector){
  14463. var self=this,$self=this;
  14464. return $core.withContext(function($ctx1) {
  14465. var $2,$1;
  14466. return $recv($self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  14467. return $core.withContext(function($ctx2) {
  14468. $2=$self._superclass();
  14469. $ctx2.sendIdx["superclass"]=1;
  14470. $1=$recv($2)._notNil();
  14471. return $recv($1)._and_((function(){
  14472. return $core.withContext(function($ctx3) {
  14473. return $recv($self._superclass())._canUnderstand_(aSelector);
  14474. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14475. }));
  14476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14477. }));
  14478. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  14479. },
  14480. args: ["aSelector"],
  14481. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  14482. referencedClasses: [],
  14483. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  14484. }),
  14485. $globals.Behavior);
  14486. $core.addMethod(
  14487. $core.method({
  14488. selector: "includesBehavior:",
  14489. protocol: "testing",
  14490. fn: function (aClass){
  14491. var self=this,$self=this;
  14492. return $core.withContext(function($ctx1) {
  14493. return $recv($self.__eq_eq(aClass))._or_((function(){
  14494. return $core.withContext(function($ctx2) {
  14495. return $self._inheritsFrom_(aClass);
  14496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14497. }));
  14498. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  14499. },
  14500. args: ["aClass"],
  14501. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  14502. referencedClasses: [],
  14503. messageSends: ["or:", "==", "inheritsFrom:"]
  14504. }),
  14505. $globals.Behavior);
  14506. $core.addMethod(
  14507. $core.method({
  14508. selector: "inheritsFrom:",
  14509. protocol: "testing",
  14510. fn: function (aClass){
  14511. var self=this,$self=this;
  14512. return $core.withContext(function($ctx1) {
  14513. var $1,$3,$2,$receiver;
  14514. $1=$self._superclass();
  14515. $ctx1.sendIdx["superclass"]=1;
  14516. if(($receiver = $1) == null || $receiver.a$nil){
  14517. return false;
  14518. } else {
  14519. $1;
  14520. }
  14521. $3=$self._superclass();
  14522. $ctx1.sendIdx["superclass"]=2;
  14523. $2=$recv(aClass).__eq_eq($3);
  14524. return $recv($2)._or_((function(){
  14525. return $core.withContext(function($ctx2) {
  14526. return $recv($self._superclass())._inheritsFrom_(aClass);
  14527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14528. }));
  14529. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  14530. },
  14531. args: ["aClass"],
  14532. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  14533. referencedClasses: [],
  14534. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  14535. }),
  14536. $globals.Behavior);
  14537. $core.addMethod(
  14538. $core.method({
  14539. selector: "instanceVariableNames",
  14540. protocol: "accessing",
  14541. fn: function (){
  14542. var self=this,$self=this;
  14543. return $core.withContext(function($ctx1) {
  14544. return self.iVarNames;
  14545. return self;
  14546. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  14547. },
  14548. args: [],
  14549. source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
  14550. referencedClasses: [],
  14551. messageSends: []
  14552. }),
  14553. $globals.Behavior);
  14554. $core.addMethod(
  14555. $core.method({
  14556. selector: "isBehavior",
  14557. protocol: "testing",
  14558. fn: function (){
  14559. var self=this,$self=this;
  14560. return true;
  14561. },
  14562. args: [],
  14563. source: "isBehavior\x0a\x09^ true",
  14564. referencedClasses: [],
  14565. messageSends: []
  14566. }),
  14567. $globals.Behavior);
  14568. $core.addMethod(
  14569. $core.method({
  14570. selector: "javascriptConstructor",
  14571. protocol: "accessing",
  14572. fn: function (){
  14573. var self=this,$self=this;
  14574. return $core.withContext(function($ctx1) {
  14575. return self.fn;
  14576. return self;
  14577. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  14578. },
  14579. args: [],
  14580. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
  14581. referencedClasses: [],
  14582. messageSends: []
  14583. }),
  14584. $globals.Behavior);
  14585. $core.addMethod(
  14586. $core.method({
  14587. selector: "javascriptConstructor:",
  14588. protocol: "accessing",
  14589. fn: function (aJavaScriptFunction){
  14590. var self=this,$self=this;
  14591. return $core.withContext(function($ctx1) {
  14592. $core.setClassConstructor(self, aJavaScriptFunction);;
  14593. return self;
  14594. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  14595. },
  14596. args: ["aJavaScriptFunction"],
  14597. source: "javascriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `$core.setClassConstructor'\x22\x0a\x09\x0a\x09<inlineJS: '$core.setClassConstructor(self, aJavaScriptFunction);'>",
  14598. referencedClasses: [],
  14599. messageSends: []
  14600. }),
  14601. $globals.Behavior);
  14602. $core.addMethod(
  14603. $core.method({
  14604. selector: "lookupSelector:",
  14605. protocol: "accessing",
  14606. fn: function (selector){
  14607. var self=this,$self=this;
  14608. var lookupClass;
  14609. return $core.withContext(function($ctx1) {
  14610. var $1;
  14611. var $early={};
  14612. try {
  14613. lookupClass=self;
  14614. $recv((function(){
  14615. return $core.withContext(function($ctx2) {
  14616. return $recv(lookupClass).__eq(nil);
  14617. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14618. }))._whileFalse_((function(){
  14619. return $core.withContext(function($ctx2) {
  14620. $1=$recv(lookupClass)._includesSelector_(selector);
  14621. if($core.assert($1)){
  14622. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  14623. }
  14624. lookupClass=$recv(lookupClass)._superclass();
  14625. return lookupClass;
  14626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14627. }));
  14628. return nil;
  14629. }
  14630. catch(e) {if(e===$early)return e[0]; throw e}
  14631. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  14632. },
  14633. args: ["selector"],
  14634. source: "lookupSelector: selector\x0a\x09\x22Look up the given selector in my methodDictionary.\x0a\x09Return the corresponding method if found.\x0a\x09Otherwise chase the superclass chain and try again.\x0a\x09Return nil if no method is found.\x22\x0a\x09\x0a\x09| lookupClass |\x0a\x09\x0a\x09lookupClass := self.\x0a\x09[ lookupClass = nil ] whileFalse: [\x0a\x09\x09(lookupClass includesSelector: selector)\x0a\x09\x09\x09\x09ifTrue: [ ^ lookupClass methodAt: selector ].\x0a\x09\x09\x09lookupClass := lookupClass superclass ].\x0a\x09^ nil",
  14635. referencedClasses: [],
  14636. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  14637. }),
  14638. $globals.Behavior);
  14639. $core.addMethod(
  14640. $core.method({
  14641. selector: "new",
  14642. protocol: "instance creation",
  14643. fn: function (){
  14644. var self=this,$self=this;
  14645. return $core.withContext(function($ctx1) {
  14646. return $recv($self._basicNew())._initialize();
  14647. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  14648. },
  14649. args: [],
  14650. source: "new\x0a\x09^ self basicNew initialize",
  14651. referencedClasses: [],
  14652. messageSends: ["initialize", "basicNew"]
  14653. }),
  14654. $globals.Behavior);
  14655. $core.addMethod(
  14656. $core.method({
  14657. selector: "prototype",
  14658. protocol: "accessing",
  14659. fn: function (){
  14660. var self=this,$self=this;
  14661. return $core.withContext(function($ctx1) {
  14662. return self.fn.prototype;
  14663. return self;
  14664. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  14665. },
  14666. args: [],
  14667. source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
  14668. referencedClasses: [],
  14669. messageSends: []
  14670. }),
  14671. $globals.Behavior);
  14672. $core.addMethod(
  14673. $core.method({
  14674. selector: "subclasses",
  14675. protocol: "accessing",
  14676. fn: function (){
  14677. var self=this,$self=this;
  14678. return $core.withContext(function($ctx1) {
  14679. $self._subclassResponsibility();
  14680. return self;
  14681. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  14682. },
  14683. args: [],
  14684. source: "subclasses\x0a\x09self subclassResponsibility",
  14685. referencedClasses: [],
  14686. messageSends: ["subclassResponsibility"]
  14687. }),
  14688. $globals.Behavior);
  14689. $core.addMethod(
  14690. $core.method({
  14691. selector: "superclass",
  14692. protocol: "accessing",
  14693. fn: function (){
  14694. var self=this,$self=this;
  14695. return $core.withContext(function($ctx1) {
  14696. return self.superclass;
  14697. return self;
  14698. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  14699. },
  14700. args: [],
  14701. source: "superclass\x0a\x09<inlineJS: 'return self.superclass'>",
  14702. referencedClasses: [],
  14703. messageSends: []
  14704. }),
  14705. $globals.Behavior);
  14706. $core.addMethod(
  14707. $core.method({
  14708. selector: "theMetaClass",
  14709. protocol: "accessing",
  14710. fn: function (){
  14711. var self=this,$self=this;
  14712. return $core.withContext(function($ctx1) {
  14713. $self._subclassResponsibility();
  14714. return self;
  14715. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  14716. },
  14717. args: [],
  14718. source: "theMetaClass\x0a\x09self subclassResponsibility",
  14719. referencedClasses: [],
  14720. messageSends: ["subclassResponsibility"]
  14721. }),
  14722. $globals.Behavior);
  14723. $core.addMethod(
  14724. $core.method({
  14725. selector: "theNonMetaClass",
  14726. protocol: "accessing",
  14727. fn: function (){
  14728. var self=this,$self=this;
  14729. return $core.withContext(function($ctx1) {
  14730. $self._subclassResponsibility();
  14731. return self;
  14732. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  14733. },
  14734. args: [],
  14735. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  14736. referencedClasses: [],
  14737. messageSends: ["subclassResponsibility"]
  14738. }),
  14739. $globals.Behavior);
  14740. $core.addMethod(
  14741. $core.method({
  14742. selector: "withAllSubclasses",
  14743. protocol: "accessing",
  14744. fn: function (){
  14745. var self=this,$self=this;
  14746. return $core.withContext(function($ctx1) {
  14747. var $1;
  14748. $1=$recv($globals.Array)._with_(self);
  14749. $recv($1)._addAll_($self._allSubclasses());
  14750. return $recv($1)._yourself();
  14751. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  14752. },
  14753. args: [],
  14754. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  14755. referencedClasses: ["Array"],
  14756. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  14757. }),
  14758. $globals.Behavior);
  14759. $core.addClass("Class", $globals.Behavior, ["package"], "Kernel-Classes");
  14760. $globals.Class.comment="I am __the__ class object.\x0a\x0aMy instances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder` instance.";
  14761. $core.addMethod(
  14762. $core.method({
  14763. selector: "basicPackage:",
  14764. protocol: "accessing",
  14765. fn: function (aPackage){
  14766. var self=this,$self=this;
  14767. $self["@package"]=aPackage;
  14768. return self;
  14769. },
  14770. args: ["aPackage"],
  14771. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  14772. referencedClasses: [],
  14773. messageSends: []
  14774. }),
  14775. $globals.Class);
  14776. $core.addMethod(
  14777. $core.method({
  14778. selector: "classTag",
  14779. protocol: "accessing",
  14780. fn: function (){
  14781. var self=this,$self=this;
  14782. return "class";
  14783. },
  14784. args: [],
  14785. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'class'",
  14786. referencedClasses: [],
  14787. messageSends: []
  14788. }),
  14789. $globals.Class);
  14790. $core.addMethod(
  14791. $core.method({
  14792. selector: "definition",
  14793. protocol: "accessing",
  14794. fn: function (){
  14795. var self=this,$self=this;
  14796. return $core.withContext(function($ctx1) {
  14797. var $1,$2;
  14798. return $recv($globals.String)._streamContents_((function(stream){
  14799. return $core.withContext(function($ctx2) {
  14800. $recv(stream)._print_($self._superclass());
  14801. $ctx2.sendIdx["print:"]=1;
  14802. $recv(stream)._write_(" subclass: ");
  14803. $ctx2.sendIdx["write:"]=1;
  14804. $recv(stream)._printSymbol_($self._name());
  14805. $recv(stream)._lf();
  14806. $ctx2.sendIdx["lf"]=1;
  14807. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  14808. return $core.withContext(function($ctx3) {
  14809. $1=$recv($globals.String)._tab();
  14810. $ctx3.sendIdx["tab"]=1;
  14811. $2=$recv($globals.String)._lf();
  14812. $ctx3.sendIdx["lf"]=2;
  14813. return [$1,"uses: ",tcd,$2];
  14814. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  14815. })));
  14816. $ctx2.sendIdx["write:"]=2;
  14817. $recv(stream)._tab();
  14818. $ctx2.sendIdx["tab"]=2;
  14819. $recv(stream)._write_("instanceVariableNames: ");
  14820. $ctx2.sendIdx["write:"]=3;
  14821. $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  14822. $ctx2.sendIdx["print:"]=2;
  14823. $recv(stream)._lf();
  14824. $recv(stream)._tab();
  14825. $recv(stream)._write_("package: ");
  14826. return $recv(stream)._print_($self._category());
  14827. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14828. }));
  14829. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  14830. },
  14831. args: [],
  14832. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09print: self superclass; write: ' subclass: '; printSymbol: self name; lf;\x0a\x09\x09write: (self traitCompositionDefinition ifNotEmpty: [ :tcd | { String tab. 'uses: '. tcd. String lf }]);\x0a\x09\x09tab; write: 'instanceVariableNames: '; print: (' ' join: self instanceVariableNames); lf;\x0a\x09\x09tab; write: 'package: '; print: self category ]",
  14833. referencedClasses: ["String"],
  14834. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "instanceVariableNames", "category"]
  14835. }),
  14836. $globals.Class);
  14837. $core.addMethod(
  14838. $core.method({
  14839. selector: "isClass",
  14840. protocol: "testing",
  14841. fn: function (){
  14842. var self=this,$self=this;
  14843. return true;
  14844. },
  14845. args: [],
  14846. source: "isClass\x0a\x09^ true",
  14847. referencedClasses: [],
  14848. messageSends: []
  14849. }),
  14850. $globals.Class);
  14851. $core.addMethod(
  14852. $core.method({
  14853. selector: "package",
  14854. protocol: "accessing",
  14855. fn: function (){
  14856. var self=this,$self=this;
  14857. return $self["@package"];
  14858. },
  14859. args: [],
  14860. source: "package\x0a\x09^ package",
  14861. referencedClasses: [],
  14862. messageSends: []
  14863. }),
  14864. $globals.Class);
  14865. $core.addMethod(
  14866. $core.method({
  14867. selector: "provided",
  14868. protocol: "converting",
  14869. fn: function (){
  14870. var self=this,$self=this;
  14871. return $core.withContext(function($ctx1) {
  14872. return $recv($self._javascriptConstructor())._provided();
  14873. }, function($ctx1) {$ctx1.fill(self,"provided",{},$globals.Class)});
  14874. },
  14875. args: [],
  14876. source: "provided\x0a\x09\x22Returns JS proxy that allows to access 'static API', as in\x0a\x09 Number provided EPSILON\x0a\x09that forwards to (wrapped JS) constructor function.\x22\x0a\x09\x0a\x09^ self javascriptConstructor provided",
  14877. referencedClasses: [],
  14878. messageSends: ["provided", "javascriptConstructor"]
  14879. }),
  14880. $globals.Class);
  14881. $core.addMethod(
  14882. $core.method({
  14883. selector: "rename:",
  14884. protocol: "accessing",
  14885. fn: function (aString){
  14886. var self=this,$self=this;
  14887. return $core.withContext(function($ctx1) {
  14888. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  14889. return self;
  14890. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  14891. },
  14892. args: ["aString"],
  14893. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  14894. referencedClasses: ["ClassBuilder"],
  14895. messageSends: ["renameClass:to:", "new"]
  14896. }),
  14897. $globals.Class);
  14898. $core.addMethod(
  14899. $core.method({
  14900. selector: "subclasses",
  14901. protocol: "accessing",
  14902. fn: function (){
  14903. var self=this,$self=this;
  14904. return $core.withContext(function($ctx1) {
  14905. return self.subclasses._copy();
  14906. return self;
  14907. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  14908. },
  14909. args: [],
  14910. source: "subclasses\x0a\x09<inlineJS: 'return self.subclasses._copy()'>",
  14911. referencedClasses: [],
  14912. messageSends: []
  14913. }),
  14914. $globals.Class);
  14915. $core.addMethod(
  14916. $core.method({
  14917. selector: "theMetaClass",
  14918. protocol: "accessing",
  14919. fn: function (){
  14920. var self=this,$self=this;
  14921. return $core.withContext(function($ctx1) {
  14922. return $self._class();
  14923. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  14924. },
  14925. args: [],
  14926. source: "theMetaClass\x0a\x09^ self class",
  14927. referencedClasses: [],
  14928. messageSends: ["class"]
  14929. }),
  14930. $globals.Class);
  14931. $core.addClass("Metaclass", $globals.Behavior, [], "Kernel-Classes");
  14932. $globals.Metaclass.comment="I am the root of the class hierarchy.\x0a\x0aMy instances are metaclasses, one for each real class, and have a single instance, which they hold onto: the class that they are the metaclass of.";
  14933. $core.addMethod(
  14934. $core.method({
  14935. selector: "asJavaScriptSource",
  14936. protocol: "converting",
  14937. fn: function (){
  14938. var self=this,$self=this;
  14939. return $core.withContext(function($ctx1) {
  14940. var $1;
  14941. $1=$recv("$globals.".__comma($recv($self._instanceClass())._name())).__comma(".a$cls");
  14942. $ctx1.sendIdx[","]=1;
  14943. return $1;
  14944. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Metaclass)});
  14945. },
  14946. args: [],
  14947. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.a$cls'",
  14948. referencedClasses: [],
  14949. messageSends: [",", "name", "instanceClass"]
  14950. }),
  14951. $globals.Metaclass);
  14952. $core.addMethod(
  14953. $core.method({
  14954. selector: "definition",
  14955. protocol: "accessing",
  14956. fn: function (){
  14957. var self=this,$self=this;
  14958. return $core.withContext(function($ctx1) {
  14959. var $1,$2;
  14960. return $recv($globals.String)._streamContents_((function(stream){
  14961. return $core.withContext(function($ctx2) {
  14962. $recv(stream)._print_(self);
  14963. $ctx2.sendIdx["print:"]=1;
  14964. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  14965. return " ";
  14966. }),(function(tcd){
  14967. return $core.withContext(function($ctx3) {
  14968. $1=$recv($globals.String)._lf();
  14969. $ctx3.sendIdx["lf"]=1;
  14970. $2=$recv($globals.String)._tab();
  14971. $ctx3.sendIdx["tab"]=1;
  14972. return [$1,$2,"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  14973. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  14974. })));
  14975. $ctx2.sendIdx["write:"]=1;
  14976. $recv(stream)._write_("instanceVariableNames: ");
  14977. return $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  14978. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14979. }));
  14980. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  14981. },
  14982. args: [],
  14983. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09print: self;\x0a\x09\x09write: (self traitCompositionDefinition\x0a\x09\x09\x09ifEmpty: [' ']\x0a\x09\x09\x09ifNotEmpty: [ :tcd | { String lf. String tab. 'uses: '. tcd. String lf. String tab }]);\x0a\x09\x09write: 'instanceVariableNames: ';\x0a\x09\x09print: (' ' join: self instanceVariableNames) ]",
  14984. referencedClasses: ["String"],
  14985. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "instanceVariableNames"]
  14986. }),
  14987. $globals.Metaclass);
  14988. $core.addMethod(
  14989. $core.method({
  14990. selector: "instanceClass",
  14991. protocol: "accessing",
  14992. fn: function (){
  14993. var self=this,$self=this;
  14994. return $core.withContext(function($ctx1) {
  14995. return self.instanceClass;
  14996. return self;
  14997. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  14998. },
  14999. args: [],
  15000. source: "instanceClass\x0a\x09<inlineJS: 'return self.instanceClass'>",
  15001. referencedClasses: [],
  15002. messageSends: []
  15003. }),
  15004. $globals.Metaclass);
  15005. $core.addMethod(
  15006. $core.method({
  15007. selector: "instanceVariableNames:",
  15008. protocol: "accessing",
  15009. fn: function (aCollection){
  15010. var self=this,$self=this;
  15011. return $core.withContext(function($ctx1) {
  15012. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  15013. return self;
  15014. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  15015. },
  15016. args: ["aCollection"],
  15017. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection.\x0a\x09^ self",
  15018. referencedClasses: ["ClassBuilder"],
  15019. messageSends: ["class:instanceVariableNames:", "new"]
  15020. }),
  15021. $globals.Metaclass);
  15022. $core.addMethod(
  15023. $core.method({
  15024. selector: "isMetaclass",
  15025. protocol: "testing",
  15026. fn: function (){
  15027. var self=this,$self=this;
  15028. return true;
  15029. },
  15030. args: [],
  15031. source: "isMetaclass\x0a\x09^ true",
  15032. referencedClasses: [],
  15033. messageSends: []
  15034. }),
  15035. $globals.Metaclass);
  15036. $core.addMethod(
  15037. $core.method({
  15038. selector: "name",
  15039. protocol: "accessing",
  15040. fn: function (){
  15041. var self=this,$self=this;
  15042. return $core.withContext(function($ctx1) {
  15043. return $recv($recv($self._instanceClass())._name()).__comma(" class");
  15044. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Metaclass)});
  15045. },
  15046. args: [],
  15047. source: "name\x0a\x09^ self instanceClass name, ' class'",
  15048. referencedClasses: [],
  15049. messageSends: [",", "name", "instanceClass"]
  15050. }),
  15051. $globals.Metaclass);
  15052. $core.addMethod(
  15053. $core.method({
  15054. selector: "package",
  15055. protocol: "accessing",
  15056. fn: function (){
  15057. var self=this,$self=this;
  15058. return $core.withContext(function($ctx1) {
  15059. return $recv($self._instanceClass())._package();
  15060. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  15061. },
  15062. args: [],
  15063. source: "package\x0a\x09^ self instanceClass package",
  15064. referencedClasses: [],
  15065. messageSends: ["package", "instanceClass"]
  15066. }),
  15067. $globals.Metaclass);
  15068. $core.addMethod(
  15069. $core.method({
  15070. selector: "subclasses",
  15071. protocol: "accessing",
  15072. fn: function (){
  15073. var self=this,$self=this;
  15074. return $core.withContext(function($ctx1) {
  15075. return $core.metaSubclasses(self);
  15076. return self;
  15077. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  15078. },
  15079. args: [],
  15080. source: "subclasses\x0a\x09<inlineJS: 'return $core.metaSubclasses(self)'>",
  15081. referencedClasses: [],
  15082. messageSends: []
  15083. }),
  15084. $globals.Metaclass);
  15085. $core.addMethod(
  15086. $core.method({
  15087. selector: "theMetaClass",
  15088. protocol: "accessing",
  15089. fn: function (){
  15090. var self=this,$self=this;
  15091. return self;
  15092. },
  15093. args: [],
  15094. source: "theMetaClass\x0a\x09^ self",
  15095. referencedClasses: [],
  15096. messageSends: []
  15097. }),
  15098. $globals.Metaclass);
  15099. $core.addMethod(
  15100. $core.method({
  15101. selector: "theNonMetaClass",
  15102. protocol: "accessing",
  15103. fn: function (){
  15104. var self=this,$self=this;
  15105. return $core.withContext(function($ctx1) {
  15106. return $self._instanceClass();
  15107. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  15108. },
  15109. args: [],
  15110. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  15111. referencedClasses: [],
  15112. messageSends: ["instanceClass"]
  15113. }),
  15114. $globals.Metaclass);
  15115. $core.addMethod(
  15116. $core.method({
  15117. selector: "uses:instanceVariableNames:",
  15118. protocol: "accessing",
  15119. fn: function (aTraitCompositionDescription,aCollection){
  15120. var self=this,$self=this;
  15121. var metaclass;
  15122. return $core.withContext(function($ctx1) {
  15123. metaclass=$self._instanceVariableNames_(aCollection);
  15124. $recv(metaclass)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15125. return metaclass;
  15126. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,metaclass:metaclass},$globals.Metaclass)});
  15127. },
  15128. args: ["aTraitCompositionDescription", "aCollection"],
  15129. source: "uses: aTraitCompositionDescription instanceVariableNames: aCollection\x0a\x09| metaclass |\x0a\x09metaclass := self instanceVariableNames: aCollection.\x0a\x09metaclass setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ metaclass",
  15130. referencedClasses: [],
  15131. messageSends: ["instanceVariableNames:", "setTraitComposition:", "asTraitComposition"]
  15132. }),
  15133. $globals.Metaclass);
  15134. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  15135. $globals.ClassBuilder.comment="I am responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using me directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`.";
  15136. $core.addMethod(
  15137. $core.method({
  15138. selector: "addSubclassOf:named:instanceVariableNames:package:",
  15139. protocol: "class definition",
  15140. fn: function (aClass,className,aCollection,packageName){
  15141. var self=this,$self=this;
  15142. var theClass,thePackage;
  15143. return $core.withContext(function($ctx1) {
  15144. var $1,$2,$3,$receiver;
  15145. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15146. thePackage=$recv($globals.Package)._named_(packageName);
  15147. $1=theClass;
  15148. if(($receiver = $1) == null || $receiver.a$nil){
  15149. $1;
  15150. } else {
  15151. $recv(theClass)._package_(thePackage);
  15152. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  15153. if(!$core.assert($2)){
  15154. return $self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  15155. }
  15156. }
  15157. $3=$self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  15158. $recv($3)._recompile();
  15159. return $recv($3)._yourself();
  15160. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  15161. },
  15162. args: ["aClass", "className", "aCollection", "packageName"],
  15163. source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass thePackage |\x0a\x09\x0a\x09theClass := Smalltalk globals at: className.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: thePackage.\x0a\x09\x09theClass superclass == aClass\x0a\x09\x09\x09ifFalse: [ ^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09^ (self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName) recompile; yourself",
  15164. referencedClasses: ["Smalltalk", "Package"],
  15165. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "basicAddSubclassOf:named:instanceVariableNames:package:", "yourself"]
  15166. }),
  15167. $globals.ClassBuilder);
  15168. $core.addMethod(
  15169. $core.method({
  15170. selector: "addTraitNamed:package:",
  15171. protocol: "class definition",
  15172. fn: function (traitName,packageName){
  15173. var self=this,$self=this;
  15174. var theTrait,thePackage;
  15175. return $core.withContext(function($ctx1) {
  15176. var $1,$2,$receiver;
  15177. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  15178. thePackage=$recv($globals.Package)._named_(packageName);
  15179. $1=theTrait;
  15180. if(($receiver = $1) == null || $receiver.a$nil){
  15181. $1;
  15182. } else {
  15183. $2=theTrait;
  15184. $recv($2)._package_(thePackage);
  15185. $recv($2)._recompile();
  15186. return $recv($2)._yourself();
  15187. }
  15188. return $self._basicAddTraitNamed_package_(traitName,packageName);
  15189. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage},$globals.ClassBuilder)});
  15190. },
  15191. args: ["traitName", "packageName"],
  15192. source: "addTraitNamed: traitName package: packageName\x0a\x09| theTrait thePackage |\x0a\x09\x0a\x09theTrait := Smalltalk globals at: traitName.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theTrait ifNotNil: [ ^ theTrait package: thePackage; recompile; yourself ].\x0a\x09\x09\x0a\x09^ self\x0a\x09\x09basicAddTraitNamed: traitName\x0a\x09\x09package: packageName",
  15193. referencedClasses: ["Smalltalk", "Package"],
  15194. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  15195. }),
  15196. $globals.ClassBuilder);
  15197. $core.addMethod(
  15198. $core.method({
  15199. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  15200. protocol: "private",
  15201. fn: function (aClass,aString,aCollection,packageName){
  15202. var self=this,$self=this;
  15203. return $core.withContext(function($ctx1) {
  15204. return $core.addClass(aString, aClass, aCollection, packageName);
  15205. ;
  15206. return self;
  15207. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  15208. },
  15209. args: ["aClass", "aString", "aCollection", "packageName"],
  15210. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  15211. referencedClasses: [],
  15212. messageSends: []
  15213. }),
  15214. $globals.ClassBuilder);
  15215. $core.addMethod(
  15216. $core.method({
  15217. selector: "basicAddTraitNamed:package:",
  15218. protocol: "private",
  15219. fn: function (aString,anotherString){
  15220. var self=this,$self=this;
  15221. return $core.withContext(function($ctx1) {
  15222. return $core.addTrait(aString, anotherString);
  15223. return self;
  15224. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString},$globals.ClassBuilder)});
  15225. },
  15226. args: ["aString", "anotherString"],
  15227. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  15228. referencedClasses: [],
  15229. messageSends: []
  15230. }),
  15231. $globals.ClassBuilder);
  15232. $core.addMethod(
  15233. $core.method({
  15234. selector: "basicClass:instanceVariables:",
  15235. protocol: "private",
  15236. fn: function (aClass,aCollection){
  15237. var self=this,$self=this;
  15238. return $core.withContext(function($ctx1) {
  15239. var $1;
  15240. $1=$recv(aClass)._isMetaclass();
  15241. if(!$core.assert($1)){
  15242. $self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  15243. }
  15244. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  15245. return self;
  15246. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15247. },
  15248. args: ["aClass", "aCollection"],
  15249. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  15250. referencedClasses: [],
  15251. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  15252. }),
  15253. $globals.ClassBuilder);
  15254. $core.addMethod(
  15255. $core.method({
  15256. selector: "basicRemoveClass:",
  15257. protocol: "private",
  15258. fn: function (aClass){
  15259. var self=this,$self=this;
  15260. return $core.withContext(function($ctx1) {
  15261. $core.removeClass(aClass);
  15262. return self;
  15263. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  15264. },
  15265. args: ["aClass"],
  15266. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  15267. referencedClasses: [],
  15268. messageSends: []
  15269. }),
  15270. $globals.ClassBuilder);
  15271. $core.addMethod(
  15272. $core.method({
  15273. selector: "basicRenameClass:to:",
  15274. protocol: "private",
  15275. fn: function (aClass,aString){
  15276. var self=this,$self=this;
  15277. return $core.withContext(function($ctx1) {
  15278. $globals[aString] = aClass;
  15279. delete $globals[aClass.name];
  15280. aClass.name = aString;
  15281. ;
  15282. return self;
  15283. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15284. },
  15285. args: ["aClass", "aString"],
  15286. source: "basicRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.name];\x0a\x09\x09aClass.name = aString;\x0a\x09'>",
  15287. referencedClasses: [],
  15288. messageSends: []
  15289. }),
  15290. $globals.ClassBuilder);
  15291. $core.addMethod(
  15292. $core.method({
  15293. selector: "basicSwapClassNames:with:",
  15294. protocol: "private",
  15295. fn: function (aClass,anotherClass){
  15296. var self=this,$self=this;
  15297. return $core.withContext(function($ctx1) {
  15298. var tmp = aClass.name;
  15299. aClass.name = anotherClass.name;
  15300. anotherClass.name = tmp;
  15301. ;
  15302. return self;
  15303. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15304. },
  15305. args: ["aClass", "anotherClass"],
  15306. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<inlineJS: '\x0a\x09\x09var tmp = aClass.name;\x0a\x09\x09aClass.name = anotherClass.name;\x0a\x09\x09anotherClass.name = tmp;\x0a\x09'>",
  15307. referencedClasses: [],
  15308. messageSends: []
  15309. }),
  15310. $globals.ClassBuilder);
  15311. $core.addMethod(
  15312. $core.method({
  15313. selector: "class:instanceVariableNames:",
  15314. protocol: "class definition",
  15315. fn: function (aClass,ivarNames){
  15316. var self=this,$self=this;
  15317. return $core.withContext(function($ctx1) {
  15318. $self._class_instanceVariables_(aClass,$self._instanceVariableNamesFor_(ivarNames));
  15319. return self;
  15320. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  15321. },
  15322. args: ["aClass", "ivarNames"],
  15323. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self class: aClass instanceVariables: (self instanceVariableNamesFor: ivarNames)",
  15324. referencedClasses: [],
  15325. messageSends: ["class:instanceVariables:", "instanceVariableNamesFor:"]
  15326. }),
  15327. $globals.ClassBuilder);
  15328. $core.addMethod(
  15329. $core.method({
  15330. selector: "class:instanceVariables:",
  15331. protocol: "class definition",
  15332. fn: function (aClass,aCollection){
  15333. var self=this,$self=this;
  15334. return $core.withContext(function($ctx1) {
  15335. var $1,$3,$2;
  15336. $self._basicClass_instanceVariables_(aClass,aCollection);
  15337. $1=$recv($globals.SystemAnnouncer)._current();
  15338. $3=$recv($globals.ClassDefinitionChanged)._new();
  15339. $recv($3)._theClass_(aClass);
  15340. $2=$recv($3)._yourself();
  15341. $recv($1)._announce_($2);
  15342. return self;
  15343. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15344. },
  15345. args: ["aClass", "aCollection"],
  15346. source: "class: aClass instanceVariables: aCollection\x0a\x09self basicClass: aClass instanceVariables: aCollection.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  15347. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  15348. messageSends: ["basicClass:instanceVariables:", "announce:", "current", "theClass:", "new", "yourself"]
  15349. }),
  15350. $globals.ClassBuilder);
  15351. $core.addMethod(
  15352. $core.method({
  15353. selector: "copyClass:named:",
  15354. protocol: "copying",
  15355. fn: function (aClass,className){
  15356. var self=this,$self=this;
  15357. var newClass;
  15358. return $core.withContext(function($ctx1) {
  15359. var $1,$3,$2;
  15360. newClass=$self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15361. $self._copyClass_to_(aClass,newClass);
  15362. $1=$recv($globals.SystemAnnouncer)._current();
  15363. $3=$recv($globals.ClassAdded)._new();
  15364. $recv($3)._theClass_(newClass);
  15365. $2=$recv($3)._yourself();
  15366. $recv($1)._announce_($2);
  15367. return newClass;
  15368. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  15369. },
  15370. args: ["aClass", "className"],
  15371. source: "copyClass: aClass named: className\x0a\x09| newClass |\x0a\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name.\x0a\x0a\x09self copyClass: aClass to: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  15372. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15373. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  15374. }),
  15375. $globals.ClassBuilder);
  15376. $core.addMethod(
  15377. $core.method({
  15378. selector: "copyClass:to:",
  15379. protocol: "copying",
  15380. fn: function (aClass,anotherClass){
  15381. var self=this,$self=this;
  15382. return $core.withContext(function($ctx1) {
  15383. var $1,$3,$2,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$16,$17,$18,$19;
  15384. $recv(anotherClass)._comment_($recv(aClass)._comment());
  15385. $1=$recv(aClass)._methodDictionary();
  15386. $ctx1.sendIdx["methodDictionary"]=1;
  15387. $recv($1)._valuesDo_((function(each){
  15388. return $core.withContext(function($ctx2) {
  15389. $3=$recv(each)._methodClass();
  15390. $ctx2.sendIdx["methodClass"]=1;
  15391. $2=$recv($3).__eq(aClass);
  15392. $ctx2.sendIdx["="]=1;
  15393. if($core.assert($2)){
  15394. $4=$recv($globals.Compiler)._new();
  15395. $ctx2.sendIdx["new"]=1;
  15396. $5=$recv(each)._source();
  15397. $ctx2.sendIdx["source"]=1;
  15398. $6=$recv(each)._protocol();
  15399. $ctx2.sendIdx["protocol"]=1;
  15400. return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
  15401. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  15402. }
  15403. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15404. }));
  15405. $ctx1.sendIdx["valuesDo:"]=1;
  15406. $7=$recv(aClass)._traitComposition();
  15407. $ctx1.sendIdx["traitComposition"]=1;
  15408. $recv(anotherClass)._setTraitComposition_($7);
  15409. $ctx1.sendIdx["setTraitComposition:"]=1;
  15410. $8=$recv(anotherClass)._class();
  15411. $ctx1.sendIdx["class"]=1;
  15412. $10=$recv(aClass)._class();
  15413. $ctx1.sendIdx["class"]=2;
  15414. $9=$recv($10)._instanceVariableNames();
  15415. $self._basicClass_instanceVariables_($8,$9);
  15416. $12=$recv(aClass)._class();
  15417. $ctx1.sendIdx["class"]=3;
  15418. $11=$recv($12)._methodDictionary();
  15419. $recv($11)._valuesDo_((function(each){
  15420. return $core.withContext(function($ctx2) {
  15421. $14=$recv(each)._methodClass();
  15422. $15=$recv(aClass)._class();
  15423. $ctx2.sendIdx["class"]=4;
  15424. $13=$recv($14).__eq($15);
  15425. if($core.assert($13)){
  15426. $16=$recv($globals.Compiler)._new();
  15427. $17=$recv(each)._source();
  15428. $18=$recv(anotherClass)._class();
  15429. $ctx2.sendIdx["class"]=5;
  15430. return $recv($16)._install_forClass_protocol_($17,$18,$recv(each)._protocol());
  15431. }
  15432. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15433. }));
  15434. $19=$recv(anotherClass)._class();
  15435. $ctx1.sendIdx["class"]=6;
  15436. $recv($19)._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  15437. return self;
  15438. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15439. },
  15440. args: ["aClass", "anotherClass"],
  15441. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09each methodClass = aClass ifTrue: [\x0a\x09\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ] ].\x0a\x09anotherClass setTraitComposition: aClass traitComposition.\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09each methodClass = aClass class ifTrue: [\x0a\x09\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ] ].\x0a\x09anotherClass class setTraitComposition: aClass class traitComposition",
  15442. referencedClasses: ["Compiler"],
  15443. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  15444. }),
  15445. $globals.ClassBuilder);
  15446. $core.addMethod(
  15447. $core.method({
  15448. selector: "installMethod:forClass:protocol:",
  15449. protocol: "method definition",
  15450. fn: function (aCompiledMethod,aBehavior,aString){
  15451. var self=this,$self=this;
  15452. return $core.withContext(function($ctx1) {
  15453. $recv(aCompiledMethod)._protocol_(aString);
  15454. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  15455. return aCompiledMethod;
  15456. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  15457. },
  15458. args: ["aCompiledMethod", "aBehavior", "aString"],
  15459. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  15460. referencedClasses: [],
  15461. messageSends: ["protocol:", "addCompiledMethod:"]
  15462. }),
  15463. $globals.ClassBuilder);
  15464. $core.addMethod(
  15465. $core.method({
  15466. selector: "instanceVariableNamesFor:",
  15467. protocol: "accessing",
  15468. fn: function (aString){
  15469. var self=this,$self=this;
  15470. return $core.withContext(function($ctx1) {
  15471. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  15472. return $core.withContext(function($ctx2) {
  15473. return $recv(each)._isEmpty();
  15474. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15475. }));
  15476. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  15477. },
  15478. args: ["aString"],
  15479. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  15480. referencedClasses: [],
  15481. messageSends: ["reject:", "tokenize:", "isEmpty"]
  15482. }),
  15483. $globals.ClassBuilder);
  15484. $core.addMethod(
  15485. $core.method({
  15486. selector: "migrateClass:superclass:",
  15487. protocol: "class migration",
  15488. fn: function (aClass,anotherClass){
  15489. var self=this,$self=this;
  15490. return $core.withContext(function($ctx1) {
  15491. var $1;
  15492. $1=$recv(aClass)._name();
  15493. $ctx1.sendIdx["name"]=1;
  15494. return $self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15495. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15496. },
  15497. args: ["aClass", "anotherClass"],
  15498. source: "migrateClass: aClass superclass: anotherClass\x0a\x09^ self\x0a\x09\x09migrateClassNamed: aClass name\x0a\x09\x09superclass: anotherClass\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name",
  15499. referencedClasses: [],
  15500. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  15501. }),
  15502. $globals.ClassBuilder);
  15503. $core.addMethod(
  15504. $core.method({
  15505. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  15506. protocol: "class migration",
  15507. fn: function (className,aClass,aCollection,packageName){
  15508. var self=this,$self=this;
  15509. var oldClass,newClass,tmp;
  15510. return $core.withContext(function($ctx1) {
  15511. var $1,$2,$4,$3;
  15512. tmp="new*".__comma(className);
  15513. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15514. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  15515. $self._basicSwapClassNames_with_(oldClass,newClass);
  15516. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  15517. $recv((function(){
  15518. return $core.withContext(function($ctx2) {
  15519. return $self._copyClass_to_(oldClass,newClass);
  15520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15521. }))._on_do_($globals.Error,(function(exception){
  15522. return $core.withContext(function($ctx2) {
  15523. $self._basicSwapClassNames_with_(oldClass,newClass);
  15524. $1=$self._basicRemoveClass_(newClass);
  15525. $ctx2.sendIdx["basicRemoveClass:"]=1;
  15526. return $recv(exception)._pass();
  15527. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  15528. }));
  15529. $self._rawRenameClass_to_(oldClass,tmp);
  15530. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  15531. $self._rawRenameClass_to_(newClass,className);
  15532. $recv($recv(oldClass)._subclasses())._do_((function(each){
  15533. return $core.withContext(function($ctx2) {
  15534. return $self._migrateClass_superclass_(each,newClass);
  15535. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15536. }));
  15537. $self._basicRemoveClass_(oldClass);
  15538. $2=$recv($globals.SystemAnnouncer)._current();
  15539. $4=$recv($globals.ClassMigrated)._new();
  15540. $recv($4)._theClass_(newClass);
  15541. $recv($4)._oldClass_(oldClass);
  15542. $3=$recv($4)._yourself();
  15543. $recv($2)._announce_($3);
  15544. return newClass;
  15545. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},$globals.ClassBuilder)});
  15546. },
  15547. args: ["className", "aClass", "aCollection", "packageName"],
  15548. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09\x09exception pass ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  15549. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  15550. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "pass", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  15551. }),
  15552. $globals.ClassBuilder);
  15553. $core.addMethod(
  15554. $core.method({
  15555. selector: "rawRenameClass:to:",
  15556. protocol: "private",
  15557. fn: function (aClass,aString){
  15558. var self=this,$self=this;
  15559. return $core.withContext(function($ctx1) {
  15560. $globals[aString] = aClass;
  15561. ;
  15562. return self;
  15563. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15564. },
  15565. args: ["aClass", "aString"],
  15566. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  15567. referencedClasses: [],
  15568. messageSends: []
  15569. }),
  15570. $globals.ClassBuilder);
  15571. $core.addMethod(
  15572. $core.method({
  15573. selector: "renameClass:to:",
  15574. protocol: "class migration",
  15575. fn: function (aClass,className){
  15576. var self=this,$self=this;
  15577. return $core.withContext(function($ctx1) {
  15578. var $1,$3,$2;
  15579. $self._basicRenameClass_to_(aClass,className);
  15580. $recv(aClass)._recompile();
  15581. $1=$recv($globals.SystemAnnouncer)._current();
  15582. $3=$recv($globals.ClassRenamed)._new();
  15583. $recv($3)._theClass_(aClass);
  15584. $2=$recv($3)._yourself();
  15585. $recv($1)._announce_($2);
  15586. return self;
  15587. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15588. },
  15589. args: ["aClass", "className"],
  15590. source: "renameClass: aClass to: className\x0a\x09self basicRenameClass: aClass to: className.\x0a\x09\x0a\x09\x22Recompile the class to fix potential issues with super sends\x22\x0a\x09aClass recompile.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRenamed new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  15591. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  15592. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  15593. }),
  15594. $globals.ClassBuilder);
  15595. $core.addMethod(
  15596. $core.method({
  15597. selector: "superclass:subclass:",
  15598. protocol: "class definition",
  15599. fn: function (aClass,className){
  15600. var self=this,$self=this;
  15601. return $core.withContext(function($ctx1) {
  15602. return $self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  15603. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15604. },
  15605. args: ["aClass", "className"],
  15606. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  15607. referencedClasses: [],
  15608. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  15609. }),
  15610. $globals.ClassBuilder);
  15611. $core.addMethod(
  15612. $core.method({
  15613. selector: "superclass:subclass:instanceVariableNames:package:",
  15614. protocol: "class definition",
  15615. fn: function (aClass,className,ivarNames,packageName){
  15616. var self=this,$self=this;
  15617. var newClass;
  15618. return $core.withContext(function($ctx1) {
  15619. var $1,$2,$3,$5,$4,$receiver;
  15620. $1=$self._instanceVariableNamesFor_(ivarNames);
  15621. if(($receiver = packageName) == null || $receiver.a$nil){
  15622. $2="unclassified";
  15623. } else {
  15624. $2=packageName;
  15625. }
  15626. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  15627. $3=$recv($globals.SystemAnnouncer)._current();
  15628. $5=$recv($globals.ClassAdded)._new();
  15629. $recv($5)._theClass_(newClass);
  15630. $4=$recv($5)._yourself();
  15631. $recv($3)._announce_($4);
  15632. return newClass;
  15633. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  15634. },
  15635. args: ["aClass", "className", "ivarNames", "packageName"],
  15636. source: "superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)\x0a\x09\x09package: (packageName ifNil: [ 'unclassified' ]).\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  15637. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15638. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  15639. }),
  15640. $globals.ClassBuilder);
  15641. $core.addClass("ClassSorterNode", $globals.Object, ["theClass", "level", "nodes"], "Kernel-Classes");
  15642. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  15643. $core.addMethod(
  15644. $core.method({
  15645. selector: "getNodesFrom:",
  15646. protocol: "accessing",
  15647. fn: function (aCollection){
  15648. var self=this,$self=this;
  15649. var children,others;
  15650. return $core.withContext(function($ctx1) {
  15651. var $1;
  15652. children=[];
  15653. others=[];
  15654. $recv(aCollection)._do_((function(each){
  15655. return $core.withContext(function($ctx2) {
  15656. $1=$recv($recv(each)._superclass()).__eq($self._theClass());
  15657. if($core.assert($1)){
  15658. return $recv(children)._add_(each);
  15659. $ctx2.sendIdx["add:"]=1;
  15660. } else {
  15661. return $recv(others)._add_(each);
  15662. }
  15663. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15664. }));
  15665. $self["@nodes"]=$recv(children)._collect_((function(each){
  15666. return $core.withContext(function($ctx2) {
  15667. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv($self._level()).__plus((1)));
  15668. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  15669. }));
  15670. return self;
  15671. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  15672. },
  15673. args: ["aCollection"],
  15674. source: "getNodesFrom: aCollection\x0a\x09| children others |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09aCollection do: [ :each |\x0a\x09\x09(each superclass = self theClass)\x0a\x09\x09\x09ifTrue: [ children add: each ]\x0a\x09\x09\x09ifFalse: [ others add: each ]].\x0a\x09nodes:= children collect: [ :each |\x0a\x09\x09ClassSorterNode on: each classes: others level: self level + 1 ]",
  15675. referencedClasses: ["ClassSorterNode"],
  15676. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  15677. }),
  15678. $globals.ClassSorterNode);
  15679. $core.addMethod(
  15680. $core.method({
  15681. selector: "level",
  15682. protocol: "accessing",
  15683. fn: function (){
  15684. var self=this,$self=this;
  15685. return $self["@level"];
  15686. },
  15687. args: [],
  15688. source: "level\x0a\x09^ level",
  15689. referencedClasses: [],
  15690. messageSends: []
  15691. }),
  15692. $globals.ClassSorterNode);
  15693. $core.addMethod(
  15694. $core.method({
  15695. selector: "level:",
  15696. protocol: "accessing",
  15697. fn: function (anInteger){
  15698. var self=this,$self=this;
  15699. $self["@level"]=anInteger;
  15700. return self;
  15701. },
  15702. args: ["anInteger"],
  15703. source: "level: anInteger\x0a\x09level := anInteger",
  15704. referencedClasses: [],
  15705. messageSends: []
  15706. }),
  15707. $globals.ClassSorterNode);
  15708. $core.addMethod(
  15709. $core.method({
  15710. selector: "nodes",
  15711. protocol: "accessing",
  15712. fn: function (){
  15713. var self=this,$self=this;
  15714. return $self["@nodes"];
  15715. },
  15716. args: [],
  15717. source: "nodes\x0a\x09^ nodes",
  15718. referencedClasses: [],
  15719. messageSends: []
  15720. }),
  15721. $globals.ClassSorterNode);
  15722. $core.addMethod(
  15723. $core.method({
  15724. selector: "theClass",
  15725. protocol: "accessing",
  15726. fn: function (){
  15727. var self=this,$self=this;
  15728. return $self["@theClass"];
  15729. },
  15730. args: [],
  15731. source: "theClass\x0a\x09^ theClass",
  15732. referencedClasses: [],
  15733. messageSends: []
  15734. }),
  15735. $globals.ClassSorterNode);
  15736. $core.addMethod(
  15737. $core.method({
  15738. selector: "theClass:",
  15739. protocol: "accessing",
  15740. fn: function (aClass){
  15741. var self=this,$self=this;
  15742. $self["@theClass"]=aClass;
  15743. return self;
  15744. },
  15745. args: ["aClass"],
  15746. source: "theClass: aClass\x0a\x09theClass := aClass",
  15747. referencedClasses: [],
  15748. messageSends: []
  15749. }),
  15750. $globals.ClassSorterNode);
  15751. $core.addMethod(
  15752. $core.method({
  15753. selector: "traverseClassesWith:",
  15754. protocol: "visiting",
  15755. fn: function (aCollection){
  15756. var self=this,$self=this;
  15757. return $core.withContext(function($ctx1) {
  15758. var $1,$3,$2;
  15759. $1=$self._theClass();
  15760. $ctx1.sendIdx["theClass"]=1;
  15761. $recv(aCollection)._add_($1);
  15762. $recv($recv($self._nodes())._sorted_((function(a,b){
  15763. return $core.withContext(function($ctx2) {
  15764. $3=$recv(a)._theClass();
  15765. $ctx2.sendIdx["theClass"]=2;
  15766. $2=$recv($3)._name();
  15767. $ctx2.sendIdx["name"]=1;
  15768. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  15769. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  15770. })))._do_((function(aNode){
  15771. return $core.withContext(function($ctx2) {
  15772. return $recv(aNode)._traverseClassesWith_(aCollection);
  15773. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  15774. }));
  15775. return self;
  15776. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  15777. },
  15778. args: ["aCollection"],
  15779. source: "traverseClassesWith: aCollection\x0a\x09\x22sort classes alphabetically Issue #143\x22\x0a\x0a\x09aCollection add: self theClass.\x0a\x09(self nodes sorted: [ :a :b | a theClass name <= b theClass name ]) do: [ :aNode |\x0a\x09\x09aNode traverseClassesWith: aCollection ].",
  15780. referencedClasses: [],
  15781. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  15782. }),
  15783. $globals.ClassSorterNode);
  15784. $core.addMethod(
  15785. $core.method({
  15786. selector: "on:classes:level:",
  15787. protocol: "instance creation",
  15788. fn: function (aClass,aCollection,anInteger){
  15789. var self=this,$self=this;
  15790. return $core.withContext(function($ctx1) {
  15791. var $1;
  15792. $1=$self._new();
  15793. $recv($1)._theClass_(aClass);
  15794. $recv($1)._level_(anInteger);
  15795. $recv($1)._getNodesFrom_(aCollection);
  15796. return $recv($1)._yourself();
  15797. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.a$cls)});
  15798. },
  15799. args: ["aClass", "aCollection", "anInteger"],
  15800. source: "on: aClass classes: aCollection level: anInteger\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09level: anInteger;\x0a\x09\x09getNodesFrom: aCollection;\x0a\x09\x09yourself",
  15801. referencedClasses: [],
  15802. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  15803. }),
  15804. $globals.ClassSorterNode.a$cls);
  15805. $core.addTrait("TBehaviorDefaults", "Kernel-Classes");
  15806. $core.addMethod(
  15807. $core.method({
  15808. selector: "allInstanceVariableNames",
  15809. protocol: "accessing",
  15810. fn: function (){
  15811. var self=this,$self=this;
  15812. return [];
  15813. },
  15814. args: [],
  15815. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  15816. referencedClasses: [],
  15817. messageSends: []
  15818. }),
  15819. $globals.TBehaviorDefaults);
  15820. $core.addMethod(
  15821. $core.method({
  15822. selector: "allSubclassesDo:",
  15823. protocol: "enumerating",
  15824. fn: function (aBlock){
  15825. var self=this,$self=this;
  15826. return self;
  15827. },
  15828. args: ["aBlock"],
  15829. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  15830. referencedClasses: [],
  15831. messageSends: []
  15832. }),
  15833. $globals.TBehaviorDefaults);
  15834. $core.addMethod(
  15835. $core.method({
  15836. selector: "name",
  15837. protocol: "accessing",
  15838. fn: function (){
  15839. var self=this,$self=this;
  15840. return nil;
  15841. },
  15842. args: [],
  15843. source: "name\x0a\x09^ nil",
  15844. referencedClasses: [],
  15845. messageSends: []
  15846. }),
  15847. $globals.TBehaviorDefaults);
  15848. $core.addMethod(
  15849. $core.method({
  15850. selector: "printOn:",
  15851. protocol: "printing",
  15852. fn: function (aStream){
  15853. var self=this,$self=this;
  15854. return $core.withContext(function($ctx1) {
  15855. var $1,$receiver;
  15856. $1=$self._name();
  15857. if(($receiver = $1) == null || $receiver.a$nil){
  15858. (
  15859. $ctx1.supercall = true,
  15860. ($globals.TBehaviorDefaults.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  15861. $ctx1.supercall = false;
  15862. } else {
  15863. var name;
  15864. name=$receiver;
  15865. $recv(aStream)._nextPutAll_(name);
  15866. }
  15867. return self;
  15868. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.TBehaviorDefaults)});
  15869. },
  15870. args: ["aStream"],
  15871. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  15872. referencedClasses: [],
  15873. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  15874. }),
  15875. $globals.TBehaviorDefaults);
  15876. $core.addMethod(
  15877. $core.method({
  15878. selector: "superclass",
  15879. protocol: "accessing",
  15880. fn: function (){
  15881. var self=this,$self=this;
  15882. return nil;
  15883. },
  15884. args: [],
  15885. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  15886. referencedClasses: [],
  15887. messageSends: []
  15888. }),
  15889. $globals.TBehaviorDefaults);
  15890. $core.addMethod(
  15891. $core.method({
  15892. selector: "traitUsers",
  15893. protocol: "accessing",
  15894. fn: function (){
  15895. var self=this,$self=this;
  15896. return [];
  15897. },
  15898. args: [],
  15899. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  15900. referencedClasses: [],
  15901. messageSends: []
  15902. }),
  15903. $globals.TBehaviorDefaults);
  15904. $core.addTrait("TBehaviorProvider", "Kernel-Classes");
  15905. $globals.TBehaviorProvider.comment="I have method dictionary and organization.";
  15906. $core.addMethod(
  15907. $core.method({
  15908. selector: ">>",
  15909. protocol: "accessing",
  15910. fn: function (aString){
  15911. var self=this,$self=this;
  15912. return $core.withContext(function($ctx1) {
  15913. return $self._methodAt_(aString);
  15914. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.TBehaviorProvider)});
  15915. },
  15916. args: ["aString"],
  15917. source: ">> aString\x0a\x09^ self methodAt: aString",
  15918. referencedClasses: [],
  15919. messageSends: ["methodAt:"]
  15920. }),
  15921. $globals.TBehaviorProvider);
  15922. $core.addMethod(
  15923. $core.method({
  15924. selector: "addCompiledMethod:",
  15925. protocol: "compiling",
  15926. fn: function (aMethod){
  15927. var self=this,$self=this;
  15928. var oldMethod,announcement;
  15929. return $core.withContext(function($ctx1) {
  15930. var $1,$2,$3,$4,$receiver;
  15931. oldMethod=$recv($self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  15932. return nil;
  15933. }));
  15934. $self._basicAddCompiledMethod_(aMethod);
  15935. $1=oldMethod;
  15936. if(($receiver = $1) == null || $receiver.a$nil){
  15937. $2=$recv($globals.MethodAdded)._new();
  15938. $ctx1.sendIdx["new"]=1;
  15939. $recv($2)._method_(aMethod);
  15940. $ctx1.sendIdx["method:"]=1;
  15941. $3=$recv($2)._yourself();
  15942. $ctx1.sendIdx["yourself"]=1;
  15943. announcement=$3;
  15944. } else {
  15945. $4=$recv($globals.MethodModified)._new();
  15946. $recv($4)._oldMethod_(oldMethod);
  15947. $recv($4)._method_(aMethod);
  15948. announcement=$recv($4)._yourself();
  15949. }
  15950. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  15951. return self;
  15952. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.TBehaviorProvider)});
  15953. },
  15954. args: ["aMethod"],
  15955. source: "addCompiledMethod: aMethod\x0a\x09| oldMethod announcement |\x0a\x09\x0a\x09oldMethod := self methodDictionary\x0a\x09\x09at: aMethod selector\x0a\x09\x09ifAbsent: [ nil ].\x0a\x09\x0a\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09announcement := oldMethod\x0a\x09\x09ifNil: [\x0a\x09\x09\x09MethodAdded new\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ]\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09MethodModified new\x0a\x09\x09\x09\x09\x09oldMethod: oldMethod;\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ].\x0a\x09\x09\x09\x09\x09\x0a\x09\x09\x09\x09\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09\x09\x09announce: announcement",
  15956. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  15957. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  15958. }),
  15959. $globals.TBehaviorProvider);
  15960. $core.addMethod(
  15961. $core.method({
  15962. selector: "basicAddCompiledMethod:",
  15963. protocol: "private",
  15964. fn: function (aMethod){
  15965. var self=this,$self=this;
  15966. return $core.withContext(function($ctx1) {
  15967. $core.addMethod(aMethod, self);
  15968. return self;
  15969. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  15970. },
  15971. args: ["aMethod"],
  15972. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  15973. referencedClasses: [],
  15974. messageSends: []
  15975. }),
  15976. $globals.TBehaviorProvider);
  15977. $core.addMethod(
  15978. $core.method({
  15979. selector: "basicRemoveCompiledMethod:",
  15980. protocol: "private",
  15981. fn: function (aMethod){
  15982. var self=this,$self=this;
  15983. return $core.withContext(function($ctx1) {
  15984. $core.removeMethod(aMethod,self);
  15985. return self;
  15986. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  15987. },
  15988. args: ["aMethod"],
  15989. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  15990. referencedClasses: [],
  15991. messageSends: []
  15992. }),
  15993. $globals.TBehaviorProvider);
  15994. $core.addMethod(
  15995. $core.method({
  15996. selector: "compile:protocol:",
  15997. protocol: "compiling",
  15998. fn: function (aString,anotherString){
  15999. var self=this,$self=this;
  16000. return $core.withContext(function($ctx1) {
  16001. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  16002. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.TBehaviorProvider)});
  16003. },
  16004. args: ["aString", "anotherString"],
  16005. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  16006. referencedClasses: ["Compiler"],
  16007. messageSends: ["install:forClass:protocol:", "new"]
  16008. }),
  16009. $globals.TBehaviorProvider);
  16010. $core.addMethod(
  16011. $core.method({
  16012. selector: "includesSelector:",
  16013. protocol: "testing",
  16014. fn: function (aString){
  16015. var self=this,$self=this;
  16016. return $core.withContext(function($ctx1) {
  16017. return $recv($self._methodDictionary())._includesKey_(aString);
  16018. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.TBehaviorProvider)});
  16019. },
  16020. args: ["aString"],
  16021. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  16022. referencedClasses: [],
  16023. messageSends: ["includesKey:", "methodDictionary"]
  16024. }),
  16025. $globals.TBehaviorProvider);
  16026. $core.addMethod(
  16027. $core.method({
  16028. selector: "methodAt:",
  16029. protocol: "accessing",
  16030. fn: function (aString){
  16031. var self=this,$self=this;
  16032. return $core.withContext(function($ctx1) {
  16033. return $recv($self._methodDictionary())._at_(aString);
  16034. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.TBehaviorProvider)});
  16035. },
  16036. args: ["aString"],
  16037. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  16038. referencedClasses: [],
  16039. messageSends: ["at:", "methodDictionary"]
  16040. }),
  16041. $globals.TBehaviorProvider);
  16042. $core.addMethod(
  16043. $core.method({
  16044. selector: "methodDictionary",
  16045. protocol: "accessing",
  16046. fn: function (){
  16047. var self=this,$self=this;
  16048. return $core.withContext(function($ctx1) {
  16049. var dict = $globals.HashedCollection._new();
  16050. var methods = self.methods;
  16051. Object.keys(methods).forEach(function(i) {
  16052. if(methods[i].selector) {
  16053. dict._at_put_(methods[i].selector, methods[i]);
  16054. }
  16055. });
  16056. return dict;
  16057. return self;
  16058. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.TBehaviorProvider)});
  16059. },
  16060. args: [],
  16061. source: "methodDictionary\x0a\x09<inlineJS: 'var dict = $globals.HashedCollection._new();\x0a\x09var methods = self.methods;\x0a\x09Object.keys(methods).forEach(function(i) {\x0a\x09\x09if(methods[i].selector) {\x0a\x09\x09\x09dict._at_put_(methods[i].selector, methods[i]);\x0a\x09\x09}\x0a\x09});\x0a\x09return dict'>",
  16062. referencedClasses: [],
  16063. messageSends: []
  16064. }),
  16065. $globals.TBehaviorProvider);
  16066. $core.addMethod(
  16067. $core.method({
  16068. selector: "methodOrganizationEnter:andLeave:",
  16069. protocol: "accessing",
  16070. fn: function (aMethod,oldMethod){
  16071. var self=this,$self=this;
  16072. return $core.withContext(function($ctx1) {
  16073. var $1,$2,$receiver;
  16074. if(($receiver = aMethod) == null || $receiver.a$nil){
  16075. aMethod;
  16076. } else {
  16077. $1=$self._organization();
  16078. $2=$recv(aMethod)._protocol();
  16079. $ctx1.sendIdx["protocol"]=1;
  16080. $recv($1)._addElement_($2);
  16081. }
  16082. if(($receiver = oldMethod) == null || $receiver.a$nil){
  16083. oldMethod;
  16084. } else {
  16085. $self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  16086. }
  16087. return self;
  16088. }, function($ctx1) {$ctx1.fill(self,"methodOrganizationEnter:andLeave:",{aMethod:aMethod,oldMethod:oldMethod},$globals.TBehaviorProvider)});
  16089. },
  16090. args: ["aMethod", "oldMethod"],
  16091. source: "methodOrganizationEnter: aMethod andLeave: oldMethod\x0a\x09aMethod ifNotNil: [\x0a\x09\x09self organization addElement: aMethod protocol ].\x0a\x09\x0a\x09oldMethod ifNotNil: [\x0a\x09\x09self removeProtocolIfEmpty: oldMethod protocol ]",
  16092. referencedClasses: [],
  16093. messageSends: ["ifNotNil:", "addElement:", "organization", "protocol", "removeProtocolIfEmpty:"]
  16094. }),
  16095. $globals.TBehaviorProvider);
  16096. $core.addMethod(
  16097. $core.method({
  16098. selector: "methodTemplate",
  16099. protocol: "accessing",
  16100. fn: function (){
  16101. var self=this,$self=this;
  16102. return $core.withContext(function($ctx1) {
  16103. return $recv($globals.String)._streamContents_((function(stream){
  16104. return $core.withContext(function($ctx2) {
  16105. $recv(stream)._write_("messageSelectorAndArgumentNames");
  16106. $ctx2.sendIdx["write:"]=1;
  16107. $recv(stream)._lf();
  16108. $ctx2.sendIdx["lf"]=1;
  16109. $recv(stream)._tab();
  16110. $ctx2.sendIdx["tab"]=1;
  16111. $recv(stream)._write_("\x22comment stating purpose of message\x22");
  16112. $ctx2.sendIdx["write:"]=2;
  16113. $recv(stream)._lf();
  16114. $ctx2.sendIdx["lf"]=2;
  16115. $recv(stream)._lf();
  16116. $ctx2.sendIdx["lf"]=3;
  16117. $recv(stream)._tab();
  16118. $ctx2.sendIdx["tab"]=2;
  16119. $recv(stream)._write_("| temporary variable names |");
  16120. $ctx2.sendIdx["write:"]=3;
  16121. $recv(stream)._lf();
  16122. $recv(stream)._tab();
  16123. return $recv(stream)._write_("statements");
  16124. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16125. }));
  16126. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.TBehaviorProvider)});
  16127. },
  16128. args: [],
  16129. source: "methodTemplate\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: 'messageSelectorAndArgumentNames'; lf;\x0a\x09\x09tab; write: '\x22comment stating purpose of message\x22'; lf;\x0a\x09\x09lf;\x0a\x09\x09tab; write: '| temporary variable names |'; lf;\x0a\x09\x09tab; write: 'statements' ]",
  16130. referencedClasses: ["String"],
  16131. messageSends: ["streamContents:", "write:", "lf", "tab"]
  16132. }),
  16133. $globals.TBehaviorProvider);
  16134. $core.addMethod(
  16135. $core.method({
  16136. selector: "methods",
  16137. protocol: "accessing",
  16138. fn: function (){
  16139. var self=this,$self=this;
  16140. return $core.withContext(function($ctx1) {
  16141. return $recv($self._methodDictionary())._values();
  16142. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.TBehaviorProvider)});
  16143. },
  16144. args: [],
  16145. source: "methods\x0a\x09^ self methodDictionary values",
  16146. referencedClasses: [],
  16147. messageSends: ["values", "methodDictionary"]
  16148. }),
  16149. $globals.TBehaviorProvider);
  16150. $core.addMethod(
  16151. $core.method({
  16152. selector: "methodsInProtocol:",
  16153. protocol: "accessing",
  16154. fn: function (aString){
  16155. var self=this,$self=this;
  16156. return $core.withContext(function($ctx1) {
  16157. return $recv($self._methods())._select_((function(each){
  16158. return $core.withContext(function($ctx2) {
  16159. return $recv($recv(each)._protocol()).__eq(aString);
  16160. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16161. }));
  16162. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16163. },
  16164. args: ["aString"],
  16165. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  16166. referencedClasses: [],
  16167. messageSends: ["select:", "methods", "=", "protocol"]
  16168. }),
  16169. $globals.TBehaviorProvider);
  16170. $core.addMethod(
  16171. $core.method({
  16172. selector: "organization",
  16173. protocol: "accessing",
  16174. fn: function (){
  16175. var self=this,$self=this;
  16176. return $core.withContext(function($ctx1) {
  16177. var $1,$receiver;
  16178. $1=$self._basicOrganization();
  16179. $ctx1.sendIdx["basicOrganization"]=1;
  16180. if(($receiver = $1) == null || $receiver.a$nil){
  16181. $self._basicOrganization_($recv($globals.ClassOrganizer)._on_(self));
  16182. return $self._basicOrganization();
  16183. } else {
  16184. return $1;
  16185. }
  16186. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.TBehaviorProvider)});
  16187. },
  16188. args: [],
  16189. source: "organization\x0a\x09^ self basicOrganization ifNil: [\x0a\x09\x09self basicOrganization: (ClassOrganizer on: self).\x0a\x09\x09self basicOrganization ]",
  16190. referencedClasses: ["ClassOrganizer"],
  16191. messageSends: ["ifNil:", "basicOrganization", "basicOrganization:", "on:"]
  16192. }),
  16193. $globals.TBehaviorProvider);
  16194. $core.addMethod(
  16195. $core.method({
  16196. selector: "ownMethods",
  16197. protocol: "accessing",
  16198. fn: function (){
  16199. var self=this,$self=this;
  16200. return $core.withContext(function($ctx1) {
  16201. var $1;
  16202. return $recv($recv($self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  16203. return $core.withContext(function($ctx2) {
  16204. return $recv(acc).__comma($self._ownMethodsInProtocol_(each));
  16205. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  16206. })))._sorted_((function(a,b){
  16207. return $core.withContext(function($ctx2) {
  16208. $1=$recv(a)._selector();
  16209. $ctx2.sendIdx["selector"]=1;
  16210. return $recv($1).__lt_eq($recv(b)._selector());
  16211. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  16212. }));
  16213. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.TBehaviorProvider)});
  16214. },
  16215. args: [],
  16216. source: "ownMethods\x0a\x09\x22Answer the methods of the receiver that are not package extensions\x0a\x09nor obtained via trait composition\x22\x0a\x0a\x09^ (self ownProtocols \x0a\x09\x09inject: OrderedCollection new\x0a\x09\x09into: [ :acc :each | acc, (self ownMethodsInProtocol: each) ])\x0a\x09\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  16217. referencedClasses: ["OrderedCollection"],
  16218. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  16219. }),
  16220. $globals.TBehaviorProvider);
  16221. $core.addMethod(
  16222. $core.method({
  16223. selector: "ownMethodsInProtocol:",
  16224. protocol: "accessing",
  16225. fn: function (aString){
  16226. var self=this,$self=this;
  16227. return $core.withContext(function($ctx1) {
  16228. return $recv($self._methodsInProtocol_(aString))._select_((function(each){
  16229. return $core.withContext(function($ctx2) {
  16230. return $recv($recv(each)._methodClass()).__eq(self);
  16231. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16232. }));
  16233. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16234. },
  16235. args: ["aString"],
  16236. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each methodClass = self ]",
  16237. referencedClasses: [],
  16238. messageSends: ["select:", "methodsInProtocol:", "=", "methodClass"]
  16239. }),
  16240. $globals.TBehaviorProvider);
  16241. $core.addMethod(
  16242. $core.method({
  16243. selector: "ownProtocols",
  16244. protocol: "accessing",
  16245. fn: function (){
  16246. var self=this,$self=this;
  16247. return $core.withContext(function($ctx1) {
  16248. return $recv($self._protocols())._reject_((function(each){
  16249. return $core.withContext(function($ctx2) {
  16250. return $recv(each)._match_("^\x5c*");
  16251. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16252. }));
  16253. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.TBehaviorProvider)});
  16254. },
  16255. args: [],
  16256. source: "ownProtocols\x0a\x09\x22Answer the protocols of the receiver that are not package extensions\x22\x0a\x0a\x09^ self protocols reject: [ :each |\x0a\x09\x09each match: '^\x5c*' ]",
  16257. referencedClasses: [],
  16258. messageSends: ["reject:", "protocols", "match:"]
  16259. }),
  16260. $globals.TBehaviorProvider);
  16261. $core.addMethod(
  16262. $core.method({
  16263. selector: "packageOfProtocol:",
  16264. protocol: "accessing",
  16265. fn: function (aString){
  16266. var self=this,$self=this;
  16267. return $core.withContext(function($ctx1) {
  16268. var $1;
  16269. $1=$recv(aString)._beginsWith_("*");
  16270. if(!$core.assert($1)){
  16271. return $self._package();
  16272. }
  16273. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  16274. return nil;
  16275. }));
  16276. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16277. },
  16278. args: ["aString"],
  16279. source: "packageOfProtocol: aString\x0a\x09\x22Answer the package the method of receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the receiver's package\x22\x0a\x09\x0a\x09(aString beginsWith: '*') ifFalse: [\x0a\x09\x09^ self package ].\x0a\x09\x09\x0a\x09^ Package \x0a\x09\x09named: aString allButFirst\x0a\x09\x09ifAbsent: [ nil ]",
  16280. referencedClasses: ["Package"],
  16281. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  16282. }),
  16283. $globals.TBehaviorProvider);
  16284. $core.addMethod(
  16285. $core.method({
  16286. selector: "protocols",
  16287. protocol: "accessing",
  16288. fn: function (){
  16289. var self=this,$self=this;
  16290. return $core.withContext(function($ctx1) {
  16291. return $recv($recv($recv($self._organization())._elements())._asArray())._sorted();
  16292. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.TBehaviorProvider)});
  16293. },
  16294. args: [],
  16295. source: "protocols\x0a\x09^ self organization elements asArray sorted",
  16296. referencedClasses: [],
  16297. messageSends: ["sorted", "asArray", "elements", "organization"]
  16298. }),
  16299. $globals.TBehaviorProvider);
  16300. $core.addMethod(
  16301. $core.method({
  16302. selector: "protocolsDo:",
  16303. protocol: "enumerating",
  16304. fn: function (aBlock){
  16305. var self=this,$self=this;
  16306. var methodsByProtocol;
  16307. return $core.withContext(function($ctx1) {
  16308. methodsByProtocol=$recv($globals.HashedCollection)._new();
  16309. $ctx1.sendIdx["new"]=1;
  16310. $recv($self._methodDictionary())._valuesDo_((function(m){
  16311. return $core.withContext(function($ctx2) {
  16312. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  16313. return $core.withContext(function($ctx3) {
  16314. return $recv($globals.Array)._new();
  16315. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  16316. })))._add_(m);
  16317. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  16318. }));
  16319. $recv($self._protocols())._do_((function(protocol){
  16320. return $core.withContext(function($ctx2) {
  16321. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  16322. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  16323. }));
  16324. return self;
  16325. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.TBehaviorProvider)});
  16326. },
  16327. args: ["aBlock"],
  16328. source: "protocolsDo: aBlock\x0a\x09\x22Execute aBlock for each method protocol with\x0a\x09its collection of methods in the sort order of protocol name.\x22\x0a\x0a\x09| methodsByProtocol |\x0a\x09methodsByProtocol := HashedCollection new.\x0a\x09self methodDictionary valuesDo: [ :m |\x0a\x09\x09(methodsByProtocol at: m protocol ifAbsentPut: [ Array new ])\x0a\x09\x09\x09add: m ].\x0a\x09self protocols do: [ :protocol |\x0a\x09\x09aBlock value: protocol value: (methodsByProtocol at: protocol) ]",
  16329. referencedClasses: ["HashedCollection", "Array"],
  16330. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  16331. }),
  16332. $globals.TBehaviorProvider);
  16333. $core.addMethod(
  16334. $core.method({
  16335. selector: "recompile",
  16336. protocol: "compiling",
  16337. fn: function (){
  16338. var self=this,$self=this;
  16339. return $core.withContext(function($ctx1) {
  16340. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  16341. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.TBehaviorProvider)});
  16342. },
  16343. args: [],
  16344. source: "recompile\x0a\x09^ Compiler new recompile: self",
  16345. referencedClasses: ["Compiler"],
  16346. messageSends: ["recompile:", "new"]
  16347. }),
  16348. $globals.TBehaviorProvider);
  16349. $core.addMethod(
  16350. $core.method({
  16351. selector: "removeCompiledMethod:",
  16352. protocol: "compiling",
  16353. fn: function (aMethod){
  16354. var self=this,$self=this;
  16355. return $core.withContext(function($ctx1) {
  16356. var $1,$3,$2;
  16357. $self._basicRemoveCompiledMethod_(aMethod);
  16358. $1=$recv($globals.SystemAnnouncer)._current();
  16359. $3=$recv($globals.MethodRemoved)._new();
  16360. $recv($3)._method_(aMethod);
  16361. $2=$recv($3)._yourself();
  16362. $recv($1)._announce_($2);
  16363. return self;
  16364. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16365. },
  16366. args: ["aMethod"],
  16367. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  16368. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  16369. messageSends: ["basicRemoveCompiledMethod:", "announce:", "current", "method:", "new", "yourself"]
  16370. }),
  16371. $globals.TBehaviorProvider);
  16372. $core.addMethod(
  16373. $core.method({
  16374. selector: "removeProtocolIfEmpty:",
  16375. protocol: "accessing",
  16376. fn: function (aString){
  16377. var self=this,$self=this;
  16378. return $core.withContext(function($ctx1) {
  16379. $recv($self._methods())._detect_ifNone_((function(each){
  16380. return $core.withContext(function($ctx2) {
  16381. return $recv($recv(each)._protocol()).__eq(aString);
  16382. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16383. }),(function(){
  16384. return $core.withContext(function($ctx2) {
  16385. return $recv($self._organization())._removeElement_(aString);
  16386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16387. }));
  16388. return self;
  16389. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.TBehaviorProvider)});
  16390. },
  16391. args: ["aString"],
  16392. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  16393. referencedClasses: [],
  16394. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  16395. }),
  16396. $globals.TBehaviorProvider);
  16397. $core.addMethod(
  16398. $core.method({
  16399. selector: "selectors",
  16400. protocol: "accessing",
  16401. fn: function (){
  16402. var self=this,$self=this;
  16403. return $core.withContext(function($ctx1) {
  16404. return $recv($self._methodDictionary())._keys();
  16405. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.TBehaviorProvider)});
  16406. },
  16407. args: [],
  16408. source: "selectors\x0a\x09^ self methodDictionary keys",
  16409. referencedClasses: [],
  16410. messageSends: ["keys", "methodDictionary"]
  16411. }),
  16412. $globals.TBehaviorProvider);
  16413. $core.addMethod(
  16414. $core.method({
  16415. selector: "setTraitComposition:",
  16416. protocol: "compiling",
  16417. fn: function (aTraitComposition){
  16418. var self=this,$self=this;
  16419. return $core.withContext(function($ctx1) {
  16420. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  16421. return self;
  16422. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition},$globals.TBehaviorProvider)});
  16423. },
  16424. args: ["aTraitComposition"],
  16425. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  16426. referencedClasses: [],
  16427. messageSends: []
  16428. }),
  16429. $globals.TBehaviorProvider);
  16430. $core.addMethod(
  16431. $core.method({
  16432. selector: "traitComposition",
  16433. protocol: "accessing",
  16434. fn: function (){
  16435. var self=this,$self=this;
  16436. return $core.withContext(function($ctx1) {
  16437. var $1,$receiver;
  16438. $1=$self._basicAt_("traitComposition");
  16439. if(($receiver = $1) == null || $receiver.a$nil){
  16440. return [];
  16441. } else {
  16442. var aCollection;
  16443. aCollection=$receiver;
  16444. return $recv(aCollection)._collect_((function(each){
  16445. return $core.withContext(function($ctx2) {
  16446. return $recv($globals.TraitTransformation)._fromJSON_(each);
  16447. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  16448. }));
  16449. }
  16450. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{},$globals.TBehaviorProvider)});
  16451. },
  16452. args: [],
  16453. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition')\x0a\x09\x09ifNil: [ #() ]\x0a\x09\x09ifNotNil: [ :aCollection | aCollection collect: [ :each | TraitTransformation fromJSON: each ] ]",
  16454. referencedClasses: ["TraitTransformation"],
  16455. messageSends: ["ifNil:ifNotNil:", "basicAt:", "collect:", "fromJSON:"]
  16456. }),
  16457. $globals.TBehaviorProvider);
  16458. $core.addMethod(
  16459. $core.method({
  16460. selector: "traitCompositionDefinition",
  16461. protocol: "accessing",
  16462. fn: function (){
  16463. var self=this,$self=this;
  16464. return $core.withContext(function($ctx1) {
  16465. return $recv($self._traitComposition())._ifNotEmpty_((function(traitComposition){
  16466. return $core.withContext(function($ctx2) {
  16467. return $recv($globals.String)._streamContents_((function(str){
  16468. return $core.withContext(function($ctx3) {
  16469. $recv(str)._write_("{");
  16470. $ctx3.sendIdx["write:"]=1;
  16471. $recv(traitComposition)._do_separatedBy_((function(each){
  16472. return $core.withContext(function($ctx4) {
  16473. return $recv(str)._write_($recv(each)._definition());
  16474. $ctx4.sendIdx["write:"]=2;
  16475. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  16476. }),(function(){
  16477. return $core.withContext(function($ctx4) {
  16478. return $recv(str)._write_(". ");
  16479. $ctx4.sendIdx["write:"]=3;
  16480. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  16481. }));
  16482. return $recv(str)._write_("}");
  16483. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  16484. }));
  16485. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  16486. }));
  16487. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{},$globals.TBehaviorProvider)});
  16488. },
  16489. args: [],
  16490. source: "traitCompositionDefinition\x0a\x09^ self traitComposition ifNotEmpty: [ :traitComposition |\x0a\x09\x09String streamContents: [ :str |\x0a\x09\x09\x09str write: '{'.\x0a\x09\x09\x09traitComposition\x0a\x09\x09\x09\x09do: [ :each | str write: each definition ]\x0a\x09\x09\x09\x09separatedBy: [ str write: '. ' ].\x0a\x09\x09\x09str write: '}' ] ]",
  16491. referencedClasses: ["String"],
  16492. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  16493. }),
  16494. $globals.TBehaviorProvider);
  16495. $core.addTrait("TMasterBehavior", "Kernel-Classes");
  16496. $globals.TMasterBehavior.comment="I am the behavior on the instance-side of the browser.\x0a\x0aI define things like package, category, name, comment etc.\x0aas opposed to derived behaviors (metaclass, class trait, ...)\x0athat relate to me.";
  16497. $core.addMethod(
  16498. $core.method({
  16499. selector: "asJavaScriptSource",
  16500. protocol: "converting",
  16501. fn: function (){
  16502. var self=this,$self=this;
  16503. return $core.withContext(function($ctx1) {
  16504. return "$globals.".__comma($self._name());
  16505. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TMasterBehavior)});
  16506. },
  16507. args: [],
  16508. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  16509. referencedClasses: [],
  16510. messageSends: [",", "name"]
  16511. }),
  16512. $globals.TMasterBehavior);
  16513. $core.addMethod(
  16514. $core.method({
  16515. selector: "browse",
  16516. protocol: "browsing",
  16517. fn: function (){
  16518. var self=this,$self=this;
  16519. return $core.withContext(function($ctx1) {
  16520. $recv($globals.Finder)._findClass_(self);
  16521. return self;
  16522. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.TMasterBehavior)});
  16523. },
  16524. args: [],
  16525. source: "browse\x0a\x09Finder findClass: self",
  16526. referencedClasses: ["Finder"],
  16527. messageSends: ["findClass:"]
  16528. }),
  16529. $globals.TMasterBehavior);
  16530. $core.addMethod(
  16531. $core.method({
  16532. selector: "category",
  16533. protocol: "accessing",
  16534. fn: function (){
  16535. var self=this,$self=this;
  16536. return $core.withContext(function($ctx1) {
  16537. var $1,$receiver;
  16538. $1=$self._package();
  16539. $ctx1.sendIdx["package"]=1;
  16540. if(($receiver = $1) == null || $receiver.a$nil){
  16541. return "Unclassified";
  16542. } else {
  16543. return $recv($self._package())._name();
  16544. }
  16545. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.TMasterBehavior)});
  16546. },
  16547. args: [],
  16548. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  16549. referencedClasses: [],
  16550. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  16551. }),
  16552. $globals.TMasterBehavior);
  16553. $core.addMethod(
  16554. $core.method({
  16555. selector: "classTag",
  16556. protocol: "accessing",
  16557. fn: function (){
  16558. var self=this,$self=this;
  16559. return $core.withContext(function($ctx1) {
  16560. return $self._subclassResponsibility();
  16561. }, function($ctx1) {$ctx1.fill(self,"classTag",{},$globals.TMasterBehavior)});
  16562. },
  16563. args: [],
  16564. source: "classTag\x0a\x09\x22Every master behavior should define a class tag.\x22\x0a\x09^ self subclassResponsibility",
  16565. referencedClasses: [],
  16566. messageSends: ["subclassResponsibility"]
  16567. }),
  16568. $globals.TMasterBehavior);
  16569. $core.addMethod(
  16570. $core.method({
  16571. selector: "comment",
  16572. protocol: "accessing",
  16573. fn: function (){
  16574. var self=this,$self=this;
  16575. return $core.withContext(function($ctx1) {
  16576. var $1,$receiver;
  16577. $1=$self._basicAt_("comment");
  16578. if(($receiver = $1) == null || $receiver.a$nil){
  16579. return "";
  16580. } else {
  16581. return $1;
  16582. }
  16583. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.TMasterBehavior)});
  16584. },
  16585. args: [],
  16586. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  16587. referencedClasses: [],
  16588. messageSends: ["ifNil:", "basicAt:"]
  16589. }),
  16590. $globals.TMasterBehavior);
  16591. $core.addMethod(
  16592. $core.method({
  16593. selector: "comment:",
  16594. protocol: "accessing",
  16595. fn: function (aString){
  16596. var self=this,$self=this;
  16597. return $core.withContext(function($ctx1) {
  16598. var $1,$3,$2;
  16599. $self._basicAt_put_("comment",aString);
  16600. $1=$recv($globals.SystemAnnouncer)._current();
  16601. $3=$recv($globals.ClassCommentChanged)._new();
  16602. $recv($3)._theClass_(self);
  16603. $2=$recv($3)._yourself();
  16604. $recv($1)._announce_($2);
  16605. return self;
  16606. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.TMasterBehavior)});
  16607. },
  16608. args: ["aString"],
  16609. source: "comment: aString\x0a\x09self basicAt: 'comment' put: aString.\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassCommentChanged new\x0a\x09\x09\x09theClass: self;\x0a\x09\x09\x09yourself)",
  16610. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  16611. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  16612. }),
  16613. $globals.TMasterBehavior);
  16614. $core.addMethod(
  16615. $core.method({
  16616. selector: "definedMethods",
  16617. protocol: "accessing",
  16618. fn: function (){
  16619. var self=this,$self=this;
  16620. var methods;
  16621. return $core.withContext(function($ctx1) {
  16622. var $1,$receiver;
  16623. methods=$self._methods();
  16624. $ctx1.sendIdx["methods"]=1;
  16625. $1=$self._theMetaClass();
  16626. if(($receiver = $1) == null || $receiver.a$nil){
  16627. return methods;
  16628. } else {
  16629. var meta;
  16630. meta=$receiver;
  16631. return $recv(methods).__comma($recv(meta)._methods());
  16632. }
  16633. return self;
  16634. }, function($ctx1) {$ctx1.fill(self,"definedMethods",{methods:methods},$globals.TMasterBehavior)});
  16635. },
  16636. args: [],
  16637. source: "definedMethods\x0a\x09\x22Answers methods of me and derived 'meta' part if present\x22\x0a\x09| methods |\x0a\x09methods := self methods.\x0a\x09self theMetaClass\x0a\x09\x09ifNil: [ ^ methods ]\x0a\x09\x09ifNotNil: [ :meta | ^ methods, meta methods ]",
  16638. referencedClasses: [],
  16639. messageSends: ["methods", "ifNil:ifNotNil:", "theMetaClass", ","]
  16640. }),
  16641. $globals.TMasterBehavior);
  16642. $core.addMethod(
  16643. $core.method({
  16644. selector: "enterOrganization",
  16645. protocol: "accessing",
  16646. fn: function (){
  16647. var self=this,$self=this;
  16648. return $core.withContext(function($ctx1) {
  16649. var $1,$receiver;
  16650. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16651. $globals.Smalltalk;
  16652. } else {
  16653. $1=$self._basicAt_("category");
  16654. if(($receiver = $1) == null || $receiver.a$nil){
  16655. $self._basicPackage_(nil);
  16656. $ctx1.sendIdx["basicPackage:"]=1;
  16657. } else {
  16658. var category;
  16659. category=$receiver;
  16660. $self._basicPackage_($recv($globals.Package)._named_(category));
  16661. $recv($recv($self._package())._organization())._addElement_(self);
  16662. }
  16663. }
  16664. return self;
  16665. }, function($ctx1) {$ctx1.fill(self,"enterOrganization",{},$globals.TMasterBehavior)});
  16666. },
  16667. args: [],
  16668. source: "enterOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09(self basicAt: 'category')\x0a\x09\x09\x09ifNil: [ self basicPackage: nil ]\x0a\x09\x09\x09ifNotNil: [ :category |\x0a\x09\x09\x09\x09\x22Amber has 1-1 correspondence between cat and pkg, atm\x22\x0a\x09\x09\x09\x09self basicPackage: (Package named: category).\x0a\x09\x09\x09\x09self package organization addElement: self ] ]",
  16669. referencedClasses: ["Smalltalk", "Package"],
  16670. messageSends: ["ifNotNil:", "ifNil:ifNotNil:", "basicAt:", "basicPackage:", "named:", "addElement:", "organization", "package"]
  16671. }),
  16672. $globals.TMasterBehavior);
  16673. $core.addMethod(
  16674. $core.method({
  16675. selector: "leaveOrganization",
  16676. protocol: "accessing",
  16677. fn: function (){
  16678. var self=this,$self=this;
  16679. return $core.withContext(function($ctx1) {
  16680. var $receiver;
  16681. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16682. $globals.Smalltalk;
  16683. } else {
  16684. $recv($recv($self._package())._organization())._removeElement_(self);
  16685. }
  16686. return self;
  16687. }, function($ctx1) {$ctx1.fill(self,"leaveOrganization",{},$globals.TMasterBehavior)});
  16688. },
  16689. args: [],
  16690. source: "leaveOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09self package organization removeElement: self ]",
  16691. referencedClasses: ["Smalltalk"],
  16692. messageSends: ["ifNotNil:", "removeElement:", "organization", "package"]
  16693. }),
  16694. $globals.TMasterBehavior);
  16695. $core.addMethod(
  16696. $core.method({
  16697. selector: "name",
  16698. protocol: "accessing",
  16699. fn: function (){
  16700. var self=this,$self=this;
  16701. return $core.withContext(function($ctx1) {
  16702. return self.name;
  16703. return self;
  16704. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.TMasterBehavior)});
  16705. },
  16706. args: [],
  16707. source: "name\x0a\x09<inlineJS: 'return self.name'>",
  16708. referencedClasses: [],
  16709. messageSends: []
  16710. }),
  16711. $globals.TMasterBehavior);
  16712. $core.addMethod(
  16713. $core.method({
  16714. selector: "package:",
  16715. protocol: "accessing",
  16716. fn: function (aPackage){
  16717. var self=this,$self=this;
  16718. var oldPackage;
  16719. return $core.withContext(function($ctx1) {
  16720. var $2,$1,$3,$5,$4;
  16721. $2=$self._package();
  16722. $ctx1.sendIdx["package"]=1;
  16723. $1=$recv($2).__eq(aPackage);
  16724. if($core.assert($1)){
  16725. return self;
  16726. }
  16727. oldPackage=$self._package();
  16728. $self._leaveOrganization();
  16729. $self._basicAt_put_("category",$recv(aPackage)._name());
  16730. $self._enterOrganization();
  16731. $3=$recv($globals.SystemAnnouncer)._current();
  16732. $5=$recv($globals.ClassMoved)._new();
  16733. $recv($5)._theClass_(self);
  16734. $recv($5)._oldPackage_(oldPackage);
  16735. $4=$recv($5)._yourself();
  16736. $recv($3)._announce_($4);
  16737. return self;
  16738. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.TMasterBehavior)});
  16739. },
  16740. args: ["aPackage"],
  16741. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self\x0a\x09\x09leaveOrganization;\x0a\x09\x09basicAt: 'category' put: aPackage name;\x0a\x09\x09enterOrganization.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  16742. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  16743. messageSends: ["ifTrue:", "=", "package", "leaveOrganization", "basicAt:put:", "name", "enterOrganization", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  16744. }),
  16745. $globals.TMasterBehavior);
  16746. $core.addMethod(
  16747. $core.method({
  16748. selector: "theNonMetaClass",
  16749. protocol: "accessing",
  16750. fn: function (){
  16751. var self=this,$self=this;
  16752. return self;
  16753. },
  16754. args: [],
  16755. source: "theNonMetaClass\x0a\x09^ self",
  16756. referencedClasses: [],
  16757. messageSends: []
  16758. }),
  16759. $globals.TMasterBehavior);
  16760. $core.addClass("Trait", $globals.Object, ["organization", "package"], "Kernel-Classes");
  16761. $core.addMethod(
  16762. $core.method({
  16763. selector: "-",
  16764. protocol: "composition",
  16765. fn: function (anArray){
  16766. var self=this,$self=this;
  16767. return $core.withContext(function($ctx1) {
  16768. return $recv($self._asTraitTransformation()).__minus(anArray);
  16769. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.Trait)});
  16770. },
  16771. args: ["anArray"],
  16772. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  16773. referencedClasses: [],
  16774. messageSends: ["-", "asTraitTransformation"]
  16775. }),
  16776. $globals.Trait);
  16777. $core.addMethod(
  16778. $core.method({
  16779. selector: "@",
  16780. protocol: "composition",
  16781. fn: function (anArrayOfAssociations){
  16782. var self=this,$self=this;
  16783. return $core.withContext(function($ctx1) {
  16784. return $recv($self._asTraitTransformation()).__at(anArrayOfAssociations);
  16785. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.Trait)});
  16786. },
  16787. args: ["anArrayOfAssociations"],
  16788. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  16789. referencedClasses: [],
  16790. messageSends: ["@", "asTraitTransformation"]
  16791. }),
  16792. $globals.Trait);
  16793. $core.addMethod(
  16794. $core.method({
  16795. selector: "asTraitComposition",
  16796. protocol: "converting",
  16797. fn: function (){
  16798. var self=this,$self=this;
  16799. return $core.withContext(function($ctx1) {
  16800. return $recv($self._asTraitTransformation())._asTraitComposition();
  16801. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Trait)});
  16802. },
  16803. args: [],
  16804. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  16805. referencedClasses: [],
  16806. messageSends: ["asTraitComposition", "asTraitTransformation"]
  16807. }),
  16808. $globals.Trait);
  16809. $core.addMethod(
  16810. $core.method({
  16811. selector: "asTraitTransformation",
  16812. protocol: "converting",
  16813. fn: function (){
  16814. var self=this,$self=this;
  16815. return $core.withContext(function($ctx1) {
  16816. return $recv($globals.TraitTransformation)._on_(self);
  16817. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{},$globals.Trait)});
  16818. },
  16819. args: [],
  16820. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  16821. referencedClasses: ["TraitTransformation"],
  16822. messageSends: ["on:"]
  16823. }),
  16824. $globals.Trait);
  16825. $core.addMethod(
  16826. $core.method({
  16827. selector: "basicOrganization",
  16828. protocol: "accessing",
  16829. fn: function (){
  16830. var self=this,$self=this;
  16831. return $self["@organization"];
  16832. },
  16833. args: [],
  16834. source: "basicOrganization\x0a\x09^ organization",
  16835. referencedClasses: [],
  16836. messageSends: []
  16837. }),
  16838. $globals.Trait);
  16839. $core.addMethod(
  16840. $core.method({
  16841. selector: "basicOrganization:",
  16842. protocol: "accessing",
  16843. fn: function (aClassOrganizer){
  16844. var self=this,$self=this;
  16845. $self["@organization"]=aClassOrganizer;
  16846. return self;
  16847. },
  16848. args: ["aClassOrganizer"],
  16849. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  16850. referencedClasses: [],
  16851. messageSends: []
  16852. }),
  16853. $globals.Trait);
  16854. $core.addMethod(
  16855. $core.method({
  16856. selector: "basicPackage:",
  16857. protocol: "accessing",
  16858. fn: function (aPackage){
  16859. var self=this,$self=this;
  16860. $self["@package"]=aPackage;
  16861. return self;
  16862. },
  16863. args: ["aPackage"],
  16864. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  16865. referencedClasses: [],
  16866. messageSends: []
  16867. }),
  16868. $globals.Trait);
  16869. $core.addMethod(
  16870. $core.method({
  16871. selector: "classTag",
  16872. protocol: "accessing",
  16873. fn: function (){
  16874. var self=this,$self=this;
  16875. return "trait";
  16876. },
  16877. args: [],
  16878. source: "classTag\x0a\x09^ 'trait'",
  16879. referencedClasses: [],
  16880. messageSends: []
  16881. }),
  16882. $globals.Trait);
  16883. $core.addMethod(
  16884. $core.method({
  16885. selector: "definition",
  16886. protocol: "accessing",
  16887. fn: function (){
  16888. var self=this,$self=this;
  16889. return $core.withContext(function($ctx1) {
  16890. var $1;
  16891. return $recv($globals.String)._streamContents_((function(stream){
  16892. return $core.withContext(function($ctx2) {
  16893. $recv(stream)._write_("Trait named: ");
  16894. $ctx2.sendIdx["write:"]=1;
  16895. $recv(stream)._printSymbol_($self._name());
  16896. $recv(stream)._lf();
  16897. $ctx2.sendIdx["lf"]=1;
  16898. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  16899. return $core.withContext(function($ctx3) {
  16900. $1=$recv($globals.String)._tab();
  16901. $ctx3.sendIdx["tab"]=1;
  16902. return [$1,"uses: ",tcd,$recv($globals.String)._lf()];
  16903. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  16904. })));
  16905. $ctx2.sendIdx["write:"]=2;
  16906. $recv(stream)._tab();
  16907. $recv(stream)._write_("package: ");
  16908. return $recv(stream)._print_($self._category());
  16909. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16910. }));
  16911. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Trait)});
  16912. },
  16913. args: [],
  16914. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: 'Trait named: '; printSymbol: self name; lf;\x0a\x09\x09write: (self traitCompositionDefinition ifNotEmpty: [ :tcd | { String tab. 'uses: '. tcd. String lf }]);\x0a\x09\x09tab; write: 'package: '; print: self category ]",
  16915. referencedClasses: ["String"],
  16916. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  16917. }),
  16918. $globals.Trait);
  16919. $core.addMethod(
  16920. $core.method({
  16921. selector: "package",
  16922. protocol: "accessing",
  16923. fn: function (){
  16924. var self=this,$self=this;
  16925. return $self["@package"];
  16926. },
  16927. args: [],
  16928. source: "package\x0a\x09^ package",
  16929. referencedClasses: [],
  16930. messageSends: []
  16931. }),
  16932. $globals.Trait);
  16933. $core.addMethod(
  16934. $core.method({
  16935. selector: "theMetaClass",
  16936. protocol: "accessing",
  16937. fn: function (){
  16938. var self=this,$self=this;
  16939. return nil;
  16940. },
  16941. args: [],
  16942. source: "theMetaClass\x0a\x09^ nil",
  16943. referencedClasses: [],
  16944. messageSends: []
  16945. }),
  16946. $globals.Trait);
  16947. $core.addMethod(
  16948. $core.method({
  16949. selector: "traitUsers",
  16950. protocol: "accessing",
  16951. fn: function (){
  16952. var self=this,$self=this;
  16953. return $core.withContext(function($ctx1) {
  16954. return $recv($self._basicAt_("traitUsers"))._copy();
  16955. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{},$globals.Trait)});
  16956. },
  16957. args: [],
  16958. source: "traitUsers\x0a\x09^ (self basicAt: 'traitUsers') copy",
  16959. referencedClasses: [],
  16960. messageSends: ["copy", "basicAt:"]
  16961. }),
  16962. $globals.Trait);
  16963. $core.addMethod(
  16964. $core.method({
  16965. selector: "named:package:",
  16966. protocol: "instance creation",
  16967. fn: function (aString,anotherString){
  16968. var self=this,$self=this;
  16969. return $core.withContext(function($ctx1) {
  16970. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  16971. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString},$globals.Trait.a$cls)});
  16972. },
  16973. args: ["aString", "anotherString"],
  16974. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  16975. referencedClasses: ["ClassBuilder"],
  16976. messageSends: ["addTraitNamed:package:", "new"]
  16977. }),
  16978. $globals.Trait.a$cls);
  16979. $core.addMethod(
  16980. $core.method({
  16981. selector: "named:uses:package:",
  16982. protocol: "instance creation",
  16983. fn: function (aString,aTraitCompositionDescription,anotherString){
  16984. var self=this,$self=this;
  16985. var trait;
  16986. return $core.withContext(function($ctx1) {
  16987. trait=$self._named_package_(aString,anotherString);
  16988. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  16989. return trait;
  16990. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait},$globals.Trait.a$cls)});
  16991. },
  16992. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  16993. source: "named: aString uses: aTraitCompositionDescription package: anotherString\x0a\x09| trait |\x0a\x09trait := self named: aString package: anotherString.\x0a\x09trait setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ trait",
  16994. referencedClasses: [],
  16995. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  16996. }),
  16997. $globals.Trait.a$cls);
  16998. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  16999. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  17000. $core.addMethod(
  17001. $core.method({
  17002. selector: "-",
  17003. protocol: "composition",
  17004. fn: function (anArray){
  17005. var self=this,$self=this;
  17006. return $core.withContext(function($ctx1) {
  17007. var $1;
  17008. $1=$self._copy();
  17009. $recv($1)._addExclusions_(anArray);
  17010. return $recv($1)._yourself();
  17011. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.TraitTransformation)});
  17012. },
  17013. args: ["anArray"],
  17014. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  17015. referencedClasses: [],
  17016. messageSends: ["addExclusions:", "copy", "yourself"]
  17017. }),
  17018. $globals.TraitTransformation);
  17019. $core.addMethod(
  17020. $core.method({
  17021. selector: "@",
  17022. protocol: "composition",
  17023. fn: function (anArrayOfAssociations){
  17024. var self=this,$self=this;
  17025. return $core.withContext(function($ctx1) {
  17026. var $1;
  17027. $1=$self._copy();
  17028. $recv($1)._addAliases_(anArrayOfAssociations);
  17029. return $recv($1)._yourself();
  17030. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17031. },
  17032. args: ["anArrayOfAssociations"],
  17033. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  17034. referencedClasses: [],
  17035. messageSends: ["addAliases:", "copy", "yourself"]
  17036. }),
  17037. $globals.TraitTransformation);
  17038. $core.addMethod(
  17039. $core.method({
  17040. selector: "addAliases:",
  17041. protocol: "accessing",
  17042. fn: function (anArrayOfAssociations){
  17043. var self=this,$self=this;
  17044. return $core.withContext(function($ctx1) {
  17045. $recv(anArrayOfAssociations)._do_((function(each){
  17046. var key;
  17047. return $core.withContext(function($ctx2) {
  17048. key=$recv(each)._key();
  17049. return $recv($self["@aliases"])._at_ifPresent_ifAbsent_(key,(function(){
  17050. return $core.withContext(function($ctx3) {
  17051. return $self._error_("Cannot use same alias name twice.");
  17052. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17053. }),(function(){
  17054. return $core.withContext(function($ctx3) {
  17055. return $recv($self["@aliases"])._at_put_(key,$recv(each)._value());
  17056. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  17057. }));
  17058. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  17059. }));
  17060. return anArrayOfAssociations;
  17061. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17062. },
  17063. args: ["anArrayOfAssociations"],
  17064. source: "addAliases: anArrayOfAssociations\x0a\x09anArrayOfAssociations do: [ :each |\x0a\x09\x09| key |\x0a\x09\x09key := each key.\x0a\x09\x09aliases at: key\x0a\x09\x09\x09ifPresent: [ self error: 'Cannot use same alias name twice.' ]\x0a\x09\x09\x09ifAbsent: [ aliases at: key put: each value ] ].\x0a\x09^ anArrayOfAssociations",
  17065. referencedClasses: [],
  17066. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  17067. }),
  17068. $globals.TraitTransformation);
  17069. $core.addMethod(
  17070. $core.method({
  17071. selector: "addExclusions:",
  17072. protocol: "accessing",
  17073. fn: function (anArray){
  17074. var self=this,$self=this;
  17075. return $core.withContext(function($ctx1) {
  17076. $recv($self["@exclusions"])._addAll_(anArray);
  17077. return anArray;
  17078. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray},$globals.TraitTransformation)});
  17079. },
  17080. args: ["anArray"],
  17081. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  17082. referencedClasses: [],
  17083. messageSends: ["addAll:"]
  17084. }),
  17085. $globals.TraitTransformation);
  17086. $core.addMethod(
  17087. $core.method({
  17088. selector: "aliases",
  17089. protocol: "accessing",
  17090. fn: function (){
  17091. var self=this,$self=this;
  17092. return $self["@aliases"];
  17093. },
  17094. args: [],
  17095. source: "aliases\x0a\x09^ aliases",
  17096. referencedClasses: [],
  17097. messageSends: []
  17098. }),
  17099. $globals.TraitTransformation);
  17100. $core.addMethod(
  17101. $core.method({
  17102. selector: "asJavaScriptObject",
  17103. protocol: "converting",
  17104. fn: function (){
  17105. var self=this,$self=this;
  17106. return $core.withContext(function($ctx1) {
  17107. return $globals.HashedCollection._newFromPairs_(["trait",$self._trait(),"aliases",$self._aliases(),"exclusions",$recv($recv($self._exclusions())._asArray())._sorted()]);
  17108. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.TraitTransformation)});
  17109. },
  17110. args: [],
  17111. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  17112. referencedClasses: [],
  17113. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  17114. }),
  17115. $globals.TraitTransformation);
  17116. $core.addMethod(
  17117. $core.method({
  17118. selector: "asJavaScriptSource",
  17119. protocol: "converting",
  17120. fn: function (){
  17121. var self=this,$self=this;
  17122. return $core.withContext(function($ctx1) {
  17123. var $2,$3,$1;
  17124. return $recv($globals.String)._streamContents_((function(str){
  17125. return $core.withContext(function($ctx2) {
  17126. $2=$recv($self._trait())._asJavaScriptSource();
  17127. $ctx2.sendIdx["asJavaScriptSource"]=1;
  17128. $3=$recv($self._aliases())._ifNotEmpty_((function(al){
  17129. return $core.withContext(function($ctx3) {
  17130. return [", aliases: ",$recv(al)._asJSONString()];
  17131. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17132. }));
  17133. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17134. $1=["{trait: ",$2,$3,$recv($self._exclusions())._ifNotEmpty_((function(ex){
  17135. return $core.withContext(function($ctx3) {
  17136. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  17137. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  17138. })),"}"];
  17139. return $recv(str)._write_($1);
  17140. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17141. }));
  17142. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TraitTransformation)});
  17143. },
  17144. args: [],
  17145. source: "asJavaScriptSource\x0a\x09^ String streamContents: [ :str | str write: {\x0a\x09\x09'{trait: '. self trait asJavaScriptSource.\x0a\x09\x09self aliases ifNotEmpty: [ :al |\x0a\x09\x09\x09{', aliases: '. al asJSONString} ].\x0a\x09\x09self exclusions ifNotEmpty: [ :ex |\x0a\x09\x09\x09{', exclusions: '. ex asArray sorted asJavaScriptSource} ].\x0a\x09\x09'}' } ]",
  17146. referencedClasses: ["String"],
  17147. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  17148. }),
  17149. $globals.TraitTransformation);
  17150. $core.addMethod(
  17151. $core.method({
  17152. selector: "asTraitComposition",
  17153. protocol: "converting",
  17154. fn: function (){
  17155. var self=this,$self=this;
  17156. return [self];
  17157. },
  17158. args: [],
  17159. source: "asTraitComposition\x0a\x09^ { self }",
  17160. referencedClasses: [],
  17161. messageSends: []
  17162. }),
  17163. $globals.TraitTransformation);
  17164. $core.addMethod(
  17165. $core.method({
  17166. selector: "asTraitTransformation",
  17167. protocol: "converting",
  17168. fn: function (){
  17169. var self=this,$self=this;
  17170. return self;
  17171. },
  17172. args: [],
  17173. source: "asTraitTransformation\x0a\x09^ self",
  17174. referencedClasses: [],
  17175. messageSends: []
  17176. }),
  17177. $globals.TraitTransformation);
  17178. $core.addMethod(
  17179. $core.method({
  17180. selector: "definition",
  17181. protocol: "accessing",
  17182. fn: function (){
  17183. var self=this,$self=this;
  17184. return $core.withContext(function($ctx1) {
  17185. return $recv($globals.String)._streamContents_((function(str){
  17186. return $core.withContext(function($ctx2) {
  17187. $recv(str)._print_($self._trait());
  17188. $recv($self._aliases())._ifNotEmpty_((function(al){
  17189. return $core.withContext(function($ctx3) {
  17190. $recv(str)._write_(" @ {");
  17191. $ctx3.sendIdx["write:"]=1;
  17192. $recv($recv(al)._associations())._do_separatedBy_((function(each){
  17193. return $core.withContext(function($ctx4) {
  17194. $recv(str)._printSymbol_($recv(each)._key());
  17195. $ctx4.sendIdx["printSymbol:"]=1;
  17196. $recv(str)._write_(" -> ");
  17197. $ctx4.sendIdx["write:"]=2;
  17198. return $recv(str)._printSymbol_($recv(each)._value());
  17199. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  17200. }),(function(){
  17201. return $core.withContext(function($ctx4) {
  17202. return $recv(str)._write_(". ");
  17203. $ctx4.sendIdx["write:"]=3;
  17204. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  17205. }));
  17206. $ctx3.sendIdx["do:separatedBy:"]=1;
  17207. return $recv(str)._write_("}");
  17208. $ctx3.sendIdx["write:"]=4;
  17209. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17210. }));
  17211. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17212. return $recv($self._exclusions())._ifNotEmpty_((function(ex){
  17213. return $core.withContext(function($ctx3) {
  17214. $recv(str)._write_(" - #(");
  17215. $ctx3.sendIdx["write:"]=5;
  17216. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  17217. return $core.withContext(function($ctx4) {
  17218. return $recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst());
  17219. $ctx4.sendIdx["write:"]=6;
  17220. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  17221. }),(function(){
  17222. return $core.withContext(function($ctx4) {
  17223. return $recv(str)._space();
  17224. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  17225. }));
  17226. return $recv(str)._write_(")");
  17227. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  17228. }));
  17229. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17230. }));
  17231. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.TraitTransformation)});
  17232. },
  17233. args: [],
  17234. source: "definition\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09str print: self trait.\x0a\x09\x09self aliases ifNotEmpty: [ :al |\x0a\x09\x09\x09str write: ' @ {'.\x0a\x09\x09\x09al associations\x0a\x09\x09\x09\x09do: [ :each | str printSymbol: each key; write: ' -> '; printSymbol: each value ]\x0a\x09\x09\x09\x09separatedBy: [ str write: '. ' ].\x0a\x09\x09\x09str write: '}' ].\x0a\x09\x09self exclusions ifNotEmpty: [ :ex |\x0a\x09\x09\x09str write: ' - #('.\x0a\x09\x09\x09ex asArray sorted \x0a\x09\x09\x09\x09do: [ :each | str write: each symbolPrintString allButFirst ]\x0a\x09\x09\x09\x09separatedBy: [ str space ].\x0a\x09\x09\x09str write: ')' ] ]",
  17235. referencedClasses: ["String"],
  17236. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  17237. }),
  17238. $globals.TraitTransformation);
  17239. $core.addMethod(
  17240. $core.method({
  17241. selector: "exclusions",
  17242. protocol: "accessing",
  17243. fn: function (){
  17244. var self=this,$self=this;
  17245. return $self["@exclusions"];
  17246. },
  17247. args: [],
  17248. source: "exclusions\x0a\x09^ exclusions",
  17249. referencedClasses: [],
  17250. messageSends: []
  17251. }),
  17252. $globals.TraitTransformation);
  17253. $core.addMethod(
  17254. $core.method({
  17255. selector: "initialize",
  17256. protocol: "initialization",
  17257. fn: function (){
  17258. var self=this,$self=this;
  17259. return $core.withContext(function($ctx1) {
  17260. (
  17261. $ctx1.supercall = true,
  17262. ($globals.TraitTransformation.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  17263. $ctx1.supercall = false;
  17264. $self["@aliases"]=$globals.HashedCollection._newFromPairs_([]);
  17265. $self["@exclusions"]=$recv($globals.Set)._new();
  17266. $self["@trait"]=nil;
  17267. return self;
  17268. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TraitTransformation)});
  17269. },
  17270. args: [],
  17271. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  17272. referencedClasses: ["Set"],
  17273. messageSends: ["initialize", "new"]
  17274. }),
  17275. $globals.TraitTransformation);
  17276. $core.addMethod(
  17277. $core.method({
  17278. selector: "postCopy",
  17279. protocol: "copying",
  17280. fn: function (){
  17281. var self=this,$self=this;
  17282. return $core.withContext(function($ctx1) {
  17283. $self["@aliases"]=$recv($self["@aliases"])._copy();
  17284. $ctx1.sendIdx["copy"]=1;
  17285. $self["@exclusions"]=$recv($self["@exclusions"])._copy();
  17286. return self;
  17287. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.TraitTransformation)});
  17288. },
  17289. args: [],
  17290. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  17291. referencedClasses: [],
  17292. messageSends: ["copy"]
  17293. }),
  17294. $globals.TraitTransformation);
  17295. $core.addMethod(
  17296. $core.method({
  17297. selector: "trait",
  17298. protocol: "accessing",
  17299. fn: function (){
  17300. var self=this,$self=this;
  17301. return $self["@trait"];
  17302. },
  17303. args: [],
  17304. source: "trait\x0a\x09^ trait",
  17305. referencedClasses: [],
  17306. messageSends: []
  17307. }),
  17308. $globals.TraitTransformation);
  17309. $core.addMethod(
  17310. $core.method({
  17311. selector: "trait:",
  17312. protocol: "accessing",
  17313. fn: function (anObject){
  17314. var self=this,$self=this;
  17315. $self["@trait"]=anObject;
  17316. return self;
  17317. },
  17318. args: ["anObject"],
  17319. source: "trait: anObject\x0a\x09trait := anObject",
  17320. referencedClasses: [],
  17321. messageSends: []
  17322. }),
  17323. $globals.TraitTransformation);
  17324. $core.addMethod(
  17325. $core.method({
  17326. selector: "fromJSON:",
  17327. protocol: "instance creation",
  17328. fn: function (aJSObject){
  17329. var self=this,$self=this;
  17330. return $core.withContext(function($ctx1) {
  17331. var $1,$4,$3,$2;
  17332. $1=(
  17333. $ctx1.supercall = true,
  17334. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17335. $ctx1.supercall = false;
  17336. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  17337. $4=$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  17338. return $globals.HashedCollection._newFromPairs_([]);
  17339. }));
  17340. $ctx1.sendIdx["at:ifAbsent:"]=1;
  17341. $3=$recv($globals.Smalltalk)._readJSObject_($4);
  17342. $2=$recv($3)._associations();
  17343. $recv($1)._addAliases_($2);
  17344. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  17345. return [];
  17346. })));
  17347. return $recv($1)._yourself();
  17348. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject},$globals.TraitTransformation.a$cls)});
  17349. },
  17350. args: ["aJSObject"],
  17351. source: "fromJSON: aJSObject\x0a\x09^ super new\x0a\x09\x09trait: (aJSObject at: #trait);\x0a\x09\x09addAliases: (Smalltalk readJSObject: (aJSObject at: #aliases ifAbsent: [#{}])) associations;\x0a\x09\x09addExclusions: (aJSObject at: #exclusions ifAbsent: [#()]);\x0a\x09\x09yourself",
  17352. referencedClasses: ["Smalltalk"],
  17353. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  17354. }),
  17355. $globals.TraitTransformation.a$cls);
  17356. $core.addMethod(
  17357. $core.method({
  17358. selector: "on:",
  17359. protocol: "instance creation",
  17360. fn: function (aTrait){
  17361. var self=this,$self=this;
  17362. return $core.withContext(function($ctx1) {
  17363. var $1;
  17364. $1=(
  17365. $ctx1.supercall = true,
  17366. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17367. $ctx1.supercall = false;
  17368. $recv($1)._trait_(aTrait);
  17369. return $recv($1)._yourself();
  17370. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait},$globals.TraitTransformation.a$cls)});
  17371. },
  17372. args: ["aTrait"],
  17373. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  17374. referencedClasses: [],
  17375. messageSends: ["trait:", "new", "yourself"]
  17376. }),
  17377. $globals.TraitTransformation.a$cls);
  17378. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}], $globals.Behavior);
  17379. $core.setTraitComposition([{trait: $globals.TMasterBehavior}, {trait: $globals.TSubclassable}], $globals.Class);
  17380. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}, {trait: $globals.TMasterBehavior}], $globals.Trait);
  17381. $core.addMethod(
  17382. $core.method({
  17383. selector: "asTraitComposition",
  17384. protocol: "*Kernel-Classes",
  17385. fn: function (){
  17386. var self=this,$self=this;
  17387. return $core.withContext(function($ctx1) {
  17388. return $self._collect_((function(each){
  17389. return $core.withContext(function($ctx2) {
  17390. return $recv(each)._asTraitTransformation();
  17391. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17392. }));
  17393. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Array)});
  17394. },
  17395. args: [],
  17396. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  17397. referencedClasses: [],
  17398. messageSends: ["collect:", "asTraitTransformation"]
  17399. }),
  17400. $globals.Array);
  17401. });
  17402. define('amber_core/Kernel-Methods',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17403. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  17404. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17405. var $pkg = $core.addPackage("Kernel-Methods");
  17406. $pkg.innerEval = function (expr) { return eval(expr); };
  17407. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  17408. $core.addClass("BlockClosure", $globals.Object, [], "Kernel-Methods");
  17409. $globals.BlockClosure.comment="I represent a lexical closure.\x0aI am is directly mapped to JavaScript Function.\x0a\x0a## API\x0a\x0a1. Evaluation\x0a\x0a My instances get evaluated with the `#value*` methods in the 'evaluating' protocol.\x0a\x0a Example: ` [ :x | x + 1 ] value: 3 \x22Answers 4\x22 `\x0a\x0a2. Control structures\x0a\x0a Blocks are used (together with `Boolean`) for control structures (methods in the `controlling` protocol).\x0a\x0a Example: `aBlock whileTrue: [ ... ]`\x0a\x0a3. Error handling\x0a\x0a I provide the `#on:do:` method for handling exceptions.\x0a\x0a Example: ` aBlock on: MessageNotUnderstood do: [ :ex | ... ] `";
  17410. $core.addMethod(
  17411. $core.method({
  17412. selector: "applyTo:arguments:",
  17413. protocol: "evaluating",
  17414. fn: function (anObject,aCollection){
  17415. var self=this,$self=this;
  17416. return $core.withContext(function($ctx1) {
  17417. return self.apply(anObject, aCollection);
  17418. return self;
  17419. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  17420. },
  17421. args: ["anObject", "aCollection"],
  17422. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  17423. referencedClasses: [],
  17424. messageSends: []
  17425. }),
  17426. $globals.BlockClosure);
  17427. $core.addMethod(
  17428. $core.method({
  17429. selector: "asCompiledMethod:",
  17430. protocol: "converting",
  17431. fn: function (aString){
  17432. var self=this,$self=this;
  17433. return $core.withContext(function($ctx1) {
  17434. return $core.method({selector:aString, fn:self});;
  17435. return self;
  17436. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  17437. },
  17438. args: ["aString"],
  17439. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  17440. referencedClasses: [],
  17441. messageSends: []
  17442. }),
  17443. $globals.BlockClosure);
  17444. $core.addMethod(
  17445. $core.method({
  17446. selector: "compiledSource",
  17447. protocol: "accessing",
  17448. fn: function (){
  17449. var self=this,$self=this;
  17450. return $core.withContext(function($ctx1) {
  17451. return self.toString();
  17452. return self;
  17453. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  17454. },
  17455. args: [],
  17456. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  17457. referencedClasses: [],
  17458. messageSends: []
  17459. }),
  17460. $globals.BlockClosure);
  17461. $core.addMethod(
  17462. $core.method({
  17463. selector: "currySelf",
  17464. protocol: "converting",
  17465. fn: function (){
  17466. var self=this,$self=this;
  17467. return $core.withContext(function($ctx1) {
  17468. return function () {
  17469. var args = [ this ];
  17470. args.push.apply(args, arguments);
  17471. return self.apply(null, args);
  17472. }
  17473. ;
  17474. return self;
  17475. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  17476. },
  17477. args: [],
  17478. source: "currySelf\x0a\x09\x22Transforms [ :selfarg :x :y | stcode ] block\x0a\x09which represents JS function (selfarg, x, y, ...) {jscode}\x0a\x09into function (x, y, ...) {jscode} that takes selfarg from 'this'.\x0a\x09IOW, it is usable as JS method and first arg takes the receiver.\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09return function () {\x0a\x09\x09\x09var args = [ this ];\x0a\x09\x09\x09args.push.apply(args, arguments);\x0a\x09\x09\x09return self.apply(null, args);\x0a\x09\x09}\x0a\x09'>",
  17479. referencedClasses: [],
  17480. messageSends: []
  17481. }),
  17482. $globals.BlockClosure);
  17483. $core.addMethod(
  17484. $core.method({
  17485. selector: "ensure:",
  17486. protocol: "evaluating",
  17487. fn: function (aBlock){
  17488. var self=this,$self=this;
  17489. return $core.withContext(function($ctx1) {
  17490. try{return $self._value()}finally{aBlock._value()};
  17491. return self;
  17492. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  17493. },
  17494. args: ["aBlock"],
  17495. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return $self._value()}finally{aBlock._value()}'>",
  17496. referencedClasses: [],
  17497. messageSends: []
  17498. }),
  17499. $globals.BlockClosure);
  17500. $core.addMethod(
  17501. $core.method({
  17502. selector: "fork",
  17503. protocol: "timeout/interval",
  17504. fn: function (){
  17505. var self=this,$self=this;
  17506. return $core.withContext(function($ctx1) {
  17507. $recv($recv($globals.ForkPool)._default())._fork_(self);
  17508. return self;
  17509. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  17510. },
  17511. args: [],
  17512. source: "fork\x0a\x09ForkPool default fork: self",
  17513. referencedClasses: ["ForkPool"],
  17514. messageSends: ["fork:", "default"]
  17515. }),
  17516. $globals.BlockClosure);
  17517. $core.addMethod(
  17518. $core.method({
  17519. selector: "new",
  17520. protocol: "evaluating",
  17521. fn: function (){
  17522. var self=this,$self=this;
  17523. return $core.withContext(function($ctx1) {
  17524. return new self();
  17525. return self;
  17526. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  17527. },
  17528. args: [],
  17529. source: "new\x0a\x09\x22Use the receiver as a JS constructor.\x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<inlineJS: 'return new self()'>",
  17530. referencedClasses: [],
  17531. messageSends: []
  17532. }),
  17533. $globals.BlockClosure);
  17534. $core.addMethod(
  17535. $core.method({
  17536. selector: "newValue:",
  17537. protocol: "evaluating",
  17538. fn: function (anObject){
  17539. var self=this,$self=this;
  17540. return $core.withContext(function($ctx1) {
  17541. return $self._newWithValues_([anObject]);
  17542. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  17543. },
  17544. args: ["anObject"],
  17545. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  17546. referencedClasses: [],
  17547. messageSends: ["newWithValues:"]
  17548. }),
  17549. $globals.BlockClosure);
  17550. $core.addMethod(
  17551. $core.method({
  17552. selector: "newValue:value:",
  17553. protocol: "evaluating",
  17554. fn: function (anObject,anObject2){
  17555. var self=this,$self=this;
  17556. return $core.withContext(function($ctx1) {
  17557. return $self._newWithValues_([anObject,anObject2]);
  17558. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  17559. },
  17560. args: ["anObject", "anObject2"],
  17561. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  17562. referencedClasses: [],
  17563. messageSends: ["newWithValues:"]
  17564. }),
  17565. $globals.BlockClosure);
  17566. $core.addMethod(
  17567. $core.method({
  17568. selector: "newValue:value:value:",
  17569. protocol: "evaluating",
  17570. fn: function (anObject,anObject2,anObject3){
  17571. var self=this,$self=this;
  17572. return $core.withContext(function($ctx1) {
  17573. return $self._newWithValues_([anObject,anObject2,anObject3]);
  17574. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  17575. },
  17576. args: ["anObject", "anObject2", "anObject3"],
  17577. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  17578. referencedClasses: [],
  17579. messageSends: ["newWithValues:"]
  17580. }),
  17581. $globals.BlockClosure);
  17582. $core.addMethod(
  17583. $core.method({
  17584. selector: "newWithValues:",
  17585. protocol: "evaluating",
  17586. fn: function (aCollection){
  17587. var self=this,$self=this;
  17588. return $core.withContext(function($ctx1) {
  17589. var object = Object.create(self.prototype);
  17590. var result = self.apply(object, aCollection);
  17591. return typeof result === "object" ? result : object;
  17592. ;
  17593. return self;
  17594. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  17595. },
  17596. args: ["aCollection"],
  17597. source: "newWithValues: aCollection\x0a\x09\x22Simulates JS new operator by combination of Object.create and .apply\x22\x0a\x09<inlineJS: '\x0a\x09\x09var object = Object.create(self.prototype);\x0a\x09\x09var result = self.apply(object, aCollection);\x0a\x09\x09return typeof result === \x22object\x22 ? result : object;\x0a\x09'>",
  17598. referencedClasses: [],
  17599. messageSends: []
  17600. }),
  17601. $globals.BlockClosure);
  17602. $core.addMethod(
  17603. $core.method({
  17604. selector: "numArgs",
  17605. protocol: "accessing",
  17606. fn: function (){
  17607. var self=this,$self=this;
  17608. return $core.withContext(function($ctx1) {
  17609. return self.length;
  17610. return self;
  17611. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  17612. },
  17613. args: [],
  17614. source: "numArgs\x0a\x09<inlineJS: 'return self.length'>",
  17615. referencedClasses: [],
  17616. messageSends: []
  17617. }),
  17618. $globals.BlockClosure);
  17619. $core.addMethod(
  17620. $core.method({
  17621. selector: "on:do:",
  17622. protocol: "error handling",
  17623. fn: function (anErrorClass,aBlock){
  17624. var self=this,$self=this;
  17625. return $core.withContext(function($ctx1) {
  17626. var $1;
  17627. return $self._tryCatch_((function(error){
  17628. var smalltalkError;
  17629. return $core.withContext(function($ctx2) {
  17630. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  17631. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  17632. if($core.assert($1)){
  17633. return $recv(aBlock)._value_(smalltalkError);
  17634. } else {
  17635. return $recv(smalltalkError)._pass();
  17636. }
  17637. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  17638. }));
  17639. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  17640. },
  17641. args: ["anErrorClass", "aBlock"],
  17642. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError pass ] ]",
  17643. referencedClasses: ["Smalltalk"],
  17644. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "pass"]
  17645. }),
  17646. $globals.BlockClosure);
  17647. $core.addMethod(
  17648. $core.method({
  17649. selector: "provided",
  17650. protocol: "converting",
  17651. fn: function (){
  17652. var self=this,$self=this;
  17653. return $core.withContext(function($ctx1) {
  17654. return $recv($globals.JSObjectProxy)._on_(self);
  17655. }, function($ctx1) {$ctx1.fill(self,"provided",{},$globals.BlockClosure)});
  17656. },
  17657. args: [],
  17658. source: "provided\x0a\x09\x22Returns JS proxy that allows to access 'static API', as in\x0a\x09 require provided resolve: ...\x0a\x09or\x0a\x09 XMLHttpRequest provided DONE\x22\x0a\x09\x0a\x09^ JSObjectProxy on: self",
  17659. referencedClasses: ["JSObjectProxy"],
  17660. messageSends: ["on:"]
  17661. }),
  17662. $globals.BlockClosure);
  17663. $core.addMethod(
  17664. $core.method({
  17665. selector: "receiver",
  17666. protocol: "accessing",
  17667. fn: function (){
  17668. var self=this,$self=this;
  17669. return nil;
  17670. },
  17671. args: [],
  17672. source: "receiver\x0a\x09^ nil",
  17673. referencedClasses: [],
  17674. messageSends: []
  17675. }),
  17676. $globals.BlockClosure);
  17677. $core.addMethod(
  17678. $core.method({
  17679. selector: "timeToRun",
  17680. protocol: "evaluating",
  17681. fn: function (){
  17682. var self=this,$self=this;
  17683. return $core.withContext(function($ctx1) {
  17684. return $recv($globals.Date)._millisecondsToRun_(self);
  17685. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  17686. },
  17687. args: [],
  17688. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  17689. referencedClasses: ["Date"],
  17690. messageSends: ["millisecondsToRun:"]
  17691. }),
  17692. $globals.BlockClosure);
  17693. $core.addMethod(
  17694. $core.method({
  17695. selector: "tryCatch:",
  17696. protocol: "error handling",
  17697. fn: function (aBlock){
  17698. var self=this,$self=this;
  17699. return $core.withContext(function($ctx1) {
  17700. try {
  17701. return $self._value();
  17702. } catch(error) {
  17703. // pass non-local returns undetected
  17704. if (Array.isArray(error) && error.length === 1) throw error;
  17705. return aBlock._value_(error);
  17706. }
  17707. ;
  17708. return self;
  17709. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  17710. },
  17711. args: ["aBlock"],
  17712. source: "tryCatch: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09try {\x0a\x09\x09\x09return $self._value();\x0a\x09\x09} catch(error) {\x0a\x09\x09\x09// pass non-local returns undetected\x0a\x09\x09\x09if (Array.isArray(error) && error.length === 1) throw error;\x0a\x09\x09\x09return aBlock._value_(error);\x0a\x09\x09}\x0a\x09'>",
  17713. referencedClasses: [],
  17714. messageSends: []
  17715. }),
  17716. $globals.BlockClosure);
  17717. $core.addMethod(
  17718. $core.method({
  17719. selector: "value",
  17720. protocol: "evaluating",
  17721. fn: function (){
  17722. var self=this,$self=this;
  17723. return $core.withContext(function($ctx1) {
  17724. return self();;
  17725. return self;
  17726. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  17727. },
  17728. args: [],
  17729. source: "value\x0a\x09<inlineJS: 'return self();'>",
  17730. referencedClasses: [],
  17731. messageSends: []
  17732. }),
  17733. $globals.BlockClosure);
  17734. $core.addMethod(
  17735. $core.method({
  17736. selector: "value:",
  17737. protocol: "evaluating",
  17738. fn: function (anArg){
  17739. var self=this,$self=this;
  17740. return $core.withContext(function($ctx1) {
  17741. return self(anArg);;
  17742. return self;
  17743. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  17744. },
  17745. args: ["anArg"],
  17746. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  17747. referencedClasses: [],
  17748. messageSends: []
  17749. }),
  17750. $globals.BlockClosure);
  17751. $core.addMethod(
  17752. $core.method({
  17753. selector: "value:value:",
  17754. protocol: "evaluating",
  17755. fn: function (firstArg,secondArg){
  17756. var self=this,$self=this;
  17757. return $core.withContext(function($ctx1) {
  17758. return self(firstArg, secondArg);;
  17759. return self;
  17760. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  17761. },
  17762. args: ["firstArg", "secondArg"],
  17763. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  17764. referencedClasses: [],
  17765. messageSends: []
  17766. }),
  17767. $globals.BlockClosure);
  17768. $core.addMethod(
  17769. $core.method({
  17770. selector: "value:value:value:",
  17771. protocol: "evaluating",
  17772. fn: function (firstArg,secondArg,thirdArg){
  17773. var self=this,$self=this;
  17774. return $core.withContext(function($ctx1) {
  17775. return self(firstArg, secondArg, thirdArg);;
  17776. return self;
  17777. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  17778. },
  17779. args: ["firstArg", "secondArg", "thirdArg"],
  17780. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  17781. referencedClasses: [],
  17782. messageSends: []
  17783. }),
  17784. $globals.BlockClosure);
  17785. $core.addMethod(
  17786. $core.method({
  17787. selector: "valueWithInterval:",
  17788. protocol: "timeout/interval",
  17789. fn: function (aNumber){
  17790. var self=this,$self=this;
  17791. return $core.withContext(function($ctx1) {
  17792. var interval = setInterval(self, aNumber);
  17793. return $globals.Timeout._on_(interval);
  17794. ;
  17795. return self;
  17796. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  17797. },
  17798. args: ["aNumber"],
  17799. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  17800. referencedClasses: [],
  17801. messageSends: []
  17802. }),
  17803. $globals.BlockClosure);
  17804. $core.addMethod(
  17805. $core.method({
  17806. selector: "valueWithPossibleArguments:",
  17807. protocol: "evaluating",
  17808. fn: function (aCollection){
  17809. var self=this,$self=this;
  17810. return $core.withContext(function($ctx1) {
  17811. return self.apply(null, aCollection);;
  17812. return self;
  17813. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  17814. },
  17815. args: ["aCollection"],
  17816. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  17817. referencedClasses: [],
  17818. messageSends: []
  17819. }),
  17820. $globals.BlockClosure);
  17821. $core.addMethod(
  17822. $core.method({
  17823. selector: "valueWithTimeout:",
  17824. protocol: "timeout/interval",
  17825. fn: function (aNumber){
  17826. var self=this,$self=this;
  17827. return $core.withContext(function($ctx1) {
  17828. var timeout = setTimeout(self, aNumber);
  17829. return $globals.Timeout._on_(timeout);
  17830. ;
  17831. return self;
  17832. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  17833. },
  17834. args: ["aNumber"],
  17835. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  17836. referencedClasses: [],
  17837. messageSends: []
  17838. }),
  17839. $globals.BlockClosure);
  17840. $core.addMethod(
  17841. $core.method({
  17842. selector: "whileFalse",
  17843. protocol: "controlling",
  17844. fn: function (){
  17845. var self=this,$self=this;
  17846. return $core.withContext(function($ctx1) {
  17847. $self._whileFalse_((function(){
  17848. }));
  17849. return self;
  17850. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  17851. },
  17852. args: [],
  17853. source: "whileFalse\x0a\x09self whileFalse: []",
  17854. referencedClasses: [],
  17855. messageSends: ["whileFalse:"]
  17856. }),
  17857. $globals.BlockClosure);
  17858. $core.addMethod(
  17859. $core.method({
  17860. selector: "whileFalse:",
  17861. protocol: "controlling",
  17862. fn: function (aBlock){
  17863. var self=this,$self=this;
  17864. return $core.withContext(function($ctx1) {
  17865. while(!$core.assert($self._value())) {aBlock._value()};
  17866. return self;
  17867. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  17868. },
  17869. args: ["aBlock"],
  17870. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert($self._value())) {aBlock._value()}'>",
  17871. referencedClasses: [],
  17872. messageSends: []
  17873. }),
  17874. $globals.BlockClosure);
  17875. $core.addMethod(
  17876. $core.method({
  17877. selector: "whileTrue",
  17878. protocol: "controlling",
  17879. fn: function (){
  17880. var self=this,$self=this;
  17881. return $core.withContext(function($ctx1) {
  17882. $self._whileTrue_((function(){
  17883. }));
  17884. return self;
  17885. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  17886. },
  17887. args: [],
  17888. source: "whileTrue\x0a\x09self whileTrue: []",
  17889. referencedClasses: [],
  17890. messageSends: ["whileTrue:"]
  17891. }),
  17892. $globals.BlockClosure);
  17893. $core.addMethod(
  17894. $core.method({
  17895. selector: "whileTrue:",
  17896. protocol: "controlling",
  17897. fn: function (aBlock){
  17898. var self=this,$self=this;
  17899. return $core.withContext(function($ctx1) {
  17900. while($core.assert($self._value())) {aBlock._value()};
  17901. return self;
  17902. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  17903. },
  17904. args: ["aBlock"],
  17905. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert($self._value())) {aBlock._value()}'>",
  17906. referencedClasses: [],
  17907. messageSends: []
  17908. }),
  17909. $globals.BlockClosure);
  17910. $core.addClass("CompiledMethod", $globals.Object, [], "Kernel-Methods");
  17911. $globals.CompiledMethod.comment="I represent a class method of the system. I hold the source and compiled code of a class method.\x0a\x0a## API\x0aMy instances can be accessed using `Behavior >> #methodAt:`\x0a\x0a Object methodAt: 'asString'\x0a\x0aSource code access:\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aReferenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aMessages sent from an instance:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends";
  17912. $core.addMethod(
  17913. $core.method({
  17914. selector: "arguments",
  17915. protocol: "accessing",
  17916. fn: function (){
  17917. var self=this,$self=this;
  17918. return $core.withContext(function($ctx1) {
  17919. return self.args || [];
  17920. return self;
  17921. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  17922. },
  17923. args: [],
  17924. source: "arguments\x0a\x09<inlineJS: 'return self.args || []'>",
  17925. referencedClasses: [],
  17926. messageSends: []
  17927. }),
  17928. $globals.CompiledMethod);
  17929. $core.addMethod(
  17930. $core.method({
  17931. selector: "browse",
  17932. protocol: "browsing",
  17933. fn: function (){
  17934. var self=this,$self=this;
  17935. return $core.withContext(function($ctx1) {
  17936. $recv($globals.Finder)._findMethod_(self);
  17937. return self;
  17938. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  17939. },
  17940. args: [],
  17941. source: "browse\x0a\x09Finder findMethod: self",
  17942. referencedClasses: ["Finder"],
  17943. messageSends: ["findMethod:"]
  17944. }),
  17945. $globals.CompiledMethod);
  17946. $core.addMethod(
  17947. $core.method({
  17948. selector: "category",
  17949. protocol: "accessing",
  17950. fn: function (){
  17951. var self=this,$self=this;
  17952. return $core.withContext(function($ctx1) {
  17953. return $self._protocol();
  17954. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  17955. },
  17956. args: [],
  17957. source: "category\x0a\x09^ self protocol",
  17958. referencedClasses: [],
  17959. messageSends: ["protocol"]
  17960. }),
  17961. $globals.CompiledMethod);
  17962. $core.addMethod(
  17963. $core.method({
  17964. selector: "defaultProtocol",
  17965. protocol: "defaults",
  17966. fn: function (){
  17967. var self=this,$self=this;
  17968. return "as yet unclassified";
  17969. },
  17970. args: [],
  17971. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  17972. referencedClasses: [],
  17973. messageSends: []
  17974. }),
  17975. $globals.CompiledMethod);
  17976. $core.addMethod(
  17977. $core.method({
  17978. selector: "fn",
  17979. protocol: "accessing",
  17980. fn: function (){
  17981. var self=this,$self=this;
  17982. return $core.withContext(function($ctx1) {
  17983. return $self._basicAt_("fn");
  17984. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  17985. },
  17986. args: [],
  17987. source: "fn\x0a\x09^ self basicAt: 'fn'",
  17988. referencedClasses: [],
  17989. messageSends: ["basicAt:"]
  17990. }),
  17991. $globals.CompiledMethod);
  17992. $core.addMethod(
  17993. $core.method({
  17994. selector: "fn:",
  17995. protocol: "accessing",
  17996. fn: function (aBlock){
  17997. var self=this,$self=this;
  17998. return $core.withContext(function($ctx1) {
  17999. $self._basicAt_put_("fn",aBlock);
  18000. return self;
  18001. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  18002. },
  18003. args: ["aBlock"],
  18004. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  18005. referencedClasses: [],
  18006. messageSends: ["basicAt:put:"]
  18007. }),
  18008. $globals.CompiledMethod);
  18009. $core.addMethod(
  18010. $core.method({
  18011. selector: "isCompiledMethod",
  18012. protocol: "testing",
  18013. fn: function (){
  18014. var self=this,$self=this;
  18015. return true;
  18016. },
  18017. args: [],
  18018. source: "isCompiledMethod\x0a\x09^ true",
  18019. referencedClasses: [],
  18020. messageSends: []
  18021. }),
  18022. $globals.CompiledMethod);
  18023. $core.addMethod(
  18024. $core.method({
  18025. selector: "isOverridden",
  18026. protocol: "testing",
  18027. fn: function (){
  18028. var self=this,$self=this;
  18029. var selector;
  18030. return $core.withContext(function($ctx1) {
  18031. var $1;
  18032. var $early={};
  18033. try {
  18034. selector=$self._selector();
  18035. $recv($self._methodClass())._allSubclassesDo_((function(each){
  18036. return $core.withContext(function($ctx2) {
  18037. $1=$recv(each)._includesSelector_(selector);
  18038. if($core.assert($1)){
  18039. throw $early=[true];
  18040. }
  18041. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18042. }));
  18043. return false;
  18044. }
  18045. catch(e) {if(e===$early)return e[0]; throw e}
  18046. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  18047. },
  18048. args: [],
  18049. source: "isOverridden\x0a\x09| selector |\x0a \x0a selector := self selector.\x0a self methodClass allSubclassesDo: [ :each |\x0a\x09 (each includesSelector: selector)\x0a \x09ifTrue: [ ^ true ] ].\x0a\x09^ false",
  18050. referencedClasses: [],
  18051. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  18052. }),
  18053. $globals.CompiledMethod);
  18054. $core.addMethod(
  18055. $core.method({
  18056. selector: "isOverride",
  18057. protocol: "testing",
  18058. fn: function (){
  18059. var self=this,$self=this;
  18060. var superclass;
  18061. return $core.withContext(function($ctx1) {
  18062. var $1,$2,$receiver;
  18063. $1=$self._methodClass();
  18064. $ctx1.sendIdx["methodClass"]=1;
  18065. superclass=$recv($1)._superclass();
  18066. $ctx1.sendIdx["superclass"]=1;
  18067. $2=superclass;
  18068. if(($receiver = $2) == null || $receiver.a$nil){
  18069. return false;
  18070. } else {
  18071. $2;
  18072. }
  18073. return $recv($recv($recv($self._methodClass())._superclass())._lookupSelector_($self._selector()))._notNil();
  18074. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  18075. },
  18076. args: [],
  18077. source: "isOverride\x0a\x09| superclass |\x0a \x0a superclass := self methodClass superclass.\x0a\x09superclass ifNil: [ ^ false ].\x0a\x09\x0a ^ (self methodClass superclass lookupSelector: self selector) notNil",
  18078. referencedClasses: [],
  18079. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  18080. }),
  18081. $globals.CompiledMethod);
  18082. $core.addMethod(
  18083. $core.method({
  18084. selector: "messageSends",
  18085. protocol: "accessing",
  18086. fn: function (){
  18087. var self=this,$self=this;
  18088. return $core.withContext(function($ctx1) {
  18089. return $self._basicAt_("messageSends");
  18090. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  18091. },
  18092. args: [],
  18093. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  18094. referencedClasses: [],
  18095. messageSends: ["basicAt:"]
  18096. }),
  18097. $globals.CompiledMethod);
  18098. $core.addMethod(
  18099. $core.method({
  18100. selector: "methodClass",
  18101. protocol: "accessing",
  18102. fn: function (){
  18103. var self=this,$self=this;
  18104. return $core.withContext(function($ctx1) {
  18105. return $self._basicAt_("owner");
  18106. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  18107. },
  18108. args: [],
  18109. source: "methodClass\x0a\x09^ self basicAt: 'owner'",
  18110. referencedClasses: [],
  18111. messageSends: ["basicAt:"]
  18112. }),
  18113. $globals.CompiledMethod);
  18114. $core.addMethod(
  18115. $core.method({
  18116. selector: "package",
  18117. protocol: "accessing",
  18118. fn: function (){
  18119. var self=this,$self=this;
  18120. return $core.withContext(function($ctx1) {
  18121. var $1,$receiver;
  18122. $1=$self._methodClass();
  18123. if(($receiver = $1) == null || $receiver.a$nil){
  18124. return $1;
  18125. } else {
  18126. var class_;
  18127. class_=$receiver;
  18128. return $recv(class_)._packageOfProtocol_($self._protocol());
  18129. }
  18130. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  18131. },
  18132. args: [],
  18133. source: "package\x0a\x09\x22Answer the package the receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the `methodClass` package\x22\x0a\x09\x0a\x09^ self methodClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  18134. referencedClasses: [],
  18135. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  18136. }),
  18137. $globals.CompiledMethod);
  18138. $core.addMethod(
  18139. $core.method({
  18140. selector: "protocol",
  18141. protocol: "accessing",
  18142. fn: function (){
  18143. var self=this,$self=this;
  18144. return $core.withContext(function($ctx1) {
  18145. var $1,$receiver;
  18146. $1=$self._basicAt_("protocol");
  18147. if(($receiver = $1) == null || $receiver.a$nil){
  18148. return $self._defaultProtocol();
  18149. } else {
  18150. return $1;
  18151. }
  18152. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  18153. },
  18154. args: [],
  18155. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  18156. referencedClasses: [],
  18157. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  18158. }),
  18159. $globals.CompiledMethod);
  18160. $core.addMethod(
  18161. $core.method({
  18162. selector: "protocol:",
  18163. protocol: "accessing",
  18164. fn: function (aString){
  18165. var self=this,$self=this;
  18166. var oldProtocol;
  18167. return $core.withContext(function($ctx1) {
  18168. var $1,$3,$2,$4,$receiver;
  18169. oldProtocol=$self._protocol();
  18170. $self._basicAt_put_("protocol",aString);
  18171. $1=$recv($globals.SystemAnnouncer)._current();
  18172. $3=$recv($globals.MethodMoved)._new();
  18173. $recv($3)._method_(self);
  18174. $recv($3)._oldProtocol_(oldProtocol);
  18175. $2=$recv($3)._yourself();
  18176. $recv($1)._announce_($2);
  18177. $4=$self._methodClass();
  18178. if(($receiver = $4) == null || $receiver.a$nil){
  18179. $4;
  18180. } else {
  18181. var methodClass;
  18182. methodClass=$receiver;
  18183. $recv($recv(methodClass)._organization())._addElement_(aString);
  18184. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  18185. }
  18186. return self;
  18187. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  18188. },
  18189. args: ["aString"],
  18190. source: "protocol: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09self basicAt: 'protocol' put: aString.\x0a\x0a\x09SystemAnnouncer current announce: (MethodMoved new\x0a\x09\x09method: self;\x0a\x09\x09oldProtocol: oldProtocol;\x0a\x09\x09yourself).\x0a\x0a\x09self methodClass ifNotNil: [ :methodClass |\x0a\x09\x09methodClass organization addElement: aString.\x0a\x09\x09methodClass removeProtocolIfEmpty: oldProtocol ]",
  18191. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  18192. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  18193. }),
  18194. $globals.CompiledMethod);
  18195. $core.addMethod(
  18196. $core.method({
  18197. selector: "referencedClasses",
  18198. protocol: "accessing",
  18199. fn: function (){
  18200. var self=this,$self=this;
  18201. return $core.withContext(function($ctx1) {
  18202. return $self._basicAt_("referencedClasses");
  18203. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  18204. },
  18205. args: [],
  18206. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  18207. referencedClasses: [],
  18208. messageSends: ["basicAt:"]
  18209. }),
  18210. $globals.CompiledMethod);
  18211. $core.addMethod(
  18212. $core.method({
  18213. selector: "selector",
  18214. protocol: "accessing",
  18215. fn: function (){
  18216. var self=this,$self=this;
  18217. return $core.withContext(function($ctx1) {
  18218. return $self._basicAt_("selector");
  18219. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  18220. },
  18221. args: [],
  18222. source: "selector\x0a\x09^ self basicAt: 'selector'",
  18223. referencedClasses: [],
  18224. messageSends: ["basicAt:"]
  18225. }),
  18226. $globals.CompiledMethod);
  18227. $core.addMethod(
  18228. $core.method({
  18229. selector: "selector:",
  18230. protocol: "accessing",
  18231. fn: function (aString){
  18232. var self=this,$self=this;
  18233. return $core.withContext(function($ctx1) {
  18234. $self._basicAt_put_("selector",aString);
  18235. return self;
  18236. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  18237. },
  18238. args: ["aString"],
  18239. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  18240. referencedClasses: [],
  18241. messageSends: ["basicAt:put:"]
  18242. }),
  18243. $globals.CompiledMethod);
  18244. $core.addMethod(
  18245. $core.method({
  18246. selector: "sendTo:arguments:",
  18247. protocol: "evaluating",
  18248. fn: function (anObject,aCollection){
  18249. var self=this,$self=this;
  18250. return $core.withContext(function($ctx1) {
  18251. return $recv($self._fn())._applyTo_arguments_(anObject,aCollection);
  18252. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  18253. },
  18254. args: ["anObject", "aCollection"],
  18255. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  18256. referencedClasses: [],
  18257. messageSends: ["applyTo:arguments:", "fn"]
  18258. }),
  18259. $globals.CompiledMethod);
  18260. $core.addMethod(
  18261. $core.method({
  18262. selector: "source",
  18263. protocol: "accessing",
  18264. fn: function (){
  18265. var self=this,$self=this;
  18266. return $core.withContext(function($ctx1) {
  18267. var $1,$receiver;
  18268. $1=$self._basicAt_("source");
  18269. if(($receiver = $1) == null || $receiver.a$nil){
  18270. return "";
  18271. } else {
  18272. return $1;
  18273. }
  18274. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  18275. },
  18276. args: [],
  18277. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  18278. referencedClasses: [],
  18279. messageSends: ["ifNil:", "basicAt:"]
  18280. }),
  18281. $globals.CompiledMethod);
  18282. $core.addMethod(
  18283. $core.method({
  18284. selector: "source:",
  18285. protocol: "accessing",
  18286. fn: function (aString){
  18287. var self=this,$self=this;
  18288. return $core.withContext(function($ctx1) {
  18289. $self._basicAt_put_("source",aString);
  18290. return self;
  18291. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  18292. },
  18293. args: ["aString"],
  18294. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  18295. referencedClasses: [],
  18296. messageSends: ["basicAt:put:"]
  18297. }),
  18298. $globals.CompiledMethod);
  18299. $core.addClass("ForkPool", $globals.Object, ["poolSize", "maxPoolSize", "queue", "worker"], "Kernel-Methods");
  18300. $globals.ForkPool.comment="I am responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0a## API\x0a\x0aThe default instance is accessed with `#default`.\x0aThe maximum concurrent forked blocks can be set with `#maxPoolSize:`.\x0a\x0aForking is done via `BlockClosure >> #fork`";
  18301. $core.addMethod(
  18302. $core.method({
  18303. selector: "addWorker",
  18304. protocol: "private",
  18305. fn: function (){
  18306. var self=this,$self=this;
  18307. return $core.withContext(function($ctx1) {
  18308. $recv($self["@worker"])._valueWithTimeout_((0));
  18309. $self["@poolSize"]=$recv($self["@poolSize"]).__plus((1));
  18310. return self;
  18311. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  18312. },
  18313. args: [],
  18314. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  18315. referencedClasses: [],
  18316. messageSends: ["valueWithTimeout:", "+"]
  18317. }),
  18318. $globals.ForkPool);
  18319. $core.addMethod(
  18320. $core.method({
  18321. selector: "defaultMaxPoolSize",
  18322. protocol: "defaults",
  18323. fn: function (){
  18324. var self=this,$self=this;
  18325. return $core.withContext(function($ctx1) {
  18326. return $recv($self._class())._defaultMaxPoolSize();
  18327. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  18328. },
  18329. args: [],
  18330. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  18331. referencedClasses: [],
  18332. messageSends: ["defaultMaxPoolSize", "class"]
  18333. }),
  18334. $globals.ForkPool);
  18335. $core.addMethod(
  18336. $core.method({
  18337. selector: "fork:",
  18338. protocol: "actions",
  18339. fn: function (aBlock){
  18340. var self=this,$self=this;
  18341. return $core.withContext(function($ctx1) {
  18342. var $1;
  18343. $1=$recv($self["@poolSize"]).__lt($self._maxPoolSize());
  18344. if($core.assert($1)){
  18345. $self._addWorker();
  18346. }
  18347. $recv($self["@queue"])._nextPut_(aBlock);
  18348. return self;
  18349. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  18350. },
  18351. args: ["aBlock"],
  18352. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  18353. referencedClasses: [],
  18354. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  18355. }),
  18356. $globals.ForkPool);
  18357. $core.addMethod(
  18358. $core.method({
  18359. selector: "initialize",
  18360. protocol: "initialization",
  18361. fn: function (){
  18362. var self=this,$self=this;
  18363. return $core.withContext(function($ctx1) {
  18364. (
  18365. $ctx1.supercall = true,
  18366. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18367. $ctx1.supercall = false;
  18368. $self["@poolSize"]=(0);
  18369. $self["@queue"]=$recv($globals.Queue)._new();
  18370. $self["@worker"]=$self._makeWorker();
  18371. return self;
  18372. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  18373. },
  18374. args: [],
  18375. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  18376. referencedClasses: ["Queue"],
  18377. messageSends: ["initialize", "new", "makeWorker"]
  18378. }),
  18379. $globals.ForkPool);
  18380. $core.addMethod(
  18381. $core.method({
  18382. selector: "makeWorker",
  18383. protocol: "initialization",
  18384. fn: function (){
  18385. var self=this,$self=this;
  18386. var sentinel;
  18387. return $core.withContext(function($ctx1) {
  18388. var $1;
  18389. sentinel=$recv($globals.Object)._new();
  18390. return (function(){
  18391. var block;
  18392. return $core.withContext(function($ctx2) {
  18393. $self["@poolSize"]=$recv($self["@poolSize"]).__minus((1));
  18394. block=$recv($self["@queue"])._nextIfAbsent_((function(){
  18395. return sentinel;
  18396. }));
  18397. $1=$recv(block).__eq_eq(sentinel);
  18398. if(!$core.assert($1)){
  18399. return $recv((function(){
  18400. return $core.withContext(function($ctx3) {
  18401. return $recv(block)._value();
  18402. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  18403. }))._ensure_((function(){
  18404. return $core.withContext(function($ctx3) {
  18405. return $self._addWorker();
  18406. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  18407. }));
  18408. }
  18409. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  18410. });
  18411. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  18412. },
  18413. args: [],
  18414. source: "makeWorker\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^ [ | block |\x0a\x09\x09poolSize := poolSize - 1.\x0a\x09\x09block := queue nextIfAbsent: [ sentinel ].\x0a\x09\x09block == sentinel ifFalse: [\x0a\x09\x09\x09[ block value ] ensure: [ self addWorker ] ]]",
  18415. referencedClasses: ["Object"],
  18416. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  18417. }),
  18418. $globals.ForkPool);
  18419. $core.addMethod(
  18420. $core.method({
  18421. selector: "maxPoolSize",
  18422. protocol: "accessing",
  18423. fn: function (){
  18424. var self=this,$self=this;
  18425. return $core.withContext(function($ctx1) {
  18426. var $1,$receiver;
  18427. $1=$self["@maxPoolSize"];
  18428. if(($receiver = $1) == null || $receiver.a$nil){
  18429. return $self._defaultMaxPoolSize();
  18430. } else {
  18431. return $1;
  18432. }
  18433. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  18434. },
  18435. args: [],
  18436. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  18437. referencedClasses: [],
  18438. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  18439. }),
  18440. $globals.ForkPool);
  18441. $core.addMethod(
  18442. $core.method({
  18443. selector: "maxPoolSize:",
  18444. protocol: "accessing",
  18445. fn: function (anInteger){
  18446. var self=this,$self=this;
  18447. $self["@maxPoolSize"]=anInteger;
  18448. return self;
  18449. },
  18450. args: ["anInteger"],
  18451. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  18452. referencedClasses: [],
  18453. messageSends: []
  18454. }),
  18455. $globals.ForkPool);
  18456. $globals.ForkPool.a$cls.iVarNames = ["default"];
  18457. $core.addMethod(
  18458. $core.method({
  18459. selector: "default",
  18460. protocol: "accessing",
  18461. fn: function (){
  18462. var self=this,$self=this;
  18463. return $core.withContext(function($ctx1) {
  18464. var $1,$receiver;
  18465. $1=$self["@default"];
  18466. if(($receiver = $1) == null || $receiver.a$nil){
  18467. $self["@default"]=$self._new();
  18468. return $self["@default"];
  18469. } else {
  18470. return $1;
  18471. }
  18472. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.a$cls)});
  18473. },
  18474. args: [],
  18475. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  18476. referencedClasses: [],
  18477. messageSends: ["ifNil:", "new"]
  18478. }),
  18479. $globals.ForkPool.a$cls);
  18480. $core.addMethod(
  18481. $core.method({
  18482. selector: "defaultMaxPoolSize",
  18483. protocol: "accessing",
  18484. fn: function (){
  18485. var self=this,$self=this;
  18486. return (100);
  18487. },
  18488. args: [],
  18489. source: "defaultMaxPoolSize\x0a\x09^ 100",
  18490. referencedClasses: [],
  18491. messageSends: []
  18492. }),
  18493. $globals.ForkPool.a$cls);
  18494. $core.addMethod(
  18495. $core.method({
  18496. selector: "resetDefault",
  18497. protocol: "accessing",
  18498. fn: function (){
  18499. var self=this,$self=this;
  18500. $self["@default"]=nil;
  18501. return self;
  18502. },
  18503. args: [],
  18504. source: "resetDefault\x0a\x09default := nil",
  18505. referencedClasses: [],
  18506. messageSends: []
  18507. }),
  18508. $globals.ForkPool.a$cls);
  18509. $core.addClass("Message", $globals.Object, ["selector", "arguments"], "Kernel-Methods");
  18510. $globals.Message.comment="In general, the system does not use instances of me for efficiency reasons.\x0aHowever, when a message is not understood by its receiver, the interpreter will make up an instance of it in order to capture the information involved in an actual message transmission.\x0aThis instance is sent it as an argument with the message `#doesNotUnderstand:` to the receiver.\x0a\x0aSee boot.js, `messageNotUnderstood` and its counterpart `Object >> #doesNotUnderstand:`\x0a\x0a## API\x0a\x0aBesides accessing methods, `#sendTo:` provides a convenient way to send a message to an object.";
  18511. $core.addMethod(
  18512. $core.method({
  18513. selector: "arguments",
  18514. protocol: "accessing",
  18515. fn: function (){
  18516. var self=this,$self=this;
  18517. return $self["@arguments"];
  18518. },
  18519. args: [],
  18520. source: "arguments\x0a\x09^ arguments",
  18521. referencedClasses: [],
  18522. messageSends: []
  18523. }),
  18524. $globals.Message);
  18525. $core.addMethod(
  18526. $core.method({
  18527. selector: "arguments:",
  18528. protocol: "accessing",
  18529. fn: function (anArray){
  18530. var self=this,$self=this;
  18531. $self["@arguments"]=anArray;
  18532. return self;
  18533. },
  18534. args: ["anArray"],
  18535. source: "arguments: anArray\x0a\x09arguments := anArray",
  18536. referencedClasses: [],
  18537. messageSends: []
  18538. }),
  18539. $globals.Message);
  18540. $core.addMethod(
  18541. $core.method({
  18542. selector: "printOn:",
  18543. protocol: "printing",
  18544. fn: function (aStream){
  18545. var self=this,$self=this;
  18546. return $core.withContext(function($ctx1) {
  18547. (
  18548. $ctx1.supercall = true,
  18549. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18550. $ctx1.supercall = false;
  18551. $recv(aStream)._nextPutAll_("(");
  18552. $ctx1.sendIdx["nextPutAll:"]=1;
  18553. $recv(aStream)._nextPutAll_($self._selector());
  18554. $ctx1.sendIdx["nextPutAll:"]=2;
  18555. $recv(aStream)._nextPutAll_(")");
  18556. return self;
  18557. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  18558. },
  18559. args: ["aStream"],
  18560. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  18561. referencedClasses: [],
  18562. messageSends: ["printOn:", "nextPutAll:", "selector"]
  18563. }),
  18564. $globals.Message);
  18565. $core.addMethod(
  18566. $core.method({
  18567. selector: "selector",
  18568. protocol: "accessing",
  18569. fn: function (){
  18570. var self=this,$self=this;
  18571. return $self["@selector"];
  18572. },
  18573. args: [],
  18574. source: "selector\x0a\x09^ selector",
  18575. referencedClasses: [],
  18576. messageSends: []
  18577. }),
  18578. $globals.Message);
  18579. $core.addMethod(
  18580. $core.method({
  18581. selector: "selector:",
  18582. protocol: "accessing",
  18583. fn: function (aString){
  18584. var self=this,$self=this;
  18585. $self["@selector"]=aString;
  18586. return self;
  18587. },
  18588. args: ["aString"],
  18589. source: "selector: aString\x0a\x09selector := aString",
  18590. referencedClasses: [],
  18591. messageSends: []
  18592. }),
  18593. $globals.Message);
  18594. $core.addMethod(
  18595. $core.method({
  18596. selector: "sendTo:",
  18597. protocol: "actions",
  18598. fn: function (anObject){
  18599. var self=this,$self=this;
  18600. return $core.withContext(function($ctx1) {
  18601. return $recv(anObject)._perform_withArguments_($self._selector(),$self._arguments());
  18602. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  18603. },
  18604. args: ["anObject"],
  18605. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  18606. referencedClasses: [],
  18607. messageSends: ["perform:withArguments:", "selector", "arguments"]
  18608. }),
  18609. $globals.Message);
  18610. $core.addMethod(
  18611. $core.method({
  18612. selector: "selector:arguments:",
  18613. protocol: "instance creation",
  18614. fn: function (aString,anArray){
  18615. var self=this,$self=this;
  18616. return $core.withContext(function($ctx1) {
  18617. var $1;
  18618. $1=$self._new();
  18619. $recv($1)._selector_(aString);
  18620. $recv($1)._arguments_(anArray);
  18621. return $recv($1)._yourself();
  18622. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.a$cls)});
  18623. },
  18624. args: ["aString", "anArray"],
  18625. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  18626. referencedClasses: [],
  18627. messageSends: ["selector:", "new", "arguments:", "yourself"]
  18628. }),
  18629. $globals.Message.a$cls);
  18630. $core.addMethod(
  18631. $core.method({
  18632. selector: "selector:arguments:notUnderstoodBy:",
  18633. protocol: "dnu handling",
  18634. fn: function (aString,anArray,anObject){
  18635. var self=this,$self=this;
  18636. return $core.withContext(function($ctx1) {
  18637. return $recv(anObject)._doesNotUnderstand_($self._selector_arguments_(aString,anArray));
  18638. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:notUnderstoodBy:",{aString:aString,anArray:anArray,anObject:anObject},$globals.Message.a$cls)});
  18639. },
  18640. args: ["aString", "anArray", "anObject"],
  18641. source: "selector: aString arguments: anArray notUnderstoodBy: anObject\x0a\x09\x22Creates the message and passes it to #doesNotUnderstand:.\x0a\x09Used by kernel to handle MNU.\x22\x0a\x09^ anObject doesNotUnderstand:\x0a\x09\x09(self selector: aString arguments: anArray)",
  18642. referencedClasses: [],
  18643. messageSends: ["doesNotUnderstand:", "selector:arguments:"]
  18644. }),
  18645. $globals.Message.a$cls);
  18646. $core.addClass("MessageSend", $globals.Object, ["receiver", "message"], "Kernel-Methods");
  18647. $globals.MessageSend.comment="I encapsulate message sends to objects. Arguments can be either predefined or supplied when the message send is performed. \x0a\x0a## API\x0a\x0aUse `#value` to perform a message send with its predefined arguments and `#value:*` if additonal arguments have to supplied.";
  18648. $core.addMethod(
  18649. $core.method({
  18650. selector: "arguments",
  18651. protocol: "accessing",
  18652. fn: function (){
  18653. var self=this,$self=this;
  18654. return $core.withContext(function($ctx1) {
  18655. return $recv($self["@message"])._arguments();
  18656. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  18657. },
  18658. args: [],
  18659. source: "arguments\x0a\x09^ message arguments",
  18660. referencedClasses: [],
  18661. messageSends: ["arguments"]
  18662. }),
  18663. $globals.MessageSend);
  18664. $core.addMethod(
  18665. $core.method({
  18666. selector: "arguments:",
  18667. protocol: "accessing",
  18668. fn: function (aCollection){
  18669. var self=this,$self=this;
  18670. return $core.withContext(function($ctx1) {
  18671. $recv($self["@message"])._arguments_(aCollection);
  18672. return self;
  18673. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  18674. },
  18675. args: ["aCollection"],
  18676. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  18677. referencedClasses: [],
  18678. messageSends: ["arguments:"]
  18679. }),
  18680. $globals.MessageSend);
  18681. $core.addMethod(
  18682. $core.method({
  18683. selector: "initialize",
  18684. protocol: "initialization",
  18685. fn: function (){
  18686. var self=this,$self=this;
  18687. return $core.withContext(function($ctx1) {
  18688. (
  18689. $ctx1.supercall = true,
  18690. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18691. $ctx1.supercall = false;
  18692. $self["@message"]=$recv($globals.Message)._new();
  18693. return self;
  18694. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  18695. },
  18696. args: [],
  18697. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  18698. referencedClasses: ["Message"],
  18699. messageSends: ["initialize", "new"]
  18700. }),
  18701. $globals.MessageSend);
  18702. $core.addMethod(
  18703. $core.method({
  18704. selector: "printOn:",
  18705. protocol: "printing",
  18706. fn: function (aStream){
  18707. var self=this,$self=this;
  18708. return $core.withContext(function($ctx1) {
  18709. (
  18710. $ctx1.supercall = true,
  18711. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18712. $ctx1.supercall = false;
  18713. $recv(aStream)._nextPutAll_("(");
  18714. $ctx1.sendIdx["nextPutAll:"]=1;
  18715. $recv(aStream)._nextPutAll_($self._receiver());
  18716. $ctx1.sendIdx["nextPutAll:"]=2;
  18717. $recv(aStream)._nextPutAll_(" >> ");
  18718. $ctx1.sendIdx["nextPutAll:"]=3;
  18719. $recv(aStream)._nextPutAll_($self._selector());
  18720. $ctx1.sendIdx["nextPutAll:"]=4;
  18721. $recv(aStream)._nextPutAll_(")");
  18722. return self;
  18723. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  18724. },
  18725. args: ["aStream"],
  18726. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self receiver;\x0a\x09\x09nextPutAll: ' >> ';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  18727. referencedClasses: [],
  18728. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  18729. }),
  18730. $globals.MessageSend);
  18731. $core.addMethod(
  18732. $core.method({
  18733. selector: "receiver",
  18734. protocol: "accessing",
  18735. fn: function (){
  18736. var self=this,$self=this;
  18737. return $self["@receiver"];
  18738. },
  18739. args: [],
  18740. source: "receiver\x0a\x09^ receiver",
  18741. referencedClasses: [],
  18742. messageSends: []
  18743. }),
  18744. $globals.MessageSend);
  18745. $core.addMethod(
  18746. $core.method({
  18747. selector: "receiver:",
  18748. protocol: "accessing",
  18749. fn: function (anObject){
  18750. var self=this,$self=this;
  18751. $self["@receiver"]=anObject;
  18752. return self;
  18753. },
  18754. args: ["anObject"],
  18755. source: "receiver: anObject\x0a\x09receiver := anObject",
  18756. referencedClasses: [],
  18757. messageSends: []
  18758. }),
  18759. $globals.MessageSend);
  18760. $core.addMethod(
  18761. $core.method({
  18762. selector: "selector",
  18763. protocol: "accessing",
  18764. fn: function (){
  18765. var self=this,$self=this;
  18766. return $core.withContext(function($ctx1) {
  18767. return $recv($self["@message"])._selector();
  18768. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  18769. },
  18770. args: [],
  18771. source: "selector\x0a\x09^ message selector",
  18772. referencedClasses: [],
  18773. messageSends: ["selector"]
  18774. }),
  18775. $globals.MessageSend);
  18776. $core.addMethod(
  18777. $core.method({
  18778. selector: "selector:",
  18779. protocol: "accessing",
  18780. fn: function (aString){
  18781. var self=this,$self=this;
  18782. return $core.withContext(function($ctx1) {
  18783. $recv($self["@message"])._selector_(aString);
  18784. return self;
  18785. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  18786. },
  18787. args: ["aString"],
  18788. source: "selector: aString\x0a\x09message selector: aString",
  18789. referencedClasses: [],
  18790. messageSends: ["selector:"]
  18791. }),
  18792. $globals.MessageSend);
  18793. $core.addMethod(
  18794. $core.method({
  18795. selector: "value",
  18796. protocol: "evaluating",
  18797. fn: function (){
  18798. var self=this,$self=this;
  18799. return $core.withContext(function($ctx1) {
  18800. return $recv($self["@message"])._sendTo_($self._receiver());
  18801. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  18802. },
  18803. args: [],
  18804. source: "value\x0a\x09^ message sendTo: self receiver",
  18805. referencedClasses: [],
  18806. messageSends: ["sendTo:", "receiver"]
  18807. }),
  18808. $globals.MessageSend);
  18809. $core.addMethod(
  18810. $core.method({
  18811. selector: "value:",
  18812. protocol: "evaluating",
  18813. fn: function (anObject){
  18814. var self=this,$self=this;
  18815. return $core.withContext(function($ctx1) {
  18816. var $1;
  18817. $1=$self["@message"];
  18818. $recv($1)._arguments_([anObject]);
  18819. return $recv($1)._sendTo_($self._receiver());
  18820. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  18821. },
  18822. args: ["anObject"],
  18823. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  18824. referencedClasses: [],
  18825. messageSends: ["arguments:", "sendTo:", "receiver"]
  18826. }),
  18827. $globals.MessageSend);
  18828. $core.addMethod(
  18829. $core.method({
  18830. selector: "value:value:",
  18831. protocol: "evaluating",
  18832. fn: function (firstArgument,secondArgument){
  18833. var self=this,$self=this;
  18834. return $core.withContext(function($ctx1) {
  18835. var $1;
  18836. $1=$self["@message"];
  18837. $recv($1)._arguments_([firstArgument,secondArgument]);
  18838. return $recv($1)._sendTo_($self._receiver());
  18839. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  18840. },
  18841. args: ["firstArgument", "secondArgument"],
  18842. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  18843. referencedClasses: [],
  18844. messageSends: ["arguments:", "sendTo:", "receiver"]
  18845. }),
  18846. $globals.MessageSend);
  18847. $core.addMethod(
  18848. $core.method({
  18849. selector: "value:value:value:",
  18850. protocol: "evaluating",
  18851. fn: function (firstArgument,secondArgument,thirdArgument){
  18852. var self=this,$self=this;
  18853. return $core.withContext(function($ctx1) {
  18854. var $1;
  18855. $1=$self["@message"];
  18856. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  18857. return $recv($1)._sendTo_($self._receiver());
  18858. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  18859. },
  18860. args: ["firstArgument", "secondArgument", "thirdArgument"],
  18861. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  18862. referencedClasses: [],
  18863. messageSends: ["arguments:", "sendTo:", "receiver"]
  18864. }),
  18865. $globals.MessageSend);
  18866. $core.addMethod(
  18867. $core.method({
  18868. selector: "valueWithPossibleArguments:",
  18869. protocol: "evaluating",
  18870. fn: function (aCollection){
  18871. var self=this,$self=this;
  18872. return $core.withContext(function($ctx1) {
  18873. $self._arguments_(aCollection);
  18874. return $self._value();
  18875. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  18876. },
  18877. args: ["aCollection"],
  18878. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  18879. referencedClasses: [],
  18880. messageSends: ["arguments:", "value"]
  18881. }),
  18882. $globals.MessageSend);
  18883. $core.addClass("MethodContext", $globals.Object, [], "Kernel-Methods");
  18884. $globals.MethodContext.comment="I hold all the dynamic state associated with the execution of either a method activation resulting from a message send. I am used to build the call stack while debugging.\x0a\x0aMy instances are JavaScript `SmalltalkMethodContext` objects defined in `boot.js`.";
  18885. $core.addMethod(
  18886. $core.method({
  18887. selector: "asString",
  18888. protocol: "converting",
  18889. fn: function (){
  18890. var self=this,$self=this;
  18891. return $core.withContext(function($ctx1) {
  18892. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  18893. $2=$self._isBlockContext();
  18894. if($core.assert($2)){
  18895. $3="a block (in ".__comma($recv($self._methodContext())._asString());
  18896. $ctx1.sendIdx[","]=2;
  18897. $1=$recv($3).__comma(")");
  18898. $ctx1.sendIdx[","]=1;
  18899. } else {
  18900. var methodClass;
  18901. methodClass=$recv($self._method())._methodClass();
  18902. $5=methodClass;
  18903. $7=$self._receiver();
  18904. $ctx1.sendIdx["receiver"]=1;
  18905. $6=$recv($7)._class();
  18906. $ctx1.sendIdx["class"]=1;
  18907. $4=$recv($5).__eq($6);
  18908. if($core.assert($4)){
  18909. $11=$self._receiver();
  18910. $ctx1.sendIdx["receiver"]=2;
  18911. $10=$recv($11)._class();
  18912. $ctx1.sendIdx["class"]=2;
  18913. $9=$recv($10)._name();
  18914. $ctx1.sendIdx["name"]=1;
  18915. $8=$recv($9).__comma(" >> ");
  18916. $ctx1.sendIdx[","]=4;
  18917. $12=$self._selector();
  18918. $ctx1.sendIdx["selector"]=1;
  18919. $1=$recv($8).__comma($12);
  18920. $ctx1.sendIdx[","]=3;
  18921. } else {
  18922. $16=$recv($recv($self._receiver())._class())._name();
  18923. $ctx1.sendIdx["name"]=2;
  18924. $15=$recv($16).__comma("(");
  18925. $14=$recv($15).__comma($recv(methodClass)._name());
  18926. $ctx1.sendIdx[","]=7;
  18927. $13=$recv($14).__comma(") >> ");
  18928. $ctx1.sendIdx[","]=6;
  18929. $1=$recv($13).__comma($self._selector());
  18930. $ctx1.sendIdx[","]=5;
  18931. }
  18932. }
  18933. return $1;
  18934. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  18935. },
  18936. args: [],
  18937. source: "asString\x0a\x09^ self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ \x0a\x09\x09\x09| methodClass |\x0a\x09\x09\x09methodClass := self method methodClass.\x0a\x09\x09\x09methodClass = self receiver class \x0a\x09\x09\x09\x09ifTrue: [ self receiver class name, ' >> ', self selector ]\x0a\x09\x09\x09\x09ifFalse: [ self receiver class name, '(', methodClass name, ') >> ', self selector ] ]",
  18938. referencedClasses: [],
  18939. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  18940. }),
  18941. $globals.MethodContext);
  18942. $core.addMethod(
  18943. $core.method({
  18944. selector: "basicReceiver",
  18945. protocol: "accessing",
  18946. fn: function (){
  18947. var self=this,$self=this;
  18948. return $core.withContext(function($ctx1) {
  18949. return self.receiver;
  18950. return self;
  18951. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  18952. },
  18953. args: [],
  18954. source: "basicReceiver\x0a\x09<inlineJS: 'return self.receiver'>",
  18955. referencedClasses: [],
  18956. messageSends: []
  18957. }),
  18958. $globals.MethodContext);
  18959. $core.addMethod(
  18960. $core.method({
  18961. selector: "evaluatedSelector",
  18962. protocol: "accessing",
  18963. fn: function (){
  18964. var self=this,$self=this;
  18965. return $core.withContext(function($ctx1) {
  18966. return self.evaluatedSelector;
  18967. return self;
  18968. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  18969. },
  18970. args: [],
  18971. source: "evaluatedSelector\x0a\x09<inlineJS: 'return self.evaluatedSelector'>",
  18972. referencedClasses: [],
  18973. messageSends: []
  18974. }),
  18975. $globals.MethodContext);
  18976. $core.addMethod(
  18977. $core.method({
  18978. selector: "findContextSuchThat:",
  18979. protocol: "accessing",
  18980. fn: function (testBlock){
  18981. var self=this,$self=this;
  18982. var context;
  18983. return $core.withContext(function($ctx1) {
  18984. var $1;
  18985. var $early={};
  18986. try {
  18987. context=self;
  18988. $recv((function(){
  18989. return $core.withContext(function($ctx2) {
  18990. return $recv(context)._isNil();
  18991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  18992. }))._whileFalse_((function(){
  18993. return $core.withContext(function($ctx2) {
  18994. $1=$recv(testBlock)._value_(context);
  18995. if($core.assert($1)){
  18996. throw $early=[context];
  18997. }
  18998. context=$recv(context)._outerContext();
  18999. return context;
  19000. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  19001. }));
  19002. return nil;
  19003. }
  19004. catch(e) {if(e===$early)return e[0]; throw e}
  19005. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  19006. },
  19007. args: ["testBlock"],
  19008. source: "findContextSuchThat: testBlock\x0a\x09\x22Search self and my sender chain for first one that satisfies `testBlock`. \x0a\x09Answer `nil` if none satisfy\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self.\x0a\x09[ context isNil] whileFalse: [\x0a\x09\x09(testBlock value: context) \x0a\x09\x09\x09ifTrue: [ ^ context ].\x0a\x09\x09context := context outerContext ].\x0a\x0a\x09^ nil",
  19009. referencedClasses: [],
  19010. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  19011. }),
  19012. $globals.MethodContext);
  19013. $core.addMethod(
  19014. $core.method({
  19015. selector: "home",
  19016. protocol: "accessing",
  19017. fn: function (){
  19018. var self=this,$self=this;
  19019. return $core.withContext(function($ctx1) {
  19020. return self.homeContext;
  19021. return self;
  19022. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  19023. },
  19024. args: [],
  19025. source: "home\x0a\x09<inlineJS: 'return self.homeContext'>",
  19026. referencedClasses: [],
  19027. messageSends: []
  19028. }),
  19029. $globals.MethodContext);
  19030. $core.addMethod(
  19031. $core.method({
  19032. selector: "index",
  19033. protocol: "accessing",
  19034. fn: function (){
  19035. var self=this,$self=this;
  19036. return $core.withContext(function($ctx1) {
  19037. return self.index || 0;
  19038. return self;
  19039. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  19040. },
  19041. args: [],
  19042. source: "index\x0a\x09<inlineJS: 'return self.index || 0'>",
  19043. referencedClasses: [],
  19044. messageSends: []
  19045. }),
  19046. $globals.MethodContext);
  19047. $core.addMethod(
  19048. $core.method({
  19049. selector: "isBlockContext",
  19050. protocol: "testing",
  19051. fn: function (){
  19052. var self=this,$self=this;
  19053. return $core.withContext(function($ctx1) {
  19054. return $recv($self._selector())._isNil();
  19055. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  19056. },
  19057. args: [],
  19058. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  19059. referencedClasses: [],
  19060. messageSends: ["isNil", "selector"]
  19061. }),
  19062. $globals.MethodContext);
  19063. $core.addMethod(
  19064. $core.method({
  19065. selector: "locals",
  19066. protocol: "accessing",
  19067. fn: function (){
  19068. var self=this,$self=this;
  19069. return $core.withContext(function($ctx1) {
  19070. return self.locals || {};
  19071. return self;
  19072. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  19073. },
  19074. args: [],
  19075. source: "locals\x0a\x09<inlineJS: 'return self.locals || {}'>",
  19076. referencedClasses: [],
  19077. messageSends: []
  19078. }),
  19079. $globals.MethodContext);
  19080. $core.addMethod(
  19081. $core.method({
  19082. selector: "method",
  19083. protocol: "accessing",
  19084. fn: function (){
  19085. var self=this,$self=this;
  19086. var method,lookupClass,receiverClass,supercall;
  19087. return $core.withContext(function($ctx1) {
  19088. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  19089. $1=$self._methodContext();
  19090. $ctx1.sendIdx["methodContext"]=1;
  19091. if(($receiver = $1) == null || $receiver.a$nil){
  19092. return nil;
  19093. } else {
  19094. $1;
  19095. }
  19096. $3=$self._methodContext();
  19097. $ctx1.sendIdx["methodContext"]=2;
  19098. $2=$recv($3)._receiver();
  19099. receiverClass=$recv($2)._class();
  19100. $4=receiverClass;
  19101. $6=$self._methodContext();
  19102. $ctx1.sendIdx["methodContext"]=3;
  19103. $5=$recv($6)._selector();
  19104. $ctx1.sendIdx["selector"]=1;
  19105. method=$recv($4)._lookupSelector_($5);
  19106. $ctx1.sendIdx["lookupSelector:"]=1;
  19107. $7=$self._outerContext();
  19108. if(($receiver = $7) == null || $receiver.a$nil){
  19109. supercall=false;
  19110. } else {
  19111. var outer;
  19112. outer=$receiver;
  19113. supercall=$recv(outer)._supercall();
  19114. }
  19115. $8=supercall;
  19116. if($core.assert($8)){
  19117. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
  19118. } else {
  19119. return method;
  19120. }
  19121. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  19122. },
  19123. args: [],
  19124. source: "method\x0a\x09| method lookupClass receiverClass supercall |\x0a\x09\x0a\x09self methodContext ifNil: [ ^ nil ].\x0a\x0a\x09receiverClass := self methodContext receiver class.\x0a\x09method := receiverClass lookupSelector: self methodContext selector.\x0a\x09supercall := self outerContext \x0a\x09\x09ifNil: [ false ]\x0a\x09\x09ifNotNil: [ :outer | outer supercall ].\x0a\x0a\x09^ supercall\x0a\x09\x09ifFalse: [ method ]\x0a\x09\x09ifTrue: [ method methodClass superclass lookupSelector: self methodContext selector ]",
  19125. referencedClasses: [],
  19126. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  19127. }),
  19128. $globals.MethodContext);
  19129. $core.addMethod(
  19130. $core.method({
  19131. selector: "methodContext",
  19132. protocol: "accessing",
  19133. fn: function (){
  19134. var self=this,$self=this;
  19135. return $core.withContext(function($ctx1) {
  19136. var $1,$2,$receiver;
  19137. $1=$self._isBlockContext();
  19138. if(!$core.assert($1)){
  19139. return self;
  19140. }
  19141. $2=$self._outerContext();
  19142. if(($receiver = $2) == null || $receiver.a$nil){
  19143. return $2;
  19144. } else {
  19145. var outer;
  19146. outer=$receiver;
  19147. return $recv(outer)._methodContext();
  19148. }
  19149. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  19150. },
  19151. args: [],
  19152. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  19153. referencedClasses: [],
  19154. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  19155. }),
  19156. $globals.MethodContext);
  19157. $core.addMethod(
  19158. $core.method({
  19159. selector: "outerContext",
  19160. protocol: "accessing",
  19161. fn: function (){
  19162. var self=this,$self=this;
  19163. return $core.withContext(function($ctx1) {
  19164. return self.outerContext || self.homeContext;
  19165. return self;
  19166. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  19167. },
  19168. args: [],
  19169. source: "outerContext\x0a\x09<inlineJS: 'return self.outerContext || self.homeContext'>",
  19170. referencedClasses: [],
  19171. messageSends: []
  19172. }),
  19173. $globals.MethodContext);
  19174. $core.addMethod(
  19175. $core.method({
  19176. selector: "printOn:",
  19177. protocol: "printing",
  19178. fn: function (aStream){
  19179. var self=this,$self=this;
  19180. return $core.withContext(function($ctx1) {
  19181. (
  19182. $ctx1.supercall = true,
  19183. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  19184. $ctx1.supercall = false;
  19185. $recv(aStream)._nextPutAll_("(");
  19186. $ctx1.sendIdx["nextPutAll:"]=1;
  19187. $recv(aStream)._nextPutAll_($self._asString());
  19188. $ctx1.sendIdx["nextPutAll:"]=2;
  19189. $recv(aStream)._nextPutAll_(")");
  19190. return self;
  19191. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  19192. },
  19193. args: ["aStream"],
  19194. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  19195. referencedClasses: [],
  19196. messageSends: ["printOn:", "nextPutAll:", "asString"]
  19197. }),
  19198. $globals.MethodContext);
  19199. $core.addMethod(
  19200. $core.method({
  19201. selector: "receiver",
  19202. protocol: "accessing",
  19203. fn: function (){
  19204. var self=this,$self=this;
  19205. return $core.withContext(function($ctx1) {
  19206. var $2,$1;
  19207. $1=$recv($self._isBlockContext())._and_((function(){
  19208. return $core.withContext(function($ctx2) {
  19209. $2=$self._outerContext();
  19210. $ctx2.sendIdx["outerContext"]=1;
  19211. return $recv($2)._notNil();
  19212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19213. }));
  19214. if($core.assert($1)){
  19215. return $recv($self._outerContext())._receiver();
  19216. } else {
  19217. return $self._basicReceiver();
  19218. }
  19219. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  19220. },
  19221. args: [],
  19222. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  19223. referencedClasses: [],
  19224. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  19225. }),
  19226. $globals.MethodContext);
  19227. $core.addMethod(
  19228. $core.method({
  19229. selector: "selector",
  19230. protocol: "accessing",
  19231. fn: function (){
  19232. var self=this,$self=this;
  19233. return $core.withContext(function($ctx1) {
  19234. if(self.selector) {
  19235. return $core.js2st(self.selector);
  19236. } else {
  19237. return nil;
  19238. }
  19239. ;
  19240. return self;
  19241. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  19242. },
  19243. args: [],
  19244. source: "selector\x0a\x09<inlineJS: '\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return $core.js2st(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09'>",
  19245. referencedClasses: [],
  19246. messageSends: []
  19247. }),
  19248. $globals.MethodContext);
  19249. $core.addMethod(
  19250. $core.method({
  19251. selector: "sendIndexAt:",
  19252. protocol: "accessing",
  19253. fn: function (aSelector){
  19254. var self=this,$self=this;
  19255. return $core.withContext(function($ctx1) {
  19256. return self.sendIdx[aSelector] || 0;
  19257. return self;
  19258. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  19259. },
  19260. args: ["aSelector"],
  19261. source: "sendIndexAt: aSelector\x0a\x09<inlineJS: 'return self.sendIdx[aSelector] || 0'>",
  19262. referencedClasses: [],
  19263. messageSends: []
  19264. }),
  19265. $globals.MethodContext);
  19266. $core.addMethod(
  19267. $core.method({
  19268. selector: "sendIndexes",
  19269. protocol: "accessing",
  19270. fn: function (){
  19271. var self=this,$self=this;
  19272. return $core.withContext(function($ctx1) {
  19273. return self.sendIdx;
  19274. return self;
  19275. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  19276. },
  19277. args: [],
  19278. source: "sendIndexes\x0a\x09<inlineJS: 'return self.sendIdx'>",
  19279. referencedClasses: [],
  19280. messageSends: []
  19281. }),
  19282. $globals.MethodContext);
  19283. $core.addMethod(
  19284. $core.method({
  19285. selector: "stubHere",
  19286. protocol: "accessing",
  19287. fn: function (){
  19288. var self=this,$self=this;
  19289. return $core.withContext(function($ctx1) {
  19290. self.homeContext = undefined;
  19291. return self;
  19292. }, function($ctx1) {$ctx1.fill(self,"stubHere",{},$globals.MethodContext)});
  19293. },
  19294. args: [],
  19295. source: "stubHere\x0a\x09<inlineJS: 'self.homeContext = undefined'>",
  19296. referencedClasses: [],
  19297. messageSends: []
  19298. }),
  19299. $globals.MethodContext);
  19300. $core.addMethod(
  19301. $core.method({
  19302. selector: "stubToAtMost:",
  19303. protocol: "error handling",
  19304. fn: function (anInteger){
  19305. var self=this,$self=this;
  19306. var context;
  19307. return $core.withContext(function($ctx1) {
  19308. var $1,$2,$receiver;
  19309. context=self;
  19310. $recv(anInteger)._timesRepeat_((function(){
  19311. return $core.withContext(function($ctx2) {
  19312. $1=context;
  19313. if(($receiver = $1) == null || $receiver.a$nil){
  19314. context=$1;
  19315. } else {
  19316. context=$recv(context)._home();
  19317. }
  19318. return context;
  19319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19320. }));
  19321. $2=context;
  19322. if(($receiver = $2) == null || $receiver.a$nil){
  19323. $2;
  19324. } else {
  19325. $recv(context)._stubHere();
  19326. }
  19327. return self;
  19328. }, function($ctx1) {$ctx1.fill(self,"stubToAtMost:",{anInteger:anInteger,context:context},$globals.MethodContext)});
  19329. },
  19330. args: ["anInteger"],
  19331. source: "stubToAtMost: anInteger\x0a\x09| context |\x0a\x09context := self.\x0a\x09anInteger timesRepeat: [ context := context ifNotNil: [ context home ] ].\x0a\x09context ifNotNil: [ context stubHere ]",
  19332. referencedClasses: [],
  19333. messageSends: ["timesRepeat:", "ifNotNil:", "home", "stubHere"]
  19334. }),
  19335. $globals.MethodContext);
  19336. $core.addMethod(
  19337. $core.method({
  19338. selector: "supercall",
  19339. protocol: "accessing",
  19340. fn: function (){
  19341. var self=this,$self=this;
  19342. return $core.withContext(function($ctx1) {
  19343. return self.supercall == true;
  19344. return self;
  19345. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  19346. },
  19347. args: [],
  19348. source: "supercall\x0a\x09<inlineJS: 'return self.supercall == true'>",
  19349. referencedClasses: [],
  19350. messageSends: []
  19351. }),
  19352. $globals.MethodContext);
  19353. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  19354. $globals.NativeFunction.comment="I am a wrapper around native functions, such as `WebSocket`.\x0aFor 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.\x0a\x0a## API\x0a\x0aSee the class-side `instance creation` methods for instance creation.\x0a\x0aCreated instances will most probably be instance of `JSObjectProxy`.\x0a\x0a## Usage example:\x0a\x0a\x09| ws |\x0a\x09ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.\x0a\x09ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]";
  19355. $core.addMethod(
  19356. $core.method({
  19357. selector: "constructorNamed:",
  19358. protocol: "instance creation",
  19359. fn: function (aString){
  19360. var self=this,$self=this;
  19361. return $core.withContext(function($ctx1) {
  19362. var nativeFunc=$globals.Platform._globals()[aString];
  19363. return new nativeFunc();
  19364. ;
  19365. return self;
  19366. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19367. },
  19368. args: ["aString"],
  19369. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19370. referencedClasses: [],
  19371. messageSends: []
  19372. }),
  19373. $globals.NativeFunction.a$cls);
  19374. $core.addMethod(
  19375. $core.method({
  19376. selector: "constructorNamed:value:",
  19377. protocol: "instance creation",
  19378. fn: function (aString,anObject){
  19379. var self=this,$self=this;
  19380. return $core.withContext(function($ctx1) {
  19381. var nativeFunc=$globals.Platform._globals()[aString];
  19382. return new nativeFunc(anObject);
  19383. ;
  19384. return self;
  19385. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19386. },
  19387. args: ["aString", "anObject"],
  19388. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19389. referencedClasses: [],
  19390. messageSends: []
  19391. }),
  19392. $globals.NativeFunction.a$cls);
  19393. $core.addMethod(
  19394. $core.method({
  19395. selector: "constructorNamed:value:value:",
  19396. protocol: "instance creation",
  19397. fn: function (aString,anObject,anObject2){
  19398. var self=this,$self=this;
  19399. return $core.withContext(function($ctx1) {
  19400. var nativeFunc=$globals.Platform._globals[aString];
  19401. return new nativeFunc(anObject,anObject2);
  19402. ;
  19403. return self;
  19404. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19405. },
  19406. args: ["aString", "anObject", "anObject2"],
  19407. source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19408. referencedClasses: [],
  19409. messageSends: []
  19410. }),
  19411. $globals.NativeFunction.a$cls);
  19412. $core.addMethod(
  19413. $core.method({
  19414. selector: "constructorNamed:value:value:value:",
  19415. protocol: "instance creation",
  19416. fn: function (aString,anObject,anObject2,anObject3){
  19417. var self=this,$self=this;
  19418. return $core.withContext(function($ctx1) {
  19419. var nativeFunc=$globals.Platform._globals[aString];
  19420. return new nativeFunc(anObject,anObject2, anObject3);
  19421. ;
  19422. return self;
  19423. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19424. },
  19425. args: ["aString", "anObject", "anObject2", "anObject3"],
  19426. source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19427. referencedClasses: [],
  19428. messageSends: []
  19429. }),
  19430. $globals.NativeFunction.a$cls);
  19431. $core.addMethod(
  19432. $core.method({
  19433. selector: "constructorOf:",
  19434. protocol: "instance creation",
  19435. fn: function (nativeFunc){
  19436. var self=this,$self=this;
  19437. return $core.withContext(function($ctx1) {
  19438. return new nativeFunc();
  19439. ;
  19440. return self;
  19441. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19442. },
  19443. args: ["nativeFunc"],
  19444. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19445. referencedClasses: [],
  19446. messageSends: []
  19447. }),
  19448. $globals.NativeFunction.a$cls);
  19449. $core.addMethod(
  19450. $core.method({
  19451. selector: "constructorOf:value:",
  19452. protocol: "instance creation",
  19453. fn: function (nativeFunc,anObject){
  19454. var self=this,$self=this;
  19455. return $core.withContext(function($ctx1) {
  19456. return new nativeFunc(anObject);
  19457. ;
  19458. return self;
  19459. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19460. },
  19461. args: ["nativeFunc", "anObject"],
  19462. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19463. referencedClasses: [],
  19464. messageSends: []
  19465. }),
  19466. $globals.NativeFunction.a$cls);
  19467. $core.addMethod(
  19468. $core.method({
  19469. selector: "constructorOf:value:value:",
  19470. protocol: "instance creation",
  19471. fn: function (nativeFunc,anObject,anObject2){
  19472. var self=this,$self=this;
  19473. return $core.withContext(function($ctx1) {
  19474. return new nativeFunc(anObject,anObject2);
  19475. ;
  19476. return self;
  19477. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19478. },
  19479. args: ["nativeFunc", "anObject", "anObject2"],
  19480. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19481. referencedClasses: [],
  19482. messageSends: []
  19483. }),
  19484. $globals.NativeFunction.a$cls);
  19485. $core.addMethod(
  19486. $core.method({
  19487. selector: "constructorOf:value:value:value:",
  19488. protocol: "instance creation",
  19489. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19490. var self=this,$self=this;
  19491. return $core.withContext(function($ctx1) {
  19492. return new nativeFunc(anObject,anObject2, anObject3);
  19493. ;
  19494. return self;
  19495. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19496. },
  19497. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19498. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19499. referencedClasses: [],
  19500. messageSends: []
  19501. }),
  19502. $globals.NativeFunction.a$cls);
  19503. $core.addMethod(
  19504. $core.method({
  19505. selector: "exists:",
  19506. protocol: "testing",
  19507. fn: function (aString){
  19508. var self=this,$self=this;
  19509. return $core.withContext(function($ctx1) {
  19510. return $recv($globals.Platform)._includesGlobal_(aString);
  19511. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.a$cls)});
  19512. },
  19513. args: ["aString"],
  19514. source: "exists: aString\x0a\x09^ Platform includesGlobal: aString",
  19515. referencedClasses: ["Platform"],
  19516. messageSends: ["includesGlobal:"]
  19517. }),
  19518. $globals.NativeFunction.a$cls);
  19519. $core.addMethod(
  19520. $core.method({
  19521. selector: "functionNamed:",
  19522. protocol: "function calling",
  19523. fn: function (aString){
  19524. var self=this,$self=this;
  19525. return $core.withContext(function($ctx1) {
  19526. var nativeFunc=$globals.Platform._globals[aString];
  19527. return nativeFunc();
  19528. ;
  19529. return self;
  19530. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19531. },
  19532. args: ["aString"],
  19533. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19534. referencedClasses: [],
  19535. messageSends: []
  19536. }),
  19537. $globals.NativeFunction.a$cls);
  19538. $core.addMethod(
  19539. $core.method({
  19540. selector: "functionNamed:value:",
  19541. protocol: "function calling",
  19542. fn: function (aString,anObject){
  19543. var self=this,$self=this;
  19544. return $core.withContext(function($ctx1) {
  19545. var nativeFunc=$globals.Platform._globals()[aString];
  19546. return nativeFunc(anObject);
  19547. ;
  19548. return self;
  19549. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19550. },
  19551. args: ["aString", "anObject"],
  19552. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19553. referencedClasses: [],
  19554. messageSends: []
  19555. }),
  19556. $globals.NativeFunction.a$cls);
  19557. $core.addMethod(
  19558. $core.method({
  19559. selector: "functionNamed:value:value:",
  19560. protocol: "function calling",
  19561. fn: function (aString,anObject,anObject2){
  19562. var self=this,$self=this;
  19563. return $core.withContext(function($ctx1) {
  19564. var nativeFunc=$globals.Platform._globals()[aString];
  19565. return nativeFunc(anObject,anObject2);
  19566. ;
  19567. return self;
  19568. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19569. },
  19570. args: ["aString", "anObject", "anObject2"],
  19571. source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19572. referencedClasses: [],
  19573. messageSends: []
  19574. }),
  19575. $globals.NativeFunction.a$cls);
  19576. $core.addMethod(
  19577. $core.method({
  19578. selector: "functionNamed:value:value:value:",
  19579. protocol: "function calling",
  19580. fn: function (aString,anObject,anObject2,anObject3){
  19581. var self=this,$self=this;
  19582. return $core.withContext(function($ctx1) {
  19583. var nativeFunc=$globals.Platform._globals()[aString];
  19584. return nativeFunc(anObject,anObject2, anObject3);
  19585. ;
  19586. return self;
  19587. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19588. },
  19589. args: ["aString", "anObject", "anObject2", "anObject3"],
  19590. source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19591. referencedClasses: [],
  19592. messageSends: []
  19593. }),
  19594. $globals.NativeFunction.a$cls);
  19595. $core.addMethod(
  19596. $core.method({
  19597. selector: "functionNamed:valueWithArgs:",
  19598. protocol: "function calling",
  19599. fn: function (aString,args){
  19600. var self=this,$self=this;
  19601. return $core.withContext(function($ctx1) {
  19602. var nativeFunc=$globals.Platform._globals()[aString];
  19603. return Function.prototype.apply.call(nativeFunc, null, args);
  19604. ;
  19605. return self;
  19606. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.a$cls)});
  19607. },
  19608. args: ["aString", "args"],
  19609. source: "functionNamed: aString valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19610. referencedClasses: [],
  19611. messageSends: []
  19612. }),
  19613. $globals.NativeFunction.a$cls);
  19614. $core.addMethod(
  19615. $core.method({
  19616. selector: "functionOf:",
  19617. protocol: "function calling",
  19618. fn: function (nativeFunc){
  19619. var self=this,$self=this;
  19620. return $core.withContext(function($ctx1) {
  19621. return nativeFunc();
  19622. ;
  19623. return self;
  19624. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19625. },
  19626. args: ["nativeFunc"],
  19627. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19628. referencedClasses: [],
  19629. messageSends: []
  19630. }),
  19631. $globals.NativeFunction.a$cls);
  19632. $core.addMethod(
  19633. $core.method({
  19634. selector: "functionOf:value:",
  19635. protocol: "function calling",
  19636. fn: function (nativeFunc,anObject){
  19637. var self=this,$self=this;
  19638. return $core.withContext(function($ctx1) {
  19639. return nativeFunc(anObject);
  19640. ;
  19641. return self;
  19642. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19643. },
  19644. args: ["nativeFunc", "anObject"],
  19645. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19646. referencedClasses: [],
  19647. messageSends: []
  19648. }),
  19649. $globals.NativeFunction.a$cls);
  19650. $core.addMethod(
  19651. $core.method({
  19652. selector: "functionOf:value:value:",
  19653. protocol: "function calling",
  19654. fn: function (nativeFunc,anObject,anObject2){
  19655. var self=this,$self=this;
  19656. return $core.withContext(function($ctx1) {
  19657. return nativeFunc(anObject,anObject2);
  19658. ;
  19659. return self;
  19660. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19661. },
  19662. args: ["nativeFunc", "anObject", "anObject2"],
  19663. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19664. referencedClasses: [],
  19665. messageSends: []
  19666. }),
  19667. $globals.NativeFunction.a$cls);
  19668. $core.addMethod(
  19669. $core.method({
  19670. selector: "functionOf:value:value:value:",
  19671. protocol: "function calling",
  19672. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19673. var self=this,$self=this;
  19674. return $core.withContext(function($ctx1) {
  19675. return nativeFunc(anObject,anObject2, anObject3);
  19676. ;
  19677. return self;
  19678. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19679. },
  19680. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19681. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19682. referencedClasses: [],
  19683. messageSends: []
  19684. }),
  19685. $globals.NativeFunction.a$cls);
  19686. $core.addMethod(
  19687. $core.method({
  19688. selector: "functionOf:valueWithArgs:",
  19689. protocol: "function calling",
  19690. fn: function (nativeFunc,args){
  19691. var self=this,$self=this;
  19692. return $core.withContext(function($ctx1) {
  19693. return Function.prototype.apply.call(nativeFunc, null, args);
  19694. ;
  19695. return self;
  19696. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.a$cls)});
  19697. },
  19698. args: ["nativeFunc", "args"],
  19699. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19700. referencedClasses: [],
  19701. messageSends: []
  19702. }),
  19703. $globals.NativeFunction.a$cls);
  19704. $core.addMethod(
  19705. $core.method({
  19706. selector: "isNativeFunction:",
  19707. protocol: "testing",
  19708. fn: function (anObject){
  19709. var self=this,$self=this;
  19710. return $core.withContext(function($ctx1) {
  19711. return typeof anObject === "function";
  19712. return self;
  19713. }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject},$globals.NativeFunction.a$cls)});
  19714. },
  19715. args: ["anObject"],
  19716. source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
  19717. referencedClasses: [],
  19718. messageSends: []
  19719. }),
  19720. $globals.NativeFunction.a$cls);
  19721. $core.addMethod(
  19722. $core.method({
  19723. selector: "methodOf:this:",
  19724. protocol: "method calling",
  19725. fn: function (nativeFunc,thisObject){
  19726. var self=this,$self=this;
  19727. return $core.withContext(function($ctx1) {
  19728. return Function.prototype.call.call(nativeFunc, thisObject);
  19729. ;
  19730. return self;
  19731. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.a$cls)});
  19732. },
  19733. args: ["nativeFunc", "thisObject"],
  19734. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  19735. referencedClasses: [],
  19736. messageSends: []
  19737. }),
  19738. $globals.NativeFunction.a$cls);
  19739. $core.addMethod(
  19740. $core.method({
  19741. selector: "methodOf:this:value:",
  19742. protocol: "method calling",
  19743. fn: function (nativeFunc,thisObject,anObject){
  19744. var self=this,$self=this;
  19745. return $core.withContext(function($ctx1) {
  19746. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  19747. ;
  19748. return self;
  19749. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.a$cls)});
  19750. },
  19751. args: ["nativeFunc", "thisObject", "anObject"],
  19752. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  19753. referencedClasses: [],
  19754. messageSends: []
  19755. }),
  19756. $globals.NativeFunction.a$cls);
  19757. $core.addMethod(
  19758. $core.method({
  19759. selector: "methodOf:this:value:value:",
  19760. protocol: "method calling",
  19761. fn: function (nativeFunc,thisObject,anObject,anObject2){
  19762. var self=this,$self=this;
  19763. return $core.withContext(function($ctx1) {
  19764. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  19765. ;
  19766. return self;
  19767. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19768. },
  19769. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  19770. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09'>",
  19771. referencedClasses: [],
  19772. messageSends: []
  19773. }),
  19774. $globals.NativeFunction.a$cls);
  19775. $core.addMethod(
  19776. $core.method({
  19777. selector: "methodOf:this:value:value:value:",
  19778. protocol: "method calling",
  19779. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  19780. var self=this,$self=this;
  19781. return $core.withContext(function($ctx1) {
  19782. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  19783. ;
  19784. return self;
  19785. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19786. },
  19787. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  19788. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);\x0a\x09'>",
  19789. referencedClasses: [],
  19790. messageSends: []
  19791. }),
  19792. $globals.NativeFunction.a$cls);
  19793. $core.addMethod(
  19794. $core.method({
  19795. selector: "methodOf:this:valueWithArgs:",
  19796. protocol: "method calling",
  19797. fn: function (nativeFunc,thisObject,args){
  19798. var self=this,$self=this;
  19799. return $core.withContext(function($ctx1) {
  19800. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  19801. ;
  19802. return self;
  19803. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.a$cls)});
  19804. },
  19805. args: ["nativeFunc", "thisObject", "args"],
  19806. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  19807. referencedClasses: [],
  19808. messageSends: []
  19809. }),
  19810. $globals.NativeFunction.a$cls);
  19811. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  19812. $globals.Timeout.comment="I am wrapping the returns from `set{Timeout,Interval}`.\x0a\x0a## Motivation\x0a\x0aNumber suffices in browsers, but node.js returns an object.";
  19813. $core.addMethod(
  19814. $core.method({
  19815. selector: "clearInterval",
  19816. protocol: "timeout/interval",
  19817. fn: function (){
  19818. var self=this,$self=this;
  19819. return $core.withContext(function($ctx1) {
  19820. var interval = $self["@rawTimeout"];
  19821. clearInterval(interval);
  19822. ;
  19823. return self;
  19824. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  19825. },
  19826. args: [],
  19827. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  19828. referencedClasses: [],
  19829. messageSends: []
  19830. }),
  19831. $globals.Timeout);
  19832. $core.addMethod(
  19833. $core.method({
  19834. selector: "clearTimeout",
  19835. protocol: "timeout/interval",
  19836. fn: function (){
  19837. var self=this,$self=this;
  19838. return $core.withContext(function($ctx1) {
  19839. var timeout = $self["@rawTimeout"];
  19840. clearTimeout(timeout);
  19841. ;
  19842. return self;
  19843. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  19844. },
  19845. args: [],
  19846. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  19847. referencedClasses: [],
  19848. messageSends: []
  19849. }),
  19850. $globals.Timeout);
  19851. $core.addMethod(
  19852. $core.method({
  19853. selector: "rawTimeout:",
  19854. protocol: "accessing",
  19855. fn: function (anObject){
  19856. var self=this,$self=this;
  19857. $self["@rawTimeout"]=anObject;
  19858. return self;
  19859. },
  19860. args: ["anObject"],
  19861. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  19862. referencedClasses: [],
  19863. messageSends: []
  19864. }),
  19865. $globals.Timeout);
  19866. $core.addMethod(
  19867. $core.method({
  19868. selector: "on:",
  19869. protocol: "instance creation",
  19870. fn: function (anObject){
  19871. var self=this,$self=this;
  19872. return $core.withContext(function($ctx1) {
  19873. var $1;
  19874. $1=$self._new();
  19875. $recv($1)._rawTimeout_(anObject);
  19876. return $recv($1)._yourself();
  19877. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.a$cls)});
  19878. },
  19879. args: ["anObject"],
  19880. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  19881. referencedClasses: [],
  19882. messageSends: ["rawTimeout:", "new", "yourself"]
  19883. }),
  19884. $globals.Timeout.a$cls);
  19885. });
  19886. define('amber_core/Kernel-Dag',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  19887. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  19888. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  19889. var $pkg = $core.addPackage("Kernel-Dag");
  19890. $pkg.innerEval = function (expr) { return eval(expr); };
  19891. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  19892. $core.addClass("AbstractDagVisitor", $globals.Object, [], "Kernel-Dag");
  19893. $globals.AbstractDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aConcrete classes should implement `visitDagNode:`,\x0athey can reuse possible variants of implementation\x0aoffered directly: `visitDagNodeVariantSimple:`\x0aand `visitDagNodeVariantRedux:`.";
  19894. $core.addMethod(
  19895. $core.method({
  19896. selector: "value:",
  19897. protocol: "evaluating",
  19898. fn: function (anObject){
  19899. var self=this,$self=this;
  19900. return $core.withContext(function($ctx1) {
  19901. return $self._visit_(anObject);
  19902. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AbstractDagVisitor)});
  19903. },
  19904. args: ["anObject"],
  19905. source: "value: anObject\x0a\x09^ self visit: anObject",
  19906. referencedClasses: [],
  19907. messageSends: ["visit:"]
  19908. }),
  19909. $globals.AbstractDagVisitor);
  19910. $core.addMethod(
  19911. $core.method({
  19912. selector: "visit:",
  19913. protocol: "visiting",
  19914. fn: function (aNode){
  19915. var self=this,$self=this;
  19916. return $core.withContext(function($ctx1) {
  19917. return $recv(aNode)._acceptDagVisitor_(self);
  19918. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.AbstractDagVisitor)});
  19919. },
  19920. args: ["aNode"],
  19921. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  19922. referencedClasses: [],
  19923. messageSends: ["acceptDagVisitor:"]
  19924. }),
  19925. $globals.AbstractDagVisitor);
  19926. $core.addMethod(
  19927. $core.method({
  19928. selector: "visitAll:",
  19929. protocol: "visiting",
  19930. fn: function (aCollection){
  19931. var self=this,$self=this;
  19932. return $core.withContext(function($ctx1) {
  19933. return $recv(aCollection)._collect_((function(each){
  19934. return $core.withContext(function($ctx2) {
  19935. return $self._visit_(each);
  19936. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19937. }));
  19938. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.AbstractDagVisitor)});
  19939. },
  19940. args: ["aCollection"],
  19941. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  19942. referencedClasses: [],
  19943. messageSends: ["collect:", "visit:"]
  19944. }),
  19945. $globals.AbstractDagVisitor);
  19946. $core.addMethod(
  19947. $core.method({
  19948. selector: "visitAllChildren:",
  19949. protocol: "visiting",
  19950. fn: function (aDagNode){
  19951. var self=this,$self=this;
  19952. return $core.withContext(function($ctx1) {
  19953. return $self._visitAll_($recv(aDagNode)._dagChildren());
  19954. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode},$globals.AbstractDagVisitor)});
  19955. },
  19956. args: ["aDagNode"],
  19957. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  19958. referencedClasses: [],
  19959. messageSends: ["visitAll:", "dagChildren"]
  19960. }),
  19961. $globals.AbstractDagVisitor);
  19962. $core.addMethod(
  19963. $core.method({
  19964. selector: "visitDagNode:",
  19965. protocol: "visiting",
  19966. fn: function (aNode){
  19967. var self=this,$self=this;
  19968. return $core.withContext(function($ctx1) {
  19969. $self._subclassResponsibility();
  19970. return self;
  19971. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.AbstractDagVisitor)});
  19972. },
  19973. args: ["aNode"],
  19974. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  19975. referencedClasses: [],
  19976. messageSends: ["subclassResponsibility"]
  19977. }),
  19978. $globals.AbstractDagVisitor);
  19979. $core.addMethod(
  19980. $core.method({
  19981. selector: "visitDagNodeVariantRedux:",
  19982. protocol: "visiting",
  19983. fn: function (aNode){
  19984. var self=this,$self=this;
  19985. var newChildren,oldChildren;
  19986. return $core.withContext(function($ctx1) {
  19987. var $2,$3,$1,$4,$5;
  19988. var $early={};
  19989. try {
  19990. oldChildren=$recv(aNode)._dagChildren();
  19991. newChildren=$self._visitAllChildren_(aNode);
  19992. $2=$recv(oldChildren)._size();
  19993. $ctx1.sendIdx["size"]=1;
  19994. $3=$recv(newChildren)._size();
  19995. $ctx1.sendIdx["size"]=2;
  19996. $1=$recv($2).__eq($3);
  19997. if($core.assert($1)){
  19998. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  19999. return $core.withContext(function($ctx2) {
  20000. $4=$recv(oldChildren)._at_(i);
  20001. $ctx2.sendIdx["at:"]=1;
  20002. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  20003. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  20004. }),(function(){
  20005. throw $early=[aNode];
  20006. }));
  20007. }
  20008. $5=$recv(aNode)._copy();
  20009. $recv($5)._dagChildren_(newChildren);
  20010. return $recv($5)._yourself();
  20011. }
  20012. catch(e) {if(e===$early)return e[0]; throw e}
  20013. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren},$globals.AbstractDagVisitor)});
  20014. },
  20015. args: ["aNode"],
  20016. source: "visitDagNodeVariantRedux: aNode\x0a\x09\x22Immutable-guarded implementation of visitDagNode:.\x0a\x09Visits all children and checks if there were changes.\x0a\x09If not, returns aNode.\x0a\x09If yes, returns copy of aNode with new children.\x22\x0a\x0a\x09| newChildren oldChildren |\x0a\x09oldChildren := aNode dagChildren.\x0a\x09newChildren := self visitAllChildren: aNode.\x0a\x09oldChildren size = newChildren size ifTrue: [\x0a\x09\x09(1 to: oldChildren size) detect: [ :i |\x0a\x09\x09\x09(oldChildren at: i) ~= (newChildren at: i)\x0a\x09\x09] ifNone: [ \x22no change\x22 ^ aNode ] ].\x0a\x09^ aNode copy dagChildren: newChildren; yourself",
  20017. referencedClasses: [],
  20018. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  20019. }),
  20020. $globals.AbstractDagVisitor);
  20021. $core.addMethod(
  20022. $core.method({
  20023. selector: "visitDagNodeVariantSimple:",
  20024. protocol: "visiting",
  20025. fn: function (aNode){
  20026. var self=this,$self=this;
  20027. return $core.withContext(function($ctx1) {
  20028. $self._visitAllChildren_(aNode);
  20029. return aNode;
  20030. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20031. },
  20032. args: ["aNode"],
  20033. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  20034. referencedClasses: [],
  20035. messageSends: ["visitAllChildren:"]
  20036. }),
  20037. $globals.AbstractDagVisitor);
  20038. $core.addClass("PathDagVisitor", $globals.AbstractDagVisitor, ["path"], "Kernel-Dag");
  20039. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  20040. $core.addMethod(
  20041. $core.method({
  20042. selector: "initialize",
  20043. protocol: "initialization",
  20044. fn: function (){
  20045. var self=this,$self=this;
  20046. return $core.withContext(function($ctx1) {
  20047. (
  20048. $ctx1.supercall = true,
  20049. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  20050. $ctx1.supercall = false;
  20051. $self["@path"]=[];
  20052. return self;
  20053. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PathDagVisitor)});
  20054. },
  20055. args: [],
  20056. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  20057. referencedClasses: [],
  20058. messageSends: ["initialize"]
  20059. }),
  20060. $globals.PathDagVisitor);
  20061. $core.addMethod(
  20062. $core.method({
  20063. selector: "path",
  20064. protocol: "accessing",
  20065. fn: function (){
  20066. var self=this,$self=this;
  20067. return $self["@path"];
  20068. },
  20069. args: [],
  20070. source: "path\x0a\x09^ path",
  20071. referencedClasses: [],
  20072. messageSends: []
  20073. }),
  20074. $globals.PathDagVisitor);
  20075. $core.addMethod(
  20076. $core.method({
  20077. selector: "visit:",
  20078. protocol: "visiting",
  20079. fn: function (aNode){
  20080. var self=this,$self=this;
  20081. var oldPath,result;
  20082. return $core.withContext(function($ctx1) {
  20083. result=aNode;
  20084. oldPath=$self["@path"];
  20085. $recv((function(){
  20086. return $core.withContext(function($ctx2) {
  20087. $self["@path"]=$recv($self["@path"]).__comma([aNode]);
  20088. result=(
  20089. $ctx2.supercall = true,
  20090. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  20091. $ctx2.supercall = false;
  20092. return result;
  20093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20094. }))._ensure_((function(){
  20095. $self["@path"]=oldPath;
  20096. return $self["@path"];
  20097. }));
  20098. return result;
  20099. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result},$globals.PathDagVisitor)});
  20100. },
  20101. args: ["aNode"],
  20102. source: "visit: aNode\x0a\x09| oldPath result |\x0a\x09result := aNode.\x0a\x09oldPath := path.\x0a\x09[\x0a\x09\x09path := path, {aNode}.\x0a\x09\x09result := super visit: aNode\x0a\x09] ensure: [ path := oldPath ].\x0a\x09^ result",
  20103. referencedClasses: [],
  20104. messageSends: ["ensure:", ",", "visit:"]
  20105. }),
  20106. $globals.PathDagVisitor);
  20107. $core.addMethod(
  20108. $core.method({
  20109. selector: "visitDagNodeVariantRedux:",
  20110. protocol: "visiting",
  20111. fn: function (aNode){
  20112. var self=this,$self=this;
  20113. var newNode;
  20114. return $core.withContext(function($ctx1) {
  20115. var $1;
  20116. newNode=(
  20117. $ctx1.supercall = true,
  20118. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($self, [aNode]));
  20119. $ctx1.supercall = false;
  20120. $1=$recv(aNode).__eq_eq(newNode);
  20121. if(!$core.assert($1)){
  20122. $recv($self["@path"])._at_put_($recv($self["@path"])._size(),newNode);
  20123. }
  20124. return newNode;
  20125. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode},$globals.PathDagVisitor)});
  20126. },
  20127. args: ["aNode"],
  20128. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  20129. referencedClasses: [],
  20130. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  20131. }),
  20132. $globals.PathDagVisitor);
  20133. $core.addClass("DagNode", $globals.Object, [], "Kernel-Dag");
  20134. $globals.DagNode.comment="I am the abstract root class of any directed acyclic graph.\x0a\x0aConcrete classes should implement `dagChildren` and `dagChildren:`\x0ato get / set direct successor nodes (aka child nodes / subnodes).";
  20135. $core.addMethod(
  20136. $core.method({
  20137. selector: "acceptDagVisitor:",
  20138. protocol: "visiting",
  20139. fn: function (aVisitor){
  20140. var self=this,$self=this;
  20141. return $core.withContext(function($ctx1) {
  20142. return $recv(aVisitor)._visitDagNode_(self);
  20143. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DagNode)});
  20144. },
  20145. args: ["aVisitor"],
  20146. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  20147. referencedClasses: [],
  20148. messageSends: ["visitDagNode:"]
  20149. }),
  20150. $globals.DagNode);
  20151. $core.addMethod(
  20152. $core.method({
  20153. selector: "allDagChildren",
  20154. protocol: "accessing",
  20155. fn: function (){
  20156. var self=this,$self=this;
  20157. var allNodes;
  20158. return $core.withContext(function($ctx1) {
  20159. var $1;
  20160. $1=$self._dagChildren();
  20161. $ctx1.sendIdx["dagChildren"]=1;
  20162. allNodes=$recv($1)._asSet();
  20163. $recv($self._dagChildren())._do_((function(each){
  20164. return $core.withContext(function($ctx2) {
  20165. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  20166. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20167. }));
  20168. return allNodes;
  20169. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes},$globals.DagNode)});
  20170. },
  20171. args: [],
  20172. source: "allDagChildren\x0a\x09| allNodes |\x0a\x09\x0a\x09allNodes := self dagChildren asSet.\x0a\x09self dagChildren do: [ :each | \x0a\x09\x09allNodes addAll: each allDagChildren ].\x0a\x09\x0a\x09^ allNodes",
  20173. referencedClasses: [],
  20174. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  20175. }),
  20176. $globals.DagNode);
  20177. $core.addMethod(
  20178. $core.method({
  20179. selector: "dagChildren",
  20180. protocol: "accessing",
  20181. fn: function (){
  20182. var self=this,$self=this;
  20183. return $core.withContext(function($ctx1) {
  20184. $self._subclassResponsibility();
  20185. return self;
  20186. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagNode)});
  20187. },
  20188. args: [],
  20189. source: "dagChildren\x0a\x09self subclassResponsibility",
  20190. referencedClasses: [],
  20191. messageSends: ["subclassResponsibility"]
  20192. }),
  20193. $globals.DagNode);
  20194. $core.addMethod(
  20195. $core.method({
  20196. selector: "dagChildren:",
  20197. protocol: "accessing",
  20198. fn: function (aCollection){
  20199. var self=this,$self=this;
  20200. return $core.withContext(function($ctx1) {
  20201. $self._subclassResponsibility();
  20202. return self;
  20203. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagNode)});
  20204. },
  20205. args: ["aCollection"],
  20206. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  20207. referencedClasses: [],
  20208. messageSends: ["subclassResponsibility"]
  20209. }),
  20210. $globals.DagNode);
  20211. $core.addMethod(
  20212. $core.method({
  20213. selector: "isDagNode",
  20214. protocol: "testing",
  20215. fn: function (){
  20216. var self=this,$self=this;
  20217. return true;
  20218. },
  20219. args: [],
  20220. source: "isDagNode\x0a\x09^ true",
  20221. referencedClasses: [],
  20222. messageSends: []
  20223. }),
  20224. $globals.DagNode);
  20225. $core.addClass("DagParentNode", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20226. $globals.DagParentNode.comment="I am `DagNode` that stores a collection of its children,\x0alazy initialized to empty array.\x0a\x0aI can `addDagChild:` to add a child.";
  20227. $core.addMethod(
  20228. $core.method({
  20229. selector: "addDagChild:",
  20230. protocol: "accessing",
  20231. fn: function (aDagNode){
  20232. var self=this,$self=this;
  20233. return $core.withContext(function($ctx1) {
  20234. $recv($self._dagChildren())._add_(aDagNode);
  20235. return self;
  20236. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode},$globals.DagParentNode)});
  20237. },
  20238. args: ["aDagNode"],
  20239. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  20240. referencedClasses: [],
  20241. messageSends: ["add:", "dagChildren"]
  20242. }),
  20243. $globals.DagParentNode);
  20244. $core.addMethod(
  20245. $core.method({
  20246. selector: "dagChildren",
  20247. protocol: "accessing",
  20248. fn: function (){
  20249. var self=this,$self=this;
  20250. return $core.withContext(function($ctx1) {
  20251. var $1,$receiver;
  20252. $1=$self["@nodes"];
  20253. if(($receiver = $1) == null || $receiver.a$nil){
  20254. $self["@nodes"]=$recv($globals.Array)._new();
  20255. return $self["@nodes"];
  20256. } else {
  20257. return $1;
  20258. }
  20259. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagParentNode)});
  20260. },
  20261. args: [],
  20262. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  20263. referencedClasses: ["Array"],
  20264. messageSends: ["ifNil:", "new"]
  20265. }),
  20266. $globals.DagParentNode);
  20267. $core.addMethod(
  20268. $core.method({
  20269. selector: "dagChildren:",
  20270. protocol: "accessing",
  20271. fn: function (aCollection){
  20272. var self=this,$self=this;
  20273. $self["@nodes"]=aCollection;
  20274. return self;
  20275. },
  20276. args: ["aCollection"],
  20277. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  20278. referencedClasses: [],
  20279. messageSends: []
  20280. }),
  20281. $globals.DagParentNode);
  20282. $core.addClass("DagSink", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20283. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  20284. $core.addMethod(
  20285. $core.method({
  20286. selector: "dagChildren",
  20287. protocol: "accessing",
  20288. fn: function (){
  20289. var self=this,$self=this;
  20290. return [];
  20291. },
  20292. args: [],
  20293. source: "dagChildren\x0a\x09^ #()",
  20294. referencedClasses: [],
  20295. messageSends: []
  20296. }),
  20297. $globals.DagSink);
  20298. $core.addMethod(
  20299. $core.method({
  20300. selector: "dagChildren:",
  20301. protocol: "accessing",
  20302. fn: function (aCollection){
  20303. var self=this,$self=this;
  20304. return $core.withContext(function($ctx1) {
  20305. $recv(aCollection)._ifNotEmpty_((function(){
  20306. return $core.withContext(function($ctx2) {
  20307. return $self._error_("A DagSink cannot have children.");
  20308. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20309. }));
  20310. return self;
  20311. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagSink)});
  20312. },
  20313. args: ["aCollection"],
  20314. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  20315. referencedClasses: [],
  20316. messageSends: ["ifNotEmpty:", "error:"]
  20317. }),
  20318. $globals.DagSink);
  20319. $core.addMethod(
  20320. $core.method({
  20321. selector: "isDagNode",
  20322. protocol: "*Kernel-Dag",
  20323. fn: function (){
  20324. var self=this,$self=this;
  20325. return false;
  20326. },
  20327. args: [],
  20328. source: "isDagNode\x0a\x09^ false",
  20329. referencedClasses: [],
  20330. messageSends: []
  20331. }),
  20332. $globals.Object);
  20333. });
  20334. define('amber_core/Kernel-Exceptions',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20335. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  20336. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20337. var $pkg = $core.addPackage("Kernel-Exceptions");
  20338. $pkg.innerEval = function (expr) { return eval(expr); };
  20339. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  20340. $core.addClass("Error", $globals.Object, ["messageText"], "Kernel-Exceptions");
  20341. $globals.Error.comment="From the ANSI standard:\x0a\x0aThis protocol describes the behavior of instances of class `Error`.\x0aThese are used to represent error conditions that prevent the normal continuation of processing.\x0aActual error exceptions used by an application may be subclasses of this class.\x0aAs `Error` is explicitly specified to be subclassable, conforming implementations must implement its behavior in a non-fragile manner.";
  20342. $core.addMethod(
  20343. $core.method({
  20344. selector: "beHandled",
  20345. protocol: "accessing",
  20346. fn: function (){
  20347. var self=this,$self=this;
  20348. return $core.withContext(function($ctx1) {
  20349. self.amberHandled = true;
  20350. return self;
  20351. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  20352. },
  20353. args: [],
  20354. source: "beHandled\x0a\x09<inlineJS: 'self.amberHandled = true'>",
  20355. referencedClasses: [],
  20356. messageSends: []
  20357. }),
  20358. $globals.Error);
  20359. $core.addMethod(
  20360. $core.method({
  20361. selector: "beUnhandled",
  20362. protocol: "accessing",
  20363. fn: function (){
  20364. var self=this,$self=this;
  20365. return $core.withContext(function($ctx1) {
  20366. self.amberHandled = false;
  20367. return self;
  20368. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  20369. },
  20370. args: [],
  20371. source: "beUnhandled\x0a\x09<inlineJS: 'self.amberHandled = false'>",
  20372. referencedClasses: [],
  20373. messageSends: []
  20374. }),
  20375. $globals.Error);
  20376. $core.addMethod(
  20377. $core.method({
  20378. selector: "context",
  20379. protocol: "accessing",
  20380. fn: function (){
  20381. var self=this,$self=this;
  20382. return $core.withContext(function($ctx1) {
  20383. return self.context;
  20384. return self;
  20385. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  20386. },
  20387. args: [],
  20388. source: "context\x0a\x09<inlineJS: 'return self.context'>",
  20389. referencedClasses: [],
  20390. messageSends: []
  20391. }),
  20392. $globals.Error);
  20393. $core.addMethod(
  20394. $core.method({
  20395. selector: "initialize",
  20396. protocol: "initialization",
  20397. fn: function (){
  20398. var self=this,$self=this;
  20399. return $core.withContext(function($ctx1) {
  20400. $self._messageText_("Errorclass: ".__comma($recv($self._class())._name()));
  20401. return self;
  20402. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  20403. },
  20404. args: [],
  20405. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  20406. referencedClasses: [],
  20407. messageSends: ["messageText:", ",", "name", "class"]
  20408. }),
  20409. $globals.Error);
  20410. $core.addMethod(
  20411. $core.method({
  20412. selector: "isSmalltalkError",
  20413. protocol: "testing",
  20414. fn: function (){
  20415. var self=this,$self=this;
  20416. return $core.withContext(function($ctx1) {
  20417. return self.smalltalkError === true;
  20418. return self;
  20419. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  20420. },
  20421. args: [],
  20422. source: "isSmalltalkError\x0a\x09<inlineJS: 'return self.smalltalkError === true'>",
  20423. referencedClasses: [],
  20424. messageSends: []
  20425. }),
  20426. $globals.Error);
  20427. $core.addMethod(
  20428. $core.method({
  20429. selector: "jsStack",
  20430. protocol: "accessing",
  20431. fn: function (){
  20432. var self=this,$self=this;
  20433. return $core.withContext(function($ctx1) {
  20434. return self.stack;
  20435. return self;
  20436. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  20437. },
  20438. args: [],
  20439. source: "jsStack\x0a\x09<inlineJS: 'return self.stack'>",
  20440. referencedClasses: [],
  20441. messageSends: []
  20442. }),
  20443. $globals.Error);
  20444. $core.addMethod(
  20445. $core.method({
  20446. selector: "messageText",
  20447. protocol: "accessing",
  20448. fn: function (){
  20449. var self=this,$self=this;
  20450. return $self["@messageText"];
  20451. },
  20452. args: [],
  20453. source: "messageText\x0a\x09^ messageText",
  20454. referencedClasses: [],
  20455. messageSends: []
  20456. }),
  20457. $globals.Error);
  20458. $core.addMethod(
  20459. $core.method({
  20460. selector: "messageText:",
  20461. protocol: "accessing",
  20462. fn: function (aString){
  20463. var self=this,$self=this;
  20464. $self["@messageText"]=aString;
  20465. return self;
  20466. },
  20467. args: ["aString"],
  20468. source: "messageText: aString\x0a\x09messageText := aString",
  20469. referencedClasses: [],
  20470. messageSends: []
  20471. }),
  20472. $globals.Error);
  20473. $core.addMethod(
  20474. $core.method({
  20475. selector: "outer",
  20476. protocol: "signaling",
  20477. fn: function (){
  20478. var self=this,$self=this;
  20479. return $core.withContext(function($ctx1) {
  20480. return $self._pass();
  20481. }, function($ctx1) {$ctx1.fill(self,"outer",{},$globals.Error)});
  20482. },
  20483. args: [],
  20484. source: "outer\x0a\x09\x22Pharo compatibility. Just sends #pass.\x22\x0a\x09\x0a\x09^ self pass",
  20485. referencedClasses: [],
  20486. messageSends: ["pass"]
  20487. }),
  20488. $globals.Error);
  20489. $core.addMethod(
  20490. $core.method({
  20491. selector: "pass",
  20492. protocol: "signaling",
  20493. fn: function (){
  20494. var self=this,$self=this;
  20495. return $core.withContext(function($ctx1) {
  20496. self.amberHandled = false;
  20497. throw self;
  20498. ;
  20499. return self;
  20500. }, function($ctx1) {$ctx1.fill(self,"pass",{},$globals.Error)});
  20501. },
  20502. args: [],
  20503. source: "pass\x0a\x09\x22Let outer handler take care of this.\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw self;\x0a\x09'>",
  20504. referencedClasses: [],
  20505. messageSends: []
  20506. }),
  20507. $globals.Error);
  20508. $core.addMethod(
  20509. $core.method({
  20510. selector: "resignal",
  20511. protocol: "signaling",
  20512. fn: function (){
  20513. var self=this,$self=this;
  20514. return $core.withContext(function($ctx1) {
  20515. $self._deprecatedAPI_("Use #pass.");
  20516. return $self._pass();
  20517. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  20518. },
  20519. args: [],
  20520. source: "resignal\x0a\x09self deprecatedAPI: 'Use #pass.'.\x0a\x09^ self pass",
  20521. referencedClasses: [],
  20522. messageSends: ["deprecatedAPI:", "pass"]
  20523. }),
  20524. $globals.Error);
  20525. $core.addMethod(
  20526. $core.method({
  20527. selector: "signal",
  20528. protocol: "signaling",
  20529. fn: function (){
  20530. var self=this,$self=this;
  20531. return $core.withContext(function($ctx1) {
  20532. self.amberHandled = false;
  20533. self.context = $core.getThisContext();
  20534. self.smalltalkError = true;
  20535. throw self;
  20536. ;
  20537. return self;
  20538. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  20539. },
  20540. args: [],
  20541. source: "signal\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09self.context = $core.getThisContext(); \x0a\x09\x09self.smalltalkError = true;\x0a\x09\x09throw self;\x0a\x09'>",
  20542. referencedClasses: [],
  20543. messageSends: []
  20544. }),
  20545. $globals.Error);
  20546. $core.addMethod(
  20547. $core.method({
  20548. selector: "signal:",
  20549. protocol: "signaling",
  20550. fn: function (aString){
  20551. var self=this,$self=this;
  20552. return $core.withContext(function($ctx1) {
  20553. $self._messageText_(aString);
  20554. $self._signal();
  20555. return self;
  20556. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  20557. },
  20558. args: ["aString"],
  20559. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  20560. referencedClasses: [],
  20561. messageSends: ["messageText:", "signal"]
  20562. }),
  20563. $globals.Error);
  20564. $core.addMethod(
  20565. $core.method({
  20566. selector: "signalerContext",
  20567. protocol: "accessing",
  20568. fn: function (){
  20569. var self=this,$self=this;
  20570. return $core.withContext(function($ctx1) {
  20571. return $self._signalerContextFrom_($self._context());
  20572. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  20573. },
  20574. args: [],
  20575. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  20576. referencedClasses: [],
  20577. messageSends: ["signalerContextFrom:", "context"]
  20578. }),
  20579. $globals.Error);
  20580. $core.addMethod(
  20581. $core.method({
  20582. selector: "signalerContextFrom:",
  20583. protocol: "accessing",
  20584. fn: function (aContext){
  20585. var self=this,$self=this;
  20586. return $core.withContext(function($ctx1) {
  20587. var $3,$2,$1;
  20588. return $recv(aContext)._findContextSuchThat_((function(context){
  20589. return $core.withContext(function($ctx2) {
  20590. $3=$recv(context)._receiver();
  20591. $ctx2.sendIdx["receiver"]=1;
  20592. $2=$recv($3).__eq_eq(self);
  20593. $ctx2.sendIdx["=="]=1;
  20594. $1=$recv($2)._or_((function(){
  20595. return $core.withContext(function($ctx3) {
  20596. return $recv($recv(context)._receiver()).__eq_eq($self._class());
  20597. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20598. }));
  20599. return $recv($1)._not();
  20600. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20601. }));
  20602. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  20603. },
  20604. args: ["aContext"],
  20605. source: "signalerContextFrom: aContext\x0a\x09\x22Find the first sender of signal(:), the first context which is neither \x0a\x09for an instance method nor for a class side method of Exception (or subclass).\x0a\x09This will make sure that the same context is found for both, `Error signal` \x0a\x09and `Error new signal`\x22\x0a\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ context receiver == self class ]) not ]",
  20606. referencedClasses: [],
  20607. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  20608. }),
  20609. $globals.Error);
  20610. $core.addMethod(
  20611. $core.method({
  20612. selector: "wasHandled",
  20613. protocol: "testing",
  20614. fn: function (){
  20615. var self=this,$self=this;
  20616. return $core.withContext(function($ctx1) {
  20617. return self.amberHandled || false;
  20618. return self;
  20619. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  20620. },
  20621. args: [],
  20622. source: "wasHandled\x0a\x09<inlineJS: 'return self.amberHandled || false'>",
  20623. referencedClasses: [],
  20624. messageSends: []
  20625. }),
  20626. $globals.Error);
  20627. $core.addMethod(
  20628. $core.method({
  20629. selector: "classTag",
  20630. protocol: "accessing",
  20631. fn: function (){
  20632. var self=this,$self=this;
  20633. return "exception";
  20634. },
  20635. args: [],
  20636. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'exception'",
  20637. referencedClasses: [],
  20638. messageSends: []
  20639. }),
  20640. $globals.Error.a$cls);
  20641. $core.addMethod(
  20642. $core.method({
  20643. selector: "signal",
  20644. protocol: "instance creation",
  20645. fn: function (){
  20646. var self=this,$self=this;
  20647. return $core.withContext(function($ctx1) {
  20648. return $recv($self._new())._signal();
  20649. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.a$cls)});
  20650. },
  20651. args: [],
  20652. source: "signal\x0a\x09^ self new signal",
  20653. referencedClasses: [],
  20654. messageSends: ["signal", "new"]
  20655. }),
  20656. $globals.Error.a$cls);
  20657. $core.addMethod(
  20658. $core.method({
  20659. selector: "signal:",
  20660. protocol: "instance creation",
  20661. fn: function (aString){
  20662. var self=this,$self=this;
  20663. return $core.withContext(function($ctx1) {
  20664. return $recv($self._new())._signal_(aString);
  20665. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.a$cls)});
  20666. },
  20667. args: ["aString"],
  20668. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  20669. referencedClasses: [],
  20670. messageSends: ["signal:", "new"]
  20671. }),
  20672. $globals.Error.a$cls);
  20673. $core.addClass("Halt", $globals.Error, [], "Kernel-Exceptions");
  20674. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  20675. $core.addMethod(
  20676. $core.method({
  20677. selector: "messageText",
  20678. protocol: "accessing",
  20679. fn: function (){
  20680. var self=this,$self=this;
  20681. return "Halt encountered";
  20682. },
  20683. args: [],
  20684. source: "messageText\x0a\x09^ 'Halt encountered'",
  20685. referencedClasses: [],
  20686. messageSends: []
  20687. }),
  20688. $globals.Halt);
  20689. $core.addMethod(
  20690. $core.method({
  20691. selector: "signalerContextFrom:",
  20692. protocol: "accessing",
  20693. fn: function (aContext){
  20694. var self=this,$self=this;
  20695. return $core.withContext(function($ctx1) {
  20696. var $3,$2,$1;
  20697. return $recv(aContext)._findContextSuchThat_((function(context){
  20698. return $core.withContext(function($ctx2) {
  20699. $3=$recv(context)._receiver();
  20700. $ctx2.sendIdx["receiver"]=1;
  20701. $2=$recv($3).__eq_eq(self);
  20702. $ctx2.sendIdx["=="]=1;
  20703. $1=$recv($2)._or_((function(){
  20704. return $core.withContext(function($ctx3) {
  20705. return $recv($recv($recv(context)._receiver()).__eq_eq($self._class()))._or_((function(){
  20706. return $core.withContext(function($ctx4) {
  20707. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  20708. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  20709. }));
  20710. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20711. }));
  20712. $ctx2.sendIdx["or:"]=1;
  20713. return $recv($1)._not();
  20714. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20715. }));
  20716. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  20717. },
  20718. args: ["aContext"],
  20719. source: "signalerContextFrom: aContext\x0a\x09\x22specialized version to find the proper context to open the debugger on.\x0a\x09This will find the first context whose method is no longer on `Halt` or \x0a\x09`Halt class` nor is `#halt` method itself.\x22\x0a\x09\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ (context receiver == self class) \x0a\x09\x09or: [ context method selector = #halt ]]) not ]",
  20720. referencedClasses: [],
  20721. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  20722. }),
  20723. $globals.Halt);
  20724. $core.addClass("JavaScriptException", $globals.Error, ["exception"], "Kernel-Exceptions");
  20725. $globals.JavaScriptException.comment="A JavaScriptException is thrown when a non-Smalltalk exception occurs while in the Smalltalk stack.\x0aSee `boot.js` `inContext()` and `BlockClosure >> on:do:`";
  20726. $core.addMethod(
  20727. $core.method({
  20728. selector: "context:",
  20729. protocol: "accessing",
  20730. fn: function (aMethodContext){
  20731. var self=this,$self=this;
  20732. return $core.withContext(function($ctx1) {
  20733. self.context = aMethodContext;
  20734. return self;
  20735. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  20736. },
  20737. args: ["aMethodContext"],
  20738. source: "context: aMethodContext\x0a\x09\x22Set the context from the outside.\x0a\x09See boot.js `inContext()` exception handling\x22\x0a\x09\x0a\x09<inlineJS: 'self.context = aMethodContext'>",
  20739. referencedClasses: [],
  20740. messageSends: []
  20741. }),
  20742. $globals.JavaScriptException);
  20743. $core.addMethod(
  20744. $core.method({
  20745. selector: "exception",
  20746. protocol: "accessing",
  20747. fn: function (){
  20748. var self=this,$self=this;
  20749. return $self["@exception"];
  20750. },
  20751. args: [],
  20752. source: "exception\x0a\x09^ exception",
  20753. referencedClasses: [],
  20754. messageSends: []
  20755. }),
  20756. $globals.JavaScriptException);
  20757. $core.addMethod(
  20758. $core.method({
  20759. selector: "exception:",
  20760. protocol: "accessing",
  20761. fn: function (anException){
  20762. var self=this,$self=this;
  20763. $self["@exception"]=anException;
  20764. return self;
  20765. },
  20766. args: ["anException"],
  20767. source: "exception: anException\x0a\x09exception := anException",
  20768. referencedClasses: [],
  20769. messageSends: []
  20770. }),
  20771. $globals.JavaScriptException);
  20772. $core.addMethod(
  20773. $core.method({
  20774. selector: "messageText",
  20775. protocol: "accessing",
  20776. fn: function (){
  20777. var self=this,$self=this;
  20778. return $core.withContext(function($ctx1) {
  20779. return "JavaScript exception: " + $self["@exception"].toString();
  20780. return self;
  20781. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  20782. },
  20783. args: [],
  20784. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + $self[\x22@exception\x22].toString()'>",
  20785. referencedClasses: [],
  20786. messageSends: []
  20787. }),
  20788. $globals.JavaScriptException);
  20789. $core.addMethod(
  20790. $core.method({
  20791. selector: "shouldBeStubbed",
  20792. protocol: "testing",
  20793. fn: function (){
  20794. var self=this,$self=this;
  20795. return $core.withContext(function($ctx1) {
  20796. return $self["@exception"] instanceof RangeError;
  20797. return self;
  20798. }, function($ctx1) {$ctx1.fill(self,"shouldBeStubbed",{},$globals.JavaScriptException)});
  20799. },
  20800. args: [],
  20801. source: "shouldBeStubbed\x0a\x09<inlineJS: 'return $self[\x22@exception\x22] instanceof RangeError'>",
  20802. referencedClasses: [],
  20803. messageSends: []
  20804. }),
  20805. $globals.JavaScriptException);
  20806. $core.addMethod(
  20807. $core.method({
  20808. selector: "wrap",
  20809. protocol: "error handling",
  20810. fn: function (){
  20811. var self=this,$self=this;
  20812. return $core.withContext(function($ctx1) {
  20813. var $1;
  20814. $recv((function(){
  20815. return $core.withContext(function($ctx2) {
  20816. return $self._signal();
  20817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20818. }))._tryCatch_((function(){
  20819. return $core.withContext(function($ctx2) {
  20820. $1=$self._shouldBeStubbed();
  20821. if($core.assert($1)){
  20822. return $recv($self._context())._stubToAtMost_((100));
  20823. }
  20824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  20825. }));
  20826. return self;
  20827. }, function($ctx1) {$ctx1.fill(self,"wrap",{},$globals.JavaScriptException)});
  20828. },
  20829. args: [],
  20830. source: "wrap\x0a\x09[ self signal ] tryCatch:\x0a\x09\x09[ self shouldBeStubbed ifTrue: [ self context stubToAtMost: 100 ] ]",
  20831. referencedClasses: [],
  20832. messageSends: ["tryCatch:", "signal", "ifTrue:", "shouldBeStubbed", "stubToAtMost:", "context"]
  20833. }),
  20834. $globals.JavaScriptException);
  20835. $core.addMethod(
  20836. $core.method({
  20837. selector: "on:",
  20838. protocol: "instance creation",
  20839. fn: function (anException){
  20840. var self=this,$self=this;
  20841. return $core.withContext(function($ctx1) {
  20842. var $1;
  20843. $1=$self._new();
  20844. $recv($1)._exception_(anException);
  20845. return $recv($1)._yourself();
  20846. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.a$cls)});
  20847. },
  20848. args: ["anException"],
  20849. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  20850. referencedClasses: [],
  20851. messageSends: ["exception:", "new", "yourself"]
  20852. }),
  20853. $globals.JavaScriptException.a$cls);
  20854. $core.addMethod(
  20855. $core.method({
  20856. selector: "on:context:",
  20857. protocol: "instance creation",
  20858. fn: function (anException,aMethodContext){
  20859. var self=this,$self=this;
  20860. return $core.withContext(function($ctx1) {
  20861. var $1;
  20862. $1=$self._new();
  20863. $recv($1)._exception_(anException);
  20864. $recv($1)._context_(aMethodContext);
  20865. return $recv($1)._yourself();
  20866. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.a$cls)});
  20867. },
  20868. args: ["anException", "aMethodContext"],
  20869. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  20870. referencedClasses: [],
  20871. messageSends: ["exception:", "new", "context:", "yourself"]
  20872. }),
  20873. $globals.JavaScriptException.a$cls);
  20874. $core.addClass("MessageNotUnderstood", $globals.Error, ["message", "receiver"], "Kernel-Exceptions");
  20875. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  20876. $core.addMethod(
  20877. $core.method({
  20878. selector: "message",
  20879. protocol: "accessing",
  20880. fn: function (){
  20881. var self=this,$self=this;
  20882. return $self["@message"];
  20883. },
  20884. args: [],
  20885. source: "message\x0a\x09^ message",
  20886. referencedClasses: [],
  20887. messageSends: []
  20888. }),
  20889. $globals.MessageNotUnderstood);
  20890. $core.addMethod(
  20891. $core.method({
  20892. selector: "message:",
  20893. protocol: "accessing",
  20894. fn: function (aMessage){
  20895. var self=this,$self=this;
  20896. $self["@message"]=aMessage;
  20897. return self;
  20898. },
  20899. args: ["aMessage"],
  20900. source: "message: aMessage\x0a\x09message := aMessage",
  20901. referencedClasses: [],
  20902. messageSends: []
  20903. }),
  20904. $globals.MessageNotUnderstood);
  20905. $core.addMethod(
  20906. $core.method({
  20907. selector: "messageText",
  20908. protocol: "accessing",
  20909. fn: function (){
  20910. var self=this,$self=this;
  20911. return $core.withContext(function($ctx1) {
  20912. var $1;
  20913. $1=$recv($recv($recv($self._receiver())._asString()).__comma(" does not understand #")).__comma($recv($self._message())._selector());
  20914. $ctx1.sendIdx[","]=1;
  20915. return $1;
  20916. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  20917. },
  20918. args: [],
  20919. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  20920. referencedClasses: [],
  20921. messageSends: [",", "asString", "receiver", "selector", "message"]
  20922. }),
  20923. $globals.MessageNotUnderstood);
  20924. $core.addMethod(
  20925. $core.method({
  20926. selector: "receiver",
  20927. protocol: "accessing",
  20928. fn: function (){
  20929. var self=this,$self=this;
  20930. return $self["@receiver"];
  20931. },
  20932. args: [],
  20933. source: "receiver\x0a\x09^ receiver",
  20934. referencedClasses: [],
  20935. messageSends: []
  20936. }),
  20937. $globals.MessageNotUnderstood);
  20938. $core.addMethod(
  20939. $core.method({
  20940. selector: "receiver:",
  20941. protocol: "accessing",
  20942. fn: function (anObject){
  20943. var self=this,$self=this;
  20944. $self["@receiver"]=anObject;
  20945. return self;
  20946. },
  20947. args: ["anObject"],
  20948. source: "receiver: anObject\x0a\x09receiver := anObject",
  20949. referencedClasses: [],
  20950. messageSends: []
  20951. }),
  20952. $globals.MessageNotUnderstood);
  20953. $core.addClass("NonBooleanReceiver", $globals.Error, ["object"], "Kernel-Exceptions");
  20954. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  20955. $core.addMethod(
  20956. $core.method({
  20957. selector: "object",
  20958. protocol: "accessing",
  20959. fn: function (){
  20960. var self=this,$self=this;
  20961. return $self["@object"];
  20962. },
  20963. args: [],
  20964. source: "object\x0a\x09^ object",
  20965. referencedClasses: [],
  20966. messageSends: []
  20967. }),
  20968. $globals.NonBooleanReceiver);
  20969. $core.addMethod(
  20970. $core.method({
  20971. selector: "object:",
  20972. protocol: "accessing",
  20973. fn: function (anObject){
  20974. var self=this,$self=this;
  20975. $self["@object"]=anObject;
  20976. return self;
  20977. },
  20978. args: ["anObject"],
  20979. source: "object: anObject\x0a\x09object := anObject",
  20980. referencedClasses: [],
  20981. messageSends: []
  20982. }),
  20983. $globals.NonBooleanReceiver);
  20984. $core.addMethod(
  20985. $core.method({
  20986. selector: "signalOn:",
  20987. protocol: "instance creation",
  20988. fn: function (anObject){
  20989. var self=this,$self=this;
  20990. return $core.withContext(function($ctx1) {
  20991. var $1;
  20992. $1=$self._new();
  20993. $recv($1)._object_(anObject);
  20994. return $recv($1)._signal();
  20995. }, function($ctx1) {$ctx1.fill(self,"signalOn:",{anObject:anObject},$globals.NonBooleanReceiver.a$cls)});
  20996. },
  20997. args: ["anObject"],
  20998. source: "signalOn: anObject\x0a\x09^ self new\x0a\x09\x09object: anObject;\x0a\x09\x09signal",
  20999. referencedClasses: [],
  21000. messageSends: ["object:", "new", "signal"]
  21001. }),
  21002. $globals.NonBooleanReceiver.a$cls);
  21003. });
  21004. define('amber_core/Kernel-Promises',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  21005. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21006. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21007. var $pkg = $core.addPackage("Kernel-Promises");
  21008. $pkg.innerEval = function (expr) { return eval(expr); };
  21009. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  21010. $core.addClass("Promise", $globals.Object, [], "Kernel-Promises");
  21011. $core.addMethod(
  21012. $core.method({
  21013. selector: "all:",
  21014. protocol: "composites",
  21015. fn: function (aCollection){
  21016. var self=this,$self=this;
  21017. return $core.withContext(function($ctx1) {
  21018. return Promise.all($recv(aCollection)._asArray());
  21019. return self;
  21020. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21021. },
  21022. args: ["aCollection"],
  21023. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  21024. referencedClasses: [],
  21025. messageSends: []
  21026. }),
  21027. $globals.Promise.a$cls);
  21028. $core.addMethod(
  21029. $core.method({
  21030. selector: "any:",
  21031. protocol: "composites",
  21032. fn: function (aCollection){
  21033. var self=this,$self=this;
  21034. return $core.withContext(function($ctx1) {
  21035. return Promise.race($recv(aCollection)._asArray());
  21036. return self;
  21037. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21038. },
  21039. args: ["aCollection"],
  21040. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  21041. referencedClasses: [],
  21042. messageSends: []
  21043. }),
  21044. $globals.Promise.a$cls);
  21045. $core.addMethod(
  21046. $core.method({
  21047. selector: "forBlock:",
  21048. protocol: "instance creation",
  21049. fn: function (aBlock){
  21050. var self=this,$self=this;
  21051. return $core.withContext(function($ctx1) {
  21052. return $recv($self._new())._then_(aBlock);
  21053. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21054. },
  21055. args: ["aBlock"],
  21056. source: "forBlock: aBlock\x0a\x22Returns a Promise that is resolved with the value of aBlock,\x0aand rejected if error happens while evaluating aBlock.\x22\x0a\x09^ self new then: aBlock",
  21057. referencedClasses: [],
  21058. messageSends: ["then:", "new"]
  21059. }),
  21060. $globals.Promise.a$cls);
  21061. $core.addMethod(
  21062. $core.method({
  21063. selector: "new",
  21064. protocol: "instance creation",
  21065. fn: function (){
  21066. var self=this,$self=this;
  21067. return $core.withContext(function($ctx1) {
  21068. return Promise.resolve();
  21069. return self;
  21070. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.a$cls)});
  21071. },
  21072. args: [],
  21073. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  21074. referencedClasses: [],
  21075. messageSends: []
  21076. }),
  21077. $globals.Promise.a$cls);
  21078. $core.addMethod(
  21079. $core.method({
  21080. selector: "new:",
  21081. protocol: "instance creation",
  21082. fn: function (aBlock){
  21083. var self=this,$self=this;
  21084. return $core.withContext(function($ctx1) {
  21085. return new Promise(function (resolve, reject) {
  21086. var model = {value: resolve, signal: reject};
  21087. aBlock._value_(model);
  21088. });
  21089. return self;
  21090. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21091. },
  21092. args: ["aBlock"],
  21093. source: "new: aBlock\x0a\x22Returns a Promise that is eventually resolved or rejected.\x0aPass a block that is called with one argument, model.\x0aYou should call model value: ... to resolve the promise\x0aand model signal: ... to reject the promise.\x0aIf error happens during run of the block,\x0apromise is rejected with that error as well.\x22\x0a<inlineJS: 'return new Promise(function (resolve, reject) {\x0a var model = {value: resolve, signal: reject};\x0a aBlock._value_(model);\x0a})'>",
  21094. referencedClasses: [],
  21095. messageSends: []
  21096. }),
  21097. $globals.Promise.a$cls);
  21098. $core.addMethod(
  21099. $core.method({
  21100. selector: "signal:",
  21101. protocol: "instance creation",
  21102. fn: function (anObject){
  21103. var self=this,$self=this;
  21104. return $core.withContext(function($ctx1) {
  21105. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  21106. return self;
  21107. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.a$cls)});
  21108. },
  21109. args: ["anObject"],
  21110. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  21111. referencedClasses: [],
  21112. messageSends: []
  21113. }),
  21114. $globals.Promise.a$cls);
  21115. $core.addMethod(
  21116. $core.method({
  21117. selector: "value:",
  21118. protocol: "instance creation",
  21119. fn: function (anObject){
  21120. var self=this,$self=this;
  21121. return $core.withContext(function($ctx1) {
  21122. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  21123. return self;
  21124. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.a$cls)});
  21125. },
  21126. args: ["anObject"],
  21127. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  21128. referencedClasses: [],
  21129. messageSends: []
  21130. }),
  21131. $globals.Promise.a$cls);
  21132. $core.addTrait("TThenable", "Kernel-Promises");
  21133. $core.addMethod(
  21134. $core.method({
  21135. selector: "catch:",
  21136. protocol: "promises",
  21137. fn: function (aBlock){
  21138. var self=this,$self=this;
  21139. return $core.withContext(function($ctx1) {
  21140. return self.then(null, function (err) {return $core.seamless(function () {
  21141. return aBlock._value_(err);
  21142. })});
  21143. return self;
  21144. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.TThenable)});
  21145. },
  21146. args: ["aBlock"],
  21147. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  21148. referencedClasses: [],
  21149. messageSends: []
  21150. }),
  21151. $globals.TThenable);
  21152. $core.addMethod(
  21153. $core.method({
  21154. selector: "on:do:",
  21155. protocol: "promises",
  21156. fn: function (aClass,aBlock){
  21157. var self=this,$self=this;
  21158. return $core.withContext(function($ctx1) {
  21159. return self.then(null, function (err) {return $core.seamless(function () {
  21160. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  21161. else throw err;
  21162. })});
  21163. return self;
  21164. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21165. },
  21166. args: ["aClass", "aBlock"],
  21167. source: "on: aClass do: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a if (err._isKindOf_(aClass)) return aBlock._value_(err);\x0a else throw err;\x0a})})'>",
  21168. referencedClasses: [],
  21169. messageSends: []
  21170. }),
  21171. $globals.TThenable);
  21172. $core.addMethod(
  21173. $core.method({
  21174. selector: "on:do:catch:",
  21175. protocol: "promises",
  21176. fn: function (aClass,aBlock,anotherBlock){
  21177. var self=this,$self=this;
  21178. return $core.withContext(function($ctx1) {
  21179. return $recv($self._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21180. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21181. },
  21182. args: ["aClass", "aBlock", "anotherBlock"],
  21183. source: "on: aClass do: aBlock catch: anotherBlock\x0a\x09^ (self on: aClass do: aBlock) catch: anotherBlock",
  21184. referencedClasses: [],
  21185. messageSends: ["catch:", "on:do:"]
  21186. }),
  21187. $globals.TThenable);
  21188. $core.addMethod(
  21189. $core.method({
  21190. selector: "then:",
  21191. protocol: "promises",
  21192. fn: function (aBlockOrArray){
  21193. var self=this,$self=this;
  21194. return $core.withContext(function($ctx1) {
  21195. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  21196. return array.reduce(function (soFar, aBlock) {
  21197. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  21198. function (result) {return $core.seamless(function () {
  21199. if (Array.isArray(result)) {
  21200. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  21201. } else {
  21202. return aBlock._value_(result);
  21203. }
  21204. })} :
  21205. function (result) {return $core.seamless(function () {
  21206. return aBlock._value_(result);
  21207. })}
  21208. );
  21209. }, self);
  21210. return self;
  21211. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.TThenable)});
  21212. },
  21213. args: ["aBlockOrArray"],
  21214. source: "then: aBlockOrArray\x0a\x22Accepts a block or array of blocks.\x0aEach of blocks in the array or the singleton one is\x0aused in .then call to a promise, to accept a result\x0aand transform it to the result for the next one.\x0aIn case a block has more than one argument\x0aand result is an array, first n-1 elements of the array\x0aare put into additional arguments beyond the first.\x0aThe first argument always contains the result as-is.\x22\x0a<inlineJS: '\x0avar array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];\x0areturn array.reduce(function (soFar, aBlock) {\x0a return soFar.then(typeof aBlock === \x22function\x22 && aBlock.length > 1 ?\x0a function (result) {return $core.seamless(function () {\x0a if (Array.isArray(result)) {\x0a return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));\x0a } else {\x0a return aBlock._value_(result);\x0a }\x0a })} :\x0a function (result) {return $core.seamless(function () {\x0a return aBlock._value_(result);\x0a })}\x0a );\x0a}, self)'>",
  21215. referencedClasses: [],
  21216. messageSends: []
  21217. }),
  21218. $globals.TThenable);
  21219. $core.addMethod(
  21220. $core.method({
  21221. selector: "then:catch:",
  21222. protocol: "promises",
  21223. fn: function (aBlockOrArray,anotherBlock){
  21224. var self=this,$self=this;
  21225. return $core.withContext(function($ctx1) {
  21226. return $recv($self._then_(aBlockOrArray))._catch_(anotherBlock);
  21227. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.TThenable)});
  21228. },
  21229. args: ["aBlockOrArray", "anotherBlock"],
  21230. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  21231. referencedClasses: [],
  21232. messageSends: ["catch:", "then:"]
  21233. }),
  21234. $globals.TThenable);
  21235. $core.addMethod(
  21236. $core.method({
  21237. selector: "then:on:do:",
  21238. protocol: "promises",
  21239. fn: function (aBlockOrArray,aClass,aBlock){
  21240. var self=this,$self=this;
  21241. return $core.withContext(function($ctx1) {
  21242. return $recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  21243. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21244. },
  21245. args: ["aBlockOrArray", "aClass", "aBlock"],
  21246. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  21247. referencedClasses: [],
  21248. messageSends: ["on:do:", "then:"]
  21249. }),
  21250. $globals.TThenable);
  21251. $core.addMethod(
  21252. $core.method({
  21253. selector: "then:on:do:catch:",
  21254. protocol: "promises",
  21255. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  21256. var self=this,$self=this;
  21257. return $core.withContext(function($ctx1) {
  21258. return $recv($recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21259. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21260. },
  21261. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  21262. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  21263. referencedClasses: [],
  21264. messageSends: ["catch:", "on:do:", "then:"]
  21265. }),
  21266. $globals.TThenable);
  21267. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.Promise);
  21268. });
  21269. define('amber_core/Kernel-Infrastructure',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects", "amber_core/Kernel-Promises"], function($boot){"use strict";
  21270. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21271. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21272. var $pkg = $core.addPackage("Kernel-Infrastructure");
  21273. $pkg.innerEval = function (expr) { return eval(expr); };
  21274. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  21275. $core.addClass("AmberBootstrapInitialization", $globals.Object, [], "Kernel-Infrastructure");
  21276. $core.addMethod(
  21277. $core.method({
  21278. selector: "organizeClasses",
  21279. protocol: "organization",
  21280. fn: function (){
  21281. var self=this,$self=this;
  21282. return $core.withContext(function($ctx1) {
  21283. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  21284. return $core.withContext(function($ctx2) {
  21285. return $recv(each)._enterOrganization();
  21286. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21287. }));
  21288. return self;
  21289. }, function($ctx1) {$ctx1.fill(self,"organizeClasses",{},$globals.AmberBootstrapInitialization.a$cls)});
  21290. },
  21291. args: [],
  21292. source: "organizeClasses\x0a\x09Smalltalk classes do: [ :each | each enterOrganization ]",
  21293. referencedClasses: ["Smalltalk"],
  21294. messageSends: ["do:", "classes", "enterOrganization"]
  21295. }),
  21296. $globals.AmberBootstrapInitialization.a$cls);
  21297. $core.addMethod(
  21298. $core.method({
  21299. selector: "organizeMethods",
  21300. protocol: "organization",
  21301. fn: function (){
  21302. var self=this,$self=this;
  21303. return $core.withContext(function($ctx1) {
  21304. $recv($recv($globals.Smalltalk)._classes())._do_((function(eachClass){
  21305. return $core.withContext(function($ctx2) {
  21306. return $recv($recv(eachClass)._definedMethods())._do_((function(eachMethod){
  21307. return $core.withContext(function($ctx3) {
  21308. return $recv($recv(eachMethod)._methodClass())._methodOrganizationEnter_andLeave_(eachMethod,nil);
  21309. }, function($ctx3) {$ctx3.fillBlock({eachMethod:eachMethod},$ctx2,2)});
  21310. }));
  21311. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  21312. }));
  21313. $ctx1.sendIdx["do:"]=1;
  21314. return self;
  21315. }, function($ctx1) {$ctx1.fill(self,"organizeMethods",{},$globals.AmberBootstrapInitialization.a$cls)});
  21316. },
  21317. args: [],
  21318. source: "organizeMethods\x0a\x09Smalltalk classes do: [ :eachClass |\x0a\x09\x09eachClass definedMethods do: [ :eachMethod |\x0a\x09\x09\x09eachMethod methodClass methodOrganizationEnter: eachMethod andLeave: nil ] ]",
  21319. referencedClasses: ["Smalltalk"],
  21320. messageSends: ["do:", "classes", "definedMethods", "methodOrganizationEnter:andLeave:", "methodClass"]
  21321. }),
  21322. $globals.AmberBootstrapInitialization.a$cls);
  21323. $core.addMethod(
  21324. $core.method({
  21325. selector: "run",
  21326. protocol: "public api",
  21327. fn: function (){
  21328. var self=this,$self=this;
  21329. return $core.withContext(function($ctx1) {
  21330. $recv($globals.SmalltalkImage)._initialize();
  21331. $self._organizeClasses();
  21332. $self._organizeMethods();
  21333. return $recv($globals.Smalltalk)._postLoad();
  21334. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.AmberBootstrapInitialization.a$cls)});
  21335. },
  21336. args: [],
  21337. source: "run\x0a\x09SmalltalkImage initialize.\x0a\x09self\x0a\x09\x09organizeClasses;\x0a\x09\x09organizeMethods.\x0a\x09^ Smalltalk postLoad",
  21338. referencedClasses: ["SmalltalkImage", "Smalltalk"],
  21339. messageSends: ["initialize", "organizeClasses", "organizeMethods", "postLoad"]
  21340. }),
  21341. $globals.AmberBootstrapInitialization.a$cls);
  21342. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  21343. $globals.JSObjectProxy.comment="I handle sending messages to JavaScript objects, making JavaScript object accessing from Amber fully transparent.\x0aMy instances make intensive use of `#doesNotUnderstand:`.\x0a\x0aMy instances are automatically created by Amber whenever a message is sent to a JavaScript object.\x0a\x0a## Usage examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a\x09window alert: 'hello world'.\x0a\x09window inspect.\x0a\x09(window jQuery: 'body') append: 'hello world'\x0a\x0aAmber messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown.\x0a\x0a## Message conversion rules\x0a\x0a- `someUser name` becomes `someUser.name`\x0a- `someUser name: 'John'` becomes `someUser name = \x22John\x22`\x0a- `console log: 'hello world'` becomes `console.log('hello world')`\x0a- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`\x0a\x0a__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`.";
  21344. $core.addMethod(
  21345. $core.method({
  21346. selector: "=",
  21347. protocol: "comparing",
  21348. fn: function (anObject){
  21349. var self=this,$self=this;
  21350. return $core.withContext(function($ctx1) {
  21351. var $2,$1;
  21352. $2=$recv(anObject)._class();
  21353. $ctx1.sendIdx["class"]=1;
  21354. $1=$recv($2).__eq_eq($self._class());
  21355. if(!$core.assert($1)){
  21356. return false;
  21357. }
  21358. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  21359. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  21360. },
  21361. args: ["anObject"],
  21362. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  21363. referencedClasses: ["JSObjectProxy"],
  21364. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  21365. }),
  21366. $globals.JSObjectProxy);
  21367. $core.addMethod(
  21368. $core.method({
  21369. selector: "asJavaScriptObject",
  21370. protocol: "converting",
  21371. fn: function (){
  21372. var self=this,$self=this;
  21373. return $self["@jsObject"];
  21374. },
  21375. args: [],
  21376. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  21377. referencedClasses: [],
  21378. messageSends: []
  21379. }),
  21380. $globals.JSObjectProxy);
  21381. $core.addMethod(
  21382. $core.method({
  21383. selector: "at:",
  21384. protocol: "accessing",
  21385. fn: function (aString){
  21386. var self=this,$self=this;
  21387. return $core.withContext(function($ctx1) {
  21388. return $self['@jsObject'][aString];
  21389. return self;
  21390. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  21391. },
  21392. args: ["aString"],
  21393. source: "at: aString\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString]'>",
  21394. referencedClasses: [],
  21395. messageSends: []
  21396. }),
  21397. $globals.JSObjectProxy);
  21398. $core.addMethod(
  21399. $core.method({
  21400. selector: "at:ifAbsent:",
  21401. protocol: "accessing",
  21402. fn: function (aString,aBlock){
  21403. var self=this,$self=this;
  21404. return $core.withContext(function($ctx1) {
  21405. var obj = $self['@jsObject'];
  21406. return aString in obj ? obj[aString] : aBlock._value();
  21407. ;
  21408. return self;
  21409. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21410. },
  21411. args: ["aString", "aBlock"],
  21412. source: "at: aString ifAbsent: aBlock\x0a\x09\x22return the aString property or evaluate aBlock if the property is not defined on the object\x22\x0a\x09<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09'>",
  21413. referencedClasses: [],
  21414. messageSends: []
  21415. }),
  21416. $globals.JSObjectProxy);
  21417. $core.addMethod(
  21418. $core.method({
  21419. selector: "at:ifPresent:",
  21420. protocol: "accessing",
  21421. fn: function (aString,aBlock){
  21422. var self=this,$self=this;
  21423. return $core.withContext(function($ctx1) {
  21424. var obj = $self['@jsObject'];
  21425. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  21426. ;
  21427. return self;
  21428. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21429. },
  21430. args: ["aString", "aBlock"],
  21431. source: "at: aString ifPresent: aBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined or return nil\x22\x0a\x09<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : nil;\x0a\x09'>",
  21432. referencedClasses: [],
  21433. messageSends: []
  21434. }),
  21435. $globals.JSObjectProxy);
  21436. $core.addMethod(
  21437. $core.method({
  21438. selector: "at:ifPresent:ifAbsent:",
  21439. protocol: "accessing",
  21440. fn: function (aString,aBlock,anotherBlock){
  21441. var self=this,$self=this;
  21442. return $core.withContext(function($ctx1) {
  21443. var obj = $self['@jsObject'];
  21444. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  21445. ;
  21446. return self;
  21447. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  21448. },
  21449. args: ["aString", "aBlock", "anotherBlock"],
  21450. source: "at: aString ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined\x0a\x09or return value of anotherBlock\x22\x0a\x09<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();\x0a\x09'>",
  21451. referencedClasses: [],
  21452. messageSends: []
  21453. }),
  21454. $globals.JSObjectProxy);
  21455. $core.addMethod(
  21456. $core.method({
  21457. selector: "at:put:",
  21458. protocol: "accessing",
  21459. fn: function (aString,anObject){
  21460. var self=this,$self=this;
  21461. return $core.withContext(function($ctx1) {
  21462. return $self['@jsObject'][aString] = anObject;
  21463. return self;
  21464. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  21465. },
  21466. args: ["aString", "anObject"],
  21467. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString] = anObject'>",
  21468. referencedClasses: [],
  21469. messageSends: []
  21470. }),
  21471. $globals.JSObjectProxy);
  21472. $core.addMethod(
  21473. $core.method({
  21474. selector: "catch:",
  21475. protocol: "promises",
  21476. fn: function (aBlock){
  21477. var self=this,$self=this;
  21478. return $core.withContext(function($ctx1) {
  21479. var $1,$2;
  21480. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21481. if($core.assert($1)){
  21482. return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_($self["@jsObject"],[aBlock]);
  21483. } else {
  21484. $2=(
  21485. $ctx1.supercall = true,
  21486. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._catch_.apply($self, [aBlock]));
  21487. $ctx1.supercall = false;
  21488. return $2;
  21489. }
  21490. return self;
  21491. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21492. },
  21493. args: ["aBlock"],
  21494. source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]",
  21495. referencedClasses: ["NativeFunction", "TThenable"],
  21496. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"]
  21497. }),
  21498. $globals.JSObjectProxy);
  21499. $core.addMethod(
  21500. $core.method({
  21501. selector: "doesNotUnderstand:",
  21502. protocol: "proxy",
  21503. fn: function (aMessage){
  21504. var self=this,$self=this;
  21505. return $core.withContext(function($ctx1) {
  21506. var $1,$receiver;
  21507. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  21508. if(($receiver = $1) == null || $receiver.a$nil){
  21509. return (
  21510. $ctx1.supercall = true,
  21511. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage]));
  21512. $ctx1.supercall = false;
  21513. } else {
  21514. var jsSelector;
  21515. jsSelector=$receiver;
  21516. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  21517. }
  21518. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  21519. },
  21520. args: ["aMessage"],
  21521. source: "doesNotUnderstand: aMessage\x0a\x09^ (JSObjectProxy lookupProperty: aMessage selector asJavaScriptPropertyName ofProxy: self)\x0a\x09\x09ifNil: [ super doesNotUnderstand: aMessage ]\x0a\x09\x09ifNotNil: [ :jsSelector | \x0a\x09\x09\x09JSObjectProxy \x0a\x09\x09\x09\x09forwardMessage: jsSelector \x0a\x09\x09\x09\x09withArguments: aMessage arguments\x0a\x09\x09\x09\x09ofProxy: self ]",
  21522. referencedClasses: ["JSObjectProxy"],
  21523. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  21524. }),
  21525. $globals.JSObjectProxy);
  21526. $core.addMethod(
  21527. $core.method({
  21528. selector: "in:",
  21529. protocol: "accessing",
  21530. fn: function (aValuable){
  21531. var self=this,$self=this;
  21532. return $core.withContext(function($ctx1) {
  21533. return $recv(aValuable)._value_($self["@jsObject"]);
  21534. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  21535. },
  21536. args: ["aValuable"],
  21537. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  21538. referencedClasses: [],
  21539. messageSends: ["value:"]
  21540. }),
  21541. $globals.JSObjectProxy);
  21542. $core.addMethod(
  21543. $core.method({
  21544. selector: "jsObject",
  21545. protocol: "accessing",
  21546. fn: function (){
  21547. var self=this,$self=this;
  21548. return $self["@jsObject"];
  21549. },
  21550. args: [],
  21551. source: "jsObject\x0a\x09^ jsObject",
  21552. referencedClasses: [],
  21553. messageSends: []
  21554. }),
  21555. $globals.JSObjectProxy);
  21556. $core.addMethod(
  21557. $core.method({
  21558. selector: "keysAndValuesDo:",
  21559. protocol: "enumerating",
  21560. fn: function (aBlock){
  21561. var self=this,$self=this;
  21562. return $core.withContext(function($ctx1) {
  21563. var o = $self['@jsObject'];
  21564. for(var i in o) {
  21565. aBlock._value_value_(i, o[i]);
  21566. }
  21567. ;
  21568. return self;
  21569. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21570. },
  21571. args: ["aBlock"],
  21572. source: "keysAndValuesDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var o = $self[''@jsObject''];\x0a\x09\x09for(var i in o) {\x0a\x09\x09\x09aBlock._value_value_(i, o[i]);\x0a\x09\x09}\x0a\x09'>",
  21573. referencedClasses: [],
  21574. messageSends: []
  21575. }),
  21576. $globals.JSObjectProxy);
  21577. $core.addMethod(
  21578. $core.method({
  21579. selector: "on:do:",
  21580. protocol: "promises",
  21581. fn: function (aClass,aBlock){
  21582. var self=this,$self=this;
  21583. return $core.withContext(function($ctx1) {
  21584. var $1,$2;
  21585. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21586. if($core.assert($1)){
  21587. return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_($self["@jsObject"],[aClass,aBlock]);
  21588. } else {
  21589. $2=(
  21590. $ctx1.supercall = true,
  21591. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._on_do_.apply($self, [aClass,aBlock]));
  21592. $ctx1.supercall = false;
  21593. return $2;
  21594. }
  21595. return self;
  21596. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  21597. },
  21598. args: ["aClass", "aBlock"],
  21599. source: "on: aClass do: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #on:do:) sendTo: jsObject arguments: {aClass. aBlock} ]\x0a\x09ifFalse: [ ^ super on: aClass do: aBlock ]",
  21600. referencedClasses: ["NativeFunction", "TThenable"],
  21601. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"]
  21602. }),
  21603. $globals.JSObjectProxy);
  21604. $core.addMethod(
  21605. $core.method({
  21606. selector: "printOn:",
  21607. protocol: "printing",
  21608. fn: function (aStream){
  21609. var self=this,$self=this;
  21610. return $core.withContext(function($ctx1) {
  21611. $recv(aStream)._nextPutAll_($self._printString());
  21612. return self;
  21613. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21614. },
  21615. args: ["aStream"],
  21616. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  21617. referencedClasses: [],
  21618. messageSends: ["nextPutAll:", "printString"]
  21619. }),
  21620. $globals.JSObjectProxy);
  21621. $core.addMethod(
  21622. $core.method({
  21623. selector: "printString",
  21624. protocol: "printing",
  21625. fn: function (){
  21626. var self=this,$self=this;
  21627. return $core.withContext(function($ctx1) {
  21628. var js = $self['@jsObject'];
  21629. return js.toString
  21630. ? js.toString()
  21631. : Object.prototype.toString.call(js)
  21632. ;
  21633. return self;
  21634. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  21635. },
  21636. args: [],
  21637. source: "printString\x0a\x09<inlineJS: '\x0a\x09\x09var js = $self[''@jsObject''];\x0a\x09\x09return js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09'>",
  21638. referencedClasses: [],
  21639. messageSends: []
  21640. }),
  21641. $globals.JSObjectProxy);
  21642. $core.addMethod(
  21643. $core.method({
  21644. selector: "putOn:",
  21645. protocol: "streaming",
  21646. fn: function (aStream){
  21647. var self=this,$self=this;
  21648. return $core.withContext(function($ctx1) {
  21649. $recv(aStream)._nextPutJSObject_($self["@jsObject"]);
  21650. return self;
  21651. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21652. },
  21653. args: ["aStream"],
  21654. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  21655. referencedClasses: [],
  21656. messageSends: ["nextPutJSObject:"]
  21657. }),
  21658. $globals.JSObjectProxy);
  21659. $core.addMethod(
  21660. $core.method({
  21661. selector: "removeKey:",
  21662. protocol: "accessing",
  21663. fn: function (aString){
  21664. var self=this,$self=this;
  21665. return $core.withContext(function($ctx1) {
  21666. delete $self['@jsObject'][aString]; return aString;
  21667. return self;
  21668. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aString:aString},$globals.JSObjectProxy)});
  21669. },
  21670. args: ["aString"],
  21671. source: "removeKey: aString\x0a\x09<inlineJS: 'delete $self[''@jsObject''][aString]; return aString'>",
  21672. referencedClasses: [],
  21673. messageSends: []
  21674. }),
  21675. $globals.JSObjectProxy);
  21676. $core.addMethod(
  21677. $core.method({
  21678. selector: "then:",
  21679. protocol: "promises",
  21680. fn: function (aBlockOrArray){
  21681. var self=this,$self=this;
  21682. return $core.withContext(function($ctx1) {
  21683. var $1,$2;
  21684. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21685. if($core.assert($1)){
  21686. return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_($self["@jsObject"],[aBlockOrArray]);
  21687. } else {
  21688. $2=(
  21689. $ctx1.supercall = true,
  21690. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._then_.apply($self, [aBlockOrArray]));
  21691. $ctx1.supercall = false;
  21692. return $2;
  21693. }
  21694. return self;
  21695. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  21696. },
  21697. args: ["aBlockOrArray"],
  21698. source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]",
  21699. referencedClasses: ["NativeFunction", "TThenable"],
  21700. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"]
  21701. }),
  21702. $globals.JSObjectProxy);
  21703. $core.addMethod(
  21704. $core.method({
  21705. selector: "addObjectVariablesTo:ofProxy:",
  21706. protocol: "proxy",
  21707. fn: function (aDictionary,aProxy){
  21708. var self=this,$self=this;
  21709. return $core.withContext(function($ctx1) {
  21710. var jsObject = aProxy['@jsObject'];
  21711. for(var i in jsObject) {
  21712. aDictionary._at_put_(i, jsObject[i]);
  21713. }
  21714. ;
  21715. return self;
  21716. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21717. },
  21718. args: ["aDictionary", "aProxy"],
  21719. source: "addObjectVariablesTo: aDictionary ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09var jsObject = aProxy[''@jsObject''];\x0a\x09\x09for(var i in jsObject) {\x0a\x09\x09\x09aDictionary._at_put_(i, jsObject[i]);\x0a\x09\x09}\x0a\x09'>",
  21720. referencedClasses: [],
  21721. messageSends: []
  21722. }),
  21723. $globals.JSObjectProxy.a$cls);
  21724. $core.addMethod(
  21725. $core.method({
  21726. selector: "compareJSObjectOfProxy:withProxy:",
  21727. protocol: "proxy",
  21728. fn: function (aProxy,anotherProxy){
  21729. var self=this,$self=this;
  21730. return $core.withContext(function($ctx1) {
  21731. var anotherJSObject = anotherProxy.a$cls ? anotherProxy["@jsObject"] : anotherProxy;
  21732. return aProxy["@jsObject"] === anotherJSObject;
  21733. return self;
  21734. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.a$cls)});
  21735. },
  21736. args: ["aProxy", "anotherProxy"],
  21737. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<inlineJS: '\x0a\x09var anotherJSObject = anotherProxy.a$cls ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a'>",
  21738. referencedClasses: [],
  21739. messageSends: []
  21740. }),
  21741. $globals.JSObjectProxy.a$cls);
  21742. $core.addMethod(
  21743. $core.method({
  21744. selector: "forwardMessage:withArguments:ofProxy:",
  21745. protocol: "proxy",
  21746. fn: function (aString,anArray,aProxy){
  21747. var self=this,$self=this;
  21748. return $core.withContext(function($ctx1) {
  21749. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  21750. ;
  21751. return self;
  21752. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21753. },
  21754. args: ["aString", "anArray", "aProxy"],
  21755. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  21756. referencedClasses: [],
  21757. messageSends: []
  21758. }),
  21759. $globals.JSObjectProxy.a$cls);
  21760. $core.addMethod(
  21761. $core.method({
  21762. selector: "jsObject:ofProxy:",
  21763. protocol: "proxy",
  21764. fn: function (aJSObject,aProxy){
  21765. var self=this,$self=this;
  21766. return $core.withContext(function($ctx1) {
  21767. aProxy['@jsObject'] = aJSObject;
  21768. return self;
  21769. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21770. },
  21771. args: ["aJSObject", "aProxy"],
  21772. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>",
  21773. referencedClasses: [],
  21774. messageSends: []
  21775. }),
  21776. $globals.JSObjectProxy.a$cls);
  21777. $core.addMethod(
  21778. $core.method({
  21779. selector: "lookupProperty:ofProxy:",
  21780. protocol: "proxy",
  21781. fn: function (aString,aProxy){
  21782. var self=this,$self=this;
  21783. return $core.withContext(function($ctx1) {
  21784. return aString in aProxy._jsObject() ? aString : nil;
  21785. return self;
  21786. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21787. },
  21788. args: ["aString", "aProxy"],
  21789. source: "lookupProperty: aString ofProxy: aProxy\x0a\x09\x22Looks up a property in JS object.\x0a\x09Answer the property if it is present, or nil if it is not present.\x22\x0a\x09\x0a\x09<inlineJS: 'return aString in aProxy._jsObject() ? aString : nil'>",
  21790. referencedClasses: [],
  21791. messageSends: []
  21792. }),
  21793. $globals.JSObjectProxy.a$cls);
  21794. $core.addMethod(
  21795. $core.method({
  21796. selector: "null",
  21797. protocol: "accessing",
  21798. fn: function (){
  21799. var self=this,$self=this;
  21800. return $core.withContext(function($ctx1) {
  21801. return null;
  21802. return self;
  21803. }, function($ctx1) {$ctx1.fill(self,"null",{},$globals.JSObjectProxy.a$cls)});
  21804. },
  21805. args: [],
  21806. source: "null\x0a\x09<inlineJS: 'return null'>",
  21807. referencedClasses: [],
  21808. messageSends: []
  21809. }),
  21810. $globals.JSObjectProxy.a$cls);
  21811. $core.addMethod(
  21812. $core.method({
  21813. selector: "on:",
  21814. protocol: "instance creation",
  21815. fn: function (aJSObject){
  21816. var self=this,$self=this;
  21817. var instance;
  21818. return $core.withContext(function($ctx1) {
  21819. instance=$self._new();
  21820. $self._jsObject_ofProxy_(aJSObject,instance);
  21821. return instance;
  21822. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.a$cls)});
  21823. },
  21824. args: ["aJSObject"],
  21825. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  21826. referencedClasses: [],
  21827. messageSends: ["new", "jsObject:ofProxy:"]
  21828. }),
  21829. $globals.JSObjectProxy.a$cls);
  21830. $core.addMethod(
  21831. $core.method({
  21832. selector: "undefined",
  21833. protocol: "accessing",
  21834. fn: function (){
  21835. var self=this,$self=this;
  21836. return $core.withContext(function($ctx1) {
  21837. return undefined;
  21838. return self;
  21839. }, function($ctx1) {$ctx1.fill(self,"undefined",{},$globals.JSObjectProxy.a$cls)});
  21840. },
  21841. args: [],
  21842. source: "undefined\x0a\x09<inlineJS: 'return undefined'>",
  21843. referencedClasses: [],
  21844. messageSends: []
  21845. }),
  21846. $globals.JSObjectProxy.a$cls);
  21847. $core.addClass("Organizer", $globals.Object, ["elements"], "Kernel-Infrastructure");
  21848. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  21849. $core.addMethod(
  21850. $core.method({
  21851. selector: "addElement:",
  21852. protocol: "accessing",
  21853. fn: function (anObject){
  21854. var self=this,$self=this;
  21855. return $core.withContext(function($ctx1) {
  21856. $recv($self._elements())._add_(anObject);
  21857. return self;
  21858. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  21859. },
  21860. args: ["anObject"],
  21861. source: "addElement: anObject\x0a\x09self elements add: anObject",
  21862. referencedClasses: [],
  21863. messageSends: ["add:", "elements"]
  21864. }),
  21865. $globals.Organizer);
  21866. $core.addMethod(
  21867. $core.method({
  21868. selector: "elements",
  21869. protocol: "accessing",
  21870. fn: function (){
  21871. var self=this,$self=this;
  21872. return $self["@elements"];
  21873. },
  21874. args: [],
  21875. source: "elements\x0a\x09^ elements",
  21876. referencedClasses: [],
  21877. messageSends: []
  21878. }),
  21879. $globals.Organizer);
  21880. $core.addMethod(
  21881. $core.method({
  21882. selector: "initialize",
  21883. protocol: "initialization",
  21884. fn: function (){
  21885. var self=this,$self=this;
  21886. return $core.withContext(function($ctx1) {
  21887. (
  21888. $ctx1.supercall = true,
  21889. ($globals.Organizer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  21890. $ctx1.supercall = false;
  21891. $self["@elements"]=$recv($globals.Set)._new();
  21892. return self;
  21893. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Organizer)});
  21894. },
  21895. args: [],
  21896. source: "initialize\x0a\x09super initialize.\x0a\x09elements := Set new",
  21897. referencedClasses: ["Set"],
  21898. messageSends: ["initialize", "new"]
  21899. }),
  21900. $globals.Organizer);
  21901. $core.addMethod(
  21902. $core.method({
  21903. selector: "removeElement:",
  21904. protocol: "accessing",
  21905. fn: function (anObject){
  21906. var self=this,$self=this;
  21907. return $core.withContext(function($ctx1) {
  21908. $recv($self._elements())._remove_ifAbsent_(anObject,(function(){
  21909. }));
  21910. return self;
  21911. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  21912. },
  21913. args: ["anObject"],
  21914. source: "removeElement: anObject\x0a\x09self elements remove: anObject ifAbsent: []",
  21915. referencedClasses: [],
  21916. messageSends: ["remove:ifAbsent:", "elements"]
  21917. }),
  21918. $globals.Organizer);
  21919. $core.addClass("ClassOrganizer", $globals.Organizer, ["traitOrBehavior"], "Kernel-Infrastructure");
  21920. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  21921. $core.addMethod(
  21922. $core.method({
  21923. selector: "addElement:",
  21924. protocol: "accessing",
  21925. fn: function (aString){
  21926. var self=this,$self=this;
  21927. return $core.withContext(function($ctx1) {
  21928. var $1,$3,$2;
  21929. (
  21930. $ctx1.supercall = true,
  21931. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($self, [aString]));
  21932. $ctx1.supercall = false;
  21933. $1=$recv($globals.SystemAnnouncer)._current();
  21934. $3=$recv($globals.ProtocolAdded)._new();
  21935. $recv($3)._protocol_(aString);
  21936. $recv($3)._theClass_($self._theClass());
  21937. $2=$recv($3)._yourself();
  21938. $recv($1)._announce_($2);
  21939. return self;
  21940. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  21941. },
  21942. args: ["aString"],
  21943. source: "addElement: aString\x0a\x09super addElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolAdded new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
  21944. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  21945. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  21946. }),
  21947. $globals.ClassOrganizer);
  21948. $core.addMethod(
  21949. $core.method({
  21950. selector: "removeElement:",
  21951. protocol: "accessing",
  21952. fn: function (aString){
  21953. var self=this,$self=this;
  21954. return $core.withContext(function($ctx1) {
  21955. var $1,$3,$2;
  21956. (
  21957. $ctx1.supercall = true,
  21958. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($self, [aString]));
  21959. $ctx1.supercall = false;
  21960. $1=$recv($globals.SystemAnnouncer)._current();
  21961. $3=$recv($globals.ProtocolRemoved)._new();
  21962. $recv($3)._protocol_(aString);
  21963. $recv($3)._theClass_($self._theClass());
  21964. $2=$recv($3)._yourself();
  21965. $recv($1)._announce_($2);
  21966. return self;
  21967. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  21968. },
  21969. args: ["aString"],
  21970. source: "removeElement: aString\x0a\x09super removeElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolRemoved new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
  21971. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  21972. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  21973. }),
  21974. $globals.ClassOrganizer);
  21975. $core.addMethod(
  21976. $core.method({
  21977. selector: "theClass",
  21978. protocol: "accessing",
  21979. fn: function (){
  21980. var self=this,$self=this;
  21981. return $self["@traitOrBehavior"];
  21982. },
  21983. args: [],
  21984. source: "theClass\x0a\x09^ traitOrBehavior",
  21985. referencedClasses: [],
  21986. messageSends: []
  21987. }),
  21988. $globals.ClassOrganizer);
  21989. $core.addMethod(
  21990. $core.method({
  21991. selector: "theClass:",
  21992. protocol: "accessing",
  21993. fn: function (aClass){
  21994. var self=this,$self=this;
  21995. $self["@traitOrBehavior"]=aClass;
  21996. return self;
  21997. },
  21998. args: ["aClass"],
  21999. source: "theClass: aClass\x0a\x09traitOrBehavior := aClass",
  22000. referencedClasses: [],
  22001. messageSends: []
  22002. }),
  22003. $globals.ClassOrganizer);
  22004. $core.addMethod(
  22005. $core.method({
  22006. selector: "on:",
  22007. protocol: "instance creation",
  22008. fn: function (aClass){
  22009. var self=this,$self=this;
  22010. return $core.withContext(function($ctx1) {
  22011. var $1;
  22012. $1=$self._new();
  22013. $recv($1)._theClass_(aClass);
  22014. return $recv($1)._yourself();
  22015. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.ClassOrganizer.a$cls)});
  22016. },
  22017. args: ["aClass"],
  22018. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  22019. referencedClasses: [],
  22020. messageSends: ["theClass:", "new", "yourself"]
  22021. }),
  22022. $globals.ClassOrganizer.a$cls);
  22023. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  22024. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  22025. $core.addClass("Package", $globals.Object, ["evalBlock", "basicTransport", "name", "transport", "imports", "dirty", "organization", "isReady"], "Kernel-Infrastructure");
  22026. $globals.Package.comment="I am similar to a \x22class category\x22 typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.\x0a\x0aEach package has a name and can be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0a\x0a## API\x0a\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name or with `Package class >> #name` directly:\x0a\x0a Smalltalk current packageAt: 'Kernel'\x0a Package named: 'Kernel'\x0a\x0aA package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a package supports \x22class extensions\x22 so a package can define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package load: 'Additional-Examples'";
  22027. $core.addMethod(
  22028. $core.method({
  22029. selector: "basicTransport",
  22030. protocol: "private",
  22031. fn: function (){
  22032. var self=this,$self=this;
  22033. return $self["@basicTransport"];
  22034. },
  22035. args: [],
  22036. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09^ basicTransport",
  22037. referencedClasses: [],
  22038. messageSends: []
  22039. }),
  22040. $globals.Package);
  22041. $core.addMethod(
  22042. $core.method({
  22043. selector: "beClean",
  22044. protocol: "accessing",
  22045. fn: function (){
  22046. var self=this,$self=this;
  22047. return $core.withContext(function($ctx1) {
  22048. var $1,$3,$2;
  22049. $self["@dirty"]=false;
  22050. $1=$recv($globals.SystemAnnouncer)._current();
  22051. $3=$recv($globals.PackageClean)._new();
  22052. $recv($3)._package_(self);
  22053. $2=$recv($3)._yourself();
  22054. $recv($1)._announce_($2);
  22055. return self;
  22056. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  22057. },
  22058. args: [],
  22059. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22060. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  22061. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22062. }),
  22063. $globals.Package);
  22064. $core.addMethod(
  22065. $core.method({
  22066. selector: "beDirty",
  22067. protocol: "accessing",
  22068. fn: function (){
  22069. var self=this,$self=this;
  22070. return $core.withContext(function($ctx1) {
  22071. var $1,$3,$2;
  22072. $self["@dirty"]=true;
  22073. $1=$recv($globals.SystemAnnouncer)._current();
  22074. $3=$recv($globals.PackageDirty)._new();
  22075. $recv($3)._package_(self);
  22076. $2=$recv($3)._yourself();
  22077. $recv($1)._announce_($2);
  22078. return self;
  22079. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  22080. },
  22081. args: [],
  22082. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22083. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  22084. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22085. }),
  22086. $globals.Package);
  22087. $core.addMethod(
  22088. $core.method({
  22089. selector: "classTemplate",
  22090. protocol: "accessing",
  22091. fn: function (){
  22092. var self=this,$self=this;
  22093. return $core.withContext(function($ctx1) {
  22094. return $recv($globals.String)._streamContents_((function(stream){
  22095. return $core.withContext(function($ctx2) {
  22096. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  22097. $ctx2.sendIdx["write:"]=1;
  22098. $recv(stream)._lf();
  22099. $ctx2.sendIdx["lf"]=1;
  22100. $recv(stream)._tab();
  22101. $ctx2.sendIdx["tab"]=1;
  22102. $recv(stream)._write_("instanceVariableNames: ''");
  22103. $ctx2.sendIdx["write:"]=2;
  22104. $recv(stream)._lf();
  22105. $recv(stream)._tab();
  22106. $recv(stream)._write_("package: ");
  22107. return $recv(stream)._print_($self._name());
  22108. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22109. }));
  22110. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  22111. },
  22112. args: [],
  22113. source: "classTemplate\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: 'Object subclass: #NameOfSubclass'; lf;\x0a\x09\x09tab; write: 'instanceVariableNames: '''''; lf;\x0a\x09\x09tab; write: 'package: '; print: self name ]",
  22114. referencedClasses: ["String"],
  22115. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  22116. }),
  22117. $globals.Package);
  22118. $core.addMethod(
  22119. $core.method({
  22120. selector: "classes",
  22121. protocol: "classes",
  22122. fn: function (){
  22123. var self=this,$self=this;
  22124. return $core.withContext(function($ctx1) {
  22125. return $recv($recv($self._organization())._elements())._copy();
  22126. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  22127. },
  22128. args: [],
  22129. source: "classes\x0a\x09^ self organization elements copy",
  22130. referencedClasses: [],
  22131. messageSends: ["copy", "elements", "organization"]
  22132. }),
  22133. $globals.Package);
  22134. $core.addMethod(
  22135. $core.method({
  22136. selector: "definition",
  22137. protocol: "accessing",
  22138. fn: function (){
  22139. var self=this,$self=this;
  22140. return $core.withContext(function($ctx1) {
  22141. var $1;
  22142. return $recv($globals.String)._streamContents_((function(stream){
  22143. return $core.withContext(function($ctx2) {
  22144. $1=$recv($self._class())._name();
  22145. $ctx2.sendIdx["name"]=1;
  22146. $recv(stream)._write_($1);
  22147. $ctx2.sendIdx["write:"]=1;
  22148. $recv(stream)._lf();
  22149. $ctx2.sendIdx["lf"]=1;
  22150. $recv(stream)._tab();
  22151. $ctx2.sendIdx["tab"]=1;
  22152. $recv(stream)._write_("named: ");
  22153. $ctx2.sendIdx["write:"]=2;
  22154. $recv(stream)._print_($self._name());
  22155. $recv(stream)._lf();
  22156. $ctx2.sendIdx["lf"]=2;
  22157. $recv(stream)._tab();
  22158. $ctx2.sendIdx["tab"]=2;
  22159. $recv(stream)._write_(["imports: ",$self._importsDefinition()]);
  22160. $ctx2.sendIdx["write:"]=3;
  22161. $recv(stream)._lf();
  22162. $recv(stream)._tab();
  22163. return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]);
  22164. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22165. }));
  22166. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  22167. },
  22168. args: [],
  22169. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: self class name; lf;\x0a\x09\x09tab; write: 'named: '; print: self name; lf;\x0a\x09\x09tab; write: { 'imports: '. self importsDefinition }; lf;\x0a\x09\x09tab; write: { 'transport: ('. self transport definition. ')' } ]",
  22170. referencedClasses: ["String"],
  22171. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  22172. }),
  22173. $globals.Package);
  22174. $core.addMethod(
  22175. $core.method({
  22176. selector: "eval:",
  22177. protocol: "evaluating",
  22178. fn: function (aString){
  22179. var self=this,$self=this;
  22180. return $core.withContext(function($ctx1) {
  22181. var $1,$receiver;
  22182. $1=$self["@evalBlock"];
  22183. if(($receiver = $1) == null || $receiver.a$nil){
  22184. return $recv($globals.Compiler)._eval_(aString);
  22185. } else {
  22186. return $recv($self["@evalBlock"])._value_(aString);
  22187. }
  22188. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Package)});
  22189. },
  22190. args: ["aString"],
  22191. source: "eval: aString\x0a\x09^ evalBlock\x0a\x09\x09ifNotNil: [ evalBlock value: aString ]\x0a\x09\x09ifNil: [ Compiler eval: aString ]",
  22192. referencedClasses: ["Compiler"],
  22193. messageSends: ["ifNotNil:ifNil:", "value:", "eval:"]
  22194. }),
  22195. $globals.Package);
  22196. $core.addMethod(
  22197. $core.method({
  22198. selector: "evalBlock",
  22199. protocol: "accessing",
  22200. fn: function (){
  22201. var self=this,$self=this;
  22202. return $self["@evalBlock"];
  22203. },
  22204. args: [],
  22205. source: "evalBlock\x0a\x09^ evalBlock",
  22206. referencedClasses: [],
  22207. messageSends: []
  22208. }),
  22209. $globals.Package);
  22210. $core.addMethod(
  22211. $core.method({
  22212. selector: "evalBlock:",
  22213. protocol: "accessing",
  22214. fn: function (aBlock){
  22215. var self=this,$self=this;
  22216. $self["@evalBlock"]=aBlock;
  22217. return self;
  22218. },
  22219. args: ["aBlock"],
  22220. source: "evalBlock: aBlock\x0a\x09evalBlock := aBlock",
  22221. referencedClasses: [],
  22222. messageSends: []
  22223. }),
  22224. $globals.Package);
  22225. $core.addMethod(
  22226. $core.method({
  22227. selector: "imports",
  22228. protocol: "accessing",
  22229. fn: function (){
  22230. var self=this,$self=this;
  22231. return $core.withContext(function($ctx1) {
  22232. var $1,$receiver;
  22233. $1=$self["@imports"];
  22234. if(($receiver = $1) == null || $receiver.a$nil){
  22235. $self._imports_([]);
  22236. return $self["@imports"];
  22237. } else {
  22238. return $1;
  22239. }
  22240. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  22241. },
  22242. args: [],
  22243. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09self imports: #().\x0a\x09\x09imports ]",
  22244. referencedClasses: [],
  22245. messageSends: ["ifNil:", "imports:"]
  22246. }),
  22247. $globals.Package);
  22248. $core.addMethod(
  22249. $core.method({
  22250. selector: "imports:",
  22251. protocol: "accessing",
  22252. fn: function (anArray){
  22253. var self=this,$self=this;
  22254. return $core.withContext(function($ctx1) {
  22255. $self._validateImports_(anArray);
  22256. $self["@imports"]=$recv(anArray)._asSet();
  22257. return self;
  22258. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  22259. },
  22260. args: ["anArray"],
  22261. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  22262. referencedClasses: [],
  22263. messageSends: ["validateImports:", "asSet"]
  22264. }),
  22265. $globals.Package);
  22266. $core.addMethod(
  22267. $core.method({
  22268. selector: "importsAsJson",
  22269. protocol: "converting",
  22270. fn: function (){
  22271. var self=this,$self=this;
  22272. return $core.withContext(function($ctx1) {
  22273. var $1;
  22274. return $recv($self._sortedImportsAsArray())._collect_((function(each){
  22275. return $core.withContext(function($ctx2) {
  22276. $1=$recv(each)._isString();
  22277. if($core.assert($1)){
  22278. return each;
  22279. } else {
  22280. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  22281. $ctx2.sendIdx[","]=1;
  22282. }
  22283. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22284. }));
  22285. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  22286. },
  22287. args: [],
  22288. source: "importsAsJson\x0a\x0a\x09^ self sortedImportsAsArray collect: [ :each |\x0a\x09\x09each isString\x0a\x09\x09\x09ifTrue: [ each ]\x0a\x09\x09\x09ifFalse: [ each key, '=', each value ]]",
  22289. referencedClasses: [],
  22290. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  22291. }),
  22292. $globals.Package);
  22293. $core.addMethod(
  22294. $core.method({
  22295. selector: "importsDefinition",
  22296. protocol: "accessing",
  22297. fn: function (){
  22298. var self=this,$self=this;
  22299. return $core.withContext(function($ctx1) {
  22300. return $recv($globals.String)._streamContents_((function(stream){
  22301. return $core.withContext(function($ctx2) {
  22302. $recv(stream)._write_("{");
  22303. $ctx2.sendIdx["write:"]=1;
  22304. $recv($self._sortedImportsAsArray())._do_separatedBy_((function(each){
  22305. return $core.withContext(function($ctx3) {
  22306. return $recv(stream)._print_(each);
  22307. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  22308. }),(function(){
  22309. return $core.withContext(function($ctx3) {
  22310. return $recv(stream)._write_(". ");
  22311. $ctx3.sendIdx["write:"]=2;
  22312. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  22313. }));
  22314. return $recv(stream)._write_("}");
  22315. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22316. }));
  22317. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  22318. },
  22319. args: [],
  22320. source: "importsDefinition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream write: '{'.\x0a\x09\x09self sortedImportsAsArray\x0a\x09\x09\x09do: [ :each | stream print: each ]\x0a\x09\x09\x09separatedBy: [ stream write: '. ' ].\x0a\x09\x09stream write: '}' ]",
  22321. referencedClasses: ["String"],
  22322. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  22323. }),
  22324. $globals.Package);
  22325. $core.addMethod(
  22326. $core.method({
  22327. selector: "importsFromJson:",
  22328. protocol: "converting",
  22329. fn: function (anArray){
  22330. var self=this,$self=this;
  22331. return $core.withContext(function($ctx1) {
  22332. var $1;
  22333. return $recv(anArray)._collect_((function(each){
  22334. var split;
  22335. return $core.withContext(function($ctx2) {
  22336. split=$recv(each)._tokenize_("=");
  22337. $1=$recv($recv(split)._size()).__eq((1));
  22338. if($core.assert($1)){
  22339. return $recv(split)._first();
  22340. $ctx2.sendIdx["first"]=1;
  22341. } else {
  22342. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  22343. }
  22344. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  22345. }));
  22346. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  22347. },
  22348. args: ["anArray"],
  22349. source: "importsFromJson: anArray\x0a\x09\x22Parses array of string, eg. #('asdf' 'qwer=tyuo')\x0a\x09into array of Strings and Associations,\x0a\x09eg. {'asdf'. 'qwer'->'tyuo'}\x22\x0a\x0a\x09^ anArray collect: [ :each |\x0a\x09\x09| split |\x0a\x09\x09split := each tokenize: '='.\x0a\x09\x09split size = 1\x0a\x09\x09\x09ifTrue: [ split first ]\x0a\x09\x09\x09ifFalse: [ split first -> split second ]]",
  22350. referencedClasses: [],
  22351. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  22352. }),
  22353. $globals.Package);
  22354. $core.addMethod(
  22355. $core.method({
  22356. selector: "initialize",
  22357. protocol: "initialization",
  22358. fn: function (){
  22359. var self=this,$self=this;
  22360. return $core.withContext(function($ctx1) {
  22361. (
  22362. $ctx1.supercall = true,
  22363. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  22364. $ctx1.supercall = false;
  22365. $self["@organization"]=$recv($globals.PackageOrganizer)._new();
  22366. $ctx1.sendIdx["new"]=1;
  22367. $self["@evalBlock"]=nil;
  22368. $self["@dirty"]=nil;
  22369. $self["@imports"]=nil;
  22370. $self["@isReady"]=$recv($globals.Promise)._new();
  22371. $self["@transport"]=nil;
  22372. return self;
  22373. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Package)});
  22374. },
  22375. args: [],
  22376. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09organization := PackageOrganizer new.\x0a\x09evalBlock := nil.\x0a\x09dirty := nil.\x0a\x09imports := nil.\x0a\x09isReady := Promise new.\x0a\x09transport := nil",
  22377. referencedClasses: ["PackageOrganizer", "Promise"],
  22378. messageSends: ["initialize", "new"]
  22379. }),
  22380. $globals.Package);
  22381. $core.addMethod(
  22382. $core.method({
  22383. selector: "isDirty",
  22384. protocol: "testing",
  22385. fn: function (){
  22386. var self=this,$self=this;
  22387. return $core.withContext(function($ctx1) {
  22388. var $1,$receiver;
  22389. $1=$self["@dirty"];
  22390. if(($receiver = $1) == null || $receiver.a$nil){
  22391. return false;
  22392. } else {
  22393. return $1;
  22394. }
  22395. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  22396. },
  22397. args: [],
  22398. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  22399. referencedClasses: [],
  22400. messageSends: ["ifNil:"]
  22401. }),
  22402. $globals.Package);
  22403. $core.addMethod(
  22404. $core.method({
  22405. selector: "isPackage",
  22406. protocol: "testing",
  22407. fn: function (){
  22408. var self=this,$self=this;
  22409. return true;
  22410. },
  22411. args: [],
  22412. source: "isPackage\x0a\x09^ true",
  22413. referencedClasses: [],
  22414. messageSends: []
  22415. }),
  22416. $globals.Package);
  22417. $core.addMethod(
  22418. $core.method({
  22419. selector: "isReady",
  22420. protocol: "accessing",
  22421. fn: function (){
  22422. var self=this,$self=this;
  22423. return $self["@isReady"];
  22424. },
  22425. args: [],
  22426. source: "isReady\x0a\x09^ isReady",
  22427. referencedClasses: [],
  22428. messageSends: []
  22429. }),
  22430. $globals.Package);
  22431. $core.addMethod(
  22432. $core.method({
  22433. selector: "isReady:",
  22434. protocol: "accessing",
  22435. fn: function (aPromise){
  22436. var self=this,$self=this;
  22437. $self["@isReady"]=aPromise;
  22438. return self;
  22439. },
  22440. args: ["aPromise"],
  22441. source: "isReady: aPromise\x0a\x09isReady := aPromise",
  22442. referencedClasses: [],
  22443. messageSends: []
  22444. }),
  22445. $globals.Package);
  22446. $core.addMethod(
  22447. $core.method({
  22448. selector: "javaScriptDescriptor:",
  22449. protocol: "accessing",
  22450. fn: function (anObject){
  22451. var self=this,$self=this;
  22452. var basicEval,basicImports,basicIsReady;
  22453. return $core.withContext(function($ctx1) {
  22454. basicEval=$recv(anObject)._at_ifAbsent_("innerEval",(function(){
  22455. return $core.withContext(function($ctx2) {
  22456. return nil._asJavaScriptObject();
  22457. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22458. }));
  22459. $ctx1.sendIdx["at:ifAbsent:"]=1;
  22460. basicImports=$recv(anObject)._at_ifAbsent_("imports",(function(){
  22461. return [];
  22462. }));
  22463. $ctx1.sendIdx["at:ifAbsent:"]=2;
  22464. $self["@basicTransport"]=$recv(anObject)._at_ifAbsent_("transport",(function(){
  22465. }));
  22466. $ctx1.sendIdx["at:ifAbsent:"]=3;
  22467. basicIsReady=$recv(anObject)._at_ifAbsent_("isReady",$recv($globals.Promise)._new());
  22468. $self._evalBlock_(basicEval);
  22469. $self._imports_($self._importsFromJson_(basicImports));
  22470. return self;
  22471. }, function($ctx1) {$ctx1.fill(self,"javaScriptDescriptor:",{anObject:anObject,basicEval:basicEval,basicImports:basicImports,basicIsReady:basicIsReady},$globals.Package)});
  22472. },
  22473. args: ["anObject"],
  22474. source: "javaScriptDescriptor: anObject\x0a\x09| basicEval basicImports basicIsReady |\x0a\x0a\x09basicEval := anObject at: 'innerEval' ifAbsent: [ nil asJavaScriptObject ].\x0a\x09basicImports := anObject at: 'imports' ifAbsent: [ #() ].\x0a\x09basicTransport := anObject at: 'transport' ifAbsent: [].\x0a\x09basicIsReady := anObject at: 'isReady' ifAbsent: Promise new.\x0a\x09\x09\x09\x0a\x09self\x0a\x09\x09evalBlock: basicEval;\x0a\x09\x09imports: (self importsFromJson: basicImports)",
  22475. referencedClasses: ["Promise"],
  22476. messageSends: ["at:ifAbsent:", "asJavaScriptObject", "new", "evalBlock:", "imports:", "importsFromJson:"]
  22477. }),
  22478. $globals.Package);
  22479. $core.addMethod(
  22480. $core.method({
  22481. selector: "loadDependencies",
  22482. protocol: "dependencies",
  22483. fn: function (){
  22484. var self=this,$self=this;
  22485. var classes,packages;
  22486. return $core.withContext(function($ctx1) {
  22487. var $1;
  22488. classes=$self._loadDependencyClasses();
  22489. $1=$recv($recv(classes)._collect_((function(each){
  22490. return $core.withContext(function($ctx2) {
  22491. return $recv(each)._package();
  22492. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22493. })))._asSet();
  22494. $recv($1)._remove_ifAbsent_(self,(function(){
  22495. }));
  22496. return $recv($1)._yourself();
  22497. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  22498. },
  22499. args: [],
  22500. 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",
  22501. referencedClasses: [],
  22502. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  22503. }),
  22504. $globals.Package);
  22505. $core.addMethod(
  22506. $core.method({
  22507. selector: "loadDependencyClasses",
  22508. protocol: "dependencies",
  22509. fn: function (){
  22510. var self=this,$self=this;
  22511. var starCategoryName;
  22512. return $core.withContext(function($ctx1) {
  22513. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  22514. starCategoryName="*".__comma($self._name());
  22515. $ctx1.sendIdx[","]=1;
  22516. $3=$self._classes();
  22517. $ctx1.sendIdx["classes"]=1;
  22518. $2=$recv($3)._collect_((function(each){
  22519. return $core.withContext(function($ctx2) {
  22520. return $recv(each)._superclass();
  22521. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22522. }));
  22523. $ctx1.sendIdx["collect:"]=1;
  22524. $1=$recv($2)._asSet();
  22525. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  22526. return $core.withContext(function($ctx2) {
  22527. $5=$recv(each)._protocols();
  22528. $ctx2.sendIdx["protocols"]=1;
  22529. $7=$recv(each)._theMetaClass();
  22530. if(($receiver = $7) == null || $receiver.a$nil){
  22531. $6=[];
  22532. } else {
  22533. var meta;
  22534. meta=$receiver;
  22535. $6=$recv(meta)._protocols();
  22536. }
  22537. $4=$recv($5).__comma($6);
  22538. return $recv($4)._includes_(starCategoryName);
  22539. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  22540. })));
  22541. $ctx1.sendIdx["addAll:"]=1;
  22542. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  22543. return $core.withContext(function($ctx2) {
  22544. return $recv($self._traitCompositions())._valuesDo_((function(each){
  22545. return $core.withContext(function($ctx3) {
  22546. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  22547. return $core.withContext(function($ctx4) {
  22548. return $recv(eachTT)._trait();
  22549. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  22550. })));
  22551. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  22552. }));
  22553. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  22554. })));
  22555. $recv($1)._remove_ifAbsent_(nil,(function(){
  22556. }));
  22557. return $recv($1)._yourself();
  22558. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  22559. },
  22560. args: [],
  22561. 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",
  22562. referencedClasses: ["Smalltalk", "Array"],
  22563. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  22564. }),
  22565. $globals.Package);
  22566. $core.addMethod(
  22567. $core.method({
  22568. selector: "name",
  22569. protocol: "accessing",
  22570. fn: function (){
  22571. var self=this,$self=this;
  22572. return $self["@name"];
  22573. },
  22574. args: [],
  22575. source: "name\x0a\x09^ name",
  22576. referencedClasses: [],
  22577. messageSends: []
  22578. }),
  22579. $globals.Package);
  22580. $core.addMethod(
  22581. $core.method({
  22582. selector: "name:",
  22583. protocol: "accessing",
  22584. fn: function (aString){
  22585. var self=this,$self=this;
  22586. $self["@name"]=aString;
  22587. return self;
  22588. },
  22589. args: ["aString"],
  22590. source: "name: aString\x0a\x09name := aString",
  22591. referencedClasses: [],
  22592. messageSends: []
  22593. }),
  22594. $globals.Package);
  22595. $core.addMethod(
  22596. $core.method({
  22597. selector: "organization",
  22598. protocol: "accessing",
  22599. fn: function (){
  22600. var self=this,$self=this;
  22601. return $self["@organization"];
  22602. },
  22603. args: [],
  22604. source: "organization\x0a\x09^ organization",
  22605. referencedClasses: [],
  22606. messageSends: []
  22607. }),
  22608. $globals.Package);
  22609. $core.addMethod(
  22610. $core.method({
  22611. selector: "printOn:",
  22612. protocol: "printing",
  22613. fn: function (aStream){
  22614. var self=this,$self=this;
  22615. return $core.withContext(function($ctx1) {
  22616. (
  22617. $ctx1.supercall = true,
  22618. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  22619. $ctx1.supercall = false;
  22620. $recv(aStream)._nextPutAll_(" (");
  22621. $ctx1.sendIdx["nextPutAll:"]=1;
  22622. $recv(aStream)._nextPutAll_($self._name());
  22623. $ctx1.sendIdx["nextPutAll:"]=2;
  22624. $recv(aStream)._nextPutAll_(")");
  22625. return self;
  22626. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  22627. },
  22628. args: ["aStream"],
  22629. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  22630. referencedClasses: [],
  22631. messageSends: ["printOn:", "nextPutAll:", "name"]
  22632. }),
  22633. $globals.Package);
  22634. $core.addMethod(
  22635. $core.method({
  22636. selector: "setupClasses",
  22637. protocol: "classes",
  22638. fn: function (){
  22639. var self=this,$self=this;
  22640. return $core.withContext(function($ctx1) {
  22641. $recv($self._classes())._do_((function(each){
  22642. return $core.withContext(function($ctx2) {
  22643. return $recv(each)._initialize();
  22644. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22645. }));
  22646. return self;
  22647. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  22648. },
  22649. args: [],
  22650. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  22651. referencedClasses: [],
  22652. messageSends: ["do:", "classes", "initialize"]
  22653. }),
  22654. $globals.Package);
  22655. $core.addMethod(
  22656. $core.method({
  22657. selector: "sortedClasses",
  22658. protocol: "classes",
  22659. fn: function (){
  22660. var self=this,$self=this;
  22661. return $core.withContext(function($ctx1) {
  22662. return $recv($self._class())._sortedClasses_($self._classes());
  22663. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  22664. },
  22665. args: [],
  22666. 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",
  22667. referencedClasses: [],
  22668. messageSends: ["sortedClasses:", "class", "classes"]
  22669. }),
  22670. $globals.Package);
  22671. $core.addMethod(
  22672. $core.method({
  22673. selector: "sortedImportsAsArray",
  22674. protocol: "private",
  22675. fn: function (){
  22676. var self=this,$self=this;
  22677. return $core.withContext(function($ctx1) {
  22678. var $3,$2,$4,$1,$6,$5,$7;
  22679. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  22680. return $core.withContext(function($ctx2) {
  22681. $3=$recv(a)._isString();
  22682. $ctx2.sendIdx["isString"]=1;
  22683. $2=$recv($3)._not();
  22684. $4=$recv(b)._isString();
  22685. $ctx2.sendIdx["isString"]=2;
  22686. $1=$recv($2).__and($4);
  22687. return $recv($1)._or_((function(){
  22688. return $core.withContext(function($ctx3) {
  22689. $6=$recv(a)._isString();
  22690. $ctx3.sendIdx["isString"]=3;
  22691. $5=$recv($6).__eq($recv(b)._isString());
  22692. return $recv($5)._and_((function(){
  22693. return $core.withContext(function($ctx4) {
  22694. $7=$recv(a)._value();
  22695. $ctx4.sendIdx["value"]=1;
  22696. return $recv($7).__lt_eq($recv(b)._value());
  22697. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  22698. }));
  22699. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  22700. }));
  22701. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  22702. }));
  22703. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  22704. },
  22705. args: [],
  22706. 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 ]]]",
  22707. referencedClasses: [],
  22708. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  22709. }),
  22710. $globals.Package);
  22711. $core.addMethod(
  22712. $core.method({
  22713. selector: "traitCompositions",
  22714. protocol: "dependencies",
  22715. fn: function (){
  22716. var self=this,$self=this;
  22717. var traitCompositions;
  22718. return $core.withContext(function($ctx1) {
  22719. var $1,$2,$3,$receiver;
  22720. traitCompositions=$recv($globals.Dictionary)._new();
  22721. $recv($self._classes())._do_((function(each){
  22722. return $core.withContext(function($ctx2) {
  22723. $1=traitCompositions;
  22724. $2=$recv(each)._traitComposition();
  22725. $ctx2.sendIdx["traitComposition"]=1;
  22726. $recv($1)._at_put_(each,$2);
  22727. $ctx2.sendIdx["at:put:"]=1;
  22728. $3=$recv(each)._theMetaClass();
  22729. if(($receiver = $3) == null || $receiver.a$nil){
  22730. return $3;
  22731. } else {
  22732. var meta;
  22733. meta=$receiver;
  22734. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  22735. }
  22736. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22737. }));
  22738. return $recv(traitCompositions)._reject_((function(each){
  22739. return $core.withContext(function($ctx2) {
  22740. return $recv(each)._isEmpty();
  22741. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  22742. }));
  22743. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  22744. },
  22745. args: [],
  22746. 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 ]",
  22747. referencedClasses: ["Dictionary"],
  22748. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  22749. }),
  22750. $globals.Package);
  22751. $core.addMethod(
  22752. $core.method({
  22753. selector: "transport",
  22754. protocol: "accessing",
  22755. fn: function (){
  22756. var self=this,$self=this;
  22757. return $core.withContext(function($ctx1) {
  22758. var $1,$receiver;
  22759. $1=$self["@transport"];
  22760. if(($receiver = $1) == null || $receiver.a$nil){
  22761. $self._transport_($recv($globals.PackageTransport)._fromJson_($self._basicTransport()));
  22762. return $self["@transport"];
  22763. } else {
  22764. return $1;
  22765. }
  22766. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  22767. },
  22768. args: [],
  22769. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09self transport: (PackageTransport fromJson: self basicTransport).\x0a\x09\x09transport ]",
  22770. referencedClasses: ["PackageTransport"],
  22771. messageSends: ["ifNil:", "transport:", "fromJson:", "basicTransport"]
  22772. }),
  22773. $globals.Package);
  22774. $core.addMethod(
  22775. $core.method({
  22776. selector: "transport:",
  22777. protocol: "accessing",
  22778. fn: function (aPackageTransport){
  22779. var self=this,$self=this;
  22780. return $core.withContext(function($ctx1) {
  22781. $self["@transport"]=aPackageTransport;
  22782. $recv(aPackageTransport)._package_(self);
  22783. return self;
  22784. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  22785. },
  22786. args: ["aPackageTransport"],
  22787. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  22788. referencedClasses: [],
  22789. messageSends: ["package:"]
  22790. }),
  22791. $globals.Package);
  22792. $core.addMethod(
  22793. $core.method({
  22794. selector: "validateImports:",
  22795. protocol: "validation",
  22796. fn: function (aCollection){
  22797. var self=this,$self=this;
  22798. return $core.withContext(function($ctx1) {
  22799. var $1,$2,$5,$4,$3,$6;
  22800. $recv(aCollection)._do_((function(import_){
  22801. return $core.withContext(function($ctx2) {
  22802. $1=$recv(import_)._isString();
  22803. $ctx2.sendIdx["isString"]=1;
  22804. if(!$core.assert($1)){
  22805. $2=$recv(import_)._respondsTo_("key");
  22806. if(!$core.assert($2)){
  22807. $self._error_("Imports must be Strings or Associations");
  22808. $ctx2.sendIdx["error:"]=1;
  22809. }
  22810. $5=$recv(import_)._key();
  22811. $ctx2.sendIdx["key"]=1;
  22812. $4=$recv($5)._isString();
  22813. $ctx2.sendIdx["isString"]=2;
  22814. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  22815. if(!$core.assert($3)){
  22816. $self._error_("Key and value must be Strings");
  22817. $ctx2.sendIdx["error:"]=2;
  22818. }
  22819. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  22820. if(!$core.assert($6)){
  22821. return $self._error_("Keys must be identifiers");
  22822. }
  22823. }
  22824. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  22825. }));
  22826. return self;
  22827. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  22828. },
  22829. args: ["aCollection"],
  22830. 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' ]]]",
  22831. referencedClasses: [],
  22832. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  22833. }),
  22834. $globals.Package);
  22835. $globals.Package.a$cls.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  22836. $core.addMethod(
  22837. $core.method({
  22838. selector: "named:",
  22839. protocol: "accessing",
  22840. fn: function (aPackageName){
  22841. var self=this,$self=this;
  22842. return $core.withContext(function($ctx1) {
  22843. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  22844. return $core.withContext(function($ctx2) {
  22845. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  22846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22847. }));
  22848. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  22849. },
  22850. args: ["aPackageName"],
  22851. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  22852. referencedClasses: ["Smalltalk"],
  22853. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  22854. }),
  22855. $globals.Package.a$cls);
  22856. $core.addMethod(
  22857. $core.method({
  22858. selector: "named:ifAbsent:",
  22859. protocol: "accessing",
  22860. fn: function (aPackageName,aBlock){
  22861. var self=this,$self=this;
  22862. return $core.withContext(function($ctx1) {
  22863. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  22864. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.a$cls)});
  22865. },
  22866. args: ["aPackageName", "aBlock"],
  22867. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  22868. referencedClasses: ["Smalltalk"],
  22869. messageSends: ["packageAt:ifAbsent:"]
  22870. }),
  22871. $globals.Package.a$cls);
  22872. $core.addMethod(
  22873. $core.method({
  22874. selector: "named:imports:transport:",
  22875. protocol: "accessing",
  22876. fn: function (aPackageName,anArray,aTransport){
  22877. var self=this,$self=this;
  22878. var pkg;
  22879. return $core.withContext(function($ctx1) {
  22880. pkg=$self._named_(aPackageName);
  22881. $recv(pkg)._imports_(anArray);
  22882. $recv(pkg)._transport_(aTransport);
  22883. return pkg;
  22884. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  22885. },
  22886. args: ["aPackageName", "anArray", "aTransport"],
  22887. source: "named: aPackageName imports: anArray transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg imports: anArray.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  22888. referencedClasses: [],
  22889. messageSends: ["named:", "imports:", "transport:"]
  22890. }),
  22891. $globals.Package.a$cls);
  22892. $core.addMethod(
  22893. $core.method({
  22894. selector: "named:javaScriptDescriptor:",
  22895. protocol: "instance creation",
  22896. fn: function (aString,anObject){
  22897. var self=this,$self=this;
  22898. var pkg;
  22899. return $core.withContext(function($ctx1) {
  22900. pkg=$recv($globals.Smalltalk)._createPackage_(aString);
  22901. $recv(pkg)._javaScriptDescriptor_(anObject);
  22902. return pkg;
  22903. }, function($ctx1) {$ctx1.fill(self,"named:javaScriptDescriptor:",{aString:aString,anObject:anObject,pkg:pkg},$globals.Package.a$cls)});
  22904. },
  22905. args: ["aString", "anObject"],
  22906. source: "named: aString javaScriptDescriptor: anObject\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := Smalltalk createPackage: aString.\x0a\x09pkg javaScriptDescriptor: anObject.\x0a\x09^ pkg",
  22907. referencedClasses: ["Smalltalk"],
  22908. messageSends: ["createPackage:", "javaScriptDescriptor:"]
  22909. }),
  22910. $globals.Package.a$cls);
  22911. $core.addMethod(
  22912. $core.method({
  22913. selector: "named:transport:",
  22914. protocol: "accessing",
  22915. fn: function (aPackageName,aTransport){
  22916. var self=this,$self=this;
  22917. var pkg;
  22918. return $core.withContext(function($ctx1) {
  22919. pkg=$self._named_(aPackageName);
  22920. $recv(pkg)._transport_(aTransport);
  22921. return pkg;
  22922. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  22923. },
  22924. args: ["aPackageName", "aTransport"],
  22925. source: "named: aPackageName transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  22926. referencedClasses: [],
  22927. messageSends: ["named:", "transport:"]
  22928. }),
  22929. $globals.Package.a$cls);
  22930. $core.addMethod(
  22931. $core.method({
  22932. selector: "new:",
  22933. protocol: "instance creation",
  22934. fn: function (aString){
  22935. var self=this,$self=this;
  22936. return $core.withContext(function($ctx1) {
  22937. var $1;
  22938. $1=$recv($globals.Package)._new();
  22939. $recv($1)._name_(aString);
  22940. return $recv($1)._yourself();
  22941. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},$globals.Package.a$cls)});
  22942. },
  22943. args: ["aString"],
  22944. source: "new: aString\x0a\x09^ Package new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  22945. referencedClasses: ["Package"],
  22946. messageSends: ["name:", "new", "yourself"]
  22947. }),
  22948. $globals.Package.a$cls);
  22949. $core.addMethod(
  22950. $core.method({
  22951. selector: "sortedClasses:",
  22952. protocol: "sorting",
  22953. fn: function (classes){
  22954. var self=this,$self=this;
  22955. var children,others,nodes,expandedClasses;
  22956. return $core.withContext(function($ctx1) {
  22957. var $1,$3,$2;
  22958. children=[];
  22959. others=[];
  22960. $recv(classes)._do_((function(each){
  22961. return $core.withContext(function($ctx2) {
  22962. $1=$recv(classes)._includes_($recv(each)._superclass());
  22963. if($core.assert($1)){
  22964. return $recv(others)._add_(each);
  22965. } else {
  22966. return $recv(children)._add_(each);
  22967. $ctx2.sendIdx["add:"]=1;
  22968. }
  22969. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22970. }));
  22971. $ctx1.sendIdx["do:"]=1;
  22972. nodes=$recv(children)._collect_((function(each){
  22973. return $core.withContext(function($ctx2) {
  22974. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  22975. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  22976. }));
  22977. nodes=$recv(nodes)._sorted_((function(a,b){
  22978. return $core.withContext(function($ctx2) {
  22979. $3=$recv(a)._theClass();
  22980. $ctx2.sendIdx["theClass"]=1;
  22981. $2=$recv($3)._name();
  22982. $ctx2.sendIdx["name"]=1;
  22983. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  22984. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  22985. }));
  22986. expandedClasses=$recv($globals.Array)._new();
  22987. $recv(nodes)._do_((function(aNode){
  22988. return $core.withContext(function($ctx2) {
  22989. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  22990. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  22991. }));
  22992. return expandedClasses;
  22993. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.a$cls)});
  22994. },
  22995. args: ["classes"],
  22996. 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",
  22997. referencedClasses: ["ClassSorterNode", "Array"],
  22998. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  22999. }),
  23000. $globals.Package.a$cls);
  23001. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  23002. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  23003. $core.addMethod(
  23004. $core.method({
  23005. selector: "announcer",
  23006. protocol: "accessing",
  23007. fn: function (){
  23008. var self=this,$self=this;
  23009. return $core.withContext(function($ctx1) {
  23010. return $recv($globals.SystemAnnouncer)._current();
  23011. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  23012. },
  23013. args: [],
  23014. source: "announcer\x0a\x09^ SystemAnnouncer current",
  23015. referencedClasses: ["SystemAnnouncer"],
  23016. messageSends: ["current"]
  23017. }),
  23018. $globals.PackageStateObserver);
  23019. $core.addMethod(
  23020. $core.method({
  23021. selector: "observeSystem",
  23022. protocol: "actions",
  23023. fn: function (){
  23024. var self=this,$self=this;
  23025. return $core.withContext(function($ctx1) {
  23026. var $1;
  23027. $1=$self._announcer();
  23028. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  23029. $ctx1.sendIdx["on:send:to:"]=1;
  23030. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  23031. $ctx1.sendIdx["on:send:to:"]=2;
  23032. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  23033. $ctx1.sendIdx["on:send:to:"]=3;
  23034. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  23035. return self;
  23036. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  23037. },
  23038. args: [],
  23039. 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",
  23040. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  23041. messageSends: ["on:send:to:", "announcer"]
  23042. }),
  23043. $globals.PackageStateObserver);
  23044. $core.addMethod(
  23045. $core.method({
  23046. selector: "onClassModification:",
  23047. protocol: "reactions",
  23048. fn: function (anAnnouncement){
  23049. var self=this,$self=this;
  23050. return $core.withContext(function($ctx1) {
  23051. var $1,$receiver;
  23052. $1=$recv(anAnnouncement)._theClass();
  23053. if(($receiver = $1) == null || $receiver.a$nil){
  23054. $1;
  23055. } else {
  23056. var theClass;
  23057. theClass=$receiver;
  23058. $recv($recv(theClass)._package())._beDirty();
  23059. }
  23060. return self;
  23061. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23062. },
  23063. args: ["anAnnouncement"],
  23064. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  23065. referencedClasses: [],
  23066. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  23067. }),
  23068. $globals.PackageStateObserver);
  23069. $core.addMethod(
  23070. $core.method({
  23071. selector: "onMethodModification:",
  23072. protocol: "reactions",
  23073. fn: function (anAnnouncement){
  23074. var self=this,$self=this;
  23075. return $core.withContext(function($ctx1) {
  23076. var $1,$receiver;
  23077. $1=$recv($recv(anAnnouncement)._method())._package();
  23078. if(($receiver = $1) == null || $receiver.a$nil){
  23079. $1;
  23080. } else {
  23081. var package_;
  23082. package_=$receiver;
  23083. $recv(package_)._beDirty();
  23084. }
  23085. return self;
  23086. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23087. },
  23088. args: ["anAnnouncement"],
  23089. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  23090. referencedClasses: [],
  23091. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  23092. }),
  23093. $globals.PackageStateObserver);
  23094. $core.addMethod(
  23095. $core.method({
  23096. selector: "onPackageAdded:",
  23097. protocol: "reactions",
  23098. fn: function (anAnnouncement){
  23099. var self=this,$self=this;
  23100. return $core.withContext(function($ctx1) {
  23101. $recv($recv(anAnnouncement)._package())._beDirty();
  23102. return self;
  23103. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23104. },
  23105. args: ["anAnnouncement"],
  23106. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  23107. referencedClasses: [],
  23108. messageSends: ["beDirty", "package"]
  23109. }),
  23110. $globals.PackageStateObserver);
  23111. $core.addMethod(
  23112. $core.method({
  23113. selector: "onProtocolModification:",
  23114. protocol: "reactions",
  23115. fn: function (anAnnouncement){
  23116. var self=this,$self=this;
  23117. return $core.withContext(function($ctx1) {
  23118. var $1,$receiver;
  23119. $1=$recv(anAnnouncement)._package();
  23120. if(($receiver = $1) == null || $receiver.a$nil){
  23121. $1;
  23122. } else {
  23123. var package_;
  23124. package_=$receiver;
  23125. $recv(package_)._beDirty();
  23126. }
  23127. return self;
  23128. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23129. },
  23130. args: ["anAnnouncement"],
  23131. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  23132. referencedClasses: [],
  23133. messageSends: ["ifNotNil:", "package", "beDirty"]
  23134. }),
  23135. $globals.PackageStateObserver);
  23136. $globals.PackageStateObserver.a$cls.iVarNames = ["current"];
  23137. $core.addMethod(
  23138. $core.method({
  23139. selector: "current",
  23140. protocol: "accessing",
  23141. fn: function (){
  23142. var self=this,$self=this;
  23143. return $core.withContext(function($ctx1) {
  23144. var $1,$receiver;
  23145. $1=$self["@current"];
  23146. if(($receiver = $1) == null || $receiver.a$nil){
  23147. $self["@current"]=$self._new();
  23148. return $self["@current"];
  23149. } else {
  23150. return $1;
  23151. }
  23152. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.a$cls)});
  23153. },
  23154. args: [],
  23155. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  23156. referencedClasses: [],
  23157. messageSends: ["ifNil:", "new"]
  23158. }),
  23159. $globals.PackageStateObserver.a$cls);
  23160. $core.addMethod(
  23161. $core.method({
  23162. selector: "initialize",
  23163. protocol: "initialization",
  23164. fn: function (){
  23165. var self=this,$self=this;
  23166. return $core.withContext(function($ctx1) {
  23167. $recv($self._current())._observeSystem();
  23168. return self;
  23169. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.a$cls)});
  23170. },
  23171. args: [],
  23172. source: "initialize\x0a\x09self current observeSystem",
  23173. referencedClasses: [],
  23174. messageSends: ["observeSystem", "current"]
  23175. }),
  23176. $globals.PackageStateObserver.a$cls);
  23177. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  23178. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  23179. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  23180. $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`";
  23181. $core.addMethod(
  23182. $core.method({
  23183. selector: "defaultValue",
  23184. protocol: "accessing",
  23185. fn: function (){
  23186. var self=this,$self=this;
  23187. return $self["@defaultValue"];
  23188. },
  23189. args: [],
  23190. source: "defaultValue\x0a\x09^ defaultValue",
  23191. referencedClasses: [],
  23192. messageSends: []
  23193. }),
  23194. $globals.Setting);
  23195. $core.addMethod(
  23196. $core.method({
  23197. selector: "defaultValue:",
  23198. protocol: "accessing",
  23199. fn: function (aStringifiableObject){
  23200. var self=this,$self=this;
  23201. $self["@defaultValue"]=aStringifiableObject;
  23202. return self;
  23203. },
  23204. args: ["aStringifiableObject"],
  23205. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  23206. referencedClasses: [],
  23207. messageSends: []
  23208. }),
  23209. $globals.Setting);
  23210. $core.addMethod(
  23211. $core.method({
  23212. selector: "key",
  23213. protocol: "accessing",
  23214. fn: function (){
  23215. var self=this,$self=this;
  23216. return $self["@key"];
  23217. },
  23218. args: [],
  23219. source: "key\x0a\x09^ key",
  23220. referencedClasses: [],
  23221. messageSends: []
  23222. }),
  23223. $globals.Setting);
  23224. $core.addMethod(
  23225. $core.method({
  23226. selector: "key:",
  23227. protocol: "accessing",
  23228. fn: function (aString){
  23229. var self=this,$self=this;
  23230. $self["@key"]=aString;
  23231. return self;
  23232. },
  23233. args: ["aString"],
  23234. source: "key: aString\x0a\x09key := aString",
  23235. referencedClasses: [],
  23236. messageSends: []
  23237. }),
  23238. $globals.Setting);
  23239. $core.addMethod(
  23240. $core.method({
  23241. selector: "value",
  23242. protocol: "accessing",
  23243. fn: function (){
  23244. var self=this,$self=this;
  23245. return $core.withContext(function($ctx1) {
  23246. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  23247. return $core.withContext(function($ctx2) {
  23248. return $self._defaultValue();
  23249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23250. }));
  23251. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  23252. },
  23253. args: [],
  23254. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  23255. referencedClasses: ["Smalltalk"],
  23256. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  23257. }),
  23258. $globals.Setting);
  23259. $core.addMethod(
  23260. $core.method({
  23261. selector: "value:",
  23262. protocol: "accessing",
  23263. fn: function (aStringifiableObject){
  23264. var self=this,$self=this;
  23265. return $core.withContext(function($ctx1) {
  23266. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  23267. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  23268. },
  23269. args: ["aStringifiableObject"],
  23270. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  23271. referencedClasses: ["Smalltalk"],
  23272. messageSends: ["at:put:", "settings", "key"]
  23273. }),
  23274. $globals.Setting);
  23275. $core.addMethod(
  23276. $core.method({
  23277. selector: "at:ifAbsent:",
  23278. protocol: "instance creation",
  23279. fn: function (aString,aDefaultValue){
  23280. var self=this,$self=this;
  23281. return $core.withContext(function($ctx1) {
  23282. var $1;
  23283. $1=(
  23284. $ctx1.supercall = true,
  23285. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  23286. $ctx1.supercall = false;
  23287. $recv($1)._key_(aString);
  23288. $recv($1)._defaultValue_(aDefaultValue);
  23289. return $recv($1)._yourself();
  23290. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.a$cls)});
  23291. },
  23292. args: ["aString", "aDefaultValue"],
  23293. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  23294. referencedClasses: [],
  23295. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  23296. }),
  23297. $globals.Setting.a$cls);
  23298. $core.addMethod(
  23299. $core.method({
  23300. selector: "new",
  23301. protocol: "instance creation",
  23302. fn: function (){
  23303. var self=this,$self=this;
  23304. return $core.withContext(function($ctx1) {
  23305. $self._shouldNotImplement();
  23306. return self;
  23307. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.a$cls)});
  23308. },
  23309. args: [],
  23310. source: "new\x0a\x09self shouldNotImplement",
  23311. referencedClasses: [],
  23312. messageSends: ["shouldNotImplement"]
  23313. }),
  23314. $globals.Setting.a$cls);
  23315. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables", "packageDictionary"], "Kernel-Infrastructure");
  23316. $globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `$core` declared in `base/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with global variable `Smalltalk`.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#globals #at:` answers a specific global (usually, a class) or `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `base/parser.js` parser file in order to work.";
  23317. $core.addMethod(
  23318. $core.method({
  23319. selector: "addGlobalJsVariable:",
  23320. protocol: "globals",
  23321. fn: function (aString){
  23322. var self=this,$self=this;
  23323. return $core.withContext(function($ctx1) {
  23324. $recv($self._globalJsVariables())._add_(aString);
  23325. return self;
  23326. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23327. },
  23328. args: ["aString"],
  23329. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  23330. referencedClasses: [],
  23331. messageSends: ["add:", "globalJsVariables"]
  23332. }),
  23333. $globals.SmalltalkImage);
  23334. $core.addMethod(
  23335. $core.method({
  23336. selector: "adoptPackageDescriptors",
  23337. protocol: "private",
  23338. fn: function (){
  23339. var self=this,$self=this;
  23340. return $core.withContext(function($ctx1) {
  23341. return $self._tryAdoptPackageDescriptorsBeyond_($recv($globals.Set)._new());
  23342. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDescriptors",{},$globals.SmalltalkImage)});
  23343. },
  23344. args: [],
  23345. source: "adoptPackageDescriptors\x0a\x09^ self tryAdoptPackageDescriptorsBeyond: Set new",
  23346. referencedClasses: ["Set"],
  23347. messageSends: ["tryAdoptPackageDescriptorsBeyond:", "new"]
  23348. }),
  23349. $globals.SmalltalkImage);
  23350. $core.addMethod(
  23351. $core.method({
  23352. selector: "amdRequire",
  23353. protocol: "accessing amd",
  23354. fn: function (){
  23355. var self=this,$self=this;
  23356. return $core.withContext(function($ctx1) {
  23357. return $recv($self._core())._at_("amdRequire");
  23358. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  23359. },
  23360. args: [],
  23361. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  23362. referencedClasses: [],
  23363. messageSends: ["at:", "core"]
  23364. }),
  23365. $globals.SmalltalkImage);
  23366. $core.addMethod(
  23367. $core.method({
  23368. selector: "asSmalltalkException:",
  23369. protocol: "error handling",
  23370. fn: function (anObject){
  23371. var self=this,$self=this;
  23372. return $core.withContext(function($ctx1) {
  23373. var $1;
  23374. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  23375. return $core.withContext(function($ctx2) {
  23376. return $recv(anObject)._isKindOf_($globals.Error);
  23377. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23378. }));
  23379. if($core.assert($1)){
  23380. return anObject;
  23381. } else {
  23382. return $recv($globals.JavaScriptException)._on_(anObject);
  23383. }
  23384. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  23385. },
  23386. args: ["anObject"],
  23387. 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 ]",
  23388. referencedClasses: ["Error", "JavaScriptException"],
  23389. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  23390. }),
  23391. $globals.SmalltalkImage);
  23392. $core.addMethod(
  23393. $core.method({
  23394. selector: "basicCreatePackage:",
  23395. protocol: "private",
  23396. fn: function (packageName){
  23397. var self=this,$self=this;
  23398. return $core.withContext(function($ctx1) {
  23399. return $recv($self._packageDictionary())._at_ifAbsentPut_(packageName,(function(){
  23400. return $core.withContext(function($ctx2) {
  23401. return $recv($globals.Package)._new_(packageName);
  23402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23403. }));
  23404. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  23405. },
  23406. args: ["packageName"],
  23407. 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 ]",
  23408. referencedClasses: ["Package"],
  23409. messageSends: ["at:ifAbsentPut:", "packageDictionary", "new:"]
  23410. }),
  23411. $globals.SmalltalkImage);
  23412. $core.addMethod(
  23413. $core.method({
  23414. selector: "basicParse:",
  23415. protocol: "private",
  23416. fn: function (aString){
  23417. var self=this,$self=this;
  23418. return $core.withContext(function($ctx1) {
  23419. return $recv($globals.SmalltalkParser)._parse_(aString);
  23420. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  23421. },
  23422. args: ["aString"],
  23423. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  23424. referencedClasses: ["SmalltalkParser"],
  23425. messageSends: ["parse:"]
  23426. }),
  23427. $globals.SmalltalkImage);
  23428. $core.addMethod(
  23429. $core.method({
  23430. selector: "cancelOptOut:",
  23431. protocol: "accessing",
  23432. fn: function (anObject){
  23433. var self=this,$self=this;
  23434. return $core.withContext(function($ctx1) {
  23435. delete anObject.klass; delete anObject.a$cls;;
  23436. return self;
  23437. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23438. },
  23439. args: ["anObject"],
  23440. 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;'>",
  23441. referencedClasses: [],
  23442. messageSends: []
  23443. }),
  23444. $globals.SmalltalkImage);
  23445. $core.addMethod(
  23446. $core.method({
  23447. selector: "classes",
  23448. protocol: "classes",
  23449. fn: function (){
  23450. var self=this,$self=this;
  23451. return $core.withContext(function($ctx1) {
  23452. return $recv($recv($self._core())._traitsOrClasses())._copy();
  23453. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  23454. },
  23455. args: [],
  23456. source: "classes\x0a\x09^ self core traitsOrClasses copy",
  23457. referencedClasses: [],
  23458. messageSends: ["copy", "traitsOrClasses", "core"]
  23459. }),
  23460. $globals.SmalltalkImage);
  23461. $core.addMethod(
  23462. $core.method({
  23463. selector: "core",
  23464. protocol: "accessing",
  23465. fn: function (){
  23466. var self=this,$self=this;
  23467. return $core.withContext(function($ctx1) {
  23468. return $core;
  23469. return self;
  23470. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  23471. },
  23472. args: [],
  23473. source: "core\x0a\x09<inlineJS: 'return $core'>",
  23474. referencedClasses: [],
  23475. messageSends: []
  23476. }),
  23477. $globals.SmalltalkImage);
  23478. $core.addMethod(
  23479. $core.method({
  23480. selector: "createPackage:",
  23481. protocol: "packages",
  23482. fn: function (packageName){
  23483. var self=this,$self=this;
  23484. var package_,announcement;
  23485. return $core.withContext(function($ctx1) {
  23486. var $1;
  23487. package_=$self._basicCreatePackage_(packageName);
  23488. $1=$recv($globals.PackageAdded)._new();
  23489. $recv($1)._package_(package_);
  23490. announcement=$recv($1)._yourself();
  23491. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  23492. return package_;
  23493. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  23494. },
  23495. args: ["packageName"],
  23496. 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",
  23497. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  23498. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  23499. }),
  23500. $globals.SmalltalkImage);
  23501. $core.addMethod(
  23502. $core.method({
  23503. selector: "defaultAmdNamespace",
  23504. protocol: "accessing amd",
  23505. fn: function (){
  23506. var self=this,$self=this;
  23507. return $core.withContext(function($ctx1) {
  23508. return "transport.defaultAmdNamespace"._settingValue();
  23509. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  23510. },
  23511. args: [],
  23512. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  23513. referencedClasses: [],
  23514. messageSends: ["settingValue"]
  23515. }),
  23516. $globals.SmalltalkImage);
  23517. $core.addMethod(
  23518. $core.method({
  23519. selector: "defaultAmdNamespace:",
  23520. protocol: "accessing amd",
  23521. fn: function (aString){
  23522. var self=this,$self=this;
  23523. return $core.withContext(function($ctx1) {
  23524. "transport.defaultAmdNamespace"._settingValue_(aString);
  23525. return self;
  23526. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  23527. },
  23528. args: ["aString"],
  23529. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  23530. referencedClasses: [],
  23531. messageSends: ["settingValue:"]
  23532. }),
  23533. $globals.SmalltalkImage);
  23534. $core.addMethod(
  23535. $core.method({
  23536. selector: "deleteClass:",
  23537. protocol: "private",
  23538. fn: function (aClass){
  23539. var self=this,$self=this;
  23540. return $core.withContext(function($ctx1) {
  23541. $core.removeClass(aClass);
  23542. return self;
  23543. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23544. },
  23545. args: ["aClass"],
  23546. 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)'>",
  23547. referencedClasses: [],
  23548. messageSends: []
  23549. }),
  23550. $globals.SmalltalkImage);
  23551. $core.addMethod(
  23552. $core.method({
  23553. selector: "deleteGlobalJsVariable:",
  23554. protocol: "globals",
  23555. fn: function (aString){
  23556. var self=this,$self=this;
  23557. return $core.withContext(function($ctx1) {
  23558. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  23559. }));
  23560. return self;
  23561. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23562. },
  23563. args: ["aString"],
  23564. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  23565. referencedClasses: [],
  23566. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  23567. }),
  23568. $globals.SmalltalkImage);
  23569. $core.addMethod(
  23570. $core.method({
  23571. selector: "existsJsGlobal:",
  23572. protocol: "testing",
  23573. fn: function (aString){
  23574. var self=this,$self=this;
  23575. return $core.withContext(function($ctx1) {
  23576. $self._deprecatedAPI_("Use Platform >> includesGlobal: instead");
  23577. return $recv($globals.Platform)._includesGlobal_(aString);
  23578. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  23579. },
  23580. args: ["aString"],
  23581. source: "existsJsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Platform >> includesGlobal: instead'.\x0a\x09^ Platform includesGlobal: aString",
  23582. referencedClasses: ["Platform"],
  23583. messageSends: ["deprecatedAPI:", "includesGlobal:"]
  23584. }),
  23585. $globals.SmalltalkImage);
  23586. $core.addMethod(
  23587. $core.method({
  23588. selector: "globalJsVariables",
  23589. protocol: "globals",
  23590. fn: function (){
  23591. var self=this,$self=this;
  23592. return $core.withContext(function($ctx1) {
  23593. var $1,$receiver;
  23594. $1=$self["@globalJsVariables"];
  23595. if(($receiver = $1) == null || $receiver.a$nil){
  23596. $self["@globalJsVariables"]=["window", "document", "process", "global"];
  23597. return $self["@globalJsVariables"];
  23598. } else {
  23599. return $1;
  23600. }
  23601. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  23602. },
  23603. args: [],
  23604. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global) ]",
  23605. referencedClasses: [],
  23606. messageSends: ["ifNil:"]
  23607. }),
  23608. $globals.SmalltalkImage);
  23609. $core.addMethod(
  23610. $core.method({
  23611. selector: "globals",
  23612. protocol: "accessing",
  23613. fn: function (){
  23614. var self=this,$self=this;
  23615. return $core.withContext(function($ctx1) {
  23616. return $globals;
  23617. return self;
  23618. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  23619. },
  23620. args: [],
  23621. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  23622. referencedClasses: [],
  23623. messageSends: []
  23624. }),
  23625. $globals.SmalltalkImage);
  23626. $core.addMethod(
  23627. $core.method({
  23628. selector: "includesKey:",
  23629. protocol: "accessing",
  23630. fn: function (aKey){
  23631. var self=this,$self=this;
  23632. return $core.withContext(function($ctx1) {
  23633. return $core.hasOwnProperty(aKey);
  23634. return self;
  23635. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  23636. },
  23637. args: ["aKey"],
  23638. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  23639. referencedClasses: [],
  23640. messageSends: []
  23641. }),
  23642. $globals.SmalltalkImage);
  23643. $core.addMethod(
  23644. $core.method({
  23645. selector: "isSmalltalkObject:",
  23646. protocol: "testing",
  23647. fn: function (anObject){
  23648. var self=this,$self=this;
  23649. return $core.withContext(function($ctx1) {
  23650. return anObject.a$cls != null;
  23651. return self;
  23652. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23653. },
  23654. args: ["anObject"],
  23655. 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'>",
  23656. referencedClasses: [],
  23657. messageSends: []
  23658. }),
  23659. $globals.SmalltalkImage);
  23660. $core.addMethod(
  23661. $core.method({
  23662. selector: "optOut:",
  23663. protocol: "accessing",
  23664. fn: function (anObject){
  23665. var self=this,$self=this;
  23666. return $core.withContext(function($ctx1) {
  23667. anObject.klass = null; anObject.a$cls = null;
  23668. return self;
  23669. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23670. },
  23671. args: ["anObject"],
  23672. 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'>",
  23673. referencedClasses: [],
  23674. messageSends: []
  23675. }),
  23676. $globals.SmalltalkImage);
  23677. $core.addMethod(
  23678. $core.method({
  23679. selector: "packageAt:ifAbsent:",
  23680. protocol: "packages",
  23681. fn: function (packageName,aBlock){
  23682. var self=this,$self=this;
  23683. return $core.withContext(function($ctx1) {
  23684. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  23685. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23686. },
  23687. args: ["packageName", "aBlock"],
  23688. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  23689. referencedClasses: [],
  23690. messageSends: ["at:ifAbsent:", "packageDictionary"]
  23691. }),
  23692. $globals.SmalltalkImage);
  23693. $core.addMethod(
  23694. $core.method({
  23695. selector: "packageAt:ifPresent:",
  23696. protocol: "packages",
  23697. fn: function (packageName,aBlock){
  23698. var self=this,$self=this;
  23699. return $core.withContext(function($ctx1) {
  23700. return $recv($self._packageDictionary())._at_ifPresent_(packageName,aBlock);
  23701. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifPresent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23702. },
  23703. args: ["packageName", "aBlock"],
  23704. source: "packageAt: packageName ifPresent: aBlock\x0a\x09^ self packageDictionary at: packageName ifPresent: aBlock",
  23705. referencedClasses: [],
  23706. messageSends: ["at:ifPresent:", "packageDictionary"]
  23707. }),
  23708. $globals.SmalltalkImage);
  23709. $core.addMethod(
  23710. $core.method({
  23711. selector: "packageDictionary",
  23712. protocol: "packages",
  23713. fn: function (){
  23714. var self=this,$self=this;
  23715. return $core.withContext(function($ctx1) {
  23716. var $1,$receiver;
  23717. $1=$self["@packageDictionary"];
  23718. if(($receiver = $1) == null || $receiver.a$nil){
  23719. $self["@packageDictionary"]=$recv($globals.Dictionary)._new();
  23720. return $self["@packageDictionary"];
  23721. } else {
  23722. return $1;
  23723. }
  23724. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{},$globals.SmalltalkImage)});
  23725. },
  23726. args: [],
  23727. source: "packageDictionary\x0a\x09^ packageDictionary ifNil: [ packageDictionary := Dictionary new ]",
  23728. referencedClasses: ["Dictionary"],
  23729. messageSends: ["ifNil:", "new"]
  23730. }),
  23731. $globals.SmalltalkImage);
  23732. $core.addMethod(
  23733. $core.method({
  23734. selector: "packages",
  23735. protocol: "packages",
  23736. fn: function (){
  23737. var self=this,$self=this;
  23738. return $core.withContext(function($ctx1) {
  23739. return $recv($recv($self._packageDictionary())._values())._copy();
  23740. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  23741. },
  23742. args: [],
  23743. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  23744. referencedClasses: [],
  23745. messageSends: ["copy", "values", "packageDictionary"]
  23746. }),
  23747. $globals.SmalltalkImage);
  23748. $core.addMethod(
  23749. $core.method({
  23750. selector: "parse:",
  23751. protocol: "accessing",
  23752. fn: function (aString){
  23753. var self=this,$self=this;
  23754. var result;
  23755. return $core.withContext(function($ctx1) {
  23756. var $1;
  23757. $recv((function(){
  23758. return $core.withContext(function($ctx2) {
  23759. result=$self._basicParse_(aString);
  23760. return result;
  23761. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23762. }))._tryCatch_((function(ex){
  23763. return $core.withContext(function($ctx2) {
  23764. return $recv($self._parseError_parsing_(ex,aString))._signal();
  23765. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  23766. }));
  23767. $1=result;
  23768. $recv($1)._source_(aString);
  23769. return $recv($1)._yourself();
  23770. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  23771. },
  23772. args: ["aString"],
  23773. 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",
  23774. referencedClasses: [],
  23775. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  23776. }),
  23777. $globals.SmalltalkImage);
  23778. $core.addMethod(
  23779. $core.method({
  23780. selector: "parseError:parsing:",
  23781. protocol: "error handling",
  23782. fn: function (anException,aString){
  23783. var self=this,$self=this;
  23784. return $core.withContext(function($ctx1) {
  23785. var $1,$2,$9,$8,$7,$6,$5,$4,$3,$receiver;
  23786. $1=$recv(anException)._basicAt_("location");
  23787. $ctx1.sendIdx["basicAt:"]=1;
  23788. if(($receiver = $1) == null || $receiver.a$nil){
  23789. return $recv(anException)._pass();
  23790. } else {
  23791. var loc;
  23792. loc=$receiver;
  23793. $2=$recv($globals.ParseError)._new();
  23794. $9=$recv(loc)._start();
  23795. $ctx1.sendIdx["start"]=1;
  23796. $8=$recv($9)._line();
  23797. $7="Parse error on line ".__comma($8);
  23798. $6=$recv($7).__comma(" column ");
  23799. $ctx1.sendIdx[","]=4;
  23800. $5=$recv($6).__comma($recv($recv(loc)._start())._column());
  23801. $ctx1.sendIdx[","]=3;
  23802. $4=$recv($5).__comma(" : Unexpected character ");
  23803. $ctx1.sendIdx[","]=2;
  23804. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  23805. $ctx1.sendIdx[","]=1;
  23806. $recv($2)._messageText_($3);
  23807. return $recv($2)._yourself();
  23808. }
  23809. return self;
  23810. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  23811. },
  23812. args: ["anException", "aString"],
  23813. source: "parseError: anException parsing: aString\x0a\x09(anException basicAt: 'location')\x0a\x09\x09ifNil: [ ^ anException pass ]\x0a\x09\x09ifNotNil: [ :loc |\x0a\x09\x09\x09^ ParseError new \x0a\x09\x09\x09\x09messageText: \x0a\x09\x09\x09\x09\x09'Parse error on line ', loc start line ,\x0a\x09\x09\x09\x09\x09' column ' , loc start column ,\x0a\x09\x09\x09\x09\x09' : Unexpected character ', (anException basicAt: 'found');\x0a\x09\x09\x09\x09yourself ]",
  23814. referencedClasses: ["ParseError"],
  23815. messageSends: ["ifNil:ifNotNil:", "basicAt:", "pass", "messageText:", "new", ",", "line", "start", "column", "yourself"]
  23816. }),
  23817. $globals.SmalltalkImage);
  23818. $core.addMethod(
  23819. $core.method({
  23820. selector: "postLoad",
  23821. protocol: "image",
  23822. fn: function (){
  23823. var self=this,$self=this;
  23824. return $core.withContext(function($ctx1) {
  23825. var $1;
  23826. return $recv($self._adoptPackageDescriptors())._then_((function(pkgs){
  23827. var classes;
  23828. return $core.withContext(function($ctx2) {
  23829. $recv(pkgs)._do_("beClean");
  23830. $ctx2.sendIdx["do:"]=1;
  23831. classes=$recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  23832. return $core.withContext(function($ctx3) {
  23833. return $recv(pkgs)._includes_($recv(each)._package());
  23834. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  23835. }));
  23836. $recv(classes)._do_((function(each){
  23837. return $core.withContext(function($ctx3) {
  23838. $1=$recv(each).__eq($self._class());
  23839. if(!$core.assert($1)){
  23840. return $recv(each)._initialize();
  23841. }
  23842. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  23843. }));
  23844. return $self._sweepPackageDescriptors_(pkgs);
  23845. }, function($ctx2) {$ctx2.fillBlock({pkgs:pkgs,classes:classes},$ctx1,1)});
  23846. }));
  23847. }, function($ctx1) {$ctx1.fill(self,"postLoad",{},$globals.SmalltalkImage)});
  23848. },
  23849. args: [],
  23850. source: "postLoad\x0a\x09^ self adoptPackageDescriptors then: [ :pkgs |\x0a\x09\x09| classes |\x0a\x09\x09pkgs do: #beClean.\x0a\x09\x09classes := Smalltalk classes select:\x0a\x09\x09\x09[ :each | pkgs includes: each package ].\x0a\x09\x09classes do: [ :each |\x0a\x09\x09\x09each = self class ifFalse: [ each initialize ] ].\x0a\x09\x09self sweepPackageDescriptors: pkgs ]",
  23851. referencedClasses: ["Smalltalk"],
  23852. messageSends: ["then:", "adoptPackageDescriptors", "do:", "select:", "classes", "includes:", "package", "ifFalse:", "=", "class", "initialize", "sweepPackageDescriptors:"]
  23853. }),
  23854. $globals.SmalltalkImage);
  23855. $core.addMethod(
  23856. $core.method({
  23857. selector: "pseudoVariableNames",
  23858. protocol: "accessing",
  23859. fn: function (){
  23860. var self=this,$self=this;
  23861. return ["self", "super", "nil", "true", "false", "thisContext"];
  23862. },
  23863. args: [],
  23864. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  23865. referencedClasses: [],
  23866. messageSends: []
  23867. }),
  23868. $globals.SmalltalkImage);
  23869. $core.addMethod(
  23870. $core.method({
  23871. selector: "readJSObject:",
  23872. protocol: "accessing",
  23873. fn: function (anObject){
  23874. var self=this,$self=this;
  23875. return $core.withContext(function($ctx1) {
  23876. return $core.readJSObject(anObject);
  23877. return self;
  23878. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23879. },
  23880. args: ["anObject"],
  23881. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  23882. referencedClasses: [],
  23883. messageSends: []
  23884. }),
  23885. $globals.SmalltalkImage);
  23886. $core.addMethod(
  23887. $core.method({
  23888. selector: "removeClass:",
  23889. protocol: "classes",
  23890. fn: function (aClass){
  23891. var self=this,$self=this;
  23892. return $core.withContext(function($ctx1) {
  23893. var $1,$2,$5,$4,$6,$3,$7,$8,$10,$9,$receiver;
  23894. $1=$recv(aClass)._isMetaclass();
  23895. if($core.assert($1)){
  23896. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  23897. $ctx1.sendIdx[","]=1;
  23898. $self._error_($2);
  23899. $ctx1.sendIdx["error:"]=1;
  23900. }
  23901. $recv(aClass)._allSubclassesDo_((function(subclass){
  23902. return $core.withContext(function($ctx2) {
  23903. $5=$recv(aClass)._name();
  23904. $ctx2.sendIdx["name"]=1;
  23905. $4=$recv($5).__comma(" has a subclass: ");
  23906. $ctx2.sendIdx[","]=3;
  23907. $6=$recv(subclass)._name();
  23908. $ctx2.sendIdx["name"]=2;
  23909. $3=$recv($4).__comma($6);
  23910. $ctx2.sendIdx[","]=2;
  23911. return $self._error_($3);
  23912. $ctx2.sendIdx["error:"]=2;
  23913. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  23914. }));
  23915. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  23916. return $core.withContext(function($ctx2) {
  23917. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  23918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  23919. }));
  23920. $self._deleteClass_(aClass);
  23921. $recv(aClass)._setTraitComposition_([]);
  23922. $ctx1.sendIdx["setTraitComposition:"]=1;
  23923. $7=$recv(aClass)._theMetaClass();
  23924. if(($receiver = $7) == null || $receiver.a$nil){
  23925. $7;
  23926. } else {
  23927. var meta;
  23928. meta=$receiver;
  23929. $recv(meta)._setTraitComposition_([]);
  23930. }
  23931. $8=$recv($globals.SystemAnnouncer)._current();
  23932. $10=$recv($globals.ClassRemoved)._new();
  23933. $recv($10)._theClass_(aClass);
  23934. $9=$recv($10)._yourself();
  23935. $recv($8)._announce_($9);
  23936. return self;
  23937. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23938. },
  23939. args: ["aClass"],
  23940. 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)",
  23941. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  23942. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "ifNotNil:", "theMetaClass", "announce:", "current", "theClass:", "new", "yourself"]
  23943. }),
  23944. $globals.SmalltalkImage);
  23945. $core.addMethod(
  23946. $core.method({
  23947. selector: "removePackage:",
  23948. protocol: "packages",
  23949. fn: function (packageName){
  23950. var self=this,$self=this;
  23951. var pkg;
  23952. return $core.withContext(function($ctx1) {
  23953. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  23954. return $core.withContext(function($ctx2) {
  23955. return $self._error_("Missing package: ".__comma(packageName));
  23956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23957. }));
  23958. $recv($recv(pkg)._classes())._do_((function(each){
  23959. return $core.withContext(function($ctx2) {
  23960. return $self._removeClass_(each);
  23961. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  23962. }));
  23963. $recv($self._packageDictionary())._removeKey_(packageName);
  23964. return self;
  23965. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  23966. },
  23967. args: ["packageName"],
  23968. 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",
  23969. referencedClasses: [],
  23970. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  23971. }),
  23972. $globals.SmalltalkImage);
  23973. $core.addMethod(
  23974. $core.method({
  23975. selector: "renamePackage:to:",
  23976. protocol: "packages",
  23977. fn: function (packageName,newName){
  23978. var self=this,$self=this;
  23979. var pkg;
  23980. return $core.withContext(function($ctx1) {
  23981. var $1,$2,$3;
  23982. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  23983. return $core.withContext(function($ctx2) {
  23984. $1="Missing package: ".__comma(packageName);
  23985. $ctx2.sendIdx[","]=1;
  23986. return $self._error_($1);
  23987. $ctx2.sendIdx["error:"]=1;
  23988. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23989. }));
  23990. $self._packageAt_ifPresent_(newName,(function(){
  23991. return $core.withContext(function($ctx2) {
  23992. return $self._error_("Already exists a package called: ".__comma(newName));
  23993. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  23994. }));
  23995. $2=pkg;
  23996. $recv($2)._name_(newName);
  23997. $recv($2)._beDirty();
  23998. $3=$self._packageDictionary();
  23999. $recv($3)._at_put_(newName,pkg);
  24000. $recv($3)._removeKey_(packageName);
  24001. return self;
  24002. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  24003. },
  24004. args: ["packageName", "newName"],
  24005. 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",
  24006. referencedClasses: [],
  24007. messageSends: ["packageAt:ifAbsent:", "error:", ",", "packageAt:ifPresent:", "name:", "beDirty", "at:put:", "packageDictionary", "removeKey:"]
  24008. }),
  24009. $globals.SmalltalkImage);
  24010. $core.addMethod(
  24011. $core.method({
  24012. selector: "reservedWords",
  24013. protocol: "accessing",
  24014. fn: function (){
  24015. var self=this,$self=this;
  24016. 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"];
  24017. },
  24018. args: [],
  24019. 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)",
  24020. referencedClasses: [],
  24021. messageSends: []
  24022. }),
  24023. $globals.SmalltalkImage);
  24024. $core.addMethod(
  24025. $core.method({
  24026. selector: "settings",
  24027. protocol: "accessing",
  24028. fn: function (){
  24029. var self=this,$self=this;
  24030. return $globals.SmalltalkSettings;
  24031. },
  24032. args: [],
  24033. source: "settings\x0a\x09^ SmalltalkSettings",
  24034. referencedClasses: ["SmalltalkSettings"],
  24035. messageSends: []
  24036. }),
  24037. $globals.SmalltalkImage);
  24038. $core.addMethod(
  24039. $core.method({
  24040. selector: "sweepPackageDescriptors:",
  24041. protocol: "private",
  24042. fn: function (pkgs){
  24043. var self=this,$self=this;
  24044. var pd;
  24045. return $core.withContext(function($ctx1) {
  24046. pd=$recv($self._core())._packageDescriptors();
  24047. $recv(pkgs)._do_((function(each){
  24048. return $core.withContext(function($ctx2) {
  24049. return $recv(pd)._removeKey_($recv(each)._name());
  24050. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24051. }));
  24052. return self;
  24053. }, function($ctx1) {$ctx1.fill(self,"sweepPackageDescriptors:",{pkgs:pkgs,pd:pd},$globals.SmalltalkImage)});
  24054. },
  24055. args: ["pkgs"],
  24056. source: "sweepPackageDescriptors: pkgs\x0a\x09| pd |\x09\x0a\x09pd := self core packageDescriptors.\x0a\x09pkgs do: [ :each | pd removeKey: each name ]",
  24057. referencedClasses: [],
  24058. messageSends: ["packageDescriptors", "core", "do:", "removeKey:", "name"]
  24059. }),
  24060. $globals.SmalltalkImage);
  24061. $core.addMethod(
  24062. $core.method({
  24063. selector: "tryAdoptPackageDescriptorsBeyond:",
  24064. protocol: "private",
  24065. fn: function (aSet){
  24066. var self=this,$self=this;
  24067. var original;
  24068. return $core.withContext(function($ctx1) {
  24069. var $1;
  24070. original=$recv(aSet)._copy();
  24071. $recv($recv($self._core())._packageDescriptors())._keysAndValuesDo_((function(key,value){
  24072. return $core.withContext(function($ctx2) {
  24073. return $recv(aSet)._add_($recv($globals.Package)._named_javaScriptDescriptor_(key,value));
  24074. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  24075. }));
  24076. $1=$recv(aSet)._allSatisfy_((function(each){
  24077. return $core.withContext(function($ctx2) {
  24078. return $recv(original)._includes_(each);
  24079. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  24080. }));
  24081. if($core.assert($1)){
  24082. return $recv($globals.Promise)._value_(aSet);
  24083. } else {
  24084. return $recv($recv($globals.Promise)._all_($recv(aSet)._collect_("isReady")))._then_((function(){
  24085. return $core.withContext(function($ctx2) {
  24086. return $self._tryAdoptPackageDescriptorsBeyond_(aSet);
  24087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  24088. }));
  24089. }
  24090. }, function($ctx1) {$ctx1.fill(self,"tryAdoptPackageDescriptorsBeyond:",{aSet:aSet,original:original},$globals.SmalltalkImage)});
  24091. },
  24092. args: ["aSet"],
  24093. source: "tryAdoptPackageDescriptorsBeyond: aSet\x0a\x09| original |\x0a\x09original := aSet copy.\x0a\x09self core packageDescriptors keysAndValuesDo: [ :key :value |\x0a\x09\x09aSet add: (Package named: key javaScriptDescriptor: value) ].\x0a\x09^ (aSet allSatisfy: [ :each | original includes: each ])\x0a\x09\x09ifFalse: [ (Promise all: (aSet collect: #isReady)) then: [ self tryAdoptPackageDescriptorsBeyond: aSet ] ]\x0a\x09\x09ifTrue: [ Promise value: aSet ]",
  24094. referencedClasses: ["Package", "Promise"],
  24095. messageSends: ["copy", "keysAndValuesDo:", "packageDescriptors", "core", "add:", "named:javaScriptDescriptor:", "ifFalse:ifTrue:", "allSatisfy:", "includes:", "then:", "all:", "collect:", "tryAdoptPackageDescriptorsBeyond:", "value:"]
  24096. }),
  24097. $globals.SmalltalkImage);
  24098. $core.addMethod(
  24099. $core.method({
  24100. selector: "version",
  24101. protocol: "accessing",
  24102. fn: function (){
  24103. var self=this,$self=this;
  24104. return "0.22.5";
  24105. },
  24106. args: [],
  24107. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.22.5'",
  24108. referencedClasses: [],
  24109. messageSends: []
  24110. }),
  24111. $globals.SmalltalkImage);
  24112. $globals.SmalltalkImage.a$cls.iVarNames = ["current"];
  24113. $core.addMethod(
  24114. $core.method({
  24115. selector: "current",
  24116. protocol: "instance creation",
  24117. fn: function (){
  24118. var self=this,$self=this;
  24119. return $core.withContext(function($ctx1) {
  24120. var $1,$receiver;
  24121. $1=$self["@current"];
  24122. if(($receiver = $1) == null || $receiver.a$nil){
  24123. $self["@current"]=(
  24124. $ctx1.supercall = true,
  24125. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24126. $ctx1.supercall = false;
  24127. return $self["@current"];
  24128. } else {
  24129. $self._deprecatedAPI();
  24130. return $self["@current"];
  24131. }
  24132. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.a$cls)});
  24133. },
  24134. args: [],
  24135. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  24136. referencedClasses: [],
  24137. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  24138. }),
  24139. $globals.SmalltalkImage.a$cls);
  24140. $core.addMethod(
  24141. $core.method({
  24142. selector: "initialize",
  24143. protocol: "initialization",
  24144. fn: function (){
  24145. var self=this,$self=this;
  24146. var st;
  24147. return $core.withContext(function($ctx1) {
  24148. st=$self._current();
  24149. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  24150. return self;
  24151. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.a$cls)});
  24152. },
  24153. args: [],
  24154. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  24155. referencedClasses: [],
  24156. messageSends: ["current", "at:put:", "globals"]
  24157. }),
  24158. $globals.SmalltalkImage.a$cls);
  24159. $core.addMethod(
  24160. $core.method({
  24161. selector: "new",
  24162. protocol: "instance creation",
  24163. fn: function (){
  24164. var self=this,$self=this;
  24165. return $core.withContext(function($ctx1) {
  24166. $self._shouldNotImplement();
  24167. return self;
  24168. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.a$cls)});
  24169. },
  24170. args: [],
  24171. source: "new\x0a\x09self shouldNotImplement",
  24172. referencedClasses: [],
  24173. messageSends: ["shouldNotImplement"]
  24174. }),
  24175. $globals.SmalltalkImage.a$cls);
  24176. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  24177. $core.addMethod(
  24178. $core.method({
  24179. selector: "nextPutJSObject:",
  24180. protocol: "*Kernel-Infrastructure",
  24181. fn: function (aJSObject){
  24182. var self=this,$self=this;
  24183. return $core.withContext(function($ctx1) {
  24184. $self._nextPut_(aJSObject);
  24185. return self;
  24186. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  24187. },
  24188. args: ["aJSObject"],
  24189. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  24190. referencedClasses: [],
  24191. messageSends: ["nextPut:"]
  24192. }),
  24193. $globals.ProtoStream);
  24194. $core.addMethod(
  24195. $core.method({
  24196. selector: "asJavaScriptPropertyName",
  24197. protocol: "*Kernel-Infrastructure",
  24198. fn: function (){
  24199. var self=this,$self=this;
  24200. return $core.withContext(function($ctx1) {
  24201. return $core.st2prop(self);
  24202. return self;
  24203. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  24204. },
  24205. args: [],
  24206. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  24207. referencedClasses: [],
  24208. messageSends: []
  24209. }),
  24210. $globals.String);
  24211. $core.addMethod(
  24212. $core.method({
  24213. selector: "asSetting",
  24214. protocol: "*Kernel-Infrastructure",
  24215. fn: function (){
  24216. var self=this,$self=this;
  24217. return $core.withContext(function($ctx1) {
  24218. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  24219. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  24220. },
  24221. args: [],
  24222. 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",
  24223. referencedClasses: ["Setting"],
  24224. messageSends: ["at:ifAbsent:"]
  24225. }),
  24226. $globals.String);
  24227. $core.addMethod(
  24228. $core.method({
  24229. selector: "asSettingIfAbsent:",
  24230. protocol: "*Kernel-Infrastructure",
  24231. fn: function (aDefaultValue){
  24232. var self=this,$self=this;
  24233. return $core.withContext(function($ctx1) {
  24234. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  24235. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24236. },
  24237. args: ["aDefaultValue"],
  24238. 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",
  24239. referencedClasses: ["Setting"],
  24240. messageSends: ["at:ifAbsent:"]
  24241. }),
  24242. $globals.String);
  24243. $core.addMethod(
  24244. $core.method({
  24245. selector: "settingValue",
  24246. protocol: "*Kernel-Infrastructure",
  24247. fn: function (){
  24248. var self=this,$self=this;
  24249. return $core.withContext(function($ctx1) {
  24250. return $recv($self._asSetting())._value();
  24251. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  24252. },
  24253. args: [],
  24254. source: "settingValue\x0a\x09^ self asSetting value",
  24255. referencedClasses: [],
  24256. messageSends: ["value", "asSetting"]
  24257. }),
  24258. $globals.String);
  24259. $core.addMethod(
  24260. $core.method({
  24261. selector: "settingValue:",
  24262. protocol: "*Kernel-Infrastructure",
  24263. fn: function (aValue){
  24264. var self=this,$self=this;
  24265. return $core.withContext(function($ctx1) {
  24266. return $recv($self._asSetting())._value_(aValue);
  24267. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  24268. },
  24269. args: ["aValue"],
  24270. 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",
  24271. referencedClasses: [],
  24272. messageSends: ["value:", "asSetting"]
  24273. }),
  24274. $globals.String);
  24275. $core.addMethod(
  24276. $core.method({
  24277. selector: "settingValueIfAbsent:",
  24278. protocol: "*Kernel-Infrastructure",
  24279. fn: function (aDefaultValue){
  24280. var self=this,$self=this;
  24281. return $core.withContext(function($ctx1) {
  24282. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  24283. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24284. },
  24285. args: ["aDefaultValue"],
  24286. 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",
  24287. referencedClasses: [],
  24288. messageSends: ["value", "asSettingIfAbsent:"]
  24289. }),
  24290. $globals.String);
  24291. });
  24292. define('amber_core/Kernel-Announcements',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  24293. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  24294. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  24295. var $pkg = $core.addPackage("Kernel-Announcements");
  24296. $pkg.innerEval = function (expr) { return eval(expr); };
  24297. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  24298. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  24299. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  24300. $core.addMethod(
  24301. $core.method({
  24302. selector: "announcementClass",
  24303. protocol: "accessing",
  24304. fn: function (){
  24305. var self=this,$self=this;
  24306. return $self["@announcementClass"];
  24307. },
  24308. args: [],
  24309. source: "announcementClass\x0a\x09^ announcementClass",
  24310. referencedClasses: [],
  24311. messageSends: []
  24312. }),
  24313. $globals.AnnouncementSubscription);
  24314. $core.addMethod(
  24315. $core.method({
  24316. selector: "announcementClass:",
  24317. protocol: "accessing",
  24318. fn: function (aClass){
  24319. var self=this,$self=this;
  24320. return $core.withContext(function($ctx1) {
  24321. $self["@announcementClass"]=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aClass)._name());
  24322. return self;
  24323. }, function($ctx1) {$ctx1.fill(self,"announcementClass:",{aClass:aClass},$globals.AnnouncementSubscription)});
  24324. },
  24325. args: ["aClass"],
  24326. source: "announcementClass: aClass\x0a\x09announcementClass := Smalltalk globals at: aClass name",
  24327. referencedClasses: ["Smalltalk"],
  24328. messageSends: ["at:", "globals", "name"]
  24329. }),
  24330. $globals.AnnouncementSubscription);
  24331. $core.addMethod(
  24332. $core.method({
  24333. selector: "deliver:",
  24334. protocol: "announcing",
  24335. fn: function (anAnnouncement){
  24336. var self=this,$self=this;
  24337. return $core.withContext(function($ctx1) {
  24338. var $1;
  24339. $1=$self._handlesAnnouncement_(anAnnouncement);
  24340. if($core.assert($1)){
  24341. $recv($self._valuable())._value_(anAnnouncement);
  24342. }
  24343. return self;
  24344. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24345. },
  24346. args: ["anAnnouncement"],
  24347. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  24348. referencedClasses: [],
  24349. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  24350. }),
  24351. $globals.AnnouncementSubscription);
  24352. $core.addMethod(
  24353. $core.method({
  24354. selector: "handlesAnnouncement:",
  24355. protocol: "announcing",
  24356. fn: function (anAnnouncement){
  24357. var self=this,$self=this;
  24358. return $core.withContext(function($ctx1) {
  24359. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(anAnnouncement)._class())._name()))._includesBehavior_($self._announcementClass());
  24360. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24361. },
  24362. args: ["anAnnouncement"],
  24363. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk globals at: anAnnouncement class name) includesBehavior: self announcementClass",
  24364. referencedClasses: ["Smalltalk"],
  24365. messageSends: ["includesBehavior:", "at:", "globals", "name", "class", "announcementClass"]
  24366. }),
  24367. $globals.AnnouncementSubscription);
  24368. $core.addMethod(
  24369. $core.method({
  24370. selector: "receiver",
  24371. protocol: "accessing",
  24372. fn: function (){
  24373. var self=this,$self=this;
  24374. return $core.withContext(function($ctx1) {
  24375. return $recv($self._valuable())._receiver();
  24376. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  24377. },
  24378. args: [],
  24379. source: "receiver\x0a\x09^ self valuable receiver",
  24380. referencedClasses: [],
  24381. messageSends: ["receiver", "valuable"]
  24382. }),
  24383. $globals.AnnouncementSubscription);
  24384. $core.addMethod(
  24385. $core.method({
  24386. selector: "valuable",
  24387. protocol: "accessing",
  24388. fn: function (){
  24389. var self=this,$self=this;
  24390. return $self["@valuable"];
  24391. },
  24392. args: [],
  24393. source: "valuable\x0a\x09^ valuable",
  24394. referencedClasses: [],
  24395. messageSends: []
  24396. }),
  24397. $globals.AnnouncementSubscription);
  24398. $core.addMethod(
  24399. $core.method({
  24400. selector: "valuable:",
  24401. protocol: "accessing",
  24402. fn: function (aValuable){
  24403. var self=this,$self=this;
  24404. $self["@valuable"]=aValuable;
  24405. return self;
  24406. },
  24407. args: ["aValuable"],
  24408. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  24409. referencedClasses: [],
  24410. messageSends: []
  24411. }),
  24412. $globals.AnnouncementSubscription);
  24413. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  24414. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  24415. $core.addMethod(
  24416. $core.method({
  24417. selector: "receiver",
  24418. protocol: "accessing",
  24419. fn: function (){
  24420. var self=this,$self=this;
  24421. return $self["@receiver"];
  24422. },
  24423. args: [],
  24424. source: "receiver\x0a\x09^ receiver",
  24425. referencedClasses: [],
  24426. messageSends: []
  24427. }),
  24428. $globals.AnnouncementValuable);
  24429. $core.addMethod(
  24430. $core.method({
  24431. selector: "receiver:",
  24432. protocol: "accessing",
  24433. fn: function (anObject){
  24434. var self=this,$self=this;
  24435. $self["@receiver"]=anObject;
  24436. return self;
  24437. },
  24438. args: ["anObject"],
  24439. source: "receiver: anObject\x0a\x09receiver := anObject",
  24440. referencedClasses: [],
  24441. messageSends: []
  24442. }),
  24443. $globals.AnnouncementValuable);
  24444. $core.addMethod(
  24445. $core.method({
  24446. selector: "valuable",
  24447. protocol: "accessing",
  24448. fn: function (){
  24449. var self=this,$self=this;
  24450. return $self["@valuable"];
  24451. },
  24452. args: [],
  24453. source: "valuable\x0a\x09^ valuable",
  24454. referencedClasses: [],
  24455. messageSends: []
  24456. }),
  24457. $globals.AnnouncementValuable);
  24458. $core.addMethod(
  24459. $core.method({
  24460. selector: "valuable:",
  24461. protocol: "accessing",
  24462. fn: function (anObject){
  24463. var self=this,$self=this;
  24464. $self["@valuable"]=anObject;
  24465. return self;
  24466. },
  24467. args: ["anObject"],
  24468. source: "valuable: anObject\x0a\x09valuable := anObject",
  24469. referencedClasses: [],
  24470. messageSends: []
  24471. }),
  24472. $globals.AnnouncementValuable);
  24473. $core.addMethod(
  24474. $core.method({
  24475. selector: "value",
  24476. protocol: "evaluating",
  24477. fn: function (){
  24478. var self=this,$self=this;
  24479. return $core.withContext(function($ctx1) {
  24480. return $recv($self._valuable())._value();
  24481. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  24482. },
  24483. args: [],
  24484. source: "value\x0a\x09^ self valuable value",
  24485. referencedClasses: [],
  24486. messageSends: ["value", "valuable"]
  24487. }),
  24488. $globals.AnnouncementValuable);
  24489. $core.addMethod(
  24490. $core.method({
  24491. selector: "value:",
  24492. protocol: "evaluating",
  24493. fn: function (anObject){
  24494. var self=this,$self=this;
  24495. return $core.withContext(function($ctx1) {
  24496. return $recv($self._valuable())._value_(anObject);
  24497. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  24498. },
  24499. args: ["anObject"],
  24500. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  24501. referencedClasses: [],
  24502. messageSends: ["value:", "valuable"]
  24503. }),
  24504. $globals.AnnouncementValuable);
  24505. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  24506. $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' ].";
  24507. $core.addMethod(
  24508. $core.method({
  24509. selector: "announce:",
  24510. protocol: "announcing",
  24511. fn: function (anAnnouncement){
  24512. var self=this,$self=this;
  24513. return $core.withContext(function($ctx1) {
  24514. $recv($self["@subscriptions"])._do_((function(each){
  24515. return $core.withContext(function($ctx2) {
  24516. return $recv(each)._deliver_(anAnnouncement);
  24517. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24518. }));
  24519. return self;
  24520. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  24521. },
  24522. args: ["anAnnouncement"],
  24523. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  24524. referencedClasses: [],
  24525. messageSends: ["do:", "deliver:"]
  24526. }),
  24527. $globals.Announcer);
  24528. $core.addMethod(
  24529. $core.method({
  24530. selector: "initialize",
  24531. protocol: "initialization",
  24532. fn: function (){
  24533. var self=this,$self=this;
  24534. return $core.withContext(function($ctx1) {
  24535. (
  24536. $ctx1.supercall = true,
  24537. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  24538. $ctx1.supercall = false;
  24539. $self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  24540. return self;
  24541. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  24542. },
  24543. args: [],
  24544. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  24545. referencedClasses: ["OrderedCollection"],
  24546. messageSends: ["initialize", "new"]
  24547. }),
  24548. $globals.Announcer);
  24549. $core.addMethod(
  24550. $core.method({
  24551. selector: "on:do:",
  24552. protocol: "subscribing",
  24553. fn: function (aClass,aBlock){
  24554. var self=this,$self=this;
  24555. return $core.withContext(function($ctx1) {
  24556. $self._on_do_for_(aClass,aBlock,nil);
  24557. return self;
  24558. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  24559. },
  24560. args: ["aClass", "aBlock"],
  24561. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  24562. referencedClasses: [],
  24563. messageSends: ["on:do:for:"]
  24564. }),
  24565. $globals.Announcer);
  24566. $core.addMethod(
  24567. $core.method({
  24568. selector: "on:do:for:",
  24569. protocol: "subscribing",
  24570. fn: function (aClass,aBlock,aReceiver){
  24571. var self=this,$self=this;
  24572. return $core.withContext(function($ctx1) {
  24573. var $1,$3,$5,$6,$4,$2;
  24574. $1=$self["@subscriptions"];
  24575. $3=$recv($globals.AnnouncementSubscription)._new();
  24576. $ctx1.sendIdx["new"]=1;
  24577. $5=$recv($globals.AnnouncementValuable)._new();
  24578. $recv($5)._valuable_(aBlock);
  24579. $recv($5)._receiver_(aReceiver);
  24580. $6=$recv($5)._yourself();
  24581. $ctx1.sendIdx["yourself"]=1;
  24582. $4=$6;
  24583. $recv($3)._valuable_($4);
  24584. $ctx1.sendIdx["valuable:"]=1;
  24585. $recv($3)._announcementClass_(aClass);
  24586. $2=$recv($3)._yourself();
  24587. $recv($1)._add_($2);
  24588. return self;
  24589. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  24590. },
  24591. args: ["aClass", "aBlock", "aReceiver"],
  24592. 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)",
  24593. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  24594. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  24595. }),
  24596. $globals.Announcer);
  24597. $core.addMethod(
  24598. $core.method({
  24599. selector: "on:doOnce:",
  24600. protocol: "subscribing",
  24601. fn: function (aClass,aBlock){
  24602. var self=this,$self=this;
  24603. var subscription;
  24604. return $core.withContext(function($ctx1) {
  24605. var $1;
  24606. $1=$recv($globals.AnnouncementSubscription)._new();
  24607. $recv($1)._announcementClass_(aClass);
  24608. subscription=$recv($1)._yourself();
  24609. $recv(subscription)._valuable_((function(ann){
  24610. return $core.withContext(function($ctx2) {
  24611. $recv($self["@subscriptions"])._remove_(subscription);
  24612. return $recv(aBlock)._value_(ann);
  24613. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  24614. }));
  24615. $recv($self["@subscriptions"])._add_(subscription);
  24616. return self;
  24617. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  24618. },
  24619. args: ["aClass", "aBlock"],
  24620. 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",
  24621. referencedClasses: ["AnnouncementSubscription"],
  24622. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  24623. }),
  24624. $globals.Announcer);
  24625. $core.addMethod(
  24626. $core.method({
  24627. selector: "on:send:to:",
  24628. protocol: "subscribing",
  24629. fn: function (aClass,aSelector,anObject){
  24630. var self=this,$self=this;
  24631. return $core.withContext(function($ctx1) {
  24632. var $1,$3,$5,$6,$4,$2;
  24633. $1=$self["@subscriptions"];
  24634. $3=$recv($globals.AnnouncementSubscription)._new();
  24635. $ctx1.sendIdx["new"]=1;
  24636. $5=$recv($globals.MessageSend)._new();
  24637. $recv($5)._receiver_(anObject);
  24638. $recv($5)._selector_(aSelector);
  24639. $6=$recv($5)._yourself();
  24640. $ctx1.sendIdx["yourself"]=1;
  24641. $4=$6;
  24642. $recv($3)._valuable_($4);
  24643. $recv($3)._announcementClass_(aClass);
  24644. $2=$recv($3)._yourself();
  24645. $recv($1)._add_($2);
  24646. return self;
  24647. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  24648. },
  24649. args: ["aClass", "aSelector", "anObject"],
  24650. 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)",
  24651. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  24652. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  24653. }),
  24654. $globals.Announcer);
  24655. $core.addMethod(
  24656. $core.method({
  24657. selector: "unsubscribe:",
  24658. protocol: "subscribing",
  24659. fn: function (anObject){
  24660. var self=this,$self=this;
  24661. return $core.withContext(function($ctx1) {
  24662. $self["@subscriptions"]=$recv($self["@subscriptions"])._reject_((function(each){
  24663. return $core.withContext(function($ctx2) {
  24664. return $recv($recv(each)._receiver()).__eq(anObject);
  24665. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24666. }));
  24667. return self;
  24668. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  24669. },
  24670. args: ["anObject"],
  24671. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  24672. referencedClasses: [],
  24673. messageSends: ["reject:", "=", "receiver"]
  24674. }),
  24675. $globals.Announcer);
  24676. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  24677. $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`";
  24678. $globals.SystemAnnouncer.a$cls.iVarNames = ["current"];
  24679. $core.addMethod(
  24680. $core.method({
  24681. selector: "current",
  24682. protocol: "accessing",
  24683. fn: function (){
  24684. var self=this,$self=this;
  24685. return $core.withContext(function($ctx1) {
  24686. var $1,$receiver;
  24687. $1=$self["@current"];
  24688. if(($receiver = $1) == null || $receiver.a$nil){
  24689. $self["@current"]=(
  24690. $ctx1.supercall = true,
  24691. ($globals.SystemAnnouncer.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24692. $ctx1.supercall = false;
  24693. return $self["@current"];
  24694. } else {
  24695. return $1;
  24696. }
  24697. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.a$cls)});
  24698. },
  24699. args: [],
  24700. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  24701. referencedClasses: [],
  24702. messageSends: ["ifNil:", "new"]
  24703. }),
  24704. $globals.SystemAnnouncer.a$cls);
  24705. $core.addMethod(
  24706. $core.method({
  24707. selector: "new",
  24708. protocol: "instance creation",
  24709. fn: function (){
  24710. var self=this,$self=this;
  24711. return $core.withContext(function($ctx1) {
  24712. $self._shouldNotImplement();
  24713. return self;
  24714. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.a$cls)});
  24715. },
  24716. args: [],
  24717. source: "new\x0a\x09self shouldNotImplement",
  24718. referencedClasses: [],
  24719. messageSends: ["shouldNotImplement"]
  24720. }),
  24721. $globals.SystemAnnouncer.a$cls);
  24722. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  24723. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  24724. $core.addMethod(
  24725. $core.method({
  24726. selector: "classTag",
  24727. protocol: "accessing",
  24728. fn: function (){
  24729. var self=this,$self=this;
  24730. return "announcement";
  24731. },
  24732. args: [],
  24733. 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'",
  24734. referencedClasses: [],
  24735. messageSends: []
  24736. }),
  24737. $globals.SystemAnnouncement.a$cls);
  24738. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  24739. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  24740. $core.addMethod(
  24741. $core.method({
  24742. selector: "theClass",
  24743. protocol: "accessing",
  24744. fn: function (){
  24745. var self=this,$self=this;
  24746. return $self["@theClass"];
  24747. },
  24748. args: [],
  24749. source: "theClass\x0a\x09^ theClass",
  24750. referencedClasses: [],
  24751. messageSends: []
  24752. }),
  24753. $globals.ClassAnnouncement);
  24754. $core.addMethod(
  24755. $core.method({
  24756. selector: "theClass:",
  24757. protocol: "accessing",
  24758. fn: function (aClass){
  24759. var self=this,$self=this;
  24760. $self["@theClass"]=aClass;
  24761. return self;
  24762. },
  24763. args: ["aClass"],
  24764. source: "theClass: aClass\x0a\x09theClass := aClass",
  24765. referencedClasses: [],
  24766. messageSends: []
  24767. }),
  24768. $globals.ClassAnnouncement);
  24769. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24770. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  24771. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24772. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  24773. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24774. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  24775. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  24776. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  24777. $core.addMethod(
  24778. $core.method({
  24779. selector: "oldClass",
  24780. protocol: "accessing",
  24781. fn: function (){
  24782. var self=this,$self=this;
  24783. return $self["@oldClass"];
  24784. },
  24785. args: [],
  24786. source: "oldClass\x0a\x09^ oldClass",
  24787. referencedClasses: [],
  24788. messageSends: []
  24789. }),
  24790. $globals.ClassMigrated);
  24791. $core.addMethod(
  24792. $core.method({
  24793. selector: "oldClass:",
  24794. protocol: "accessing",
  24795. fn: function (aClass){
  24796. var self=this,$self=this;
  24797. $self["@oldClass"]=aClass;
  24798. return self;
  24799. },
  24800. args: ["aClass"],
  24801. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  24802. referencedClasses: [],
  24803. messageSends: []
  24804. }),
  24805. $globals.ClassMigrated);
  24806. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  24807. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  24808. $core.addMethod(
  24809. $core.method({
  24810. selector: "oldPackage",
  24811. protocol: "accessing",
  24812. fn: function (){
  24813. var self=this,$self=this;
  24814. return $self["@oldPackage"];
  24815. },
  24816. args: [],
  24817. source: "oldPackage\x0a\x09^ oldPackage",
  24818. referencedClasses: [],
  24819. messageSends: []
  24820. }),
  24821. $globals.ClassMoved);
  24822. $core.addMethod(
  24823. $core.method({
  24824. selector: "oldPackage:",
  24825. protocol: "accessing",
  24826. fn: function (aPackage){
  24827. var self=this,$self=this;
  24828. $self["@oldPackage"]=aPackage;
  24829. return self;
  24830. },
  24831. args: ["aPackage"],
  24832. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  24833. referencedClasses: [],
  24834. messageSends: []
  24835. }),
  24836. $globals.ClassMoved);
  24837. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24838. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  24839. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24840. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  24841. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  24842. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  24843. $core.addMethod(
  24844. $core.method({
  24845. selector: "method",
  24846. protocol: "accessing",
  24847. fn: function (){
  24848. var self=this,$self=this;
  24849. return $self["@method"];
  24850. },
  24851. args: [],
  24852. source: "method\x0a\x09^ method",
  24853. referencedClasses: [],
  24854. messageSends: []
  24855. }),
  24856. $globals.MethodAnnouncement);
  24857. $core.addMethod(
  24858. $core.method({
  24859. selector: "method:",
  24860. protocol: "accessing",
  24861. fn: function (aCompiledMethod){
  24862. var self=this,$self=this;
  24863. $self["@method"]=aCompiledMethod;
  24864. return self;
  24865. },
  24866. args: ["aCompiledMethod"],
  24867. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  24868. referencedClasses: [],
  24869. messageSends: []
  24870. }),
  24871. $globals.MethodAnnouncement);
  24872. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24873. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  24874. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  24875. $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.";
  24876. $core.addMethod(
  24877. $core.method({
  24878. selector: "oldMethod",
  24879. protocol: "accessing",
  24880. fn: function (){
  24881. var self=this,$self=this;
  24882. return $self["@oldMethod"];
  24883. },
  24884. args: [],
  24885. source: "oldMethod\x0a\x09^ oldMethod",
  24886. referencedClasses: [],
  24887. messageSends: []
  24888. }),
  24889. $globals.MethodModified);
  24890. $core.addMethod(
  24891. $core.method({
  24892. selector: "oldMethod:",
  24893. protocol: "accessing",
  24894. fn: function (aMethod){
  24895. var self=this,$self=this;
  24896. $self["@oldMethod"]=aMethod;
  24897. return self;
  24898. },
  24899. args: ["aMethod"],
  24900. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  24901. referencedClasses: [],
  24902. messageSends: []
  24903. }),
  24904. $globals.MethodModified);
  24905. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  24906. $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.";
  24907. $core.addMethod(
  24908. $core.method({
  24909. selector: "oldProtocol",
  24910. protocol: "accessing",
  24911. fn: function (){
  24912. var self=this,$self=this;
  24913. return $self["@oldProtocol"];
  24914. },
  24915. args: [],
  24916. source: "oldProtocol\x0a\x09^ oldProtocol",
  24917. referencedClasses: [],
  24918. messageSends: []
  24919. }),
  24920. $globals.MethodMoved);
  24921. $core.addMethod(
  24922. $core.method({
  24923. selector: "oldProtocol:",
  24924. protocol: "accessing",
  24925. fn: function (aString){
  24926. var self=this,$self=this;
  24927. $self["@oldProtocol"]=aString;
  24928. return self;
  24929. },
  24930. args: ["aString"],
  24931. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  24932. referencedClasses: [],
  24933. messageSends: []
  24934. }),
  24935. $globals.MethodMoved);
  24936. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24937. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  24938. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  24939. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  24940. $core.addMethod(
  24941. $core.method({
  24942. selector: "package",
  24943. protocol: "accessing",
  24944. fn: function (){
  24945. var self=this,$self=this;
  24946. return $self["@package"];
  24947. },
  24948. args: [],
  24949. source: "package\x0a\x09^ package",
  24950. referencedClasses: [],
  24951. messageSends: []
  24952. }),
  24953. $globals.PackageAnnouncement);
  24954. $core.addMethod(
  24955. $core.method({
  24956. selector: "package:",
  24957. protocol: "accessing",
  24958. fn: function (aPackage){
  24959. var self=this,$self=this;
  24960. $self["@package"]=aPackage;
  24961. return self;
  24962. },
  24963. args: ["aPackage"],
  24964. source: "package: aPackage\x0a\x09package := aPackage",
  24965. referencedClasses: [],
  24966. messageSends: []
  24967. }),
  24968. $globals.PackageAnnouncement);
  24969. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24970. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  24971. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24972. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  24973. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24974. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  24975. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24976. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  24977. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  24978. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  24979. $core.addMethod(
  24980. $core.method({
  24981. selector: "package",
  24982. protocol: "accessing",
  24983. fn: function (){
  24984. var self=this,$self=this;
  24985. return $core.withContext(function($ctx1) {
  24986. var $1,$receiver;
  24987. $1=$self._theClass();
  24988. if(($receiver = $1) == null || $receiver.a$nil){
  24989. return $1;
  24990. } else {
  24991. var class_;
  24992. class_=$receiver;
  24993. return $recv(class_)._packageOfProtocol_($self._protocol());
  24994. }
  24995. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  24996. },
  24997. args: [],
  24998. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  24999. referencedClasses: [],
  25000. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  25001. }),
  25002. $globals.ProtocolAnnouncement);
  25003. $core.addMethod(
  25004. $core.method({
  25005. selector: "protocol",
  25006. protocol: "accessing",
  25007. fn: function (){
  25008. var self=this,$self=this;
  25009. return $self["@protocol"];
  25010. },
  25011. args: [],
  25012. source: "protocol\x0a\x09^ protocol",
  25013. referencedClasses: [],
  25014. messageSends: []
  25015. }),
  25016. $globals.ProtocolAnnouncement);
  25017. $core.addMethod(
  25018. $core.method({
  25019. selector: "protocol:",
  25020. protocol: "accessing",
  25021. fn: function (aString){
  25022. var self=this,$self=this;
  25023. $self["@protocol"]=aString;
  25024. return self;
  25025. },
  25026. args: ["aString"],
  25027. source: "protocol: aString\x0a\x09protocol := aString",
  25028. referencedClasses: [],
  25029. messageSends: []
  25030. }),
  25031. $globals.ProtocolAnnouncement);
  25032. $core.addMethod(
  25033. $core.method({
  25034. selector: "theClass",
  25035. protocol: "accessing",
  25036. fn: function (){
  25037. var self=this,$self=this;
  25038. return $self["@theClass"];
  25039. },
  25040. args: [],
  25041. source: "theClass\x0a\x09^ theClass",
  25042. referencedClasses: [],
  25043. messageSends: []
  25044. }),
  25045. $globals.ProtocolAnnouncement);
  25046. $core.addMethod(
  25047. $core.method({
  25048. selector: "theClass:",
  25049. protocol: "accessing",
  25050. fn: function (aClass){
  25051. var self=this,$self=this;
  25052. $self["@theClass"]=aClass;
  25053. return self;
  25054. },
  25055. args: ["aClass"],
  25056. source: "theClass: aClass\x0a\x09theClass := aClass",
  25057. referencedClasses: [],
  25058. messageSends: []
  25059. }),
  25060. $globals.ProtocolAnnouncement);
  25061. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25062. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  25063. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25064. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  25065. });
  25066. 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";
  25067. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  25068. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  25069. var $pkg = $core.addPackage("Platform-Services");
  25070. $pkg.innerEval = function (expr) { return eval(expr); };
  25071. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  25072. $core.addClass("ConsoleErrorHandler", $globals.Object, [], "Platform-Services");
  25073. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  25074. $core.addMethod(
  25075. $core.method({
  25076. selector: "handleError:",
  25077. protocol: "error handling",
  25078. fn: function (anError){
  25079. var self=this,$self=this;
  25080. return $core.withContext(function($ctx1) {
  25081. var $1,$receiver;
  25082. $1=$recv(anError)._context();
  25083. $ctx1.sendIdx["context"]=1;
  25084. if(($receiver = $1) == null || $receiver.a$nil){
  25085. $1;
  25086. } else {
  25087. $self._logErrorContext_($recv(anError)._context());
  25088. }
  25089. $self._logError_(anError);
  25090. return self;
  25091. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25092. },
  25093. args: ["anError"],
  25094. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  25095. referencedClasses: [],
  25096. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  25097. }),
  25098. $globals.ConsoleErrorHandler);
  25099. $core.addMethod(
  25100. $core.method({
  25101. selector: "log:",
  25102. protocol: "private",
  25103. fn: function (aString){
  25104. var self=this,$self=this;
  25105. return $core.withContext(function($ctx1) {
  25106. $recv(console)._log_(aString);
  25107. return self;
  25108. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  25109. },
  25110. args: ["aString"],
  25111. source: "log: aString\x0a\x09console log: aString",
  25112. referencedClasses: [],
  25113. messageSends: ["log:"]
  25114. }),
  25115. $globals.ConsoleErrorHandler);
  25116. $core.addMethod(
  25117. $core.method({
  25118. selector: "logContext:",
  25119. protocol: "private",
  25120. fn: function (aContext){
  25121. var self=this,$self=this;
  25122. return $core.withContext(function($ctx1) {
  25123. var $1,$receiver;
  25124. $1=$recv(aContext)._home();
  25125. $ctx1.sendIdx["home"]=1;
  25126. if(($receiver = $1) == null || $receiver.a$nil){
  25127. $1;
  25128. } else {
  25129. $self._logContext_($recv(aContext)._home());
  25130. }
  25131. $self._log_($recv(aContext)._asString());
  25132. return self;
  25133. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25134. },
  25135. args: ["aContext"],
  25136. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  25137. referencedClasses: [],
  25138. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  25139. }),
  25140. $globals.ConsoleErrorHandler);
  25141. $core.addMethod(
  25142. $core.method({
  25143. selector: "logError:",
  25144. protocol: "private",
  25145. fn: function (anError){
  25146. var self=this,$self=this;
  25147. return $core.withContext(function($ctx1) {
  25148. $self._log_($recv(anError)._messageText());
  25149. return self;
  25150. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25151. },
  25152. args: ["anError"],
  25153. source: "logError: anError\x0a\x09self log: anError messageText",
  25154. referencedClasses: [],
  25155. messageSends: ["log:", "messageText"]
  25156. }),
  25157. $globals.ConsoleErrorHandler);
  25158. $core.addMethod(
  25159. $core.method({
  25160. selector: "logErrorContext:",
  25161. protocol: "private",
  25162. fn: function (aContext){
  25163. var self=this,$self=this;
  25164. return $core.withContext(function($ctx1) {
  25165. var $1,$receiver;
  25166. if(($receiver = aContext) == null || $receiver.a$nil){
  25167. aContext;
  25168. } else {
  25169. $1=$recv(aContext)._home();
  25170. $ctx1.sendIdx["home"]=1;
  25171. if(($receiver = $1) == null || $receiver.a$nil){
  25172. $1;
  25173. } else {
  25174. $self._logContext_($recv(aContext)._home());
  25175. }
  25176. }
  25177. return self;
  25178. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25179. },
  25180. args: ["aContext"],
  25181. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  25182. referencedClasses: [],
  25183. messageSends: ["ifNotNil:", "home", "logContext:"]
  25184. }),
  25185. $globals.ConsoleErrorHandler);
  25186. $globals.ConsoleErrorHandler.a$cls.iVarNames = ["current"];
  25187. $core.addMethod(
  25188. $core.method({
  25189. selector: "initialize",
  25190. protocol: "initialization",
  25191. fn: function (){
  25192. var self=this,$self=this;
  25193. return $core.withContext(function($ctx1) {
  25194. $recv($globals.ErrorHandler)._registerIfNone_($self._new());
  25195. return self;
  25196. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.a$cls)});
  25197. },
  25198. args: [],
  25199. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  25200. referencedClasses: ["ErrorHandler"],
  25201. messageSends: ["registerIfNone:", "new"]
  25202. }),
  25203. $globals.ConsoleErrorHandler.a$cls);
  25204. $core.addClass("ConsoleTranscript", $globals.Object, ["textarea"], "Platform-Services");
  25205. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  25206. $core.addMethod(
  25207. $core.method({
  25208. selector: "clear",
  25209. protocol: "printing",
  25210. fn: function (){
  25211. var self=this,$self=this;
  25212. return self;
  25213. },
  25214. args: [],
  25215. source: "clear\x0a\x09\x22no op\x22",
  25216. referencedClasses: [],
  25217. messageSends: []
  25218. }),
  25219. $globals.ConsoleTranscript);
  25220. $core.addMethod(
  25221. $core.method({
  25222. selector: "cr",
  25223. protocol: "printing",
  25224. fn: function (){
  25225. var self=this,$self=this;
  25226. return self;
  25227. },
  25228. args: [],
  25229. source: "cr\x0a\x09\x22no op\x22",
  25230. referencedClasses: [],
  25231. messageSends: []
  25232. }),
  25233. $globals.ConsoleTranscript);
  25234. $core.addMethod(
  25235. $core.method({
  25236. selector: "open",
  25237. protocol: "actions",
  25238. fn: function (){
  25239. var self=this,$self=this;
  25240. return self;
  25241. },
  25242. args: [],
  25243. source: "open",
  25244. referencedClasses: [],
  25245. messageSends: []
  25246. }),
  25247. $globals.ConsoleTranscript);
  25248. $core.addMethod(
  25249. $core.method({
  25250. selector: "show:",
  25251. protocol: "printing",
  25252. fn: function (anObject){
  25253. var self=this,$self=this;
  25254. return $core.withContext(function($ctx1) {
  25255. console.log(String($recv(anObject)._asString()));
  25256. return self;
  25257. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  25258. },
  25259. args: ["anObject"],
  25260. 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()))'>",
  25261. referencedClasses: [],
  25262. messageSends: []
  25263. }),
  25264. $globals.ConsoleTranscript);
  25265. $core.addMethod(
  25266. $core.method({
  25267. selector: "initialize",
  25268. protocol: "initialization",
  25269. fn: function (){
  25270. var self=this,$self=this;
  25271. return $core.withContext(function($ctx1) {
  25272. $recv($globals.Transcript)._registerIfNone_($self._new());
  25273. return self;
  25274. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.a$cls)});
  25275. },
  25276. args: [],
  25277. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  25278. referencedClasses: ["Transcript"],
  25279. messageSends: ["registerIfNone:", "new"]
  25280. }),
  25281. $globals.ConsoleTranscript.a$cls);
  25282. $core.addClass("Environment", $globals.Object, [], "Platform-Services");
  25283. $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.";
  25284. $core.addMethod(
  25285. $core.method({
  25286. selector: "addInstVarNamed:to:",
  25287. protocol: "compiling",
  25288. fn: function (aString,aClass){
  25289. var self=this,$self=this;
  25290. var newInstVars;
  25291. return $core.withContext(function($ctx1) {
  25292. var $1,$2,$3,$4,$5;
  25293. newInstVars=$recv($recv(aClass)._instanceVariableNames())._copyWith_(aString);
  25294. $1=$recv(aClass)._isMetaclass();
  25295. if($core.assert($1)){
  25296. $2=$self._classBuilder();
  25297. $ctx1.sendIdx["classBuilder"]=1;
  25298. $recv($2)._class_instanceVariables_(aClass,newInstVars);
  25299. } else {
  25300. $3=$self._classBuilder();
  25301. $4=$recv(aClass)._superclass();
  25302. $5=$recv(aClass)._name();
  25303. $ctx1.sendIdx["name"]=1;
  25304. $recv($3)._addSubclassOf_named_instanceVariableNames_package_($4,$5,newInstVars,$recv($recv(aClass)._package())._name());
  25305. }
  25306. return self;
  25307. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass,newInstVars:newInstVars},$globals.Environment)});
  25308. },
  25309. args: ["aString", "aClass"],
  25310. source: "addInstVarNamed: aString to: aClass\x0a\x09| newInstVars |\x0a\x09newInstVars := aClass instanceVariableNames copyWith: aString.\x0a\x0a\x09aClass isMetaclass\x0a\x09\x09ifTrue: [ self classBuilder\x0a\x09\x09\x09class: aClass instanceVariables: newInstVars ]\x0a\x09\x09ifFalse: [ self classBuilder\x0a\x09\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09\x09named: aClass name \x0a\x09\x09\x09instanceVariableNames: newInstVars\x0a\x09\x09\x09package: aClass package name ]",
  25311. referencedClasses: [],
  25312. messageSends: ["copyWith:", "instanceVariableNames", "ifTrue:ifFalse:", "isMetaclass", "class:instanceVariables:", "classBuilder", "addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "package"]
  25313. }),
  25314. $globals.Environment);
  25315. $core.addMethod(
  25316. $core.method({
  25317. selector: "allSelectors",
  25318. protocol: "accessing",
  25319. fn: function (){
  25320. var self=this,$self=this;
  25321. return $core.withContext(function($ctx1) {
  25322. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  25323. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  25324. },
  25325. args: [],
  25326. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  25327. referencedClasses: ["Smalltalk"],
  25328. messageSends: ["allSelectors", "core"]
  25329. }),
  25330. $globals.Environment);
  25331. $core.addMethod(
  25332. $core.method({
  25333. selector: "availableClassNames",
  25334. protocol: "accessing",
  25335. fn: function (){
  25336. var self=this,$self=this;
  25337. return $core.withContext(function($ctx1) {
  25338. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  25339. return $core.withContext(function($ctx2) {
  25340. return $recv(each)._name();
  25341. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25342. }));
  25343. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  25344. },
  25345. args: [],
  25346. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  25347. referencedClasses: ["Smalltalk"],
  25348. messageSends: ["collect:", "classes", "name"]
  25349. }),
  25350. $globals.Environment);
  25351. $core.addMethod(
  25352. $core.method({
  25353. selector: "availablePackageNames",
  25354. protocol: "accessing",
  25355. fn: function (){
  25356. var self=this,$self=this;
  25357. return $core.withContext(function($ctx1) {
  25358. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  25359. return $core.withContext(function($ctx2) {
  25360. return $recv(each)._name();
  25361. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25362. }));
  25363. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  25364. },
  25365. args: [],
  25366. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  25367. referencedClasses: ["Smalltalk"],
  25368. messageSends: ["collect:", "packages", "name"]
  25369. }),
  25370. $globals.Environment);
  25371. $core.addMethod(
  25372. $core.method({
  25373. selector: "availableProtocolsFor:",
  25374. protocol: "accessing",
  25375. fn: function (aClass){
  25376. var self=this,$self=this;
  25377. var protocols;
  25378. return $core.withContext(function($ctx1) {
  25379. var $1,$receiver;
  25380. protocols=$recv(aClass)._protocols();
  25381. $1=$recv(aClass)._superclass();
  25382. $ctx1.sendIdx["superclass"]=1;
  25383. if(($receiver = $1) == null || $receiver.a$nil){
  25384. $1;
  25385. } else {
  25386. $recv(protocols)._addAll_($self._availableProtocolsFor_($recv(aClass)._superclass()));
  25387. }
  25388. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  25389. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  25390. },
  25391. args: ["aClass"],
  25392. 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",
  25393. referencedClasses: [],
  25394. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  25395. }),
  25396. $globals.Environment);
  25397. $core.addMethod(
  25398. $core.method({
  25399. selector: "classBuilder",
  25400. protocol: "accessing",
  25401. fn: function (){
  25402. var self=this,$self=this;
  25403. return $core.withContext(function($ctx1) {
  25404. return $recv($globals.ClassBuilder)._new();
  25405. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  25406. },
  25407. args: [],
  25408. source: "classBuilder\x0a\x09^ ClassBuilder new",
  25409. referencedClasses: ["ClassBuilder"],
  25410. messageSends: ["new"]
  25411. }),
  25412. $globals.Environment);
  25413. $core.addMethod(
  25414. $core.method({
  25415. selector: "classNamed:",
  25416. protocol: "accessing",
  25417. fn: function (aString){
  25418. var self=this,$self=this;
  25419. return $core.withContext(function($ctx1) {
  25420. var $1,$receiver;
  25421. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  25422. if(($receiver = $1) == null || $receiver.a$nil){
  25423. return $self._error_("Invalid class name");
  25424. } else {
  25425. return $1;
  25426. }
  25427. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  25428. },
  25429. args: ["aString"],
  25430. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  25431. referencedClasses: ["Smalltalk"],
  25432. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  25433. }),
  25434. $globals.Environment);
  25435. $core.addMethod(
  25436. $core.method({
  25437. selector: "classes",
  25438. protocol: "accessing",
  25439. fn: function (){
  25440. var self=this,$self=this;
  25441. return $core.withContext(function($ctx1) {
  25442. return $recv($globals.Smalltalk)._classes();
  25443. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  25444. },
  25445. args: [],
  25446. source: "classes\x0a\x09^ Smalltalk classes",
  25447. referencedClasses: ["Smalltalk"],
  25448. messageSends: ["classes"]
  25449. }),
  25450. $globals.Environment);
  25451. $core.addMethod(
  25452. $core.method({
  25453. selector: "commitPackage:onSuccess:onError:",
  25454. protocol: "actions",
  25455. fn: function (aPackage,aBlock,anotherBlock){
  25456. var self=this,$self=this;
  25457. return $core.withContext(function($ctx1) {
  25458. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  25459. return self;
  25460. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  25461. },
  25462. args: ["aPackage", "aBlock", "anotherBlock"],
  25463. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  25464. referencedClasses: [],
  25465. messageSends: ["commitOnSuccess:onError:", "transport"]
  25466. }),
  25467. $globals.Environment);
  25468. $core.addMethod(
  25469. $core.method({
  25470. selector: "compileClassComment:for:",
  25471. protocol: "compiling",
  25472. fn: function (aString,aClass){
  25473. var self=this,$self=this;
  25474. return $core.withContext(function($ctx1) {
  25475. $recv(aClass)._comment_(aString);
  25476. return self;
  25477. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  25478. },
  25479. args: ["aString", "aClass"],
  25480. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  25481. referencedClasses: [],
  25482. messageSends: ["comment:"]
  25483. }),
  25484. $globals.Environment);
  25485. $core.addMethod(
  25486. $core.method({
  25487. selector: "compileClassDefinition:",
  25488. protocol: "compiling",
  25489. fn: function (aString){
  25490. var self=this,$self=this;
  25491. return $core.withContext(function($ctx1) {
  25492. $recv((function(){
  25493. return $core.withContext(function($ctx2) {
  25494. return $self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  25495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  25496. }))._on_do_($globals.Error,(function(error){
  25497. return $core.withContext(function($ctx2) {
  25498. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  25499. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  25500. }));
  25501. return self;
  25502. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  25503. },
  25504. args: ["aString"],
  25505. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  25506. referencedClasses: ["DoIt", "Error", "Terminal"],
  25507. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  25508. }),
  25509. $globals.Environment);
  25510. $core.addMethod(
  25511. $core.method({
  25512. selector: "compileMethod:for:protocol:",
  25513. protocol: "compiling",
  25514. fn: function (sourceCode,class_,protocol){
  25515. var self=this,$self=this;
  25516. return $core.withContext(function($ctx1) {
  25517. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  25518. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  25519. },
  25520. args: ["sourceCode", "class", "protocol"],
  25521. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  25522. referencedClasses: [],
  25523. messageSends: ["compile:protocol:"]
  25524. }),
  25525. $globals.Environment);
  25526. $core.addMethod(
  25527. $core.method({
  25528. selector: "copyClass:to:",
  25529. protocol: "actions",
  25530. fn: function (aClass,aClassName){
  25531. var self=this,$self=this;
  25532. return $core.withContext(function($ctx1) {
  25533. var $1,$2,$receiver;
  25534. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25535. if(($receiver = $1) == null || $receiver.a$nil){
  25536. $1;
  25537. } else {
  25538. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25539. $ctx1.sendIdx[","]=1;
  25540. $self._error_($2);
  25541. }
  25542. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  25543. return self;
  25544. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25545. },
  25546. args: ["aClass", "aClassName"],
  25547. 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",
  25548. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25549. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  25550. }),
  25551. $globals.Environment);
  25552. $core.addMethod(
  25553. $core.method({
  25554. selector: "doItReceiver",
  25555. protocol: "accessing",
  25556. fn: function (){
  25557. var self=this,$self=this;
  25558. return $core.withContext(function($ctx1) {
  25559. return $recv($globals.DoIt)._new();
  25560. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  25561. },
  25562. args: [],
  25563. source: "doItReceiver\x0a\x09^ DoIt new",
  25564. referencedClasses: ["DoIt"],
  25565. messageSends: ["new"]
  25566. }),
  25567. $globals.Environment);
  25568. $core.addMethod(
  25569. $core.method({
  25570. selector: "evaluate:for:",
  25571. protocol: "evaluating",
  25572. fn: function (aString,anObject){
  25573. var self=this,$self=this;
  25574. return $core.withContext(function($ctx1) {
  25575. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  25576. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  25577. },
  25578. args: ["aString", "anObject"],
  25579. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  25580. referencedClasses: ["Evaluator"],
  25581. messageSends: ["evaluate:for:"]
  25582. }),
  25583. $globals.Environment);
  25584. $core.addMethod(
  25585. $core.method({
  25586. selector: "evaluate:on:do:",
  25587. protocol: "error handling",
  25588. fn: function (aBlock,anErrorClass,exceptionBlock){
  25589. var self=this,$self=this;
  25590. return $core.withContext(function($ctx1) {
  25591. var $1;
  25592. $recv(aBlock)._tryCatch_((function(exception){
  25593. return $core.withContext(function($ctx2) {
  25594. $1=$recv(exception)._isKindOf_($self._classNamed_($recv(anErrorClass)._name()));
  25595. if($core.assert($1)){
  25596. return $recv(exceptionBlock)._value_(exception);
  25597. } else {
  25598. return $recv(exception)._pass();
  25599. }
  25600. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  25601. }));
  25602. return self;
  25603. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  25604. },
  25605. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  25606. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception pass ] ]",
  25607. referencedClasses: [],
  25608. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "pass"]
  25609. }),
  25610. $globals.Environment);
  25611. $core.addMethod(
  25612. $core.method({
  25613. selector: "inspect:",
  25614. protocol: "actions",
  25615. fn: function (anObject){
  25616. var self=this,$self=this;
  25617. return $core.withContext(function($ctx1) {
  25618. $recv($globals.Inspector)._inspect_(anObject);
  25619. return self;
  25620. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  25621. },
  25622. args: ["anObject"],
  25623. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  25624. referencedClasses: ["Inspector"],
  25625. messageSends: ["inspect:"]
  25626. }),
  25627. $globals.Environment);
  25628. $core.addMethod(
  25629. $core.method({
  25630. selector: "moveClass:toPackage:",
  25631. protocol: "actions",
  25632. fn: function (aClass,aPackageName){
  25633. var self=this,$self=this;
  25634. var package_;
  25635. return $core.withContext(function($ctx1) {
  25636. var $1,$2,$receiver;
  25637. package_=$recv($globals.Package)._named_(aPackageName);
  25638. $1=package_;
  25639. if(($receiver = $1) == null || $receiver.a$nil){
  25640. $self._error_("Invalid package name");
  25641. } else {
  25642. $1;
  25643. }
  25644. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  25645. if($core.assert($2)){
  25646. return self;
  25647. }
  25648. $recv(aClass)._package_(package_);
  25649. $recv(aClass)._recompile();
  25650. return self;
  25651. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  25652. },
  25653. args: ["aClass", "aPackageName"],
  25654. 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",
  25655. referencedClasses: ["Package"],
  25656. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:", "recompile"]
  25657. }),
  25658. $globals.Environment);
  25659. $core.addMethod(
  25660. $core.method({
  25661. selector: "moveMethod:toClass:",
  25662. protocol: "actions",
  25663. fn: function (aMethod,aClassName){
  25664. var self=this,$self=this;
  25665. var destinationClass;
  25666. return $core.withContext(function($ctx1) {
  25667. var $2,$3,$1,$5,$4;
  25668. destinationClass=$self._classNamed_(aClassName);
  25669. $2=destinationClass;
  25670. $3=$recv(aMethod)._methodClass();
  25671. $ctx1.sendIdx["methodClass"]=1;
  25672. $1=$recv($2).__eq_eq($3);
  25673. if($core.assert($1)){
  25674. return self;
  25675. }
  25676. $5=$recv(aMethod)._methodClass();
  25677. $ctx1.sendIdx["methodClass"]=2;
  25678. $4=$recv($5)._isMetaclass();
  25679. if($core.assert($4)){
  25680. destinationClass=$recv(destinationClass)._theMetaClass();
  25681. destinationClass;
  25682. }
  25683. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25684. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25685. return self;
  25686. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  25687. },
  25688. args: ["aMethod", "aClassName"],
  25689. 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",
  25690. referencedClasses: [],
  25691. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "theMetaClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  25692. }),
  25693. $globals.Environment);
  25694. $core.addMethod(
  25695. $core.method({
  25696. selector: "moveMethod:toProtocol:",
  25697. protocol: "actions",
  25698. fn: function (aMethod,aProtocol){
  25699. var self=this,$self=this;
  25700. return $core.withContext(function($ctx1) {
  25701. $recv(aMethod)._protocol_(aProtocol);
  25702. $recv($recv(aMethod)._methodClass())._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25703. return self;
  25704. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  25705. },
  25706. args: ["aMethod", "aProtocol"],
  25707. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol.\x0a\x0a\x09aMethod methodClass\x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol",
  25708. referencedClasses: [],
  25709. messageSends: ["protocol:", "compile:protocol:", "methodClass", "source", "protocol"]
  25710. }),
  25711. $globals.Environment);
  25712. $core.addMethod(
  25713. $core.method({
  25714. selector: "packages",
  25715. protocol: "accessing",
  25716. fn: function (){
  25717. var self=this,$self=this;
  25718. return $core.withContext(function($ctx1) {
  25719. return $recv($globals.Smalltalk)._packages();
  25720. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  25721. },
  25722. args: [],
  25723. source: "packages\x0a\x09^ Smalltalk packages",
  25724. referencedClasses: ["Smalltalk"],
  25725. messageSends: ["packages"]
  25726. }),
  25727. $globals.Environment);
  25728. $core.addMethod(
  25729. $core.method({
  25730. selector: "registerErrorHandler:",
  25731. protocol: "services",
  25732. fn: function (anErrorHandler){
  25733. var self=this,$self=this;
  25734. return $core.withContext(function($ctx1) {
  25735. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  25736. return self;
  25737. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  25738. },
  25739. args: ["anErrorHandler"],
  25740. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  25741. referencedClasses: ["ErrorHandler"],
  25742. messageSends: ["register:"]
  25743. }),
  25744. $globals.Environment);
  25745. $core.addMethod(
  25746. $core.method({
  25747. selector: "registerFinder:",
  25748. protocol: "services",
  25749. fn: function (aFinder){
  25750. var self=this,$self=this;
  25751. return $core.withContext(function($ctx1) {
  25752. $recv($globals.Finder)._register_(aFinder);
  25753. return self;
  25754. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  25755. },
  25756. args: ["aFinder"],
  25757. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  25758. referencedClasses: ["Finder"],
  25759. messageSends: ["register:"]
  25760. }),
  25761. $globals.Environment);
  25762. $core.addMethod(
  25763. $core.method({
  25764. selector: "registerInspector:",
  25765. protocol: "services",
  25766. fn: function (anInspector){
  25767. var self=this,$self=this;
  25768. return $core.withContext(function($ctx1) {
  25769. $recv($globals.Inspector)._register_(anInspector);
  25770. return self;
  25771. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  25772. },
  25773. args: ["anInspector"],
  25774. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  25775. referencedClasses: ["Inspector"],
  25776. messageSends: ["register:"]
  25777. }),
  25778. $globals.Environment);
  25779. $core.addMethod(
  25780. $core.method({
  25781. selector: "registerProgressHandler:",
  25782. protocol: "services",
  25783. fn: function (aProgressHandler){
  25784. var self=this,$self=this;
  25785. return $core.withContext(function($ctx1) {
  25786. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  25787. return self;
  25788. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  25789. },
  25790. args: ["aProgressHandler"],
  25791. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  25792. referencedClasses: ["ProgressHandler"],
  25793. messageSends: ["register:"]
  25794. }),
  25795. $globals.Environment);
  25796. $core.addMethod(
  25797. $core.method({
  25798. selector: "registerTranscript:",
  25799. protocol: "services",
  25800. fn: function (aTranscript){
  25801. var self=this,$self=this;
  25802. return $core.withContext(function($ctx1) {
  25803. $recv($globals.Transcript)._register_(aTranscript);
  25804. return self;
  25805. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  25806. },
  25807. args: ["aTranscript"],
  25808. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  25809. referencedClasses: ["Transcript"],
  25810. messageSends: ["register:"]
  25811. }),
  25812. $globals.Environment);
  25813. $core.addMethod(
  25814. $core.method({
  25815. selector: "removeClass:",
  25816. protocol: "actions",
  25817. fn: function (aClass){
  25818. var self=this,$self=this;
  25819. return $core.withContext(function($ctx1) {
  25820. $recv($globals.Smalltalk)._removeClass_(aClass);
  25821. return self;
  25822. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  25823. },
  25824. args: ["aClass"],
  25825. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  25826. referencedClasses: ["Smalltalk"],
  25827. messageSends: ["removeClass:"]
  25828. }),
  25829. $globals.Environment);
  25830. $core.addMethod(
  25831. $core.method({
  25832. selector: "removeMethod:",
  25833. protocol: "actions",
  25834. fn: function (aMethod){
  25835. var self=this,$self=this;
  25836. return $core.withContext(function($ctx1) {
  25837. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25838. return self;
  25839. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  25840. },
  25841. args: ["aMethod"],
  25842. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  25843. referencedClasses: [],
  25844. messageSends: ["removeCompiledMethod:", "methodClass"]
  25845. }),
  25846. $globals.Environment);
  25847. $core.addMethod(
  25848. $core.method({
  25849. selector: "removeProtocol:from:",
  25850. protocol: "actions",
  25851. fn: function (aString,aClass){
  25852. var self=this,$self=this;
  25853. return $core.withContext(function($ctx1) {
  25854. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25855. return $core.withContext(function($ctx2) {
  25856. return $recv(aClass)._removeCompiledMethod_(each);
  25857. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25858. }));
  25859. return self;
  25860. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  25861. },
  25862. args: ["aString", "aClass"],
  25863. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  25864. referencedClasses: [],
  25865. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  25866. }),
  25867. $globals.Environment);
  25868. $core.addMethod(
  25869. $core.method({
  25870. selector: "renameClass:to:",
  25871. protocol: "actions",
  25872. fn: function (aClass,aClassName){
  25873. var self=this,$self=this;
  25874. return $core.withContext(function($ctx1) {
  25875. var $1,$2,$receiver;
  25876. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25877. if(($receiver = $1) == null || $receiver.a$nil){
  25878. $1;
  25879. } else {
  25880. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25881. $ctx1.sendIdx[","]=1;
  25882. $self._error_($2);
  25883. }
  25884. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  25885. return self;
  25886. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25887. },
  25888. args: ["aClass", "aClassName"],
  25889. 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",
  25890. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25891. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  25892. }),
  25893. $globals.Environment);
  25894. $core.addMethod(
  25895. $core.method({
  25896. selector: "renamePackage:to:",
  25897. protocol: "actions",
  25898. fn: function (aPackageName,aNewPackageName){
  25899. var self=this,$self=this;
  25900. return $core.withContext(function($ctx1) {
  25901. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  25902. return self;
  25903. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  25904. },
  25905. args: ["aPackageName", "aNewPackageName"],
  25906. source: "renamePackage: aPackageName to: aNewPackageName\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  25907. referencedClasses: ["Smalltalk"],
  25908. messageSends: ["renamePackage:to:"]
  25909. }),
  25910. $globals.Environment);
  25911. $core.addMethod(
  25912. $core.method({
  25913. selector: "renameProtocol:to:in:",
  25914. protocol: "actions",
  25915. fn: function (aString,anotherString,aClass){
  25916. var self=this,$self=this;
  25917. return $core.withContext(function($ctx1) {
  25918. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25919. return $core.withContext(function($ctx2) {
  25920. return $recv(each)._protocol_(anotherString);
  25921. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25922. }));
  25923. return self;
  25924. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  25925. },
  25926. args: ["aString", "anotherString", "aClass"],
  25927. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  25928. referencedClasses: [],
  25929. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  25930. }),
  25931. $globals.Environment);
  25932. $core.addMethod(
  25933. $core.method({
  25934. selector: "setClassCommentOf:to:",
  25935. protocol: "actions",
  25936. fn: function (aClass,aString){
  25937. var self=this,$self=this;
  25938. return $core.withContext(function($ctx1) {
  25939. $recv(aClass)._comment_(aString);
  25940. return self;
  25941. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  25942. },
  25943. args: ["aClass", "aString"],
  25944. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  25945. referencedClasses: [],
  25946. messageSends: ["comment:"]
  25947. }),
  25948. $globals.Environment);
  25949. $core.addMethod(
  25950. $core.method({
  25951. selector: "systemAnnouncer",
  25952. protocol: "accessing",
  25953. fn: function (){
  25954. var self=this,$self=this;
  25955. return $core.withContext(function($ctx1) {
  25956. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  25957. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  25958. },
  25959. args: [],
  25960. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  25961. referencedClasses: ["Smalltalk"],
  25962. messageSends: ["current", "at:", "globals"]
  25963. }),
  25964. $globals.Environment);
  25965. $core.addClass("NullProgressHandler", $globals.Object, [], "Platform-Services");
  25966. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  25967. $core.addMethod(
  25968. $core.method({
  25969. selector: "do:on:displaying:",
  25970. protocol: "progress handling",
  25971. fn: function (aBlock,aCollection,aString){
  25972. var self=this,$self=this;
  25973. return $core.withContext(function($ctx1) {
  25974. $recv(aCollection)._do_(aBlock);
  25975. return self;
  25976. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  25977. },
  25978. args: ["aBlock", "aCollection", "aString"],
  25979. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  25980. referencedClasses: [],
  25981. messageSends: ["do:"]
  25982. }),
  25983. $globals.NullProgressHandler);
  25984. $globals.NullProgressHandler.a$cls.iVarNames = ["current"];
  25985. $core.addMethod(
  25986. $core.method({
  25987. selector: "initialize",
  25988. protocol: "initialization",
  25989. fn: function (){
  25990. var self=this,$self=this;
  25991. return $core.withContext(function($ctx1) {
  25992. $recv($globals.ProgressHandler)._registerIfNone_($self._new());
  25993. return self;
  25994. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.a$cls)});
  25995. },
  25996. args: [],
  25997. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  25998. referencedClasses: ["ProgressHandler"],
  25999. messageSends: ["registerIfNone:", "new"]
  26000. }),
  26001. $globals.NullProgressHandler.a$cls);
  26002. $core.addClass("Service", $globals.Object, [], "Platform-Services");
  26003. $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.";
  26004. $globals.Service.a$cls.iVarNames = ["current"];
  26005. $core.addMethod(
  26006. $core.method({
  26007. selector: "current",
  26008. protocol: "accessing",
  26009. fn: function (){
  26010. var self=this,$self=this;
  26011. return $self["@current"];
  26012. },
  26013. args: [],
  26014. source: "current\x0a\x09^ current",
  26015. referencedClasses: [],
  26016. messageSends: []
  26017. }),
  26018. $globals.Service.a$cls);
  26019. $core.addMethod(
  26020. $core.method({
  26021. selector: "new",
  26022. protocol: "instance creation",
  26023. fn: function (){
  26024. var self=this,$self=this;
  26025. return $core.withContext(function($ctx1) {
  26026. $self._shouldNotImplement();
  26027. return self;
  26028. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.a$cls)});
  26029. },
  26030. args: [],
  26031. source: "new\x0a\x09self shouldNotImplement",
  26032. referencedClasses: [],
  26033. messageSends: ["shouldNotImplement"]
  26034. }),
  26035. $globals.Service.a$cls);
  26036. $core.addMethod(
  26037. $core.method({
  26038. selector: "register:",
  26039. protocol: "registration",
  26040. fn: function (anObject){
  26041. var self=this,$self=this;
  26042. $self["@current"]=anObject;
  26043. return self;
  26044. },
  26045. args: ["anObject"],
  26046. source: "register: anObject\x0a\x09current := anObject",
  26047. referencedClasses: [],
  26048. messageSends: []
  26049. }),
  26050. $globals.Service.a$cls);
  26051. $core.addMethod(
  26052. $core.method({
  26053. selector: "registerIfNone:",
  26054. protocol: "registration",
  26055. fn: function (anObject){
  26056. var self=this,$self=this;
  26057. return $core.withContext(function($ctx1) {
  26058. var $1,$receiver;
  26059. $1=$self._current();
  26060. if(($receiver = $1) == null || $receiver.a$nil){
  26061. $self._register_(anObject);
  26062. } else {
  26063. $1;
  26064. }
  26065. return self;
  26066. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.a$cls)});
  26067. },
  26068. args: ["anObject"],
  26069. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  26070. referencedClasses: [],
  26071. messageSends: ["ifNil:", "current", "register:"]
  26072. }),
  26073. $globals.Service.a$cls);
  26074. $core.addClass("ErrorHandler", $globals.Service, [], "Platform-Services");
  26075. $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.";
  26076. $core.addMethod(
  26077. $core.method({
  26078. selector: "handleError:",
  26079. protocol: "error handling",
  26080. fn: function (anError){
  26081. var self=this,$self=this;
  26082. return $core.withContext(function($ctx1) {
  26083. var $1;
  26084. $1=$recv((function(){
  26085. return $core.withContext(function($ctx2) {
  26086. return $recv(anError)._isSmalltalkError();
  26087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  26088. }))._tryCatch_((function(){
  26089. return false;
  26090. }));
  26091. if($core.assert($1)){
  26092. $self._handleUnhandledError_(anError);
  26093. $ctx1.sendIdx["handleUnhandledError:"]=1;
  26094. } else {
  26095. var smalltalkError;
  26096. smalltalkError=$recv($globals.JavaScriptException)._on_(anError);
  26097. $recv(smalltalkError)._wrap();
  26098. $self._handleUnhandledError_(smalltalkError);
  26099. }
  26100. return self;
  26101. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26102. },
  26103. args: ["anError"],
  26104. 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 ]",
  26105. referencedClasses: ["JavaScriptException"],
  26106. messageSends: ["ifTrue:ifFalse:", "tryCatch:", "isSmalltalkError", "handleUnhandledError:", "on:", "wrap"]
  26107. }),
  26108. $globals.ErrorHandler.a$cls);
  26109. $core.addMethod(
  26110. $core.method({
  26111. selector: "handleUnhandledError:",
  26112. protocol: "error handling",
  26113. fn: function (anError){
  26114. var self=this,$self=this;
  26115. return $core.withContext(function($ctx1) {
  26116. var $1;
  26117. $1=$recv(anError)._wasHandled();
  26118. if(!$core.assert($1)){
  26119. $recv($self._current())._handleError_(anError);
  26120. $recv(anError)._beHandled();
  26121. }
  26122. return self;
  26123. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26124. },
  26125. args: ["anError"],
  26126. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifFalse: [\x0a\x09\x09self current handleError: anError.\x0a\x09\x09anError beHandled ]",
  26127. referencedClasses: [],
  26128. messageSends: ["ifFalse:", "wasHandled", "handleError:", "current", "beHandled"]
  26129. }),
  26130. $globals.ErrorHandler.a$cls);
  26131. $core.addClass("Finder", $globals.Service, [], "Platform-Services");
  26132. $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.";
  26133. $core.addMethod(
  26134. $core.method({
  26135. selector: "findClass:",
  26136. protocol: "finding",
  26137. fn: function (aClass){
  26138. var self=this,$self=this;
  26139. return $core.withContext(function($ctx1) {
  26140. return $recv($self._current())._findClass_(aClass);
  26141. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.a$cls)});
  26142. },
  26143. args: ["aClass"],
  26144. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  26145. referencedClasses: [],
  26146. messageSends: ["findClass:", "current"]
  26147. }),
  26148. $globals.Finder.a$cls);
  26149. $core.addMethod(
  26150. $core.method({
  26151. selector: "findMethod:",
  26152. protocol: "finding",
  26153. fn: function (aCompiledMethod){
  26154. var self=this,$self=this;
  26155. return $core.withContext(function($ctx1) {
  26156. return $recv($self._current())._findMethod_(aCompiledMethod);
  26157. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.a$cls)});
  26158. },
  26159. args: ["aCompiledMethod"],
  26160. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  26161. referencedClasses: [],
  26162. messageSends: ["findMethod:", "current"]
  26163. }),
  26164. $globals.Finder.a$cls);
  26165. $core.addMethod(
  26166. $core.method({
  26167. selector: "findString:",
  26168. protocol: "finding",
  26169. fn: function (aString){
  26170. var self=this,$self=this;
  26171. return $core.withContext(function($ctx1) {
  26172. return $recv($self._current())._findString_(aString);
  26173. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.a$cls)});
  26174. },
  26175. args: ["aString"],
  26176. source: "findString: aString\x0a\x09^ self current findString: aString",
  26177. referencedClasses: [],
  26178. messageSends: ["findString:", "current"]
  26179. }),
  26180. $globals.Finder.a$cls);
  26181. $core.addClass("Inspector", $globals.Service, [], "Platform-Services");
  26182. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  26183. $core.addMethod(
  26184. $core.method({
  26185. selector: "inspect:",
  26186. protocol: "inspecting",
  26187. fn: function (anObject){
  26188. var self=this,$self=this;
  26189. return $core.withContext(function($ctx1) {
  26190. return $recv($self._current())._inspect_(anObject);
  26191. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.a$cls)});
  26192. },
  26193. args: ["anObject"],
  26194. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  26195. referencedClasses: [],
  26196. messageSends: ["inspect:", "current"]
  26197. }),
  26198. $globals.Inspector.a$cls);
  26199. $core.addClass("Platform", $globals.Service, [], "Platform-Services");
  26200. $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";
  26201. $core.addMethod(
  26202. $core.method({
  26203. selector: "globals",
  26204. protocol: "accessing",
  26205. fn: function (){
  26206. var self=this,$self=this;
  26207. return $core.withContext(function($ctx1) {
  26208. return $recv($self._current())._globals();
  26209. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.a$cls)});
  26210. },
  26211. args: [],
  26212. source: "globals\x0a\x09^ self current globals",
  26213. referencedClasses: [],
  26214. messageSends: ["globals", "current"]
  26215. }),
  26216. $globals.Platform.a$cls);
  26217. $core.addMethod(
  26218. $core.method({
  26219. selector: "includesGlobal:",
  26220. protocol: "testing",
  26221. fn: function (aString){
  26222. var self=this,$self=this;
  26223. return $core.withContext(function($ctx1) {
  26224. return $recv($self._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  26225. return true;
  26226. }),(function(){
  26227. return false;
  26228. }));
  26229. }, function($ctx1) {$ctx1.fill(self,"includesGlobal:",{aString:aString},$globals.Platform.a$cls)});
  26230. },
  26231. args: ["aString"],
  26232. source: "includesGlobal: aString\x0a\x09^ self globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  26233. referencedClasses: [],
  26234. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  26235. }),
  26236. $globals.Platform.a$cls);
  26237. $core.addMethod(
  26238. $core.method({
  26239. selector: "newXhr",
  26240. protocol: "accessing",
  26241. fn: function (){
  26242. var self=this,$self=this;
  26243. return $core.withContext(function($ctx1) {
  26244. return $recv($self._current())._newXhr();
  26245. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.a$cls)});
  26246. },
  26247. args: [],
  26248. source: "newXhr\x0a\x09^ self current newXhr",
  26249. referencedClasses: [],
  26250. messageSends: ["newXhr", "current"]
  26251. }),
  26252. $globals.Platform.a$cls);
  26253. $core.addClass("ProgressHandler", $globals.Service, [], "Platform-Services");
  26254. $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`.";
  26255. $core.addMethod(
  26256. $core.method({
  26257. selector: "do:on:displaying:",
  26258. protocol: "progress handling",
  26259. fn: function (aBlock,aCollection,aString){
  26260. var self=this,$self=this;
  26261. return $core.withContext(function($ctx1) {
  26262. $recv($self._current())._do_on_displaying_(aBlock,aCollection,aString);
  26263. return self;
  26264. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.a$cls)});
  26265. },
  26266. args: ["aBlock", "aCollection", "aString"],
  26267. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  26268. referencedClasses: [],
  26269. messageSends: ["do:on:displaying:", "current"]
  26270. }),
  26271. $globals.ProgressHandler.a$cls);
  26272. $core.addClass("Terminal", $globals.Service, [], "Platform-Services");
  26273. $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:'.";
  26274. $core.addMethod(
  26275. $core.method({
  26276. selector: "alert:",
  26277. protocol: "dialogs",
  26278. fn: function (aString){
  26279. var self=this,$self=this;
  26280. return $core.withContext(function($ctx1) {
  26281. return $recv($self._current())._alert_(aString);
  26282. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.a$cls)});
  26283. },
  26284. args: ["aString"],
  26285. source: "alert: aString\x0a\x09^ self current alert: aString",
  26286. referencedClasses: [],
  26287. messageSends: ["alert:", "current"]
  26288. }),
  26289. $globals.Terminal.a$cls);
  26290. $core.addMethod(
  26291. $core.method({
  26292. selector: "confirm:",
  26293. protocol: "dialogs",
  26294. fn: function (aString){
  26295. var self=this,$self=this;
  26296. return $core.withContext(function($ctx1) {
  26297. return $recv($self._current())._confirm_(aString);
  26298. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.a$cls)});
  26299. },
  26300. args: ["aString"],
  26301. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  26302. referencedClasses: [],
  26303. messageSends: ["confirm:", "current"]
  26304. }),
  26305. $globals.Terminal.a$cls);
  26306. $core.addMethod(
  26307. $core.method({
  26308. selector: "prompt:",
  26309. protocol: "dialogs",
  26310. fn: function (aString){
  26311. var self=this,$self=this;
  26312. return $core.withContext(function($ctx1) {
  26313. return $recv($self._current())._prompt_(aString);
  26314. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.a$cls)});
  26315. },
  26316. args: ["aString"],
  26317. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  26318. referencedClasses: [],
  26319. messageSends: ["prompt:", "current"]
  26320. }),
  26321. $globals.Terminal.a$cls);
  26322. $core.addMethod(
  26323. $core.method({
  26324. selector: "prompt:default:",
  26325. protocol: "dialogs",
  26326. fn: function (aString,defaultString){
  26327. var self=this,$self=this;
  26328. return $core.withContext(function($ctx1) {
  26329. return $recv($self._current())._prompt_default_(aString,defaultString);
  26330. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.a$cls)});
  26331. },
  26332. args: ["aString", "defaultString"],
  26333. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  26334. referencedClasses: [],
  26335. messageSends: ["prompt:default:", "current"]
  26336. }),
  26337. $globals.Terminal.a$cls);
  26338. $core.addClass("Transcript", $globals.Service, [], "Platform-Services");
  26339. $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.";
  26340. $core.addMethod(
  26341. $core.method({
  26342. selector: "clear",
  26343. protocol: "printing",
  26344. fn: function (){
  26345. var self=this,$self=this;
  26346. return $core.withContext(function($ctx1) {
  26347. $recv($self._current())._clear();
  26348. return self;
  26349. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.a$cls)});
  26350. },
  26351. args: [],
  26352. source: "clear\x0a\x09self current clear",
  26353. referencedClasses: [],
  26354. messageSends: ["clear", "current"]
  26355. }),
  26356. $globals.Transcript.a$cls);
  26357. $core.addMethod(
  26358. $core.method({
  26359. selector: "cr",
  26360. protocol: "printing",
  26361. fn: function (){
  26362. var self=this,$self=this;
  26363. return $core.withContext(function($ctx1) {
  26364. $recv($self._current())._show_($recv($globals.String)._cr());
  26365. return self;
  26366. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.a$cls)});
  26367. },
  26368. args: [],
  26369. source: "cr\x0a\x09self current show: String cr",
  26370. referencedClasses: ["String"],
  26371. messageSends: ["show:", "current", "cr"]
  26372. }),
  26373. $globals.Transcript.a$cls);
  26374. $core.addMethod(
  26375. $core.method({
  26376. selector: "inspect:",
  26377. protocol: "printing",
  26378. fn: function (anObject){
  26379. var self=this,$self=this;
  26380. return $core.withContext(function($ctx1) {
  26381. $self._show_(anObject);
  26382. return self;
  26383. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.a$cls)});
  26384. },
  26385. args: ["anObject"],
  26386. source: "inspect: anObject\x0a\x09self show: anObject",
  26387. referencedClasses: [],
  26388. messageSends: ["show:"]
  26389. }),
  26390. $globals.Transcript.a$cls);
  26391. $core.addMethod(
  26392. $core.method({
  26393. selector: "open",
  26394. protocol: "instance creation",
  26395. fn: function (){
  26396. var self=this,$self=this;
  26397. return $core.withContext(function($ctx1) {
  26398. $recv($self._current())._open();
  26399. return self;
  26400. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.a$cls)});
  26401. },
  26402. args: [],
  26403. source: "open\x0a\x09self current open",
  26404. referencedClasses: [],
  26405. messageSends: ["open", "current"]
  26406. }),
  26407. $globals.Transcript.a$cls);
  26408. $core.addMethod(
  26409. $core.method({
  26410. selector: "show:",
  26411. protocol: "printing",
  26412. fn: function (anObject){
  26413. var self=this,$self=this;
  26414. return $core.withContext(function($ctx1) {
  26415. $recv($self._current())._show_(anObject);
  26416. return self;
  26417. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.a$cls)});
  26418. },
  26419. args: ["anObject"],
  26420. source: "show: anObject\x0a\x09self current show: anObject",
  26421. referencedClasses: [],
  26422. messageSends: ["show:", "current"]
  26423. }),
  26424. $globals.Transcript.a$cls);
  26425. $core.addMethod(
  26426. $core.method({
  26427. selector: "inspectOn:",
  26428. protocol: "*Platform-Services",
  26429. fn: function (anInspector){
  26430. var self=this,$self=this;
  26431. var variables;
  26432. return $core.withContext(function($ctx1) {
  26433. variables=$recv($globals.Dictionary)._new();
  26434. $recv(variables)._at_put_("#self",self);
  26435. $ctx1.sendIdx["at:put:"]=1;
  26436. $recv(variables)._at_put_("#keys",$self._keys());
  26437. $ctx1.sendIdx["at:put:"]=2;
  26438. $self._keysAndValuesDo_((function(key,value){
  26439. return $core.withContext(function($ctx2) {
  26440. return $recv(variables)._at_put_(key,value);
  26441. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  26442. }));
  26443. $recv(anInspector)._setLabel_($self._printString());
  26444. $recv(anInspector)._setVariables_(variables);
  26445. return self;
  26446. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  26447. },
  26448. args: ["anInspector"],
  26449. 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",
  26450. referencedClasses: ["Dictionary"],
  26451. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  26452. }),
  26453. $globals.AssociativeCollection);
  26454. $core.addMethod(
  26455. $core.method({
  26456. selector: "inspectOn:",
  26457. protocol: "*Platform-Services",
  26458. fn: function (anInspector){
  26459. var self=this,$self=this;
  26460. var variables;
  26461. return $core.withContext(function($ctx1) {
  26462. variables=$recv($globals.Dictionary)._new();
  26463. $recv(variables)._at_put_("#self",self);
  26464. $ctx1.sendIdx["at:put:"]=1;
  26465. $self._withIndexDo_((function(each,i){
  26466. return $core.withContext(function($ctx2) {
  26467. return $recv(variables)._at_put_(i,each);
  26468. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  26469. }));
  26470. $recv(anInspector)._setLabel_($self._printString());
  26471. $recv(anInspector)._setVariables_(variables);
  26472. return self;
  26473. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  26474. },
  26475. args: ["anInspector"],
  26476. 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",
  26477. referencedClasses: ["Dictionary"],
  26478. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  26479. }),
  26480. $globals.Collection);
  26481. $core.addMethod(
  26482. $core.method({
  26483. selector: "inspectOn:",
  26484. protocol: "*Platform-Services",
  26485. fn: function (anInspector){
  26486. var self=this,$self=this;
  26487. var variables;
  26488. return $core.withContext(function($ctx1) {
  26489. variables=$recv($globals.Dictionary)._new();
  26490. $recv(variables)._at_put_("#self",self);
  26491. $ctx1.sendIdx["at:put:"]=1;
  26492. $recv(variables)._at_put_("#year",$self._year());
  26493. $ctx1.sendIdx["at:put:"]=2;
  26494. $recv(variables)._at_put_("#month",$self._month());
  26495. $ctx1.sendIdx["at:put:"]=3;
  26496. $recv(variables)._at_put_("#day",$self._day());
  26497. $ctx1.sendIdx["at:put:"]=4;
  26498. $recv(variables)._at_put_("#hours",$self._hours());
  26499. $ctx1.sendIdx["at:put:"]=5;
  26500. $recv(variables)._at_put_("#minutes",$self._minutes());
  26501. $ctx1.sendIdx["at:put:"]=6;
  26502. $recv(variables)._at_put_("#seconds",$self._seconds());
  26503. $ctx1.sendIdx["at:put:"]=7;
  26504. $recv(variables)._at_put_("#milliseconds",$self._milliseconds());
  26505. $recv(anInspector)._setLabel_($self._printString());
  26506. $recv(anInspector)._setVariables_(variables);
  26507. return self;
  26508. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  26509. },
  26510. args: ["anInspector"],
  26511. 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",
  26512. referencedClasses: ["Dictionary"],
  26513. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  26514. }),
  26515. $globals.Date);
  26516. $core.addMethod(
  26517. $core.method({
  26518. selector: "inspectOn:",
  26519. protocol: "*Platform-Services",
  26520. fn: function (anInspector){
  26521. var self=this,$self=this;
  26522. var variables;
  26523. return $core.withContext(function($ctx1) {
  26524. variables=$recv($globals.Dictionary)._new();
  26525. $recv(variables)._at_put_("#self",$self._jsObject());
  26526. $recv(anInspector)._setLabel_($self._printString());
  26527. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  26528. $recv(anInspector)._setVariables_(variables);
  26529. return self;
  26530. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  26531. },
  26532. args: ["anInspector"],
  26533. 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",
  26534. referencedClasses: ["Dictionary", "JSObjectProxy"],
  26535. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  26536. }),
  26537. $globals.JSObjectProxy);
  26538. $core.addMethod(
  26539. $core.method({
  26540. selector: "inspectOn:",
  26541. protocol: "*Platform-Services",
  26542. fn: function (anInspector){
  26543. var self=this,$self=this;
  26544. var variables;
  26545. return $core.withContext(function($ctx1) {
  26546. variables=$recv($globals.Dictionary)._new();
  26547. $recv(variables)._at_put_("#self",self);
  26548. $ctx1.sendIdx["at:put:"]=1;
  26549. $recv(variables)._at_put_("#home",$self._home());
  26550. $ctx1.sendIdx["at:put:"]=2;
  26551. $recv(variables)._at_put_("#receiver",$self._receiver());
  26552. $ctx1.sendIdx["at:put:"]=3;
  26553. $recv(variables)._at_put_("#selector",$self._selector());
  26554. $ctx1.sendIdx["at:put:"]=4;
  26555. $recv(variables)._at_put_("#locals",$self._locals());
  26556. $ctx1.sendIdx["at:put:"]=5;
  26557. $recv($recv($self._class())._instanceVariableNames())._do_((function(each){
  26558. return $core.withContext(function($ctx2) {
  26559. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26560. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26561. }));
  26562. $recv(anInspector)._setLabel_($self._printString());
  26563. $recv(anInspector)._setVariables_(variables);
  26564. return self;
  26565. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  26566. },
  26567. args: ["anInspector"],
  26568. 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",
  26569. referencedClasses: ["Dictionary"],
  26570. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26571. }),
  26572. $globals.MethodContext);
  26573. $core.addMethod(
  26574. $core.method({
  26575. selector: "inspectOn:",
  26576. protocol: "*Platform-Services",
  26577. fn: function (anInspector){
  26578. var self=this,$self=this;
  26579. var variables;
  26580. return $core.withContext(function($ctx1) {
  26581. variables=$recv($globals.Dictionary)._new();
  26582. $recv(variables)._at_put_("#self",self);
  26583. $ctx1.sendIdx["at:put:"]=1;
  26584. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  26585. return $core.withContext(function($ctx2) {
  26586. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26587. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26588. }));
  26589. $recv(anInspector)._setLabel_($self._printString());
  26590. $recv(anInspector)._setVariables_(variables);
  26591. return self;
  26592. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  26593. },
  26594. args: ["anInspector"],
  26595. 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",
  26596. referencedClasses: ["Dictionary"],
  26597. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26598. }),
  26599. $globals.Object);
  26600. $core.addMethod(
  26601. $core.method({
  26602. selector: "do:displayingProgress:",
  26603. protocol: "*Platform-Services",
  26604. fn: function (aBlock,aString){
  26605. var self=this,$self=this;
  26606. return $core.withContext(function($ctx1) {
  26607. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  26608. return self;
  26609. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  26610. },
  26611. args: ["aBlock", "aString"],
  26612. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  26613. referencedClasses: ["ProgressHandler"],
  26614. messageSends: ["do:on:displaying:"]
  26615. }),
  26616. $globals.SequenceableCollection);
  26617. $core.addMethod(
  26618. $core.method({
  26619. selector: "inspectOn:",
  26620. protocol: "*Platform-Services",
  26621. fn: function (anInspector){
  26622. var self=this,$self=this;
  26623. var variables,i;
  26624. return $core.withContext(function($ctx1) {
  26625. variables=$recv($globals.Dictionary)._new();
  26626. $recv(variables)._at_put_("#self",self);
  26627. $ctx1.sendIdx["at:put:"]=1;
  26628. i=(1);
  26629. $self._do_((function(each){
  26630. return $core.withContext(function($ctx2) {
  26631. $recv(variables)._at_put_(i,each);
  26632. i=$recv(i).__plus((1));
  26633. return i;
  26634. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26635. }));
  26636. $recv(anInspector)._setLabel_($self._printString());
  26637. $recv(anInspector)._setVariables_(variables);
  26638. return self;
  26639. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  26640. },
  26641. args: ["anInspector"],
  26642. 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",
  26643. referencedClasses: ["Dictionary"],
  26644. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  26645. }),
  26646. $globals.Set);
  26647. $core.addMethod(
  26648. $core.method({
  26649. selector: "inspectOn:",
  26650. protocol: "*Platform-Services",
  26651. fn: function (anInspector){
  26652. var self=this,$self=this;
  26653. var label;
  26654. return $core.withContext(function($ctx1) {
  26655. var $3,$2,$1,$5,$4;
  26656. (
  26657. $ctx1.supercall = true,
  26658. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($self, [anInspector]));
  26659. $ctx1.supercall = false;
  26660. $3=$self._printString();
  26661. $ctx1.sendIdx["printString"]=1;
  26662. $2=$recv($3)._size();
  26663. $1=$recv($2).__gt((30));
  26664. if($core.assert($1)){
  26665. $5=$self._printString();
  26666. $ctx1.sendIdx["printString"]=2;
  26667. $4=$recv($5)._copyFrom_to_((1),(30));
  26668. label=$recv($4).__comma("...'");
  26669. label;
  26670. } else {
  26671. label=$self._printString();
  26672. label;
  26673. }
  26674. $recv(anInspector)._setLabel_(label);
  26675. return self;
  26676. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  26677. },
  26678. args: ["anInspector"],
  26679. 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",
  26680. referencedClasses: [],
  26681. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  26682. }),
  26683. $globals.String);
  26684. });
  26685. define('amber/deploy',[
  26686. './helpers',
  26687. './boot', // pre-fetch, dep of ./helpers
  26688. // --- packages of the core Amber begin here ---
  26689. 'amber_core/Kernel-Helpers',
  26690. 'amber_core/Kernel-Objects',
  26691. 'amber_core/Kernel-Classes',
  26692. 'amber_core/Kernel-Methods',
  26693. 'amber_core/Kernel-Collections',
  26694. 'amber_core/Kernel-Dag',
  26695. 'amber_core/Kernel-Infrastructure',
  26696. 'amber_core/Kernel-Promises',
  26697. 'amber_core/Kernel-Exceptions',
  26698. 'amber_core/Kernel-Announcements',
  26699. 'amber_core/Platform-Services',
  26700. // --- packages of the core Amber end here ---
  26701. ], function (amber) {
  26702. return amber;
  26703. });
  26704. // jshint ignore:start
  26705. define('amber/parser',['./boot'], function($boot) {
  26706. var $globals = $boot.globals;
  26707. $globals.SmalltalkParser = (function() {
  26708. "use strict";
  26709. /*
  26710. * Generated by PEG.js 0.9.0.
  26711. *
  26712. * http://pegjs.org/
  26713. */
  26714. function peg$subclass(child, parent) {
  26715. function ctor() { this.constructor = child; }
  26716. ctor.prototype = parent.prototype;
  26717. child.prototype = new ctor();
  26718. }
  26719. function peg$SyntaxError(message, expected, found, location) {
  26720. this.message = message;
  26721. this.expected = expected;
  26722. this.found = found;
  26723. this.location = location;
  26724. this.name = "SyntaxError";
  26725. if (typeof Error.captureStackTrace === "function") {
  26726. Error.captureStackTrace(this, peg$SyntaxError);
  26727. }
  26728. }
  26729. peg$subclass(peg$SyntaxError, Error);
  26730. function peg$parse(input) {
  26731. var options = arguments.length > 1 ? arguments[1] : {},
  26732. parser = this,
  26733. peg$FAILED = {},
  26734. peg$startRuleFunctions = { start: peg$parsestart },
  26735. peg$startRuleFunction = peg$parsestart,
  26736. peg$c0 = /^[ \t\x0B\f\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF\n\r\u2028\u2029]/,
  26737. 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]" },
  26738. peg$c2 = "\"",
  26739. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  26740. peg$c4 = /^[^"]/,
  26741. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  26742. peg$c6 = ".",
  26743. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  26744. peg$c8 = /^[a-zA-Z]/,
  26745. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  26746. peg$c10 = /^[a-zA-Z0-9]/,
  26747. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  26748. peg$c12 = ":",
  26749. peg$c13 = { type: "literal", value: ":", description: "\":\"" },
  26750. peg$c14 = /^[A-Z]/,
  26751. peg$c15 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  26752. peg$c16 = function(val) {
  26753. return $globals.ValueNode._new()
  26754. ._location_(location())
  26755. ._source_(text())
  26756. ._value_(val);
  26757. },
  26758. peg$c17 = "'",
  26759. peg$c18 = { type: "literal", value: "'", description: "\"'\"" },
  26760. peg$c19 = "''",
  26761. peg$c20 = { type: "literal", value: "''", description: "\"''\"" },
  26762. peg$c21 = function() {return '\'';},
  26763. peg$c22 = /^[^']/,
  26764. peg$c23 = { type: "class", value: "[^']", description: "[^']" },
  26765. peg$c24 = function(val) {return val.join('');},
  26766. peg$c25 = "$",
  26767. peg$c26 = { type: "literal", value: "$", description: "\"$\"" },
  26768. peg$c27 = { type: "any", description: "any character" },
  26769. peg$c28 = function(char) {
  26770. return $globals.ValueNode._new()
  26771. ._location_(location())
  26772. ._source_(text())
  26773. ._value_(char);
  26774. },
  26775. peg$c29 = "#",
  26776. peg$c30 = { type: "literal", value: "#", description: "\"#\"" },
  26777. peg$c31 = function(rest) {return rest;},
  26778. peg$c32 = "e",
  26779. peg$c33 = { type: "literal", value: "e", description: "\"e\"" },
  26780. peg$c34 = function(n) {return parseFloat(n);},
  26781. peg$c35 = "-",
  26782. peg$c36 = { type: "literal", value: "-", description: "\"-\"" },
  26783. peg$c37 = "16r",
  26784. peg$c38 = { type: "literal", value: "16r", description: "\"16r\"" },
  26785. peg$c39 = /^[0-9a-fA-F]/,
  26786. peg$c40 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  26787. peg$c41 = function(neg, num) {
  26788. return parseInt(((neg || '') + num), 16);
  26789. },
  26790. peg$c42 = /^[0-9]/,
  26791. peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
  26792. peg$c44 = function(n) {return parseFloat(n, 10);},
  26793. peg$c45 = function(n) {return parseInt(n, 10);},
  26794. peg$c46 = "#(",
  26795. peg$c47 = { type: "literal", value: "#(", description: "\"#(\"" },
  26796. peg$c48 = ")",
  26797. peg$c49 = { type: "literal", value: ")", description: "\")\"" },
  26798. peg$c50 = function(rest) {
  26799. return rest
  26800. ._location_(location())
  26801. ._source_(text());
  26802. },
  26803. peg$c51 = "(",
  26804. peg$c52 = { type: "literal", value: "(", description: "\"(\"" },
  26805. peg$c53 = function(lit) {return lit._value();},
  26806. peg$c54 = function(lits) {
  26807. return $globals.ValueNode._new()
  26808. ._value_(lits);
  26809. },
  26810. peg$c55 = "{",
  26811. peg$c56 = { type: "literal", value: "{", description: "\"{\"" },
  26812. peg$c57 = "}",
  26813. peg$c58 = { type: "literal", value: "}", description: "\"}\"" },
  26814. peg$c59 = function(expressions) {
  26815. return $globals.DynamicArrayNode._new()
  26816. ._location_(location())
  26817. ._source_(text())
  26818. ._dagChildren_(expressions || []);
  26819. },
  26820. peg$c60 = "#{",
  26821. peg$c61 = { type: "literal", value: "#{", description: "\"#{\"" },
  26822. peg$c62 = function(expressions) {
  26823. return $globals.DynamicDictionaryNode._new()
  26824. ._location_(location())
  26825. ._source_(text())
  26826. ._dagChildren_(expressions || []);
  26827. },
  26828. peg$c63 = "true",
  26829. peg$c64 = { type: "literal", value: "true", description: "\"true\"" },
  26830. peg$c65 = function() {return true;},
  26831. peg$c66 = "false",
  26832. peg$c67 = { type: "literal", value: "false", description: "\"false\"" },
  26833. peg$c68 = function() {return false;},
  26834. peg$c69 = "nil",
  26835. peg$c70 = { type: "literal", value: "nil", description: "\"nil\"" },
  26836. peg$c71 = function() {return null;},
  26837. peg$c72 = function(identifier) {
  26838. return $globals.VariableNode._new()
  26839. ._location_(location())
  26840. ._source_(text())
  26841. ._value_(identifier);
  26842. },
  26843. peg$c73 = /^[\\+*\/=><,@%~|&\-]/,
  26844. peg$c74 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  26845. peg$c75 = function(key, arg) {return {key:key, arg:arg};},
  26846. peg$c76 = function(pairs) {
  26847. var selector = '';
  26848. var params = [];
  26849. for(var i = 0; i < pairs.length; i++) {
  26850. selector += pairs[i].key;
  26851. params.push(pairs[i].arg);
  26852. }
  26853. return [selector, params];
  26854. },
  26855. peg$c77 = function(selector, arg) {
  26856. return [selector, [arg]];
  26857. },
  26858. peg$c78 = function(selector) {return [selector, []];},
  26859. peg$c79 = function(expression) {
  26860. return expression;
  26861. },
  26862. peg$c80 = function(first, others) {
  26863. return [first].concat(others);
  26864. },
  26865. peg$c81 = function(selector) {
  26866. return $globals.Message._selector_arguments_(selector, []);
  26867. },
  26868. peg$c82 = function(pairs) {
  26869. var selector = '';
  26870. var args = [];
  26871. for(var i = 0; i < pairs.length; i++) {
  26872. selector += pairs[i].key;
  26873. args.push(pairs[i].arg._value());
  26874. }
  26875. return $globals.Message._selector_arguments_(selector, args)
  26876. },
  26877. peg$c83 = "<",
  26878. peg$c84 = { type: "literal", value: "<", description: "\"<\"" },
  26879. peg$c85 = ">",
  26880. peg$c86 = { type: "literal", value: ">", description: "\">\"" },
  26881. peg$c87 = function(message) {return message;},
  26882. peg$c88 = ":=",
  26883. peg$c89 = { type: "literal", value: ":=", description: "\":=\"" },
  26884. peg$c90 = function(variable, expression) {
  26885. return $globals.AssignmentNode._new()
  26886. ._location_(location())
  26887. ._source_(text())
  26888. ._left_(variable)
  26889. ._right_(expression);
  26890. },
  26891. peg$c91 = "^",
  26892. peg$c92 = { type: "literal", value: "^", description: "\"^\"" },
  26893. peg$c93 = function(expression) {
  26894. return $globals.ReturnNode._new()
  26895. ._location_(location())
  26896. ._source_(text())
  26897. ._dagChildren_([expression]);
  26898. },
  26899. peg$c94 = "|",
  26900. peg$c95 = { type: "literal", value: "|", description: "\"|\"" },
  26901. peg$c96 = function(variable) {return variable;},
  26902. peg$c97 = function(vars) {
  26903. return vars;
  26904. },
  26905. peg$c98 = function(param) {return param;},
  26906. peg$c99 = function(params) {
  26907. return params;
  26908. },
  26909. peg$c100 = function(ret) {return [ret];},
  26910. peg$c101 = function(exps, ret) {
  26911. var expressions = exps;
  26912. expressions.push(ret);
  26913. return expressions;
  26914. },
  26915. peg$c102 = function(expressions) {return expressions || [];},
  26916. peg$c103 = function(aPragmas, temps, zPragmas, statements) {
  26917. return $globals.SequenceNode._new()
  26918. ._location_(location())
  26919. ._source_(text())
  26920. ._temps_(temps || [])
  26921. ._pragmas_((aPragmas || []).concat(zPragmas || []))
  26922. ._dagChildren_(statements || []);
  26923. },
  26924. peg$c104 = "[",
  26925. peg$c105 = { type: "literal", value: "[", description: "\"[\"" },
  26926. peg$c106 = "]",
  26927. peg$c107 = { type: "literal", value: "]", description: "\"]\"" },
  26928. peg$c108 = function(params, sequence) {
  26929. return $globals.BlockNode._new()
  26930. ._location_(location())
  26931. ._source_(text())
  26932. ._parameters_(params || [])
  26933. ._dagChildren_([sequence._asBlockSequenceNode()]);
  26934. },
  26935. peg$c109 = function(selector) {
  26936. return $globals.SendNode._new()
  26937. ._location_(location())
  26938. ._source_(text())
  26939. ._selector_(selector);
  26940. },
  26941. peg$c110 = function(receiver, tail) {
  26942. return receiver._withTail_(tail);
  26943. },
  26944. peg$c111 = function(selector, arg) {
  26945. return $globals.SendNode._new()
  26946. ._location_(location())
  26947. ._source_(text())
  26948. ._selector_(selector)
  26949. ._arguments_([arg]);
  26950. },
  26951. peg$c112 = function(unarys, binarys) { return unarys.concat(binarys); },
  26952. peg$c113 = function(pairs) {
  26953. var selector = '';
  26954. var args = [];
  26955. for(var i = 0; i < pairs.length; i++) {
  26956. selector += pairs[i].key;
  26957. args.push(pairs[i].arg);
  26958. }
  26959. return $globals.SendNode._new()
  26960. ._location_(location())
  26961. ._source_(text())
  26962. ._selector_(selector)
  26963. ._arguments_(args);
  26964. },
  26965. peg$c114 = function(binarys, final) {
  26966. if (final) binarys.push(final);
  26967. return binarys;
  26968. },
  26969. peg$c115 = function(receiver, tail) {return tail.length > 0;},
  26970. peg$c116 = ";",
  26971. peg$c117 = { type: "literal", value: ";", description: "\";\"" },
  26972. peg$c118 = function(receiver, tail, mess) {return mess;},
  26973. peg$c119 = function(receiver, tail, messages) {
  26974. messages.unshift(receiver._withTail_(tail));
  26975. return $globals.CascadeNode._new()
  26976. ._location_(location())
  26977. ._source_(text())
  26978. ._dagChildren_(messages);
  26979. },
  26980. peg$c120 = function(pattern, sequence) {
  26981. return $globals.MethodNode._new()
  26982. ._location_(location())
  26983. ._source_(text())
  26984. ._selector_(pattern[0])
  26985. ._arguments_(pattern[1])
  26986. ._dagChildren_([sequence]);
  26987. },
  26988. peg$c121 = function(receiver, tail) { return tail.length > 0 && tail[tail.length-1]._selector() === '->' },
  26989. peg$c122 = function(receiver, tail) {
  26990. var last = tail.pop();
  26991. return [receiver._withTail_(tail), last._arguments()[0]];
  26992. },
  26993. peg$c123 = function(first, others) {
  26994. return first.concat.apply(first, others);
  26995. },
  26996. peg$currPos = 0,
  26997. peg$savedPos = 0,
  26998. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  26999. peg$maxFailPos = 0,
  27000. peg$maxFailExpected = [],
  27001. peg$silentFails = 0,
  27002. peg$resultsCache = {},
  27003. peg$result;
  27004. if ("startRule" in options) {
  27005. if (!(options.startRule in peg$startRuleFunctions)) {
  27006. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  27007. }
  27008. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  27009. }
  27010. function text() {
  27011. return input.substring(peg$savedPos, peg$currPos);
  27012. }
  27013. function location() {
  27014. return peg$computeLocation(peg$savedPos, peg$currPos);
  27015. }
  27016. function expected(description) {
  27017. throw peg$buildException(
  27018. null,
  27019. [{ type: "other", description: description }],
  27020. input.substring(peg$savedPos, peg$currPos),
  27021. peg$computeLocation(peg$savedPos, peg$currPos)
  27022. );
  27023. }
  27024. function error(message) {
  27025. throw peg$buildException(
  27026. message,
  27027. null,
  27028. input.substring(peg$savedPos, peg$currPos),
  27029. peg$computeLocation(peg$savedPos, peg$currPos)
  27030. );
  27031. }
  27032. function peg$computePosDetails(pos) {
  27033. var details = peg$posDetailsCache[pos],
  27034. p, ch;
  27035. if (details) {
  27036. return details;
  27037. } else {
  27038. p = pos - 1;
  27039. while (!peg$posDetailsCache[p]) {
  27040. p--;
  27041. }
  27042. details = peg$posDetailsCache[p];
  27043. details = {
  27044. line: details.line,
  27045. column: details.column,
  27046. seenCR: details.seenCR
  27047. };
  27048. while (p < pos) {
  27049. ch = input.charAt(p);
  27050. if (ch === "\n") {
  27051. if (!details.seenCR) { details.line++; }
  27052. details.column = 1;
  27053. details.seenCR = false;
  27054. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  27055. details.line++;
  27056. details.column = 1;
  27057. details.seenCR = true;
  27058. } else {
  27059. details.column++;
  27060. details.seenCR = false;
  27061. }
  27062. p++;
  27063. }
  27064. peg$posDetailsCache[pos] = details;
  27065. return details;
  27066. }
  27067. }
  27068. function peg$computeLocation(startPos, endPos) {
  27069. var startPosDetails = peg$computePosDetails(startPos),
  27070. endPosDetails = peg$computePosDetails(endPos);
  27071. return {
  27072. start: {
  27073. offset: startPos,
  27074. line: startPosDetails.line,
  27075. column: startPosDetails.column
  27076. },
  27077. end: {
  27078. offset: endPos,
  27079. line: endPosDetails.line,
  27080. column: endPosDetails.column
  27081. }
  27082. };
  27083. }
  27084. function peg$fail(expected) {
  27085. if (peg$currPos < peg$maxFailPos) { return; }
  27086. if (peg$currPos > peg$maxFailPos) {
  27087. peg$maxFailPos = peg$currPos;
  27088. peg$maxFailExpected = [];
  27089. }
  27090. peg$maxFailExpected.push(expected);
  27091. }
  27092. function peg$buildException(message, expected, found, location) {
  27093. function cleanupExpected(expected) {
  27094. var i = 1;
  27095. expected.sort(function(a, b) {
  27096. if (a.description < b.description) {
  27097. return -1;
  27098. } else if (a.description > b.description) {
  27099. return 1;
  27100. } else {
  27101. return 0;
  27102. }
  27103. });
  27104. while (i < expected.length) {
  27105. if (expected[i - 1] === expected[i]) {
  27106. expected.splice(i, 1);
  27107. } else {
  27108. i++;
  27109. }
  27110. }
  27111. }
  27112. function buildMessage(expected, found) {
  27113. function stringEscape(s) {
  27114. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  27115. return s
  27116. .replace(/\\/g, '\\\\')
  27117. .replace(/"/g, '\\"')
  27118. .replace(/\x08/g, '\\b')
  27119. .replace(/\t/g, '\\t')
  27120. .replace(/\n/g, '\\n')
  27121. .replace(/\f/g, '\\f')
  27122. .replace(/\r/g, '\\r')
  27123. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  27124. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  27125. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  27126. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  27127. }
  27128. var expectedDescs = new Array(expected.length),
  27129. expectedDesc, foundDesc, i;
  27130. for (i = 0; i < expected.length; i++) {
  27131. expectedDescs[i] = expected[i].description;
  27132. }
  27133. expectedDesc = expected.length > 1
  27134. ? expectedDescs.slice(0, -1).join(", ")
  27135. + " or "
  27136. + expectedDescs[expected.length - 1]
  27137. : expectedDescs[0];
  27138. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  27139. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  27140. }
  27141. if (expected !== null) {
  27142. cleanupExpected(expected);
  27143. }
  27144. return new peg$SyntaxError(
  27145. message !== null ? message : buildMessage(expected, found),
  27146. expected,
  27147. found,
  27148. location
  27149. );
  27150. }
  27151. function peg$parsestart() {
  27152. var s0;
  27153. var key = peg$currPos * 66 + 0,
  27154. cached = peg$resultsCache[key];
  27155. if (cached) {
  27156. peg$currPos = cached.nextPos;
  27157. return cached.result;
  27158. }
  27159. s0 = peg$parsemethod();
  27160. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27161. return s0;
  27162. }
  27163. function peg$parseseparator() {
  27164. var s0, s1;
  27165. var key = peg$currPos * 66 + 1,
  27166. cached = peg$resultsCache[key];
  27167. if (cached) {
  27168. peg$currPos = cached.nextPos;
  27169. return cached.result;
  27170. }
  27171. s0 = [];
  27172. if (peg$c0.test(input.charAt(peg$currPos))) {
  27173. s1 = input.charAt(peg$currPos);
  27174. peg$currPos++;
  27175. } else {
  27176. s1 = peg$FAILED;
  27177. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27178. }
  27179. if (s1 !== peg$FAILED) {
  27180. while (s1 !== peg$FAILED) {
  27181. s0.push(s1);
  27182. if (peg$c0.test(input.charAt(peg$currPos))) {
  27183. s1 = input.charAt(peg$currPos);
  27184. peg$currPos++;
  27185. } else {
  27186. s1 = peg$FAILED;
  27187. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27188. }
  27189. }
  27190. } else {
  27191. s0 = peg$FAILED;
  27192. }
  27193. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27194. return s0;
  27195. }
  27196. function peg$parsecomments() {
  27197. var s0, s1, s2, s3, s4;
  27198. var key = peg$currPos * 66 + 2,
  27199. cached = peg$resultsCache[key];
  27200. if (cached) {
  27201. peg$currPos = cached.nextPos;
  27202. return cached.result;
  27203. }
  27204. s0 = [];
  27205. s1 = peg$currPos;
  27206. if (input.charCodeAt(peg$currPos) === 34) {
  27207. s2 = peg$c2;
  27208. peg$currPos++;
  27209. } else {
  27210. s2 = peg$FAILED;
  27211. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27212. }
  27213. if (s2 !== peg$FAILED) {
  27214. s3 = [];
  27215. if (peg$c4.test(input.charAt(peg$currPos))) {
  27216. s4 = input.charAt(peg$currPos);
  27217. peg$currPos++;
  27218. } else {
  27219. s4 = peg$FAILED;
  27220. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27221. }
  27222. while (s4 !== peg$FAILED) {
  27223. s3.push(s4);
  27224. if (peg$c4.test(input.charAt(peg$currPos))) {
  27225. s4 = input.charAt(peg$currPos);
  27226. peg$currPos++;
  27227. } else {
  27228. s4 = peg$FAILED;
  27229. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27230. }
  27231. }
  27232. if (s3 !== peg$FAILED) {
  27233. if (input.charCodeAt(peg$currPos) === 34) {
  27234. s4 = peg$c2;
  27235. peg$currPos++;
  27236. } else {
  27237. s4 = peg$FAILED;
  27238. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27239. }
  27240. if (s4 !== peg$FAILED) {
  27241. s2 = [s2, s3, s4];
  27242. s1 = s2;
  27243. } else {
  27244. peg$currPos = s1;
  27245. s1 = peg$FAILED;
  27246. }
  27247. } else {
  27248. peg$currPos = s1;
  27249. s1 = peg$FAILED;
  27250. }
  27251. } else {
  27252. peg$currPos = s1;
  27253. s1 = peg$FAILED;
  27254. }
  27255. if (s1 !== peg$FAILED) {
  27256. while (s1 !== peg$FAILED) {
  27257. s0.push(s1);
  27258. s1 = peg$currPos;
  27259. if (input.charCodeAt(peg$currPos) === 34) {
  27260. s2 = peg$c2;
  27261. peg$currPos++;
  27262. } else {
  27263. s2 = peg$FAILED;
  27264. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27265. }
  27266. if (s2 !== peg$FAILED) {
  27267. s3 = [];
  27268. if (peg$c4.test(input.charAt(peg$currPos))) {
  27269. s4 = input.charAt(peg$currPos);
  27270. peg$currPos++;
  27271. } else {
  27272. s4 = peg$FAILED;
  27273. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27274. }
  27275. while (s4 !== peg$FAILED) {
  27276. s3.push(s4);
  27277. if (peg$c4.test(input.charAt(peg$currPos))) {
  27278. s4 = input.charAt(peg$currPos);
  27279. peg$currPos++;
  27280. } else {
  27281. s4 = peg$FAILED;
  27282. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27283. }
  27284. }
  27285. if (s3 !== peg$FAILED) {
  27286. if (input.charCodeAt(peg$currPos) === 34) {
  27287. s4 = peg$c2;
  27288. peg$currPos++;
  27289. } else {
  27290. s4 = peg$FAILED;
  27291. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27292. }
  27293. if (s4 !== peg$FAILED) {
  27294. s2 = [s2, s3, s4];
  27295. s1 = s2;
  27296. } else {
  27297. peg$currPos = s1;
  27298. s1 = peg$FAILED;
  27299. }
  27300. } else {
  27301. peg$currPos = s1;
  27302. s1 = peg$FAILED;
  27303. }
  27304. } else {
  27305. peg$currPos = s1;
  27306. s1 = peg$FAILED;
  27307. }
  27308. }
  27309. } else {
  27310. s0 = peg$FAILED;
  27311. }
  27312. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27313. return s0;
  27314. }
  27315. function peg$parsews() {
  27316. var s0, s1;
  27317. var key = peg$currPos * 66 + 3,
  27318. cached = peg$resultsCache[key];
  27319. if (cached) {
  27320. peg$currPos = cached.nextPos;
  27321. return cached.result;
  27322. }
  27323. s0 = [];
  27324. s1 = peg$parseseparator();
  27325. if (s1 === peg$FAILED) {
  27326. s1 = peg$parsecomments();
  27327. }
  27328. while (s1 !== peg$FAILED) {
  27329. s0.push(s1);
  27330. s1 = peg$parseseparator();
  27331. if (s1 === peg$FAILED) {
  27332. s1 = peg$parsecomments();
  27333. }
  27334. }
  27335. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27336. return s0;
  27337. }
  27338. function peg$parsemaybeDotsWs() {
  27339. var s0, s1;
  27340. var key = peg$currPos * 66 + 4,
  27341. cached = peg$resultsCache[key];
  27342. if (cached) {
  27343. peg$currPos = cached.nextPos;
  27344. return cached.result;
  27345. }
  27346. s0 = [];
  27347. if (input.charCodeAt(peg$currPos) === 46) {
  27348. s1 = peg$c6;
  27349. peg$currPos++;
  27350. } else {
  27351. s1 = peg$FAILED;
  27352. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27353. }
  27354. if (s1 === peg$FAILED) {
  27355. s1 = peg$parseseparator();
  27356. if (s1 === peg$FAILED) {
  27357. s1 = peg$parsecomments();
  27358. }
  27359. }
  27360. while (s1 !== peg$FAILED) {
  27361. s0.push(s1);
  27362. if (input.charCodeAt(peg$currPos) === 46) {
  27363. s1 = peg$c6;
  27364. peg$currPos++;
  27365. } else {
  27366. s1 = peg$FAILED;
  27367. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27368. }
  27369. if (s1 === peg$FAILED) {
  27370. s1 = peg$parseseparator();
  27371. if (s1 === peg$FAILED) {
  27372. s1 = peg$parsecomments();
  27373. }
  27374. }
  27375. }
  27376. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27377. return s0;
  27378. }
  27379. function peg$parsesomeDotsWs() {
  27380. var s0, s1, s2, s3;
  27381. var key = peg$currPos * 66 + 5,
  27382. cached = peg$resultsCache[key];
  27383. if (cached) {
  27384. peg$currPos = cached.nextPos;
  27385. return cached.result;
  27386. }
  27387. s0 = peg$currPos;
  27388. s1 = peg$parsews();
  27389. if (s1 !== peg$FAILED) {
  27390. if (input.charCodeAt(peg$currPos) === 46) {
  27391. s2 = peg$c6;
  27392. peg$currPos++;
  27393. } else {
  27394. s2 = peg$FAILED;
  27395. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27396. }
  27397. if (s2 !== peg$FAILED) {
  27398. s3 = peg$parsemaybeDotsWs();
  27399. if (s3 !== peg$FAILED) {
  27400. s1 = [s1, s2, s3];
  27401. s0 = s1;
  27402. } else {
  27403. peg$currPos = s0;
  27404. s0 = peg$FAILED;
  27405. }
  27406. } else {
  27407. peg$currPos = s0;
  27408. s0 = peg$FAILED;
  27409. }
  27410. } else {
  27411. peg$currPos = s0;
  27412. s0 = peg$FAILED;
  27413. }
  27414. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27415. return s0;
  27416. }
  27417. function peg$parseidentifier() {
  27418. var s0, s1, s2, s3, s4;
  27419. var key = peg$currPos * 66 + 6,
  27420. cached = peg$resultsCache[key];
  27421. if (cached) {
  27422. peg$currPos = cached.nextPos;
  27423. return cached.result;
  27424. }
  27425. s0 = peg$currPos;
  27426. s1 = peg$currPos;
  27427. if (peg$c8.test(input.charAt(peg$currPos))) {
  27428. s2 = input.charAt(peg$currPos);
  27429. peg$currPos++;
  27430. } else {
  27431. s2 = peg$FAILED;
  27432. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  27433. }
  27434. if (s2 !== peg$FAILED) {
  27435. s3 = [];
  27436. if (peg$c10.test(input.charAt(peg$currPos))) {
  27437. s4 = input.charAt(peg$currPos);
  27438. peg$currPos++;
  27439. } else {
  27440. s4 = peg$FAILED;
  27441. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27442. }
  27443. while (s4 !== peg$FAILED) {
  27444. s3.push(s4);
  27445. if (peg$c10.test(input.charAt(peg$currPos))) {
  27446. s4 = input.charAt(peg$currPos);
  27447. peg$currPos++;
  27448. } else {
  27449. s4 = peg$FAILED;
  27450. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27451. }
  27452. }
  27453. if (s3 !== peg$FAILED) {
  27454. s2 = [s2, s3];
  27455. s1 = s2;
  27456. } else {
  27457. peg$currPos = s1;
  27458. s1 = peg$FAILED;
  27459. }
  27460. } else {
  27461. peg$currPos = s1;
  27462. s1 = peg$FAILED;
  27463. }
  27464. if (s1 !== peg$FAILED) {
  27465. s0 = input.substring(s0, peg$currPos);
  27466. } else {
  27467. s0 = s1;
  27468. }
  27469. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27470. return s0;
  27471. }
  27472. function peg$parsekeyword() {
  27473. var s0, s1, s2, s3;
  27474. var key = peg$currPos * 66 + 7,
  27475. cached = peg$resultsCache[key];
  27476. if (cached) {
  27477. peg$currPos = cached.nextPos;
  27478. return cached.result;
  27479. }
  27480. s0 = peg$currPos;
  27481. s1 = peg$currPos;
  27482. s2 = peg$parseidentifier();
  27483. if (s2 !== peg$FAILED) {
  27484. if (input.charCodeAt(peg$currPos) === 58) {
  27485. s3 = peg$c12;
  27486. peg$currPos++;
  27487. } else {
  27488. s3 = peg$FAILED;
  27489. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  27490. }
  27491. if (s3 !== peg$FAILED) {
  27492. s2 = [s2, s3];
  27493. s1 = s2;
  27494. } else {
  27495. peg$currPos = s1;
  27496. s1 = peg$FAILED;
  27497. }
  27498. } else {
  27499. peg$currPos = s1;
  27500. s1 = peg$FAILED;
  27501. }
  27502. if (s1 !== peg$FAILED) {
  27503. s0 = input.substring(s0, peg$currPos);
  27504. } else {
  27505. s0 = s1;
  27506. }
  27507. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27508. return s0;
  27509. }
  27510. function peg$parseclassName() {
  27511. var s0, s1, s2, s3, s4;
  27512. var key = peg$currPos * 66 + 8,
  27513. cached = peg$resultsCache[key];
  27514. if (cached) {
  27515. peg$currPos = cached.nextPos;
  27516. return cached.result;
  27517. }
  27518. s0 = peg$currPos;
  27519. s1 = peg$currPos;
  27520. if (peg$c14.test(input.charAt(peg$currPos))) {
  27521. s2 = input.charAt(peg$currPos);
  27522. peg$currPos++;
  27523. } else {
  27524. s2 = peg$FAILED;
  27525. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  27526. }
  27527. if (s2 !== peg$FAILED) {
  27528. s3 = [];
  27529. if (peg$c10.test(input.charAt(peg$currPos))) {
  27530. s4 = input.charAt(peg$currPos);
  27531. peg$currPos++;
  27532. } else {
  27533. s4 = peg$FAILED;
  27534. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27535. }
  27536. while (s4 !== peg$FAILED) {
  27537. s3.push(s4);
  27538. if (peg$c10.test(input.charAt(peg$currPos))) {
  27539. s4 = input.charAt(peg$currPos);
  27540. peg$currPos++;
  27541. } else {
  27542. s4 = peg$FAILED;
  27543. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27544. }
  27545. }
  27546. if (s3 !== peg$FAILED) {
  27547. s2 = [s2, s3];
  27548. s1 = s2;
  27549. } else {
  27550. peg$currPos = s1;
  27551. s1 = peg$FAILED;
  27552. }
  27553. } else {
  27554. peg$currPos = s1;
  27555. s1 = peg$FAILED;
  27556. }
  27557. if (s1 !== peg$FAILED) {
  27558. s0 = input.substring(s0, peg$currPos);
  27559. } else {
  27560. s0 = s1;
  27561. }
  27562. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27563. return s0;
  27564. }
  27565. function peg$parsestring() {
  27566. var s0, s1;
  27567. var key = peg$currPos * 66 + 9,
  27568. cached = peg$resultsCache[key];
  27569. if (cached) {
  27570. peg$currPos = cached.nextPos;
  27571. return cached.result;
  27572. }
  27573. s0 = peg$currPos;
  27574. s1 = peg$parserawString();
  27575. if (s1 !== peg$FAILED) {
  27576. peg$savedPos = s0;
  27577. s1 = peg$c16(s1);
  27578. }
  27579. s0 = s1;
  27580. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27581. return s0;
  27582. }
  27583. function peg$parserawString() {
  27584. var s0, s1, s2, s3, s4;
  27585. var key = peg$currPos * 66 + 10,
  27586. cached = peg$resultsCache[key];
  27587. if (cached) {
  27588. peg$currPos = cached.nextPos;
  27589. return cached.result;
  27590. }
  27591. s0 = peg$currPos;
  27592. if (input.charCodeAt(peg$currPos) === 39) {
  27593. s1 = peg$c17;
  27594. peg$currPos++;
  27595. } else {
  27596. s1 = peg$FAILED;
  27597. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27598. }
  27599. if (s1 !== peg$FAILED) {
  27600. s2 = [];
  27601. s3 = peg$currPos;
  27602. if (input.substr(peg$currPos, 2) === peg$c19) {
  27603. s4 = peg$c19;
  27604. peg$currPos += 2;
  27605. } else {
  27606. s4 = peg$FAILED;
  27607. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27608. }
  27609. if (s4 !== peg$FAILED) {
  27610. peg$savedPos = s3;
  27611. s4 = peg$c21();
  27612. }
  27613. s3 = s4;
  27614. if (s3 === peg$FAILED) {
  27615. if (peg$c22.test(input.charAt(peg$currPos))) {
  27616. s3 = input.charAt(peg$currPos);
  27617. peg$currPos++;
  27618. } else {
  27619. s3 = peg$FAILED;
  27620. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27621. }
  27622. }
  27623. while (s3 !== peg$FAILED) {
  27624. s2.push(s3);
  27625. s3 = peg$currPos;
  27626. if (input.substr(peg$currPos, 2) === peg$c19) {
  27627. s4 = peg$c19;
  27628. peg$currPos += 2;
  27629. } else {
  27630. s4 = peg$FAILED;
  27631. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27632. }
  27633. if (s4 !== peg$FAILED) {
  27634. peg$savedPos = s3;
  27635. s4 = peg$c21();
  27636. }
  27637. s3 = s4;
  27638. if (s3 === peg$FAILED) {
  27639. if (peg$c22.test(input.charAt(peg$currPos))) {
  27640. s3 = input.charAt(peg$currPos);
  27641. peg$currPos++;
  27642. } else {
  27643. s3 = peg$FAILED;
  27644. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27645. }
  27646. }
  27647. }
  27648. if (s2 !== peg$FAILED) {
  27649. if (input.charCodeAt(peg$currPos) === 39) {
  27650. s3 = peg$c17;
  27651. peg$currPos++;
  27652. } else {
  27653. s3 = peg$FAILED;
  27654. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27655. }
  27656. if (s3 !== peg$FAILED) {
  27657. peg$savedPos = s0;
  27658. s1 = peg$c24(s2);
  27659. s0 = s1;
  27660. } else {
  27661. peg$currPos = s0;
  27662. s0 = peg$FAILED;
  27663. }
  27664. } else {
  27665. peg$currPos = s0;
  27666. s0 = peg$FAILED;
  27667. }
  27668. } else {
  27669. peg$currPos = s0;
  27670. s0 = peg$FAILED;
  27671. }
  27672. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27673. return s0;
  27674. }
  27675. function peg$parsecharacter() {
  27676. var s0, s1, s2;
  27677. var key = peg$currPos * 66 + 11,
  27678. cached = peg$resultsCache[key];
  27679. if (cached) {
  27680. peg$currPos = cached.nextPos;
  27681. return cached.result;
  27682. }
  27683. s0 = peg$currPos;
  27684. if (input.charCodeAt(peg$currPos) === 36) {
  27685. s1 = peg$c25;
  27686. peg$currPos++;
  27687. } else {
  27688. s1 = peg$FAILED;
  27689. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  27690. }
  27691. if (s1 !== peg$FAILED) {
  27692. if (input.length > peg$currPos) {
  27693. s2 = input.charAt(peg$currPos);
  27694. peg$currPos++;
  27695. } else {
  27696. s2 = peg$FAILED;
  27697. if (peg$silentFails === 0) { peg$fail(peg$c27); }
  27698. }
  27699. if (s2 !== peg$FAILED) {
  27700. peg$savedPos = s0;
  27701. s1 = peg$c28(s2);
  27702. s0 = s1;
  27703. } else {
  27704. peg$currPos = s0;
  27705. s0 = peg$FAILED;
  27706. }
  27707. } else {
  27708. peg$currPos = s0;
  27709. s0 = peg$FAILED;
  27710. }
  27711. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27712. return s0;
  27713. }
  27714. function peg$parsesymbol() {
  27715. var s0, s1, s2;
  27716. var key = peg$currPos * 66 + 12,
  27717. cached = peg$resultsCache[key];
  27718. if (cached) {
  27719. peg$currPos = cached.nextPos;
  27720. return cached.result;
  27721. }
  27722. s0 = peg$currPos;
  27723. if (input.charCodeAt(peg$currPos) === 35) {
  27724. s1 = peg$c29;
  27725. peg$currPos++;
  27726. } else {
  27727. s1 = peg$FAILED;
  27728. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  27729. }
  27730. if (s1 !== peg$FAILED) {
  27731. s2 = peg$parsebareSymbol();
  27732. if (s2 !== peg$FAILED) {
  27733. peg$savedPos = s0;
  27734. s1 = peg$c31(s2);
  27735. s0 = s1;
  27736. } else {
  27737. peg$currPos = s0;
  27738. s0 = peg$FAILED;
  27739. }
  27740. } else {
  27741. peg$currPos = s0;
  27742. s0 = peg$FAILED;
  27743. }
  27744. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27745. return s0;
  27746. }
  27747. function peg$parsebareSymbol() {
  27748. var s0, s1, s2, s3;
  27749. var key = peg$currPos * 66 + 13,
  27750. cached = peg$resultsCache[key];
  27751. if (cached) {
  27752. peg$currPos = cached.nextPos;
  27753. return cached.result;
  27754. }
  27755. s0 = peg$currPos;
  27756. s1 = peg$currPos;
  27757. s2 = [];
  27758. s3 = peg$parsekeyword();
  27759. if (s3 !== peg$FAILED) {
  27760. while (s3 !== peg$FAILED) {
  27761. s2.push(s3);
  27762. s3 = peg$parsekeyword();
  27763. }
  27764. } else {
  27765. s2 = peg$FAILED;
  27766. }
  27767. if (s2 !== peg$FAILED) {
  27768. s1 = input.substring(s1, peg$currPos);
  27769. } else {
  27770. s1 = s2;
  27771. }
  27772. if (s1 === peg$FAILED) {
  27773. s1 = peg$parsebinarySelector();
  27774. if (s1 === peg$FAILED) {
  27775. s1 = peg$parseidentifier();
  27776. if (s1 === peg$FAILED) {
  27777. s1 = peg$parserawString();
  27778. }
  27779. }
  27780. }
  27781. if (s1 !== peg$FAILED) {
  27782. peg$savedPos = s0;
  27783. s1 = peg$c16(s1);
  27784. }
  27785. s0 = s1;
  27786. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27787. return s0;
  27788. }
  27789. function peg$parsenumber() {
  27790. var s0, s1;
  27791. var key = peg$currPos * 66 + 14,
  27792. cached = peg$resultsCache[key];
  27793. if (cached) {
  27794. peg$currPos = cached.nextPos;
  27795. return cached.result;
  27796. }
  27797. s0 = peg$currPos;
  27798. s1 = peg$parserawNumber();
  27799. if (s1 !== peg$FAILED) {
  27800. peg$savedPos = s0;
  27801. s1 = peg$c16(s1);
  27802. }
  27803. s0 = s1;
  27804. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27805. return s0;
  27806. }
  27807. function peg$parserawNumber() {
  27808. var s0;
  27809. var key = peg$currPos * 66 + 15,
  27810. cached = peg$resultsCache[key];
  27811. if (cached) {
  27812. peg$currPos = cached.nextPos;
  27813. return cached.result;
  27814. }
  27815. s0 = peg$parsenumberExp();
  27816. if (s0 === peg$FAILED) {
  27817. s0 = peg$parsehex();
  27818. if (s0 === peg$FAILED) {
  27819. s0 = peg$parsefloat();
  27820. if (s0 === peg$FAILED) {
  27821. s0 = peg$parseinteger();
  27822. }
  27823. }
  27824. }
  27825. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27826. return s0;
  27827. }
  27828. function peg$parsenumberExp() {
  27829. var s0, s1, s2, s3, s4, s5;
  27830. var key = peg$currPos * 66 + 16,
  27831. cached = peg$resultsCache[key];
  27832. if (cached) {
  27833. peg$currPos = cached.nextPos;
  27834. return cached.result;
  27835. }
  27836. s0 = peg$currPos;
  27837. s1 = peg$currPos;
  27838. s2 = peg$currPos;
  27839. s3 = peg$parsefloat();
  27840. if (s3 === peg$FAILED) {
  27841. s3 = peg$parseinteger();
  27842. }
  27843. if (s3 !== peg$FAILED) {
  27844. if (input.charCodeAt(peg$currPos) === 101) {
  27845. s4 = peg$c32;
  27846. peg$currPos++;
  27847. } else {
  27848. s4 = peg$FAILED;
  27849. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  27850. }
  27851. if (s4 !== peg$FAILED) {
  27852. s5 = peg$parseinteger();
  27853. if (s5 !== peg$FAILED) {
  27854. s3 = [s3, s4, s5];
  27855. s2 = s3;
  27856. } else {
  27857. peg$currPos = s2;
  27858. s2 = peg$FAILED;
  27859. }
  27860. } else {
  27861. peg$currPos = s2;
  27862. s2 = peg$FAILED;
  27863. }
  27864. } else {
  27865. peg$currPos = s2;
  27866. s2 = peg$FAILED;
  27867. }
  27868. if (s2 !== peg$FAILED) {
  27869. s1 = input.substring(s1, peg$currPos);
  27870. } else {
  27871. s1 = s2;
  27872. }
  27873. if (s1 !== peg$FAILED) {
  27874. peg$savedPos = s0;
  27875. s1 = peg$c34(s1);
  27876. }
  27877. s0 = s1;
  27878. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27879. return s0;
  27880. }
  27881. function peg$parsehex() {
  27882. var s0, s1, s2, s3, s4, s5;
  27883. var key = peg$currPos * 66 + 17,
  27884. cached = peg$resultsCache[key];
  27885. if (cached) {
  27886. peg$currPos = cached.nextPos;
  27887. return cached.result;
  27888. }
  27889. s0 = peg$currPos;
  27890. if (input.charCodeAt(peg$currPos) === 45) {
  27891. s1 = peg$c35;
  27892. peg$currPos++;
  27893. } else {
  27894. s1 = peg$FAILED;
  27895. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27896. }
  27897. if (s1 === peg$FAILED) {
  27898. s1 = null;
  27899. }
  27900. if (s1 !== peg$FAILED) {
  27901. if (input.substr(peg$currPos, 3) === peg$c37) {
  27902. s2 = peg$c37;
  27903. peg$currPos += 3;
  27904. } else {
  27905. s2 = peg$FAILED;
  27906. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  27907. }
  27908. if (s2 !== peg$FAILED) {
  27909. s3 = peg$currPos;
  27910. s4 = [];
  27911. if (peg$c39.test(input.charAt(peg$currPos))) {
  27912. s5 = input.charAt(peg$currPos);
  27913. peg$currPos++;
  27914. } else {
  27915. s5 = peg$FAILED;
  27916. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27917. }
  27918. if (s5 !== peg$FAILED) {
  27919. while (s5 !== peg$FAILED) {
  27920. s4.push(s5);
  27921. if (peg$c39.test(input.charAt(peg$currPos))) {
  27922. s5 = input.charAt(peg$currPos);
  27923. peg$currPos++;
  27924. } else {
  27925. s5 = peg$FAILED;
  27926. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27927. }
  27928. }
  27929. } else {
  27930. s4 = peg$FAILED;
  27931. }
  27932. if (s4 !== peg$FAILED) {
  27933. s3 = input.substring(s3, peg$currPos);
  27934. } else {
  27935. s3 = s4;
  27936. }
  27937. if (s3 !== peg$FAILED) {
  27938. peg$savedPos = s0;
  27939. s1 = peg$c41(s1, s3);
  27940. s0 = s1;
  27941. } else {
  27942. peg$currPos = s0;
  27943. s0 = peg$FAILED;
  27944. }
  27945. } else {
  27946. peg$currPos = s0;
  27947. s0 = peg$FAILED;
  27948. }
  27949. } else {
  27950. peg$currPos = s0;
  27951. s0 = peg$FAILED;
  27952. }
  27953. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27954. return s0;
  27955. }
  27956. function peg$parsefloat() {
  27957. var s0, s1, s2, s3, s4, s5, s6, s7;
  27958. var key = peg$currPos * 66 + 18,
  27959. cached = peg$resultsCache[key];
  27960. if (cached) {
  27961. peg$currPos = cached.nextPos;
  27962. return cached.result;
  27963. }
  27964. s0 = peg$currPos;
  27965. s1 = peg$currPos;
  27966. s2 = peg$currPos;
  27967. if (input.charCodeAt(peg$currPos) === 45) {
  27968. s3 = peg$c35;
  27969. peg$currPos++;
  27970. } else {
  27971. s3 = peg$FAILED;
  27972. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27973. }
  27974. if (s3 === peg$FAILED) {
  27975. s3 = null;
  27976. }
  27977. if (s3 !== peg$FAILED) {
  27978. s4 = [];
  27979. if (peg$c42.test(input.charAt(peg$currPos))) {
  27980. s5 = input.charAt(peg$currPos);
  27981. peg$currPos++;
  27982. } else {
  27983. s5 = peg$FAILED;
  27984. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27985. }
  27986. if (s5 !== peg$FAILED) {
  27987. while (s5 !== peg$FAILED) {
  27988. s4.push(s5);
  27989. if (peg$c42.test(input.charAt(peg$currPos))) {
  27990. s5 = input.charAt(peg$currPos);
  27991. peg$currPos++;
  27992. } else {
  27993. s5 = peg$FAILED;
  27994. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27995. }
  27996. }
  27997. } else {
  27998. s4 = peg$FAILED;
  27999. }
  28000. if (s4 !== peg$FAILED) {
  28001. if (input.charCodeAt(peg$currPos) === 46) {
  28002. s5 = peg$c6;
  28003. peg$currPos++;
  28004. } else {
  28005. s5 = peg$FAILED;
  28006. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  28007. }
  28008. if (s5 !== peg$FAILED) {
  28009. s6 = [];
  28010. if (peg$c42.test(input.charAt(peg$currPos))) {
  28011. s7 = input.charAt(peg$currPos);
  28012. peg$currPos++;
  28013. } else {
  28014. s7 = peg$FAILED;
  28015. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28016. }
  28017. if (s7 !== peg$FAILED) {
  28018. while (s7 !== peg$FAILED) {
  28019. s6.push(s7);
  28020. if (peg$c42.test(input.charAt(peg$currPos))) {
  28021. s7 = input.charAt(peg$currPos);
  28022. peg$currPos++;
  28023. } else {
  28024. s7 = peg$FAILED;
  28025. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28026. }
  28027. }
  28028. } else {
  28029. s6 = peg$FAILED;
  28030. }
  28031. if (s6 !== peg$FAILED) {
  28032. s3 = [s3, s4, s5, s6];
  28033. s2 = s3;
  28034. } else {
  28035. peg$currPos = s2;
  28036. s2 = peg$FAILED;
  28037. }
  28038. } else {
  28039. peg$currPos = s2;
  28040. s2 = peg$FAILED;
  28041. }
  28042. } else {
  28043. peg$currPos = s2;
  28044. s2 = peg$FAILED;
  28045. }
  28046. } else {
  28047. peg$currPos = s2;
  28048. s2 = peg$FAILED;
  28049. }
  28050. if (s2 !== peg$FAILED) {
  28051. s1 = input.substring(s1, peg$currPos);
  28052. } else {
  28053. s1 = s2;
  28054. }
  28055. if (s1 !== peg$FAILED) {
  28056. peg$savedPos = s0;
  28057. s1 = peg$c44(s1);
  28058. }
  28059. s0 = s1;
  28060. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28061. return s0;
  28062. }
  28063. function peg$parseinteger() {
  28064. var s0, s1, s2, s3, s4, s5;
  28065. var key = peg$currPos * 66 + 19,
  28066. cached = peg$resultsCache[key];
  28067. if (cached) {
  28068. peg$currPos = cached.nextPos;
  28069. return cached.result;
  28070. }
  28071. s0 = peg$currPos;
  28072. s1 = peg$currPos;
  28073. s2 = peg$currPos;
  28074. if (input.charCodeAt(peg$currPos) === 45) {
  28075. s3 = peg$c35;
  28076. peg$currPos++;
  28077. } else {
  28078. s3 = peg$FAILED;
  28079. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28080. }
  28081. if (s3 === peg$FAILED) {
  28082. s3 = null;
  28083. }
  28084. if (s3 !== peg$FAILED) {
  28085. s4 = [];
  28086. if (peg$c42.test(input.charAt(peg$currPos))) {
  28087. s5 = input.charAt(peg$currPos);
  28088. peg$currPos++;
  28089. } else {
  28090. s5 = peg$FAILED;
  28091. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28092. }
  28093. if (s5 !== peg$FAILED) {
  28094. while (s5 !== peg$FAILED) {
  28095. s4.push(s5);
  28096. if (peg$c42.test(input.charAt(peg$currPos))) {
  28097. s5 = input.charAt(peg$currPos);
  28098. peg$currPos++;
  28099. } else {
  28100. s5 = peg$FAILED;
  28101. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28102. }
  28103. }
  28104. } else {
  28105. s4 = peg$FAILED;
  28106. }
  28107. if (s4 !== peg$FAILED) {
  28108. s3 = [s3, s4];
  28109. s2 = s3;
  28110. } else {
  28111. peg$currPos = s2;
  28112. s2 = peg$FAILED;
  28113. }
  28114. } else {
  28115. peg$currPos = s2;
  28116. s2 = peg$FAILED;
  28117. }
  28118. if (s2 !== peg$FAILED) {
  28119. s1 = input.substring(s1, peg$currPos);
  28120. } else {
  28121. s1 = s2;
  28122. }
  28123. if (s1 !== peg$FAILED) {
  28124. peg$savedPos = s0;
  28125. s1 = peg$c45(s1);
  28126. }
  28127. s0 = s1;
  28128. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28129. return s0;
  28130. }
  28131. function peg$parseliteralArray() {
  28132. var s0, s1, s2, s3, s4;
  28133. var key = peg$currPos * 66 + 20,
  28134. cached = peg$resultsCache[key];
  28135. if (cached) {
  28136. peg$currPos = cached.nextPos;
  28137. return cached.result;
  28138. }
  28139. s0 = peg$currPos;
  28140. if (input.substr(peg$currPos, 2) === peg$c46) {
  28141. s1 = peg$c46;
  28142. peg$currPos += 2;
  28143. } else {
  28144. s1 = peg$FAILED;
  28145. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  28146. }
  28147. if (s1 !== peg$FAILED) {
  28148. s2 = peg$parsewsLiteralArrayContents();
  28149. if (s2 !== peg$FAILED) {
  28150. s3 = peg$parsews();
  28151. if (s3 !== peg$FAILED) {
  28152. if (input.charCodeAt(peg$currPos) === 41) {
  28153. s4 = peg$c48;
  28154. peg$currPos++;
  28155. } else {
  28156. s4 = peg$FAILED;
  28157. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28158. }
  28159. if (s4 !== peg$FAILED) {
  28160. peg$savedPos = s0;
  28161. s1 = peg$c50(s2);
  28162. s0 = s1;
  28163. } else {
  28164. peg$currPos = s0;
  28165. s0 = peg$FAILED;
  28166. }
  28167. } else {
  28168. peg$currPos = s0;
  28169. s0 = peg$FAILED;
  28170. }
  28171. } else {
  28172. peg$currPos = s0;
  28173. s0 = peg$FAILED;
  28174. }
  28175. } else {
  28176. peg$currPos = s0;
  28177. s0 = peg$FAILED;
  28178. }
  28179. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28180. return s0;
  28181. }
  28182. function peg$parsebareLiteralArray() {
  28183. var s0, s1, s2, s3, s4;
  28184. var key = peg$currPos * 66 + 21,
  28185. cached = peg$resultsCache[key];
  28186. if (cached) {
  28187. peg$currPos = cached.nextPos;
  28188. return cached.result;
  28189. }
  28190. s0 = peg$currPos;
  28191. if (input.charCodeAt(peg$currPos) === 40) {
  28192. s1 = peg$c51;
  28193. peg$currPos++;
  28194. } else {
  28195. s1 = peg$FAILED;
  28196. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  28197. }
  28198. if (s1 !== peg$FAILED) {
  28199. s2 = peg$parsewsLiteralArrayContents();
  28200. if (s2 !== peg$FAILED) {
  28201. s3 = peg$parsews();
  28202. if (s3 !== peg$FAILED) {
  28203. if (input.charCodeAt(peg$currPos) === 41) {
  28204. s4 = peg$c48;
  28205. peg$currPos++;
  28206. } else {
  28207. s4 = peg$FAILED;
  28208. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28209. }
  28210. if (s4 !== peg$FAILED) {
  28211. peg$savedPos = s0;
  28212. s1 = peg$c50(s2);
  28213. s0 = s1;
  28214. } else {
  28215. peg$currPos = s0;
  28216. s0 = peg$FAILED;
  28217. }
  28218. } else {
  28219. peg$currPos = s0;
  28220. s0 = peg$FAILED;
  28221. }
  28222. } else {
  28223. peg$currPos = s0;
  28224. s0 = peg$FAILED;
  28225. }
  28226. } else {
  28227. peg$currPos = s0;
  28228. s0 = peg$FAILED;
  28229. }
  28230. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28231. return s0;
  28232. }
  28233. function peg$parseliteralArrayElement() {
  28234. var s0;
  28235. var key = peg$currPos * 66 + 22,
  28236. cached = peg$resultsCache[key];
  28237. if (cached) {
  28238. peg$currPos = cached.nextPos;
  28239. return cached.result;
  28240. }
  28241. s0 = peg$parseparseTimeLiteral();
  28242. if (s0 === peg$FAILED) {
  28243. s0 = peg$parsebareLiteralArray();
  28244. if (s0 === peg$FAILED) {
  28245. s0 = peg$parsebareSymbol();
  28246. }
  28247. }
  28248. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28249. return s0;
  28250. }
  28251. function peg$parsewsLiteralArrayContents() {
  28252. var s0, s1, s2, s3, s4;
  28253. var key = peg$currPos * 66 + 23,
  28254. cached = peg$resultsCache[key];
  28255. if (cached) {
  28256. peg$currPos = cached.nextPos;
  28257. return cached.result;
  28258. }
  28259. s0 = peg$currPos;
  28260. s1 = [];
  28261. s2 = peg$currPos;
  28262. s3 = peg$parsews();
  28263. if (s3 !== peg$FAILED) {
  28264. s4 = peg$parseliteralArrayElement();
  28265. if (s4 !== peg$FAILED) {
  28266. peg$savedPos = s2;
  28267. s3 = peg$c53(s4);
  28268. s2 = s3;
  28269. } else {
  28270. peg$currPos = s2;
  28271. s2 = peg$FAILED;
  28272. }
  28273. } else {
  28274. peg$currPos = s2;
  28275. s2 = peg$FAILED;
  28276. }
  28277. while (s2 !== peg$FAILED) {
  28278. s1.push(s2);
  28279. s2 = peg$currPos;
  28280. s3 = peg$parsews();
  28281. if (s3 !== peg$FAILED) {
  28282. s4 = peg$parseliteralArrayElement();
  28283. if (s4 !== peg$FAILED) {
  28284. peg$savedPos = s2;
  28285. s3 = peg$c53(s4);
  28286. s2 = s3;
  28287. } else {
  28288. peg$currPos = s2;
  28289. s2 = peg$FAILED;
  28290. }
  28291. } else {
  28292. peg$currPos = s2;
  28293. s2 = peg$FAILED;
  28294. }
  28295. }
  28296. if (s1 !== peg$FAILED) {
  28297. peg$savedPos = s0;
  28298. s1 = peg$c54(s1);
  28299. }
  28300. s0 = s1;
  28301. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28302. return s0;
  28303. }
  28304. function peg$parsedynamicArray() {
  28305. var s0, s1, s2, s3, s4;
  28306. var key = peg$currPos * 66 + 24,
  28307. cached = peg$resultsCache[key];
  28308. if (cached) {
  28309. peg$currPos = cached.nextPos;
  28310. return cached.result;
  28311. }
  28312. s0 = peg$currPos;
  28313. if (input.charCodeAt(peg$currPos) === 123) {
  28314. s1 = peg$c55;
  28315. peg$currPos++;
  28316. } else {
  28317. s1 = peg$FAILED;
  28318. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  28319. }
  28320. if (s1 !== peg$FAILED) {
  28321. s2 = peg$parsewsExpressions();
  28322. if (s2 === peg$FAILED) {
  28323. s2 = null;
  28324. }
  28325. if (s2 !== peg$FAILED) {
  28326. s3 = peg$parsemaybeDotsWs();
  28327. if (s3 !== peg$FAILED) {
  28328. if (input.charCodeAt(peg$currPos) === 125) {
  28329. s4 = peg$c57;
  28330. peg$currPos++;
  28331. } else {
  28332. s4 = peg$FAILED;
  28333. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28334. }
  28335. if (s4 !== peg$FAILED) {
  28336. peg$savedPos = s0;
  28337. s1 = peg$c59(s2);
  28338. s0 = s1;
  28339. } else {
  28340. peg$currPos = s0;
  28341. s0 = peg$FAILED;
  28342. }
  28343. } else {
  28344. peg$currPos = s0;
  28345. s0 = peg$FAILED;
  28346. }
  28347. } else {
  28348. peg$currPos = s0;
  28349. s0 = peg$FAILED;
  28350. }
  28351. } else {
  28352. peg$currPos = s0;
  28353. s0 = peg$FAILED;
  28354. }
  28355. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28356. return s0;
  28357. }
  28358. function peg$parsedynamicDictionary() {
  28359. var s0, s1, s2, s3, s4;
  28360. var key = peg$currPos * 66 + 25,
  28361. cached = peg$resultsCache[key];
  28362. if (cached) {
  28363. peg$currPos = cached.nextPos;
  28364. return cached.result;
  28365. }
  28366. s0 = peg$currPos;
  28367. if (input.substr(peg$currPos, 2) === peg$c60) {
  28368. s1 = peg$c60;
  28369. peg$currPos += 2;
  28370. } else {
  28371. s1 = peg$FAILED;
  28372. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  28373. }
  28374. if (s1 !== peg$FAILED) {
  28375. s2 = peg$parsewsAssociations();
  28376. if (s2 === peg$FAILED) {
  28377. s2 = null;
  28378. }
  28379. if (s2 !== peg$FAILED) {
  28380. s3 = peg$parsemaybeDotsWs();
  28381. if (s3 !== peg$FAILED) {
  28382. if (input.charCodeAt(peg$currPos) === 125) {
  28383. s4 = peg$c57;
  28384. peg$currPos++;
  28385. } else {
  28386. s4 = peg$FAILED;
  28387. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28388. }
  28389. if (s4 !== peg$FAILED) {
  28390. peg$savedPos = s0;
  28391. s1 = peg$c62(s2);
  28392. s0 = s1;
  28393. } else {
  28394. peg$currPos = s0;
  28395. s0 = peg$FAILED;
  28396. }
  28397. } else {
  28398. peg$currPos = s0;
  28399. s0 = peg$FAILED;
  28400. }
  28401. } else {
  28402. peg$currPos = s0;
  28403. s0 = peg$FAILED;
  28404. }
  28405. } else {
  28406. peg$currPos = s0;
  28407. s0 = peg$FAILED;
  28408. }
  28409. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28410. return s0;
  28411. }
  28412. function peg$parsepseudoVariable() {
  28413. var s0, s1, s2;
  28414. var key = peg$currPos * 66 + 26,
  28415. cached = peg$resultsCache[key];
  28416. if (cached) {
  28417. peg$currPos = cached.nextPos;
  28418. return cached.result;
  28419. }
  28420. s0 = peg$currPos;
  28421. s1 = peg$currPos;
  28422. if (input.substr(peg$currPos, 4) === peg$c63) {
  28423. s2 = peg$c63;
  28424. peg$currPos += 4;
  28425. } else {
  28426. s2 = peg$FAILED;
  28427. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  28428. }
  28429. if (s2 !== peg$FAILED) {
  28430. peg$savedPos = s1;
  28431. s2 = peg$c65();
  28432. }
  28433. s1 = s2;
  28434. if (s1 === peg$FAILED) {
  28435. s1 = peg$currPos;
  28436. if (input.substr(peg$currPos, 5) === peg$c66) {
  28437. s2 = peg$c66;
  28438. peg$currPos += 5;
  28439. } else {
  28440. s2 = peg$FAILED;
  28441. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  28442. }
  28443. if (s2 !== peg$FAILED) {
  28444. peg$savedPos = s1;
  28445. s2 = peg$c68();
  28446. }
  28447. s1 = s2;
  28448. if (s1 === peg$FAILED) {
  28449. s1 = peg$currPos;
  28450. if (input.substr(peg$currPos, 3) === peg$c69) {
  28451. s2 = peg$c69;
  28452. peg$currPos += 3;
  28453. } else {
  28454. s2 = peg$FAILED;
  28455. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  28456. }
  28457. if (s2 !== peg$FAILED) {
  28458. peg$savedPos = s1;
  28459. s2 = peg$c71();
  28460. }
  28461. s1 = s2;
  28462. }
  28463. }
  28464. if (s1 !== peg$FAILED) {
  28465. peg$savedPos = s0;
  28466. s1 = peg$c16(s1);
  28467. }
  28468. s0 = s1;
  28469. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28470. return s0;
  28471. }
  28472. function peg$parseparseTimeLiteral() {
  28473. var s0;
  28474. var key = peg$currPos * 66 + 27,
  28475. cached = peg$resultsCache[key];
  28476. if (cached) {
  28477. peg$currPos = cached.nextPos;
  28478. return cached.result;
  28479. }
  28480. s0 = peg$parsepseudoVariable();
  28481. if (s0 === peg$FAILED) {
  28482. s0 = peg$parsenumber();
  28483. if (s0 === peg$FAILED) {
  28484. s0 = peg$parseliteralArray();
  28485. if (s0 === peg$FAILED) {
  28486. s0 = peg$parsestring();
  28487. if (s0 === peg$FAILED) {
  28488. s0 = peg$parsesymbol();
  28489. if (s0 === peg$FAILED) {
  28490. s0 = peg$parsecharacter();
  28491. }
  28492. }
  28493. }
  28494. }
  28495. }
  28496. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28497. return s0;
  28498. }
  28499. function peg$parseruntimeLiteral() {
  28500. var s0;
  28501. var key = peg$currPos * 66 + 28,
  28502. cached = peg$resultsCache[key];
  28503. if (cached) {
  28504. peg$currPos = cached.nextPos;
  28505. return cached.result;
  28506. }
  28507. s0 = peg$parsedynamicDictionary();
  28508. if (s0 === peg$FAILED) {
  28509. s0 = peg$parsedynamicArray();
  28510. if (s0 === peg$FAILED) {
  28511. s0 = peg$parseblock();
  28512. }
  28513. }
  28514. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28515. return s0;
  28516. }
  28517. function peg$parseliteral() {
  28518. var s0;
  28519. var key = peg$currPos * 66 + 29,
  28520. cached = peg$resultsCache[key];
  28521. if (cached) {
  28522. peg$currPos = cached.nextPos;
  28523. return cached.result;
  28524. }
  28525. s0 = peg$parseruntimeLiteral();
  28526. if (s0 === peg$FAILED) {
  28527. s0 = peg$parseparseTimeLiteral();
  28528. }
  28529. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28530. return s0;
  28531. }
  28532. function peg$parsevariable() {
  28533. var s0, s1;
  28534. var key = peg$currPos * 66 + 30,
  28535. cached = peg$resultsCache[key];
  28536. if (cached) {
  28537. peg$currPos = cached.nextPos;
  28538. return cached.result;
  28539. }
  28540. s0 = peg$currPos;
  28541. s1 = peg$parseidentifier();
  28542. if (s1 !== peg$FAILED) {
  28543. peg$savedPos = s0;
  28544. s1 = peg$c72(s1);
  28545. }
  28546. s0 = s1;
  28547. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28548. return s0;
  28549. }
  28550. function peg$parsebinarySelector() {
  28551. var s0, s1, s2;
  28552. var key = peg$currPos * 66 + 31,
  28553. cached = peg$resultsCache[key];
  28554. if (cached) {
  28555. peg$currPos = cached.nextPos;
  28556. return cached.result;
  28557. }
  28558. s0 = peg$currPos;
  28559. s1 = [];
  28560. if (peg$c73.test(input.charAt(peg$currPos))) {
  28561. s2 = input.charAt(peg$currPos);
  28562. peg$currPos++;
  28563. } else {
  28564. s2 = peg$FAILED;
  28565. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28566. }
  28567. if (s2 !== peg$FAILED) {
  28568. while (s2 !== peg$FAILED) {
  28569. s1.push(s2);
  28570. if (peg$c73.test(input.charAt(peg$currPos))) {
  28571. s2 = input.charAt(peg$currPos);
  28572. peg$currPos++;
  28573. } else {
  28574. s2 = peg$FAILED;
  28575. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28576. }
  28577. }
  28578. } else {
  28579. s1 = peg$FAILED;
  28580. }
  28581. if (s1 !== peg$FAILED) {
  28582. s0 = input.substring(s0, peg$currPos);
  28583. } else {
  28584. s0 = s1;
  28585. }
  28586. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28587. return s0;
  28588. }
  28589. function peg$parsewsKeywordPattern() {
  28590. var s0, s1, s2, s3, s4, s5, s6;
  28591. var key = peg$currPos * 66 + 32,
  28592. cached = peg$resultsCache[key];
  28593. if (cached) {
  28594. peg$currPos = cached.nextPos;
  28595. return cached.result;
  28596. }
  28597. s0 = peg$currPos;
  28598. s1 = [];
  28599. s2 = peg$currPos;
  28600. s3 = peg$parsews();
  28601. if (s3 !== peg$FAILED) {
  28602. s4 = peg$parsekeyword();
  28603. if (s4 !== peg$FAILED) {
  28604. s5 = peg$parsews();
  28605. if (s5 !== peg$FAILED) {
  28606. s6 = peg$parseidentifier();
  28607. if (s6 !== peg$FAILED) {
  28608. peg$savedPos = s2;
  28609. s3 = peg$c75(s4, s6);
  28610. s2 = s3;
  28611. } else {
  28612. peg$currPos = s2;
  28613. s2 = peg$FAILED;
  28614. }
  28615. } else {
  28616. peg$currPos = s2;
  28617. s2 = peg$FAILED;
  28618. }
  28619. } else {
  28620. peg$currPos = s2;
  28621. s2 = peg$FAILED;
  28622. }
  28623. } else {
  28624. peg$currPos = s2;
  28625. s2 = peg$FAILED;
  28626. }
  28627. if (s2 !== peg$FAILED) {
  28628. while (s2 !== peg$FAILED) {
  28629. s1.push(s2);
  28630. s2 = peg$currPos;
  28631. s3 = peg$parsews();
  28632. if (s3 !== peg$FAILED) {
  28633. s4 = peg$parsekeyword();
  28634. if (s4 !== peg$FAILED) {
  28635. s5 = peg$parsews();
  28636. if (s5 !== peg$FAILED) {
  28637. s6 = peg$parseidentifier();
  28638. if (s6 !== peg$FAILED) {
  28639. peg$savedPos = s2;
  28640. s3 = peg$c75(s4, s6);
  28641. s2 = s3;
  28642. } else {
  28643. peg$currPos = s2;
  28644. s2 = peg$FAILED;
  28645. }
  28646. } else {
  28647. peg$currPos = s2;
  28648. s2 = peg$FAILED;
  28649. }
  28650. } else {
  28651. peg$currPos = s2;
  28652. s2 = peg$FAILED;
  28653. }
  28654. } else {
  28655. peg$currPos = s2;
  28656. s2 = peg$FAILED;
  28657. }
  28658. }
  28659. } else {
  28660. s1 = peg$FAILED;
  28661. }
  28662. if (s1 !== peg$FAILED) {
  28663. peg$savedPos = s0;
  28664. s1 = peg$c76(s1);
  28665. }
  28666. s0 = s1;
  28667. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28668. return s0;
  28669. }
  28670. function peg$parsewsBinaryPattern() {
  28671. var s0, s1, s2, s3, s4;
  28672. var key = peg$currPos * 66 + 33,
  28673. cached = peg$resultsCache[key];
  28674. if (cached) {
  28675. peg$currPos = cached.nextPos;
  28676. return cached.result;
  28677. }
  28678. s0 = peg$currPos;
  28679. s1 = peg$parsews();
  28680. if (s1 !== peg$FAILED) {
  28681. s2 = peg$parsebinarySelector();
  28682. if (s2 !== peg$FAILED) {
  28683. s3 = peg$parsews();
  28684. if (s3 !== peg$FAILED) {
  28685. s4 = peg$parseidentifier();
  28686. if (s4 !== peg$FAILED) {
  28687. peg$savedPos = s0;
  28688. s1 = peg$c77(s2, s4);
  28689. s0 = s1;
  28690. } else {
  28691. peg$currPos = s0;
  28692. s0 = peg$FAILED;
  28693. }
  28694. } else {
  28695. peg$currPos = s0;
  28696. s0 = peg$FAILED;
  28697. }
  28698. } else {
  28699. peg$currPos = s0;
  28700. s0 = peg$FAILED;
  28701. }
  28702. } else {
  28703. peg$currPos = s0;
  28704. s0 = peg$FAILED;
  28705. }
  28706. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28707. return s0;
  28708. }
  28709. function peg$parsewsUnaryPattern() {
  28710. var s0, s1, s2;
  28711. var key = peg$currPos * 66 + 34,
  28712. cached = peg$resultsCache[key];
  28713. if (cached) {
  28714. peg$currPos = cached.nextPos;
  28715. return cached.result;
  28716. }
  28717. s0 = peg$currPos;
  28718. s1 = peg$parsews();
  28719. if (s1 !== peg$FAILED) {
  28720. s2 = peg$parseidentifier();
  28721. if (s2 !== peg$FAILED) {
  28722. peg$savedPos = s0;
  28723. s1 = peg$c78(s2);
  28724. s0 = s1;
  28725. } else {
  28726. peg$currPos = s0;
  28727. s0 = peg$FAILED;
  28728. }
  28729. } else {
  28730. peg$currPos = s0;
  28731. s0 = peg$FAILED;
  28732. }
  28733. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28734. return s0;
  28735. }
  28736. function peg$parseexpression() {
  28737. var s0;
  28738. var key = peg$currPos * 66 + 35,
  28739. cached = peg$resultsCache[key];
  28740. if (cached) {
  28741. peg$currPos = cached.nextPos;
  28742. return cached.result;
  28743. }
  28744. s0 = peg$parseassignment();
  28745. if (s0 === peg$FAILED) {
  28746. s0 = peg$parsecascade();
  28747. if (s0 === peg$FAILED) {
  28748. s0 = peg$parsekeywordSend();
  28749. }
  28750. }
  28751. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28752. return s0;
  28753. }
  28754. function peg$parsewsExpressionsRest() {
  28755. var s0, s1, s2;
  28756. var key = peg$currPos * 66 + 36,
  28757. cached = peg$resultsCache[key];
  28758. if (cached) {
  28759. peg$currPos = cached.nextPos;
  28760. return cached.result;
  28761. }
  28762. s0 = peg$currPos;
  28763. s1 = peg$parsesomeDotsWs();
  28764. if (s1 !== peg$FAILED) {
  28765. s2 = peg$parseexpression();
  28766. if (s2 !== peg$FAILED) {
  28767. peg$savedPos = s0;
  28768. s1 = peg$c79(s2);
  28769. s0 = s1;
  28770. } else {
  28771. peg$currPos = s0;
  28772. s0 = peg$FAILED;
  28773. }
  28774. } else {
  28775. peg$currPos = s0;
  28776. s0 = peg$FAILED;
  28777. }
  28778. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28779. return s0;
  28780. }
  28781. function peg$parsewsExpressions() {
  28782. var s0, s1, s2, s3, s4;
  28783. var key = peg$currPos * 66 + 37,
  28784. cached = peg$resultsCache[key];
  28785. if (cached) {
  28786. peg$currPos = cached.nextPos;
  28787. return cached.result;
  28788. }
  28789. s0 = peg$currPos;
  28790. s1 = peg$parsemaybeDotsWs();
  28791. if (s1 !== peg$FAILED) {
  28792. s2 = peg$parseexpression();
  28793. if (s2 !== peg$FAILED) {
  28794. s3 = [];
  28795. s4 = peg$parsewsExpressionsRest();
  28796. while (s4 !== peg$FAILED) {
  28797. s3.push(s4);
  28798. s4 = peg$parsewsExpressionsRest();
  28799. }
  28800. if (s3 !== peg$FAILED) {
  28801. peg$savedPos = s0;
  28802. s1 = peg$c80(s2, s3);
  28803. s0 = s1;
  28804. } else {
  28805. peg$currPos = s0;
  28806. s0 = peg$FAILED;
  28807. }
  28808. } else {
  28809. peg$currPos = s0;
  28810. s0 = peg$FAILED;
  28811. }
  28812. } else {
  28813. peg$currPos = s0;
  28814. s0 = peg$FAILED;
  28815. }
  28816. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28817. return s0;
  28818. }
  28819. function peg$parsewsUnaryPragmaMessage() {
  28820. var s0, s1, s2, s3, s4;
  28821. var key = peg$currPos * 66 + 38,
  28822. cached = peg$resultsCache[key];
  28823. if (cached) {
  28824. peg$currPos = cached.nextPos;
  28825. return cached.result;
  28826. }
  28827. s0 = peg$currPos;
  28828. s1 = peg$parsews();
  28829. if (s1 !== peg$FAILED) {
  28830. s2 = peg$parseidentifier();
  28831. if (s2 !== peg$FAILED) {
  28832. s3 = peg$currPos;
  28833. peg$silentFails++;
  28834. if (input.charCodeAt(peg$currPos) === 58) {
  28835. s4 = peg$c12;
  28836. peg$currPos++;
  28837. } else {
  28838. s4 = peg$FAILED;
  28839. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  28840. }
  28841. peg$silentFails--;
  28842. if (s4 === peg$FAILED) {
  28843. s3 = void 0;
  28844. } else {
  28845. peg$currPos = s3;
  28846. s3 = peg$FAILED;
  28847. }
  28848. if (s3 !== peg$FAILED) {
  28849. peg$savedPos = s0;
  28850. s1 = peg$c81(s2);
  28851. s0 = s1;
  28852. } else {
  28853. peg$currPos = s0;
  28854. s0 = peg$FAILED;
  28855. }
  28856. } else {
  28857. peg$currPos = s0;
  28858. s0 = peg$FAILED;
  28859. }
  28860. } else {
  28861. peg$currPos = s0;
  28862. s0 = peg$FAILED;
  28863. }
  28864. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28865. return s0;
  28866. }
  28867. function peg$parsewsKeywordPragmaMessage() {
  28868. var s0, s1, s2, s3, s4, s5, s6;
  28869. var key = peg$currPos * 66 + 39,
  28870. cached = peg$resultsCache[key];
  28871. if (cached) {
  28872. peg$currPos = cached.nextPos;
  28873. return cached.result;
  28874. }
  28875. s0 = peg$currPos;
  28876. s1 = [];
  28877. s2 = peg$currPos;
  28878. s3 = peg$parsews();
  28879. if (s3 !== peg$FAILED) {
  28880. s4 = peg$parsekeyword();
  28881. if (s4 !== peg$FAILED) {
  28882. s5 = peg$parsews();
  28883. if (s5 !== peg$FAILED) {
  28884. s6 = peg$parseparseTimeLiteral();
  28885. if (s6 !== peg$FAILED) {
  28886. peg$savedPos = s2;
  28887. s3 = peg$c75(s4, s6);
  28888. s2 = s3;
  28889. } else {
  28890. peg$currPos = s2;
  28891. s2 = peg$FAILED;
  28892. }
  28893. } else {
  28894. peg$currPos = s2;
  28895. s2 = peg$FAILED;
  28896. }
  28897. } else {
  28898. peg$currPos = s2;
  28899. s2 = peg$FAILED;
  28900. }
  28901. } else {
  28902. peg$currPos = s2;
  28903. s2 = peg$FAILED;
  28904. }
  28905. if (s2 !== peg$FAILED) {
  28906. while (s2 !== peg$FAILED) {
  28907. s1.push(s2);
  28908. s2 = peg$currPos;
  28909. s3 = peg$parsews();
  28910. if (s3 !== peg$FAILED) {
  28911. s4 = peg$parsekeyword();
  28912. if (s4 !== peg$FAILED) {
  28913. s5 = peg$parsews();
  28914. if (s5 !== peg$FAILED) {
  28915. s6 = peg$parseparseTimeLiteral();
  28916. if (s6 !== peg$FAILED) {
  28917. peg$savedPos = s2;
  28918. s3 = peg$c75(s4, s6);
  28919. s2 = s3;
  28920. } else {
  28921. peg$currPos = s2;
  28922. s2 = peg$FAILED;
  28923. }
  28924. } else {
  28925. peg$currPos = s2;
  28926. s2 = peg$FAILED;
  28927. }
  28928. } else {
  28929. peg$currPos = s2;
  28930. s2 = peg$FAILED;
  28931. }
  28932. } else {
  28933. peg$currPos = s2;
  28934. s2 = peg$FAILED;
  28935. }
  28936. }
  28937. } else {
  28938. s1 = peg$FAILED;
  28939. }
  28940. if (s1 !== peg$FAILED) {
  28941. peg$savedPos = s0;
  28942. s1 = peg$c82(s1);
  28943. }
  28944. s0 = s1;
  28945. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28946. return s0;
  28947. }
  28948. function peg$parsewsPragmaMessage() {
  28949. var s0;
  28950. var key = peg$currPos * 66 + 40,
  28951. cached = peg$resultsCache[key];
  28952. if (cached) {
  28953. peg$currPos = cached.nextPos;
  28954. return cached.result;
  28955. }
  28956. s0 = peg$parsewsUnaryPragmaMessage();
  28957. if (s0 === peg$FAILED) {
  28958. s0 = peg$parsewsKeywordPragmaMessage();
  28959. }
  28960. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28961. return s0;
  28962. }
  28963. function peg$parsewsPragmas() {
  28964. var s0, s1, s2, s3, s4, s5, s6;
  28965. var key = peg$currPos * 66 + 41,
  28966. cached = peg$resultsCache[key];
  28967. if (cached) {
  28968. peg$currPos = cached.nextPos;
  28969. return cached.result;
  28970. }
  28971. s0 = [];
  28972. s1 = peg$currPos;
  28973. s2 = peg$parsews();
  28974. if (s2 !== peg$FAILED) {
  28975. if (input.charCodeAt(peg$currPos) === 60) {
  28976. s3 = peg$c83;
  28977. peg$currPos++;
  28978. } else {
  28979. s3 = peg$FAILED;
  28980. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  28981. }
  28982. if (s3 !== peg$FAILED) {
  28983. s4 = peg$parsewsPragmaMessage();
  28984. if (s4 !== peg$FAILED) {
  28985. s5 = peg$parsews();
  28986. if (s5 !== peg$FAILED) {
  28987. if (input.charCodeAt(peg$currPos) === 62) {
  28988. s6 = peg$c85;
  28989. peg$currPos++;
  28990. } else {
  28991. s6 = peg$FAILED;
  28992. if (peg$silentFails === 0) { peg$fail(peg$c86); }
  28993. }
  28994. if (s6 !== peg$FAILED) {
  28995. peg$savedPos = s1;
  28996. s2 = peg$c87(s4);
  28997. s1 = s2;
  28998. } else {
  28999. peg$currPos = s1;
  29000. s1 = peg$FAILED;
  29001. }
  29002. } else {
  29003. peg$currPos = s1;
  29004. s1 = peg$FAILED;
  29005. }
  29006. } else {
  29007. peg$currPos = s1;
  29008. s1 = peg$FAILED;
  29009. }
  29010. } else {
  29011. peg$currPos = s1;
  29012. s1 = peg$FAILED;
  29013. }
  29014. } else {
  29015. peg$currPos = s1;
  29016. s1 = peg$FAILED;
  29017. }
  29018. while (s1 !== peg$FAILED) {
  29019. s0.push(s1);
  29020. s1 = peg$currPos;
  29021. s2 = peg$parsews();
  29022. if (s2 !== peg$FAILED) {
  29023. if (input.charCodeAt(peg$currPos) === 60) {
  29024. s3 = peg$c83;
  29025. peg$currPos++;
  29026. } else {
  29027. s3 = peg$FAILED;
  29028. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  29029. }
  29030. if (s3 !== peg$FAILED) {
  29031. s4 = peg$parsewsPragmaMessage();
  29032. if (s4 !== peg$FAILED) {
  29033. s5 = peg$parsews();
  29034. if (s5 !== peg$FAILED) {
  29035. if (input.charCodeAt(peg$currPos) === 62) {
  29036. s6 = peg$c85;
  29037. peg$currPos++;
  29038. } else {
  29039. s6 = peg$FAILED;
  29040. if (peg$silentFails === 0) { peg$fail(peg$c86); }
  29041. }
  29042. if (s6 !== peg$FAILED) {
  29043. peg$savedPos = s1;
  29044. s2 = peg$c87(s4);
  29045. s1 = s2;
  29046. } else {
  29047. peg$currPos = s1;
  29048. s1 = peg$FAILED;
  29049. }
  29050. } else {
  29051. peg$currPos = s1;
  29052. s1 = peg$FAILED;
  29053. }
  29054. } else {
  29055. peg$currPos = s1;
  29056. s1 = peg$FAILED;
  29057. }
  29058. } else {
  29059. peg$currPos = s1;
  29060. s1 = peg$FAILED;
  29061. }
  29062. } else {
  29063. peg$currPos = s1;
  29064. s1 = peg$FAILED;
  29065. }
  29066. }
  29067. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29068. return s0;
  29069. }
  29070. function peg$parseassignment() {
  29071. var s0, s1, s2, s3, s4, s5;
  29072. var key = peg$currPos * 66 + 42,
  29073. cached = peg$resultsCache[key];
  29074. if (cached) {
  29075. peg$currPos = cached.nextPos;
  29076. return cached.result;
  29077. }
  29078. s0 = peg$currPos;
  29079. s1 = peg$parsevariable();
  29080. if (s1 !== peg$FAILED) {
  29081. s2 = peg$parsews();
  29082. if (s2 !== peg$FAILED) {
  29083. if (input.substr(peg$currPos, 2) === peg$c88) {
  29084. s3 = peg$c88;
  29085. peg$currPos += 2;
  29086. } else {
  29087. s3 = peg$FAILED;
  29088. if (peg$silentFails === 0) { peg$fail(peg$c89); }
  29089. }
  29090. if (s3 !== peg$FAILED) {
  29091. s4 = peg$parsews();
  29092. if (s4 !== peg$FAILED) {
  29093. s5 = peg$parseexpression();
  29094. if (s5 !== peg$FAILED) {
  29095. peg$savedPos = s0;
  29096. s1 = peg$c90(s1, s5);
  29097. s0 = s1;
  29098. } else {
  29099. peg$currPos = s0;
  29100. s0 = peg$FAILED;
  29101. }
  29102. } else {
  29103. peg$currPos = s0;
  29104. s0 = peg$FAILED;
  29105. }
  29106. } else {
  29107. peg$currPos = s0;
  29108. s0 = peg$FAILED;
  29109. }
  29110. } else {
  29111. peg$currPos = s0;
  29112. s0 = peg$FAILED;
  29113. }
  29114. } else {
  29115. peg$currPos = s0;
  29116. s0 = peg$FAILED;
  29117. }
  29118. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29119. return s0;
  29120. }
  29121. function peg$parseret() {
  29122. var s0, s1, s2, s3;
  29123. var key = peg$currPos * 66 + 43,
  29124. cached = peg$resultsCache[key];
  29125. if (cached) {
  29126. peg$currPos = cached.nextPos;
  29127. return cached.result;
  29128. }
  29129. s0 = peg$currPos;
  29130. if (input.charCodeAt(peg$currPos) === 94) {
  29131. s1 = peg$c91;
  29132. peg$currPos++;
  29133. } else {
  29134. s1 = peg$FAILED;
  29135. if (peg$silentFails === 0) { peg$fail(peg$c92); }
  29136. }
  29137. if (s1 !== peg$FAILED) {
  29138. s2 = peg$parsews();
  29139. if (s2 !== peg$FAILED) {
  29140. s3 = peg$parseexpression();
  29141. if (s3 !== peg$FAILED) {
  29142. peg$savedPos = s0;
  29143. s1 = peg$c93(s3);
  29144. s0 = s1;
  29145. } else {
  29146. peg$currPos = s0;
  29147. s0 = peg$FAILED;
  29148. }
  29149. } else {
  29150. peg$currPos = s0;
  29151. s0 = peg$FAILED;
  29152. }
  29153. } else {
  29154. peg$currPos = s0;
  29155. s0 = peg$FAILED;
  29156. }
  29157. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29158. return s0;
  29159. }
  29160. function peg$parsetemps() {
  29161. var s0, s1, s2, s3, s4, s5;
  29162. var key = peg$currPos * 66 + 44,
  29163. cached = peg$resultsCache[key];
  29164. if (cached) {
  29165. peg$currPos = cached.nextPos;
  29166. return cached.result;
  29167. }
  29168. s0 = peg$currPos;
  29169. if (input.charCodeAt(peg$currPos) === 124) {
  29170. s1 = peg$c94;
  29171. peg$currPos++;
  29172. } else {
  29173. s1 = peg$FAILED;
  29174. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29175. }
  29176. if (s1 !== peg$FAILED) {
  29177. s2 = [];
  29178. s3 = peg$currPos;
  29179. s4 = peg$parsews();
  29180. if (s4 !== peg$FAILED) {
  29181. s5 = peg$parseidentifier();
  29182. if (s5 !== peg$FAILED) {
  29183. peg$savedPos = s3;
  29184. s4 = peg$c96(s5);
  29185. s3 = s4;
  29186. } else {
  29187. peg$currPos = s3;
  29188. s3 = peg$FAILED;
  29189. }
  29190. } else {
  29191. peg$currPos = s3;
  29192. s3 = peg$FAILED;
  29193. }
  29194. while (s3 !== peg$FAILED) {
  29195. s2.push(s3);
  29196. s3 = peg$currPos;
  29197. s4 = peg$parsews();
  29198. if (s4 !== peg$FAILED) {
  29199. s5 = peg$parseidentifier();
  29200. if (s5 !== peg$FAILED) {
  29201. peg$savedPos = s3;
  29202. s4 = peg$c96(s5);
  29203. s3 = s4;
  29204. } else {
  29205. peg$currPos = s3;
  29206. s3 = peg$FAILED;
  29207. }
  29208. } else {
  29209. peg$currPos = s3;
  29210. s3 = peg$FAILED;
  29211. }
  29212. }
  29213. if (s2 !== peg$FAILED) {
  29214. s3 = peg$parsews();
  29215. if (s3 !== peg$FAILED) {
  29216. if (input.charCodeAt(peg$currPos) === 124) {
  29217. s4 = peg$c94;
  29218. peg$currPos++;
  29219. } else {
  29220. s4 = peg$FAILED;
  29221. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29222. }
  29223. if (s4 !== peg$FAILED) {
  29224. peg$savedPos = s0;
  29225. s1 = peg$c97(s2);
  29226. s0 = s1;
  29227. } else {
  29228. peg$currPos = s0;
  29229. s0 = peg$FAILED;
  29230. }
  29231. } else {
  29232. peg$currPos = s0;
  29233. s0 = peg$FAILED;
  29234. }
  29235. } else {
  29236. peg$currPos = s0;
  29237. s0 = peg$FAILED;
  29238. }
  29239. } else {
  29240. peg$currPos = s0;
  29241. s0 = peg$FAILED;
  29242. }
  29243. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29244. return s0;
  29245. }
  29246. function peg$parsewsBlockParamList() {
  29247. var s0, s1, s2, s3, s4, s5, s6;
  29248. var key = peg$currPos * 66 + 45,
  29249. cached = peg$resultsCache[key];
  29250. if (cached) {
  29251. peg$currPos = cached.nextPos;
  29252. return cached.result;
  29253. }
  29254. s0 = peg$currPos;
  29255. s1 = [];
  29256. s2 = peg$currPos;
  29257. s3 = peg$parsews();
  29258. if (s3 !== peg$FAILED) {
  29259. if (input.charCodeAt(peg$currPos) === 58) {
  29260. s4 = peg$c12;
  29261. peg$currPos++;
  29262. } else {
  29263. s4 = peg$FAILED;
  29264. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29265. }
  29266. if (s4 !== peg$FAILED) {
  29267. s5 = peg$parsews();
  29268. if (s5 !== peg$FAILED) {
  29269. s6 = peg$parseidentifier();
  29270. if (s6 !== peg$FAILED) {
  29271. peg$savedPos = s2;
  29272. s3 = peg$c98(s6);
  29273. s2 = s3;
  29274. } else {
  29275. peg$currPos = s2;
  29276. s2 = peg$FAILED;
  29277. }
  29278. } else {
  29279. peg$currPos = s2;
  29280. s2 = peg$FAILED;
  29281. }
  29282. } else {
  29283. peg$currPos = s2;
  29284. s2 = peg$FAILED;
  29285. }
  29286. } else {
  29287. peg$currPos = s2;
  29288. s2 = peg$FAILED;
  29289. }
  29290. if (s2 !== peg$FAILED) {
  29291. while (s2 !== peg$FAILED) {
  29292. s1.push(s2);
  29293. s2 = peg$currPos;
  29294. s3 = peg$parsews();
  29295. if (s3 !== peg$FAILED) {
  29296. if (input.charCodeAt(peg$currPos) === 58) {
  29297. s4 = peg$c12;
  29298. peg$currPos++;
  29299. } else {
  29300. s4 = peg$FAILED;
  29301. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29302. }
  29303. if (s4 !== peg$FAILED) {
  29304. s5 = peg$parsews();
  29305. if (s5 !== peg$FAILED) {
  29306. s6 = peg$parseidentifier();
  29307. if (s6 !== peg$FAILED) {
  29308. peg$savedPos = s2;
  29309. s3 = peg$c98(s6);
  29310. s2 = s3;
  29311. } else {
  29312. peg$currPos = s2;
  29313. s2 = peg$FAILED;
  29314. }
  29315. } else {
  29316. peg$currPos = s2;
  29317. s2 = peg$FAILED;
  29318. }
  29319. } else {
  29320. peg$currPos = s2;
  29321. s2 = peg$FAILED;
  29322. }
  29323. } else {
  29324. peg$currPos = s2;
  29325. s2 = peg$FAILED;
  29326. }
  29327. }
  29328. } else {
  29329. s1 = peg$FAILED;
  29330. }
  29331. if (s1 !== peg$FAILED) {
  29332. s2 = peg$parsews();
  29333. if (s2 !== peg$FAILED) {
  29334. if (input.charCodeAt(peg$currPos) === 124) {
  29335. s3 = peg$c94;
  29336. peg$currPos++;
  29337. } else {
  29338. s3 = peg$FAILED;
  29339. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29340. }
  29341. if (s3 !== peg$FAILED) {
  29342. peg$savedPos = s0;
  29343. s1 = peg$c99(s1);
  29344. s0 = s1;
  29345. } else {
  29346. peg$currPos = s0;
  29347. s0 = peg$FAILED;
  29348. }
  29349. } else {
  29350. peg$currPos = s0;
  29351. s0 = peg$FAILED;
  29352. }
  29353. } else {
  29354. peg$currPos = s0;
  29355. s0 = peg$FAILED;
  29356. }
  29357. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29358. return s0;
  29359. }
  29360. function peg$parsesubexpression() {
  29361. var s0, s1, s2, s3, s4, s5;
  29362. var key = peg$currPos * 66 + 46,
  29363. cached = peg$resultsCache[key];
  29364. if (cached) {
  29365. peg$currPos = cached.nextPos;
  29366. return cached.result;
  29367. }
  29368. s0 = peg$currPos;
  29369. if (input.charCodeAt(peg$currPos) === 40) {
  29370. s1 = peg$c51;
  29371. peg$currPos++;
  29372. } else {
  29373. s1 = peg$FAILED;
  29374. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  29375. }
  29376. if (s1 !== peg$FAILED) {
  29377. s2 = peg$parsews();
  29378. if (s2 !== peg$FAILED) {
  29379. s3 = peg$parseexpression();
  29380. if (s3 !== peg$FAILED) {
  29381. s4 = peg$parsews();
  29382. if (s4 !== peg$FAILED) {
  29383. if (input.charCodeAt(peg$currPos) === 41) {
  29384. s5 = peg$c48;
  29385. peg$currPos++;
  29386. } else {
  29387. s5 = peg$FAILED;
  29388. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  29389. }
  29390. if (s5 !== peg$FAILED) {
  29391. peg$savedPos = s0;
  29392. s1 = peg$c79(s3);
  29393. s0 = s1;
  29394. } else {
  29395. peg$currPos = s0;
  29396. s0 = peg$FAILED;
  29397. }
  29398. } else {
  29399. peg$currPos = s0;
  29400. s0 = peg$FAILED;
  29401. }
  29402. } else {
  29403. peg$currPos = s0;
  29404. s0 = peg$FAILED;
  29405. }
  29406. } else {
  29407. peg$currPos = s0;
  29408. s0 = peg$FAILED;
  29409. }
  29410. } else {
  29411. peg$currPos = s0;
  29412. s0 = peg$FAILED;
  29413. }
  29414. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29415. return s0;
  29416. }
  29417. function peg$parsewsStatements() {
  29418. var s0, s1, s2, s3;
  29419. var key = peg$currPos * 66 + 47,
  29420. cached = peg$resultsCache[key];
  29421. if (cached) {
  29422. peg$currPos = cached.nextPos;
  29423. return cached.result;
  29424. }
  29425. s0 = peg$currPos;
  29426. s1 = peg$parsemaybeDotsWs();
  29427. if (s1 !== peg$FAILED) {
  29428. s2 = peg$parseret();
  29429. if (s2 !== peg$FAILED) {
  29430. peg$savedPos = s0;
  29431. s1 = peg$c100(s2);
  29432. s0 = s1;
  29433. } else {
  29434. peg$currPos = s0;
  29435. s0 = peg$FAILED;
  29436. }
  29437. } else {
  29438. peg$currPos = s0;
  29439. s0 = peg$FAILED;
  29440. }
  29441. if (s0 === peg$FAILED) {
  29442. s0 = peg$currPos;
  29443. s1 = peg$parsewsExpressions();
  29444. if (s1 !== peg$FAILED) {
  29445. s2 = peg$parsesomeDotsWs();
  29446. if (s2 !== peg$FAILED) {
  29447. s3 = peg$parseret();
  29448. if (s3 !== peg$FAILED) {
  29449. peg$savedPos = s0;
  29450. s1 = peg$c101(s1, s3);
  29451. s0 = s1;
  29452. } else {
  29453. peg$currPos = s0;
  29454. s0 = peg$FAILED;
  29455. }
  29456. } else {
  29457. peg$currPos = s0;
  29458. s0 = peg$FAILED;
  29459. }
  29460. } else {
  29461. peg$currPos = s0;
  29462. s0 = peg$FAILED;
  29463. }
  29464. if (s0 === peg$FAILED) {
  29465. s0 = peg$currPos;
  29466. s1 = peg$parsewsExpressions();
  29467. if (s1 === peg$FAILED) {
  29468. s1 = null;
  29469. }
  29470. if (s1 !== peg$FAILED) {
  29471. peg$savedPos = s0;
  29472. s1 = peg$c102(s1);
  29473. }
  29474. s0 = s1;
  29475. }
  29476. }
  29477. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29478. return s0;
  29479. }
  29480. function peg$parsewsSequenceWs() {
  29481. var s0, s1, s2, s3, s4, s5, s6;
  29482. var key = peg$currPos * 66 + 48,
  29483. cached = peg$resultsCache[key];
  29484. if (cached) {
  29485. peg$currPos = cached.nextPos;
  29486. return cached.result;
  29487. }
  29488. s0 = peg$currPos;
  29489. s1 = peg$parsewsPragmas();
  29490. if (s1 === peg$FAILED) {
  29491. s1 = null;
  29492. }
  29493. if (s1 !== peg$FAILED) {
  29494. s2 = peg$parsews();
  29495. if (s2 !== peg$FAILED) {
  29496. s3 = peg$parsetemps();
  29497. if (s3 === peg$FAILED) {
  29498. s3 = null;
  29499. }
  29500. if (s3 !== peg$FAILED) {
  29501. s4 = peg$parsewsPragmas();
  29502. if (s4 === peg$FAILED) {
  29503. s4 = null;
  29504. }
  29505. if (s4 !== peg$FAILED) {
  29506. s5 = peg$parsewsStatements();
  29507. if (s5 === peg$FAILED) {
  29508. s5 = null;
  29509. }
  29510. if (s5 !== peg$FAILED) {
  29511. s6 = peg$parsemaybeDotsWs();
  29512. if (s6 !== peg$FAILED) {
  29513. peg$savedPos = s0;
  29514. s1 = peg$c103(s1, s3, s4, s5);
  29515. s0 = s1;
  29516. } else {
  29517. peg$currPos = s0;
  29518. s0 = peg$FAILED;
  29519. }
  29520. } else {
  29521. peg$currPos = s0;
  29522. s0 = peg$FAILED;
  29523. }
  29524. } else {
  29525. peg$currPos = s0;
  29526. s0 = peg$FAILED;
  29527. }
  29528. } else {
  29529. peg$currPos = s0;
  29530. s0 = peg$FAILED;
  29531. }
  29532. } else {
  29533. peg$currPos = s0;
  29534. s0 = peg$FAILED;
  29535. }
  29536. } else {
  29537. peg$currPos = s0;
  29538. s0 = peg$FAILED;
  29539. }
  29540. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29541. return s0;
  29542. }
  29543. function peg$parseblock() {
  29544. var s0, s1, s2, s3, s4;
  29545. var key = peg$currPos * 66 + 49,
  29546. cached = peg$resultsCache[key];
  29547. if (cached) {
  29548. peg$currPos = cached.nextPos;
  29549. return cached.result;
  29550. }
  29551. s0 = peg$currPos;
  29552. if (input.charCodeAt(peg$currPos) === 91) {
  29553. s1 = peg$c104;
  29554. peg$currPos++;
  29555. } else {
  29556. s1 = peg$FAILED;
  29557. if (peg$silentFails === 0) { peg$fail(peg$c105); }
  29558. }
  29559. if (s1 !== peg$FAILED) {
  29560. s2 = peg$parsewsBlockParamList();
  29561. if (s2 === peg$FAILED) {
  29562. s2 = null;
  29563. }
  29564. if (s2 !== peg$FAILED) {
  29565. s3 = peg$parsewsSequenceWs();
  29566. if (s3 !== peg$FAILED) {
  29567. if (input.charCodeAt(peg$currPos) === 93) {
  29568. s4 = peg$c106;
  29569. peg$currPos++;
  29570. } else {
  29571. s4 = peg$FAILED;
  29572. if (peg$silentFails === 0) { peg$fail(peg$c107); }
  29573. }
  29574. if (s4 !== peg$FAILED) {
  29575. peg$savedPos = s0;
  29576. s1 = peg$c108(s2, s3);
  29577. s0 = s1;
  29578. } else {
  29579. peg$currPos = s0;
  29580. s0 = peg$FAILED;
  29581. }
  29582. } else {
  29583. peg$currPos = s0;
  29584. s0 = peg$FAILED;
  29585. }
  29586. } else {
  29587. peg$currPos = s0;
  29588. s0 = peg$FAILED;
  29589. }
  29590. } else {
  29591. peg$currPos = s0;
  29592. s0 = peg$FAILED;
  29593. }
  29594. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29595. return s0;
  29596. }
  29597. function peg$parseoperand() {
  29598. var s0;
  29599. var key = peg$currPos * 66 + 50,
  29600. cached = peg$resultsCache[key];
  29601. if (cached) {
  29602. peg$currPos = cached.nextPos;
  29603. return cached.result;
  29604. }
  29605. s0 = peg$parseliteral();
  29606. if (s0 === peg$FAILED) {
  29607. s0 = peg$parsevariable();
  29608. if (s0 === peg$FAILED) {
  29609. s0 = peg$parsesubexpression();
  29610. }
  29611. }
  29612. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29613. return s0;
  29614. }
  29615. function peg$parsewsUnaryMessage() {
  29616. var s0, s1, s2, s3, s4;
  29617. var key = peg$currPos * 66 + 51,
  29618. cached = peg$resultsCache[key];
  29619. if (cached) {
  29620. peg$currPos = cached.nextPos;
  29621. return cached.result;
  29622. }
  29623. s0 = peg$currPos;
  29624. s1 = peg$parsews();
  29625. if (s1 !== peg$FAILED) {
  29626. s2 = peg$parseidentifier();
  29627. if (s2 !== peg$FAILED) {
  29628. s3 = peg$currPos;
  29629. peg$silentFails++;
  29630. if (input.charCodeAt(peg$currPos) === 58) {
  29631. s4 = peg$c12;
  29632. peg$currPos++;
  29633. } else {
  29634. s4 = peg$FAILED;
  29635. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29636. }
  29637. peg$silentFails--;
  29638. if (s4 === peg$FAILED) {
  29639. s3 = void 0;
  29640. } else {
  29641. peg$currPos = s3;
  29642. s3 = peg$FAILED;
  29643. }
  29644. if (s3 !== peg$FAILED) {
  29645. peg$savedPos = s0;
  29646. s1 = peg$c109(s2);
  29647. s0 = s1;
  29648. } else {
  29649. peg$currPos = s0;
  29650. s0 = peg$FAILED;
  29651. }
  29652. } else {
  29653. peg$currPos = s0;
  29654. s0 = peg$FAILED;
  29655. }
  29656. } else {
  29657. peg$currPos = s0;
  29658. s0 = peg$FAILED;
  29659. }
  29660. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29661. return s0;
  29662. }
  29663. function peg$parsewsUnaryTail() {
  29664. var s0, s1;
  29665. var key = peg$currPos * 66 + 52,
  29666. cached = peg$resultsCache[key];
  29667. if (cached) {
  29668. peg$currPos = cached.nextPos;
  29669. return cached.result;
  29670. }
  29671. s0 = [];
  29672. s1 = peg$parsewsUnaryMessage();
  29673. while (s1 !== peg$FAILED) {
  29674. s0.push(s1);
  29675. s1 = peg$parsewsUnaryMessage();
  29676. }
  29677. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29678. return s0;
  29679. }
  29680. function peg$parseunarySend() {
  29681. var s0, s1, s2;
  29682. var key = peg$currPos * 66 + 53,
  29683. cached = peg$resultsCache[key];
  29684. if (cached) {
  29685. peg$currPos = cached.nextPos;
  29686. return cached.result;
  29687. }
  29688. s0 = peg$currPos;
  29689. s1 = peg$parseoperand();
  29690. if (s1 !== peg$FAILED) {
  29691. s2 = peg$parsewsUnaryTail();
  29692. if (s2 !== peg$FAILED) {
  29693. peg$savedPos = s0;
  29694. s1 = peg$c110(s1, s2);
  29695. s0 = s1;
  29696. } else {
  29697. peg$currPos = s0;
  29698. s0 = peg$FAILED;
  29699. }
  29700. } else {
  29701. peg$currPos = s0;
  29702. s0 = peg$FAILED;
  29703. }
  29704. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29705. return s0;
  29706. }
  29707. function peg$parsewsBinaryMessage() {
  29708. var s0, s1, s2, s3, s4;
  29709. var key = peg$currPos * 66 + 54,
  29710. cached = peg$resultsCache[key];
  29711. if (cached) {
  29712. peg$currPos = cached.nextPos;
  29713. return cached.result;
  29714. }
  29715. s0 = peg$currPos;
  29716. s1 = peg$parsews();
  29717. if (s1 !== peg$FAILED) {
  29718. s2 = peg$parsebinarySelector();
  29719. if (s2 !== peg$FAILED) {
  29720. s3 = peg$parsews();
  29721. if (s3 !== peg$FAILED) {
  29722. s4 = peg$parseunarySend();
  29723. if (s4 !== peg$FAILED) {
  29724. peg$savedPos = s0;
  29725. s1 = peg$c111(s2, s4);
  29726. s0 = s1;
  29727. } else {
  29728. peg$currPos = s0;
  29729. s0 = peg$FAILED;
  29730. }
  29731. } else {
  29732. peg$currPos = s0;
  29733. s0 = peg$FAILED;
  29734. }
  29735. } else {
  29736. peg$currPos = s0;
  29737. s0 = peg$FAILED;
  29738. }
  29739. } else {
  29740. peg$currPos = s0;
  29741. s0 = peg$FAILED;
  29742. }
  29743. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29744. return s0;
  29745. }
  29746. function peg$parsewsBinaryTail() {
  29747. var s0, s1, s2, s3;
  29748. var key = peg$currPos * 66 + 55,
  29749. cached = peg$resultsCache[key];
  29750. if (cached) {
  29751. peg$currPos = cached.nextPos;
  29752. return cached.result;
  29753. }
  29754. s0 = peg$currPos;
  29755. s1 = peg$parsewsUnaryTail();
  29756. if (s1 !== peg$FAILED) {
  29757. s2 = [];
  29758. s3 = peg$parsewsBinaryMessage();
  29759. while (s3 !== peg$FAILED) {
  29760. s2.push(s3);
  29761. s3 = peg$parsewsBinaryMessage();
  29762. }
  29763. if (s2 !== peg$FAILED) {
  29764. peg$savedPos = s0;
  29765. s1 = peg$c112(s1, s2);
  29766. s0 = s1;
  29767. } else {
  29768. peg$currPos = s0;
  29769. s0 = peg$FAILED;
  29770. }
  29771. } else {
  29772. peg$currPos = s0;
  29773. s0 = peg$FAILED;
  29774. }
  29775. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29776. return s0;
  29777. }
  29778. function peg$parsebinarySend() {
  29779. var s0, s1, s2;
  29780. var key = peg$currPos * 66 + 56,
  29781. cached = peg$resultsCache[key];
  29782. if (cached) {
  29783. peg$currPos = cached.nextPos;
  29784. return cached.result;
  29785. }
  29786. s0 = peg$currPos;
  29787. s1 = peg$parseoperand();
  29788. if (s1 !== peg$FAILED) {
  29789. s2 = peg$parsewsBinaryTail();
  29790. if (s2 !== peg$FAILED) {
  29791. peg$savedPos = s0;
  29792. s1 = peg$c110(s1, s2);
  29793. s0 = s1;
  29794. } else {
  29795. peg$currPos = s0;
  29796. s0 = peg$FAILED;
  29797. }
  29798. } else {
  29799. peg$currPos = s0;
  29800. s0 = peg$FAILED;
  29801. }
  29802. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29803. return s0;
  29804. }
  29805. function peg$parsewsKeywordMessage() {
  29806. var s0, s1, s2, s3, s4, s5, s6;
  29807. var key = peg$currPos * 66 + 57,
  29808. cached = peg$resultsCache[key];
  29809. if (cached) {
  29810. peg$currPos = cached.nextPos;
  29811. return cached.result;
  29812. }
  29813. s0 = peg$currPos;
  29814. s1 = [];
  29815. s2 = peg$currPos;
  29816. s3 = peg$parsews();
  29817. if (s3 !== peg$FAILED) {
  29818. s4 = peg$parsekeyword();
  29819. if (s4 !== peg$FAILED) {
  29820. s5 = peg$parsews();
  29821. if (s5 !== peg$FAILED) {
  29822. s6 = peg$parsebinarySend();
  29823. if (s6 !== peg$FAILED) {
  29824. peg$savedPos = s2;
  29825. s3 = peg$c75(s4, s6);
  29826. s2 = s3;
  29827. } else {
  29828. peg$currPos = s2;
  29829. s2 = peg$FAILED;
  29830. }
  29831. } else {
  29832. peg$currPos = s2;
  29833. s2 = peg$FAILED;
  29834. }
  29835. } else {
  29836. peg$currPos = s2;
  29837. s2 = peg$FAILED;
  29838. }
  29839. } else {
  29840. peg$currPos = s2;
  29841. s2 = peg$FAILED;
  29842. }
  29843. if (s2 !== peg$FAILED) {
  29844. while (s2 !== peg$FAILED) {
  29845. s1.push(s2);
  29846. s2 = peg$currPos;
  29847. s3 = peg$parsews();
  29848. if (s3 !== peg$FAILED) {
  29849. s4 = peg$parsekeyword();
  29850. if (s4 !== peg$FAILED) {
  29851. s5 = peg$parsews();
  29852. if (s5 !== peg$FAILED) {
  29853. s6 = peg$parsebinarySend();
  29854. if (s6 !== peg$FAILED) {
  29855. peg$savedPos = s2;
  29856. s3 = peg$c75(s4, s6);
  29857. s2 = s3;
  29858. } else {
  29859. peg$currPos = s2;
  29860. s2 = peg$FAILED;
  29861. }
  29862. } else {
  29863. peg$currPos = s2;
  29864. s2 = peg$FAILED;
  29865. }
  29866. } else {
  29867. peg$currPos = s2;
  29868. s2 = peg$FAILED;
  29869. }
  29870. } else {
  29871. peg$currPos = s2;
  29872. s2 = peg$FAILED;
  29873. }
  29874. }
  29875. } else {
  29876. s1 = peg$FAILED;
  29877. }
  29878. if (s1 !== peg$FAILED) {
  29879. peg$savedPos = s0;
  29880. s1 = peg$c113(s1);
  29881. }
  29882. s0 = s1;
  29883. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29884. return s0;
  29885. }
  29886. function peg$parsewsKeywordTail() {
  29887. var s0, s1, s2;
  29888. var key = peg$currPos * 66 + 58,
  29889. cached = peg$resultsCache[key];
  29890. if (cached) {
  29891. peg$currPos = cached.nextPos;
  29892. return cached.result;
  29893. }
  29894. s0 = peg$currPos;
  29895. s1 = peg$parsewsBinaryTail();
  29896. if (s1 !== peg$FAILED) {
  29897. s2 = peg$parsewsKeywordMessage();
  29898. if (s2 === peg$FAILED) {
  29899. s2 = null;
  29900. }
  29901. if (s2 !== peg$FAILED) {
  29902. peg$savedPos = s0;
  29903. s1 = peg$c114(s1, s2);
  29904. s0 = s1;
  29905. } else {
  29906. peg$currPos = s0;
  29907. s0 = peg$FAILED;
  29908. }
  29909. } else {
  29910. peg$currPos = s0;
  29911. s0 = peg$FAILED;
  29912. }
  29913. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29914. return s0;
  29915. }
  29916. function peg$parsekeywordSend() {
  29917. var s0, s1, s2;
  29918. var key = peg$currPos * 66 + 59,
  29919. cached = peg$resultsCache[key];
  29920. if (cached) {
  29921. peg$currPos = cached.nextPos;
  29922. return cached.result;
  29923. }
  29924. s0 = peg$currPos;
  29925. s1 = peg$parseoperand();
  29926. if (s1 !== peg$FAILED) {
  29927. s2 = peg$parsewsKeywordTail();
  29928. if (s2 !== peg$FAILED) {
  29929. peg$savedPos = s0;
  29930. s1 = peg$c110(s1, s2);
  29931. s0 = s1;
  29932. } else {
  29933. peg$currPos = s0;
  29934. s0 = peg$FAILED;
  29935. }
  29936. } else {
  29937. peg$currPos = s0;
  29938. s0 = peg$FAILED;
  29939. }
  29940. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29941. return s0;
  29942. }
  29943. function peg$parsewsMessage() {
  29944. var s0;
  29945. var key = peg$currPos * 66 + 60,
  29946. cached = peg$resultsCache[key];
  29947. if (cached) {
  29948. peg$currPos = cached.nextPos;
  29949. return cached.result;
  29950. }
  29951. s0 = peg$parsewsBinaryMessage();
  29952. if (s0 === peg$FAILED) {
  29953. s0 = peg$parsewsUnaryMessage();
  29954. if (s0 === peg$FAILED) {
  29955. s0 = peg$parsewsKeywordMessage();
  29956. }
  29957. }
  29958. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29959. return s0;
  29960. }
  29961. function peg$parsecascade() {
  29962. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  29963. var key = peg$currPos * 66 + 61,
  29964. cached = peg$resultsCache[key];
  29965. if (cached) {
  29966. peg$currPos = cached.nextPos;
  29967. return cached.result;
  29968. }
  29969. s0 = peg$currPos;
  29970. s1 = peg$parseoperand();
  29971. if (s1 !== peg$FAILED) {
  29972. s2 = peg$parsewsKeywordTail();
  29973. if (s2 !== peg$FAILED) {
  29974. peg$savedPos = peg$currPos;
  29975. s3 = peg$c115(s1, s2);
  29976. if (s3) {
  29977. s3 = void 0;
  29978. } else {
  29979. s3 = peg$FAILED;
  29980. }
  29981. if (s3 !== peg$FAILED) {
  29982. s4 = [];
  29983. s5 = peg$currPos;
  29984. s6 = peg$parsews();
  29985. if (s6 !== peg$FAILED) {
  29986. if (input.charCodeAt(peg$currPos) === 59) {
  29987. s7 = peg$c116;
  29988. peg$currPos++;
  29989. } else {
  29990. s7 = peg$FAILED;
  29991. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  29992. }
  29993. if (s7 !== peg$FAILED) {
  29994. s8 = peg$parsewsMessage();
  29995. if (s8 !== peg$FAILED) {
  29996. peg$savedPos = s5;
  29997. s6 = peg$c118(s1, s2, s8);
  29998. s5 = s6;
  29999. } else {
  30000. peg$currPos = s5;
  30001. s5 = peg$FAILED;
  30002. }
  30003. } else {
  30004. peg$currPos = s5;
  30005. s5 = peg$FAILED;
  30006. }
  30007. } else {
  30008. peg$currPos = s5;
  30009. s5 = peg$FAILED;
  30010. }
  30011. if (s5 !== peg$FAILED) {
  30012. while (s5 !== peg$FAILED) {
  30013. s4.push(s5);
  30014. s5 = peg$currPos;
  30015. s6 = peg$parsews();
  30016. if (s6 !== peg$FAILED) {
  30017. if (input.charCodeAt(peg$currPos) === 59) {
  30018. s7 = peg$c116;
  30019. peg$currPos++;
  30020. } else {
  30021. s7 = peg$FAILED;
  30022. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  30023. }
  30024. if (s7 !== peg$FAILED) {
  30025. s8 = peg$parsewsMessage();
  30026. if (s8 !== peg$FAILED) {
  30027. peg$savedPos = s5;
  30028. s6 = peg$c118(s1, s2, s8);
  30029. s5 = s6;
  30030. } else {
  30031. peg$currPos = s5;
  30032. s5 = peg$FAILED;
  30033. }
  30034. } else {
  30035. peg$currPos = s5;
  30036. s5 = peg$FAILED;
  30037. }
  30038. } else {
  30039. peg$currPos = s5;
  30040. s5 = peg$FAILED;
  30041. }
  30042. }
  30043. } else {
  30044. s4 = peg$FAILED;
  30045. }
  30046. if (s4 !== peg$FAILED) {
  30047. peg$savedPos = s0;
  30048. s1 = peg$c119(s1, s2, s4);
  30049. s0 = s1;
  30050. } else {
  30051. peg$currPos = s0;
  30052. s0 = peg$FAILED;
  30053. }
  30054. } else {
  30055. peg$currPos = s0;
  30056. s0 = peg$FAILED;
  30057. }
  30058. } else {
  30059. peg$currPos = s0;
  30060. s0 = peg$FAILED;
  30061. }
  30062. } else {
  30063. peg$currPos = s0;
  30064. s0 = peg$FAILED;
  30065. }
  30066. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30067. return s0;
  30068. }
  30069. function peg$parsemethod() {
  30070. var s0, s1, s2;
  30071. var key = peg$currPos * 66 + 62,
  30072. cached = peg$resultsCache[key];
  30073. if (cached) {
  30074. peg$currPos = cached.nextPos;
  30075. return cached.result;
  30076. }
  30077. s0 = peg$currPos;
  30078. s1 = peg$parsewsKeywordPattern();
  30079. if (s1 === peg$FAILED) {
  30080. s1 = peg$parsewsBinaryPattern();
  30081. if (s1 === peg$FAILED) {
  30082. s1 = peg$parsewsUnaryPattern();
  30083. }
  30084. }
  30085. if (s1 !== peg$FAILED) {
  30086. s2 = peg$parsewsSequenceWs();
  30087. if (s2 !== peg$FAILED) {
  30088. peg$savedPos = s0;
  30089. s1 = peg$c120(s1, s2);
  30090. s0 = s1;
  30091. } else {
  30092. peg$currPos = s0;
  30093. s0 = peg$FAILED;
  30094. }
  30095. } else {
  30096. peg$currPos = s0;
  30097. s0 = peg$FAILED;
  30098. }
  30099. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30100. return s0;
  30101. }
  30102. function peg$parseassociationSend() {
  30103. var s0, s1, s2, s3;
  30104. var key = peg$currPos * 66 + 63,
  30105. cached = peg$resultsCache[key];
  30106. if (cached) {
  30107. peg$currPos = cached.nextPos;
  30108. return cached.result;
  30109. }
  30110. s0 = peg$currPos;
  30111. s1 = peg$parseoperand();
  30112. if (s1 !== peg$FAILED) {
  30113. s2 = peg$parsewsBinaryTail();
  30114. if (s2 !== peg$FAILED) {
  30115. peg$savedPos = peg$currPos;
  30116. s3 = peg$c121(s1, s2);
  30117. if (s3) {
  30118. s3 = void 0;
  30119. } else {
  30120. s3 = peg$FAILED;
  30121. }
  30122. if (s3 !== peg$FAILED) {
  30123. peg$savedPos = s0;
  30124. s1 = peg$c122(s1, s2);
  30125. s0 = s1;
  30126. } else {
  30127. peg$currPos = s0;
  30128. s0 = peg$FAILED;
  30129. }
  30130. } else {
  30131. peg$currPos = s0;
  30132. s0 = peg$FAILED;
  30133. }
  30134. } else {
  30135. peg$currPos = s0;
  30136. s0 = peg$FAILED;
  30137. }
  30138. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30139. return s0;
  30140. }
  30141. function peg$parsewsAssociationsRest() {
  30142. var s0, s1, s2;
  30143. var key = peg$currPos * 66 + 64,
  30144. cached = peg$resultsCache[key];
  30145. if (cached) {
  30146. peg$currPos = cached.nextPos;
  30147. return cached.result;
  30148. }
  30149. s0 = peg$currPos;
  30150. s1 = peg$parsesomeDotsWs();
  30151. if (s1 !== peg$FAILED) {
  30152. s2 = peg$parseassociationSend();
  30153. if (s2 !== peg$FAILED) {
  30154. peg$savedPos = s0;
  30155. s1 = peg$c79(s2);
  30156. s0 = s1;
  30157. } else {
  30158. peg$currPos = s0;
  30159. s0 = peg$FAILED;
  30160. }
  30161. } else {
  30162. peg$currPos = s0;
  30163. s0 = peg$FAILED;
  30164. }
  30165. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30166. return s0;
  30167. }
  30168. function peg$parsewsAssociations() {
  30169. var s0, s1, s2, s3, s4;
  30170. var key = peg$currPos * 66 + 65,
  30171. cached = peg$resultsCache[key];
  30172. if (cached) {
  30173. peg$currPos = cached.nextPos;
  30174. return cached.result;
  30175. }
  30176. s0 = peg$currPos;
  30177. s1 = peg$parsemaybeDotsWs();
  30178. if (s1 !== peg$FAILED) {
  30179. s2 = peg$parseassociationSend();
  30180. if (s2 !== peg$FAILED) {
  30181. s3 = [];
  30182. s4 = peg$parsewsAssociationsRest();
  30183. while (s4 !== peg$FAILED) {
  30184. s3.push(s4);
  30185. s4 = peg$parsewsAssociationsRest();
  30186. }
  30187. if (s3 !== peg$FAILED) {
  30188. peg$savedPos = s0;
  30189. s1 = peg$c123(s2, s3);
  30190. s0 = s1;
  30191. } else {
  30192. peg$currPos = s0;
  30193. s0 = peg$FAILED;
  30194. }
  30195. } else {
  30196. peg$currPos = s0;
  30197. s0 = peg$FAILED;
  30198. }
  30199. } else {
  30200. peg$currPos = s0;
  30201. s0 = peg$FAILED;
  30202. }
  30203. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30204. return s0;
  30205. }
  30206. peg$result = peg$startRuleFunction();
  30207. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  30208. return peg$result;
  30209. } else {
  30210. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  30211. peg$fail({ type: "end", description: "end of input" });
  30212. }
  30213. throw peg$buildException(
  30214. null,
  30215. peg$maxFailExpected,
  30216. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  30217. peg$maxFailPos < input.length
  30218. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  30219. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  30220. );
  30221. }
  30222. }
  30223. return {
  30224. SyntaxError: peg$SyntaxError,
  30225. parse: peg$parse
  30226. };
  30227. })();
  30228. });
  30229. 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";
  30230. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  30231. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  30232. var $pkg = $core.addPackage("Platform-ImportExport");
  30233. $pkg.innerEval = function (expr) { return eval(expr); };
  30234. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  30235. $core.addClass("AbstractExporter", $globals.Object, [], "Platform-ImportExport");
  30236. $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.";
  30237. $core.addMethod(
  30238. $core.method({
  30239. selector: "exportPackage:on:",
  30240. protocol: "output",
  30241. fn: function (aPackage,aStream){
  30242. var self=this,$self=this;
  30243. return $core.withContext(function($ctx1) {
  30244. $self._subclassResponsibility();
  30245. return self;
  30246. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  30247. },
  30248. args: ["aPackage", "aStream"],
  30249. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  30250. referencedClasses: [],
  30251. messageSends: ["subclassResponsibility"]
  30252. }),
  30253. $globals.AbstractExporter);
  30254. $core.addMethod(
  30255. $core.method({
  30256. selector: "extensionMethodsOfPackage:",
  30257. protocol: "accessing",
  30258. fn: function (aPackage){
  30259. var self=this,$self=this;
  30260. var result;
  30261. return $core.withContext(function($ctx1) {
  30262. result=$recv($globals.OrderedCollection)._new();
  30263. $recv($self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  30264. return $core.withContext(function($ctx2) {
  30265. return $recv(result)._addAll_($recv(each)._ownMethods());
  30266. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30267. }));
  30268. return result;
  30269. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  30270. },
  30271. args: ["aPackage"],
  30272. 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",
  30273. referencedClasses: ["OrderedCollection"],
  30274. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "ownMethods"]
  30275. }),
  30276. $globals.AbstractExporter);
  30277. $core.addMethod(
  30278. $core.method({
  30279. selector: "extensionProtocolsOfPackage:",
  30280. protocol: "accessing",
  30281. fn: function (aPackage){
  30282. var self=this,$self=this;
  30283. var extensionName,result;
  30284. return $core.withContext(function($ctx1) {
  30285. var $1,$2,$3;
  30286. $1=$recv(aPackage)._name();
  30287. $ctx1.sendIdx["name"]=1;
  30288. extensionName="*".__comma($1);
  30289. result=$recv($globals.OrderedCollection)._new();
  30290. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  30291. return $core.withContext(function($ctx2) {
  30292. $2=$recv(a)._name();
  30293. $ctx2.sendIdx["name"]=2;
  30294. return $recv($2).__lt($recv(b)._name());
  30295. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30296. })))._do_((function(each){
  30297. return $core.withContext(function($ctx2) {
  30298. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._do_((function(behavior){
  30299. return $core.withContext(function($ctx3) {
  30300. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  30301. if($core.assert($3)){
  30302. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  30303. }
  30304. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  30305. }));
  30306. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  30307. }));
  30308. $ctx1.sendIdx["do:"]=1;
  30309. return result;
  30310. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  30311. },
  30312. args: ["aPackage"],
  30313. 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",
  30314. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  30315. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "copyWithout:", "theMetaClass", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  30316. }),
  30317. $globals.AbstractExporter);
  30318. $core.addClass("ChunkExporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30319. $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.";
  30320. $core.addMethod(
  30321. $core.method({
  30322. selector: "chunkEscape:",
  30323. protocol: "convenience",
  30324. fn: function (aString){
  30325. var self=this,$self=this;
  30326. return $core.withContext(function($ctx1) {
  30327. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  30328. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  30329. },
  30330. args: ["aString"],
  30331. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  30332. referencedClasses: [],
  30333. messageSends: ["trimBoth", "replace:with:"]
  30334. }),
  30335. $globals.ChunkExporter);
  30336. $core.addMethod(
  30337. $core.method({
  30338. selector: "exportBehavior:on:",
  30339. protocol: "output",
  30340. fn: function (aBehavior,aStream){
  30341. var self=this,$self=this;
  30342. return $core.withContext(function($ctx1) {
  30343. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30344. $self._exportProtocols_on_($self._ownMethodProtocolsOfClass_(aBehavior),aStream);
  30345. return self;
  30346. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30347. },
  30348. args: ["aBehavior", "aStream"],
  30349. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09self \x0a\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: aBehavior)\x0a\x09\x09on: aStream",
  30350. referencedClasses: [],
  30351. messageSends: ["exportBehaviorDefinitionTo:using:", "exportProtocols:on:", "ownMethodProtocolsOfClass:"]
  30352. }),
  30353. $globals.ChunkExporter);
  30354. $core.addMethod(
  30355. $core.method({
  30356. selector: "exportCategoryEpilogueOf:on:",
  30357. protocol: "output",
  30358. fn: function (aCategory,aStream){
  30359. var self=this,$self=this;
  30360. return $core.withContext(function($ctx1) {
  30361. $recv(aStream)._write_(" !");
  30362. $recv(aStream)._lf();
  30363. $ctx1.sendIdx["lf"]=1;
  30364. $recv(aStream)._lf();
  30365. return self;
  30366. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30367. },
  30368. args: ["aCategory", "aStream"],
  30369. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30370. referencedClasses: [],
  30371. messageSends: ["write:", "lf"]
  30372. }),
  30373. $globals.ChunkExporter);
  30374. $core.addMethod(
  30375. $core.method({
  30376. selector: "exportCategoryPrologueOf:on:",
  30377. protocol: "output",
  30378. fn: function (aCategory,aStream){
  30379. var self=this,$self=this;
  30380. return $core.withContext(function($ctx1) {
  30381. $recv(aStream)._write_("!");
  30382. $ctx1.sendIdx["write:"]=1;
  30383. $recv(aStream)._print_($recv(aCategory)._theClass());
  30384. $ctx1.sendIdx["print:"]=1;
  30385. $recv(aStream)._write_(" methodsFor: ");
  30386. $ctx1.sendIdx["write:"]=2;
  30387. $recv(aStream)._print_(aCategory);
  30388. $recv(aStream)._write_("!");
  30389. return self;
  30390. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30391. },
  30392. args: ["aCategory", "aStream"],
  30393. 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: '!'",
  30394. referencedClasses: [],
  30395. messageSends: ["write:", "print:", "theClass"]
  30396. }),
  30397. $globals.ChunkExporter);
  30398. $core.addMethod(
  30399. $core.method({
  30400. selector: "exportDefinitionOf:on:",
  30401. protocol: "output",
  30402. fn: function (aClass,aStream){
  30403. var self=this,$self=this;
  30404. return $core.withContext(function($ctx1) {
  30405. var $1,$2,$3,$4;
  30406. $recv(aStream)._print_($recv(aClass)._superclass());
  30407. $ctx1.sendIdx["print:"]=1;
  30408. $recv(aStream)._write_(" subclass: ");
  30409. $ctx1.sendIdx["write:"]=1;
  30410. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30411. $1=$recv(aStream)._lf();
  30412. $ctx1.sendIdx["lf"]=1;
  30413. $recv(aStream)._tab();
  30414. $ctx1.sendIdx["tab"]=1;
  30415. $recv(aStream)._write_("instanceVariableNames: ");
  30416. $ctx1.sendIdx["write:"]=2;
  30417. $recv(aStream)._print_(" "._join_($recv(aClass)._instanceVariableNames()));
  30418. $ctx1.sendIdx["print:"]=2;
  30419. $recv(aStream)._lf();
  30420. $ctx1.sendIdx["lf"]=2;
  30421. $recv(aStream)._tab();
  30422. $recv(aStream)._write_("package: ");
  30423. $ctx1.sendIdx["write:"]=3;
  30424. $recv(aStream)._print_($recv(aClass)._category());
  30425. $ctx1.sendIdx["print:"]=3;
  30426. $recv(aStream)._write_("!");
  30427. $ctx1.sendIdx["write:"]=4;
  30428. $2=$recv(aStream)._lf();
  30429. $ctx1.sendIdx["lf"]=3;
  30430. $3=$recv(aClass)._comment();
  30431. $ctx1.sendIdx["comment"]=1;
  30432. $recv($3)._ifNotEmpty_((function(){
  30433. return $core.withContext(function($ctx2) {
  30434. $recv(aStream)._write_("!");
  30435. $ctx2.sendIdx["write:"]=5;
  30436. $recv(aStream)._print_(aClass);
  30437. $recv(aStream)._write_(" commentStamp!");
  30438. $ctx2.sendIdx["write:"]=6;
  30439. $recv(aStream)._lf();
  30440. $ctx2.sendIdx["lf"]=4;
  30441. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30442. $4=$recv(aStream)._lf();
  30443. $ctx2.sendIdx["lf"]=5;
  30444. return $4;
  30445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30446. }));
  30447. $recv(aStream)._lf();
  30448. return self;
  30449. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30450. },
  30451. args: ["aClass", "aStream"],
  30452. 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",
  30453. referencedClasses: [],
  30454. messageSends: ["print:", "superclass", "write:", "printSymbol:", "name", "lf", "tab", "join:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30455. }),
  30456. $globals.ChunkExporter);
  30457. $core.addMethod(
  30458. $core.method({
  30459. selector: "exportMetaDefinitionOf:on:",
  30460. protocol: "output",
  30461. fn: function (aClass,aStream){
  30462. var self=this,$self=this;
  30463. var classIvars,classTraitComposition;
  30464. return $core.withContext(function($ctx1) {
  30465. var $1,$2;
  30466. $1=$recv(aClass)._class();
  30467. $ctx1.sendIdx["class"]=1;
  30468. classIvars=$recv($1)._instanceVariableNames();
  30469. classTraitComposition=$recv($recv(aClass)._class())._traitComposition();
  30470. $2=$recv(classIvars)._notEmpty();
  30471. if($core.assert($2)){
  30472. $recv(aStream)._print_($recv(aClass)._theMetaClass());
  30473. $ctx1.sendIdx["print:"]=1;
  30474. $recv(aStream)._space();
  30475. $recv(aStream)._write_("instanceVariableNames: ");
  30476. $ctx1.sendIdx["write:"]=1;
  30477. $recv(aStream)._print_(" "._join_(classIvars));
  30478. $recv(aStream)._write_("!");
  30479. $recv(aStream)._lf();
  30480. $ctx1.sendIdx["lf"]=1;
  30481. $recv(aStream)._lf();
  30482. }
  30483. return self;
  30484. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream,classIvars:classIvars,classTraitComposition:classTraitComposition},$globals.ChunkExporter)});
  30485. },
  30486. args: ["aClass", "aStream"],
  30487. 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 ]",
  30488. referencedClasses: [],
  30489. messageSends: ["instanceVariableNames", "class", "traitComposition", "ifTrue:", "notEmpty", "print:", "theMetaClass", "space", "write:", "join:", "lf"]
  30490. }),
  30491. $globals.ChunkExporter);
  30492. $core.addMethod(
  30493. $core.method({
  30494. selector: "exportMethod:on:",
  30495. protocol: "output",
  30496. fn: function (aMethod,aStream){
  30497. var self=this,$self=this;
  30498. return $core.withContext(function($ctx1) {
  30499. $recv(aStream)._lf();
  30500. $ctx1.sendIdx["lf"]=1;
  30501. $recv(aStream)._lf();
  30502. $ctx1.sendIdx["lf"]=2;
  30503. $recv(aStream)._write_($self._chunkEscape_($recv(aMethod)._source()));
  30504. $ctx1.sendIdx["write:"]=1;
  30505. $recv(aStream)._lf();
  30506. $recv(aStream)._write_("!");
  30507. return self;
  30508. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  30509. },
  30510. args: ["aMethod", "aStream"],
  30511. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; write: (self chunkEscape: aMethod source); lf;\x0a\x09\x09write: '!'",
  30512. referencedClasses: [],
  30513. messageSends: ["lf", "write:", "chunkEscape:", "source"]
  30514. }),
  30515. $globals.ChunkExporter);
  30516. $core.addMethod(
  30517. $core.method({
  30518. selector: "exportPackage:on:",
  30519. protocol: "output",
  30520. fn: function (aPackage,aStream){
  30521. var self=this,$self=this;
  30522. return $core.withContext(function($ctx1) {
  30523. var $1,$receiver;
  30524. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  30525. $self._exportPackageImportsOf_on_(aPackage,aStream);
  30526. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  30527. return $core.withContext(function($ctx2) {
  30528. $self._exportBehavior_on_(each,aStream);
  30529. $ctx2.sendIdx["exportBehavior:on:"]=1;
  30530. $1=$recv(each)._theMetaClass();
  30531. if(($receiver = $1) == null || $receiver.a$nil){
  30532. return $1;
  30533. } else {
  30534. var meta;
  30535. meta=$receiver;
  30536. return $self._exportBehavior_on_(meta,aStream);
  30537. }
  30538. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30539. }));
  30540. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  30541. $self._exportProtocols_on_($self._extensionProtocolsOfPackage_(aPackage),aStream);
  30542. return self;
  30543. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30544. },
  30545. args: ["aPackage", "aStream"],
  30546. 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",
  30547. referencedClasses: [],
  30548. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "exportProtocols:on:", "extensionProtocolsOfPackage:"]
  30549. }),
  30550. $globals.ChunkExporter);
  30551. $core.addMethod(
  30552. $core.method({
  30553. selector: "exportPackageDefinitionOf:on:",
  30554. protocol: "output",
  30555. fn: function (aPackage,aStream){
  30556. var self=this,$self=this;
  30557. return $core.withContext(function($ctx1) {
  30558. $recv(aStream)._write_("Smalltalk createPackage: ");
  30559. $ctx1.sendIdx["write:"]=1;
  30560. $recv(aStream)._print_($recv(aPackage)._name());
  30561. $recv(aStream)._write_("!");
  30562. $recv(aStream)._lf();
  30563. return self;
  30564. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30565. },
  30566. args: ["aPackage", "aStream"],
  30567. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'Smalltalk createPackage: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: '!';\x0a\x09\x09lf",
  30568. referencedClasses: [],
  30569. messageSends: ["write:", "print:", "name", "lf"]
  30570. }),
  30571. $globals.ChunkExporter);
  30572. $core.addMethod(
  30573. $core.method({
  30574. selector: "exportPackageImportsOf:on:",
  30575. protocol: "output",
  30576. fn: function (aPackage,aStream){
  30577. var self=this,$self=this;
  30578. return $core.withContext(function($ctx1) {
  30579. var $1;
  30580. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  30581. return $core.withContext(function($ctx2) {
  30582. $recv(aStream)._write_("(Smalltalk packageAt: ");
  30583. $ctx2.sendIdx["write:"]=1;
  30584. $1=$recv(aPackage)._name();
  30585. $ctx2.sendIdx["name"]=1;
  30586. $recv(aStream)._print_($1);
  30587. $ctx2.sendIdx["print:"]=1;
  30588. $recv(aStream)._write_(" ifAbsent: [ self error: ");
  30589. $ctx2.sendIdx["write:"]=2;
  30590. $recv(aStream)._print_("Package not created: ".__comma($recv(aPackage)._name()));
  30591. $recv(aStream)._write_([" ]) imports: ",$self._chunkEscape_($recv(aPackage)._importsDefinition()),"!"]);
  30592. return $recv(aStream)._lf();
  30593. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  30594. }));
  30595. return self;
  30596. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30597. },
  30598. args: ["aPackage", "aStream"],
  30599. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage imports ifNotEmpty: [ :imports | aStream\x0a\x09\x09write: '(Smalltalk packageAt: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: ' ifAbsent: [ self error: ';\x0a\x09\x09print: 'Package not created: ', aPackage name;\x0a\x09\x09write: { ' ]) imports: '. self chunkEscape: aPackage importsDefinition. '!' };\x0a\x09\x09lf ]",
  30600. referencedClasses: [],
  30601. messageSends: ["ifNotEmpty:", "imports", "write:", "print:", "name", ",", "chunkEscape:", "importsDefinition", "lf"]
  30602. }),
  30603. $globals.ChunkExporter);
  30604. $core.addMethod(
  30605. $core.method({
  30606. selector: "exportPackageTraitCompositionsOf:on:",
  30607. protocol: "output",
  30608. fn: function (aPackage,aStream){
  30609. var self=this,$self=this;
  30610. return $core.withContext(function($ctx1) {
  30611. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  30612. return $core.withContext(function($ctx2) {
  30613. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  30614. return $core.withContext(function($ctx3) {
  30615. return $self._exportTraitComposition_of_on_(value,key,aStream);
  30616. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  30617. }));
  30618. $recv(aStream)._write_("! !");
  30619. $recv(aStream)._lf();
  30620. $ctx2.sendIdx["lf"]=1;
  30621. return $recv(aStream)._lf();
  30622. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  30623. }));
  30624. return self;
  30625. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30626. },
  30627. args: ["aPackage", "aStream"],
  30628. 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 ]",
  30629. referencedClasses: [],
  30630. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "write:", "lf"]
  30631. }),
  30632. $globals.ChunkExporter);
  30633. $core.addMethod(
  30634. $core.method({
  30635. selector: "exportProtocol:on:",
  30636. protocol: "output",
  30637. fn: function (aProtocol,aStream){
  30638. var self=this,$self=this;
  30639. return $core.withContext(function($ctx1) {
  30640. $recv($recv(aProtocol)._ownMethods())._ifNotEmpty_((function(methods){
  30641. return $core.withContext(function($ctx2) {
  30642. $self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  30643. $recv(methods)._do_((function(method){
  30644. return $core.withContext(function($ctx3) {
  30645. return $self._exportMethod_on_(method,aStream);
  30646. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  30647. }));
  30648. return $self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  30649. }, function($ctx2) {$ctx2.fillBlock({methods:methods},$ctx1,1)});
  30650. }));
  30651. return self;
  30652. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30653. },
  30654. args: ["aProtocol", "aStream"],
  30655. 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 ]",
  30656. referencedClasses: [],
  30657. messageSends: ["ifNotEmpty:", "ownMethods", "exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  30658. }),
  30659. $globals.ChunkExporter);
  30660. $core.addMethod(
  30661. $core.method({
  30662. selector: "exportProtocolEpilogueOf:on:",
  30663. protocol: "output",
  30664. fn: function (aProtocol,aStream){
  30665. var self=this,$self=this;
  30666. return $core.withContext(function($ctx1) {
  30667. $recv(aStream)._write_(" !");
  30668. $recv(aStream)._lf();
  30669. $ctx1.sendIdx["lf"]=1;
  30670. $recv(aStream)._lf();
  30671. return self;
  30672. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30673. },
  30674. args: ["aProtocol", "aStream"],
  30675. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30676. referencedClasses: [],
  30677. messageSends: ["write:", "lf"]
  30678. }),
  30679. $globals.ChunkExporter);
  30680. $core.addMethod(
  30681. $core.method({
  30682. selector: "exportProtocolPrologueOf:on:",
  30683. protocol: "output",
  30684. fn: function (aProtocol,aStream){
  30685. var self=this,$self=this;
  30686. return $core.withContext(function($ctx1) {
  30687. $recv(aStream)._write_("!");
  30688. $ctx1.sendIdx["write:"]=1;
  30689. $recv(aStream)._print_($recv(aProtocol)._theClass());
  30690. $ctx1.sendIdx["print:"]=1;
  30691. $recv(aStream)._write_(" methodsFor: ");
  30692. $ctx1.sendIdx["write:"]=2;
  30693. $recv(aStream)._print_($recv(aProtocol)._name());
  30694. $recv(aStream)._write_("!");
  30695. return self;
  30696. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30697. },
  30698. args: ["aProtocol", "aStream"],
  30699. 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: '!'",
  30700. referencedClasses: [],
  30701. messageSends: ["write:", "print:", "theClass", "name"]
  30702. }),
  30703. $globals.ChunkExporter);
  30704. $core.addMethod(
  30705. $core.method({
  30706. selector: "exportProtocols:on:",
  30707. protocol: "output",
  30708. fn: function (aCollection,aStream){
  30709. var self=this,$self=this;
  30710. return $core.withContext(function($ctx1) {
  30711. $recv(aCollection)._do_((function(each){
  30712. return $core.withContext(function($ctx2) {
  30713. return $self._exportProtocol_on_(each,aStream);
  30714. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30715. }));
  30716. return self;
  30717. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  30718. },
  30719. args: ["aCollection", "aStream"],
  30720. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  30721. referencedClasses: [],
  30722. messageSends: ["do:", "exportProtocol:on:"]
  30723. }),
  30724. $globals.ChunkExporter);
  30725. $core.addMethod(
  30726. $core.method({
  30727. selector: "exportTraitComposition:of:on:",
  30728. protocol: "output",
  30729. fn: function (aTraitComposition,aBehavior,aStream){
  30730. var self=this,$self=this;
  30731. return $core.withContext(function($ctx1) {
  30732. $recv(aStream)._print_(aBehavior);
  30733. $recv(aStream)._write_(" setTraitComposition: ");
  30734. $ctx1.sendIdx["write:"]=1;
  30735. $recv(aStream)._write_($recv(aBehavior)._traitCompositionDefinition());
  30736. $ctx1.sendIdx["write:"]=2;
  30737. $recv(aStream)._write_(" asTraitComposition!");
  30738. $recv(aStream)._lf();
  30739. return self;
  30740. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30741. },
  30742. args: ["aTraitComposition", "aBehavior", "aStream"],
  30743. 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",
  30744. referencedClasses: [],
  30745. messageSends: ["print:", "write:", "traitCompositionDefinition", "lf"]
  30746. }),
  30747. $globals.ChunkExporter);
  30748. $core.addMethod(
  30749. $core.method({
  30750. selector: "exportTraitDefinitionOf:on:",
  30751. protocol: "output",
  30752. fn: function (aClass,aStream){
  30753. var self=this,$self=this;
  30754. return $core.withContext(function($ctx1) {
  30755. var $1,$2,$3,$4;
  30756. $recv(aStream)._write_("Trait named: ");
  30757. $ctx1.sendIdx["write:"]=1;
  30758. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30759. $1=$recv(aStream)._lf();
  30760. $ctx1.sendIdx["lf"]=1;
  30761. $recv(aStream)._tab();
  30762. $recv(aStream)._write_("package: ");
  30763. $ctx1.sendIdx["write:"]=2;
  30764. $recv(aStream)._print_($recv(aClass)._category());
  30765. $ctx1.sendIdx["print:"]=1;
  30766. $recv(aStream)._write_("!");
  30767. $ctx1.sendIdx["write:"]=3;
  30768. $2=$recv(aStream)._lf();
  30769. $ctx1.sendIdx["lf"]=2;
  30770. $3=$recv(aClass)._comment();
  30771. $ctx1.sendIdx["comment"]=1;
  30772. $recv($3)._ifNotEmpty_((function(){
  30773. return $core.withContext(function($ctx2) {
  30774. $recv(aStream)._write_("!");
  30775. $ctx2.sendIdx["write:"]=4;
  30776. $recv(aStream)._print_(aClass);
  30777. $recv(aStream)._write_(" commentStamp!");
  30778. $ctx2.sendIdx["write:"]=5;
  30779. $recv(aStream)._lf();
  30780. $ctx2.sendIdx["lf"]=3;
  30781. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30782. $4=$recv(aStream)._lf();
  30783. $ctx2.sendIdx["lf"]=4;
  30784. return $4;
  30785. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30786. }));
  30787. $recv(aStream)._lf();
  30788. return self;
  30789. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30790. },
  30791. args: ["aClass", "aStream"],
  30792. 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",
  30793. referencedClasses: [],
  30794. messageSends: ["write:", "printSymbol:", "name", "lf", "tab", "print:", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30795. }),
  30796. $globals.ChunkExporter);
  30797. $core.addMethod(
  30798. $core.method({
  30799. selector: "extensionCategoriesOfPackage:",
  30800. protocol: "accessing",
  30801. fn: function (aPackage){
  30802. var self=this,$self=this;
  30803. var name,map,result;
  30804. return $core.withContext(function($ctx1) {
  30805. var $1;
  30806. name=$recv(aPackage)._name();
  30807. result=$recv($globals.OrderedCollection)._new();
  30808. $ctx1.sendIdx["new"]=1;
  30809. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  30810. return $core.withContext(function($ctx2) {
  30811. return $recv([each,$recv(each)._theMetaClass()])._do_((function(aClass){
  30812. return $core.withContext(function($ctx3) {
  30813. map=$recv($globals.Dictionary)._new();
  30814. $recv(aClass)._protocolsDo_((function(category,methods){
  30815. return $core.withContext(function($ctx4) {
  30816. $1=$recv(category).__eq("*".__comma(name));
  30817. if($core.assert($1)){
  30818. return $recv(map)._at_put_(category,methods);
  30819. }
  30820. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  30821. }));
  30822. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30823. return $core.withContext(function($ctx4) {
  30824. return $recv(a).__lt_eq(b);
  30825. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  30826. })))._collect_((function(category){
  30827. return $core.withContext(function($ctx4) {
  30828. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  30829. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  30830. })));
  30831. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  30832. }));
  30833. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30834. }));
  30835. $ctx1.sendIdx["do:"]=1;
  30836. return result;
  30837. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  30838. },
  30839. args: ["aPackage"],
  30840. 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",
  30841. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  30842. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "theMetaClass", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30843. }),
  30844. $globals.ChunkExporter);
  30845. $core.addMethod(
  30846. $core.method({
  30847. selector: "ownCategoriesOfClass:",
  30848. protocol: "accessing",
  30849. fn: function (aClass){
  30850. var self=this,$self=this;
  30851. var map;
  30852. return $core.withContext(function($ctx1) {
  30853. var $1;
  30854. map=$recv($globals.Dictionary)._new();
  30855. $recv(aClass)._protocolsDo_((function(each,methods){
  30856. return $core.withContext(function($ctx2) {
  30857. $1=$recv(each)._match_("^\x5c*");
  30858. if(!$core.assert($1)){
  30859. return $recv(map)._at_put_(each,methods);
  30860. }
  30861. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  30862. }));
  30863. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30864. return $core.withContext(function($ctx2) {
  30865. return $recv(a).__lt_eq(b);
  30866. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  30867. })))._collect_((function(each){
  30868. return $core.withContext(function($ctx2) {
  30869. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  30870. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  30871. }));
  30872. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  30873. },
  30874. args: ["aClass"],
  30875. 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) ]",
  30876. referencedClasses: ["Dictionary", "MethodCategory"],
  30877. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30878. }),
  30879. $globals.ChunkExporter);
  30880. $core.addMethod(
  30881. $core.method({
  30882. selector: "ownCategoriesOfMetaClass:",
  30883. protocol: "accessing",
  30884. fn: function (aClass){
  30885. var self=this,$self=this;
  30886. return $core.withContext(function($ctx1) {
  30887. return $self._ownCategoriesOfClass_($recv(aClass)._theMetaClass());
  30888. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  30889. },
  30890. args: ["aClass"],
  30891. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass theMetaClass",
  30892. referencedClasses: [],
  30893. messageSends: ["ownCategoriesOfClass:", "theMetaClass"]
  30894. }),
  30895. $globals.ChunkExporter);
  30896. $core.addMethod(
  30897. $core.method({
  30898. selector: "ownMethodProtocolsOfClass:",
  30899. protocol: "accessing",
  30900. fn: function (aClass){
  30901. var self=this,$self=this;
  30902. return $core.withContext(function($ctx1) {
  30903. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  30904. return $core.withContext(function($ctx2) {
  30905. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  30906. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30907. }));
  30908. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  30909. },
  30910. args: ["aClass"],
  30911. 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 ]",
  30912. referencedClasses: ["ExportMethodProtocol"],
  30913. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  30914. }),
  30915. $globals.ChunkExporter);
  30916. $core.addClass("Exporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30917. $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.).";
  30918. $core.addMethod(
  30919. $core.method({
  30920. selector: "exportBehavior:on:",
  30921. protocol: "output",
  30922. fn: function (aBehavior,aStream){
  30923. var self=this,$self=this;
  30924. return $core.withContext(function($ctx1) {
  30925. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30926. $recv($recv(aBehavior)._ownMethods())._do_((function(method){
  30927. return $core.withContext(function($ctx2) {
  30928. return $self._exportMethod_on_(method,aStream);
  30929. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  30930. }));
  30931. return self;
  30932. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  30933. },
  30934. args: ["aBehavior", "aStream"],
  30935. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09aBehavior ownMethods do: [ :method |\x0a\x09\x09self exportMethod: method on: aStream ]",
  30936. referencedClasses: [],
  30937. messageSends: ["exportBehaviorDefinitionTo:using:", "do:", "ownMethods", "exportMethod:on:"]
  30938. }),
  30939. $globals.Exporter);
  30940. $core.addMethod(
  30941. $core.method({
  30942. selector: "exportDefinitionOf:on:",
  30943. protocol: "output",
  30944. fn: function (aClass,aStream){
  30945. var self=this,$self=this;
  30946. return $core.withContext(function($ctx1) {
  30947. var $3,$5,$4,$6,$7,$2,$1,$8,$10,$9,$receiver;
  30948. $recv(aStream)._lf();
  30949. $ctx1.sendIdx["lf"]=1;
  30950. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  30951. $ctx1.sendIdx["asJavaScriptSource"]=1;
  30952. $5=$recv(aClass)._superclass();
  30953. if(($receiver = $5) == null || $receiver.a$nil){
  30954. $4="null";
  30955. } else {
  30956. var superclass;
  30957. superclass=$receiver;
  30958. $4=$recv(superclass)._asJavaScriptSource();
  30959. $ctx1.sendIdx["asJavaScriptSource"]=2;
  30960. }
  30961. $6=$recv($recv(aClass)._instanceVariableNames())._asJavaScriptSource();
  30962. $ctx1.sendIdx["asJavaScriptSource"]=3;
  30963. $7=$recv($recv(aClass)._category())._asJavaScriptSource();
  30964. $ctx1.sendIdx["asJavaScriptSource"]=4;
  30965. $2=["$core.addClass(",$3,", ",$4,", ",$6,", ",$7,");"];
  30966. $1=$recv(aStream)._write_($2);
  30967. $ctx1.sendIdx["write:"]=1;
  30968. $8=$recv(aClass)._comment();
  30969. $ctx1.sendIdx["comment"]=1;
  30970. $recv($8)._ifNotEmpty_((function(){
  30971. return $core.withContext(function($ctx2) {
  30972. $recv(aStream)._lf();
  30973. $ctx2.sendIdx["lf"]=2;
  30974. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  30975. $ctx2.sendIdx["write:"]=2;
  30976. $recv(aStream)._lf();
  30977. $ctx2.sendIdx["lf"]=3;
  30978. $10=$recv(aClass)._asJavaScriptSource();
  30979. $ctx2.sendIdx["asJavaScriptSource"]=5;
  30980. $9=[$10,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  30981. $recv(aStream)._write_($9);
  30982. $ctx2.sendIdx["write:"]=3;
  30983. $recv(aStream)._lf();
  30984. $ctx2.sendIdx["lf"]=4;
  30985. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  30986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  30987. }));
  30988. $recv(aStream)._lf();
  30989. return self;
  30990. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  30991. },
  30992. args: ["aClass", "aStream"],
  30993. 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",
  30994. referencedClasses: [],
  30995. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "ifNil:ifNotNil:", "superclass", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  30996. }),
  30997. $globals.Exporter);
  30998. $core.addMethod(
  30999. $core.method({
  31000. selector: "exportMetaDefinitionOf:on:",
  31001. protocol: "output",
  31002. fn: function (aClass,aStream){
  31003. var self=this,$self=this;
  31004. return $core.withContext(function($ctx1) {
  31005. var $2,$1,$4,$3;
  31006. $recv(aStream)._lf();
  31007. $ctx1.sendIdx["lf"]=1;
  31008. $2=$recv(aClass)._theMetaClass();
  31009. $ctx1.sendIdx["theMetaClass"]=1;
  31010. $1=$recv($2)._instanceVariableNames();
  31011. $recv($1)._ifNotEmpty_((function(classIvars){
  31012. return $core.withContext(function($ctx2) {
  31013. $4=$recv($recv(aClass)._theMetaClass())._asJavaScriptSource();
  31014. $ctx2.sendIdx["asJavaScriptSource"]=1;
  31015. $3=[$4,".iVarNames = ",$recv(classIvars)._asJavaScriptSource(),";"];
  31016. $recv(aStream)._write_($3);
  31017. return $recv(aStream)._lf();
  31018. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  31019. }));
  31020. return self;
  31021. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31022. },
  31023. args: ["aClass", "aStream"],
  31024. 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 ]",
  31025. referencedClasses: [],
  31026. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "theMetaClass", "write:", "asJavaScriptSource"]
  31027. }),
  31028. $globals.Exporter);
  31029. $core.addMethod(
  31030. $core.method({
  31031. selector: "exportMethod:on:",
  31032. protocol: "output",
  31033. fn: function (aMethod,aStream){
  31034. var self=this,$self=this;
  31035. return $core.withContext(function($ctx1) {
  31036. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  31037. $recv(aStream)._write_("$core.addMethod(");
  31038. $ctx1.sendIdx["write:"]=1;
  31039. $recv(aStream)._lf();
  31040. $ctx1.sendIdx["lf"]=1;
  31041. $recv(aStream)._write_("$core.method({");
  31042. $ctx1.sendIdx["write:"]=2;
  31043. $recv(aStream)._lf();
  31044. $ctx1.sendIdx["lf"]=2;
  31045. $2=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  31046. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31047. $1=["selector: ",$2,","];
  31048. $recv(aStream)._write_($1);
  31049. $ctx1.sendIdx["write:"]=3;
  31050. $recv(aStream)._lf();
  31051. $ctx1.sendIdx["lf"]=3;
  31052. $4=$recv($recv(aMethod)._protocol())._asJavaScriptSource();
  31053. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31054. $3=["protocol: ",$4,","];
  31055. $recv(aStream)._write_($3);
  31056. $ctx1.sendIdx["write:"]=4;
  31057. $recv(aStream)._lf();
  31058. $ctx1.sendIdx["lf"]=4;
  31059. $recv(aStream)._write_(["fn: ",$recv($recv(aMethod)._fn())._compiledSource(),","]);
  31060. $ctx1.sendIdx["write:"]=5;
  31061. $recv(aStream)._lf();
  31062. $ctx1.sendIdx["lf"]=5;
  31063. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31064. $ctx1.sendIdx["write:"]=6;
  31065. $recv(aStream)._lf();
  31066. $ctx1.sendIdx["lf"]=6;
  31067. $6=$recv($recv(aMethod)._arguments())._asJavaScriptSource();
  31068. $ctx1.sendIdx["asJavaScriptSource"]=3;
  31069. $5=["args: ",$6,","];
  31070. $recv(aStream)._write_($5);
  31071. $ctx1.sendIdx["write:"]=7;
  31072. $recv(aStream)._lf();
  31073. $ctx1.sendIdx["lf"]=7;
  31074. $8=$recv($recv(aMethod)._source())._asJavaScriptSource();
  31075. $ctx1.sendIdx["asJavaScriptSource"]=4;
  31076. $7=["source: ",$8,","];
  31077. $recv(aStream)._write_($7);
  31078. $ctx1.sendIdx["write:"]=8;
  31079. $recv(aStream)._lf();
  31080. $ctx1.sendIdx["lf"]=8;
  31081. $10=$recv($recv(aMethod)._referencedClasses())._asJavaScriptSource();
  31082. $ctx1.sendIdx["asJavaScriptSource"]=5;
  31083. $9=["referencedClasses: ",$10,","];
  31084. $recv(aStream)._write_($9);
  31085. $ctx1.sendIdx["write:"]=9;
  31086. $recv(aStream)._lf();
  31087. $ctx1.sendIdx["lf"]=9;
  31088. $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31089. $ctx1.sendIdx["write:"]=10;
  31090. $recv(aStream)._lf();
  31091. $ctx1.sendIdx["lf"]=10;
  31092. $12=$recv($recv(aMethod)._messageSends())._asJavaScriptSource();
  31093. $ctx1.sendIdx["asJavaScriptSource"]=6;
  31094. $11=["messageSends: ",$12];
  31095. $recv(aStream)._write_($11);
  31096. $ctx1.sendIdx["write:"]=11;
  31097. $recv(aStream)._lf();
  31098. $ctx1.sendIdx["lf"]=11;
  31099. $recv(aStream)._write_("}),");
  31100. $ctx1.sendIdx["write:"]=12;
  31101. $recv(aStream)._lf();
  31102. $ctx1.sendIdx["lf"]=12;
  31103. $recv(aStream)._write_([$recv($recv(aMethod)._methodClass())._asJavaScriptSource(),");"]);
  31104. $recv(aStream)._lf();
  31105. $ctx1.sendIdx["lf"]=13;
  31106. $recv(aStream)._lf();
  31107. return self;
  31108. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  31109. },
  31110. args: ["aMethod", "aStream"],
  31111. 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",
  31112. referencedClasses: [],
  31113. messageSends: ["write:", "lf", "asJavaScriptSource", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "methodClass"]
  31114. }),
  31115. $globals.Exporter);
  31116. $core.addMethod(
  31117. $core.method({
  31118. selector: "exportPackage:on:",
  31119. protocol: "output",
  31120. fn: function (aPackage,aStream){
  31121. var self=this,$self=this;
  31122. return $core.withContext(function($ctx1) {
  31123. var $1,$receiver;
  31124. $self._exportPackagePrologueOf_on_(aPackage,aStream);
  31125. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  31126. $self._exportPackageContextOf_on_(aPackage,aStream);
  31127. $self._exportPackageImportsOf_on_(aPackage,aStream);
  31128. $self._exportPackageTransportOf_on_(aPackage,aStream);
  31129. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  31130. return $core.withContext(function($ctx2) {
  31131. $self._exportBehavior_on_(each,aStream);
  31132. $ctx2.sendIdx["exportBehavior:on:"]=1;
  31133. $1=$recv(each)._theMetaClass();
  31134. if(($receiver = $1) == null || $receiver.a$nil){
  31135. return $1;
  31136. } else {
  31137. var meta;
  31138. meta=$receiver;
  31139. return $self._exportBehavior_on_(meta,aStream);
  31140. }
  31141. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31142. }));
  31143. $ctx1.sendIdx["do:"]=1;
  31144. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  31145. $recv($self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  31146. return $core.withContext(function($ctx2) {
  31147. return $self._exportMethod_on_(each,aStream);
  31148. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  31149. }));
  31150. $self._exportPackageEpilogueOf_on_(aPackage,aStream);
  31151. return self;
  31152. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31153. },
  31154. args: ["aPackage", "aStream"],
  31155. 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",
  31156. referencedClasses: [],
  31157. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "extensionMethodsOfPackage:", "exportMethod:on:", "exportPackageEpilogueOf:on:"]
  31158. }),
  31159. $globals.Exporter);
  31160. $core.addMethod(
  31161. $core.method({
  31162. selector: "exportPackageBodyBlockPrologueOf:on:",
  31163. protocol: "output",
  31164. fn: function (aPackage,aStream){
  31165. var self=this,$self=this;
  31166. return $core.withContext(function($ctx1) {
  31167. $recv(aStream)._write_("if(!(\x22nilAsValue\x22 in $boot))$boot.nilAsValue=$boot.nilAsReceiver;");
  31168. $ctx1.sendIdx["write:"]=1;
  31169. $recv(aStream)._lf();
  31170. $ctx1.sendIdx["lf"]=1;
  31171. $recv(aStream)._write_("var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  31172. $recv(aStream)._lf();
  31173. return self;
  31174. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31175. },
  31176. args: ["aPackage", "aStream"],
  31177. source: "exportPackageBodyBlockPrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'if(!(\x22nilAsValue\x22 in $boot))$boot.nilAsValue=$boot.nilAsReceiver;'; lf;\x0a\x09\x09write: 'var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;'; lf",
  31178. referencedClasses: [],
  31179. messageSends: ["write:", "lf"]
  31180. }),
  31181. $globals.Exporter);
  31182. $core.addMethod(
  31183. $core.method({
  31184. selector: "exportPackageContextOf:on:",
  31185. protocol: "output",
  31186. fn: function (aPackage,aStream){
  31187. var self=this,$self=this;
  31188. return $core.withContext(function($ctx1) {
  31189. $recv(aStream)._write_("$pkg.innerEval = function (expr) { return eval(expr); };");
  31190. $recv(aStream)._lf();
  31191. return self;
  31192. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31193. },
  31194. args: ["aPackage", "aStream"],
  31195. source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '$pkg.innerEval = function (expr) { return eval(expr); };';\x0a\x09\x09lf",
  31196. referencedClasses: [],
  31197. messageSends: ["write:", "lf"]
  31198. }),
  31199. $globals.Exporter);
  31200. $core.addMethod(
  31201. $core.method({
  31202. selector: "exportPackageDefinitionOf:on:",
  31203. protocol: "output",
  31204. fn: function (aPackage,aStream){
  31205. var self=this,$self=this;
  31206. return $core.withContext(function($ctx1) {
  31207. $recv(aStream)._write_(["var $pkg = $core.addPackage(",$recv($recv(aPackage)._name())._asJavaScriptSource(),");"]);
  31208. $recv(aStream)._lf();
  31209. return self;
  31210. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31211. },
  31212. args: ["aPackage", "aStream"],
  31213. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { 'var $pkg = $core.addPackage('. aPackage name asJavaScriptSource. ');' };\x0a\x09\x09lf",
  31214. referencedClasses: [],
  31215. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31216. }),
  31217. $globals.Exporter);
  31218. $core.addMethod(
  31219. $core.method({
  31220. selector: "exportPackageEpilogueOf:on:",
  31221. protocol: "output",
  31222. fn: function (aPackage,aStream){
  31223. var self=this,$self=this;
  31224. return $core.withContext(function($ctx1) {
  31225. $self._subclassResponsibility();
  31226. return self;
  31227. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31228. },
  31229. args: ["aPackage", "aStream"],
  31230. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31231. referencedClasses: [],
  31232. messageSends: ["subclassResponsibility"]
  31233. }),
  31234. $globals.Exporter);
  31235. $core.addMethod(
  31236. $core.method({
  31237. selector: "exportPackageImportsOf:on:",
  31238. protocol: "output",
  31239. fn: function (aPackage,aStream){
  31240. var self=this,$self=this;
  31241. return $core.withContext(function($ctx1) {
  31242. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  31243. return $core.withContext(function($ctx2) {
  31244. $recv(aStream)._write_(["$pkg.imports = ",$recv(imports)._asJavaScriptSource(),";"]);
  31245. return $recv(aStream)._lf();
  31246. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  31247. }));
  31248. return self;
  31249. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31250. },
  31251. args: ["aPackage", "aStream"],
  31252. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage importsAsJson ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09write: { '$pkg.imports = '. imports asJavaScriptSource. ';' };\x0a\x09\x09\x09lf ]",
  31253. referencedClasses: [],
  31254. messageSends: ["ifNotEmpty:", "importsAsJson", "write:", "asJavaScriptSource", "lf"]
  31255. }),
  31256. $globals.Exporter);
  31257. $core.addMethod(
  31258. $core.method({
  31259. selector: "exportPackagePrologueOf:on:",
  31260. protocol: "output",
  31261. fn: function (aPackage,aStream){
  31262. var self=this,$self=this;
  31263. return $core.withContext(function($ctx1) {
  31264. $self._subclassResponsibility();
  31265. return self;
  31266. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31267. },
  31268. args: ["aPackage", "aStream"],
  31269. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31270. referencedClasses: [],
  31271. messageSends: ["subclassResponsibility"]
  31272. }),
  31273. $globals.Exporter);
  31274. $core.addMethod(
  31275. $core.method({
  31276. selector: "exportPackageTraitCompositionsOf:on:",
  31277. protocol: "output",
  31278. fn: function (aPackage,aStream){
  31279. var self=this,$self=this;
  31280. return $core.withContext(function($ctx1) {
  31281. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  31282. return $core.withContext(function($ctx2) {
  31283. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  31284. return $core.withContext(function($ctx3) {
  31285. return $self._exportTraitComposition_of_on_(value,key,aStream);
  31286. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  31287. }));
  31288. return $recv(aStream)._lf();
  31289. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  31290. }));
  31291. return self;
  31292. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31293. },
  31294. args: ["aPackage", "aStream"],
  31295. 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 ]",
  31296. referencedClasses: [],
  31297. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "lf"]
  31298. }),
  31299. $globals.Exporter);
  31300. $core.addMethod(
  31301. $core.method({
  31302. selector: "exportPackageTransportOf:on:",
  31303. protocol: "output",
  31304. fn: function (aPackage,aStream){
  31305. var self=this,$self=this;
  31306. return $core.withContext(function($ctx1) {
  31307. $recv(aStream)._write_(["$pkg.transport = ",$recv($recv(aPackage)._transport())._asJSONString(),";"]);
  31308. $recv(aStream)._lf();
  31309. return self;
  31310. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31311. },
  31312. args: ["aPackage", "aStream"],
  31313. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { '$pkg.transport = '. aPackage transport asJSONString. ';' };\x0a\x09\x09lf",
  31314. referencedClasses: [],
  31315. messageSends: ["write:", "asJSONString", "transport", "lf"]
  31316. }),
  31317. $globals.Exporter);
  31318. $core.addMethod(
  31319. $core.method({
  31320. selector: "exportTraitComposition:of:on:",
  31321. protocol: "output",
  31322. fn: function (aTraitComposition,aBehavior,aStream){
  31323. var self=this,$self=this;
  31324. return $core.withContext(function($ctx1) {
  31325. var $2,$1;
  31326. $2=$recv(aTraitComposition)._asJavaScriptSource();
  31327. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31328. $1=["$core.setTraitComposition(",$2,", ",$recv(aBehavior)._asJavaScriptSource(),");"];
  31329. $recv(aStream)._write_($1);
  31330. $recv(aStream)._lf();
  31331. return self;
  31332. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  31333. },
  31334. args: ["aTraitComposition", "aBehavior", "aStream"],
  31335. 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",
  31336. referencedClasses: [],
  31337. messageSends: ["write:", "asJavaScriptSource", "lf"]
  31338. }),
  31339. $globals.Exporter);
  31340. $core.addMethod(
  31341. $core.method({
  31342. selector: "exportTraitDefinitionOf:on:",
  31343. protocol: "output",
  31344. fn: function (aClass,aStream){
  31345. var self=this,$self=this;
  31346. return $core.withContext(function($ctx1) {
  31347. var $3,$4,$2,$1,$5,$7,$6;
  31348. $recv(aStream)._lf();
  31349. $ctx1.sendIdx["lf"]=1;
  31350. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  31351. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31352. $4=$recv($recv(aClass)._category())._asJavaScriptSource();
  31353. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31354. $2=["$core.addTrait(",$3,", ",$4,");"];
  31355. $1=$recv(aStream)._write_($2);
  31356. $ctx1.sendIdx["write:"]=1;
  31357. $5=$recv(aClass)._comment();
  31358. $ctx1.sendIdx["comment"]=1;
  31359. $recv($5)._ifNotEmpty_((function(){
  31360. return $core.withContext(function($ctx2) {
  31361. $recv(aStream)._lf();
  31362. $ctx2.sendIdx["lf"]=2;
  31363. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31364. $ctx2.sendIdx["write:"]=2;
  31365. $recv(aStream)._lf();
  31366. $ctx2.sendIdx["lf"]=3;
  31367. $7=$recv(aClass)._asJavaScriptSource();
  31368. $ctx2.sendIdx["asJavaScriptSource"]=3;
  31369. $6=[$7,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  31370. $recv(aStream)._write_($6);
  31371. $ctx2.sendIdx["write:"]=3;
  31372. $recv(aStream)._lf();
  31373. $ctx2.sendIdx["lf"]=4;
  31374. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31376. }));
  31377. $recv(aStream)._lf();
  31378. return self;
  31379. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31380. },
  31381. args: ["aClass", "aStream"],
  31382. 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",
  31383. referencedClasses: [],
  31384. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  31385. }),
  31386. $globals.Exporter);
  31387. $core.addMethod(
  31388. $core.method({
  31389. selector: "ownMethodsOfClass:",
  31390. protocol: "accessing",
  31391. fn: function (aClass){
  31392. var self=this,$self=this;
  31393. return $core.withContext(function($ctx1) {
  31394. var $1;
  31395. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  31396. return $core.withContext(function($ctx2) {
  31397. $1=$recv(a)._selector();
  31398. $ctx2.sendIdx["selector"]=1;
  31399. return $recv($1).__lt_eq($recv(b)._selector());
  31400. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31401. })))._reject_((function(each){
  31402. return $core.withContext(function($ctx2) {
  31403. return $recv($recv(each)._protocol())._match_("^\x5c*");
  31404. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31405. }));
  31406. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  31407. },
  31408. args: ["aClass"],
  31409. 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*') ]",
  31410. referencedClasses: [],
  31411. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  31412. }),
  31413. $globals.Exporter);
  31414. $core.addMethod(
  31415. $core.method({
  31416. selector: "ownMethodsOfMetaClass:",
  31417. protocol: "accessing",
  31418. fn: function (aClass){
  31419. var self=this,$self=this;
  31420. return $core.withContext(function($ctx1) {
  31421. return $self._ownMethodsOfClass_($recv(aClass)._theMetaClass());
  31422. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  31423. },
  31424. args: ["aClass"],
  31425. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass theMetaClass",
  31426. referencedClasses: [],
  31427. messageSends: ["ownMethodsOfClass:", "theMetaClass"]
  31428. }),
  31429. $globals.Exporter);
  31430. $core.addClass("AmdExporter", $globals.Exporter, ["namespace"], "Platform-ImportExport");
  31431. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  31432. $core.addMethod(
  31433. $core.method({
  31434. selector: "amdNamesOfPackages:",
  31435. protocol: "private",
  31436. fn: function (anArray){
  31437. var self=this,$self=this;
  31438. return $core.withContext(function($ctx1) {
  31439. var $1;
  31440. return $recv($recv(anArray)._select_((function(each){
  31441. return $core.withContext(function($ctx2) {
  31442. $1=$self._amdNamespaceOfPackage_(each);
  31443. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  31444. return $recv($1)._notNil();
  31445. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31446. })))._collect_((function(each){
  31447. return $core.withContext(function($ctx2) {
  31448. return $recv($recv($self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  31449. $ctx2.sendIdx[","]=1;
  31450. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31451. }));
  31452. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  31453. },
  31454. args: ["anArray"],
  31455. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  31456. referencedClasses: [],
  31457. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  31458. }),
  31459. $globals.AmdExporter);
  31460. $core.addMethod(
  31461. $core.method({
  31462. selector: "amdNamespaceOfPackage:",
  31463. protocol: "private",
  31464. fn: function (aPackage){
  31465. var self=this,$self=this;
  31466. return $core.withContext(function($ctx1) {
  31467. var $3,$2,$1;
  31468. $3=$recv(aPackage)._transport();
  31469. $ctx1.sendIdx["transport"]=1;
  31470. $2=$recv($3)._type();
  31471. $1=$recv($2).__eq("amd");
  31472. if($core.assert($1)){
  31473. return $recv($recv(aPackage)._transport())._namespace();
  31474. } else {
  31475. return nil;
  31476. }
  31477. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  31478. },
  31479. args: ["aPackage"],
  31480. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  31481. referencedClasses: [],
  31482. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  31483. }),
  31484. $globals.AmdExporter);
  31485. $core.addMethod(
  31486. $core.method({
  31487. selector: "exportPackageEpilogueOf:on:",
  31488. protocol: "output",
  31489. fn: function (aPackage,aStream){
  31490. var self=this,$self=this;
  31491. return $core.withContext(function($ctx1) {
  31492. $recv(aStream)._write_("});");
  31493. $recv(aStream)._lf();
  31494. return self;
  31495. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  31496. },
  31497. args: ["aPackage", "aStream"],
  31498. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '});';\x0a\x09\x09lf",
  31499. referencedClasses: [],
  31500. messageSends: ["write:", "lf"]
  31501. }),
  31502. $globals.AmdExporter);
  31503. $core.addMethod(
  31504. $core.method({
  31505. selector: "exportPackagePrologueOf:on:",
  31506. protocol: "output",
  31507. fn: function (aPackage,aStream){
  31508. var self=this,$self=this;
  31509. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  31510. return $core.withContext(function($ctx1) {
  31511. var $1,$3,$2,$4,$6,$5,$7,$14,$13,$12,$11,$10,$9,$18,$17,$16,$15,$8;
  31512. pragmaStart="";
  31513. pragmaEnd="";
  31514. importsForOutput=$self._importsForOutput_(aPackage);
  31515. loadDependencies=$self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  31516. $1=$recv(importsForOutput)._value();
  31517. $ctx1.sendIdx["value"]=1;
  31518. $recv($1)._ifNotEmpty_((function(){
  31519. return $core.withContext(function($ctx2) {
  31520. $3=$recv($globals.String)._lf();
  31521. $ctx2.sendIdx["lf"]=1;
  31522. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  31523. $ctx2.sendIdx[","]=2;
  31524. $4=$recv($globals.String)._lf();
  31525. $ctx2.sendIdx["lf"]=2;
  31526. pragmaStart=$recv($2).__comma($4);
  31527. $ctx2.sendIdx[","]=1;
  31528. $6=$recv($globals.String)._lf();
  31529. $ctx2.sendIdx["lf"]=3;
  31530. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  31531. $ctx2.sendIdx[","]=4;
  31532. $7=$recv($globals.String)._lf();
  31533. $ctx2.sendIdx["lf"]=4;
  31534. pragmaEnd=$recv($5).__comma($7);
  31535. $ctx2.sendIdx[","]=3;
  31536. return pragmaEnd;
  31537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31538. }));
  31539. $14=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  31540. $ctx1.sendIdx[","]=7;
  31541. $13=$recv($14).__comma([":2:"]);
  31542. $ctx1.sendIdx[","]=6;
  31543. $12=$recv($13).__comma($recv($recv(loadDependencies)._asArray())._sorted());
  31544. $ctx1.sendIdx[","]=5;
  31545. $11=$recv($12)._asJavaScriptSource();
  31546. $10=$recv($11)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  31547. $ctx1.sendIdx["replace:with:"]=2;
  31548. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  31549. $ctx1.sendIdx["replace:with:"]=1;
  31550. $18=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  31551. $ctx1.sendIdx[","]=8;
  31552. $17=$recv($18)._join_(",");
  31553. $16=$recv($17)._replace_with_(",\x5cs*:1:",pragmaStart);
  31554. $15=$recv($16)._replace_with_(",\x5cs*:2:",pragmaEnd);
  31555. $ctx1.sendIdx["replace:with:"]=3;
  31556. $8=["define(",$9,", function(",$15,"){\x22use strict\x22;"];
  31557. $recv(aStream)._write_($8);
  31558. $recv(aStream)._lf();
  31559. $self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  31560. return self;
  31561. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  31562. },
  31563. args: ["aPackage", "aStream"],
  31564. 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",
  31565. referencedClasses: ["String"],
  31566. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "write:", "replace:with:", "asJavaScriptSource", "sorted", "asArray", "join:", "key", "exportPackageBodyBlockPrologueOf:on:"]
  31567. }),
  31568. $globals.AmdExporter);
  31569. $core.addMethod(
  31570. $core.method({
  31571. selector: "importsForOutput:",
  31572. protocol: "private",
  31573. fn: function (aPackage){
  31574. var self=this,$self=this;
  31575. var namedImports,anonImports,importVarNames;
  31576. return $core.withContext(function($ctx1) {
  31577. var $1;
  31578. namedImports=[];
  31579. anonImports=[];
  31580. importVarNames=[];
  31581. $recv($recv(aPackage)._imports())._do_((function(each){
  31582. return $core.withContext(function($ctx2) {
  31583. $1=$recv(each)._isString();
  31584. if($core.assert($1)){
  31585. return $recv(anonImports)._add_(each);
  31586. $ctx2.sendIdx["add:"]=1;
  31587. } else {
  31588. $recv(namedImports)._add_($recv(each)._value());
  31589. $ctx2.sendIdx["add:"]=2;
  31590. return $recv(importVarNames)._add_($recv(each)._key());
  31591. }
  31592. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31593. }));
  31594. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  31595. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  31596. },
  31597. args: ["aPackage"],
  31598. 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)",
  31599. referencedClasses: [],
  31600. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  31601. }),
  31602. $globals.AmdExporter);
  31603. $core.addClass("ChunkParser", $globals.Object, ["stream", "last"], "Platform-ImportExport");
  31604. $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";
  31605. $core.addMethod(
  31606. $core.method({
  31607. selector: "last",
  31608. protocol: "accessing",
  31609. fn: function (){
  31610. var self=this,$self=this;
  31611. return $self["@last"];
  31612. },
  31613. args: [],
  31614. source: "last\x0a\x09^ last",
  31615. referencedClasses: [],
  31616. messageSends: []
  31617. }),
  31618. $globals.ChunkParser);
  31619. $core.addMethod(
  31620. $core.method({
  31621. selector: "nextChunk",
  31622. protocol: "reading",
  31623. fn: function (){
  31624. var self=this,$self=this;
  31625. var char,result,chunk;
  31626. return $core.withContext(function($ctx1) {
  31627. var $1,$2,$3,$4;
  31628. var $early={};
  31629. try {
  31630. result=""._writeStream();
  31631. $recv((function(){
  31632. return $core.withContext(function($ctx2) {
  31633. char=$recv($self["@stream"])._next();
  31634. $ctx2.sendIdx["next"]=1;
  31635. return $recv(char)._notNil();
  31636. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31637. }))._whileTrue_((function(){
  31638. return $core.withContext(function($ctx2) {
  31639. $1=$recv(char).__eq("!");
  31640. $ctx2.sendIdx["="]=1;
  31641. if($core.assert($1)){
  31642. $2=$recv($recv($self["@stream"])._peek()).__eq("!");
  31643. if($core.assert($2)){
  31644. $recv($self["@stream"])._next();
  31645. } else {
  31646. $self["@last"]=$recv($recv(result)._contents())._trimBoth();
  31647. $3=$self["@last"];
  31648. throw $early=[$3];
  31649. }
  31650. }
  31651. return $recv(result)._nextPut_(char);
  31652. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31653. }));
  31654. $self["@last"]=nil;
  31655. $4=$self["@last"];
  31656. return $4;
  31657. }
  31658. catch(e) {if(e===$early)return e[0]; throw e}
  31659. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  31660. },
  31661. args: [],
  31662. 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",
  31663. referencedClasses: [],
  31664. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  31665. }),
  31666. $globals.ChunkParser);
  31667. $core.addMethod(
  31668. $core.method({
  31669. selector: "stream:",
  31670. protocol: "accessing",
  31671. fn: function (aStream){
  31672. var self=this,$self=this;
  31673. $self["@stream"]=aStream;
  31674. return self;
  31675. },
  31676. args: ["aStream"],
  31677. source: "stream: aStream\x0a\x09stream := aStream",
  31678. referencedClasses: [],
  31679. messageSends: []
  31680. }),
  31681. $globals.ChunkParser);
  31682. $core.addMethod(
  31683. $core.method({
  31684. selector: "on:",
  31685. protocol: "instance creation",
  31686. fn: function (aStream){
  31687. var self=this,$self=this;
  31688. return $core.withContext(function($ctx1) {
  31689. return $recv($self._new())._stream_(aStream);
  31690. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.a$cls)});
  31691. },
  31692. args: ["aStream"],
  31693. source: "on: aStream\x0a\x09^ self new stream: aStream",
  31694. referencedClasses: [],
  31695. messageSends: ["stream:", "new"]
  31696. }),
  31697. $globals.ChunkParser.a$cls);
  31698. $core.addClass("ClassCommentReader", $globals.Object, ["class"], "Platform-ImportExport");
  31699. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  31700. $core.addMethod(
  31701. $core.method({
  31702. selector: "class:",
  31703. protocol: "accessing",
  31704. fn: function (aClass){
  31705. var self=this,$self=this;
  31706. $self["@class"]=aClass;
  31707. return self;
  31708. },
  31709. args: ["aClass"],
  31710. source: "class: aClass\x0a\x09class := aClass",
  31711. referencedClasses: [],
  31712. messageSends: []
  31713. }),
  31714. $globals.ClassCommentReader);
  31715. $core.addMethod(
  31716. $core.method({
  31717. selector: "initialize",
  31718. protocol: "initialization",
  31719. fn: function (){
  31720. var self=this,$self=this;
  31721. return $core.withContext(function($ctx1) {
  31722. (
  31723. $ctx1.supercall = true,
  31724. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31725. $ctx1.supercall = false;
  31726. return self;
  31727. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  31728. },
  31729. args: [],
  31730. source: "initialize\x0a\x09super initialize.",
  31731. referencedClasses: [],
  31732. messageSends: ["initialize"]
  31733. }),
  31734. $globals.ClassCommentReader);
  31735. $core.addMethod(
  31736. $core.method({
  31737. selector: "scanFrom:",
  31738. protocol: "fileIn",
  31739. fn: function (aChunkParser){
  31740. var self=this,$self=this;
  31741. var chunk;
  31742. return $core.withContext(function($ctx1) {
  31743. chunk=$recv(aChunkParser)._nextChunk();
  31744. $recv(chunk)._ifNotEmpty_((function(){
  31745. return $core.withContext(function($ctx2) {
  31746. return $self._setComment_(chunk);
  31747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31748. }));
  31749. return self;
  31750. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  31751. },
  31752. args: ["aChunkParser"],
  31753. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  31754. referencedClasses: [],
  31755. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  31756. }),
  31757. $globals.ClassCommentReader);
  31758. $core.addMethod(
  31759. $core.method({
  31760. selector: "setComment:",
  31761. protocol: "private",
  31762. fn: function (aString){
  31763. var self=this,$self=this;
  31764. return $core.withContext(function($ctx1) {
  31765. $recv($self["@class"])._comment_(aString);
  31766. return self;
  31767. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  31768. },
  31769. args: ["aString"],
  31770. source: "setComment: aString\x0a\x09class comment: aString",
  31771. referencedClasses: [],
  31772. messageSends: ["comment:"]
  31773. }),
  31774. $globals.ClassCommentReader);
  31775. $core.addClass("ClassProtocolReader", $globals.Object, ["class", "category"], "Platform-ImportExport");
  31776. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  31777. $core.addMethod(
  31778. $core.method({
  31779. selector: "class:category:",
  31780. protocol: "accessing",
  31781. fn: function (aClass,aString){
  31782. var self=this,$self=this;
  31783. $self["@class"]=aClass;
  31784. $self["@category"]=aString;
  31785. return self;
  31786. },
  31787. args: ["aClass", "aString"],
  31788. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  31789. referencedClasses: [],
  31790. messageSends: []
  31791. }),
  31792. $globals.ClassProtocolReader);
  31793. $core.addMethod(
  31794. $core.method({
  31795. selector: "compileMethod:",
  31796. protocol: "private",
  31797. fn: function (aString){
  31798. var self=this,$self=this;
  31799. return $core.withContext(function($ctx1) {
  31800. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,$self["@class"],$self["@category"]);
  31801. return self;
  31802. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  31803. },
  31804. args: ["aString"],
  31805. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  31806. referencedClasses: ["Compiler"],
  31807. messageSends: ["install:forClass:protocol:", "new"]
  31808. }),
  31809. $globals.ClassProtocolReader);
  31810. $core.addMethod(
  31811. $core.method({
  31812. selector: "initialize",
  31813. protocol: "initialization",
  31814. fn: function (){
  31815. var self=this,$self=this;
  31816. return $core.withContext(function($ctx1) {
  31817. (
  31818. $ctx1.supercall = true,
  31819. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31820. $ctx1.supercall = false;
  31821. return self;
  31822. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  31823. },
  31824. args: [],
  31825. source: "initialize\x0a\x09super initialize.",
  31826. referencedClasses: [],
  31827. messageSends: ["initialize"]
  31828. }),
  31829. $globals.ClassProtocolReader);
  31830. $core.addMethod(
  31831. $core.method({
  31832. selector: "scanFrom:",
  31833. protocol: "fileIn",
  31834. fn: function (aChunkParser){
  31835. var self=this,$self=this;
  31836. var chunk;
  31837. return $core.withContext(function($ctx1) {
  31838. $recv((function(){
  31839. return $core.withContext(function($ctx2) {
  31840. chunk=$recv(aChunkParser)._nextChunk();
  31841. return $recv(chunk)._isEmpty();
  31842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31843. }))._whileFalse_((function(){
  31844. return $core.withContext(function($ctx2) {
  31845. return $self._compileMethod_(chunk);
  31846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31847. }));
  31848. return self;
  31849. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  31850. },
  31851. args: ["aChunkParser"],
  31852. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  31853. referencedClasses: [],
  31854. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  31855. }),
  31856. $globals.ClassProtocolReader);
  31857. $core.addClass("ExportMethodProtocol", $globals.Object, ["name", "theClass"], "Platform-ImportExport");
  31858. $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.";
  31859. $core.addMethod(
  31860. $core.method({
  31861. selector: "methods",
  31862. protocol: "accessing",
  31863. fn: function (){
  31864. var self=this,$self=this;
  31865. return $core.withContext(function($ctx1) {
  31866. var $1;
  31867. return $recv($recv($self._theClass())._methodsInProtocol_($self._name()))._sorted_((function(a,b){
  31868. return $core.withContext(function($ctx2) {
  31869. $1=$recv(a)._selector();
  31870. $ctx2.sendIdx["selector"]=1;
  31871. return $recv($1).__lt_eq($recv(b)._selector());
  31872. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31873. }));
  31874. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  31875. },
  31876. args: [],
  31877. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31878. referencedClasses: [],
  31879. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  31880. }),
  31881. $globals.ExportMethodProtocol);
  31882. $core.addMethod(
  31883. $core.method({
  31884. selector: "name",
  31885. protocol: "accessing",
  31886. fn: function (){
  31887. var self=this,$self=this;
  31888. return $self["@name"];
  31889. },
  31890. args: [],
  31891. source: "name\x0a\x09^ name",
  31892. referencedClasses: [],
  31893. messageSends: []
  31894. }),
  31895. $globals.ExportMethodProtocol);
  31896. $core.addMethod(
  31897. $core.method({
  31898. selector: "name:",
  31899. protocol: "accessing",
  31900. fn: function (aString){
  31901. var self=this,$self=this;
  31902. $self["@name"]=aString;
  31903. return self;
  31904. },
  31905. args: ["aString"],
  31906. source: "name: aString\x0a\x09name := aString",
  31907. referencedClasses: [],
  31908. messageSends: []
  31909. }),
  31910. $globals.ExportMethodProtocol);
  31911. $core.addMethod(
  31912. $core.method({
  31913. selector: "ownMethods",
  31914. protocol: "accessing",
  31915. fn: function (){
  31916. var self=this,$self=this;
  31917. return $core.withContext(function($ctx1) {
  31918. var $1;
  31919. return $recv($recv($self._theClass())._ownMethodsInProtocol_($self._name()))._sorted_((function(a,b){
  31920. return $core.withContext(function($ctx2) {
  31921. $1=$recv(a)._selector();
  31922. $ctx2.sendIdx["selector"]=1;
  31923. return $recv($1).__lt_eq($recv(b)._selector());
  31924. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31925. }));
  31926. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.ExportMethodProtocol)});
  31927. },
  31928. args: [],
  31929. source: "ownMethods\x0a\x09^ (self theClass ownMethodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31930. referencedClasses: [],
  31931. messageSends: ["sorted:", "ownMethodsInProtocol:", "theClass", "name", "<=", "selector"]
  31932. }),
  31933. $globals.ExportMethodProtocol);
  31934. $core.addMethod(
  31935. $core.method({
  31936. selector: "theClass",
  31937. protocol: "accessing",
  31938. fn: function (){
  31939. var self=this,$self=this;
  31940. return $self["@theClass"];
  31941. },
  31942. args: [],
  31943. source: "theClass\x0a\x09^ theClass",
  31944. referencedClasses: [],
  31945. messageSends: []
  31946. }),
  31947. $globals.ExportMethodProtocol);
  31948. $core.addMethod(
  31949. $core.method({
  31950. selector: "theClass:",
  31951. protocol: "accessing",
  31952. fn: function (aClass){
  31953. var self=this,$self=this;
  31954. $self["@theClass"]=aClass;
  31955. return self;
  31956. },
  31957. args: ["aClass"],
  31958. source: "theClass: aClass\x0a\x09theClass := aClass",
  31959. referencedClasses: [],
  31960. messageSends: []
  31961. }),
  31962. $globals.ExportMethodProtocol);
  31963. $core.addMethod(
  31964. $core.method({
  31965. selector: "name:theClass:",
  31966. protocol: "instance creation",
  31967. fn: function (aString,aClass){
  31968. var self=this,$self=this;
  31969. return $core.withContext(function($ctx1) {
  31970. var $1;
  31971. $1=$self._new();
  31972. $recv($1)._name_(aString);
  31973. $recv($1)._theClass_(aClass);
  31974. return $recv($1)._yourself();
  31975. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.a$cls)});
  31976. },
  31977. args: ["aString", "aClass"],
  31978. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  31979. referencedClasses: [],
  31980. messageSends: ["name:", "new", "theClass:", "yourself"]
  31981. }),
  31982. $globals.ExportMethodProtocol.a$cls);
  31983. $core.addClass("Importer", $globals.Object, ["lastSection", "lastChunk"], "Platform-ImportExport");
  31984. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  31985. $core.addMethod(
  31986. $core.method({
  31987. selector: "import:",
  31988. protocol: "fileIn",
  31989. fn: function (aStream){
  31990. var self=this,$self=this;
  31991. var chunk,result,parser,lastEmpty;
  31992. return $core.withContext(function($ctx1) {
  31993. var $1;
  31994. parser=$recv($globals.ChunkParser)._on_(aStream);
  31995. lastEmpty=false;
  31996. $self["@lastSection"]="n/a, not started";
  31997. $self["@lastChunk"]=nil;
  31998. $recv((function(){
  31999. return $core.withContext(function($ctx2) {
  32000. $recv((function(){
  32001. return $core.withContext(function($ctx3) {
  32002. chunk=$recv(parser)._nextChunk();
  32003. return $recv(chunk)._isNil();
  32004. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32005. }))._whileFalse_((function(){
  32006. return $core.withContext(function($ctx3) {
  32007. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  32008. lastEmpty=true;
  32009. return lastEmpty;
  32010. }),(function(){
  32011. return $core.withContext(function($ctx4) {
  32012. $self["@lastSection"]=chunk;
  32013. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  32014. $1=lastEmpty;
  32015. if($core.assert($1)){
  32016. lastEmpty=false;
  32017. return $recv(result)._scanFrom_(parser);
  32018. }
  32019. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  32020. }));
  32021. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  32022. }));
  32023. $self["@lastSection"]="n/a, finished";
  32024. return $self["@lastSection"];
  32025. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32026. }))._on_do_($globals.Error,(function(e){
  32027. return $core.withContext(function($ctx2) {
  32028. $self["@lastChunk"]=$recv(parser)._last();
  32029. return $recv(e)._pass();
  32030. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  32031. }));
  32032. return self;
  32033. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  32034. },
  32035. args: ["aStream"],
  32036. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk\x0a\x09\x09\x09ifEmpty: [ lastEmpty := true ]\x0a\x09\x09\x09ifNotEmpty: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e pass ].",
  32037. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  32038. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "pass"]
  32039. }),
  32040. $globals.Importer);
  32041. $core.addMethod(
  32042. $core.method({
  32043. selector: "lastChunk",
  32044. protocol: "accessing",
  32045. fn: function (){
  32046. var self=this,$self=this;
  32047. return $self["@lastChunk"];
  32048. },
  32049. args: [],
  32050. source: "lastChunk\x0a\x09^ lastChunk",
  32051. referencedClasses: [],
  32052. messageSends: []
  32053. }),
  32054. $globals.Importer);
  32055. $core.addMethod(
  32056. $core.method({
  32057. selector: "lastSection",
  32058. protocol: "accessing",
  32059. fn: function (){
  32060. var self=this,$self=this;
  32061. return $self["@lastSection"];
  32062. },
  32063. args: [],
  32064. source: "lastSection\x0a\x09^ lastSection",
  32065. referencedClasses: [],
  32066. messageSends: []
  32067. }),
  32068. $globals.Importer);
  32069. $core.addClass("PackageCommitError", $globals.Error, [], "Platform-ImportExport");
  32070. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  32071. $core.addClass("PackageHandler", $globals.Object, [], "Platform-ImportExport");
  32072. $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.";
  32073. $core.addMethod(
  32074. $core.method({
  32075. selector: "ajaxPutAt:data:onSuccess:onError:",
  32076. protocol: "private",
  32077. fn: function (aURL,aString,aBlock,anotherBlock){
  32078. var self=this,$self=this;
  32079. var xhr;
  32080. return $core.withContext(function($ctx1) {
  32081. var $1,$4,$3,$2;
  32082. xhr=$recv($globals.Platform)._newXhr();
  32083. $recv(xhr)._open_url_async_("PUT",aURL,true);
  32084. $recv(xhr)._onreadystatechange_((function(){
  32085. return $core.withContext(function($ctx2) {
  32086. $1=$recv($recv(xhr)._readyState()).__eq((4));
  32087. if($core.assert($1)){
  32088. $4=$recv(xhr)._status();
  32089. $ctx2.sendIdx["status"]=1;
  32090. $3=$recv($4).__gt_eq((200));
  32091. $2=$recv($3)._and_((function(){
  32092. return $core.withContext(function($ctx3) {
  32093. return $recv($recv(xhr)._status()).__lt((300));
  32094. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  32095. }));
  32096. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  32097. }
  32098. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32099. }));
  32100. $recv(xhr)._send_(aString);
  32101. return self;
  32102. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  32103. },
  32104. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  32105. 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",
  32106. referencedClasses: ["Platform"],
  32107. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  32108. }),
  32109. $globals.PackageHandler);
  32110. $core.addMethod(
  32111. $core.method({
  32112. selector: "chunkContentsFor:",
  32113. protocol: "accessing",
  32114. fn: function (aPackage){
  32115. var self=this,$self=this;
  32116. return $core.withContext(function($ctx1) {
  32117. return $recv($globals.String)._streamContents_((function(str){
  32118. return $core.withContext(function($ctx2) {
  32119. return $recv($self._chunkExporter())._exportPackage_on_(aPackage,str);
  32120. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32121. }));
  32122. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32123. },
  32124. args: ["aPackage"],
  32125. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  32126. referencedClasses: ["String"],
  32127. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  32128. }),
  32129. $globals.PackageHandler);
  32130. $core.addMethod(
  32131. $core.method({
  32132. selector: "chunkExporter",
  32133. protocol: "factory",
  32134. fn: function (){
  32135. var self=this,$self=this;
  32136. return $core.withContext(function($ctx1) {
  32137. return $recv($self._chunkExporterClass())._new();
  32138. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  32139. },
  32140. args: [],
  32141. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  32142. referencedClasses: [],
  32143. messageSends: ["new", "chunkExporterClass"]
  32144. }),
  32145. $globals.PackageHandler);
  32146. $core.addMethod(
  32147. $core.method({
  32148. selector: "chunkExporterClass",
  32149. protocol: "accessing",
  32150. fn: function (){
  32151. var self=this,$self=this;
  32152. return $globals.ChunkExporter;
  32153. },
  32154. args: [],
  32155. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  32156. referencedClasses: ["ChunkExporter"],
  32157. messageSends: []
  32158. }),
  32159. $globals.PackageHandler);
  32160. $core.addMethod(
  32161. $core.method({
  32162. selector: "commit:",
  32163. protocol: "committing",
  32164. fn: function (aPackage){
  32165. var self=this,$self=this;
  32166. return $core.withContext(function($ctx1) {
  32167. var $1,$2;
  32168. $self._commit_onSuccess_onError_(aPackage,(function(){
  32169. }),(function(error){
  32170. return $core.withContext(function($ctx2) {
  32171. $1=$recv($globals.PackageCommitError)._new();
  32172. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  32173. $ctx2.sendIdx[","]=1;
  32174. $recv($1)._messageText_($2);
  32175. return $recv($1)._signal();
  32176. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  32177. }));
  32178. return self;
  32179. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  32180. },
  32181. args: ["aPackage"],
  32182. 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 ]",
  32183. referencedClasses: ["PackageCommitError"],
  32184. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  32185. }),
  32186. $globals.PackageHandler);
  32187. $core.addMethod(
  32188. $core.method({
  32189. selector: "commit:onSuccess:onError:",
  32190. protocol: "committing",
  32191. fn: function (aPackage,aBlock,anotherBlock){
  32192. var self=this,$self=this;
  32193. return $core.withContext(function($ctx1) {
  32194. $self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  32195. return $core.withContext(function($ctx2) {
  32196. return $self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  32197. return $core.withContext(function($ctx3) {
  32198. $recv(aPackage)._beClean();
  32199. return $recv(aBlock)._value();
  32200. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32201. }),anotherBlock);
  32202. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32203. }),anotherBlock);
  32204. return self;
  32205. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32206. },
  32207. args: ["aPackage", "aBlock", "anotherBlock"],
  32208. 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",
  32209. referencedClasses: [],
  32210. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  32211. }),
  32212. $globals.PackageHandler);
  32213. $core.addMethod(
  32214. $core.method({
  32215. selector: "commitJsFileFor:onSuccess:onError:",
  32216. protocol: "committing",
  32217. fn: function (aPackage,aBlock,anotherBlock){
  32218. var self=this,$self=this;
  32219. return $core.withContext(function($ctx1) {
  32220. var $2,$1;
  32221. $2=$recv($recv($self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32222. $ctx1.sendIdx[","]=2;
  32223. $1=$recv($2).__comma(".js");
  32224. $ctx1.sendIdx[","]=1;
  32225. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._contentsFor_(aPackage),aBlock,anotherBlock);
  32226. return self;
  32227. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32228. },
  32229. args: ["aPackage", "aBlock", "anotherBlock"],
  32230. 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",
  32231. referencedClasses: [],
  32232. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  32233. }),
  32234. $globals.PackageHandler);
  32235. $core.addMethod(
  32236. $core.method({
  32237. selector: "commitPathJsFor:",
  32238. protocol: "accessing",
  32239. fn: function (aPackage){
  32240. var self=this,$self=this;
  32241. return $core.withContext(function($ctx1) {
  32242. $self._subclassResponsibility();
  32243. return self;
  32244. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32245. },
  32246. args: ["aPackage"],
  32247. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  32248. referencedClasses: [],
  32249. messageSends: ["subclassResponsibility"]
  32250. }),
  32251. $globals.PackageHandler);
  32252. $core.addMethod(
  32253. $core.method({
  32254. selector: "commitPathStFor:",
  32255. protocol: "accessing",
  32256. fn: function (aPackage){
  32257. var self=this,$self=this;
  32258. return $core.withContext(function($ctx1) {
  32259. $self._subclassResponsibility();
  32260. return self;
  32261. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32262. },
  32263. args: ["aPackage"],
  32264. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  32265. referencedClasses: [],
  32266. messageSends: ["subclassResponsibility"]
  32267. }),
  32268. $globals.PackageHandler);
  32269. $core.addMethod(
  32270. $core.method({
  32271. selector: "commitStFileFor:onSuccess:onError:",
  32272. protocol: "committing",
  32273. fn: function (aPackage,aBlock,anotherBlock){
  32274. var self=this,$self=this;
  32275. return $core.withContext(function($ctx1) {
  32276. var $2,$1;
  32277. $2=$recv($recv($self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32278. $ctx1.sendIdx[","]=2;
  32279. $1=$recv($2).__comma(".st");
  32280. $ctx1.sendIdx[","]=1;
  32281. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  32282. return self;
  32283. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32284. },
  32285. args: ["aPackage", "aBlock", "anotherBlock"],
  32286. 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",
  32287. referencedClasses: [],
  32288. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  32289. }),
  32290. $globals.PackageHandler);
  32291. $core.addMethod(
  32292. $core.method({
  32293. selector: "contentsFor:",
  32294. protocol: "accessing",
  32295. fn: function (aPackage){
  32296. var self=this,$self=this;
  32297. return $core.withContext(function($ctx1) {
  32298. return $recv($globals.String)._streamContents_((function(str){
  32299. return $core.withContext(function($ctx2) {
  32300. return $recv($self._exporter())._exportPackage_on_(aPackage,str);
  32301. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32302. }));
  32303. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32304. },
  32305. args: ["aPackage"],
  32306. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  32307. referencedClasses: ["String"],
  32308. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  32309. }),
  32310. $globals.PackageHandler);
  32311. $core.addMethod(
  32312. $core.method({
  32313. selector: "exporter",
  32314. protocol: "factory",
  32315. fn: function (){
  32316. var self=this,$self=this;
  32317. return $core.withContext(function($ctx1) {
  32318. return $recv($self._exporterClass())._new();
  32319. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  32320. },
  32321. args: [],
  32322. source: "exporter\x0a\x09^ self exporterClass new",
  32323. referencedClasses: [],
  32324. messageSends: ["new", "exporterClass"]
  32325. }),
  32326. $globals.PackageHandler);
  32327. $core.addMethod(
  32328. $core.method({
  32329. selector: "exporterClass",
  32330. protocol: "accessing",
  32331. fn: function (){
  32332. var self=this,$self=this;
  32333. return $core.withContext(function($ctx1) {
  32334. $self._subclassResponsibility();
  32335. return self;
  32336. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  32337. },
  32338. args: [],
  32339. source: "exporterClass\x0a\x09self subclassResponsibility",
  32340. referencedClasses: [],
  32341. messageSends: ["subclassResponsibility"]
  32342. }),
  32343. $globals.PackageHandler);
  32344. $core.addMethod(
  32345. $core.method({
  32346. selector: "load:",
  32347. protocol: "loading",
  32348. fn: function (aPackage){
  32349. var self=this,$self=this;
  32350. return $core.withContext(function($ctx1) {
  32351. $self._subclassResponsibility();
  32352. return self;
  32353. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  32354. },
  32355. args: ["aPackage"],
  32356. source: "load: aPackage\x0a\x09\x22Should return a TThenable\x22\x0a\x09self subclassResponsibility",
  32357. referencedClasses: [],
  32358. messageSends: ["subclassResponsibility"]
  32359. }),
  32360. $globals.PackageHandler);
  32361. $core.addMethod(
  32362. $core.method({
  32363. selector: "onCommitError:",
  32364. protocol: "error handling",
  32365. fn: function (anError){
  32366. var self=this,$self=this;
  32367. return $core.withContext(function($ctx1) {
  32368. var $1,$2;
  32369. $1=$recv($globals.PackageCommitError)._new();
  32370. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  32371. $ctx1.sendIdx[","]=1;
  32372. $recv($1)._messageText_($2);
  32373. $recv($1)._signal();
  32374. return self;
  32375. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  32376. },
  32377. args: ["anError"],
  32378. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  32379. referencedClasses: ["PackageCommitError"],
  32380. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  32381. }),
  32382. $globals.PackageHandler);
  32383. $core.addClass("AmdPackageHandler", $globals.PackageHandler, [], "Platform-ImportExport");
  32384. $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.";
  32385. $core.addMethod(
  32386. $core.method({
  32387. selector: "commitPathJsFor:",
  32388. protocol: "accessing",
  32389. fn: function (aPackage){
  32390. var self=this,$self=this;
  32391. return $core.withContext(function($ctx1) {
  32392. return $self._toUrl_($self._namespaceFor_(aPackage));
  32393. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32394. },
  32395. args: ["aPackage"],
  32396. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  32397. referencedClasses: [],
  32398. messageSends: ["toUrl:", "namespaceFor:"]
  32399. }),
  32400. $globals.AmdPackageHandler);
  32401. $core.addMethod(
  32402. $core.method({
  32403. selector: "commitPathStFor:",
  32404. protocol: "accessing",
  32405. fn: function (aPackage){
  32406. var self=this,$self=this;
  32407. var path,pathWithout;
  32408. return $core.withContext(function($ctx1) {
  32409. var $1,$2;
  32410. $1=$recv($self._namespaceFor_(aPackage)).__comma("/_source");
  32411. $ctx1.sendIdx[","]=1;
  32412. path=$self._toUrl_($1);
  32413. pathWithout=$self._commitPathJsFor_(aPackage);
  32414. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  32415. if($core.assert($2)){
  32416. return pathWithout;
  32417. } else {
  32418. return path;
  32419. }
  32420. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  32421. },
  32422. args: ["aPackage"],
  32423. 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 ]",
  32424. referencedClasses: [],
  32425. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  32426. }),
  32427. $globals.AmdPackageHandler);
  32428. $core.addMethod(
  32429. $core.method({
  32430. selector: "exporterClass",
  32431. protocol: "accessing",
  32432. fn: function (){
  32433. var self=this,$self=this;
  32434. return $globals.AmdExporter;
  32435. },
  32436. args: [],
  32437. source: "exporterClass\x0a\x09^ AmdExporter",
  32438. referencedClasses: ["AmdExporter"],
  32439. messageSends: []
  32440. }),
  32441. $globals.AmdPackageHandler);
  32442. $core.addMethod(
  32443. $core.method({
  32444. selector: "load:",
  32445. protocol: "loading",
  32446. fn: function (aPackage){
  32447. var self=this,$self=this;
  32448. return $core.withContext(function($ctx1) {
  32449. var $1,$3,$2,$receiver;
  32450. return $recv($globals.Promise)._new_((function(model){
  32451. return $core.withContext(function($ctx2) {
  32452. $1=$recv($globals.Smalltalk)._amdRequire();
  32453. if(($receiver = $1) == null || $receiver.a$nil){
  32454. return $self._error_("AMD loader not present");
  32455. } else {
  32456. var require;
  32457. require=$receiver;
  32458. $3=$recv($recv($self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32459. $ctx2.sendIdx[","]=1;
  32460. $2=[$3];
  32461. return $recv(require)._value_value_value_($2,(function(result){
  32462. return $core.withContext(function($ctx3) {
  32463. return $recv(model)._value_(result);
  32464. }, function($ctx3) {$ctx3.fillBlock({result:result},$ctx2,4)});
  32465. }),(function(error){
  32466. return $core.withContext(function($ctx3) {
  32467. return $recv(model)._signal_(error);
  32468. }, function($ctx3) {$ctx3.fillBlock({error:error},$ctx2,5)});
  32469. }));
  32470. }
  32471. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,1)});
  32472. }));
  32473. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32474. },
  32475. args: ["aPackage"],
  32476. source: "load: aPackage\x0a\x09^ Promise new: [ :model |\x0a\x09\x09Smalltalk amdRequire\x0a\x09\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09\x09require\x0a\x09\x09\x09\x09\x09value: { (self namespaceFor: aPackage), '/', aPackage name }\x0a\x09\x09\x09\x09\x09value: [ :result | model value: result ]\x0a\x09\x09\x09\x09\x09value: [ :error | model signal: error ] ] ]",
  32477. referencedClasses: ["Promise", "Smalltalk"],
  32478. messageSends: ["new:", "ifNil:ifNotNil:", "amdRequire", "error:", "value:value:value:", ",", "namespaceFor:", "name", "value:", "signal:"]
  32479. }),
  32480. $globals.AmdPackageHandler);
  32481. $core.addMethod(
  32482. $core.method({
  32483. selector: "namespaceFor:",
  32484. protocol: "committing",
  32485. fn: function (aPackage){
  32486. var self=this,$self=this;
  32487. return $core.withContext(function($ctx1) {
  32488. return $recv($recv(aPackage)._transport())._namespace();
  32489. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32490. },
  32491. args: ["aPackage"],
  32492. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  32493. referencedClasses: [],
  32494. messageSends: ["namespace", "transport"]
  32495. }),
  32496. $globals.AmdPackageHandler);
  32497. $core.addMethod(
  32498. $core.method({
  32499. selector: "toUrl:",
  32500. protocol: "private",
  32501. fn: function (aString){
  32502. var self=this,$self=this;
  32503. return $core.withContext(function($ctx1) {
  32504. var $1,$receiver;
  32505. $1=$recv($globals.Smalltalk)._amdRequire();
  32506. if(($receiver = $1) == null || $receiver.a$nil){
  32507. return $self._error_("AMD loader not present");
  32508. } else {
  32509. var require;
  32510. require=$receiver;
  32511. return $recv($recv(require)._provided())._toUrl_(aString);
  32512. }
  32513. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  32514. },
  32515. args: ["aString"],
  32516. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | require provided toUrl: aString ]",
  32517. referencedClasses: ["Smalltalk"],
  32518. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "toUrl:", "provided"]
  32519. }),
  32520. $globals.AmdPackageHandler);
  32521. $core.addMethod(
  32522. $core.method({
  32523. selector: "defaultNamespace",
  32524. protocol: "commit paths",
  32525. fn: function (){
  32526. var self=this,$self=this;
  32527. return $core.withContext(function($ctx1) {
  32528. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32529. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.a$cls)});
  32530. },
  32531. args: [],
  32532. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32533. referencedClasses: ["Smalltalk"],
  32534. messageSends: ["defaultAmdNamespace"]
  32535. }),
  32536. $globals.AmdPackageHandler.a$cls);
  32537. $core.addMethod(
  32538. $core.method({
  32539. selector: "defaultNamespace:",
  32540. protocol: "commit paths",
  32541. fn: function (aString){
  32542. var self=this,$self=this;
  32543. return $core.withContext(function($ctx1) {
  32544. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  32545. return self;
  32546. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.a$cls)});
  32547. },
  32548. args: ["aString"],
  32549. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  32550. referencedClasses: ["Smalltalk"],
  32551. messageSends: ["defaultAmdNamespace:"]
  32552. }),
  32553. $globals.AmdPackageHandler.a$cls);
  32554. $core.addClass("PackageTransport", $globals.Object, ["package"], "Platform-ImportExport");
  32555. $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.";
  32556. $core.addMethod(
  32557. $core.method({
  32558. selector: "asJavaScriptObject",
  32559. protocol: "converting",
  32560. fn: function (){
  32561. var self=this,$self=this;
  32562. return $core.withContext(function($ctx1) {
  32563. return $globals.HashedCollection._newFromPairs_(["type",$self._type()]);
  32564. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.PackageTransport)});
  32565. },
  32566. args: [],
  32567. source: "asJavaScriptObject\x0a\x09^ #{ 'type' -> self type }",
  32568. referencedClasses: [],
  32569. messageSends: ["type"]
  32570. }),
  32571. $globals.PackageTransport);
  32572. $core.addMethod(
  32573. $core.method({
  32574. selector: "commit",
  32575. protocol: "committing",
  32576. fn: function (){
  32577. var self=this,$self=this;
  32578. return $core.withContext(function($ctx1) {
  32579. $recv($self._commitHandler())._commit_($self._package());
  32580. return self;
  32581. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  32582. },
  32583. args: [],
  32584. source: "commit\x0a\x09self commitHandler commit: self package",
  32585. referencedClasses: [],
  32586. messageSends: ["commit:", "commitHandler", "package"]
  32587. }),
  32588. $globals.PackageTransport);
  32589. $core.addMethod(
  32590. $core.method({
  32591. selector: "commitHandler",
  32592. protocol: "factory",
  32593. fn: function (){
  32594. var self=this,$self=this;
  32595. return $core.withContext(function($ctx1) {
  32596. return $recv($self._commitHandlerClass())._new();
  32597. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  32598. },
  32599. args: [],
  32600. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  32601. referencedClasses: [],
  32602. messageSends: ["new", "commitHandlerClass"]
  32603. }),
  32604. $globals.PackageTransport);
  32605. $core.addMethod(
  32606. $core.method({
  32607. selector: "commitHandlerClass",
  32608. protocol: "accessing",
  32609. fn: function (){
  32610. var self=this,$self=this;
  32611. return $core.withContext(function($ctx1) {
  32612. $self._subclassResponsibility();
  32613. return self;
  32614. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  32615. },
  32616. args: [],
  32617. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  32618. referencedClasses: [],
  32619. messageSends: ["subclassResponsibility"]
  32620. }),
  32621. $globals.PackageTransport);
  32622. $core.addMethod(
  32623. $core.method({
  32624. selector: "commitOnSuccess:onError:",
  32625. protocol: "committing",
  32626. fn: function (aBlock,anotherBlock){
  32627. var self=this,$self=this;
  32628. return $core.withContext(function($ctx1) {
  32629. $recv($self._commitHandler())._commit_onSuccess_onError_($self._package(),aBlock,anotherBlock);
  32630. return self;
  32631. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  32632. },
  32633. args: ["aBlock", "anotherBlock"],
  32634. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  32635. referencedClasses: [],
  32636. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  32637. }),
  32638. $globals.PackageTransport);
  32639. $core.addMethod(
  32640. $core.method({
  32641. selector: "definition",
  32642. protocol: "accessing",
  32643. fn: function (){
  32644. var self=this,$self=this;
  32645. return "";
  32646. },
  32647. args: [],
  32648. source: "definition\x0a\x09^ ''",
  32649. referencedClasses: [],
  32650. messageSends: []
  32651. }),
  32652. $globals.PackageTransport);
  32653. $core.addMethod(
  32654. $core.method({
  32655. selector: "load",
  32656. protocol: "loading",
  32657. fn: function (){
  32658. var self=this,$self=this;
  32659. return $core.withContext(function($ctx1) {
  32660. return $recv($recv($self._commitHandler())._load_($self._package()))._then_((function(){
  32661. return $core.withContext(function($ctx2) {
  32662. return $recv($globals.Smalltalk)._postLoad();
  32663. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32664. }));
  32665. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  32666. },
  32667. args: [],
  32668. source: "load\x0a\x09^ (self commitHandler load: self package)\x0a\x09\x09then: [ Smalltalk postLoad ]",
  32669. referencedClasses: ["Smalltalk"],
  32670. messageSends: ["then:", "load:", "commitHandler", "package", "postLoad"]
  32671. }),
  32672. $globals.PackageTransport);
  32673. $core.addMethod(
  32674. $core.method({
  32675. selector: "package",
  32676. protocol: "accessing",
  32677. fn: function (){
  32678. var self=this,$self=this;
  32679. return $self["@package"];
  32680. },
  32681. args: [],
  32682. source: "package\x0a\x09^ package",
  32683. referencedClasses: [],
  32684. messageSends: []
  32685. }),
  32686. $globals.PackageTransport);
  32687. $core.addMethod(
  32688. $core.method({
  32689. selector: "package:",
  32690. protocol: "accessing",
  32691. fn: function (aPackage){
  32692. var self=this,$self=this;
  32693. $self["@package"]=aPackage;
  32694. return self;
  32695. },
  32696. args: ["aPackage"],
  32697. source: "package: aPackage\x0a\x09package := aPackage",
  32698. referencedClasses: [],
  32699. messageSends: []
  32700. }),
  32701. $globals.PackageTransport);
  32702. $core.addMethod(
  32703. $core.method({
  32704. selector: "setupFromJson:",
  32705. protocol: "initialization",
  32706. fn: function (anObject){
  32707. var self=this,$self=this;
  32708. return self;
  32709. },
  32710. args: ["anObject"],
  32711. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  32712. referencedClasses: [],
  32713. messageSends: []
  32714. }),
  32715. $globals.PackageTransport);
  32716. $core.addMethod(
  32717. $core.method({
  32718. selector: "type",
  32719. protocol: "accessing",
  32720. fn: function (){
  32721. var self=this,$self=this;
  32722. return $core.withContext(function($ctx1) {
  32723. return $recv($self._class())._type();
  32724. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  32725. },
  32726. args: [],
  32727. source: "type\x0a\x09^ self class type",
  32728. referencedClasses: [],
  32729. messageSends: ["type", "class"]
  32730. }),
  32731. $globals.PackageTransport);
  32732. $globals.PackageTransport.a$cls.iVarNames = ["registry"];
  32733. $core.addMethod(
  32734. $core.method({
  32735. selector: "classRegisteredFor:",
  32736. protocol: "accessing",
  32737. fn: function (aString){
  32738. var self=this,$self=this;
  32739. return $core.withContext(function($ctx1) {
  32740. return $recv($self["@registry"])._at_(aString);
  32741. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.a$cls)});
  32742. },
  32743. args: ["aString"],
  32744. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  32745. referencedClasses: [],
  32746. messageSends: ["at:"]
  32747. }),
  32748. $globals.PackageTransport.a$cls);
  32749. $core.addMethod(
  32750. $core.method({
  32751. selector: "defaultType",
  32752. protocol: "accessing",
  32753. fn: function (){
  32754. var self=this,$self=this;
  32755. return $core.withContext(function($ctx1) {
  32756. return $recv($globals.AmdPackageTransport)._type();
  32757. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.a$cls)});
  32758. },
  32759. args: [],
  32760. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  32761. referencedClasses: ["AmdPackageTransport"],
  32762. messageSends: ["type"]
  32763. }),
  32764. $globals.PackageTransport.a$cls);
  32765. $core.addMethod(
  32766. $core.method({
  32767. selector: "for:",
  32768. protocol: "instance creation",
  32769. fn: function (aString){
  32770. var self=this,$self=this;
  32771. return $core.withContext(function($ctx1) {
  32772. return $recv($self._classRegisteredFor_(aString))._new();
  32773. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.a$cls)});
  32774. },
  32775. args: ["aString"],
  32776. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  32777. referencedClasses: [],
  32778. messageSends: ["new", "classRegisteredFor:"]
  32779. }),
  32780. $globals.PackageTransport.a$cls);
  32781. $core.addMethod(
  32782. $core.method({
  32783. selector: "fromJson:",
  32784. protocol: "instance creation",
  32785. fn: function (anObject){
  32786. var self=this,$self=this;
  32787. return $core.withContext(function($ctx1) {
  32788. var $1,$2,$receiver;
  32789. if(($receiver = anObject) == null || $receiver.a$nil){
  32790. $1=$self._for_($self._defaultType());
  32791. $ctx1.sendIdx["for:"]=1;
  32792. return $1;
  32793. } else {
  32794. anObject;
  32795. }
  32796. $2=$self._for_($recv(anObject)._type());
  32797. $recv($2)._setupFromJson_(anObject);
  32798. return $recv($2)._yourself();
  32799. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.a$cls)});
  32800. },
  32801. args: ["anObject"],
  32802. 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",
  32803. referencedClasses: [],
  32804. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  32805. }),
  32806. $globals.PackageTransport.a$cls);
  32807. $core.addMethod(
  32808. $core.method({
  32809. selector: "initialize",
  32810. protocol: "initialization",
  32811. fn: function (){
  32812. var self=this,$self=this;
  32813. return $core.withContext(function($ctx1) {
  32814. var $1;
  32815. (
  32816. $ctx1.supercall = true,
  32817. ($globals.PackageTransport.a$cls.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  32818. $ctx1.supercall = false;
  32819. $1=$self.__eq_eq($globals.PackageTransport);
  32820. if($core.assert($1)){
  32821. $self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  32822. $self["@registry"];
  32823. } else {
  32824. $self._register();
  32825. }
  32826. return self;
  32827. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.a$cls)});
  32828. },
  32829. args: [],
  32830. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  32831. referencedClasses: ["PackageTransport"],
  32832. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  32833. }),
  32834. $globals.PackageTransport.a$cls);
  32835. $core.addMethod(
  32836. $core.method({
  32837. selector: "register",
  32838. protocol: "registration",
  32839. fn: function (){
  32840. var self=this,$self=this;
  32841. return $core.withContext(function($ctx1) {
  32842. $recv($globals.PackageTransport)._register_(self);
  32843. return self;
  32844. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.a$cls)});
  32845. },
  32846. args: [],
  32847. source: "register\x0a\x09PackageTransport register: self",
  32848. referencedClasses: ["PackageTransport"],
  32849. messageSends: ["register:"]
  32850. }),
  32851. $globals.PackageTransport.a$cls);
  32852. $core.addMethod(
  32853. $core.method({
  32854. selector: "register:",
  32855. protocol: "registration",
  32856. fn: function (aClass){
  32857. var self=this,$self=this;
  32858. return $core.withContext(function($ctx1) {
  32859. var $1,$receiver;
  32860. $1=$recv(aClass)._type();
  32861. $ctx1.sendIdx["type"]=1;
  32862. if(($receiver = $1) == null || $receiver.a$nil){
  32863. $1;
  32864. } else {
  32865. $recv($self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  32866. }
  32867. return self;
  32868. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.a$cls)});
  32869. },
  32870. args: ["aClass"],
  32871. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  32872. referencedClasses: [],
  32873. messageSends: ["ifNotNil:", "type", "at:put:"]
  32874. }),
  32875. $globals.PackageTransport.a$cls);
  32876. $core.addMethod(
  32877. $core.method({
  32878. selector: "type",
  32879. protocol: "accessing",
  32880. fn: function (){
  32881. var self=this,$self=this;
  32882. return nil;
  32883. },
  32884. args: [],
  32885. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  32886. referencedClasses: [],
  32887. messageSends: []
  32888. }),
  32889. $globals.PackageTransport.a$cls);
  32890. $core.addClass("AmdPackageTransport", $globals.PackageTransport, ["namespace"], "Platform-ImportExport");
  32891. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  32892. $core.addMethod(
  32893. $core.method({
  32894. selector: "asJavaScriptObject",
  32895. protocol: "converting",
  32896. fn: function (){
  32897. var self=this,$self=this;
  32898. return $core.withContext(function($ctx1) {
  32899. var $1;
  32900. $1=(
  32901. $ctx1.supercall = true,
  32902. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJavaScriptObject.apply($self, []));
  32903. $ctx1.supercall = false;
  32904. $recv($1)._at_put_("amdNamespace",$self._namespace());
  32905. return $recv($1)._yourself();
  32906. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.AmdPackageTransport)});
  32907. },
  32908. args: [],
  32909. source: "asJavaScriptObject\x0a\x09^ super asJavaScriptObject\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  32910. referencedClasses: [],
  32911. messageSends: ["at:put:", "asJavaScriptObject", "namespace", "yourself"]
  32912. }),
  32913. $globals.AmdPackageTransport);
  32914. $core.addMethod(
  32915. $core.method({
  32916. selector: "commitHandlerClass",
  32917. protocol: "accessing",
  32918. fn: function (){
  32919. var self=this,$self=this;
  32920. return $globals.AmdPackageHandler;
  32921. },
  32922. args: [],
  32923. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  32924. referencedClasses: ["AmdPackageHandler"],
  32925. messageSends: []
  32926. }),
  32927. $globals.AmdPackageTransport);
  32928. $core.addMethod(
  32929. $core.method({
  32930. selector: "defaultNamespace",
  32931. protocol: "defaults",
  32932. fn: function (){
  32933. var self=this,$self=this;
  32934. return $core.withContext(function($ctx1) {
  32935. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32936. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  32937. },
  32938. args: [],
  32939. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32940. referencedClasses: ["Smalltalk"],
  32941. messageSends: ["defaultAmdNamespace"]
  32942. }),
  32943. $globals.AmdPackageTransport);
  32944. $core.addMethod(
  32945. $core.method({
  32946. selector: "definition",
  32947. protocol: "accessing",
  32948. fn: function (){
  32949. var self=this,$self=this;
  32950. return $core.withContext(function($ctx1) {
  32951. return $recv($globals.String)._streamContents_((function(stream){
  32952. return $core.withContext(function($ctx2) {
  32953. $recv(stream)._write_([$recv($self._class())._name()," namespace: "]);
  32954. return $recv(stream)._print_($self._namespace());
  32955. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  32956. }));
  32957. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  32958. },
  32959. args: [],
  32960. source: "definition\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: { self class name. ' namespace: ' }; print: self namespace ]",
  32961. referencedClasses: ["String"],
  32962. messageSends: ["streamContents:", "write:", "name", "class", "print:", "namespace"]
  32963. }),
  32964. $globals.AmdPackageTransport);
  32965. $core.addMethod(
  32966. $core.method({
  32967. selector: "namespace",
  32968. protocol: "accessing",
  32969. fn: function (){
  32970. var self=this,$self=this;
  32971. return $core.withContext(function($ctx1) {
  32972. var $1,$receiver;
  32973. $1=$self["@namespace"];
  32974. if(($receiver = $1) == null || $receiver.a$nil){
  32975. return $self._defaultNamespace();
  32976. } else {
  32977. return $1;
  32978. }
  32979. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  32980. },
  32981. args: [],
  32982. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  32983. referencedClasses: [],
  32984. messageSends: ["ifNil:", "defaultNamespace"]
  32985. }),
  32986. $globals.AmdPackageTransport);
  32987. $core.addMethod(
  32988. $core.method({
  32989. selector: "namespace:",
  32990. protocol: "accessing",
  32991. fn: function (aString){
  32992. var self=this,$self=this;
  32993. $self["@namespace"]=aString;
  32994. return self;
  32995. },
  32996. args: ["aString"],
  32997. source: "namespace: aString\x0a\x09namespace := aString",
  32998. referencedClasses: [],
  32999. messageSends: []
  33000. }),
  33001. $globals.AmdPackageTransport);
  33002. $core.addMethod(
  33003. $core.method({
  33004. selector: "printOn:",
  33005. protocol: "printing",
  33006. fn: function (aStream){
  33007. var self=this,$self=this;
  33008. return $core.withContext(function($ctx1) {
  33009. (
  33010. $ctx1.supercall = true,
  33011. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  33012. $ctx1.supercall = false;
  33013. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  33014. $ctx1.sendIdx["nextPutAll:"]=1;
  33015. $recv(aStream)._nextPutAll_($self._namespace());
  33016. $ctx1.sendIdx["nextPutAll:"]=2;
  33017. $recv(aStream)._nextPutAll_(")");
  33018. return self;
  33019. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  33020. },
  33021. args: ["aStream"],
  33022. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  33023. referencedClasses: [],
  33024. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  33025. }),
  33026. $globals.AmdPackageTransport);
  33027. $core.addMethod(
  33028. $core.method({
  33029. selector: "setPath:",
  33030. protocol: "actions",
  33031. fn: function (aString){
  33032. var self=this,$self=this;
  33033. return $core.withContext(function($ctx1) {
  33034. $recv($recv(require)._provided())._config_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([$self._namespace(),aString])]));
  33035. return self;
  33036. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  33037. },
  33038. args: ["aString"],
  33039. source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09require provided config: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
  33040. referencedClasses: [],
  33041. messageSends: ["config:", "provided", "namespace"]
  33042. }),
  33043. $globals.AmdPackageTransport);
  33044. $core.addMethod(
  33045. $core.method({
  33046. selector: "setupFromJson:",
  33047. protocol: "initialization",
  33048. fn: function (anObject){
  33049. var self=this,$self=this;
  33050. return $core.withContext(function($ctx1) {
  33051. $self._namespace_($recv(anObject)._at_("amdNamespace"));
  33052. return self;
  33053. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  33054. },
  33055. args: ["anObject"],
  33056. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  33057. referencedClasses: [],
  33058. messageSends: ["namespace:", "at:"]
  33059. }),
  33060. $globals.AmdPackageTransport);
  33061. $core.addMethod(
  33062. $core.method({
  33063. selector: "namespace:",
  33064. protocol: "instance creation",
  33065. fn: function (aString){
  33066. var self=this,$self=this;
  33067. return $core.withContext(function($ctx1) {
  33068. var $1;
  33069. $1=$self._new();
  33070. $recv($1)._namespace_(aString);
  33071. return $recv($1)._yourself();
  33072. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.a$cls)});
  33073. },
  33074. args: ["aString"],
  33075. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  33076. referencedClasses: [],
  33077. messageSends: ["namespace:", "new", "yourself"]
  33078. }),
  33079. $globals.AmdPackageTransport.a$cls);
  33080. $core.addMethod(
  33081. $core.method({
  33082. selector: "type",
  33083. protocol: "accessing",
  33084. fn: function (){
  33085. var self=this,$self=this;
  33086. return "amd";
  33087. },
  33088. args: [],
  33089. source: "type\x0a\x09^ 'amd'",
  33090. referencedClasses: [],
  33091. messageSends: []
  33092. }),
  33093. $globals.AmdPackageTransport.a$cls);
  33094. $core.addMethod(
  33095. $core.method({
  33096. selector: "exportBehaviorDefinitionTo:using:",
  33097. protocol: "*Platform-ImportExport",
  33098. fn: function (aStream,anExporter){
  33099. var self=this,$self=this;
  33100. return $core.withContext(function($ctx1) {
  33101. $recv(anExporter)._exportDefinitionOf_on_(self,aStream);
  33102. return self;
  33103. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Class)});
  33104. },
  33105. args: ["aStream", "anExporter"],
  33106. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportDefinitionOf: self on: aStream",
  33107. referencedClasses: [],
  33108. messageSends: ["exportDefinitionOf:on:"]
  33109. }),
  33110. $globals.Class);
  33111. $core.addMethod(
  33112. $core.method({
  33113. selector: "exportBehaviorDefinitionTo:using:",
  33114. protocol: "*Platform-ImportExport",
  33115. fn: function (aStream,anExporter){
  33116. var self=this,$self=this;
  33117. return $core.withContext(function($ctx1) {
  33118. $recv(anExporter)._exportMetaDefinitionOf_on_($self._instanceClass(),aStream);
  33119. return self;
  33120. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Metaclass)});
  33121. },
  33122. args: ["aStream", "anExporter"],
  33123. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportMetaDefinitionOf: self instanceClass on: aStream",
  33124. referencedClasses: [],
  33125. messageSends: ["exportMetaDefinitionOf:on:", "instanceClass"]
  33126. }),
  33127. $globals.Metaclass);
  33128. $core.addMethod(
  33129. $core.method({
  33130. selector: "commit",
  33131. protocol: "*Platform-ImportExport",
  33132. fn: function (){
  33133. var self=this,$self=this;
  33134. return $core.withContext(function($ctx1) {
  33135. return $recv($self._transport())._commit();
  33136. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  33137. },
  33138. args: [],
  33139. source: "commit\x0a\x09^ self transport commit",
  33140. referencedClasses: [],
  33141. messageSends: ["commit", "transport"]
  33142. }),
  33143. $globals.Package);
  33144. $core.addMethod(
  33145. $core.method({
  33146. selector: "load",
  33147. protocol: "*Platform-ImportExport",
  33148. fn: function (){
  33149. var self=this,$self=this;
  33150. return $core.withContext(function($ctx1) {
  33151. return $recv($self._transport())._load();
  33152. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  33153. },
  33154. args: [],
  33155. source: "load\x0a\x09^ self transport load",
  33156. referencedClasses: [],
  33157. messageSends: ["load", "transport"]
  33158. }),
  33159. $globals.Package);
  33160. $core.addMethod(
  33161. $core.method({
  33162. selector: "loadFromNamespace:",
  33163. protocol: "*Platform-ImportExport",
  33164. fn: function (aString){
  33165. var self=this,$self=this;
  33166. return $core.withContext(function($ctx1) {
  33167. var $1;
  33168. $1=$self._transport();
  33169. $recv($1)._namespace_(aString);
  33170. return $recv($1)._load();
  33171. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  33172. },
  33173. args: ["aString"],
  33174. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  33175. referencedClasses: [],
  33176. messageSends: ["namespace:", "transport", "load"]
  33177. }),
  33178. $globals.Package);
  33179. $core.addMethod(
  33180. $core.method({
  33181. selector: "load:",
  33182. protocol: "*Platform-ImportExport",
  33183. fn: function (aPackageName){
  33184. var self=this,$self=this;
  33185. return $core.withContext(function($ctx1) {
  33186. return $recv($self._named_(aPackageName))._load();
  33187. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  33188. },
  33189. args: ["aPackageName"],
  33190. source: "load: aPackageName\x0a\x09^ (self named: aPackageName) load",
  33191. referencedClasses: [],
  33192. messageSends: ["load", "named:"]
  33193. }),
  33194. $globals.Package.a$cls);
  33195. $core.addMethod(
  33196. $core.method({
  33197. selector: "load:fromNamespace:",
  33198. protocol: "*Platform-ImportExport",
  33199. fn: function (aPackageName,aString){
  33200. var self=this,$self=this;
  33201. return $core.withContext(function($ctx1) {
  33202. return $recv($self._named_(aPackageName))._loadFromNamespace_(aString);
  33203. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.a$cls)});
  33204. },
  33205. args: ["aPackageName", "aString"],
  33206. source: "load: aPackageName fromNamespace: aString\x0a\x09^ (self named: aPackageName) loadFromNamespace: aString",
  33207. referencedClasses: [],
  33208. messageSends: ["loadFromNamespace:", "named:"]
  33209. }),
  33210. $globals.Package.a$cls);
  33211. $core.addMethod(
  33212. $core.method({
  33213. selector: "methodsFor:",
  33214. protocol: "*Platform-ImportExport",
  33215. fn: function (aString){
  33216. var self=this,$self=this;
  33217. return $core.withContext(function($ctx1) {
  33218. var $1;
  33219. $1=$recv($globals.ClassProtocolReader)._new();
  33220. $recv($1)._class_category_(self,aString);
  33221. return $recv($1)._yourself();
  33222. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.TBehaviorProvider)});
  33223. },
  33224. args: ["aString"],
  33225. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  33226. referencedClasses: ["ClassProtocolReader"],
  33227. messageSends: ["class:category:", "new", "yourself"]
  33228. }),
  33229. $globals.TBehaviorProvider);
  33230. $core.addMethod(
  33231. $core.method({
  33232. selector: "methodsFor:stamp:",
  33233. protocol: "*Platform-ImportExport",
  33234. fn: function (aString,aStamp){
  33235. var self=this,$self=this;
  33236. return $core.withContext(function($ctx1) {
  33237. return $self._methodsFor_(aString);
  33238. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.TBehaviorProvider)});
  33239. },
  33240. args: ["aString", "aStamp"],
  33241. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  33242. referencedClasses: [],
  33243. messageSends: ["methodsFor:"]
  33244. }),
  33245. $globals.TBehaviorProvider);
  33246. $core.addMethod(
  33247. $core.method({
  33248. selector: "commentStamp",
  33249. protocol: "*Platform-ImportExport",
  33250. fn: function (){
  33251. var self=this,$self=this;
  33252. return $core.withContext(function($ctx1) {
  33253. var $1;
  33254. $1=$recv($globals.ClassCommentReader)._new();
  33255. $recv($1)._class_(self);
  33256. return $recv($1)._yourself();
  33257. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.TMasterBehavior)});
  33258. },
  33259. args: [],
  33260. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  33261. referencedClasses: ["ClassCommentReader"],
  33262. messageSends: ["class:", "new", "yourself"]
  33263. }),
  33264. $globals.TMasterBehavior);
  33265. $core.addMethod(
  33266. $core.method({
  33267. selector: "commentStamp:prior:",
  33268. protocol: "*Platform-ImportExport",
  33269. fn: function (aStamp,prior){
  33270. var self=this,$self=this;
  33271. return $core.withContext(function($ctx1) {
  33272. return $self._commentStamp();
  33273. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.TMasterBehavior)});
  33274. },
  33275. args: ["aStamp", "prior"],
  33276. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  33277. referencedClasses: [],
  33278. messageSends: ["commentStamp"]
  33279. }),
  33280. $globals.TMasterBehavior);
  33281. $core.addMethod(
  33282. $core.method({
  33283. selector: "exportBehaviorDefinitionTo:using:",
  33284. protocol: "*Platform-ImportExport",
  33285. fn: function (aStream,anExporter){
  33286. var self=this,$self=this;
  33287. return $core.withContext(function($ctx1) {
  33288. $recv(anExporter)._exportTraitDefinitionOf_on_(self,aStream);
  33289. return self;
  33290. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Trait)});
  33291. },
  33292. args: ["aStream", "anExporter"],
  33293. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportTraitDefinitionOf: self on: aStream",
  33294. referencedClasses: [],
  33295. messageSends: ["exportTraitDefinitionOf:on:"]
  33296. }),
  33297. $globals.Trait);
  33298. });
  33299. define('amber_core/Compiler-AST',["amber/boot", "amber_core/Kernel-Dag", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Methods"], function($boot){"use strict";
  33300. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  33301. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  33302. var $pkg = $core.addPackage("Compiler-AST");
  33303. $pkg.innerEval = function (expr) { return eval(expr); };
  33304. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  33305. $core.addClass("ASTNode", $globals.DagParentNode, ["parent", "position", "source", "shouldBeAliased"], "Compiler-AST");
  33306. $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.";
  33307. $core.addMethod(
  33308. $core.method({
  33309. selector: "inPosition:",
  33310. protocol: "testing",
  33311. fn: function (aPoint){
  33312. var self=this,$self=this;
  33313. return $core.withContext(function($ctx1) {
  33314. return $recv($recv($self._positionStart()).__lt_eq(aPoint))._and_((function(){
  33315. return $core.withContext(function($ctx2) {
  33316. return $recv($self._positionEnd()).__gt_eq(aPoint);
  33317. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33318. }));
  33319. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.ASTNode)});
  33320. },
  33321. args: ["aPoint"],
  33322. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  33323. referencedClasses: [],
  33324. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  33325. }),
  33326. $globals.ASTNode);
  33327. $core.addMethod(
  33328. $core.method({
  33329. selector: "isAssignmentNode",
  33330. protocol: "testing",
  33331. fn: function (){
  33332. var self=this,$self=this;
  33333. return false;
  33334. },
  33335. args: [],
  33336. source: "isAssignmentNode\x0a\x09^ false",
  33337. referencedClasses: [],
  33338. messageSends: []
  33339. }),
  33340. $globals.ASTNode);
  33341. $core.addMethod(
  33342. $core.method({
  33343. selector: "isBlockNode",
  33344. protocol: "testing",
  33345. fn: function (){
  33346. var self=this,$self=this;
  33347. return false;
  33348. },
  33349. args: [],
  33350. source: "isBlockNode\x0a\x09^ false",
  33351. referencedClasses: [],
  33352. messageSends: []
  33353. }),
  33354. $globals.ASTNode);
  33355. $core.addMethod(
  33356. $core.method({
  33357. selector: "isBlockSequenceNode",
  33358. protocol: "testing",
  33359. fn: function (){
  33360. var self=this,$self=this;
  33361. return false;
  33362. },
  33363. args: [],
  33364. source: "isBlockSequenceNode\x0a\x09^ false",
  33365. referencedClasses: [],
  33366. messageSends: []
  33367. }),
  33368. $globals.ASTNode);
  33369. $core.addMethod(
  33370. $core.method({
  33371. selector: "isCascadeNode",
  33372. protocol: "testing",
  33373. fn: function (){
  33374. var self=this,$self=this;
  33375. return false;
  33376. },
  33377. args: [],
  33378. source: "isCascadeNode\x0a\x09^ false",
  33379. referencedClasses: [],
  33380. messageSends: []
  33381. }),
  33382. $globals.ASTNode);
  33383. $core.addMethod(
  33384. $core.method({
  33385. selector: "isImmutable",
  33386. protocol: "testing",
  33387. fn: function (){
  33388. var self=this,$self=this;
  33389. return false;
  33390. },
  33391. args: [],
  33392. source: "isImmutable\x0a\x09^ false",
  33393. referencedClasses: [],
  33394. messageSends: []
  33395. }),
  33396. $globals.ASTNode);
  33397. $core.addMethod(
  33398. $core.method({
  33399. selector: "isJSStatementNode",
  33400. protocol: "testing",
  33401. fn: function (){
  33402. var self=this,$self=this;
  33403. return false;
  33404. },
  33405. args: [],
  33406. source: "isJSStatementNode\x0a\x09^ false",
  33407. referencedClasses: [],
  33408. messageSends: []
  33409. }),
  33410. $globals.ASTNode);
  33411. $core.addMethod(
  33412. $core.method({
  33413. selector: "isNavigationNode",
  33414. protocol: "testing",
  33415. fn: function (){
  33416. var self=this,$self=this;
  33417. return false;
  33418. },
  33419. args: [],
  33420. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  33421. referencedClasses: [],
  33422. messageSends: []
  33423. }),
  33424. $globals.ASTNode);
  33425. $core.addMethod(
  33426. $core.method({
  33427. selector: "isReturnNode",
  33428. protocol: "testing",
  33429. fn: function (){
  33430. var self=this,$self=this;
  33431. return false;
  33432. },
  33433. args: [],
  33434. source: "isReturnNode\x0a\x09^ false",
  33435. referencedClasses: [],
  33436. messageSends: []
  33437. }),
  33438. $globals.ASTNode);
  33439. $core.addMethod(
  33440. $core.method({
  33441. selector: "isSendNode",
  33442. protocol: "testing",
  33443. fn: function (){
  33444. var self=this,$self=this;
  33445. return false;
  33446. },
  33447. args: [],
  33448. source: "isSendNode\x0a\x09^ false",
  33449. referencedClasses: [],
  33450. messageSends: []
  33451. }),
  33452. $globals.ASTNode);
  33453. $core.addMethod(
  33454. $core.method({
  33455. selector: "isSequenceNode",
  33456. protocol: "testing",
  33457. fn: function (){
  33458. var self=this,$self=this;
  33459. return false;
  33460. },
  33461. args: [],
  33462. source: "isSequenceNode\x0a\x09^ false",
  33463. referencedClasses: [],
  33464. messageSends: []
  33465. }),
  33466. $globals.ASTNode);
  33467. $core.addMethod(
  33468. $core.method({
  33469. selector: "isSuperKeyword",
  33470. protocol: "testing",
  33471. fn: function (){
  33472. var self=this,$self=this;
  33473. return false;
  33474. },
  33475. args: [],
  33476. source: "isSuperKeyword\x0a\x09^ false",
  33477. referencedClasses: [],
  33478. messageSends: []
  33479. }),
  33480. $globals.ASTNode);
  33481. $core.addMethod(
  33482. $core.method({
  33483. selector: "isValueNode",
  33484. protocol: "testing",
  33485. fn: function (){
  33486. var self=this,$self=this;
  33487. return false;
  33488. },
  33489. args: [],
  33490. source: "isValueNode\x0a\x09^ false",
  33491. referencedClasses: [],
  33492. messageSends: []
  33493. }),
  33494. $globals.ASTNode);
  33495. $core.addMethod(
  33496. $core.method({
  33497. selector: "isVariableNode",
  33498. protocol: "testing",
  33499. fn: function (){
  33500. var self=this,$self=this;
  33501. return false;
  33502. },
  33503. args: [],
  33504. source: "isVariableNode\x0a\x09^ false",
  33505. referencedClasses: [],
  33506. messageSends: []
  33507. }),
  33508. $globals.ASTNode);
  33509. $core.addMethod(
  33510. $core.method({
  33511. selector: "location:",
  33512. protocol: "accessing",
  33513. fn: function (aLocation){
  33514. var self=this,$self=this;
  33515. return $core.withContext(function($ctx1) {
  33516. var $3,$2,$1;
  33517. $3=$recv(aLocation)._start();
  33518. $ctx1.sendIdx["start"]=1;
  33519. $2=$recv($3)._line();
  33520. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  33521. $self._position_($1);
  33522. return self;
  33523. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.ASTNode)});
  33524. },
  33525. args: ["aLocation"],
  33526. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  33527. referencedClasses: [],
  33528. messageSends: ["position:", "@", "line", "start", "column"]
  33529. }),
  33530. $globals.ASTNode);
  33531. $core.addMethod(
  33532. $core.method({
  33533. selector: "method",
  33534. protocol: "accessing",
  33535. fn: function (){
  33536. var self=this,$self=this;
  33537. return $core.withContext(function($ctx1) {
  33538. var $1,$receiver;
  33539. $1=$self._parent();
  33540. if(($receiver = $1) == null || $receiver.a$nil){
  33541. return $1;
  33542. } else {
  33543. var node;
  33544. node=$receiver;
  33545. return $recv(node)._method();
  33546. }
  33547. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTNode)});
  33548. },
  33549. args: [],
  33550. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  33551. referencedClasses: [],
  33552. messageSends: ["ifNotNil:", "parent", "method"]
  33553. }),
  33554. $globals.ASTNode);
  33555. $core.addMethod(
  33556. $core.method({
  33557. selector: "navigationNodeAt:ifAbsent:",
  33558. protocol: "accessing",
  33559. fn: function (aPoint,aBlock){
  33560. var self=this,$self=this;
  33561. var children;
  33562. return $core.withContext(function($ctx1) {
  33563. var $2,$1;
  33564. var $early={};
  33565. try {
  33566. children=$recv($self._allDagChildren())._select_((function(each){
  33567. return $core.withContext(function($ctx2) {
  33568. return $recv($recv(each)._isNavigationNode())._and_((function(){
  33569. return $core.withContext(function($ctx3) {
  33570. return $recv(each)._inPosition_(aPoint);
  33571. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33572. }));
  33573. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33574. }));
  33575. $recv(children)._ifEmpty_((function(){
  33576. return $core.withContext(function($ctx2) {
  33577. throw $early=[$recv(aBlock)._value()];
  33578. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  33579. }));
  33580. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  33581. return $core.withContext(function($ctx2) {
  33582. $2=$recv(a)._positionStart();
  33583. $ctx2.sendIdx["positionStart"]=1;
  33584. $1=$recv($2)._dist_(aPoint);
  33585. $ctx2.sendIdx["dist:"]=1;
  33586. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  33587. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  33588. })))._first();
  33589. }
  33590. catch(e) {if(e===$early)return e[0]; throw e}
  33591. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.ASTNode)});
  33592. },
  33593. args: ["aPoint", "aBlock"],
  33594. 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",
  33595. referencedClasses: [],
  33596. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  33597. }),
  33598. $globals.ASTNode);
  33599. $core.addMethod(
  33600. $core.method({
  33601. selector: "parent",
  33602. protocol: "accessing",
  33603. fn: function (){
  33604. var self=this,$self=this;
  33605. return $self["@parent"];
  33606. },
  33607. args: [],
  33608. source: "parent\x0a\x09^ parent",
  33609. referencedClasses: [],
  33610. messageSends: []
  33611. }),
  33612. $globals.ASTNode);
  33613. $core.addMethod(
  33614. $core.method({
  33615. selector: "parent:",
  33616. protocol: "accessing",
  33617. fn: function (aNode){
  33618. var self=this,$self=this;
  33619. $self["@parent"]=aNode;
  33620. return self;
  33621. },
  33622. args: ["aNode"],
  33623. source: "parent: aNode\x0a\x09parent := aNode",
  33624. referencedClasses: [],
  33625. messageSends: []
  33626. }),
  33627. $globals.ASTNode);
  33628. $core.addMethod(
  33629. $core.method({
  33630. selector: "position",
  33631. protocol: "accessing",
  33632. fn: function (){
  33633. var self=this,$self=this;
  33634. return $core.withContext(function($ctx1) {
  33635. var $1,$2,$receiver;
  33636. $1=$self["@position"];
  33637. if(($receiver = $1) == null || $receiver.a$nil){
  33638. $2=$self._parent();
  33639. if(($receiver = $2) == null || $receiver.a$nil){
  33640. return $2;
  33641. } else {
  33642. var node;
  33643. node=$receiver;
  33644. return $recv(node)._position();
  33645. }
  33646. } else {
  33647. return $1;
  33648. }
  33649. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.ASTNode)});
  33650. },
  33651. args: [],
  33652. 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 ] ]",
  33653. referencedClasses: [],
  33654. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  33655. }),
  33656. $globals.ASTNode);
  33657. $core.addMethod(
  33658. $core.method({
  33659. selector: "position:",
  33660. protocol: "accessing",
  33661. fn: function (aPosition){
  33662. var self=this,$self=this;
  33663. $self["@position"]=aPosition;
  33664. return self;
  33665. },
  33666. args: ["aPosition"],
  33667. source: "position: aPosition\x0a\x09position := aPosition",
  33668. referencedClasses: [],
  33669. messageSends: []
  33670. }),
  33671. $globals.ASTNode);
  33672. $core.addMethod(
  33673. $core.method({
  33674. selector: "positionEnd",
  33675. protocol: "accessing",
  33676. fn: function (){
  33677. var self=this,$self=this;
  33678. return $core.withContext(function($ctx1) {
  33679. var $1,$6,$5,$4,$3,$2;
  33680. $1=$self._positionStart();
  33681. $6=$self._source();
  33682. $ctx1.sendIdx["source"]=1;
  33683. $5=$recv($6)._lines();
  33684. $ctx1.sendIdx["lines"]=1;
  33685. $4=$recv($5)._size();
  33686. $ctx1.sendIdx["size"]=1;
  33687. $3=$recv($4).__minus((1));
  33688. $ctx1.sendIdx["-"]=1;
  33689. $2=$recv($3).__at($recv($recv($recv($recv($self._source())._lines())._last())._size()).__minus((1)));
  33690. return $recv($1).__plus($2);
  33691. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.ASTNode)});
  33692. },
  33693. args: [],
  33694. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  33695. referencedClasses: [],
  33696. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  33697. }),
  33698. $globals.ASTNode);
  33699. $core.addMethod(
  33700. $core.method({
  33701. selector: "positionStart",
  33702. protocol: "accessing",
  33703. fn: function (){
  33704. var self=this,$self=this;
  33705. return $core.withContext(function($ctx1) {
  33706. return $self._position();
  33707. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.ASTNode)});
  33708. },
  33709. args: [],
  33710. source: "positionStart\x0a\x09^ self position",
  33711. referencedClasses: [],
  33712. messageSends: ["position"]
  33713. }),
  33714. $globals.ASTNode);
  33715. $core.addMethod(
  33716. $core.method({
  33717. selector: "requiresSmalltalkContext",
  33718. protocol: "testing",
  33719. fn: function (){
  33720. var self=this,$self=this;
  33721. return $core.withContext(function($ctx1) {
  33722. return $recv($recv($self._dagChildren())._detect_ifNone_((function(each){
  33723. return $core.withContext(function($ctx2) {
  33724. return $recv(each)._requiresSmalltalkContext();
  33725. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33726. }),(function(){
  33727. return nil;
  33728. })))._notNil();
  33729. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.ASTNode)});
  33730. },
  33731. args: [],
  33732. 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",
  33733. referencedClasses: [],
  33734. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  33735. }),
  33736. $globals.ASTNode);
  33737. $core.addMethod(
  33738. $core.method({
  33739. selector: "shouldBeAliased",
  33740. protocol: "accessing",
  33741. fn: function (){
  33742. var self=this,$self=this;
  33743. return $core.withContext(function($ctx1) {
  33744. var $1,$receiver;
  33745. $1=$self["@shouldBeAliased"];
  33746. if(($receiver = $1) == null || $receiver.a$nil){
  33747. return false;
  33748. } else {
  33749. return $1;
  33750. }
  33751. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.ASTNode)});
  33752. },
  33753. args: [],
  33754. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  33755. referencedClasses: [],
  33756. messageSends: ["ifNil:"]
  33757. }),
  33758. $globals.ASTNode);
  33759. $core.addMethod(
  33760. $core.method({
  33761. selector: "shouldBeAliased:",
  33762. protocol: "accessing",
  33763. fn: function (aBoolean){
  33764. var self=this,$self=this;
  33765. $self["@shouldBeAliased"]=aBoolean;
  33766. return self;
  33767. },
  33768. args: ["aBoolean"],
  33769. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  33770. referencedClasses: [],
  33771. messageSends: []
  33772. }),
  33773. $globals.ASTNode);
  33774. $core.addMethod(
  33775. $core.method({
  33776. selector: "size",
  33777. protocol: "accessing",
  33778. fn: function (){
  33779. var self=this,$self=this;
  33780. return $core.withContext(function($ctx1) {
  33781. return $recv($self._source())._size();
  33782. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.ASTNode)});
  33783. },
  33784. args: [],
  33785. source: "size\x0a\x09^ self source size",
  33786. referencedClasses: [],
  33787. messageSends: ["size", "source"]
  33788. }),
  33789. $globals.ASTNode);
  33790. $core.addMethod(
  33791. $core.method({
  33792. selector: "source",
  33793. protocol: "accessing",
  33794. fn: function (){
  33795. var self=this,$self=this;
  33796. return $core.withContext(function($ctx1) {
  33797. var $1,$receiver;
  33798. $1=$self["@source"];
  33799. if(($receiver = $1) == null || $receiver.a$nil){
  33800. return "";
  33801. } else {
  33802. return $1;
  33803. }
  33804. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.ASTNode)});
  33805. },
  33806. args: [],
  33807. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33808. referencedClasses: [],
  33809. messageSends: ["ifNil:"]
  33810. }),
  33811. $globals.ASTNode);
  33812. $core.addMethod(
  33813. $core.method({
  33814. selector: "source:",
  33815. protocol: "accessing",
  33816. fn: function (aString){
  33817. var self=this,$self=this;
  33818. $self["@source"]=aString;
  33819. return self;
  33820. },
  33821. args: ["aString"],
  33822. source: "source: aString\x0a\x09source := aString",
  33823. referencedClasses: [],
  33824. messageSends: []
  33825. }),
  33826. $globals.ASTNode);
  33827. $core.addMethod(
  33828. $core.method({
  33829. selector: "withTail:",
  33830. protocol: "building",
  33831. fn: function (aCollection){
  33832. var self=this,$self=this;
  33833. return $core.withContext(function($ctx1) {
  33834. var $1;
  33835. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  33836. return $core.withContext(function($ctx2) {
  33837. $1=$recv($globals.SendNode)._new();
  33838. $recv($1)._position_($recv(send)._position());
  33839. $recv($1)._source_($recv(send)._source());
  33840. $recv($1)._receiver_(receiver);
  33841. $recv($1)._selector_($recv(send)._selector());
  33842. $recv($1)._arguments_($recv(send)._arguments());
  33843. return $recv($1)._yourself();
  33844. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  33845. }));
  33846. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection},$globals.ASTNode)});
  33847. },
  33848. args: ["aCollection"],
  33849. 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 ]",
  33850. referencedClasses: ["SendNode"],
  33851. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  33852. }),
  33853. $globals.ASTNode);
  33854. $core.addClass("AssignmentNode", $globals.ASTNode, ["left", "right"], "Compiler-AST");
  33855. $globals.AssignmentNode.comment="I represent an assignment node.";
  33856. $core.addMethod(
  33857. $core.method({
  33858. selector: "acceptDagVisitor:",
  33859. protocol: "visiting",
  33860. fn: function (aVisitor){
  33861. var self=this,$self=this;
  33862. return $core.withContext(function($ctx1) {
  33863. return $recv(aVisitor)._visitAssignmentNode_(self);
  33864. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  33865. },
  33866. args: ["aVisitor"],
  33867. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  33868. referencedClasses: [],
  33869. messageSends: ["visitAssignmentNode:"]
  33870. }),
  33871. $globals.AssignmentNode);
  33872. $core.addMethod(
  33873. $core.method({
  33874. selector: "dagChildren",
  33875. protocol: "accessing",
  33876. fn: function (){
  33877. var self=this,$self=this;
  33878. return $core.withContext(function($ctx1) {
  33879. return $recv($globals.Array)._with_with_($self._left(),$self._right());
  33880. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.AssignmentNode)});
  33881. },
  33882. args: [],
  33883. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  33884. referencedClasses: ["Array"],
  33885. messageSends: ["with:with:", "left", "right"]
  33886. }),
  33887. $globals.AssignmentNode);
  33888. $core.addMethod(
  33889. $core.method({
  33890. selector: "isAssignmentNode",
  33891. protocol: "testing",
  33892. fn: function (){
  33893. var self=this,$self=this;
  33894. return true;
  33895. },
  33896. args: [],
  33897. source: "isAssignmentNode\x0a\x09^ true",
  33898. referencedClasses: [],
  33899. messageSends: []
  33900. }),
  33901. $globals.AssignmentNode);
  33902. $core.addMethod(
  33903. $core.method({
  33904. selector: "left",
  33905. protocol: "accessing",
  33906. fn: function (){
  33907. var self=this,$self=this;
  33908. return $self["@left"];
  33909. },
  33910. args: [],
  33911. source: "left\x0a\x09^ left",
  33912. referencedClasses: [],
  33913. messageSends: []
  33914. }),
  33915. $globals.AssignmentNode);
  33916. $core.addMethod(
  33917. $core.method({
  33918. selector: "left:",
  33919. protocol: "accessing",
  33920. fn: function (aNode){
  33921. var self=this,$self=this;
  33922. $self["@left"]=aNode;
  33923. return self;
  33924. },
  33925. args: ["aNode"],
  33926. source: "left: aNode\x0a\x09left := aNode",
  33927. referencedClasses: [],
  33928. messageSends: []
  33929. }),
  33930. $globals.AssignmentNode);
  33931. $core.addMethod(
  33932. $core.method({
  33933. selector: "right",
  33934. protocol: "accessing",
  33935. fn: function (){
  33936. var self=this,$self=this;
  33937. return $self["@right"];
  33938. },
  33939. args: [],
  33940. source: "right\x0a\x09^ right",
  33941. referencedClasses: [],
  33942. messageSends: []
  33943. }),
  33944. $globals.AssignmentNode);
  33945. $core.addMethod(
  33946. $core.method({
  33947. selector: "right:",
  33948. protocol: "accessing",
  33949. fn: function (aNode){
  33950. var self=this,$self=this;
  33951. $self["@right"]=aNode;
  33952. return self;
  33953. },
  33954. args: ["aNode"],
  33955. source: "right: aNode\x0a\x09right := aNode",
  33956. referencedClasses: [],
  33957. messageSends: []
  33958. }),
  33959. $globals.AssignmentNode);
  33960. $core.addClass("BlockNode", $globals.ASTNode, ["parameters", "scope"], "Compiler-AST");
  33961. $globals.BlockNode.comment="I represent an block closure node.";
  33962. $core.addMethod(
  33963. $core.method({
  33964. selector: "acceptDagVisitor:",
  33965. protocol: "visiting",
  33966. fn: function (aVisitor){
  33967. var self=this,$self=this;
  33968. return $core.withContext(function($ctx1) {
  33969. return $recv(aVisitor)._visitBlockNode_(self);
  33970. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockNode)});
  33971. },
  33972. args: ["aVisitor"],
  33973. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  33974. referencedClasses: [],
  33975. messageSends: ["visitBlockNode:"]
  33976. }),
  33977. $globals.BlockNode);
  33978. $core.addMethod(
  33979. $core.method({
  33980. selector: "isBlockNode",
  33981. protocol: "testing",
  33982. fn: function (){
  33983. var self=this,$self=this;
  33984. return true;
  33985. },
  33986. args: [],
  33987. source: "isBlockNode\x0a\x09^ true",
  33988. referencedClasses: [],
  33989. messageSends: []
  33990. }),
  33991. $globals.BlockNode);
  33992. $core.addMethod(
  33993. $core.method({
  33994. selector: "parameters",
  33995. protocol: "accessing",
  33996. fn: function (){
  33997. var self=this,$self=this;
  33998. return $core.withContext(function($ctx1) {
  33999. var $1,$receiver;
  34000. $1=$self["@parameters"];
  34001. if(($receiver = $1) == null || $receiver.a$nil){
  34002. $self["@parameters"]=$recv($globals.Array)._new();
  34003. return $self["@parameters"];
  34004. } else {
  34005. return $1;
  34006. }
  34007. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  34008. },
  34009. args: [],
  34010. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  34011. referencedClasses: ["Array"],
  34012. messageSends: ["ifNil:", "new"]
  34013. }),
  34014. $globals.BlockNode);
  34015. $core.addMethod(
  34016. $core.method({
  34017. selector: "parameters:",
  34018. protocol: "accessing",
  34019. fn: function (aCollection){
  34020. var self=this,$self=this;
  34021. $self["@parameters"]=aCollection;
  34022. return self;
  34023. },
  34024. args: ["aCollection"],
  34025. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  34026. referencedClasses: [],
  34027. messageSends: []
  34028. }),
  34029. $globals.BlockNode);
  34030. $core.addMethod(
  34031. $core.method({
  34032. selector: "scope",
  34033. protocol: "accessing",
  34034. fn: function (){
  34035. var self=this,$self=this;
  34036. return $self["@scope"];
  34037. },
  34038. args: [],
  34039. source: "scope\x0a\x09^ scope",
  34040. referencedClasses: [],
  34041. messageSends: []
  34042. }),
  34043. $globals.BlockNode);
  34044. $core.addMethod(
  34045. $core.method({
  34046. selector: "scope:",
  34047. protocol: "accessing",
  34048. fn: function (aLexicalScope){
  34049. var self=this,$self=this;
  34050. $self["@scope"]=aLexicalScope;
  34051. return self;
  34052. },
  34053. args: ["aLexicalScope"],
  34054. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34055. referencedClasses: [],
  34056. messageSends: []
  34057. }),
  34058. $globals.BlockNode);
  34059. $core.addClass("CascadeNode", $globals.ASTNode, ["receiver"], "Compiler-AST");
  34060. $globals.CascadeNode.comment="I represent an cascade node.";
  34061. $core.addMethod(
  34062. $core.method({
  34063. selector: "acceptDagVisitor:",
  34064. protocol: "visiting",
  34065. fn: function (aVisitor){
  34066. var self=this,$self=this;
  34067. return $core.withContext(function($ctx1) {
  34068. return $recv(aVisitor)._visitCascadeNode_(self);
  34069. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.CascadeNode)});
  34070. },
  34071. args: ["aVisitor"],
  34072. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  34073. referencedClasses: [],
  34074. messageSends: ["visitCascadeNode:"]
  34075. }),
  34076. $globals.CascadeNode);
  34077. $core.addMethod(
  34078. $core.method({
  34079. selector: "isCascadeNode",
  34080. protocol: "testing",
  34081. fn: function (){
  34082. var self=this,$self=this;
  34083. return true;
  34084. },
  34085. args: [],
  34086. source: "isCascadeNode\x0a\x09^ true",
  34087. referencedClasses: [],
  34088. messageSends: []
  34089. }),
  34090. $globals.CascadeNode);
  34091. $core.addMethod(
  34092. $core.method({
  34093. selector: "receiver",
  34094. protocol: "accessing",
  34095. fn: function (){
  34096. var self=this,$self=this;
  34097. return $self["@receiver"];
  34098. },
  34099. args: [],
  34100. source: "receiver\x0a\x09^ receiver",
  34101. referencedClasses: [],
  34102. messageSends: []
  34103. }),
  34104. $globals.CascadeNode);
  34105. $core.addMethod(
  34106. $core.method({
  34107. selector: "receiver:",
  34108. protocol: "accessing",
  34109. fn: function (aNode){
  34110. var self=this,$self=this;
  34111. $self["@receiver"]=aNode;
  34112. return self;
  34113. },
  34114. args: ["aNode"],
  34115. source: "receiver: aNode\x0a\x09receiver := aNode",
  34116. referencedClasses: [],
  34117. messageSends: []
  34118. }),
  34119. $globals.CascadeNode);
  34120. $core.addClass("DynamicArrayNode", $globals.ASTNode, [], "Compiler-AST");
  34121. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  34122. $core.addMethod(
  34123. $core.method({
  34124. selector: "acceptDagVisitor:",
  34125. protocol: "visiting",
  34126. fn: function (aVisitor){
  34127. var self=this,$self=this;
  34128. return $core.withContext(function($ctx1) {
  34129. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  34130. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  34131. },
  34132. args: ["aVisitor"],
  34133. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  34134. referencedClasses: [],
  34135. messageSends: ["visitDynamicArrayNode:"]
  34136. }),
  34137. $globals.DynamicArrayNode);
  34138. $core.addClass("DynamicDictionaryNode", $globals.ASTNode, [], "Compiler-AST");
  34139. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  34140. $core.addMethod(
  34141. $core.method({
  34142. selector: "acceptDagVisitor:",
  34143. protocol: "visiting",
  34144. fn: function (aVisitor){
  34145. var self=this,$self=this;
  34146. return $core.withContext(function($ctx1) {
  34147. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  34148. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  34149. },
  34150. args: ["aVisitor"],
  34151. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  34152. referencedClasses: [],
  34153. messageSends: ["visitDynamicDictionaryNode:"]
  34154. }),
  34155. $globals.DynamicDictionaryNode);
  34156. $core.addClass("JSStatementNode", $globals.ASTNode, [], "Compiler-AST");
  34157. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  34158. $core.addMethod(
  34159. $core.method({
  34160. selector: "acceptDagVisitor:",
  34161. protocol: "visiting",
  34162. fn: function (aVisitor){
  34163. var self=this,$self=this;
  34164. return $core.withContext(function($ctx1) {
  34165. return $recv(aVisitor)._visitJSStatementNode_(self);
  34166. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  34167. },
  34168. args: ["aVisitor"],
  34169. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  34170. referencedClasses: [],
  34171. messageSends: ["visitJSStatementNode:"]
  34172. }),
  34173. $globals.JSStatementNode);
  34174. $core.addMethod(
  34175. $core.method({
  34176. selector: "isJSStatementNode",
  34177. protocol: "testing",
  34178. fn: function (){
  34179. var self=this,$self=this;
  34180. return true;
  34181. },
  34182. args: [],
  34183. source: "isJSStatementNode\x0a\x09^ true",
  34184. referencedClasses: [],
  34185. messageSends: []
  34186. }),
  34187. $globals.JSStatementNode);
  34188. $core.addMethod(
  34189. $core.method({
  34190. selector: "requiresSmalltalkContext",
  34191. protocol: "testing",
  34192. fn: function (){
  34193. var self=this,$self=this;
  34194. return true;
  34195. },
  34196. args: [],
  34197. source: "requiresSmalltalkContext\x0a\x09^ true",
  34198. referencedClasses: [],
  34199. messageSends: []
  34200. }),
  34201. $globals.JSStatementNode);
  34202. $core.addClass("MethodNode", $globals.ASTNode, ["selector", "arguments", "source", "scope", "classReferences", "sendIndexes"], "Compiler-AST");
  34203. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  34204. $core.addMethod(
  34205. $core.method({
  34206. selector: "acceptDagVisitor:",
  34207. protocol: "visiting",
  34208. fn: function (aVisitor){
  34209. var self=this,$self=this;
  34210. return $core.withContext(function($ctx1) {
  34211. return $recv(aVisitor)._visitMethodNode_(self);
  34212. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.MethodNode)});
  34213. },
  34214. args: ["aVisitor"],
  34215. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  34216. referencedClasses: [],
  34217. messageSends: ["visitMethodNode:"]
  34218. }),
  34219. $globals.MethodNode);
  34220. $core.addMethod(
  34221. $core.method({
  34222. selector: "arguments",
  34223. protocol: "accessing",
  34224. fn: function (){
  34225. var self=this,$self=this;
  34226. return $core.withContext(function($ctx1) {
  34227. var $1,$receiver;
  34228. $1=$self["@arguments"];
  34229. if(($receiver = $1) == null || $receiver.a$nil){
  34230. return [];
  34231. } else {
  34232. return $1;
  34233. }
  34234. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  34235. },
  34236. args: [],
  34237. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  34238. referencedClasses: [],
  34239. messageSends: ["ifNil:"]
  34240. }),
  34241. $globals.MethodNode);
  34242. $core.addMethod(
  34243. $core.method({
  34244. selector: "arguments:",
  34245. protocol: "accessing",
  34246. fn: function (aCollection){
  34247. var self=this,$self=this;
  34248. $self["@arguments"]=aCollection;
  34249. return self;
  34250. },
  34251. args: ["aCollection"],
  34252. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34253. referencedClasses: [],
  34254. messageSends: []
  34255. }),
  34256. $globals.MethodNode);
  34257. $core.addMethod(
  34258. $core.method({
  34259. selector: "classReferences",
  34260. protocol: "accessing",
  34261. fn: function (){
  34262. var self=this,$self=this;
  34263. return $self["@classReferences"];
  34264. },
  34265. args: [],
  34266. source: "classReferences\x0a\x09^ classReferences",
  34267. referencedClasses: [],
  34268. messageSends: []
  34269. }),
  34270. $globals.MethodNode);
  34271. $core.addMethod(
  34272. $core.method({
  34273. selector: "classReferences:",
  34274. protocol: "accessing",
  34275. fn: function (aCollection){
  34276. var self=this,$self=this;
  34277. $self["@classReferences"]=aCollection;
  34278. return self;
  34279. },
  34280. args: ["aCollection"],
  34281. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  34282. referencedClasses: [],
  34283. messageSends: []
  34284. }),
  34285. $globals.MethodNode);
  34286. $core.addMethod(
  34287. $core.method({
  34288. selector: "messageSends",
  34289. protocol: "accessing",
  34290. fn: function (){
  34291. var self=this,$self=this;
  34292. return $core.withContext(function($ctx1) {
  34293. return $recv($self._sendIndexes())._keys();
  34294. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  34295. },
  34296. args: [],
  34297. source: "messageSends\x0a\x09^ self sendIndexes keys",
  34298. referencedClasses: [],
  34299. messageSends: ["keys", "sendIndexes"]
  34300. }),
  34301. $globals.MethodNode);
  34302. $core.addMethod(
  34303. $core.method({
  34304. selector: "method",
  34305. protocol: "accessing",
  34306. fn: function (){
  34307. var self=this,$self=this;
  34308. return self;
  34309. },
  34310. args: [],
  34311. source: "method\x0a\x09^ self",
  34312. referencedClasses: [],
  34313. messageSends: []
  34314. }),
  34315. $globals.MethodNode);
  34316. $core.addMethod(
  34317. $core.method({
  34318. selector: "scope",
  34319. protocol: "accessing",
  34320. fn: function (){
  34321. var self=this,$self=this;
  34322. return $self["@scope"];
  34323. },
  34324. args: [],
  34325. source: "scope\x0a\x09^ scope",
  34326. referencedClasses: [],
  34327. messageSends: []
  34328. }),
  34329. $globals.MethodNode);
  34330. $core.addMethod(
  34331. $core.method({
  34332. selector: "scope:",
  34333. protocol: "accessing",
  34334. fn: function (aMethodScope){
  34335. var self=this,$self=this;
  34336. $self["@scope"]=aMethodScope;
  34337. return self;
  34338. },
  34339. args: ["aMethodScope"],
  34340. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  34341. referencedClasses: [],
  34342. messageSends: []
  34343. }),
  34344. $globals.MethodNode);
  34345. $core.addMethod(
  34346. $core.method({
  34347. selector: "selector",
  34348. protocol: "accessing",
  34349. fn: function (){
  34350. var self=this,$self=this;
  34351. return $self["@selector"];
  34352. },
  34353. args: [],
  34354. source: "selector\x0a\x09^ selector",
  34355. referencedClasses: [],
  34356. messageSends: []
  34357. }),
  34358. $globals.MethodNode);
  34359. $core.addMethod(
  34360. $core.method({
  34361. selector: "selector:",
  34362. protocol: "accessing",
  34363. fn: function (aString){
  34364. var self=this,$self=this;
  34365. $self["@selector"]=aString;
  34366. return self;
  34367. },
  34368. args: ["aString"],
  34369. source: "selector: aString\x0a\x09selector := aString",
  34370. referencedClasses: [],
  34371. messageSends: []
  34372. }),
  34373. $globals.MethodNode);
  34374. $core.addMethod(
  34375. $core.method({
  34376. selector: "sendIndexes",
  34377. protocol: "accessing",
  34378. fn: function (){
  34379. var self=this,$self=this;
  34380. return $self["@sendIndexes"];
  34381. },
  34382. args: [],
  34383. source: "sendIndexes\x0a\x09^ sendIndexes",
  34384. referencedClasses: [],
  34385. messageSends: []
  34386. }),
  34387. $globals.MethodNode);
  34388. $core.addMethod(
  34389. $core.method({
  34390. selector: "sendIndexes:",
  34391. protocol: "accessing",
  34392. fn: function (aDictionary){
  34393. var self=this,$self=this;
  34394. $self["@sendIndexes"]=aDictionary;
  34395. return self;
  34396. },
  34397. args: ["aDictionary"],
  34398. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  34399. referencedClasses: [],
  34400. messageSends: []
  34401. }),
  34402. $globals.MethodNode);
  34403. $core.addMethod(
  34404. $core.method({
  34405. selector: "sequenceNode",
  34406. protocol: "accessing",
  34407. fn: function (){
  34408. var self=this,$self=this;
  34409. return $core.withContext(function($ctx1) {
  34410. var $1;
  34411. var $early={};
  34412. try {
  34413. $recv($self._dagChildren())._do_((function(each){
  34414. return $core.withContext(function($ctx2) {
  34415. $1=$recv(each)._isSequenceNode();
  34416. if($core.assert($1)){
  34417. throw $early=[each];
  34418. }
  34419. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34420. }));
  34421. return nil;
  34422. }
  34423. catch(e) {if(e===$early)return e[0]; throw e}
  34424. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  34425. },
  34426. args: [],
  34427. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  34428. referencedClasses: [],
  34429. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  34430. }),
  34431. $globals.MethodNode);
  34432. $core.addMethod(
  34433. $core.method({
  34434. selector: "source",
  34435. protocol: "accessing",
  34436. fn: function (){
  34437. var self=this,$self=this;
  34438. return $self["@source"];
  34439. },
  34440. args: [],
  34441. source: "source\x0a\x09^ source",
  34442. referencedClasses: [],
  34443. messageSends: []
  34444. }),
  34445. $globals.MethodNode);
  34446. $core.addMethod(
  34447. $core.method({
  34448. selector: "source:",
  34449. protocol: "accessing",
  34450. fn: function (aString){
  34451. var self=this,$self=this;
  34452. $self["@source"]=aString;
  34453. return self;
  34454. },
  34455. args: ["aString"],
  34456. source: "source: aString\x0a\x09source := aString",
  34457. referencedClasses: [],
  34458. messageSends: []
  34459. }),
  34460. $globals.MethodNode);
  34461. $core.addClass("ReturnNode", $globals.ASTNode, ["scope"], "Compiler-AST");
  34462. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  34463. $core.addMethod(
  34464. $core.method({
  34465. selector: "acceptDagVisitor:",
  34466. protocol: "visiting",
  34467. fn: function (aVisitor){
  34468. var self=this,$self=this;
  34469. return $core.withContext(function($ctx1) {
  34470. return $recv(aVisitor)._visitReturnNode_(self);
  34471. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ReturnNode)});
  34472. },
  34473. args: ["aVisitor"],
  34474. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  34475. referencedClasses: [],
  34476. messageSends: ["visitReturnNode:"]
  34477. }),
  34478. $globals.ReturnNode);
  34479. $core.addMethod(
  34480. $core.method({
  34481. selector: "isReturnNode",
  34482. protocol: "testing",
  34483. fn: function (){
  34484. var self=this,$self=this;
  34485. return true;
  34486. },
  34487. args: [],
  34488. source: "isReturnNode\x0a\x09^ true",
  34489. referencedClasses: [],
  34490. messageSends: []
  34491. }),
  34492. $globals.ReturnNode);
  34493. $core.addMethod(
  34494. $core.method({
  34495. selector: "nonLocalReturn",
  34496. protocol: "testing",
  34497. fn: function (){
  34498. var self=this,$self=this;
  34499. return $core.withContext(function($ctx1) {
  34500. return $recv($recv($self._scope())._isMethodScope())._not();
  34501. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  34502. },
  34503. args: [],
  34504. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  34505. referencedClasses: [],
  34506. messageSends: ["not", "isMethodScope", "scope"]
  34507. }),
  34508. $globals.ReturnNode);
  34509. $core.addMethod(
  34510. $core.method({
  34511. selector: "scope",
  34512. protocol: "accessing",
  34513. fn: function (){
  34514. var self=this,$self=this;
  34515. return $self["@scope"];
  34516. },
  34517. args: [],
  34518. source: "scope\x0a\x09^ scope",
  34519. referencedClasses: [],
  34520. messageSends: []
  34521. }),
  34522. $globals.ReturnNode);
  34523. $core.addMethod(
  34524. $core.method({
  34525. selector: "scope:",
  34526. protocol: "accessing",
  34527. fn: function (aLexicalScope){
  34528. var self=this,$self=this;
  34529. $self["@scope"]=aLexicalScope;
  34530. return self;
  34531. },
  34532. args: ["aLexicalScope"],
  34533. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34534. referencedClasses: [],
  34535. messageSends: []
  34536. }),
  34537. $globals.ReturnNode);
  34538. $core.addClass("SendNode", $globals.ASTNode, ["selector", "arguments", "receiver", "index", "shouldBeInlined"], "Compiler-AST");
  34539. $globals.SendNode.comment="I represent an message send node.";
  34540. $core.addMethod(
  34541. $core.method({
  34542. selector: "acceptDagVisitor:",
  34543. protocol: "visiting",
  34544. fn: function (aVisitor){
  34545. var self=this,$self=this;
  34546. return $core.withContext(function($ctx1) {
  34547. return $recv(aVisitor)._visitSendNode_(self);
  34548. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SendNode)});
  34549. },
  34550. args: ["aVisitor"],
  34551. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  34552. referencedClasses: [],
  34553. messageSends: ["visitSendNode:"]
  34554. }),
  34555. $globals.SendNode);
  34556. $core.addMethod(
  34557. $core.method({
  34558. selector: "arguments",
  34559. protocol: "accessing",
  34560. fn: function (){
  34561. var self=this,$self=this;
  34562. return $core.withContext(function($ctx1) {
  34563. var $1,$receiver;
  34564. $1=$self["@arguments"];
  34565. if(($receiver = $1) == null || $receiver.a$nil){
  34566. $self["@arguments"]=[];
  34567. return $self["@arguments"];
  34568. } else {
  34569. return $1;
  34570. }
  34571. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  34572. },
  34573. args: [],
  34574. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  34575. referencedClasses: [],
  34576. messageSends: ["ifNil:"]
  34577. }),
  34578. $globals.SendNode);
  34579. $core.addMethod(
  34580. $core.method({
  34581. selector: "arguments:",
  34582. protocol: "accessing",
  34583. fn: function (aCollection){
  34584. var self=this,$self=this;
  34585. $self["@arguments"]=aCollection;
  34586. return self;
  34587. },
  34588. args: ["aCollection"],
  34589. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34590. referencedClasses: [],
  34591. messageSends: []
  34592. }),
  34593. $globals.SendNode);
  34594. $core.addMethod(
  34595. $core.method({
  34596. selector: "dagChildren",
  34597. protocol: "accessing",
  34598. fn: function (){
  34599. var self=this,$self=this;
  34600. return $core.withContext(function($ctx1) {
  34601. var $1,$2,$3,$receiver;
  34602. $1=$self._receiver();
  34603. $ctx1.sendIdx["receiver"]=1;
  34604. if(($receiver = $1) == null || $receiver.a$nil){
  34605. $2=$self._arguments();
  34606. $ctx1.sendIdx["arguments"]=1;
  34607. return $recv($2)._copy();
  34608. } else {
  34609. $1;
  34610. }
  34611. $3=$recv($globals.Array)._with_($self._receiver());
  34612. $recv($3)._addAll_($self._arguments());
  34613. return $recv($3)._yourself();
  34614. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.SendNode)});
  34615. },
  34616. args: [],
  34617. 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",
  34618. referencedClasses: ["Array"],
  34619. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  34620. }),
  34621. $globals.SendNode);
  34622. $core.addMethod(
  34623. $core.method({
  34624. selector: "index",
  34625. protocol: "accessing",
  34626. fn: function (){
  34627. var self=this,$self=this;
  34628. return $self["@index"];
  34629. },
  34630. args: [],
  34631. source: "index\x0a\x09^ index",
  34632. referencedClasses: [],
  34633. messageSends: []
  34634. }),
  34635. $globals.SendNode);
  34636. $core.addMethod(
  34637. $core.method({
  34638. selector: "index:",
  34639. protocol: "accessing",
  34640. fn: function (anInteger){
  34641. var self=this,$self=this;
  34642. $self["@index"]=anInteger;
  34643. return self;
  34644. },
  34645. args: ["anInteger"],
  34646. source: "index: anInteger\x0a\x09index := anInteger",
  34647. referencedClasses: [],
  34648. messageSends: []
  34649. }),
  34650. $globals.SendNode);
  34651. $core.addMethod(
  34652. $core.method({
  34653. selector: "isNavigationNode",
  34654. protocol: "testing",
  34655. fn: function (){
  34656. var self=this,$self=this;
  34657. return true;
  34658. },
  34659. args: [],
  34660. source: "isNavigationNode\x0a\x09^ true",
  34661. referencedClasses: [],
  34662. messageSends: []
  34663. }),
  34664. $globals.SendNode);
  34665. $core.addMethod(
  34666. $core.method({
  34667. selector: "isSendNode",
  34668. protocol: "testing",
  34669. fn: function (){
  34670. var self=this,$self=this;
  34671. return true;
  34672. },
  34673. args: [],
  34674. source: "isSendNode\x0a\x09^ true",
  34675. referencedClasses: [],
  34676. messageSends: []
  34677. }),
  34678. $globals.SendNode);
  34679. $core.addMethod(
  34680. $core.method({
  34681. selector: "navigationLink",
  34682. protocol: "accessing",
  34683. fn: function (){
  34684. var self=this,$self=this;
  34685. return $core.withContext(function($ctx1) {
  34686. return $self._selector();
  34687. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  34688. },
  34689. args: [],
  34690. source: "navigationLink\x0a\x09^ self selector",
  34691. referencedClasses: [],
  34692. messageSends: ["selector"]
  34693. }),
  34694. $globals.SendNode);
  34695. $core.addMethod(
  34696. $core.method({
  34697. selector: "receiver",
  34698. protocol: "accessing",
  34699. fn: function (){
  34700. var self=this,$self=this;
  34701. return $self["@receiver"];
  34702. },
  34703. args: [],
  34704. source: "receiver\x0a\x09^ receiver",
  34705. referencedClasses: [],
  34706. messageSends: []
  34707. }),
  34708. $globals.SendNode);
  34709. $core.addMethod(
  34710. $core.method({
  34711. selector: "receiver:",
  34712. protocol: "accessing",
  34713. fn: function (aNode){
  34714. var self=this,$self=this;
  34715. $self["@receiver"]=aNode;
  34716. return self;
  34717. },
  34718. args: ["aNode"],
  34719. source: "receiver: aNode\x0a\x09receiver := aNode",
  34720. referencedClasses: [],
  34721. messageSends: []
  34722. }),
  34723. $globals.SendNode);
  34724. $core.addMethod(
  34725. $core.method({
  34726. selector: "requiresSmalltalkContext",
  34727. protocol: "testing",
  34728. fn: function (){
  34729. var self=this,$self=this;
  34730. return true;
  34731. },
  34732. args: [],
  34733. source: "requiresSmalltalkContext\x0a\x09^ true",
  34734. referencedClasses: [],
  34735. messageSends: []
  34736. }),
  34737. $globals.SendNode);
  34738. $core.addMethod(
  34739. $core.method({
  34740. selector: "selector",
  34741. protocol: "accessing",
  34742. fn: function (){
  34743. var self=this,$self=this;
  34744. return $self["@selector"];
  34745. },
  34746. args: [],
  34747. source: "selector\x0a\x09^ selector",
  34748. referencedClasses: [],
  34749. messageSends: []
  34750. }),
  34751. $globals.SendNode);
  34752. $core.addMethod(
  34753. $core.method({
  34754. selector: "selector:",
  34755. protocol: "accessing",
  34756. fn: function (aString){
  34757. var self=this,$self=this;
  34758. $self["@selector"]=aString;
  34759. return self;
  34760. },
  34761. args: ["aString"],
  34762. source: "selector: aString\x0a\x09selector := aString",
  34763. referencedClasses: [],
  34764. messageSends: []
  34765. }),
  34766. $globals.SendNode);
  34767. $core.addMethod(
  34768. $core.method({
  34769. selector: "shouldBeInlined",
  34770. protocol: "accessing",
  34771. fn: function (){
  34772. var self=this,$self=this;
  34773. return $core.withContext(function($ctx1) {
  34774. var $1,$receiver;
  34775. $1=$self["@shouldBeInlined"];
  34776. if(($receiver = $1) == null || $receiver.a$nil){
  34777. return false;
  34778. } else {
  34779. return $1;
  34780. }
  34781. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.SendNode)});
  34782. },
  34783. args: [],
  34784. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  34785. referencedClasses: [],
  34786. messageSends: ["ifNil:"]
  34787. }),
  34788. $globals.SendNode);
  34789. $core.addMethod(
  34790. $core.method({
  34791. selector: "shouldBeInlined:",
  34792. protocol: "accessing",
  34793. fn: function (aBoolean){
  34794. var self=this,$self=this;
  34795. $self["@shouldBeInlined"]=aBoolean;
  34796. return self;
  34797. },
  34798. args: ["aBoolean"],
  34799. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  34800. referencedClasses: [],
  34801. messageSends: []
  34802. }),
  34803. $globals.SendNode);
  34804. $core.addMethod(
  34805. $core.method({
  34806. selector: "superSend",
  34807. protocol: "accessing",
  34808. fn: function (){
  34809. var self=this,$self=this;
  34810. return $core.withContext(function($ctx1) {
  34811. var $2,$1;
  34812. $2=$self._receiver();
  34813. $ctx1.sendIdx["receiver"]=1;
  34814. $1=$recv($2)._notNil();
  34815. return $recv($1)._and_((function(){
  34816. return $core.withContext(function($ctx2) {
  34817. return $recv($self._receiver())._isSuperKeyword();
  34818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34819. }));
  34820. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  34821. },
  34822. args: [],
  34823. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  34824. referencedClasses: [],
  34825. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  34826. }),
  34827. $globals.SendNode);
  34828. $core.addClass("SequenceNode", $globals.ASTNode, ["temps", "pragmas", "scope"], "Compiler-AST");
  34829. $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).";
  34830. $core.addMethod(
  34831. $core.method({
  34832. selector: "acceptDagVisitor:",
  34833. protocol: "visiting",
  34834. fn: function (aVisitor){
  34835. var self=this,$self=this;
  34836. return $core.withContext(function($ctx1) {
  34837. return $recv(aVisitor)._visitSequenceNode_(self);
  34838. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SequenceNode)});
  34839. },
  34840. args: ["aVisitor"],
  34841. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  34842. referencedClasses: [],
  34843. messageSends: ["visitSequenceNode:"]
  34844. }),
  34845. $globals.SequenceNode);
  34846. $core.addMethod(
  34847. $core.method({
  34848. selector: "asBlockSequenceNode",
  34849. protocol: "building",
  34850. fn: function (){
  34851. var self=this,$self=this;
  34852. return $core.withContext(function($ctx1) {
  34853. var $1;
  34854. $1=$recv($globals.BlockSequenceNode)._new();
  34855. $recv($1)._position_($self._position());
  34856. $recv($1)._source_($self._source());
  34857. $recv($1)._dagChildren_($self._dagChildren());
  34858. $recv($1)._temps_($self._temps());
  34859. $recv($1)._pragmas_($self._pragmas());
  34860. return $recv($1)._yourself();
  34861. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  34862. },
  34863. args: [],
  34864. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09dagChildren: self dagChildren;\x0a\x09\x09temps: self temps;\x0a\x09\x09pragmas: self pragmas;\x0a\x09\x09yourself",
  34865. referencedClasses: ["BlockSequenceNode"],
  34866. messageSends: ["position:", "new", "position", "source:", "source", "dagChildren:", "dagChildren", "temps:", "temps", "pragmas:", "pragmas", "yourself"]
  34867. }),
  34868. $globals.SequenceNode);
  34869. $core.addMethod(
  34870. $core.method({
  34871. selector: "isSequenceNode",
  34872. protocol: "testing",
  34873. fn: function (){
  34874. var self=this,$self=this;
  34875. return true;
  34876. },
  34877. args: [],
  34878. source: "isSequenceNode\x0a\x09^ true",
  34879. referencedClasses: [],
  34880. messageSends: []
  34881. }),
  34882. $globals.SequenceNode);
  34883. $core.addMethod(
  34884. $core.method({
  34885. selector: "pragmas",
  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["@pragmas"];
  34892. if(($receiver = $1) == null || $receiver.a$nil){
  34893. return [];
  34894. } else {
  34895. return $1;
  34896. }
  34897. }, function($ctx1) {$ctx1.fill(self,"pragmas",{},$globals.SequenceNode)});
  34898. },
  34899. args: [],
  34900. source: "pragmas\x0a\x09^ pragmas ifNil: [ #() ]",
  34901. referencedClasses: [],
  34902. messageSends: ["ifNil:"]
  34903. }),
  34904. $globals.SequenceNode);
  34905. $core.addMethod(
  34906. $core.method({
  34907. selector: "pragmas:",
  34908. protocol: "accessing",
  34909. fn: function (aCollection){
  34910. var self=this,$self=this;
  34911. $self["@pragmas"]=aCollection;
  34912. return self;
  34913. },
  34914. args: ["aCollection"],
  34915. source: "pragmas: aCollection\x0a\x09pragmas := aCollection",
  34916. referencedClasses: [],
  34917. messageSends: []
  34918. }),
  34919. $globals.SequenceNode);
  34920. $core.addMethod(
  34921. $core.method({
  34922. selector: "scope",
  34923. protocol: "accessing",
  34924. fn: function (){
  34925. var self=this,$self=this;
  34926. return $self["@scope"];
  34927. },
  34928. args: [],
  34929. source: "scope\x0a\x09^ scope",
  34930. referencedClasses: [],
  34931. messageSends: []
  34932. }),
  34933. $globals.SequenceNode);
  34934. $core.addMethod(
  34935. $core.method({
  34936. selector: "scope:",
  34937. protocol: "accessing",
  34938. fn: function (aLexicalScope){
  34939. var self=this,$self=this;
  34940. $self["@scope"]=aLexicalScope;
  34941. return self;
  34942. },
  34943. args: ["aLexicalScope"],
  34944. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34945. referencedClasses: [],
  34946. messageSends: []
  34947. }),
  34948. $globals.SequenceNode);
  34949. $core.addMethod(
  34950. $core.method({
  34951. selector: "temps",
  34952. protocol: "accessing",
  34953. fn: function (){
  34954. var self=this,$self=this;
  34955. return $core.withContext(function($ctx1) {
  34956. var $1,$receiver;
  34957. $1=$self["@temps"];
  34958. if(($receiver = $1) == null || $receiver.a$nil){
  34959. return [];
  34960. } else {
  34961. return $1;
  34962. }
  34963. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  34964. },
  34965. args: [],
  34966. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  34967. referencedClasses: [],
  34968. messageSends: ["ifNil:"]
  34969. }),
  34970. $globals.SequenceNode);
  34971. $core.addMethod(
  34972. $core.method({
  34973. selector: "temps:",
  34974. protocol: "accessing",
  34975. fn: function (aCollection){
  34976. var self=this,$self=this;
  34977. $self["@temps"]=aCollection;
  34978. return self;
  34979. },
  34980. args: ["aCollection"],
  34981. source: "temps: aCollection\x0a\x09temps := aCollection",
  34982. referencedClasses: [],
  34983. messageSends: []
  34984. }),
  34985. $globals.SequenceNode);
  34986. $core.addClass("BlockSequenceNode", $globals.SequenceNode, [], "Compiler-AST");
  34987. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  34988. $core.addMethod(
  34989. $core.method({
  34990. selector: "acceptDagVisitor:",
  34991. protocol: "visiting",
  34992. fn: function (aVisitor){
  34993. var self=this,$self=this;
  34994. return $core.withContext(function($ctx1) {
  34995. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  34996. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  34997. },
  34998. args: ["aVisitor"],
  34999. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  35000. referencedClasses: [],
  35001. messageSends: ["visitBlockSequenceNode:"]
  35002. }),
  35003. $globals.BlockSequenceNode);
  35004. $core.addMethod(
  35005. $core.method({
  35006. selector: "isBlockSequenceNode",
  35007. protocol: "testing",
  35008. fn: function (){
  35009. var self=this,$self=this;
  35010. return true;
  35011. },
  35012. args: [],
  35013. source: "isBlockSequenceNode\x0a\x09^ true",
  35014. referencedClasses: [],
  35015. messageSends: []
  35016. }),
  35017. $globals.BlockSequenceNode);
  35018. $core.addMethod(
  35019. $core.method({
  35020. selector: "pragmas:",
  35021. protocol: "visiting",
  35022. fn: function (aCollection){
  35023. var self=this,$self=this;
  35024. return $core.withContext(function($ctx1) {
  35025. var $1;
  35026. $recv(aCollection)._ifNotEmpty_((function(){
  35027. return $core.withContext(function($ctx2) {
  35028. return $recv($globals.CompilerError)._signal_("Block must have no pragmas.");
  35029. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35030. }));
  35031. $1=(
  35032. $ctx1.supercall = true,
  35033. ($globals.BlockSequenceNode.superclass||$boot.nilAsClass).fn.prototype._pragmas_.apply($self, [aCollection]));
  35034. $ctx1.supercall = false;
  35035. return $1;
  35036. }, function($ctx1) {$ctx1.fill(self,"pragmas:",{aCollection:aCollection},$globals.BlockSequenceNode)});
  35037. },
  35038. args: ["aCollection"],
  35039. source: "pragmas: aCollection\x0a\x09aCollection ifNotEmpty: [\x0a\x09\x09CompilerError signal: 'Block must have no pragmas.' ].\x0a\x09^ super pragmas: aCollection",
  35040. referencedClasses: ["CompilerError"],
  35041. messageSends: ["ifNotEmpty:", "signal:", "pragmas:"]
  35042. }),
  35043. $globals.BlockSequenceNode);
  35044. $core.addClass("ValueNode", $globals.ASTNode, ["value"], "Compiler-AST");
  35045. $globals.ValueNode.comment="I represent a value node.";
  35046. $core.addMethod(
  35047. $core.method({
  35048. selector: "acceptDagVisitor:",
  35049. protocol: "visiting",
  35050. fn: function (aVisitor){
  35051. var self=this,$self=this;
  35052. return $core.withContext(function($ctx1) {
  35053. return $recv(aVisitor)._visitValueNode_(self);
  35054. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ValueNode)});
  35055. },
  35056. args: ["aVisitor"],
  35057. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  35058. referencedClasses: [],
  35059. messageSends: ["visitValueNode:"]
  35060. }),
  35061. $globals.ValueNode);
  35062. $core.addMethod(
  35063. $core.method({
  35064. selector: "isImmutable",
  35065. protocol: "testing",
  35066. fn: function (){
  35067. var self=this,$self=this;
  35068. return $core.withContext(function($ctx1) {
  35069. return $recv($self._value())._isImmutable();
  35070. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  35071. },
  35072. args: [],
  35073. source: "isImmutable\x0a\x09^ self value isImmutable",
  35074. referencedClasses: [],
  35075. messageSends: ["isImmutable", "value"]
  35076. }),
  35077. $globals.ValueNode);
  35078. $core.addMethod(
  35079. $core.method({
  35080. selector: "isValueNode",
  35081. protocol: "testing",
  35082. fn: function (){
  35083. var self=this,$self=this;
  35084. return true;
  35085. },
  35086. args: [],
  35087. source: "isValueNode\x0a\x09^ true",
  35088. referencedClasses: [],
  35089. messageSends: []
  35090. }),
  35091. $globals.ValueNode);
  35092. $core.addMethod(
  35093. $core.method({
  35094. selector: "value",
  35095. protocol: "accessing",
  35096. fn: function (){
  35097. var self=this,$self=this;
  35098. return $self["@value"];
  35099. },
  35100. args: [],
  35101. source: "value\x0a\x09^ value",
  35102. referencedClasses: [],
  35103. messageSends: []
  35104. }),
  35105. $globals.ValueNode);
  35106. $core.addMethod(
  35107. $core.method({
  35108. selector: "value:",
  35109. protocol: "accessing",
  35110. fn: function (anObject){
  35111. var self=this,$self=this;
  35112. $self["@value"]=anObject;
  35113. return self;
  35114. },
  35115. args: ["anObject"],
  35116. source: "value: anObject\x0a\x09value := anObject",
  35117. referencedClasses: [],
  35118. messageSends: []
  35119. }),
  35120. $globals.ValueNode);
  35121. $core.addClass("VariableNode", $globals.ValueNode, ["assigned", "binding"], "Compiler-AST");
  35122. $globals.VariableNode.comment="I represent an variable node.";
  35123. $core.addMethod(
  35124. $core.method({
  35125. selector: "acceptDagVisitor:",
  35126. protocol: "visiting",
  35127. fn: function (aVisitor){
  35128. var self=this,$self=this;
  35129. return $core.withContext(function($ctx1) {
  35130. return $recv(aVisitor)._visitVariableNode_(self);
  35131. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.VariableNode)});
  35132. },
  35133. args: ["aVisitor"],
  35134. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  35135. referencedClasses: [],
  35136. messageSends: ["visitVariableNode:"]
  35137. }),
  35138. $globals.VariableNode);
  35139. $core.addMethod(
  35140. $core.method({
  35141. selector: "alias",
  35142. protocol: "accessing",
  35143. fn: function (){
  35144. var self=this,$self=this;
  35145. return $core.withContext(function($ctx1) {
  35146. return $recv($self._binding())._alias();
  35147. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  35148. },
  35149. args: [],
  35150. source: "alias\x0a\x09^ self binding alias",
  35151. referencedClasses: [],
  35152. messageSends: ["alias", "binding"]
  35153. }),
  35154. $globals.VariableNode);
  35155. $core.addMethod(
  35156. $core.method({
  35157. selector: "assigned",
  35158. protocol: "accessing",
  35159. fn: function (){
  35160. var self=this,$self=this;
  35161. return $core.withContext(function($ctx1) {
  35162. var $1,$receiver;
  35163. $1=$self["@assigned"];
  35164. if(($receiver = $1) == null || $receiver.a$nil){
  35165. return false;
  35166. } else {
  35167. return $1;
  35168. }
  35169. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  35170. },
  35171. args: [],
  35172. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  35173. referencedClasses: [],
  35174. messageSends: ["ifNil:"]
  35175. }),
  35176. $globals.VariableNode);
  35177. $core.addMethod(
  35178. $core.method({
  35179. selector: "assigned:",
  35180. protocol: "accessing",
  35181. fn: function (aBoolean){
  35182. var self=this,$self=this;
  35183. $self["@assigned"]=aBoolean;
  35184. return self;
  35185. },
  35186. args: ["aBoolean"],
  35187. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  35188. referencedClasses: [],
  35189. messageSends: []
  35190. }),
  35191. $globals.VariableNode);
  35192. $core.addMethod(
  35193. $core.method({
  35194. selector: "beAssigned",
  35195. protocol: "accessing",
  35196. fn: function (){
  35197. var self=this,$self=this;
  35198. return $core.withContext(function($ctx1) {
  35199. $recv($self._binding())._validateAssignment();
  35200. $self["@assigned"]=true;
  35201. return self;
  35202. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  35203. },
  35204. args: [],
  35205. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  35206. referencedClasses: [],
  35207. messageSends: ["validateAssignment", "binding"]
  35208. }),
  35209. $globals.VariableNode);
  35210. $core.addMethod(
  35211. $core.method({
  35212. selector: "binding",
  35213. protocol: "accessing",
  35214. fn: function (){
  35215. var self=this,$self=this;
  35216. return $self["@binding"];
  35217. },
  35218. args: [],
  35219. source: "binding\x0a\x09^ binding",
  35220. referencedClasses: [],
  35221. messageSends: []
  35222. }),
  35223. $globals.VariableNode);
  35224. $core.addMethod(
  35225. $core.method({
  35226. selector: "binding:",
  35227. protocol: "accessing",
  35228. fn: function (aScopeVar){
  35229. var self=this,$self=this;
  35230. $self["@binding"]=aScopeVar;
  35231. return self;
  35232. },
  35233. args: ["aScopeVar"],
  35234. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  35235. referencedClasses: [],
  35236. messageSends: []
  35237. }),
  35238. $globals.VariableNode);
  35239. $core.addMethod(
  35240. $core.method({
  35241. selector: "isArgument",
  35242. protocol: "testing",
  35243. fn: function (){
  35244. var self=this,$self=this;
  35245. return $core.withContext(function($ctx1) {
  35246. return $recv($self._binding())._isArgVar();
  35247. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  35248. },
  35249. args: [],
  35250. source: "isArgument\x0a\x09^ self binding isArgVar",
  35251. referencedClasses: [],
  35252. messageSends: ["isArgVar", "binding"]
  35253. }),
  35254. $globals.VariableNode);
  35255. $core.addMethod(
  35256. $core.method({
  35257. selector: "isImmutable",
  35258. protocol: "testing",
  35259. fn: function (){
  35260. var self=this,$self=this;
  35261. return $core.withContext(function($ctx1) {
  35262. return $recv($self._binding())._isImmutable();
  35263. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  35264. },
  35265. args: [],
  35266. source: "isImmutable\x0a\x09^ self binding isImmutable",
  35267. referencedClasses: [],
  35268. messageSends: ["isImmutable", "binding"]
  35269. }),
  35270. $globals.VariableNode);
  35271. $core.addMethod(
  35272. $core.method({
  35273. selector: "isNavigationNode",
  35274. protocol: "testing",
  35275. fn: function (){
  35276. var self=this,$self=this;
  35277. return true;
  35278. },
  35279. args: [],
  35280. source: "isNavigationNode\x0a\x09^ true",
  35281. referencedClasses: [],
  35282. messageSends: []
  35283. }),
  35284. $globals.VariableNode);
  35285. $core.addMethod(
  35286. $core.method({
  35287. selector: "isSuperKeyword",
  35288. protocol: "testing",
  35289. fn: function (){
  35290. var self=this,$self=this;
  35291. return $core.withContext(function($ctx1) {
  35292. return $recv($self._value()).__eq("super");
  35293. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{},$globals.VariableNode)});
  35294. },
  35295. args: [],
  35296. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  35297. referencedClasses: [],
  35298. messageSends: ["=", "value"]
  35299. }),
  35300. $globals.VariableNode);
  35301. $core.addMethod(
  35302. $core.method({
  35303. selector: "isVariableNode",
  35304. protocol: "testing",
  35305. fn: function (){
  35306. var self=this,$self=this;
  35307. return true;
  35308. },
  35309. args: [],
  35310. source: "isVariableNode\x0a\x09^ true",
  35311. referencedClasses: [],
  35312. messageSends: []
  35313. }),
  35314. $globals.VariableNode);
  35315. $core.addMethod(
  35316. $core.method({
  35317. selector: "navigationLink",
  35318. protocol: "accessing",
  35319. fn: function (){
  35320. var self=this,$self=this;
  35321. return $core.withContext(function($ctx1) {
  35322. return $self._value();
  35323. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  35324. },
  35325. args: [],
  35326. source: "navigationLink\x0a\x09^ self value",
  35327. referencedClasses: [],
  35328. messageSends: ["value"]
  35329. }),
  35330. $globals.VariableNode);
  35331. $core.addClass("CompilerError", $globals.Error, [], "Compiler-AST");
  35332. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  35333. $core.addClass("ParentFakingPathDagVisitor", $globals.PathDagVisitor, ["setParentSelector"], "Compiler-AST");
  35334. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  35335. $core.addMethod(
  35336. $core.method({
  35337. selector: "visit:",
  35338. protocol: "visiting",
  35339. fn: function (aNode){
  35340. var self=this,$self=this;
  35341. return $core.withContext(function($ctx1) {
  35342. var $1;
  35343. $recv($self._path())._ifNotEmpty_((function(p){
  35344. return $core.withContext(function($ctx2) {
  35345. return $recv(aNode)._parent_($recv(p)._last());
  35346. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  35347. }));
  35348. $1=(
  35349. $ctx1.supercall = true,
  35350. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  35351. $ctx1.supercall = false;
  35352. return $1;
  35353. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ParentFakingPathDagVisitor)});
  35354. },
  35355. args: ["aNode"],
  35356. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  35357. referencedClasses: [],
  35358. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  35359. }),
  35360. $globals.ParentFakingPathDagVisitor);
  35361. $core.addClass("NodeVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-AST");
  35362. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  35363. $core.addMethod(
  35364. $core.method({
  35365. selector: "visitAssignmentNode:",
  35366. protocol: "visiting",
  35367. fn: function (aNode){
  35368. var self=this,$self=this;
  35369. return $core.withContext(function($ctx1) {
  35370. return $self._visitDagNode_(aNode);
  35371. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  35372. },
  35373. args: ["aNode"],
  35374. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35375. referencedClasses: [],
  35376. messageSends: ["visitDagNode:"]
  35377. }),
  35378. $globals.NodeVisitor);
  35379. $core.addMethod(
  35380. $core.method({
  35381. selector: "visitBlockNode:",
  35382. protocol: "visiting",
  35383. fn: function (aNode){
  35384. var self=this,$self=this;
  35385. return $core.withContext(function($ctx1) {
  35386. return $self._visitDagNode_(aNode);
  35387. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  35388. },
  35389. args: ["aNode"],
  35390. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35391. referencedClasses: [],
  35392. messageSends: ["visitDagNode:"]
  35393. }),
  35394. $globals.NodeVisitor);
  35395. $core.addMethod(
  35396. $core.method({
  35397. selector: "visitBlockSequenceNode:",
  35398. protocol: "visiting",
  35399. fn: function (aNode){
  35400. var self=this,$self=this;
  35401. return $core.withContext(function($ctx1) {
  35402. return $self._visitSequenceNode_(aNode);
  35403. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35404. },
  35405. args: ["aNode"],
  35406. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  35407. referencedClasses: [],
  35408. messageSends: ["visitSequenceNode:"]
  35409. }),
  35410. $globals.NodeVisitor);
  35411. $core.addMethod(
  35412. $core.method({
  35413. selector: "visitCascadeNode:",
  35414. protocol: "visiting",
  35415. fn: function (aNode){
  35416. var self=this,$self=this;
  35417. return $core.withContext(function($ctx1) {
  35418. return $self._visitDagNode_(aNode);
  35419. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  35420. },
  35421. args: ["aNode"],
  35422. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35423. referencedClasses: [],
  35424. messageSends: ["visitDagNode:"]
  35425. }),
  35426. $globals.NodeVisitor);
  35427. $core.addMethod(
  35428. $core.method({
  35429. selector: "visitDagNode:",
  35430. protocol: "visiting",
  35431. fn: function (aNode){
  35432. var self=this,$self=this;
  35433. return $core.withContext(function($ctx1) {
  35434. return $self._visitDagNodeVariantSimple_(aNode);
  35435. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.NodeVisitor)});
  35436. },
  35437. args: ["aNode"],
  35438. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  35439. referencedClasses: [],
  35440. messageSends: ["visitDagNodeVariantSimple:"]
  35441. }),
  35442. $globals.NodeVisitor);
  35443. $core.addMethod(
  35444. $core.method({
  35445. selector: "visitDynamicArrayNode:",
  35446. protocol: "visiting",
  35447. fn: function (aNode){
  35448. var self=this,$self=this;
  35449. return $core.withContext(function($ctx1) {
  35450. return $self._visitDagNode_(aNode);
  35451. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  35452. },
  35453. args: ["aNode"],
  35454. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35455. referencedClasses: [],
  35456. messageSends: ["visitDagNode:"]
  35457. }),
  35458. $globals.NodeVisitor);
  35459. $core.addMethod(
  35460. $core.method({
  35461. selector: "visitDynamicDictionaryNode:",
  35462. protocol: "visiting",
  35463. fn: function (aNode){
  35464. var self=this,$self=this;
  35465. return $core.withContext(function($ctx1) {
  35466. return $self._visitDagNode_(aNode);
  35467. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  35468. },
  35469. args: ["aNode"],
  35470. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35471. referencedClasses: [],
  35472. messageSends: ["visitDagNode:"]
  35473. }),
  35474. $globals.NodeVisitor);
  35475. $core.addMethod(
  35476. $core.method({
  35477. selector: "visitJSStatementNode:",
  35478. protocol: "visiting",
  35479. fn: function (aNode){
  35480. var self=this,$self=this;
  35481. return $core.withContext(function($ctx1) {
  35482. return $self._visitDagNode_(aNode);
  35483. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  35484. },
  35485. args: ["aNode"],
  35486. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35487. referencedClasses: [],
  35488. messageSends: ["visitDagNode:"]
  35489. }),
  35490. $globals.NodeVisitor);
  35491. $core.addMethod(
  35492. $core.method({
  35493. selector: "visitMethodNode:",
  35494. protocol: "visiting",
  35495. fn: function (aNode){
  35496. var self=this,$self=this;
  35497. return $core.withContext(function($ctx1) {
  35498. return $self._visitDagNode_(aNode);
  35499. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  35500. },
  35501. args: ["aNode"],
  35502. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35503. referencedClasses: [],
  35504. messageSends: ["visitDagNode:"]
  35505. }),
  35506. $globals.NodeVisitor);
  35507. $core.addMethod(
  35508. $core.method({
  35509. selector: "visitReturnNode:",
  35510. protocol: "visiting",
  35511. fn: function (aNode){
  35512. var self=this,$self=this;
  35513. return $core.withContext(function($ctx1) {
  35514. return $self._visitDagNode_(aNode);
  35515. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  35516. },
  35517. args: ["aNode"],
  35518. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35519. referencedClasses: [],
  35520. messageSends: ["visitDagNode:"]
  35521. }),
  35522. $globals.NodeVisitor);
  35523. $core.addMethod(
  35524. $core.method({
  35525. selector: "visitSendNode:",
  35526. protocol: "visiting",
  35527. fn: function (aNode){
  35528. var self=this,$self=this;
  35529. return $core.withContext(function($ctx1) {
  35530. return $self._visitDagNode_(aNode);
  35531. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  35532. },
  35533. args: ["aNode"],
  35534. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35535. referencedClasses: [],
  35536. messageSends: ["visitDagNode:"]
  35537. }),
  35538. $globals.NodeVisitor);
  35539. $core.addMethod(
  35540. $core.method({
  35541. selector: "visitSequenceNode:",
  35542. protocol: "visiting",
  35543. fn: function (aNode){
  35544. var self=this,$self=this;
  35545. return $core.withContext(function($ctx1) {
  35546. return $self._visitDagNode_(aNode);
  35547. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35548. },
  35549. args: ["aNode"],
  35550. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35551. referencedClasses: [],
  35552. messageSends: ["visitDagNode:"]
  35553. }),
  35554. $globals.NodeVisitor);
  35555. $core.addMethod(
  35556. $core.method({
  35557. selector: "visitValueNode:",
  35558. protocol: "visiting",
  35559. fn: function (aNode){
  35560. var self=this,$self=this;
  35561. return $core.withContext(function($ctx1) {
  35562. return $self._visitDagNode_(aNode);
  35563. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  35564. },
  35565. args: ["aNode"],
  35566. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35567. referencedClasses: [],
  35568. messageSends: ["visitDagNode:"]
  35569. }),
  35570. $globals.NodeVisitor);
  35571. $core.addMethod(
  35572. $core.method({
  35573. selector: "visitVariableNode:",
  35574. protocol: "visiting",
  35575. fn: function (aNode){
  35576. var self=this,$self=this;
  35577. return $core.withContext(function($ctx1) {
  35578. return $self._visitDagNode_(aNode);
  35579. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  35580. },
  35581. args: ["aNode"],
  35582. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35583. referencedClasses: [],
  35584. messageSends: ["visitDagNode:"]
  35585. }),
  35586. $globals.NodeVisitor);
  35587. $core.addMethod(
  35588. $core.method({
  35589. selector: "ast",
  35590. protocol: "*Compiler-AST",
  35591. fn: function (){
  35592. var self=this,$self=this;
  35593. return $core.withContext(function($ctx1) {
  35594. var $1;
  35595. $1=$self._source();
  35596. $ctx1.sendIdx["source"]=1;
  35597. $recv($1)._ifEmpty_((function(){
  35598. return $core.withContext(function($ctx2) {
  35599. return $recv($globals.CompilerError)._signal_("Method source is empty");
  35600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35601. }));
  35602. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_($self._source(),$self._methodClass(),$self._protocol());
  35603. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  35604. },
  35605. args: [],
  35606. source: "ast\x0a\x09self source ifEmpty: [ CompilerError signal: 'Method source is empty' ].\x0a\x09\x0a\x09^ Compiler new\x0a\x09\x09ast: self source\x0a\x09\x09forClass: self methodClass\x0a\x09\x09protocol: self protocol",
  35607. referencedClasses: ["CompilerError", "Compiler"],
  35608. messageSends: ["ifEmpty:", "source", "signal:", "ast:forClass:protocol:", "new", "methodClass", "protocol"]
  35609. }),
  35610. $globals.CompiledMethod);
  35611. });
  35612. define('amber_core/Compiler-Core',["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Collections", "amber_core/Kernel-Objects"], function($boot){"use strict";
  35613. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  35614. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  35615. var $pkg = $core.addPackage("Compiler-Core");
  35616. $pkg.innerEval = function (expr) { return eval(expr); };
  35617. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  35618. $core.addClass("AbstractCodeGenerator", $globals.Object, ["currentClass", "currentPackage", "source"], "Compiler-Core");
  35619. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  35620. $core.addMethod(
  35621. $core.method({
  35622. selector: "compileNode:",
  35623. protocol: "compiling",
  35624. fn: function (aNode){
  35625. var self=this,$self=this;
  35626. return $core.withContext(function($ctx1) {
  35627. return $recv($self._transformers())._inject_into_(aNode,(function(input,transformer){
  35628. return $core.withContext(function($ctx2) {
  35629. return $recv(transformer)._value_(input);
  35630. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  35631. }));
  35632. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  35633. },
  35634. args: ["aNode"],
  35635. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  35636. referencedClasses: [],
  35637. messageSends: ["inject:into:", "transformers", "value:"]
  35638. }),
  35639. $globals.AbstractCodeGenerator);
  35640. $core.addMethod(
  35641. $core.method({
  35642. selector: "currentClass",
  35643. protocol: "accessing",
  35644. fn: function (){
  35645. var self=this,$self=this;
  35646. return $self["@currentClass"];
  35647. },
  35648. args: [],
  35649. source: "currentClass\x0a\x09^ currentClass",
  35650. referencedClasses: [],
  35651. messageSends: []
  35652. }),
  35653. $globals.AbstractCodeGenerator);
  35654. $core.addMethod(
  35655. $core.method({
  35656. selector: "currentClass:",
  35657. protocol: "accessing",
  35658. fn: function (aClass){
  35659. var self=this,$self=this;
  35660. $self["@currentClass"]=aClass;
  35661. return self;
  35662. },
  35663. args: ["aClass"],
  35664. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  35665. referencedClasses: [],
  35666. messageSends: []
  35667. }),
  35668. $globals.AbstractCodeGenerator);
  35669. $core.addMethod(
  35670. $core.method({
  35671. selector: "currentPackage",
  35672. protocol: "accessing",
  35673. fn: function (){
  35674. var self=this,$self=this;
  35675. return $self["@currentPackage"];
  35676. },
  35677. args: [],
  35678. source: "currentPackage\x0a\x09^ currentPackage",
  35679. referencedClasses: [],
  35680. messageSends: []
  35681. }),
  35682. $globals.AbstractCodeGenerator);
  35683. $core.addMethod(
  35684. $core.method({
  35685. selector: "currentPackage:",
  35686. protocol: "accessing",
  35687. fn: function (anObject){
  35688. var self=this,$self=this;
  35689. $self["@currentPackage"]=anObject;
  35690. return self;
  35691. },
  35692. args: ["anObject"],
  35693. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  35694. referencedClasses: [],
  35695. messageSends: []
  35696. }),
  35697. $globals.AbstractCodeGenerator);
  35698. $core.addMethod(
  35699. $core.method({
  35700. selector: "pseudoVariables",
  35701. protocol: "accessing",
  35702. fn: function (){
  35703. var self=this,$self=this;
  35704. return $core.withContext(function($ctx1) {
  35705. return $recv($globals.Smalltalk)._pseudoVariableNames();
  35706. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  35707. },
  35708. args: [],
  35709. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  35710. referencedClasses: ["Smalltalk"],
  35711. messageSends: ["pseudoVariableNames"]
  35712. }),
  35713. $globals.AbstractCodeGenerator);
  35714. $core.addMethod(
  35715. $core.method({
  35716. selector: "source",
  35717. protocol: "accessing",
  35718. fn: function (){
  35719. var self=this,$self=this;
  35720. return $core.withContext(function($ctx1) {
  35721. var $1,$receiver;
  35722. $1=$self["@source"];
  35723. if(($receiver = $1) == null || $receiver.a$nil){
  35724. return "";
  35725. } else {
  35726. return $1;
  35727. }
  35728. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  35729. },
  35730. args: [],
  35731. source: "source\x0a\x09^ source ifNil: [ '' ]",
  35732. referencedClasses: [],
  35733. messageSends: ["ifNil:"]
  35734. }),
  35735. $globals.AbstractCodeGenerator);
  35736. $core.addMethod(
  35737. $core.method({
  35738. selector: "source:",
  35739. protocol: "accessing",
  35740. fn: function (aString){
  35741. var self=this,$self=this;
  35742. $self["@source"]=aString;
  35743. return self;
  35744. },
  35745. args: ["aString"],
  35746. source: "source: aString\x0a\x09source := aString",
  35747. referencedClasses: [],
  35748. messageSends: []
  35749. }),
  35750. $globals.AbstractCodeGenerator);
  35751. $core.addMethod(
  35752. $core.method({
  35753. selector: "transformers",
  35754. protocol: "compiling",
  35755. fn: function (){
  35756. var self=this,$self=this;
  35757. var dict;
  35758. return $core.withContext(function($ctx1) {
  35759. dict=$self._transformersDictionary();
  35760. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  35761. return $core.withContext(function($ctx2) {
  35762. return $recv(dict)._at_(each);
  35763. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35764. }));
  35765. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict},$globals.AbstractCodeGenerator)});
  35766. },
  35767. args: [],
  35768. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  35769. referencedClasses: [],
  35770. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  35771. }),
  35772. $globals.AbstractCodeGenerator);
  35773. $core.addMethod(
  35774. $core.method({
  35775. selector: "transformersDictionary",
  35776. protocol: "compiling",
  35777. fn: function (){
  35778. var self=this,$self=this;
  35779. return $core.withContext(function($ctx1) {
  35780. $self._subclassResponsibility();
  35781. return self;
  35782. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.AbstractCodeGenerator)});
  35783. },
  35784. args: [],
  35785. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  35786. referencedClasses: [],
  35787. messageSends: ["subclassResponsibility"]
  35788. }),
  35789. $globals.AbstractCodeGenerator);
  35790. $core.addClass("CodeGenerator", $globals.AbstractCodeGenerator, ["transformersDictionary"], "Compiler-Core");
  35791. $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.";
  35792. $core.addMethod(
  35793. $core.method({
  35794. selector: "irTranslator",
  35795. protocol: "compiling",
  35796. fn: function (){
  35797. var self=this,$self=this;
  35798. return $core.withContext(function($ctx1) {
  35799. var $1;
  35800. $1=$recv($self._irTranslatorClass())._new();
  35801. $recv($1)._currentClass_($self._currentClass());
  35802. return $recv($1)._yourself();
  35803. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  35804. },
  35805. args: [],
  35806. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  35807. referencedClasses: [],
  35808. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  35809. }),
  35810. $globals.CodeGenerator);
  35811. $core.addMethod(
  35812. $core.method({
  35813. selector: "irTranslatorClass",
  35814. protocol: "compiling",
  35815. fn: function (){
  35816. var self=this,$self=this;
  35817. return $globals.IRJSTranslator;
  35818. },
  35819. args: [],
  35820. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  35821. referencedClasses: ["IRJSTranslator"],
  35822. messageSends: []
  35823. }),
  35824. $globals.CodeGenerator);
  35825. $core.addMethod(
  35826. $core.method({
  35827. selector: "semanticAnalyzer",
  35828. protocol: "compiling",
  35829. fn: function (){
  35830. var self=this,$self=this;
  35831. return $core.withContext(function($ctx1) {
  35832. var $1;
  35833. $1=$recv($globals.SemanticAnalyzer)._on_($self._currentClass());
  35834. $recv($1)._thePackage_($self._currentPackage());
  35835. return $recv($1)._yourself();
  35836. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  35837. },
  35838. args: [],
  35839. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  35840. referencedClasses: ["SemanticAnalyzer"],
  35841. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  35842. }),
  35843. $globals.CodeGenerator);
  35844. $core.addMethod(
  35845. $core.method({
  35846. selector: "transformersDictionary",
  35847. protocol: "compiling",
  35848. fn: function (){
  35849. var self=this,$self=this;
  35850. return $core.withContext(function($ctx1) {
  35851. var $1,$2,$receiver;
  35852. $1=$self["@transformersDictionary"];
  35853. if(($receiver = $1) == null || $receiver.a$nil){
  35854. $2=$recv($globals.Dictionary)._new();
  35855. $ctx1.sendIdx["new"]=1;
  35856. $recv($2)._at_put_("1000-earlyPragmas",$recv($globals.EarlyPragmator)._new());
  35857. $ctx1.sendIdx["at:put:"]=1;
  35858. $recv($2)._at_put_("2000-semantic",$self._semanticAnalyzer());
  35859. $ctx1.sendIdx["at:put:"]=2;
  35860. $recv($2)._at_put_("5000-astToIr",$self._translator());
  35861. $ctx1.sendIdx["at:put:"]=3;
  35862. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  35863. $self["@transformersDictionary"]=$recv($2)._yourself();
  35864. return $self["@transformersDictionary"];
  35865. } else {
  35866. return $1;
  35867. }
  35868. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.CodeGenerator)});
  35869. },
  35870. args: [],
  35871. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := Dictionary new\x0a\x09\x09at: '1000-earlyPragmas' put: EarlyPragmator new;\x0a\x09\x09at: '2000-semantic' put: self semanticAnalyzer;\x0a\x09\x09at: '5000-astToIr' put: self translator;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself ]",
  35872. referencedClasses: ["Dictionary", "EarlyPragmator"],
  35873. messageSends: ["ifNil:", "at:put:", "new", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
  35874. }),
  35875. $globals.CodeGenerator);
  35876. $core.addMethod(
  35877. $core.method({
  35878. selector: "translator",
  35879. protocol: "compiling",
  35880. fn: function (){
  35881. var self=this,$self=this;
  35882. return $core.withContext(function($ctx1) {
  35883. var $1;
  35884. $1=$recv($globals.IRASTTranslator)._new();
  35885. $recv($1)._source_($self._source());
  35886. $recv($1)._theClass_($self._currentClass());
  35887. return $recv($1)._yourself();
  35888. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  35889. },
  35890. args: [],
  35891. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  35892. referencedClasses: ["IRASTTranslator"],
  35893. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  35894. }),
  35895. $globals.CodeGenerator);
  35896. $core.addClass("Compiler", $globals.Object, ["currentClass", "currentPackage", "source", "codeGeneratorClass", "codeGenerator"], "Compiler-Core");
  35897. $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`";
  35898. $core.addMethod(
  35899. $core.method({
  35900. selector: "ast:forClass:protocol:",
  35901. protocol: "compiling",
  35902. fn: function (aString,aClass,anotherString){
  35903. var self=this,$self=this;
  35904. return $core.withContext(function($ctx1) {
  35905. var $early={};
  35906. try {
  35907. $self._source_(aString);
  35908. $self._forClass_protocol_(aClass,anotherString);
  35909. $recv($recv($self._codeGenerator())._transformersDictionary())._at_put_("2500-astCheckpoint",(function(x){
  35910. throw $early=[x];
  35911. }));
  35912. $self._compileNode_($self._parse_(aString));
  35913. $recv($globals.CompilerError)._signal_("AST transformation failed.");
  35914. return self;
  35915. }
  35916. catch(e) {if(e===$early)return e[0]; throw e}
  35917. }, function($ctx1) {$ctx1.fill(self,"ast:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  35918. },
  35919. args: ["aString", "aClass", "anotherString"],
  35920. source: "ast: aString forClass: aClass protocol: anotherString\x0a\x09self\x0a\x09\x09source: aString;\x0a\x09\x09forClass: aClass protocol: anotherString.\x0a\x0a\x09self codeGenerator transformersDictionary at: '2500-astCheckpoint' put: [ :x | ^x ].\x0a\x09\x0a\x09self compileNode: (self parse: aString).\x0a\x0a\x09CompilerError signal: 'AST transformation failed.'",
  35921. referencedClasses: ["CompilerError"],
  35922. messageSends: ["source:", "forClass:protocol:", "at:put:", "transformersDictionary", "codeGenerator", "compileNode:", "parse:", "signal:"]
  35923. }),
  35924. $globals.Compiler);
  35925. $core.addMethod(
  35926. $core.method({
  35927. selector: "cleanCodeGenerator",
  35928. protocol: "accessing",
  35929. fn: function (){
  35930. var self=this,$self=this;
  35931. $self["@codeGenerator"]=nil;
  35932. return self;
  35933. },
  35934. args: [],
  35935. source: "cleanCodeGenerator\x0a\x09codeGenerator := nil",
  35936. referencedClasses: [],
  35937. messageSends: []
  35938. }),
  35939. $globals.Compiler);
  35940. $core.addMethod(
  35941. $core.method({
  35942. selector: "codeGenerator",
  35943. protocol: "accessing",
  35944. fn: function (){
  35945. var self=this,$self=this;
  35946. return $core.withContext(function($ctx1) {
  35947. var $1,$2,$receiver;
  35948. $1=$self["@codeGenerator"];
  35949. if(($receiver = $1) == null || $receiver.a$nil){
  35950. $2=$recv($self._codeGeneratorClass())._new();
  35951. $recv($2)._source_($self._source());
  35952. $recv($2)._currentClass_($self._currentClass());
  35953. $recv($2)._currentPackage_($self._currentPackage());
  35954. $self["@codeGenerator"]=$recv($2)._yourself();
  35955. return $self["@codeGenerator"];
  35956. } else {
  35957. return $1;
  35958. }
  35959. }, function($ctx1) {$ctx1.fill(self,"codeGenerator",{},$globals.Compiler)});
  35960. },
  35961. args: [],
  35962. source: "codeGenerator\x0a\x09^ codeGenerator ifNil: [ codeGenerator := self codeGeneratorClass new\x0a\x09\x09\x09source: self source;\x0a\x09\x09\x09currentClass: self currentClass;\x0a\x09\x09\x09currentPackage: self currentPackage;\x0a\x09\x09\x09yourself ]",
  35963. referencedClasses: [],
  35964. messageSends: ["ifNil:", "source:", "new", "codeGeneratorClass", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "yourself"]
  35965. }),
  35966. $globals.Compiler);
  35967. $core.addMethod(
  35968. $core.method({
  35969. selector: "codeGeneratorClass",
  35970. protocol: "accessing",
  35971. fn: function (){
  35972. var self=this,$self=this;
  35973. return $core.withContext(function($ctx1) {
  35974. var $1,$receiver;
  35975. $1=$self["@codeGeneratorClass"];
  35976. if(($receiver = $1) == null || $receiver.a$nil){
  35977. return $globals.InliningCodeGenerator;
  35978. } else {
  35979. return $1;
  35980. }
  35981. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  35982. },
  35983. args: [],
  35984. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  35985. referencedClasses: ["InliningCodeGenerator"],
  35986. messageSends: ["ifNil:"]
  35987. }),
  35988. $globals.Compiler);
  35989. $core.addMethod(
  35990. $core.method({
  35991. selector: "codeGeneratorClass:",
  35992. protocol: "accessing",
  35993. fn: function (aClass){
  35994. var self=this,$self=this;
  35995. $self["@codeGeneratorClass"]=aClass;
  35996. return self;
  35997. },
  35998. args: ["aClass"],
  35999. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  36000. referencedClasses: [],
  36001. messageSends: []
  36002. }),
  36003. $globals.Compiler);
  36004. $core.addMethod(
  36005. $core.method({
  36006. selector: "compile:forClass:protocol:",
  36007. protocol: "compiling",
  36008. fn: function (aString,aClass,anotherString){
  36009. var self=this,$self=this;
  36010. return $core.withContext(function($ctx1) {
  36011. $self._source_(aString);
  36012. $self._forClass_protocol_(aClass,anotherString);
  36013. return $self._compileNode_($self._parse_(aString));
  36014. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  36015. },
  36016. args: ["aString", "aClass", "anotherString"],
  36017. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09forClass: aClass protocol: anotherString;\x0a\x09\x09compileNode: (self parse: aString)",
  36018. referencedClasses: [],
  36019. messageSends: ["source:", "forClass:protocol:", "compileNode:", "parse:"]
  36020. }),
  36021. $globals.Compiler);
  36022. $core.addMethod(
  36023. $core.method({
  36024. selector: "compileExpression:on:",
  36025. protocol: "compiling",
  36026. fn: function (aString,anObject){
  36027. var self=this,$self=this;
  36028. return $core.withContext(function($ctx1) {
  36029. var $1;
  36030. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  36031. $ctx1.sendIdx[","]=1;
  36032. return $self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  36033. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  36034. },
  36035. args: ["aString", "anObject"],
  36036. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  36037. referencedClasses: [],
  36038. messageSends: ["compile:forClass:protocol:", ",", "class"]
  36039. }),
  36040. $globals.Compiler);
  36041. $core.addMethod(
  36042. $core.method({
  36043. selector: "compileNode:",
  36044. protocol: "compiling",
  36045. fn: function (aNode){
  36046. var self=this,$self=this;
  36047. var result;
  36048. return $core.withContext(function($ctx1) {
  36049. result=$recv($self._codeGenerator())._compileNode_(aNode);
  36050. $self._cleanCodeGenerator();
  36051. return result;
  36052. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,result:result},$globals.Compiler)});
  36053. },
  36054. args: ["aNode"],
  36055. source: "compileNode: aNode\x0a | result |\x0a\x09result := self codeGenerator compileNode: aNode.\x0a\x09self cleanCodeGenerator.\x0a\x09^ result",
  36056. referencedClasses: [],
  36057. messageSends: ["compileNode:", "codeGenerator", "cleanCodeGenerator"]
  36058. }),
  36059. $globals.Compiler);
  36060. $core.addMethod(
  36061. $core.method({
  36062. selector: "currentClass",
  36063. protocol: "accessing",
  36064. fn: function (){
  36065. var self=this,$self=this;
  36066. return $self["@currentClass"];
  36067. },
  36068. args: [],
  36069. source: "currentClass\x0a\x09^ currentClass",
  36070. referencedClasses: [],
  36071. messageSends: []
  36072. }),
  36073. $globals.Compiler);
  36074. $core.addMethod(
  36075. $core.method({
  36076. selector: "currentClass:",
  36077. protocol: "accessing",
  36078. fn: function (aClass){
  36079. var self=this,$self=this;
  36080. $self["@currentClass"]=aClass;
  36081. return self;
  36082. },
  36083. args: ["aClass"],
  36084. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  36085. referencedClasses: [],
  36086. messageSends: []
  36087. }),
  36088. $globals.Compiler);
  36089. $core.addMethod(
  36090. $core.method({
  36091. selector: "currentPackage",
  36092. protocol: "accessing",
  36093. fn: function (){
  36094. var self=this,$self=this;
  36095. return $self["@currentPackage"];
  36096. },
  36097. args: [],
  36098. source: "currentPackage\x0a\x09^ currentPackage",
  36099. referencedClasses: [],
  36100. messageSends: []
  36101. }),
  36102. $globals.Compiler);
  36103. $core.addMethod(
  36104. $core.method({
  36105. selector: "currentPackage:",
  36106. protocol: "accessing",
  36107. fn: function (anObject){
  36108. var self=this,$self=this;
  36109. $self["@currentPackage"]=anObject;
  36110. return self;
  36111. },
  36112. args: ["anObject"],
  36113. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  36114. referencedClasses: [],
  36115. messageSends: []
  36116. }),
  36117. $globals.Compiler);
  36118. $core.addMethod(
  36119. $core.method({
  36120. selector: "eval:",
  36121. protocol: "compiling",
  36122. fn: function (aString){
  36123. var self=this,$self=this;
  36124. return $core.withContext(function($ctx1) {
  36125. return eval(aString);
  36126. return self;
  36127. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  36128. },
  36129. args: ["aString"],
  36130. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  36131. referencedClasses: [],
  36132. messageSends: []
  36133. }),
  36134. $globals.Compiler);
  36135. $core.addMethod(
  36136. $core.method({
  36137. selector: "eval:forPackage:",
  36138. protocol: "compiling",
  36139. fn: function (aString,aPackage){
  36140. var self=this,$self=this;
  36141. return $core.withContext(function($ctx1) {
  36142. var $receiver;
  36143. if(($receiver = aPackage) == null || $receiver.a$nil){
  36144. return $self._eval_(aString);
  36145. $ctx1.sendIdx["eval:"]=1;
  36146. } else {
  36147. return $recv(aPackage)._eval_(aString);
  36148. }
  36149. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  36150. },
  36151. args: ["aString", "aPackage"],
  36152. source: "eval: aString forPackage: aPackage\x0a\x09^ aPackage\x0a\x09\x09ifNil: [ self eval: aString ]\x0a\x09\x09ifNotNil: [ aPackage eval: aString ]",
  36153. referencedClasses: [],
  36154. messageSends: ["ifNil:ifNotNil:", "eval:"]
  36155. }),
  36156. $globals.Compiler);
  36157. $core.addMethod(
  36158. $core.method({
  36159. selector: "evaluateExpression:",
  36160. protocol: "compiling",
  36161. fn: function (aString){
  36162. var self=this,$self=this;
  36163. return $core.withContext(function($ctx1) {
  36164. return $self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  36165. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  36166. },
  36167. args: ["aString"],
  36168. 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",
  36169. referencedClasses: ["DoIt"],
  36170. messageSends: ["evaluateExpression:on:", "new"]
  36171. }),
  36172. $globals.Compiler);
  36173. $core.addMethod(
  36174. $core.method({
  36175. selector: "evaluateExpression:on:",
  36176. protocol: "compiling",
  36177. fn: function (aString,anObject){
  36178. var self=this,$self=this;
  36179. var result,method;
  36180. return $core.withContext(function($ctx1) {
  36181. var $1;
  36182. method=$self._eval_($self._compileExpression_on_(aString,anObject));
  36183. $recv(method)._protocol_("**xxxDoIt");
  36184. $1=$recv(anObject)._class();
  36185. $ctx1.sendIdx["class"]=1;
  36186. $recv($1)._addCompiledMethod_(method);
  36187. result=$recv(anObject)._xxxDoIt();
  36188. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  36189. return result;
  36190. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  36191. },
  36192. args: ["aString", "anObject"],
  36193. 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",
  36194. referencedClasses: [],
  36195. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  36196. }),
  36197. $globals.Compiler);
  36198. $core.addMethod(
  36199. $core.method({
  36200. selector: "forClass:protocol:",
  36201. protocol: "compiling",
  36202. fn: function (aClass,anotherString){
  36203. var self=this,$self=this;
  36204. return $core.withContext(function($ctx1) {
  36205. $self._currentPackage_($recv(aClass)._packageOfProtocol_(anotherString));
  36206. $self._currentClass_(aClass);
  36207. return self;
  36208. }, function($ctx1) {$ctx1.fill(self,"forClass:protocol:",{aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  36209. },
  36210. args: ["aClass", "anotherString"],
  36211. source: "forClass: aClass protocol: anotherString\x0a\x09self\x0a\x09\x09currentPackage: (aClass packageOfProtocol: anotherString);\x0a\x09\x09currentClass: aClass",
  36212. referencedClasses: [],
  36213. messageSends: ["currentPackage:", "packageOfProtocol:", "currentClass:"]
  36214. }),
  36215. $globals.Compiler);
  36216. $core.addMethod(
  36217. $core.method({
  36218. selector: "install:forClass:protocol:",
  36219. protocol: "compiling",
  36220. fn: function (aString,aBehavior,anotherString){
  36221. var self=this,$self=this;
  36222. var compiledMethod;
  36223. return $core.withContext(function($ctx1) {
  36224. compiledMethod=$self._eval_forPackage_($self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  36225. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  36226. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  36227. },
  36228. args: ["aString", "aBehavior", "anotherString"],
  36229. 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",
  36230. referencedClasses: ["ClassBuilder"],
  36231. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  36232. }),
  36233. $globals.Compiler);
  36234. $core.addMethod(
  36235. $core.method({
  36236. selector: "parse:",
  36237. protocol: "compiling",
  36238. fn: function (aString){
  36239. var self=this,$self=this;
  36240. return $core.withContext(function($ctx1) {
  36241. return $recv($globals.Smalltalk)._parse_(aString);
  36242. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  36243. },
  36244. args: ["aString"],
  36245. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  36246. referencedClasses: ["Smalltalk"],
  36247. messageSends: ["parse:"]
  36248. }),
  36249. $globals.Compiler);
  36250. $core.addMethod(
  36251. $core.method({
  36252. selector: "parseExpression:",
  36253. protocol: "compiling",
  36254. fn: function (aString){
  36255. var self=this,$self=this;
  36256. return $core.withContext(function($ctx1) {
  36257. var $1;
  36258. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  36259. $ctx1.sendIdx[","]=1;
  36260. return $self._parse_($1);
  36261. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  36262. },
  36263. args: ["aString"],
  36264. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  36265. referencedClasses: [],
  36266. messageSends: ["parse:", ","]
  36267. }),
  36268. $globals.Compiler);
  36269. $core.addMethod(
  36270. $core.method({
  36271. selector: "recompile:",
  36272. protocol: "compiling",
  36273. fn: function (aClass){
  36274. var self=this,$self=this;
  36275. return $core.withContext(function($ctx1) {
  36276. var $1,$2,$3,$receiver;
  36277. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  36278. return $core.withContext(function($ctx2) {
  36279. $1=$recv($recv(each)._methodClass()).__eq(aClass);
  36280. $ctx2.sendIdx["="]=1;
  36281. if($core.assert($1)){
  36282. return $self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  36283. }
  36284. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36285. }),"Recompiling ".__comma($recv(aClass)._name()));
  36286. $2=$recv(aClass)._theMetaClass();
  36287. if(($receiver = $2) == null || $receiver.a$nil){
  36288. $2;
  36289. } else {
  36290. var meta;
  36291. meta=$receiver;
  36292. $3=$recv(meta).__eq(aClass);
  36293. if(!$core.assert($3)){
  36294. $self._recompile_(meta);
  36295. }
  36296. }
  36297. return self;
  36298. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  36299. },
  36300. args: ["aClass"],
  36301. 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 ] ]",
  36302. referencedClasses: [],
  36303. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifNotNil:", "theMetaClass", "ifFalse:", "recompile:"]
  36304. }),
  36305. $globals.Compiler);
  36306. $core.addMethod(
  36307. $core.method({
  36308. selector: "recompileAll",
  36309. protocol: "compiling",
  36310. fn: function (){
  36311. var self=this,$self=this;
  36312. return $core.withContext(function($ctx1) {
  36313. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  36314. return $core.withContext(function($ctx2) {
  36315. return $self._recompile_(each);
  36316. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36317. }),"Compiling all classes...");
  36318. return self;
  36319. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  36320. },
  36321. args: [],
  36322. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  36323. referencedClasses: ["Smalltalk"],
  36324. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  36325. }),
  36326. $globals.Compiler);
  36327. $core.addMethod(
  36328. $core.method({
  36329. selector: "source",
  36330. protocol: "accessing",
  36331. fn: function (){
  36332. var self=this,$self=this;
  36333. return $core.withContext(function($ctx1) {
  36334. var $1,$receiver;
  36335. $1=$self["@source"];
  36336. if(($receiver = $1) == null || $receiver.a$nil){
  36337. return "";
  36338. } else {
  36339. return $1;
  36340. }
  36341. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  36342. },
  36343. args: [],
  36344. source: "source\x0a\x09^ source ifNil: [ '' ]",
  36345. referencedClasses: [],
  36346. messageSends: ["ifNil:"]
  36347. }),
  36348. $globals.Compiler);
  36349. $core.addMethod(
  36350. $core.method({
  36351. selector: "source:",
  36352. protocol: "accessing",
  36353. fn: function (aString){
  36354. var self=this,$self=this;
  36355. $self["@source"]=aString;
  36356. return self;
  36357. },
  36358. args: ["aString"],
  36359. source: "source: aString\x0a\x09source := aString",
  36360. referencedClasses: [],
  36361. messageSends: []
  36362. }),
  36363. $globals.Compiler);
  36364. $core.addMethod(
  36365. $core.method({
  36366. selector: "eval:",
  36367. protocol: "evaluating",
  36368. fn: function (aString){
  36369. var self=this,$self=this;
  36370. return $core.withContext(function($ctx1) {
  36371. return $recv($self._new())._eval_(aString);
  36372. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler.a$cls)});
  36373. },
  36374. args: ["aString"],
  36375. source: "eval: aString\x0a\x09^ self new eval: aString",
  36376. referencedClasses: [],
  36377. messageSends: ["eval:", "new"]
  36378. }),
  36379. $globals.Compiler.a$cls);
  36380. $core.addMethod(
  36381. $core.method({
  36382. selector: "recompile:",
  36383. protocol: "compiling",
  36384. fn: function (aClass){
  36385. var self=this,$self=this;
  36386. return $core.withContext(function($ctx1) {
  36387. $recv($self._new())._recompile_(aClass);
  36388. return self;
  36389. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.a$cls)});
  36390. },
  36391. args: ["aClass"],
  36392. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  36393. referencedClasses: [],
  36394. messageSends: ["recompile:", "new"]
  36395. }),
  36396. $globals.Compiler.a$cls);
  36397. $core.addMethod(
  36398. $core.method({
  36399. selector: "recompileAll",
  36400. protocol: "compiling",
  36401. fn: function (){
  36402. var self=this,$self=this;
  36403. return $core.withContext(function($ctx1) {
  36404. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  36405. return $core.withContext(function($ctx2) {
  36406. return $self._recompile_(each);
  36407. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36408. }));
  36409. return self;
  36410. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.a$cls)});
  36411. },
  36412. args: [],
  36413. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  36414. referencedClasses: ["Smalltalk"],
  36415. messageSends: ["do:", "classes", "recompile:"]
  36416. }),
  36417. $globals.Compiler.a$cls);
  36418. $core.addClass("DoIt", $globals.Object, [], "Compiler-Core");
  36419. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  36420. $core.addClass("Evaluator", $globals.Object, [], "Compiler-Core");
  36421. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  36422. $core.addMethod(
  36423. $core.method({
  36424. selector: "evaluate:context:",
  36425. protocol: "evaluating",
  36426. fn: function (aString,aContext){
  36427. var self=this,$self=this;
  36428. var compiler,ast;
  36429. return $core.withContext(function($ctx1) {
  36430. var $1;
  36431. var $early={};
  36432. try {
  36433. compiler=$recv($globals.Compiler)._new();
  36434. $recv((function(){
  36435. return $core.withContext(function($ctx2) {
  36436. ast=$recv(compiler)._parseExpression_(aString);
  36437. return ast;
  36438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36439. }))._on_do_($globals.Error,(function(ex){
  36440. return $core.withContext(function($ctx2) {
  36441. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  36442. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  36443. }));
  36444. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  36445. $recv($1)._context_(aContext);
  36446. $recv($1)._visit_(ast);
  36447. return $recv(aContext)._evaluateNode_(ast);
  36448. }
  36449. catch(e) {if(e===$early)return e[0]; throw e}
  36450. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  36451. },
  36452. args: ["aString", "aContext"],
  36453. 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",
  36454. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  36455. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  36456. }),
  36457. $globals.Evaluator);
  36458. $core.addMethod(
  36459. $core.method({
  36460. selector: "evaluate:for:",
  36461. protocol: "evaluating",
  36462. fn: function (aString,anObject){
  36463. var self=this,$self=this;
  36464. return $core.withContext(function($ctx1) {
  36465. return $recv(anObject)._evaluate_on_(aString,self);
  36466. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  36467. },
  36468. args: ["aString", "anObject"],
  36469. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  36470. referencedClasses: [],
  36471. messageSends: ["evaluate:on:"]
  36472. }),
  36473. $globals.Evaluator);
  36474. $core.addMethod(
  36475. $core.method({
  36476. selector: "evaluate:receiver:",
  36477. protocol: "evaluating",
  36478. fn: function (aString,anObject){
  36479. var self=this,$self=this;
  36480. var compiler;
  36481. return $core.withContext(function($ctx1) {
  36482. var $early={};
  36483. try {
  36484. compiler=$recv($globals.Compiler)._new();
  36485. $recv((function(){
  36486. return $core.withContext(function($ctx2) {
  36487. return $recv(compiler)._parseExpression_(aString);
  36488. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36489. }))._on_do_($globals.Error,(function(ex){
  36490. return $core.withContext(function($ctx2) {
  36491. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  36492. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  36493. }));
  36494. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  36495. }
  36496. catch(e) {if(e===$early)return e[0]; throw e}
  36497. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  36498. },
  36499. args: ["aString", "anObject"],
  36500. 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",
  36501. referencedClasses: ["Compiler", "Error", "Terminal"],
  36502. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  36503. }),
  36504. $globals.Evaluator);
  36505. $core.addMethod(
  36506. $core.method({
  36507. selector: "evaluate:for:",
  36508. protocol: "instance creation",
  36509. fn: function (aString,anObject){
  36510. var self=this,$self=this;
  36511. return $core.withContext(function($ctx1) {
  36512. return $recv($self._new())._evaluate_for_(aString,anObject);
  36513. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.a$cls)});
  36514. },
  36515. args: ["aString", "anObject"],
  36516. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  36517. referencedClasses: [],
  36518. messageSends: ["evaluate:for:", "new"]
  36519. }),
  36520. $globals.Evaluator.a$cls);
  36521. $core.addClass("Pragmator", $globals.NodeVisitor, ["methodNode", "sequenceNode"], "Compiler-Core");
  36522. $globals.Pragmator.comment="I am abstract superclass for pragma-processing transformer.\x0a\x0aMy subclasses should implement messages for each pragma\x0athey process. Pragma processing checks if a message is known\x0ato a class but not to its superclass. IOW, each and only those\x0apragmas are processed which are defined as methods in the subclass.\x0a\x0aThese messages can access sequence node in which\x0aa pragma occurred and its containing method node\x0aas `self sequenceNode` and `self methodNode`.\x0a\x0aSee `EarlyPragmator` for an example.";
  36523. $core.addMethod(
  36524. $core.method({
  36525. selector: "canProcessPragma:",
  36526. protocol: "pragma processing",
  36527. fn: function (aMessage){
  36528. var self=this,$self=this;
  36529. var selector;
  36530. return $core.withContext(function($ctx1) {
  36531. selector=$recv(aMessage)._selector();
  36532. return $recv($self._respondsTo_(selector))._and_((function(){
  36533. return $core.withContext(function($ctx2) {
  36534. return $recv($recv($recv($self._class())._superclass())._canUnderstand_(selector))._not();
  36535. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36536. }));
  36537. }, function($ctx1) {$ctx1.fill(self,"canProcessPragma:",{aMessage:aMessage,selector:selector},$globals.Pragmator)});
  36538. },
  36539. args: ["aMessage"],
  36540. source: "canProcessPragma: aMessage\x0a\x09| selector |\x0a\x09selector := aMessage selector.\x0a\x09^ (self respondsTo: selector) and: [\x0a\x09\x09(self class superclass canUnderstand: selector) not]",
  36541. referencedClasses: [],
  36542. messageSends: ["selector", "and:", "respondsTo:", "not", "canUnderstand:", "superclass", "class"]
  36543. }),
  36544. $globals.Pragmator);
  36545. $core.addMethod(
  36546. $core.method({
  36547. selector: "methodNode",
  36548. protocol: "accessing",
  36549. fn: function (){
  36550. var self=this,$self=this;
  36551. return $self["@methodNode"];
  36552. },
  36553. args: [],
  36554. source: "methodNode\x0a\x09^ methodNode",
  36555. referencedClasses: [],
  36556. messageSends: []
  36557. }),
  36558. $globals.Pragmator);
  36559. $core.addMethod(
  36560. $core.method({
  36561. selector: "methodNode:",
  36562. protocol: "accessing",
  36563. fn: function (anObject){
  36564. var self=this,$self=this;
  36565. $self["@methodNode"]=anObject;
  36566. return self;
  36567. },
  36568. args: ["anObject"],
  36569. source: "methodNode: anObject\x0a\x09methodNode := anObject",
  36570. referencedClasses: [],
  36571. messageSends: []
  36572. }),
  36573. $globals.Pragmator);
  36574. $core.addMethod(
  36575. $core.method({
  36576. selector: "processPragma:",
  36577. protocol: "pragma processing",
  36578. fn: function (aMessage){
  36579. var self=this,$self=this;
  36580. return $core.withContext(function($ctx1) {
  36581. var $1;
  36582. $1=$self._canProcessPragma_(aMessage);
  36583. if($core.assert($1)){
  36584. return $recv(aMessage)._sendTo_(self);
  36585. }
  36586. return self;
  36587. }, function($ctx1) {$ctx1.fill(self,"processPragma:",{aMessage:aMessage},$globals.Pragmator)});
  36588. },
  36589. args: ["aMessage"],
  36590. source: "processPragma: aMessage\x0a\x09(self canProcessPragma: aMessage) ifTrue: [\x0a\x09\x09^ aMessage sendTo: self ]",
  36591. referencedClasses: [],
  36592. messageSends: ["ifTrue:", "canProcessPragma:", "sendTo:"]
  36593. }),
  36594. $globals.Pragmator);
  36595. $core.addMethod(
  36596. $core.method({
  36597. selector: "sequenceNode",
  36598. protocol: "accessing",
  36599. fn: function (){
  36600. var self=this,$self=this;
  36601. return $self["@sequenceNode"];
  36602. },
  36603. args: [],
  36604. source: "sequenceNode\x0a\x09^ sequenceNode",
  36605. referencedClasses: [],
  36606. messageSends: []
  36607. }),
  36608. $globals.Pragmator);
  36609. $core.addMethod(
  36610. $core.method({
  36611. selector: "sequenceNode:",
  36612. protocol: "accessing",
  36613. fn: function (anObject){
  36614. var self=this,$self=this;
  36615. $self["@sequenceNode"]=anObject;
  36616. return self;
  36617. },
  36618. args: ["anObject"],
  36619. source: "sequenceNode: anObject\x0a\x09sequenceNode := anObject",
  36620. referencedClasses: [],
  36621. messageSends: []
  36622. }),
  36623. $globals.Pragmator);
  36624. $core.addMethod(
  36625. $core.method({
  36626. selector: "visitMethodNode:",
  36627. protocol: "pragma processing",
  36628. fn: function (aNode){
  36629. var self=this,$self=this;
  36630. return $core.withContext(function($ctx1) {
  36631. var $1;
  36632. $self._methodNode_(aNode);
  36633. $1=(
  36634. $ctx1.supercall = true,
  36635. ($globals.Pragmator.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  36636. $ctx1.supercall = false;
  36637. return $1;
  36638. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.Pragmator)});
  36639. },
  36640. args: ["aNode"],
  36641. source: "visitMethodNode: aNode\x0a\x09self methodNode: aNode.\x0a\x09^ super visitMethodNode: aNode",
  36642. referencedClasses: [],
  36643. messageSends: ["methodNode:", "visitMethodNode:"]
  36644. }),
  36645. $globals.Pragmator);
  36646. $core.addMethod(
  36647. $core.method({
  36648. selector: "visitSequenceNode:",
  36649. protocol: "pragma processing",
  36650. fn: function (aNode){
  36651. var self=this,$self=this;
  36652. return $core.withContext(function($ctx1) {
  36653. var $1;
  36654. $self._sequenceNode_(aNode);
  36655. $recv($recv(aNode)._pragmas())._do_((function(each){
  36656. return $core.withContext(function($ctx2) {
  36657. return $self._processPragma_(each);
  36658. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36659. }));
  36660. $1=(
  36661. $ctx1.supercall = true,
  36662. ($globals.Pragmator.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  36663. $ctx1.supercall = false;
  36664. return $1;
  36665. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.Pragmator)});
  36666. },
  36667. args: ["aNode"],
  36668. source: "visitSequenceNode: aNode\x0a\x09self sequenceNode: aNode.\x0a\x09aNode pragmas do: [ :each | self processPragma: each ].\x0a\x09^ super visitSequenceNode: aNode",
  36669. referencedClasses: [],
  36670. messageSends: ["sequenceNode:", "do:", "pragmas", "processPragma:", "visitSequenceNode:"]
  36671. }),
  36672. $globals.Pragmator);
  36673. $core.addClass("EarlyPragmator", $globals.Pragmator, [], "Compiler-Core");
  36674. $core.addMethod(
  36675. $core.method({
  36676. selector: "asVariableName",
  36677. protocol: "*Compiler-Core",
  36678. fn: function (){
  36679. var self=this,$self=this;
  36680. return $core.withContext(function($ctx1) {
  36681. var $1;
  36682. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  36683. if($core.assert($1)){
  36684. return $self.__comma("_");
  36685. } else {
  36686. return self;
  36687. }
  36688. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  36689. },
  36690. args: [],
  36691. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  36692. referencedClasses: ["Smalltalk"],
  36693. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  36694. }),
  36695. $globals.String);
  36696. });
  36697. define('amber_core/Compiler-Semantic',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Kernel-Objects"], function($boot){"use strict";
  36698. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  36699. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  36700. var $pkg = $core.addPackage("Compiler-Semantic");
  36701. $pkg.innerEval = function (expr) { return eval(expr); };
  36702. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  36703. $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic");
  36704. $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.";
  36705. $core.addMethod(
  36706. $core.method({
  36707. selector: "addArg:",
  36708. protocol: "adding",
  36709. fn: function (aString){
  36710. var self=this,$self=this;
  36711. return $core.withContext(function($ctx1) {
  36712. var $1;
  36713. $1=$self._args();
  36714. $ctx1.sendIdx["args"]=1;
  36715. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  36716. $recv($recv($self._args())._at_(aString))._scope_(self);
  36717. return self;
  36718. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  36719. },
  36720. args: ["aString"],
  36721. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  36722. referencedClasses: ["ArgVar"],
  36723. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  36724. }),
  36725. $globals.LexicalScope);
  36726. $core.addMethod(
  36727. $core.method({
  36728. selector: "addTemp:",
  36729. protocol: "adding",
  36730. fn: function (aString){
  36731. var self=this,$self=this;
  36732. return $core.withContext(function($ctx1) {
  36733. var $1;
  36734. $1=$self._temps();
  36735. $ctx1.sendIdx["temps"]=1;
  36736. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  36737. $recv($recv($self._temps())._at_(aString))._scope_(self);
  36738. return self;
  36739. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  36740. },
  36741. args: ["aString"],
  36742. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  36743. referencedClasses: ["TempVar"],
  36744. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  36745. }),
  36746. $globals.LexicalScope);
  36747. $core.addMethod(
  36748. $core.method({
  36749. selector: "alias",
  36750. protocol: "accessing",
  36751. fn: function (){
  36752. var self=this,$self=this;
  36753. return $core.withContext(function($ctx1) {
  36754. return "$ctx".__comma($recv($self._scopeLevel())._asString());
  36755. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  36756. },
  36757. args: [],
  36758. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  36759. referencedClasses: [],
  36760. messageSends: [",", "asString", "scopeLevel"]
  36761. }),
  36762. $globals.LexicalScope);
  36763. $core.addMethod(
  36764. $core.method({
  36765. selector: "allVariableNames",
  36766. protocol: "accessing",
  36767. fn: function (){
  36768. var self=this,$self=this;
  36769. return $core.withContext(function($ctx1) {
  36770. var $1;
  36771. $1=$recv($self._args())._keys();
  36772. $ctx1.sendIdx["keys"]=1;
  36773. return $recv($1).__comma($recv($self._temps())._keys());
  36774. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  36775. },
  36776. args: [],
  36777. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  36778. referencedClasses: [],
  36779. messageSends: [",", "keys", "args", "temps"]
  36780. }),
  36781. $globals.LexicalScope);
  36782. $core.addMethod(
  36783. $core.method({
  36784. selector: "args",
  36785. protocol: "accessing",
  36786. fn: function (){
  36787. var self=this,$self=this;
  36788. return $core.withContext(function($ctx1) {
  36789. var $1,$receiver;
  36790. $1=$self["@args"];
  36791. if(($receiver = $1) == null || $receiver.a$nil){
  36792. $self["@args"]=$recv($globals.Dictionary)._new();
  36793. return $self["@args"];
  36794. } else {
  36795. return $1;
  36796. }
  36797. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  36798. },
  36799. args: [],
  36800. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  36801. referencedClasses: ["Dictionary"],
  36802. messageSends: ["ifNil:", "new"]
  36803. }),
  36804. $globals.LexicalScope);
  36805. $core.addMethod(
  36806. $core.method({
  36807. selector: "bindingFor:",
  36808. protocol: "accessing",
  36809. fn: function (aStringOrNode){
  36810. var self=this,$self=this;
  36811. return $core.withContext(function($ctx1) {
  36812. var $2,$3,$4,$5,$1;
  36813. $2=$self._pseudoVars();
  36814. $3=$recv(aStringOrNode)._value();
  36815. $ctx1.sendIdx["value"]=1;
  36816. $1=$recv($2)._at_ifAbsent_($3,(function(){
  36817. return $core.withContext(function($ctx2) {
  36818. $4=$self._args();
  36819. $5=$recv(aStringOrNode)._value();
  36820. $ctx2.sendIdx["value"]=2;
  36821. return $recv($4)._at_ifAbsent_($5,(function(){
  36822. return $core.withContext(function($ctx3) {
  36823. return $recv($self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  36824. return nil;
  36825. }));
  36826. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  36827. }));
  36828. $ctx2.sendIdx["at:ifAbsent:"]=2;
  36829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36830. }));
  36831. $ctx1.sendIdx["at:ifAbsent:"]=1;
  36832. return $1;
  36833. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  36834. },
  36835. args: ["aStringOrNode"],
  36836. 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 ]]]",
  36837. referencedClasses: [],
  36838. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  36839. }),
  36840. $globals.LexicalScope);
  36841. $core.addMethod(
  36842. $core.method({
  36843. selector: "blockIndex",
  36844. protocol: "accessing",
  36845. fn: function (){
  36846. var self=this,$self=this;
  36847. return $core.withContext(function($ctx1) {
  36848. var $1,$receiver;
  36849. $1=$self["@blockIndex"];
  36850. if(($receiver = $1) == null || $receiver.a$nil){
  36851. return (0);
  36852. } else {
  36853. return $1;
  36854. }
  36855. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  36856. },
  36857. args: [],
  36858. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  36859. referencedClasses: [],
  36860. messageSends: ["ifNil:"]
  36861. }),
  36862. $globals.LexicalScope);
  36863. $core.addMethod(
  36864. $core.method({
  36865. selector: "blockIndex:",
  36866. protocol: "accessing",
  36867. fn: function (anInteger){
  36868. var self=this,$self=this;
  36869. $self["@blockIndex"]=anInteger;
  36870. return self;
  36871. },
  36872. args: ["anInteger"],
  36873. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  36874. referencedClasses: [],
  36875. messageSends: []
  36876. }),
  36877. $globals.LexicalScope);
  36878. $core.addMethod(
  36879. $core.method({
  36880. selector: "canInlineNonLocalReturns",
  36881. protocol: "testing",
  36882. fn: function (){
  36883. var self=this,$self=this;
  36884. return $core.withContext(function($ctx1) {
  36885. return $recv($self._isInlined())._and_((function(){
  36886. return $core.withContext(function($ctx2) {
  36887. return $recv($self._outerScope())._canInlineNonLocalReturns();
  36888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36889. }));
  36890. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  36891. },
  36892. args: [],
  36893. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  36894. referencedClasses: [],
  36895. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  36896. }),
  36897. $globals.LexicalScope);
  36898. $core.addMethod(
  36899. $core.method({
  36900. selector: "instruction",
  36901. protocol: "accessing",
  36902. fn: function (){
  36903. var self=this,$self=this;
  36904. return $self["@instruction"];
  36905. },
  36906. args: [],
  36907. source: "instruction\x0a\x09^ instruction",
  36908. referencedClasses: [],
  36909. messageSends: []
  36910. }),
  36911. $globals.LexicalScope);
  36912. $core.addMethod(
  36913. $core.method({
  36914. selector: "instruction:",
  36915. protocol: "accessing",
  36916. fn: function (anIRInstruction){
  36917. var self=this,$self=this;
  36918. $self["@instruction"]=anIRInstruction;
  36919. return self;
  36920. },
  36921. args: ["anIRInstruction"],
  36922. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  36923. referencedClasses: [],
  36924. messageSends: []
  36925. }),
  36926. $globals.LexicalScope);
  36927. $core.addMethod(
  36928. $core.method({
  36929. selector: "isBlockScope",
  36930. protocol: "testing",
  36931. fn: function (){
  36932. var self=this,$self=this;
  36933. return $core.withContext(function($ctx1) {
  36934. return $recv($self._isMethodScope())._not();
  36935. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  36936. },
  36937. args: [],
  36938. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  36939. referencedClasses: [],
  36940. messageSends: ["not", "isMethodScope"]
  36941. }),
  36942. $globals.LexicalScope);
  36943. $core.addMethod(
  36944. $core.method({
  36945. selector: "isInlined",
  36946. protocol: "testing",
  36947. fn: function (){
  36948. var self=this,$self=this;
  36949. return $core.withContext(function($ctx1) {
  36950. var $2,$1;
  36951. $2=$self._instruction();
  36952. $ctx1.sendIdx["instruction"]=1;
  36953. $1=$recv($2)._notNil();
  36954. return $recv($1)._and_((function(){
  36955. return $core.withContext(function($ctx2) {
  36956. return $recv($self._instruction())._isInlined();
  36957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36958. }));
  36959. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  36960. },
  36961. args: [],
  36962. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  36963. referencedClasses: [],
  36964. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  36965. }),
  36966. $globals.LexicalScope);
  36967. $core.addMethod(
  36968. $core.method({
  36969. selector: "isMethodScope",
  36970. protocol: "testing",
  36971. fn: function (){
  36972. var self=this,$self=this;
  36973. return false;
  36974. },
  36975. args: [],
  36976. source: "isMethodScope\x0a\x09^ false",
  36977. referencedClasses: [],
  36978. messageSends: []
  36979. }),
  36980. $globals.LexicalScope);
  36981. $core.addMethod(
  36982. $core.method({
  36983. selector: "lookupVariable:",
  36984. protocol: "accessing",
  36985. fn: function (aNode){
  36986. var self=this,$self=this;
  36987. var lookup;
  36988. return $core.withContext(function($ctx1) {
  36989. var $1,$2,$receiver;
  36990. lookup=$self._bindingFor_(aNode);
  36991. $1=lookup;
  36992. if(($receiver = $1) == null || $receiver.a$nil){
  36993. $2=$self._outerScope();
  36994. $ctx1.sendIdx["outerScope"]=1;
  36995. if(($receiver = $2) == null || $receiver.a$nil){
  36996. lookup=$2;
  36997. } else {
  36998. lookup=$recv($self._outerScope())._lookupVariable_(aNode);
  36999. }
  37000. lookup;
  37001. } else {
  37002. $1;
  37003. }
  37004. return lookup;
  37005. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  37006. },
  37007. args: ["aNode"],
  37008. 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",
  37009. referencedClasses: [],
  37010. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  37011. }),
  37012. $globals.LexicalScope);
  37013. $core.addMethod(
  37014. $core.method({
  37015. selector: "methodScope",
  37016. protocol: "accessing",
  37017. fn: function (){
  37018. var self=this,$self=this;
  37019. return $core.withContext(function($ctx1) {
  37020. var $1,$receiver;
  37021. $1=$self._outerScope();
  37022. $ctx1.sendIdx["outerScope"]=1;
  37023. if(($receiver = $1) == null || $receiver.a$nil){
  37024. return $1;
  37025. } else {
  37026. return $recv($self._outerScope())._methodScope();
  37027. }
  37028. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  37029. },
  37030. args: [],
  37031. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  37032. referencedClasses: [],
  37033. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  37034. }),
  37035. $globals.LexicalScope);
  37036. $core.addMethod(
  37037. $core.method({
  37038. selector: "node",
  37039. protocol: "accessing",
  37040. fn: function (){
  37041. var self=this,$self=this;
  37042. return $self["@node"];
  37043. },
  37044. args: [],
  37045. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  37046. referencedClasses: [],
  37047. messageSends: []
  37048. }),
  37049. $globals.LexicalScope);
  37050. $core.addMethod(
  37051. $core.method({
  37052. selector: "node:",
  37053. protocol: "accessing",
  37054. fn: function (aNode){
  37055. var self=this,$self=this;
  37056. $self["@node"]=aNode;
  37057. return self;
  37058. },
  37059. args: ["aNode"],
  37060. source: "node: aNode\x0a\x09node := aNode",
  37061. referencedClasses: [],
  37062. messageSends: []
  37063. }),
  37064. $globals.LexicalScope);
  37065. $core.addMethod(
  37066. $core.method({
  37067. selector: "outerScope",
  37068. protocol: "accessing",
  37069. fn: function (){
  37070. var self=this,$self=this;
  37071. return $self["@outerScope"];
  37072. },
  37073. args: [],
  37074. source: "outerScope\x0a\x09^ outerScope",
  37075. referencedClasses: [],
  37076. messageSends: []
  37077. }),
  37078. $globals.LexicalScope);
  37079. $core.addMethod(
  37080. $core.method({
  37081. selector: "outerScope:",
  37082. protocol: "accessing",
  37083. fn: function (aLexicalScope){
  37084. var self=this,$self=this;
  37085. $self["@outerScope"]=aLexicalScope;
  37086. return self;
  37087. },
  37088. args: ["aLexicalScope"],
  37089. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  37090. referencedClasses: [],
  37091. messageSends: []
  37092. }),
  37093. $globals.LexicalScope);
  37094. $core.addMethod(
  37095. $core.method({
  37096. selector: "pseudoVars",
  37097. protocol: "accessing",
  37098. fn: function (){
  37099. var self=this,$self=this;
  37100. return $core.withContext(function($ctx1) {
  37101. return $recv($self._methodScope())._pseudoVars();
  37102. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  37103. },
  37104. args: [],
  37105. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  37106. referencedClasses: [],
  37107. messageSends: ["pseudoVars", "methodScope"]
  37108. }),
  37109. $globals.LexicalScope);
  37110. $core.addMethod(
  37111. $core.method({
  37112. selector: "scopeLevel",
  37113. protocol: "accessing",
  37114. fn: function (){
  37115. var self=this,$self=this;
  37116. return $core.withContext(function($ctx1) {
  37117. var $1,$2,$4,$3,$receiver;
  37118. $1=$self._outerScope();
  37119. $ctx1.sendIdx["outerScope"]=1;
  37120. if(($receiver = $1) == null || $receiver.a$nil){
  37121. return (1);
  37122. } else {
  37123. $1;
  37124. }
  37125. $2=$self._isInlined();
  37126. if($core.assert($2)){
  37127. $4=$self._outerScope();
  37128. $ctx1.sendIdx["outerScope"]=2;
  37129. $3=$recv($4)._scopeLevel();
  37130. $ctx1.sendIdx["scopeLevel"]=1;
  37131. return $3;
  37132. }
  37133. return $recv($recv($self._outerScope())._scopeLevel()).__plus((1));
  37134. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  37135. },
  37136. args: [],
  37137. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  37138. referencedClasses: [],
  37139. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  37140. }),
  37141. $globals.LexicalScope);
  37142. $core.addMethod(
  37143. $core.method({
  37144. selector: "temps",
  37145. protocol: "accessing",
  37146. fn: function (){
  37147. var self=this,$self=this;
  37148. return $core.withContext(function($ctx1) {
  37149. var $1,$receiver;
  37150. $1=$self["@temps"];
  37151. if(($receiver = $1) == null || $receiver.a$nil){
  37152. $self["@temps"]=$recv($globals.Dictionary)._new();
  37153. return $self["@temps"];
  37154. } else {
  37155. return $1;
  37156. }
  37157. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  37158. },
  37159. args: [],
  37160. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  37161. referencedClasses: ["Dictionary"],
  37162. messageSends: ["ifNil:", "new"]
  37163. }),
  37164. $globals.LexicalScope);
  37165. $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "unknownVariables", "localReturn", "nonLocalReturns"], "Compiler-Semantic");
  37166. $globals.MethodLexicalScope.comment="I represent a method scope.";
  37167. $core.addMethod(
  37168. $core.method({
  37169. selector: "addIVar:",
  37170. protocol: "adding",
  37171. fn: function (aString){
  37172. var self=this,$self=this;
  37173. return $core.withContext(function($ctx1) {
  37174. var $1;
  37175. $1=$self._iVars();
  37176. $ctx1.sendIdx["iVars"]=1;
  37177. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  37178. $recv($recv($self._iVars())._at_(aString))._scope_(self);
  37179. return self;
  37180. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  37181. },
  37182. args: ["aString"],
  37183. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  37184. referencedClasses: ["InstanceVar"],
  37185. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  37186. }),
  37187. $globals.MethodLexicalScope);
  37188. $core.addMethod(
  37189. $core.method({
  37190. selector: "addNonLocalReturn:",
  37191. protocol: "adding",
  37192. fn: function (aScope){
  37193. var self=this,$self=this;
  37194. return $core.withContext(function($ctx1) {
  37195. $recv($self._nonLocalReturns())._add_(aScope);
  37196. return self;
  37197. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37198. },
  37199. args: ["aScope"],
  37200. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  37201. referencedClasses: [],
  37202. messageSends: ["add:", "nonLocalReturns"]
  37203. }),
  37204. $globals.MethodLexicalScope);
  37205. $core.addMethod(
  37206. $core.method({
  37207. selector: "allVariableNames",
  37208. protocol: "accessing",
  37209. fn: function (){
  37210. var self=this,$self=this;
  37211. return $core.withContext(function($ctx1) {
  37212. var $1;
  37213. $1=(
  37214. $ctx1.supercall = true,
  37215. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($self, []));
  37216. $ctx1.supercall = false;
  37217. return $recv($1).__comma($recv($self._iVars())._keys());
  37218. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  37219. },
  37220. args: [],
  37221. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  37222. referencedClasses: [],
  37223. messageSends: [",", "allVariableNames", "keys", "iVars"]
  37224. }),
  37225. $globals.MethodLexicalScope);
  37226. $core.addMethod(
  37227. $core.method({
  37228. selector: "bindingFor:",
  37229. protocol: "accessing",
  37230. fn: function (aNode){
  37231. var self=this,$self=this;
  37232. return $core.withContext(function($ctx1) {
  37233. var $1,$receiver;
  37234. $1=(
  37235. $ctx1.supercall = true,
  37236. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($self, [aNode]));
  37237. $ctx1.supercall = false;
  37238. if(($receiver = $1) == null || $receiver.a$nil){
  37239. return $recv($self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  37240. return nil;
  37241. }));
  37242. } else {
  37243. return $1;
  37244. }
  37245. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  37246. },
  37247. args: ["aNode"],
  37248. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  37249. referencedClasses: [],
  37250. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  37251. }),
  37252. $globals.MethodLexicalScope);
  37253. $core.addMethod(
  37254. $core.method({
  37255. selector: "canInlineNonLocalReturns",
  37256. protocol: "testing",
  37257. fn: function (){
  37258. var self=this,$self=this;
  37259. return true;
  37260. },
  37261. args: [],
  37262. source: "canInlineNonLocalReturns\x0a\x09^ true",
  37263. referencedClasses: [],
  37264. messageSends: []
  37265. }),
  37266. $globals.MethodLexicalScope);
  37267. $core.addMethod(
  37268. $core.method({
  37269. selector: "hasLocalReturn",
  37270. protocol: "testing",
  37271. fn: function (){
  37272. var self=this,$self=this;
  37273. return $core.withContext(function($ctx1) {
  37274. return $self._localReturn();
  37275. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  37276. },
  37277. args: [],
  37278. source: "hasLocalReturn\x0a\x09^ self localReturn",
  37279. referencedClasses: [],
  37280. messageSends: ["localReturn"]
  37281. }),
  37282. $globals.MethodLexicalScope);
  37283. $core.addMethod(
  37284. $core.method({
  37285. selector: "hasNonLocalReturn",
  37286. protocol: "testing",
  37287. fn: function (){
  37288. var self=this,$self=this;
  37289. return $core.withContext(function($ctx1) {
  37290. return $recv($self._nonLocalReturns())._notEmpty();
  37291. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  37292. },
  37293. args: [],
  37294. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  37295. referencedClasses: [],
  37296. messageSends: ["notEmpty", "nonLocalReturns"]
  37297. }),
  37298. $globals.MethodLexicalScope);
  37299. $core.addMethod(
  37300. $core.method({
  37301. selector: "iVars",
  37302. protocol: "accessing",
  37303. fn: function (){
  37304. var self=this,$self=this;
  37305. return $core.withContext(function($ctx1) {
  37306. var $1,$receiver;
  37307. $1=$self["@iVars"];
  37308. if(($receiver = $1) == null || $receiver.a$nil){
  37309. $self["@iVars"]=$recv($globals.Dictionary)._new();
  37310. return $self["@iVars"];
  37311. } else {
  37312. return $1;
  37313. }
  37314. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  37315. },
  37316. args: [],
  37317. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  37318. referencedClasses: ["Dictionary"],
  37319. messageSends: ["ifNil:", "new"]
  37320. }),
  37321. $globals.MethodLexicalScope);
  37322. $core.addMethod(
  37323. $core.method({
  37324. selector: "isMethodScope",
  37325. protocol: "testing",
  37326. fn: function (){
  37327. var self=this,$self=this;
  37328. return true;
  37329. },
  37330. args: [],
  37331. source: "isMethodScope\x0a\x09^ true",
  37332. referencedClasses: [],
  37333. messageSends: []
  37334. }),
  37335. $globals.MethodLexicalScope);
  37336. $core.addMethod(
  37337. $core.method({
  37338. selector: "localReturn",
  37339. protocol: "accessing",
  37340. fn: function (){
  37341. var self=this,$self=this;
  37342. return $core.withContext(function($ctx1) {
  37343. var $1,$receiver;
  37344. $1=$self["@localReturn"];
  37345. if(($receiver = $1) == null || $receiver.a$nil){
  37346. return false;
  37347. } else {
  37348. return $1;
  37349. }
  37350. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  37351. },
  37352. args: [],
  37353. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  37354. referencedClasses: [],
  37355. messageSends: ["ifNil:"]
  37356. }),
  37357. $globals.MethodLexicalScope);
  37358. $core.addMethod(
  37359. $core.method({
  37360. selector: "localReturn:",
  37361. protocol: "accessing",
  37362. fn: function (aBoolean){
  37363. var self=this,$self=this;
  37364. $self["@localReturn"]=aBoolean;
  37365. return self;
  37366. },
  37367. args: ["aBoolean"],
  37368. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  37369. referencedClasses: [],
  37370. messageSends: []
  37371. }),
  37372. $globals.MethodLexicalScope);
  37373. $core.addMethod(
  37374. $core.method({
  37375. selector: "methodScope",
  37376. protocol: "accessing",
  37377. fn: function (){
  37378. var self=this,$self=this;
  37379. return self;
  37380. },
  37381. args: [],
  37382. source: "methodScope\x0a\x09^ self",
  37383. referencedClasses: [],
  37384. messageSends: []
  37385. }),
  37386. $globals.MethodLexicalScope);
  37387. $core.addMethod(
  37388. $core.method({
  37389. selector: "nonLocalReturns",
  37390. protocol: "accessing",
  37391. fn: function (){
  37392. var self=this,$self=this;
  37393. return $core.withContext(function($ctx1) {
  37394. var $1,$receiver;
  37395. $1=$self["@nonLocalReturns"];
  37396. if(($receiver = $1) == null || $receiver.a$nil){
  37397. $self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  37398. return $self["@nonLocalReturns"];
  37399. } else {
  37400. return $1;
  37401. }
  37402. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  37403. },
  37404. args: [],
  37405. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  37406. referencedClasses: ["OrderedCollection"],
  37407. messageSends: ["ifNil:", "new"]
  37408. }),
  37409. $globals.MethodLexicalScope);
  37410. $core.addMethod(
  37411. $core.method({
  37412. selector: "pseudoVars",
  37413. protocol: "accessing",
  37414. fn: function (){
  37415. var self=this,$self=this;
  37416. return $core.withContext(function($ctx1) {
  37417. var $1,$2,$4,$3,$receiver;
  37418. $1=$self["@pseudoVars"];
  37419. if(($receiver = $1) == null || $receiver.a$nil){
  37420. $self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  37421. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  37422. return $core.withContext(function($ctx2) {
  37423. $2=$self["@pseudoVars"];
  37424. $4=$recv($globals.PseudoVar)._on_(each);
  37425. $recv($4)._scope_($self._methodScope());
  37426. $3=$recv($4)._yourself();
  37427. return $recv($2)._at_put_(each,$3);
  37428. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37429. }));
  37430. } else {
  37431. $1;
  37432. }
  37433. return $self["@pseudoVars"];
  37434. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  37435. },
  37436. args: [],
  37437. 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",
  37438. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  37439. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  37440. }),
  37441. $globals.MethodLexicalScope);
  37442. $core.addMethod(
  37443. $core.method({
  37444. selector: "removeNonLocalReturn:",
  37445. protocol: "adding",
  37446. fn: function (aScope){
  37447. var self=this,$self=this;
  37448. return $core.withContext(function($ctx1) {
  37449. $recv($self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  37450. }));
  37451. return self;
  37452. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37453. },
  37454. args: ["aScope"],
  37455. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  37456. referencedClasses: [],
  37457. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  37458. }),
  37459. $globals.MethodLexicalScope);
  37460. $core.addMethod(
  37461. $core.method({
  37462. selector: "unknownVariables",
  37463. protocol: "accessing",
  37464. fn: function (){
  37465. var self=this,$self=this;
  37466. return $core.withContext(function($ctx1) {
  37467. var $1,$receiver;
  37468. $1=$self["@unknownVariables"];
  37469. if(($receiver = $1) == null || $receiver.a$nil){
  37470. $self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  37471. return $self["@unknownVariables"];
  37472. } else {
  37473. return $1;
  37474. }
  37475. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  37476. },
  37477. args: [],
  37478. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  37479. referencedClasses: ["OrderedCollection"],
  37480. messageSends: ["ifNil:", "new"]
  37481. }),
  37482. $globals.MethodLexicalScope);
  37483. $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic");
  37484. $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.";
  37485. $core.addMethod(
  37486. $core.method({
  37487. selector: "alias",
  37488. protocol: "accessing",
  37489. fn: function (){
  37490. var self=this,$self=this;
  37491. return $core.withContext(function($ctx1) {
  37492. return $recv($self._name())._asVariableName();
  37493. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  37494. },
  37495. args: [],
  37496. source: "alias\x0a\x09^ self name asVariableName",
  37497. referencedClasses: [],
  37498. messageSends: ["asVariableName", "name"]
  37499. }),
  37500. $globals.ScopeVar);
  37501. $core.addMethod(
  37502. $core.method({
  37503. selector: "isArgVar",
  37504. protocol: "testing",
  37505. fn: function (){
  37506. var self=this,$self=this;
  37507. return false;
  37508. },
  37509. args: [],
  37510. source: "isArgVar\x0a\x09^ false",
  37511. referencedClasses: [],
  37512. messageSends: []
  37513. }),
  37514. $globals.ScopeVar);
  37515. $core.addMethod(
  37516. $core.method({
  37517. selector: "isClassRefVar",
  37518. protocol: "testing",
  37519. fn: function (){
  37520. var self=this,$self=this;
  37521. return false;
  37522. },
  37523. args: [],
  37524. source: "isClassRefVar\x0a\x09^ false",
  37525. referencedClasses: [],
  37526. messageSends: []
  37527. }),
  37528. $globals.ScopeVar);
  37529. $core.addMethod(
  37530. $core.method({
  37531. selector: "isImmutable",
  37532. protocol: "testing",
  37533. fn: function (){
  37534. var self=this,$self=this;
  37535. return false;
  37536. },
  37537. args: [],
  37538. source: "isImmutable\x0a\x09^ false",
  37539. referencedClasses: [],
  37540. messageSends: []
  37541. }),
  37542. $globals.ScopeVar);
  37543. $core.addMethod(
  37544. $core.method({
  37545. selector: "isInstanceVar",
  37546. protocol: "testing",
  37547. fn: function (){
  37548. var self=this,$self=this;
  37549. return false;
  37550. },
  37551. args: [],
  37552. source: "isInstanceVar\x0a\x09^ false",
  37553. referencedClasses: [],
  37554. messageSends: []
  37555. }),
  37556. $globals.ScopeVar);
  37557. $core.addMethod(
  37558. $core.method({
  37559. selector: "isPseudoVar",
  37560. protocol: "testing",
  37561. fn: function (){
  37562. var self=this,$self=this;
  37563. return false;
  37564. },
  37565. args: [],
  37566. source: "isPseudoVar\x0a\x09^ false",
  37567. referencedClasses: [],
  37568. messageSends: []
  37569. }),
  37570. $globals.ScopeVar);
  37571. $core.addMethod(
  37572. $core.method({
  37573. selector: "isSelf",
  37574. protocol: "testing",
  37575. fn: function (){
  37576. var self=this,$self=this;
  37577. return false;
  37578. },
  37579. args: [],
  37580. source: "isSelf\x0a\x09^ false",
  37581. referencedClasses: [],
  37582. messageSends: []
  37583. }),
  37584. $globals.ScopeVar);
  37585. $core.addMethod(
  37586. $core.method({
  37587. selector: "isSuper",
  37588. protocol: "testing",
  37589. fn: function (){
  37590. var self=this,$self=this;
  37591. return false;
  37592. },
  37593. args: [],
  37594. source: "isSuper\x0a\x09^ false",
  37595. referencedClasses: [],
  37596. messageSends: []
  37597. }),
  37598. $globals.ScopeVar);
  37599. $core.addMethod(
  37600. $core.method({
  37601. selector: "isTempVar",
  37602. protocol: "testing",
  37603. fn: function (){
  37604. var self=this,$self=this;
  37605. return false;
  37606. },
  37607. args: [],
  37608. source: "isTempVar\x0a\x09^ false",
  37609. referencedClasses: [],
  37610. messageSends: []
  37611. }),
  37612. $globals.ScopeVar);
  37613. $core.addMethod(
  37614. $core.method({
  37615. selector: "isUnknownVar",
  37616. protocol: "testing",
  37617. fn: function (){
  37618. var self=this,$self=this;
  37619. return false;
  37620. },
  37621. args: [],
  37622. source: "isUnknownVar\x0a\x09^ false",
  37623. referencedClasses: [],
  37624. messageSends: []
  37625. }),
  37626. $globals.ScopeVar);
  37627. $core.addMethod(
  37628. $core.method({
  37629. selector: "name",
  37630. protocol: "accessing",
  37631. fn: function (){
  37632. var self=this,$self=this;
  37633. return $self["@name"];
  37634. },
  37635. args: [],
  37636. source: "name\x0a\x09^ name",
  37637. referencedClasses: [],
  37638. messageSends: []
  37639. }),
  37640. $globals.ScopeVar);
  37641. $core.addMethod(
  37642. $core.method({
  37643. selector: "name:",
  37644. protocol: "accessing",
  37645. fn: function (aString){
  37646. var self=this,$self=this;
  37647. $self["@name"]=aString;
  37648. return self;
  37649. },
  37650. args: ["aString"],
  37651. source: "name: aString\x0a\x09name := aString",
  37652. referencedClasses: [],
  37653. messageSends: []
  37654. }),
  37655. $globals.ScopeVar);
  37656. $core.addMethod(
  37657. $core.method({
  37658. selector: "scope",
  37659. protocol: "accessing",
  37660. fn: function (){
  37661. var self=this,$self=this;
  37662. return $self["@scope"];
  37663. },
  37664. args: [],
  37665. source: "scope\x0a\x09^ scope",
  37666. referencedClasses: [],
  37667. messageSends: []
  37668. }),
  37669. $globals.ScopeVar);
  37670. $core.addMethod(
  37671. $core.method({
  37672. selector: "scope:",
  37673. protocol: "accessing",
  37674. fn: function (aScope){
  37675. var self=this,$self=this;
  37676. $self["@scope"]=aScope;
  37677. return self;
  37678. },
  37679. args: ["aScope"],
  37680. source: "scope: aScope\x0a\x09scope := aScope",
  37681. referencedClasses: [],
  37682. messageSends: []
  37683. }),
  37684. $globals.ScopeVar);
  37685. $core.addMethod(
  37686. $core.method({
  37687. selector: "validateAssignment",
  37688. protocol: "testing",
  37689. fn: function (){
  37690. var self=this,$self=this;
  37691. return $core.withContext(function($ctx1) {
  37692. var $1,$2;
  37693. $1=$recv($self._isArgVar())._or_((function(){
  37694. return $core.withContext(function($ctx2) {
  37695. return $self._isPseudoVar();
  37696. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37697. }));
  37698. if($core.assert($1)){
  37699. $2=$recv($globals.InvalidAssignmentError)._new();
  37700. $recv($2)._variableName_($self._name());
  37701. $recv($2)._signal();
  37702. }
  37703. return self;
  37704. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  37705. },
  37706. args: [],
  37707. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  37708. referencedClasses: ["InvalidAssignmentError"],
  37709. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  37710. }),
  37711. $globals.ScopeVar);
  37712. $core.addMethod(
  37713. $core.method({
  37714. selector: "on:",
  37715. protocol: "instance creation",
  37716. fn: function (aString){
  37717. var self=this,$self=this;
  37718. return $core.withContext(function($ctx1) {
  37719. var $1;
  37720. $1=$self._new();
  37721. $recv($1)._name_(aString);
  37722. return $recv($1)._yourself();
  37723. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.a$cls)});
  37724. },
  37725. args: ["aString"],
  37726. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  37727. referencedClasses: [],
  37728. messageSends: ["name:", "new", "yourself"]
  37729. }),
  37730. $globals.ScopeVar.a$cls);
  37731. $core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic");
  37732. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  37733. $core.addMethod(
  37734. $core.method({
  37735. selector: "isImmutable",
  37736. protocol: "testing",
  37737. fn: function (){
  37738. var self=this,$self=this;
  37739. return true;
  37740. },
  37741. args: [],
  37742. source: "isImmutable\x0a\x09^ true",
  37743. referencedClasses: [],
  37744. messageSends: []
  37745. }),
  37746. $globals.AliasVar);
  37747. $core.addMethod(
  37748. $core.method({
  37749. selector: "node",
  37750. protocol: "accessing",
  37751. fn: function (){
  37752. var self=this,$self=this;
  37753. return $self["@node"];
  37754. },
  37755. args: [],
  37756. source: "node\x0a\x09^ node",
  37757. referencedClasses: [],
  37758. messageSends: []
  37759. }),
  37760. $globals.AliasVar);
  37761. $core.addMethod(
  37762. $core.method({
  37763. selector: "node:",
  37764. protocol: "accessing",
  37765. fn: function (aNode){
  37766. var self=this,$self=this;
  37767. $self["@node"]=aNode;
  37768. return self;
  37769. },
  37770. args: ["aNode"],
  37771. source: "node: aNode\x0a\x09node := aNode",
  37772. referencedClasses: [],
  37773. messageSends: []
  37774. }),
  37775. $globals.AliasVar);
  37776. $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37777. $globals.ArgVar.comment="I am an argument of a method or block.";
  37778. $core.addMethod(
  37779. $core.method({
  37780. selector: "isArgVar",
  37781. protocol: "testing",
  37782. fn: function (){
  37783. var self=this,$self=this;
  37784. return true;
  37785. },
  37786. args: [],
  37787. source: "isArgVar\x0a\x09^ true",
  37788. referencedClasses: [],
  37789. messageSends: []
  37790. }),
  37791. $globals.ArgVar);
  37792. $core.addMethod(
  37793. $core.method({
  37794. selector: "isImmutable",
  37795. protocol: "testing",
  37796. fn: function (){
  37797. var self=this,$self=this;
  37798. return true;
  37799. },
  37800. args: [],
  37801. source: "isImmutable\x0a\x09^ true",
  37802. referencedClasses: [],
  37803. messageSends: []
  37804. }),
  37805. $globals.ArgVar);
  37806. $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37807. $globals.ClassRefVar.comment="I am an class reference variable";
  37808. $core.addMethod(
  37809. $core.method({
  37810. selector: "alias",
  37811. protocol: "accessing",
  37812. fn: function (){
  37813. var self=this,$self=this;
  37814. return $core.withContext(function($ctx1) {
  37815. return "$globals.".__comma($self._name());
  37816. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  37817. },
  37818. args: [],
  37819. 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",
  37820. referencedClasses: [],
  37821. messageSends: [",", "name"]
  37822. }),
  37823. $globals.ClassRefVar);
  37824. $core.addMethod(
  37825. $core.method({
  37826. selector: "isClassRefVar",
  37827. protocol: "testing",
  37828. fn: function (){
  37829. var self=this,$self=this;
  37830. return true;
  37831. },
  37832. args: [],
  37833. source: "isClassRefVar\x0a\x09^ true",
  37834. referencedClasses: [],
  37835. messageSends: []
  37836. }),
  37837. $globals.ClassRefVar);
  37838. $core.addMethod(
  37839. $core.method({
  37840. selector: "isImmutable",
  37841. protocol: "testing",
  37842. fn: function (){
  37843. var self=this,$self=this;
  37844. return true;
  37845. },
  37846. args: [],
  37847. source: "isImmutable\x0a\x09^ true",
  37848. referencedClasses: [],
  37849. messageSends: []
  37850. }),
  37851. $globals.ClassRefVar);
  37852. $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37853. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  37854. $core.addMethod(
  37855. $core.method({
  37856. selector: "alias",
  37857. protocol: "testing",
  37858. fn: function (){
  37859. var self=this,$self=this;
  37860. return $core.withContext(function($ctx1) {
  37861. var $1;
  37862. $1=$recv("$self[\x22@".__comma($self._name())).__comma("\x22]");
  37863. $ctx1.sendIdx[","]=1;
  37864. return $1;
  37865. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  37866. },
  37867. args: [],
  37868. source: "alias\x0a\x09^ '$self[\x22@', self name, '\x22]'",
  37869. referencedClasses: [],
  37870. messageSends: [",", "name"]
  37871. }),
  37872. $globals.InstanceVar);
  37873. $core.addMethod(
  37874. $core.method({
  37875. selector: "isInstanceVar",
  37876. protocol: "testing",
  37877. fn: function (){
  37878. var self=this,$self=this;
  37879. return true;
  37880. },
  37881. args: [],
  37882. source: "isInstanceVar\x0a\x09^ true",
  37883. referencedClasses: [],
  37884. messageSends: []
  37885. }),
  37886. $globals.InstanceVar);
  37887. $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37888. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  37889. $core.addMethod(
  37890. $core.method({
  37891. selector: "alias",
  37892. protocol: "accessing",
  37893. fn: function (){
  37894. var self=this,$self=this;
  37895. return $core.withContext(function($ctx1) {
  37896. return $self._name();
  37897. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  37898. },
  37899. args: [],
  37900. source: "alias\x0a\x09^ self name",
  37901. referencedClasses: [],
  37902. messageSends: ["name"]
  37903. }),
  37904. $globals.PseudoVar);
  37905. $core.addMethod(
  37906. $core.method({
  37907. selector: "isImmutable",
  37908. protocol: "testing",
  37909. fn: function (){
  37910. var self=this,$self=this;
  37911. return true;
  37912. },
  37913. args: [],
  37914. source: "isImmutable\x0a\x09^ true",
  37915. referencedClasses: [],
  37916. messageSends: []
  37917. }),
  37918. $globals.PseudoVar);
  37919. $core.addMethod(
  37920. $core.method({
  37921. selector: "isPseudoVar",
  37922. protocol: "testing",
  37923. fn: function (){
  37924. var self=this,$self=this;
  37925. return true;
  37926. },
  37927. args: [],
  37928. source: "isPseudoVar\x0a\x09^ true",
  37929. referencedClasses: [],
  37930. messageSends: []
  37931. }),
  37932. $globals.PseudoVar);
  37933. $core.addMethod(
  37934. $core.method({
  37935. selector: "isSelf",
  37936. protocol: "testing",
  37937. fn: function (){
  37938. var self=this,$self=this;
  37939. return $core.withContext(function($ctx1) {
  37940. return $recv($self["@name"]).__eq("self");
  37941. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.PseudoVar)});
  37942. },
  37943. args: [],
  37944. source: "isSelf\x0a\x09^ name = 'self'",
  37945. referencedClasses: [],
  37946. messageSends: ["="]
  37947. }),
  37948. $globals.PseudoVar);
  37949. $core.addMethod(
  37950. $core.method({
  37951. selector: "isSuper",
  37952. protocol: "testing",
  37953. fn: function (){
  37954. var self=this,$self=this;
  37955. return $core.withContext(function($ctx1) {
  37956. return $recv($self["@name"]).__eq("super");
  37957. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.PseudoVar)});
  37958. },
  37959. args: [],
  37960. source: "isSuper\x0a\x09^ name = 'super'",
  37961. referencedClasses: [],
  37962. messageSends: ["="]
  37963. }),
  37964. $globals.PseudoVar);
  37965. $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37966. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  37967. $core.addMethod(
  37968. $core.method({
  37969. selector: "isTempVar",
  37970. protocol: "testing",
  37971. fn: function (){
  37972. var self=this,$self=this;
  37973. return true;
  37974. },
  37975. args: [],
  37976. source: "isTempVar\x0a\x09^ true",
  37977. referencedClasses: [],
  37978. messageSends: []
  37979. }),
  37980. $globals.TempVar);
  37981. $core.addClass("UnknownVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37982. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  37983. $core.addMethod(
  37984. $core.method({
  37985. selector: "isUnknownVar",
  37986. protocol: "testing",
  37987. fn: function (){
  37988. var self=this,$self=this;
  37989. return true;
  37990. },
  37991. args: [],
  37992. source: "isUnknownVar\x0a\x09^ true",
  37993. referencedClasses: [],
  37994. messageSends: []
  37995. }),
  37996. $globals.UnknownVar);
  37997. $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic");
  37998. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  37999. $core.addMethod(
  38000. $core.method({
  38001. selector: "classReferences",
  38002. protocol: "accessing",
  38003. fn: function (){
  38004. var self=this,$self=this;
  38005. return $core.withContext(function($ctx1) {
  38006. var $1,$receiver;
  38007. $1=$self["@classReferences"];
  38008. if(($receiver = $1) == null || $receiver.a$nil){
  38009. $self["@classReferences"]=$recv($globals.Set)._new();
  38010. return $self["@classReferences"];
  38011. } else {
  38012. return $1;
  38013. }
  38014. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  38015. },
  38016. args: [],
  38017. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  38018. referencedClasses: ["Set"],
  38019. messageSends: ["ifNil:", "new"]
  38020. }),
  38021. $globals.SemanticAnalyzer);
  38022. $core.addMethod(
  38023. $core.method({
  38024. selector: "errorShadowingVariable:",
  38025. protocol: "error handling",
  38026. fn: function (aString){
  38027. var self=this,$self=this;
  38028. return $core.withContext(function($ctx1) {
  38029. var $1;
  38030. $1=$recv($globals.ShadowingVariableError)._new();
  38031. $recv($1)._variableName_(aString);
  38032. $recv($1)._signal();
  38033. return self;
  38034. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  38035. },
  38036. args: ["aString"],
  38037. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  38038. referencedClasses: ["ShadowingVariableError"],
  38039. messageSends: ["variableName:", "new", "signal"]
  38040. }),
  38041. $globals.SemanticAnalyzer);
  38042. $core.addMethod(
  38043. $core.method({
  38044. selector: "errorUnknownVariable:",
  38045. protocol: "error handling",
  38046. fn: function (aNode){
  38047. var self=this,$self=this;
  38048. var identifier;
  38049. return $core.withContext(function($ctx1) {
  38050. var $1,$2,$3;
  38051. identifier=$recv(aNode)._value();
  38052. $ctx1.sendIdx["value"]=1;
  38053. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  38054. return $core.withContext(function($ctx2) {
  38055. return $self._isVariableUndefined_inPackage_(identifier,$self._thePackage());
  38056. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38057. }));
  38058. if($core.assert($1)){
  38059. $2=$recv($globals.UnknownVariableError)._new();
  38060. $3=$recv(aNode)._value();
  38061. $ctx1.sendIdx["value"]=2;
  38062. $recv($2)._variableName_($3);
  38063. $recv($2)._signal();
  38064. } else {
  38065. $recv($recv($recv($self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  38066. }
  38067. return self;
  38068. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  38069. },
  38070. args: ["aNode"],
  38071. 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 ]",
  38072. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  38073. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  38074. }),
  38075. $globals.SemanticAnalyzer);
  38076. $core.addMethod(
  38077. $core.method({
  38078. selector: "isVariableUndefined:inPackage:",
  38079. protocol: "testing",
  38080. fn: function (aString,aPackage){
  38081. var self=this,$self=this;
  38082. return $core.withContext(function($ctx1) {
  38083. var $1,$2,$receiver;
  38084. if(($receiver = aPackage) == null || $receiver.a$nil){
  38085. aPackage;
  38086. } else {
  38087. var packageKnownVars;
  38088. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  38089. $1=$recv(packageKnownVars)._includes_(aString);
  38090. if($core.assert($1)){
  38091. return false;
  38092. }
  38093. }
  38094. $2=$recv("typeof ".__comma(aString)).__comma(" === \x22undefined\x22");
  38095. $ctx1.sendIdx[","]=1;
  38096. return $recv($globals.Compiler)._eval_($2);
  38097. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  38098. },
  38099. args: ["aString", "aPackage"],
  38100. 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'",
  38101. referencedClasses: ["Compiler"],
  38102. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", ","]
  38103. }),
  38104. $globals.SemanticAnalyzer);
  38105. $core.addMethod(
  38106. $core.method({
  38107. selector: "messageSends",
  38108. protocol: "accessing",
  38109. fn: function (){
  38110. var self=this,$self=this;
  38111. return $core.withContext(function($ctx1) {
  38112. var $1,$receiver;
  38113. $1=$self["@messageSends"];
  38114. if(($receiver = $1) == null || $receiver.a$nil){
  38115. $self["@messageSends"]=$recv($globals.Dictionary)._new();
  38116. return $self["@messageSends"];
  38117. } else {
  38118. return $1;
  38119. }
  38120. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  38121. },
  38122. args: [],
  38123. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  38124. referencedClasses: ["Dictionary"],
  38125. messageSends: ["ifNil:", "new"]
  38126. }),
  38127. $globals.SemanticAnalyzer);
  38128. $core.addMethod(
  38129. $core.method({
  38130. selector: "newBlockScope",
  38131. protocol: "factory",
  38132. fn: function (){
  38133. var self=this,$self=this;
  38134. return $core.withContext(function($ctx1) {
  38135. return $self._newScopeOfClass_($globals.LexicalScope);
  38136. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  38137. },
  38138. args: [],
  38139. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  38140. referencedClasses: ["LexicalScope"],
  38141. messageSends: ["newScopeOfClass:"]
  38142. }),
  38143. $globals.SemanticAnalyzer);
  38144. $core.addMethod(
  38145. $core.method({
  38146. selector: "newMethodScope",
  38147. protocol: "factory",
  38148. fn: function (){
  38149. var self=this,$self=this;
  38150. return $core.withContext(function($ctx1) {
  38151. return $self._newScopeOfClass_($globals.MethodLexicalScope);
  38152. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  38153. },
  38154. args: [],
  38155. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  38156. referencedClasses: ["MethodLexicalScope"],
  38157. messageSends: ["newScopeOfClass:"]
  38158. }),
  38159. $globals.SemanticAnalyzer);
  38160. $core.addMethod(
  38161. $core.method({
  38162. selector: "newScopeOfClass:",
  38163. protocol: "factory",
  38164. fn: function (aLexicalScopeClass){
  38165. var self=this,$self=this;
  38166. return $core.withContext(function($ctx1) {
  38167. var $1;
  38168. $1=$recv(aLexicalScopeClass)._new();
  38169. $recv($1)._outerScope_($self["@currentScope"]);
  38170. return $recv($1)._yourself();
  38171. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  38172. },
  38173. args: ["aLexicalScopeClass"],
  38174. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  38175. referencedClasses: [],
  38176. messageSends: ["outerScope:", "new", "yourself"]
  38177. }),
  38178. $globals.SemanticAnalyzer);
  38179. $core.addMethod(
  38180. $core.method({
  38181. selector: "nextBlockIndex",
  38182. protocol: "private",
  38183. fn: function (){
  38184. var self=this,$self=this;
  38185. return $core.withContext(function($ctx1) {
  38186. var $1,$receiver;
  38187. $1=$self["@blockIndex"];
  38188. if(($receiver = $1) == null || $receiver.a$nil){
  38189. $self["@blockIndex"]=(0);
  38190. $self["@blockIndex"];
  38191. } else {
  38192. $1;
  38193. }
  38194. $self["@blockIndex"]=$recv($self["@blockIndex"]).__plus((1));
  38195. return $self["@blockIndex"];
  38196. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  38197. },
  38198. args: [],
  38199. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  38200. referencedClasses: [],
  38201. messageSends: ["ifNil:", "+"]
  38202. }),
  38203. $globals.SemanticAnalyzer);
  38204. $core.addMethod(
  38205. $core.method({
  38206. selector: "popScope",
  38207. protocol: "scope",
  38208. fn: function (){
  38209. var self=this,$self=this;
  38210. return $core.withContext(function($ctx1) {
  38211. var $1,$receiver;
  38212. $1=$self["@currentScope"];
  38213. if(($receiver = $1) == null || $receiver.a$nil){
  38214. $1;
  38215. } else {
  38216. $self["@currentScope"]=$recv($self["@currentScope"])._outerScope();
  38217. $self["@currentScope"];
  38218. }
  38219. return self;
  38220. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  38221. },
  38222. args: [],
  38223. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  38224. referencedClasses: [],
  38225. messageSends: ["ifNotNil:", "outerScope"]
  38226. }),
  38227. $globals.SemanticAnalyzer);
  38228. $core.addMethod(
  38229. $core.method({
  38230. selector: "pushScope:",
  38231. protocol: "scope",
  38232. fn: function (aScope){
  38233. var self=this,$self=this;
  38234. return $core.withContext(function($ctx1) {
  38235. $recv(aScope)._outerScope_($self["@currentScope"]);
  38236. $self["@currentScope"]=aScope;
  38237. return self;
  38238. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  38239. },
  38240. args: ["aScope"],
  38241. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  38242. referencedClasses: [],
  38243. messageSends: ["outerScope:"]
  38244. }),
  38245. $globals.SemanticAnalyzer);
  38246. $core.addMethod(
  38247. $core.method({
  38248. selector: "theClass",
  38249. protocol: "accessing",
  38250. fn: function (){
  38251. var self=this,$self=this;
  38252. return $self["@theClass"];
  38253. },
  38254. args: [],
  38255. source: "theClass\x0a\x09^ theClass",
  38256. referencedClasses: [],
  38257. messageSends: []
  38258. }),
  38259. $globals.SemanticAnalyzer);
  38260. $core.addMethod(
  38261. $core.method({
  38262. selector: "theClass:",
  38263. protocol: "accessing",
  38264. fn: function (aClass){
  38265. var self=this,$self=this;
  38266. $self["@theClass"]=aClass;
  38267. return self;
  38268. },
  38269. args: ["aClass"],
  38270. source: "theClass: aClass\x0a\x09theClass := aClass",
  38271. referencedClasses: [],
  38272. messageSends: []
  38273. }),
  38274. $globals.SemanticAnalyzer);
  38275. $core.addMethod(
  38276. $core.method({
  38277. selector: "thePackage",
  38278. protocol: "accessing",
  38279. fn: function (){
  38280. var self=this,$self=this;
  38281. return $self["@thePackage"];
  38282. },
  38283. args: [],
  38284. source: "thePackage\x0a\x09^ thePackage",
  38285. referencedClasses: [],
  38286. messageSends: []
  38287. }),
  38288. $globals.SemanticAnalyzer);
  38289. $core.addMethod(
  38290. $core.method({
  38291. selector: "thePackage:",
  38292. protocol: "accessing",
  38293. fn: function (aPackage){
  38294. var self=this,$self=this;
  38295. $self["@thePackage"]=aPackage;
  38296. return self;
  38297. },
  38298. args: ["aPackage"],
  38299. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  38300. referencedClasses: [],
  38301. messageSends: []
  38302. }),
  38303. $globals.SemanticAnalyzer);
  38304. $core.addMethod(
  38305. $core.method({
  38306. selector: "validateVariableScope:",
  38307. protocol: "scope",
  38308. fn: function (aString){
  38309. var self=this,$self=this;
  38310. return $core.withContext(function($ctx1) {
  38311. var $1,$receiver;
  38312. $1=$recv($self["@currentScope"])._lookupVariable_(aString);
  38313. if(($receiver = $1) == null || $receiver.a$nil){
  38314. $1;
  38315. } else {
  38316. $self._errorShadowingVariable_(aString);
  38317. }
  38318. return self;
  38319. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  38320. },
  38321. args: ["aString"],
  38322. 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 ]",
  38323. referencedClasses: [],
  38324. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  38325. }),
  38326. $globals.SemanticAnalyzer);
  38327. $core.addMethod(
  38328. $core.method({
  38329. selector: "visitAssignmentNode:",
  38330. protocol: "visiting",
  38331. fn: function (aNode){
  38332. var self=this,$self=this;
  38333. return $core.withContext(function($ctx1) {
  38334. (
  38335. $ctx1.supercall = true,
  38336. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($self, [aNode]));
  38337. $ctx1.supercall = false;
  38338. $recv($recv(aNode)._left())._beAssigned();
  38339. return self;
  38340. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38341. },
  38342. args: ["aNode"],
  38343. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  38344. referencedClasses: [],
  38345. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  38346. }),
  38347. $globals.SemanticAnalyzer);
  38348. $core.addMethod(
  38349. $core.method({
  38350. selector: "visitBlockNode:",
  38351. protocol: "visiting",
  38352. fn: function (aNode){
  38353. var self=this,$self=this;
  38354. return $core.withContext(function($ctx1) {
  38355. $self._pushScope_($self._newBlockScope());
  38356. $recv(aNode)._scope_($self["@currentScope"]);
  38357. $recv($self["@currentScope"])._node_(aNode);
  38358. $recv($self["@currentScope"])._blockIndex_($self._nextBlockIndex());
  38359. $recv($recv(aNode)._parameters())._do_((function(each){
  38360. return $core.withContext(function($ctx2) {
  38361. $self._validateVariableScope_(each);
  38362. return $recv($self["@currentScope"])._addArg_(each);
  38363. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38364. }));
  38365. (
  38366. $ctx1.supercall = true,
  38367. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($self, [aNode]));
  38368. $ctx1.supercall = false;
  38369. $self._popScope();
  38370. return self;
  38371. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38372. },
  38373. args: ["aNode"],
  38374. 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",
  38375. referencedClasses: [],
  38376. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  38377. }),
  38378. $globals.SemanticAnalyzer);
  38379. $core.addMethod(
  38380. $core.method({
  38381. selector: "visitCascadeNode:",
  38382. protocol: "visiting",
  38383. fn: function (aNode){
  38384. var self=this,$self=this;
  38385. return $core.withContext(function($ctx1) {
  38386. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  38387. (
  38388. $ctx1.supercall = true,
  38389. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($self, [aNode]));
  38390. $ctx1.supercall = false;
  38391. return self;
  38392. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38393. },
  38394. args: ["aNode"],
  38395. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  38396. referencedClasses: [],
  38397. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  38398. }),
  38399. $globals.SemanticAnalyzer);
  38400. $core.addMethod(
  38401. $core.method({
  38402. selector: "visitMethodNode:",
  38403. protocol: "visiting",
  38404. fn: function (aNode){
  38405. var self=this,$self=this;
  38406. return $core.withContext(function($ctx1) {
  38407. $self._pushScope_($self._newMethodScope());
  38408. $recv(aNode)._scope_($self["@currentScope"]);
  38409. $recv($self["@currentScope"])._node_(aNode);
  38410. $recv($recv($self._theClass())._allInstanceVariableNames())._do_((function(each){
  38411. return $core.withContext(function($ctx2) {
  38412. return $recv($self["@currentScope"])._addIVar_(each);
  38413. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38414. }));
  38415. $ctx1.sendIdx["do:"]=1;
  38416. $recv($recv(aNode)._arguments())._do_((function(each){
  38417. return $core.withContext(function($ctx2) {
  38418. $self._validateVariableScope_(each);
  38419. return $recv($self["@currentScope"])._addArg_(each);
  38420. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38421. }));
  38422. (
  38423. $ctx1.supercall = true,
  38424. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  38425. $ctx1.supercall = false;
  38426. $recv(aNode)._classReferences_($self._classReferences());
  38427. $recv(aNode)._sendIndexes_($self._messageSends());
  38428. $self._popScope();
  38429. return aNode;
  38430. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38431. },
  38432. args: ["aNode"],
  38433. 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",
  38434. referencedClasses: [],
  38435. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  38436. }),
  38437. $globals.SemanticAnalyzer);
  38438. $core.addMethod(
  38439. $core.method({
  38440. selector: "visitReturnNode:",
  38441. protocol: "visiting",
  38442. fn: function (aNode){
  38443. var self=this,$self=this;
  38444. return $core.withContext(function($ctx1) {
  38445. var $1;
  38446. $recv(aNode)._scope_($self["@currentScope"]);
  38447. $1=$recv($self["@currentScope"])._isMethodScope();
  38448. if($core.assert($1)){
  38449. $recv($self["@currentScope"])._localReturn_(true);
  38450. } else {
  38451. $recv($recv($self["@currentScope"])._methodScope())._addNonLocalReturn_($self["@currentScope"]);
  38452. }
  38453. (
  38454. $ctx1.supercall = true,
  38455. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($self, [aNode]));
  38456. $ctx1.supercall = false;
  38457. return self;
  38458. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38459. },
  38460. args: ["aNode"],
  38461. 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",
  38462. referencedClasses: [],
  38463. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  38464. }),
  38465. $globals.SemanticAnalyzer);
  38466. $core.addMethod(
  38467. $core.method({
  38468. selector: "visitSendNode:",
  38469. protocol: "visiting",
  38470. fn: function (aNode){
  38471. var self=this,$self=this;
  38472. var sends;
  38473. return $core.withContext(function($ctx1) {
  38474. sends=$recv($self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  38475. return $core.withContext(function($ctx2) {
  38476. return $recv($globals.OrderedCollection)._new();
  38477. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38478. }));
  38479. $recv(sends)._add_(aNode);
  38480. $recv(aNode)._index_($recv(sends)._size());
  38481. (
  38482. $ctx1.supercall = true,
  38483. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  38484. $ctx1.supercall = false;
  38485. return self;
  38486. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends},$globals.SemanticAnalyzer)});
  38487. },
  38488. args: ["aNode"],
  38489. 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",
  38490. referencedClasses: ["OrderedCollection"],
  38491. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  38492. }),
  38493. $globals.SemanticAnalyzer);
  38494. $core.addMethod(
  38495. $core.method({
  38496. selector: "visitSequenceNode:",
  38497. protocol: "visiting",
  38498. fn: function (aNode){
  38499. var self=this,$self=this;
  38500. return $core.withContext(function($ctx1) {
  38501. $recv($recv(aNode)._temps())._do_((function(each){
  38502. return $core.withContext(function($ctx2) {
  38503. $self._validateVariableScope_(each);
  38504. return $recv($self["@currentScope"])._addTemp_(each);
  38505. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38506. }));
  38507. (
  38508. $ctx1.supercall = true,
  38509. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  38510. $ctx1.supercall = false;
  38511. return self;
  38512. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38513. },
  38514. args: ["aNode"],
  38515. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  38516. referencedClasses: [],
  38517. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  38518. }),
  38519. $globals.SemanticAnalyzer);
  38520. $core.addMethod(
  38521. $core.method({
  38522. selector: "visitVariableNode:",
  38523. protocol: "visiting",
  38524. fn: function (aNode){
  38525. var self=this,$self=this;
  38526. var binding;
  38527. return $core.withContext(function($ctx1) {
  38528. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  38529. binding=$recv($self["@currentScope"])._lookupVariable_(aNode);
  38530. $1=binding;
  38531. if(($receiver = $1) == null || $receiver.a$nil){
  38532. $3=$recv(aNode)._value();
  38533. $ctx1.sendIdx["value"]=1;
  38534. $2=$recv($3)._isCapitalized();
  38535. if($core.assert($2)){
  38536. $4=$recv($globals.ClassRefVar)._new();
  38537. $ctx1.sendIdx["new"]=1;
  38538. $5=$recv(aNode)._value();
  38539. $ctx1.sendIdx["value"]=2;
  38540. $recv($4)._name_($5);
  38541. $ctx1.sendIdx["name:"]=1;
  38542. $6=$recv($4)._yourself();
  38543. $ctx1.sendIdx["yourself"]=1;
  38544. binding=$6;
  38545. $7=$self._classReferences();
  38546. $8=$recv(aNode)._value();
  38547. $ctx1.sendIdx["value"]=3;
  38548. $recv($7)._add_($8);
  38549. } else {
  38550. $self._errorUnknownVariable_(aNode);
  38551. $9=$recv($globals.UnknownVar)._new();
  38552. $recv($9)._name_($recv(aNode)._value());
  38553. binding=$recv($9)._yourself();
  38554. binding;
  38555. }
  38556. } else {
  38557. $1;
  38558. }
  38559. $recv(aNode)._binding_(binding);
  38560. return self;
  38561. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  38562. },
  38563. args: ["aNode"],
  38564. 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.",
  38565. referencedClasses: ["ClassRefVar", "UnknownVar"],
  38566. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  38567. }),
  38568. $globals.SemanticAnalyzer);
  38569. $core.addMethod(
  38570. $core.method({
  38571. selector: "on:",
  38572. protocol: "instance creation",
  38573. fn: function (aClass){
  38574. var self=this,$self=this;
  38575. return $core.withContext(function($ctx1) {
  38576. var $1;
  38577. $1=$self._new();
  38578. $recv($1)._theClass_(aClass);
  38579. return $recv($1)._yourself();
  38580. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.a$cls)});
  38581. },
  38582. args: ["aClass"],
  38583. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  38584. referencedClasses: [],
  38585. messageSends: ["theClass:", "new", "yourself"]
  38586. }),
  38587. $globals.SemanticAnalyzer.a$cls);
  38588. $core.addClass("SemanticError", $globals.CompilerError, [], "Compiler-Semantic");
  38589. $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";
  38590. $core.addClass("InvalidAssignmentError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38591. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  38592. $core.addMethod(
  38593. $core.method({
  38594. selector: "messageText",
  38595. protocol: "accessing",
  38596. fn: function (){
  38597. var self=this,$self=this;
  38598. return $core.withContext(function($ctx1) {
  38599. return " Invalid assignment to variable: ".__comma($self._variableName());
  38600. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  38601. },
  38602. args: [],
  38603. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  38604. referencedClasses: [],
  38605. messageSends: [",", "variableName"]
  38606. }),
  38607. $globals.InvalidAssignmentError);
  38608. $core.addMethod(
  38609. $core.method({
  38610. selector: "variableName",
  38611. protocol: "accessing",
  38612. fn: function (){
  38613. var self=this,$self=this;
  38614. return $self["@variableName"];
  38615. },
  38616. args: [],
  38617. source: "variableName\x0a\x09^ variableName",
  38618. referencedClasses: [],
  38619. messageSends: []
  38620. }),
  38621. $globals.InvalidAssignmentError);
  38622. $core.addMethod(
  38623. $core.method({
  38624. selector: "variableName:",
  38625. protocol: "accessing",
  38626. fn: function (aString){
  38627. var self=this,$self=this;
  38628. $self["@variableName"]=aString;
  38629. return self;
  38630. },
  38631. args: ["aString"],
  38632. source: "variableName: aString\x0a\x09variableName := aString",
  38633. referencedClasses: [],
  38634. messageSends: []
  38635. }),
  38636. $globals.InvalidAssignmentError);
  38637. $core.addClass("ShadowingVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38638. $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.";
  38639. $core.addMethod(
  38640. $core.method({
  38641. selector: "messageText",
  38642. protocol: "accessing",
  38643. fn: function (){
  38644. var self=this,$self=this;
  38645. return $core.withContext(function($ctx1) {
  38646. var $1;
  38647. $1=$recv("Variable shadowing error: ".__comma($self._variableName())).__comma(" is already defined");
  38648. $ctx1.sendIdx[","]=1;
  38649. return $1;
  38650. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  38651. },
  38652. args: [],
  38653. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  38654. referencedClasses: [],
  38655. messageSends: [",", "variableName"]
  38656. }),
  38657. $globals.ShadowingVariableError);
  38658. $core.addMethod(
  38659. $core.method({
  38660. selector: "variableName",
  38661. protocol: "accessing",
  38662. fn: function (){
  38663. var self=this,$self=this;
  38664. return $self["@variableName"];
  38665. },
  38666. args: [],
  38667. source: "variableName\x0a\x09^ variableName",
  38668. referencedClasses: [],
  38669. messageSends: []
  38670. }),
  38671. $globals.ShadowingVariableError);
  38672. $core.addMethod(
  38673. $core.method({
  38674. selector: "variableName:",
  38675. protocol: "accessing",
  38676. fn: function (aString){
  38677. var self=this,$self=this;
  38678. $self["@variableName"]=aString;
  38679. return self;
  38680. },
  38681. args: ["aString"],
  38682. source: "variableName: aString\x0a\x09variableName := aString",
  38683. referencedClasses: [],
  38684. messageSends: []
  38685. }),
  38686. $globals.ShadowingVariableError);
  38687. $core.addClass("UnknownVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38688. $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.";
  38689. $core.addMethod(
  38690. $core.method({
  38691. selector: "messageText",
  38692. protocol: "accessing",
  38693. fn: function (){
  38694. var self=this,$self=this;
  38695. return $core.withContext(function($ctx1) {
  38696. var $1;
  38697. $1=$recv("Unknown Variable error: ".__comma($self._variableName())).__comma(" is not defined");
  38698. $ctx1.sendIdx[","]=1;
  38699. return $1;
  38700. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  38701. },
  38702. args: [],
  38703. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  38704. referencedClasses: [],
  38705. messageSends: [",", "variableName"]
  38706. }),
  38707. $globals.UnknownVariableError);
  38708. $core.addMethod(
  38709. $core.method({
  38710. selector: "variableName",
  38711. protocol: "accessing",
  38712. fn: function (){
  38713. var self=this,$self=this;
  38714. return $self["@variableName"];
  38715. },
  38716. args: [],
  38717. source: "variableName\x0a\x09^ variableName",
  38718. referencedClasses: [],
  38719. messageSends: []
  38720. }),
  38721. $globals.UnknownVariableError);
  38722. $core.addMethod(
  38723. $core.method({
  38724. selector: "variableName:",
  38725. protocol: "accessing",
  38726. fn: function (aString){
  38727. var self=this,$self=this;
  38728. $self["@variableName"]=aString;
  38729. return self;
  38730. },
  38731. args: ["aString"],
  38732. source: "variableName: aString\x0a\x09variableName := aString",
  38733. referencedClasses: [],
  38734. messageSends: []
  38735. }),
  38736. $globals.UnknownVariableError);
  38737. $core.addMethod(
  38738. $core.method({
  38739. selector: "inlineJS:",
  38740. protocol: "*Compiler-Semantic",
  38741. fn: function (aString){
  38742. var self=this,$self=this;
  38743. return $core.withContext(function($ctx1) {
  38744. var $2,$1,$3,$5,$4;
  38745. $2=$self._sequenceNode();
  38746. $ctx1.sendIdx["sequenceNode"]=1;
  38747. $1=$recv($2)._dagChildren();
  38748. $recv($1)._ifNotEmpty_((function(){
  38749. return $core.withContext(function($ctx2) {
  38750. return $recv($globals.CompilerError)._signal_("inlineJS: does not allow smalltalk statements");
  38751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38752. }));
  38753. $3=$self._sequenceNode();
  38754. $5=$recv($globals.JSStatementNode)._new();
  38755. $recv($5)._source_(aString);
  38756. $4=$recv($5)._yourself();
  38757. $recv($3)._addDagChild_($4);
  38758. return self;
  38759. }, function($ctx1) {$ctx1.fill(self,"inlineJS:",{aString:aString},$globals.EarlyPragmator)});
  38760. },
  38761. args: ["aString"],
  38762. source: "inlineJS: aString\x0a\x09self sequenceNode dagChildren ifNotEmpty: [\x0a\x09\x09CompilerError signal: 'inlineJS: does not allow smalltalk statements' ].\x0a\x09self sequenceNode addDagChild: (\x0a\x09\x09JSStatementNode new\x0a\x09\x09\x09source: aString;\x0a\x09\x09\x09yourself)",
  38763. referencedClasses: ["CompilerError", "JSStatementNode"],
  38764. messageSends: ["ifNotEmpty:", "dagChildren", "sequenceNode", "signal:", "addDagChild:", "source:", "new", "yourself"]
  38765. }),
  38766. $globals.EarlyPragmator);
  38767. });
  38768. 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";
  38769. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  38770. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  38771. var $pkg = $core.addPackage("Compiler-IR");
  38772. $pkg.innerEval = function (expr) { return eval(expr); };
  38773. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  38774. $core.addClass("IRASTTranslator", $globals.NodeVisitor, ["source", "theClass", "method", "sequence", "nextAlias"], "Compiler-IR");
  38775. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  38776. $core.addMethod(
  38777. $core.method({
  38778. selector: "addToSequence:",
  38779. protocol: "visiting",
  38780. fn: function (anInstruction){
  38781. var self=this,$self=this;
  38782. return $core.withContext(function($ctx1) {
  38783. var $1,$receiver;
  38784. if(($receiver = anInstruction) == null || $receiver.a$nil){
  38785. anInstruction;
  38786. } else {
  38787. $1=$recv(anInstruction)._isVariable();
  38788. if(!$core.assert($1)){
  38789. $recv($self._sequence())._add_(anInstruction);
  38790. }
  38791. }
  38792. return anInstruction;
  38793. }, function($ctx1) {$ctx1.fill(self,"addToSequence:",{anInstruction:anInstruction},$globals.IRASTTranslator)});
  38794. },
  38795. args: ["anInstruction"],
  38796. source: "addToSequence: anInstruction\x0a\x09anInstruction ifNotNil: [\x0a\x09\x09anInstruction isVariable ifFalse: [\x0a\x09\x09\x09self sequence add: anInstruction ] ].\x0a\x09^ anInstruction",
  38797. referencedClasses: [],
  38798. messageSends: ["ifNotNil:", "ifFalse:", "isVariable", "add:", "sequence"]
  38799. }),
  38800. $globals.IRASTTranslator);
  38801. $core.addMethod(
  38802. $core.method({
  38803. selector: "alias:",
  38804. protocol: "visiting",
  38805. fn: function (aNode){
  38806. var self=this,$self=this;
  38807. var variable;
  38808. return $core.withContext(function($ctx1) {
  38809. var $1,$2,$3,$5,$4,$6,$8,$7;
  38810. $1=$recv(aNode)._isImmutable();
  38811. if($core.assert($1)){
  38812. $2=$self._visit_(aNode);
  38813. $ctx1.sendIdx["visit:"]=1;
  38814. return $2;
  38815. }
  38816. $3=$recv($globals.IRVariable)._new();
  38817. $ctx1.sendIdx["new"]=1;
  38818. $5=$recv($globals.AliasVar)._new();
  38819. $ctx1.sendIdx["new"]=2;
  38820. $4=$recv($5)._name_("$".__comma($self._nextAlias()));
  38821. $recv($3)._variable_($4);
  38822. $6=$recv($3)._yourself();
  38823. $ctx1.sendIdx["yourself"]=1;
  38824. variable=$6;
  38825. $8=$recv($globals.IRAssignment)._new();
  38826. $recv($8)._add_(variable);
  38827. $ctx1.sendIdx["add:"]=1;
  38828. $recv($8)._add_($self._visit_(aNode));
  38829. $ctx1.sendIdx["add:"]=2;
  38830. $7=$recv($8)._yourself();
  38831. $self._addToSequence_($7);
  38832. $recv($recv($self._method())._internalVariables())._add_(variable);
  38833. return variable;
  38834. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  38835. },
  38836. args: ["aNode"],
  38837. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self addToSequence: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  38838. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  38839. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "addToSequence:", "add:", "internalVariables", "method"]
  38840. }),
  38841. $globals.IRASTTranslator);
  38842. $core.addMethod(
  38843. $core.method({
  38844. selector: "aliasTemporally:",
  38845. protocol: "visiting",
  38846. fn: function (aCollection){
  38847. var self=this,$self=this;
  38848. var threshold,result;
  38849. return $core.withContext(function($ctx1) {
  38850. var $1,$2,$4,$3;
  38851. threshold=(0);
  38852. $recv(aCollection)._withIndexDo_((function(each,i){
  38853. return $core.withContext(function($ctx2) {
  38854. $1=$recv(each)._subtreeNeedsAliasing();
  38855. if($core.assert($1)){
  38856. threshold=i;
  38857. return threshold;
  38858. }
  38859. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  38860. }));
  38861. $ctx1.sendIdx["withIndexDo:"]=1;
  38862. result=$recv($globals.OrderedCollection)._new();
  38863. $recv(aCollection)._withIndexDo_((function(each,i){
  38864. return $core.withContext(function($ctx2) {
  38865. $2=result;
  38866. $4=$recv(i).__lt_eq(threshold);
  38867. if($core.assert($4)){
  38868. $3=$self._alias_(each);
  38869. } else {
  38870. $3=$self._visit_(each);
  38871. }
  38872. return $recv($2)._add_($3);
  38873. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  38874. }));
  38875. return result;
  38876. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  38877. },
  38878. args: ["aCollection"],
  38879. 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",
  38880. referencedClasses: ["OrderedCollection"],
  38881. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  38882. }),
  38883. $globals.IRASTTranslator);
  38884. $core.addMethod(
  38885. $core.method({
  38886. selector: "method",
  38887. protocol: "accessing",
  38888. fn: function (){
  38889. var self=this,$self=this;
  38890. return $self["@method"];
  38891. },
  38892. args: [],
  38893. source: "method\x0a\x09^ method",
  38894. referencedClasses: [],
  38895. messageSends: []
  38896. }),
  38897. $globals.IRASTTranslator);
  38898. $core.addMethod(
  38899. $core.method({
  38900. selector: "method:",
  38901. protocol: "accessing",
  38902. fn: function (anIRMethod){
  38903. var self=this,$self=this;
  38904. $self["@method"]=anIRMethod;
  38905. return self;
  38906. },
  38907. args: ["anIRMethod"],
  38908. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  38909. referencedClasses: [],
  38910. messageSends: []
  38911. }),
  38912. $globals.IRASTTranslator);
  38913. $core.addMethod(
  38914. $core.method({
  38915. selector: "nextAlias",
  38916. protocol: "accessing",
  38917. fn: function (){
  38918. var self=this,$self=this;
  38919. return $core.withContext(function($ctx1) {
  38920. var $1,$receiver;
  38921. $1=$self["@nextAlias"];
  38922. if(($receiver = $1) == null || $receiver.a$nil){
  38923. $self["@nextAlias"]=(0);
  38924. $self["@nextAlias"];
  38925. } else {
  38926. $1;
  38927. }
  38928. $self["@nextAlias"]=$recv($self["@nextAlias"]).__plus((1));
  38929. return $recv($self["@nextAlias"])._asString();
  38930. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  38931. },
  38932. args: [],
  38933. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  38934. referencedClasses: [],
  38935. messageSends: ["ifNil:", "+", "asString"]
  38936. }),
  38937. $globals.IRASTTranslator);
  38938. $core.addMethod(
  38939. $core.method({
  38940. selector: "sequence",
  38941. protocol: "accessing",
  38942. fn: function (){
  38943. var self=this,$self=this;
  38944. return $self["@sequence"];
  38945. },
  38946. args: [],
  38947. source: "sequence\x0a\x09^ sequence",
  38948. referencedClasses: [],
  38949. messageSends: []
  38950. }),
  38951. $globals.IRASTTranslator);
  38952. $core.addMethod(
  38953. $core.method({
  38954. selector: "sequence:",
  38955. protocol: "accessing",
  38956. fn: function (anIRSequence){
  38957. var self=this,$self=this;
  38958. $self["@sequence"]=anIRSequence;
  38959. return self;
  38960. },
  38961. args: ["anIRSequence"],
  38962. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  38963. referencedClasses: [],
  38964. messageSends: []
  38965. }),
  38966. $globals.IRASTTranslator);
  38967. $core.addMethod(
  38968. $core.method({
  38969. selector: "source",
  38970. protocol: "accessing",
  38971. fn: function (){
  38972. var self=this,$self=this;
  38973. return $self["@source"];
  38974. },
  38975. args: [],
  38976. source: "source\x0a\x09^ source",
  38977. referencedClasses: [],
  38978. messageSends: []
  38979. }),
  38980. $globals.IRASTTranslator);
  38981. $core.addMethod(
  38982. $core.method({
  38983. selector: "source:",
  38984. protocol: "accessing",
  38985. fn: function (aString){
  38986. var self=this,$self=this;
  38987. $self["@source"]=aString;
  38988. return self;
  38989. },
  38990. args: ["aString"],
  38991. source: "source: aString\x0a\x09source := aString",
  38992. referencedClasses: [],
  38993. messageSends: []
  38994. }),
  38995. $globals.IRASTTranslator);
  38996. $core.addMethod(
  38997. $core.method({
  38998. selector: "theClass",
  38999. protocol: "accessing",
  39000. fn: function (){
  39001. var self=this,$self=this;
  39002. return $self["@theClass"];
  39003. },
  39004. args: [],
  39005. source: "theClass\x0a\x09^ theClass",
  39006. referencedClasses: [],
  39007. messageSends: []
  39008. }),
  39009. $globals.IRASTTranslator);
  39010. $core.addMethod(
  39011. $core.method({
  39012. selector: "theClass:",
  39013. protocol: "accessing",
  39014. fn: function (aClass){
  39015. var self=this,$self=this;
  39016. $self["@theClass"]=aClass;
  39017. return self;
  39018. },
  39019. args: ["aClass"],
  39020. source: "theClass: aClass\x0a\x09theClass := aClass",
  39021. referencedClasses: [],
  39022. messageSends: []
  39023. }),
  39024. $globals.IRASTTranslator);
  39025. $core.addMethod(
  39026. $core.method({
  39027. selector: "visitAssignmentNode:",
  39028. protocol: "visiting",
  39029. fn: function (aNode){
  39030. var self=this,$self=this;
  39031. var left,right,assignment;
  39032. return $core.withContext(function($ctx1) {
  39033. var $2,$1;
  39034. right=$self._visit_($recv(aNode)._right());
  39035. $ctx1.sendIdx["visit:"]=1;
  39036. left=$self._visit_($recv(aNode)._left());
  39037. $2=$recv($globals.IRAssignment)._new();
  39038. $recv($2)._add_(left);
  39039. $ctx1.sendIdx["add:"]=1;
  39040. $recv($2)._add_(right);
  39041. $1=$recv($2)._yourself();
  39042. $self._addToSequence_($1);
  39043. return left;
  39044. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  39045. },
  39046. args: ["aNode"],
  39047. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self addToSequence: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  39048. referencedClasses: ["IRAssignment"],
  39049. messageSends: ["visit:", "right", "left", "addToSequence:", "add:", "new", "yourself"]
  39050. }),
  39051. $globals.IRASTTranslator);
  39052. $core.addMethod(
  39053. $core.method({
  39054. selector: "visitBlockNode:",
  39055. protocol: "visiting",
  39056. fn: function (aNode){
  39057. var self=this,$self=this;
  39058. var closure;
  39059. return $core.withContext(function($ctx1) {
  39060. var $1,$2,$3,$5,$4,$6,$8,$7;
  39061. $1=$recv($globals.IRClosure)._new();
  39062. $ctx1.sendIdx["new"]=1;
  39063. $recv($1)._arguments_($recv(aNode)._parameters());
  39064. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39065. $2=$recv(aNode)._scope();
  39066. $ctx1.sendIdx["scope"]=1;
  39067. $recv($1)._scope_($2);
  39068. $ctx1.sendIdx["scope:"]=1;
  39069. $3=$recv($1)._yourself();
  39070. $ctx1.sendIdx["yourself"]=1;
  39071. closure=$3;
  39072. $5=$recv(aNode)._scope();
  39073. $ctx1.sendIdx["scope"]=2;
  39074. $4=$recv($5)._temps();
  39075. $recv($4)._do_((function(each){
  39076. return $core.withContext(function($ctx2) {
  39077. $6=closure;
  39078. $8=$recv($globals.IRTempDeclaration)._new();
  39079. $recv($8)._name_($recv(each)._name());
  39080. $recv($8)._scope_($recv(aNode)._scope());
  39081. $7=$recv($8)._yourself();
  39082. return $recv($6)._add_($7);
  39083. $ctx2.sendIdx["add:"]=1;
  39084. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39085. }));
  39086. $ctx1.sendIdx["do:"]=1;
  39087. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39088. return $core.withContext(function($ctx2) {
  39089. return $recv(closure)._add_($self._visit_(each));
  39090. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39091. }));
  39092. return closure;
  39093. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  39094. },
  39095. args: ["aNode"],
  39096. 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",
  39097. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  39098. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  39099. }),
  39100. $globals.IRASTTranslator);
  39101. $core.addMethod(
  39102. $core.method({
  39103. selector: "visitBlockSequenceNode:",
  39104. protocol: "visiting",
  39105. fn: function (aNode){
  39106. var self=this,$self=this;
  39107. return $core.withContext(function($ctx1) {
  39108. var $1,$2,$4,$3,$5,$8,$7,$6,$10,$13,$12,$11,$9;
  39109. $1=$recv($globals.IRBlockSequence)._new();
  39110. $ctx1.sendIdx["new"]=1;
  39111. return $self._withSequence_do_($1,(function(){
  39112. return $core.withContext(function($ctx2) {
  39113. $2=$recv(aNode)._dagChildren();
  39114. $ctx2.sendIdx["dagChildren"]=1;
  39115. return $recv($2)._ifNotEmpty_((function(){
  39116. return $core.withContext(function($ctx3) {
  39117. $4=$recv(aNode)._dagChildren();
  39118. $ctx3.sendIdx["dagChildren"]=2;
  39119. $3=$recv($4)._allButLast();
  39120. $recv($3)._do_((function(each){
  39121. return $core.withContext(function($ctx4) {
  39122. $5=$self._visitOrAlias_(each);
  39123. $ctx4.sendIdx["visitOrAlias:"]=1;
  39124. return $self._addToSequence_($5);
  39125. $ctx4.sendIdx["addToSequence:"]=1;
  39126. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  39127. }));
  39128. $8=$recv(aNode)._dagChildren();
  39129. $ctx3.sendIdx["dagChildren"]=3;
  39130. $7=$recv($8)._last();
  39131. $ctx3.sendIdx["last"]=1;
  39132. $6=$recv($7)._isReturnNode();
  39133. if($core.assert($6)){
  39134. return $self._addToSequence_($self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  39135. } else {
  39136. $10=$recv($globals.IRBlockReturn)._new();
  39137. $13=$recv(aNode)._dagChildren();
  39138. $ctx3.sendIdx["dagChildren"]=4;
  39139. $12=$recv($13)._last();
  39140. $ctx3.sendIdx["last"]=2;
  39141. $11=$self._visitOrAlias_($12);
  39142. $ctx3.sendIdx["visitOrAlias:"]=2;
  39143. $recv($10)._add_($11);
  39144. $9=$recv($10)._yourself();
  39145. return $self._addToSequence_($9);
  39146. $ctx3.sendIdx["addToSequence:"]=2;
  39147. }
  39148. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39149. }));
  39150. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39151. }));
  39152. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39153. },
  39154. args: ["aNode"],
  39155. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren ifNotEmpty: [\x0a\x09\x09\x09\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self addToSequence: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode dagChildren last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self addToSequence: (IRBlockReturn new add: (self visitOrAlias: aNode dagChildren last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self addToSequence: (self visitOrAlias: aNode dagChildren last) ] ]]",
  39156. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  39157. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "addToSequence:", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "add:", "yourself"]
  39158. }),
  39159. $globals.IRASTTranslator);
  39160. $core.addMethod(
  39161. $core.method({
  39162. selector: "visitCascadeNode:",
  39163. protocol: "visiting",
  39164. fn: function (aNode){
  39165. var self=this,$self=this;
  39166. var receiver;
  39167. return $core.withContext(function($ctx1) {
  39168. var $1,$2,$4,$3;
  39169. receiver=$recv(aNode)._receiver();
  39170. $1=$recv(receiver)._isImmutable();
  39171. if(!$core.assert($1)){
  39172. var alias;
  39173. alias=$self._alias_(receiver);
  39174. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  39175. receiver;
  39176. }
  39177. $2=$recv(aNode)._dagChildren();
  39178. $ctx1.sendIdx["dagChildren"]=1;
  39179. $recv($2)._do_((function(each){
  39180. return $core.withContext(function($ctx2) {
  39181. return $recv(each)._receiver_(receiver);
  39182. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39183. }));
  39184. $ctx1.sendIdx["do:"]=1;
  39185. $4=$recv(aNode)._dagChildren();
  39186. $ctx1.sendIdx["dagChildren"]=2;
  39187. $3=$recv($4)._allButLast();
  39188. $recv($3)._do_((function(each){
  39189. return $core.withContext(function($ctx2) {
  39190. return $self._addToSequence_($self._visit_(each));
  39191. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39192. }));
  39193. return $self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  39194. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver},$globals.IRASTTranslator)});
  39195. },
  39196. args: ["aNode"],
  39197. source: "visitCascadeNode: aNode\x0a\x09| receiver |\x0a\x09receiver := aNode receiver.\x0a\x09receiver isImmutable ifFalse: [\x0a\x09\x09| alias |\x0a\x09\x09alias := self alias: receiver.\x0a\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09aNode dagChildren do: [ :each | each receiver: receiver ].\x0a\x0a\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09self addToSequence: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode dagChildren last",
  39198. referencedClasses: ["VariableNode"],
  39199. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "addToSequence:", "visit:", "visitOrAlias:", "last"]
  39200. }),
  39201. $globals.IRASTTranslator);
  39202. $core.addMethod(
  39203. $core.method({
  39204. selector: "visitDynamicArrayNode:",
  39205. protocol: "visiting",
  39206. fn: function (aNode){
  39207. var self=this,$self=this;
  39208. var array;
  39209. return $core.withContext(function($ctx1) {
  39210. array=$recv($globals.IRDynamicArray)._new();
  39211. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39212. return $core.withContext(function($ctx2) {
  39213. return $recv(array)._add_(each);
  39214. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39215. }));
  39216. return array;
  39217. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  39218. },
  39219. args: ["aNode"],
  39220. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  39221. referencedClasses: ["IRDynamicArray"],
  39222. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39223. }),
  39224. $globals.IRASTTranslator);
  39225. $core.addMethod(
  39226. $core.method({
  39227. selector: "visitDynamicDictionaryNode:",
  39228. protocol: "visiting",
  39229. fn: function (aNode){
  39230. var self=this,$self=this;
  39231. var dictionary;
  39232. return $core.withContext(function($ctx1) {
  39233. dictionary=$recv($globals.IRDynamicDictionary)._new();
  39234. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39235. return $core.withContext(function($ctx2) {
  39236. return $recv(dictionary)._add_(each);
  39237. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39238. }));
  39239. return dictionary;
  39240. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  39241. },
  39242. args: ["aNode"],
  39243. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  39244. referencedClasses: ["IRDynamicDictionary"],
  39245. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39246. }),
  39247. $globals.IRASTTranslator);
  39248. $core.addMethod(
  39249. $core.method({
  39250. selector: "visitJSStatementNode:",
  39251. protocol: "visiting",
  39252. fn: function (aNode){
  39253. var self=this,$self=this;
  39254. return $core.withContext(function($ctx1) {
  39255. var $1;
  39256. $1=$recv($globals.IRVerbatim)._new();
  39257. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  39258. return $recv($1)._yourself();
  39259. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39260. },
  39261. args: ["aNode"],
  39262. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  39263. referencedClasses: ["IRVerbatim"],
  39264. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  39265. }),
  39266. $globals.IRASTTranslator);
  39267. $core.addMethod(
  39268. $core.method({
  39269. selector: "visitMethodNode:",
  39270. protocol: "visiting",
  39271. fn: function (aNode){
  39272. var self=this,$self=this;
  39273. return $core.withContext(function($ctx1) {
  39274. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  39275. $2=$recv($globals.IRMethod)._new();
  39276. $ctx1.sendIdx["new"]=1;
  39277. $recv($2)._source_($recv($self._source())._crlfSanitized());
  39278. $ctx1.sendIdx["source:"]=1;
  39279. $recv($2)._theClass_($self._theClass());
  39280. $recv($2)._arguments_($recv(aNode)._arguments());
  39281. $recv($2)._selector_($recv(aNode)._selector());
  39282. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  39283. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39284. $recv($2)._classReferences_($recv(aNode)._classReferences());
  39285. $3=$recv(aNode)._scope();
  39286. $ctx1.sendIdx["scope"]=1;
  39287. $recv($2)._scope_($3);
  39288. $ctx1.sendIdx["scope:"]=1;
  39289. $4=$recv($2)._yourself();
  39290. $ctx1.sendIdx["yourself"]=1;
  39291. $1=$4;
  39292. $self._method_($1);
  39293. $6=$recv(aNode)._scope();
  39294. $ctx1.sendIdx["scope"]=2;
  39295. $5=$recv($6)._temps();
  39296. $recv($5)._do_((function(each){
  39297. return $core.withContext(function($ctx2) {
  39298. $7=$self._method();
  39299. $ctx2.sendIdx["method"]=1;
  39300. $9=$recv($globals.IRTempDeclaration)._new();
  39301. $ctx2.sendIdx["new"]=2;
  39302. $recv($9)._name_($recv(each)._name());
  39303. $10=$recv(aNode)._scope();
  39304. $ctx2.sendIdx["scope"]=3;
  39305. $recv($9)._scope_($10);
  39306. $11=$recv($9)._yourself();
  39307. $ctx2.sendIdx["yourself"]=2;
  39308. $8=$11;
  39309. return $recv($7)._add_($8);
  39310. $ctx2.sendIdx["add:"]=1;
  39311. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39312. }));
  39313. $ctx1.sendIdx["do:"]=1;
  39314. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39315. return $core.withContext(function($ctx2) {
  39316. $12=$self._method();
  39317. $ctx2.sendIdx["method"]=2;
  39318. return $recv($12)._add_($self._visit_(each));
  39319. $ctx2.sendIdx["add:"]=2;
  39320. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39321. }));
  39322. $14=$recv(aNode)._scope();
  39323. $ctx1.sendIdx["scope"]=4;
  39324. $13=$recv($14)._hasLocalReturn();
  39325. if(!$core.assert($13)){
  39326. $15=$self._method();
  39327. $ctx1.sendIdx["method"]=3;
  39328. $17=$recv($globals.IRReturn)._new();
  39329. $ctx1.sendIdx["new"]=3;
  39330. $19=$recv($globals.IRVariable)._new();
  39331. $ctx1.sendIdx["new"]=4;
  39332. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  39333. $20=$recv($19)._yourself();
  39334. $ctx1.sendIdx["yourself"]=3;
  39335. $18=$20;
  39336. $recv($17)._add_($18);
  39337. $ctx1.sendIdx["add:"]=4;
  39338. $21=$recv($17)._yourself();
  39339. $ctx1.sendIdx["yourself"]=4;
  39340. $16=$21;
  39341. $recv($15)._add_($16);
  39342. $ctx1.sendIdx["add:"]=3;
  39343. $23=$recv($globals.IRVerbatim)._new();
  39344. $recv($23)._source_(";".__comma($recv($globals.String)._lf()));
  39345. $22=$recv($23)._yourself();
  39346. $recv($15)._add_($22);
  39347. }
  39348. return $self._method();
  39349. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39350. },
  39351. args: ["aNode"],
  39352. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode dagChildren do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ';', String lf; yourself) ].\x0a\x0a\x09^ self method",
  39353. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim", "String"],
  39354. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "dagChildren", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars", ",", "lf"]
  39355. }),
  39356. $globals.IRASTTranslator);
  39357. $core.addMethod(
  39358. $core.method({
  39359. selector: "visitOrAlias:",
  39360. protocol: "visiting",
  39361. fn: function (aNode){
  39362. var self=this,$self=this;
  39363. return $core.withContext(function($ctx1) {
  39364. var $1;
  39365. $1=$recv(aNode)._shouldBeAliased();
  39366. if($core.assert($1)){
  39367. return $self._alias_(aNode);
  39368. } else {
  39369. return $self._visit_(aNode);
  39370. }
  39371. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  39372. },
  39373. args: ["aNode"],
  39374. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  39375. referencedClasses: [],
  39376. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  39377. }),
  39378. $globals.IRASTTranslator);
  39379. $core.addMethod(
  39380. $core.method({
  39381. selector: "visitReturnNode:",
  39382. protocol: "visiting",
  39383. fn: function (aNode){
  39384. var self=this,$self=this;
  39385. var return_;
  39386. return $core.withContext(function($ctx1) {
  39387. var $1;
  39388. $1=$recv(aNode)._nonLocalReturn();
  39389. if($core.assert($1)){
  39390. return_=$recv($globals.IRNonLocalReturn)._new();
  39391. $ctx1.sendIdx["new"]=1;
  39392. } else {
  39393. return_=$recv($globals.IRReturn)._new();
  39394. }
  39395. $recv(return_)._scope_($recv(aNode)._scope());
  39396. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39397. return $core.withContext(function($ctx2) {
  39398. return $recv(return_)._add_($self._visitOrAlias_(each));
  39399. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39400. }));
  39401. return return_;
  39402. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  39403. },
  39404. args: ["aNode"],
  39405. 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",
  39406. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  39407. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  39408. }),
  39409. $globals.IRASTTranslator);
  39410. $core.addMethod(
  39411. $core.method({
  39412. selector: "visitSendNode:",
  39413. protocol: "visiting",
  39414. fn: function (aNode){
  39415. var self=this,$self=this;
  39416. var send;
  39417. return $core.withContext(function($ctx1) {
  39418. var $1;
  39419. send=$recv($globals.IRSend)._new();
  39420. $1=send;
  39421. $recv($1)._selector_($recv(aNode)._selector());
  39422. $recv($1)._index_($recv(aNode)._index());
  39423. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39424. return $core.withContext(function($ctx2) {
  39425. return $recv(send)._add_(each);
  39426. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39427. }));
  39428. return send;
  39429. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  39430. },
  39431. args: ["aNode"],
  39432. 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",
  39433. referencedClasses: ["IRSend"],
  39434. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39435. }),
  39436. $globals.IRASTTranslator);
  39437. $core.addMethod(
  39438. $core.method({
  39439. selector: "visitSequenceNode:",
  39440. protocol: "visiting",
  39441. fn: function (aNode){
  39442. var self=this,$self=this;
  39443. return $core.withContext(function($ctx1) {
  39444. return $self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  39445. return $core.withContext(function($ctx2) {
  39446. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  39447. return $core.withContext(function($ctx3) {
  39448. return $self._addToSequence_($self._visitOrAlias_(each));
  39449. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39450. }));
  39451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39452. }));
  39453. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39454. },
  39455. args: ["aNode"],
  39456. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [ aNode dagChildren do: [ :each |\x0a\x09\x09\x09self addToSequence: (self visitOrAlias: each) ] ]",
  39457. referencedClasses: ["IRSequence"],
  39458. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "addToSequence:", "visitOrAlias:"]
  39459. }),
  39460. $globals.IRASTTranslator);
  39461. $core.addMethod(
  39462. $core.method({
  39463. selector: "visitValueNode:",
  39464. protocol: "visiting",
  39465. fn: function (aNode){
  39466. var self=this,$self=this;
  39467. return $core.withContext(function($ctx1) {
  39468. var $1;
  39469. $1=$recv($globals.IRValue)._new();
  39470. $recv($1)._value_($recv(aNode)._value());
  39471. return $recv($1)._yourself();
  39472. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39473. },
  39474. args: ["aNode"],
  39475. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  39476. referencedClasses: ["IRValue"],
  39477. messageSends: ["value:", "new", "value", "yourself"]
  39478. }),
  39479. $globals.IRASTTranslator);
  39480. $core.addMethod(
  39481. $core.method({
  39482. selector: "visitVariableNode:",
  39483. protocol: "visiting",
  39484. fn: function (aNode){
  39485. var self=this,$self=this;
  39486. return $core.withContext(function($ctx1) {
  39487. var $1;
  39488. $1=$recv($globals.IRVariable)._new();
  39489. $recv($1)._variable_($recv(aNode)._binding());
  39490. return $recv($1)._yourself();
  39491. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39492. },
  39493. args: ["aNode"],
  39494. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  39495. referencedClasses: ["IRVariable"],
  39496. messageSends: ["variable:", "new", "binding", "yourself"]
  39497. }),
  39498. $globals.IRASTTranslator);
  39499. $core.addMethod(
  39500. $core.method({
  39501. selector: "withSequence:do:",
  39502. protocol: "accessing",
  39503. fn: function (aSequence,aBlock){
  39504. var self=this,$self=this;
  39505. var outerSequence;
  39506. return $core.withContext(function($ctx1) {
  39507. outerSequence=$self._sequence();
  39508. $self._sequence_(aSequence);
  39509. $ctx1.sendIdx["sequence:"]=1;
  39510. $recv(aBlock)._value();
  39511. $self._sequence_(outerSequence);
  39512. return aSequence;
  39513. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  39514. },
  39515. args: ["aSequence", "aBlock"],
  39516. 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",
  39517. referencedClasses: [],
  39518. messageSends: ["sequence", "sequence:", "value"]
  39519. }),
  39520. $globals.IRASTTranslator);
  39521. $core.addClass("IRInstruction", $globals.DagParentNode, ["parent"], "Compiler-IR");
  39522. $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.";
  39523. $core.addMethod(
  39524. $core.method({
  39525. selector: "add:",
  39526. protocol: "building",
  39527. fn: function (anObject){
  39528. var self=this,$self=this;
  39529. return $core.withContext(function($ctx1) {
  39530. $recv(anObject)._parent_(self);
  39531. return $recv($self._dagChildren())._add_(anObject);
  39532. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  39533. },
  39534. args: ["anObject"],
  39535. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  39536. referencedClasses: [],
  39537. messageSends: ["parent:", "add:", "dagChildren"]
  39538. }),
  39539. $globals.IRInstruction);
  39540. $core.addMethod(
  39541. $core.method({
  39542. selector: "isClosure",
  39543. protocol: "testing",
  39544. fn: function (){
  39545. var self=this,$self=this;
  39546. return false;
  39547. },
  39548. args: [],
  39549. source: "isClosure\x0a\x09^ false",
  39550. referencedClasses: [],
  39551. messageSends: []
  39552. }),
  39553. $globals.IRInstruction);
  39554. $core.addMethod(
  39555. $core.method({
  39556. selector: "isInlined",
  39557. protocol: "testing",
  39558. fn: function (){
  39559. var self=this,$self=this;
  39560. return false;
  39561. },
  39562. args: [],
  39563. source: "isInlined\x0a\x09^ false",
  39564. referencedClasses: [],
  39565. messageSends: []
  39566. }),
  39567. $globals.IRInstruction);
  39568. $core.addMethod(
  39569. $core.method({
  39570. selector: "isMethod",
  39571. protocol: "testing",
  39572. fn: function (){
  39573. var self=this,$self=this;
  39574. return false;
  39575. },
  39576. args: [],
  39577. source: "isMethod\x0a\x09^ false",
  39578. referencedClasses: [],
  39579. messageSends: []
  39580. }),
  39581. $globals.IRInstruction);
  39582. $core.addMethod(
  39583. $core.method({
  39584. selector: "isSelf",
  39585. protocol: "testing",
  39586. fn: function (){
  39587. var self=this,$self=this;
  39588. return false;
  39589. },
  39590. args: [],
  39591. source: "isSelf\x0a\x09^ false",
  39592. referencedClasses: [],
  39593. messageSends: []
  39594. }),
  39595. $globals.IRInstruction);
  39596. $core.addMethod(
  39597. $core.method({
  39598. selector: "isSend",
  39599. protocol: "testing",
  39600. fn: function (){
  39601. var self=this,$self=this;
  39602. return false;
  39603. },
  39604. args: [],
  39605. source: "isSend\x0a\x09^ false",
  39606. referencedClasses: [],
  39607. messageSends: []
  39608. }),
  39609. $globals.IRInstruction);
  39610. $core.addMethod(
  39611. $core.method({
  39612. selector: "isSequence",
  39613. protocol: "testing",
  39614. fn: function (){
  39615. var self=this,$self=this;
  39616. return false;
  39617. },
  39618. args: [],
  39619. source: "isSequence\x0a\x09^ false",
  39620. referencedClasses: [],
  39621. messageSends: []
  39622. }),
  39623. $globals.IRInstruction);
  39624. $core.addMethod(
  39625. $core.method({
  39626. selector: "isSuper",
  39627. protocol: "testing",
  39628. fn: function (){
  39629. var self=this,$self=this;
  39630. return false;
  39631. },
  39632. args: [],
  39633. source: "isSuper\x0a\x09^ false",
  39634. referencedClasses: [],
  39635. messageSends: []
  39636. }),
  39637. $globals.IRInstruction);
  39638. $core.addMethod(
  39639. $core.method({
  39640. selector: "isTempDeclaration",
  39641. protocol: "testing",
  39642. fn: function (){
  39643. var self=this,$self=this;
  39644. return false;
  39645. },
  39646. args: [],
  39647. source: "isTempDeclaration\x0a\x09^ false",
  39648. referencedClasses: [],
  39649. messageSends: []
  39650. }),
  39651. $globals.IRInstruction);
  39652. $core.addMethod(
  39653. $core.method({
  39654. selector: "isVariable",
  39655. protocol: "testing",
  39656. fn: function (){
  39657. var self=this,$self=this;
  39658. return false;
  39659. },
  39660. args: [],
  39661. source: "isVariable\x0a\x09^ false",
  39662. referencedClasses: [],
  39663. messageSends: []
  39664. }),
  39665. $globals.IRInstruction);
  39666. $core.addMethod(
  39667. $core.method({
  39668. selector: "method",
  39669. protocol: "accessing",
  39670. fn: function (){
  39671. var self=this,$self=this;
  39672. return $core.withContext(function($ctx1) {
  39673. return $recv($self._parent())._method();
  39674. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  39675. },
  39676. args: [],
  39677. source: "method\x0a\x09^ self parent method",
  39678. referencedClasses: [],
  39679. messageSends: ["method", "parent"]
  39680. }),
  39681. $globals.IRInstruction);
  39682. $core.addMethod(
  39683. $core.method({
  39684. selector: "needsBoxingAsReceiver",
  39685. protocol: "testing",
  39686. fn: function (){
  39687. var self=this,$self=this;
  39688. return true;
  39689. },
  39690. args: [],
  39691. source: "needsBoxingAsReceiver\x0a\x09^ true",
  39692. referencedClasses: [],
  39693. messageSends: []
  39694. }),
  39695. $globals.IRInstruction);
  39696. $core.addMethod(
  39697. $core.method({
  39698. selector: "parent",
  39699. protocol: "accessing",
  39700. fn: function (){
  39701. var self=this,$self=this;
  39702. return $self["@parent"];
  39703. },
  39704. args: [],
  39705. source: "parent\x0a\x09^ parent",
  39706. referencedClasses: [],
  39707. messageSends: []
  39708. }),
  39709. $globals.IRInstruction);
  39710. $core.addMethod(
  39711. $core.method({
  39712. selector: "parent:",
  39713. protocol: "accessing",
  39714. fn: function (anIRInstruction){
  39715. var self=this,$self=this;
  39716. $self["@parent"]=anIRInstruction;
  39717. return self;
  39718. },
  39719. args: ["anIRInstruction"],
  39720. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  39721. referencedClasses: [],
  39722. messageSends: []
  39723. }),
  39724. $globals.IRInstruction);
  39725. $core.addMethod(
  39726. $core.method({
  39727. selector: "remove:",
  39728. protocol: "building",
  39729. fn: function (anIRInstruction){
  39730. var self=this,$self=this;
  39731. return $core.withContext(function($ctx1) {
  39732. $recv($self._dagChildren())._remove_(anIRInstruction);
  39733. return self;
  39734. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39735. },
  39736. args: ["anIRInstruction"],
  39737. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  39738. referencedClasses: [],
  39739. messageSends: ["remove:", "dagChildren"]
  39740. }),
  39741. $globals.IRInstruction);
  39742. $core.addMethod(
  39743. $core.method({
  39744. selector: "replace:with:",
  39745. protocol: "building",
  39746. fn: function (anIRInstruction,anotherIRInstruction){
  39747. var self=this,$self=this;
  39748. return $core.withContext(function($ctx1) {
  39749. var $1;
  39750. $recv(anotherIRInstruction)._parent_(self);
  39751. $1=$self._dagChildren();
  39752. $ctx1.sendIdx["dagChildren"]=1;
  39753. $recv($1)._at_put_($recv($self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  39754. return self;
  39755. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  39756. },
  39757. args: ["anIRInstruction", "anotherIRInstruction"],
  39758. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  39759. referencedClasses: [],
  39760. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  39761. }),
  39762. $globals.IRInstruction);
  39763. $core.addMethod(
  39764. $core.method({
  39765. selector: "replaceWith:",
  39766. protocol: "building",
  39767. fn: function (anIRInstruction){
  39768. var self=this,$self=this;
  39769. return $core.withContext(function($ctx1) {
  39770. $recv($self._parent())._replace_with_(self,anIRInstruction);
  39771. return self;
  39772. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39773. },
  39774. args: ["anIRInstruction"],
  39775. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  39776. referencedClasses: [],
  39777. messageSends: ["replace:with:", "parent"]
  39778. }),
  39779. $globals.IRInstruction);
  39780. $core.addMethod(
  39781. $core.method({
  39782. selector: "scope",
  39783. protocol: "accessing",
  39784. fn: function (){
  39785. var self=this,$self=this;
  39786. return $core.withContext(function($ctx1) {
  39787. var $1,$receiver;
  39788. $1=$self._parent();
  39789. if(($receiver = $1) == null || $receiver.a$nil){
  39790. return $1;
  39791. } else {
  39792. var node;
  39793. node=$receiver;
  39794. return $recv(node)._scope();
  39795. }
  39796. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  39797. },
  39798. args: [],
  39799. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  39800. referencedClasses: [],
  39801. messageSends: ["ifNotNil:", "parent", "scope"]
  39802. }),
  39803. $globals.IRInstruction);
  39804. $core.addMethod(
  39805. $core.method({
  39806. selector: "yieldsValue",
  39807. protocol: "testing",
  39808. fn: function (){
  39809. var self=this,$self=this;
  39810. return true;
  39811. },
  39812. args: [],
  39813. source: "yieldsValue\x0a\x09^ true",
  39814. referencedClasses: [],
  39815. messageSends: []
  39816. }),
  39817. $globals.IRInstruction);
  39818. $core.addMethod(
  39819. $core.method({
  39820. selector: "on:",
  39821. protocol: "instance creation",
  39822. fn: function (aBuilder){
  39823. var self=this,$self=this;
  39824. return $core.withContext(function($ctx1) {
  39825. var $1;
  39826. $1=$self._new();
  39827. $recv($1)._builder_(aBuilder);
  39828. return $recv($1)._yourself();
  39829. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.a$cls)});
  39830. },
  39831. args: ["aBuilder"],
  39832. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  39833. referencedClasses: [],
  39834. messageSends: ["builder:", "new", "yourself"]
  39835. }),
  39836. $globals.IRInstruction.a$cls);
  39837. $core.addClass("IRAssignment", $globals.IRInstruction, [], "Compiler-IR");
  39838. $core.addMethod(
  39839. $core.method({
  39840. selector: "acceptDagVisitor:",
  39841. protocol: "visiting",
  39842. fn: function (aVisitor){
  39843. var self=this,$self=this;
  39844. return $core.withContext(function($ctx1) {
  39845. return $recv(aVisitor)._visitIRAssignment_(self);
  39846. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRAssignment)});
  39847. },
  39848. args: ["aVisitor"],
  39849. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  39850. referencedClasses: [],
  39851. messageSends: ["visitIRAssignment:"]
  39852. }),
  39853. $globals.IRAssignment);
  39854. $core.addMethod(
  39855. $core.method({
  39856. selector: "left",
  39857. protocol: "accessing",
  39858. fn: function (){
  39859. var self=this,$self=this;
  39860. return $core.withContext(function($ctx1) {
  39861. return $recv($self._dagChildren())._first();
  39862. }, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
  39863. },
  39864. args: [],
  39865. source: "left\x0a\x09^ self dagChildren first",
  39866. referencedClasses: [],
  39867. messageSends: ["first", "dagChildren"]
  39868. }),
  39869. $globals.IRAssignment);
  39870. $core.addMethod(
  39871. $core.method({
  39872. selector: "right",
  39873. protocol: "accessing",
  39874. fn: function (){
  39875. var self=this,$self=this;
  39876. return $core.withContext(function($ctx1) {
  39877. return $recv($self._dagChildren())._last();
  39878. }, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
  39879. },
  39880. args: [],
  39881. source: "right\x0a\x09^ self dagChildren last",
  39882. referencedClasses: [],
  39883. messageSends: ["last", "dagChildren"]
  39884. }),
  39885. $globals.IRAssignment);
  39886. $core.addClass("IRDynamicArray", $globals.IRInstruction, [], "Compiler-IR");
  39887. $core.addMethod(
  39888. $core.method({
  39889. selector: "acceptDagVisitor:",
  39890. protocol: "visiting",
  39891. fn: function (aVisitor){
  39892. var self=this,$self=this;
  39893. return $core.withContext(function($ctx1) {
  39894. return $recv(aVisitor)._visitIRDynamicArray_(self);
  39895. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  39896. },
  39897. args: ["aVisitor"],
  39898. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  39899. referencedClasses: [],
  39900. messageSends: ["visitIRDynamicArray:"]
  39901. }),
  39902. $globals.IRDynamicArray);
  39903. $core.addClass("IRDynamicDictionary", $globals.IRInstruction, [], "Compiler-IR");
  39904. $core.addMethod(
  39905. $core.method({
  39906. selector: "acceptDagVisitor:",
  39907. protocol: "visiting",
  39908. fn: function (aVisitor){
  39909. var self=this,$self=this;
  39910. return $core.withContext(function($ctx1) {
  39911. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  39912. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  39913. },
  39914. args: ["aVisitor"],
  39915. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  39916. referencedClasses: [],
  39917. messageSends: ["visitIRDynamicDictionary:"]
  39918. }),
  39919. $globals.IRDynamicDictionary);
  39920. $core.addClass("IRScopedInstruction", $globals.IRInstruction, ["scope"], "Compiler-IR");
  39921. $core.addMethod(
  39922. $core.method({
  39923. selector: "scope",
  39924. protocol: "accessing",
  39925. fn: function (){
  39926. var self=this,$self=this;
  39927. return $self["@scope"];
  39928. },
  39929. args: [],
  39930. source: "scope\x0a\x09^ scope",
  39931. referencedClasses: [],
  39932. messageSends: []
  39933. }),
  39934. $globals.IRScopedInstruction);
  39935. $core.addMethod(
  39936. $core.method({
  39937. selector: "scope:",
  39938. protocol: "accessing",
  39939. fn: function (aScope){
  39940. var self=this,$self=this;
  39941. $self["@scope"]=aScope;
  39942. return self;
  39943. },
  39944. args: ["aScope"],
  39945. source: "scope: aScope\x0a\x09scope := aScope",
  39946. referencedClasses: [],
  39947. messageSends: []
  39948. }),
  39949. $globals.IRScopedInstruction);
  39950. $core.addClass("IRClosureInstruction", $globals.IRScopedInstruction, ["arguments", "requiresSmalltalkContext"], "Compiler-IR");
  39951. $core.addMethod(
  39952. $core.method({
  39953. selector: "arguments",
  39954. protocol: "accessing",
  39955. fn: function (){
  39956. var self=this,$self=this;
  39957. return $core.withContext(function($ctx1) {
  39958. var $1,$receiver;
  39959. $1=$self["@arguments"];
  39960. if(($receiver = $1) == null || $receiver.a$nil){
  39961. return [];
  39962. } else {
  39963. return $1;
  39964. }
  39965. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  39966. },
  39967. args: [],
  39968. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  39969. referencedClasses: [],
  39970. messageSends: ["ifNil:"]
  39971. }),
  39972. $globals.IRClosureInstruction);
  39973. $core.addMethod(
  39974. $core.method({
  39975. selector: "arguments:",
  39976. protocol: "accessing",
  39977. fn: function (aCollection){
  39978. var self=this,$self=this;
  39979. $self["@arguments"]=aCollection;
  39980. return self;
  39981. },
  39982. args: ["aCollection"],
  39983. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  39984. referencedClasses: [],
  39985. messageSends: []
  39986. }),
  39987. $globals.IRClosureInstruction);
  39988. $core.addMethod(
  39989. $core.method({
  39990. selector: "locals",
  39991. protocol: "accessing",
  39992. fn: function (){
  39993. var self=this,$self=this;
  39994. return $core.withContext(function($ctx1) {
  39995. var $1;
  39996. $1=$recv($self._arguments())._copy();
  39997. $recv($1)._addAll_($recv($self._tempDeclarations())._collect_((function(each){
  39998. return $core.withContext(function($ctx2) {
  39999. return $recv(each)._name();
  40000. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40001. })));
  40002. return $recv($1)._yourself();
  40003. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  40004. },
  40005. args: [],
  40006. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  40007. referencedClasses: [],
  40008. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  40009. }),
  40010. $globals.IRClosureInstruction);
  40011. $core.addMethod(
  40012. $core.method({
  40013. selector: "requiresSmalltalkContext",
  40014. protocol: "accessing",
  40015. fn: function (){
  40016. var self=this,$self=this;
  40017. return $core.withContext(function($ctx1) {
  40018. var $1,$receiver;
  40019. $1=$self["@requiresSmalltalkContext"];
  40020. if(($receiver = $1) == null || $receiver.a$nil){
  40021. return false;
  40022. } else {
  40023. return $1;
  40024. }
  40025. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  40026. },
  40027. args: [],
  40028. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  40029. referencedClasses: [],
  40030. messageSends: ["ifNil:"]
  40031. }),
  40032. $globals.IRClosureInstruction);
  40033. $core.addMethod(
  40034. $core.method({
  40035. selector: "requiresSmalltalkContext:",
  40036. protocol: "accessing",
  40037. fn: function (anObject){
  40038. var self=this,$self=this;
  40039. $self["@requiresSmalltalkContext"]=anObject;
  40040. return self;
  40041. },
  40042. args: ["anObject"],
  40043. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  40044. referencedClasses: [],
  40045. messageSends: []
  40046. }),
  40047. $globals.IRClosureInstruction);
  40048. $core.addMethod(
  40049. $core.method({
  40050. selector: "scope:",
  40051. protocol: "accessing",
  40052. fn: function (aScope){
  40053. var self=this,$self=this;
  40054. return $core.withContext(function($ctx1) {
  40055. (
  40056. $ctx1.supercall = true,
  40057. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($self, [aScope]));
  40058. $ctx1.supercall = false;
  40059. $recv(aScope)._instruction_(self);
  40060. return self;
  40061. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  40062. },
  40063. args: ["aScope"],
  40064. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  40065. referencedClasses: [],
  40066. messageSends: ["scope:", "instruction:"]
  40067. }),
  40068. $globals.IRClosureInstruction);
  40069. $core.addMethod(
  40070. $core.method({
  40071. selector: "tempDeclarations",
  40072. protocol: "accessing",
  40073. fn: function (){
  40074. var self=this,$self=this;
  40075. return $core.withContext(function($ctx1) {
  40076. return $recv($self._dagChildren())._select_((function(each){
  40077. return $core.withContext(function($ctx2) {
  40078. return $recv(each)._isTempDeclaration();
  40079. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40080. }));
  40081. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  40082. },
  40083. args: [],
  40084. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  40085. referencedClasses: [],
  40086. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  40087. }),
  40088. $globals.IRClosureInstruction);
  40089. $core.addClass("IRClosure", $globals.IRClosureInstruction, [], "Compiler-IR");
  40090. $core.addMethod(
  40091. $core.method({
  40092. selector: "acceptDagVisitor:",
  40093. protocol: "visiting",
  40094. fn: function (aVisitor){
  40095. var self=this,$self=this;
  40096. return $core.withContext(function($ctx1) {
  40097. return $recv(aVisitor)._visitIRClosure_(self);
  40098. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRClosure)});
  40099. },
  40100. args: ["aVisitor"],
  40101. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  40102. referencedClasses: [],
  40103. messageSends: ["visitIRClosure:"]
  40104. }),
  40105. $globals.IRClosure);
  40106. $core.addMethod(
  40107. $core.method({
  40108. selector: "isClosure",
  40109. protocol: "testing",
  40110. fn: function (){
  40111. var self=this,$self=this;
  40112. return true;
  40113. },
  40114. args: [],
  40115. source: "isClosure\x0a\x09^ true",
  40116. referencedClasses: [],
  40117. messageSends: []
  40118. }),
  40119. $globals.IRClosure);
  40120. $core.addMethod(
  40121. $core.method({
  40122. selector: "sequence",
  40123. protocol: "accessing",
  40124. fn: function (){
  40125. var self=this,$self=this;
  40126. return $core.withContext(function($ctx1) {
  40127. return $recv($self._dagChildren())._last();
  40128. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  40129. },
  40130. args: [],
  40131. source: "sequence\x0a\x09^ self dagChildren last",
  40132. referencedClasses: [],
  40133. messageSends: ["last", "dagChildren"]
  40134. }),
  40135. $globals.IRClosure);
  40136. $core.addClass("IRMethod", $globals.IRClosureInstruction, ["theClass", "source", "selector", "classReferences", "sendIndexes", "requiresSmalltalkContext", "internalVariables"], "Compiler-IR");
  40137. $globals.IRMethod.comment="I am a method instruction";
  40138. $core.addMethod(
  40139. $core.method({
  40140. selector: "acceptDagVisitor:",
  40141. protocol: "visiting",
  40142. fn: function (aVisitor){
  40143. var self=this,$self=this;
  40144. return $core.withContext(function($ctx1) {
  40145. return $recv(aVisitor)._visitIRMethod_(self);
  40146. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRMethod)});
  40147. },
  40148. args: ["aVisitor"],
  40149. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  40150. referencedClasses: [],
  40151. messageSends: ["visitIRMethod:"]
  40152. }),
  40153. $globals.IRMethod);
  40154. $core.addMethod(
  40155. $core.method({
  40156. selector: "classReferences",
  40157. protocol: "accessing",
  40158. fn: function (){
  40159. var self=this,$self=this;
  40160. return $self["@classReferences"];
  40161. },
  40162. args: [],
  40163. source: "classReferences\x0a\x09^ classReferences",
  40164. referencedClasses: [],
  40165. messageSends: []
  40166. }),
  40167. $globals.IRMethod);
  40168. $core.addMethod(
  40169. $core.method({
  40170. selector: "classReferences:",
  40171. protocol: "accessing",
  40172. fn: function (aCollection){
  40173. var self=this,$self=this;
  40174. $self["@classReferences"]=aCollection;
  40175. return self;
  40176. },
  40177. args: ["aCollection"],
  40178. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  40179. referencedClasses: [],
  40180. messageSends: []
  40181. }),
  40182. $globals.IRMethod);
  40183. $core.addMethod(
  40184. $core.method({
  40185. selector: "internalVariables",
  40186. protocol: "accessing",
  40187. fn: function (){
  40188. var self=this,$self=this;
  40189. return $core.withContext(function($ctx1) {
  40190. var $1,$receiver;
  40191. $1=$self["@internalVariables"];
  40192. if(($receiver = $1) == null || $receiver.a$nil){
  40193. $self["@internalVariables"]=$recv($globals.Set)._new();
  40194. return $self["@internalVariables"];
  40195. } else {
  40196. return $1;
  40197. }
  40198. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  40199. },
  40200. args: [],
  40201. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  40202. referencedClasses: ["Set"],
  40203. messageSends: ["ifNil:", "new"]
  40204. }),
  40205. $globals.IRMethod);
  40206. $core.addMethod(
  40207. $core.method({
  40208. selector: "isMethod",
  40209. protocol: "testing",
  40210. fn: function (){
  40211. var self=this,$self=this;
  40212. return true;
  40213. },
  40214. args: [],
  40215. source: "isMethod\x0a\x09^ true",
  40216. referencedClasses: [],
  40217. messageSends: []
  40218. }),
  40219. $globals.IRMethod);
  40220. $core.addMethod(
  40221. $core.method({
  40222. selector: "messageSends",
  40223. protocol: "accessing",
  40224. fn: function (){
  40225. var self=this,$self=this;
  40226. return $core.withContext(function($ctx1) {
  40227. return $recv($self._sendIndexes())._keys();
  40228. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  40229. },
  40230. args: [],
  40231. source: "messageSends\x0a\x09^ self sendIndexes keys",
  40232. referencedClasses: [],
  40233. messageSends: ["keys", "sendIndexes"]
  40234. }),
  40235. $globals.IRMethod);
  40236. $core.addMethod(
  40237. $core.method({
  40238. selector: "method",
  40239. protocol: "accessing",
  40240. fn: function (){
  40241. var self=this,$self=this;
  40242. return self;
  40243. },
  40244. args: [],
  40245. source: "method\x0a\x09^ self",
  40246. referencedClasses: [],
  40247. messageSends: []
  40248. }),
  40249. $globals.IRMethod);
  40250. $core.addMethod(
  40251. $core.method({
  40252. selector: "selector",
  40253. protocol: "accessing",
  40254. fn: function (){
  40255. var self=this,$self=this;
  40256. return $self["@selector"];
  40257. },
  40258. args: [],
  40259. source: "selector\x0a\x09^ selector",
  40260. referencedClasses: [],
  40261. messageSends: []
  40262. }),
  40263. $globals.IRMethod);
  40264. $core.addMethod(
  40265. $core.method({
  40266. selector: "selector:",
  40267. protocol: "accessing",
  40268. fn: function (aString){
  40269. var self=this,$self=this;
  40270. $self["@selector"]=aString;
  40271. return self;
  40272. },
  40273. args: ["aString"],
  40274. source: "selector: aString\x0a\x09selector := aString",
  40275. referencedClasses: [],
  40276. messageSends: []
  40277. }),
  40278. $globals.IRMethod);
  40279. $core.addMethod(
  40280. $core.method({
  40281. selector: "sendIndexes",
  40282. protocol: "accessing",
  40283. fn: function (){
  40284. var self=this,$self=this;
  40285. return $self["@sendIndexes"];
  40286. },
  40287. args: [],
  40288. source: "sendIndexes\x0a\x09^ sendIndexes",
  40289. referencedClasses: [],
  40290. messageSends: []
  40291. }),
  40292. $globals.IRMethod);
  40293. $core.addMethod(
  40294. $core.method({
  40295. selector: "sendIndexes:",
  40296. protocol: "accessing",
  40297. fn: function (aDictionary){
  40298. var self=this,$self=this;
  40299. $self["@sendIndexes"]=aDictionary;
  40300. return self;
  40301. },
  40302. args: ["aDictionary"],
  40303. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  40304. referencedClasses: [],
  40305. messageSends: []
  40306. }),
  40307. $globals.IRMethod);
  40308. $core.addMethod(
  40309. $core.method({
  40310. selector: "source",
  40311. protocol: "accessing",
  40312. fn: function (){
  40313. var self=this,$self=this;
  40314. return $self["@source"];
  40315. },
  40316. args: [],
  40317. source: "source\x0a\x09^ source",
  40318. referencedClasses: [],
  40319. messageSends: []
  40320. }),
  40321. $globals.IRMethod);
  40322. $core.addMethod(
  40323. $core.method({
  40324. selector: "source:",
  40325. protocol: "accessing",
  40326. fn: function (aString){
  40327. var self=this,$self=this;
  40328. $self["@source"]=aString;
  40329. return self;
  40330. },
  40331. args: ["aString"],
  40332. source: "source: aString\x0a\x09source := aString",
  40333. referencedClasses: [],
  40334. messageSends: []
  40335. }),
  40336. $globals.IRMethod);
  40337. $core.addMethod(
  40338. $core.method({
  40339. selector: "theClass",
  40340. protocol: "accessing",
  40341. fn: function (){
  40342. var self=this,$self=this;
  40343. return $self["@theClass"];
  40344. },
  40345. args: [],
  40346. source: "theClass\x0a\x09^ theClass",
  40347. referencedClasses: [],
  40348. messageSends: []
  40349. }),
  40350. $globals.IRMethod);
  40351. $core.addMethod(
  40352. $core.method({
  40353. selector: "theClass:",
  40354. protocol: "accessing",
  40355. fn: function (aClass){
  40356. var self=this,$self=this;
  40357. $self["@theClass"]=aClass;
  40358. return self;
  40359. },
  40360. args: ["aClass"],
  40361. source: "theClass: aClass\x0a\x09theClass := aClass",
  40362. referencedClasses: [],
  40363. messageSends: []
  40364. }),
  40365. $globals.IRMethod);
  40366. $core.addClass("IRReturn", $globals.IRScopedInstruction, [], "Compiler-IR");
  40367. $globals.IRReturn.comment="I am a local return instruction.";
  40368. $core.addMethod(
  40369. $core.method({
  40370. selector: "acceptDagVisitor:",
  40371. protocol: "visiting",
  40372. fn: function (aVisitor){
  40373. var self=this,$self=this;
  40374. return $core.withContext(function($ctx1) {
  40375. return $recv(aVisitor)._visitIRReturn_(self);
  40376. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRReturn)});
  40377. },
  40378. args: ["aVisitor"],
  40379. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  40380. referencedClasses: [],
  40381. messageSends: ["visitIRReturn:"]
  40382. }),
  40383. $globals.IRReturn);
  40384. $core.addMethod(
  40385. $core.method({
  40386. selector: "expression",
  40387. protocol: "accessing",
  40388. fn: function (){
  40389. var self=this,$self=this;
  40390. return $core.withContext(function($ctx1) {
  40391. return $recv($self._dagChildren())._single();
  40392. }, function($ctx1) {$ctx1.fill(self,"expression",{},$globals.IRReturn)});
  40393. },
  40394. args: [],
  40395. source: "expression\x0a\x09^ self dagChildren single",
  40396. referencedClasses: [],
  40397. messageSends: ["single", "dagChildren"]
  40398. }),
  40399. $globals.IRReturn);
  40400. $core.addMethod(
  40401. $core.method({
  40402. selector: "scope",
  40403. protocol: "accessing",
  40404. fn: function (){
  40405. var self=this,$self=this;
  40406. return $core.withContext(function($ctx1) {
  40407. var $1,$receiver;
  40408. $1=$self["@scope"];
  40409. if(($receiver = $1) == null || $receiver.a$nil){
  40410. return $recv($self._parent())._scope();
  40411. } else {
  40412. return $1;
  40413. }
  40414. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  40415. },
  40416. args: [],
  40417. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  40418. referencedClasses: [],
  40419. messageSends: ["ifNil:", "scope", "parent"]
  40420. }),
  40421. $globals.IRReturn);
  40422. $core.addMethod(
  40423. $core.method({
  40424. selector: "yieldsValue",
  40425. protocol: "testing",
  40426. fn: function (){
  40427. var self=this,$self=this;
  40428. return false;
  40429. },
  40430. args: [],
  40431. source: "yieldsValue\x0a\x09^ false",
  40432. referencedClasses: [],
  40433. messageSends: []
  40434. }),
  40435. $globals.IRReturn);
  40436. $core.addClass("IRBlockReturn", $globals.IRReturn, [], "Compiler-IR");
  40437. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  40438. $core.addMethod(
  40439. $core.method({
  40440. selector: "acceptDagVisitor:",
  40441. protocol: "visiting",
  40442. fn: function (aVisitor){
  40443. var self=this,$self=this;
  40444. return $core.withContext(function($ctx1) {
  40445. return $recv(aVisitor)._visitIRBlockReturn_(self);
  40446. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  40447. },
  40448. args: ["aVisitor"],
  40449. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  40450. referencedClasses: [],
  40451. messageSends: ["visitIRBlockReturn:"]
  40452. }),
  40453. $globals.IRBlockReturn);
  40454. $core.addClass("IRNonLocalReturn", $globals.IRReturn, [], "Compiler-IR");
  40455. $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.";
  40456. $core.addMethod(
  40457. $core.method({
  40458. selector: "acceptDagVisitor:",
  40459. protocol: "visiting",
  40460. fn: function (aVisitor){
  40461. var self=this,$self=this;
  40462. return $core.withContext(function($ctx1) {
  40463. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  40464. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  40465. },
  40466. args: ["aVisitor"],
  40467. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  40468. referencedClasses: [],
  40469. messageSends: ["visitIRNonLocalReturn:"]
  40470. }),
  40471. $globals.IRNonLocalReturn);
  40472. $core.addClass("IRTempDeclaration", $globals.IRScopedInstruction, ["name"], "Compiler-IR");
  40473. $core.addMethod(
  40474. $core.method({
  40475. selector: "acceptDagVisitor:",
  40476. protocol: "visiting",
  40477. fn: function (aVisitor){
  40478. var self=this,$self=this;
  40479. return $core.withContext(function($ctx1) {
  40480. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  40481. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  40482. },
  40483. args: ["aVisitor"],
  40484. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  40485. referencedClasses: [],
  40486. messageSends: ["visitIRTempDeclaration:"]
  40487. }),
  40488. $globals.IRTempDeclaration);
  40489. $core.addMethod(
  40490. $core.method({
  40491. selector: "isTempDeclaration",
  40492. protocol: "testing",
  40493. fn: function (){
  40494. var self=this,$self=this;
  40495. return true;
  40496. },
  40497. args: [],
  40498. source: "isTempDeclaration\x0a\x09^ true",
  40499. referencedClasses: [],
  40500. messageSends: []
  40501. }),
  40502. $globals.IRTempDeclaration);
  40503. $core.addMethod(
  40504. $core.method({
  40505. selector: "name",
  40506. protocol: "accessing",
  40507. fn: function (){
  40508. var self=this,$self=this;
  40509. return $self["@name"];
  40510. },
  40511. args: [],
  40512. source: "name\x0a\x09^ name",
  40513. referencedClasses: [],
  40514. messageSends: []
  40515. }),
  40516. $globals.IRTempDeclaration);
  40517. $core.addMethod(
  40518. $core.method({
  40519. selector: "name:",
  40520. protocol: "accessing",
  40521. fn: function (aString){
  40522. var self=this,$self=this;
  40523. $self["@name"]=aString;
  40524. return self;
  40525. },
  40526. args: ["aString"],
  40527. source: "name: aString\x0a\x09name := aString",
  40528. referencedClasses: [],
  40529. messageSends: []
  40530. }),
  40531. $globals.IRTempDeclaration);
  40532. $core.addClass("IRSend", $globals.IRInstruction, ["selector", "index"], "Compiler-IR");
  40533. $globals.IRSend.comment="I am a message send instruction.";
  40534. $core.addMethod(
  40535. $core.method({
  40536. selector: "acceptDagVisitor:",
  40537. protocol: "visiting",
  40538. fn: function (aVisitor){
  40539. var self=this,$self=this;
  40540. return $core.withContext(function($ctx1) {
  40541. return $recv(aVisitor)._visitIRSend_(self);
  40542. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSend)});
  40543. },
  40544. args: ["aVisitor"],
  40545. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  40546. referencedClasses: [],
  40547. messageSends: ["visitIRSend:"]
  40548. }),
  40549. $globals.IRSend);
  40550. $core.addMethod(
  40551. $core.method({
  40552. selector: "arguments",
  40553. protocol: "accessing",
  40554. fn: function (){
  40555. var self=this,$self=this;
  40556. return $core.withContext(function($ctx1) {
  40557. return $recv($self._dagChildren())._allButFirst();
  40558. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
  40559. },
  40560. args: [],
  40561. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  40562. referencedClasses: [],
  40563. messageSends: ["allButFirst", "dagChildren"]
  40564. }),
  40565. $globals.IRSend);
  40566. $core.addMethod(
  40567. $core.method({
  40568. selector: "index",
  40569. protocol: "accessing",
  40570. fn: function (){
  40571. var self=this,$self=this;
  40572. return $self["@index"];
  40573. },
  40574. args: [],
  40575. source: "index\x0a\x09^ index",
  40576. referencedClasses: [],
  40577. messageSends: []
  40578. }),
  40579. $globals.IRSend);
  40580. $core.addMethod(
  40581. $core.method({
  40582. selector: "index:",
  40583. protocol: "accessing",
  40584. fn: function (anInteger){
  40585. var self=this,$self=this;
  40586. $self["@index"]=anInteger;
  40587. return self;
  40588. },
  40589. args: ["anInteger"],
  40590. source: "index: anInteger\x0a\x09index := anInteger",
  40591. referencedClasses: [],
  40592. messageSends: []
  40593. }),
  40594. $globals.IRSend);
  40595. $core.addMethod(
  40596. $core.method({
  40597. selector: "isSend",
  40598. protocol: "testing",
  40599. fn: function (){
  40600. var self=this,$self=this;
  40601. return true;
  40602. },
  40603. args: [],
  40604. source: "isSend\x0a\x09^ true",
  40605. referencedClasses: [],
  40606. messageSends: []
  40607. }),
  40608. $globals.IRSend);
  40609. $core.addMethod(
  40610. $core.method({
  40611. selector: "receiver",
  40612. protocol: "accessing",
  40613. fn: function (){
  40614. var self=this,$self=this;
  40615. return $core.withContext(function($ctx1) {
  40616. return $recv($self._dagChildren())._first();
  40617. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
  40618. },
  40619. args: [],
  40620. source: "receiver\x0a\x09^ self dagChildren first",
  40621. referencedClasses: [],
  40622. messageSends: ["first", "dagChildren"]
  40623. }),
  40624. $globals.IRSend);
  40625. $core.addMethod(
  40626. $core.method({
  40627. selector: "selector",
  40628. protocol: "accessing",
  40629. fn: function (){
  40630. var self=this,$self=this;
  40631. return $self["@selector"];
  40632. },
  40633. args: [],
  40634. source: "selector\x0a\x09^ selector",
  40635. referencedClasses: [],
  40636. messageSends: []
  40637. }),
  40638. $globals.IRSend);
  40639. $core.addMethod(
  40640. $core.method({
  40641. selector: "selector:",
  40642. protocol: "accessing",
  40643. fn: function (aString){
  40644. var self=this,$self=this;
  40645. $self["@selector"]=aString;
  40646. return self;
  40647. },
  40648. args: ["aString"],
  40649. source: "selector: aString\x0a\x09selector := aString",
  40650. referencedClasses: [],
  40651. messageSends: []
  40652. }),
  40653. $globals.IRSend);
  40654. $core.addClass("IRSequence", $globals.IRInstruction, [], "Compiler-IR");
  40655. $core.addMethod(
  40656. $core.method({
  40657. selector: "acceptDagVisitor:",
  40658. protocol: "visiting",
  40659. fn: function (aVisitor){
  40660. var self=this,$self=this;
  40661. return $core.withContext(function($ctx1) {
  40662. return $recv(aVisitor)._visitIRSequence_(self);
  40663. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSequence)});
  40664. },
  40665. args: ["aVisitor"],
  40666. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  40667. referencedClasses: [],
  40668. messageSends: ["visitIRSequence:"]
  40669. }),
  40670. $globals.IRSequence);
  40671. $core.addMethod(
  40672. $core.method({
  40673. selector: "isSequence",
  40674. protocol: "testing",
  40675. fn: function (){
  40676. var self=this,$self=this;
  40677. return true;
  40678. },
  40679. args: [],
  40680. source: "isSequence\x0a\x09^ true",
  40681. referencedClasses: [],
  40682. messageSends: []
  40683. }),
  40684. $globals.IRSequence);
  40685. $core.addClass("IRBlockSequence", $globals.IRSequence, [], "Compiler-IR");
  40686. $core.addMethod(
  40687. $core.method({
  40688. selector: "acceptDagVisitor:",
  40689. protocol: "visiting",
  40690. fn: function (aVisitor){
  40691. var self=this,$self=this;
  40692. return $core.withContext(function($ctx1) {
  40693. return $recv(aVisitor)._visitIRBlockSequence_(self);
  40694. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  40695. },
  40696. args: ["aVisitor"],
  40697. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  40698. referencedClasses: [],
  40699. messageSends: ["visitIRBlockSequence:"]
  40700. }),
  40701. $globals.IRBlockSequence);
  40702. $core.addClass("IRValue", $globals.IRInstruction, ["value"], "Compiler-IR");
  40703. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  40704. $core.addMethod(
  40705. $core.method({
  40706. selector: "acceptDagVisitor:",
  40707. protocol: "visiting",
  40708. fn: function (aVisitor){
  40709. var self=this,$self=this;
  40710. return $core.withContext(function($ctx1) {
  40711. return $recv(aVisitor)._visitIRValue_(self);
  40712. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRValue)});
  40713. },
  40714. args: ["aVisitor"],
  40715. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  40716. referencedClasses: [],
  40717. messageSends: ["visitIRValue:"]
  40718. }),
  40719. $globals.IRValue);
  40720. $core.addMethod(
  40721. $core.method({
  40722. selector: "needsBoxingAsReceiver",
  40723. protocol: "testing",
  40724. fn: function (){
  40725. var self=this,$self=this;
  40726. return false;
  40727. },
  40728. args: [],
  40729. source: "needsBoxingAsReceiver\x0a\x09^ false",
  40730. referencedClasses: [],
  40731. messageSends: []
  40732. }),
  40733. $globals.IRValue);
  40734. $core.addMethod(
  40735. $core.method({
  40736. selector: "value",
  40737. protocol: "accessing",
  40738. fn: function (){
  40739. var self=this,$self=this;
  40740. return $self["@value"];
  40741. },
  40742. args: [],
  40743. source: "value\x0a\x09^ value",
  40744. referencedClasses: [],
  40745. messageSends: []
  40746. }),
  40747. $globals.IRValue);
  40748. $core.addMethod(
  40749. $core.method({
  40750. selector: "value:",
  40751. protocol: "accessing",
  40752. fn: function (aString){
  40753. var self=this,$self=this;
  40754. $self["@value"]=aString;
  40755. return self;
  40756. },
  40757. args: ["aString"],
  40758. source: "value: aString\x0a\x09value := aString",
  40759. referencedClasses: [],
  40760. messageSends: []
  40761. }),
  40762. $globals.IRValue);
  40763. $core.addClass("IRVariable", $globals.IRInstruction, ["variable"], "Compiler-IR");
  40764. $globals.IRVariable.comment="I am a variable instruction.";
  40765. $core.addMethod(
  40766. $core.method({
  40767. selector: "acceptDagVisitor:",
  40768. protocol: "visiting",
  40769. fn: function (aVisitor){
  40770. var self=this,$self=this;
  40771. return $core.withContext(function($ctx1) {
  40772. return $recv(aVisitor)._visitIRVariable_(self);
  40773. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVariable)});
  40774. },
  40775. args: ["aVisitor"],
  40776. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  40777. referencedClasses: [],
  40778. messageSends: ["visitIRVariable:"]
  40779. }),
  40780. $globals.IRVariable);
  40781. $core.addMethod(
  40782. $core.method({
  40783. selector: "isSelf",
  40784. protocol: "testing",
  40785. fn: function (){
  40786. var self=this,$self=this;
  40787. return $core.withContext(function($ctx1) {
  40788. return $recv($self._variable())._isSelf();
  40789. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.IRVariable)});
  40790. },
  40791. args: [],
  40792. source: "isSelf\x0a\x09^ self variable isSelf",
  40793. referencedClasses: [],
  40794. messageSends: ["isSelf", "variable"]
  40795. }),
  40796. $globals.IRVariable);
  40797. $core.addMethod(
  40798. $core.method({
  40799. selector: "isSuper",
  40800. protocol: "testing",
  40801. fn: function (){
  40802. var self=this,$self=this;
  40803. return $core.withContext(function($ctx1) {
  40804. return $recv($self._variable())._isSuper();
  40805. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.IRVariable)});
  40806. },
  40807. args: [],
  40808. source: "isSuper\x0a\x09^ self variable isSuper",
  40809. referencedClasses: [],
  40810. messageSends: ["isSuper", "variable"]
  40811. }),
  40812. $globals.IRVariable);
  40813. $core.addMethod(
  40814. $core.method({
  40815. selector: "isVariable",
  40816. protocol: "testing",
  40817. fn: function (){
  40818. var self=this,$self=this;
  40819. return true;
  40820. },
  40821. args: [],
  40822. source: "isVariable\x0a\x09^ true",
  40823. referencedClasses: [],
  40824. messageSends: []
  40825. }),
  40826. $globals.IRVariable);
  40827. $core.addMethod(
  40828. $core.method({
  40829. selector: "needsBoxingAsReceiver",
  40830. protocol: "testing",
  40831. fn: function (){
  40832. var self=this,$self=this;
  40833. return $core.withContext(function($ctx1) {
  40834. return $recv($recv($self._variable())._isPseudoVar())._not();
  40835. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  40836. },
  40837. args: [],
  40838. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  40839. referencedClasses: [],
  40840. messageSends: ["not", "isPseudoVar", "variable"]
  40841. }),
  40842. $globals.IRVariable);
  40843. $core.addMethod(
  40844. $core.method({
  40845. selector: "variable",
  40846. protocol: "accessing",
  40847. fn: function (){
  40848. var self=this,$self=this;
  40849. return $self["@variable"];
  40850. },
  40851. args: [],
  40852. source: "variable\x0a\x09^ variable",
  40853. referencedClasses: [],
  40854. messageSends: []
  40855. }),
  40856. $globals.IRVariable);
  40857. $core.addMethod(
  40858. $core.method({
  40859. selector: "variable:",
  40860. protocol: "accessing",
  40861. fn: function (aScopeVariable){
  40862. var self=this,$self=this;
  40863. $self["@variable"]=aScopeVariable;
  40864. return self;
  40865. },
  40866. args: ["aScopeVariable"],
  40867. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  40868. referencedClasses: [],
  40869. messageSends: []
  40870. }),
  40871. $globals.IRVariable);
  40872. $core.addClass("IRVerbatim", $globals.IRInstruction, ["source"], "Compiler-IR");
  40873. $core.addMethod(
  40874. $core.method({
  40875. selector: "acceptDagVisitor:",
  40876. protocol: "visiting",
  40877. fn: function (aVisitor){
  40878. var self=this,$self=this;
  40879. return $core.withContext(function($ctx1) {
  40880. return $recv(aVisitor)._visitIRVerbatim_(self);
  40881. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  40882. },
  40883. args: ["aVisitor"],
  40884. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  40885. referencedClasses: [],
  40886. messageSends: ["visitIRVerbatim:"]
  40887. }),
  40888. $globals.IRVerbatim);
  40889. $core.addMethod(
  40890. $core.method({
  40891. selector: "source",
  40892. protocol: "accessing",
  40893. fn: function (){
  40894. var self=this,$self=this;
  40895. return $self["@source"];
  40896. },
  40897. args: [],
  40898. source: "source\x0a\x09^ source",
  40899. referencedClasses: [],
  40900. messageSends: []
  40901. }),
  40902. $globals.IRVerbatim);
  40903. $core.addMethod(
  40904. $core.method({
  40905. selector: "source:",
  40906. protocol: "accessing",
  40907. fn: function (aString){
  40908. var self=this,$self=this;
  40909. $self["@source"]=aString;
  40910. return self;
  40911. },
  40912. args: ["aString"],
  40913. source: "source: aString\x0a\x09source := aString",
  40914. referencedClasses: [],
  40915. messageSends: []
  40916. }),
  40917. $globals.IRVerbatim);
  40918. $core.addClass("IRVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-IR");
  40919. $core.addMethod(
  40920. $core.method({
  40921. selector: "visitDagNode:",
  40922. protocol: "visiting",
  40923. fn: function (aNode){
  40924. var self=this,$self=this;
  40925. return $core.withContext(function($ctx1) {
  40926. return $self._visitDagNodeVariantSimple_(aNode);
  40927. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.IRVisitor)});
  40928. },
  40929. args: ["aNode"],
  40930. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  40931. referencedClasses: [],
  40932. messageSends: ["visitDagNodeVariantSimple:"]
  40933. }),
  40934. $globals.IRVisitor);
  40935. $core.addMethod(
  40936. $core.method({
  40937. selector: "visitIRAssignment:",
  40938. protocol: "visiting",
  40939. fn: function (anIRAssignment){
  40940. var self=this,$self=this;
  40941. return $core.withContext(function($ctx1) {
  40942. return $self._visitDagNode_(anIRAssignment);
  40943. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  40944. },
  40945. args: ["anIRAssignment"],
  40946. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  40947. referencedClasses: [],
  40948. messageSends: ["visitDagNode:"]
  40949. }),
  40950. $globals.IRVisitor);
  40951. $core.addMethod(
  40952. $core.method({
  40953. selector: "visitIRBlockReturn:",
  40954. protocol: "visiting",
  40955. fn: function (anIRBlockReturn){
  40956. var self=this,$self=this;
  40957. return $core.withContext(function($ctx1) {
  40958. return $self._visitIRReturn_(anIRBlockReturn);
  40959. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  40960. },
  40961. args: ["anIRBlockReturn"],
  40962. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  40963. referencedClasses: [],
  40964. messageSends: ["visitIRReturn:"]
  40965. }),
  40966. $globals.IRVisitor);
  40967. $core.addMethod(
  40968. $core.method({
  40969. selector: "visitIRBlockSequence:",
  40970. protocol: "visiting",
  40971. fn: function (anIRBlockSequence){
  40972. var self=this,$self=this;
  40973. return $core.withContext(function($ctx1) {
  40974. return $self._visitIRSequence_(anIRBlockSequence);
  40975. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  40976. },
  40977. args: ["anIRBlockSequence"],
  40978. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  40979. referencedClasses: [],
  40980. messageSends: ["visitIRSequence:"]
  40981. }),
  40982. $globals.IRVisitor);
  40983. $core.addMethod(
  40984. $core.method({
  40985. selector: "visitIRClosure:",
  40986. protocol: "visiting",
  40987. fn: function (anIRClosure){
  40988. var self=this,$self=this;
  40989. return $core.withContext(function($ctx1) {
  40990. return $self._visitDagNode_(anIRClosure);
  40991. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  40992. },
  40993. args: ["anIRClosure"],
  40994. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  40995. referencedClasses: [],
  40996. messageSends: ["visitDagNode:"]
  40997. }),
  40998. $globals.IRVisitor);
  40999. $core.addMethod(
  41000. $core.method({
  41001. selector: "visitIRDynamicArray:",
  41002. protocol: "visiting",
  41003. fn: function (anIRDynamicArray){
  41004. var self=this,$self=this;
  41005. return $core.withContext(function($ctx1) {
  41006. return $self._visitDagNode_(anIRDynamicArray);
  41007. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  41008. },
  41009. args: ["anIRDynamicArray"],
  41010. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  41011. referencedClasses: [],
  41012. messageSends: ["visitDagNode:"]
  41013. }),
  41014. $globals.IRVisitor);
  41015. $core.addMethod(
  41016. $core.method({
  41017. selector: "visitIRDynamicDictionary:",
  41018. protocol: "visiting",
  41019. fn: function (anIRDynamicDictionary){
  41020. var self=this,$self=this;
  41021. return $core.withContext(function($ctx1) {
  41022. return $self._visitDagNode_(anIRDynamicDictionary);
  41023. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  41024. },
  41025. args: ["anIRDynamicDictionary"],
  41026. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  41027. referencedClasses: [],
  41028. messageSends: ["visitDagNode:"]
  41029. }),
  41030. $globals.IRVisitor);
  41031. $core.addMethod(
  41032. $core.method({
  41033. selector: "visitIRInlinedClosure:",
  41034. protocol: "visiting",
  41035. fn: function (anIRInlinedClosure){
  41036. var self=this,$self=this;
  41037. return $core.withContext(function($ctx1) {
  41038. return $self._visitIRClosure_(anIRInlinedClosure);
  41039. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  41040. },
  41041. args: ["anIRInlinedClosure"],
  41042. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  41043. referencedClasses: [],
  41044. messageSends: ["visitIRClosure:"]
  41045. }),
  41046. $globals.IRVisitor);
  41047. $core.addMethod(
  41048. $core.method({
  41049. selector: "visitIRInlinedSequence:",
  41050. protocol: "visiting",
  41051. fn: function (anIRInlinedSequence){
  41052. var self=this,$self=this;
  41053. return $core.withContext(function($ctx1) {
  41054. return $self._visitIRSequence_(anIRInlinedSequence);
  41055. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  41056. },
  41057. args: ["anIRInlinedSequence"],
  41058. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  41059. referencedClasses: [],
  41060. messageSends: ["visitIRSequence:"]
  41061. }),
  41062. $globals.IRVisitor);
  41063. $core.addMethod(
  41064. $core.method({
  41065. selector: "visitIRMethod:",
  41066. protocol: "visiting",
  41067. fn: function (anIRMethod){
  41068. var self=this,$self=this;
  41069. return $core.withContext(function($ctx1) {
  41070. return $self._visitDagNode_(anIRMethod);
  41071. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  41072. },
  41073. args: ["anIRMethod"],
  41074. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  41075. referencedClasses: [],
  41076. messageSends: ["visitDagNode:"]
  41077. }),
  41078. $globals.IRVisitor);
  41079. $core.addMethod(
  41080. $core.method({
  41081. selector: "visitIRNonLocalReturn:",
  41082. protocol: "visiting",
  41083. fn: function (anIRNonLocalReturn){
  41084. var self=this,$self=this;
  41085. return $core.withContext(function($ctx1) {
  41086. return $self._visitDagNode_(anIRNonLocalReturn);
  41087. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  41088. },
  41089. args: ["anIRNonLocalReturn"],
  41090. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  41091. referencedClasses: [],
  41092. messageSends: ["visitDagNode:"]
  41093. }),
  41094. $globals.IRVisitor);
  41095. $core.addMethod(
  41096. $core.method({
  41097. selector: "visitIRNonLocalReturnHandling:",
  41098. protocol: "visiting",
  41099. fn: function (anIRNonLocalReturnHandling){
  41100. var self=this,$self=this;
  41101. return $core.withContext(function($ctx1) {
  41102. return $self._visitDagNode_(anIRNonLocalReturnHandling);
  41103. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  41104. },
  41105. args: ["anIRNonLocalReturnHandling"],
  41106. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  41107. referencedClasses: [],
  41108. messageSends: ["visitDagNode:"]
  41109. }),
  41110. $globals.IRVisitor);
  41111. $core.addMethod(
  41112. $core.method({
  41113. selector: "visitIRReturn:",
  41114. protocol: "visiting",
  41115. fn: function (anIRReturn){
  41116. var self=this,$self=this;
  41117. return $core.withContext(function($ctx1) {
  41118. return $self._visitDagNode_(anIRReturn);
  41119. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  41120. },
  41121. args: ["anIRReturn"],
  41122. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  41123. referencedClasses: [],
  41124. messageSends: ["visitDagNode:"]
  41125. }),
  41126. $globals.IRVisitor);
  41127. $core.addMethod(
  41128. $core.method({
  41129. selector: "visitIRSend:",
  41130. protocol: "visiting",
  41131. fn: function (anIRSend){
  41132. var self=this,$self=this;
  41133. return $core.withContext(function($ctx1) {
  41134. return $self._visitDagNode_(anIRSend);
  41135. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  41136. },
  41137. args: ["anIRSend"],
  41138. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  41139. referencedClasses: [],
  41140. messageSends: ["visitDagNode:"]
  41141. }),
  41142. $globals.IRVisitor);
  41143. $core.addMethod(
  41144. $core.method({
  41145. selector: "visitIRSequence:",
  41146. protocol: "visiting",
  41147. fn: function (anIRSequence){
  41148. var self=this,$self=this;
  41149. return $core.withContext(function($ctx1) {
  41150. return $self._visitDagNode_(anIRSequence);
  41151. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  41152. },
  41153. args: ["anIRSequence"],
  41154. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  41155. referencedClasses: [],
  41156. messageSends: ["visitDagNode:"]
  41157. }),
  41158. $globals.IRVisitor);
  41159. $core.addMethod(
  41160. $core.method({
  41161. selector: "visitIRTempDeclaration:",
  41162. protocol: "visiting",
  41163. fn: function (anIRTempDeclaration){
  41164. var self=this,$self=this;
  41165. return $core.withContext(function($ctx1) {
  41166. return $self._visitDagNode_(anIRTempDeclaration);
  41167. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  41168. },
  41169. args: ["anIRTempDeclaration"],
  41170. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  41171. referencedClasses: [],
  41172. messageSends: ["visitDagNode:"]
  41173. }),
  41174. $globals.IRVisitor);
  41175. $core.addMethod(
  41176. $core.method({
  41177. selector: "visitIRValue:",
  41178. protocol: "visiting",
  41179. fn: function (anIRValue){
  41180. var self=this,$self=this;
  41181. return $core.withContext(function($ctx1) {
  41182. return $self._visitDagNode_(anIRValue);
  41183. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  41184. },
  41185. args: ["anIRValue"],
  41186. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  41187. referencedClasses: [],
  41188. messageSends: ["visitDagNode:"]
  41189. }),
  41190. $globals.IRVisitor);
  41191. $core.addMethod(
  41192. $core.method({
  41193. selector: "visitIRVariable:",
  41194. protocol: "visiting",
  41195. fn: function (anIRVariable){
  41196. var self=this,$self=this;
  41197. return $core.withContext(function($ctx1) {
  41198. return $self._visitDagNode_(anIRVariable);
  41199. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  41200. },
  41201. args: ["anIRVariable"],
  41202. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  41203. referencedClasses: [],
  41204. messageSends: ["visitDagNode:"]
  41205. }),
  41206. $globals.IRVisitor);
  41207. $core.addMethod(
  41208. $core.method({
  41209. selector: "visitIRVerbatim:",
  41210. protocol: "visiting",
  41211. fn: function (anIRVerbatim){
  41212. var self=this,$self=this;
  41213. return $core.withContext(function($ctx1) {
  41214. return $self._visitDagNode_(anIRVerbatim);
  41215. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  41216. },
  41217. args: ["anIRVerbatim"],
  41218. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  41219. referencedClasses: [],
  41220. messageSends: ["visitDagNode:"]
  41221. }),
  41222. $globals.IRVisitor);
  41223. $core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
  41224. $core.addMethod(
  41225. $core.method({
  41226. selector: "contents",
  41227. protocol: "accessing",
  41228. fn: function (){
  41229. var self=this,$self=this;
  41230. return $core.withContext(function($ctx1) {
  41231. return $recv($self._stream())._contents();
  41232. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  41233. },
  41234. args: [],
  41235. source: "contents\x0a\x09^ self stream contents",
  41236. referencedClasses: [],
  41237. messageSends: ["contents", "stream"]
  41238. }),
  41239. $globals.IRJSTranslator);
  41240. $core.addMethod(
  41241. $core.method({
  41242. selector: "currentClass",
  41243. protocol: "accessing",
  41244. fn: function (){
  41245. var self=this,$self=this;
  41246. return $self["@currentClass"];
  41247. },
  41248. args: [],
  41249. source: "currentClass\x0a\x09^ currentClass",
  41250. referencedClasses: [],
  41251. messageSends: []
  41252. }),
  41253. $globals.IRJSTranslator);
  41254. $core.addMethod(
  41255. $core.method({
  41256. selector: "currentClass:",
  41257. protocol: "accessing",
  41258. fn: function (aClass){
  41259. var self=this,$self=this;
  41260. $self["@currentClass"]=aClass;
  41261. return self;
  41262. },
  41263. args: ["aClass"],
  41264. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  41265. referencedClasses: [],
  41266. messageSends: []
  41267. }),
  41268. $globals.IRJSTranslator);
  41269. $core.addMethod(
  41270. $core.method({
  41271. selector: "initialize",
  41272. protocol: "initialization",
  41273. fn: function (){
  41274. var self=this,$self=this;
  41275. return $core.withContext(function($ctx1) {
  41276. (
  41277. $ctx1.supercall = true,
  41278. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41279. $ctx1.supercall = false;
  41280. $self["@stream"]=$recv($globals.JSStream)._new();
  41281. return self;
  41282. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  41283. },
  41284. args: [],
  41285. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  41286. referencedClasses: ["JSStream"],
  41287. messageSends: ["initialize", "new"]
  41288. }),
  41289. $globals.IRJSTranslator);
  41290. $core.addMethod(
  41291. $core.method({
  41292. selector: "stream",
  41293. protocol: "accessing",
  41294. fn: function (){
  41295. var self=this,$self=this;
  41296. return $self["@stream"];
  41297. },
  41298. args: [],
  41299. source: "stream\x0a\x09^ stream",
  41300. referencedClasses: [],
  41301. messageSends: []
  41302. }),
  41303. $globals.IRJSTranslator);
  41304. $core.addMethod(
  41305. $core.method({
  41306. selector: "stream:",
  41307. protocol: "accessing",
  41308. fn: function (aStream){
  41309. var self=this,$self=this;
  41310. $self["@stream"]=aStream;
  41311. return self;
  41312. },
  41313. args: ["aStream"],
  41314. source: "stream: aStream\x0a\x09stream := aStream",
  41315. referencedClasses: [],
  41316. messageSends: []
  41317. }),
  41318. $globals.IRJSTranslator);
  41319. $core.addMethod(
  41320. $core.method({
  41321. selector: "visitIRAssignment:",
  41322. protocol: "visiting",
  41323. fn: function (anIRAssignment){
  41324. var self=this,$self=this;
  41325. return $core.withContext(function($ctx1) {
  41326. $recv($self._stream())._nextPutAssignLhs_rhs_((function(){
  41327. return $core.withContext(function($ctx2) {
  41328. return $self._visit_($recv(anIRAssignment)._left());
  41329. $ctx2.sendIdx["visit:"]=1;
  41330. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41331. }),(function(){
  41332. return $core.withContext(function($ctx2) {
  41333. return $self._visit_($recv(anIRAssignment)._right());
  41334. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41335. }));
  41336. return self;
  41337. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  41338. },
  41339. args: ["anIRAssignment"],
  41340. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  41341. referencedClasses: [],
  41342. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  41343. }),
  41344. $globals.IRJSTranslator);
  41345. $core.addMethod(
  41346. $core.method({
  41347. selector: "visitIRClosure:",
  41348. protocol: "visiting",
  41349. fn: function (anIRClosure){
  41350. var self=this,$self=this;
  41351. return $core.withContext(function($ctx1) {
  41352. var $1,$2;
  41353. $1=$self._stream();
  41354. $ctx1.sendIdx["stream"]=1;
  41355. $recv($1)._nextPutClosureWith_arguments_((function(){
  41356. return $core.withContext(function($ctx2) {
  41357. $2=$self._stream();
  41358. $ctx2.sendIdx["stream"]=2;
  41359. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  41360. return $core.withContext(function($ctx3) {
  41361. return $recv($recv(each)._name())._asVariableName();
  41362. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  41363. })));
  41364. return $recv($self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  41365. return $core.withContext(function($ctx3) {
  41366. return (
  41367. $ctx3.supercall = true,
  41368. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($self, [anIRClosure]));
  41369. $ctx3.supercall = false;
  41370. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  41371. }));
  41372. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41373. }),$recv(anIRClosure)._arguments());
  41374. return self;
  41375. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  41376. },
  41377. args: ["anIRClosure"],
  41378. 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",
  41379. referencedClasses: [],
  41380. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  41381. }),
  41382. $globals.IRJSTranslator);
  41383. $core.addMethod(
  41384. $core.method({
  41385. selector: "visitIRDynamicArray:",
  41386. protocol: "visiting",
  41387. fn: function (anIRDynamicArray){
  41388. var self=this,$self=this;
  41389. return $core.withContext(function($ctx1) {
  41390. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  41391. return self;
  41392. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  41393. },
  41394. args: ["anIRDynamicArray"],
  41395. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  41396. referencedClasses: [],
  41397. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41398. }),
  41399. $globals.IRJSTranslator);
  41400. $core.addMethod(
  41401. $core.method({
  41402. selector: "visitIRDynamicDictionary:",
  41403. protocol: "visiting",
  41404. fn: function (anIRDynamicDictionary){
  41405. var self=this,$self=this;
  41406. return $core.withContext(function($ctx1) {
  41407. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  41408. return self;
  41409. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  41410. },
  41411. args: ["anIRDynamicDictionary"],
  41412. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  41413. referencedClasses: [],
  41414. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41415. }),
  41416. $globals.IRJSTranslator);
  41417. $core.addMethod(
  41418. $core.method({
  41419. selector: "visitIRMethod:",
  41420. protocol: "visiting",
  41421. fn: function (anIRMethod){
  41422. var self=this,$self=this;
  41423. return $core.withContext(function($ctx1) {
  41424. var $1,$2,$3,$4,$5,$6,$7;
  41425. $1=$self._stream();
  41426. $ctx1.sendIdx["stream"]=1;
  41427. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  41428. return $core.withContext(function($ctx2) {
  41429. $2=$self._stream();
  41430. $ctx2.sendIdx["stream"]=2;
  41431. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  41432. return $core.withContext(function($ctx3) {
  41433. $3=$self._stream();
  41434. $ctx3.sendIdx["stream"]=3;
  41435. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  41436. return $core.withContext(function($ctx4) {
  41437. return $recv($recv(each)._name())._asVariableName();
  41438. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  41439. }));
  41440. $ctx3.sendIdx["collect:"]=1;
  41441. $recv($3)._nextPutVars_($4);
  41442. $ctx3.sendIdx["nextPutVars:"]=1;
  41443. $5=$self._stream();
  41444. $ctx3.sendIdx["stream"]=4;
  41445. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  41446. return $core.withContext(function($ctx4) {
  41447. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  41448. return $core.withContext(function($ctx5) {
  41449. $6=$self._stream();
  41450. $ctx5.sendIdx["stream"]=5;
  41451. return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  41452. return $core.withContext(function($ctx6) {
  41453. return $recv($recv(each)._variable())._alias();
  41454. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  41455. })));
  41456. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  41457. }));
  41458. $7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  41459. if($core.assert($7)){
  41460. return $recv($self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  41461. return $core.withContext(function($ctx5) {
  41462. return (
  41463. $ctx5.supercall = true,
  41464. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41465. $ctx5.supercall = false;
  41466. $ctx5.sendIdx["visitIRMethod:"]=1;
  41467. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  41468. }));
  41469. } else {
  41470. return (
  41471. $ctx4.supercall = true,
  41472. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41473. $ctx4.supercall = false;
  41474. }
  41475. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  41476. }));
  41477. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41478. }),$recv(anIRMethod)._arguments());
  41479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41480. }));
  41481. return $self._contents();
  41482. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  41483. },
  41484. args: ["anIRMethod"],
  41485. 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",
  41486. referencedClasses: [],
  41487. 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"]
  41488. }),
  41489. $globals.IRJSTranslator);
  41490. $core.addMethod(
  41491. $core.method({
  41492. selector: "visitIRNonLocalReturn:",
  41493. protocol: "visiting",
  41494. fn: function (anIRNonLocalReturn){
  41495. var self=this,$self=this;
  41496. return $core.withContext(function($ctx1) {
  41497. $recv($self._stream())._nextPutNonLocalReturnWith_((function(){
  41498. return $core.withContext(function($ctx2) {
  41499. return (
  41500. $ctx2.supercall = true,
  41501. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  41502. $ctx2.supercall = false;
  41503. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41504. }));
  41505. return self;
  41506. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  41507. },
  41508. args: ["anIRNonLocalReturn"],
  41509. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  41510. referencedClasses: [],
  41511. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  41512. }),
  41513. $globals.IRJSTranslator);
  41514. $core.addMethod(
  41515. $core.method({
  41516. selector: "visitIRReturn:",
  41517. protocol: "visiting",
  41518. fn: function (anIRReturn){
  41519. var self=this,$self=this;
  41520. return $core.withContext(function($ctx1) {
  41521. $recv($self._stream())._nextPutReturnWith_((function(){
  41522. return $core.withContext(function($ctx2) {
  41523. return (
  41524. $ctx2.supercall = true,
  41525. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  41526. $ctx2.supercall = false;
  41527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41528. }));
  41529. return self;
  41530. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  41531. },
  41532. args: ["anIRReturn"],
  41533. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  41534. referencedClasses: [],
  41535. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  41536. }),
  41537. $globals.IRJSTranslator);
  41538. $core.addMethod(
  41539. $core.method({
  41540. selector: "visitIRSend:",
  41541. protocol: "visiting",
  41542. fn: function (anIRSend){
  41543. var self=this,$self=this;
  41544. var sends,superclass;
  41545. return $core.withContext(function($ctx1) {
  41546. var $1,$2;
  41547. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  41548. $1=$recv($recv(anIRSend)._receiver())._isSuper();
  41549. if($core.assert($1)){
  41550. $self._visitSuperSend_(anIRSend);
  41551. } else {
  41552. $self._visitSend_(anIRSend);
  41553. }
  41554. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  41555. if($core.assert($2)){
  41556. $recv($self._stream())._nextPutSendIndexFor_(anIRSend);
  41557. }
  41558. return self;
  41559. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  41560. },
  41561. args: ["anIRSend"],
  41562. 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 ]",
  41563. referencedClasses: [],
  41564. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuper", "receiver", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  41565. }),
  41566. $globals.IRJSTranslator);
  41567. $core.addMethod(
  41568. $core.method({
  41569. selector: "visitIRSequence:",
  41570. protocol: "visiting",
  41571. fn: function (anIRSequence){
  41572. var self=this,$self=this;
  41573. return $core.withContext(function($ctx1) {
  41574. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  41575. return $core.withContext(function($ctx2) {
  41576. return $recv($self._stream())._nextPutStatementWith_((function(){
  41577. return $core.withContext(function($ctx3) {
  41578. return $self._visit_(each);
  41579. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41580. }));
  41581. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41582. }));
  41583. return self;
  41584. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  41585. },
  41586. args: ["anIRSequence"],
  41587. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  41588. referencedClasses: [],
  41589. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  41590. }),
  41591. $globals.IRJSTranslator);
  41592. $core.addMethod(
  41593. $core.method({
  41594. selector: "visitIRTempDeclaration:",
  41595. protocol: "visiting",
  41596. fn: function (anIRTempDeclaration){
  41597. var self=this,$self=this;
  41598. return self;
  41599. },
  41600. args: ["anIRTempDeclaration"],
  41601. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  41602. referencedClasses: [],
  41603. messageSends: []
  41604. }),
  41605. $globals.IRJSTranslator);
  41606. $core.addMethod(
  41607. $core.method({
  41608. selector: "visitIRValue:",
  41609. protocol: "visiting",
  41610. fn: function (anIRValue){
  41611. var self=this,$self=this;
  41612. return $core.withContext(function($ctx1) {
  41613. $recv($self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavaScriptSource());
  41614. return self;
  41615. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  41616. },
  41617. args: ["anIRValue"],
  41618. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavaScriptSource",
  41619. referencedClasses: [],
  41620. messageSends: ["nextPutAll:", "stream", "asJavaScriptSource", "value"]
  41621. }),
  41622. $globals.IRJSTranslator);
  41623. $core.addMethod(
  41624. $core.method({
  41625. selector: "visitIRVariable:",
  41626. protocol: "visiting",
  41627. fn: function (anIRVariable){
  41628. var self=this,$self=this;
  41629. return $core.withContext(function($ctx1) {
  41630. var $3,$2,$1,$4;
  41631. $3=$recv(anIRVariable)._variable();
  41632. $ctx1.sendIdx["variable"]=1;
  41633. $2=$recv($3)._name();
  41634. $1=$recv($2).__eq("thisContext");
  41635. if($core.assert($1)){
  41636. $4=$self._stream();
  41637. $ctx1.sendIdx["stream"]=1;
  41638. $recv($4)._nextPutAll_("$core.getThisContext()");
  41639. $ctx1.sendIdx["nextPutAll:"]=1;
  41640. } else {
  41641. $recv($self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  41642. }
  41643. return self;
  41644. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  41645. },
  41646. args: ["anIRVariable"],
  41647. 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 ]",
  41648. referencedClasses: [],
  41649. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  41650. }),
  41651. $globals.IRJSTranslator);
  41652. $core.addMethod(
  41653. $core.method({
  41654. selector: "visitIRVerbatim:",
  41655. protocol: "visiting",
  41656. fn: function (anIRVerbatim){
  41657. var self=this,$self=this;
  41658. return $core.withContext(function($ctx1) {
  41659. $recv($self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  41660. return self;
  41661. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  41662. },
  41663. args: ["anIRVerbatim"],
  41664. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutAll: anIRVerbatim source",
  41665. referencedClasses: [],
  41666. messageSends: ["nextPutAll:", "stream", "source"]
  41667. }),
  41668. $globals.IRJSTranslator);
  41669. $core.addMethod(
  41670. $core.method({
  41671. selector: "visitInstructionList:enclosedBetween:and:",
  41672. protocol: "visiting",
  41673. fn: function (anArray,aString,anotherString){
  41674. var self=this,$self=this;
  41675. return $core.withContext(function($ctx1) {
  41676. var $1;
  41677. $1=$self._stream();
  41678. $ctx1.sendIdx["stream"]=1;
  41679. $recv($1)._nextPutAll_(aString);
  41680. $ctx1.sendIdx["nextPutAll:"]=1;
  41681. $recv(anArray)._do_separatedBy_((function(each){
  41682. return $core.withContext(function($ctx2) {
  41683. return $self._visit_(each);
  41684. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41685. }),(function(){
  41686. return $core.withContext(function($ctx2) {
  41687. return $recv($self._stream())._nextPutAll_(",");
  41688. $ctx2.sendIdx["nextPutAll:"]=2;
  41689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41690. }));
  41691. $recv($self["@stream"])._nextPutAll_(anotherString);
  41692. return self;
  41693. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  41694. },
  41695. args: ["anArray", "aString", "anotherString"],
  41696. 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",
  41697. referencedClasses: [],
  41698. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  41699. }),
  41700. $globals.IRJSTranslator);
  41701. $core.addMethod(
  41702. $core.method({
  41703. selector: "visitReceiver:",
  41704. protocol: "visiting",
  41705. fn: function (anIRInstruction){
  41706. var self=this,$self=this;
  41707. var instr;
  41708. return $core.withContext(function($ctx1) {
  41709. var $1,$2,$4,$5,$3,$6,$7,$8;
  41710. $1=$recv(anIRInstruction)._isSelf();
  41711. if($core.assert($1)){
  41712. $2=$recv(anIRInstruction)._copy();
  41713. $ctx1.sendIdx["copy"]=1;
  41714. $4=$recv($recv(anIRInstruction)._variable())._copy();
  41715. $recv($4)._name_("$self");
  41716. $5=$recv($4)._yourself();
  41717. $ctx1.sendIdx["yourself"]=1;
  41718. $3=$5;
  41719. $recv($2)._variable_($3);
  41720. instr=$recv($2)._yourself();
  41721. instr;
  41722. } else {
  41723. instr=anIRInstruction;
  41724. instr;
  41725. }
  41726. $6=$recv(instr)._needsBoxingAsReceiver();
  41727. if(!$core.assert($6)){
  41728. $7=$self._visit_(instr);
  41729. $ctx1.sendIdx["visit:"]=1;
  41730. return $7;
  41731. }
  41732. $8=$self._stream();
  41733. $ctx1.sendIdx["stream"]=1;
  41734. $recv($8)._nextPutAll_("$recv(");
  41735. $ctx1.sendIdx["nextPutAll:"]=1;
  41736. $self._visit_(instr);
  41737. $recv($self._stream())._nextPutAll_(")");
  41738. return self;
  41739. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction,instr:instr},$globals.IRJSTranslator)});
  41740. },
  41741. args: ["anIRInstruction"],
  41742. 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: ')'",
  41743. referencedClasses: [],
  41744. messageSends: ["ifTrue:ifFalse:", "isSelf", "variable:", "copy", "name:", "variable", "yourself", "ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  41745. }),
  41746. $globals.IRJSTranslator);
  41747. $core.addMethod(
  41748. $core.method({
  41749. selector: "visitSend:",
  41750. protocol: "visiting",
  41751. fn: function (anIRSend){
  41752. var self=this,$self=this;
  41753. return $core.withContext(function($ctx1) {
  41754. $self._visitReceiver_($recv(anIRSend)._receiver());
  41755. $recv($self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  41756. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  41757. return self;
  41758. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41759. },
  41760. args: ["anIRSend"],
  41761. 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: ')'",
  41762. referencedClasses: [],
  41763. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41764. }),
  41765. $globals.IRJSTranslator);
  41766. $core.addMethod(
  41767. $core.method({
  41768. selector: "visitSuperSend:",
  41769. protocol: "visiting",
  41770. fn: function (anIRSend){
  41771. var self=this,$self=this;
  41772. return $core.withContext(function($ctx1) {
  41773. var $1,$4,$3,$2,$5,$6,$7,$8;
  41774. $1=$self._stream();
  41775. $ctx1.sendIdx["stream"]=1;
  41776. $recv($1)._nextPutAll_("(");
  41777. $ctx1.sendIdx["nextPutAll:"]=1;
  41778. $recv($1)._lf();
  41779. $ctx1.sendIdx["lf"]=1;
  41780. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41781. $ctx1.sendIdx["nextPutAll:"]=2;
  41782. $recv($1)._lf();
  41783. $ctx1.sendIdx["lf"]=2;
  41784. $4=$recv(anIRSend)._scope();
  41785. $ctx1.sendIdx["scope"]=1;
  41786. $3=$recv($4)._alias();
  41787. $ctx1.sendIdx["alias"]=1;
  41788. $2=$recv($3).__comma(".supercall = true,");
  41789. $ctx1.sendIdx[","]=1;
  41790. $recv($1)._nextPutAll_($2);
  41791. $ctx1.sendIdx["nextPutAll:"]=3;
  41792. $recv($1)._lf();
  41793. $ctx1.sendIdx["lf"]=3;
  41794. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41795. $ctx1.sendIdx["nextPutAll:"]=4;
  41796. $recv($1)._lf();
  41797. $ctx1.sendIdx["lf"]=4;
  41798. $5="(".__comma($recv($self._currentClass())._asJavaScriptSource());
  41799. $ctx1.sendIdx[","]=2;
  41800. $recv($1)._nextPutAll_($5);
  41801. $ctx1.sendIdx["nextPutAll:"]=5;
  41802. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  41803. $ctx1.sendIdx["nextPutAll:"]=6;
  41804. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  41805. $ctx1.sendIdx[","]=3;
  41806. $recv($1)._nextPutAll_($6);
  41807. $ctx1.sendIdx["nextPutAll:"]=7;
  41808. $7=$recv($1)._nextPutAll_("$self, ");
  41809. $ctx1.sendIdx["nextPutAll:"]=8;
  41810. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  41811. $8=$self._stream();
  41812. $recv($8)._nextPutAll_("));");
  41813. $ctx1.sendIdx["nextPutAll:"]=9;
  41814. $recv($8)._lf();
  41815. $ctx1.sendIdx["lf"]=5;
  41816. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41817. $ctx1.sendIdx["nextPutAll:"]=10;
  41818. $recv($8)._lf();
  41819. $ctx1.sendIdx["lf"]=6;
  41820. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  41821. $ctx1.sendIdx["nextPutAll:"]=11;
  41822. $recv($8)._lf();
  41823. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41824. return self;
  41825. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41826. },
  41827. args: ["anIRSend"],
  41828. 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);'",
  41829. referencedClasses: [],
  41830. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavaScriptSource", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41831. }),
  41832. $globals.IRJSTranslator);
  41833. $core.addClass("JSStream", $globals.Object, ["stream", "omitSemicolon"], "Compiler-IR");
  41834. $core.addMethod(
  41835. $core.method({
  41836. selector: "contents",
  41837. protocol: "accessing",
  41838. fn: function (){
  41839. var self=this,$self=this;
  41840. return $core.withContext(function($ctx1) {
  41841. return $recv($self["@stream"])._contents();
  41842. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  41843. },
  41844. args: [],
  41845. source: "contents\x0a\x09^ stream contents",
  41846. referencedClasses: [],
  41847. messageSends: ["contents"]
  41848. }),
  41849. $globals.JSStream);
  41850. $core.addMethod(
  41851. $core.method({
  41852. selector: "initialize",
  41853. protocol: "initialization",
  41854. fn: function (){
  41855. var self=this,$self=this;
  41856. return $core.withContext(function($ctx1) {
  41857. (
  41858. $ctx1.supercall = true,
  41859. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41860. $ctx1.supercall = false;
  41861. $self["@stream"]=""._writeStream();
  41862. return self;
  41863. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  41864. },
  41865. args: [],
  41866. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  41867. referencedClasses: [],
  41868. messageSends: ["initialize", "writeStream"]
  41869. }),
  41870. $globals.JSStream);
  41871. $core.addMethod(
  41872. $core.method({
  41873. selector: "lf",
  41874. protocol: "streaming",
  41875. fn: function (){
  41876. var self=this,$self=this;
  41877. return $core.withContext(function($ctx1) {
  41878. $recv($self["@stream"])._lf();
  41879. return self;
  41880. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  41881. },
  41882. args: [],
  41883. source: "lf\x0a\x09stream lf",
  41884. referencedClasses: [],
  41885. messageSends: ["lf"]
  41886. }),
  41887. $globals.JSStream);
  41888. $core.addMethod(
  41889. $core.method({
  41890. selector: "nextPut:",
  41891. protocol: "streaming",
  41892. fn: function (aString){
  41893. var self=this,$self=this;
  41894. return $core.withContext(function($ctx1) {
  41895. $recv($self["@stream"])._nextPut_(aString);
  41896. return self;
  41897. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  41898. },
  41899. args: ["aString"],
  41900. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  41901. referencedClasses: [],
  41902. messageSends: ["nextPut:"]
  41903. }),
  41904. $globals.JSStream);
  41905. $core.addMethod(
  41906. $core.method({
  41907. selector: "nextPutAll:",
  41908. protocol: "streaming",
  41909. fn: function (aString){
  41910. var self=this,$self=this;
  41911. return $core.withContext(function($ctx1) {
  41912. $recv($self["@stream"])._nextPutAll_(aString);
  41913. return self;
  41914. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  41915. },
  41916. args: ["aString"],
  41917. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  41918. referencedClasses: [],
  41919. messageSends: ["nextPutAll:"]
  41920. }),
  41921. $globals.JSStream);
  41922. $core.addMethod(
  41923. $core.method({
  41924. selector: "nextPutAssignLhs:rhs:",
  41925. protocol: "streaming",
  41926. fn: function (aBlock,anotherBlock){
  41927. var self=this,$self=this;
  41928. return $core.withContext(function($ctx1) {
  41929. $recv(aBlock)._value();
  41930. $ctx1.sendIdx["value"]=1;
  41931. $recv($self["@stream"])._nextPutAll_("=");
  41932. $recv(anotherBlock)._value();
  41933. return self;
  41934. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  41935. },
  41936. args: ["aBlock", "anotherBlock"],
  41937. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  41938. referencedClasses: [],
  41939. messageSends: ["value", "nextPutAll:"]
  41940. }),
  41941. $globals.JSStream);
  41942. $core.addMethod(
  41943. $core.method({
  41944. selector: "nextPutBlockContextFor:during:",
  41945. protocol: "streaming",
  41946. fn: function (anIRClosure,aBlock){
  41947. var self=this,$self=this;
  41948. return $core.withContext(function($ctx1) {
  41949. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  41950. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  41951. if(!$core.assert($1)){
  41952. $2=$recv(aBlock)._value();
  41953. $ctx1.sendIdx["value"]=1;
  41954. return $2;
  41955. }
  41956. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41957. $ctx1.sendIdx["nextPutAll:"]=1;
  41958. $self._lf();
  41959. $ctx1.sendIdx["lf"]=1;
  41960. $6=$recv(anIRClosure)._scope();
  41961. $ctx1.sendIdx["scope"]=1;
  41962. $5=$recv($6)._alias();
  41963. $ctx1.sendIdx["alias"]=1;
  41964. $4="return $core.withContext(function(".__comma($5);
  41965. $ctx1.sendIdx[","]=2;
  41966. $3=$recv($4).__comma(") {");
  41967. $ctx1.sendIdx[","]=1;
  41968. $self._nextPutAll_($3);
  41969. $ctx1.sendIdx["nextPutAll:"]=2;
  41970. $self._lf();
  41971. $ctx1.sendIdx["lf"]=2;
  41972. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41973. $ctx1.sendIdx["nextPutAll:"]=3;
  41974. $7=$self._lf();
  41975. $ctx1.sendIdx["lf"]=3;
  41976. $recv(aBlock)._value();
  41977. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41978. $ctx1.sendIdx["nextPutAll:"]=4;
  41979. $self._lf();
  41980. $ctx1.sendIdx["lf"]=4;
  41981. $11=$recv(anIRClosure)._scope();
  41982. $ctx1.sendIdx["scope"]=2;
  41983. $10=$recv($11)._alias();
  41984. $ctx1.sendIdx["alias"]=2;
  41985. $9="}, function(".__comma($10);
  41986. $ctx1.sendIdx[","]=4;
  41987. $8=$recv($9).__comma(") {");
  41988. $ctx1.sendIdx[","]=3;
  41989. $self._nextPutAll_($8);
  41990. $ctx1.sendIdx["nextPutAll:"]=5;
  41991. $15=$recv(anIRClosure)._scope();
  41992. $ctx1.sendIdx["scope"]=3;
  41993. $14=$recv($15)._alias();
  41994. $ctx1.sendIdx["alias"]=3;
  41995. $13=$recv($14).__comma(".fillBlock({");
  41996. $ctx1.sendIdx[","]=5;
  41997. $12=$self._nextPutAll_($13);
  41998. $ctx1.sendIdx["nextPutAll:"]=6;
  41999. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  42000. return $core.withContext(function($ctx2) {
  42001. $16=$recv(each)._asVariableName();
  42002. $ctx2.sendIdx["asVariableName"]=1;
  42003. $self._nextPutAll_($16);
  42004. $ctx2.sendIdx["nextPutAll:"]=7;
  42005. $self._nextPutAll_(":");
  42006. $ctx2.sendIdx["nextPutAll:"]=8;
  42007. $17=$self._nextPutAll_($recv(each)._asVariableName());
  42008. $ctx2.sendIdx["nextPutAll:"]=9;
  42009. return $17;
  42010. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42011. }),(function(){
  42012. return $core.withContext(function($ctx2) {
  42013. return $self._nextPutAll_(",");
  42014. $ctx2.sendIdx["nextPutAll:"]=10;
  42015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42016. }));
  42017. $self._nextPutAll_("},");
  42018. $ctx1.sendIdx["nextPutAll:"]=11;
  42019. $23=$recv(anIRClosure)._scope();
  42020. $ctx1.sendIdx["scope"]=4;
  42021. $22=$recv($23)._outerScope();
  42022. $21=$recv($22)._alias();
  42023. $20=$recv($21).__comma(",");
  42024. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  42025. $ctx1.sendIdx[","]=7;
  42026. $18=$recv($19).__comma(")});");
  42027. $ctx1.sendIdx[","]=6;
  42028. $self._nextPutAll_($18);
  42029. $ctx1.sendIdx["nextPutAll:"]=12;
  42030. $self._lf();
  42031. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42032. return self;
  42033. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  42034. },
  42035. args: ["anIRClosure", "aBlock"],
  42036. 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);'",
  42037. referencedClasses: [],
  42038. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  42039. }),
  42040. $globals.JSStream);
  42041. $core.addMethod(
  42042. $core.method({
  42043. selector: "nextPutClosureWith:arguments:",
  42044. protocol: "streaming",
  42045. fn: function (aBlock,anArray){
  42046. var self=this,$self=this;
  42047. return $core.withContext(function($ctx1) {
  42048. var $1,$2,$3;
  42049. $recv($self["@stream"])._nextPutAll_("(function(");
  42050. $ctx1.sendIdx["nextPutAll:"]=1;
  42051. $recv(anArray)._do_separatedBy_((function(each){
  42052. return $core.withContext(function($ctx2) {
  42053. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  42054. $ctx2.sendIdx["nextPutAll:"]=2;
  42055. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42056. }),(function(){
  42057. return $core.withContext(function($ctx2) {
  42058. return $recv($self["@stream"])._nextPut_(",");
  42059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42060. }));
  42061. $1=$self["@stream"];
  42062. $recv($1)._nextPutAll_("){");
  42063. $ctx1.sendIdx["nextPutAll:"]=3;
  42064. $2=$recv($1)._lf();
  42065. $ctx1.sendIdx["lf"]=1;
  42066. $recv(aBlock)._value();
  42067. $3=$self["@stream"];
  42068. $recv($3)._lf();
  42069. $recv($3)._nextPutAll_("})");
  42070. return self;
  42071. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  42072. },
  42073. args: ["aBlock", "anArray"],
  42074. 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: '})'",
  42075. referencedClasses: [],
  42076. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  42077. }),
  42078. $globals.JSStream);
  42079. $core.addMethod(
  42080. $core.method({
  42081. selector: "nextPutContextFor:during:",
  42082. protocol: "streaming",
  42083. fn: function (aMethod,aBlock){
  42084. var self=this,$self=this;
  42085. return $core.withContext(function($ctx1) {
  42086. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  42087. $1=$recv(aMethod)._requiresSmalltalkContext();
  42088. if(!$core.assert($1)){
  42089. $2=$recv(aBlock)._value();
  42090. $ctx1.sendIdx["value"]=1;
  42091. return $2;
  42092. }
  42093. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42094. $ctx1.sendIdx["nextPutAll:"]=1;
  42095. $self._lf();
  42096. $ctx1.sendIdx["lf"]=1;
  42097. $6=$recv(aMethod)._scope();
  42098. $ctx1.sendIdx["scope"]=1;
  42099. $5=$recv($6)._alias();
  42100. $ctx1.sendIdx["alias"]=1;
  42101. $4="return $core.withContext(function(".__comma($5);
  42102. $ctx1.sendIdx[","]=2;
  42103. $3=$recv($4).__comma(") {");
  42104. $ctx1.sendIdx[","]=1;
  42105. $self._nextPutAll_($3);
  42106. $ctx1.sendIdx["nextPutAll:"]=2;
  42107. $self._lf();
  42108. $ctx1.sendIdx["lf"]=2;
  42109. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42110. $ctx1.sendIdx["nextPutAll:"]=3;
  42111. $7=$self._lf();
  42112. $ctx1.sendIdx["lf"]=3;
  42113. $recv(aBlock)._value();
  42114. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42115. $ctx1.sendIdx["nextPutAll:"]=4;
  42116. $self._lf();
  42117. $ctx1.sendIdx["lf"]=4;
  42118. $12=$recv(aMethod)._scope();
  42119. $ctx1.sendIdx["scope"]=2;
  42120. $11=$recv($12)._alias();
  42121. $ctx1.sendIdx["alias"]=2;
  42122. $10="}, function(".__comma($11);
  42123. $ctx1.sendIdx[","]=5;
  42124. $9=$recv($10).__comma(") {");
  42125. $ctx1.sendIdx[","]=4;
  42126. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  42127. $ctx1.sendIdx[","]=3;
  42128. $self._nextPutAll_($8);
  42129. $ctx1.sendIdx["nextPutAll:"]=5;
  42130. $16=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  42131. $ctx1.sendIdx["asJavaScriptSource"]=1;
  42132. $15=".fill(self,".__comma($16);
  42133. $14=$recv($15).__comma(",{");
  42134. $ctx1.sendIdx[","]=6;
  42135. $13=$self._nextPutAll_($14);
  42136. $ctx1.sendIdx["nextPutAll:"]=6;
  42137. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  42138. return $core.withContext(function($ctx2) {
  42139. $17=$recv(each)._asVariableName();
  42140. $ctx2.sendIdx["asVariableName"]=1;
  42141. $self._nextPutAll_($17);
  42142. $ctx2.sendIdx["nextPutAll:"]=7;
  42143. $self._nextPutAll_(":");
  42144. $ctx2.sendIdx["nextPutAll:"]=8;
  42145. $18=$self._nextPutAll_($recv(each)._asVariableName());
  42146. $ctx2.sendIdx["nextPutAll:"]=9;
  42147. return $18;
  42148. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42149. }),(function(){
  42150. return $core.withContext(function($ctx2) {
  42151. return $self._nextPutAll_(",");
  42152. $ctx2.sendIdx["nextPutAll:"]=10;
  42153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42154. }));
  42155. $self._nextPutAll_("},");
  42156. $ctx1.sendIdx["nextPutAll:"]=11;
  42157. $self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavaScriptSource());
  42158. $ctx1.sendIdx["nextPutAll:"]=12;
  42159. $self._nextPutAll_(")});");
  42160. $ctx1.sendIdx["nextPutAll:"]=13;
  42161. $self._lf();
  42162. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42163. return self;
  42164. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  42165. },
  42166. args: ["aMethod", "aBlock"],
  42167. 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);'",
  42168. referencedClasses: [],
  42169. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavaScriptSource", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  42170. }),
  42171. $globals.JSStream);
  42172. $core.addMethod(
  42173. $core.method({
  42174. selector: "nextPutFunctionWith:arguments:",
  42175. protocol: "streaming",
  42176. fn: function (aBlock,anArray){
  42177. var self=this,$self=this;
  42178. return $core.withContext(function($ctx1) {
  42179. var $1,$2,$3,$4,$5;
  42180. $recv($self["@stream"])._nextPutAll_("fn: function (");
  42181. $ctx1.sendIdx["nextPutAll:"]=1;
  42182. $recv(anArray)._do_separatedBy_((function(each){
  42183. return $core.withContext(function($ctx2) {
  42184. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  42185. $ctx2.sendIdx["nextPutAll:"]=2;
  42186. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42187. }),(function(){
  42188. return $core.withContext(function($ctx2) {
  42189. return $recv($self["@stream"])._nextPut_(",");
  42190. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42191. }));
  42192. $1=$self["@stream"];
  42193. $recv($1)._nextPutAll_("){");
  42194. $ctx1.sendIdx["nextPutAll:"]=3;
  42195. $2=$recv($1)._lf();
  42196. $ctx1.sendIdx["lf"]=1;
  42197. $3=$self["@stream"];
  42198. $recv($3)._nextPutAll_("var self=this,$self=this;");
  42199. $ctx1.sendIdx["nextPutAll:"]=4;
  42200. $4=$recv($3)._lf();
  42201. $ctx1.sendIdx["lf"]=2;
  42202. $recv(aBlock)._value();
  42203. $5=$self["@stream"];
  42204. $recv($5)._lf();
  42205. $recv($5)._nextPutAll_("}");
  42206. return self;
  42207. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  42208. },
  42209. args: ["aBlock", "anArray"],
  42210. 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: '}'",
  42211. referencedClasses: [],
  42212. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  42213. }),
  42214. $globals.JSStream);
  42215. $core.addMethod(
  42216. $core.method({
  42217. selector: "nextPutIf:then:",
  42218. protocol: "streaming",
  42219. fn: function (aBlock,anotherBlock){
  42220. var self=this,$self=this;
  42221. return $core.withContext(function($ctx1) {
  42222. var $1;
  42223. $recv($self["@stream"])._nextPutAll_("if(");
  42224. $ctx1.sendIdx["nextPutAll:"]=1;
  42225. $recv(aBlock)._value();
  42226. $ctx1.sendIdx["value"]=1;
  42227. $1=$self["@stream"];
  42228. $recv($1)._nextPutAll_("){");
  42229. $ctx1.sendIdx["nextPutAll:"]=2;
  42230. $recv($1)._lf();
  42231. $recv(anotherBlock)._value();
  42232. $recv($self["@stream"])._nextPutAll_("}");
  42233. $self._omitSemicolon_(true);
  42234. return self;
  42235. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  42236. },
  42237. args: ["aBlock", "anotherBlock"],
  42238. 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",
  42239. referencedClasses: [],
  42240. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  42241. }),
  42242. $globals.JSStream);
  42243. $core.addMethod(
  42244. $core.method({
  42245. selector: "nextPutIf:then:else:",
  42246. protocol: "streaming",
  42247. fn: function (aBlock,ifBlock,elseBlock){
  42248. var self=this,$self=this;
  42249. return $core.withContext(function($ctx1) {
  42250. var $1,$2,$3;
  42251. $recv($self["@stream"])._nextPutAll_("if(");
  42252. $ctx1.sendIdx["nextPutAll:"]=1;
  42253. $recv(aBlock)._value();
  42254. $ctx1.sendIdx["value"]=1;
  42255. $1=$self["@stream"];
  42256. $recv($1)._nextPutAll_("){");
  42257. $ctx1.sendIdx["nextPutAll:"]=2;
  42258. $2=$recv($1)._lf();
  42259. $ctx1.sendIdx["lf"]=1;
  42260. $recv(ifBlock)._value();
  42261. $ctx1.sendIdx["value"]=2;
  42262. $3=$self["@stream"];
  42263. $recv($3)._nextPutAll_("} else {");
  42264. $ctx1.sendIdx["nextPutAll:"]=3;
  42265. $recv($3)._lf();
  42266. $recv(elseBlock)._value();
  42267. $recv($self["@stream"])._nextPutAll_("}");
  42268. $self._omitSemicolon_(true);
  42269. return self;
  42270. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  42271. },
  42272. args: ["aBlock", "ifBlock", "elseBlock"],
  42273. 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",
  42274. referencedClasses: [],
  42275. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  42276. }),
  42277. $globals.JSStream);
  42278. $core.addMethod(
  42279. $core.method({
  42280. selector: "nextPutMethodDeclaration:with:",
  42281. protocol: "streaming",
  42282. fn: function (aMethod,aBlock){
  42283. var self=this,$self=this;
  42284. return $core.withContext(function($ctx1) {
  42285. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  42286. $1=$self["@stream"];
  42287. $recv($1)._nextPutAll_("$core.method({");
  42288. $ctx1.sendIdx["nextPutAll:"]=1;
  42289. $recv($1)._lf();
  42290. $ctx1.sendIdx["lf"]=1;
  42291. $4=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  42292. $ctx1.sendIdx["asJavaScriptSource"]=1;
  42293. $3="selector: ".__comma($4);
  42294. $ctx1.sendIdx[","]=2;
  42295. $2=$recv($3).__comma(",");
  42296. $ctx1.sendIdx[","]=1;
  42297. $recv($1)._nextPutAll_($2);
  42298. $ctx1.sendIdx["nextPutAll:"]=2;
  42299. $recv($1)._lf();
  42300. $ctx1.sendIdx["lf"]=2;
  42301. $7=$recv($recv(aMethod)._source())._asJavaScriptSource();
  42302. $ctx1.sendIdx["asJavaScriptSource"]=2;
  42303. $6="source: ".__comma($7);
  42304. $ctx1.sendIdx[","]=4;
  42305. $5=$recv($6).__comma(",");
  42306. $ctx1.sendIdx[","]=3;
  42307. $recv($1)._nextPutAll_($5);
  42308. $ctx1.sendIdx["nextPutAll:"]=3;
  42309. $8=$recv($1)._lf();
  42310. $ctx1.sendIdx["lf"]=3;
  42311. $recv(aBlock)._value();
  42312. $ctx1.sendIdx["value"]=1;
  42313. $9=$self["@stream"];
  42314. $12=$recv($globals.String)._lf();
  42315. $ctx1.sendIdx["lf"]=4;
  42316. $11=",".__comma($12);
  42317. $ctx1.sendIdx[","]=6;
  42318. $10=$recv($11).__comma("messageSends: ");
  42319. $ctx1.sendIdx[","]=5;
  42320. $recv($9)._nextPutAll_($10);
  42321. $ctx1.sendIdx["nextPutAll:"]=4;
  42322. $15=$recv($recv(aMethod)._messageSends())._asArray();
  42323. $ctx1.sendIdx["asArray"]=1;
  42324. $14=$recv($15)._asJavaScriptSource();
  42325. $ctx1.sendIdx["asJavaScriptSource"]=3;
  42326. $13=$recv($14).__comma(",");
  42327. $ctx1.sendIdx[","]=7;
  42328. $recv($9)._nextPutAll_($13);
  42329. $ctx1.sendIdx["nextPutAll:"]=5;
  42330. $recv($9)._lf();
  42331. $ctx1.sendIdx["lf"]=5;
  42332. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  42333. return $core.withContext(function($ctx2) {
  42334. return $recv(each)._value();
  42335. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42336. })))._asArray())._asJavaScriptSource();
  42337. $ctx1.sendIdx["asJavaScriptSource"]=4;
  42338. $17="args: ".__comma($18);
  42339. $16=$recv($17).__comma(",");
  42340. $ctx1.sendIdx[","]=8;
  42341. $recv($9)._nextPutAll_($16);
  42342. $ctx1.sendIdx["nextPutAll:"]=6;
  42343. $recv($9)._lf();
  42344. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  42345. $ctx1.sendIdx["nextPutAll:"]=7;
  42346. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  42347. return $core.withContext(function($ctx2) {
  42348. return $recv($self["@stream"])._nextPutAll_($recv(each)._asJavaScriptSource());
  42349. $ctx2.sendIdx["nextPutAll:"]=8;
  42350. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42351. }),(function(){
  42352. return $core.withContext(function($ctx2) {
  42353. return $recv($self["@stream"])._nextPutAll_(",");
  42354. $ctx2.sendIdx["nextPutAll:"]=9;
  42355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42356. }));
  42357. $20=$self["@stream"];
  42358. $recv($20)._nextPutAll_("]");
  42359. $ctx1.sendIdx["nextPutAll:"]=10;
  42360. $recv($20)._nextPutAll_("})");
  42361. return self;
  42362. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  42363. },
  42364. args: ["aMethod", "aBlock"],
  42365. 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: '})'",
  42366. referencedClasses: ["String"],
  42367. messageSends: ["nextPutAll:", "lf", ",", "asJavaScriptSource", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  42368. }),
  42369. $globals.JSStream);
  42370. $core.addMethod(
  42371. $core.method({
  42372. selector: "nextPutNonLocalReturnHandlingWith:",
  42373. protocol: "streaming",
  42374. fn: function (aBlock){
  42375. var self=this,$self=this;
  42376. return $core.withContext(function($ctx1) {
  42377. var $1,$2,$3;
  42378. $1=$self["@stream"];
  42379. $recv($1)._nextPutAll_("var $early={};");
  42380. $ctx1.sendIdx["nextPutAll:"]=1;
  42381. $recv($1)._lf();
  42382. $ctx1.sendIdx["lf"]=1;
  42383. $recv($1)._nextPutAll_("try {");
  42384. $ctx1.sendIdx["nextPutAll:"]=2;
  42385. $2=$recv($1)._lf();
  42386. $ctx1.sendIdx["lf"]=2;
  42387. $recv(aBlock)._value();
  42388. $3=$self["@stream"];
  42389. $recv($3)._nextPutAll_("}");
  42390. $ctx1.sendIdx["nextPutAll:"]=3;
  42391. $recv($3)._lf();
  42392. $ctx1.sendIdx["lf"]=3;
  42393. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  42394. $recv($3)._lf();
  42395. return self;
  42396. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  42397. },
  42398. args: ["aBlock"],
  42399. 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",
  42400. referencedClasses: [],
  42401. messageSends: ["nextPutAll:", "lf", "value"]
  42402. }),
  42403. $globals.JSStream);
  42404. $core.addMethod(
  42405. $core.method({
  42406. selector: "nextPutNonLocalReturnWith:",
  42407. protocol: "streaming",
  42408. fn: function (aBlock){
  42409. var self=this,$self=this;
  42410. return $core.withContext(function($ctx1) {
  42411. $recv($self["@stream"])._nextPutAll_("throw $early=[");
  42412. $ctx1.sendIdx["nextPutAll:"]=1;
  42413. $recv(aBlock)._value();
  42414. $recv($self["@stream"])._nextPutAll_("]");
  42415. return self;
  42416. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42417. },
  42418. args: ["aBlock"],
  42419. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  42420. referencedClasses: [],
  42421. messageSends: ["nextPutAll:", "value"]
  42422. }),
  42423. $globals.JSStream);
  42424. $core.addMethod(
  42425. $core.method({
  42426. selector: "nextPutReturnWith:",
  42427. protocol: "streaming",
  42428. fn: function (aBlock){
  42429. var self=this,$self=this;
  42430. return $core.withContext(function($ctx1) {
  42431. $recv($self["@stream"])._nextPutAll_("return ");
  42432. $recv(aBlock)._value();
  42433. return self;
  42434. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42435. },
  42436. args: ["aBlock"],
  42437. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  42438. referencedClasses: [],
  42439. messageSends: ["nextPutAll:", "value"]
  42440. }),
  42441. $globals.JSStream);
  42442. $core.addMethod(
  42443. $core.method({
  42444. selector: "nextPutSendIndexFor:",
  42445. protocol: "streaming",
  42446. fn: function (anIRSend){
  42447. var self=this,$self=this;
  42448. return $core.withContext(function($ctx1) {
  42449. $self._nextPutAll_(";");
  42450. $ctx1.sendIdx["nextPutAll:"]=1;
  42451. $self._lf();
  42452. $ctx1.sendIdx["lf"]=1;
  42453. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42454. $ctx1.sendIdx["nextPutAll:"]=2;
  42455. $self._lf();
  42456. $ctx1.sendIdx["lf"]=2;
  42457. $self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  42458. $ctx1.sendIdx["nextPutAll:"]=3;
  42459. $self._nextPutAll_(".sendIdx[");
  42460. $ctx1.sendIdx["nextPutAll:"]=4;
  42461. $self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavaScriptSource());
  42462. $ctx1.sendIdx["nextPutAll:"]=5;
  42463. $self._nextPutAll_("]=");
  42464. $ctx1.sendIdx["nextPutAll:"]=6;
  42465. $self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  42466. $ctx1.sendIdx["nextPutAll:"]=7;
  42467. $self._nextPutAll_(";");
  42468. $ctx1.sendIdx["nextPutAll:"]=8;
  42469. $self._lf();
  42470. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  42471. return self;
  42472. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  42473. },
  42474. args: ["anIRSend"],
  42475. 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)'",
  42476. referencedClasses: [],
  42477. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavaScriptSource", "selector", "asString", "index"]
  42478. }),
  42479. $globals.JSStream);
  42480. $core.addMethod(
  42481. $core.method({
  42482. selector: "nextPutStatementWith:",
  42483. protocol: "streaming",
  42484. fn: function (aBlock){
  42485. var self=this,$self=this;
  42486. return $core.withContext(function($ctx1) {
  42487. var $1;
  42488. $self._omitSemicolon_(false);
  42489. $ctx1.sendIdx["omitSemicolon:"]=1;
  42490. $recv(aBlock)._value();
  42491. $1=$self._omitSemicolon();
  42492. if(!$core.assert($1)){
  42493. $recv($self["@stream"])._nextPutAll_(";");
  42494. }
  42495. $self._omitSemicolon_(false);
  42496. $recv($self["@stream"])._lf();
  42497. return self;
  42498. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  42499. },
  42500. args: ["aBlock"],
  42501. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  42502. referencedClasses: [],
  42503. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  42504. }),
  42505. $globals.JSStream);
  42506. $core.addMethod(
  42507. $core.method({
  42508. selector: "nextPutVars:",
  42509. protocol: "streaming",
  42510. fn: function (aCollection){
  42511. var self=this,$self=this;
  42512. return $core.withContext(function($ctx1) {
  42513. var $1;
  42514. $recv(aCollection)._ifNotEmpty_((function(){
  42515. return $core.withContext(function($ctx2) {
  42516. $recv($self["@stream"])._nextPutAll_("var ");
  42517. $ctx2.sendIdx["nextPutAll:"]=1;
  42518. $recv(aCollection)._do_separatedBy_((function(each){
  42519. return $core.withContext(function($ctx3) {
  42520. return $recv($self["@stream"])._nextPutAll_(each);
  42521. $ctx3.sendIdx["nextPutAll:"]=2;
  42522. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42523. }),(function(){
  42524. return $core.withContext(function($ctx3) {
  42525. return $recv($self["@stream"])._nextPutAll_(",");
  42526. $ctx3.sendIdx["nextPutAll:"]=3;
  42527. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42528. }));
  42529. $1=$self["@stream"];
  42530. $recv($1)._nextPutAll_(";");
  42531. return $recv($1)._lf();
  42532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42533. }));
  42534. return self;
  42535. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  42536. },
  42537. args: ["aCollection"],
  42538. 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 ]",
  42539. referencedClasses: [],
  42540. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  42541. }),
  42542. $globals.JSStream);
  42543. $core.addMethod(
  42544. $core.method({
  42545. selector: "omitSemicolon",
  42546. protocol: "accessing",
  42547. fn: function (){
  42548. var self=this,$self=this;
  42549. return $self["@omitSemicolon"];
  42550. },
  42551. args: [],
  42552. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  42553. referencedClasses: [],
  42554. messageSends: []
  42555. }),
  42556. $globals.JSStream);
  42557. $core.addMethod(
  42558. $core.method({
  42559. selector: "omitSemicolon:",
  42560. protocol: "accessing",
  42561. fn: function (aBoolean){
  42562. var self=this,$self=this;
  42563. $self["@omitSemicolon"]=aBoolean;
  42564. return self;
  42565. },
  42566. args: ["aBoolean"],
  42567. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  42568. referencedClasses: [],
  42569. messageSends: []
  42570. }),
  42571. $globals.JSStream);
  42572. $core.addMethod(
  42573. $core.method({
  42574. selector: "isReferenced",
  42575. protocol: "*Compiler-IR",
  42576. fn: function (){
  42577. var self=this,$self=this;
  42578. return $core.withContext(function($ctx1) {
  42579. var $3,$2,$1;
  42580. $3=$self._parent();
  42581. $ctx1.sendIdx["parent"]=1;
  42582. $2=$recv($3)._isSequenceNode();
  42583. $1=$recv($2)._or_((function(){
  42584. return $core.withContext(function($ctx2) {
  42585. return $recv($self._parent())._isAssignmentNode();
  42586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42587. }));
  42588. return $recv($1)._not();
  42589. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.ASTNode)});
  42590. },
  42591. args: [],
  42592. 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",
  42593. referencedClasses: [],
  42594. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  42595. }),
  42596. $globals.ASTNode);
  42597. $core.addMethod(
  42598. $core.method({
  42599. selector: "subtreeNeedsAliasing",
  42600. protocol: "*Compiler-IR",
  42601. fn: function (){
  42602. var self=this,$self=this;
  42603. return $core.withContext(function($ctx1) {
  42604. return $recv($self._shouldBeAliased())._or_((function(){
  42605. return $core.withContext(function($ctx2) {
  42606. return $recv($self._dagChildren())._anySatisfy_((function(each){
  42607. return $core.withContext(function($ctx3) {
  42608. return $recv(each)._subtreeNeedsAliasing();
  42609. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42610. }));
  42611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42612. }));
  42613. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.ASTNode)});
  42614. },
  42615. args: [],
  42616. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  42617. referencedClasses: [],
  42618. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  42619. }),
  42620. $globals.ASTNode);
  42621. $core.addMethod(
  42622. $core.method({
  42623. selector: "shouldBeAliased",
  42624. protocol: "*Compiler-IR",
  42625. fn: function (){
  42626. var self=this,$self=this;
  42627. return $core.withContext(function($ctx1) {
  42628. var $1;
  42629. $1=(
  42630. $ctx1.supercall = true,
  42631. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42632. $ctx1.supercall = false;
  42633. return $recv($1)._or_((function(){
  42634. return $core.withContext(function($ctx2) {
  42635. return $self._isReferenced();
  42636. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42637. }));
  42638. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  42639. },
  42640. args: [],
  42641. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  42642. referencedClasses: [],
  42643. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  42644. }),
  42645. $globals.AssignmentNode);
  42646. $core.addMethod(
  42647. $core.method({
  42648. selector: "appendToInstruction:",
  42649. protocol: "*Compiler-IR",
  42650. fn: function (anIRInstruction){
  42651. var self=this,$self=this;
  42652. return $core.withContext(function($ctx1) {
  42653. $recv(anIRInstruction)._appendBlock_(self);
  42654. return self;
  42655. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  42656. },
  42657. args: ["anIRInstruction"],
  42658. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  42659. referencedClasses: [],
  42660. messageSends: ["appendBlock:"]
  42661. }),
  42662. $globals.BlockClosure);
  42663. $core.addMethod(
  42664. $core.method({
  42665. selector: "subtreeNeedsAliasing",
  42666. protocol: "*Compiler-IR",
  42667. fn: function (){
  42668. var self=this,$self=this;
  42669. return $core.withContext(function($ctx1) {
  42670. return $self._shouldBeAliased();
  42671. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  42672. },
  42673. args: [],
  42674. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  42675. referencedClasses: [],
  42676. messageSends: ["shouldBeAliased"]
  42677. }),
  42678. $globals.BlockNode);
  42679. $core.addMethod(
  42680. $core.method({
  42681. selector: "subtreeNeedsAliasing",
  42682. protocol: "*Compiler-IR",
  42683. fn: function (){
  42684. var self=this,$self=this;
  42685. return $core.withContext(function($ctx1) {
  42686. return $recv($recv($self._parent())._isSequenceNode())._not();
  42687. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  42688. },
  42689. args: [],
  42690. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  42691. referencedClasses: [],
  42692. messageSends: ["not", "isSequenceNode", "parent"]
  42693. }),
  42694. $globals.CascadeNode);
  42695. $core.addMethod(
  42696. $core.method({
  42697. selector: "shouldBeAliased",
  42698. protocol: "*Compiler-IR",
  42699. fn: function (){
  42700. var self=this,$self=this;
  42701. var sends;
  42702. return $core.withContext(function($ctx1) {
  42703. var $2,$1;
  42704. sends=$recv($recv($recv($self._method())._sendIndexes())._at_($self._selector()))._size();
  42705. $2=(
  42706. $ctx1.supercall = true,
  42707. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42708. $ctx1.supercall = false;
  42709. $1=$recv($2)._or_((function(){
  42710. return $core.withContext(function($ctx2) {
  42711. return $recv($self._isReferenced())._and_((function(){
  42712. return $core.withContext(function($ctx3) {
  42713. return $recv($recv($self._index()).__lt(sends))._or_((function(){
  42714. return $core.withContext(function($ctx4) {
  42715. return $self._superSend();
  42716. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  42717. }));
  42718. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42719. }));
  42720. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42721. }));
  42722. $ctx1.sendIdx["or:"]=1;
  42723. return $1;
  42724. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  42725. },
  42726. args: [],
  42727. 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 ] ] ])",
  42728. referencedClasses: [],
  42729. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  42730. }),
  42731. $globals.SendNode);
  42732. $core.addMethod(
  42733. $core.method({
  42734. selector: "subtreeNeedsAliasing",
  42735. protocol: "*Compiler-IR",
  42736. fn: function (){
  42737. var self=this,$self=this;
  42738. return $core.withContext(function($ctx1) {
  42739. return $recv($self._shouldBeInlined())._or_((function(){
  42740. return $core.withContext(function($ctx2) {
  42741. return (
  42742. $ctx2.supercall = true,
  42743. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($self, []));
  42744. $ctx2.supercall = false;
  42745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42746. }));
  42747. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.SendNode)});
  42748. },
  42749. args: [],
  42750. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  42751. referencedClasses: [],
  42752. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  42753. }),
  42754. $globals.SendNode);
  42755. });
  42756. 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";
  42757. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  42758. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  42759. var $pkg = $core.addPackage("Compiler-Inlining");
  42760. $pkg.innerEval = function (expr) { return eval(expr); };
  42761. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  42762. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  42763. $core.addMethod(
  42764. $core.method({
  42765. selector: "visitSendNode:",
  42766. protocol: "visiting",
  42767. fn: function (aNode){
  42768. var self=this,$self=this;
  42769. return $core.withContext(function($ctx1) {
  42770. var $1,$2,$3,$4,$receiver;
  42771. $1=$recv(aNode)._superSend();
  42772. if(!$core.assert($1)){
  42773. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  42774. if($core.assert($2)){
  42775. $recv(aNode)._shouldBeInlined_(true);
  42776. $3=$recv(aNode)._receiver();
  42777. if(($receiver = $3) == null || $receiver.a$nil){
  42778. $3;
  42779. } else {
  42780. var receiver;
  42781. receiver=$receiver;
  42782. $recv(receiver)._shouldBeAliased_(true);
  42783. }
  42784. }
  42785. }
  42786. $4=(
  42787. $ctx1.supercall = true,
  42788. ($globals.ASTPreInliner.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  42789. $ctx1.supercall = false;
  42790. return $4;
  42791. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPreInliner)});
  42792. },
  42793. args: ["aNode"],
  42794. 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",
  42795. referencedClasses: ["IRSendInliner"],
  42796. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  42797. }),
  42798. $globals.ASTPreInliner);
  42799. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  42800. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  42801. $core.addMethod(
  42802. $core.method({
  42803. selector: "acceptDagVisitor:",
  42804. protocol: "visiting",
  42805. fn: function (aVisitor){
  42806. var self=this,$self=this;
  42807. return $core.withContext(function($ctx1) {
  42808. $recv(aVisitor)._visitIRInlinedClosure_(self);
  42809. return self;
  42810. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  42811. },
  42812. args: ["aVisitor"],
  42813. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  42814. referencedClasses: [],
  42815. messageSends: ["visitIRInlinedClosure:"]
  42816. }),
  42817. $globals.IRInlinedClosure);
  42818. $core.addMethod(
  42819. $core.method({
  42820. selector: "isInlined",
  42821. protocol: "testing",
  42822. fn: function (){
  42823. var self=this,$self=this;
  42824. return true;
  42825. },
  42826. args: [],
  42827. source: "isInlined\x0a\x09^ true",
  42828. referencedClasses: [],
  42829. messageSends: []
  42830. }),
  42831. $globals.IRInlinedClosure);
  42832. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  42833. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  42834. $core.addMethod(
  42835. $core.method({
  42836. selector: "acceptDagVisitor:",
  42837. protocol: "visiting",
  42838. fn: function (aVisitor){
  42839. var self=this,$self=this;
  42840. return $core.withContext(function($ctx1) {
  42841. $recv(aVisitor)._visitInlinedSend_(self);
  42842. return self;
  42843. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  42844. },
  42845. args: ["aVisitor"],
  42846. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  42847. referencedClasses: [],
  42848. messageSends: ["visitInlinedSend:"]
  42849. }),
  42850. $globals.IRInlinedSend);
  42851. $core.addMethod(
  42852. $core.method({
  42853. selector: "internalVariables",
  42854. protocol: "accessing",
  42855. fn: function (){
  42856. var self=this,$self=this;
  42857. return [];
  42858. },
  42859. args: [],
  42860. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  42861. referencedClasses: [],
  42862. messageSends: []
  42863. }),
  42864. $globals.IRInlinedSend);
  42865. $core.addMethod(
  42866. $core.method({
  42867. selector: "isInlined",
  42868. protocol: "testing",
  42869. fn: function (){
  42870. var self=this,$self=this;
  42871. return true;
  42872. },
  42873. args: [],
  42874. source: "isInlined\x0a\x09^ true",
  42875. referencedClasses: [],
  42876. messageSends: []
  42877. }),
  42878. $globals.IRInlinedSend);
  42879. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42880. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  42881. $core.addMethod(
  42882. $core.method({
  42883. selector: "acceptDagVisitor:",
  42884. protocol: "visiting",
  42885. fn: function (aVisitor){
  42886. var self=this,$self=this;
  42887. return $core.withContext(function($ctx1) {
  42888. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  42889. return self;
  42890. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  42891. },
  42892. args: ["aVisitor"],
  42893. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  42894. referencedClasses: [],
  42895. messageSends: ["visitIRInlinedIfFalse:"]
  42896. }),
  42897. $globals.IRInlinedIfFalse);
  42898. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42899. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  42900. $core.addMethod(
  42901. $core.method({
  42902. selector: "acceptDagVisitor:",
  42903. protocol: "visiting",
  42904. fn: function (aVisitor){
  42905. var self=this,$self=this;
  42906. return $core.withContext(function($ctx1) {
  42907. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  42908. return self;
  42909. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  42910. },
  42911. args: ["aVisitor"],
  42912. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  42913. referencedClasses: [],
  42914. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  42915. }),
  42916. $globals.IRInlinedIfNilIfNotNil);
  42917. $core.addMethod(
  42918. $core.method({
  42919. selector: "internalVariables",
  42920. protocol: "accessing",
  42921. fn: function (){
  42922. var self=this,$self=this;
  42923. return $core.withContext(function($ctx1) {
  42924. return $recv($globals.Array)._with_($self._receiverInternalVariable());
  42925. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  42926. },
  42927. args: [],
  42928. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  42929. referencedClasses: ["Array"],
  42930. messageSends: ["with:", "receiverInternalVariable"]
  42931. }),
  42932. $globals.IRInlinedIfNilIfNotNil);
  42933. $core.addMethod(
  42934. $core.method({
  42935. selector: "receiverInternalVariable",
  42936. protocol: "accessing",
  42937. fn: function (){
  42938. var self=this,$self=this;
  42939. return $core.withContext(function($ctx1) {
  42940. var $1;
  42941. $1=$recv($globals.IRVariable)._new();
  42942. $ctx1.sendIdx["new"]=1;
  42943. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_($self._receiverInternalVariableName()));
  42944. return $recv($1)._yourself();
  42945. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  42946. },
  42947. args: [],
  42948. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  42949. referencedClasses: ["IRVariable", "AliasVar"],
  42950. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  42951. }),
  42952. $globals.IRInlinedIfNilIfNotNil);
  42953. $core.addMethod(
  42954. $core.method({
  42955. selector: "receiverInternalVariableName",
  42956. protocol: "accessing",
  42957. fn: function (){
  42958. var self=this,$self=this;
  42959. return "$receiver";
  42960. },
  42961. args: [],
  42962. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  42963. referencedClasses: [],
  42964. messageSends: []
  42965. }),
  42966. $globals.IRInlinedIfNilIfNotNil);
  42967. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42968. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  42969. $core.addMethod(
  42970. $core.method({
  42971. selector: "acceptDagVisitor:",
  42972. protocol: "visiting",
  42973. fn: function (aVisitor){
  42974. var self=this,$self=this;
  42975. return $core.withContext(function($ctx1) {
  42976. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  42977. return self;
  42978. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  42979. },
  42980. args: ["aVisitor"],
  42981. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  42982. referencedClasses: [],
  42983. messageSends: ["visitIRInlinedIfTrue:"]
  42984. }),
  42985. $globals.IRInlinedIfTrue);
  42986. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42987. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  42988. $core.addMethod(
  42989. $core.method({
  42990. selector: "acceptDagVisitor:",
  42991. protocol: "visiting",
  42992. fn: function (aVisitor){
  42993. var self=this,$self=this;
  42994. return $core.withContext(function($ctx1) {
  42995. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  42996. return self;
  42997. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  42998. },
  42999. args: ["aVisitor"],
  43000. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  43001. referencedClasses: [],
  43002. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  43003. }),
  43004. $globals.IRInlinedIfTrueIfFalse);
  43005. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  43006. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  43007. $core.addMethod(
  43008. $core.method({
  43009. selector: "acceptDagVisitor:",
  43010. protocol: "visiting",
  43011. fn: function (aVisitor){
  43012. var self=this,$self=this;
  43013. return $core.withContext(function($ctx1) {
  43014. $recv(aVisitor)._visitIRInlinedSequence_(self);
  43015. return self;
  43016. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  43017. },
  43018. args: ["aVisitor"],
  43019. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  43020. referencedClasses: [],
  43021. messageSends: ["visitIRInlinedSequence:"]
  43022. }),
  43023. $globals.IRInlinedSequence);
  43024. $core.addMethod(
  43025. $core.method({
  43026. selector: "isInlined",
  43027. protocol: "testing",
  43028. fn: function (){
  43029. var self=this,$self=this;
  43030. return true;
  43031. },
  43032. args: [],
  43033. source: "isInlined\x0a\x09^ true",
  43034. referencedClasses: [],
  43035. messageSends: []
  43036. }),
  43037. $globals.IRInlinedSequence);
  43038. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  43039. $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`";
  43040. $core.addMethod(
  43041. $core.method({
  43042. selector: "assignmentInliner",
  43043. protocol: "factory",
  43044. fn: function (){
  43045. var self=this,$self=this;
  43046. return $core.withContext(function($ctx1) {
  43047. var $1;
  43048. $1=$recv($globals.IRAssignmentInliner)._new();
  43049. $recv($1)._translator_(self);
  43050. return $recv($1)._yourself();
  43051. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  43052. },
  43053. args: [],
  43054. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43055. referencedClasses: ["IRAssignmentInliner"],
  43056. messageSends: ["translator:", "new", "yourself"]
  43057. }),
  43058. $globals.IRInliner);
  43059. $core.addMethod(
  43060. $core.method({
  43061. selector: "returnInliner",
  43062. protocol: "factory",
  43063. fn: function (){
  43064. var self=this,$self=this;
  43065. return $core.withContext(function($ctx1) {
  43066. var $1;
  43067. $1=$recv($globals.IRReturnInliner)._new();
  43068. $recv($1)._translator_(self);
  43069. return $recv($1)._yourself();
  43070. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  43071. },
  43072. args: [],
  43073. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43074. referencedClasses: ["IRReturnInliner"],
  43075. messageSends: ["translator:", "new", "yourself"]
  43076. }),
  43077. $globals.IRInliner);
  43078. $core.addMethod(
  43079. $core.method({
  43080. selector: "sendInliner",
  43081. protocol: "factory",
  43082. fn: function (){
  43083. var self=this,$self=this;
  43084. return $core.withContext(function($ctx1) {
  43085. var $1;
  43086. $1=$recv($globals.IRSendInliner)._new();
  43087. $recv($1)._translator_(self);
  43088. return $recv($1)._yourself();
  43089. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  43090. },
  43091. args: [],
  43092. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43093. referencedClasses: ["IRSendInliner"],
  43094. messageSends: ["translator:", "new", "yourself"]
  43095. }),
  43096. $globals.IRInliner);
  43097. $core.addMethod(
  43098. $core.method({
  43099. selector: "shouldInlineAssignment:",
  43100. protocol: "testing",
  43101. fn: function (anIRAssignment){
  43102. var self=this,$self=this;
  43103. return $core.withContext(function($ctx1) {
  43104. var $3,$2,$1;
  43105. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  43106. return $core.withContext(function($ctx2) {
  43107. $3=$recv(anIRAssignment)._right();
  43108. $ctx2.sendIdx["right"]=1;
  43109. $2=$recv($3)._isSend();
  43110. return $recv($2)._and_((function(){
  43111. return $core.withContext(function($ctx3) {
  43112. return $self._shouldInlineSend_($recv(anIRAssignment)._right());
  43113. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43114. }));
  43115. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43116. }));
  43117. $ctx1.sendIdx["and:"]=1;
  43118. return $1;
  43119. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  43120. },
  43121. args: ["anIRAssignment"],
  43122. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  43123. referencedClasses: [],
  43124. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  43125. }),
  43126. $globals.IRInliner);
  43127. $core.addMethod(
  43128. $core.method({
  43129. selector: "shouldInlineReturn:",
  43130. protocol: "testing",
  43131. fn: function (anIRReturn){
  43132. var self=this,$self=this;
  43133. return $core.withContext(function($ctx1) {
  43134. var $3,$2,$1;
  43135. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  43136. return $core.withContext(function($ctx2) {
  43137. $3=$recv(anIRReturn)._expression();
  43138. $ctx2.sendIdx["expression"]=1;
  43139. $2=$recv($3)._isSend();
  43140. return $recv($2)._and_((function(){
  43141. return $core.withContext(function($ctx3) {
  43142. return $self._shouldInlineSend_($recv(anIRReturn)._expression());
  43143. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43144. }));
  43145. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43146. }));
  43147. $ctx1.sendIdx["and:"]=1;
  43148. return $1;
  43149. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  43150. },
  43151. args: ["anIRReturn"],
  43152. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  43153. referencedClasses: [],
  43154. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  43155. }),
  43156. $globals.IRInliner);
  43157. $core.addMethod(
  43158. $core.method({
  43159. selector: "shouldInlineSend:",
  43160. protocol: "testing",
  43161. fn: function (anIRSend){
  43162. var self=this,$self=this;
  43163. return $core.withContext(function($ctx1) {
  43164. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  43165. return $core.withContext(function($ctx2) {
  43166. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  43167. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43168. }));
  43169. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  43170. },
  43171. args: ["anIRSend"],
  43172. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  43173. referencedClasses: ["IRSendInliner"],
  43174. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  43175. }),
  43176. $globals.IRInliner);
  43177. $core.addMethod(
  43178. $core.method({
  43179. selector: "visitIRAssignment:",
  43180. protocol: "visiting",
  43181. fn: function (anIRAssignment){
  43182. var self=this,$self=this;
  43183. return $core.withContext(function($ctx1) {
  43184. var $1;
  43185. $1=$self._shouldInlineAssignment_(anIRAssignment);
  43186. if($core.assert($1)){
  43187. return $recv($self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  43188. } else {
  43189. return (
  43190. $ctx1.supercall = true,
  43191. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($self, [anIRAssignment]));
  43192. $ctx1.supercall = false;
  43193. }
  43194. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  43195. },
  43196. args: ["anIRAssignment"],
  43197. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  43198. referencedClasses: [],
  43199. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  43200. }),
  43201. $globals.IRInliner);
  43202. $core.addMethod(
  43203. $core.method({
  43204. selector: "visitIRNonLocalReturn:",
  43205. protocol: "visiting",
  43206. fn: function (anIRNonLocalReturn){
  43207. var self=this,$self=this;
  43208. var localReturn;
  43209. return $core.withContext(function($ctx1) {
  43210. var $2,$1,$4,$3,$5,$6,$7;
  43211. $2=$recv(anIRNonLocalReturn)._scope();
  43212. $ctx1.sendIdx["scope"]=1;
  43213. $1=$recv($2)._canInlineNonLocalReturns();
  43214. if($core.assert($1)){
  43215. $4=$recv(anIRNonLocalReturn)._scope();
  43216. $ctx1.sendIdx["scope"]=2;
  43217. $3=$recv($4)._methodScope();
  43218. $5=$recv(anIRNonLocalReturn)._scope();
  43219. $ctx1.sendIdx["scope"]=3;
  43220. $recv($3)._removeNonLocalReturn_($5);
  43221. $6=$recv($globals.IRReturn)._new();
  43222. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  43223. localReturn=$recv($6)._yourself();
  43224. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  43225. return $core.withContext(function($ctx2) {
  43226. return $recv(localReturn)._add_(each);
  43227. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43228. }));
  43229. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  43230. return $self._visitIRReturn_(localReturn);
  43231. }
  43232. $7=(
  43233. $ctx1.supercall = true,
  43234. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  43235. $ctx1.supercall = false;
  43236. return $7;
  43237. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  43238. },
  43239. args: ["anIRNonLocalReturn"],
  43240. 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",
  43241. referencedClasses: ["IRReturn"],
  43242. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  43243. }),
  43244. $globals.IRInliner);
  43245. $core.addMethod(
  43246. $core.method({
  43247. selector: "visitIRReturn:",
  43248. protocol: "visiting",
  43249. fn: function (anIRReturn){
  43250. var self=this,$self=this;
  43251. return $core.withContext(function($ctx1) {
  43252. var $1;
  43253. $1=$self._shouldInlineReturn_(anIRReturn);
  43254. if($core.assert($1)){
  43255. return $recv($self._returnInliner())._inlineReturn_(anIRReturn);
  43256. } else {
  43257. return (
  43258. $ctx1.supercall = true,
  43259. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  43260. $ctx1.supercall = false;
  43261. }
  43262. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  43263. },
  43264. args: ["anIRReturn"],
  43265. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  43266. referencedClasses: [],
  43267. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  43268. }),
  43269. $globals.IRInliner);
  43270. $core.addMethod(
  43271. $core.method({
  43272. selector: "visitIRSend:",
  43273. protocol: "visiting",
  43274. fn: function (anIRSend){
  43275. var self=this,$self=this;
  43276. return $core.withContext(function($ctx1) {
  43277. var $1;
  43278. $1=$self._shouldInlineSend_(anIRSend);
  43279. if($core.assert($1)){
  43280. return $recv($self._sendInliner())._inlineSend_(anIRSend);
  43281. } else {
  43282. return (
  43283. $ctx1.supercall = true,
  43284. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($self, [anIRSend]));
  43285. $ctx1.supercall = false;
  43286. }
  43287. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  43288. },
  43289. args: ["anIRSend"],
  43290. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  43291. referencedClasses: [],
  43292. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  43293. }),
  43294. $globals.IRInliner);
  43295. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  43296. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  43297. $core.addMethod(
  43298. $core.method({
  43299. selector: "visitIRInlinedClosure:",
  43300. protocol: "visiting",
  43301. fn: function (anIRInlinedClosure){
  43302. var self=this,$self=this;
  43303. return $core.withContext(function($ctx1) {
  43304. $recv($self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  43305. return $core.withContext(function($ctx2) {
  43306. return $recv($recv(each)._name())._asVariableName();
  43307. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43308. })));
  43309. $self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  43310. return self;
  43311. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  43312. },
  43313. args: ["anIRInlinedClosure"],
  43314. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  43315. referencedClasses: [],
  43316. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  43317. }),
  43318. $globals.IRInliningJSTranslator);
  43319. $core.addMethod(
  43320. $core.method({
  43321. selector: "visitIRInlinedIfFalse:",
  43322. protocol: "visiting",
  43323. fn: function (anIRInlinedIfFalse){
  43324. var self=this,$self=this;
  43325. return $core.withContext(function($ctx1) {
  43326. var $1,$2,$4,$3;
  43327. $1=$self._stream();
  43328. $ctx1.sendIdx["stream"]=1;
  43329. $recv($1)._nextPutIf_then_((function(){
  43330. return $core.withContext(function($ctx2) {
  43331. $2=$self._stream();
  43332. $ctx2.sendIdx["stream"]=2;
  43333. $recv($2)._nextPutAll_("!$core.assert(");
  43334. $ctx2.sendIdx["nextPutAll:"]=1;
  43335. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  43336. $ctx2.sendIdx["dagChildren"]=1;
  43337. $3=$recv($4)._first();
  43338. $self._visit_($3);
  43339. $ctx2.sendIdx["visit:"]=1;
  43340. return $recv($self._stream())._nextPutAll_(")");
  43341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43342. }),(function(){
  43343. return $core.withContext(function($ctx2) {
  43344. return $self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  43345. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43346. }));
  43347. return self;
  43348. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  43349. },
  43350. args: ["anIRInlinedIfFalse"],
  43351. 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 ]",
  43352. referencedClasses: [],
  43353. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43354. }),
  43355. $globals.IRInliningJSTranslator);
  43356. $core.addMethod(
  43357. $core.method({
  43358. selector: "visitIRInlinedIfNilIfNotNil:",
  43359. protocol: "visiting",
  43360. fn: function (anIRInlinedIfNilIfNotNil){
  43361. var self=this,$self=this;
  43362. return $core.withContext(function($ctx1) {
  43363. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  43364. $1=$self._stream();
  43365. $ctx1.sendIdx["stream"]=1;
  43366. $recv($1)._nextPutIf_then_else_((function(){
  43367. var recvVarName;
  43368. return $core.withContext(function($ctx2) {
  43369. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  43370. $2=$self._stream();
  43371. $ctx2.sendIdx["stream"]=2;
  43372. $4="(".__comma(recvVarName);
  43373. $ctx2.sendIdx[","]=2;
  43374. $3=$recv($4).__comma(" = ");
  43375. $ctx2.sendIdx[","]=1;
  43376. $recv($2)._nextPutAll_($3);
  43377. $ctx2.sendIdx["nextPutAll:"]=1;
  43378. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43379. $ctx2.sendIdx["dagChildren"]=1;
  43380. $5=$recv($6)._first();
  43381. $self._visit_($5);
  43382. $ctx2.sendIdx["visit:"]=1;
  43383. $7=$self._stream();
  43384. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".a$nil");
  43385. $ctx2.sendIdx[","]=3;
  43386. return $recv($7)._nextPutAll_($8);
  43387. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  43388. }),(function(){
  43389. return $core.withContext(function($ctx2) {
  43390. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43391. $ctx2.sendIdx["dagChildren"]=2;
  43392. $9=$recv($10)._second();
  43393. return $self._visit_($9);
  43394. $ctx2.sendIdx["visit:"]=2;
  43395. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43396. }),(function(){
  43397. return $core.withContext(function($ctx2) {
  43398. return $self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  43399. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43400. }));
  43401. return self;
  43402. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  43403. },
  43404. args: ["anIRInlinedIfNilIfNotNil"],
  43405. 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 ]",
  43406. referencedClasses: [],
  43407. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  43408. }),
  43409. $globals.IRInliningJSTranslator);
  43410. $core.addMethod(
  43411. $core.method({
  43412. selector: "visitIRInlinedIfTrue:",
  43413. protocol: "visiting",
  43414. fn: function (anIRInlinedIfTrue){
  43415. var self=this,$self=this;
  43416. return $core.withContext(function($ctx1) {
  43417. var $1,$2,$4,$3;
  43418. $1=$self._stream();
  43419. $ctx1.sendIdx["stream"]=1;
  43420. $recv($1)._nextPutIf_then_((function(){
  43421. return $core.withContext(function($ctx2) {
  43422. $2=$self._stream();
  43423. $ctx2.sendIdx["stream"]=2;
  43424. $recv($2)._nextPutAll_("$core.assert(");
  43425. $ctx2.sendIdx["nextPutAll:"]=1;
  43426. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  43427. $ctx2.sendIdx["dagChildren"]=1;
  43428. $3=$recv($4)._first();
  43429. $self._visit_($3);
  43430. $ctx2.sendIdx["visit:"]=1;
  43431. return $recv($self._stream())._nextPutAll_(")");
  43432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43433. }),(function(){
  43434. return $core.withContext(function($ctx2) {
  43435. return $self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  43436. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43437. }));
  43438. return self;
  43439. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  43440. },
  43441. args: ["anIRInlinedIfTrue"],
  43442. 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 ]",
  43443. referencedClasses: [],
  43444. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43445. }),
  43446. $globals.IRInliningJSTranslator);
  43447. $core.addMethod(
  43448. $core.method({
  43449. selector: "visitIRInlinedIfTrueIfFalse:",
  43450. protocol: "visiting",
  43451. fn: function (anIRInlinedIfTrueIfFalse){
  43452. var self=this,$self=this;
  43453. return $core.withContext(function($ctx1) {
  43454. var $1,$2,$4,$3,$6,$5;
  43455. $1=$self._stream();
  43456. $ctx1.sendIdx["stream"]=1;
  43457. $recv($1)._nextPutIf_then_else_((function(){
  43458. return $core.withContext(function($ctx2) {
  43459. $2=$self._stream();
  43460. $ctx2.sendIdx["stream"]=2;
  43461. $recv($2)._nextPutAll_("$core.assert(");
  43462. $ctx2.sendIdx["nextPutAll:"]=1;
  43463. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43464. $ctx2.sendIdx["dagChildren"]=1;
  43465. $3=$recv($4)._first();
  43466. $self._visit_($3);
  43467. $ctx2.sendIdx["visit:"]=1;
  43468. return $recv($self._stream())._nextPutAll_(")");
  43469. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43470. }),(function(){
  43471. return $core.withContext(function($ctx2) {
  43472. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43473. $ctx2.sendIdx["dagChildren"]=2;
  43474. $5=$recv($6)._second();
  43475. return $self._visit_($5);
  43476. $ctx2.sendIdx["visit:"]=2;
  43477. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43478. }),(function(){
  43479. return $core.withContext(function($ctx2) {
  43480. return $self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  43481. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43482. }));
  43483. return self;
  43484. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  43485. },
  43486. args: ["anIRInlinedIfTrueIfFalse"],
  43487. 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 ]",
  43488. referencedClasses: [],
  43489. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  43490. }),
  43491. $globals.IRInliningJSTranslator);
  43492. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  43493. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  43494. $core.addMethod(
  43495. $core.method({
  43496. selector: "ifFalse:",
  43497. protocol: "inlining",
  43498. fn: function (anIRInstruction){
  43499. var self=this,$self=this;
  43500. return $core.withContext(function($ctx1) {
  43501. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  43502. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43503. },
  43504. args: ["anIRInstruction"],
  43505. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  43506. referencedClasses: ["IRInlinedIfFalse"],
  43507. messageSends: ["inlinedSend:withBlock:", "new"]
  43508. }),
  43509. $globals.IRSendInliner);
  43510. $core.addMethod(
  43511. $core.method({
  43512. selector: "ifFalse:ifTrue:",
  43513. protocol: "inlining",
  43514. fn: function (anIRInstruction,anotherIRInstruction){
  43515. var self=this,$self=this;
  43516. return $core.withContext(function($ctx1) {
  43517. return $self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  43518. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43519. },
  43520. args: ["anIRInstruction", "anotherIRInstruction"],
  43521. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  43522. referencedClasses: [],
  43523. messageSends: ["perform:withArguments:"]
  43524. }),
  43525. $globals.IRSendInliner);
  43526. $core.addMethod(
  43527. $core.method({
  43528. selector: "ifNil:",
  43529. protocol: "inlining",
  43530. fn: function (anIRInstruction){
  43531. var self=this,$self=this;
  43532. return $core.withContext(function($ctx1) {
  43533. var $1,$3,$5,$6,$4,$2;
  43534. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43535. $ctx1.sendIdx["new"]=1;
  43536. $3=$recv($globals.IRClosure)._new();
  43537. $ctx1.sendIdx["new"]=2;
  43538. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43539. $5=$recv($globals.IRBlockSequence)._new();
  43540. $recv($5)._add_($recv($self._send())._receiver());
  43541. $6=$recv($5)._yourself();
  43542. $ctx1.sendIdx["yourself"]=1;
  43543. $4=$6;
  43544. $recv($3)._add_($4);
  43545. $ctx1.sendIdx["add:"]=1;
  43546. $2=$recv($3)._yourself();
  43547. return $self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  43548. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43549. },
  43550. args: ["anIRInstruction"],
  43551. 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)",
  43552. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43553. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43554. }),
  43555. $globals.IRSendInliner);
  43556. $core.addMethod(
  43557. $core.method({
  43558. selector: "ifNil:ifNotNil:",
  43559. protocol: "inlining",
  43560. fn: function (anIRInstruction,anotherIRInstruction){
  43561. var self=this,$self=this;
  43562. return $core.withContext(function($ctx1) {
  43563. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  43564. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43565. },
  43566. args: ["anIRInstruction", "anotherIRInstruction"],
  43567. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43568. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43569. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43570. }),
  43571. $globals.IRSendInliner);
  43572. $core.addMethod(
  43573. $core.method({
  43574. selector: "ifNotNil:",
  43575. protocol: "inlining",
  43576. fn: function (anIRInstruction){
  43577. var self=this,$self=this;
  43578. return $core.withContext(function($ctx1) {
  43579. var $1,$3,$5,$6,$4,$2;
  43580. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43581. $ctx1.sendIdx["new"]=1;
  43582. $3=$recv($globals.IRClosure)._new();
  43583. $ctx1.sendIdx["new"]=2;
  43584. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43585. $5=$recv($globals.IRBlockSequence)._new();
  43586. $recv($5)._add_($recv($self._send())._receiver());
  43587. $6=$recv($5)._yourself();
  43588. $ctx1.sendIdx["yourself"]=1;
  43589. $4=$6;
  43590. $recv($3)._add_($4);
  43591. $ctx1.sendIdx["add:"]=1;
  43592. $2=$recv($3)._yourself();
  43593. return $self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  43594. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43595. },
  43596. args: ["anIRInstruction"],
  43597. 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",
  43598. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43599. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43600. }),
  43601. $globals.IRSendInliner);
  43602. $core.addMethod(
  43603. $core.method({
  43604. selector: "ifNotNil:ifNil:",
  43605. protocol: "inlining",
  43606. fn: function (anIRInstruction,anotherIRInstruction){
  43607. var self=this,$self=this;
  43608. return $core.withContext(function($ctx1) {
  43609. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  43610. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43611. },
  43612. args: ["anIRInstruction", "anotherIRInstruction"],
  43613. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  43614. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43615. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43616. }),
  43617. $globals.IRSendInliner);
  43618. $core.addMethod(
  43619. $core.method({
  43620. selector: "ifTrue:",
  43621. protocol: "inlining",
  43622. fn: function (anIRInstruction){
  43623. var self=this,$self=this;
  43624. return $core.withContext(function($ctx1) {
  43625. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  43626. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43627. },
  43628. args: ["anIRInstruction"],
  43629. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  43630. referencedClasses: ["IRInlinedIfTrue"],
  43631. messageSends: ["inlinedSend:withBlock:", "new"]
  43632. }),
  43633. $globals.IRSendInliner);
  43634. $core.addMethod(
  43635. $core.method({
  43636. selector: "ifTrue:ifFalse:",
  43637. protocol: "inlining",
  43638. fn: function (anIRInstruction,anotherIRInstruction){
  43639. var self=this,$self=this;
  43640. return $core.withContext(function($ctx1) {
  43641. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  43642. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43643. },
  43644. args: ["anIRInstruction", "anotherIRInstruction"],
  43645. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43646. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  43647. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43648. }),
  43649. $globals.IRSendInliner);
  43650. $core.addMethod(
  43651. $core.method({
  43652. selector: "inlineClosure:",
  43653. protocol: "inlining",
  43654. fn: function (anIRClosure){
  43655. var self=this,$self=this;
  43656. var inlinedClosure,sequence,statements;
  43657. return $core.withContext(function($ctx1) {
  43658. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  43659. inlinedClosure=$self._inlinedClosure();
  43660. $1=inlinedClosure;
  43661. $2=$recv(anIRClosure)._scope();
  43662. $ctx1.sendIdx["scope"]=1;
  43663. $recv($1)._scope_($2);
  43664. $ctx1.sendIdx["scope:"]=1;
  43665. $recv($1)._parent_($recv(anIRClosure)._parent());
  43666. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  43667. return $core.withContext(function($ctx2) {
  43668. return $recv(inlinedClosure)._add_(each);
  43669. $ctx2.sendIdx["add:"]=1;
  43670. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43671. }));
  43672. $ctx1.sendIdx["do:"]=1;
  43673. sequence=$self._inlinedSequence();
  43674. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  43675. return $core.withContext(function($ctx2) {
  43676. $3=inlinedClosure;
  43677. $5=$recv($globals.IRTempDeclaration)._new();
  43678. $ctx2.sendIdx["new"]=1;
  43679. $recv($5)._name_(each);
  43680. $ctx2.sendIdx["name:"]=1;
  43681. $6=$recv($5)._yourself();
  43682. $ctx2.sendIdx["yourself"]=1;
  43683. $4=$6;
  43684. $recv($3)._add_($4);
  43685. $ctx2.sendIdx["add:"]=2;
  43686. $7=sequence;
  43687. $9=$recv($globals.IRAssignment)._new();
  43688. $ctx2.sendIdx["new"]=2;
  43689. $11=$recv($globals.IRVariable)._new();
  43690. $ctx2.sendIdx["new"]=3;
  43691. $13=$recv($globals.AliasVar)._new();
  43692. $ctx2.sendIdx["new"]=4;
  43693. $14=$recv(inlinedClosure)._scope();
  43694. $ctx2.sendIdx["scope"]=2;
  43695. $recv($13)._scope_($14);
  43696. $ctx2.sendIdx["scope:"]=2;
  43697. $recv($13)._name_(each);
  43698. $ctx2.sendIdx["name:"]=2;
  43699. $15=$recv($13)._yourself();
  43700. $ctx2.sendIdx["yourself"]=2;
  43701. $12=$15;
  43702. $10=$recv($11)._variable_($12);
  43703. $ctx2.sendIdx["variable:"]=1;
  43704. $recv($9)._add_($10);
  43705. $ctx2.sendIdx["add:"]=4;
  43706. $17=$recv($globals.IRVariable)._new();
  43707. $ctx2.sendIdx["new"]=5;
  43708. $19=$recv($globals.AliasVar)._new();
  43709. $recv($19)._scope_($recv(inlinedClosure)._scope());
  43710. $recv($19)._name_("$receiver");
  43711. $20=$recv($19)._yourself();
  43712. $ctx2.sendIdx["yourself"]=3;
  43713. $18=$20;
  43714. $16=$recv($17)._variable_($18);
  43715. $recv($9)._add_($16);
  43716. $ctx2.sendIdx["add:"]=5;
  43717. $8=$recv($9)._yourself();
  43718. return $recv($7)._add_($8);
  43719. $ctx2.sendIdx["add:"]=3;
  43720. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43721. }));
  43722. $ctx1.sendIdx["do:"]=2;
  43723. $recv(inlinedClosure)._add_(sequence);
  43724. $ctx1.sendIdx["add:"]=6;
  43725. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  43726. $recv(statements)._ifNotEmpty_((function(){
  43727. return $core.withContext(function($ctx2) {
  43728. $recv($recv(statements)._allButLast())._do_((function(each){
  43729. return $core.withContext(function($ctx3) {
  43730. return $recv(sequence)._add_(each);
  43731. $ctx3.sendIdx["add:"]=7;
  43732. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  43733. }));
  43734. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  43735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43736. }));
  43737. return inlinedClosure;
  43738. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  43739. },
  43740. args: ["anIRClosure"],
  43741. 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",
  43742. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  43743. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  43744. }),
  43745. $globals.IRSendInliner);
  43746. $core.addMethod(
  43747. $core.method({
  43748. selector: "inlineSend:",
  43749. protocol: "inlining",
  43750. fn: function (anIRSend){
  43751. var self=this,$self=this;
  43752. return $core.withContext(function($ctx1) {
  43753. var $2,$1;
  43754. $self._send_(anIRSend);
  43755. $2=$self._send();
  43756. $ctx1.sendIdx["send"]=1;
  43757. $1=$recv($2)._selector();
  43758. return $self._perform_withArguments_($1,$recv($self._send())._arguments());
  43759. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  43760. },
  43761. args: ["anIRSend"],
  43762. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  43763. referencedClasses: [],
  43764. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  43765. }),
  43766. $globals.IRSendInliner);
  43767. $core.addMethod(
  43768. $core.method({
  43769. selector: "inlineSend:andReplace:",
  43770. protocol: "private",
  43771. fn: function (anIRSend,anIRInstruction){
  43772. var self=this,$self=this;
  43773. return $core.withContext(function($ctx1) {
  43774. $recv(anIRInstruction)._replaceWith_(anIRSend);
  43775. return $self._inlineSend_(anIRSend);
  43776. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43777. },
  43778. args: ["anIRSend", "anIRInstruction"],
  43779. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  43780. referencedClasses: [],
  43781. messageSends: ["replaceWith:", "inlineSend:"]
  43782. }),
  43783. $globals.IRSendInliner);
  43784. $core.addMethod(
  43785. $core.method({
  43786. selector: "inlinedClosure",
  43787. protocol: "factory",
  43788. fn: function (){
  43789. var self=this,$self=this;
  43790. return $core.withContext(function($ctx1) {
  43791. return $recv($globals.IRInlinedClosure)._new();
  43792. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  43793. },
  43794. args: [],
  43795. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  43796. referencedClasses: ["IRInlinedClosure"],
  43797. messageSends: ["new"]
  43798. }),
  43799. $globals.IRSendInliner);
  43800. $core.addMethod(
  43801. $core.method({
  43802. selector: "inlinedSend:withBlock:",
  43803. protocol: "private",
  43804. fn: function (inlinedSend,anIRInstruction){
  43805. var self=this,$self=this;
  43806. var inlinedClosure;
  43807. return $core.withContext(function($ctx1) {
  43808. var $1,$2,$4,$3,$5;
  43809. $1=$recv(anIRInstruction)._isClosure();
  43810. if(!$core.assert($1)){
  43811. $self._inliningError_("Message argument should be a block");
  43812. $ctx1.sendIdx["inliningError:"]=1;
  43813. }
  43814. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  43815. if(!$core.assert($2)){
  43816. $self._inliningError_("Inlined block should have zero argument");
  43817. }
  43818. inlinedClosure=$recv($self._translator())._visit_($self._inlineClosure_(anIRInstruction));
  43819. $4=$self._send();
  43820. $ctx1.sendIdx["send"]=1;
  43821. $3=$recv($4)._receiver();
  43822. $recv(inlinedSend)._add_($3);
  43823. $ctx1.sendIdx["add:"]=1;
  43824. $recv(inlinedSend)._add_(inlinedClosure);
  43825. $recv($self._send())._replaceWith_(inlinedSend);
  43826. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  43827. $ctx1.sendIdx["internalVariables"]=1;
  43828. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  43829. return inlinedSend;
  43830. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  43831. },
  43832. args: ["inlinedSend", "anIRInstruction"],
  43833. 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",
  43834. referencedClasses: [],
  43835. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43836. }),
  43837. $globals.IRSendInliner);
  43838. $core.addMethod(
  43839. $core.method({
  43840. selector: "inlinedSend:withBlock:withBlock:",
  43841. protocol: "private",
  43842. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  43843. var self=this,$self=this;
  43844. var inlinedClosure1,inlinedClosure2;
  43845. return $core.withContext(function($ctx1) {
  43846. var $1,$2,$3,$4,$6,$5,$7;
  43847. $1=$recv(anIRInstruction)._isClosure();
  43848. $ctx1.sendIdx["isClosure"]=1;
  43849. if(!$core.assert($1)){
  43850. $self._inliningError_("Message argument should be a block");
  43851. $ctx1.sendIdx["inliningError:"]=1;
  43852. }
  43853. $2=$recv(anotherIRInstruction)._isClosure();
  43854. if(!$core.assert($2)){
  43855. $self._inliningError_("Message argument should be a block");
  43856. }
  43857. $3=$self._translator();
  43858. $ctx1.sendIdx["translator"]=1;
  43859. $4=$self._inlineClosure_(anIRInstruction);
  43860. $ctx1.sendIdx["inlineClosure:"]=1;
  43861. inlinedClosure1=$recv($3)._visit_($4);
  43862. $ctx1.sendIdx["visit:"]=1;
  43863. inlinedClosure2=$recv($self._translator())._visit_($self._inlineClosure_(anotherIRInstruction));
  43864. $6=$self._send();
  43865. $ctx1.sendIdx["send"]=1;
  43866. $5=$recv($6)._receiver();
  43867. $recv(inlinedSend)._add_($5);
  43868. $ctx1.sendIdx["add:"]=1;
  43869. $recv(inlinedSend)._add_(inlinedClosure1);
  43870. $ctx1.sendIdx["add:"]=2;
  43871. $recv(inlinedSend)._add_(inlinedClosure2);
  43872. $recv($self._send())._replaceWith_(inlinedSend);
  43873. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  43874. $ctx1.sendIdx["internalVariables"]=1;
  43875. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  43876. return inlinedSend;
  43877. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  43878. },
  43879. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  43880. 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",
  43881. referencedClasses: [],
  43882. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43883. }),
  43884. $globals.IRSendInliner);
  43885. $core.addMethod(
  43886. $core.method({
  43887. selector: "inlinedSequence",
  43888. protocol: "factory",
  43889. fn: function (){
  43890. var self=this,$self=this;
  43891. return $core.withContext(function($ctx1) {
  43892. return $recv($globals.IRInlinedSequence)._new();
  43893. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  43894. },
  43895. args: [],
  43896. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  43897. referencedClasses: ["IRInlinedSequence"],
  43898. messageSends: ["new"]
  43899. }),
  43900. $globals.IRSendInliner);
  43901. $core.addMethod(
  43902. $core.method({
  43903. selector: "inliningError:",
  43904. protocol: "error handling",
  43905. fn: function (aString){
  43906. var self=this,$self=this;
  43907. return $core.withContext(function($ctx1) {
  43908. $recv($globals.InliningError)._signal_(aString);
  43909. return self;
  43910. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  43911. },
  43912. args: ["aString"],
  43913. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  43914. referencedClasses: ["InliningError"],
  43915. messageSends: ["signal:"]
  43916. }),
  43917. $globals.IRSendInliner);
  43918. $core.addMethod(
  43919. $core.method({
  43920. selector: "send",
  43921. protocol: "accessing",
  43922. fn: function (){
  43923. var self=this,$self=this;
  43924. return $self["@send"];
  43925. },
  43926. args: [],
  43927. source: "send\x0a\x09^ send",
  43928. referencedClasses: [],
  43929. messageSends: []
  43930. }),
  43931. $globals.IRSendInliner);
  43932. $core.addMethod(
  43933. $core.method({
  43934. selector: "send:",
  43935. protocol: "accessing",
  43936. fn: function (anIRSend){
  43937. var self=this,$self=this;
  43938. $self["@send"]=anIRSend;
  43939. return self;
  43940. },
  43941. args: ["anIRSend"],
  43942. source: "send: anIRSend\x0a\x09send := anIRSend",
  43943. referencedClasses: [],
  43944. messageSends: []
  43945. }),
  43946. $globals.IRSendInliner);
  43947. $core.addMethod(
  43948. $core.method({
  43949. selector: "translator",
  43950. protocol: "accessing",
  43951. fn: function (){
  43952. var self=this,$self=this;
  43953. return $self["@translator"];
  43954. },
  43955. args: [],
  43956. source: "translator\x0a\x09^ translator",
  43957. referencedClasses: [],
  43958. messageSends: []
  43959. }),
  43960. $globals.IRSendInliner);
  43961. $core.addMethod(
  43962. $core.method({
  43963. selector: "translator:",
  43964. protocol: "accessing",
  43965. fn: function (anASTTranslator){
  43966. var self=this,$self=this;
  43967. $self["@translator"]=anASTTranslator;
  43968. return self;
  43969. },
  43970. args: ["anASTTranslator"],
  43971. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  43972. referencedClasses: [],
  43973. messageSends: []
  43974. }),
  43975. $globals.IRSendInliner);
  43976. $core.addMethod(
  43977. $core.method({
  43978. selector: "inlinedSelectors",
  43979. protocol: "accessing",
  43980. fn: function (){
  43981. var self=this,$self=this;
  43982. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  43983. },
  43984. args: [],
  43985. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  43986. referencedClasses: [],
  43987. messageSends: []
  43988. }),
  43989. $globals.IRSendInliner.a$cls);
  43990. $core.addMethod(
  43991. $core.method({
  43992. selector: "shouldInline:",
  43993. protocol: "accessing",
  43994. fn: function (anIRSend){
  43995. var self=this,$self=this;
  43996. return $core.withContext(function($ctx1) {
  43997. var $1;
  43998. $1=$recv($self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  43999. if(!$core.assert($1)){
  44000. return false;
  44001. }
  44002. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  44003. return $core.withContext(function($ctx2) {
  44004. return $recv(each)._isClosure();
  44005. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  44006. }));
  44007. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.a$cls)});
  44008. },
  44009. args: ["anIRSend"],
  44010. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  44011. referencedClasses: [],
  44012. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  44013. }),
  44014. $globals.IRSendInliner.a$cls);
  44015. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  44016. $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};";
  44017. $core.addMethod(
  44018. $core.method({
  44019. selector: "inlineAssignment:",
  44020. protocol: "inlining",
  44021. fn: function (anIRAssignment){
  44022. var self=this,$self=this;
  44023. return $core.withContext(function($ctx1) {
  44024. $self._target_($recv(anIRAssignment)._left());
  44025. return $self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  44026. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRAssignmentInliner)});
  44027. },
  44028. args: ["anIRAssignment"],
  44029. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  44030. referencedClasses: [],
  44031. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  44032. }),
  44033. $globals.IRAssignmentInliner);
  44034. $core.addMethod(
  44035. $core.method({
  44036. selector: "inlineClosure:",
  44037. protocol: "inlining",
  44038. fn: function (anIRClosure){
  44039. var self=this,$self=this;
  44040. var closure,sequence,statements;
  44041. return $core.withContext(function($ctx1) {
  44042. var $1,$2,$3,$5,$4;
  44043. closure=(
  44044. $ctx1.supercall = true,
  44045. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  44046. $ctx1.supercall = false;
  44047. sequence=$recv(closure)._sequence();
  44048. statements=$recv(sequence)._dagChildren();
  44049. $recv(statements)._ifNotEmpty_((function(){
  44050. var final;
  44051. return $core.withContext(function($ctx2) {
  44052. final=$recv(statements)._last();
  44053. $1=$recv(final)._yieldsValue();
  44054. if($core.assert($1)){
  44055. $2=sequence;
  44056. $3=final;
  44057. $5=$recv($globals.IRAssignment)._new();
  44058. $recv($5)._add_($self._target());
  44059. $ctx2.sendIdx["add:"]=1;
  44060. $recv($5)._add_($recv(final)._copy());
  44061. $4=$recv($5)._yourself();
  44062. return $recv($2)._replace_with_($3,$4);
  44063. }
  44064. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  44065. }));
  44066. return closure;
  44067. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRAssignmentInliner)});
  44068. },
  44069. args: ["anIRClosure"],
  44070. 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",
  44071. referencedClasses: ["IRAssignment"],
  44072. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  44073. }),
  44074. $globals.IRAssignmentInliner);
  44075. $core.addMethod(
  44076. $core.method({
  44077. selector: "target",
  44078. protocol: "accessing",
  44079. fn: function (){
  44080. var self=this,$self=this;
  44081. return $self["@target"];
  44082. },
  44083. args: [],
  44084. source: "target\x0a\x09^ target",
  44085. referencedClasses: [],
  44086. messageSends: []
  44087. }),
  44088. $globals.IRAssignmentInliner);
  44089. $core.addMethod(
  44090. $core.method({
  44091. selector: "target:",
  44092. protocol: "accessing",
  44093. fn: function (anObject){
  44094. var self=this,$self=this;
  44095. $self["@target"]=anObject;
  44096. return self;
  44097. },
  44098. args: ["anObject"],
  44099. source: "target: anObject\x0a\x09target := anObject",
  44100. referencedClasses: [],
  44101. messageSends: []
  44102. }),
  44103. $globals.IRAssignmentInliner);
  44104. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  44105. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  44106. $core.addMethod(
  44107. $core.method({
  44108. selector: "inlineClosure:",
  44109. protocol: "inlining",
  44110. fn: function (anIRClosure){
  44111. var self=this,$self=this;
  44112. var closure,sequence,statements;
  44113. return $core.withContext(function($ctx1) {
  44114. var $1,$2,$3,$5,$4;
  44115. closure=(
  44116. $ctx1.supercall = true,
  44117. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  44118. $ctx1.supercall = false;
  44119. sequence=$recv(closure)._sequence();
  44120. statements=$recv(sequence)._dagChildren();
  44121. $recv(statements)._ifNotEmpty_((function(){
  44122. var final;
  44123. return $core.withContext(function($ctx2) {
  44124. final=$recv(statements)._last();
  44125. $1=$recv(final)._yieldsValue();
  44126. if($core.assert($1)){
  44127. $2=sequence;
  44128. $3=final;
  44129. $5=$recv($globals.IRReturn)._new();
  44130. $recv($5)._add_($recv(final)._copy());
  44131. $4=$recv($5)._yourself();
  44132. return $recv($2)._replace_with_($3,$4);
  44133. }
  44134. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  44135. }));
  44136. return closure;
  44137. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRReturnInliner)});
  44138. },
  44139. args: ["anIRClosure"],
  44140. 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",
  44141. referencedClasses: ["IRReturn"],
  44142. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  44143. }),
  44144. $globals.IRReturnInliner);
  44145. $core.addMethod(
  44146. $core.method({
  44147. selector: "inlineReturn:",
  44148. protocol: "inlining",
  44149. fn: function (anIRReturn){
  44150. var self=this,$self=this;
  44151. return $core.withContext(function($ctx1) {
  44152. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  44153. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn},$globals.IRReturnInliner)});
  44154. },
  44155. args: ["anIRReturn"],
  44156. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  44157. referencedClasses: [],
  44158. messageSends: ["inlineSend:andReplace:", "expression"]
  44159. }),
  44160. $globals.IRReturnInliner);
  44161. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  44162. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  44163. $core.addMethod(
  44164. $core.method({
  44165. selector: "inliner",
  44166. protocol: "compiling",
  44167. fn: function (){
  44168. var self=this,$self=this;
  44169. return $core.withContext(function($ctx1) {
  44170. return $recv($globals.IRInliner)._new();
  44171. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  44172. },
  44173. args: [],
  44174. source: "inliner\x0a\x09^ IRInliner new",
  44175. referencedClasses: ["IRInliner"],
  44176. messageSends: ["new"]
  44177. }),
  44178. $globals.InliningCodeGenerator);
  44179. $core.addMethod(
  44180. $core.method({
  44181. selector: "irTranslatorClass",
  44182. protocol: "compiling",
  44183. fn: function (){
  44184. var self=this,$self=this;
  44185. return $globals.IRInliningJSTranslator;
  44186. },
  44187. args: [],
  44188. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  44189. referencedClasses: ["IRInliningJSTranslator"],
  44190. messageSends: []
  44191. }),
  44192. $globals.InliningCodeGenerator);
  44193. $core.addMethod(
  44194. $core.method({
  44195. selector: "preInliner",
  44196. protocol: "compiling",
  44197. fn: function (){
  44198. var self=this,$self=this;
  44199. return $core.withContext(function($ctx1) {
  44200. return $recv($globals.ASTPreInliner)._new();
  44201. }, function($ctx1) {$ctx1.fill(self,"preInliner",{},$globals.InliningCodeGenerator)});
  44202. },
  44203. args: [],
  44204. source: "preInliner\x0a\x09^ ASTPreInliner new",
  44205. referencedClasses: ["ASTPreInliner"],
  44206. messageSends: ["new"]
  44207. }),
  44208. $globals.InliningCodeGenerator);
  44209. $core.addMethod(
  44210. $core.method({
  44211. selector: "transformersDictionary",
  44212. protocol: "compiling",
  44213. fn: function (){
  44214. var self=this,$self=this;
  44215. return $core.withContext(function($ctx1) {
  44216. var $1,$2,$receiver;
  44217. $1=$self["@transformersDictionary"];
  44218. if(($receiver = $1) == null || $receiver.a$nil){
  44219. $2=(
  44220. $ctx1.supercall = true,
  44221. ($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($self, []));
  44222. $ctx1.supercall = false;
  44223. $recv($2)._at_put_("3000-inlinerTagging",$self._preInliner());
  44224. $ctx1.sendIdx["at:put:"]=1;
  44225. $recv($2)._at_put_("6000-inliner",$self._inliner());
  44226. $ctx1.sendIdx["at:put:"]=2;
  44227. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  44228. $self["@transformersDictionary"]=$recv($2)._yourself();
  44229. return $self["@transformersDictionary"];
  44230. } else {
  44231. return $1;
  44232. }
  44233. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.InliningCodeGenerator)});
  44234. },
  44235. args: [],
  44236. 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 ]",
  44237. referencedClasses: [],
  44238. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  44239. }),
  44240. $globals.InliningCodeGenerator);
  44241. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  44242. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  44243. $core.addClass("InliningSemanticAnalyzer", $globals.SemanticAnalyzer, [], "Compiler-Inlining");
  44244. $core.addMethod(
  44245. $core.method({
  44246. selector: "visitSendNode:",
  44247. protocol: "visiting",
  44248. fn: function (aNode){
  44249. var self=this,$self=this;
  44250. return $core.withContext(function($ctx1) {
  44251. var $1,$2,$3,$receiver;
  44252. $1=$recv(aNode)._superSend();
  44253. if(!$core.assert($1)){
  44254. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  44255. if($core.assert($2)){
  44256. $recv(aNode)._shouldBeInlined_(true);
  44257. $3=$recv(aNode)._receiver();
  44258. if(($receiver = $3) == null || $receiver.a$nil){
  44259. $3;
  44260. } else {
  44261. var receiver;
  44262. receiver=$receiver;
  44263. $recv(receiver)._shouldBeAliased_(true);
  44264. }
  44265. }
  44266. }
  44267. (
  44268. $ctx1.supercall = true,
  44269. ($globals.InliningSemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  44270. $ctx1.supercall = false;
  44271. return self;
  44272. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.InliningSemanticAnalyzer)});
  44273. },
  44274. args: ["aNode"],
  44275. 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",
  44276. referencedClasses: ["IRSendInliner"],
  44277. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  44278. }),
  44279. $globals.InliningSemanticAnalyzer);
  44280. $core.addMethod(
  44281. $core.method({
  44282. selector: "asInlinedBlockResult",
  44283. protocol: "*Compiler-Inlining",
  44284. fn: function (){
  44285. var self=this,$self=this;
  44286. return $core.withContext(function($ctx1) {
  44287. return $self._expression();
  44288. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{},$globals.IRBlockReturn)});
  44289. },
  44290. args: [],
  44291. source: "asInlinedBlockResult\x0a\x09^ self expression",
  44292. referencedClasses: [],
  44293. messageSends: ["expression"]
  44294. }),
  44295. $globals.IRBlockReturn);
  44296. $core.addMethod(
  44297. $core.method({
  44298. selector: "asInlinedBlockResult",
  44299. protocol: "*Compiler-Inlining",
  44300. fn: function (){
  44301. var self=this,$self=this;
  44302. return self;
  44303. },
  44304. args: [],
  44305. source: "asInlinedBlockResult\x0a\x09^ self",
  44306. referencedClasses: [],
  44307. messageSends: []
  44308. }),
  44309. $globals.IRInstruction);
  44310. });
  44311. 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";
  44312. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  44313. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  44314. var $pkg = $core.addPackage("Compiler-Interpreter");
  44315. $pkg.innerEval = function (expr) { return eval(expr); };
  44316. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  44317. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  44318. $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`).";
  44319. $core.addMethod(
  44320. $core.method({
  44321. selector: "applyTo:arguments:",
  44322. protocol: "evaluating",
  44323. fn: function (anObject,aCollection){
  44324. var self=this,$self=this;
  44325. return $core.withContext(function($ctx1) {
  44326. $self._interpreterError();
  44327. return self;
  44328. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  44329. },
  44330. args: ["anObject", "aCollection"],
  44331. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  44332. referencedClasses: [],
  44333. messageSends: ["interpreterError"]
  44334. }),
  44335. $globals.AIBlockClosure);
  44336. $core.addMethod(
  44337. $core.method({
  44338. selector: "compiledSource",
  44339. protocol: "accessing",
  44340. fn: function (){
  44341. var self=this,$self=this;
  44342. return "[ AST Block closure ]";
  44343. },
  44344. args: [],
  44345. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  44346. referencedClasses: [],
  44347. messageSends: []
  44348. }),
  44349. $globals.AIBlockClosure);
  44350. $core.addMethod(
  44351. $core.method({
  44352. selector: "currySelf",
  44353. protocol: "converting",
  44354. fn: function (){
  44355. var self=this,$self=this;
  44356. return $core.withContext(function($ctx1) {
  44357. $self._interpreterError();
  44358. return self;
  44359. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  44360. },
  44361. args: [],
  44362. source: "currySelf\x0a\x09self interpreterError",
  44363. referencedClasses: [],
  44364. messageSends: ["interpreterError"]
  44365. }),
  44366. $globals.AIBlockClosure);
  44367. $core.addMethod(
  44368. $core.method({
  44369. selector: "initializeWithContext:node:",
  44370. protocol: "initialization",
  44371. fn: function (aContext,aNode){
  44372. var self=this,$self=this;
  44373. $self["@node"]=aNode;
  44374. $self["@outerContext"]=aContext;
  44375. return self;
  44376. },
  44377. args: ["aContext", "aNode"],
  44378. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  44379. referencedClasses: [],
  44380. messageSends: []
  44381. }),
  44382. $globals.AIBlockClosure);
  44383. $core.addMethod(
  44384. $core.method({
  44385. selector: "interpreterError",
  44386. protocol: "error handling",
  44387. fn: function (){
  44388. var self=this,$self=this;
  44389. return $core.withContext(function($ctx1) {
  44390. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  44391. return self;
  44392. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  44393. },
  44394. args: [],
  44395. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  44396. referencedClasses: ["ASTInterpreterError"],
  44397. messageSends: ["signal:"]
  44398. }),
  44399. $globals.AIBlockClosure);
  44400. $core.addMethod(
  44401. $core.method({
  44402. selector: "numArgs",
  44403. protocol: "accessing",
  44404. fn: function (){
  44405. var self=this,$self=this;
  44406. return $core.withContext(function($ctx1) {
  44407. return $recv($recv($self["@node"])._temps())._size();
  44408. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  44409. },
  44410. args: [],
  44411. source: "numArgs\x0a\x09^ node temps size",
  44412. referencedClasses: [],
  44413. messageSends: ["size", "temps"]
  44414. }),
  44415. $globals.AIBlockClosure);
  44416. $core.addMethod(
  44417. $core.method({
  44418. selector: "value",
  44419. protocol: "evaluating",
  44420. fn: function (){
  44421. var self=this,$self=this;
  44422. return $core.withContext(function($ctx1) {
  44423. return $self._valueWithPossibleArguments_([]);
  44424. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  44425. },
  44426. args: [],
  44427. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  44428. referencedClasses: [],
  44429. messageSends: ["valueWithPossibleArguments:"]
  44430. }),
  44431. $globals.AIBlockClosure);
  44432. $core.addMethod(
  44433. $core.method({
  44434. selector: "value:",
  44435. protocol: "evaluating",
  44436. fn: function (anArgument){
  44437. var self=this,$self=this;
  44438. return $core.withContext(function($ctx1) {
  44439. return $self._valueWithPossibleArguments_([anArgument]);
  44440. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  44441. },
  44442. args: ["anArgument"],
  44443. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  44444. referencedClasses: [],
  44445. messageSends: ["valueWithPossibleArguments:"]
  44446. }),
  44447. $globals.AIBlockClosure);
  44448. $core.addMethod(
  44449. $core.method({
  44450. selector: "value:value:",
  44451. protocol: "evaluating",
  44452. fn: function (firstArgument,secondArgument){
  44453. var self=this,$self=this;
  44454. return $core.withContext(function($ctx1) {
  44455. return $self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  44456. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  44457. },
  44458. args: ["firstArgument", "secondArgument"],
  44459. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  44460. referencedClasses: [],
  44461. messageSends: ["valueWithPossibleArguments:"]
  44462. }),
  44463. $globals.AIBlockClosure);
  44464. $core.addMethod(
  44465. $core.method({
  44466. selector: "value:value:value:",
  44467. protocol: "evaluating",
  44468. fn: function (firstArgument,secondArgument,thirdArgument){
  44469. var self=this,$self=this;
  44470. return $core.withContext(function($ctx1) {
  44471. return $self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  44472. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  44473. },
  44474. args: ["firstArgument", "secondArgument", "thirdArgument"],
  44475. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  44476. referencedClasses: [],
  44477. messageSends: ["valueWithPossibleArguments:"]
  44478. }),
  44479. $globals.AIBlockClosure);
  44480. $core.addMethod(
  44481. $core.method({
  44482. selector: "valueWithPossibleArguments:",
  44483. protocol: "evaluating",
  44484. fn: function (aCollection){
  44485. var self=this,$self=this;
  44486. var context,sequenceNode;
  44487. return $core.withContext(function($ctx1) {
  44488. var $1,$2,$3;
  44489. context=$recv($self["@outerContext"])._newInnerContext();
  44490. $1=$recv($recv($recv($self["@node"])._dagChildren())._first())._copy();
  44491. $recv($1)._parent_(nil);
  44492. sequenceNode=$recv($1)._yourself();
  44493. $recv($recv(sequenceNode)._temps())._do_((function(each){
  44494. return $core.withContext(function($ctx2) {
  44495. return $recv(context)._defineLocal_(each);
  44496. $ctx2.sendIdx["defineLocal:"]=1;
  44497. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44498. }));
  44499. $recv($recv($self["@node"])._parameters())._withIndexDo_((function(each,index){
  44500. return $core.withContext(function($ctx2) {
  44501. $recv(context)._defineLocal_(each);
  44502. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  44503. return nil;
  44504. })));
  44505. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  44506. }));
  44507. $2=$recv(context)._interpreter();
  44508. $ctx1.sendIdx["interpreter"]=1;
  44509. $recv($2)._node_(sequenceNode);
  44510. $recv($2)._enterNode();
  44511. $recv($2)._proceed();
  44512. $3=$recv($self["@outerContext"])._interpreter();
  44513. $ctx1.sendIdx["interpreter"]=2;
  44514. $recv($3)._setNonLocalReturnFromContext_(context);
  44515. return $recv($recv(context)._interpreter())._pop();
  44516. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  44517. },
  44518. args: ["aCollection"],
  44519. 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",
  44520. referencedClasses: [],
  44521. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  44522. }),
  44523. $globals.AIBlockClosure);
  44524. $core.addMethod(
  44525. $core.method({
  44526. selector: "forContext:node:",
  44527. protocol: "instance creation",
  44528. fn: function (aContext,aNode){
  44529. var self=this,$self=this;
  44530. return $core.withContext(function($ctx1) {
  44531. var $1;
  44532. $1=$self._new();
  44533. $recv($1)._initializeWithContext_node_(aContext,aNode);
  44534. return $recv($1)._yourself();
  44535. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.a$cls)});
  44536. },
  44537. args: ["aContext", "aNode"],
  44538. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  44539. referencedClasses: [],
  44540. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  44541. }),
  44542. $globals.AIBlockClosure.a$cls);
  44543. $core.addClass("AIContext", $globals.MethodContext, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  44544. $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)";
  44545. $core.addMethod(
  44546. $core.method({
  44547. selector: "arguments",
  44548. protocol: "interpreting",
  44549. fn: function (){
  44550. var self=this,$self=this;
  44551. return $core.withContext(function($ctx1) {
  44552. return $recv($recv($self._ast())._arguments())._collect_((function(each){
  44553. return $core.withContext(function($ctx2) {
  44554. return $self._localAt_ifAbsent_(each,(function(){
  44555. return $core.withContext(function($ctx3) {
  44556. return $self._error_("Argument not in context");
  44557. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44558. }));
  44559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44560. }));
  44561. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  44562. },
  44563. args: [],
  44564. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  44565. referencedClasses: [],
  44566. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  44567. }),
  44568. $globals.AIContext);
  44569. $core.addMethod(
  44570. $core.method({
  44571. selector: "ast",
  44572. protocol: "interpreting",
  44573. fn: function (){
  44574. var self=this,$self=this;
  44575. return $core.withContext(function($ctx1) {
  44576. var $1,$2,$3,$receiver;
  44577. $1=$self._isBlockContext();
  44578. if($core.assert($1)){
  44579. $2=$self._outerContext();
  44580. if(($receiver = $2) == null || $receiver.a$nil){
  44581. return $2;
  44582. } else {
  44583. var context;
  44584. context=$receiver;
  44585. return $recv(context)._ast();
  44586. }
  44587. }
  44588. $3=$self["@ast"];
  44589. if(($receiver = $3) == null || $receiver.a$nil){
  44590. $self._initializeAST();
  44591. } else {
  44592. $3;
  44593. }
  44594. return $self["@ast"];
  44595. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  44596. },
  44597. args: [],
  44598. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  44599. referencedClasses: [],
  44600. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  44601. }),
  44602. $globals.AIContext);
  44603. $core.addMethod(
  44604. $core.method({
  44605. selector: "basicLocalAt:",
  44606. protocol: "private",
  44607. fn: function (aString){
  44608. var self=this,$self=this;
  44609. return $core.withContext(function($ctx1) {
  44610. return $recv($self._locals())._at_(aString);
  44611. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  44612. },
  44613. args: ["aString"],
  44614. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  44615. referencedClasses: [],
  44616. messageSends: ["at:", "locals"]
  44617. }),
  44618. $globals.AIContext);
  44619. $core.addMethod(
  44620. $core.method({
  44621. selector: "basicLocalAt:put:",
  44622. protocol: "private",
  44623. fn: function (aString,anObject){
  44624. var self=this,$self=this;
  44625. return $core.withContext(function($ctx1) {
  44626. $recv($self._locals())._at_put_(aString,anObject);
  44627. return self;
  44628. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  44629. },
  44630. args: ["aString", "anObject"],
  44631. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  44632. referencedClasses: [],
  44633. messageSends: ["at:put:", "locals"]
  44634. }),
  44635. $globals.AIContext);
  44636. $core.addMethod(
  44637. $core.method({
  44638. selector: "basicReceiver",
  44639. protocol: "interpreting",
  44640. fn: function (){
  44641. var self=this,$self=this;
  44642. return $core.withContext(function($ctx1) {
  44643. return $self._localAt_("self");
  44644. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  44645. },
  44646. args: [],
  44647. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  44648. referencedClasses: [],
  44649. messageSends: ["localAt:"]
  44650. }),
  44651. $globals.AIContext);
  44652. $core.addMethod(
  44653. $core.method({
  44654. selector: "defineLocal:",
  44655. protocol: "accessing",
  44656. fn: function (aString){
  44657. var self=this,$self=this;
  44658. return $core.withContext(function($ctx1) {
  44659. $recv($self._locals())._at_put_(aString,nil);
  44660. return self;
  44661. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  44662. },
  44663. args: ["aString"],
  44664. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  44665. referencedClasses: [],
  44666. messageSends: ["at:put:", "locals"]
  44667. }),
  44668. $globals.AIContext);
  44669. $core.addMethod(
  44670. $core.method({
  44671. selector: "evaluate:on:",
  44672. protocol: "evaluating",
  44673. fn: function (aString,anEvaluator){
  44674. var self=this,$self=this;
  44675. return $core.withContext(function($ctx1) {
  44676. return $recv(anEvaluator)._evaluate_context_(aString,self);
  44677. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  44678. },
  44679. args: ["aString", "anEvaluator"],
  44680. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  44681. referencedClasses: [],
  44682. messageSends: ["evaluate:context:"]
  44683. }),
  44684. $globals.AIContext);
  44685. $core.addMethod(
  44686. $core.method({
  44687. selector: "evaluateNode:",
  44688. protocol: "evaluating",
  44689. fn: function (aNode){
  44690. var self=this,$self=this;
  44691. return $core.withContext(function($ctx1) {
  44692. var $1;
  44693. $1=$recv($globals.ASTInterpreter)._new();
  44694. $recv($1)._context_(self);
  44695. $recv($1)._node_(aNode);
  44696. $recv($1)._enterNode();
  44697. $recv($1)._proceed();
  44698. return $recv($1)._result();
  44699. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  44700. },
  44701. args: ["aNode"],
  44702. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  44703. referencedClasses: ["ASTInterpreter"],
  44704. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  44705. }),
  44706. $globals.AIContext);
  44707. $core.addMethod(
  44708. $core.method({
  44709. selector: "evaluatedSelector",
  44710. protocol: "accessing",
  44711. fn: function (){
  44712. var self=this,$self=this;
  44713. return $self["@evaluatedSelector"];
  44714. },
  44715. args: [],
  44716. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  44717. referencedClasses: [],
  44718. messageSends: []
  44719. }),
  44720. $globals.AIContext);
  44721. $core.addMethod(
  44722. $core.method({
  44723. selector: "evaluatedSelector:",
  44724. protocol: "accessing",
  44725. fn: function (aString){
  44726. var self=this,$self=this;
  44727. $self["@evaluatedSelector"]=aString;
  44728. return self;
  44729. },
  44730. args: ["aString"],
  44731. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  44732. referencedClasses: [],
  44733. messageSends: []
  44734. }),
  44735. $globals.AIContext);
  44736. $core.addMethod(
  44737. $core.method({
  44738. selector: "index",
  44739. protocol: "accessing",
  44740. fn: function (){
  44741. var self=this,$self=this;
  44742. return $core.withContext(function($ctx1) {
  44743. var $1,$receiver;
  44744. $1=$self["@index"];
  44745. if(($receiver = $1) == null || $receiver.a$nil){
  44746. return (0);
  44747. } else {
  44748. return $1;
  44749. }
  44750. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  44751. },
  44752. args: [],
  44753. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  44754. referencedClasses: [],
  44755. messageSends: ["ifNil:"]
  44756. }),
  44757. $globals.AIContext);
  44758. $core.addMethod(
  44759. $core.method({
  44760. selector: "index:",
  44761. protocol: "accessing",
  44762. fn: function (anInteger){
  44763. var self=this,$self=this;
  44764. $self["@index"]=anInteger;
  44765. return self;
  44766. },
  44767. args: ["anInteger"],
  44768. source: "index: anInteger\x0a\x09index := anInteger",
  44769. referencedClasses: [],
  44770. messageSends: []
  44771. }),
  44772. $globals.AIContext);
  44773. $core.addMethod(
  44774. $core.method({
  44775. selector: "initializeAST",
  44776. protocol: "initialization",
  44777. fn: function (){
  44778. var self=this,$self=this;
  44779. return $core.withContext(function($ctx1) {
  44780. var $1;
  44781. $1=$self._method();
  44782. $ctx1.sendIdx["method"]=1;
  44783. $self["@ast"]=$recv($1)._ast();
  44784. $recv($recv($globals.SemanticAnalyzer)._on_($recv($self._method())._methodClass()))._visit_($self["@ast"]);
  44785. return self;
  44786. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  44787. },
  44788. args: [],
  44789. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  44790. referencedClasses: ["SemanticAnalyzer"],
  44791. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  44792. }),
  44793. $globals.AIContext);
  44794. $core.addMethod(
  44795. $core.method({
  44796. selector: "initializeFromMethodContext:",
  44797. protocol: "initialization",
  44798. fn: function (aMethodContext){
  44799. var self=this,$self=this;
  44800. return $core.withContext(function($ctx1) {
  44801. var $1,$2,$3,$receiver;
  44802. $self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  44803. $self._index_($recv(aMethodContext)._index());
  44804. $self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  44805. $self._receiver_($recv(aMethodContext)._receiver());
  44806. $self._supercall_($recv(aMethodContext)._supercall());
  44807. $self._selector_($recv(aMethodContext)._selector());
  44808. $1=$recv(aMethodContext)._outerContext();
  44809. $ctx1.sendIdx["outerContext"]=1;
  44810. if(($receiver = $1) == null || $receiver.a$nil){
  44811. $1;
  44812. } else {
  44813. var outer;
  44814. outer=$receiver;
  44815. $2=$recv(outer)._methodContext();
  44816. if(($receiver = $2) == null || $receiver.a$nil){
  44817. $2;
  44818. } else {
  44819. $self._outerContext_($recv($self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  44820. }
  44821. $3=$recv(aMethodContext)._locals();
  44822. $ctx1.sendIdx["locals"]=1;
  44823. $recv($3)._keysAndValuesDo_((function(key,value){
  44824. return $core.withContext(function($ctx2) {
  44825. return $recv($self._locals())._at_put_(key,value);
  44826. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  44827. }));
  44828. }
  44829. return self;
  44830. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  44831. },
  44832. args: ["aMethodContext"],
  44833. 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 ] ]",
  44834. referencedClasses: [],
  44835. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  44836. }),
  44837. $globals.AIContext);
  44838. $core.addMethod(
  44839. $core.method({
  44840. selector: "initializeInterpreter",
  44841. protocol: "initialization",
  44842. fn: function (){
  44843. var self=this,$self=this;
  44844. return $core.withContext(function($ctx1) {
  44845. var $1,$2,$receiver;
  44846. $1=$recv($globals.ASTInterpreter)._new();
  44847. $recv($1)._context_(self);
  44848. $self["@interpreter"]=$recv($1)._yourself();
  44849. $2=$self._innerContext();
  44850. if(($receiver = $2) == null || $receiver.a$nil){
  44851. $2;
  44852. } else {
  44853. $self._setupInterpreter_($self["@interpreter"]);
  44854. }
  44855. return self;
  44856. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  44857. },
  44858. args: [],
  44859. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  44860. referencedClasses: ["ASTInterpreter"],
  44861. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  44862. }),
  44863. $globals.AIContext);
  44864. $core.addMethod(
  44865. $core.method({
  44866. selector: "initializeLocals",
  44867. protocol: "initialization",
  44868. fn: function (){
  44869. var self=this,$self=this;
  44870. return $core.withContext(function($ctx1) {
  44871. $self["@locals"]=$recv($globals.Dictionary)._new();
  44872. $recv($self["@locals"])._at_put_("thisContext",self);
  44873. return self;
  44874. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  44875. },
  44876. args: [],
  44877. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  44878. referencedClasses: ["Dictionary"],
  44879. messageSends: ["new", "at:put:"]
  44880. }),
  44881. $globals.AIContext);
  44882. $core.addMethod(
  44883. $core.method({
  44884. selector: "innerContext",
  44885. protocol: "accessing",
  44886. fn: function (){
  44887. var self=this,$self=this;
  44888. return $self["@innerContext"];
  44889. },
  44890. args: [],
  44891. source: "innerContext\x0a\x09^ innerContext",
  44892. referencedClasses: [],
  44893. messageSends: []
  44894. }),
  44895. $globals.AIContext);
  44896. $core.addMethod(
  44897. $core.method({
  44898. selector: "innerContext:",
  44899. protocol: "accessing",
  44900. fn: function (anAIContext){
  44901. var self=this,$self=this;
  44902. $self["@innerContext"]=anAIContext;
  44903. return self;
  44904. },
  44905. args: ["anAIContext"],
  44906. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  44907. referencedClasses: [],
  44908. messageSends: []
  44909. }),
  44910. $globals.AIContext);
  44911. $core.addMethod(
  44912. $core.method({
  44913. selector: "interpreter",
  44914. protocol: "interpreting",
  44915. fn: function (){
  44916. var self=this,$self=this;
  44917. return $core.withContext(function($ctx1) {
  44918. var $1,$receiver;
  44919. $1=$self["@interpreter"];
  44920. if(($receiver = $1) == null || $receiver.a$nil){
  44921. $self._initializeInterpreter();
  44922. } else {
  44923. $1;
  44924. }
  44925. return $self["@interpreter"];
  44926. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  44927. },
  44928. args: [],
  44929. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  44930. referencedClasses: [],
  44931. messageSends: ["ifNil:", "initializeInterpreter"]
  44932. }),
  44933. $globals.AIContext);
  44934. $core.addMethod(
  44935. $core.method({
  44936. selector: "interpreter:",
  44937. protocol: "interpreting",
  44938. fn: function (anInterpreter){
  44939. var self=this,$self=this;
  44940. $self["@interpreter"]=anInterpreter;
  44941. return self;
  44942. },
  44943. args: ["anInterpreter"],
  44944. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  44945. referencedClasses: [],
  44946. messageSends: []
  44947. }),
  44948. $globals.AIContext);
  44949. $core.addMethod(
  44950. $core.method({
  44951. selector: "isTopContext",
  44952. protocol: "testing",
  44953. fn: function (){
  44954. var self=this,$self=this;
  44955. return $core.withContext(function($ctx1) {
  44956. return $recv($self._innerContext())._isNil();
  44957. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  44958. },
  44959. args: [],
  44960. source: "isTopContext\x0a\x09^ self innerContext isNil",
  44961. referencedClasses: [],
  44962. messageSends: ["isNil", "innerContext"]
  44963. }),
  44964. $globals.AIContext);
  44965. $core.addMethod(
  44966. $core.method({
  44967. selector: "localAt:",
  44968. protocol: "accessing",
  44969. fn: function (aString){
  44970. var self=this,$self=this;
  44971. var context;
  44972. return $core.withContext(function($ctx1) {
  44973. context=$self._lookupContextForLocal_(aString);
  44974. return $recv(context)._basicLocalAt_(aString);
  44975. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  44976. },
  44977. args: ["aString"],
  44978. 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",
  44979. referencedClasses: [],
  44980. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  44981. }),
  44982. $globals.AIContext);
  44983. $core.addMethod(
  44984. $core.method({
  44985. selector: "localAt:ifAbsent:",
  44986. protocol: "accessing",
  44987. fn: function (aString,aBlock){
  44988. var self=this,$self=this;
  44989. var context;
  44990. return $core.withContext(function($ctx1) {
  44991. var $early={};
  44992. try {
  44993. context=$self._lookupContextForLocal_ifNone_(aString,(function(){
  44994. return $core.withContext(function($ctx2) {
  44995. throw $early=[$recv(aBlock)._value()];
  44996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44997. }));
  44998. return $recv(context)._basicLocalAt_(aString);
  44999. }
  45000. catch(e) {if(e===$early)return e[0]; throw e}
  45001. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  45002. },
  45003. args: ["aString", "aBlock"],
  45004. 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",
  45005. referencedClasses: [],
  45006. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  45007. }),
  45008. $globals.AIContext);
  45009. $core.addMethod(
  45010. $core.method({
  45011. selector: "localAt:put:",
  45012. protocol: "accessing",
  45013. fn: function (aString,anObject){
  45014. var self=this,$self=this;
  45015. var context;
  45016. return $core.withContext(function($ctx1) {
  45017. context=$self._lookupContextForLocal_(aString);
  45018. $recv(context)._basicLocalAt_put_(aString,anObject);
  45019. return self;
  45020. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  45021. },
  45022. args: ["aString", "anObject"],
  45023. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  45024. referencedClasses: [],
  45025. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  45026. }),
  45027. $globals.AIContext);
  45028. $core.addMethod(
  45029. $core.method({
  45030. selector: "locals",
  45031. protocol: "accessing",
  45032. fn: function (){
  45033. var self=this,$self=this;
  45034. return $core.withContext(function($ctx1) {
  45035. var $1,$receiver;
  45036. $1=$self["@locals"];
  45037. if(($receiver = $1) == null || $receiver.a$nil){
  45038. $self._initializeLocals();
  45039. } else {
  45040. $1;
  45041. }
  45042. return $self["@locals"];
  45043. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  45044. },
  45045. args: [],
  45046. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  45047. referencedClasses: [],
  45048. messageSends: ["ifNil:", "initializeLocals"]
  45049. }),
  45050. $globals.AIContext);
  45051. $core.addMethod(
  45052. $core.method({
  45053. selector: "lookupContextForLocal:",
  45054. protocol: "private",
  45055. fn: function (aString){
  45056. var self=this,$self=this;
  45057. return $core.withContext(function($ctx1) {
  45058. return $self._lookupContextForLocal_ifNone_(aString,(function(){
  45059. return $core.withContext(function($ctx2) {
  45060. return $self._variableNotFound();
  45061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45062. }));
  45063. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  45064. },
  45065. args: ["aString"],
  45066. 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 ]",
  45067. referencedClasses: [],
  45068. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  45069. }),
  45070. $globals.AIContext);
  45071. $core.addMethod(
  45072. $core.method({
  45073. selector: "lookupContextForLocal:ifNone:",
  45074. protocol: "private",
  45075. fn: function (aString,aBlock){
  45076. var self=this,$self=this;
  45077. return $core.withContext(function($ctx1) {
  45078. var $1;
  45079. return $recv($self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  45080. return self;
  45081. }),(function(){
  45082. return $core.withContext(function($ctx2) {
  45083. $1=$self._outerContext();
  45084. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  45085. return $core.withContext(function($ctx3) {
  45086. return $recv(context)._lookupContextForLocal_(aString);
  45087. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  45088. }));
  45089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45090. }));
  45091. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  45092. },
  45093. args: ["aString", "aBlock"],
  45094. 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 ] ]",
  45095. referencedClasses: [],
  45096. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  45097. }),
  45098. $globals.AIContext);
  45099. $core.addMethod(
  45100. $core.method({
  45101. selector: "newInnerContext",
  45102. protocol: "factory",
  45103. fn: function (){
  45104. var self=this,$self=this;
  45105. return $core.withContext(function($ctx1) {
  45106. var $1;
  45107. $1=$recv($self._class())._new();
  45108. $recv($1)._outerContext_(self);
  45109. return $recv($1)._yourself();
  45110. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  45111. },
  45112. args: [],
  45113. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  45114. referencedClasses: [],
  45115. messageSends: ["outerContext:", "new", "class", "yourself"]
  45116. }),
  45117. $globals.AIContext);
  45118. $core.addMethod(
  45119. $core.method({
  45120. selector: "outerContext",
  45121. protocol: "accessing",
  45122. fn: function (){
  45123. var self=this,$self=this;
  45124. return $self["@outerContext"];
  45125. },
  45126. args: [],
  45127. source: "outerContext\x0a\x09^ outerContext",
  45128. referencedClasses: [],
  45129. messageSends: []
  45130. }),
  45131. $globals.AIContext);
  45132. $core.addMethod(
  45133. $core.method({
  45134. selector: "outerContext:",
  45135. protocol: "accessing",
  45136. fn: function (anAIContext){
  45137. var self=this,$self=this;
  45138. return $core.withContext(function($ctx1) {
  45139. var $1,$receiver;
  45140. $self["@outerContext"]=anAIContext;
  45141. $1=$self["@outerContext"];
  45142. if(($receiver = $1) == null || $receiver.a$nil){
  45143. $1;
  45144. } else {
  45145. var context;
  45146. context=$receiver;
  45147. $recv(context)._innerContext_(self);
  45148. }
  45149. return self;
  45150. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  45151. },
  45152. args: ["anAIContext"],
  45153. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  45154. referencedClasses: [],
  45155. messageSends: ["ifNotNil:", "innerContext:"]
  45156. }),
  45157. $globals.AIContext);
  45158. $core.addMethod(
  45159. $core.method({
  45160. selector: "receiver:",
  45161. protocol: "interpreting",
  45162. fn: function (anObject){
  45163. var self=this,$self=this;
  45164. return $core.withContext(function($ctx1) {
  45165. $recv($self._locals())._at_put_("self",anObject);
  45166. return self;
  45167. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  45168. },
  45169. args: ["anObject"],
  45170. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  45171. referencedClasses: [],
  45172. messageSends: ["at:put:", "locals"]
  45173. }),
  45174. $globals.AIContext);
  45175. $core.addMethod(
  45176. $core.method({
  45177. selector: "selector",
  45178. protocol: "accessing",
  45179. fn: function (){
  45180. var self=this,$self=this;
  45181. return $self["@selector"];
  45182. },
  45183. args: [],
  45184. source: "selector\x0a\x09^ selector",
  45185. referencedClasses: [],
  45186. messageSends: []
  45187. }),
  45188. $globals.AIContext);
  45189. $core.addMethod(
  45190. $core.method({
  45191. selector: "selector:",
  45192. protocol: "accessing",
  45193. fn: function (aString){
  45194. var self=this,$self=this;
  45195. $self["@selector"]=aString;
  45196. return self;
  45197. },
  45198. args: ["aString"],
  45199. source: "selector: aString\x0a\x09selector := aString",
  45200. referencedClasses: [],
  45201. messageSends: []
  45202. }),
  45203. $globals.AIContext);
  45204. $core.addMethod(
  45205. $core.method({
  45206. selector: "sendIndexAt:",
  45207. protocol: "accessing",
  45208. fn: function (aString){
  45209. var self=this,$self=this;
  45210. return $core.withContext(function($ctx1) {
  45211. return $recv($self._sendIndexes())._at_ifAbsent_(aString,(function(){
  45212. return (0);
  45213. }));
  45214. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  45215. },
  45216. args: ["aString"],
  45217. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  45218. referencedClasses: [],
  45219. messageSends: ["at:ifAbsent:", "sendIndexes"]
  45220. }),
  45221. $globals.AIContext);
  45222. $core.addMethod(
  45223. $core.method({
  45224. selector: "sendIndexes",
  45225. protocol: "accessing",
  45226. fn: function (){
  45227. var self=this,$self=this;
  45228. return $core.withContext(function($ctx1) {
  45229. var $1,$receiver;
  45230. $1=$self["@sendIndexes"];
  45231. if(($receiver = $1) == null || $receiver.a$nil){
  45232. return $recv($globals.Dictionary)._new();
  45233. } else {
  45234. return $1;
  45235. }
  45236. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  45237. },
  45238. args: [],
  45239. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  45240. referencedClasses: ["Dictionary"],
  45241. messageSends: ["ifNil:", "new"]
  45242. }),
  45243. $globals.AIContext);
  45244. $core.addMethod(
  45245. $core.method({
  45246. selector: "sendIndexes:",
  45247. protocol: "accessing",
  45248. fn: function (aDictionary){
  45249. var self=this,$self=this;
  45250. $self["@sendIndexes"]=aDictionary;
  45251. return self;
  45252. },
  45253. args: ["aDictionary"],
  45254. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  45255. referencedClasses: [],
  45256. messageSends: []
  45257. }),
  45258. $globals.AIContext);
  45259. $core.addMethod(
  45260. $core.method({
  45261. selector: "setupInterpreter:",
  45262. protocol: "interpreting",
  45263. fn: function (anInterpreter){
  45264. var self=this,$self=this;
  45265. var currentNode;
  45266. return $core.withContext(function($ctx1) {
  45267. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  45268. $1=$recv($globals.ASTPCNodeVisitor)._new();
  45269. $2=$self._evaluatedSelector();
  45270. $ctx1.sendIdx["evaluatedSelector"]=1;
  45271. $recv($1)._selector_($2);
  45272. $recv($1)._index_($self._sendIndexAt_($self._evaluatedSelector()));
  45273. $3=$self._ast();
  45274. $ctx1.sendIdx["ast"]=1;
  45275. $recv($1)._visit_($3);
  45276. currentNode=$recv($1)._currentNode();
  45277. $4=$recv($self._ast())._sequenceNode();
  45278. if(($receiver = $4) == null || $receiver.a$nil){
  45279. $4;
  45280. } else {
  45281. var sequence;
  45282. sequence=$receiver;
  45283. $recv($recv(sequence)._temps())._do_((function(each){
  45284. return $core.withContext(function($ctx2) {
  45285. return $self._defineLocal_(each);
  45286. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  45287. }));
  45288. $ctx1.sendIdx["do:"]=1;
  45289. }
  45290. $recv(anInterpreter)._node_(currentNode);
  45291. $7=$self._innerContext();
  45292. $ctx1.sendIdx["innerContext"]=1;
  45293. $6=$recv($7)._arguments();
  45294. $5=$recv($6)._reversed();
  45295. $recv($5)._do_((function(each){
  45296. return $core.withContext(function($ctx2) {
  45297. return $recv(anInterpreter)._push_(each);
  45298. $ctx2.sendIdx["push:"]=1;
  45299. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  45300. }));
  45301. $recv(anInterpreter)._push_($recv($self._innerContext())._receiver());
  45302. return self;
  45303. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  45304. },
  45305. args: ["anInterpreter"],
  45306. 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)",
  45307. referencedClasses: ["ASTPCNodeVisitor"],
  45308. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  45309. }),
  45310. $globals.AIContext);
  45311. $core.addMethod(
  45312. $core.method({
  45313. selector: "supercall",
  45314. protocol: "interpreting",
  45315. fn: function (){
  45316. var self=this,$self=this;
  45317. return $core.withContext(function($ctx1) {
  45318. var $1,$receiver;
  45319. $1=$self["@supercall"];
  45320. if(($receiver = $1) == null || $receiver.a$nil){
  45321. return false;
  45322. } else {
  45323. return $1;
  45324. }
  45325. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  45326. },
  45327. args: [],
  45328. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  45329. referencedClasses: [],
  45330. messageSends: ["ifNil:"]
  45331. }),
  45332. $globals.AIContext);
  45333. $core.addMethod(
  45334. $core.method({
  45335. selector: "supercall:",
  45336. protocol: "interpreting",
  45337. fn: function (aBoolean){
  45338. var self=this,$self=this;
  45339. $self["@supercall"]=aBoolean;
  45340. return self;
  45341. },
  45342. args: ["aBoolean"],
  45343. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  45344. referencedClasses: [],
  45345. messageSends: []
  45346. }),
  45347. $globals.AIContext);
  45348. $core.addMethod(
  45349. $core.method({
  45350. selector: "variableNotFound",
  45351. protocol: "error handling",
  45352. fn: function (){
  45353. var self=this,$self=this;
  45354. return $core.withContext(function($ctx1) {
  45355. $self._error_("Variable missing");
  45356. return self;
  45357. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  45358. },
  45359. args: [],
  45360. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  45361. referencedClasses: [],
  45362. messageSends: ["error:"]
  45363. }),
  45364. $globals.AIContext);
  45365. $core.addMethod(
  45366. $core.method({
  45367. selector: "fromMethodContext:",
  45368. protocol: "instance creation",
  45369. fn: function (aMethodContext){
  45370. var self=this,$self=this;
  45371. return $core.withContext(function($ctx1) {
  45372. var $1;
  45373. $1=$self._new();
  45374. $recv($1)._initializeFromMethodContext_(aMethodContext);
  45375. return $recv($1)._yourself();
  45376. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.a$cls)});
  45377. },
  45378. args: ["aMethodContext"],
  45379. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  45380. referencedClasses: [],
  45381. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  45382. }),
  45383. $globals.AIContext.a$cls);
  45384. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  45385. $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.";
  45386. $core.addMethod(
  45387. $core.method({
  45388. selector: "context",
  45389. protocol: "accessing",
  45390. fn: function (){
  45391. var self=this,$self=this;
  45392. return $self["@context"];
  45393. },
  45394. args: [],
  45395. source: "context\x0a\x09^ context",
  45396. referencedClasses: [],
  45397. messageSends: []
  45398. }),
  45399. $globals.AISemanticAnalyzer);
  45400. $core.addMethod(
  45401. $core.method({
  45402. selector: "context:",
  45403. protocol: "accessing",
  45404. fn: function (anAIContext){
  45405. var self=this,$self=this;
  45406. $self["@context"]=anAIContext;
  45407. return self;
  45408. },
  45409. args: ["anAIContext"],
  45410. source: "context: anAIContext\x0a\x09context := anAIContext",
  45411. referencedClasses: [],
  45412. messageSends: []
  45413. }),
  45414. $globals.AISemanticAnalyzer);
  45415. $core.addMethod(
  45416. $core.method({
  45417. selector: "visitVariableNode:",
  45418. protocol: "visiting",
  45419. fn: function (aNode){
  45420. var self=this,$self=this;
  45421. return $core.withContext(function($ctx1) {
  45422. var $1;
  45423. var $early={};
  45424. try {
  45425. $recv($self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  45426. return $core.withContext(function($ctx2) {
  45427. $1=(
  45428. $ctx2.supercall = true,
  45429. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($self, [aNode]));
  45430. $ctx2.supercall = false;
  45431. throw $early=[$1];
  45432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45433. }));
  45434. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  45435. return self;
  45436. }
  45437. catch(e) {if(e===$early)return e[0]; throw e}
  45438. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  45439. },
  45440. args: ["aNode"],
  45441. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  45442. referencedClasses: ["ASTContextVar"],
  45443. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  45444. }),
  45445. $globals.AISemanticAnalyzer);
  45446. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  45447. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  45448. $core.addMethod(
  45449. $core.method({
  45450. selector: "context",
  45451. protocol: "accessing",
  45452. fn: function (){
  45453. var self=this,$self=this;
  45454. return $self["@context"];
  45455. },
  45456. args: [],
  45457. source: "context\x0a\x09^ context",
  45458. referencedClasses: [],
  45459. messageSends: []
  45460. }),
  45461. $globals.ASTContextVar);
  45462. $core.addMethod(
  45463. $core.method({
  45464. selector: "context:",
  45465. protocol: "accessing",
  45466. fn: function (anObject){
  45467. var self=this,$self=this;
  45468. $self["@context"]=anObject;
  45469. return self;
  45470. },
  45471. args: ["anObject"],
  45472. source: "context: anObject\x0a\x09context := anObject",
  45473. referencedClasses: [],
  45474. messageSends: []
  45475. }),
  45476. $globals.ASTContextVar);
  45477. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  45478. $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.";
  45479. $core.addMethod(
  45480. $core.method({
  45481. selector: "atEnd",
  45482. protocol: "testing",
  45483. fn: function (){
  45484. var self=this,$self=this;
  45485. return $core.withContext(function($ctx1) {
  45486. var $1,$receiver;
  45487. $1=$self._context();
  45488. $ctx1.sendIdx["context"]=1;
  45489. if(($receiver = $1) == null || $receiver.a$nil){
  45490. return true;
  45491. } else {
  45492. $1;
  45493. }
  45494. return $recv($recv($self._interpreter())._atEnd())._and_((function(){
  45495. return $core.withContext(function($ctx2) {
  45496. return $recv($self._context())._isTopContext();
  45497. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45498. }));
  45499. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  45500. },
  45501. args: [],
  45502. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  45503. referencedClasses: [],
  45504. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  45505. }),
  45506. $globals.ASTDebugger);
  45507. $core.addMethod(
  45508. $core.method({
  45509. selector: "context",
  45510. protocol: "accessing",
  45511. fn: function (){
  45512. var self=this,$self=this;
  45513. return $self["@context"];
  45514. },
  45515. args: [],
  45516. source: "context\x0a\x09^ context",
  45517. referencedClasses: [],
  45518. messageSends: []
  45519. }),
  45520. $globals.ASTDebugger);
  45521. $core.addMethod(
  45522. $core.method({
  45523. selector: "context:",
  45524. protocol: "accessing",
  45525. fn: function (aContext){
  45526. var self=this,$self=this;
  45527. $self["@context"]=aContext;
  45528. return self;
  45529. },
  45530. args: ["aContext"],
  45531. source: "context: aContext\x0a\x09context := aContext",
  45532. referencedClasses: [],
  45533. messageSends: []
  45534. }),
  45535. $globals.ASTDebugger);
  45536. $core.addMethod(
  45537. $core.method({
  45538. selector: "flushInnerContexts",
  45539. protocol: "actions",
  45540. fn: function (){
  45541. var self=this,$self=this;
  45542. return $core.withContext(function($ctx1) {
  45543. var $1,$receiver;
  45544. $1=$self._context();
  45545. if(($receiver = $1) == null || $receiver.a$nil){
  45546. $1;
  45547. } else {
  45548. var cxt;
  45549. cxt=$receiver;
  45550. $recv(cxt)._innerContext_(nil);
  45551. }
  45552. return self;
  45553. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  45554. },
  45555. args: [],
  45556. 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 ]",
  45557. referencedClasses: [],
  45558. messageSends: ["ifNotNil:", "context", "innerContext:"]
  45559. }),
  45560. $globals.ASTDebugger);
  45561. $core.addMethod(
  45562. $core.method({
  45563. selector: "interpreter",
  45564. protocol: "accessing",
  45565. fn: function (){
  45566. var self=this,$self=this;
  45567. return $core.withContext(function($ctx1) {
  45568. var $1,$receiver;
  45569. $1=$self._context();
  45570. if(($receiver = $1) == null || $receiver.a$nil){
  45571. return $1;
  45572. } else {
  45573. var ctx;
  45574. ctx=$receiver;
  45575. return $recv(ctx)._interpreter();
  45576. }
  45577. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  45578. },
  45579. args: [],
  45580. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  45581. referencedClasses: [],
  45582. messageSends: ["ifNotNil:", "context", "interpreter"]
  45583. }),
  45584. $globals.ASTDebugger);
  45585. $core.addMethod(
  45586. $core.method({
  45587. selector: "method",
  45588. protocol: "accessing",
  45589. fn: function (){
  45590. var self=this,$self=this;
  45591. return $core.withContext(function($ctx1) {
  45592. return $recv($self._context())._method();
  45593. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  45594. },
  45595. args: [],
  45596. source: "method\x0a\x09^ self context method",
  45597. referencedClasses: [],
  45598. messageSends: ["method", "context"]
  45599. }),
  45600. $globals.ASTDebugger);
  45601. $core.addMethod(
  45602. $core.method({
  45603. selector: "node",
  45604. protocol: "accessing",
  45605. fn: function (){
  45606. var self=this,$self=this;
  45607. return $core.withContext(function($ctx1) {
  45608. var $1,$receiver;
  45609. $1=$self._interpreter();
  45610. $ctx1.sendIdx["interpreter"]=1;
  45611. if(($receiver = $1) == null || $receiver.a$nil){
  45612. return $1;
  45613. } else {
  45614. return $recv($self._interpreter())._node();
  45615. }
  45616. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  45617. },
  45618. args: [],
  45619. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  45620. referencedClasses: [],
  45621. messageSends: ["ifNotNil:", "interpreter", "node"]
  45622. }),
  45623. $globals.ASTDebugger);
  45624. $core.addMethod(
  45625. $core.method({
  45626. selector: "onStep",
  45627. protocol: "private",
  45628. fn: function (){
  45629. var self=this,$self=this;
  45630. return $core.withContext(function($ctx1) {
  45631. var $1,$3,$2,$4,$6,$5,$receiver;
  45632. $1=$self._interpreter();
  45633. $ctx1.sendIdx["interpreter"]=1;
  45634. $self["@result"]=$recv($1)._result();
  45635. $3=$self._interpreter();
  45636. $ctx1.sendIdx["interpreter"]=2;
  45637. $2=$recv($3)._atEnd();
  45638. $ctx1.sendIdx["atEnd"]=1;
  45639. if($core.assert($2)){
  45640. $4=$recv($self._context())._outerContext();
  45641. if(($receiver = $4) == null || $receiver.a$nil){
  45642. $4;
  45643. } else {
  45644. var outerContext;
  45645. outerContext=$receiver;
  45646. $self._context_(outerContext);
  45647. }
  45648. $6=$self._interpreter();
  45649. $ctx1.sendIdx["interpreter"]=3;
  45650. $5=$recv($6)._atEnd();
  45651. if(!$core.assert($5)){
  45652. $recv($self._interpreter())._skip();
  45653. }
  45654. }
  45655. $self._flushInnerContexts();
  45656. return self;
  45657. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  45658. },
  45659. args: [],
  45660. 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",
  45661. referencedClasses: [],
  45662. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  45663. }),
  45664. $globals.ASTDebugger);
  45665. $core.addMethod(
  45666. $core.method({
  45667. selector: "proceed",
  45668. protocol: "stepping",
  45669. fn: function (){
  45670. var self=this,$self=this;
  45671. return $core.withContext(function($ctx1) {
  45672. $recv((function(){
  45673. return $core.withContext(function($ctx2) {
  45674. return $self._atEnd();
  45675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45676. }))._whileFalse_((function(){
  45677. return $core.withContext(function($ctx2) {
  45678. return $self._stepOver();
  45679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45680. }));
  45681. return self;
  45682. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  45683. },
  45684. args: [],
  45685. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  45686. referencedClasses: [],
  45687. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  45688. }),
  45689. $globals.ASTDebugger);
  45690. $core.addMethod(
  45691. $core.method({
  45692. selector: "restart",
  45693. protocol: "stepping",
  45694. fn: function (){
  45695. var self=this,$self=this;
  45696. return $core.withContext(function($ctx1) {
  45697. $recv($self._interpreter())._restart();
  45698. $self._flushInnerContexts();
  45699. return self;
  45700. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  45701. },
  45702. args: [],
  45703. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  45704. referencedClasses: [],
  45705. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  45706. }),
  45707. $globals.ASTDebugger);
  45708. $core.addMethod(
  45709. $core.method({
  45710. selector: "result",
  45711. protocol: "accessing",
  45712. fn: function (){
  45713. var self=this,$self=this;
  45714. return $self["@result"];
  45715. },
  45716. args: [],
  45717. source: "result\x0a\x09^ result",
  45718. referencedClasses: [],
  45719. messageSends: []
  45720. }),
  45721. $globals.ASTDebugger);
  45722. $core.addMethod(
  45723. $core.method({
  45724. selector: "stepInto",
  45725. protocol: "stepping",
  45726. fn: function (){
  45727. var self=this,$self=this;
  45728. return $core.withContext(function($ctx1) {
  45729. $self._shouldBeImplemented();
  45730. return self;
  45731. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  45732. },
  45733. args: [],
  45734. source: "stepInto\x0a\x09self shouldBeImplemented",
  45735. referencedClasses: [],
  45736. messageSends: ["shouldBeImplemented"]
  45737. }),
  45738. $globals.ASTDebugger);
  45739. $core.addMethod(
  45740. $core.method({
  45741. selector: "stepOver",
  45742. protocol: "stepping",
  45743. fn: function (){
  45744. var self=this,$self=this;
  45745. return $core.withContext(function($ctx1) {
  45746. var $1,$2;
  45747. $1=$recv($self._context())._isTopContext();
  45748. if($core.assert($1)){
  45749. $recv($self._interpreter())._stepOver();
  45750. } else {
  45751. $2=$self._interpreter();
  45752. $ctx1.sendIdx["interpreter"]=1;
  45753. $recv($2)._skip();
  45754. }
  45755. $self._onStep();
  45756. return self;
  45757. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  45758. },
  45759. args: [],
  45760. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  45761. referencedClasses: [],
  45762. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  45763. }),
  45764. $globals.ASTDebugger);
  45765. $core.addMethod(
  45766. $core.method({
  45767. selector: "context:",
  45768. protocol: "instance creation",
  45769. fn: function (aContext){
  45770. var self=this,$self=this;
  45771. return $core.withContext(function($ctx1) {
  45772. var $1;
  45773. $1=$self._new();
  45774. $recv($1)._context_(aContext);
  45775. return $recv($1)._yourself();
  45776. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.a$cls)});
  45777. },
  45778. args: ["aContext"],
  45779. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  45780. referencedClasses: [],
  45781. messageSends: ["context:", "new", "yourself"]
  45782. }),
  45783. $globals.ASTDebugger.a$cls);
  45784. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  45785. $core.addMethod(
  45786. $core.method({
  45787. selector: "interpreter",
  45788. protocol: "accessing",
  45789. fn: function (){
  45790. var self=this,$self=this;
  45791. return $self["@interpreter"];
  45792. },
  45793. args: [],
  45794. source: "interpreter\x0a\x09^ interpreter",
  45795. referencedClasses: [],
  45796. messageSends: []
  45797. }),
  45798. $globals.ASTEnterNode);
  45799. $core.addMethod(
  45800. $core.method({
  45801. selector: "interpreter:",
  45802. protocol: "accessing",
  45803. fn: function (anObject){
  45804. var self=this,$self=this;
  45805. $self["@interpreter"]=anObject;
  45806. return self;
  45807. },
  45808. args: ["anObject"],
  45809. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  45810. referencedClasses: [],
  45811. messageSends: []
  45812. }),
  45813. $globals.ASTEnterNode);
  45814. $core.addMethod(
  45815. $core.method({
  45816. selector: "visitBlockNode:",
  45817. protocol: "visiting",
  45818. fn: function (aNode){
  45819. var self=this,$self=this;
  45820. return aNode;
  45821. },
  45822. args: ["aNode"],
  45823. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  45824. referencedClasses: [],
  45825. messageSends: []
  45826. }),
  45827. $globals.ASTEnterNode);
  45828. $core.addMethod(
  45829. $core.method({
  45830. selector: "visitDagNode:",
  45831. protocol: "visiting",
  45832. fn: function (aNode){
  45833. var self=this,$self=this;
  45834. return $core.withContext(function($ctx1) {
  45835. var $early={};
  45836. try {
  45837. $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  45838. throw $early=[aNode];
  45839. }),(function(nodes){
  45840. return $core.withContext(function($ctx2) {
  45841. throw $early=[$self._visit_($recv(nodes)._first())];
  45842. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  45843. }));
  45844. return self;
  45845. }
  45846. catch(e) {if(e===$early)return e[0]; throw e}
  45847. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45848. },
  45849. args: ["aNode"],
  45850. source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  45851. referencedClasses: [],
  45852. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  45853. }),
  45854. $globals.ASTEnterNode);
  45855. $core.addMethod(
  45856. $core.method({
  45857. selector: "visitSequenceNode:",
  45858. protocol: "visiting",
  45859. fn: function (aNode){
  45860. var self=this,$self=this;
  45861. return $core.withContext(function($ctx1) {
  45862. var $1;
  45863. $recv($recv(aNode)._temps())._do_((function(each){
  45864. return $core.withContext(function($ctx2) {
  45865. return $recv($recv($self._interpreter())._context())._defineLocal_(each);
  45866. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45867. }));
  45868. $1=(
  45869. $ctx1.supercall = true,
  45870. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  45871. $ctx1.supercall = false;
  45872. return $1;
  45873. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45874. },
  45875. args: ["aNode"],
  45876. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  45877. referencedClasses: [],
  45878. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  45879. }),
  45880. $globals.ASTEnterNode);
  45881. $core.addMethod(
  45882. $core.method({
  45883. selector: "on:",
  45884. protocol: "instance creation",
  45885. fn: function (anInterpreter){
  45886. var self=this,$self=this;
  45887. return $core.withContext(function($ctx1) {
  45888. var $1;
  45889. $1=$self._new();
  45890. $recv($1)._interpreter_(anInterpreter);
  45891. return $recv($1)._yourself();
  45892. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.a$cls)});
  45893. },
  45894. args: ["anInterpreter"],
  45895. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  45896. referencedClasses: [],
  45897. messageSends: ["interpreter:", "new", "yourself"]
  45898. }),
  45899. $globals.ASTEnterNode.a$cls);
  45900. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  45901. $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";
  45902. $core.addMethod(
  45903. $core.method({
  45904. selector: "assign:to:",
  45905. protocol: "private",
  45906. fn: function (aNode,anObject){
  45907. var self=this,$self=this;
  45908. return $core.withContext(function($ctx1) {
  45909. var $1,$3,$2,$4;
  45910. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  45911. if($core.assert($1)){
  45912. $3=$self._context();
  45913. $ctx1.sendIdx["context"]=1;
  45914. $2=$recv($3)._receiver();
  45915. $4=$recv(aNode)._value();
  45916. $ctx1.sendIdx["value"]=1;
  45917. $recv($2)._instVarAt_put_($4,anObject);
  45918. } else {
  45919. $recv($self._context())._localAt_put_($recv(aNode)._value(),anObject);
  45920. }
  45921. return self;
  45922. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  45923. },
  45924. args: ["aNode", "anObject"],
  45925. 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 ]",
  45926. referencedClasses: [],
  45927. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  45928. }),
  45929. $globals.ASTInterpreter);
  45930. $core.addMethod(
  45931. $core.method({
  45932. selector: "atEnd",
  45933. protocol: "testing",
  45934. fn: function (){
  45935. var self=this,$self=this;
  45936. return $core.withContext(function($ctx1) {
  45937. var $1;
  45938. $1=$self["@forceAtEnd"];
  45939. if($core.assert($1)){
  45940. return true;
  45941. }
  45942. return $recv($self._hasReturned())._or_((function(){
  45943. return $core.withContext(function($ctx2) {
  45944. return $recv($self._node())._isNil();
  45945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45946. }));
  45947. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  45948. },
  45949. args: [],
  45950. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  45951. referencedClasses: [],
  45952. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  45953. }),
  45954. $globals.ASTInterpreter);
  45955. $core.addMethod(
  45956. $core.method({
  45957. selector: "context",
  45958. protocol: "accessing",
  45959. fn: function (){
  45960. var self=this,$self=this;
  45961. return $self["@context"];
  45962. },
  45963. args: [],
  45964. source: "context\x0a\x09^ context",
  45965. referencedClasses: [],
  45966. messageSends: []
  45967. }),
  45968. $globals.ASTInterpreter);
  45969. $core.addMethod(
  45970. $core.method({
  45971. selector: "context:",
  45972. protocol: "accessing",
  45973. fn: function (aContext){
  45974. var self=this,$self=this;
  45975. $self["@context"]=aContext;
  45976. return self;
  45977. },
  45978. args: ["aContext"],
  45979. source: "context: aContext\x0a\x09context := aContext",
  45980. referencedClasses: [],
  45981. messageSends: []
  45982. }),
  45983. $globals.ASTInterpreter);
  45984. $core.addMethod(
  45985. $core.method({
  45986. selector: "enterNode",
  45987. protocol: "interpreting",
  45988. fn: function (){
  45989. var self=this,$self=this;
  45990. return $core.withContext(function($ctx1) {
  45991. $self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_($self._node()));
  45992. return self;
  45993. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  45994. },
  45995. args: [],
  45996. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  45997. referencedClasses: ["ASTEnterNode"],
  45998. messageSends: ["node:", "visit:", "on:", "node"]
  45999. }),
  46000. $globals.ASTInterpreter);
  46001. $core.addMethod(
  46002. $core.method({
  46003. selector: "eval:",
  46004. protocol: "private",
  46005. fn: function (aString){
  46006. var self=this,$self=this;
  46007. var source,function_;
  46008. return $core.withContext(function($ctx1) {
  46009. var $3,$2,$1;
  46010. source=$recv($globals.String)._streamContents_((function(str){
  46011. return $core.withContext(function($ctx2) {
  46012. $recv(str)._nextPutAll_("0,(function(");
  46013. $ctx2.sendIdx["nextPutAll:"]=1;
  46014. $3=$self._context();
  46015. $ctx2.sendIdx["context"]=1;
  46016. $2=$recv($3)._locals();
  46017. $ctx2.sendIdx["locals"]=1;
  46018. $1=$recv($2)._keys();
  46019. $recv($1)._do_separatedBy_((function(each){
  46020. return $core.withContext(function($ctx3) {
  46021. return $recv(str)._nextPutAll_(each);
  46022. $ctx3.sendIdx["nextPutAll:"]=2;
  46023. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  46024. }),(function(){
  46025. return $core.withContext(function($ctx3) {
  46026. return $recv(str)._nextPutAll_(",");
  46027. $ctx3.sendIdx["nextPutAll:"]=3;
  46028. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  46029. }));
  46030. $recv(str)._nextPutAll_("){ return (function() {");
  46031. $ctx2.sendIdx["nextPutAll:"]=4;
  46032. $recv(str)._nextPutAll_(aString);
  46033. $ctx2.sendIdx["nextPutAll:"]=5;
  46034. return $recv(str)._nextPutAll_("})()})");
  46035. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  46036. }));
  46037. function_=$recv($globals.Compiler)._eval_(source);
  46038. return $recv(function_)._valueWithPossibleArguments_($recv($recv($self._context())._locals())._values());
  46039. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  46040. },
  46041. args: ["aString"],
  46042. 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",
  46043. referencedClasses: ["String", "Compiler"],
  46044. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "valueWithPossibleArguments:", "values"]
  46045. }),
  46046. $globals.ASTInterpreter);
  46047. $core.addMethod(
  46048. $core.method({
  46049. selector: "hasReturned",
  46050. protocol: "testing",
  46051. fn: function (){
  46052. var self=this,$self=this;
  46053. return $core.withContext(function($ctx1) {
  46054. var $1,$receiver;
  46055. $1=$self["@returned"];
  46056. if(($receiver = $1) == null || $receiver.a$nil){
  46057. return false;
  46058. } else {
  46059. return $1;
  46060. }
  46061. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  46062. },
  46063. args: [],
  46064. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  46065. referencedClasses: [],
  46066. messageSends: ["ifNil:"]
  46067. }),
  46068. $globals.ASTInterpreter);
  46069. $core.addMethod(
  46070. $core.method({
  46071. selector: "initialize",
  46072. protocol: "initialization",
  46073. fn: function (){
  46074. var self=this,$self=this;
  46075. return $core.withContext(function($ctx1) {
  46076. (
  46077. $ctx1.supercall = true,
  46078. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  46079. $ctx1.supercall = false;
  46080. $self["@forceAtEnd"]=false;
  46081. return self;
  46082. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  46083. },
  46084. args: [],
  46085. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  46086. referencedClasses: [],
  46087. messageSends: ["initialize"]
  46088. }),
  46089. $globals.ASTInterpreter);
  46090. $core.addMethod(
  46091. $core.method({
  46092. selector: "interpret",
  46093. protocol: "interpreting",
  46094. fn: function (){
  46095. var self=this,$self=this;
  46096. return $core.withContext(function($ctx1) {
  46097. $self._visit_($self._node());
  46098. return self;
  46099. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  46100. },
  46101. args: [],
  46102. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  46103. referencedClasses: [],
  46104. messageSends: ["visit:", "node"]
  46105. }),
  46106. $globals.ASTInterpreter);
  46107. $core.addMethod(
  46108. $core.method({
  46109. selector: "messageFromSendNode:arguments:",
  46110. protocol: "private",
  46111. fn: function (aSendNode,aCollection){
  46112. var self=this,$self=this;
  46113. return $core.withContext(function($ctx1) {
  46114. var $1;
  46115. $1=$recv($globals.Message)._new();
  46116. $recv($1)._selector_($recv(aSendNode)._selector());
  46117. $recv($1)._arguments_(aCollection);
  46118. return $recv($1)._yourself();
  46119. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  46120. },
  46121. args: ["aSendNode", "aCollection"],
  46122. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  46123. referencedClasses: ["Message"],
  46124. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  46125. }),
  46126. $globals.ASTInterpreter);
  46127. $core.addMethod(
  46128. $core.method({
  46129. selector: "messageNotUnderstood:receiver:",
  46130. protocol: "private",
  46131. fn: function (aMessage,anObject){
  46132. var self=this,$self=this;
  46133. return $core.withContext(function($ctx1) {
  46134. var $1;
  46135. $1=$recv($globals.MessageNotUnderstood)._new();
  46136. $recv($1)._message_(aMessage);
  46137. $recv($1)._receiver_(anObject);
  46138. $recv($1)._signal();
  46139. return self;
  46140. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  46141. },
  46142. args: ["aMessage", "anObject"],
  46143. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  46144. referencedClasses: ["MessageNotUnderstood"],
  46145. messageSends: ["message:", "new", "receiver:", "signal"]
  46146. }),
  46147. $globals.ASTInterpreter);
  46148. $core.addMethod(
  46149. $core.method({
  46150. selector: "next",
  46151. protocol: "interpreting",
  46152. fn: function (){
  46153. var self=this,$self=this;
  46154. var nd,nextNode;
  46155. return $core.withContext(function($ctx1) {
  46156. var $1,$2,$receiver;
  46157. nd=$self._node();
  46158. $1=$recv(nd)._parent();
  46159. if(($receiver = $1) == null || $receiver.a$nil){
  46160. nextNode=$1;
  46161. } else {
  46162. var parent;
  46163. parent=$receiver;
  46164. $2=$recv(parent)._nextSiblingNode_(nd);
  46165. if(($receiver = $2) == null || $receiver.a$nil){
  46166. nextNode=parent;
  46167. } else {
  46168. var sibling;
  46169. sibling=$receiver;
  46170. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  46171. }
  46172. }
  46173. $self._node_(nextNode);
  46174. return self;
  46175. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  46176. },
  46177. args: [],
  46178. 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",
  46179. referencedClasses: ["ASTEnterNode"],
  46180. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  46181. }),
  46182. $globals.ASTInterpreter);
  46183. $core.addMethod(
  46184. $core.method({
  46185. selector: "node",
  46186. protocol: "accessing",
  46187. fn: function (){
  46188. var self=this,$self=this;
  46189. return $self["@node"];
  46190. },
  46191. args: [],
  46192. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  46193. referencedClasses: [],
  46194. messageSends: []
  46195. }),
  46196. $globals.ASTInterpreter);
  46197. $core.addMethod(
  46198. $core.method({
  46199. selector: "node:",
  46200. protocol: "accessing",
  46201. fn: function (aNode){
  46202. var self=this,$self=this;
  46203. $self["@node"]=aNode;
  46204. return self;
  46205. },
  46206. args: ["aNode"],
  46207. source: "node: aNode\x0a\x09node := aNode",
  46208. referencedClasses: [],
  46209. messageSends: []
  46210. }),
  46211. $globals.ASTInterpreter);
  46212. $core.addMethod(
  46213. $core.method({
  46214. selector: "peek",
  46215. protocol: "stack",
  46216. fn: function (){
  46217. var self=this,$self=this;
  46218. return $core.withContext(function($ctx1) {
  46219. var $1;
  46220. var $early={};
  46221. try {
  46222. $1=$self._stack();
  46223. $ctx1.sendIdx["stack"]=1;
  46224. $recv($1)._ifEmpty_((function(){
  46225. throw $early=[nil];
  46226. }));
  46227. return $recv($self._stack())._last();
  46228. }
  46229. catch(e) {if(e===$early)return e[0]; throw e}
  46230. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  46231. },
  46232. args: [],
  46233. 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",
  46234. referencedClasses: [],
  46235. messageSends: ["ifEmpty:", "stack", "last"]
  46236. }),
  46237. $globals.ASTInterpreter);
  46238. $core.addMethod(
  46239. $core.method({
  46240. selector: "pop",
  46241. protocol: "stack",
  46242. fn: function (){
  46243. var self=this,$self=this;
  46244. var peekedValue;
  46245. return $core.withContext(function($ctx1) {
  46246. peekedValue=$self._peek();
  46247. $recv($self._stack())._removeLast();
  46248. return peekedValue;
  46249. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  46250. },
  46251. args: [],
  46252. 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",
  46253. referencedClasses: [],
  46254. messageSends: ["peek", "removeLast", "stack"]
  46255. }),
  46256. $globals.ASTInterpreter);
  46257. $core.addMethod(
  46258. $core.method({
  46259. selector: "proceed",
  46260. protocol: "interpreting",
  46261. fn: function (){
  46262. var self=this,$self=this;
  46263. return $core.withContext(function($ctx1) {
  46264. $recv((function(){
  46265. return $core.withContext(function($ctx2) {
  46266. return $self._atEnd();
  46267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46268. }))._whileFalse_((function(){
  46269. return $core.withContext(function($ctx2) {
  46270. return $self._step();
  46271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46272. }));
  46273. return self;
  46274. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  46275. },
  46276. args: [],
  46277. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  46278. referencedClasses: [],
  46279. messageSends: ["whileFalse:", "atEnd", "step"]
  46280. }),
  46281. $globals.ASTInterpreter);
  46282. $core.addMethod(
  46283. $core.method({
  46284. selector: "push:",
  46285. protocol: "stack",
  46286. fn: function (anObject){
  46287. var self=this,$self=this;
  46288. return $core.withContext(function($ctx1) {
  46289. return $recv($self._stack())._add_(anObject);
  46290. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  46291. },
  46292. args: ["anObject"],
  46293. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  46294. referencedClasses: [],
  46295. messageSends: ["add:", "stack"]
  46296. }),
  46297. $globals.ASTInterpreter);
  46298. $core.addMethod(
  46299. $core.method({
  46300. selector: "restart",
  46301. protocol: "interpreting",
  46302. fn: function (){
  46303. var self=this,$self=this;
  46304. return $core.withContext(function($ctx1) {
  46305. $self._node_($recv($self._context())._ast());
  46306. $self._enterNode();
  46307. return self;
  46308. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  46309. },
  46310. args: [],
  46311. source: "restart\x0a\x09self node: self context ast; enterNode",
  46312. referencedClasses: [],
  46313. messageSends: ["node:", "ast", "context", "enterNode"]
  46314. }),
  46315. $globals.ASTInterpreter);
  46316. $core.addMethod(
  46317. $core.method({
  46318. selector: "result",
  46319. protocol: "accessing",
  46320. fn: function (){
  46321. var self=this,$self=this;
  46322. return $core.withContext(function($ctx1) {
  46323. var $1;
  46324. $1=$self._hasReturned();
  46325. if($core.assert($1)){
  46326. return $self._returnValue();
  46327. } else {
  46328. return $recv($self._context())._receiver();
  46329. }
  46330. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  46331. },
  46332. args: [],
  46333. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  46334. referencedClasses: [],
  46335. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  46336. }),
  46337. $globals.ASTInterpreter);
  46338. $core.addMethod(
  46339. $core.method({
  46340. selector: "returnValue",
  46341. protocol: "accessing",
  46342. fn: function (){
  46343. var self=this,$self=this;
  46344. return $self["@returnValue"];
  46345. },
  46346. args: [],
  46347. source: "returnValue\x0a\x09^ returnValue",
  46348. referencedClasses: [],
  46349. messageSends: []
  46350. }),
  46351. $globals.ASTInterpreter);
  46352. $core.addMethod(
  46353. $core.method({
  46354. selector: "returnValue:",
  46355. protocol: "accessing",
  46356. fn: function (anObject){
  46357. var self=this,$self=this;
  46358. $self["@returnValue"]=anObject;
  46359. return self;
  46360. },
  46361. args: ["anObject"],
  46362. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  46363. referencedClasses: [],
  46364. messageSends: []
  46365. }),
  46366. $globals.ASTInterpreter);
  46367. $core.addMethod(
  46368. $core.method({
  46369. selector: "sendMessage:to:superSend:",
  46370. protocol: "private",
  46371. fn: function (aMessage,anObject,aBoolean){
  46372. var self=this,$self=this;
  46373. var method;
  46374. return $core.withContext(function($ctx1) {
  46375. var $2,$1,$3,$receiver;
  46376. var $early={};
  46377. try {
  46378. if(!$core.assert(aBoolean)){
  46379. return $recv(aMessage)._sendTo_(anObject);
  46380. }
  46381. $2=$recv(anObject)._class();
  46382. $ctx1.sendIdx["class"]=1;
  46383. $1=$recv($2)._superclass();
  46384. $ctx1.sendIdx["superclass"]=1;
  46385. if(($receiver = $1) == null || $receiver.a$nil){
  46386. $3=$self._messageNotUnderstood_receiver_(aMessage,anObject);
  46387. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  46388. return $3;
  46389. } else {
  46390. $1;
  46391. }
  46392. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  46393. return $core.withContext(function($ctx2) {
  46394. throw $early=[$self._messageNotUnderstood_receiver_(aMessage,anObject)];
  46395. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46396. }));
  46397. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  46398. }
  46399. catch(e) {if(e===$early)return e[0]; throw e}
  46400. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  46401. },
  46402. args: ["aMessage", "anObject", "aBoolean"],
  46403. 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",
  46404. referencedClasses: [],
  46405. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  46406. }),
  46407. $globals.ASTInterpreter);
  46408. $core.addMethod(
  46409. $core.method({
  46410. selector: "setNonLocalReturnFromContext:",
  46411. protocol: "interpreting",
  46412. fn: function (aContext){
  46413. var self=this,$self=this;
  46414. return $core.withContext(function($ctx1) {
  46415. var $2,$1;
  46416. $2=$recv(aContext)._interpreter();
  46417. $ctx1.sendIdx["interpreter"]=1;
  46418. $1=$recv($2)._hasReturned();
  46419. if($core.assert($1)){
  46420. $self["@returned"]=true;
  46421. $self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  46422. }
  46423. return self;
  46424. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  46425. },
  46426. args: ["aContext"],
  46427. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  46428. referencedClasses: [],
  46429. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  46430. }),
  46431. $globals.ASTInterpreter);
  46432. $core.addMethod(
  46433. $core.method({
  46434. selector: "skip",
  46435. protocol: "interpreting",
  46436. fn: function (){
  46437. var self=this,$self=this;
  46438. return $core.withContext(function($ctx1) {
  46439. $self._next();
  46440. return self;
  46441. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  46442. },
  46443. args: [],
  46444. source: "skip\x0a\x09self next",
  46445. referencedClasses: [],
  46446. messageSends: ["next"]
  46447. }),
  46448. $globals.ASTInterpreter);
  46449. $core.addMethod(
  46450. $core.method({
  46451. selector: "stack",
  46452. protocol: "accessing",
  46453. fn: function (){
  46454. var self=this,$self=this;
  46455. return $core.withContext(function($ctx1) {
  46456. var $1,$receiver;
  46457. $1=$self["@stack"];
  46458. if(($receiver = $1) == null || $receiver.a$nil){
  46459. $self["@stack"]=$recv($globals.OrderedCollection)._new();
  46460. return $self["@stack"];
  46461. } else {
  46462. return $1;
  46463. }
  46464. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  46465. },
  46466. args: [],
  46467. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  46468. referencedClasses: ["OrderedCollection"],
  46469. messageSends: ["ifNil:", "new"]
  46470. }),
  46471. $globals.ASTInterpreter);
  46472. $core.addMethod(
  46473. $core.method({
  46474. selector: "step",
  46475. protocol: "interpreting",
  46476. fn: function (){
  46477. var self=this,$self=this;
  46478. return $core.withContext(function($ctx1) {
  46479. $self._interpret();
  46480. $self._next();
  46481. return self;
  46482. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  46483. },
  46484. args: [],
  46485. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  46486. referencedClasses: [],
  46487. messageSends: ["interpret", "next"]
  46488. }),
  46489. $globals.ASTInterpreter);
  46490. $core.addMethod(
  46491. $core.method({
  46492. selector: "stepOver",
  46493. protocol: "interpreting",
  46494. fn: function (){
  46495. var self=this,$self=this;
  46496. return $core.withContext(function($ctx1) {
  46497. var $2,$1;
  46498. $self._step();
  46499. $ctx1.sendIdx["step"]=1;
  46500. $recv((function(){
  46501. return $core.withContext(function($ctx2) {
  46502. $2=$self._node();
  46503. $ctx2.sendIdx["node"]=1;
  46504. $1=$recv($2)._isNil();
  46505. return $recv($1)._or_((function(){
  46506. return $core.withContext(function($ctx3) {
  46507. return $recv($self._node())._isSteppingNode();
  46508. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46509. }));
  46510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46511. }))._whileFalse_((function(){
  46512. return $core.withContext(function($ctx2) {
  46513. return $self._step();
  46514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46515. }));
  46516. return self;
  46517. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  46518. },
  46519. args: [],
  46520. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  46521. referencedClasses: [],
  46522. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  46523. }),
  46524. $globals.ASTInterpreter);
  46525. $core.addMethod(
  46526. $core.method({
  46527. selector: "visit:",
  46528. protocol: "visiting",
  46529. fn: function (aNode){
  46530. var self=this,$self=this;
  46531. return $core.withContext(function($ctx1) {
  46532. var $1;
  46533. $1=$self._hasReturned();
  46534. if(!$core.assert($1)){
  46535. (
  46536. $ctx1.supercall = true,
  46537. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  46538. $ctx1.supercall = false;
  46539. }
  46540. return self;
  46541. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  46542. },
  46543. args: ["aNode"],
  46544. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  46545. referencedClasses: [],
  46546. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  46547. }),
  46548. $globals.ASTInterpreter);
  46549. $core.addMethod(
  46550. $core.method({
  46551. selector: "visitAssignmentNode:",
  46552. protocol: "visiting",
  46553. fn: function (aNode){
  46554. var self=this,$self=this;
  46555. var poppedValue;
  46556. return $core.withContext(function($ctx1) {
  46557. poppedValue=$self._pop();
  46558. $ctx1.sendIdx["pop"]=1;
  46559. $self._pop();
  46560. $self._push_(poppedValue);
  46561. $self._assign_to_($recv(aNode)._left(),poppedValue);
  46562. return self;
  46563. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  46564. },
  46565. args: ["aNode"],
  46566. 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",
  46567. referencedClasses: [],
  46568. messageSends: ["pop", "push:", "assign:to:", "left"]
  46569. }),
  46570. $globals.ASTInterpreter);
  46571. $core.addMethod(
  46572. $core.method({
  46573. selector: "visitBlockNode:",
  46574. protocol: "visiting",
  46575. fn: function (aNode){
  46576. var self=this,$self=this;
  46577. var block;
  46578. return $core.withContext(function($ctx1) {
  46579. block=$recv($globals.AIBlockClosure)._forContext_node_($self._context(),aNode);
  46580. $self._push_(block);
  46581. return self;
  46582. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  46583. },
  46584. args: ["aNode"],
  46585. 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",
  46586. referencedClasses: ["AIBlockClosure"],
  46587. messageSends: ["forContext:node:", "context", "push:"]
  46588. }),
  46589. $globals.ASTInterpreter);
  46590. $core.addMethod(
  46591. $core.method({
  46592. selector: "visitBlockSequenceNode:",
  46593. protocol: "visiting",
  46594. fn: function (aNode){
  46595. var self=this,$self=this;
  46596. return $core.withContext(function($ctx1) {
  46597. (
  46598. $ctx1.supercall = true,
  46599. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($self, [aNode]));
  46600. $ctx1.supercall = false;
  46601. $self["@forceAtEnd"]=true;
  46602. return self;
  46603. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46604. },
  46605. args: ["aNode"],
  46606. 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",
  46607. referencedClasses: [],
  46608. messageSends: ["visitBlockSequenceNode:"]
  46609. }),
  46610. $globals.ASTInterpreter);
  46611. $core.addMethod(
  46612. $core.method({
  46613. selector: "visitDagNode:",
  46614. protocol: "visiting",
  46615. fn: function (aNode){
  46616. var self=this,$self=this;
  46617. return self;
  46618. },
  46619. args: ["aNode"],
  46620. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  46621. referencedClasses: [],
  46622. messageSends: []
  46623. }),
  46624. $globals.ASTInterpreter);
  46625. $core.addMethod(
  46626. $core.method({
  46627. selector: "visitDynamicArrayNode:",
  46628. protocol: "visiting",
  46629. fn: function (aNode){
  46630. var self=this,$self=this;
  46631. var array;
  46632. return $core.withContext(function($ctx1) {
  46633. array=[];
  46634. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46635. return $core.withContext(function($ctx2) {
  46636. return $recv(array)._addFirst_($self._pop());
  46637. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46638. }));
  46639. $self._push_(array);
  46640. return self;
  46641. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  46642. },
  46643. args: ["aNode"],
  46644. 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",
  46645. referencedClasses: [],
  46646. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  46647. }),
  46648. $globals.ASTInterpreter);
  46649. $core.addMethod(
  46650. $core.method({
  46651. selector: "visitDynamicDictionaryNode:",
  46652. protocol: "visiting",
  46653. fn: function (aNode){
  46654. var self=this,$self=this;
  46655. var keyValueList;
  46656. return $core.withContext(function($ctx1) {
  46657. keyValueList=$recv($globals.OrderedCollection)._new();
  46658. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46659. return $core.withContext(function($ctx2) {
  46660. return $recv(keyValueList)._add_($self._pop());
  46661. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46662. }));
  46663. $self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  46664. return self;
  46665. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  46666. },
  46667. args: ["aNode"],
  46668. 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)",
  46669. referencedClasses: ["OrderedCollection", "HashedCollection"],
  46670. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  46671. }),
  46672. $globals.ASTInterpreter);
  46673. $core.addMethod(
  46674. $core.method({
  46675. selector: "visitJSStatementNode:",
  46676. protocol: "visiting",
  46677. fn: function (aNode){
  46678. var self=this,$self=this;
  46679. return $core.withContext(function($ctx1) {
  46680. $self["@returned"]=true;
  46681. $self._returnValue_($self._eval_($recv(aNode)._source()));
  46682. return self;
  46683. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46684. },
  46685. args: ["aNode"],
  46686. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  46687. referencedClasses: [],
  46688. messageSends: ["returnValue:", "eval:", "source"]
  46689. }),
  46690. $globals.ASTInterpreter);
  46691. $core.addMethod(
  46692. $core.method({
  46693. selector: "visitReturnNode:",
  46694. protocol: "visiting",
  46695. fn: function (aNode){
  46696. var self=this,$self=this;
  46697. return $core.withContext(function($ctx1) {
  46698. $self["@returned"]=true;
  46699. $self._returnValue_($self._pop());
  46700. return self;
  46701. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46702. },
  46703. args: ["aNode"],
  46704. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  46705. referencedClasses: [],
  46706. messageSends: ["returnValue:", "pop"]
  46707. }),
  46708. $globals.ASTInterpreter);
  46709. $core.addMethod(
  46710. $core.method({
  46711. selector: "visitSendNode:",
  46712. protocol: "visiting",
  46713. fn: function (aNode){
  46714. var self=this,$self=this;
  46715. var receiver,args,message,result;
  46716. return $core.withContext(function($ctx1) {
  46717. var $1;
  46718. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  46719. return $core.withContext(function($ctx2) {
  46720. return $self._pop();
  46721. $ctx2.sendIdx["pop"]=1;
  46722. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46723. }));
  46724. receiver=$self._peek();
  46725. message=$self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  46726. result=$self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  46727. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  46728. return $core.withContext(function($ctx2) {
  46729. return $recv($recv(aNode)._isLastChild())._not();
  46730. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46731. }));
  46732. if(!$core.assert($1)){
  46733. $self._pop();
  46734. $self._push_(result);
  46735. }
  46736. return self;
  46737. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  46738. },
  46739. args: ["aNode"],
  46740. 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 ]",
  46741. referencedClasses: [],
  46742. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  46743. }),
  46744. $globals.ASTInterpreter);
  46745. $core.addMethod(
  46746. $core.method({
  46747. selector: "visitValueNode:",
  46748. protocol: "visiting",
  46749. fn: function (aNode){
  46750. var self=this,$self=this;
  46751. return $core.withContext(function($ctx1) {
  46752. $self._push_($recv(aNode)._value());
  46753. return self;
  46754. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46755. },
  46756. args: ["aNode"],
  46757. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  46758. referencedClasses: [],
  46759. messageSends: ["push:", "value"]
  46760. }),
  46761. $globals.ASTInterpreter);
  46762. $core.addMethod(
  46763. $core.method({
  46764. selector: "visitVariableNode:",
  46765. protocol: "visiting",
  46766. fn: function (aNode){
  46767. var self=this,$self=this;
  46768. return $core.withContext(function($ctx1) {
  46769. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  46770. $2=$recv(aNode)._binding();
  46771. $ctx1.sendIdx["binding"]=1;
  46772. $1=$recv($2)._isUnknownVar();
  46773. if($core.assert($1)){
  46774. $5=$recv($globals.Platform)._globals();
  46775. $ctx1.sendIdx["globals"]=1;
  46776. $6=$recv(aNode)._value();
  46777. $ctx1.sendIdx["value"]=1;
  46778. $4=$recv($5)._at_ifAbsent_($6,(function(){
  46779. return $core.withContext(function($ctx2) {
  46780. return $self._error_("Unknown variable");
  46781. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46782. }));
  46783. $ctx1.sendIdx["at:ifAbsent:"]=1;
  46784. $3=$self._push_($4);
  46785. $ctx1.sendIdx["push:"]=1;
  46786. return $3;
  46787. }
  46788. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  46789. if($core.assert($8)){
  46790. $10=$self._context();
  46791. $ctx1.sendIdx["context"]=1;
  46792. $9=$recv($10)._receiver();
  46793. $11=$recv(aNode)._value();
  46794. $ctx1.sendIdx["value"]=2;
  46795. $7=$recv($9)._instVarAt_($11);
  46796. } else {
  46797. $12=$self._context();
  46798. $13=$recv(aNode)._value();
  46799. $ctx1.sendIdx["value"]=3;
  46800. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  46801. return $core.withContext(function($ctx2) {
  46802. $15=$recv(aNode)._value();
  46803. $ctx2.sendIdx["value"]=4;
  46804. $14=$recv($15)._isCapitalized();
  46805. if($core.assert($14)){
  46806. $16=$recv($globals.Smalltalk)._globals();
  46807. $ctx2.sendIdx["globals"]=2;
  46808. $17=$recv(aNode)._value();
  46809. $ctx2.sendIdx["value"]=5;
  46810. return $recv($16)._at_ifAbsent_($17,(function(){
  46811. return $core.withContext(function($ctx3) {
  46812. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  46813. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  46814. }));
  46815. }
  46816. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  46817. }));
  46818. }
  46819. $self._push_($7);
  46820. return self;
  46821. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46822. },
  46823. args: ["aNode"],
  46824. 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 ] ] ] ])",
  46825. referencedClasses: ["Platform", "Smalltalk"],
  46826. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  46827. }),
  46828. $globals.ASTInterpreter);
  46829. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  46830. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  46831. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  46832. $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`";
  46833. $core.addMethod(
  46834. $core.method({
  46835. selector: "currentNode",
  46836. protocol: "accessing",
  46837. fn: function (){
  46838. var self=this,$self=this;
  46839. return $self["@currentNode"];
  46840. },
  46841. args: [],
  46842. source: "currentNode\x0a\x09^ currentNode",
  46843. referencedClasses: [],
  46844. messageSends: []
  46845. }),
  46846. $globals.ASTPCNodeVisitor);
  46847. $core.addMethod(
  46848. $core.method({
  46849. selector: "increaseTrackedIndex",
  46850. protocol: "accessing",
  46851. fn: function (){
  46852. var self=this,$self=this;
  46853. return $core.withContext(function($ctx1) {
  46854. $self["@trackedIndex"]=$recv($self._trackedIndex()).__plus((1));
  46855. return self;
  46856. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
  46857. },
  46858. args: [],
  46859. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  46860. referencedClasses: [],
  46861. messageSends: ["+", "trackedIndex"]
  46862. }),
  46863. $globals.ASTPCNodeVisitor);
  46864. $core.addMethod(
  46865. $core.method({
  46866. selector: "index",
  46867. protocol: "accessing",
  46868. fn: function (){
  46869. var self=this,$self=this;
  46870. return $self["@index"];
  46871. },
  46872. args: [],
  46873. source: "index\x0a\x09^ index",
  46874. referencedClasses: [],
  46875. messageSends: []
  46876. }),
  46877. $globals.ASTPCNodeVisitor);
  46878. $core.addMethod(
  46879. $core.method({
  46880. selector: "index:",
  46881. protocol: "accessing",
  46882. fn: function (aNumber){
  46883. var self=this,$self=this;
  46884. $self["@index"]=aNumber;
  46885. return self;
  46886. },
  46887. args: ["aNumber"],
  46888. source: "index: aNumber\x0a\x09index := aNumber",
  46889. referencedClasses: [],
  46890. messageSends: []
  46891. }),
  46892. $globals.ASTPCNodeVisitor);
  46893. $core.addMethod(
  46894. $core.method({
  46895. selector: "selector",
  46896. protocol: "accessing",
  46897. fn: function (){
  46898. var self=this,$self=this;
  46899. return $self["@selector"];
  46900. },
  46901. args: [],
  46902. source: "selector\x0a\x09^ selector",
  46903. referencedClasses: [],
  46904. messageSends: []
  46905. }),
  46906. $globals.ASTPCNodeVisitor);
  46907. $core.addMethod(
  46908. $core.method({
  46909. selector: "selector:",
  46910. protocol: "accessing",
  46911. fn: function (aString){
  46912. var self=this,$self=this;
  46913. $self["@selector"]=aString;
  46914. return self;
  46915. },
  46916. args: ["aString"],
  46917. source: "selector: aString\x0a\x09selector := aString",
  46918. referencedClasses: [],
  46919. messageSends: []
  46920. }),
  46921. $globals.ASTPCNodeVisitor);
  46922. $core.addMethod(
  46923. $core.method({
  46924. selector: "trackedIndex",
  46925. protocol: "accessing",
  46926. fn: function (){
  46927. var self=this,$self=this;
  46928. return $core.withContext(function($ctx1) {
  46929. var $1,$receiver;
  46930. $1=$self["@trackedIndex"];
  46931. if(($receiver = $1) == null || $receiver.a$nil){
  46932. $self["@trackedIndex"]=(0);
  46933. return $self["@trackedIndex"];
  46934. } else {
  46935. return $1;
  46936. }
  46937. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
  46938. },
  46939. args: [],
  46940. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  46941. referencedClasses: [],
  46942. messageSends: ["ifNil:"]
  46943. }),
  46944. $globals.ASTPCNodeVisitor);
  46945. $core.addMethod(
  46946. $core.method({
  46947. selector: "visitJSStatementNode:",
  46948. protocol: "visiting",
  46949. fn: function (aNode){
  46950. var self=this,$self=this;
  46951. $self["@currentNode"]=aNode;
  46952. return self;
  46953. },
  46954. args: ["aNode"],
  46955. 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",
  46956. referencedClasses: [],
  46957. messageSends: []
  46958. }),
  46959. $globals.ASTPCNodeVisitor);
  46960. $core.addMethod(
  46961. $core.method({
  46962. selector: "visitSendNode:",
  46963. protocol: "visiting",
  46964. fn: function (aNode){
  46965. var self=this,$self=this;
  46966. return $core.withContext(function($ctx1) {
  46967. var $2,$1,$3;
  46968. (
  46969. $ctx1.supercall = true,
  46970. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  46971. $ctx1.supercall = false;
  46972. $2=$self._selector();
  46973. $ctx1.sendIdx["selector"]=1;
  46974. $1=$recv($2).__eq($recv(aNode)._selector());
  46975. $ctx1.sendIdx["="]=1;
  46976. if($core.assert($1)){
  46977. $3=$recv($self._trackedIndex()).__eq($self._index());
  46978. if($core.assert($3)){
  46979. $self["@currentNode"]=aNode;
  46980. $self["@currentNode"];
  46981. }
  46982. $self._increaseTrackedIndex();
  46983. }
  46984. return self;
  46985. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
  46986. },
  46987. args: ["aNode"],
  46988. 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 ]",
  46989. referencedClasses: [],
  46990. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  46991. }),
  46992. $globals.ASTPCNodeVisitor);
  46993. $core.addMethod(
  46994. $core.method({
  46995. selector: "isLastChild",
  46996. protocol: "*Compiler-Interpreter",
  46997. fn: function (){
  46998. var self=this,$self=this;
  46999. return $core.withContext(function($ctx1) {
  47000. return $recv($recv($recv($self._parent())._dagChildren())._last()).__eq(self);
  47001. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
  47002. },
  47003. args: [],
  47004. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  47005. referencedClasses: [],
  47006. messageSends: ["=", "last", "dagChildren", "parent"]
  47007. }),
  47008. $globals.ASTNode);
  47009. $core.addMethod(
  47010. $core.method({
  47011. selector: "isSteppingNode",
  47012. protocol: "*Compiler-Interpreter",
  47013. fn: function (){
  47014. var self=this,$self=this;
  47015. return false;
  47016. },
  47017. args: [],
  47018. source: "isSteppingNode\x0a\x09^ false",
  47019. referencedClasses: [],
  47020. messageSends: []
  47021. }),
  47022. $globals.ASTNode);
  47023. $core.addMethod(
  47024. $core.method({
  47025. selector: "nextSiblingNode:",
  47026. protocol: "*Compiler-Interpreter",
  47027. fn: function (aNode){
  47028. var self=this,$self=this;
  47029. return $core.withContext(function($ctx1) {
  47030. var $1;
  47031. var $early={};
  47032. try {
  47033. $1=$self._dagChildren();
  47034. $ctx1.sendIdx["dagChildren"]=1;
  47035. return $recv($1)._at_ifAbsent_($recv($recv($self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  47036. throw $early=[nil];
  47037. }));
  47038. }
  47039. catch(e) {if(e===$early)return e[0]; throw e}
  47040. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
  47041. },
  47042. args: ["aNode"],
  47043. 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 ]",
  47044. referencedClasses: [],
  47045. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  47046. }),
  47047. $globals.ASTNode);
  47048. $core.addMethod(
  47049. $core.method({
  47050. selector: "isSteppingNode",
  47051. protocol: "*Compiler-Interpreter",
  47052. fn: function (){
  47053. var self=this,$self=this;
  47054. return true;
  47055. },
  47056. args: [],
  47057. source: "isSteppingNode\x0a\x09^ true",
  47058. referencedClasses: [],
  47059. messageSends: []
  47060. }),
  47061. $globals.AssignmentNode);
  47062. $core.addMethod(
  47063. $core.method({
  47064. selector: "isSteppingNode",
  47065. protocol: "*Compiler-Interpreter",
  47066. fn: function (){
  47067. var self=this,$self=this;
  47068. return true;
  47069. },
  47070. args: [],
  47071. source: "isSteppingNode\x0a\x09^ true",
  47072. referencedClasses: [],
  47073. messageSends: []
  47074. }),
  47075. $globals.BlockNode);
  47076. $core.addMethod(
  47077. $core.method({
  47078. selector: "nextSiblingNode:",
  47079. protocol: "*Compiler-Interpreter",
  47080. fn: function (aNode){
  47081. var self=this,$self=this;
  47082. return nil;
  47083. },
  47084. args: ["aNode"],
  47085. 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",
  47086. referencedClasses: [],
  47087. messageSends: []
  47088. }),
  47089. $globals.BlockNode);
  47090. $core.addMethod(
  47091. $core.method({
  47092. selector: "isSteppingNode",
  47093. protocol: "*Compiler-Interpreter",
  47094. fn: function (){
  47095. var self=this,$self=this;
  47096. return true;
  47097. },
  47098. args: [],
  47099. source: "isSteppingNode\x0a\x09^ true",
  47100. referencedClasses: [],
  47101. messageSends: []
  47102. }),
  47103. $globals.DynamicArrayNode);
  47104. $core.addMethod(
  47105. $core.method({
  47106. selector: "isSteppingNode",
  47107. protocol: "*Compiler-Interpreter",
  47108. fn: function (){
  47109. var self=this,$self=this;
  47110. return true;
  47111. },
  47112. args: [],
  47113. source: "isSteppingNode\x0a\x09^ true",
  47114. referencedClasses: [],
  47115. messageSends: []
  47116. }),
  47117. $globals.DynamicDictionaryNode);
  47118. $core.addMethod(
  47119. $core.method({
  47120. selector: "isSteppingNode",
  47121. protocol: "*Compiler-Interpreter",
  47122. fn: function (){
  47123. var self=this,$self=this;
  47124. return true;
  47125. },
  47126. args: [],
  47127. source: "isSteppingNode\x0a\x09^ true",
  47128. referencedClasses: [],
  47129. messageSends: []
  47130. }),
  47131. $globals.JSStatementNode);
  47132. $core.addMethod(
  47133. $core.method({
  47134. selector: "isCascadeSendNode",
  47135. protocol: "*Compiler-Interpreter",
  47136. fn: function (){
  47137. var self=this,$self=this;
  47138. return $core.withContext(function($ctx1) {
  47139. return $recv($self._parent())._isCascadeNode();
  47140. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  47141. },
  47142. args: [],
  47143. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  47144. referencedClasses: [],
  47145. messageSends: ["isCascadeNode", "parent"]
  47146. }),
  47147. $globals.SendNode);
  47148. $core.addMethod(
  47149. $core.method({
  47150. selector: "isSteppingNode",
  47151. protocol: "*Compiler-Interpreter",
  47152. fn: function (){
  47153. var self=this,$self=this;
  47154. return true;
  47155. },
  47156. args: [],
  47157. source: "isSteppingNode\x0a\x09^ true",
  47158. referencedClasses: [],
  47159. messageSends: []
  47160. }),
  47161. $globals.SendNode);
  47162. });
  47163. define('amber/lang',[
  47164. './deploy',
  47165. './boot', // pre-fetch, dep of ./helpers
  47166. './helpers', // pre-fetch, dep of ./deploy
  47167. './parser',
  47168. // --- packages for the Amber reflection begin here ---
  47169. 'amber_core/Platform-ImportExport',
  47170. 'amber_core/Compiler-Core',
  47171. 'amber_core/Compiler-AST',
  47172. 'amber_core/Compiler-Semantic',
  47173. 'amber_core/Compiler-IR',
  47174. 'amber_core/Compiler-Inlining',
  47175. 'amber_core/Compiler-Interpreter'
  47176. // --- packages for the Amber reflection end here ---
  47177. ], function (amber) {
  47178. return amber;
  47179. });
  47180. define('amber_core/Platform-DOM',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  47181. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  47182. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  47183. var $pkg = $core.addPackage("Platform-DOM");
  47184. $pkg.innerEval = function (expr) { return eval(expr); };
  47185. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  47186. $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM");
  47187. $core.addMethod(
  47188. $core.method({
  47189. selector: "isDomNode:",
  47190. protocol: "testing",
  47191. fn: function (anObject){
  47192. var self=this,$self=this;
  47193. return $core.withContext(function($ctx1) {
  47194. return anObject.nodeType > 0 &&
  47195. Object.prototype.toString.call(anObject) !== "[object Object]";
  47196. return self;
  47197. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject},$globals.PlatformDom.a$cls)});
  47198. },
  47199. args: ["anObject"],
  47200. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  47201. referencedClasses: [],
  47202. messageSends: []
  47203. }),
  47204. $globals.PlatformDom.a$cls);
  47205. $core.addMethod(
  47206. $core.method({
  47207. selector: "isFeasible",
  47208. protocol: "testing",
  47209. fn: function (){
  47210. var self=this,$self=this;
  47211. return $core.withContext(function($ctx1) {
  47212. if (typeof document === "undefined") return false;
  47213. try {
  47214. var d = document.createElement("div"),
  47215. f = document.createDocumentFragment(),
  47216. t = document.createTextNode("Hello, Amber!");
  47217. f.appendChild(t);
  47218. d.insertBefore(f, null);
  47219. return d.innerHTML === "Hello, Amber!";
  47220. } catch (e) {
  47221. return false;
  47222. };
  47223. return self;
  47224. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.PlatformDom.a$cls)});
  47225. },
  47226. args: [],
  47227. 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'>",
  47228. referencedClasses: [],
  47229. messageSends: []
  47230. }),
  47231. $globals.PlatformDom.a$cls);
  47232. $core.addMethod(
  47233. $core.method({
  47234. selector: "newCustomEvent:detail:",
  47235. protocol: "creation",
  47236. fn: function (aString,anObject){
  47237. var self=this,$self=this;
  47238. return $core.withContext(function($ctx1) {
  47239. return new CustomEvent(aString, {detail: anObject});
  47240. return self;
  47241. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject},$globals.PlatformDom.a$cls)});
  47242. },
  47243. args: ["aString", "anObject"],
  47244. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  47245. referencedClasses: [],
  47246. messageSends: []
  47247. }),
  47248. $globals.PlatformDom.a$cls);
  47249. $core.addMethod(
  47250. $core.method({
  47251. selector: "toArray:",
  47252. protocol: "converting",
  47253. fn: function (aDomList){
  47254. var self=this,$self=this;
  47255. return $core.withContext(function($ctx1) {
  47256. return Array.prototype.slice.call(aDomList);
  47257. return self;
  47258. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList},$globals.PlatformDom.a$cls)});
  47259. },
  47260. args: ["aDomList"],
  47261. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  47262. referencedClasses: [],
  47263. messageSends: []
  47264. }),
  47265. $globals.PlatformDom.a$cls);
  47266. $core.addMethod(
  47267. $core.method({
  47268. selector: "asDomNode",
  47269. protocol: "*Platform-DOM",
  47270. fn: function (){
  47271. var self=this,$self=this;
  47272. var fragment;
  47273. return $core.withContext(function($ctx1) {
  47274. fragment=$recv(document)._createDocumentFragment();
  47275. $self._do_((function(each){
  47276. return $core.withContext(function($ctx2) {
  47277. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  47278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47279. }));
  47280. return fragment;
  47281. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment},$globals.Collection)});
  47282. },
  47283. args: [],
  47284. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  47285. referencedClasses: [],
  47286. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  47287. }),
  47288. $globals.Collection);
  47289. $core.addMethod(
  47290. $core.method({
  47291. selector: "asDomNode",
  47292. protocol: "*Platform-DOM",
  47293. fn: function (){
  47294. var self=this,$self=this;
  47295. return $core.withContext(function($ctx1) {
  47296. var $1,$2;
  47297. $1=$recv($globals.PlatformDom)._isDomNode_($self["@jsObject"]);
  47298. if($core.assert($1)){
  47299. return $self["@jsObject"];
  47300. } else {
  47301. $2=(
  47302. $ctx1.supercall = true,
  47303. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($self, []));
  47304. $ctx1.supercall = false;
  47305. return $2;
  47306. }
  47307. return self;
  47308. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.JSObjectProxy)});
  47309. },
  47310. args: [],
  47311. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  47312. referencedClasses: ["PlatformDom"],
  47313. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  47314. }),
  47315. $globals.JSObjectProxy);
  47316. $core.addMethod(
  47317. $core.method({
  47318. selector: "asDomNode",
  47319. protocol: "*Platform-DOM",
  47320. fn: function (){
  47321. var self=this,$self=this;
  47322. return $core.withContext(function($ctx1) {
  47323. return $recv(document)._createTextNode_($self._asString());
  47324. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.String)});
  47325. },
  47326. args: [],
  47327. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  47328. referencedClasses: [],
  47329. messageSends: ["createTextNode:", "asString"]
  47330. }),
  47331. $globals.String);
  47332. $core.addMethod(
  47333. $core.method({
  47334. selector: "htmlTextContent",
  47335. protocol: "*Platform-DOM",
  47336. fn: function (){
  47337. var self=this,$self=this;
  47338. return $core.withContext(function($ctx1) {
  47339. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  47340. return self;
  47341. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{},$globals.String)});
  47342. },
  47343. args: [],
  47344. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  47345. referencedClasses: [],
  47346. messageSends: []
  47347. }),
  47348. $globals.String);
  47349. });
  47350. 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";
  47351. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  47352. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  47353. var $pkg = $core.addPackage("SUnit");
  47354. $pkg.innerEval = function (expr) { return eval(expr); };
  47355. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  47356. $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
  47357. $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.";
  47358. $core.addMethod(
  47359. $core.method({
  47360. selector: "result",
  47361. protocol: "accessing",
  47362. fn: function (){
  47363. var self=this,$self=this;
  47364. return $self["@result"];
  47365. },
  47366. args: [],
  47367. source: "result\x0a\x09^ result",
  47368. referencedClasses: [],
  47369. messageSends: []
  47370. }),
  47371. $globals.ResultAnnouncement);
  47372. $core.addMethod(
  47373. $core.method({
  47374. selector: "result:",
  47375. protocol: "accessing",
  47376. fn: function (aTestResult){
  47377. var self=this,$self=this;
  47378. $self["@result"]=aTestResult;
  47379. return self;
  47380. },
  47381. args: ["aTestResult"],
  47382. source: "result: aTestResult\x0a\x09result := aTestResult",
  47383. referencedClasses: [],
  47384. messageSends: []
  47385. }),
  47386. $globals.ResultAnnouncement);
  47387. $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
  47388. $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.";
  47389. $core.addMethod(
  47390. $core.method({
  47391. selector: "assert:",
  47392. protocol: "testing",
  47393. fn: function (aBoolean){
  47394. var self=this,$self=this;
  47395. return $core.withContext(function($ctx1) {
  47396. $self._assert_description_(aBoolean,"Assertion failed");
  47397. return self;
  47398. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  47399. },
  47400. args: ["aBoolean"],
  47401. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  47402. referencedClasses: [],
  47403. messageSends: ["assert:description:"]
  47404. }),
  47405. $globals.TestCase);
  47406. $core.addMethod(
  47407. $core.method({
  47408. selector: "assert:description:",
  47409. protocol: "testing",
  47410. fn: function (aBoolean,aString){
  47411. var self=this,$self=this;
  47412. return $core.withContext(function($ctx1) {
  47413. if(!$core.assert(aBoolean)){
  47414. $self._signalFailure_(aString);
  47415. }
  47416. return self;
  47417. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  47418. },
  47419. args: ["aBoolean", "aString"],
  47420. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  47421. referencedClasses: [],
  47422. messageSends: ["ifFalse:", "signalFailure:"]
  47423. }),
  47424. $globals.TestCase);
  47425. $core.addMethod(
  47426. $core.method({
  47427. selector: "assert:equals:",
  47428. protocol: "testing",
  47429. fn: function (actual,expected){
  47430. var self=this,$self=this;
  47431. return $core.withContext(function($ctx1) {
  47432. var $1,$5,$4,$3,$2;
  47433. $1=$recv(actual).__eq(expected);
  47434. $5=$recv(expected)._printString();
  47435. $ctx1.sendIdx["printString"]=1;
  47436. $4="Expected: ".__comma($5);
  47437. $3=$recv($4).__comma(" but was: ");
  47438. $ctx1.sendIdx[","]=2;
  47439. $2=$recv($3).__comma($recv(actual)._printString());
  47440. $ctx1.sendIdx[","]=1;
  47441. return $self._assert_description_($1,$2);
  47442. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  47443. },
  47444. args: ["actual", "expected"],
  47445. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  47446. referencedClasses: [],
  47447. messageSends: ["assert:description:", "=", ",", "printString"]
  47448. }),
  47449. $globals.TestCase);
  47450. $core.addMethod(
  47451. $core.method({
  47452. selector: "async:",
  47453. protocol: "async",
  47454. fn: function (aBlock){
  47455. var self=this,$self=this;
  47456. var c;
  47457. return $core.withContext(function($ctx1) {
  47458. var $1;
  47459. $self._errorIfNotAsync_("#async");
  47460. c=$self["@context"];
  47461. return (function(){
  47462. return $core.withContext(function($ctx2) {
  47463. $1=$self._isAsync();
  47464. if($core.assert($1)){
  47465. return $recv(c)._execute_(aBlock);
  47466. }
  47467. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47468. });
  47469. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  47470. },
  47471. args: ["aBlock"],
  47472. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  47473. referencedClasses: [],
  47474. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  47475. }),
  47476. $globals.TestCase);
  47477. $core.addMethod(
  47478. $core.method({
  47479. selector: "context:",
  47480. protocol: "accessing",
  47481. fn: function (aRunningTestContext){
  47482. var self=this,$self=this;
  47483. $self["@context"]=aRunningTestContext;
  47484. return self;
  47485. },
  47486. args: ["aRunningTestContext"],
  47487. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  47488. referencedClasses: [],
  47489. messageSends: []
  47490. }),
  47491. $globals.TestCase);
  47492. $core.addMethod(
  47493. $core.method({
  47494. selector: "deny:",
  47495. protocol: "testing",
  47496. fn: function (aBoolean){
  47497. var self=this,$self=this;
  47498. return $core.withContext(function($ctx1) {
  47499. $self._assert_($recv(aBoolean)._not());
  47500. return self;
  47501. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  47502. },
  47503. args: ["aBoolean"],
  47504. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  47505. referencedClasses: [],
  47506. messageSends: ["assert:", "not"]
  47507. }),
  47508. $globals.TestCase);
  47509. $core.addMethod(
  47510. $core.method({
  47511. selector: "errorIfNotAsync:",
  47512. protocol: "error handling",
  47513. fn: function (aString){
  47514. var self=this,$self=this;
  47515. return $core.withContext(function($ctx1) {
  47516. var $1;
  47517. $1=$self._isAsync();
  47518. if(!$core.assert($1)){
  47519. $self._error_($recv(aString).__comma(" used without prior #timeout:"));
  47520. }
  47521. return self;
  47522. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  47523. },
  47524. args: ["aString"],
  47525. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  47526. referencedClasses: [],
  47527. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  47528. }),
  47529. $globals.TestCase);
  47530. $core.addMethod(
  47531. $core.method({
  47532. selector: "finished",
  47533. protocol: "async",
  47534. fn: function (){
  47535. var self=this,$self=this;
  47536. return $core.withContext(function($ctx1) {
  47537. $self._errorIfNotAsync_("#finished");
  47538. $self["@asyncTimeout"]=nil;
  47539. return self;
  47540. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  47541. },
  47542. args: [],
  47543. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  47544. referencedClasses: [],
  47545. messageSends: ["errorIfNotAsync:"]
  47546. }),
  47547. $globals.TestCase);
  47548. $core.addMethod(
  47549. $core.method({
  47550. selector: "isAsync",
  47551. protocol: "testing",
  47552. fn: function (){
  47553. var self=this,$self=this;
  47554. return $core.withContext(function($ctx1) {
  47555. return $recv($self["@asyncTimeout"])._notNil();
  47556. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  47557. },
  47558. args: [],
  47559. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  47560. referencedClasses: [],
  47561. messageSends: ["notNil"]
  47562. }),
  47563. $globals.TestCase);
  47564. $core.addMethod(
  47565. $core.method({
  47566. selector: "performTest",
  47567. protocol: "running",
  47568. fn: function (){
  47569. var self=this,$self=this;
  47570. return $core.withContext(function($ctx1) {
  47571. $self["@asyncTimeout"]=nil;
  47572. $self._perform_($self._selector());
  47573. return self;
  47574. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  47575. },
  47576. args: [],
  47577. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  47578. referencedClasses: [],
  47579. messageSends: ["perform:", "selector"]
  47580. }),
  47581. $globals.TestCase);
  47582. $core.addMethod(
  47583. $core.method({
  47584. selector: "runCase",
  47585. protocol: "running",
  47586. fn: function (){
  47587. var self=this,$self=this;
  47588. return $core.withContext(function($ctx1) {
  47589. $recv($recv($globals.TestContext)._testCase_(self))._start();
  47590. return self;
  47591. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  47592. },
  47593. args: [],
  47594. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  47595. referencedClasses: ["TestContext"],
  47596. messageSends: ["start", "testCase:"]
  47597. }),
  47598. $globals.TestCase);
  47599. $core.addMethod(
  47600. $core.method({
  47601. selector: "selector",
  47602. protocol: "accessing",
  47603. fn: function (){
  47604. var self=this,$self=this;
  47605. return $self["@testSelector"];
  47606. },
  47607. args: [],
  47608. source: "selector\x0a\x09^ testSelector",
  47609. referencedClasses: [],
  47610. messageSends: []
  47611. }),
  47612. $globals.TestCase);
  47613. $core.addMethod(
  47614. $core.method({
  47615. selector: "setTestSelector:",
  47616. protocol: "accessing",
  47617. fn: function (aSelector){
  47618. var self=this,$self=this;
  47619. $self["@testSelector"]=aSelector;
  47620. return self;
  47621. },
  47622. args: ["aSelector"],
  47623. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  47624. referencedClasses: [],
  47625. messageSends: []
  47626. }),
  47627. $globals.TestCase);
  47628. $core.addMethod(
  47629. $core.method({
  47630. selector: "setUp",
  47631. protocol: "running",
  47632. fn: function (){
  47633. var self=this,$self=this;
  47634. return self;
  47635. },
  47636. args: [],
  47637. source: "setUp",
  47638. referencedClasses: [],
  47639. messageSends: []
  47640. }),
  47641. $globals.TestCase);
  47642. $core.addMethod(
  47643. $core.method({
  47644. selector: "should:",
  47645. protocol: "testing",
  47646. fn: function (aBlock){
  47647. var self=this,$self=this;
  47648. return $core.withContext(function($ctx1) {
  47649. $self._assert_($recv(aBlock)._value());
  47650. return self;
  47651. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  47652. },
  47653. args: ["aBlock"],
  47654. source: "should: aBlock\x0a\x09self assert: aBlock value",
  47655. referencedClasses: [],
  47656. messageSends: ["assert:", "value"]
  47657. }),
  47658. $globals.TestCase);
  47659. $core.addMethod(
  47660. $core.method({
  47661. selector: "should:raise:",
  47662. protocol: "testing",
  47663. fn: function (aBlock,anExceptionClass){
  47664. var self=this,$self=this;
  47665. return $core.withContext(function($ctx1) {
  47666. $self._assert_($recv((function(){
  47667. return $core.withContext(function($ctx2) {
  47668. $recv(aBlock)._value();
  47669. return false;
  47670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47671. }))._on_do_(anExceptionClass,(function(ex){
  47672. return true;
  47673. })));
  47674. return self;
  47675. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47676. },
  47677. args: ["aBlock", "anExceptionClass"],
  47678. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  47679. referencedClasses: [],
  47680. messageSends: ["assert:", "on:do:", "value"]
  47681. }),
  47682. $globals.TestCase);
  47683. $core.addMethod(
  47684. $core.method({
  47685. selector: "shouldnt:raise:",
  47686. protocol: "testing",
  47687. fn: function (aBlock,anExceptionClass){
  47688. var self=this,$self=this;
  47689. return $core.withContext(function($ctx1) {
  47690. $self._assert_($recv((function(){
  47691. return $core.withContext(function($ctx2) {
  47692. $recv(aBlock)._value();
  47693. return true;
  47694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47695. }))._on_do_(anExceptionClass,(function(ex){
  47696. return false;
  47697. })));
  47698. return self;
  47699. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47700. },
  47701. args: ["aBlock", "anExceptionClass"],
  47702. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  47703. referencedClasses: [],
  47704. messageSends: ["assert:", "on:do:", "value"]
  47705. }),
  47706. $globals.TestCase);
  47707. $core.addMethod(
  47708. $core.method({
  47709. selector: "signalFailure:",
  47710. protocol: "private",
  47711. fn: function (aString){
  47712. var self=this,$self=this;
  47713. return $core.withContext(function($ctx1) {
  47714. var $1;
  47715. $1=$recv($globals.TestFailure)._new();
  47716. $recv($1)._messageText_(aString);
  47717. $recv($1)._signal();
  47718. return self;
  47719. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  47720. },
  47721. args: ["aString"],
  47722. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  47723. referencedClasses: ["TestFailure"],
  47724. messageSends: ["messageText:", "new", "signal"]
  47725. }),
  47726. $globals.TestCase);
  47727. $core.addMethod(
  47728. $core.method({
  47729. selector: "tearDown",
  47730. protocol: "running",
  47731. fn: function (){
  47732. var self=this,$self=this;
  47733. return self;
  47734. },
  47735. args: [],
  47736. source: "tearDown",
  47737. referencedClasses: [],
  47738. messageSends: []
  47739. }),
  47740. $globals.TestCase);
  47741. $core.addMethod(
  47742. $core.method({
  47743. selector: "timeout:",
  47744. protocol: "async",
  47745. fn: function (aNumber){
  47746. var self=this,$self=this;
  47747. return $core.withContext(function($ctx1) {
  47748. var $1,$receiver;
  47749. $1=$self["@asyncTimeout"];
  47750. if(($receiver = $1) == null || $receiver.a$nil){
  47751. $1;
  47752. } else {
  47753. $recv($self["@asyncTimeout"])._clearTimeout();
  47754. }
  47755. $self["@asyncTimeout"]=(0);
  47756. $self["@asyncTimeout"]=$recv($self._async_((function(){
  47757. return $core.withContext(function($ctx2) {
  47758. return $self._assert_description_(false,"SUnit grace time exhausted");
  47759. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47760. })))._valueWithTimeout_(aNumber);
  47761. return self;
  47762. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  47763. },
  47764. args: ["aNumber"],
  47765. 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",
  47766. referencedClasses: [],
  47767. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  47768. }),
  47769. $globals.TestCase);
  47770. $core.addMethod(
  47771. $core.method({
  47772. selector: "allTestSelectors",
  47773. protocol: "accessing",
  47774. fn: function (){
  47775. var self=this,$self=this;
  47776. var selectors;
  47777. return $core.withContext(function($ctx1) {
  47778. var $1;
  47779. selectors=$self._testSelectors();
  47780. $1=$self._shouldInheritSelectors();
  47781. if($core.assert($1)){
  47782. $recv(selectors)._addAll_($recv($self._superclass())._allTestSelectors());
  47783. }
  47784. return selectors;
  47785. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.a$cls)});
  47786. },
  47787. args: [],
  47788. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  47789. referencedClasses: [],
  47790. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  47791. }),
  47792. $globals.TestCase.a$cls);
  47793. $core.addMethod(
  47794. $core.method({
  47795. selector: "buildSuite",
  47796. protocol: "accessing",
  47797. fn: function (){
  47798. var self=this,$self=this;
  47799. return $core.withContext(function($ctx1) {
  47800. return $recv($self._allTestSelectors())._collect_((function(each){
  47801. return $core.withContext(function($ctx2) {
  47802. return $self._selector_(each);
  47803. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47804. }));
  47805. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.a$cls)});
  47806. },
  47807. args: [],
  47808. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  47809. referencedClasses: [],
  47810. messageSends: ["collect:", "allTestSelectors", "selector:"]
  47811. }),
  47812. $globals.TestCase.a$cls);
  47813. $core.addMethod(
  47814. $core.method({
  47815. selector: "classTag",
  47816. protocol: "accessing",
  47817. fn: function (){
  47818. var self=this,$self=this;
  47819. return "test";
  47820. },
  47821. args: [],
  47822. 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'",
  47823. referencedClasses: [],
  47824. messageSends: []
  47825. }),
  47826. $globals.TestCase.a$cls);
  47827. $core.addMethod(
  47828. $core.method({
  47829. selector: "isAbstract",
  47830. protocol: "testing",
  47831. fn: function (){
  47832. var self=this,$self=this;
  47833. return $core.withContext(function($ctx1) {
  47834. return $recv($self._name()).__eq("TestCase");
  47835. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.a$cls)});
  47836. },
  47837. args: [],
  47838. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  47839. referencedClasses: [],
  47840. messageSends: ["=", "name"]
  47841. }),
  47842. $globals.TestCase.a$cls);
  47843. $core.addMethod(
  47844. $core.method({
  47845. selector: "isTestClass",
  47846. protocol: "testing",
  47847. fn: function (){
  47848. var self=this,$self=this;
  47849. return $core.withContext(function($ctx1) {
  47850. return $recv($self._isAbstract())._not();
  47851. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.TestCase.a$cls)});
  47852. },
  47853. args: [],
  47854. source: "isTestClass\x0a\x09^ self isAbstract not",
  47855. referencedClasses: [],
  47856. messageSends: ["not", "isAbstract"]
  47857. }),
  47858. $globals.TestCase.a$cls);
  47859. $core.addMethod(
  47860. $core.method({
  47861. selector: "lookupHierarchyRoot",
  47862. protocol: "accessing",
  47863. fn: function (){
  47864. var self=this,$self=this;
  47865. return $globals.TestCase;
  47866. },
  47867. args: [],
  47868. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  47869. referencedClasses: ["TestCase"],
  47870. messageSends: []
  47871. }),
  47872. $globals.TestCase.a$cls);
  47873. $core.addMethod(
  47874. $core.method({
  47875. selector: "selector:",
  47876. protocol: "accessing",
  47877. fn: function (aSelector){
  47878. var self=this,$self=this;
  47879. return $core.withContext(function($ctx1) {
  47880. var $1;
  47881. $1=$self._new();
  47882. $recv($1)._setTestSelector_(aSelector);
  47883. return $recv($1)._yourself();
  47884. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.a$cls)});
  47885. },
  47886. args: ["aSelector"],
  47887. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  47888. referencedClasses: [],
  47889. messageSends: ["setTestSelector:", "new", "yourself"]
  47890. }),
  47891. $globals.TestCase.a$cls);
  47892. $core.addMethod(
  47893. $core.method({
  47894. selector: "shouldInheritSelectors",
  47895. protocol: "testing",
  47896. fn: function (){
  47897. var self=this,$self=this;
  47898. return $core.withContext(function($ctx1) {
  47899. return $self.__tild_eq($self._lookupHierarchyRoot());
  47900. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.a$cls)});
  47901. },
  47902. args: [],
  47903. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  47904. referencedClasses: [],
  47905. messageSends: ["~=", "lookupHierarchyRoot"]
  47906. }),
  47907. $globals.TestCase.a$cls);
  47908. $core.addMethod(
  47909. $core.method({
  47910. selector: "testSelectors",
  47911. protocol: "accessing",
  47912. fn: function (){
  47913. var self=this,$self=this;
  47914. return $core.withContext(function($ctx1) {
  47915. return $recv($recv($self._methodDictionary())._keys())._select_((function(each){
  47916. return $core.withContext(function($ctx2) {
  47917. return $recv(each)._match_("^test");
  47918. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47919. }));
  47920. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.a$cls)});
  47921. },
  47922. args: [],
  47923. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  47924. referencedClasses: [],
  47925. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  47926. }),
  47927. $globals.TestCase.a$cls);
  47928. $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
  47929. $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).";
  47930. $core.addMethod(
  47931. $core.method({
  47932. selector: "execute:",
  47933. protocol: "running",
  47934. fn: function (aBlock){
  47935. var self=this,$self=this;
  47936. var failed;
  47937. return $core.withContext(function($ctx1) {
  47938. var $1,$2;
  47939. $recv($self["@testCase"])._context_(self);
  47940. $ctx1.sendIdx["context:"]=1;
  47941. $recv((function(){
  47942. return $core.withContext(function($ctx2) {
  47943. failed=true;
  47944. $recv(aBlock)._value();
  47945. failed=false;
  47946. return failed;
  47947. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47948. }))._ensure_((function(){
  47949. return $core.withContext(function($ctx2) {
  47950. $recv($self["@testCase"])._context_(nil);
  47951. $1=$recv(failed)._and_((function(){
  47952. return $core.withContext(function($ctx3) {
  47953. return $recv($self["@testCase"])._isAsync();
  47954. $ctx3.sendIdx["isAsync"]=1;
  47955. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  47956. }));
  47957. if($core.assert($1)){
  47958. $recv($self["@testCase"])._finished();
  47959. }
  47960. $2=$recv($self["@testCase"])._isAsync();
  47961. if(!$core.assert($2)){
  47962. return $recv($self["@testCase"])._tearDown();
  47963. }
  47964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47965. }));
  47966. return self;
  47967. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  47968. },
  47969. args: ["aBlock"],
  47970. 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 ] ]",
  47971. referencedClasses: [],
  47972. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  47973. }),
  47974. $globals.TestContext);
  47975. $core.addMethod(
  47976. $core.method({
  47977. selector: "start",
  47978. protocol: "running",
  47979. fn: function (){
  47980. var self=this,$self=this;
  47981. return $core.withContext(function($ctx1) {
  47982. $self._execute_((function(){
  47983. return $core.withContext(function($ctx2) {
  47984. $recv($self["@testCase"])._setUp();
  47985. return $recv($self["@testCase"])._performTest();
  47986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47987. }));
  47988. return self;
  47989. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  47990. },
  47991. args: [],
  47992. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  47993. referencedClasses: [],
  47994. messageSends: ["execute:", "setUp", "performTest"]
  47995. }),
  47996. $globals.TestContext);
  47997. $core.addMethod(
  47998. $core.method({
  47999. selector: "testCase:",
  48000. protocol: "accessing",
  48001. fn: function (aTestCase){
  48002. var self=this,$self=this;
  48003. $self["@testCase"]=aTestCase;
  48004. return self;
  48005. },
  48006. args: ["aTestCase"],
  48007. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  48008. referencedClasses: [],
  48009. messageSends: []
  48010. }),
  48011. $globals.TestContext);
  48012. $core.addMethod(
  48013. $core.method({
  48014. selector: "testCase:",
  48015. protocol: "instance creation",
  48016. fn: function (aTestCase){
  48017. var self=this,$self=this;
  48018. return $core.withContext(function($ctx1) {
  48019. var $1;
  48020. $1=$self._new();
  48021. $recv($1)._testCase_(aTestCase);
  48022. return $recv($1)._yourself();
  48023. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.a$cls)});
  48024. },
  48025. args: ["aTestCase"],
  48026. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  48027. referencedClasses: [],
  48028. messageSends: ["testCase:", "new", "yourself"]
  48029. }),
  48030. $globals.TestContext.a$cls);
  48031. $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  48032. $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`.";
  48033. $core.addMethod(
  48034. $core.method({
  48035. selector: "execute:",
  48036. protocol: "running",
  48037. fn: function (aBlock){
  48038. var self=this,$self=this;
  48039. return $core.withContext(function($ctx1) {
  48040. var $1;
  48041. $recv((function(){
  48042. return $core.withContext(function($ctx2) {
  48043. return $self._withErrorReporting_((function(){
  48044. return $core.withContext(function($ctx3) {
  48045. return (
  48046. $ctx3.supercall = true,
  48047. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($self, [aBlock]));
  48048. $ctx3.supercall = false;
  48049. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48050. }));
  48051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48052. }))._ensure_((function(){
  48053. return $core.withContext(function($ctx2) {
  48054. $1=$recv($self["@testCase"])._isAsync();
  48055. if(!$core.assert($1)){
  48056. $recv($self["@result"])._increaseRuns();
  48057. return $recv($self["@finished"])._value();
  48058. }
  48059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48060. }));
  48061. return self;
  48062. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  48063. },
  48064. args: ["aBlock"],
  48065. 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 ] ]",
  48066. referencedClasses: [],
  48067. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  48068. }),
  48069. $globals.ReportingTestContext);
  48070. $core.addMethod(
  48071. $core.method({
  48072. selector: "finished:",
  48073. protocol: "accessing",
  48074. fn: function (aBlock){
  48075. var self=this,$self=this;
  48076. $self["@finished"]=aBlock;
  48077. return self;
  48078. },
  48079. args: ["aBlock"],
  48080. source: "finished: aBlock\x0a\x09finished := aBlock",
  48081. referencedClasses: [],
  48082. messageSends: []
  48083. }),
  48084. $globals.ReportingTestContext);
  48085. $core.addMethod(
  48086. $core.method({
  48087. selector: "result:",
  48088. protocol: "accessing",
  48089. fn: function (aTestResult){
  48090. var self=this,$self=this;
  48091. $self["@result"]=aTestResult;
  48092. return self;
  48093. },
  48094. args: ["aTestResult"],
  48095. source: "result: aTestResult\x0a\x09result := aTestResult",
  48096. referencedClasses: [],
  48097. messageSends: []
  48098. }),
  48099. $globals.ReportingTestContext);
  48100. $core.addMethod(
  48101. $core.method({
  48102. selector: "withErrorReporting:",
  48103. protocol: "private",
  48104. fn: function (aBlock){
  48105. var self=this,$self=this;
  48106. return $core.withContext(function($ctx1) {
  48107. $recv((function(){
  48108. return $core.withContext(function($ctx2) {
  48109. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  48110. return $core.withContext(function($ctx3) {
  48111. return $recv($self["@result"])._addFailure_($self["@testCase"]);
  48112. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  48113. }));
  48114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48115. }))._on_do_($globals.Error,(function(ex){
  48116. return $core.withContext(function($ctx2) {
  48117. return $recv($self["@result"])._addError_($self["@testCase"]);
  48118. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  48119. }));
  48120. $ctx1.sendIdx["on:do:"]=1;
  48121. return self;
  48122. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  48123. },
  48124. args: ["aBlock"],
  48125. 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 ]",
  48126. referencedClasses: ["TestFailure", "Error"],
  48127. messageSends: ["on:do:", "addFailure:", "addError:"]
  48128. }),
  48129. $globals.ReportingTestContext);
  48130. $core.addMethod(
  48131. $core.method({
  48132. selector: "testCase:result:finished:",
  48133. protocol: "instance creation",
  48134. fn: function (aTestCase,aTestResult,aBlock){
  48135. var self=this,$self=this;
  48136. return $core.withContext(function($ctx1) {
  48137. var $1;
  48138. $1=(
  48139. $ctx1.supercall = true,
  48140. ($globals.ReportingTestContext.a$cls.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($self, [aTestCase]));
  48141. $ctx1.supercall = false;
  48142. $recv($1)._result_(aTestResult);
  48143. $recv($1)._finished_(aBlock);
  48144. return $recv($1)._yourself();
  48145. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.a$cls)});
  48146. },
  48147. args: ["aTestCase", "aTestResult", "aBlock"],
  48148. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  48149. referencedClasses: [],
  48150. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  48151. }),
  48152. $globals.ReportingTestContext.a$cls);
  48153. $core.addClass("TestFailure", $globals.Error, [], "SUnit");
  48154. $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.";
  48155. $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
  48156. $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";
  48157. $core.addMethod(
  48158. $core.method({
  48159. selector: "addError:",
  48160. protocol: "accessing",
  48161. fn: function (anError){
  48162. var self=this,$self=this;
  48163. return $core.withContext(function($ctx1) {
  48164. $recv($self._errors())._add_(anError);
  48165. return self;
  48166. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  48167. },
  48168. args: ["anError"],
  48169. source: "addError: anError\x0a\x09self errors add: anError",
  48170. referencedClasses: [],
  48171. messageSends: ["add:", "errors"]
  48172. }),
  48173. $globals.TestResult);
  48174. $core.addMethod(
  48175. $core.method({
  48176. selector: "addFailure:",
  48177. protocol: "accessing",
  48178. fn: function (aFailure){
  48179. var self=this,$self=this;
  48180. return $core.withContext(function($ctx1) {
  48181. $recv($self._failures())._add_(aFailure);
  48182. return self;
  48183. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  48184. },
  48185. args: ["aFailure"],
  48186. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  48187. referencedClasses: [],
  48188. messageSends: ["add:", "failures"]
  48189. }),
  48190. $globals.TestResult);
  48191. $core.addMethod(
  48192. $core.method({
  48193. selector: "errors",
  48194. protocol: "accessing",
  48195. fn: function (){
  48196. var self=this,$self=this;
  48197. return $self["@errors"];
  48198. },
  48199. args: [],
  48200. source: "errors\x0a\x09^ errors",
  48201. referencedClasses: [],
  48202. messageSends: []
  48203. }),
  48204. $globals.TestResult);
  48205. $core.addMethod(
  48206. $core.method({
  48207. selector: "failures",
  48208. protocol: "accessing",
  48209. fn: function (){
  48210. var self=this,$self=this;
  48211. return $self["@failures"];
  48212. },
  48213. args: [],
  48214. source: "failures\x0a\x09^ failures",
  48215. referencedClasses: [],
  48216. messageSends: []
  48217. }),
  48218. $globals.TestResult);
  48219. $core.addMethod(
  48220. $core.method({
  48221. selector: "increaseRuns",
  48222. protocol: "accessing",
  48223. fn: function (){
  48224. var self=this,$self=this;
  48225. return $core.withContext(function($ctx1) {
  48226. $self["@runs"]=$recv($self["@runs"]).__plus((1));
  48227. return self;
  48228. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  48229. },
  48230. args: [],
  48231. source: "increaseRuns\x0a\x09runs := runs + 1",
  48232. referencedClasses: [],
  48233. messageSends: ["+"]
  48234. }),
  48235. $globals.TestResult);
  48236. $core.addMethod(
  48237. $core.method({
  48238. selector: "initialize",
  48239. protocol: "initialization",
  48240. fn: function (){
  48241. var self=this,$self=this;
  48242. return $core.withContext(function($ctx1) {
  48243. (
  48244. $ctx1.supercall = true,
  48245. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48246. $ctx1.supercall = false;
  48247. $self["@timestamp"]=$recv($globals.Date)._now();
  48248. $self["@runs"]=(0);
  48249. $self["@errors"]=$recv($globals.Array)._new();
  48250. $ctx1.sendIdx["new"]=1;
  48251. $self["@failures"]=$recv($globals.Array)._new();
  48252. $self["@total"]=(0);
  48253. return self;
  48254. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  48255. },
  48256. args: [],
  48257. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  48258. referencedClasses: ["Date", "Array"],
  48259. messageSends: ["initialize", "now", "new"]
  48260. }),
  48261. $globals.TestResult);
  48262. $core.addMethod(
  48263. $core.method({
  48264. selector: "nextRunDo:",
  48265. protocol: "running",
  48266. fn: function (aBlock){
  48267. var self=this,$self=this;
  48268. return $core.withContext(function($ctx1) {
  48269. var $2,$1;
  48270. $2=$self._runs();
  48271. $ctx1.sendIdx["runs"]=1;
  48272. $1=$recv($2).__eq_eq($self._total());
  48273. if(!$core.assert($1)){
  48274. return $recv(aBlock)._value_($recv($self._runs()).__plus((1)));
  48275. }
  48276. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  48277. },
  48278. args: ["aBlock"],
  48279. 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 ]",
  48280. referencedClasses: [],
  48281. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  48282. }),
  48283. $globals.TestResult);
  48284. $core.addMethod(
  48285. $core.method({
  48286. selector: "runCase:",
  48287. protocol: "running",
  48288. fn: function (aTestCase){
  48289. var self=this,$self=this;
  48290. return $core.withContext(function($ctx1) {
  48291. $recv((function(){
  48292. return $core.withContext(function($ctx2) {
  48293. return $recv((function(){
  48294. return $core.withContext(function($ctx3) {
  48295. $self._increaseRuns();
  48296. return $recv(aTestCase)._runCase();
  48297. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48298. }))._on_do_($globals.TestFailure,(function(ex){
  48299. return $core.withContext(function($ctx3) {
  48300. return $self._addFailure_(aTestCase);
  48301. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  48302. }));
  48303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48304. }))._on_do_($globals.Error,(function(ex){
  48305. return $core.withContext(function($ctx2) {
  48306. return $self._addError_(aTestCase);
  48307. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  48308. }));
  48309. $ctx1.sendIdx["on:do:"]=1;
  48310. return self;
  48311. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  48312. },
  48313. args: ["aTestCase"],
  48314. 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 ]",
  48315. referencedClasses: ["TestFailure", "Error"],
  48316. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  48317. }),
  48318. $globals.TestResult);
  48319. $core.addMethod(
  48320. $core.method({
  48321. selector: "runs",
  48322. protocol: "accessing",
  48323. fn: function (){
  48324. var self=this,$self=this;
  48325. return $self["@runs"];
  48326. },
  48327. args: [],
  48328. source: "runs\x0a\x09^ runs",
  48329. referencedClasses: [],
  48330. messageSends: []
  48331. }),
  48332. $globals.TestResult);
  48333. $core.addMethod(
  48334. $core.method({
  48335. selector: "status",
  48336. protocol: "accessing",
  48337. fn: function (){
  48338. var self=this,$self=this;
  48339. return $core.withContext(function($ctx1) {
  48340. var $1;
  48341. $1=$recv($self._errors())._ifNotEmpty_ifEmpty_((function(){
  48342. return "error";
  48343. }),(function(){
  48344. return $core.withContext(function($ctx2) {
  48345. return $recv($self._failures())._ifNotEmpty_ifEmpty_((function(){
  48346. return "failure";
  48347. }),(function(){
  48348. return "success";
  48349. }));
  48350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48351. }));
  48352. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  48353. return $1;
  48354. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  48355. },
  48356. args: [],
  48357. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  48358. referencedClasses: [],
  48359. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  48360. }),
  48361. $globals.TestResult);
  48362. $core.addMethod(
  48363. $core.method({
  48364. selector: "timestamp",
  48365. protocol: "accessing",
  48366. fn: function (){
  48367. var self=this,$self=this;
  48368. return $self["@timestamp"];
  48369. },
  48370. args: [],
  48371. source: "timestamp\x0a\x09^ timestamp",
  48372. referencedClasses: [],
  48373. messageSends: []
  48374. }),
  48375. $globals.TestResult);
  48376. $core.addMethod(
  48377. $core.method({
  48378. selector: "total",
  48379. protocol: "accessing",
  48380. fn: function (){
  48381. var self=this,$self=this;
  48382. return $self["@total"];
  48383. },
  48384. args: [],
  48385. source: "total\x0a\x09^ total",
  48386. referencedClasses: [],
  48387. messageSends: []
  48388. }),
  48389. $globals.TestResult);
  48390. $core.addMethod(
  48391. $core.method({
  48392. selector: "total:",
  48393. protocol: "accessing",
  48394. fn: function (aNumber){
  48395. var self=this,$self=this;
  48396. $self["@total"]=aNumber;
  48397. return self;
  48398. },
  48399. args: ["aNumber"],
  48400. source: "total: aNumber\x0a\x09total := aNumber",
  48401. referencedClasses: [],
  48402. messageSends: []
  48403. }),
  48404. $globals.TestResult);
  48405. $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
  48406. $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`.";
  48407. $core.addMethod(
  48408. $core.method({
  48409. selector: "announcer",
  48410. protocol: "accessing",
  48411. fn: function (){
  48412. var self=this,$self=this;
  48413. return $self["@announcer"];
  48414. },
  48415. args: [],
  48416. source: "announcer\x0a\x09^ announcer",
  48417. referencedClasses: [],
  48418. messageSends: []
  48419. }),
  48420. $globals.TestSuiteRunner);
  48421. $core.addMethod(
  48422. $core.method({
  48423. selector: "contextOf:",
  48424. protocol: "private",
  48425. fn: function (anInteger){
  48426. var self=this,$self=this;
  48427. return $core.withContext(function($ctx1) {
  48428. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv($self["@suite"])._at_(anInteger),$self["@result"],(function(){
  48429. return $core.withContext(function($ctx2) {
  48430. return $self._resume();
  48431. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48432. }));
  48433. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  48434. },
  48435. args: ["anInteger"],
  48436. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  48437. referencedClasses: ["ReportingTestContext"],
  48438. messageSends: ["testCase:result:finished:", "at:", "resume"]
  48439. }),
  48440. $globals.TestSuiteRunner);
  48441. $core.addMethod(
  48442. $core.method({
  48443. selector: "initialize",
  48444. protocol: "initialization",
  48445. fn: function (){
  48446. var self=this,$self=this;
  48447. return $core.withContext(function($ctx1) {
  48448. var $1;
  48449. (
  48450. $ctx1.supercall = true,
  48451. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48452. $ctx1.supercall = false;
  48453. $self["@announcer"]=$recv($globals.Announcer)._new();
  48454. $ctx1.sendIdx["new"]=1;
  48455. $self["@result"]=$recv($globals.TestResult)._new();
  48456. $self["@runNextTest"]=(function(){
  48457. var runs;
  48458. return $core.withContext(function($ctx2) {
  48459. runs=$recv($self["@result"])._runs();
  48460. $1=$recv(runs).__lt($recv($self["@result"])._total());
  48461. if($core.assert($1)){
  48462. return $recv($self._contextOf_($recv(runs).__plus((1))))._start();
  48463. }
  48464. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  48465. });
  48466. return self;
  48467. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  48468. },
  48469. args: [],
  48470. 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 ] ].",
  48471. referencedClasses: ["Announcer", "TestResult"],
  48472. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  48473. }),
  48474. $globals.TestSuiteRunner);
  48475. $core.addMethod(
  48476. $core.method({
  48477. selector: "result",
  48478. protocol: "accessing",
  48479. fn: function (){
  48480. var self=this,$self=this;
  48481. return $self["@result"];
  48482. },
  48483. args: [],
  48484. source: "result\x0a\x09^ result",
  48485. referencedClasses: [],
  48486. messageSends: []
  48487. }),
  48488. $globals.TestSuiteRunner);
  48489. $core.addMethod(
  48490. $core.method({
  48491. selector: "resume",
  48492. protocol: "actions",
  48493. fn: function (){
  48494. var self=this,$self=this;
  48495. return $core.withContext(function($ctx1) {
  48496. $recv($self["@runNextTest"])._fork();
  48497. $recv($self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_($self["@result"]));
  48498. return self;
  48499. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  48500. },
  48501. args: [],
  48502. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  48503. referencedClasses: ["ResultAnnouncement"],
  48504. messageSends: ["fork", "announce:", "result:", "new"]
  48505. }),
  48506. $globals.TestSuiteRunner);
  48507. $core.addMethod(
  48508. $core.method({
  48509. selector: "run",
  48510. protocol: "actions",
  48511. fn: function (){
  48512. var self=this,$self=this;
  48513. return $core.withContext(function($ctx1) {
  48514. $recv($self["@result"])._total_($recv($self["@suite"])._size());
  48515. $self._resume();
  48516. return self;
  48517. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  48518. },
  48519. args: [],
  48520. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  48521. referencedClasses: [],
  48522. messageSends: ["total:", "size", "resume"]
  48523. }),
  48524. $globals.TestSuiteRunner);
  48525. $core.addMethod(
  48526. $core.method({
  48527. selector: "suite:",
  48528. protocol: "accessing",
  48529. fn: function (aCollection){
  48530. var self=this,$self=this;
  48531. $self["@suite"]=aCollection;
  48532. return self;
  48533. },
  48534. args: ["aCollection"],
  48535. source: "suite: aCollection\x0a\x09suite := aCollection",
  48536. referencedClasses: [],
  48537. messageSends: []
  48538. }),
  48539. $globals.TestSuiteRunner);
  48540. $core.addMethod(
  48541. $core.method({
  48542. selector: "new",
  48543. protocol: "instance creation",
  48544. fn: function (){
  48545. var self=this,$self=this;
  48546. return $core.withContext(function($ctx1) {
  48547. $self._shouldNotImplement();
  48548. return self;
  48549. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.a$cls)});
  48550. },
  48551. args: [],
  48552. source: "new\x0a\x09self shouldNotImplement",
  48553. referencedClasses: [],
  48554. messageSends: ["shouldNotImplement"]
  48555. }),
  48556. $globals.TestSuiteRunner.a$cls);
  48557. $core.addMethod(
  48558. $core.method({
  48559. selector: "on:",
  48560. protocol: "instance creation",
  48561. fn: function (aCollection){
  48562. var self=this,$self=this;
  48563. return $core.withContext(function($ctx1) {
  48564. var $1;
  48565. $1=(
  48566. $ctx1.supercall = true,
  48567. ($globals.TestSuiteRunner.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  48568. $ctx1.supercall = false;
  48569. return $recv($1)._suite_(aCollection);
  48570. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.a$cls)});
  48571. },
  48572. args: ["aCollection"],
  48573. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  48574. referencedClasses: [],
  48575. messageSends: ["suite:", "new"]
  48576. }),
  48577. $globals.TestSuiteRunner.a$cls);
  48578. $core.addMethod(
  48579. $core.method({
  48580. selector: "isTestPackage",
  48581. protocol: "*SUnit",
  48582. fn: function (){
  48583. var self=this,$self=this;
  48584. return $core.withContext(function($ctx1) {
  48585. return $recv($self._classes())._anySatisfy_((function(each){
  48586. return $core.withContext(function($ctx2) {
  48587. return $recv(each)._isTestClass();
  48588. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48589. }));
  48590. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  48591. },
  48592. args: [],
  48593. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  48594. referencedClasses: [],
  48595. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  48596. }),
  48597. $globals.Package);
  48598. $core.addMethod(
  48599. $core.method({
  48600. selector: "isTestClass",
  48601. protocol: "*SUnit",
  48602. fn: function (){
  48603. var self=this,$self=this;
  48604. return false;
  48605. },
  48606. args: [],
  48607. source: "isTestClass\x0a\x09^ false",
  48608. referencedClasses: [],
  48609. messageSends: []
  48610. }),
  48611. $globals.TBehaviorDefaults);
  48612. });
  48613. define('amber_core/Compiler-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  48614. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  48615. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  48616. var $pkg = $core.addPackage("Compiler-Tests");
  48617. $pkg.innerEval = function (expr) { return eval(expr); };
  48618. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  48619. $core.addClass("ASTParsingTest", $globals.TestCase, [], "Compiler-Tests");
  48620. $core.addMethod(
  48621. $core.method({
  48622. selector: "parse:forClass:",
  48623. protocol: "parsing",
  48624. fn: function (aString,aClass){
  48625. var self=this,$self=this;
  48626. return $core.withContext(function($ctx1) {
  48627. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_(aString,aClass,"test");
  48628. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  48629. },
  48630. args: ["aString", "aClass"],
  48631. source: "parse: aString forClass: aClass\x0a\x09^ Compiler new\x0a\x09\x09ast: aString\x0a\x09\x09forClass: aClass\x0a\x09\x09protocol: 'test'",
  48632. referencedClasses: ["Compiler"],
  48633. messageSends: ["ast:forClass:protocol:", "new"]
  48634. }),
  48635. $globals.ASTParsingTest);
  48636. $core.addClass("ASTPCNodeVisitorTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48637. $core.addMethod(
  48638. $core.method({
  48639. selector: "astPCNodeVisitor",
  48640. protocol: "factory",
  48641. fn: function (){
  48642. var self=this,$self=this;
  48643. return $core.withContext(function($ctx1) {
  48644. var $1;
  48645. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48646. $recv($1)._index_((0));
  48647. return $recv($1)._yourself();
  48648. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  48649. },
  48650. args: [],
  48651. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48652. referencedClasses: ["ASTPCNodeVisitor"],
  48653. messageSends: ["index:", "new", "yourself"]
  48654. }),
  48655. $globals.ASTPCNodeVisitorTest);
  48656. $core.addMethod(
  48657. $core.method({
  48658. selector: "astPCNodeVisitorForSelector:",
  48659. protocol: "factory",
  48660. fn: function (aString){
  48661. var self=this,$self=this;
  48662. return $core.withContext(function($ctx1) {
  48663. var $1;
  48664. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48665. $recv($1)._selector_(aString);
  48666. $recv($1)._index_((0));
  48667. return $recv($1)._yourself();
  48668. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  48669. },
  48670. args: ["aString"],
  48671. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48672. referencedClasses: ["ASTPCNodeVisitor"],
  48673. messageSends: ["selector:", "new", "index:", "yourself"]
  48674. }),
  48675. $globals.ASTPCNodeVisitorTest);
  48676. $core.addMethod(
  48677. $core.method({
  48678. selector: "testJSStatementNode",
  48679. protocol: "tests",
  48680. fn: function (){
  48681. var self=this,$self=this;
  48682. var ast,visitor;
  48683. return $core.withContext(function($ctx1) {
  48684. var $3,$2,$1;
  48685. ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  48686. $3=$self._astPCNodeVisitor();
  48687. $recv($3)._visit_(ast);
  48688. $2=$recv($3)._currentNode();
  48689. $1=$recv($2)._isJSStatementNode();
  48690. $self._assert_($1);
  48691. return self;
  48692. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  48693. },
  48694. args: [],
  48695. 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",
  48696. referencedClasses: ["Object"],
  48697. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  48698. }),
  48699. $globals.ASTPCNodeVisitorTest);
  48700. $core.addMethod(
  48701. $core.method({
  48702. selector: "testMessageSend",
  48703. protocol: "tests",
  48704. fn: function (){
  48705. var self=this,$self=this;
  48706. var ast;
  48707. return $core.withContext(function($ctx1) {
  48708. var $3,$2,$1;
  48709. ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  48710. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48711. $recv($3)._visit_(ast);
  48712. $2=$recv($3)._currentNode();
  48713. $1=$recv($2)._selector();
  48714. $self._assert_equals_($1,"yourself");
  48715. return self;
  48716. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48717. },
  48718. args: [],
  48719. 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'",
  48720. referencedClasses: ["Object"],
  48721. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48722. }),
  48723. $globals.ASTPCNodeVisitorTest);
  48724. $core.addMethod(
  48725. $core.method({
  48726. selector: "testMessageSendWithBlocks",
  48727. protocol: "tests",
  48728. fn: function (){
  48729. var self=this,$self=this;
  48730. var ast;
  48731. return $core.withContext(function($ctx1) {
  48732. var $3,$2,$1;
  48733. ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  48734. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48735. $recv($3)._visit_(ast);
  48736. $2=$recv($3)._currentNode();
  48737. $1=$recv($2)._selector();
  48738. $self._assert_equals_($1,"yourself");
  48739. return self;
  48740. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48741. },
  48742. args: [],
  48743. 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'",
  48744. referencedClasses: ["Object"],
  48745. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48746. }),
  48747. $globals.ASTPCNodeVisitorTest);
  48748. $core.addMethod(
  48749. $core.method({
  48750. selector: "testMessageSendWithInlining",
  48751. protocol: "tests",
  48752. fn: function (){
  48753. var self=this,$self=this;
  48754. var ast;
  48755. return $core.withContext(function($ctx1) {
  48756. var $3,$4,$2,$1,$7,$6,$5;
  48757. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48758. $ctx1.sendIdx["parse:forClass:"]=1;
  48759. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48760. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  48761. $recv($3)._visit_(ast);
  48762. $ctx1.sendIdx["visit:"]=1;
  48763. $4=$recv($3)._currentNode();
  48764. $ctx1.sendIdx["currentNode"]=1;
  48765. $2=$4;
  48766. $1=$recv($2)._selector();
  48767. $ctx1.sendIdx["selector"]=1;
  48768. $self._assert_equals_($1,"yourself");
  48769. $ctx1.sendIdx["assert:equals:"]=1;
  48770. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48771. $7=$self._astPCNodeVisitorForSelector_("asBoolean");
  48772. $recv($7)._visit_(ast);
  48773. $6=$recv($7)._currentNode();
  48774. $5=$recv($6)._selector();
  48775. $self._assert_equals_($5,"asBoolean");
  48776. return self;
  48777. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48778. },
  48779. args: [],
  48780. 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'",
  48781. referencedClasses: ["Object"],
  48782. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48783. }),
  48784. $globals.ASTPCNodeVisitorTest);
  48785. $core.addMethod(
  48786. $core.method({
  48787. selector: "testNoMessageSend",
  48788. protocol: "tests",
  48789. fn: function (){
  48790. var self=this,$self=this;
  48791. var ast;
  48792. return $core.withContext(function($ctx1) {
  48793. var $3,$2,$1;
  48794. ast=$self._parse_forClass_("foo ^ self",$globals.Object);
  48795. $3=$self._astPCNodeVisitor();
  48796. $recv($3)._visit_(ast);
  48797. $2=$recv($3)._currentNode();
  48798. $1=$recv($2)._isNil();
  48799. $self._assert_($1);
  48800. return self;
  48801. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48802. },
  48803. args: [],
  48804. 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",
  48805. referencedClasses: ["Object"],
  48806. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  48807. }),
  48808. $globals.ASTPCNodeVisitorTest);
  48809. $core.addClass("ASTPositionTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48810. $core.addMethod(
  48811. $core.method({
  48812. selector: "testNodeAtPosition",
  48813. protocol: "tests",
  48814. fn: function (){
  48815. var self=this,$self=this;
  48816. var node;
  48817. return $core.withContext(function($ctx1) {
  48818. var $3,$4,$2,$1,$7,$8,$6,$5;
  48819. node=$self._parse_forClass_("yourself\x0a\x09^ self",$globals.Object);
  48820. $ctx1.sendIdx["parse:forClass:"]=1;
  48821. $3=node;
  48822. $4=(2).__at((4));
  48823. $ctx1.sendIdx["@"]=1;
  48824. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  48825. return nil;
  48826. }));
  48827. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  48828. $1=$recv($2)._source();
  48829. $self._assert_equals_($1,"self");
  48830. $ctx1.sendIdx["assert:equals:"]=1;
  48831. node=$self._parse_forClass_("foo\x0a\x09true ifTrue: [ 1 ]",$globals.Object);
  48832. $ctx1.sendIdx["parse:forClass:"]=2;
  48833. $7=node;
  48834. $8=(2).__at((7));
  48835. $ctx1.sendIdx["@"]=2;
  48836. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  48837. return nil;
  48838. }));
  48839. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  48840. $5=$recv($6)._selector();
  48841. $ctx1.sendIdx["selector"]=1;
  48842. $self._assert_equals_($5,"ifTrue:");
  48843. $ctx1.sendIdx["assert:equals:"]=2;
  48844. node=$self._parse_forClass_("foo\x0a\x09self foo; bar; baz",$globals.Object);
  48845. $self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  48846. return nil;
  48847. })))._selector(),"foo");
  48848. return self;
  48849. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  48850. },
  48851. args: [],
  48852. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  48853. referencedClasses: ["Object"],
  48854. messageSends: ["parse:forClass:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  48855. }),
  48856. $globals.ASTPositionTest);
  48857. $core.addClass("CodeGeneratorTest", $globals.ASTParsingTest, ["receiver"], "Compiler-Tests");
  48858. $core.addMethod(
  48859. $core.method({
  48860. selector: "codeGeneratorClass",
  48861. protocol: "accessing",
  48862. fn: function (){
  48863. var self=this,$self=this;
  48864. return $globals.CodeGenerator;
  48865. },
  48866. args: [],
  48867. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  48868. referencedClasses: ["CodeGenerator"],
  48869. messageSends: []
  48870. }),
  48871. $globals.CodeGeneratorTest);
  48872. $core.addMethod(
  48873. $core.method({
  48874. selector: "compiler",
  48875. protocol: "factory",
  48876. fn: function (){
  48877. var self=this,$self=this;
  48878. return $core.withContext(function($ctx1) {
  48879. var $1;
  48880. $1=$recv($globals.Compiler)._new();
  48881. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  48882. return $recv($1)._yourself();
  48883. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  48884. },
  48885. args: [],
  48886. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  48887. referencedClasses: ["Compiler"],
  48888. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  48889. }),
  48890. $globals.CodeGeneratorTest);
  48891. $core.addMethod(
  48892. $core.method({
  48893. selector: "setUp",
  48894. protocol: "initialization",
  48895. fn: function (){
  48896. var self=this,$self=this;
  48897. return $core.withContext(function($ctx1) {
  48898. $self["@receiver"]=$recv($globals.DoIt)._new();
  48899. return self;
  48900. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  48901. },
  48902. args: [],
  48903. source: "setUp\x0a\x09receiver := DoIt new",
  48904. referencedClasses: ["DoIt"],
  48905. messageSends: ["new"]
  48906. }),
  48907. $globals.CodeGeneratorTest);
  48908. $core.addMethod(
  48909. $core.method({
  48910. selector: "should:receiver:raise:",
  48911. protocol: "testing",
  48912. fn: function (aString,anObject,anErrorClass){
  48913. var self=this,$self=this;
  48914. var method,result;
  48915. return $core.withContext(function($ctx1) {
  48916. var $1,$2,$3,$receiver;
  48917. $self["@receiver"]=anObject;
  48918. $recv((function(){
  48919. return $core.withContext(function($ctx2) {
  48920. return $self._should_raise_((function(){
  48921. return $core.withContext(function($ctx3) {
  48922. $1=$self._compiler();
  48923. $2=$recv(anObject)._class();
  48924. $ctx3.sendIdx["class"]=1;
  48925. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  48926. return $recv($self["@receiver"])._perform_($recv(method)._selector());
  48927. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48928. }),anErrorClass);
  48929. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48930. }))._ensure_((function(){
  48931. return $core.withContext(function($ctx2) {
  48932. $3=method;
  48933. if(($receiver = $3) == null || $receiver.a$nil){
  48934. return $3;
  48935. } else {
  48936. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  48937. }
  48938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48939. }));
  48940. return self;
  48941. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  48942. },
  48943. args: ["aString", "anObject", "anErrorClass"],
  48944. 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 ] ]",
  48945. referencedClasses: [],
  48946. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  48947. }),
  48948. $globals.CodeGeneratorTest);
  48949. $core.addMethod(
  48950. $core.method({
  48951. selector: "should:receiver:return:",
  48952. protocol: "testing",
  48953. fn: function (aString,anObject,aResult){
  48954. var self=this,$self=this;
  48955. var method,result;
  48956. return $core.withContext(function($ctx1) {
  48957. var $1,$2;
  48958. $self["@receiver"]=anObject;
  48959. $1=$self._compiler();
  48960. $2=$recv(anObject)._class();
  48961. $ctx1.sendIdx["class"]=1;
  48962. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  48963. result=$recv($self["@receiver"])._perform_($recv(method)._selector());
  48964. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  48965. $self._assert_equals_(aResult,result);
  48966. return self;
  48967. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  48968. },
  48969. args: ["aString", "anObject", "aResult"],
  48970. 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",
  48971. referencedClasses: [],
  48972. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  48973. }),
  48974. $globals.CodeGeneratorTest);
  48975. $core.addMethod(
  48976. $core.method({
  48977. selector: "should:return:",
  48978. protocol: "testing",
  48979. fn: function (aString,anObject){
  48980. var self=this,$self=this;
  48981. return $core.withContext(function($ctx1) {
  48982. return $self._should_receiver_return_(aString,$self["@receiver"],anObject);
  48983. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  48984. },
  48985. args: ["aString", "anObject"],
  48986. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  48987. referencedClasses: [],
  48988. messageSends: ["should:receiver:return:"]
  48989. }),
  48990. $globals.CodeGeneratorTest);
  48991. $core.addMethod(
  48992. $core.method({
  48993. selector: "tearDown",
  48994. protocol: "initialization",
  48995. fn: function (){
  48996. var self=this,$self=this;
  48997. return self;
  48998. },
  48999. args: [],
  49000. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  49001. referencedClasses: [],
  49002. messageSends: []
  49003. }),
  49004. $globals.CodeGeneratorTest);
  49005. $core.addMethod(
  49006. $core.method({
  49007. selector: "testAssignment",
  49008. protocol: "tests",
  49009. fn: function (){
  49010. var self=this,$self=this;
  49011. return $core.withContext(function($ctx1) {
  49012. $self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  49013. $ctx1.sendIdx["should:return:"]=1;
  49014. $self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  49015. $ctx1.sendIdx["should:return:"]=2;
  49016. $self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  49017. return self;
  49018. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  49019. },
  49020. args: [],
  49021. 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",
  49022. referencedClasses: [],
  49023. messageSends: ["should:return:"]
  49024. }),
  49025. $globals.CodeGeneratorTest);
  49026. $core.addMethod(
  49027. $core.method({
  49028. selector: "testBackslashSelectors",
  49029. protocol: "tests",
  49030. fn: function (){
  49031. var self=this,$self=this;
  49032. return $core.withContext(function($ctx1) {
  49033. $self._should_return_("\x5c arg ^ 4",(4));
  49034. $ctx1.sendIdx["should:return:"]=1;
  49035. $self._should_return_("\x5c\x5c arg ^ 42",(42));
  49036. return self;
  49037. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  49038. },
  49039. args: [],
  49040. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  49041. referencedClasses: [],
  49042. messageSends: ["should:return:"]
  49043. }),
  49044. $globals.CodeGeneratorTest);
  49045. $core.addMethod(
  49046. $core.method({
  49047. selector: "testBlockReturn",
  49048. protocol: "tests",
  49049. fn: function (){
  49050. var self=this,$self=this;
  49051. return $core.withContext(function($ctx1) {
  49052. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  49053. $ctx1.sendIdx["should:return:"]=1;
  49054. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  49055. $ctx1.sendIdx["should:return:"]=2;
  49056. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  49057. return self;
  49058. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  49059. },
  49060. args: [],
  49061. 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).",
  49062. referencedClasses: [],
  49063. messageSends: ["should:return:"]
  49064. }),
  49065. $globals.CodeGeneratorTest);
  49066. $core.addMethod(
  49067. $core.method({
  49068. selector: "testCascades",
  49069. protocol: "tests",
  49070. fn: function (){
  49071. var self=this,$self=this;
  49072. return $core.withContext(function($ctx1) {
  49073. $self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  49074. return self;
  49075. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  49076. },
  49077. args: [],
  49078. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  49079. referencedClasses: [],
  49080. messageSends: ["should:return:"]
  49081. }),
  49082. $globals.CodeGeneratorTest);
  49083. $core.addMethod(
  49084. $core.method({
  49085. selector: "testCascadesInDynamicArray",
  49086. protocol: "tests",
  49087. fn: function (){
  49088. var self=this,$self=this;
  49089. return $core.withContext(function($ctx1) {
  49090. $self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  49091. return self;
  49092. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  49093. },
  49094. args: [],
  49095. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  49096. referencedClasses: [],
  49097. messageSends: ["should:return:"]
  49098. }),
  49099. $globals.CodeGeneratorTest);
  49100. $core.addMethod(
  49101. $core.method({
  49102. selector: "testCascadesInDynamicDictioary",
  49103. protocol: "tests",
  49104. fn: function (){
  49105. var self=this,$self=this;
  49106. return $core.withContext(function($ctx1) {
  49107. $self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  49108. return self;
  49109. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  49110. },
  49111. args: [],
  49112. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  49113. referencedClasses: [],
  49114. messageSends: ["should:return:"]
  49115. }),
  49116. $globals.CodeGeneratorTest);
  49117. $core.addMethod(
  49118. $core.method({
  49119. selector: "testCascadesInSend",
  49120. protocol: "tests",
  49121. fn: function (){
  49122. var self=this,$self=this;
  49123. return $core.withContext(function($ctx1) {
  49124. $self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  49125. return self;
  49126. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  49127. },
  49128. args: [],
  49129. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  49130. referencedClasses: [],
  49131. messageSends: ["should:return:"]
  49132. }),
  49133. $globals.CodeGeneratorTest);
  49134. $core.addMethod(
  49135. $core.method({
  49136. selector: "testCascadesWithInlining",
  49137. protocol: "tests",
  49138. fn: function (){
  49139. var self=this,$self=this;
  49140. return $core.withContext(function($ctx1) {
  49141. $self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  49142. $ctx1.sendIdx["should:return:"]=1;
  49143. $self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  49144. return self;
  49145. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  49146. },
  49147. args: [],
  49148. 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",
  49149. referencedClasses: [],
  49150. messageSends: ["should:return:"]
  49151. }),
  49152. $globals.CodeGeneratorTest);
  49153. $core.addMethod(
  49154. $core.method({
  49155. selector: "testDynamicArrayElementsOrdered",
  49156. protocol: "tests",
  49157. fn: function (){
  49158. var self=this,$self=this;
  49159. return $core.withContext(function($ctx1) {
  49160. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  49161. $ctx1.sendIdx["should:return:"]=1;
  49162. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  49163. return self;
  49164. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  49165. },
  49166. args: [],
  49167. 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).",
  49168. referencedClasses: [],
  49169. messageSends: ["should:return:"]
  49170. }),
  49171. $globals.CodeGeneratorTest);
  49172. $core.addMethod(
  49173. $core.method({
  49174. selector: "testDynamicDictionaryElementsOrdered",
  49175. protocol: "tests",
  49176. fn: function (){
  49177. var self=this,$self=this;
  49178. return $core.withContext(function($ctx1) {
  49179. $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)]));
  49180. return self;
  49181. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  49182. },
  49183. args: [],
  49184. 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}.",
  49185. referencedClasses: [],
  49186. messageSends: ["should:return:"]
  49187. }),
  49188. $globals.CodeGeneratorTest);
  49189. $core.addMethod(
  49190. $core.method({
  49191. selector: "testDynamicDictionaryWithMoreArrows",
  49192. protocol: "tests",
  49193. fn: function (){
  49194. var self=this,$self=this;
  49195. return $core.withContext(function($ctx1) {
  49196. var $2,$1;
  49197. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  49198. $ctx1.sendIdx["->"]=1;
  49199. $1=$recv($globals.HashedCollection)._with_($2);
  49200. $self._should_return_("foo ^ #{1->2->3}",$1);
  49201. return self;
  49202. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  49203. },
  49204. args: [],
  49205. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  49206. referencedClasses: ["HashedCollection"],
  49207. messageSends: ["should:return:", "with:", "->"]
  49208. }),
  49209. $globals.CodeGeneratorTest);
  49210. $core.addMethod(
  49211. $core.method({
  49212. selector: "testGlobalVar",
  49213. protocol: "tests",
  49214. fn: function (){
  49215. var self=this,$self=this;
  49216. return $core.withContext(function($ctx1) {
  49217. $self._should_return_("foo ^ eval class",$globals.BlockClosure);
  49218. $ctx1.sendIdx["should:return:"]=1;
  49219. $self._should_return_("foo ^ Math cos: 0",(1));
  49220. $ctx1.sendIdx["should:return:"]=2;
  49221. $self._should_return_("foo ^ NonExistingVar",nil);
  49222. return self;
  49223. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  49224. },
  49225. args: [],
  49226. 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",
  49227. referencedClasses: ["BlockClosure"],
  49228. messageSends: ["should:return:"]
  49229. }),
  49230. $globals.CodeGeneratorTest);
  49231. $core.addMethod(
  49232. $core.method({
  49233. selector: "testInnerTemporalDependentElementsOrdered",
  49234. protocol: "tests",
  49235. fn: function (){
  49236. var self=this,$self=this;
  49237. return $core.withContext(function($ctx1) {
  49238. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  49239. $2="foo".__minus_gt($globals.Array);
  49240. $ctx1.sendIdx["->"]=1;
  49241. $3="bar".__minus_gt((2));
  49242. $ctx1.sendIdx["->"]=2;
  49243. $1=[$2,$3];
  49244. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  49245. $ctx1.sendIdx["should:return:"]=1;
  49246. $5="foo".__minus_gt($globals.Array);
  49247. $ctx1.sendIdx["->"]=3;
  49248. $6="bar".__minus_gt((2));
  49249. $ctx1.sendIdx["->"]=4;
  49250. $4=[$5,$6];
  49251. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  49252. $ctx1.sendIdx["should:return:"]=2;
  49253. $8="foo".__minus_gt((1));
  49254. $ctx1.sendIdx["->"]=5;
  49255. $9="bar".__minus_gt((2));
  49256. $ctx1.sendIdx["->"]=6;
  49257. $7=[$8,$9];
  49258. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  49259. $ctx1.sendIdx["should:return:"]=3;
  49260. $11="foo".__minus_gt((1));
  49261. $ctx1.sendIdx["->"]=7;
  49262. $10=[$11,"bar".__minus_gt((2))];
  49263. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  49264. $ctx1.sendIdx["should:return:"]=4;
  49265. $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)]));
  49266. return self;
  49267. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  49268. },
  49269. args: [],
  49270. 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}.",
  49271. referencedClasses: ["Array"],
  49272. messageSends: ["should:return:", "->"]
  49273. }),
  49274. $globals.CodeGeneratorTest);
  49275. $core.addMethod(
  49276. $core.method({
  49277. selector: "testLexicalScope",
  49278. protocol: "tests",
  49279. fn: function (){
  49280. var self=this,$self=this;
  49281. return $core.withContext(function($ctx1) {
  49282. $self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  49283. return self;
  49284. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  49285. },
  49286. args: [],
  49287. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  49288. referencedClasses: [],
  49289. messageSends: ["should:return:"]
  49290. }),
  49291. $globals.CodeGeneratorTest);
  49292. $core.addMethod(
  49293. $core.method({
  49294. selector: "testLiterals",
  49295. protocol: "tests",
  49296. fn: function (){
  49297. var self=this,$self=this;
  49298. return $core.withContext(function($ctx1) {
  49299. $self._should_return_("foo ^ 1",(1));
  49300. $ctx1.sendIdx["should:return:"]=1;
  49301. $self._should_return_("foo ^ 'hello'","hello");
  49302. $ctx1.sendIdx["should:return:"]=2;
  49303. $self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  49304. $ctx1.sendIdx["should:return:"]=3;
  49305. $self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  49306. $ctx1.sendIdx["should:return:"]=4;
  49307. $self._should_return_("foo ^ true",true);
  49308. $ctx1.sendIdx["should:return:"]=5;
  49309. $self._should_return_("foo ^ false",false);
  49310. $ctx1.sendIdx["should:return:"]=6;
  49311. $self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  49312. $ctx1.sendIdx["should:return:"]=7;
  49313. $self._should_return_("foo ^ #hello","hello");
  49314. $ctx1.sendIdx["should:return:"]=8;
  49315. $self._should_return_("foo ^ $h","h");
  49316. $ctx1.sendIdx["should:return:"]=9;
  49317. $self._should_return_("foo ^ -123.456",(-123.456));
  49318. $ctx1.sendIdx["should:return:"]=10;
  49319. $self._should_return_("foo ^ -2.5e4",(-25000));
  49320. return self;
  49321. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  49322. },
  49323. args: [],
  49324. 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.",
  49325. referencedClasses: [],
  49326. messageSends: ["should:return:"]
  49327. }),
  49328. $globals.CodeGeneratorTest);
  49329. $core.addMethod(
  49330. $core.method({
  49331. selector: "testLocalReturn",
  49332. protocol: "tests",
  49333. fn: function (){
  49334. var self=this,$self=this;
  49335. return $core.withContext(function($ctx1) {
  49336. $self._should_return_("foo ^ 1",(1));
  49337. $ctx1.sendIdx["should:return:"]=1;
  49338. $self._should_return_("foo ^ 1 + 1",(2));
  49339. $ctx1.sendIdx["should:return:"]=2;
  49340. $self._should_return_("foo ",$self["@receiver"]);
  49341. $ctx1.sendIdx["should:return:"]=3;
  49342. $self._should_return_("foo self asString",$self["@receiver"]);
  49343. $ctx1.sendIdx["should:return:"]=4;
  49344. $self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  49345. return self;
  49346. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  49347. },
  49348. args: [],
  49349. 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",
  49350. referencedClasses: [],
  49351. messageSends: ["should:return:"]
  49352. }),
  49353. $globals.CodeGeneratorTest);
  49354. $core.addMethod(
  49355. $core.method({
  49356. selector: "testMessageSends",
  49357. protocol: "tests",
  49358. fn: function (){
  49359. var self=this,$self=this;
  49360. return $core.withContext(function($ctx1) {
  49361. $self._should_return_("foo ^ 1 asString","1");
  49362. $ctx1.sendIdx["should:return:"]=1;
  49363. $self._should_return_("foo ^ 1 + 1",(2));
  49364. $ctx1.sendIdx["should:return:"]=2;
  49365. $self._should_return_("foo ^ 1 + 2 * 3",(9));
  49366. $ctx1.sendIdx["should:return:"]=3;
  49367. $self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  49368. $ctx1.sendIdx["should:return:"]=4;
  49369. $self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  49370. return self;
  49371. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  49372. },
  49373. args: [],
  49374. 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)",
  49375. referencedClasses: [],
  49376. messageSends: ["should:return:"]
  49377. }),
  49378. $globals.CodeGeneratorTest);
  49379. $core.addMethod(
  49380. $core.method({
  49381. selector: "testMistypedPragmaJSStatement",
  49382. protocol: "tests",
  49383. fn: function (){
  49384. var self=this,$self=this;
  49385. return $core.withContext(function($ctx1) {
  49386. $self._should_receiver_raise_("foo < inlineJS: 'return 'foo'' >",$self["@receiver"],$globals.ParseError);
  49387. return self;
  49388. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49389. },
  49390. args: [],
  49391. source: "testMistypedPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return ''foo'''' >' receiver: receiver raise: ParseError",
  49392. referencedClasses: ["ParseError"],
  49393. messageSends: ["should:receiver:raise:"]
  49394. }),
  49395. $globals.CodeGeneratorTest);
  49396. $core.addMethod(
  49397. $core.method({
  49398. selector: "testMultipleSequences",
  49399. protocol: "tests",
  49400. fn: function (){
  49401. var self=this,$self=this;
  49402. return $core.withContext(function($ctx1) {
  49403. $self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  49404. return self;
  49405. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  49406. },
  49407. args: [],
  49408. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  49409. referencedClasses: [],
  49410. messageSends: ["should:return:"]
  49411. }),
  49412. $globals.CodeGeneratorTest);
  49413. $core.addMethod(
  49414. $core.method({
  49415. selector: "testMutableLiterals",
  49416. protocol: "tests",
  49417. fn: function (){
  49418. var self=this,$self=this;
  49419. return $core.withContext(function($ctx1) {
  49420. $self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  49421. return self;
  49422. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  49423. },
  49424. args: [],
  49425. 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)",
  49426. referencedClasses: [],
  49427. messageSends: ["should:return:"]
  49428. }),
  49429. $globals.CodeGeneratorTest);
  49430. $core.addMethod(
  49431. $core.method({
  49432. selector: "testNestedIfTrue",
  49433. protocol: "tests",
  49434. fn: function (){
  49435. var self=this,$self=this;
  49436. return $core.withContext(function($ctx1) {
  49437. $self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  49438. $ctx1.sendIdx["should:return:"]=1;
  49439. $self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  49440. $ctx1.sendIdx["should:return:"]=2;
  49441. $self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  49442. $ctx1.sendIdx["should:return:"]=3;
  49443. $self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",$self["@receiver"]);
  49444. return self;
  49445. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  49446. },
  49447. args: [],
  49448. 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.",
  49449. referencedClasses: [],
  49450. messageSends: ["should:return:"]
  49451. }),
  49452. $globals.CodeGeneratorTest);
  49453. $core.addMethod(
  49454. $core.method({
  49455. selector: "testNestedSends",
  49456. protocol: "tests",
  49457. fn: function (){
  49458. var self=this,$self=this;
  49459. return $core.withContext(function($ctx1) {
  49460. $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());
  49461. return self;
  49462. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  49463. },
  49464. args: [],
  49465. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  49466. referencedClasses: ["Point"],
  49467. messageSends: ["should:return:", "asString", "x:y:", "@"]
  49468. }),
  49469. $globals.CodeGeneratorTest);
  49470. $core.addMethod(
  49471. $core.method({
  49472. selector: "testNonLocalReturn",
  49473. protocol: "tests",
  49474. fn: function (){
  49475. var self=this,$self=this;
  49476. return $core.withContext(function($ctx1) {
  49477. $self._should_return_("foo [ ^ 1 ] value",(1));
  49478. $ctx1.sendIdx["should:return:"]=1;
  49479. $self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  49480. $ctx1.sendIdx["should:return:"]=2;
  49481. $self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  49482. $ctx1.sendIdx["should:return:"]=3;
  49483. $self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  49484. return self;
  49485. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  49486. },
  49487. args: [],
  49488. 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",
  49489. referencedClasses: [],
  49490. messageSends: ["should:return:"]
  49491. }),
  49492. $globals.CodeGeneratorTest);
  49493. $core.addMethod(
  49494. $core.method({
  49495. selector: "testPascalCaseGlobal",
  49496. protocol: "tests",
  49497. fn: function (){
  49498. var self=this,$self=this;
  49499. return $core.withContext(function($ctx1) {
  49500. $self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  49501. $ctx1.sendIdx["should:return:"]=1;
  49502. $self._should_return_("foo ^NonExistent",nil);
  49503. return self;
  49504. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  49505. },
  49506. args: [],
  49507. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  49508. referencedClasses: ["Smalltalk"],
  49509. messageSends: ["should:return:", "at:", "globals"]
  49510. }),
  49511. $globals.CodeGeneratorTest);
  49512. $core.addMethod(
  49513. $core.method({
  49514. selector: "testPragmaInBlock",
  49515. protocol: "tests",
  49516. fn: function (){
  49517. var self=this,$self=this;
  49518. return $core.withContext(function($ctx1) {
  49519. $self._should_receiver_raise_("foo ^ [ < fooBar > 4 ] value",$self["@receiver"],$globals.CompilerError);
  49520. return self;
  49521. }, function($ctx1) {$ctx1.fill(self,"testPragmaInBlock",{},$globals.CodeGeneratorTest)});
  49522. },
  49523. args: [],
  49524. source: "testPragmaInBlock\x0a\x09self should: 'foo ^ [ < fooBar > 4 ] value' receiver: receiver raise: CompilerError",
  49525. referencedClasses: ["CompilerError"],
  49526. messageSends: ["should:receiver:raise:"]
  49527. }),
  49528. $globals.CodeGeneratorTest);
  49529. $core.addMethod(
  49530. $core.method({
  49531. selector: "testPragmaJSStatement",
  49532. protocol: "tests",
  49533. fn: function (){
  49534. var self=this,$self=this;
  49535. return $core.withContext(function($ctx1) {
  49536. $self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  49537. return self;
  49538. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49539. },
  49540. args: [],
  49541. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  49542. referencedClasses: [],
  49543. messageSends: ["should:return:"]
  49544. }),
  49545. $globals.CodeGeneratorTest);
  49546. $core.addMethod(
  49547. $core.method({
  49548. selector: "testRootSuperSend",
  49549. protocol: "tests",
  49550. fn: function (){
  49551. var self=this,$self=this;
  49552. return $core.withContext(function($ctx1) {
  49553. $self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  49554. return self;
  49555. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  49556. },
  49557. args: [],
  49558. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  49559. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  49560. messageSends: ["should:receiver:raise:", "new"]
  49561. }),
  49562. $globals.CodeGeneratorTest);
  49563. $core.addMethod(
  49564. $core.method({
  49565. selector: "testSendReceiverAndArgumentsOrdered",
  49566. protocol: "tests",
  49567. fn: function (){
  49568. var self=this,$self=this;
  49569. return $core.withContext(function($ctx1) {
  49570. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  49571. $ctx1.sendIdx["should:return:"]=1;
  49572. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  49573. return self;
  49574. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  49575. },
  49576. args: [],
  49577. 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}.",
  49578. referencedClasses: ["Array"],
  49579. messageSends: ["should:return:"]
  49580. }),
  49581. $globals.CodeGeneratorTest);
  49582. $core.addMethod(
  49583. $core.method({
  49584. selector: "testSuperSend",
  49585. protocol: "tests",
  49586. fn: function (){
  49587. var self=this,$self=this;
  49588. return $core.withContext(function($ctx1) {
  49589. $self._should_receiver_return_("foo ^ super isBoolean",true,false);
  49590. return self;
  49591. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  49592. },
  49593. args: [],
  49594. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  49595. referencedClasses: [],
  49596. messageSends: ["should:receiver:return:"]
  49597. }),
  49598. $globals.CodeGeneratorTest);
  49599. $core.addMethod(
  49600. $core.method({
  49601. selector: "testTempVariables",
  49602. protocol: "tests",
  49603. fn: function (){
  49604. var self=this,$self=this;
  49605. return $core.withContext(function($ctx1) {
  49606. $self._should_return_("foo | a | ^ a",nil);
  49607. $ctx1.sendIdx["should:return:"]=1;
  49608. $self._should_return_("foo | AVariable | ^ AVariable",nil);
  49609. $ctx1.sendIdx["should:return:"]=2;
  49610. $self._should_return_("foo | a b c | ^ c",nil);
  49611. $ctx1.sendIdx["should:return:"]=3;
  49612. $self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  49613. $ctx1.sendIdx["should:return:"]=4;
  49614. $self._should_return_("foo | a | a:= 1. ^ a",(1));
  49615. $ctx1.sendIdx["should:return:"]=5;
  49616. $self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  49617. return self;
  49618. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  49619. },
  49620. args: [],
  49621. 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.",
  49622. referencedClasses: [],
  49623. messageSends: ["should:return:"]
  49624. }),
  49625. $globals.CodeGeneratorTest);
  49626. $core.addMethod(
  49627. $core.method({
  49628. selector: "testThisContext",
  49629. protocol: "tests",
  49630. fn: function (){
  49631. var self=this,$self=this;
  49632. return $core.withContext(function($ctx1) {
  49633. $self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  49634. return self;
  49635. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  49636. },
  49637. args: [],
  49638. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  49639. referencedClasses: [],
  49640. messageSends: ["should:return:"]
  49641. }),
  49642. $globals.CodeGeneratorTest);
  49643. $core.addMethod(
  49644. $core.method({
  49645. selector: "testUnknownPragma",
  49646. protocol: "tests",
  49647. fn: function (){
  49648. var self=this,$self=this;
  49649. return $core.withContext(function($ctx1) {
  49650. $self._should_return_("foo < fooBar: 'return 2+3' > | x | ^ x := 6",(6));
  49651. $ctx1.sendIdx["should:return:"]=1;
  49652. $self._should_return_("foo | x | < fooBar: 'return 2+3' > ^ x := 6",(6));
  49653. return self;
  49654. }, function($ctx1) {$ctx1.fill(self,"testUnknownPragma",{},$globals.CodeGeneratorTest)});
  49655. },
  49656. args: [],
  49657. source: "testUnknownPragma\x0a\x09self should: 'foo < fooBar: ''return 2+3'' > | x | ^ x := 6' return: 6.\x0a\x09self should: 'foo | x | < fooBar: ''return 2+3'' > ^ x := 6' return: 6",
  49658. referencedClasses: [],
  49659. messageSends: ["should:return:"]
  49660. }),
  49661. $globals.CodeGeneratorTest);
  49662. $core.addMethod(
  49663. $core.method({
  49664. selector: "testifFalse",
  49665. protocol: "tests",
  49666. fn: function (){
  49667. var self=this,$self=this;
  49668. return $core.withContext(function($ctx1) {
  49669. $self._should_return_("foo true ifFalse: [ ^ 1 ]",$self["@receiver"]);
  49670. $ctx1.sendIdx["should:return:"]=1;
  49671. $self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  49672. $ctx1.sendIdx["should:return:"]=2;
  49673. $self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  49674. $ctx1.sendIdx["should:return:"]=3;
  49675. $self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  49676. return self;
  49677. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  49678. },
  49679. args: [],
  49680. 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.",
  49681. referencedClasses: [],
  49682. messageSends: ["should:return:"]
  49683. }),
  49684. $globals.CodeGeneratorTest);
  49685. $core.addMethod(
  49686. $core.method({
  49687. selector: "testifFalseIfTrue",
  49688. protocol: "tests",
  49689. fn: function (){
  49690. var self=this,$self=this;
  49691. return $core.withContext(function($ctx1) {
  49692. $self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  49693. $ctx1.sendIdx["should:return:"]=1;
  49694. $self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  49695. $ctx1.sendIdx["should:return:"]=2;
  49696. $self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  49697. $ctx1.sendIdx["should:return:"]=3;
  49698. $self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  49699. return self;
  49700. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  49701. },
  49702. args: [],
  49703. 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.",
  49704. referencedClasses: [],
  49705. messageSends: ["should:return:"]
  49706. }),
  49707. $globals.CodeGeneratorTest);
  49708. $core.addMethod(
  49709. $core.method({
  49710. selector: "testifNil",
  49711. protocol: "tests",
  49712. fn: function (){
  49713. var self=this,$self=this;
  49714. return $core.withContext(function($ctx1) {
  49715. $self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  49716. $ctx1.sendIdx["should:return:"]=1;
  49717. $self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  49718. $ctx1.sendIdx["should:return:"]=2;
  49719. $self._should_return_("foo 1 ifNil: [ ^ 2 ]",$self["@receiver"]);
  49720. $ctx1.sendIdx["should:return:"]=3;
  49721. $self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  49722. return self;
  49723. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  49724. },
  49725. args: [],
  49726. 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.",
  49727. referencedClasses: [],
  49728. messageSends: ["should:return:"]
  49729. }),
  49730. $globals.CodeGeneratorTest);
  49731. $core.addMethod(
  49732. $core.method({
  49733. selector: "testifNilIfNotNil",
  49734. protocol: "tests",
  49735. fn: function (){
  49736. var self=this,$self=this;
  49737. return $core.withContext(function($ctx1) {
  49738. $self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  49739. $ctx1.sendIdx["should:return:"]=1;
  49740. $self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  49741. $ctx1.sendIdx["should:return:"]=2;
  49742. $self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  49743. $ctx1.sendIdx["should:return:"]=3;
  49744. $self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  49745. return self;
  49746. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  49747. },
  49748. args: [],
  49749. 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.",
  49750. referencedClasses: [],
  49751. messageSends: ["should:return:"]
  49752. }),
  49753. $globals.CodeGeneratorTest);
  49754. $core.addMethod(
  49755. $core.method({
  49756. selector: "testifNotNil",
  49757. protocol: "tests",
  49758. fn: function (){
  49759. var self=this,$self=this;
  49760. return $core.withContext(function($ctx1) {
  49761. $self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  49762. $ctx1.sendIdx["should:return:"]=1;
  49763. $self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  49764. $ctx1.sendIdx["should:return:"]=2;
  49765. $self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  49766. $ctx1.sendIdx["should:return:"]=3;
  49767. $self._should_return_("foo nil ifNotNil: [ ^ 2 ]",$self["@receiver"]);
  49768. return self;
  49769. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  49770. },
  49771. args: [],
  49772. 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.",
  49773. referencedClasses: [],
  49774. messageSends: ["should:return:"]
  49775. }),
  49776. $globals.CodeGeneratorTest);
  49777. $core.addMethod(
  49778. $core.method({
  49779. selector: "testifNotNilWithArgument",
  49780. protocol: "tests",
  49781. fn: function (){
  49782. var self=this,$self=this;
  49783. return $core.withContext(function($ctx1) {
  49784. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  49785. $ctx1.sendIdx["should:return:"]=1;
  49786. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  49787. $ctx1.sendIdx["should:return:"]=2;
  49788. $self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  49789. $ctx1.sendIdx["should:return:"]=3;
  49790. $self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  49791. $ctx1.sendIdx["should:return:"]=4;
  49792. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  49793. $ctx1.sendIdx["should:return:"]=5;
  49794. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  49795. return self;
  49796. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  49797. },
  49798. args: [],
  49799. 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",
  49800. referencedClasses: [],
  49801. messageSends: ["should:return:"]
  49802. }),
  49803. $globals.CodeGeneratorTest);
  49804. $core.addMethod(
  49805. $core.method({
  49806. selector: "testifTrue",
  49807. protocol: "tests",
  49808. fn: function (){
  49809. var self=this,$self=this;
  49810. return $core.withContext(function($ctx1) {
  49811. $self._should_return_("foo false ifTrue: [ ^ 1 ]",$self["@receiver"]);
  49812. $ctx1.sendIdx["should:return:"]=1;
  49813. $self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  49814. $ctx1.sendIdx["should:return:"]=2;
  49815. $self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  49816. $ctx1.sendIdx["should:return:"]=3;
  49817. $self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  49818. return self;
  49819. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  49820. },
  49821. args: [],
  49822. 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.",
  49823. referencedClasses: [],
  49824. messageSends: ["should:return:"]
  49825. }),
  49826. $globals.CodeGeneratorTest);
  49827. $core.addMethod(
  49828. $core.method({
  49829. selector: "testifTrueIfFalse",
  49830. protocol: "tests",
  49831. fn: function (){
  49832. var self=this,$self=this;
  49833. return $core.withContext(function($ctx1) {
  49834. $self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  49835. $ctx1.sendIdx["should:return:"]=1;
  49836. $self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  49837. $ctx1.sendIdx["should:return:"]=2;
  49838. $self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  49839. $ctx1.sendIdx["should:return:"]=3;
  49840. $self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  49841. return self;
  49842. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  49843. },
  49844. args: [],
  49845. 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.",
  49846. referencedClasses: [],
  49847. messageSends: ["should:return:"]
  49848. }),
  49849. $globals.CodeGeneratorTest);
  49850. $core.addClass("ASTInterpreterTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49851. $core.addMethod(
  49852. $core.method({
  49853. selector: "interpret:receiver:withArguments:",
  49854. protocol: "private",
  49855. fn: function (aString,anObject,aDictionary){
  49856. var self=this,$self=this;
  49857. var ctx,ast,interpreter;
  49858. return $core.withContext(function($ctx1) {
  49859. var $1,$2,$3,$receiver;
  49860. interpreter=$recv($globals.ASTInterpreter)._new();
  49861. $ctx1.sendIdx["new"]=1;
  49862. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49863. $1=$recv($globals.AIContext)._new();
  49864. $recv($1)._receiver_(anObject);
  49865. $recv($1)._interpreter_(interpreter);
  49866. ctx=$recv($1)._yourself();
  49867. $2=$recv(ast)._sequenceNode();
  49868. if(($receiver = $2) == null || $receiver.a$nil){
  49869. $2;
  49870. } else {
  49871. var sequence;
  49872. sequence=$receiver;
  49873. $recv($recv(sequence)._temps())._do_((function(each){
  49874. return $core.withContext(function($ctx2) {
  49875. return $recv(ctx)._defineLocal_(each);
  49876. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49877. }));
  49878. }
  49879. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49880. return $core.withContext(function($ctx2) {
  49881. return $recv(ctx)._localAt_put_(key,value);
  49882. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49883. }));
  49884. $3=interpreter;
  49885. $recv($3)._context_(ctx);
  49886. $recv($3)._node_(ast);
  49887. $recv($3)._enterNode();
  49888. $recv($3)._proceed();
  49889. return $recv($3)._result();
  49890. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  49891. },
  49892. args: ["aString", "anObject", "aDictionary"],
  49893. 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",
  49894. referencedClasses: ["ASTInterpreter", "AIContext"],
  49895. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  49896. }),
  49897. $globals.ASTInterpreterTest);
  49898. $core.addMethod(
  49899. $core.method({
  49900. selector: "should:receiver:return:",
  49901. protocol: "testing",
  49902. fn: function (aString,anObject,aResult){
  49903. var self=this,$self=this;
  49904. return $core.withContext(function($ctx1) {
  49905. $self["@receiver"]=anObject;
  49906. return $self._assert_equals_($self._interpret_receiver_withArguments_(aString,$self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  49907. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  49908. },
  49909. args: ["aString", "anObject", "aResult"],
  49910. 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",
  49911. referencedClasses: [],
  49912. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  49913. }),
  49914. $globals.ASTInterpreterTest);
  49915. $core.addClass("ASTDebuggerTest", $globals.ASTInterpreterTest, [], "Compiler-Tests");
  49916. $core.addMethod(
  49917. $core.method({
  49918. selector: "interpret:receiver:withArguments:",
  49919. protocol: "private",
  49920. fn: function (aString,anObject,aDictionary){
  49921. var self=this,$self=this;
  49922. var ctx,ast,debugger_;
  49923. return $core.withContext(function($ctx1) {
  49924. var $1,$2,$3,$4,$5,$receiver;
  49925. $1=$recv($globals.AIContext)._new();
  49926. $ctx1.sendIdx["new"]=1;
  49927. $recv($1)._receiver_(anObject);
  49928. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  49929. ctx=$recv($1)._yourself();
  49930. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49931. $2=$recv(ast)._sequenceNode();
  49932. if(($receiver = $2) == null || $receiver.a$nil){
  49933. $2;
  49934. } else {
  49935. var sequence;
  49936. sequence=$receiver;
  49937. $recv($recv(sequence)._temps())._do_((function(each){
  49938. return $core.withContext(function($ctx2) {
  49939. return $recv(ctx)._defineLocal_(each);
  49940. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49941. }));
  49942. }
  49943. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49944. return $core.withContext(function($ctx2) {
  49945. return $recv(ctx)._localAt_put_(key,value);
  49946. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49947. }));
  49948. $3=$recv(ctx)._interpreter();
  49949. $ctx1.sendIdx["interpreter"]=1;
  49950. $recv($3)._context_(ctx);
  49951. $ctx1.sendIdx["context:"]=1;
  49952. $4=$recv(ctx)._interpreter();
  49953. $recv($4)._node_(ast);
  49954. $recv($4)._enterNode();
  49955. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  49956. $5=debugger_;
  49957. $recv($5)._proceed();
  49958. return $recv($5)._result();
  49959. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  49960. },
  49961. args: ["aString", "anObject", "aDictionary"],
  49962. 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",
  49963. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  49964. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  49965. }),
  49966. $globals.ASTDebuggerTest);
  49967. $core.addClass("InliningCodeGeneratorTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49968. $core.addMethod(
  49969. $core.method({
  49970. selector: "codeGeneratorClass",
  49971. protocol: "accessing",
  49972. fn: function (){
  49973. var self=this,$self=this;
  49974. return $globals.InliningCodeGenerator;
  49975. },
  49976. args: [],
  49977. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  49978. referencedClasses: ["InliningCodeGenerator"],
  49979. messageSends: []
  49980. }),
  49981. $globals.InliningCodeGeneratorTest);
  49982. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  49983. $core.addMethod(
  49984. $core.method({
  49985. selector: "testClassRefVar",
  49986. protocol: "tests",
  49987. fn: function (){
  49988. var self=this,$self=this;
  49989. var node;
  49990. return $core.withContext(function($ctx1) {
  49991. var $1,$2;
  49992. $1=$recv($globals.VariableNode)._new();
  49993. $ctx1.sendIdx["new"]=1;
  49994. $recv($1)._value_("Object");
  49995. node=$recv($1)._yourself();
  49996. $2=$recv($globals.SemanticAnalyzer)._new();
  49997. $ctx1.sendIdx["new"]=2;
  49998. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  49999. $recv($2)._visit_(node);
  50000. $self._assert_($recv($recv(node)._binding())._isClassRefVar());
  50001. return self;
  50002. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  50003. },
  50004. args: [],
  50005. 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",
  50006. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  50007. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  50008. }),
  50009. $globals.ScopeVarTest);
  50010. $core.addMethod(
  50011. $core.method({
  50012. selector: "testInstanceVar",
  50013. protocol: "tests",
  50014. fn: function (){
  50015. var self=this,$self=this;
  50016. var node,scope;
  50017. return $core.withContext(function($ctx1) {
  50018. var $1;
  50019. $1=$recv($globals.VariableNode)._new();
  50020. $ctx1.sendIdx["new"]=1;
  50021. $recv($1)._value_("bzzz");
  50022. node=$recv($1)._yourself();
  50023. scope=$recv($globals.MethodLexicalScope)._new();
  50024. $recv(scope)._addIVar_("bzzz");
  50025. $self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  50026. return self;
  50027. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  50028. },
  50029. args: [],
  50030. 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",
  50031. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50032. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  50033. }),
  50034. $globals.ScopeVarTest);
  50035. $core.addMethod(
  50036. $core.method({
  50037. selector: "testPseudoVar",
  50038. protocol: "tests",
  50039. fn: function (){
  50040. var self=this,$self=this;
  50041. var node,pseudoVars;
  50042. return $core.withContext(function($ctx1) {
  50043. var $1;
  50044. pseudoVars=["self", "super", "true", "false", "nil"];
  50045. $recv(pseudoVars)._do_((function(each){
  50046. return $core.withContext(function($ctx2) {
  50047. $1=$recv($globals.VariableNode)._new();
  50048. $ctx2.sendIdx["new"]=1;
  50049. $recv($1)._value_(each);
  50050. node=$recv($1)._yourself();
  50051. return $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  50052. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50053. }));
  50054. return self;
  50055. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  50056. },
  50057. args: [],
  50058. 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]",
  50059. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50060. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  50061. }),
  50062. $globals.ScopeVarTest);
  50063. $core.addMethod(
  50064. $core.method({
  50065. selector: "testTempVar",
  50066. protocol: "tests",
  50067. fn: function (){
  50068. var self=this,$self=this;
  50069. var node,scope;
  50070. return $core.withContext(function($ctx1) {
  50071. var $1;
  50072. $1=$recv($globals.VariableNode)._new();
  50073. $ctx1.sendIdx["new"]=1;
  50074. $recv($1)._value_("bzzz");
  50075. node=$recv($1)._yourself();
  50076. scope=$recv($globals.MethodLexicalScope)._new();
  50077. $recv(scope)._addTemp_("bzzz");
  50078. $self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  50079. return self;
  50080. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  50081. },
  50082. args: [],
  50083. 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",
  50084. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50085. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  50086. }),
  50087. $globals.ScopeVarTest);
  50088. $core.addMethod(
  50089. $core.method({
  50090. selector: "testUnknownVar",
  50091. protocol: "tests",
  50092. fn: function (){
  50093. var self=this,$self=this;
  50094. var node;
  50095. return $core.withContext(function($ctx1) {
  50096. var $1;
  50097. $1=$recv($globals.VariableNode)._new();
  50098. $ctx1.sendIdx["new"]=1;
  50099. $recv($1)._value_("bzzz");
  50100. node=$recv($1)._yourself();
  50101. $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  50102. return self;
  50103. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  50104. },
  50105. args: [],
  50106. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  50107. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50108. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  50109. }),
  50110. $globals.ScopeVarTest);
  50111. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  50112. $core.addMethod(
  50113. $core.method({
  50114. selector: "setUp",
  50115. protocol: "running",
  50116. fn: function (){
  50117. var self=this,$self=this;
  50118. return $core.withContext(function($ctx1) {
  50119. $self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  50120. return self;
  50121. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  50122. },
  50123. args: [],
  50124. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  50125. referencedClasses: ["SemanticAnalyzer", "Object"],
  50126. messageSends: ["on:"]
  50127. }),
  50128. $globals.SemanticAnalyzerTest);
  50129. $core.addMethod(
  50130. $core.method({
  50131. selector: "testAssignment",
  50132. protocol: "tests",
  50133. fn: function (){
  50134. var self=this,$self=this;
  50135. var src,ast;
  50136. return $core.withContext(function($ctx1) {
  50137. src="foo self := 1";
  50138. ast=$recv($globals.Smalltalk)._parse_(src);
  50139. $self._should_raise_((function(){
  50140. return $core.withContext(function($ctx2) {
  50141. return $recv($self["@analyzer"])._visit_(ast);
  50142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50143. }),$globals.InvalidAssignmentError);
  50144. return self;
  50145. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50146. },
  50147. args: [],
  50148. 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",
  50149. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  50150. messageSends: ["parse:", "should:raise:", "visit:"]
  50151. }),
  50152. $globals.SemanticAnalyzerTest);
  50153. $core.addMethod(
  50154. $core.method({
  50155. selector: "testNonLocalReturn",
  50156. protocol: "tests",
  50157. fn: function (){
  50158. var self=this,$self=this;
  50159. var src,ast;
  50160. return $core.withContext(function($ctx1) {
  50161. src="foo | a | a + 1. ^ a";
  50162. ast=$recv($globals.Smalltalk)._parse_(src);
  50163. $recv($self["@analyzer"])._visit_(ast);
  50164. $self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  50165. return self;
  50166. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50167. },
  50168. args: [],
  50169. 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",
  50170. referencedClasses: ["Smalltalk"],
  50171. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  50172. }),
  50173. $globals.SemanticAnalyzerTest);
  50174. $core.addMethod(
  50175. $core.method({
  50176. selector: "testNonLocalReturn2",
  50177. protocol: "tests",
  50178. fn: function (){
  50179. var self=this,$self=this;
  50180. var src,ast;
  50181. return $core.withContext(function($ctx1) {
  50182. src="foo | a | a + 1. [ [ ^ a] ]";
  50183. ast=$recv($globals.Smalltalk)._parse_(src);
  50184. $recv($self["@analyzer"])._visit_(ast);
  50185. $self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  50186. return self;
  50187. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50188. },
  50189. args: [],
  50190. 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",
  50191. referencedClasses: ["Smalltalk"],
  50192. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  50193. }),
  50194. $globals.SemanticAnalyzerTest);
  50195. $core.addMethod(
  50196. $core.method({
  50197. selector: "testScope",
  50198. protocol: "tests",
  50199. fn: function (){
  50200. var self=this,$self=this;
  50201. var src,ast;
  50202. return $core.withContext(function($ctx1) {
  50203. var $4,$3,$2,$1;
  50204. src="foo | a | a + 1. [ | b | b := a ]";
  50205. ast=$recv($globals.Smalltalk)._parse_(src);
  50206. $recv($self["@analyzer"])._visit_(ast);
  50207. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50208. $ctx1.sendIdx["dagChildren"]=1;
  50209. $3=$recv($4)._last();
  50210. $2=$recv($3)._scope();
  50211. $ctx1.sendIdx["scope"]=1;
  50212. $1=$recv($2).__eq_eq($recv(ast)._scope());
  50213. $self._deny_($1);
  50214. return self;
  50215. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50216. },
  50217. args: [],
  50218. 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.",
  50219. referencedClasses: ["Smalltalk"],
  50220. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  50221. }),
  50222. $globals.SemanticAnalyzerTest);
  50223. $core.addMethod(
  50224. $core.method({
  50225. selector: "testScope2",
  50226. protocol: "tests",
  50227. fn: function (){
  50228. var self=this,$self=this;
  50229. var src,ast;
  50230. return $core.withContext(function($ctx1) {
  50231. var $8,$7,$6,$5,$4,$3,$2,$1;
  50232. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  50233. ast=$recv($globals.Smalltalk)._parse_(src);
  50234. $recv($self["@analyzer"])._visit_(ast);
  50235. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50236. $ctx1.sendIdx["dagChildren"]=3;
  50237. $7=$recv($8)._last();
  50238. $6=$recv($7)._dagChildren();
  50239. $ctx1.sendIdx["dagChildren"]=2;
  50240. $5=$recv($6)._first();
  50241. $ctx1.sendIdx["first"]=2;
  50242. $4=$recv($5)._dagChildren();
  50243. $ctx1.sendIdx["dagChildren"]=1;
  50244. $3=$recv($4)._first();
  50245. $ctx1.sendIdx["first"]=1;
  50246. $2=$recv($3)._scope();
  50247. $ctx1.sendIdx["scope"]=1;
  50248. $1=$recv($2).__eq_eq($recv(ast)._scope());
  50249. $self._deny_($1);
  50250. return self;
  50251. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50252. },
  50253. args: [],
  50254. 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.",
  50255. referencedClasses: ["Smalltalk"],
  50256. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  50257. }),
  50258. $globals.SemanticAnalyzerTest);
  50259. $core.addMethod(
  50260. $core.method({
  50261. selector: "testScopeLevel",
  50262. protocol: "tests",
  50263. fn: function (){
  50264. var self=this,$self=this;
  50265. var src,ast;
  50266. return $core.withContext(function($ctx1) {
  50267. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  50268. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  50269. ast=$recv($globals.Smalltalk)._parse_(src);
  50270. $recv($self["@analyzer"])._visit_(ast);
  50271. $2=$recv(ast)._scope();
  50272. $ctx1.sendIdx["scope"]=1;
  50273. $1=$recv($2)._scopeLevel();
  50274. $ctx1.sendIdx["scopeLevel"]=1;
  50275. $self._assert_equals_($1,(1));
  50276. $ctx1.sendIdx["assert:equals:"]=1;
  50277. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50278. $ctx1.sendIdx["dagChildren"]=3;
  50279. $9=$recv($10)._last();
  50280. $8=$recv($9)._dagChildren();
  50281. $ctx1.sendIdx["dagChildren"]=2;
  50282. $7=$recv($8)._first();
  50283. $ctx1.sendIdx["first"]=2;
  50284. $6=$recv($7)._dagChildren();
  50285. $ctx1.sendIdx["dagChildren"]=1;
  50286. $5=$recv($6)._first();
  50287. $ctx1.sendIdx["first"]=1;
  50288. $4=$recv($5)._scope();
  50289. $3=$recv($4)._scopeLevel();
  50290. $self._assert_equals_($3,(3));
  50291. return self;
  50292. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50293. },
  50294. args: [],
  50295. 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",
  50296. referencedClasses: ["Smalltalk"],
  50297. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  50298. }),
  50299. $globals.SemanticAnalyzerTest);
  50300. $core.addMethod(
  50301. $core.method({
  50302. selector: "testUnknownVariables",
  50303. protocol: "tests",
  50304. fn: function (){
  50305. var self=this,$self=this;
  50306. var src,ast;
  50307. return $core.withContext(function($ctx1) {
  50308. src="foo | a | b + a";
  50309. ast=$recv($globals.Smalltalk)._parse_(src);
  50310. $self._should_raise_((function(){
  50311. return $core.withContext(function($ctx2) {
  50312. return $recv($self["@analyzer"])._visit_(ast);
  50313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50314. }),$globals.UnknownVariableError);
  50315. return self;
  50316. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50317. },
  50318. args: [],
  50319. 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",
  50320. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50321. messageSends: ["parse:", "should:raise:", "visit:"]
  50322. }),
  50323. $globals.SemanticAnalyzerTest);
  50324. $core.addMethod(
  50325. $core.method({
  50326. selector: "testUnknownVariablesWithScope",
  50327. protocol: "tests",
  50328. fn: function (){
  50329. var self=this,$self=this;
  50330. var src,ast;
  50331. return $core.withContext(function($ctx1) {
  50332. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  50333. ast=$recv($globals.Smalltalk)._parse_(src);
  50334. $self._should_raise_((function(){
  50335. return $core.withContext(function($ctx2) {
  50336. return $recv($self["@analyzer"])._visit_(ast);
  50337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50338. }),$globals.UnknownVariableError);
  50339. return self;
  50340. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50341. },
  50342. args: [],
  50343. 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",
  50344. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50345. messageSends: ["parse:", "should:raise:", "visit:"]
  50346. }),
  50347. $globals.SemanticAnalyzerTest);
  50348. $core.addMethod(
  50349. $core.method({
  50350. selector: "testVariableShadowing",
  50351. protocol: "tests",
  50352. fn: function (){
  50353. var self=this,$self=this;
  50354. var src,ast;
  50355. return $core.withContext(function($ctx1) {
  50356. src="foo | a | a + 1";
  50357. ast=$recv($globals.Smalltalk)._parse_(src);
  50358. $recv($self["@analyzer"])._visit_(ast);
  50359. return self;
  50360. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50361. },
  50362. args: [],
  50363. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50364. referencedClasses: ["Smalltalk"],
  50365. messageSends: ["parse:", "visit:"]
  50366. }),
  50367. $globals.SemanticAnalyzerTest);
  50368. $core.addMethod(
  50369. $core.method({
  50370. selector: "testVariableShadowing2",
  50371. protocol: "tests",
  50372. fn: function (){
  50373. var self=this,$self=this;
  50374. var src,ast;
  50375. return $core.withContext(function($ctx1) {
  50376. src="foo | a | a + 1. [ | a | a := 2 ]";
  50377. ast=$recv($globals.Smalltalk)._parse_(src);
  50378. $self._should_raise_((function(){
  50379. return $core.withContext(function($ctx2) {
  50380. return $recv($self["@analyzer"])._visit_(ast);
  50381. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50382. }),$globals.ShadowingVariableError);
  50383. return self;
  50384. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50385. },
  50386. args: [],
  50387. 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",
  50388. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50389. messageSends: ["parse:", "should:raise:", "visit:"]
  50390. }),
  50391. $globals.SemanticAnalyzerTest);
  50392. $core.addMethod(
  50393. $core.method({
  50394. selector: "testVariableShadowing3",
  50395. protocol: "tests",
  50396. fn: function (){
  50397. var self=this,$self=this;
  50398. var src,ast;
  50399. return $core.withContext(function($ctx1) {
  50400. src="foo | a | a + 1. [ | b | b := 2 ]";
  50401. ast=$recv($globals.Smalltalk)._parse_(src);
  50402. $recv($self["@analyzer"])._visit_(ast);
  50403. return self;
  50404. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50405. },
  50406. args: [],
  50407. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50408. referencedClasses: ["Smalltalk"],
  50409. messageSends: ["parse:", "visit:"]
  50410. }),
  50411. $globals.SemanticAnalyzerTest);
  50412. $core.addMethod(
  50413. $core.method({
  50414. selector: "testVariableShadowing4",
  50415. protocol: "tests",
  50416. fn: function (){
  50417. var self=this,$self=this;
  50418. var src,ast;
  50419. return $core.withContext(function($ctx1) {
  50420. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  50421. ast=$recv($globals.Smalltalk)._parse_(src);
  50422. $recv($self["@analyzer"])._visit_(ast);
  50423. return self;
  50424. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50425. },
  50426. args: [],
  50427. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50428. referencedClasses: ["Smalltalk"],
  50429. messageSends: ["parse:", "visit:"]
  50430. }),
  50431. $globals.SemanticAnalyzerTest);
  50432. $core.addMethod(
  50433. $core.method({
  50434. selector: "testVariableShadowing5",
  50435. protocol: "tests",
  50436. fn: function (){
  50437. var self=this,$self=this;
  50438. var src,ast;
  50439. return $core.withContext(function($ctx1) {
  50440. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  50441. ast=$recv($globals.Smalltalk)._parse_(src);
  50442. $self._should_raise_((function(){
  50443. return $core.withContext(function($ctx2) {
  50444. return $recv($self["@analyzer"])._visit_(ast);
  50445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50446. }),$globals.ShadowingVariableError);
  50447. return self;
  50448. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50449. },
  50450. args: [],
  50451. 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",
  50452. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50453. messageSends: ["parse:", "should:raise:", "visit:"]
  50454. }),
  50455. $globals.SemanticAnalyzerTest);
  50456. $core.addMethod(
  50457. $core.method({
  50458. selector: "testVariablesLookup",
  50459. protocol: "tests",
  50460. fn: function (){
  50461. var self=this,$self=this;
  50462. var src,ast;
  50463. return $core.withContext(function($ctx1) {
  50464. 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;
  50465. src="foo | a | a + 1. [ | b | b := a ]";
  50466. ast=$recv($globals.Smalltalk)._parse_(src);
  50467. $recv($self["@analyzer"])._visit_(ast);
  50468. $7=$recv(ast)._dagChildren();
  50469. $ctx1.sendIdx["dagChildren"]=2;
  50470. $6=$recv($7)._first();
  50471. $ctx1.sendIdx["first"]=2;
  50472. $5=$recv($6)._dagChildren();
  50473. $ctx1.sendIdx["dagChildren"]=1;
  50474. $4=$recv($5)._first();
  50475. $ctx1.sendIdx["first"]=1;
  50476. $3=$recv($4)._receiver();
  50477. $ctx1.sendIdx["receiver"]=1;
  50478. $2=$recv($3)._binding();
  50479. $ctx1.sendIdx["binding"]=1;
  50480. $1=$recv($2)._isTempVar();
  50481. $ctx1.sendIdx["isTempVar"]=1;
  50482. $self._assert_($1);
  50483. $ctx1.sendIdx["assert:"]=1;
  50484. $15=$recv(ast)._dagChildren();
  50485. $ctx1.sendIdx["dagChildren"]=4;
  50486. $14=$recv($15)._first();
  50487. $ctx1.sendIdx["first"]=4;
  50488. $13=$recv($14)._dagChildren();
  50489. $ctx1.sendIdx["dagChildren"]=3;
  50490. $12=$recv($13)._first();
  50491. $ctx1.sendIdx["first"]=3;
  50492. $11=$recv($12)._receiver();
  50493. $10=$recv($11)._binding();
  50494. $ctx1.sendIdx["binding"]=2;
  50495. $9=$recv($10)._scope();
  50496. $ctx1.sendIdx["scope"]=1;
  50497. $16=$recv(ast)._scope();
  50498. $ctx1.sendIdx["scope"]=2;
  50499. $8=$recv($9).__eq_eq($16);
  50500. $ctx1.sendIdx["=="]=1;
  50501. $self._assert_($8);
  50502. $ctx1.sendIdx["assert:"]=2;
  50503. $27=$recv(ast)._dagChildren();
  50504. $ctx1.sendIdx["dagChildren"]=8;
  50505. $26=$recv($27)._first();
  50506. $ctx1.sendIdx["first"]=7;
  50507. $25=$recv($26)._dagChildren();
  50508. $ctx1.sendIdx["dagChildren"]=7;
  50509. $24=$recv($25)._last();
  50510. $ctx1.sendIdx["last"]=1;
  50511. $23=$recv($24)._dagChildren();
  50512. $ctx1.sendIdx["dagChildren"]=6;
  50513. $22=$recv($23)._first();
  50514. $ctx1.sendIdx["first"]=6;
  50515. $21=$recv($22)._dagChildren();
  50516. $ctx1.sendIdx["dagChildren"]=5;
  50517. $20=$recv($21)._first();
  50518. $ctx1.sendIdx["first"]=5;
  50519. $19=$recv($20)._left();
  50520. $ctx1.sendIdx["left"]=1;
  50521. $18=$recv($19)._binding();
  50522. $ctx1.sendIdx["binding"]=3;
  50523. $17=$recv($18)._isTempVar();
  50524. $self._assert_($17);
  50525. $ctx1.sendIdx["assert:"]=3;
  50526. $39=$recv(ast)._dagChildren();
  50527. $ctx1.sendIdx["dagChildren"]=12;
  50528. $38=$recv($39)._first();
  50529. $ctx1.sendIdx["first"]=10;
  50530. $37=$recv($38)._dagChildren();
  50531. $ctx1.sendIdx["dagChildren"]=11;
  50532. $36=$recv($37)._last();
  50533. $ctx1.sendIdx["last"]=2;
  50534. $35=$recv($36)._dagChildren();
  50535. $ctx1.sendIdx["dagChildren"]=10;
  50536. $34=$recv($35)._first();
  50537. $ctx1.sendIdx["first"]=9;
  50538. $33=$recv($34)._dagChildren();
  50539. $ctx1.sendIdx["dagChildren"]=9;
  50540. $32=$recv($33)._first();
  50541. $ctx1.sendIdx["first"]=8;
  50542. $31=$recv($32)._left();
  50543. $30=$recv($31)._binding();
  50544. $29=$recv($30)._scope();
  50545. $ctx1.sendIdx["scope"]=3;
  50546. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50547. $ctx1.sendIdx["dagChildren"]=13;
  50548. $41=$recv($42)._last();
  50549. $40=$recv($41)._scope();
  50550. $28=$recv($29).__eq_eq($40);
  50551. $self._assert_($28);
  50552. return self;
  50553. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50554. },
  50555. args: [],
  50556. 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.",
  50557. referencedClasses: ["Smalltalk"],
  50558. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  50559. }),
  50560. $globals.SemanticAnalyzerTest);
  50561. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  50562. $core.addMethod(
  50563. $core.method({
  50564. selector: "setUp",
  50565. protocol: "running",
  50566. fn: function (){
  50567. var self=this,$self=this;
  50568. return $core.withContext(function($ctx1) {
  50569. var $1,$3,$4,$2;
  50570. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  50571. $3=$recv($globals.AIContext)._new();
  50572. $recv($3)._defineLocal_("local");
  50573. $recv($3)._localAt_put_("local",(3));
  50574. $4=$recv($3)._yourself();
  50575. $ctx1.sendIdx["yourself"]=1;
  50576. $2=$4;
  50577. $recv($1)._context_($2);
  50578. $self["@analyzer"]=$recv($1)._yourself();
  50579. return self;
  50580. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  50581. },
  50582. args: [],
  50583. 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",
  50584. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  50585. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  50586. }),
  50587. $globals.AISemanticAnalyzerTest);
  50588. $core.addMethod(
  50589. $core.method({
  50590. selector: "testContextVariables",
  50591. protocol: "tests",
  50592. fn: function (){
  50593. var self=this,$self=this;
  50594. var src,ast;
  50595. return $core.withContext(function($ctx1) {
  50596. src="foo | a | local + a";
  50597. ast=$recv($globals.Smalltalk)._parse_(src);
  50598. $self._shouldnt_raise_((function(){
  50599. return $core.withContext(function($ctx2) {
  50600. return $recv($self["@analyzer"])._visit_(ast);
  50601. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50602. }),$globals.UnknownVariableError);
  50603. return self;
  50604. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  50605. },
  50606. args: [],
  50607. 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",
  50608. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50609. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  50610. }),
  50611. $globals.AISemanticAnalyzerTest);
  50612. });
  50613. define('amber_core/Kernel-Tests',["amber/boot", "amber_core/Kernel-Objects", "amber_core/SUnit"], function($boot){"use strict";
  50614. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  50615. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  50616. var $pkg = $core.addPackage("Kernel-Tests");
  50617. $pkg.innerEval = function (expr) { return eval(expr); };
  50618. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  50619. $core.addClass("AnnouncementSubscriptionTest", $globals.TestCase, [], "Kernel-Tests");
  50620. $core.addMethod(
  50621. $core.method({
  50622. selector: "testAddExtensionMethod",
  50623. protocol: "tests",
  50624. fn: function (){
  50625. var self=this,$self=this;
  50626. var method,dirty;
  50627. return $core.withContext(function($ctx1) {
  50628. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  50629. $2=$self._class();
  50630. $ctx1.sendIdx["class"]=1;
  50631. $1=$recv($2)._package();
  50632. $ctx1.sendIdx["package"]=1;
  50633. dirty=$recv($1)._isDirty();
  50634. $ctx1.sendIdx["isDirty"]=1;
  50635. $4=$self._class();
  50636. $ctx1.sendIdx["class"]=2;
  50637. $3=$recv($4)._package();
  50638. $ctx1.sendIdx["package"]=2;
  50639. $recv($3)._beClean();
  50640. $5=$self._class();
  50641. $ctx1.sendIdx["class"]=3;
  50642. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  50643. $8=$self._class();
  50644. $ctx1.sendIdx["class"]=4;
  50645. $7=$recv($8)._package();
  50646. $ctx1.sendIdx["package"]=3;
  50647. $6=$recv($7)._isDirty();
  50648. $self._deny_($6);
  50649. $9=$self._class();
  50650. $ctx1.sendIdx["class"]=5;
  50651. $recv($9)._removeCompiledMethod_(method);
  50652. $10=dirty;
  50653. if($core.assert($10)){
  50654. $recv($recv($self._class())._package())._beDirty();
  50655. }
  50656. return self;
  50657. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  50658. },
  50659. args: [],
  50660. 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 ]",
  50661. referencedClasses: [],
  50662. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  50663. }),
  50664. $globals.AnnouncementSubscriptionTest);
  50665. $core.addMethod(
  50666. $core.method({
  50667. selector: "testHandlesAnnouncement",
  50668. protocol: "tests",
  50669. fn: function (){
  50670. var self=this,$self=this;
  50671. var subscription,announcementClass1,announcementClass2,classBuilder;
  50672. return $core.withContext(function($ctx1) {
  50673. var $1,$3,$4,$2,$6,$7,$5;
  50674. classBuilder=$recv($globals.ClassBuilder)._new();
  50675. $ctx1.sendIdx["new"]=1;
  50676. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  50677. $1=$recv($globals.AnnouncementSubscription)._new();
  50678. $ctx1.sendIdx["new"]=2;
  50679. subscription=$recv($1)._announcementClass_($globals.SystemAnnouncement);
  50680. $3=subscription;
  50681. $4=$recv($globals.SystemAnnouncement)._new();
  50682. $ctx1.sendIdx["new"]=3;
  50683. $2=$recv($3)._handlesAnnouncement_($4);
  50684. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  50685. $self._assert_equals_($2,true);
  50686. $ctx1.sendIdx["assert:equals:"]=1;
  50687. $6=subscription;
  50688. $7=$recv(announcementClass1)._new();
  50689. $ctx1.sendIdx["new"]=4;
  50690. $5=$recv($6)._handlesAnnouncement_($7);
  50691. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  50692. $self._assert_equals_($5,true);
  50693. $ctx1.sendIdx["assert:equals:"]=2;
  50694. $self._assert_equals_($recv(subscription)._handlesAnnouncement_($recv($globals.Object)._new()),false);
  50695. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  50696. return self;
  50697. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  50698. },
  50699. args: [],
  50700. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement new) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1 new) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object new) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  50701. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  50702. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  50703. }),
  50704. $globals.AnnouncementSubscriptionTest);
  50705. $core.addClass("AnnouncerTest", $globals.TestCase, [], "Kernel-Tests");
  50706. $core.addMethod(
  50707. $core.method({
  50708. selector: "testOnDo",
  50709. protocol: "tests",
  50710. fn: function (){
  50711. var self=this,$self=this;
  50712. var counter,announcer;
  50713. return $core.withContext(function($ctx1) {
  50714. var $1,$2;
  50715. counter=(0);
  50716. announcer=$recv($globals.Announcer)._new();
  50717. $ctx1.sendIdx["new"]=1;
  50718. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  50719. return $core.withContext(function($ctx2) {
  50720. counter=$recv(counter).__plus((1));
  50721. return counter;
  50722. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50723. }));
  50724. $1=announcer;
  50725. $2=$recv($globals.SystemAnnouncement)._new();
  50726. $ctx1.sendIdx["new"]=2;
  50727. $recv($1)._announce_($2);
  50728. $ctx1.sendIdx["announce:"]=1;
  50729. $self._assert_equals_(counter,(1));
  50730. $ctx1.sendIdx["assert:equals:"]=1;
  50731. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50732. $self._assert_equals_(counter,(2));
  50733. return self;
  50734. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50735. },
  50736. args: [],
  50737. 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.",
  50738. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50739. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  50740. }),
  50741. $globals.AnnouncerTest);
  50742. $core.addMethod(
  50743. $core.method({
  50744. selector: "testOnDoFor",
  50745. protocol: "tests",
  50746. fn: function (){
  50747. var self=this,$self=this;
  50748. var counter,announcer;
  50749. return $core.withContext(function($ctx1) {
  50750. var $1,$2,$3,$4;
  50751. counter=(0);
  50752. announcer=$recv($globals.Announcer)._new();
  50753. $ctx1.sendIdx["new"]=1;
  50754. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  50755. return $core.withContext(function($ctx2) {
  50756. counter=$recv(counter).__plus((1));
  50757. return counter;
  50758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50759. }),self);
  50760. $1=announcer;
  50761. $2=$recv($globals.SystemAnnouncement)._new();
  50762. $ctx1.sendIdx["new"]=2;
  50763. $recv($1)._announce_($2);
  50764. $ctx1.sendIdx["announce:"]=1;
  50765. $self._assert_equals_(counter,(1));
  50766. $ctx1.sendIdx["assert:equals:"]=1;
  50767. $3=announcer;
  50768. $4=$recv($globals.SystemAnnouncement)._new();
  50769. $ctx1.sendIdx["new"]=3;
  50770. $recv($3)._announce_($4);
  50771. $ctx1.sendIdx["announce:"]=2;
  50772. $self._assert_equals_(counter,(2));
  50773. $ctx1.sendIdx["assert:equals:"]=2;
  50774. $recv(announcer)._unsubscribe_(self);
  50775. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50776. $self._assert_equals_(counter,(2));
  50777. return self;
  50778. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50779. },
  50780. args: [],
  50781. 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.",
  50782. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50783. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  50784. }),
  50785. $globals.AnnouncerTest);
  50786. $core.addMethod(
  50787. $core.method({
  50788. selector: "testOnDoOnce",
  50789. protocol: "tests",
  50790. fn: function (){
  50791. var self=this,$self=this;
  50792. var counter,announcer;
  50793. return $core.withContext(function($ctx1) {
  50794. var $1,$2;
  50795. counter=(0);
  50796. announcer=$recv($globals.Announcer)._new();
  50797. $ctx1.sendIdx["new"]=1;
  50798. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  50799. return $core.withContext(function($ctx2) {
  50800. counter=$recv(counter).__plus((1));
  50801. return counter;
  50802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50803. }));
  50804. $1=announcer;
  50805. $2=$recv($globals.SystemAnnouncement)._new();
  50806. $ctx1.sendIdx["new"]=2;
  50807. $recv($1)._announce_($2);
  50808. $ctx1.sendIdx["announce:"]=1;
  50809. $self._assert_equals_(counter,(1));
  50810. $ctx1.sendIdx["assert:equals:"]=1;
  50811. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50812. $self._assert_equals_(counter,(1));
  50813. return self;
  50814. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50815. },
  50816. args: [],
  50817. 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.",
  50818. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50819. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  50820. }),
  50821. $globals.AnnouncerTest);
  50822. $core.addClass("BlockClosureTest", $globals.TestCase, [], "Kernel-Tests");
  50823. $core.addMethod(
  50824. $core.method({
  50825. selector: "localReturnOnDoCatch",
  50826. protocol: "fixture",
  50827. fn: function (){
  50828. var self=this,$self=this;
  50829. return $core.withContext(function($ctx1) {
  50830. var $early={};
  50831. try {
  50832. $recv((function(){
  50833. throw $early=[(2)];
  50834. }))._on_do_($globals.Error,(function(){
  50835. }));
  50836. return (3);
  50837. }
  50838. catch(e) {if(e===$early)return e[0]; throw e}
  50839. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  50840. },
  50841. args: [],
  50842. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  50843. referencedClasses: ["Error"],
  50844. messageSends: ["on:do:"]
  50845. }),
  50846. $globals.BlockClosureTest);
  50847. $core.addMethod(
  50848. $core.method({
  50849. selector: "localReturnOnDoMiss",
  50850. protocol: "fixture",
  50851. fn: function (){
  50852. var self=this,$self=this;
  50853. return $core.withContext(function($ctx1) {
  50854. var $early={};
  50855. try {
  50856. $recv((function(){
  50857. throw $early=[(2)];
  50858. }))._on_do_($globals.Class,(function(){
  50859. }));
  50860. return (3);
  50861. }
  50862. catch(e) {if(e===$early)return e[0]; throw e}
  50863. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  50864. },
  50865. args: [],
  50866. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  50867. referencedClasses: ["Class"],
  50868. messageSends: ["on:do:"]
  50869. }),
  50870. $globals.BlockClosureTest);
  50871. $core.addMethod(
  50872. $core.method({
  50873. selector: "testCanClearInterval",
  50874. protocol: "tests",
  50875. fn: function (){
  50876. var self=this,$self=this;
  50877. return $core.withContext(function($ctx1) {
  50878. $self._shouldnt_raise_((function(){
  50879. return $core.withContext(function($ctx2) {
  50880. return $recv($recv((function(){
  50881. return $core.withContext(function($ctx3) {
  50882. return $recv($recv($globals.Error)._new())._signal();
  50883. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50884. }))._valueWithInterval_((0)))._clearInterval();
  50885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50886. }),$globals.Error);
  50887. return self;
  50888. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  50889. },
  50890. args: [],
  50891. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  50892. referencedClasses: ["Error"],
  50893. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  50894. }),
  50895. $globals.BlockClosureTest);
  50896. $core.addMethod(
  50897. $core.method({
  50898. selector: "testCanClearTimeout",
  50899. protocol: "tests",
  50900. fn: function (){
  50901. var self=this,$self=this;
  50902. return $core.withContext(function($ctx1) {
  50903. $self._shouldnt_raise_((function(){
  50904. return $core.withContext(function($ctx2) {
  50905. return $recv($recv((function(){
  50906. return $core.withContext(function($ctx3) {
  50907. return $recv($recv($globals.Error)._new())._signal();
  50908. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50909. }))._valueWithTimeout_((0)))._clearTimeout();
  50910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50911. }),$globals.Error);
  50912. return self;
  50913. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  50914. },
  50915. args: [],
  50916. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  50917. referencedClasses: ["Error"],
  50918. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  50919. }),
  50920. $globals.BlockClosureTest);
  50921. $core.addMethod(
  50922. $core.method({
  50923. selector: "testCompiledSource",
  50924. protocol: "tests",
  50925. fn: function (){
  50926. var self=this,$self=this;
  50927. return $core.withContext(function($ctx1) {
  50928. $self._assert_($recv($recv((function(){
  50929. return $core.withContext(function($ctx2) {
  50930. return (1).__plus((1));
  50931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50932. }))._compiledSource())._includesSubString_("function"));
  50933. return self;
  50934. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  50935. },
  50936. args: [],
  50937. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  50938. referencedClasses: [],
  50939. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  50940. }),
  50941. $globals.BlockClosureTest);
  50942. $core.addMethod(
  50943. $core.method({
  50944. selector: "testCurrySelf",
  50945. protocol: "tests",
  50946. fn: function (){
  50947. var self=this,$self=this;
  50948. var curriedMethod,array;
  50949. return $core.withContext(function($ctx1) {
  50950. curriedMethod=$recv($recv((function(selfarg,x){
  50951. return $core.withContext(function($ctx2) {
  50952. return $recv(selfarg)._at_(x);
  50953. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  50954. }))._currySelf())._asCompiledMethod_("foo:");
  50955. array=[(3), (1), (4)];
  50956. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  50957. $recv((function(){
  50958. return $core.withContext(function($ctx2) {
  50959. return $self._assert_equals_($recv(array)._foo_((2)),(1));
  50960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50961. }))._ensure_((function(){
  50962. return $core.withContext(function($ctx2) {
  50963. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  50964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50965. }));
  50966. return self;
  50967. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  50968. },
  50969. args: [],
  50970. 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 ]",
  50971. referencedClasses: ["ClassBuilder", "Array"],
  50972. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  50973. }),
  50974. $globals.BlockClosureTest);
  50975. $core.addMethod(
  50976. $core.method({
  50977. selector: "testEnsure",
  50978. protocol: "tests",
  50979. fn: function (){
  50980. var self=this,$self=this;
  50981. return $core.withContext(function($ctx1) {
  50982. $self._assert_equals_($recv((function(){
  50983. return (3);
  50984. }))._ensure_((function(){
  50985. return (4);
  50986. })),(3));
  50987. return self;
  50988. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  50989. },
  50990. args: [],
  50991. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  50992. referencedClasses: [],
  50993. messageSends: ["assert:equals:", "ensure:"]
  50994. }),
  50995. $globals.BlockClosureTest);
  50996. $core.addMethod(
  50997. $core.method({
  50998. selector: "testEnsureRaises",
  50999. protocol: "tests",
  51000. fn: function (){
  51001. var self=this,$self=this;
  51002. return $core.withContext(function($ctx1) {
  51003. $self._should_raise_((function(){
  51004. return $core.withContext(function($ctx2) {
  51005. return $recv((function(){
  51006. return $core.withContext(function($ctx3) {
  51007. return $recv($recv($globals.Error)._new())._signal();
  51008. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51009. }))._ensure_((function(){
  51010. return true;
  51011. }));
  51012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51013. }),$globals.Error);
  51014. return self;
  51015. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  51016. },
  51017. args: [],
  51018. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  51019. referencedClasses: ["Error"],
  51020. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  51021. }),
  51022. $globals.BlockClosureTest);
  51023. $core.addMethod(
  51024. $core.method({
  51025. selector: "testExceptionSemantics",
  51026. protocol: "tests",
  51027. fn: function (){
  51028. var self=this,$self=this;
  51029. return $core.withContext(function($ctx1) {
  51030. $self._timeout_((100));
  51031. $recv($self._async_((function(){
  51032. return $core.withContext(function($ctx2) {
  51033. return $recv((function(){
  51034. return $core.withContext(function($ctx3) {
  51035. $self._assert_(true);
  51036. $recv($globals.Error)._signal();
  51037. $self._deny_(true);
  51038. return $self._finished();
  51039. $ctx3.sendIdx["finished"]=1;
  51040. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51041. }))._on_do_($globals.Error,(function(ex){
  51042. return $core.withContext(function($ctx3) {
  51043. return $self._finished();
  51044. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  51045. }));
  51046. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51047. })))._valueWithTimeout_((0));
  51048. return self;
  51049. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  51050. },
  51051. args: [],
  51052. 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",
  51053. referencedClasses: ["Error"],
  51054. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  51055. }),
  51056. $globals.BlockClosureTest);
  51057. $core.addMethod(
  51058. $core.method({
  51059. selector: "testLocalReturnOnDoCatch",
  51060. protocol: "tests",
  51061. fn: function (){
  51062. var self=this,$self=this;
  51063. return $core.withContext(function($ctx1) {
  51064. $self._assert_equals_($self._localReturnOnDoCatch(),(2));
  51065. return self;
  51066. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  51067. },
  51068. args: [],
  51069. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  51070. referencedClasses: [],
  51071. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  51072. }),
  51073. $globals.BlockClosureTest);
  51074. $core.addMethod(
  51075. $core.method({
  51076. selector: "testLocalReturnOnDoMiss",
  51077. protocol: "tests",
  51078. fn: function (){
  51079. var self=this,$self=this;
  51080. return $core.withContext(function($ctx1) {
  51081. $self._assert_equals_($self._localReturnOnDoMiss(),(2));
  51082. return self;
  51083. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  51084. },
  51085. args: [],
  51086. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  51087. referencedClasses: [],
  51088. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  51089. }),
  51090. $globals.BlockClosureTest);
  51091. $core.addMethod(
  51092. $core.method({
  51093. selector: "testNewWithValues",
  51094. protocol: "tests",
  51095. fn: function (){
  51096. var self=this,$self=this;
  51097. return $core.withContext(function($ctx1) {
  51098. function TestConstructor(arg1, arg2, arg3) {}
  51099. TestConstructor.prototype.name = "theTestPrototype";
  51100. var wrappedConstructor = $recv(TestConstructor);
  51101. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  51102. $self._assert_(result instanceof TestConstructor);
  51103. $self._assert_equals_(result.name, "theTestPrototype");
  51104. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  51105. $self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  51106. return self;
  51107. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  51108. },
  51109. args: [],
  51110. 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'>",
  51111. referencedClasses: [],
  51112. messageSends: []
  51113. }),
  51114. $globals.BlockClosureTest);
  51115. $core.addMethod(
  51116. $core.method({
  51117. selector: "testNumArgs",
  51118. protocol: "tests",
  51119. fn: function (){
  51120. var self=this,$self=this;
  51121. return $core.withContext(function($ctx1) {
  51122. var $1;
  51123. $1=$recv((function(){
  51124. }))._numArgs();
  51125. $ctx1.sendIdx["numArgs"]=1;
  51126. $self._assert_equals_($1,(0));
  51127. $ctx1.sendIdx["assert:equals:"]=1;
  51128. $self._assert_equals_($recv((function(a,b){
  51129. }))._numArgs(),(2));
  51130. return self;
  51131. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  51132. },
  51133. args: [],
  51134. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  51135. referencedClasses: [],
  51136. messageSends: ["assert:equals:", "numArgs"]
  51137. }),
  51138. $globals.BlockClosureTest);
  51139. $core.addMethod(
  51140. $core.method({
  51141. selector: "testOnDo",
  51142. protocol: "tests",
  51143. fn: function (){
  51144. var self=this,$self=this;
  51145. return $core.withContext(function($ctx1) {
  51146. $self._assert_($recv((function(){
  51147. return $core.withContext(function($ctx2) {
  51148. return $recv($recv($globals.Error)._new())._signal();
  51149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51150. }))._on_do_($globals.Error,(function(ex){
  51151. return true;
  51152. })));
  51153. return self;
  51154. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  51155. },
  51156. args: [],
  51157. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  51158. referencedClasses: ["Error"],
  51159. messageSends: ["assert:", "on:do:", "signal", "new"]
  51160. }),
  51161. $globals.BlockClosureTest);
  51162. $core.addMethod(
  51163. $core.method({
  51164. selector: "testValue",
  51165. protocol: "tests",
  51166. fn: function (){
  51167. var self=this,$self=this;
  51168. return $core.withContext(function($ctx1) {
  51169. var $1;
  51170. $1=$recv((function(){
  51171. return $core.withContext(function($ctx2) {
  51172. return (1).__plus((1));
  51173. $ctx2.sendIdx["+"]=1;
  51174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51175. }))._value();
  51176. $ctx1.sendIdx["value"]=1;
  51177. $self._assert_equals_($1,(2));
  51178. $ctx1.sendIdx["assert:equals:"]=1;
  51179. $self._assert_equals_($recv((function(x){
  51180. return $core.withContext(function($ctx2) {
  51181. return $recv(x).__plus((1));
  51182. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  51183. }))._value_((2)),(3));
  51184. $ctx1.sendIdx["assert:equals:"]=2;
  51185. $self._assert_equals_($recv((function(x,y){
  51186. return $core.withContext(function($ctx2) {
  51187. return $recv(x).__star(y);
  51188. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  51189. }))._value_value_((2),(4)),(8));
  51190. $ctx1.sendIdx["assert:equals:"]=3;
  51191. $self._assert_equals_($recv((function(a,b,c){
  51192. return (1);
  51193. }))._value(),(1));
  51194. return self;
  51195. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  51196. },
  51197. args: [],
  51198. 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",
  51199. referencedClasses: [],
  51200. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  51201. }),
  51202. $globals.BlockClosureTest);
  51203. $core.addMethod(
  51204. $core.method({
  51205. selector: "testValueWithPossibleArguments",
  51206. protocol: "tests",
  51207. fn: function (){
  51208. var self=this,$self=this;
  51209. return $core.withContext(function($ctx1) {
  51210. var $1,$2;
  51211. $1=$recv((function(){
  51212. return (1);
  51213. }))._valueWithPossibleArguments_([(3), (4)]);
  51214. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  51215. $self._assert_equals_($1,(1));
  51216. $ctx1.sendIdx["assert:equals:"]=1;
  51217. $2=$recv((function(a){
  51218. return $core.withContext(function($ctx2) {
  51219. return $recv(a).__plus((4));
  51220. $ctx2.sendIdx["+"]=1;
  51221. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  51222. }))._valueWithPossibleArguments_([(3), (4)]);
  51223. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  51224. $self._assert_equals_($2,(7));
  51225. $ctx1.sendIdx["assert:equals:"]=2;
  51226. $self._assert_equals_($recv((function(a,b){
  51227. return $core.withContext(function($ctx2) {
  51228. return $recv(a).__plus(b);
  51229. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  51230. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  51231. return self;
  51232. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  51233. },
  51234. args: [],
  51235. 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.",
  51236. referencedClasses: [],
  51237. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  51238. }),
  51239. $globals.BlockClosureTest);
  51240. $core.addMethod(
  51241. $core.method({
  51242. selector: "testWhileFalse",
  51243. protocol: "tests",
  51244. fn: function (){
  51245. var self=this,$self=this;
  51246. var i;
  51247. return $core.withContext(function($ctx1) {
  51248. i=(0);
  51249. $recv((function(){
  51250. return $core.withContext(function($ctx2) {
  51251. return $recv(i).__gt((5));
  51252. $ctx2.sendIdx[">"]=1;
  51253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51254. }))._whileFalse_((function(){
  51255. return $core.withContext(function($ctx2) {
  51256. i=$recv(i).__plus((1));
  51257. $ctx2.sendIdx["+"]=1;
  51258. return i;
  51259. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51260. }));
  51261. $self._assert_equals_(i,(6));
  51262. $ctx1.sendIdx["assert:equals:"]=1;
  51263. i=(0);
  51264. $recv((function(){
  51265. return $core.withContext(function($ctx2) {
  51266. i=$recv(i).__plus((1));
  51267. return $recv(i).__gt((5));
  51268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51269. }))._whileFalse();
  51270. $self._assert_equals_(i,(6));
  51271. return self;
  51272. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  51273. },
  51274. args: [],
  51275. 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",
  51276. referencedClasses: [],
  51277. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  51278. }),
  51279. $globals.BlockClosureTest);
  51280. $core.addMethod(
  51281. $core.method({
  51282. selector: "testWhileTrue",
  51283. protocol: "tests",
  51284. fn: function (){
  51285. var self=this,$self=this;
  51286. var i;
  51287. return $core.withContext(function($ctx1) {
  51288. i=(0);
  51289. $recv((function(){
  51290. return $core.withContext(function($ctx2) {
  51291. return $recv(i).__lt((5));
  51292. $ctx2.sendIdx["<"]=1;
  51293. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51294. }))._whileTrue_((function(){
  51295. return $core.withContext(function($ctx2) {
  51296. i=$recv(i).__plus((1));
  51297. $ctx2.sendIdx["+"]=1;
  51298. return i;
  51299. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51300. }));
  51301. $self._assert_equals_(i,(5));
  51302. $ctx1.sendIdx["assert:equals:"]=1;
  51303. i=(0);
  51304. $recv((function(){
  51305. return $core.withContext(function($ctx2) {
  51306. i=$recv(i).__plus((1));
  51307. return $recv(i).__lt((5));
  51308. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51309. }))._whileTrue();
  51310. $self._assert_equals_(i,(5));
  51311. return self;
  51312. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  51313. },
  51314. args: [],
  51315. 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",
  51316. referencedClasses: [],
  51317. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  51318. }),
  51319. $globals.BlockClosureTest);
  51320. $core.addClass("BooleanTest", $globals.TestCase, [], "Kernel-Tests");
  51321. $core.addMethod(
  51322. $core.method({
  51323. selector: "testEquality",
  51324. protocol: "tests",
  51325. fn: function (){
  51326. var self=this,$self=this;
  51327. return $core.withContext(function($ctx1) {
  51328. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51329. $1=(0).__eq(false);
  51330. $ctx1.sendIdx["="]=1;
  51331. $self._deny_($1);
  51332. $ctx1.sendIdx["deny:"]=1;
  51333. $2=false.__eq((0));
  51334. $ctx1.sendIdx["="]=2;
  51335. $self._deny_($2);
  51336. $ctx1.sendIdx["deny:"]=2;
  51337. $3="".__eq(false);
  51338. $ctx1.sendIdx["="]=3;
  51339. $self._deny_($3);
  51340. $ctx1.sendIdx["deny:"]=3;
  51341. $4=false.__eq("");
  51342. $ctx1.sendIdx["="]=4;
  51343. $self._deny_($4);
  51344. $ctx1.sendIdx["deny:"]=4;
  51345. $5=true.__eq(true);
  51346. $ctx1.sendIdx["="]=5;
  51347. $self._assert_($5);
  51348. $ctx1.sendIdx["assert:"]=1;
  51349. $6=false.__eq(true);
  51350. $ctx1.sendIdx["="]=6;
  51351. $self._deny_($6);
  51352. $ctx1.sendIdx["deny:"]=5;
  51353. $7=true.__eq(false);
  51354. $ctx1.sendIdx["="]=7;
  51355. $self._deny_($7);
  51356. $8=false.__eq(false);
  51357. $ctx1.sendIdx["="]=8;
  51358. $self._assert_($8);
  51359. $ctx1.sendIdx["assert:"]=2;
  51360. $10=true._yourself();
  51361. $ctx1.sendIdx["yourself"]=1;
  51362. $9=$recv($10).__eq(true);
  51363. $ctx1.sendIdx["="]=9;
  51364. $self._assert_($9);
  51365. $ctx1.sendIdx["assert:"]=3;
  51366. $12=true._yourself();
  51367. $ctx1.sendIdx["yourself"]=2;
  51368. $11=$recv($12).__eq(true._yourself());
  51369. $self._assert_($11);
  51370. return self;
  51371. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  51372. },
  51373. args: [],
  51374. 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)",
  51375. referencedClasses: [],
  51376. messageSends: ["deny:", "=", "assert:", "yourself"]
  51377. }),
  51378. $globals.BooleanTest);
  51379. $core.addMethod(
  51380. $core.method({
  51381. selector: "testIdentity",
  51382. protocol: "tests",
  51383. fn: function (){
  51384. var self=this,$self=this;
  51385. return $core.withContext(function($ctx1) {
  51386. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51387. $1=(0).__eq_eq(false);
  51388. $ctx1.sendIdx["=="]=1;
  51389. $self._deny_($1);
  51390. $ctx1.sendIdx["deny:"]=1;
  51391. $2=false.__eq_eq((0));
  51392. $ctx1.sendIdx["=="]=2;
  51393. $self._deny_($2);
  51394. $ctx1.sendIdx["deny:"]=2;
  51395. $3="".__eq_eq(false);
  51396. $ctx1.sendIdx["=="]=3;
  51397. $self._deny_($3);
  51398. $ctx1.sendIdx["deny:"]=3;
  51399. $4=false.__eq_eq("");
  51400. $ctx1.sendIdx["=="]=4;
  51401. $self._deny_($4);
  51402. $ctx1.sendIdx["deny:"]=4;
  51403. $5=true.__eq_eq(true);
  51404. $ctx1.sendIdx["=="]=5;
  51405. $self._assert_($5);
  51406. $ctx1.sendIdx["assert:"]=1;
  51407. $6=false.__eq_eq(true);
  51408. $ctx1.sendIdx["=="]=6;
  51409. $self._deny_($6);
  51410. $ctx1.sendIdx["deny:"]=5;
  51411. $7=true.__eq_eq(false);
  51412. $ctx1.sendIdx["=="]=7;
  51413. $self._deny_($7);
  51414. $8=false.__eq_eq(false);
  51415. $ctx1.sendIdx["=="]=8;
  51416. $self._assert_($8);
  51417. $ctx1.sendIdx["assert:"]=2;
  51418. $10=true._yourself();
  51419. $ctx1.sendIdx["yourself"]=1;
  51420. $9=$recv($10).__eq_eq(true);
  51421. $ctx1.sendIdx["=="]=9;
  51422. $self._assert_($9);
  51423. $ctx1.sendIdx["assert:"]=3;
  51424. $12=true._yourself();
  51425. $ctx1.sendIdx["yourself"]=2;
  51426. $11=$recv($12).__eq_eq(true._yourself());
  51427. $self._assert_($11);
  51428. return self;
  51429. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  51430. },
  51431. args: [],
  51432. 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",
  51433. referencedClasses: [],
  51434. messageSends: ["deny:", "==", "assert:", "yourself"]
  51435. }),
  51436. $globals.BooleanTest);
  51437. $core.addMethod(
  51438. $core.method({
  51439. selector: "testIfTrueIfFalse",
  51440. protocol: "tests",
  51441. fn: function (){
  51442. var self=this,$self=this;
  51443. return $core.withContext(function($ctx1) {
  51444. var $1,$2,$3,$4,$5,$6,$7,$8;
  51445. if($core.assert(true)){
  51446. $1="alternative block";
  51447. }
  51448. $self._assert_equals_($1,"alternative block");
  51449. $ctx1.sendIdx["assert:equals:"]=1;
  51450. if(!$core.assert(true)){
  51451. $2="alternative block";
  51452. }
  51453. $self._assert_equals_($2,nil);
  51454. $ctx1.sendIdx["assert:equals:"]=2;
  51455. if($core.assert(false)){
  51456. $3="alternative block";
  51457. }
  51458. $self._assert_equals_($3,nil);
  51459. $ctx1.sendIdx["assert:equals:"]=3;
  51460. if(!$core.assert(false)){
  51461. $4="alternative block";
  51462. }
  51463. $self._assert_equals_($4,"alternative block");
  51464. $ctx1.sendIdx["assert:equals:"]=4;
  51465. if($core.assert(false)){
  51466. $5="alternative block";
  51467. } else {
  51468. $5="alternative block2";
  51469. }
  51470. $self._assert_equals_($5,"alternative block2");
  51471. $ctx1.sendIdx["assert:equals:"]=5;
  51472. if($core.assert(false)){
  51473. $6="alternative block2";
  51474. } else {
  51475. $6="alternative block";
  51476. }
  51477. $self._assert_equals_($6,"alternative block");
  51478. $ctx1.sendIdx["assert:equals:"]=6;
  51479. if($core.assert(true)){
  51480. $7="alternative block";
  51481. } else {
  51482. $7="alternative block2";
  51483. }
  51484. $self._assert_equals_($7,"alternative block");
  51485. $ctx1.sendIdx["assert:equals:"]=7;
  51486. if($core.assert(true)){
  51487. $8="alternative block2";
  51488. } else {
  51489. $8="alternative block";
  51490. }
  51491. $self._assert_equals_($8,"alternative block2");
  51492. return self;
  51493. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  51494. },
  51495. args: [],
  51496. 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'.",
  51497. referencedClasses: [],
  51498. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51499. }),
  51500. $globals.BooleanTest);
  51501. $core.addMethod(
  51502. $core.method({
  51503. selector: "testIfTrueIfFalseWithBoxing",
  51504. protocol: "tests",
  51505. fn: function (){
  51506. var self=this,$self=this;
  51507. return $core.withContext(function($ctx1) {
  51508. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  51509. $2=true._yourself();
  51510. $ctx1.sendIdx["yourself"]=1;
  51511. if($core.assert($2)){
  51512. $1="alternative block";
  51513. }
  51514. $self._assert_equals_($1,"alternative block");
  51515. $ctx1.sendIdx["assert:equals:"]=1;
  51516. $4=true._yourself();
  51517. $ctx1.sendIdx["yourself"]=2;
  51518. if(!$core.assert($4)){
  51519. $3="alternative block";
  51520. }
  51521. $self._assert_equals_($3,nil);
  51522. $ctx1.sendIdx["assert:equals:"]=2;
  51523. $6=false._yourself();
  51524. $ctx1.sendIdx["yourself"]=3;
  51525. if($core.assert($6)){
  51526. $5="alternative block";
  51527. }
  51528. $self._assert_equals_($5,nil);
  51529. $ctx1.sendIdx["assert:equals:"]=3;
  51530. $8=false._yourself();
  51531. $ctx1.sendIdx["yourself"]=4;
  51532. if(!$core.assert($8)){
  51533. $7="alternative block";
  51534. }
  51535. $self._assert_equals_($7,"alternative block");
  51536. $ctx1.sendIdx["assert:equals:"]=4;
  51537. $10=false._yourself();
  51538. $ctx1.sendIdx["yourself"]=5;
  51539. if($core.assert($10)){
  51540. $9="alternative block";
  51541. } else {
  51542. $9="alternative block2";
  51543. }
  51544. $self._assert_equals_($9,"alternative block2");
  51545. $ctx1.sendIdx["assert:equals:"]=5;
  51546. $12=false._yourself();
  51547. $ctx1.sendIdx["yourself"]=6;
  51548. if($core.assert($12)){
  51549. $11="alternative block2";
  51550. } else {
  51551. $11="alternative block";
  51552. }
  51553. $self._assert_equals_($11,"alternative block");
  51554. $ctx1.sendIdx["assert:equals:"]=6;
  51555. $14=true._yourself();
  51556. $ctx1.sendIdx["yourself"]=7;
  51557. if($core.assert($14)){
  51558. $13="alternative block";
  51559. } else {
  51560. $13="alternative block2";
  51561. }
  51562. $self._assert_equals_($13,"alternative block");
  51563. $ctx1.sendIdx["assert:equals:"]=7;
  51564. $16=true._yourself();
  51565. if($core.assert($16)){
  51566. $15="alternative block2";
  51567. } else {
  51568. $15="alternative block";
  51569. }
  51570. $self._assert_equals_($15,"alternative block2");
  51571. return self;
  51572. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  51573. },
  51574. args: [],
  51575. 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'.",
  51576. referencedClasses: [],
  51577. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51578. }),
  51579. $globals.BooleanTest);
  51580. $core.addMethod(
  51581. $core.method({
  51582. selector: "testLogic",
  51583. protocol: "tests",
  51584. fn: function (){
  51585. var self=this,$self=this;
  51586. return $core.withContext(function($ctx1) {
  51587. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  51588. $1=true.__and(true);
  51589. $ctx1.sendIdx["&"]=1;
  51590. $self._assert_($1);
  51591. $ctx1.sendIdx["assert:"]=1;
  51592. $2=true.__and(false);
  51593. $ctx1.sendIdx["&"]=2;
  51594. $self._deny_($2);
  51595. $ctx1.sendIdx["deny:"]=1;
  51596. $3=false.__and(true);
  51597. $ctx1.sendIdx["&"]=3;
  51598. $self._deny_($3);
  51599. $ctx1.sendIdx["deny:"]=2;
  51600. $5=false.__and(false);
  51601. $ctx1.sendIdx["&"]=4;
  51602. $4=$self._deny_($5);
  51603. $ctx1.sendIdx["deny:"]=3;
  51604. $6=true.__or(true);
  51605. $ctx1.sendIdx["|"]=1;
  51606. $self._assert_($6);
  51607. $ctx1.sendIdx["assert:"]=2;
  51608. $7=true.__or(false);
  51609. $ctx1.sendIdx["|"]=2;
  51610. $self._assert_($7);
  51611. $ctx1.sendIdx["assert:"]=3;
  51612. $8=false.__or(true);
  51613. $ctx1.sendIdx["|"]=3;
  51614. $self._assert_($8);
  51615. $ctx1.sendIdx["assert:"]=4;
  51616. $10=false.__or(false);
  51617. $ctx1.sendIdx["|"]=4;
  51618. $9=$self._deny_($10);
  51619. $ctx1.sendIdx["deny:"]=4;
  51620. $12=(1).__gt((0));
  51621. $ctx1.sendIdx[">"]=1;
  51622. $11=true.__and($12);
  51623. $ctx1.sendIdx["&"]=5;
  51624. $self._assert_($11);
  51625. $ctx1.sendIdx["assert:"]=5;
  51626. $14=(1).__gt((0));
  51627. $ctx1.sendIdx[">"]=2;
  51628. $13=$recv($14).__and(false);
  51629. $ctx1.sendIdx["&"]=6;
  51630. $self._deny_($13);
  51631. $ctx1.sendIdx["deny:"]=5;
  51632. $16=(1).__gt((0));
  51633. $ctx1.sendIdx[">"]=3;
  51634. $17=(1).__gt((2));
  51635. $ctx1.sendIdx[">"]=4;
  51636. $15=$recv($16).__and($17);
  51637. $self._deny_($15);
  51638. $19=(1).__gt((0));
  51639. $ctx1.sendIdx[">"]=5;
  51640. $18=false.__or($19);
  51641. $ctx1.sendIdx["|"]=5;
  51642. $self._assert_($18);
  51643. $ctx1.sendIdx["assert:"]=6;
  51644. $21=(1).__gt((0));
  51645. $ctx1.sendIdx[">"]=6;
  51646. $20=$recv($21).__or(false);
  51647. $ctx1.sendIdx["|"]=6;
  51648. $self._assert_($20);
  51649. $ctx1.sendIdx["assert:"]=7;
  51650. $23=(1).__gt((0));
  51651. $ctx1.sendIdx[">"]=7;
  51652. $22=$recv($23).__or((1).__gt((2)));
  51653. $self._assert_($22);
  51654. return self;
  51655. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  51656. },
  51657. args: [],
  51658. 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))",
  51659. referencedClasses: [],
  51660. messageSends: ["assert:", "&", "deny:", "|", ">"]
  51661. }),
  51662. $globals.BooleanTest);
  51663. $core.addMethod(
  51664. $core.method({
  51665. selector: "testLogicKeywords",
  51666. protocol: "tests",
  51667. fn: function (){
  51668. var self=this,$self=this;
  51669. return $core.withContext(function($ctx1) {
  51670. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  51671. $1=true._and_((function(){
  51672. return true;
  51673. }));
  51674. $ctx1.sendIdx["and:"]=1;
  51675. $self._assert_($1);
  51676. $ctx1.sendIdx["assert:"]=1;
  51677. $2=true._and_((function(){
  51678. return false;
  51679. }));
  51680. $ctx1.sendIdx["and:"]=2;
  51681. $self._deny_($2);
  51682. $ctx1.sendIdx["deny:"]=1;
  51683. $3=false._and_((function(){
  51684. return true;
  51685. }));
  51686. $ctx1.sendIdx["and:"]=3;
  51687. $self._deny_($3);
  51688. $ctx1.sendIdx["deny:"]=2;
  51689. $5=false._and_((function(){
  51690. return false;
  51691. }));
  51692. $ctx1.sendIdx["and:"]=4;
  51693. $4=$self._deny_($5);
  51694. $ctx1.sendIdx["deny:"]=3;
  51695. $6=true._or_((function(){
  51696. return true;
  51697. }));
  51698. $ctx1.sendIdx["or:"]=1;
  51699. $self._assert_($6);
  51700. $ctx1.sendIdx["assert:"]=2;
  51701. $7=true._or_((function(){
  51702. return false;
  51703. }));
  51704. $ctx1.sendIdx["or:"]=2;
  51705. $self._assert_($7);
  51706. $ctx1.sendIdx["assert:"]=3;
  51707. $8=false._or_((function(){
  51708. return true;
  51709. }));
  51710. $ctx1.sendIdx["or:"]=3;
  51711. $self._assert_($8);
  51712. $ctx1.sendIdx["assert:"]=4;
  51713. $10=false._or_((function(){
  51714. return false;
  51715. }));
  51716. $ctx1.sendIdx["or:"]=4;
  51717. $9=$self._deny_($10);
  51718. $ctx1.sendIdx["deny:"]=4;
  51719. $11=true._and_((function(){
  51720. return $core.withContext(function($ctx2) {
  51721. return (1).__gt((0));
  51722. $ctx2.sendIdx[">"]=1;
  51723. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  51724. }));
  51725. $ctx1.sendIdx["and:"]=5;
  51726. $self._assert_($11);
  51727. $ctx1.sendIdx["assert:"]=5;
  51728. $13=(1).__gt((0));
  51729. $ctx1.sendIdx[">"]=2;
  51730. $12=$recv($13)._and_((function(){
  51731. return false;
  51732. }));
  51733. $ctx1.sendIdx["and:"]=6;
  51734. $self._deny_($12);
  51735. $ctx1.sendIdx["deny:"]=5;
  51736. $15=(1).__gt((0));
  51737. $ctx1.sendIdx[">"]=3;
  51738. $14=$recv($15)._and_((function(){
  51739. return $core.withContext(function($ctx2) {
  51740. return (1).__gt((2));
  51741. $ctx2.sendIdx[">"]=4;
  51742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  51743. }));
  51744. $self._deny_($14);
  51745. $16=false._or_((function(){
  51746. return $core.withContext(function($ctx2) {
  51747. return (1).__gt((0));
  51748. $ctx2.sendIdx[">"]=5;
  51749. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  51750. }));
  51751. $ctx1.sendIdx["or:"]=5;
  51752. $self._assert_($16);
  51753. $ctx1.sendIdx["assert:"]=6;
  51754. $18=(1).__gt((0));
  51755. $ctx1.sendIdx[">"]=6;
  51756. $17=$recv($18)._or_((function(){
  51757. return false;
  51758. }));
  51759. $ctx1.sendIdx["or:"]=6;
  51760. $self._assert_($17);
  51761. $ctx1.sendIdx["assert:"]=7;
  51762. $20=(1).__gt((0));
  51763. $ctx1.sendIdx[">"]=7;
  51764. $19=$recv($20)._or_((function(){
  51765. return $core.withContext(function($ctx2) {
  51766. return (1).__gt((2));
  51767. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  51768. }));
  51769. $self._assert_($19);
  51770. return self;
  51771. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  51772. },
  51773. args: [],
  51774. 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 ])",
  51775. referencedClasses: [],
  51776. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  51777. }),
  51778. $globals.BooleanTest);
  51779. $core.addMethod(
  51780. $core.method({
  51781. selector: "testNonBooleanError",
  51782. protocol: "tests",
  51783. fn: function (){
  51784. var self=this,$self=this;
  51785. return $core.withContext(function($ctx1) {
  51786. $self._should_raise_((function(){
  51787. return $core.withContext(function($ctx2) {
  51788. if($core.assert("")){
  51789. } else {
  51790. }
  51791. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51792. }),$globals.NonBooleanReceiver);
  51793. return self;
  51794. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  51795. },
  51796. args: [],
  51797. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  51798. referencedClasses: ["NonBooleanReceiver"],
  51799. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  51800. }),
  51801. $globals.BooleanTest);
  51802. $core.addClass("ClassBuilderTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  51803. $core.addMethod(
  51804. $core.method({
  51805. selector: "setUp",
  51806. protocol: "running",
  51807. fn: function (){
  51808. var self=this,$self=this;
  51809. return $core.withContext(function($ctx1) {
  51810. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  51811. return self;
  51812. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  51813. },
  51814. args: [],
  51815. source: "setUp\x0a\x09builder := ClassBuilder new",
  51816. referencedClasses: ["ClassBuilder"],
  51817. messageSends: ["new"]
  51818. }),
  51819. $globals.ClassBuilderTest);
  51820. $core.addMethod(
  51821. $core.method({
  51822. selector: "tearDown",
  51823. protocol: "running",
  51824. fn: function (){
  51825. var self=this,$self=this;
  51826. return $core.withContext(function($ctx1) {
  51827. var $1,$receiver;
  51828. $1=$self["@theClass"];
  51829. if(($receiver = $1) == null || $receiver.a$nil){
  51830. $1;
  51831. } else {
  51832. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  51833. $self._deny_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51834. $self["@theClass"]=nil;
  51835. $self["@theClass"];
  51836. }
  51837. return self;
  51838. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  51839. },
  51840. args: [],
  51841. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09self deny: (theClass package classes includes: theClass).\x0a\x09\x09theClass := nil ]",
  51842. referencedClasses: ["Smalltalk"],
  51843. messageSends: ["ifNotNil:", "removeClass:", "deny:", "includes:", "classes", "package"]
  51844. }),
  51845. $globals.ClassBuilderTest);
  51846. $core.addMethod(
  51847. $core.method({
  51848. selector: "testAddTrait",
  51849. protocol: "tests",
  51850. fn: function (){
  51851. var self=this,$self=this;
  51852. return $core.withContext(function($ctx1) {
  51853. var $3,$2,$1,$4;
  51854. $self["@theClass"]=$recv($self["@builder"])._addTraitNamed_package_("ObjectMock2","Kernel-Tests");
  51855. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51856. $ctx1.sendIdx["assert:equals:"]=1;
  51857. $3=$recv($self["@theClass"])._package();
  51858. $ctx1.sendIdx["package"]=1;
  51859. $2=$recv($3)._classes();
  51860. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  51861. $self._assert_equals_($1,(1));
  51862. $ctx1.sendIdx["assert:equals:"]=2;
  51863. $4=$recv($self["@theClass"])._package();
  51864. $ctx1.sendIdx["package"]=2;
  51865. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  51866. return self;
  51867. }, function($ctx1) {$ctx1.fill(self,"testAddTrait",{},$globals.ClassBuilderTest)});
  51868. },
  51869. args: [],
  51870. 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",
  51871. referencedClasses: ["ObjectMock"],
  51872. messageSends: ["addTraitNamed:package:", "assert:equals:", "name", "occurrencesOf:", "classes", "package"]
  51873. }),
  51874. $globals.ClassBuilderTest);
  51875. $core.addMethod(
  51876. $core.method({
  51877. selector: "testClassCopy",
  51878. protocol: "tests",
  51879. fn: function (){
  51880. var self=this,$self=this;
  51881. return $core.withContext(function($ctx1) {
  51882. var $2,$1,$4,$3,$6,$7,$5,$9,$8;
  51883. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51884. $2=$recv($self["@theClass"])._superclass();
  51885. $ctx1.sendIdx["superclass"]=1;
  51886. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  51887. $ctx1.sendIdx["=="]=1;
  51888. $self._assert_($1);
  51889. $ctx1.sendIdx["assert:"]=1;
  51890. $4=$recv($self["@theClass"])._instanceVariableNames();
  51891. $ctx1.sendIdx["instanceVariableNames"]=1;
  51892. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  51893. $ctx1.sendIdx["=="]=2;
  51894. $self._assert_($3);
  51895. $ctx1.sendIdx["assert:"]=2;
  51896. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51897. $ctx1.sendIdx["assert:equals:"]=1;
  51898. $6=$recv($self["@theClass"])._package();
  51899. $ctx1.sendIdx["package"]=1;
  51900. $7=$recv($globals.ObjectMock)._package();
  51901. $ctx1.sendIdx["package"]=2;
  51902. $5=$recv($6).__eq_eq($7);
  51903. $self._assert_($5);
  51904. $ctx1.sendIdx["assert:"]=3;
  51905. $self._assert_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51906. $9=$recv($self["@theClass"])._methodDictionary();
  51907. $ctx1.sendIdx["methodDictionary"]=1;
  51908. $8=$recv($9)._keys();
  51909. $ctx1.sendIdx["keys"]=1;
  51910. $self._assert_equals_($8,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  51911. return self;
  51912. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  51913. },
  51914. args: [],
  51915. 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",
  51916. referencedClasses: ["ObjectMock"],
  51917. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "includes:", "classes", "keys", "methodDictionary"]
  51918. }),
  51919. $globals.ClassBuilderTest);
  51920. $core.addMethod(
  51921. $core.method({
  51922. selector: "testClassMigration",
  51923. protocol: "tests",
  51924. fn: function (){
  51925. var self=this,$self=this;
  51926. var instance,oldClass;
  51927. return $core.withContext(function($ctx1) {
  51928. var $2,$1,$4,$3,$5,$6,$7,$8,$10,$9,$12,$11;
  51929. oldClass=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51930. $2=$recv($globals.Smalltalk)._globals();
  51931. $ctx1.sendIdx["globals"]=1;
  51932. $1=$recv($2)._at_("ObjectMock2");
  51933. $ctx1.sendIdx["at:"]=1;
  51934. instance=$recv($1)._new();
  51935. $4=$recv($globals.Smalltalk)._globals();
  51936. $ctx1.sendIdx["globals"]=2;
  51937. $3=$recv($4)._at_("ObjectMock2");
  51938. $ctx1.sendIdx["at:"]=2;
  51939. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  51940. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  51941. $ctx1.sendIdx["=="]=1;
  51942. $self._deny_($5);
  51943. $ctx1.sendIdx["deny:"]=1;
  51944. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  51945. $ctx1.sendIdx["=="]=2;
  51946. $self._assert_($6);
  51947. $ctx1.sendIdx["assert:"]=1;
  51948. $self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  51949. $ctx1.sendIdx["assert:"]=2;
  51950. $7=$recv($globals.ObjectMock2)._selectors();
  51951. $ctx1.sendIdx["selectors"]=1;
  51952. $self._assert_equals_($7,$recv(oldClass)._selectors());
  51953. $ctx1.sendIdx["assert:equals:"]=1;
  51954. $8=$recv($globals.ObjectMock2)._comment();
  51955. $ctx1.sendIdx["comment"]=1;
  51956. $self._assert_equals_($8,$recv(oldClass)._comment());
  51957. $ctx1.sendIdx["assert:equals:"]=2;
  51958. $10=$recv($globals.ObjectMock2)._package();
  51959. $ctx1.sendIdx["package"]=1;
  51960. $9=$recv($10)._name();
  51961. $ctx1.sendIdx["name"]=1;
  51962. $self._assert_equals_($9,"Kernel-Tests");
  51963. $self._assert_($recv($recv($recv($globals.ObjectMock2)._package())._classes())._includes_($globals.ObjectMock2));
  51964. $ctx1.sendIdx["assert:"]=3;
  51965. $12=$recv(instance)._class();
  51966. $ctx1.sendIdx["class"]=1;
  51967. $11=$recv($12).__eq_eq($globals.ObjectMock2);
  51968. $self._deny_($11);
  51969. $self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  51970. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  51971. return self;
  51972. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  51973. },
  51974. args: [],
  51975. 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",
  51976. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  51977. 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:"]
  51978. }),
  51979. $globals.ClassBuilderTest);
  51980. $core.addMethod(
  51981. $core.method({
  51982. selector: "testClassMigrationWithClassInstanceVariables",
  51983. protocol: "tests",
  51984. fn: function (){
  51985. var self=this,$self=this;
  51986. return $core.withContext(function($ctx1) {
  51987. var $1;
  51988. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51989. $1=$recv($globals.ObjectMock2)._class();
  51990. $ctx1.sendIdx["class"]=1;
  51991. $recv($1)._instanceVariableNames_("foo bar");
  51992. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  51993. $self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  51994. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  51995. return self;
  51996. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  51997. },
  51998. args: [],
  51999. 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",
  52000. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  52001. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  52002. }),
  52003. $globals.ClassBuilderTest);
  52004. $core.addMethod(
  52005. $core.method({
  52006. selector: "testClassMigrationWithSubclasses",
  52007. protocol: "tests",
  52008. fn: function (){
  52009. var self=this,$self=this;
  52010. return $core.withContext(function($ctx1) {
  52011. var $2,$1,$4,$3;
  52012. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52013. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  52014. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  52015. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  52016. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  52017. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  52018. $2=$recv($globals.ObjectMock)._subclasses();
  52019. $ctx1.sendIdx["subclasses"]=1;
  52020. $1=$recv($2)._includes_($globals.ObjectMock2);
  52021. $ctx1.sendIdx["includes:"]=1;
  52022. $self._assert_($1);
  52023. $ctx1.sendIdx["assert:"]=1;
  52024. $4=$recv($globals.ObjectMock2)._subclasses();
  52025. $ctx1.sendIdx["subclasses"]=2;
  52026. $3=$recv($4)._includes_($globals.ObjectMock3);
  52027. $ctx1.sendIdx["includes:"]=2;
  52028. $self._assert_($3);
  52029. $ctx1.sendIdx["assert:"]=2;
  52030. $self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  52031. $recv($recv($globals.ObjectMock)._allSubclasses())._reverseDo_((function(each){
  52032. return $core.withContext(function($ctx2) {
  52033. return $recv($globals.Smalltalk)._removeClass_(each);
  52034. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52035. }));
  52036. return self;
  52037. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  52038. },
  52039. args: [],
  52040. 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 ]",
  52041. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  52042. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "reverseDo:", "allSubclasses", "removeClass:"]
  52043. }),
  52044. $globals.ClassBuilderTest);
  52045. $core.addMethod(
  52046. $core.method({
  52047. selector: "testInstanceVariableNames",
  52048. protocol: "tests",
  52049. fn: function (){
  52050. var self=this,$self=this;
  52051. return $core.withContext(function($ctx1) {
  52052. $self._assert_equals_($recv($self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  52053. return self;
  52054. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  52055. },
  52056. args: [],
  52057. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  52058. referencedClasses: [],
  52059. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  52060. }),
  52061. $globals.ClassBuilderTest);
  52062. $core.addMethod(
  52063. $core.method({
  52064. selector: "testSubclass",
  52065. protocol: "tests",
  52066. fn: function (){
  52067. var self=this,$self=this;
  52068. return $core.withContext(function($ctx1) {
  52069. var $3,$2,$1,$4;
  52070. $self["@theClass"]=$recv($self["@builder"])._addSubclassOf_named_instanceVariableNames_package_($globals.ObjectMock,"ObjectMock2","foo bar","Kernel-Tests");
  52071. $self._assert_equals_($recv($self["@theClass"])._superclass(),$globals.ObjectMock);
  52072. $ctx1.sendIdx["assert:equals:"]=1;
  52073. $self._assert_equals_($recv($self["@theClass"])._instanceVariableNames(),"foo bar");
  52074. $ctx1.sendIdx["assert:equals:"]=2;
  52075. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52076. $ctx1.sendIdx["assert:equals:"]=3;
  52077. $3=$recv($self["@theClass"])._package();
  52078. $ctx1.sendIdx["package"]=1;
  52079. $2=$recv($3)._classes();
  52080. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  52081. $self._assert_equals_($1,(1));
  52082. $ctx1.sendIdx["assert:equals:"]=4;
  52083. $4=$recv($self["@theClass"])._package();
  52084. $ctx1.sendIdx["package"]=2;
  52085. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  52086. $ctx1.sendIdx["assert:equals:"]=5;
  52087. $self._assert_equals_($recv($recv($recv($self["@theClass"])._methodDictionary())._keys())._size(),(0));
  52088. return self;
  52089. }, function($ctx1) {$ctx1.fill(self,"testSubclass",{},$globals.ClassBuilderTest)});
  52090. },
  52091. args: [],
  52092. 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",
  52093. referencedClasses: ["ObjectMock"],
  52094. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "assert:equals:", "superclass", "instanceVariableNames", "name", "occurrencesOf:", "classes", "package", "size", "keys", "methodDictionary"]
  52095. }),
  52096. $globals.ClassBuilderTest);
  52097. $core.addClass("ClassTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  52098. $core.addMethod(
  52099. $core.method({
  52100. selector: "jsConstructor",
  52101. protocol: "running",
  52102. fn: function (){
  52103. var self=this,$self=this;
  52104. return $core.withContext(function($ctx1) {
  52105. function Foo(){}
  52106. Foo.prototype.valueOf = function () {return 4;};
  52107. return Foo;
  52108. ;
  52109. return self;
  52110. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  52111. },
  52112. args: [],
  52113. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  52114. referencedClasses: [],
  52115. messageSends: []
  52116. }),
  52117. $globals.ClassTest);
  52118. $core.addMethod(
  52119. $core.method({
  52120. selector: "setUp",
  52121. protocol: "running",
  52122. fn: function (){
  52123. var self=this,$self=this;
  52124. return $core.withContext(function($ctx1) {
  52125. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  52126. return self;
  52127. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  52128. },
  52129. args: [],
  52130. source: "setUp\x0a\x09builder := ClassBuilder new",
  52131. referencedClasses: ["ClassBuilder"],
  52132. messageSends: ["new"]
  52133. }),
  52134. $globals.ClassTest);
  52135. $core.addMethod(
  52136. $core.method({
  52137. selector: "tearDown",
  52138. protocol: "running",
  52139. fn: function (){
  52140. var self=this,$self=this;
  52141. return $core.withContext(function($ctx1) {
  52142. var $1,$receiver;
  52143. $1=$self["@theClass"];
  52144. if(($receiver = $1) == null || $receiver.a$nil){
  52145. $1;
  52146. } else {
  52147. $recv($recv($self["@theClass"])._allSubclasses())._reverseDo_((function(each){
  52148. return $core.withContext(function($ctx2) {
  52149. return $recv($globals.Smalltalk)._removeClass_(each);
  52150. $ctx2.sendIdx["removeClass:"]=1;
  52151. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52152. }));
  52153. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  52154. $self["@theClass"]=nil;
  52155. $self["@theClass"];
  52156. }
  52157. return self;
  52158. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  52159. },
  52160. args: [],
  52161. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ].\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09theClass := nil ]",
  52162. referencedClasses: ["Smalltalk"],
  52163. messageSends: ["ifNotNil:", "reverseDo:", "allSubclasses", "removeClass:"]
  52164. }),
  52165. $globals.ClassTest);
  52166. $core.addMethod(
  52167. $core.method({
  52168. selector: "testAllSubclasses",
  52169. protocol: "tests",
  52170. fn: function (){
  52171. var self=this,$self=this;
  52172. var subclasses,index;
  52173. return $core.withContext(function($ctx1) {
  52174. subclasses=$recv($globals.Object)._subclasses();
  52175. $ctx1.sendIdx["subclasses"]=1;
  52176. index=(1);
  52177. $recv((function(){
  52178. return $core.withContext(function($ctx2) {
  52179. return $recv(index).__gt($recv(subclasses)._size());
  52180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52181. }))._whileFalse_((function(){
  52182. return $core.withContext(function($ctx2) {
  52183. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  52184. index=$recv(index).__plus((1));
  52185. return index;
  52186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  52187. }));
  52188. $self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  52189. return self;
  52190. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  52191. },
  52192. args: [],
  52193. 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",
  52194. referencedClasses: ["Object"],
  52195. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  52196. }),
  52197. $globals.ClassTest);
  52198. $core.addMethod(
  52199. $core.method({
  52200. selector: "testMetaclassSubclasses",
  52201. protocol: "tests",
  52202. fn: function (){
  52203. var self=this,$self=this;
  52204. var subclasses;
  52205. return $core.withContext(function($ctx1) {
  52206. var $4,$3,$2,$1;
  52207. $4=$recv($globals.Object)._class();
  52208. $ctx1.sendIdx["class"]=1;
  52209. $3=$recv($4)._instanceClass();
  52210. $2=$recv($3)._subclasses();
  52211. $ctx1.sendIdx["subclasses"]=1;
  52212. $1=$recv($2)._select_((function(each){
  52213. return $core.withContext(function($ctx2) {
  52214. return $recv($recv(each)._isMetaclass())._not();
  52215. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52216. }));
  52217. subclasses=$recv($1)._collect_((function(each){
  52218. return $core.withContext(function($ctx2) {
  52219. return $recv(each)._theMetaClass();
  52220. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52221. }));
  52222. $self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  52223. return self;
  52224. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  52225. },
  52226. args: [],
  52227. 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",
  52228. referencedClasses: ["Object"],
  52229. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  52230. }),
  52231. $globals.ClassTest);
  52232. $core.addMethod(
  52233. $core.method({
  52234. selector: "testSetJavaScriptConstructor",
  52235. protocol: "tests",
  52236. fn: function (){
  52237. var self=this,$self=this;
  52238. var instance;
  52239. return $core.withContext(function($ctx1) {
  52240. var $2,$1,$4,$3,$6,$5,$8,$7;
  52241. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52242. $recv($self["@theClass"])._javascriptConstructor_($self._jsConstructor());
  52243. $2=$recv($self["@theClass"])._superclass();
  52244. $ctx1.sendIdx["superclass"]=1;
  52245. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52246. $ctx1.sendIdx["=="]=1;
  52247. $self._assert_($1);
  52248. $ctx1.sendIdx["assert:"]=1;
  52249. $4=$recv($self["@theClass"])._instanceVariableNames();
  52250. $ctx1.sendIdx["instanceVariableNames"]=1;
  52251. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52252. $ctx1.sendIdx["=="]=2;
  52253. $self._assert_($3);
  52254. $ctx1.sendIdx["assert:"]=2;
  52255. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52256. $ctx1.sendIdx["assert:equals:"]=1;
  52257. $6=$recv($self["@theClass"])._package();
  52258. $ctx1.sendIdx["package"]=1;
  52259. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  52260. $ctx1.sendIdx["=="]=3;
  52261. $self._assert_($5);
  52262. $ctx1.sendIdx["assert:"]=3;
  52263. $8=$recv($self["@theClass"])._methodDictionary();
  52264. $ctx1.sendIdx["methodDictionary"]=1;
  52265. $7=$recv($8)._keys();
  52266. $ctx1.sendIdx["keys"]=1;
  52267. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52268. $ctx1.sendIdx["assert:equals:"]=2;
  52269. instance=$recv($self["@theClass"])._new();
  52270. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  52271. $self._assert_equals_($recv(instance)._value(),(4));
  52272. $ctx1.sendIdx["assert:equals:"]=3;
  52273. $self._shouldnt_raise_((function(){
  52274. return $core.withContext(function($ctx2) {
  52275. return $recv(instance)._foo_((9));
  52276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52277. }),$globals.Error);
  52278. $self._assert_equals_($recv(instance)._foo(),(9));
  52279. return self;
  52280. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52281. },
  52282. args: [],
  52283. 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",
  52284. referencedClasses: ["ObjectMock", "Error"],
  52285. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52286. }),
  52287. $globals.ClassTest);
  52288. $core.addMethod(
  52289. $core.method({
  52290. selector: "testTrickySetJavaScriptConstructor",
  52291. protocol: "tests",
  52292. fn: function (){
  52293. var self=this,$self=this;
  52294. var instance;
  52295. return $core.withContext(function($ctx1) {
  52296. var $2,$1,$4,$3,$6,$5,$8,$7;
  52297. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52298. $recv($self["@theClass"])._javascriptConstructor_($self._trickyJsConstructor());
  52299. $2=$recv($self["@theClass"])._superclass();
  52300. $ctx1.sendIdx["superclass"]=1;
  52301. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52302. $ctx1.sendIdx["=="]=1;
  52303. $self._assert_($1);
  52304. $ctx1.sendIdx["assert:"]=1;
  52305. $4=$recv($self["@theClass"])._instanceVariableNames();
  52306. $ctx1.sendIdx["instanceVariableNames"]=1;
  52307. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52308. $ctx1.sendIdx["=="]=2;
  52309. $self._assert_($3);
  52310. $ctx1.sendIdx["assert:"]=2;
  52311. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52312. $ctx1.sendIdx["assert:equals:"]=1;
  52313. $6=$recv($self["@theClass"])._package();
  52314. $ctx1.sendIdx["package"]=1;
  52315. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  52316. $ctx1.sendIdx["=="]=3;
  52317. $self._assert_($5);
  52318. $ctx1.sendIdx["assert:"]=3;
  52319. $8=$recv($self["@theClass"])._methodDictionary();
  52320. $ctx1.sendIdx["methodDictionary"]=1;
  52321. $7=$recv($8)._keys();
  52322. $ctx1.sendIdx["keys"]=1;
  52323. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52324. $ctx1.sendIdx["assert:equals:"]=2;
  52325. instance=$recv($self["@theClass"])._new();
  52326. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  52327. $self._assert_equals_($recv(instance)._value(),(4));
  52328. $ctx1.sendIdx["assert:equals:"]=3;
  52329. $self._shouldnt_raise_((function(){
  52330. return $core.withContext(function($ctx2) {
  52331. return $recv(instance)._foo_((9));
  52332. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52333. }),$globals.Error);
  52334. $self._assert_equals_($recv(instance)._foo(),(9));
  52335. return self;
  52336. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52337. },
  52338. args: [],
  52339. 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",
  52340. referencedClasses: ["ObjectMock", "Error"],
  52341. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52342. }),
  52343. $globals.ClassTest);
  52344. $core.addMethod(
  52345. $core.method({
  52346. selector: "trickyJsConstructor",
  52347. protocol: "running",
  52348. fn: function (){
  52349. var self=this,$self=this;
  52350. return $core.withContext(function($ctx1) {
  52351. function Foo(){}
  52352. Foo.prototype.valueOf = function () {return 4;};
  52353. Foo.prototype._foo = function () {return "bar";};
  52354. return Foo;
  52355. ;
  52356. return self;
  52357. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  52358. },
  52359. args: [],
  52360. 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'>",
  52361. referencedClasses: [],
  52362. messageSends: []
  52363. }),
  52364. $globals.ClassTest);
  52365. $core.addClass("CollectionTest", $globals.TestCase, ["sampleBlock"], "Kernel-Tests");
  52366. $core.addMethod(
  52367. $core.method({
  52368. selector: "assertSameContents:as:",
  52369. protocol: "convenience",
  52370. fn: function (aCollection,anotherCollection){
  52371. var self=this,$self=this;
  52372. return $core.withContext(function($ctx1) {
  52373. var $2,$1,$4,$3;
  52374. $2=$recv(aCollection)._size();
  52375. $ctx1.sendIdx["size"]=1;
  52376. $1=$recv($2).__eq($recv(anotherCollection)._size());
  52377. $ctx1.sendIdx["="]=1;
  52378. $self._assert_($1);
  52379. $ctx1.sendIdx["assert:"]=1;
  52380. $recv(aCollection)._do_((function(each){
  52381. return $core.withContext(function($ctx2) {
  52382. $4=$recv(aCollection)._occurrencesOf_(each);
  52383. $ctx2.sendIdx["occurrencesOf:"]=1;
  52384. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  52385. return $self._assert_($3);
  52386. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52387. }));
  52388. return self;
  52389. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  52390. },
  52391. args: ["aCollection", "anotherCollection"],
  52392. 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)) ]",
  52393. referencedClasses: [],
  52394. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  52395. }),
  52396. $globals.CollectionTest);
  52397. $core.addMethod(
  52398. $core.method({
  52399. selector: "collection",
  52400. protocol: "fixture",
  52401. fn: function (){
  52402. var self=this,$self=this;
  52403. return $core.withContext(function($ctx1) {
  52404. $self._subclassResponsibility();
  52405. return self;
  52406. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  52407. },
  52408. args: [],
  52409. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  52410. referencedClasses: [],
  52411. messageSends: ["subclassResponsibility"]
  52412. }),
  52413. $globals.CollectionTest);
  52414. $core.addMethod(
  52415. $core.method({
  52416. selector: "collectionClass",
  52417. protocol: "fixture",
  52418. fn: function (){
  52419. var self=this,$self=this;
  52420. return $core.withContext(function($ctx1) {
  52421. return $recv($self._class())._collectionClass();
  52422. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  52423. },
  52424. args: [],
  52425. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  52426. referencedClasses: [],
  52427. messageSends: ["collectionClass", "class"]
  52428. }),
  52429. $globals.CollectionTest);
  52430. $core.addMethod(
  52431. $core.method({
  52432. selector: "collectionOfPrintStrings",
  52433. protocol: "fixture",
  52434. fn: function (){
  52435. var self=this,$self=this;
  52436. return $core.withContext(function($ctx1) {
  52437. $self._subclassResponsibility();
  52438. return self;
  52439. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  52440. },
  52441. args: [],
  52442. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  52443. referencedClasses: [],
  52444. messageSends: ["subclassResponsibility"]
  52445. }),
  52446. $globals.CollectionTest);
  52447. $core.addMethod(
  52448. $core.method({
  52449. selector: "collectionSize",
  52450. protocol: "fixture",
  52451. fn: function (){
  52452. var self=this,$self=this;
  52453. return $core.withContext(function($ctx1) {
  52454. $self._subclassResponsibility();
  52455. return self;
  52456. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  52457. },
  52458. args: [],
  52459. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  52460. referencedClasses: [],
  52461. messageSends: ["subclassResponsibility"]
  52462. }),
  52463. $globals.CollectionTest);
  52464. $core.addMethod(
  52465. $core.method({
  52466. selector: "collectionWithDuplicates",
  52467. protocol: "fixture",
  52468. fn: function (){
  52469. var self=this,$self=this;
  52470. return $core.withContext(function($ctx1) {
  52471. $self._subclassResponsibility();
  52472. return self;
  52473. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  52474. },
  52475. args: [],
  52476. 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",
  52477. referencedClasses: [],
  52478. messageSends: ["subclassResponsibility"]
  52479. }),
  52480. $globals.CollectionTest);
  52481. $core.addMethod(
  52482. $core.method({
  52483. selector: "collectionWithNewValue",
  52484. protocol: "fixture",
  52485. fn: function (){
  52486. var self=this,$self=this;
  52487. return $core.withContext(function($ctx1) {
  52488. $self._subclassResponsibility();
  52489. return self;
  52490. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  52491. },
  52492. args: [],
  52493. 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",
  52494. referencedClasses: [],
  52495. messageSends: ["subclassResponsibility"]
  52496. }),
  52497. $globals.CollectionTest);
  52498. $core.addMethod(
  52499. $core.method({
  52500. selector: "initialize",
  52501. protocol: "initialization",
  52502. fn: function (){
  52503. var self=this,$self=this;
  52504. return $core.withContext(function($ctx1) {
  52505. (
  52506. $ctx1.supercall = true,
  52507. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  52508. $ctx1.supercall = false;
  52509. $self["@sampleBlock"]=(function(){
  52510. });
  52511. return self;
  52512. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  52513. },
  52514. args: [],
  52515. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  52516. referencedClasses: [],
  52517. messageSends: ["initialize"]
  52518. }),
  52519. $globals.CollectionTest);
  52520. $core.addMethod(
  52521. $core.method({
  52522. selector: "sampleNewValue",
  52523. protocol: "fixture",
  52524. fn: function (){
  52525. var self=this,$self=this;
  52526. return "N";
  52527. },
  52528. args: [],
  52529. 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'",
  52530. referencedClasses: [],
  52531. messageSends: []
  52532. }),
  52533. $globals.CollectionTest);
  52534. $core.addMethod(
  52535. $core.method({
  52536. selector: "sampleNewValueAsCollection",
  52537. protocol: "fixture",
  52538. fn: function (){
  52539. var self=this,$self=this;
  52540. return $core.withContext(function($ctx1) {
  52541. return $recv($self._collectionClass())._with_($self._sampleNewValue());
  52542. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  52543. },
  52544. args: [],
  52545. 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",
  52546. referencedClasses: [],
  52547. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  52548. }),
  52549. $globals.CollectionTest);
  52550. $core.addMethod(
  52551. $core.method({
  52552. selector: "testAddAll",
  52553. protocol: "tests",
  52554. fn: function (){
  52555. var self=this,$self=this;
  52556. return $core.withContext(function($ctx1) {
  52557. 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;
  52558. $2=$self._collection();
  52559. $ctx1.sendIdx["collection"]=1;
  52560. $4=$self._collectionClass();
  52561. $ctx1.sendIdx["collectionClass"]=1;
  52562. $3=$recv($4)._new();
  52563. $ctx1.sendIdx["new"]=1;
  52564. $recv($2)._addAll_($3);
  52565. $ctx1.sendIdx["addAll:"]=1;
  52566. $5=$recv($2)._yourself();
  52567. $ctx1.sendIdx["yourself"]=1;
  52568. $1=$5;
  52569. $6=$self._collection();
  52570. $ctx1.sendIdx["collection"]=2;
  52571. $self._assert_equals_($1,$6);
  52572. $ctx1.sendIdx["assert:equals:"]=1;
  52573. $9=$self._collectionClass();
  52574. $ctx1.sendIdx["collectionClass"]=2;
  52575. $8=$recv($9)._new();
  52576. $ctx1.sendIdx["new"]=2;
  52577. $10=$self._collection();
  52578. $ctx1.sendIdx["collection"]=3;
  52579. $recv($8)._addAll_($10);
  52580. $ctx1.sendIdx["addAll:"]=2;
  52581. $11=$recv($8)._yourself();
  52582. $ctx1.sendIdx["yourself"]=2;
  52583. $7=$11;
  52584. $12=$self._collection();
  52585. $ctx1.sendIdx["collection"]=4;
  52586. $self._assert_equals_($7,$12);
  52587. $ctx1.sendIdx["assert:equals:"]=2;
  52588. $15=$self._collectionClass();
  52589. $ctx1.sendIdx["collectionClass"]=3;
  52590. $14=$recv($15)._new();
  52591. $ctx1.sendIdx["new"]=3;
  52592. $17=$self._collectionClass();
  52593. $ctx1.sendIdx["collectionClass"]=4;
  52594. $16=$recv($17)._new();
  52595. $ctx1.sendIdx["new"]=4;
  52596. $recv($14)._addAll_($16);
  52597. $ctx1.sendIdx["addAll:"]=3;
  52598. $18=$recv($14)._yourself();
  52599. $ctx1.sendIdx["yourself"]=3;
  52600. $13=$18;
  52601. $self._assert_equals_($13,$recv($self._collectionClass())._new());
  52602. $ctx1.sendIdx["assert:equals:"]=3;
  52603. $20=$self._collection();
  52604. $ctx1.sendIdx["collection"]=5;
  52605. $21=$self._sampleNewValueAsCollection();
  52606. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52607. $recv($20)._addAll_($21);
  52608. $ctx1.sendIdx["addAll:"]=4;
  52609. $22=$recv($20)._yourself();
  52610. $ctx1.sendIdx["yourself"]=4;
  52611. $19=$22;
  52612. $23=$self._collectionWithNewValue();
  52613. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52614. $self._assert_equals_($19,$23);
  52615. $25=$self._sampleNewValueAsCollection();
  52616. $recv($25)._addAll_($self._collection());
  52617. $24=$recv($25)._yourself();
  52618. $self._assertSameContents_as_($24,$self._collectionWithNewValue());
  52619. return self;
  52620. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  52621. },
  52622. args: [],
  52623. 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",
  52624. referencedClasses: [],
  52625. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52626. }),
  52627. $globals.CollectionTest);
  52628. $core.addMethod(
  52629. $core.method({
  52630. selector: "testAllSatisfy",
  52631. protocol: "tests",
  52632. fn: function (){
  52633. var self=this,$self=this;
  52634. var collection,anyOne;
  52635. return $core.withContext(function($ctx1) {
  52636. var $1;
  52637. collection=$self._collection();
  52638. anyOne=$recv(collection)._anyOne();
  52639. $1=$recv(collection)._allSatisfy_((function(each){
  52640. return $core.withContext(function($ctx2) {
  52641. return $recv(collection)._includes_(each);
  52642. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52643. }));
  52644. $ctx1.sendIdx["allSatisfy:"]=1;
  52645. $self._assert_($1);
  52646. $self._deny_($recv(collection)._allSatisfy_((function(each){
  52647. return $core.withContext(function($ctx2) {
  52648. return $recv(each).__tild_eq(anyOne);
  52649. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52650. })));
  52651. return self;
  52652. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  52653. },
  52654. args: [],
  52655. 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 ])",
  52656. referencedClasses: [],
  52657. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  52658. }),
  52659. $globals.CollectionTest);
  52660. $core.addMethod(
  52661. $core.method({
  52662. selector: "testAnyOne",
  52663. protocol: "tests",
  52664. fn: function (){
  52665. var self=this,$self=this;
  52666. return $core.withContext(function($ctx1) {
  52667. var $2,$1;
  52668. $self._should_raise_((function(){
  52669. return $core.withContext(function($ctx2) {
  52670. return $recv($recv($self._collectionClass())._new())._anyOne();
  52671. $ctx2.sendIdx["anyOne"]=1;
  52672. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52673. }),$globals.Error);
  52674. $2=$self._collection();
  52675. $ctx1.sendIdx["collection"]=1;
  52676. $1=$recv($2)._includes_($recv($self._collection())._anyOne());
  52677. $self._assert_($1);
  52678. return self;
  52679. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  52680. },
  52681. args: [],
  52682. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  52683. referencedClasses: ["Error"],
  52684. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  52685. }),
  52686. $globals.CollectionTest);
  52687. $core.addMethod(
  52688. $core.method({
  52689. selector: "testAnySatisfy",
  52690. protocol: "tests",
  52691. fn: function (){
  52692. var self=this,$self=this;
  52693. var anyOne;
  52694. return $core.withContext(function($ctx1) {
  52695. var $1,$3,$2;
  52696. $1=$self._collection();
  52697. $ctx1.sendIdx["collection"]=1;
  52698. anyOne=$recv($1)._anyOne();
  52699. $3=$self._collection();
  52700. $ctx1.sendIdx["collection"]=2;
  52701. $2=$recv($3)._anySatisfy_((function(each){
  52702. return $core.withContext(function($ctx2) {
  52703. return $recv(each).__eq(anyOne);
  52704. $ctx2.sendIdx["="]=1;
  52705. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52706. }));
  52707. $ctx1.sendIdx["anySatisfy:"]=1;
  52708. $self._assert_($2);
  52709. $self._deny_($recv($self._collection())._anySatisfy_((function(each){
  52710. return $core.withContext(function($ctx2) {
  52711. return $recv(each).__eq($recv($globals.Object)._new());
  52712. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52713. })));
  52714. return self;
  52715. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  52716. },
  52717. args: [],
  52718. 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 ])",
  52719. referencedClasses: ["Object"],
  52720. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  52721. }),
  52722. $globals.CollectionTest);
  52723. $core.addMethod(
  52724. $core.method({
  52725. selector: "testAsArray",
  52726. protocol: "tests",
  52727. fn: function (){
  52728. var self=this,$self=this;
  52729. return $core.withContext(function($ctx1) {
  52730. var $1;
  52731. $1=$self._collection();
  52732. $ctx1.sendIdx["collection"]=1;
  52733. $self._assertSameContents_as_($1,$recv($self._collection())._asArray());
  52734. return self;
  52735. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  52736. },
  52737. args: [],
  52738. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  52739. referencedClasses: [],
  52740. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  52741. }),
  52742. $globals.CollectionTest);
  52743. $core.addMethod(
  52744. $core.method({
  52745. selector: "testAsOrderedCollection",
  52746. protocol: "tests",
  52747. fn: function (){
  52748. var self=this,$self=this;
  52749. return $core.withContext(function($ctx1) {
  52750. var $1;
  52751. $1=$self._collection();
  52752. $ctx1.sendIdx["collection"]=1;
  52753. $self._assertSameContents_as_($1,$recv($self._collection())._asOrderedCollection());
  52754. return self;
  52755. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  52756. },
  52757. args: [],
  52758. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  52759. referencedClasses: [],
  52760. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  52761. }),
  52762. $globals.CollectionTest);
  52763. $core.addMethod(
  52764. $core.method({
  52765. selector: "testAsSet",
  52766. protocol: "tests",
  52767. fn: function (){
  52768. var self=this,$self=this;
  52769. var c,set;
  52770. return $core.withContext(function($ctx1) {
  52771. c=$self._collectionWithDuplicates();
  52772. set=$recv(c)._asSet();
  52773. $self._assert_equals_($recv(set)._size(),(6));
  52774. $recv(c)._do_((function(each){
  52775. return $core.withContext(function($ctx2) {
  52776. return $self._assert_($recv(set)._includes_(each));
  52777. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52778. }));
  52779. return self;
  52780. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  52781. },
  52782. args: [],
  52783. 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) ]",
  52784. referencedClasses: [],
  52785. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  52786. }),
  52787. $globals.CollectionTest);
  52788. $core.addMethod(
  52789. $core.method({
  52790. selector: "testCollect",
  52791. protocol: "tests",
  52792. fn: function (){
  52793. var self=this,$self=this;
  52794. return $core.withContext(function($ctx1) {
  52795. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  52796. $2=$self._collection();
  52797. $ctx1.sendIdx["collection"]=1;
  52798. $1=$recv($2)._collect_((function(each){
  52799. return each;
  52800. }));
  52801. $ctx1.sendIdx["collect:"]=1;
  52802. $3=$self._collection();
  52803. $ctx1.sendIdx["collection"]=2;
  52804. $self._assert_equals_($1,$3);
  52805. $ctx1.sendIdx["assert:equals:"]=1;
  52806. $5=$self._collectionWithNewValue();
  52807. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52808. $4=$recv($5)._collect_((function(each){
  52809. return each;
  52810. }));
  52811. $ctx1.sendIdx["collect:"]=2;
  52812. $self._assert_equals_($4,$self._collectionWithNewValue());
  52813. $ctx1.sendIdx["assert:equals:"]=2;
  52814. $8=$self._collectionClass();
  52815. $ctx1.sendIdx["collectionClass"]=1;
  52816. $7=$recv($8)._new();
  52817. $ctx1.sendIdx["new"]=1;
  52818. $6=$recv($7)._collect_((function(each){
  52819. return $core.withContext(function($ctx2) {
  52820. return $recv(each)._printString();
  52821. $ctx2.sendIdx["printString"]=1;
  52822. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  52823. }));
  52824. $ctx1.sendIdx["collect:"]=3;
  52825. $self._assert_equals_($6,$recv($self._collectionClass())._new());
  52826. $ctx1.sendIdx["assert:equals:"]=3;
  52827. $11=$self._collection();
  52828. $ctx1.sendIdx["collection"]=3;
  52829. $10=$recv($11)._collect_((function(){
  52830. return $core.withContext(function($ctx2) {
  52831. return $self._sampleNewValue();
  52832. $ctx2.sendIdx["sampleNewValue"]=1;
  52833. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  52834. }));
  52835. $ctx1.sendIdx["collect:"]=4;
  52836. $9=$recv($10)._detect_((function(){
  52837. return true;
  52838. }));
  52839. $self._assert_equals_($9,$self._sampleNewValue());
  52840. $ctx1.sendIdx["assert:equals:"]=4;
  52841. $self._assert_equals_($recv($self._collection())._collect_((function(each){
  52842. return $core.withContext(function($ctx2) {
  52843. return $recv(each)._printString();
  52844. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52845. })),$self._collectionOfPrintStrings());
  52846. return self;
  52847. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  52848. },
  52849. args: [],
  52850. 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",
  52851. referencedClasses: [],
  52852. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  52853. }),
  52854. $globals.CollectionTest);
  52855. $core.addMethod(
  52856. $core.method({
  52857. selector: "testComma",
  52858. protocol: "tests",
  52859. fn: function (){
  52860. var self=this,$self=this;
  52861. return $core.withContext(function($ctx1) {
  52862. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  52863. $2=$self._collection();
  52864. $ctx1.sendIdx["collection"]=1;
  52865. $4=$self._collectionClass();
  52866. $ctx1.sendIdx["collectionClass"]=1;
  52867. $3=$recv($4)._new();
  52868. $ctx1.sendIdx["new"]=1;
  52869. $1=$recv($2).__comma($3);
  52870. $ctx1.sendIdx[","]=1;
  52871. $5=$self._collection();
  52872. $ctx1.sendIdx["collection"]=2;
  52873. $self._assert_equals_($1,$5);
  52874. $ctx1.sendIdx["assert:equals:"]=1;
  52875. $8=$self._collectionClass();
  52876. $ctx1.sendIdx["collectionClass"]=2;
  52877. $7=$recv($8)._new();
  52878. $ctx1.sendIdx["new"]=2;
  52879. $9=$self._collection();
  52880. $ctx1.sendIdx["collection"]=3;
  52881. $6=$recv($7).__comma($9);
  52882. $ctx1.sendIdx[","]=2;
  52883. $10=$self._collection();
  52884. $ctx1.sendIdx["collection"]=4;
  52885. $self._assert_equals_($6,$10);
  52886. $ctx1.sendIdx["assert:equals:"]=2;
  52887. $13=$self._collectionClass();
  52888. $ctx1.sendIdx["collectionClass"]=3;
  52889. $12=$recv($13)._new();
  52890. $ctx1.sendIdx["new"]=3;
  52891. $15=$self._collectionClass();
  52892. $ctx1.sendIdx["collectionClass"]=4;
  52893. $14=$recv($15)._new();
  52894. $ctx1.sendIdx["new"]=4;
  52895. $11=$recv($12).__comma($14);
  52896. $ctx1.sendIdx[","]=3;
  52897. $self._assert_equals_($11,$recv($self._collectionClass())._new());
  52898. $ctx1.sendIdx["assert:equals:"]=3;
  52899. $17=$self._collection();
  52900. $ctx1.sendIdx["collection"]=5;
  52901. $18=$self._sampleNewValueAsCollection();
  52902. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52903. $16=$recv($17).__comma($18);
  52904. $ctx1.sendIdx[","]=4;
  52905. $19=$self._collectionWithNewValue();
  52906. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52907. $self._assert_equals_($16,$19);
  52908. $self._assertSameContents_as_($recv($self._sampleNewValueAsCollection()).__comma($self._collection()),$self._collectionWithNewValue());
  52909. return self;
  52910. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  52911. },
  52912. args: [],
  52913. 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",
  52914. referencedClasses: [],
  52915. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52916. }),
  52917. $globals.CollectionTest);
  52918. $core.addMethod(
  52919. $core.method({
  52920. selector: "testCopy",
  52921. protocol: "tests",
  52922. fn: function (){
  52923. var self=this,$self=this;
  52924. return $core.withContext(function($ctx1) {
  52925. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  52926. $3=$self._collectionClass();
  52927. $ctx1.sendIdx["collectionClass"]=1;
  52928. $2=$recv($3)._new();
  52929. $ctx1.sendIdx["new"]=1;
  52930. $1=$recv($2)._copy();
  52931. $ctx1.sendIdx["copy"]=1;
  52932. $5=$self._collectionClass();
  52933. $ctx1.sendIdx["collectionClass"]=2;
  52934. $4=$recv($5)._new();
  52935. $ctx1.sendIdx["new"]=2;
  52936. $self._assert_equals_($1,$4);
  52937. $ctx1.sendIdx["assert:equals:"]=1;
  52938. $7=$self._collection();
  52939. $ctx1.sendIdx["collection"]=1;
  52940. $6=$recv($7)._copy();
  52941. $ctx1.sendIdx["copy"]=2;
  52942. $8=$self._collection();
  52943. $ctx1.sendIdx["collection"]=2;
  52944. $self._assert_equals_($6,$8);
  52945. $ctx1.sendIdx["assert:equals:"]=2;
  52946. $10=$self._collectionWithNewValue();
  52947. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52948. $9=$recv($10)._copy();
  52949. $ctx1.sendIdx["copy"]=3;
  52950. $11=$self._collectionWithNewValue();
  52951. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52952. $self._assert_equals_($9,$11);
  52953. $15=$self._collectionClass();
  52954. $ctx1.sendIdx["collectionClass"]=3;
  52955. $14=$recv($15)._new();
  52956. $ctx1.sendIdx["new"]=3;
  52957. $13=$recv($14)._copy();
  52958. $ctx1.sendIdx["copy"]=4;
  52959. $16=$self._collection();
  52960. $ctx1.sendIdx["collection"]=3;
  52961. $12=$recv($13).__eq($16);
  52962. $ctx1.sendIdx["="]=1;
  52963. $self._deny_($12);
  52964. $ctx1.sendIdx["deny:"]=1;
  52965. $19=$self._collection();
  52966. $ctx1.sendIdx["collection"]=4;
  52967. $18=$recv($19)._copy();
  52968. $ctx1.sendIdx["copy"]=5;
  52969. $17=$recv($18).__eq($recv($self._collectionClass())._new());
  52970. $ctx1.sendIdx["="]=2;
  52971. $self._deny_($17);
  52972. $ctx1.sendIdx["deny:"]=2;
  52973. $self._deny_($recv($recv($self._collection())._copy()).__eq($self._collectionWithNewValue()));
  52974. return self;
  52975. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  52976. },
  52977. args: [],
  52978. 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",
  52979. referencedClasses: [],
  52980. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  52981. }),
  52982. $globals.CollectionTest);
  52983. $core.addMethod(
  52984. $core.method({
  52985. selector: "testCopySeparates",
  52986. protocol: "tests",
  52987. fn: function (){
  52988. var self=this,$self=this;
  52989. var original,copy;
  52990. return $core.withContext(function($ctx1) {
  52991. original=$self._collection();
  52992. $ctx1.sendIdx["collection"]=1;
  52993. copy=$recv(original)._copy();
  52994. $recv(copy)._addAll_($self._sampleNewValueAsCollection());
  52995. $self._assert_($recv(original).__eq($self._collection()));
  52996. return self;
  52997. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  52998. },
  52999. args: [],
  53000. 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",
  53001. referencedClasses: [],
  53002. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  53003. }),
  53004. $globals.CollectionTest);
  53005. $core.addMethod(
  53006. $core.method({
  53007. selector: "testDetect",
  53008. protocol: "tests",
  53009. fn: function (){
  53010. var self=this,$self=this;
  53011. return $core.withContext(function($ctx1) {
  53012. var $1,$2,$3,$4,$6,$5,$7;
  53013. $self._shouldnt_raise_((function(){
  53014. return $core.withContext(function($ctx2) {
  53015. $1=$self._collection();
  53016. $ctx2.sendIdx["collection"]=1;
  53017. return $recv($1)._detect_((function(){
  53018. return true;
  53019. }));
  53020. $ctx2.sendIdx["detect:"]=1;
  53021. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53022. }),$globals.Error);
  53023. $self._should_raise_((function(){
  53024. return $core.withContext(function($ctx2) {
  53025. $2=$self._collection();
  53026. $ctx2.sendIdx["collection"]=2;
  53027. return $recv($2)._detect_((function(){
  53028. return false;
  53029. }));
  53030. $ctx2.sendIdx["detect:"]=2;
  53031. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53032. }),$globals.Error);
  53033. $ctx1.sendIdx["should:raise:"]=1;
  53034. $3=$recv($self._sampleNewValueAsCollection())._detect_((function(){
  53035. return true;
  53036. }));
  53037. $ctx1.sendIdx["detect:"]=3;
  53038. $4=$self._sampleNewValue();
  53039. $ctx1.sendIdx["sampleNewValue"]=1;
  53040. $self._assert_equals_($3,$4);
  53041. $ctx1.sendIdx["assert:equals:"]=1;
  53042. $5=$recv($self._collectionWithNewValue())._detect_((function(each){
  53043. return $core.withContext(function($ctx2) {
  53044. $6=$self._sampleNewValue();
  53045. $ctx2.sendIdx["sampleNewValue"]=2;
  53046. return $recv(each).__eq($6);
  53047. $ctx2.sendIdx["="]=1;
  53048. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53049. }));
  53050. $ctx1.sendIdx["detect:"]=4;
  53051. $7=$self._sampleNewValue();
  53052. $ctx1.sendIdx["sampleNewValue"]=3;
  53053. $self._assert_equals_($5,$7);
  53054. $self._should_raise_((function(){
  53055. return $core.withContext(function($ctx2) {
  53056. return $recv($self._collection())._detect_((function(each){
  53057. return $core.withContext(function($ctx3) {
  53058. return $recv(each).__eq($self._sampleNewValue());
  53059. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  53060. }));
  53061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  53062. }),$globals.Error);
  53063. return self;
  53064. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  53065. },
  53066. args: [],
  53067. 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",
  53068. referencedClasses: ["Error"],
  53069. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  53070. }),
  53071. $globals.CollectionTest);
  53072. $core.addMethod(
  53073. $core.method({
  53074. selector: "testDetectIfNone",
  53075. protocol: "tests",
  53076. fn: function (){
  53077. var self=this,$self=this;
  53078. var sentinel;
  53079. return $core.withContext(function($ctx1) {
  53080. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  53081. sentinel=$recv($globals.Object)._new();
  53082. $3=$self._collection();
  53083. $ctx1.sendIdx["collection"]=1;
  53084. $2=$recv($3)._detect_ifNone_((function(){
  53085. return true;
  53086. }),(function(){
  53087. return sentinel;
  53088. }));
  53089. $ctx1.sendIdx["detect:ifNone:"]=1;
  53090. $1=$recv($2).__tild_eq(sentinel);
  53091. $self._assert_($1);
  53092. $5=$self._collection();
  53093. $ctx1.sendIdx["collection"]=2;
  53094. $4=$recv($5)._detect_ifNone_((function(){
  53095. return false;
  53096. }),(function(){
  53097. return sentinel;
  53098. }));
  53099. $ctx1.sendIdx["detect:ifNone:"]=2;
  53100. $self._assert_equals_($4,sentinel);
  53101. $ctx1.sendIdx["assert:equals:"]=1;
  53102. $6=$recv($self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  53103. return true;
  53104. }),(function(){
  53105. return sentinel;
  53106. }));
  53107. $ctx1.sendIdx["detect:ifNone:"]=3;
  53108. $7=$self._sampleNewValue();
  53109. $ctx1.sendIdx["sampleNewValue"]=1;
  53110. $self._assert_equals_($6,$7);
  53111. $ctx1.sendIdx["assert:equals:"]=2;
  53112. $8=$recv($self._collectionWithNewValue())._detect_ifNone_((function(each){
  53113. return $core.withContext(function($ctx2) {
  53114. $9=$self._sampleNewValue();
  53115. $ctx2.sendIdx["sampleNewValue"]=2;
  53116. return $recv(each).__eq($9);
  53117. $ctx2.sendIdx["="]=1;
  53118. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  53119. }),(function(){
  53120. return sentinel;
  53121. }));
  53122. $ctx1.sendIdx["detect:ifNone:"]=4;
  53123. $10=$self._sampleNewValue();
  53124. $ctx1.sendIdx["sampleNewValue"]=3;
  53125. $self._assert_equals_($8,$10);
  53126. $ctx1.sendIdx["assert:equals:"]=3;
  53127. $self._assert_equals_($recv($self._collection())._detect_ifNone_((function(each){
  53128. return $core.withContext(function($ctx2) {
  53129. return $recv(each).__eq($self._sampleNewValue());
  53130. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  53131. }),(function(){
  53132. return sentinel;
  53133. })),sentinel);
  53134. return self;
  53135. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  53136. },
  53137. args: [],
  53138. 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",
  53139. referencedClasses: ["Object"],
  53140. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  53141. }),
  53142. $globals.CollectionTest);
  53143. $core.addMethod(
  53144. $core.method({
  53145. selector: "testDo",
  53146. protocol: "tests",
  53147. fn: function (){
  53148. var self=this,$self=this;
  53149. var newCollection;
  53150. return $core.withContext(function($ctx1) {
  53151. var $1,$2;
  53152. newCollection=$recv($globals.OrderedCollection)._new();
  53153. $ctx1.sendIdx["new"]=1;
  53154. $1=$self._collection();
  53155. $ctx1.sendIdx["collection"]=1;
  53156. $recv($1)._do_((function(each){
  53157. return $core.withContext(function($ctx2) {
  53158. return $recv(newCollection)._add_(each);
  53159. $ctx2.sendIdx["add:"]=1;
  53160. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53161. }));
  53162. $ctx1.sendIdx["do:"]=1;
  53163. $self._assertSameContents_as_($self._collection(),newCollection);
  53164. $ctx1.sendIdx["assertSameContents:as:"]=1;
  53165. newCollection=$recv($globals.OrderedCollection)._new();
  53166. $2=$self._collectionWithDuplicates();
  53167. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  53168. $recv($2)._do_((function(each){
  53169. return $core.withContext(function($ctx2) {
  53170. return $recv(newCollection)._add_(each);
  53171. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53172. }));
  53173. $self._assertSameContents_as_($self._collectionWithDuplicates(),newCollection);
  53174. return self;
  53175. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  53176. },
  53177. args: [],
  53178. 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",
  53179. referencedClasses: ["OrderedCollection"],
  53180. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  53181. }),
  53182. $globals.CollectionTest);
  53183. $core.addMethod(
  53184. $core.method({
  53185. selector: "testEquality",
  53186. protocol: "tests",
  53187. fn: function (){
  53188. var self=this,$self=this;
  53189. return $core.withContext(function($ctx1) {
  53190. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  53191. $2=$self._collectionClass();
  53192. $ctx1.sendIdx["collectionClass"]=1;
  53193. $1=$recv($2)._new();
  53194. $ctx1.sendIdx["new"]=1;
  53195. $4=$self._collectionClass();
  53196. $ctx1.sendIdx["collectionClass"]=2;
  53197. $3=$recv($4)._new();
  53198. $ctx1.sendIdx["new"]=2;
  53199. $self._assert_equals_($1,$3);
  53200. $ctx1.sendIdx["assert:equals:"]=1;
  53201. $5=$self._collection();
  53202. $ctx1.sendIdx["collection"]=1;
  53203. $6=$self._collection();
  53204. $ctx1.sendIdx["collection"]=2;
  53205. $self._assert_equals_($5,$6);
  53206. $ctx1.sendIdx["assert:equals:"]=2;
  53207. $7=$self._collectionWithNewValue();
  53208. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53209. $8=$self._collectionWithNewValue();
  53210. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53211. $self._assert_equals_($7,$8);
  53212. $11=$self._collectionClass();
  53213. $ctx1.sendIdx["collectionClass"]=3;
  53214. $10=$recv($11)._new();
  53215. $ctx1.sendIdx["new"]=3;
  53216. $12=$self._collection();
  53217. $ctx1.sendIdx["collection"]=3;
  53218. $9=$recv($10).__eq($12);
  53219. $ctx1.sendIdx["="]=1;
  53220. $self._deny_($9);
  53221. $ctx1.sendIdx["deny:"]=1;
  53222. $14=$self._collection();
  53223. $ctx1.sendIdx["collection"]=4;
  53224. $13=$recv($14).__eq($recv($self._collectionClass())._new());
  53225. $ctx1.sendIdx["="]=2;
  53226. $self._deny_($13);
  53227. $ctx1.sendIdx["deny:"]=2;
  53228. $self._deny_($recv($self._collection()).__eq($self._collectionWithNewValue()));
  53229. return self;
  53230. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  53231. },
  53232. args: [],
  53233. 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",
  53234. referencedClasses: [],
  53235. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  53236. }),
  53237. $globals.CollectionTest);
  53238. $core.addMethod(
  53239. $core.method({
  53240. selector: "testIfEmptyFamily",
  53241. protocol: "tests",
  53242. fn: function (){
  53243. var self=this,$self=this;
  53244. return $core.withContext(function($ctx1) {
  53245. 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;
  53246. $3=$self._collectionClass();
  53247. $ctx1.sendIdx["collectionClass"]=1;
  53248. $2=$recv($3)._new();
  53249. $ctx1.sendIdx["new"]=1;
  53250. $1=$recv($2)._ifEmpty_((function(){
  53251. return (42);
  53252. }));
  53253. $ctx1.sendIdx["ifEmpty:"]=1;
  53254. $self._assert_equals_($1,(42));
  53255. $ctx1.sendIdx["assert:equals:"]=1;
  53256. $5=$self._collection();
  53257. $ctx1.sendIdx["collection"]=1;
  53258. $4=$recv($5)._ifEmpty_((function(){
  53259. return (42);
  53260. }));
  53261. $6=$self._collection();
  53262. $ctx1.sendIdx["collection"]=2;
  53263. $self._assert_equals_($4,$6);
  53264. $ctx1.sendIdx["assert:equals:"]=2;
  53265. $9=$self._collectionClass();
  53266. $ctx1.sendIdx["collectionClass"]=2;
  53267. $8=$recv($9)._new();
  53268. $ctx1.sendIdx["new"]=2;
  53269. $7=$recv($8)._ifNotEmpty_((function(){
  53270. return (42);
  53271. }));
  53272. $ctx1.sendIdx["ifNotEmpty:"]=1;
  53273. $11=$self._collectionClass();
  53274. $ctx1.sendIdx["collectionClass"]=3;
  53275. $10=$recv($11)._new();
  53276. $ctx1.sendIdx["new"]=3;
  53277. $self._assert_equals_($7,$10);
  53278. $ctx1.sendIdx["assert:equals:"]=3;
  53279. $13=$self._collection();
  53280. $ctx1.sendIdx["collection"]=3;
  53281. $12=$recv($13)._ifNotEmpty_((function(){
  53282. return (42);
  53283. }));
  53284. $ctx1.sendIdx["ifNotEmpty:"]=2;
  53285. $self._assert_equals_($12,(42));
  53286. $ctx1.sendIdx["assert:equals:"]=4;
  53287. $15=$self._collection();
  53288. $ctx1.sendIdx["collection"]=4;
  53289. $14=$recv($15)._ifNotEmpty_((function(col){
  53290. return col;
  53291. }));
  53292. $16=$self._collection();
  53293. $ctx1.sendIdx["collection"]=5;
  53294. $self._assert_equals_($14,$16);
  53295. $ctx1.sendIdx["assert:equals:"]=5;
  53296. $19=$self._collectionClass();
  53297. $ctx1.sendIdx["collectionClass"]=4;
  53298. $18=$recv($19)._new();
  53299. $ctx1.sendIdx["new"]=4;
  53300. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  53301. return (42);
  53302. }),(function(){
  53303. return (999);
  53304. }));
  53305. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  53306. $self._assert_equals_($17,(42));
  53307. $ctx1.sendIdx["assert:equals:"]=6;
  53308. $21=$self._collection();
  53309. $ctx1.sendIdx["collection"]=6;
  53310. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  53311. return (42);
  53312. }),(function(){
  53313. return (999);
  53314. }));
  53315. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  53316. $self._assert_equals_($20,(999));
  53317. $ctx1.sendIdx["assert:equals:"]=7;
  53318. $23=$self._collection();
  53319. $ctx1.sendIdx["collection"]=7;
  53320. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  53321. return (42);
  53322. }),(function(col){
  53323. return col;
  53324. }));
  53325. $24=$self._collection();
  53326. $ctx1.sendIdx["collection"]=8;
  53327. $self._assert_equals_($22,$24);
  53328. $ctx1.sendIdx["assert:equals:"]=8;
  53329. $25=$recv($recv($self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  53330. return (42);
  53331. }),(function(){
  53332. return (999);
  53333. }));
  53334. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  53335. $self._assert_equals_($25,(999));
  53336. $ctx1.sendIdx["assert:equals:"]=9;
  53337. $27=$self._collection();
  53338. $ctx1.sendIdx["collection"]=9;
  53339. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  53340. return (42);
  53341. }),(function(){
  53342. return (999);
  53343. }));
  53344. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  53345. $self._assert_equals_($26,(42));
  53346. $ctx1.sendIdx["assert:equals:"]=10;
  53347. $29=$self._collection();
  53348. $ctx1.sendIdx["collection"]=10;
  53349. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  53350. return col;
  53351. }),(function(){
  53352. return (999);
  53353. }));
  53354. $self._assert_equals_($28,$self._collection());
  53355. return self;
  53356. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  53357. },
  53358. args: [],
  53359. 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.",
  53360. referencedClasses: [],
  53361. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  53362. }),
  53363. $globals.CollectionTest);
  53364. $core.addMethod(
  53365. $core.method({
  53366. selector: "testIsEmpty",
  53367. protocol: "tests",
  53368. fn: function (){
  53369. var self=this,$self=this;
  53370. return $core.withContext(function($ctx1) {
  53371. var $1;
  53372. $1=$recv($recv($self._collectionClass())._new())._isEmpty();
  53373. $ctx1.sendIdx["isEmpty"]=1;
  53374. $self._assert_($1);
  53375. $self._deny_($recv($self._collection())._isEmpty());
  53376. return self;
  53377. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  53378. },
  53379. args: [],
  53380. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  53381. referencedClasses: [],
  53382. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  53383. }),
  53384. $globals.CollectionTest);
  53385. $core.addMethod(
  53386. $core.method({
  53387. selector: "testNoneSatisfy",
  53388. protocol: "tests",
  53389. fn: function (){
  53390. var self=this,$self=this;
  53391. var anyOne;
  53392. return $core.withContext(function($ctx1) {
  53393. var $1,$3,$2;
  53394. $1=$self._collection();
  53395. $ctx1.sendIdx["collection"]=1;
  53396. anyOne=$recv($1)._anyOne();
  53397. $3=$self._collection();
  53398. $ctx1.sendIdx["collection"]=2;
  53399. $2=$recv($3)._noneSatisfy_((function(each){
  53400. return $core.withContext(function($ctx2) {
  53401. return $recv(each).__eq(anyOne);
  53402. $ctx2.sendIdx["="]=1;
  53403. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53404. }));
  53405. $ctx1.sendIdx["noneSatisfy:"]=1;
  53406. $self._deny_($2);
  53407. $self._assert_($recv($self._collection())._noneSatisfy_((function(each){
  53408. return $core.withContext(function($ctx2) {
  53409. return $recv(each).__eq($recv($globals.Object)._new());
  53410. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53411. })));
  53412. return self;
  53413. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  53414. },
  53415. args: [],
  53416. 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 ])",
  53417. referencedClasses: ["Object"],
  53418. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  53419. }),
  53420. $globals.CollectionTest);
  53421. $core.addMethod(
  53422. $core.method({
  53423. selector: "testRegression1224",
  53424. protocol: "tests",
  53425. fn: function (){
  53426. var self=this,$self=this;
  53427. return $core.withContext(function($ctx1) {
  53428. var $3,$2,$1;
  53429. $3=$recv($self._collectionClass())._new();
  53430. $recv($3)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  53431. }));
  53432. $2=$recv($3)._yourself();
  53433. $1=$recv($2)._size();
  53434. $self._assert_equals_($1,(0));
  53435. return self;
  53436. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.CollectionTest)});
  53437. },
  53438. args: [],
  53439. source: "testRegression1224\x0a\x09self assert: (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size equals: 0",
  53440. referencedClasses: [],
  53441. messageSends: ["assert:equals:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  53442. }),
  53443. $globals.CollectionTest);
  53444. $core.addMethod(
  53445. $core.method({
  53446. selector: "testRemoveAll",
  53447. protocol: "tests",
  53448. fn: function (){
  53449. var self=this,$self=this;
  53450. return $core.withContext(function($ctx1) {
  53451. var $2,$1;
  53452. $2=$self._collection();
  53453. $recv($2)._removeAll();
  53454. $1=$recv($2)._yourself();
  53455. $self._assert_equals_($1,$recv($self._collectionClass())._new());
  53456. return self;
  53457. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  53458. },
  53459. args: [],
  53460. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  53461. referencedClasses: [],
  53462. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  53463. }),
  53464. $globals.CollectionTest);
  53465. $core.addMethod(
  53466. $core.method({
  53467. selector: "testSelect",
  53468. protocol: "tests",
  53469. fn: function (){
  53470. var self=this,$self=this;
  53471. return $core.withContext(function($ctx1) {
  53472. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  53473. $2=$self._collection();
  53474. $ctx1.sendIdx["collection"]=1;
  53475. $1=$recv($2)._select_((function(){
  53476. return false;
  53477. }));
  53478. $ctx1.sendIdx["select:"]=1;
  53479. $4=$self._collectionClass();
  53480. $ctx1.sendIdx["collectionClass"]=1;
  53481. $3=$recv($4)._new();
  53482. $ctx1.sendIdx["new"]=1;
  53483. $self._assert_equals_($1,$3);
  53484. $ctx1.sendIdx["assert:equals:"]=1;
  53485. $6=$self._collection();
  53486. $ctx1.sendIdx["collection"]=2;
  53487. $5=$recv($6)._select_((function(){
  53488. return true;
  53489. }));
  53490. $ctx1.sendIdx["select:"]=2;
  53491. $7=$self._collection();
  53492. $ctx1.sendIdx["collection"]=3;
  53493. $self._assert_equals_($5,$7);
  53494. $ctx1.sendIdx["assert:equals:"]=2;
  53495. $9=$self._collectionWithNewValue();
  53496. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53497. $8=$recv($9)._select_((function(each){
  53498. return $core.withContext(function($ctx2) {
  53499. $10=$self._sampleNewValue();
  53500. $ctx2.sendIdx["sampleNewValue"]=1;
  53501. return $recv(each).__eq($10);
  53502. $ctx2.sendIdx["="]=1;
  53503. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  53504. }));
  53505. $ctx1.sendIdx["select:"]=3;
  53506. $self._assert_equals_($8,$self._sampleNewValueAsCollection());
  53507. $ctx1.sendIdx["assert:equals:"]=3;
  53508. $12=$self._collectionWithNewValue();
  53509. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53510. $11=$recv($12)._select_((function(each){
  53511. return $core.withContext(function($ctx2) {
  53512. $13=$self._sampleNewValue();
  53513. $ctx2.sendIdx["sampleNewValue"]=2;
  53514. return $recv(each).__tild_eq($13);
  53515. $ctx2.sendIdx["~="]=1;
  53516. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53517. }));
  53518. $ctx1.sendIdx["select:"]=4;
  53519. $14=$self._collection();
  53520. $ctx1.sendIdx["collection"]=4;
  53521. $self._assert_equals_($11,$14);
  53522. $ctx1.sendIdx["assert:equals:"]=4;
  53523. $16=$self._collection();
  53524. $ctx1.sendIdx["collection"]=5;
  53525. $15=$recv($16)._select_((function(each){
  53526. return $core.withContext(function($ctx2) {
  53527. $17=$self._sampleNewValue();
  53528. $ctx2.sendIdx["sampleNewValue"]=3;
  53529. return $recv(each).__eq($17);
  53530. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  53531. }));
  53532. $ctx1.sendIdx["select:"]=5;
  53533. $self._assert_equals_($15,$recv($self._collectionClass())._new());
  53534. $ctx1.sendIdx["assert:equals:"]=5;
  53535. $self._assert_equals_($recv($self._collectionWithNewValue())._select_((function(each){
  53536. return $core.withContext(function($ctx2) {
  53537. return $recv(each).__tild_eq($self._sampleNewValue());
  53538. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53539. })),$self._collection());
  53540. return self;
  53541. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  53542. },
  53543. args: [],
  53544. 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",
  53545. referencedClasses: [],
  53546. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  53547. }),
  53548. $globals.CollectionTest);
  53549. $core.addMethod(
  53550. $core.method({
  53551. selector: "testSelectThenCollect",
  53552. protocol: "tests",
  53553. fn: function (){
  53554. var self=this,$self=this;
  53555. return $core.withContext(function($ctx1) {
  53556. var $2,$1,$4,$3,$6,$5,$7,$9,$8;
  53557. $2=$self._collection();
  53558. $ctx1.sendIdx["collection"]=1;
  53559. $1=$recv($2)._select_thenCollect_((function(){
  53560. return false;
  53561. }),"isString");
  53562. $ctx1.sendIdx["select:thenCollect:"]=1;
  53563. $4=$self._collectionClass();
  53564. $ctx1.sendIdx["collectionClass"]=1;
  53565. $3=$recv($4)._new();
  53566. $ctx1.sendIdx["new"]=1;
  53567. $self._assert_equals_($1,$3);
  53568. $ctx1.sendIdx["assert:equals:"]=1;
  53569. $6=$self._collection();
  53570. $ctx1.sendIdx["collection"]=2;
  53571. $5=$recv($6)._select_thenCollect_((function(){
  53572. return true;
  53573. }),(function(x){
  53574. return x;
  53575. }));
  53576. $ctx1.sendIdx["select:thenCollect:"]=2;
  53577. $7=$self._collection();
  53578. $ctx1.sendIdx["collection"]=3;
  53579. $self._assert_equals_($5,$7);
  53580. $ctx1.sendIdx["assert:equals:"]=2;
  53581. $8=$recv($self._collection())._select_thenCollect_((function(each){
  53582. return $core.withContext(function($ctx2) {
  53583. $9=$self._sampleNewValue();
  53584. $ctx2.sendIdx["sampleNewValue"]=1;
  53585. return $recv(each).__eq($9);
  53586. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53587. }),(function(x){
  53588. return x;
  53589. }));
  53590. $ctx1.sendIdx["select:thenCollect:"]=3;
  53591. $self._assert_equals_($8,$recv($self._collectionClass())._new());
  53592. $ctx1.sendIdx["assert:equals:"]=3;
  53593. $self._assert_equals_($recv($self._collectionWithNewValue())._select_thenCollect_((function(each){
  53594. return $core.withContext(function($ctx2) {
  53595. return $recv(each).__tild_eq($self._sampleNewValue());
  53596. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53597. }),"printString"),$self._collectionOfPrintStrings());
  53598. return self;
  53599. }, function($ctx1) {$ctx1.fill(self,"testSelectThenCollect",{},$globals.CollectionTest)});
  53600. },
  53601. args: [],
  53602. 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",
  53603. referencedClasses: [],
  53604. messageSends: ["assert:equals:", "select:thenCollect:", "collection", "new", "collectionClass", "=", "sampleNewValue", "collectionWithNewValue", "~=", "collectionOfPrintStrings"]
  53605. }),
  53606. $globals.CollectionTest);
  53607. $core.addMethod(
  53608. $core.method({
  53609. selector: "testSingle",
  53610. protocol: "tests",
  53611. fn: function (){
  53612. var self=this,$self=this;
  53613. return $core.withContext(function($ctx1) {
  53614. $self._should_raise_((function(){
  53615. return $core.withContext(function($ctx2) {
  53616. return $recv($recv($self._collectionClass())._new())._single();
  53617. $ctx2.sendIdx["single"]=1;
  53618. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53619. }),$globals.Error);
  53620. $ctx1.sendIdx["should:raise:"]=1;
  53621. $self._should_raise_((function(){
  53622. return $core.withContext(function($ctx2) {
  53623. return $recv($self._collection())._single();
  53624. $ctx2.sendIdx["single"]=2;
  53625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53626. }),$globals.Error);
  53627. $self._assert_equals_($recv($self._sampleNewValueAsCollection())._single(),$self._sampleNewValue());
  53628. return self;
  53629. }, function($ctx1) {$ctx1.fill(self,"testSingle",{},$globals.CollectionTest)});
  53630. },
  53631. args: [],
  53632. 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",
  53633. referencedClasses: ["Error"],
  53634. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  53635. }),
  53636. $globals.CollectionTest);
  53637. $core.addMethod(
  53638. $core.method({
  53639. selector: "testSize",
  53640. protocol: "tests",
  53641. fn: function (){
  53642. var self=this,$self=this;
  53643. return $core.withContext(function($ctx1) {
  53644. var $1,$2;
  53645. $1=$recv($recv($self._collectionClass())._new())._size();
  53646. $ctx1.sendIdx["size"]=1;
  53647. $self._assert_equals_($1,(0));
  53648. $ctx1.sendIdx["assert:equals:"]=1;
  53649. $2=$recv($self._sampleNewValueAsCollection())._size();
  53650. $ctx1.sendIdx["size"]=2;
  53651. $self._assert_equals_($2,(1));
  53652. $ctx1.sendIdx["assert:equals:"]=2;
  53653. $self._assert_equals_($recv($self._collection())._size(),$self._collectionSize());
  53654. return self;
  53655. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  53656. },
  53657. args: [],
  53658. 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",
  53659. referencedClasses: [],
  53660. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  53661. }),
  53662. $globals.CollectionTest);
  53663. $core.addMethod(
  53664. $core.method({
  53665. selector: "collectionClass",
  53666. protocol: "fixture",
  53667. fn: function (){
  53668. var self=this,$self=this;
  53669. return nil;
  53670. },
  53671. args: [],
  53672. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  53673. referencedClasses: [],
  53674. messageSends: []
  53675. }),
  53676. $globals.CollectionTest.a$cls);
  53677. $core.addMethod(
  53678. $core.method({
  53679. selector: "isAbstract",
  53680. protocol: "testing",
  53681. fn: function (){
  53682. var self=this,$self=this;
  53683. return $core.withContext(function($ctx1) {
  53684. return $recv($self._collectionClass())._isNil();
  53685. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.a$cls)});
  53686. },
  53687. args: [],
  53688. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  53689. referencedClasses: [],
  53690. messageSends: ["isNil", "collectionClass"]
  53691. }),
  53692. $globals.CollectionTest.a$cls);
  53693. $core.addClass("IndexableCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  53694. $core.addMethod(
  53695. $core.method({
  53696. selector: "collectionWithNewValue",
  53697. protocol: "fixture",
  53698. fn: function (){
  53699. var self=this,$self=this;
  53700. return $core.withContext(function($ctx1) {
  53701. $self._subclassResponsibility();
  53702. return self;
  53703. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  53704. },
  53705. args: [],
  53706. 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",
  53707. referencedClasses: [],
  53708. messageSends: ["subclassResponsibility"]
  53709. }),
  53710. $globals.IndexableCollectionTest);
  53711. $core.addMethod(
  53712. $core.method({
  53713. selector: "nonIndexesDo:",
  53714. protocol: "fixture",
  53715. fn: function (aBlock){
  53716. var self=this,$self=this;
  53717. return $core.withContext(function($ctx1) {
  53718. $self._subclassResponsibility();
  53719. return self;
  53720. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53721. },
  53722. args: ["aBlock"],
  53723. 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",
  53724. referencedClasses: [],
  53725. messageSends: ["subclassResponsibility"]
  53726. }),
  53727. $globals.IndexableCollectionTest);
  53728. $core.addMethod(
  53729. $core.method({
  53730. selector: "sampleNewIndex",
  53731. protocol: "fixture",
  53732. fn: function (){
  53733. var self=this,$self=this;
  53734. return $core.withContext(function($ctx1) {
  53735. $self._subclassResponsibility();
  53736. return self;
  53737. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  53738. },
  53739. args: [],
  53740. 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",
  53741. referencedClasses: [],
  53742. messageSends: ["subclassResponsibility"]
  53743. }),
  53744. $globals.IndexableCollectionTest);
  53745. $core.addMethod(
  53746. $core.method({
  53747. selector: "samplesDo:",
  53748. protocol: "fixture",
  53749. fn: function (aBlock){
  53750. var self=this,$self=this;
  53751. return $core.withContext(function($ctx1) {
  53752. $self._subclassResponsibility();
  53753. return self;
  53754. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53755. },
  53756. args: ["aBlock"],
  53757. 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",
  53758. referencedClasses: [],
  53759. messageSends: ["subclassResponsibility"]
  53760. }),
  53761. $globals.IndexableCollectionTest);
  53762. $core.addMethod(
  53763. $core.method({
  53764. selector: "testAt",
  53765. protocol: "tests",
  53766. fn: function (){
  53767. var self=this,$self=this;
  53768. return $core.withContext(function($ctx1) {
  53769. var $1;
  53770. $self._nonIndexesDo_((function(each){
  53771. return $core.withContext(function($ctx2) {
  53772. return $self._should_raise_((function(){
  53773. return $core.withContext(function($ctx3) {
  53774. $1=$self._collection();
  53775. $ctx3.sendIdx["collection"]=1;
  53776. return $recv($1)._at_(each);
  53777. $ctx3.sendIdx["at:"]=1;
  53778. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53779. }),$globals.Error);
  53780. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53781. }));
  53782. $self._samplesDo_((function(index,value){
  53783. return $core.withContext(function($ctx2) {
  53784. return $self._assert_equals_($recv($self._collection())._at_(index),value);
  53785. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53786. }));
  53787. return self;
  53788. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  53789. },
  53790. args: [],
  53791. 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 ]",
  53792. referencedClasses: ["Error"],
  53793. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  53794. }),
  53795. $globals.IndexableCollectionTest);
  53796. $core.addMethod(
  53797. $core.method({
  53798. selector: "testAtIfAbsent",
  53799. protocol: "tests",
  53800. fn: function (){
  53801. var self=this,$self=this;
  53802. return $core.withContext(function($ctx1) {
  53803. var $2,$1,$3;
  53804. $self._nonIndexesDo_((function(each){
  53805. return $core.withContext(function($ctx2) {
  53806. $2=$self._collection();
  53807. $ctx2.sendIdx["collection"]=1;
  53808. $1=$recv($2)._at_ifAbsent_(each,(function(){
  53809. return $core.withContext(function($ctx3) {
  53810. return $self._sampleNewValue();
  53811. $ctx3.sendIdx["sampleNewValue"]=1;
  53812. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53813. }));
  53814. $ctx2.sendIdx["at:ifAbsent:"]=1;
  53815. $3=$self._sampleNewValue();
  53816. $ctx2.sendIdx["sampleNewValue"]=2;
  53817. return $self._assert_equals_($1,$3);
  53818. $ctx2.sendIdx["assert:equals:"]=1;
  53819. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53820. }));
  53821. $self._samplesDo_((function(index,value){
  53822. return $core.withContext(function($ctx2) {
  53823. return $self._assert_equals_($recv($self._collection())._at_ifAbsent_(index,(function(){
  53824. return $core.withContext(function($ctx3) {
  53825. return $self._sampleNewValue();
  53826. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  53827. })),value);
  53828. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53829. }));
  53830. return self;
  53831. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  53832. },
  53833. args: [],
  53834. 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 ].",
  53835. referencedClasses: [],
  53836. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  53837. }),
  53838. $globals.IndexableCollectionTest);
  53839. $core.addMethod(
  53840. $core.method({
  53841. selector: "testAtIfAbsentPut",
  53842. protocol: "tests",
  53843. fn: function (){
  53844. var self=this,$self=this;
  53845. var newCollection;
  53846. return $core.withContext(function($ctx1) {
  53847. var $1;
  53848. newCollection=$self._collection();
  53849. $ctx1.sendIdx["collection"]=1;
  53850. $self._samplesDo_((function(index,value){
  53851. return $core.withContext(function($ctx2) {
  53852. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  53853. return $core.withContext(function($ctx3) {
  53854. return $self._sampleNewValue();
  53855. $ctx3.sendIdx["sampleNewValue"]=1;
  53856. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53857. }));
  53858. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  53859. return $self._assert_equals_($1,value);
  53860. $ctx2.sendIdx["assert:equals:"]=1;
  53861. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53862. }));
  53863. $self._assert_equals_(newCollection,$self._collection());
  53864. $ctx1.sendIdx["assert:equals:"]=2;
  53865. $self._assert_equals_($recv(newCollection)._at_ifAbsentPut_($self._sampleNewIndex(),(function(){
  53866. return $core.withContext(function($ctx2) {
  53867. return $self._sampleNewValue();
  53868. $ctx2.sendIdx["sampleNewValue"]=2;
  53869. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53870. })),$self._sampleNewValue());
  53871. $ctx1.sendIdx["assert:equals:"]=3;
  53872. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  53873. return self;
  53874. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  53875. },
  53876. args: [],
  53877. 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",
  53878. referencedClasses: [],
  53879. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  53880. }),
  53881. $globals.IndexableCollectionTest);
  53882. $core.addMethod(
  53883. $core.method({
  53884. selector: "testAtIfPresent",
  53885. protocol: "tests",
  53886. fn: function (){
  53887. var self=this,$self=this;
  53888. var visited,sentinel;
  53889. return $core.withContext(function($ctx1) {
  53890. var $2,$1,$4,$3;
  53891. sentinel=$recv($globals.Object)._new();
  53892. $self._nonIndexesDo_((function(each){
  53893. return $core.withContext(function($ctx2) {
  53894. visited=nil;
  53895. $2=$self._collection();
  53896. $ctx2.sendIdx["collection"]=1;
  53897. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  53898. visited=value1;
  53899. return sentinel;
  53900. }));
  53901. $ctx2.sendIdx["at:ifPresent:"]=1;
  53902. $self._assert_equals_($1,nil);
  53903. $ctx2.sendIdx["assert:equals:"]=1;
  53904. return $self._assert_($recv(visited)._isNil());
  53905. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53906. }));
  53907. $self._samplesDo_((function(index,value){
  53908. return $core.withContext(function($ctx2) {
  53909. visited=nil;
  53910. $4=$self._collection();
  53911. $ctx2.sendIdx["collection"]=2;
  53912. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  53913. visited=value2;
  53914. return sentinel;
  53915. }));
  53916. $self._assert_equals_($3,sentinel);
  53917. $ctx2.sendIdx["assert:equals:"]=2;
  53918. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53919. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53920. }));
  53921. return self;
  53922. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  53923. },
  53924. args: [],
  53925. 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) ]",
  53926. referencedClasses: ["Object"],
  53927. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  53928. }),
  53929. $globals.IndexableCollectionTest);
  53930. $core.addMethod(
  53931. $core.method({
  53932. selector: "testAtIfPresentIfAbsent",
  53933. protocol: "tests",
  53934. fn: function (){
  53935. var self=this,$self=this;
  53936. var visited,sentinel;
  53937. return $core.withContext(function($ctx1) {
  53938. var $2,$1,$3,$5,$4;
  53939. sentinel=$recv($globals.Object)._new();
  53940. $self._nonIndexesDo_((function(each){
  53941. return $core.withContext(function($ctx2) {
  53942. visited=nil;
  53943. $2=$self._collection();
  53944. $ctx2.sendIdx["collection"]=1;
  53945. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  53946. visited=value1;
  53947. return sentinel;
  53948. }),(function(){
  53949. return $core.withContext(function($ctx3) {
  53950. return $self._sampleNewValue();
  53951. $ctx3.sendIdx["sampleNewValue"]=1;
  53952. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  53953. }));
  53954. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  53955. $3=$self._sampleNewValue();
  53956. $ctx2.sendIdx["sampleNewValue"]=2;
  53957. $self._assert_equals_($1,$3);
  53958. $ctx2.sendIdx["assert:equals:"]=1;
  53959. return $self._assert_($recv(visited)._isNil());
  53960. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53961. }));
  53962. $self._samplesDo_((function(index,value){
  53963. return $core.withContext(function($ctx2) {
  53964. visited=nil;
  53965. $5=$self._collection();
  53966. $ctx2.sendIdx["collection"]=2;
  53967. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  53968. visited=value2;
  53969. return sentinel;
  53970. }),(function(){
  53971. return $core.withContext(function($ctx3) {
  53972. return $self._sampleNewValue();
  53973. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  53974. }));
  53975. $self._assert_equals_($4,sentinel);
  53976. $ctx2.sendIdx["assert:equals:"]=2;
  53977. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53978. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  53979. }));
  53980. return self;
  53981. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  53982. },
  53983. args: [],
  53984. 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) ]",
  53985. referencedClasses: ["Object"],
  53986. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  53987. }),
  53988. $globals.IndexableCollectionTest);
  53989. $core.addMethod(
  53990. $core.method({
  53991. selector: "testAtPut",
  53992. protocol: "tests",
  53993. fn: function (){
  53994. var self=this,$self=this;
  53995. var newCollection;
  53996. return $core.withContext(function($ctx1) {
  53997. newCollection=$self._collection();
  53998. $ctx1.sendIdx["collection"]=1;
  53999. $self._samplesDo_((function(index,value){
  54000. return $core.withContext(function($ctx2) {
  54001. return $recv(newCollection)._at_put_(index,value);
  54002. $ctx2.sendIdx["at:put:"]=1;
  54003. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  54004. }));
  54005. $self._assert_equals_(newCollection,$self._collection());
  54006. $ctx1.sendIdx["assert:equals:"]=1;
  54007. $recv(newCollection)._at_put_($self._sampleNewIndex(),$self._sampleNewValue());
  54008. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  54009. return self;
  54010. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  54011. },
  54012. args: [],
  54013. 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",
  54014. referencedClasses: [],
  54015. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  54016. }),
  54017. $globals.IndexableCollectionTest);
  54018. $core.addMethod(
  54019. $core.method({
  54020. selector: "testIndexOf",
  54021. protocol: "tests",
  54022. fn: function (){
  54023. var self=this,$self=this;
  54024. return $core.withContext(function($ctx1) {
  54025. var $1;
  54026. $self._should_raise_((function(){
  54027. return $core.withContext(function($ctx2) {
  54028. $1=$self._collection();
  54029. $ctx2.sendIdx["collection"]=1;
  54030. return $recv($1)._indexOf_($self._sampleNewValue());
  54031. $ctx2.sendIdx["indexOf:"]=1;
  54032. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54033. }),$globals.Error);
  54034. $self._samplesDo_((function(index,value){
  54035. return $core.withContext(function($ctx2) {
  54036. return $self._assert_equals_($recv($self._collection())._indexOf_(value),index);
  54037. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  54038. }));
  54039. return self;
  54040. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  54041. },
  54042. args: [],
  54043. 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 ]",
  54044. referencedClasses: ["Error"],
  54045. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  54046. }),
  54047. $globals.IndexableCollectionTest);
  54048. $core.addMethod(
  54049. $core.method({
  54050. selector: "testIndexOfWithNull",
  54051. protocol: "tests",
  54052. fn: function (){
  54053. var self=this,$self=this;
  54054. var jsNull;
  54055. return $core.withContext(function($ctx1) {
  54056. var $2,$1;
  54057. jsNull=$recv($globals.JSON)._parse_("null");
  54058. $self._samplesDo_((function(index,value){
  54059. return $core.withContext(function($ctx2) {
  54060. $2=$self._collection();
  54061. $recv($2)._at_put_(index,jsNull);
  54062. $1=$recv($2)._indexOf_(jsNull);
  54063. return $self._assert_equals_($1,index);
  54064. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  54065. }));
  54066. return self;
  54067. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  54068. },
  54069. args: [],
  54070. 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 ]",
  54071. referencedClasses: ["JSON"],
  54072. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  54073. }),
  54074. $globals.IndexableCollectionTest);
  54075. $core.addMethod(
  54076. $core.method({
  54077. selector: "testWithIndexDo",
  54078. protocol: "tests",
  54079. fn: function (){
  54080. var self=this,$self=this;
  54081. var collection;
  54082. return $core.withContext(function($ctx1) {
  54083. collection=$self._collection();
  54084. $ctx1.sendIdx["collection"]=1;
  54085. $recv($self._collection())._withIndexDo_((function(each,index){
  54086. return $core.withContext(function($ctx2) {
  54087. return $self._assert_equals_($recv(collection)._at_(index),each);
  54088. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  54089. }));
  54090. return self;
  54091. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  54092. },
  54093. args: [],
  54094. 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 ]",
  54095. referencedClasses: [],
  54096. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  54097. }),
  54098. $globals.IndexableCollectionTest);
  54099. $core.addClass("AssociativeCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  54100. $core.addMethod(
  54101. $core.method({
  54102. selector: "collectionKeys",
  54103. protocol: "fixture",
  54104. fn: function (){
  54105. var self=this,$self=this;
  54106. return $core.withContext(function($ctx1) {
  54107. $self._subclassResponsibility();
  54108. return self;
  54109. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  54110. },
  54111. args: [],
  54112. source: "collectionKeys\x0a\x09self subclassResponsibility",
  54113. referencedClasses: [],
  54114. messageSends: ["subclassResponsibility"]
  54115. }),
  54116. $globals.AssociativeCollectionTest);
  54117. $core.addMethod(
  54118. $core.method({
  54119. selector: "collectionValues",
  54120. protocol: "fixture",
  54121. fn: function (){
  54122. var self=this,$self=this;
  54123. return $core.withContext(function($ctx1) {
  54124. $self._subclassResponsibility();
  54125. return self;
  54126. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  54127. },
  54128. args: [],
  54129. source: "collectionValues\x0a\x09self subclassResponsibility",
  54130. referencedClasses: [],
  54131. messageSends: ["subclassResponsibility"]
  54132. }),
  54133. $globals.AssociativeCollectionTest);
  54134. $core.addMethod(
  54135. $core.method({
  54136. selector: "nonIndexesDo:",
  54137. protocol: "fixture",
  54138. fn: function (aBlock){
  54139. var self=this,$self=this;
  54140. return $core.withContext(function($ctx1) {
  54141. $recv(aBlock)._value_((5));
  54142. $ctx1.sendIdx["value:"]=1;
  54143. $recv(aBlock)._value_((function(){
  54144. }));
  54145. $ctx1.sendIdx["value:"]=2;
  54146. $recv(aBlock)._value_($recv($globals.Object)._new());
  54147. $ctx1.sendIdx["value:"]=3;
  54148. $recv(aBlock)._value_("z");
  54149. return self;
  54150. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  54151. },
  54152. args: ["aBlock"],
  54153. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  54154. referencedClasses: ["Object"],
  54155. messageSends: ["value:", "new"]
  54156. }),
  54157. $globals.AssociativeCollectionTest);
  54158. $core.addMethod(
  54159. $core.method({
  54160. selector: "sampleNewIndex",
  54161. protocol: "fixture",
  54162. fn: function (){
  54163. var self=this,$self=this;
  54164. return "new";
  54165. },
  54166. args: [],
  54167. source: "sampleNewIndex\x0a\x09^ 'new'",
  54168. referencedClasses: [],
  54169. messageSends: []
  54170. }),
  54171. $globals.AssociativeCollectionTest);
  54172. $core.addMethod(
  54173. $core.method({
  54174. selector: "samplesDo:",
  54175. protocol: "fixture",
  54176. fn: function (aBlock){
  54177. var self=this,$self=this;
  54178. return $core.withContext(function($ctx1) {
  54179. $recv(aBlock)._value_value_("a",(2));
  54180. return self;
  54181. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  54182. },
  54183. args: ["aBlock"],
  54184. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  54185. referencedClasses: [],
  54186. messageSends: ["value:value:"]
  54187. }),
  54188. $globals.AssociativeCollectionTest);
  54189. $core.addMethod(
  54190. $core.method({
  54191. selector: "testAddAll",
  54192. protocol: "tests",
  54193. fn: function (){
  54194. var self=this,$self=this;
  54195. return $core.withContext(function($ctx1) {
  54196. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  54197. (
  54198. $ctx1.supercall = true,
  54199. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  54200. $ctx1.supercall = false;
  54201. $2=$self._collection();
  54202. $ctx1.sendIdx["collection"]=1;
  54203. $3=$self._collection();
  54204. $ctx1.sendIdx["collection"]=2;
  54205. $recv($2)._addAll_($3);
  54206. $ctx1.sendIdx["addAll:"]=1;
  54207. $4=$recv($2)._yourself();
  54208. $ctx1.sendIdx["yourself"]=1;
  54209. $1=$4;
  54210. $5=$self._collection();
  54211. $ctx1.sendIdx["collection"]=3;
  54212. $self._assert_equals_($1,$5);
  54213. $ctx1.sendIdx["assert:equals:"]=1;
  54214. $7=$self._collection();
  54215. $ctx1.sendIdx["collection"]=4;
  54216. $8=$self._collectionWithNewValue();
  54217. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54218. $recv($7)._addAll_($8);
  54219. $ctx1.sendIdx["addAll:"]=2;
  54220. $9=$recv($7)._yourself();
  54221. $ctx1.sendIdx["yourself"]=2;
  54222. $6=$9;
  54223. $10=$self._collectionWithNewValue();
  54224. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54225. $self._assert_equals_($6,$10);
  54226. $ctx1.sendIdx["assert:equals:"]=2;
  54227. $12=$self._collectionWithNewValue();
  54228. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54229. $recv($12)._addAll_($self._collection());
  54230. $11=$recv($12)._yourself();
  54231. $self._assert_equals_($11,$self._collectionWithNewValue());
  54232. return self;
  54233. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  54234. },
  54235. args: [],
  54236. 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",
  54237. referencedClasses: [],
  54238. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  54239. }),
  54240. $globals.AssociativeCollectionTest);
  54241. $core.addMethod(
  54242. $core.method({
  54243. selector: "testAsDictionary",
  54244. protocol: "tests",
  54245. fn: function (){
  54246. var self=this,$self=this;
  54247. return $core.withContext(function($ctx1) {
  54248. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  54249. return self;
  54250. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  54251. },
  54252. args: [],
  54253. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  54254. referencedClasses: ["Dictionary"],
  54255. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  54256. }),
  54257. $globals.AssociativeCollectionTest);
  54258. $core.addMethod(
  54259. $core.method({
  54260. selector: "testAsHashedCollection",
  54261. protocol: "tests",
  54262. fn: function (){
  54263. var self=this,$self=this;
  54264. return $core.withContext(function($ctx1) {
  54265. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  54266. return self;
  54267. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  54268. },
  54269. args: [],
  54270. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  54271. referencedClasses: ["HashedCollection"],
  54272. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  54273. }),
  54274. $globals.AssociativeCollectionTest);
  54275. $core.addMethod(
  54276. $core.method({
  54277. selector: "testComma",
  54278. protocol: "tests",
  54279. fn: function (){
  54280. var self=this,$self=this;
  54281. return $core.withContext(function($ctx1) {
  54282. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  54283. (
  54284. $ctx1.supercall = true,
  54285. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  54286. $ctx1.supercall = false;
  54287. $2=$self._collection();
  54288. $ctx1.sendIdx["collection"]=1;
  54289. $3=$self._collection();
  54290. $ctx1.sendIdx["collection"]=2;
  54291. $1=$recv($2).__comma($3);
  54292. $ctx1.sendIdx[","]=1;
  54293. $4=$self._collection();
  54294. $ctx1.sendIdx["collection"]=3;
  54295. $self._assert_equals_($1,$4);
  54296. $ctx1.sendIdx["assert:equals:"]=1;
  54297. $6=$self._collection();
  54298. $ctx1.sendIdx["collection"]=4;
  54299. $7=$self._collectionWithNewValue();
  54300. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54301. $5=$recv($6).__comma($7);
  54302. $ctx1.sendIdx[","]=2;
  54303. $8=$self._collectionWithNewValue();
  54304. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54305. $self._assert_equals_($5,$8);
  54306. $ctx1.sendIdx["assert:equals:"]=2;
  54307. $10=$self._collectionWithNewValue();
  54308. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54309. $9=$recv($10).__comma($self._collection());
  54310. $self._assert_equals_($9,$self._collectionWithNewValue());
  54311. return self;
  54312. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  54313. },
  54314. args: [],
  54315. 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",
  54316. referencedClasses: [],
  54317. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  54318. }),
  54319. $globals.AssociativeCollectionTest);
  54320. $core.addMethod(
  54321. $core.method({
  54322. selector: "testFrom",
  54323. protocol: "tests",
  54324. fn: function (){
  54325. var self=this,$self=this;
  54326. var associations;
  54327. return $core.withContext(function($ctx1) {
  54328. var $1;
  54329. $1="a".__minus_gt((1));
  54330. $ctx1.sendIdx["->"]=1;
  54331. associations=[$1,"b".__minus_gt((2))];
  54332. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54333. return self;
  54334. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  54335. },
  54336. args: [],
  54337. 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 }.",
  54338. referencedClasses: [],
  54339. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  54340. }),
  54341. $globals.AssociativeCollectionTest);
  54342. $core.addMethod(
  54343. $core.method({
  54344. selector: "testKeys",
  54345. protocol: "tests",
  54346. fn: function (){
  54347. var self=this,$self=this;
  54348. return $core.withContext(function($ctx1) {
  54349. var $2,$1,$3,$4;
  54350. $2=$recv($recv($self._collectionClass())._new())._keys();
  54351. $ctx1.sendIdx["keys"]=1;
  54352. $1=$recv($2)._isEmpty();
  54353. $self._assert_($1);
  54354. $3=$recv($self._collection())._keys();
  54355. $ctx1.sendIdx["keys"]=2;
  54356. $4=$self._collectionKeys();
  54357. $ctx1.sendIdx["collectionKeys"]=1;
  54358. $self._assertSameContents_as_($3,$4);
  54359. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54360. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._keys(),$recv($self._collectionKeys()).__comma([$self._sampleNewIndex()]));
  54361. return self;
  54362. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  54363. },
  54364. args: [],
  54365. 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 }",
  54366. referencedClasses: [],
  54367. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  54368. }),
  54369. $globals.AssociativeCollectionTest);
  54370. $core.addMethod(
  54371. $core.method({
  54372. selector: "testNewFromPairs",
  54373. protocol: "tests",
  54374. fn: function (){
  54375. var self=this,$self=this;
  54376. var flattenedAssociations;
  54377. return $core.withContext(function($ctx1) {
  54378. flattenedAssociations=["a",(1),"b",(2)];
  54379. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54380. return self;
  54381. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  54382. },
  54383. args: [],
  54384. 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 }.",
  54385. referencedClasses: [],
  54386. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  54387. }),
  54388. $globals.AssociativeCollectionTest);
  54389. $core.addMethod(
  54390. $core.method({
  54391. selector: "testPrintString",
  54392. protocol: "tests",
  54393. fn: function (){
  54394. var self=this,$self=this;
  54395. return $core.withContext(function($ctx1) {
  54396. var $3,$2,$1,$4;
  54397. $3=$self._collectionClass();
  54398. $ctx1.sendIdx["collectionClass"]=1;
  54399. $2=$recv($3)._new();
  54400. $recv($2)._at_put_("firstname","James");
  54401. $ctx1.sendIdx["at:put:"]=1;
  54402. $recv($2)._at_put_("lastname","Bond");
  54403. $1=$recv($2)._printString();
  54404. $4=$recv("a ".__comma($recv($self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  54405. $ctx1.sendIdx[","]=1;
  54406. $self._assert_equals_($1,$4);
  54407. return self;
  54408. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  54409. },
  54410. args: [],
  54411. 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'')'",
  54412. referencedClasses: [],
  54413. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  54414. }),
  54415. $globals.AssociativeCollectionTest);
  54416. $core.addMethod(
  54417. $core.method({
  54418. selector: "testRemoveKey",
  54419. protocol: "tests",
  54420. fn: function (){
  54421. var self=this,$self=this;
  54422. return $core.withContext(function($ctx1) {
  54423. var $1,$2,$3,$5,$6,$4,$8,$7;
  54424. $self._nonIndexesDo_((function(each){
  54425. var collection;
  54426. return $core.withContext(function($ctx2) {
  54427. collection=$self._collection();
  54428. $ctx2.sendIdx["collection"]=1;
  54429. $self._should_raise_((function(){
  54430. return $core.withContext(function($ctx3) {
  54431. return $recv(collection)._removeKey_(each);
  54432. $ctx3.sendIdx["removeKey:"]=1;
  54433. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54434. }),$globals.Error);
  54435. $1=collection;
  54436. $2=$self._collection();
  54437. $ctx2.sendIdx["collection"]=2;
  54438. return $self._assert_equals_($1,$2);
  54439. $ctx2.sendIdx["assert:equals:"]=1;
  54440. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54441. }));
  54442. $self._samplesDo_((function(index,value){
  54443. var collection;
  54444. return $core.withContext(function($ctx2) {
  54445. collection=$self._collection();
  54446. $ctx2.sendIdx["collection"]=3;
  54447. $3=$recv(collection)._removeKey_(index);
  54448. $ctx2.sendIdx["removeKey:"]=2;
  54449. $self._assert_equals_($3,value);
  54450. $ctx2.sendIdx["assert:equals:"]=2;
  54451. $5=collection;
  54452. $6=$self._collection();
  54453. $ctx2.sendIdx["collection"]=4;
  54454. $4=$recv($5).__eq($6);
  54455. return $self._deny_($4);
  54456. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54457. }));
  54458. $8=$self._collectionWithNewValue();
  54459. $recv($8)._removeKey_($self._sampleNewIndex());
  54460. $7=$recv($8)._yourself();
  54461. $self._assert_equals_($7,$self._collection());
  54462. return self;
  54463. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  54464. },
  54465. args: [],
  54466. 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",
  54467. referencedClasses: ["Error"],
  54468. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  54469. }),
  54470. $globals.AssociativeCollectionTest);
  54471. $core.addMethod(
  54472. $core.method({
  54473. selector: "testRemoveKeyIfAbsent",
  54474. protocol: "tests",
  54475. fn: function (){
  54476. var self=this,$self=this;
  54477. return $core.withContext(function($ctx1) {
  54478. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  54479. $self._nonIndexesDo_((function(each){
  54480. var collection;
  54481. return $core.withContext(function($ctx2) {
  54482. collection=$self._collection();
  54483. $ctx2.sendIdx["collection"]=1;
  54484. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  54485. return $core.withContext(function($ctx3) {
  54486. return $self._sampleNewValue();
  54487. $ctx3.sendIdx["sampleNewValue"]=1;
  54488. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54489. }));
  54490. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  54491. $2=$self._sampleNewValue();
  54492. $ctx2.sendIdx["sampleNewValue"]=2;
  54493. $self._assert_equals_($1,$2);
  54494. $ctx2.sendIdx["assert:equals:"]=1;
  54495. $3=collection;
  54496. $4=$self._collection();
  54497. $ctx2.sendIdx["collection"]=2;
  54498. return $self._assert_equals_($3,$4);
  54499. $ctx2.sendIdx["assert:equals:"]=2;
  54500. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54501. }));
  54502. $self._samplesDo_((function(index,value){
  54503. var collection;
  54504. return $core.withContext(function($ctx2) {
  54505. collection=$self._collection();
  54506. $ctx2.sendIdx["collection"]=3;
  54507. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  54508. return $core.withContext(function($ctx3) {
  54509. return $self._sampleNewValue();
  54510. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  54511. }));
  54512. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  54513. $self._assert_equals_($5,value);
  54514. $ctx2.sendIdx["assert:equals:"]=3;
  54515. $7=collection;
  54516. $8=$self._collection();
  54517. $ctx2.sendIdx["collection"]=4;
  54518. $6=$recv($7).__eq($8);
  54519. return $self._deny_($6);
  54520. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54521. }));
  54522. $10=$self._collectionWithNewValue();
  54523. $recv($10)._removeKey_ifAbsent_($self._sampleNewIndex(),(function(){
  54524. return $core.withContext(function($ctx2) {
  54525. return $self._assert_(false);
  54526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54527. }));
  54528. $9=$recv($10)._yourself();
  54529. $self._assert_equals_($9,$self._collection());
  54530. return self;
  54531. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  54532. },
  54533. args: [],
  54534. 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",
  54535. referencedClasses: [],
  54536. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  54537. }),
  54538. $globals.AssociativeCollectionTest);
  54539. $core.addMethod(
  54540. $core.method({
  54541. selector: "testValues",
  54542. protocol: "tests",
  54543. fn: function (){
  54544. var self=this,$self=this;
  54545. return $core.withContext(function($ctx1) {
  54546. var $2,$1,$3,$4;
  54547. $2=$recv($recv($self._collectionClass())._new())._values();
  54548. $ctx1.sendIdx["values"]=1;
  54549. $1=$recv($2)._isEmpty();
  54550. $self._assert_($1);
  54551. $3=$recv($self._collection())._values();
  54552. $ctx1.sendIdx["values"]=2;
  54553. $4=$self._collectionValues();
  54554. $ctx1.sendIdx["collectionValues"]=1;
  54555. $self._assertSameContents_as_($3,$4);
  54556. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54557. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._values(),$recv($self._collectionValues()).__comma([$self._sampleNewValue()]));
  54558. return self;
  54559. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  54560. },
  54561. args: [],
  54562. 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 }",
  54563. referencedClasses: [],
  54564. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  54565. }),
  54566. $globals.AssociativeCollectionTest);
  54567. $core.addClass("DictionaryTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54568. $core.addMethod(
  54569. $core.method({
  54570. selector: "collection",
  54571. protocol: "fixture",
  54572. fn: function (){
  54573. var self=this,$self=this;
  54574. return $core.withContext(function($ctx1) {
  54575. var $1;
  54576. $1=$recv($globals.Dictionary)._new();
  54577. $recv($1)._at_put_((1),(1));
  54578. $ctx1.sendIdx["at:put:"]=1;
  54579. $recv($1)._at_put_("a",(2));
  54580. $ctx1.sendIdx["at:put:"]=2;
  54581. $recv($1)._at_put_(true,(3));
  54582. $ctx1.sendIdx["at:put:"]=3;
  54583. $recv($1)._at_put_((1).__at((3)),(-4));
  54584. $ctx1.sendIdx["at:put:"]=4;
  54585. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54586. return $recv($1)._yourself();
  54587. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  54588. },
  54589. args: [],
  54590. 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",
  54591. referencedClasses: ["Dictionary"],
  54592. messageSends: ["at:put:", "new", "@", "yourself"]
  54593. }),
  54594. $globals.DictionaryTest);
  54595. $core.addMethod(
  54596. $core.method({
  54597. selector: "collectionKeys",
  54598. protocol: "fixture",
  54599. fn: function (){
  54600. var self=this,$self=this;
  54601. return $core.withContext(function($ctx1) {
  54602. return [(1),"a",true,(1).__at((3)),$self["@sampleBlock"]];
  54603. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  54604. },
  54605. args: [],
  54606. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  54607. referencedClasses: [],
  54608. messageSends: ["@"]
  54609. }),
  54610. $globals.DictionaryTest);
  54611. $core.addMethod(
  54612. $core.method({
  54613. selector: "collectionOfPrintStrings",
  54614. protocol: "fixture",
  54615. fn: function (){
  54616. var self=this,$self=this;
  54617. return $core.withContext(function($ctx1) {
  54618. var $1;
  54619. $1=$recv($globals.Dictionary)._new();
  54620. $recv($1)._at_put_((1),"1");
  54621. $ctx1.sendIdx["at:put:"]=1;
  54622. $recv($1)._at_put_("a","2");
  54623. $ctx1.sendIdx["at:put:"]=2;
  54624. $recv($1)._at_put_(true,"3");
  54625. $ctx1.sendIdx["at:put:"]=3;
  54626. $recv($1)._at_put_((1).__at((3)),"-4");
  54627. $ctx1.sendIdx["at:put:"]=4;
  54628. $recv($1)._at_put_($self["@sampleBlock"],"9");
  54629. return $recv($1)._yourself();
  54630. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  54631. },
  54632. args: [],
  54633. 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",
  54634. referencedClasses: ["Dictionary"],
  54635. messageSends: ["at:put:", "new", "@", "yourself"]
  54636. }),
  54637. $globals.DictionaryTest);
  54638. $core.addMethod(
  54639. $core.method({
  54640. selector: "collectionSize",
  54641. protocol: "fixture",
  54642. fn: function (){
  54643. var self=this,$self=this;
  54644. return (5);
  54645. },
  54646. args: [],
  54647. source: "collectionSize\x0a\x09^ 5",
  54648. referencedClasses: [],
  54649. messageSends: []
  54650. }),
  54651. $globals.DictionaryTest);
  54652. $core.addMethod(
  54653. $core.method({
  54654. selector: "collectionValues",
  54655. protocol: "fixture",
  54656. fn: function (){
  54657. var self=this,$self=this;
  54658. return [(1),(2),(3),(-4),(9)];
  54659. },
  54660. args: [],
  54661. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  54662. referencedClasses: [],
  54663. messageSends: []
  54664. }),
  54665. $globals.DictionaryTest);
  54666. $core.addMethod(
  54667. $core.method({
  54668. selector: "collectionWithDuplicates",
  54669. protocol: "fixture",
  54670. fn: function (){
  54671. var self=this,$self=this;
  54672. return $core.withContext(function($ctx1) {
  54673. var $1;
  54674. $1=$recv($globals.Dictionary)._new();
  54675. $recv($1)._at_put_((1),(1));
  54676. $ctx1.sendIdx["at:put:"]=1;
  54677. $recv($1)._at_put_("a",(2));
  54678. $ctx1.sendIdx["at:put:"]=2;
  54679. $recv($1)._at_put_(true,(3));
  54680. $ctx1.sendIdx["at:put:"]=3;
  54681. $recv($1)._at_put_((4),(-4));
  54682. $ctx1.sendIdx["at:put:"]=4;
  54683. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54684. $ctx1.sendIdx["at:put:"]=5;
  54685. $recv($1)._at_put_("b",(1));
  54686. $ctx1.sendIdx["at:put:"]=6;
  54687. $recv($1)._at_put_((3),(3));
  54688. $ctx1.sendIdx["at:put:"]=7;
  54689. $recv($1)._at_put_(false,(12));
  54690. return $recv($1)._yourself();
  54691. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  54692. },
  54693. args: [],
  54694. 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",
  54695. referencedClasses: ["Dictionary"],
  54696. messageSends: ["at:put:", "new", "yourself"]
  54697. }),
  54698. $globals.DictionaryTest);
  54699. $core.addMethod(
  54700. $core.method({
  54701. selector: "collectionWithNewValue",
  54702. protocol: "fixture",
  54703. fn: function (){
  54704. var self=this,$self=this;
  54705. return $core.withContext(function($ctx1) {
  54706. var $1;
  54707. $1=$recv($globals.Dictionary)._new();
  54708. $recv($1)._at_put_((1),(1));
  54709. $ctx1.sendIdx["at:put:"]=1;
  54710. $recv($1)._at_put_("a",(2));
  54711. $ctx1.sendIdx["at:put:"]=2;
  54712. $recv($1)._at_put_(true,(3));
  54713. $ctx1.sendIdx["at:put:"]=3;
  54714. $recv($1)._at_put_((1).__at((3)),(-4));
  54715. $ctx1.sendIdx["at:put:"]=4;
  54716. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54717. $ctx1.sendIdx["at:put:"]=5;
  54718. $recv($1)._at_put_("new","N");
  54719. return $recv($1)._yourself();
  54720. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  54721. },
  54722. args: [],
  54723. 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",
  54724. referencedClasses: ["Dictionary"],
  54725. messageSends: ["at:put:", "new", "@", "yourself"]
  54726. }),
  54727. $globals.DictionaryTest);
  54728. $core.addMethod(
  54729. $core.method({
  54730. selector: "sampleNewValueAsCollection",
  54731. protocol: "fixture",
  54732. fn: function (){
  54733. var self=this,$self=this;
  54734. return $core.withContext(function($ctx1) {
  54735. var $1;
  54736. $1=$recv($globals.Dictionary)._new();
  54737. $recv($1)._at_put_("new","N");
  54738. return $recv($1)._yourself();
  54739. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  54740. },
  54741. args: [],
  54742. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  54743. referencedClasses: ["Dictionary"],
  54744. messageSends: ["at:put:", "new", "yourself"]
  54745. }),
  54746. $globals.DictionaryTest);
  54747. $core.addMethod(
  54748. $core.method({
  54749. selector: "samplesDo:",
  54750. protocol: "fixture",
  54751. fn: function (aBlock){
  54752. var self=this,$self=this;
  54753. return $core.withContext(function($ctx1) {
  54754. (
  54755. $ctx1.supercall = true,
  54756. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  54757. $ctx1.supercall = false;
  54758. $recv(aBlock)._value_value_(true,(3));
  54759. $ctx1.sendIdx["value:value:"]=1;
  54760. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  54761. $ctx1.sendIdx["value:value:"]=2;
  54762. $recv(aBlock)._value_value_($self["@sampleBlock"],(9));
  54763. return self;
  54764. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  54765. },
  54766. args: ["aBlock"],
  54767. 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",
  54768. referencedClasses: [],
  54769. messageSends: ["samplesDo:", "value:value:", "@"]
  54770. }),
  54771. $globals.DictionaryTest);
  54772. $core.addMethod(
  54773. $core.method({
  54774. selector: "testAccessing",
  54775. protocol: "tests",
  54776. fn: function (){
  54777. var self=this,$self=this;
  54778. var d;
  54779. return $core.withContext(function($ctx1) {
  54780. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  54781. d=$recv($globals.Dictionary)._new();
  54782. $recv(d)._at_put_("hello","world");
  54783. $ctx1.sendIdx["at:put:"]=1;
  54784. $1=$recv(d)._at_("hello");
  54785. $ctx1.sendIdx["at:"]=1;
  54786. $self._assert_equals_($1,"world");
  54787. $ctx1.sendIdx["assert:equals:"]=1;
  54788. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  54789. return nil;
  54790. }));
  54791. $ctx1.sendIdx["at:ifAbsent:"]=1;
  54792. $self._assert_equals_($2,"world");
  54793. $ctx1.sendIdx["assert:equals:"]=2;
  54794. $self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  54795. return nil;
  54796. }))).__eq("world"));
  54797. $ctx1.sendIdx["deny:"]=1;
  54798. $3=$recv(d)._includesKey_("hello");
  54799. $ctx1.sendIdx["includesKey:"]=1;
  54800. $self._assert_($3);
  54801. $ctx1.sendIdx["assert:"]=1;
  54802. $4=$recv(d)._includesKey_("foo");
  54803. $ctx1.sendIdx["includesKey:"]=2;
  54804. $self._deny_($4);
  54805. $ctx1.sendIdx["deny:"]=2;
  54806. $recv(d)._at_put_((1),(2));
  54807. $ctx1.sendIdx["at:put:"]=2;
  54808. $5=$recv(d)._at_((1));
  54809. $ctx1.sendIdx["at:"]=2;
  54810. $self._assert_equals_($5,(2));
  54811. $ctx1.sendIdx["assert:equals:"]=3;
  54812. $6=d;
  54813. $7=(1).__at((3));
  54814. $ctx1.sendIdx["@"]=1;
  54815. $recv($6)._at_put_($7,(3));
  54816. $9=d;
  54817. $10=(1).__at((3));
  54818. $ctx1.sendIdx["@"]=2;
  54819. $8=$recv($9)._at_($10);
  54820. $self._assert_equals_($8,(3));
  54821. $12=d;
  54822. $13=(1).__at((3));
  54823. $ctx1.sendIdx["@"]=3;
  54824. $11=$recv($12)._includesKey_($13);
  54825. $ctx1.sendIdx["includesKey:"]=3;
  54826. $self._assert_($11);
  54827. $self._deny_($recv(d)._includesKey_((3).__at((1))));
  54828. return self;
  54829. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  54830. },
  54831. args: [],
  54832. 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)",
  54833. referencedClasses: ["Dictionary"],
  54834. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  54835. }),
  54836. $globals.DictionaryTest);
  54837. $core.addMethod(
  54838. $core.method({
  54839. selector: "testDynamicDictionaries",
  54840. protocol: "tests",
  54841. fn: function (){
  54842. var self=this,$self=this;
  54843. return $core.withContext(function($ctx1) {
  54844. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  54845. return self;
  54846. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  54847. },
  54848. args: [],
  54849. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  54850. referencedClasses: ["Dictionary"],
  54851. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  54852. }),
  54853. $globals.DictionaryTest);
  54854. $core.addMethod(
  54855. $core.method({
  54856. selector: "collectionClass",
  54857. protocol: "fixture",
  54858. fn: function (){
  54859. var self=this,$self=this;
  54860. return $globals.Dictionary;
  54861. },
  54862. args: [],
  54863. source: "collectionClass\x0a\x09^ Dictionary",
  54864. referencedClasses: ["Dictionary"],
  54865. messageSends: []
  54866. }),
  54867. $globals.DictionaryTest.a$cls);
  54868. $core.addClass("HashedCollectionTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54869. $core.addMethod(
  54870. $core.method({
  54871. selector: "collection",
  54872. protocol: "fixture",
  54873. fn: function (){
  54874. var self=this,$self=this;
  54875. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  54876. },
  54877. args: [],
  54878. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  54879. referencedClasses: [],
  54880. messageSends: []
  54881. }),
  54882. $globals.HashedCollectionTest);
  54883. $core.addMethod(
  54884. $core.method({
  54885. selector: "collectionKeys",
  54886. protocol: "fixture",
  54887. fn: function (){
  54888. var self=this,$self=this;
  54889. return ["b","a","c","d"];
  54890. },
  54891. args: [],
  54892. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  54893. referencedClasses: [],
  54894. messageSends: []
  54895. }),
  54896. $globals.HashedCollectionTest);
  54897. $core.addMethod(
  54898. $core.method({
  54899. selector: "collectionOfPrintStrings",
  54900. protocol: "fixture",
  54901. fn: function (){
  54902. var self=this,$self=this;
  54903. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  54904. },
  54905. args: [],
  54906. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  54907. referencedClasses: [],
  54908. messageSends: []
  54909. }),
  54910. $globals.HashedCollectionTest);
  54911. $core.addMethod(
  54912. $core.method({
  54913. selector: "collectionSize",
  54914. protocol: "fixture",
  54915. fn: function (){
  54916. var self=this,$self=this;
  54917. return (4);
  54918. },
  54919. args: [],
  54920. source: "collectionSize\x0a\x09^ 4",
  54921. referencedClasses: [],
  54922. messageSends: []
  54923. }),
  54924. $globals.HashedCollectionTest);
  54925. $core.addMethod(
  54926. $core.method({
  54927. selector: "collectionValues",
  54928. protocol: "fixture",
  54929. fn: function (){
  54930. var self=this,$self=this;
  54931. return [(1),(2),(3),(-4)];
  54932. },
  54933. args: [],
  54934. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  54935. referencedClasses: [],
  54936. messageSends: []
  54937. }),
  54938. $globals.HashedCollectionTest);
  54939. $core.addMethod(
  54940. $core.method({
  54941. selector: "collectionWithDuplicates",
  54942. protocol: "fixture",
  54943. fn: function (){
  54944. var self=this,$self=this;
  54945. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  54946. },
  54947. args: [],
  54948. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  54949. referencedClasses: [],
  54950. messageSends: []
  54951. }),
  54952. $globals.HashedCollectionTest);
  54953. $core.addMethod(
  54954. $core.method({
  54955. selector: "collectionWithNewValue",
  54956. protocol: "fixture",
  54957. fn: function (){
  54958. var self=this,$self=this;
  54959. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  54960. },
  54961. args: [],
  54962. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  54963. referencedClasses: [],
  54964. messageSends: []
  54965. }),
  54966. $globals.HashedCollectionTest);
  54967. $core.addMethod(
  54968. $core.method({
  54969. selector: "sampleNewValueAsCollection",
  54970. protocol: "fixture",
  54971. fn: function (){
  54972. var self=this,$self=this;
  54973. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  54974. },
  54975. args: [],
  54976. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  54977. referencedClasses: [],
  54978. messageSends: []
  54979. }),
  54980. $globals.HashedCollectionTest);
  54981. $core.addMethod(
  54982. $core.method({
  54983. selector: "testDynamicDictionaries",
  54984. protocol: "tests",
  54985. fn: function (){
  54986. var self=this,$self=this;
  54987. return $core.withContext(function($ctx1) {
  54988. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  54989. return self;
  54990. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  54991. },
  54992. args: [],
  54993. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  54994. referencedClasses: ["HashedCollection"],
  54995. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  54996. }),
  54997. $globals.HashedCollectionTest);
  54998. $core.addMethod(
  54999. $core.method({
  55000. selector: "collectionClass",
  55001. protocol: "fixture",
  55002. fn: function (){
  55003. var self=this,$self=this;
  55004. return $globals.HashedCollection;
  55005. },
  55006. args: [],
  55007. source: "collectionClass\x0a\x09^ HashedCollection",
  55008. referencedClasses: ["HashedCollection"],
  55009. messageSends: []
  55010. }),
  55011. $globals.HashedCollectionTest.a$cls);
  55012. $core.addClass("SequenceableCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  55013. $core.addMethod(
  55014. $core.method({
  55015. selector: "collectionFirst",
  55016. protocol: "fixture",
  55017. fn: function (){
  55018. var self=this,$self=this;
  55019. return $core.withContext(function($ctx1) {
  55020. $self._subclassResponsibility();
  55021. return self;
  55022. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  55023. },
  55024. args: [],
  55025. source: "collectionFirst\x0a\x09self subclassResponsibility",
  55026. referencedClasses: [],
  55027. messageSends: ["subclassResponsibility"]
  55028. }),
  55029. $globals.SequenceableCollectionTest);
  55030. $core.addMethod(
  55031. $core.method({
  55032. selector: "collectionFirstTwo",
  55033. protocol: "fixture",
  55034. fn: function (){
  55035. var self=this,$self=this;
  55036. return $core.withContext(function($ctx1) {
  55037. $self._subclassResponsibility();
  55038. return self;
  55039. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  55040. },
  55041. args: [],
  55042. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  55043. referencedClasses: [],
  55044. messageSends: ["subclassResponsibility"]
  55045. }),
  55046. $globals.SequenceableCollectionTest);
  55047. $core.addMethod(
  55048. $core.method({
  55049. selector: "collectionLast",
  55050. protocol: "fixture",
  55051. fn: function (){
  55052. var self=this,$self=this;
  55053. return $core.withContext(function($ctx1) {
  55054. $self._subclassResponsibility();
  55055. return self;
  55056. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  55057. },
  55058. args: [],
  55059. source: "collectionLast\x0a\x09self subclassResponsibility",
  55060. referencedClasses: [],
  55061. messageSends: ["subclassResponsibility"]
  55062. }),
  55063. $globals.SequenceableCollectionTest);
  55064. $core.addMethod(
  55065. $core.method({
  55066. selector: "collectionLastTwo",
  55067. protocol: "fixture",
  55068. fn: function (){
  55069. var self=this,$self=this;
  55070. return $core.withContext(function($ctx1) {
  55071. $self._subclassResponsibility();
  55072. return self;
  55073. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  55074. },
  55075. args: [],
  55076. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  55077. referencedClasses: [],
  55078. messageSends: ["subclassResponsibility"]
  55079. }),
  55080. $globals.SequenceableCollectionTest);
  55081. $core.addMethod(
  55082. $core.method({
  55083. selector: "nonIndexesDo:",
  55084. protocol: "fixture",
  55085. fn: function (aBlock){
  55086. var self=this,$self=this;
  55087. return $core.withContext(function($ctx1) {
  55088. $recv(aBlock)._value_((0));
  55089. $ctx1.sendIdx["value:"]=1;
  55090. $recv(aBlock)._value_($recv($self._collectionSize()).__plus((1)));
  55091. $ctx1.sendIdx["value:"]=2;
  55092. $recv(aBlock)._value_("z");
  55093. return self;
  55094. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  55095. },
  55096. args: ["aBlock"],
  55097. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  55098. referencedClasses: [],
  55099. messageSends: ["value:", "+", "collectionSize"]
  55100. }),
  55101. $globals.SequenceableCollectionTest);
  55102. $core.addMethod(
  55103. $core.method({
  55104. selector: "samplesDo:",
  55105. protocol: "fixture",
  55106. fn: function (aBlock){
  55107. var self=this,$self=this;
  55108. return $core.withContext(function($ctx1) {
  55109. $recv(aBlock)._value_value_((1),$self._collectionFirst());
  55110. $ctx1.sendIdx["value:value:"]=1;
  55111. $recv(aBlock)._value_value_($self._collectionSize(),$self._collectionLast());
  55112. return self;
  55113. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  55114. },
  55115. args: ["aBlock"],
  55116. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  55117. referencedClasses: [],
  55118. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  55119. }),
  55120. $globals.SequenceableCollectionTest);
  55121. $core.addMethod(
  55122. $core.method({
  55123. selector: "testBeginsWith",
  55124. protocol: "tests",
  55125. fn: function (){
  55126. var self=this,$self=this;
  55127. return $core.withContext(function($ctx1) {
  55128. var $2,$1,$4,$5,$3,$7,$6;
  55129. $2=$self._collection();
  55130. $ctx1.sendIdx["collection"]=1;
  55131. $1=$recv($2)._beginsWith_($recv($self._collectionClass())._new());
  55132. $ctx1.sendIdx["beginsWith:"]=1;
  55133. $self._assert_($1);
  55134. $ctx1.sendIdx["assert:"]=1;
  55135. $4=$self._collection();
  55136. $ctx1.sendIdx["collection"]=2;
  55137. $5=$self._collection();
  55138. $ctx1.sendIdx["collection"]=3;
  55139. $3=$recv($4)._beginsWith_($5);
  55140. $ctx1.sendIdx["beginsWith:"]=2;
  55141. $self._assert_($3);
  55142. $ctx1.sendIdx["assert:"]=2;
  55143. $7=$self._collection();
  55144. $ctx1.sendIdx["collection"]=4;
  55145. $6=$recv($7)._beginsWith_($self._collectionFirstTwo());
  55146. $ctx1.sendIdx["beginsWith:"]=3;
  55147. $self._assert_($6);
  55148. $self._deny_($recv($self._collection())._beginsWith_($self._collectionLastTwo()));
  55149. return self;
  55150. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  55151. },
  55152. args: [],
  55153. 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)",
  55154. referencedClasses: [],
  55155. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  55156. }),
  55157. $globals.SequenceableCollectionTest);
  55158. $core.addMethod(
  55159. $core.method({
  55160. selector: "testEndsWith",
  55161. protocol: "tests",
  55162. fn: function (){
  55163. var self=this,$self=this;
  55164. return $core.withContext(function($ctx1) {
  55165. var $2,$1,$4,$5,$3,$7,$6;
  55166. $2=$self._collection();
  55167. $ctx1.sendIdx["collection"]=1;
  55168. $1=$recv($2)._endsWith_($recv($self._collectionClass())._new());
  55169. $ctx1.sendIdx["endsWith:"]=1;
  55170. $self._assert_($1);
  55171. $ctx1.sendIdx["assert:"]=1;
  55172. $4=$self._collection();
  55173. $ctx1.sendIdx["collection"]=2;
  55174. $5=$self._collection();
  55175. $ctx1.sendIdx["collection"]=3;
  55176. $3=$recv($4)._endsWith_($5);
  55177. $ctx1.sendIdx["endsWith:"]=2;
  55178. $self._assert_($3);
  55179. $ctx1.sendIdx["assert:"]=2;
  55180. $7=$self._collection();
  55181. $ctx1.sendIdx["collection"]=4;
  55182. $6=$recv($7)._endsWith_($self._collectionLastTwo());
  55183. $ctx1.sendIdx["endsWith:"]=3;
  55184. $self._assert_($6);
  55185. $self._deny_($recv($self._collection())._endsWith_($self._collectionFirstTwo()));
  55186. return self;
  55187. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  55188. },
  55189. args: [],
  55190. 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)",
  55191. referencedClasses: [],
  55192. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  55193. }),
  55194. $globals.SequenceableCollectionTest);
  55195. $core.addMethod(
  55196. $core.method({
  55197. selector: "testFirst",
  55198. protocol: "tests",
  55199. fn: function (){
  55200. var self=this,$self=this;
  55201. return $core.withContext(function($ctx1) {
  55202. $self._assert_equals_($recv($self._collection())._first(),$self._collectionFirst());
  55203. return self;
  55204. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  55205. },
  55206. args: [],
  55207. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  55208. referencedClasses: [],
  55209. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  55210. }),
  55211. $globals.SequenceableCollectionTest);
  55212. $core.addMethod(
  55213. $core.method({
  55214. selector: "testFirstN",
  55215. protocol: "tests",
  55216. fn: function (){
  55217. var self=this,$self=this;
  55218. return $core.withContext(function($ctx1) {
  55219. var $2,$1,$4,$3,$6,$5,$7;
  55220. $2=$self._collection();
  55221. $ctx1.sendIdx["collection"]=1;
  55222. $1=$recv($2)._first_((2));
  55223. $ctx1.sendIdx["first:"]=1;
  55224. $self._assert_equals_($1,$self._collectionFirstTwo());
  55225. $ctx1.sendIdx["assert:equals:"]=1;
  55226. $4=$self._collection();
  55227. $ctx1.sendIdx["collection"]=2;
  55228. $3=$recv($4)._first_((0));
  55229. $ctx1.sendIdx["first:"]=2;
  55230. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55231. $ctx1.sendIdx["assert:equals:"]=2;
  55232. $6=$self._collection();
  55233. $ctx1.sendIdx["collection"]=3;
  55234. $5=$recv($6)._first_($self._collectionSize());
  55235. $ctx1.sendIdx["first:"]=3;
  55236. $7=$self._collection();
  55237. $ctx1.sendIdx["collection"]=4;
  55238. $self._assert_equals_($5,$7);
  55239. $self._should_raise_((function(){
  55240. return $core.withContext(function($ctx2) {
  55241. return $recv($self._collection())._first_((33));
  55242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55243. }),$globals.Error);
  55244. return self;
  55245. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  55246. },
  55247. args: [],
  55248. 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",
  55249. referencedClasses: ["Error"],
  55250. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55251. }),
  55252. $globals.SequenceableCollectionTest);
  55253. $core.addMethod(
  55254. $core.method({
  55255. selector: "testFourth",
  55256. protocol: "tests",
  55257. fn: function (){
  55258. var self=this,$self=this;
  55259. return $core.withContext(function($ctx1) {
  55260. var $2,$1;
  55261. $2=$self._collection();
  55262. $ctx1.sendIdx["collection"]=1;
  55263. $1=$recv($2)._fourth();
  55264. $self._assert_equals_($1,$recv($self._collection())._at_((4)));
  55265. return self;
  55266. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  55267. },
  55268. args: [],
  55269. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  55270. referencedClasses: [],
  55271. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  55272. }),
  55273. $globals.SequenceableCollectionTest);
  55274. $core.addMethod(
  55275. $core.method({
  55276. selector: "testIndexOfStartingAt",
  55277. protocol: "tests",
  55278. fn: function (){
  55279. var self=this,$self=this;
  55280. var jsNull;
  55281. return $core.withContext(function($ctx1) {
  55282. var $2,$1,$4,$3;
  55283. jsNull=$recv($globals.JSON)._parse_("null");
  55284. $self._samplesDo_((function(index,value){
  55285. return $core.withContext(function($ctx2) {
  55286. $2=$self._collection();
  55287. $ctx2.sendIdx["collection"]=1;
  55288. $1=$recv($2)._indexOf_startingAt_(value,(1));
  55289. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55290. $self._assert_equals_($1,index);
  55291. $ctx2.sendIdx["assert:equals:"]=1;
  55292. $4=$self._collection();
  55293. $ctx2.sendIdx["collection"]=2;
  55294. $3=$recv($4)._indexOf_startingAt_(value,index);
  55295. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55296. $self._assert_equals_($3,index);
  55297. $ctx2.sendIdx["assert:equals:"]=2;
  55298. return $self._assert_equals_($recv($self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  55299. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  55300. }));
  55301. return self;
  55302. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55303. },
  55304. args: [],
  55305. 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 ]",
  55306. referencedClasses: ["JSON"],
  55307. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  55308. }),
  55309. $globals.SequenceableCollectionTest);
  55310. $core.addMethod(
  55311. $core.method({
  55312. selector: "testIndexOfStartingAtWithNull",
  55313. protocol: "tests",
  55314. fn: function (){
  55315. var self=this,$self=this;
  55316. var jsNull;
  55317. return $core.withContext(function($ctx1) {
  55318. var $1,$2;
  55319. jsNull=$recv($globals.JSON)._parse_("null");
  55320. $self._samplesDo_((function(index,value){
  55321. var collection;
  55322. return $core.withContext(function($ctx2) {
  55323. collection=$self._collection();
  55324. $recv(collection)._at_put_(index,jsNull);
  55325. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  55326. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55327. $self._assert_equals_($1,index);
  55328. $ctx2.sendIdx["assert:equals:"]=1;
  55329. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  55330. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55331. $self._assert_equals_($2,index);
  55332. $ctx2.sendIdx["assert:equals:"]=2;
  55333. return $self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  55334. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  55335. }));
  55336. return self;
  55337. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55338. },
  55339. args: [],
  55340. 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 ]",
  55341. referencedClasses: ["JSON"],
  55342. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  55343. }),
  55344. $globals.SequenceableCollectionTest);
  55345. $core.addMethod(
  55346. $core.method({
  55347. selector: "testLast",
  55348. protocol: "tests",
  55349. fn: function (){
  55350. var self=this,$self=this;
  55351. return $core.withContext(function($ctx1) {
  55352. $self._assert_equals_($recv($self._collection())._last(),$self._collectionLast());
  55353. return self;
  55354. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  55355. },
  55356. args: [],
  55357. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  55358. referencedClasses: [],
  55359. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  55360. }),
  55361. $globals.SequenceableCollectionTest);
  55362. $core.addMethod(
  55363. $core.method({
  55364. selector: "testLastN",
  55365. protocol: "tests",
  55366. fn: function (){
  55367. var self=this,$self=this;
  55368. return $core.withContext(function($ctx1) {
  55369. var $2,$1,$4,$3,$6,$5,$7;
  55370. $2=$self._collection();
  55371. $ctx1.sendIdx["collection"]=1;
  55372. $1=$recv($2)._last_((2));
  55373. $ctx1.sendIdx["last:"]=1;
  55374. $self._assert_equals_($1,$self._collectionLastTwo());
  55375. $ctx1.sendIdx["assert:equals:"]=1;
  55376. $4=$self._collection();
  55377. $ctx1.sendIdx["collection"]=2;
  55378. $3=$recv($4)._last_((0));
  55379. $ctx1.sendIdx["last:"]=2;
  55380. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55381. $ctx1.sendIdx["assert:equals:"]=2;
  55382. $6=$self._collection();
  55383. $ctx1.sendIdx["collection"]=3;
  55384. $5=$recv($6)._last_($self._collectionSize());
  55385. $ctx1.sendIdx["last:"]=3;
  55386. $7=$self._collection();
  55387. $ctx1.sendIdx["collection"]=4;
  55388. $self._assert_equals_($5,$7);
  55389. $self._should_raise_((function(){
  55390. return $core.withContext(function($ctx2) {
  55391. return $recv($self._collection())._last_((33));
  55392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55393. }),$globals.Error);
  55394. return self;
  55395. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  55396. },
  55397. args: [],
  55398. 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",
  55399. referencedClasses: ["Error"],
  55400. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55401. }),
  55402. $globals.SequenceableCollectionTest);
  55403. $core.addMethod(
  55404. $core.method({
  55405. selector: "testSecond",
  55406. protocol: "tests",
  55407. fn: function (){
  55408. var self=this,$self=this;
  55409. return $core.withContext(function($ctx1) {
  55410. var $2,$1;
  55411. $2=$self._collection();
  55412. $ctx1.sendIdx["collection"]=1;
  55413. $1=$recv($2)._second();
  55414. $self._assert_equals_($1,$recv($self._collection())._at_((2)));
  55415. return self;
  55416. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  55417. },
  55418. args: [],
  55419. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  55420. referencedClasses: [],
  55421. messageSends: ["assert:equals:", "second", "collection", "at:"]
  55422. }),
  55423. $globals.SequenceableCollectionTest);
  55424. $core.addMethod(
  55425. $core.method({
  55426. selector: "testThird",
  55427. protocol: "tests",
  55428. fn: function (){
  55429. var self=this,$self=this;
  55430. return $core.withContext(function($ctx1) {
  55431. var $2,$1;
  55432. $2=$self._collection();
  55433. $ctx1.sendIdx["collection"]=1;
  55434. $1=$recv($2)._third();
  55435. $self._assert_equals_($1,$recv($self._collection())._at_((3)));
  55436. return self;
  55437. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  55438. },
  55439. args: [],
  55440. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  55441. referencedClasses: [],
  55442. messageSends: ["assert:equals:", "third", "collection", "at:"]
  55443. }),
  55444. $globals.SequenceableCollectionTest);
  55445. $core.addClass("ArrayTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55446. $core.addMethod(
  55447. $core.method({
  55448. selector: "collection",
  55449. protocol: "fixture",
  55450. fn: function (){
  55451. var self=this,$self=this;
  55452. return [(1), (2), (3), (-4)];
  55453. },
  55454. args: [],
  55455. source: "collection\x0a\x09^ #(1 2 3 -4)",
  55456. referencedClasses: [],
  55457. messageSends: []
  55458. }),
  55459. $globals.ArrayTest);
  55460. $core.addMethod(
  55461. $core.method({
  55462. selector: "collectionFirst",
  55463. protocol: "fixture",
  55464. fn: function (){
  55465. var self=this,$self=this;
  55466. return (1);
  55467. },
  55468. args: [],
  55469. source: "collectionFirst\x0a\x09^ 1",
  55470. referencedClasses: [],
  55471. messageSends: []
  55472. }),
  55473. $globals.ArrayTest);
  55474. $core.addMethod(
  55475. $core.method({
  55476. selector: "collectionFirstTwo",
  55477. protocol: "fixture",
  55478. fn: function (){
  55479. var self=this,$self=this;
  55480. return [(1), (2)];
  55481. },
  55482. args: [],
  55483. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  55484. referencedClasses: [],
  55485. messageSends: []
  55486. }),
  55487. $globals.ArrayTest);
  55488. $core.addMethod(
  55489. $core.method({
  55490. selector: "collectionLast",
  55491. protocol: "fixture",
  55492. fn: function (){
  55493. var self=this,$self=this;
  55494. return (-4);
  55495. },
  55496. args: [],
  55497. source: "collectionLast\x0a\x09^ -4",
  55498. referencedClasses: [],
  55499. messageSends: []
  55500. }),
  55501. $globals.ArrayTest);
  55502. $core.addMethod(
  55503. $core.method({
  55504. selector: "collectionLastTwo",
  55505. protocol: "fixture",
  55506. fn: function (){
  55507. var self=this,$self=this;
  55508. return [(3), (-4)];
  55509. },
  55510. args: [],
  55511. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  55512. referencedClasses: [],
  55513. messageSends: []
  55514. }),
  55515. $globals.ArrayTest);
  55516. $core.addMethod(
  55517. $core.method({
  55518. selector: "collectionOfPrintStrings",
  55519. protocol: "fixture",
  55520. fn: function (){
  55521. var self=this,$self=this;
  55522. return ["1", "2", "3", "-4"];
  55523. },
  55524. args: [],
  55525. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  55526. referencedClasses: [],
  55527. messageSends: []
  55528. }),
  55529. $globals.ArrayTest);
  55530. $core.addMethod(
  55531. $core.method({
  55532. selector: "collectionSize",
  55533. protocol: "fixture",
  55534. fn: function (){
  55535. var self=this,$self=this;
  55536. return (4);
  55537. },
  55538. args: [],
  55539. source: "collectionSize\x0a\x09^ 4",
  55540. referencedClasses: [],
  55541. messageSends: []
  55542. }),
  55543. $globals.ArrayTest);
  55544. $core.addMethod(
  55545. $core.method({
  55546. selector: "collectionWithDuplicates",
  55547. protocol: "fixture",
  55548. fn: function (){
  55549. var self=this,$self=this;
  55550. return ["a", "b", "c", (1), (2), (1), "a", []];
  55551. },
  55552. args: [],
  55553. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  55554. referencedClasses: [],
  55555. messageSends: []
  55556. }),
  55557. $globals.ArrayTest);
  55558. $core.addMethod(
  55559. $core.method({
  55560. selector: "collectionWithNewValue",
  55561. protocol: "fixture",
  55562. fn: function (){
  55563. var self=this,$self=this;
  55564. return [(1), (2), (3), (-4), "N"];
  55565. },
  55566. args: [],
  55567. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  55568. referencedClasses: [],
  55569. messageSends: []
  55570. }),
  55571. $globals.ArrayTest);
  55572. $core.addMethod(
  55573. $core.method({
  55574. selector: "sampleNewIndex",
  55575. protocol: "fixture",
  55576. fn: function (){
  55577. var self=this,$self=this;
  55578. return (5);
  55579. },
  55580. args: [],
  55581. source: "sampleNewIndex\x0a\x09^ 5",
  55582. referencedClasses: [],
  55583. messageSends: []
  55584. }),
  55585. $globals.ArrayTest);
  55586. $core.addMethod(
  55587. $core.method({
  55588. selector: "samplesDo:",
  55589. protocol: "fixture",
  55590. fn: function (aBlock){
  55591. var self=this,$self=this;
  55592. return $core.withContext(function($ctx1) {
  55593. (
  55594. $ctx1.supercall = true,
  55595. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55596. $ctx1.supercall = false;
  55597. $recv(aBlock)._value_value_((3),(3));
  55598. return self;
  55599. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  55600. },
  55601. args: ["aBlock"],
  55602. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  55603. referencedClasses: [],
  55604. messageSends: ["samplesDo:", "value:value:"]
  55605. }),
  55606. $globals.ArrayTest);
  55607. $core.addMethod(
  55608. $core.method({
  55609. selector: "testAdd",
  55610. protocol: "tests",
  55611. fn: function (){
  55612. var self=this,$self=this;
  55613. var array;
  55614. return $core.withContext(function($ctx1) {
  55615. array=$self._collection();
  55616. $recv(array)._add_((6));
  55617. $self._assert_equals_($recv(array)._last(),(6));
  55618. return self;
  55619. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  55620. },
  55621. args: [],
  55622. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  55623. referencedClasses: [],
  55624. messageSends: ["collection", "add:", "assert:equals:", "last"]
  55625. }),
  55626. $globals.ArrayTest);
  55627. $core.addMethod(
  55628. $core.method({
  55629. selector: "testAddFirst",
  55630. protocol: "tests",
  55631. fn: function (){
  55632. var self=this,$self=this;
  55633. return $core.withContext(function($ctx1) {
  55634. var $3,$2,$1;
  55635. $3=$self._collection();
  55636. $recv($3)._addFirst_((0));
  55637. $2=$recv($3)._yourself();
  55638. $1=$recv($2)._first();
  55639. $self._assert_equals_($1,(0));
  55640. return self;
  55641. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  55642. },
  55643. args: [],
  55644. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  55645. referencedClasses: [],
  55646. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  55647. }),
  55648. $globals.ArrayTest);
  55649. $core.addMethod(
  55650. $core.method({
  55651. selector: "testPrintString",
  55652. protocol: "tests",
  55653. fn: function (){
  55654. var self=this,$self=this;
  55655. var array;
  55656. return $core.withContext(function($ctx1) {
  55657. var $1,$2,$3,$4,$5,$6,$7,$8;
  55658. array=$recv($globals.Array)._new();
  55659. $1=$recv(array)._printString();
  55660. $ctx1.sendIdx["printString"]=1;
  55661. $self._assert_equals_($1,"an Array ()");
  55662. $ctx1.sendIdx["assert:equals:"]=1;
  55663. $2=array;
  55664. $recv($2)._add_((1));
  55665. $ctx1.sendIdx["add:"]=1;
  55666. $3=$recv($2)._add_((3));
  55667. $ctx1.sendIdx["add:"]=2;
  55668. $4=$recv(array)._printString();
  55669. $ctx1.sendIdx["printString"]=2;
  55670. $self._assert_equals_($4,"an Array (1 3)");
  55671. $ctx1.sendIdx["assert:equals:"]=2;
  55672. $recv(array)._add_("foo");
  55673. $5=$recv(array)._printString();
  55674. $ctx1.sendIdx["printString"]=3;
  55675. $self._assert_equals_($5,"an Array (1 3 'foo')");
  55676. $ctx1.sendIdx["assert:equals:"]=3;
  55677. $6=array;
  55678. $recv($6)._remove_((1));
  55679. $ctx1.sendIdx["remove:"]=1;
  55680. $recv($6)._remove_((3));
  55681. $7=$recv(array)._printString();
  55682. $ctx1.sendIdx["printString"]=4;
  55683. $self._assert_equals_($7,"an Array ('foo')");
  55684. $ctx1.sendIdx["assert:equals:"]=4;
  55685. $recv(array)._addLast_((3));
  55686. $ctx1.sendIdx["addLast:"]=1;
  55687. $8=$recv(array)._printString();
  55688. $ctx1.sendIdx["printString"]=5;
  55689. $self._assert_equals_($8,"an Array ('foo' 3)");
  55690. $ctx1.sendIdx["assert:equals:"]=5;
  55691. $recv(array)._addLast_((3));
  55692. $self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  55693. return self;
  55694. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  55695. },
  55696. args: [],
  55697. 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)'.",
  55698. referencedClasses: ["Array"],
  55699. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  55700. }),
  55701. $globals.ArrayTest);
  55702. $core.addMethod(
  55703. $core.method({
  55704. selector: "testRemove",
  55705. protocol: "tests",
  55706. fn: function (){
  55707. var self=this,$self=this;
  55708. var array;
  55709. return $core.withContext(function($ctx1) {
  55710. array=[(1), (2), (3), (4), (5)];
  55711. $recv(array)._remove_((3));
  55712. $ctx1.sendIdx["remove:"]=1;
  55713. $self._assert_equals_(array,[(1), (2), (4), (5)]);
  55714. $self._should_raise_((function(){
  55715. return $core.withContext(function($ctx2) {
  55716. return $recv(array)._remove_((3));
  55717. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55718. }),$globals.Error);
  55719. return self;
  55720. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  55721. },
  55722. args: [],
  55723. 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",
  55724. referencedClasses: ["Error"],
  55725. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  55726. }),
  55727. $globals.ArrayTest);
  55728. $core.addMethod(
  55729. $core.method({
  55730. selector: "testRemoveFromTo",
  55731. protocol: "tests",
  55732. fn: function (){
  55733. var self=this,$self=this;
  55734. return $core.withContext(function($ctx1) {
  55735. var $1,$2;
  55736. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  55737. $ctx1.sendIdx["removeFrom:to:"]=1;
  55738. $self._assert_equals_($1,[(4)]);
  55739. $ctx1.sendIdx["assert:equals:"]=1;
  55740. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  55741. $ctx1.sendIdx["removeFrom:to:"]=2;
  55742. $self._assert_equals_($2,[(1), (4)]);
  55743. $ctx1.sendIdx["assert:equals:"]=2;
  55744. $self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  55745. return self;
  55746. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  55747. },
  55748. args: [],
  55749. 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)",
  55750. referencedClasses: [],
  55751. messageSends: ["assert:equals:", "removeFrom:to:"]
  55752. }),
  55753. $globals.ArrayTest);
  55754. $core.addMethod(
  55755. $core.method({
  55756. selector: "testRemoveIndex",
  55757. protocol: "tests",
  55758. fn: function (){
  55759. var self=this,$self=this;
  55760. return $core.withContext(function($ctx1) {
  55761. var $1,$2;
  55762. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  55763. $ctx1.sendIdx["removeIndex:"]=1;
  55764. $self._assert_equals_($1,[(1), (3), (4)]);
  55765. $ctx1.sendIdx["assert:equals:"]=1;
  55766. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  55767. $ctx1.sendIdx["removeIndex:"]=2;
  55768. $self._assert_equals_($2,[(2), (3), (4)]);
  55769. $ctx1.sendIdx["assert:equals:"]=2;
  55770. $self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  55771. return self;
  55772. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  55773. },
  55774. args: [],
  55775. 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: #()",
  55776. referencedClasses: [],
  55777. messageSends: ["assert:equals:", "removeIndex:"]
  55778. }),
  55779. $globals.ArrayTest);
  55780. $core.addMethod(
  55781. $core.method({
  55782. selector: "testRemoveLast",
  55783. protocol: "tests",
  55784. fn: function (){
  55785. var self=this,$self=this;
  55786. var array;
  55787. return $core.withContext(function($ctx1) {
  55788. array=[(1), (2)];
  55789. $recv(array)._removeLast();
  55790. $self._assert_equals_($recv(array)._last(),(1));
  55791. return self;
  55792. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  55793. },
  55794. args: [],
  55795. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  55796. referencedClasses: [],
  55797. messageSends: ["removeLast", "assert:equals:", "last"]
  55798. }),
  55799. $globals.ArrayTest);
  55800. $core.addMethod(
  55801. $core.method({
  55802. selector: "testReversed",
  55803. protocol: "tests",
  55804. fn: function (){
  55805. var self=this,$self=this;
  55806. var array;
  55807. return $core.withContext(function($ctx1) {
  55808. array=[(5), (4), (3), (2), (1)];
  55809. $self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  55810. return self;
  55811. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  55812. },
  55813. args: [],
  55814. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  55815. referencedClasses: [],
  55816. messageSends: ["assert:equals:", "reversed"]
  55817. }),
  55818. $globals.ArrayTest);
  55819. $core.addMethod(
  55820. $core.method({
  55821. selector: "testSort",
  55822. protocol: "tests",
  55823. fn: function (){
  55824. var self=this,$self=this;
  55825. var array;
  55826. return $core.withContext(function($ctx1) {
  55827. array=[(10), (1), (5)];
  55828. $recv(array)._sort();
  55829. $self._assert_equals_(array,[(1), (5), (10)]);
  55830. return self;
  55831. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  55832. },
  55833. args: [],
  55834. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  55835. referencedClasses: [],
  55836. messageSends: ["sort", "assert:equals:"]
  55837. }),
  55838. $globals.ArrayTest);
  55839. $core.addMethod(
  55840. $core.method({
  55841. selector: "collectionClass",
  55842. protocol: "fixture",
  55843. fn: function (){
  55844. var self=this,$self=this;
  55845. return $globals.Array;
  55846. },
  55847. args: [],
  55848. source: "collectionClass\x0a\x09^ Array",
  55849. referencedClasses: ["Array"],
  55850. messageSends: []
  55851. }),
  55852. $globals.ArrayTest.a$cls);
  55853. $core.addClass("StringTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55854. $core.addMethod(
  55855. $core.method({
  55856. selector: "collection",
  55857. protocol: "fixture",
  55858. fn: function (){
  55859. var self=this,$self=this;
  55860. return "helLo";
  55861. },
  55862. args: [],
  55863. source: "collection\x0a\x09^ 'helLo'",
  55864. referencedClasses: [],
  55865. messageSends: []
  55866. }),
  55867. $globals.StringTest);
  55868. $core.addMethod(
  55869. $core.method({
  55870. selector: "collectionFirst",
  55871. protocol: "fixture",
  55872. fn: function (){
  55873. var self=this,$self=this;
  55874. return "h";
  55875. },
  55876. args: [],
  55877. source: "collectionFirst\x0a\x09^ 'h'",
  55878. referencedClasses: [],
  55879. messageSends: []
  55880. }),
  55881. $globals.StringTest);
  55882. $core.addMethod(
  55883. $core.method({
  55884. selector: "collectionFirstTwo",
  55885. protocol: "fixture",
  55886. fn: function (){
  55887. var self=this,$self=this;
  55888. return "he";
  55889. },
  55890. args: [],
  55891. source: "collectionFirstTwo\x0a\x09^ 'he'",
  55892. referencedClasses: [],
  55893. messageSends: []
  55894. }),
  55895. $globals.StringTest);
  55896. $core.addMethod(
  55897. $core.method({
  55898. selector: "collectionLast",
  55899. protocol: "fixture",
  55900. fn: function (){
  55901. var self=this,$self=this;
  55902. return "o";
  55903. },
  55904. args: [],
  55905. source: "collectionLast\x0a\x09^ 'o'",
  55906. referencedClasses: [],
  55907. messageSends: []
  55908. }),
  55909. $globals.StringTest);
  55910. $core.addMethod(
  55911. $core.method({
  55912. selector: "collectionLastTwo",
  55913. protocol: "fixture",
  55914. fn: function (){
  55915. var self=this,$self=this;
  55916. return "Lo";
  55917. },
  55918. args: [],
  55919. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  55920. referencedClasses: [],
  55921. messageSends: []
  55922. }),
  55923. $globals.StringTest);
  55924. $core.addMethod(
  55925. $core.method({
  55926. selector: "collectionOfPrintStrings",
  55927. protocol: "fixture",
  55928. fn: function (){
  55929. var self=this,$self=this;
  55930. return "'h''e''l''L''o'";
  55931. },
  55932. args: [],
  55933. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  55934. referencedClasses: [],
  55935. messageSends: []
  55936. }),
  55937. $globals.StringTest);
  55938. $core.addMethod(
  55939. $core.method({
  55940. selector: "collectionSize",
  55941. protocol: "fixture",
  55942. fn: function (){
  55943. var self=this,$self=this;
  55944. return (5);
  55945. },
  55946. args: [],
  55947. source: "collectionSize\x0a\x09^ 5",
  55948. referencedClasses: [],
  55949. messageSends: []
  55950. }),
  55951. $globals.StringTest);
  55952. $core.addMethod(
  55953. $core.method({
  55954. selector: "collectionWithDuplicates",
  55955. protocol: "fixture",
  55956. fn: function (){
  55957. var self=this,$self=this;
  55958. return "abbaerten";
  55959. },
  55960. args: [],
  55961. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  55962. referencedClasses: [],
  55963. messageSends: []
  55964. }),
  55965. $globals.StringTest);
  55966. $core.addMethod(
  55967. $core.method({
  55968. selector: "collectionWithNewValue",
  55969. protocol: "fixture",
  55970. fn: function (){
  55971. var self=this,$self=this;
  55972. return "helLoN";
  55973. },
  55974. args: [],
  55975. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  55976. referencedClasses: [],
  55977. messageSends: []
  55978. }),
  55979. $globals.StringTest);
  55980. $core.addMethod(
  55981. $core.method({
  55982. selector: "sampleNewValueAsCollection",
  55983. protocol: "fixture",
  55984. fn: function (){
  55985. var self=this,$self=this;
  55986. return "N";
  55987. },
  55988. args: [],
  55989. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  55990. referencedClasses: [],
  55991. messageSends: []
  55992. }),
  55993. $globals.StringTest);
  55994. $core.addMethod(
  55995. $core.method({
  55996. selector: "samplesDo:",
  55997. protocol: "fixture",
  55998. fn: function (aBlock){
  55999. var self=this,$self=this;
  56000. return $core.withContext(function($ctx1) {
  56001. (
  56002. $ctx1.supercall = true,
  56003. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  56004. $ctx1.supercall = false;
  56005. $recv(aBlock)._value_value_((3),"l");
  56006. return self;
  56007. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  56008. },
  56009. args: ["aBlock"],
  56010. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  56011. referencedClasses: [],
  56012. messageSends: ["samplesDo:", "value:value:"]
  56013. }),
  56014. $globals.StringTest);
  56015. $core.addMethod(
  56016. $core.method({
  56017. selector: "testAddAll",
  56018. protocol: "tests",
  56019. fn: function (){
  56020. var self=this,$self=this;
  56021. return $core.withContext(function($ctx1) {
  56022. var $1;
  56023. $self._should_raise_((function(){
  56024. return $core.withContext(function($ctx2) {
  56025. $1=$self._collection();
  56026. $ctx2.sendIdx["collection"]=1;
  56027. return $recv($1)._addAll_($self._collection());
  56028. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56029. }),$globals.Error);
  56030. return self;
  56031. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  56032. },
  56033. args: [],
  56034. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  56035. referencedClasses: ["Error"],
  56036. messageSends: ["should:raise:", "addAll:", "collection"]
  56037. }),
  56038. $globals.StringTest);
  56039. $core.addMethod(
  56040. $core.method({
  56041. selector: "testAddRemove",
  56042. protocol: "tests",
  56043. fn: function (){
  56044. var self=this,$self=this;
  56045. return $core.withContext(function($ctx1) {
  56046. $self._should_raise_((function(){
  56047. return $core.withContext(function($ctx2) {
  56048. return "hello"._add_("a");
  56049. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56050. }),$globals.Error);
  56051. $ctx1.sendIdx["should:raise:"]=1;
  56052. $self._should_raise_((function(){
  56053. return $core.withContext(function($ctx2) {
  56054. return "hello"._remove_("h");
  56055. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56056. }),$globals.Error);
  56057. return self;
  56058. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  56059. },
  56060. args: [],
  56061. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  56062. referencedClasses: ["Error"],
  56063. messageSends: ["should:raise:", "add:", "remove:"]
  56064. }),
  56065. $globals.StringTest);
  56066. $core.addMethod(
  56067. $core.method({
  56068. selector: "testAsArray",
  56069. protocol: "tests",
  56070. fn: function (){
  56071. var self=this,$self=this;
  56072. return $core.withContext(function($ctx1) {
  56073. $self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  56074. return self;
  56075. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  56076. },
  56077. args: [],
  56078. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  56079. referencedClasses: [],
  56080. messageSends: ["assert:equals:", "asArray"]
  56081. }),
  56082. $globals.StringTest);
  56083. $core.addMethod(
  56084. $core.method({
  56085. selector: "testAsLowerCase",
  56086. protocol: "tests",
  56087. fn: function (){
  56088. var self=this,$self=this;
  56089. return $core.withContext(function($ctx1) {
  56090. $self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  56091. return self;
  56092. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  56093. },
  56094. args: [],
  56095. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  56096. referencedClasses: [],
  56097. messageSends: ["assert:equals:", "asLowercase"]
  56098. }),
  56099. $globals.StringTest);
  56100. $core.addMethod(
  56101. $core.method({
  56102. selector: "testAsNumber",
  56103. protocol: "tests",
  56104. fn: function (){
  56105. var self=this,$self=this;
  56106. return $core.withContext(function($ctx1) {
  56107. var $1,$2;
  56108. $1="3"._asNumber();
  56109. $ctx1.sendIdx["asNumber"]=1;
  56110. $self._assert_equals_($1,(3));
  56111. $ctx1.sendIdx["assert:equals:"]=1;
  56112. $2="-3"._asNumber();
  56113. $ctx1.sendIdx["asNumber"]=2;
  56114. $self._assert_equals_($2,(-3));
  56115. $ctx1.sendIdx["assert:equals:"]=2;
  56116. $self._assert_equals_("-1.5"._asNumber(),(-1.5));
  56117. return self;
  56118. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  56119. },
  56120. args: [],
  56121. 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.",
  56122. referencedClasses: [],
  56123. messageSends: ["assert:equals:", "asNumber"]
  56124. }),
  56125. $globals.StringTest);
  56126. $core.addMethod(
  56127. $core.method({
  56128. selector: "testAsUpperCase",
  56129. protocol: "tests",
  56130. fn: function (){
  56131. var self=this,$self=this;
  56132. return $core.withContext(function($ctx1) {
  56133. $self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  56134. return self;
  56135. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  56136. },
  56137. args: [],
  56138. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  56139. referencedClasses: [],
  56140. messageSends: ["assert:equals:", "asUppercase"]
  56141. }),
  56142. $globals.StringTest);
  56143. $core.addMethod(
  56144. $core.method({
  56145. selector: "testAsciiValue",
  56146. protocol: "tests",
  56147. fn: function (){
  56148. var self=this,$self=this;
  56149. var characterA,characterU;
  56150. return $core.withContext(function($ctx1) {
  56151. var $1;
  56152. characterA="A";
  56153. characterU="U";
  56154. $1=$recv(characterA)._asciiValue();
  56155. $ctx1.sendIdx["asciiValue"]=1;
  56156. $self._assert_equals_($1,(65));
  56157. $ctx1.sendIdx["assert:equals:"]=1;
  56158. $self._assert_equals_($recv(characterU)._asciiValue(),(85));
  56159. return self;
  56160. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  56161. },
  56162. args: [],
  56163. 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",
  56164. referencedClasses: [],
  56165. messageSends: ["assert:equals:", "asciiValue"]
  56166. }),
  56167. $globals.StringTest);
  56168. $core.addMethod(
  56169. $core.method({
  56170. selector: "testAtIfAbsentPut",
  56171. protocol: "tests",
  56172. fn: function (){
  56173. var self=this,$self=this;
  56174. return $core.withContext(function($ctx1) {
  56175. $self._should_raise_((function(){
  56176. return $core.withContext(function($ctx2) {
  56177. return "hello"._at_ifAbsentPut_((6),(function(){
  56178. return "a";
  56179. }));
  56180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56181. }),$globals.Error);
  56182. return self;
  56183. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  56184. },
  56185. args: [],
  56186. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  56187. referencedClasses: ["Error"],
  56188. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  56189. }),
  56190. $globals.StringTest);
  56191. $core.addMethod(
  56192. $core.method({
  56193. selector: "testAtPut",
  56194. protocol: "tests",
  56195. fn: function (){
  56196. var self=this,$self=this;
  56197. return $core.withContext(function($ctx1) {
  56198. $self._should_raise_((function(){
  56199. return $core.withContext(function($ctx2) {
  56200. return "hello"._at_put_((1),"a");
  56201. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56202. }),$globals.Error);
  56203. return self;
  56204. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  56205. },
  56206. args: [],
  56207. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  56208. referencedClasses: ["Error"],
  56209. messageSends: ["should:raise:", "at:put:"]
  56210. }),
  56211. $globals.StringTest);
  56212. $core.addMethod(
  56213. $core.method({
  56214. selector: "testCapitalized",
  56215. protocol: "tests",
  56216. fn: function (){
  56217. var self=this,$self=this;
  56218. return $core.withContext(function($ctx1) {
  56219. var $1,$2,$3;
  56220. $1="test"._capitalized();
  56221. $ctx1.sendIdx["capitalized"]=1;
  56222. $self._assert_equals_($1,"Test");
  56223. $ctx1.sendIdx["assert:equals:"]=1;
  56224. $2="Test"._capitalized();
  56225. $ctx1.sendIdx["capitalized"]=2;
  56226. $self._assert_equals_($2,"Test");
  56227. $ctx1.sendIdx["assert:equals:"]=2;
  56228. $self._assert_equals_(""._capitalized(),"");
  56229. $ctx1.sendIdx["assert:equals:"]=3;
  56230. $3="Test"._isCapitalized();
  56231. $ctx1.sendIdx["isCapitalized"]=1;
  56232. $self._assert_equals_($3,true);
  56233. $ctx1.sendIdx["assert:equals:"]=4;
  56234. $self._assert_equals_("test"._isCapitalized(),false);
  56235. return self;
  56236. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  56237. },
  56238. args: [],
  56239. 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.",
  56240. referencedClasses: [],
  56241. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  56242. }),
  56243. $globals.StringTest);
  56244. $core.addMethod(
  56245. $core.method({
  56246. selector: "testCharCodeAt",
  56247. protocol: "tests",
  56248. fn: function (){
  56249. var self=this,$self=this;
  56250. return $core.withContext(function($ctx1) {
  56251. var $1,$2,$3,$4,$5;
  56252. $1="jackie"._charCodeAt_((1));
  56253. $ctx1.sendIdx["charCodeAt:"]=1;
  56254. $self._assert_equals_($1,(106));
  56255. $ctx1.sendIdx["assert:equals:"]=1;
  56256. $2="jackie"._charCodeAt_((2));
  56257. $ctx1.sendIdx["charCodeAt:"]=2;
  56258. $self._assert_equals_($2,(97));
  56259. $ctx1.sendIdx["assert:equals:"]=2;
  56260. $3="jackie"._charCodeAt_((3));
  56261. $ctx1.sendIdx["charCodeAt:"]=3;
  56262. $self._assert_equals_($3,(99));
  56263. $ctx1.sendIdx["assert:equals:"]=3;
  56264. $4="jackie"._charCodeAt_((4));
  56265. $ctx1.sendIdx["charCodeAt:"]=4;
  56266. $self._assert_equals_($4,(107));
  56267. $ctx1.sendIdx["assert:equals:"]=4;
  56268. $5="jackie"._charCodeAt_((5));
  56269. $ctx1.sendIdx["charCodeAt:"]=5;
  56270. $self._assert_equals_($5,(105));
  56271. $ctx1.sendIdx["assert:equals:"]=5;
  56272. $self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  56273. return self;
  56274. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  56275. },
  56276. args: [],
  56277. 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",
  56278. referencedClasses: [],
  56279. messageSends: ["assert:equals:", "charCodeAt:"]
  56280. }),
  56281. $globals.StringTest);
  56282. $core.addMethod(
  56283. $core.method({
  56284. selector: "testCopyFromTo",
  56285. protocol: "tests",
  56286. fn: function (){
  56287. var self=this,$self=this;
  56288. return $core.withContext(function($ctx1) {
  56289. var $1;
  56290. $1="jackie"._copyFrom_to_((1),(3));
  56291. $ctx1.sendIdx["copyFrom:to:"]=1;
  56292. $self._assert_equals_($1,"jac");
  56293. $ctx1.sendIdx["assert:equals:"]=1;
  56294. $self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  56295. return self;
  56296. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  56297. },
  56298. args: [],
  56299. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  56300. referencedClasses: [],
  56301. messageSends: ["assert:equals:", "copyFrom:to:"]
  56302. }),
  56303. $globals.StringTest);
  56304. $core.addMethod(
  56305. $core.method({
  56306. selector: "testCopySeparates",
  56307. protocol: "tests",
  56308. fn: function (){
  56309. var self=this,$self=this;
  56310. return $core.withContext(function($ctx1) {
  56311. var $3,$2,$1;
  56312. $3=$self._collection();
  56313. $ctx1.sendIdx["collection"]=1;
  56314. $2=$recv($3)._copy();
  56315. $1=$recv($2).__eq_eq($self._collection());
  56316. $self._assert_($1);
  56317. return self;
  56318. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  56319. },
  56320. args: [],
  56321. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  56322. referencedClasses: [],
  56323. messageSends: ["assert:", "==", "copy", "collection"]
  56324. }),
  56325. $globals.StringTest);
  56326. $core.addMethod(
  56327. $core.method({
  56328. selector: "testCopyWithoutAll",
  56329. protocol: "tests",
  56330. fn: function (){
  56331. var self=this,$self=this;
  56332. return $core.withContext(function($ctx1) {
  56333. $self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  56334. return self;
  56335. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  56336. },
  56337. args: [],
  56338. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  56339. referencedClasses: [],
  56340. messageSends: ["assert:equals:", "copyWithoutAll:"]
  56341. }),
  56342. $globals.StringTest);
  56343. $core.addMethod(
  56344. $core.method({
  56345. selector: "testEquality",
  56346. protocol: "tests",
  56347. fn: function (){
  56348. var self=this,$self=this;
  56349. return $core.withContext(function($ctx1) {
  56350. var $1,$2,$3;
  56351. $self._assert_equals_("hello","hello");
  56352. $ctx1.sendIdx["assert:equals:"]=1;
  56353. $1="hello".__eq("world");
  56354. $ctx1.sendIdx["="]=1;
  56355. $self._deny_($1);
  56356. $ctx1.sendIdx["deny:"]=1;
  56357. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  56358. })));
  56359. $ctx1.sendIdx["="]=2;
  56360. $self._deny_($2);
  56361. $ctx1.sendIdx["deny:"]=2;
  56362. $3="hello"._yourself();
  56363. $ctx1.sendIdx["yourself"]=1;
  56364. $self._assert_equals_("hello",$3);
  56365. $ctx1.sendIdx["assert:equals:"]=2;
  56366. $self._assert_equals_("hello"._yourself(),"hello");
  56367. $self._deny_("".__eq((0)));
  56368. return self;
  56369. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  56370. },
  56371. args: [],
  56372. 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",
  56373. referencedClasses: [],
  56374. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  56375. }),
  56376. $globals.StringTest);
  56377. $core.addMethod(
  56378. $core.method({
  56379. selector: "testIdentity",
  56380. protocol: "tests",
  56381. fn: function (){
  56382. var self=this,$self=this;
  56383. return $core.withContext(function($ctx1) {
  56384. var $1,$2,$4,$3,$5;
  56385. $1="hello".__eq_eq("hello");
  56386. $ctx1.sendIdx["=="]=1;
  56387. $self._assert_($1);
  56388. $ctx1.sendIdx["assert:"]=1;
  56389. $2="hello".__eq_eq("world");
  56390. $ctx1.sendIdx["=="]=2;
  56391. $self._deny_($2);
  56392. $ctx1.sendIdx["deny:"]=1;
  56393. $4="hello"._yourself();
  56394. $ctx1.sendIdx["yourself"]=1;
  56395. $3="hello".__eq_eq($4);
  56396. $ctx1.sendIdx["=="]=3;
  56397. $self._assert_($3);
  56398. $ctx1.sendIdx["assert:"]=2;
  56399. $5=$recv("hello"._yourself()).__eq_eq("hello");
  56400. $ctx1.sendIdx["=="]=4;
  56401. $self._assert_($5);
  56402. $self._deny_("".__eq_eq((0)));
  56403. return self;
  56404. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  56405. },
  56406. args: [],
  56407. 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",
  56408. referencedClasses: [],
  56409. messageSends: ["assert:", "==", "deny:", "yourself"]
  56410. }),
  56411. $globals.StringTest);
  56412. $core.addMethod(
  56413. $core.method({
  56414. selector: "testIncludesSubString",
  56415. protocol: "tests",
  56416. fn: function (){
  56417. var self=this,$self=this;
  56418. return $core.withContext(function($ctx1) {
  56419. var $1;
  56420. $1="amber"._includesSubString_("ber");
  56421. $ctx1.sendIdx["includesSubString:"]=1;
  56422. $self._assert_($1);
  56423. $self._deny_("amber"._includesSubString_("zork"));
  56424. return self;
  56425. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  56426. },
  56427. args: [],
  56428. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  56429. referencedClasses: [],
  56430. messageSends: ["assert:", "includesSubString:", "deny:"]
  56431. }),
  56432. $globals.StringTest);
  56433. $core.addMethod(
  56434. $core.method({
  56435. selector: "testIndexOfStartingAtWithNull",
  56436. protocol: "tests",
  56437. fn: function (){
  56438. var self=this,$self=this;
  56439. return self;
  56440. },
  56441. args: [],
  56442. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56443. referencedClasses: [],
  56444. messageSends: []
  56445. }),
  56446. $globals.StringTest);
  56447. $core.addMethod(
  56448. $core.method({
  56449. selector: "testIndexOfWithNull",
  56450. protocol: "tests",
  56451. fn: function (){
  56452. var self=this,$self=this;
  56453. return self;
  56454. },
  56455. args: [],
  56456. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56457. referencedClasses: [],
  56458. messageSends: []
  56459. }),
  56460. $globals.StringTest);
  56461. $core.addMethod(
  56462. $core.method({
  56463. selector: "testIsVowel",
  56464. protocol: "tests",
  56465. fn: function (){
  56466. var self=this,$self=this;
  56467. var vowel,consonant;
  56468. return $core.withContext(function($ctx1) {
  56469. var $1;
  56470. vowel="u";
  56471. consonant="z";
  56472. $1=$recv(vowel)._isVowel();
  56473. $ctx1.sendIdx["isVowel"]=1;
  56474. $self._assert_equals_($1,true);
  56475. $ctx1.sendIdx["assert:equals:"]=1;
  56476. $self._assert_equals_($recv(consonant)._isVowel(),false);
  56477. return self;
  56478. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  56479. },
  56480. args: [],
  56481. 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",
  56482. referencedClasses: [],
  56483. messageSends: ["assert:equals:", "isVowel"]
  56484. }),
  56485. $globals.StringTest);
  56486. $core.addMethod(
  56487. $core.method({
  56488. selector: "testJoin",
  56489. protocol: "tests",
  56490. fn: function (){
  56491. var self=this,$self=this;
  56492. return $core.withContext(function($ctx1) {
  56493. $self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  56494. return self;
  56495. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  56496. },
  56497. args: [],
  56498. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  56499. referencedClasses: [],
  56500. messageSends: ["assert:equals:", "join:"]
  56501. }),
  56502. $globals.StringTest);
  56503. $core.addMethod(
  56504. $core.method({
  56505. selector: "testRegression1224",
  56506. protocol: "tests",
  56507. fn: function (){
  56508. var self=this,$self=this;
  56509. return $core.withContext(function($ctx1) {
  56510. var $2,$1;
  56511. $self._should_raise_((function(){
  56512. return $core.withContext(function($ctx2) {
  56513. $2=$recv($self._collectionClass())._new();
  56514. $recv($2)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  56515. }));
  56516. $1=$recv($2)._yourself();
  56517. return $recv($1)._size();
  56518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56519. }),$globals.Error);
  56520. return self;
  56521. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.StringTest)});
  56522. },
  56523. args: [],
  56524. 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",
  56525. referencedClasses: ["Error"],
  56526. messageSends: ["should:raise:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  56527. }),
  56528. $globals.StringTest);
  56529. $core.addMethod(
  56530. $core.method({
  56531. selector: "testRemoveAll",
  56532. protocol: "tests",
  56533. fn: function (){
  56534. var self=this,$self=this;
  56535. return $core.withContext(function($ctx1) {
  56536. $self._should_raise_((function(){
  56537. return $core.withContext(function($ctx2) {
  56538. return $recv($self._collection())._removeAll();
  56539. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56540. }),$globals.Error);
  56541. return self;
  56542. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  56543. },
  56544. args: [],
  56545. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  56546. referencedClasses: ["Error"],
  56547. messageSends: ["should:raise:", "removeAll", "collection"]
  56548. }),
  56549. $globals.StringTest);
  56550. $core.addMethod(
  56551. $core.method({
  56552. selector: "testReversed",
  56553. protocol: "tests",
  56554. fn: function (){
  56555. var self=this,$self=this;
  56556. return $core.withContext(function($ctx1) {
  56557. $self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  56558. return self;
  56559. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  56560. },
  56561. args: [],
  56562. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  56563. referencedClasses: [],
  56564. messageSends: ["assert:equals:", "reversed"]
  56565. }),
  56566. $globals.StringTest);
  56567. $core.addMethod(
  56568. $core.method({
  56569. selector: "testStreamContents",
  56570. protocol: "tests",
  56571. fn: function (){
  56572. var self=this,$self=this;
  56573. return $core.withContext(function($ctx1) {
  56574. $self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  56575. return $core.withContext(function($ctx2) {
  56576. $recv(aStream)._nextPutAll_("hello");
  56577. $ctx2.sendIdx["nextPutAll:"]=1;
  56578. $recv(aStream)._space();
  56579. return $recv(aStream)._nextPutAll_("world");
  56580. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  56581. })),"hello world");
  56582. return self;
  56583. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  56584. },
  56585. args: [],
  56586. 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'",
  56587. referencedClasses: ["String"],
  56588. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  56589. }),
  56590. $globals.StringTest);
  56591. $core.addMethod(
  56592. $core.method({
  56593. selector: "testSubStrings",
  56594. protocol: "tests",
  56595. fn: function (){
  56596. var self=this,$self=this;
  56597. return $core.withContext(function($ctx1) {
  56598. $self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  56599. return self;
  56600. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  56601. },
  56602. args: [],
  56603. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  56604. referencedClasses: [],
  56605. messageSends: ["assert:equals:", "subStrings:"]
  56606. }),
  56607. $globals.StringTest);
  56608. $core.addMethod(
  56609. $core.method({
  56610. selector: "testTrim",
  56611. protocol: "tests",
  56612. fn: function (){
  56613. var self=this,$self=this;
  56614. return $core.withContext(function($ctx1) {
  56615. $self._assert_equals_(" jackie"._trimLeft(),"jackie");
  56616. $ctx1.sendIdx["assert:equals:"]=1;
  56617. $self._assert_equals_("jackie "._trimRight(),"jackie");
  56618. return self;
  56619. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  56620. },
  56621. args: [],
  56622. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  56623. referencedClasses: [],
  56624. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  56625. }),
  56626. $globals.StringTest);
  56627. $core.addMethod(
  56628. $core.method({
  56629. selector: "testValue",
  56630. protocol: "tests",
  56631. fn: function (){
  56632. var self=this,$self=this;
  56633. return $core.withContext(function($ctx1) {
  56634. $self._assert_equals_("asString"._value_((1)),"1");
  56635. $ctx1.sendIdx["assert:equals:"]=1;
  56636. $self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  56637. return self;
  56638. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  56639. },
  56640. args: [],
  56641. 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')",
  56642. referencedClasses: [],
  56643. messageSends: ["assert:equals:", "value:", "collect:"]
  56644. }),
  56645. $globals.StringTest);
  56646. $core.addMethod(
  56647. $core.method({
  56648. selector: "collectionClass",
  56649. protocol: "fixture",
  56650. fn: function (){
  56651. var self=this,$self=this;
  56652. return $globals.String;
  56653. },
  56654. args: [],
  56655. source: "collectionClass\x0a\x09^ String",
  56656. referencedClasses: ["String"],
  56657. messageSends: []
  56658. }),
  56659. $globals.StringTest.a$cls);
  56660. $core.addClass("SetTest", $globals.CollectionTest, [], "Kernel-Tests");
  56661. $core.addMethod(
  56662. $core.method({
  56663. selector: "collection",
  56664. protocol: "fixture",
  56665. fn: function (){
  56666. var self=this,$self=this;
  56667. return $core.withContext(function($ctx1) {
  56668. var $1;
  56669. $1=$recv($globals.Set)._new();
  56670. $recv($1)._add_($globals.Smalltalk);
  56671. $ctx1.sendIdx["add:"]=1;
  56672. $recv($1)._add_(nil);
  56673. $ctx1.sendIdx["add:"]=2;
  56674. $recv($1)._add_((3).__at((3)));
  56675. $ctx1.sendIdx["add:"]=3;
  56676. $recv($1)._add_(false);
  56677. $ctx1.sendIdx["add:"]=4;
  56678. $recv($1)._add_($self["@sampleBlock"]);
  56679. return $recv($1)._yourself();
  56680. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  56681. },
  56682. args: [],
  56683. 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",
  56684. referencedClasses: ["Set", "Smalltalk"],
  56685. messageSends: ["add:", "new", "@", "yourself"]
  56686. }),
  56687. $globals.SetTest);
  56688. $core.addMethod(
  56689. $core.method({
  56690. selector: "collectionOfPrintStrings",
  56691. protocol: "fixture",
  56692. fn: function (){
  56693. var self=this,$self=this;
  56694. return $core.withContext(function($ctx1) {
  56695. var $1;
  56696. $1=$recv($globals.Set)._new();
  56697. $recv($1)._add_("a SmalltalkImage");
  56698. $ctx1.sendIdx["add:"]=1;
  56699. $recv($1)._add_("nil");
  56700. $ctx1.sendIdx["add:"]=2;
  56701. $recv($1)._add_("3@3");
  56702. $ctx1.sendIdx["add:"]=3;
  56703. $recv($1)._add_("false");
  56704. $ctx1.sendIdx["add:"]=4;
  56705. $recv($1)._add_("a BlockClosure");
  56706. return $recv($1)._yourself();
  56707. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  56708. },
  56709. args: [],
  56710. 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",
  56711. referencedClasses: ["Set"],
  56712. messageSends: ["add:", "new", "yourself"]
  56713. }),
  56714. $globals.SetTest);
  56715. $core.addMethod(
  56716. $core.method({
  56717. selector: "collectionSize",
  56718. protocol: "fixture",
  56719. fn: function (){
  56720. var self=this,$self=this;
  56721. return (5);
  56722. },
  56723. args: [],
  56724. source: "collectionSize\x0a\x09^ 5",
  56725. referencedClasses: [],
  56726. messageSends: []
  56727. }),
  56728. $globals.SetTest);
  56729. $core.addMethod(
  56730. $core.method({
  56731. selector: "collectionWithDuplicates",
  56732. protocol: "fixture",
  56733. fn: function (){
  56734. var self=this,$self=this;
  56735. return $core.withContext(function($ctx1) {
  56736. var $1;
  56737. $1=$self._collection();
  56738. $recv($1)._add_((0));
  56739. return $recv($1)._yourself();
  56740. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  56741. },
  56742. args: [],
  56743. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  56744. referencedClasses: [],
  56745. messageSends: ["add:", "collection", "yourself"]
  56746. }),
  56747. $globals.SetTest);
  56748. $core.addMethod(
  56749. $core.method({
  56750. selector: "collectionWithNewValue",
  56751. protocol: "fixture",
  56752. fn: function (){
  56753. var self=this,$self=this;
  56754. return $core.withContext(function($ctx1) {
  56755. var $1;
  56756. $1=$recv($globals.Set)._new();
  56757. $recv($1)._add_($globals.Smalltalk);
  56758. $ctx1.sendIdx["add:"]=1;
  56759. $recv($1)._add_(nil);
  56760. $ctx1.sendIdx["add:"]=2;
  56761. $recv($1)._add_((3).__at((3)));
  56762. $ctx1.sendIdx["add:"]=3;
  56763. $recv($1)._add_("N");
  56764. $ctx1.sendIdx["add:"]=4;
  56765. $recv($1)._add_(false);
  56766. $ctx1.sendIdx["add:"]=5;
  56767. $recv($1)._add_($self["@sampleBlock"]);
  56768. return $recv($1)._yourself();
  56769. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  56770. },
  56771. args: [],
  56772. 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",
  56773. referencedClasses: ["Set", "Smalltalk"],
  56774. messageSends: ["add:", "new", "@", "yourself"]
  56775. }),
  56776. $globals.SetTest);
  56777. $core.addMethod(
  56778. $core.method({
  56779. selector: "testAddAll",
  56780. protocol: "tests",
  56781. fn: function (){
  56782. var self=this,$self=this;
  56783. return $core.withContext(function($ctx1) {
  56784. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  56785. (
  56786. $ctx1.supercall = true,
  56787. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  56788. $ctx1.supercall = false;
  56789. $2=$self._collection();
  56790. $ctx1.sendIdx["collection"]=1;
  56791. $3=$self._collection();
  56792. $ctx1.sendIdx["collection"]=2;
  56793. $recv($2)._addAll_($3);
  56794. $ctx1.sendIdx["addAll:"]=1;
  56795. $4=$recv($2)._yourself();
  56796. $ctx1.sendIdx["yourself"]=1;
  56797. $1=$4;
  56798. $5=$self._collection();
  56799. $ctx1.sendIdx["collection"]=3;
  56800. $self._assert_equals_($1,$5);
  56801. $ctx1.sendIdx["assert:equals:"]=1;
  56802. $7=$self._collection();
  56803. $ctx1.sendIdx["collection"]=4;
  56804. $8=$self._collectionWithNewValue();
  56805. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56806. $recv($7)._addAll_($8);
  56807. $ctx1.sendIdx["addAll:"]=2;
  56808. $9=$recv($7)._yourself();
  56809. $ctx1.sendIdx["yourself"]=2;
  56810. $6=$9;
  56811. $10=$self._collectionWithNewValue();
  56812. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56813. $self._assert_equals_($6,$10);
  56814. $ctx1.sendIdx["assert:equals:"]=2;
  56815. $12=$self._collectionWithNewValue();
  56816. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56817. $recv($12)._addAll_($self._collection());
  56818. $11=$recv($12)._yourself();
  56819. $self._assert_equals_($11,$self._collectionWithNewValue());
  56820. return self;
  56821. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  56822. },
  56823. args: [],
  56824. 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",
  56825. referencedClasses: [],
  56826. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  56827. }),
  56828. $globals.SetTest);
  56829. $core.addMethod(
  56830. $core.method({
  56831. selector: "testAddRemove",
  56832. protocol: "tests",
  56833. fn: function (){
  56834. var self=this,$self=this;
  56835. var set;
  56836. return $core.withContext(function($ctx1) {
  56837. var $1,$2;
  56838. set=$recv($globals.Set)._new();
  56839. $self._assert_($recv(set)._isEmpty());
  56840. $ctx1.sendIdx["assert:"]=1;
  56841. $recv(set)._add_((3));
  56842. $ctx1.sendIdx["add:"]=1;
  56843. $1=$recv(set)._includes_((3));
  56844. $ctx1.sendIdx["includes:"]=1;
  56845. $self._assert_($1);
  56846. $ctx1.sendIdx["assert:"]=2;
  56847. $recv(set)._add_((5));
  56848. $2=$recv(set)._includes_((5));
  56849. $ctx1.sendIdx["includes:"]=2;
  56850. $self._assert_($2);
  56851. $recv(set)._remove_((3));
  56852. $self._deny_($recv(set)._includes_((3)));
  56853. return self;
  56854. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  56855. },
  56856. args: [],
  56857. 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)",
  56858. referencedClasses: ["Set"],
  56859. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  56860. }),
  56861. $globals.SetTest);
  56862. $core.addMethod(
  56863. $core.method({
  56864. selector: "testAt",
  56865. protocol: "tests",
  56866. fn: function (){
  56867. var self=this,$self=this;
  56868. return $core.withContext(function($ctx1) {
  56869. $self._should_raise_((function(){
  56870. return $core.withContext(function($ctx2) {
  56871. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  56872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56873. }),$globals.Error);
  56874. return self;
  56875. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  56876. },
  56877. args: [],
  56878. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  56879. referencedClasses: ["Set", "Error"],
  56880. messageSends: ["should:raise:", "at:put:", "new"]
  56881. }),
  56882. $globals.SetTest);
  56883. $core.addMethod(
  56884. $core.method({
  56885. selector: "testCollect",
  56886. protocol: "tests",
  56887. fn: function (){
  56888. var self=this,$self=this;
  56889. return $core.withContext(function($ctx1) {
  56890. var $2,$1;
  56891. (
  56892. $ctx1.supercall = true,
  56893. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($self, []));
  56894. $ctx1.supercall = false;
  56895. $2=[(5), (6), (8)]._asSet();
  56896. $ctx1.sendIdx["asSet"]=1;
  56897. $1=$recv($2)._collect_((function(x){
  56898. return $core.withContext(function($ctx2) {
  56899. return $recv(x).__backslash_backslash((3));
  56900. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56901. }));
  56902. $self._assert_equals_($1,[(0), (2)]._asSet());
  56903. return self;
  56904. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  56905. },
  56906. args: [],
  56907. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  56908. referencedClasses: [],
  56909. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  56910. }),
  56911. $globals.SetTest);
  56912. $core.addMethod(
  56913. $core.method({
  56914. selector: "testComma",
  56915. protocol: "tests",
  56916. fn: function (){
  56917. var self=this,$self=this;
  56918. return $core.withContext(function($ctx1) {
  56919. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  56920. (
  56921. $ctx1.supercall = true,
  56922. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  56923. $ctx1.supercall = false;
  56924. $2=$self._collection();
  56925. $ctx1.sendIdx["collection"]=1;
  56926. $3=$self._collection();
  56927. $ctx1.sendIdx["collection"]=2;
  56928. $1=$recv($2).__comma($3);
  56929. $ctx1.sendIdx[","]=1;
  56930. $4=$self._collection();
  56931. $ctx1.sendIdx["collection"]=3;
  56932. $self._assert_equals_($1,$4);
  56933. $ctx1.sendIdx["assert:equals:"]=1;
  56934. $6=$self._collection();
  56935. $ctx1.sendIdx["collection"]=4;
  56936. $7=$self._collectionWithNewValue();
  56937. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56938. $5=$recv($6).__comma($7);
  56939. $ctx1.sendIdx[","]=2;
  56940. $8=$self._collectionWithNewValue();
  56941. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56942. $self._assert_equals_($5,$8);
  56943. $ctx1.sendIdx["assert:equals:"]=2;
  56944. $10=$self._collectionWithNewValue();
  56945. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56946. $9=$recv($10).__comma($self._collection());
  56947. $self._assert_equals_($9,$self._collectionWithNewValue());
  56948. return self;
  56949. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  56950. },
  56951. args: [],
  56952. 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",
  56953. referencedClasses: [],
  56954. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  56955. }),
  56956. $globals.SetTest);
  56957. $core.addMethod(
  56958. $core.method({
  56959. selector: "testComparing",
  56960. protocol: "tests",
  56961. fn: function (){
  56962. var self=this,$self=this;
  56963. return $core.withContext(function($ctx1) {
  56964. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  56965. $1=[(0), (2)]._asSet();
  56966. $ctx1.sendIdx["asSet"]=1;
  56967. $2=[(0), (2)]._asSet();
  56968. $ctx1.sendIdx["asSet"]=2;
  56969. $self._assert_equals_($1,$2);
  56970. $ctx1.sendIdx["assert:equals:"]=1;
  56971. $3=[(2), (0)]._asSet();
  56972. $ctx1.sendIdx["asSet"]=3;
  56973. $4=[(0), (2)]._asSet();
  56974. $ctx1.sendIdx["asSet"]=4;
  56975. $self._assert_equals_($3,$4);
  56976. $6=[(0), (2), (3)]._asSet();
  56977. $ctx1.sendIdx["asSet"]=5;
  56978. $7=[(0), (2)]._asSet();
  56979. $ctx1.sendIdx["asSet"]=6;
  56980. $5=$recv($6).__eq($7);
  56981. $ctx1.sendIdx["="]=1;
  56982. $self._deny_($5);
  56983. $ctx1.sendIdx["deny:"]=1;
  56984. $9=[(1), (2)]._asSet();
  56985. $ctx1.sendIdx["asSet"]=7;
  56986. $8=$recv($9).__eq([(0), (2)]._asSet());
  56987. $self._deny_($8);
  56988. return self;
  56989. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  56990. },
  56991. args: [],
  56992. 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",
  56993. referencedClasses: [],
  56994. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  56995. }),
  56996. $globals.SetTest);
  56997. $core.addMethod(
  56998. $core.method({
  56999. selector: "testPrintString",
  57000. protocol: "tests",
  57001. fn: function (){
  57002. var self=this,$self=this;
  57003. var set;
  57004. return $core.withContext(function($ctx1) {
  57005. var $1,$2,$3,$4,$5,$6,$7,$8;
  57006. set=$recv($globals.Set)._new();
  57007. $1=$recv(set)._printString();
  57008. $ctx1.sendIdx["printString"]=1;
  57009. $self._assert_equals_($1,"a Set ()");
  57010. $ctx1.sendIdx["assert:equals:"]=1;
  57011. $2=set;
  57012. $recv($2)._add_((1));
  57013. $ctx1.sendIdx["add:"]=1;
  57014. $3=$recv($2)._add_((3));
  57015. $ctx1.sendIdx["add:"]=2;
  57016. $4=$recv(set)._printString();
  57017. $ctx1.sendIdx["printString"]=2;
  57018. $self._assert_equals_($4,"a Set (1 3)");
  57019. $ctx1.sendIdx["assert:equals:"]=2;
  57020. $recv(set)._add_("foo");
  57021. $ctx1.sendIdx["add:"]=3;
  57022. $5=$recv(set)._printString();
  57023. $ctx1.sendIdx["printString"]=3;
  57024. $self._assert_equals_($5,"a Set (1 3 'foo')");
  57025. $ctx1.sendIdx["assert:equals:"]=3;
  57026. $6=set;
  57027. $recv($6)._remove_((1));
  57028. $ctx1.sendIdx["remove:"]=1;
  57029. $recv($6)._remove_((3));
  57030. $7=$recv(set)._printString();
  57031. $ctx1.sendIdx["printString"]=4;
  57032. $self._assert_equals_($7,"a Set ('foo')");
  57033. $ctx1.sendIdx["assert:equals:"]=4;
  57034. $recv(set)._add_((3));
  57035. $ctx1.sendIdx["add:"]=4;
  57036. $8=$recv(set)._printString();
  57037. $ctx1.sendIdx["printString"]=5;
  57038. $self._assert_equals_($8,"a Set (3 'foo')");
  57039. $ctx1.sendIdx["assert:equals:"]=5;
  57040. $recv(set)._add_((3));
  57041. $self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  57042. return self;
  57043. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  57044. },
  57045. args: [],
  57046. 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'')'",
  57047. referencedClasses: ["Set"],
  57048. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  57049. }),
  57050. $globals.SetTest);
  57051. $core.addMethod(
  57052. $core.method({
  57053. selector: "testRegression1225",
  57054. protocol: "tests",
  57055. fn: function (){
  57056. var self=this,$self=this;
  57057. return $core.withContext(function($ctx1) {
  57058. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._add_((3)),(3));
  57059. return self;
  57060. }, function($ctx1) {$ctx1.fill(self,"testRegression1225",{},$globals.SetTest)});
  57061. },
  57062. args: [],
  57063. source: "testRegression1225\x0a\x09self assert: (#(1 2 3) asSet add: 3) equals: 3",
  57064. referencedClasses: [],
  57065. messageSends: ["assert:equals:", "add:", "asSet"]
  57066. }),
  57067. $globals.SetTest);
  57068. $core.addMethod(
  57069. $core.method({
  57070. selector: "testRegression1226",
  57071. protocol: "tests",
  57072. fn: function (){
  57073. var self=this,$self=this;
  57074. return $core.withContext(function($ctx1) {
  57075. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._remove_((3)),(3));
  57076. return self;
  57077. }, function($ctx1) {$ctx1.fill(self,"testRegression1226",{},$globals.SetTest)});
  57078. },
  57079. args: [],
  57080. source: "testRegression1226\x0a\x09self assert: (#(1 2 3) asSet remove: 3) equals: 3",
  57081. referencedClasses: [],
  57082. messageSends: ["assert:equals:", "remove:", "asSet"]
  57083. }),
  57084. $globals.SetTest);
  57085. $core.addMethod(
  57086. $core.method({
  57087. selector: "testRegression1227",
  57088. protocol: "tests",
  57089. fn: function (){
  57090. var self=this,$self=this;
  57091. return $core.withContext(function($ctx1) {
  57092. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._remove_ifAbsent_((4),(function(){
  57093. return (5);
  57094. })),(5));
  57095. return self;
  57096. }, function($ctx1) {$ctx1.fill(self,"testRegression1227",{},$globals.SetTest)});
  57097. },
  57098. args: [],
  57099. source: "testRegression1227\x0a\x09self assert: (#(1 2 3) asSet remove: 4 ifAbsent: [5]) equals: 5",
  57100. referencedClasses: [],
  57101. messageSends: ["assert:equals:", "remove:ifAbsent:", "asSet"]
  57102. }),
  57103. $globals.SetTest);
  57104. $core.addMethod(
  57105. $core.method({
  57106. selector: "testRegression1228",
  57107. protocol: "tests",
  57108. fn: function (){
  57109. var self=this,$self=this;
  57110. return $core.withContext(function($ctx1) {
  57111. $self._should_raise_((function(){
  57112. return $core.withContext(function($ctx2) {
  57113. return $recv([(1), (2), (3)]._asSet())._remove_((4));
  57114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57115. }),$globals.Error);
  57116. return self;
  57117. }, function($ctx1) {$ctx1.fill(self,"testRegression1228",{},$globals.SetTest)});
  57118. },
  57119. args: [],
  57120. source: "testRegression1228\x0a\x09self should: [#(1 2 3) asSet remove: 4] raise: Error",
  57121. referencedClasses: ["Error"],
  57122. messageSends: ["should:raise:", "remove:", "asSet"]
  57123. }),
  57124. $globals.SetTest);
  57125. $core.addMethod(
  57126. $core.method({
  57127. selector: "testUnboxedObjects",
  57128. protocol: "tests",
  57129. fn: function (){
  57130. var self=this,$self=this;
  57131. return $core.withContext(function($ctx1) {
  57132. var $4,$3,$2,$1;
  57133. $4="foo"._yourself();
  57134. $ctx1.sendIdx["yourself"]=1;
  57135. $3=[$4,"foo"._yourself()];
  57136. $2=$recv($3)._asSet();
  57137. $1=$recv($2)._asArray();
  57138. $self._assert_equals_($1,["foo"]);
  57139. return self;
  57140. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  57141. },
  57142. args: [],
  57143. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  57144. referencedClasses: [],
  57145. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  57146. }),
  57147. $globals.SetTest);
  57148. $core.addMethod(
  57149. $core.method({
  57150. selector: "testUnicity",
  57151. protocol: "tests",
  57152. fn: function (){
  57153. var self=this,$self=this;
  57154. var set;
  57155. return $core.withContext(function($ctx1) {
  57156. var $1;
  57157. set=$recv($globals.Set)._new();
  57158. $recv(set)._add_((21));
  57159. $ctx1.sendIdx["add:"]=1;
  57160. $recv(set)._add_("hello");
  57161. $ctx1.sendIdx["add:"]=2;
  57162. $recv(set)._add_((21));
  57163. $ctx1.sendIdx["add:"]=3;
  57164. $1=$recv(set)._size();
  57165. $ctx1.sendIdx["size"]=1;
  57166. $self._assert_equals_($1,(2));
  57167. $ctx1.sendIdx["assert:equals:"]=1;
  57168. $recv(set)._add_("hello");
  57169. $self._assert_equals_($recv(set)._size(),(2));
  57170. $ctx1.sendIdx["assert:equals:"]=2;
  57171. $self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  57172. return self;
  57173. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  57174. },
  57175. args: [],
  57176. 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')",
  57177. referencedClasses: ["Set"],
  57178. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  57179. }),
  57180. $globals.SetTest);
  57181. $core.addMethod(
  57182. $core.method({
  57183. selector: "collectionClass",
  57184. protocol: "fixture",
  57185. fn: function (){
  57186. var self=this,$self=this;
  57187. return $globals.Set;
  57188. },
  57189. args: [],
  57190. source: "collectionClass\x0a\x09^ Set",
  57191. referencedClasses: ["Set"],
  57192. messageSends: []
  57193. }),
  57194. $globals.SetTest.a$cls);
  57195. $core.addClass("ConsoleTranscriptTest", $globals.TestCase, [], "Kernel-Tests");
  57196. $core.addMethod(
  57197. $core.method({
  57198. selector: "testShow",
  57199. protocol: "tests",
  57200. fn: function (){
  57201. var self=this,$self=this;
  57202. var originalTranscript;
  57203. return $core.withContext(function($ctx1) {
  57204. originalTranscript=$recv($globals.Transcript)._current();
  57205. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  57206. $ctx1.sendIdx["register:"]=1;
  57207. $self._shouldnt_raise_((function(){
  57208. return $core.withContext(function($ctx2) {
  57209. return $recv($globals.Transcript)._show_("Hello console!");
  57210. $ctx2.sendIdx["show:"]=1;
  57211. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57212. }),$globals.Error);
  57213. $ctx1.sendIdx["shouldnt:raise:"]=1;
  57214. $self._shouldnt_raise_((function(){
  57215. return $core.withContext(function($ctx2) {
  57216. return $recv($globals.Transcript)._show_(console);
  57217. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57218. }),$globals.Error);
  57219. $recv($globals.Transcript)._register_(originalTranscript);
  57220. return self;
  57221. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  57222. },
  57223. args: [],
  57224. 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.",
  57225. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  57226. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  57227. }),
  57228. $globals.ConsoleTranscriptTest);
  57229. $core.addClass("DateTest", $globals.TestCase, [], "Kernel-Tests");
  57230. $core.addMethod(
  57231. $core.method({
  57232. selector: "testEquality",
  57233. protocol: "tests",
  57234. fn: function (){
  57235. var self=this,$self=this;
  57236. var now;
  57237. return $core.withContext(function($ctx1) {
  57238. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  57239. now=$recv($globals.Date)._new();
  57240. $1=$recv(now).__eq(now);
  57241. $ctx1.sendIdx["="]=1;
  57242. $self._assert_($1);
  57243. $ctx1.sendIdx["assert:"]=1;
  57244. $3=now;
  57245. $4=$recv($globals.Date)._fromMilliseconds_((0));
  57246. $ctx1.sendIdx["fromMilliseconds:"]=1;
  57247. $2=$recv($3).__eq($4);
  57248. $ctx1.sendIdx["="]=2;
  57249. $self._deny_($2);
  57250. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  57251. $ctx1.sendIdx["fromMilliseconds:"]=2;
  57252. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  57253. $ctx1.sendIdx["fromMilliseconds:"]=3;
  57254. $5=$recv($6).__eq($7);
  57255. $ctx1.sendIdx["="]=3;
  57256. $self._assert_($5);
  57257. $ctx1.sendIdx["assert:"]=2;
  57258. $9=now;
  57259. $11=$recv(now)._asMilliseconds();
  57260. $ctx1.sendIdx["asMilliseconds"]=1;
  57261. $10=$recv($globals.Date)._fromMilliseconds_($11);
  57262. $ctx1.sendIdx["fromMilliseconds:"]=4;
  57263. $8=$recv($9).__eq($10);
  57264. $ctx1.sendIdx["="]=4;
  57265. $self._assert_($8);
  57266. $ctx1.sendIdx["assert:"]=3;
  57267. $self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  57268. return self;
  57269. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  57270. },
  57271. args: [],
  57272. 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",
  57273. referencedClasses: ["Date"],
  57274. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  57275. }),
  57276. $globals.DateTest);
  57277. $core.addMethod(
  57278. $core.method({
  57279. selector: "testIdentity",
  57280. protocol: "tests",
  57281. fn: function (){
  57282. var self=this,$self=this;
  57283. var now;
  57284. return $core.withContext(function($ctx1) {
  57285. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  57286. now=$recv($globals.Date)._new();
  57287. $1=$recv(now).__eq_eq(now);
  57288. $ctx1.sendIdx["=="]=1;
  57289. $self._assert_($1);
  57290. $3=now;
  57291. $4=$recv($globals.Date)._fromMilliseconds_((0));
  57292. $ctx1.sendIdx["fromMilliseconds:"]=1;
  57293. $2=$recv($3).__eq_eq($4);
  57294. $ctx1.sendIdx["=="]=2;
  57295. $self._deny_($2);
  57296. $ctx1.sendIdx["deny:"]=1;
  57297. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  57298. $ctx1.sendIdx["fromMilliseconds:"]=2;
  57299. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  57300. $ctx1.sendIdx["fromMilliseconds:"]=3;
  57301. $5=$recv($6).__eq_eq($7);
  57302. $ctx1.sendIdx["=="]=3;
  57303. $self._deny_($5);
  57304. $ctx1.sendIdx["deny:"]=2;
  57305. $9=now;
  57306. $11=$recv(now)._asMilliseconds();
  57307. $ctx1.sendIdx["asMilliseconds"]=1;
  57308. $10=$recv($globals.Date)._fromMilliseconds_($11);
  57309. $ctx1.sendIdx["fromMilliseconds:"]=4;
  57310. $8=$recv($9).__eq_eq($10);
  57311. $ctx1.sendIdx["=="]=4;
  57312. $self._deny_($8);
  57313. $ctx1.sendIdx["deny:"]=3;
  57314. $self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  57315. return self;
  57316. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  57317. },
  57318. args: [],
  57319. 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",
  57320. referencedClasses: ["Date"],
  57321. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  57322. }),
  57323. $globals.DateTest);
  57324. $core.addClass("JSObjectProxyTest", $globals.TestCase, [], "Kernel-Tests");
  57325. $core.addMethod(
  57326. $core.method({
  57327. selector: "jsObject",
  57328. protocol: "accessing",
  57329. fn: function (){
  57330. var self=this,$self=this;
  57331. return $core.withContext(function($ctx1) {
  57332. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  57333. return self;
  57334. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  57335. },
  57336. args: [],
  57337. 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}'>",
  57338. referencedClasses: [],
  57339. messageSends: []
  57340. }),
  57341. $globals.JSObjectProxyTest);
  57342. $core.addMethod(
  57343. $core.method({
  57344. selector: "jsUndefined",
  57345. protocol: "accessing",
  57346. fn: function (){
  57347. var self=this,$self=this;
  57348. return $core.withContext(function($ctx1) {
  57349. return;
  57350. return self;
  57351. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  57352. },
  57353. args: [],
  57354. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  57355. referencedClasses: [],
  57356. messageSends: []
  57357. }),
  57358. $globals.JSObjectProxyTest);
  57359. $core.addMethod(
  57360. $core.method({
  57361. selector: "testAtIfAbsent",
  57362. protocol: "tests",
  57363. fn: function (){
  57364. var self=this,$self=this;
  57365. var testObject;
  57366. return $core.withContext(function($ctx1) {
  57367. var $1,$2,$3;
  57368. testObject=$self._jsObject();
  57369. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  57370. return "Property does not exist";
  57371. }));
  57372. $ctx1.sendIdx["at:ifAbsent:"]=1;
  57373. $self._assert_equals_($1,"Property does not exist");
  57374. $ctx1.sendIdx["assert:equals:"]=1;
  57375. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  57376. return "Property does not exist";
  57377. }));
  57378. $ctx1.sendIdx["at:ifAbsent:"]=2;
  57379. $self._assert_equals_($2,nil);
  57380. $ctx1.sendIdx["assert:equals:"]=2;
  57381. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  57382. return "Property does not exist";
  57383. }));
  57384. $ctx1.sendIdx["at:ifAbsent:"]=3;
  57385. $self._assert_equals_($3,(1));
  57386. $ctx1.sendIdx["assert:equals:"]=3;
  57387. $self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  57388. return "Property does not exist";
  57389. })),nil);
  57390. return self;
  57391. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57392. },
  57393. args: [],
  57394. 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.",
  57395. referencedClasses: [],
  57396. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  57397. }),
  57398. $globals.JSObjectProxyTest);
  57399. $core.addMethod(
  57400. $core.method({
  57401. selector: "testAtIfPresent",
  57402. protocol: "tests",
  57403. fn: function (){
  57404. var self=this,$self=this;
  57405. var testObject;
  57406. return $core.withContext(function($ctx1) {
  57407. var $2,$1,$4,$3,$6,$5;
  57408. testObject=$self._jsObject();
  57409. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  57410. return $core.withContext(function($ctx2) {
  57411. $2=$recv(x)._asString();
  57412. $ctx2.sendIdx["asString"]=1;
  57413. return "hello ".__comma($2);
  57414. $ctx2.sendIdx[","]=1;
  57415. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57416. }));
  57417. $ctx1.sendIdx["at:ifPresent:"]=1;
  57418. $self._assert_equals_($1,nil);
  57419. $ctx1.sendIdx["assert:equals:"]=1;
  57420. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  57421. return $core.withContext(function($ctx2) {
  57422. $4=$recv(x)._asString();
  57423. $ctx2.sendIdx["asString"]=2;
  57424. return "hello ".__comma($4);
  57425. $ctx2.sendIdx[","]=2;
  57426. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  57427. }));
  57428. $ctx1.sendIdx["at:ifPresent:"]=2;
  57429. $self._assert_equals_($3,"hello nil");
  57430. $ctx1.sendIdx["assert:equals:"]=2;
  57431. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  57432. return $core.withContext(function($ctx2) {
  57433. $6=$recv(x)._asString();
  57434. $ctx2.sendIdx["asString"]=3;
  57435. return "hello ".__comma($6);
  57436. $ctx2.sendIdx[","]=3;
  57437. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57438. }));
  57439. $ctx1.sendIdx["at:ifPresent:"]=3;
  57440. $self._assert_equals_($5,"hello 1");
  57441. $ctx1.sendIdx["assert:equals:"]=3;
  57442. $self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  57443. return $core.withContext(function($ctx2) {
  57444. return "hello ".__comma($recv(x)._asString());
  57445. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  57446. })),"hello nil");
  57447. return self;
  57448. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57449. },
  57450. args: [],
  57451. 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'.",
  57452. referencedClasses: [],
  57453. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  57454. }),
  57455. $globals.JSObjectProxyTest);
  57456. $core.addMethod(
  57457. $core.method({
  57458. selector: "testAtIfPresentIfAbsent",
  57459. protocol: "tests",
  57460. fn: function (){
  57461. var self=this,$self=this;
  57462. var testObject;
  57463. return $core.withContext(function($ctx1) {
  57464. var $2,$1,$4,$3,$6,$5;
  57465. testObject=$self._jsObject();
  57466. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  57467. return $core.withContext(function($ctx2) {
  57468. $2=$recv(x)._asString();
  57469. $ctx2.sendIdx["asString"]=1;
  57470. return "hello ".__comma($2);
  57471. $ctx2.sendIdx[","]=1;
  57472. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57473. }),(function(){
  57474. return "not present";
  57475. }));
  57476. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  57477. $self._assert_equals_($1,"not present");
  57478. $ctx1.sendIdx["assert:equals:"]=1;
  57479. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  57480. return $core.withContext(function($ctx2) {
  57481. $4=$recv(x)._asString();
  57482. $ctx2.sendIdx["asString"]=2;
  57483. return "hello ".__comma($4);
  57484. $ctx2.sendIdx[","]=2;
  57485. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57486. }),(function(){
  57487. return "not present";
  57488. }));
  57489. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  57490. $self._assert_equals_($3,"hello nil");
  57491. $ctx1.sendIdx["assert:equals:"]=2;
  57492. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  57493. return $core.withContext(function($ctx2) {
  57494. $6=$recv(x)._asString();
  57495. $ctx2.sendIdx["asString"]=3;
  57496. return "hello ".__comma($6);
  57497. $ctx2.sendIdx[","]=3;
  57498. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  57499. }),(function(){
  57500. return "not present";
  57501. }));
  57502. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  57503. $self._assert_equals_($5,"hello 1");
  57504. $ctx1.sendIdx["assert:equals:"]=3;
  57505. $self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  57506. return $core.withContext(function($ctx2) {
  57507. return "hello ".__comma($recv(x)._asString());
  57508. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  57509. }),(function(){
  57510. return "not present";
  57511. })),"hello nil");
  57512. return self;
  57513. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57514. },
  57515. args: [],
  57516. 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'.",
  57517. referencedClasses: [],
  57518. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  57519. }),
  57520. $globals.JSObjectProxyTest);
  57521. $core.addMethod(
  57522. $core.method({
  57523. selector: "testAtPut",
  57524. protocol: "tests",
  57525. fn: function (){
  57526. var self=this,$self=this;
  57527. var testObject;
  57528. return $core.withContext(function($ctx1) {
  57529. var $2,$1;
  57530. testObject=$self._jsObject();
  57531. $2=$recv(testObject)._at_("abc");
  57532. $ctx1.sendIdx["at:"]=1;
  57533. $1=$recv($2).__tild_eq("xyz");
  57534. $self._assert_($1);
  57535. $self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  57536. $ctx1.sendIdx["assert:equals:"]=1;
  57537. $self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  57538. return self;
  57539. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  57540. },
  57541. args: [],
  57542. 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'",
  57543. referencedClasses: [],
  57544. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  57545. }),
  57546. $globals.JSObjectProxyTest);
  57547. $core.addMethod(
  57548. $core.method({
  57549. selector: "testComparison",
  57550. protocol: "tests",
  57551. fn: function (){
  57552. var self=this,$self=this;
  57553. return $core.withContext(function($ctx1) {
  57554. var $1,$2;
  57555. $self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  57556. $1=$recv(console).__eq(console);
  57557. $ctx1.sendIdx["="]=1;
  57558. $self._assert_($1);
  57559. $2=$recv(console).__eq($recv($globals.Object)._new());
  57560. $ctx1.sendIdx["="]=2;
  57561. $self._deny_($2);
  57562. $ctx1.sendIdx["deny:"]=1;
  57563. $self._deny_($recv(console).__eq($self._jsObject()));
  57564. return self;
  57565. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  57566. },
  57567. args: [],
  57568. 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",
  57569. referencedClasses: ["Object"],
  57570. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  57571. }),
  57572. $globals.JSObjectProxyTest);
  57573. $core.addMethod(
  57574. $core.method({
  57575. selector: "testDNU",
  57576. protocol: "tests",
  57577. fn: function (){
  57578. var self=this,$self=this;
  57579. return $core.withContext(function($ctx1) {
  57580. $self._should_raise_((function(){
  57581. return $core.withContext(function($ctx2) {
  57582. return $recv($self._jsObject())._foo();
  57583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57584. }),$globals.MessageNotUnderstood);
  57585. return self;
  57586. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  57587. },
  57588. args: [],
  57589. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  57590. referencedClasses: ["MessageNotUnderstood"],
  57591. messageSends: ["should:raise:", "foo", "jsObject"]
  57592. }),
  57593. $globals.JSObjectProxyTest);
  57594. $core.addMethod(
  57595. $core.method({
  57596. selector: "testDNUWithAllowJavaScriptCalls",
  57597. protocol: "tests",
  57598. fn: function (){
  57599. var self=this,$self=this;
  57600. var jsObject;
  57601. return $core.withContext(function($ctx1) {
  57602. jsObject=[];
  57603. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  57604. $self._should_raise_((function(){
  57605. return $core.withContext(function($ctx2) {
  57606. return $recv(jsObject)._foo();
  57607. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57608. }),$globals.MessageNotUnderstood);
  57609. return self;
  57610. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57611. },
  57612. args: [],
  57613. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  57614. referencedClasses: ["MessageNotUnderstood"],
  57615. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  57616. }),
  57617. $globals.JSObjectProxyTest);
  57618. $core.addMethod(
  57619. $core.method({
  57620. selector: "testMessageSend",
  57621. protocol: "tests",
  57622. fn: function (){
  57623. var self=this,$self=this;
  57624. return $core.withContext(function($ctx1) {
  57625. var $2,$1,$4,$3;
  57626. $2=$self._jsObject();
  57627. $ctx1.sendIdx["jsObject"]=1;
  57628. $1=$recv($2)._a();
  57629. $self._assert_equals_($1,(1));
  57630. $ctx1.sendIdx["assert:equals:"]=1;
  57631. $4=$self._jsObject();
  57632. $ctx1.sendIdx["jsObject"]=2;
  57633. $3=$recv($4)._b();
  57634. $self._assert_equals_($3,(2));
  57635. $ctx1.sendIdx["assert:equals:"]=2;
  57636. $self._assert_equals_($recv($self._jsObject())._c_((3)),(3));
  57637. return self;
  57638. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  57639. },
  57640. args: [],
  57641. 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",
  57642. referencedClasses: [],
  57643. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  57644. }),
  57645. $globals.JSObjectProxyTest);
  57646. $core.addMethod(
  57647. $core.method({
  57648. selector: "testMethodWithArguments",
  57649. protocol: "tests",
  57650. fn: function (){
  57651. var self=this,$self=this;
  57652. return $core.withContext(function($ctx1) {
  57653. $self._assert_equals_($recv($self._jsObject())._c_((1)),(1));
  57654. return self;
  57655. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  57656. },
  57657. args: [],
  57658. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  57659. referencedClasses: [],
  57660. messageSends: ["assert:equals:", "c:", "jsObject"]
  57661. }),
  57662. $globals.JSObjectProxyTest);
  57663. $core.addMethod(
  57664. $core.method({
  57665. selector: "testNull",
  57666. protocol: "tests",
  57667. fn: function (){
  57668. var self=this,$self=this;
  57669. return $core.withContext(function($ctx1) {
  57670. var $2,$1;
  57671. $2=$recv($globals.JSObjectProxy)._null();
  57672. $ctx1.sendIdx["null"]=1;
  57673. $1=$recv($2)._isNil();
  57674. $self._assert_($1);
  57675. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._null()])),"{\x22foo\x22:null}");
  57676. return self;
  57677. }, function($ctx1) {$ctx1.fill(self,"testNull",{},$globals.JSObjectProxyTest)});
  57678. },
  57679. args: [],
  57680. source: "testNull\x0a\x09self assert: JSObjectProxy null isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy null})\x0a\x09\x09equals: '{\x22foo\x22:null}'",
  57681. referencedClasses: ["JSObjectProxy", "JSON"],
  57682. messageSends: ["assert:", "isNil", "null", "assert:equals:", "stringify:"]
  57683. }),
  57684. $globals.JSObjectProxyTest);
  57685. $core.addMethod(
  57686. $core.method({
  57687. selector: "testPrinting",
  57688. protocol: "tests",
  57689. fn: function (){
  57690. var self=this,$self=this;
  57691. return $core.withContext(function($ctx1) {
  57692. $self._assert_equals_($recv($self._jsObject())._printString(),"[object Object]");
  57693. return self;
  57694. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  57695. },
  57696. args: [],
  57697. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  57698. referencedClasses: [],
  57699. messageSends: ["assert:equals:", "printString", "jsObject"]
  57700. }),
  57701. $globals.JSObjectProxyTest);
  57702. $core.addMethod(
  57703. $core.method({
  57704. selector: "testPropertyThatReturnsEmptyString",
  57705. protocol: "tests",
  57706. fn: function (){
  57707. var self=this,$self=this;
  57708. var object;
  57709. return $core.withContext(function($ctx1) {
  57710. var $1;
  57711. object=$self._jsObject();
  57712. $1=$recv(object)._d();
  57713. $ctx1.sendIdx["d"]=1;
  57714. $self._assert_equals_($1,"");
  57715. $ctx1.sendIdx["assert:equals:"]=1;
  57716. $recv(object)._d_("hello");
  57717. $self._assert_equals_($recv(object)._d(),"hello");
  57718. return self;
  57719. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  57720. },
  57721. args: [],
  57722. 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'",
  57723. referencedClasses: [],
  57724. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  57725. }),
  57726. $globals.JSObjectProxyTest);
  57727. $core.addMethod(
  57728. $core.method({
  57729. selector: "testPropertyThatReturnsUndefined",
  57730. protocol: "tests",
  57731. fn: function (){
  57732. var self=this,$self=this;
  57733. var object;
  57734. return $core.withContext(function($ctx1) {
  57735. object=$self._jsObject();
  57736. $self._shouldnt_raise_((function(){
  57737. return $core.withContext(function($ctx2) {
  57738. return $recv(object)._e();
  57739. $ctx2.sendIdx["e"]=1;
  57740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57741. }),$globals.MessageNotUnderstood);
  57742. $self._assert_($recv($recv(object)._e())._isNil());
  57743. return self;
  57744. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  57745. },
  57746. args: [],
  57747. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  57748. referencedClasses: ["MessageNotUnderstood"],
  57749. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  57750. }),
  57751. $globals.JSObjectProxyTest);
  57752. $core.addMethod(
  57753. $core.method({
  57754. selector: "testSetPropertyWithFalsyValue",
  57755. protocol: "tests",
  57756. fn: function (){
  57757. var self=this,$self=this;
  57758. var jsObject;
  57759. return $core.withContext(function($ctx1) {
  57760. var $1,$2,$3,$4,$5;
  57761. jsObject=$self._jsObject();
  57762. $1=$recv(jsObject)._a();
  57763. $ctx1.sendIdx["a"]=1;
  57764. $self._assert_equals_($1,(1));
  57765. $ctx1.sendIdx["assert:equals:"]=1;
  57766. $recv(jsObject)._a_($recv($globals.JSObjectProxy)._null());
  57767. $ctx1.sendIdx["a:"]=1;
  57768. $2=$recv(jsObject)._a();
  57769. $ctx1.sendIdx["a"]=2;
  57770. $self._assert_equals_($2,nil);
  57771. $ctx1.sendIdx["assert:equals:"]=2;
  57772. $recv(jsObject)._a_((0));
  57773. $ctx1.sendIdx["a:"]=2;
  57774. $3=$recv(jsObject)._a();
  57775. $ctx1.sendIdx["a"]=3;
  57776. $self._assert_equals_($3,(0));
  57777. $ctx1.sendIdx["assert:equals:"]=3;
  57778. $recv(jsObject)._a_($self._jsUndefined());
  57779. $ctx1.sendIdx["a:"]=3;
  57780. $4=$recv(jsObject)._a();
  57781. $ctx1.sendIdx["a"]=4;
  57782. $self._assert_equals_($4,nil);
  57783. $ctx1.sendIdx["assert:equals:"]=4;
  57784. $recv(jsObject)._a_("");
  57785. $ctx1.sendIdx["a:"]=4;
  57786. $5=$recv(jsObject)._a();
  57787. $ctx1.sendIdx["a"]=5;
  57788. $self._assert_equals_($5,"");
  57789. $ctx1.sendIdx["assert:equals:"]=5;
  57790. $recv(jsObject)._a_(false);
  57791. $self._assert_equals_($recv(jsObject)._a(),false);
  57792. return self;
  57793. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57794. },
  57795. args: [],
  57796. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: JSObjectProxy null.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  57797. referencedClasses: ["JSObjectProxy"],
  57798. messageSends: ["jsObject", "assert:equals:", "a", "a:", "null", "jsUndefined"]
  57799. }),
  57800. $globals.JSObjectProxyTest);
  57801. $core.addMethod(
  57802. $core.method({
  57803. selector: "testUndefined",
  57804. protocol: "tests",
  57805. fn: function (){
  57806. var self=this,$self=this;
  57807. return $core.withContext(function($ctx1) {
  57808. var $2,$1;
  57809. $2=$recv($globals.JSObjectProxy)._undefined();
  57810. $ctx1.sendIdx["undefined"]=1;
  57811. $1=$recv($2)._isNil();
  57812. $self._assert_($1);
  57813. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._undefined()])),"{}");
  57814. return self;
  57815. }, function($ctx1) {$ctx1.fill(self,"testUndefined",{},$globals.JSObjectProxyTest)});
  57816. },
  57817. args: [],
  57818. source: "testUndefined\x0a\x09self assert: JSObjectProxy undefined isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy undefined})\x0a\x09\x09equals: '{}'",
  57819. referencedClasses: ["JSObjectProxy", "JSON"],
  57820. messageSends: ["assert:", "isNil", "undefined", "assert:equals:", "stringify:"]
  57821. }),
  57822. $globals.JSObjectProxyTest);
  57823. $core.addMethod(
  57824. $core.method({
  57825. selector: "testValue",
  57826. protocol: "tests",
  57827. fn: function (){
  57828. var self=this,$self=this;
  57829. var testObject;
  57830. return $core.withContext(function($ctx1) {
  57831. testObject=$self._jsObject();
  57832. $recv(testObject)._at_put_("value","aValue");
  57833. $self._assert_equals_($recv(testObject)._value(),"aValue");
  57834. return self;
  57835. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  57836. },
  57837. args: [],
  57838. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  57839. referencedClasses: [],
  57840. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  57841. }),
  57842. $globals.JSObjectProxyTest);
  57843. $core.addMethod(
  57844. $core.method({
  57845. selector: "testYourself",
  57846. protocol: "tests",
  57847. fn: function (){
  57848. var self=this,$self=this;
  57849. var object;
  57850. return $core.withContext(function($ctx1) {
  57851. var $1;
  57852. $1=$self._jsObject();
  57853. $recv($1)._d_("test");
  57854. object=$recv($1)._yourself();
  57855. $self._assert_equals_($recv(object)._d(),"test");
  57856. return self;
  57857. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  57858. },
  57859. args: [],
  57860. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  57861. referencedClasses: [],
  57862. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  57863. }),
  57864. $globals.JSObjectProxyTest);
  57865. $core.addClass("JavaScriptExceptionTest", $globals.TestCase, [], "Kernel-Tests");
  57866. $core.addMethod(
  57867. $core.method({
  57868. selector: "testCatchingException",
  57869. protocol: "tests",
  57870. fn: function (){
  57871. var self=this,$self=this;
  57872. return $core.withContext(function($ctx1) {
  57873. $recv((function(){
  57874. return $core.withContext(function($ctx2) {
  57875. return $self._throwException();
  57876. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57877. }))._on_do_($globals.Error,(function(error){
  57878. return $core.withContext(function($ctx2) {
  57879. return $self._assert_($recv($recv(error)._exception()).__eq("test"));
  57880. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  57881. }));
  57882. return self;
  57883. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  57884. },
  57885. args: [],
  57886. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  57887. referencedClasses: ["Error"],
  57888. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  57889. }),
  57890. $globals.JavaScriptExceptionTest);
  57891. $core.addMethod(
  57892. $core.method({
  57893. selector: "testRaisingException",
  57894. protocol: "tests",
  57895. fn: function (){
  57896. var self=this,$self=this;
  57897. return $core.withContext(function($ctx1) {
  57898. $self._should_raise_((function(){
  57899. return $core.withContext(function($ctx2) {
  57900. return $self._throwException();
  57901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57902. }),$globals.JavaScriptException);
  57903. return self;
  57904. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  57905. },
  57906. args: [],
  57907. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  57908. referencedClasses: ["JavaScriptException"],
  57909. messageSends: ["should:raise:", "throwException"]
  57910. }),
  57911. $globals.JavaScriptExceptionTest);
  57912. $core.addMethod(
  57913. $core.method({
  57914. selector: "throwException",
  57915. protocol: "helpers",
  57916. fn: function (){
  57917. var self=this,$self=this;
  57918. return $core.withContext(function($ctx1) {
  57919. throw "test";
  57920. return self;
  57921. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  57922. },
  57923. args: [],
  57924. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  57925. referencedClasses: [],
  57926. messageSends: []
  57927. }),
  57928. $globals.JavaScriptExceptionTest);
  57929. $core.addClass("MessageSendTest", $globals.TestCase, [], "Kernel-Tests");
  57930. $core.addMethod(
  57931. $core.method({
  57932. selector: "testValue",
  57933. protocol: "tests",
  57934. fn: function (){
  57935. var self=this,$self=this;
  57936. var messageSend;
  57937. return $core.withContext(function($ctx1) {
  57938. var $1;
  57939. $1=$recv($globals.MessageSend)._new();
  57940. $ctx1.sendIdx["new"]=1;
  57941. $recv($1)._receiver_($recv($globals.Object)._new());
  57942. $recv($1)._selector_("asString");
  57943. messageSend=$recv($1)._yourself();
  57944. $self._assert_equals_($recv(messageSend)._value(),"an Object");
  57945. return self;
  57946. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  57947. },
  57948. args: [],
  57949. 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'",
  57950. referencedClasses: ["MessageSend", "Object"],
  57951. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  57952. }),
  57953. $globals.MessageSendTest);
  57954. $core.addMethod(
  57955. $core.method({
  57956. selector: "testValueWithArguments",
  57957. protocol: "tests",
  57958. fn: function (){
  57959. var self=this,$self=this;
  57960. var messageSend;
  57961. return $core.withContext(function($ctx1) {
  57962. var $1;
  57963. $1=$recv($globals.MessageSend)._new();
  57964. $recv($1)._receiver_((2));
  57965. $recv($1)._selector_("+");
  57966. messageSend=$recv($1)._yourself();
  57967. $self._assert_equals_($recv(messageSend)._value_((3)),(5));
  57968. $ctx1.sendIdx["assert:equals:"]=1;
  57969. $self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  57970. return self;
  57971. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  57972. },
  57973. args: [],
  57974. 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",
  57975. referencedClasses: ["MessageSend"],
  57976. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  57977. }),
  57978. $globals.MessageSendTest);
  57979. $core.addClass("MethodInheritanceTest", $globals.TestCase, ["receiverTop", "receiverMiddle", "receiverBottom", "method", "performBlock"], "Kernel-Tests");
  57980. $core.addMethod(
  57981. $core.method({
  57982. selector: "codeGeneratorClass",
  57983. protocol: "accessing",
  57984. fn: function (){
  57985. var self=this,$self=this;
  57986. return $globals.CodeGenerator;
  57987. },
  57988. args: [],
  57989. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  57990. referencedClasses: ["CodeGenerator"],
  57991. messageSends: []
  57992. }),
  57993. $globals.MethodInheritanceTest);
  57994. $core.addMethod(
  57995. $core.method({
  57996. selector: "compiler",
  57997. protocol: "factory",
  57998. fn: function (){
  57999. var self=this,$self=this;
  58000. return $core.withContext(function($ctx1) {
  58001. var $1;
  58002. $1=$recv($globals.Compiler)._new();
  58003. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  58004. return $recv($1)._yourself();
  58005. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  58006. },
  58007. args: [],
  58008. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  58009. referencedClasses: ["Compiler"],
  58010. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  58011. }),
  58012. $globals.MethodInheritanceTest);
  58013. $core.addMethod(
  58014. $core.method({
  58015. selector: "deinstallBottom",
  58016. protocol: "testing",
  58017. fn: function (){
  58018. var self=this,$self=this;
  58019. return $core.withContext(function($ctx1) {
  58020. $recv($self._targetClassBottom())._removeCompiledMethod_($self["@method"]);
  58021. return self;
  58022. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  58023. },
  58024. args: [],
  58025. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  58026. referencedClasses: [],
  58027. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  58028. }),
  58029. $globals.MethodInheritanceTest);
  58030. $core.addMethod(
  58031. $core.method({
  58032. selector: "deinstallMiddle",
  58033. protocol: "testing",
  58034. fn: function (){
  58035. var self=this,$self=this;
  58036. return $core.withContext(function($ctx1) {
  58037. $recv($self._targetClassMiddle())._removeCompiledMethod_($self["@method"]);
  58038. return self;
  58039. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  58040. },
  58041. args: [],
  58042. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  58043. referencedClasses: [],
  58044. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  58045. }),
  58046. $globals.MethodInheritanceTest);
  58047. $core.addMethod(
  58048. $core.method({
  58049. selector: "deinstallTop",
  58050. protocol: "testing",
  58051. fn: function (){
  58052. var self=this,$self=this;
  58053. return $core.withContext(function($ctx1) {
  58054. $recv($self._targetClassTop())._removeCompiledMethod_($self["@method"]);
  58055. return self;
  58056. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  58057. },
  58058. args: [],
  58059. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  58060. referencedClasses: [],
  58061. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  58062. }),
  58063. $globals.MethodInheritanceTest);
  58064. $core.addMethod(
  58065. $core.method({
  58066. selector: "installBottom:",
  58067. protocol: "testing",
  58068. fn: function (aString){
  58069. var self=this,$self=this;
  58070. return $core.withContext(function($ctx1) {
  58071. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassBottom(),"tests");
  58072. return self;
  58073. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  58074. },
  58075. args: ["aString"],
  58076. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  58077. referencedClasses: [],
  58078. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  58079. }),
  58080. $globals.MethodInheritanceTest);
  58081. $core.addMethod(
  58082. $core.method({
  58083. selector: "installMiddle:",
  58084. protocol: "testing",
  58085. fn: function (aString){
  58086. var self=this,$self=this;
  58087. return $core.withContext(function($ctx1) {
  58088. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassMiddle(),"tests");
  58089. return self;
  58090. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  58091. },
  58092. args: ["aString"],
  58093. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  58094. referencedClasses: [],
  58095. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  58096. }),
  58097. $globals.MethodInheritanceTest);
  58098. $core.addMethod(
  58099. $core.method({
  58100. selector: "installTop:",
  58101. protocol: "testing",
  58102. fn: function (aString){
  58103. var self=this,$self=this;
  58104. return $core.withContext(function($ctx1) {
  58105. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassTop(),"tests");
  58106. return self;
  58107. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  58108. },
  58109. args: ["aString"],
  58110. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  58111. referencedClasses: [],
  58112. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  58113. }),
  58114. $globals.MethodInheritanceTest);
  58115. $core.addMethod(
  58116. $core.method({
  58117. selector: "setUp",
  58118. protocol: "initialization",
  58119. fn: function (){
  58120. var self=this,$self=this;
  58121. return $core.withContext(function($ctx1) {
  58122. $self["@receiverTop"]=$recv($self._targetClassTop())._new();
  58123. $ctx1.sendIdx["new"]=1;
  58124. $self["@receiverMiddle"]=$recv($self._targetClassMiddle())._new();
  58125. $ctx1.sendIdx["new"]=2;
  58126. $self["@receiverBottom"]=$recv($self._targetClassBottom())._new();
  58127. $self["@method"]=nil;
  58128. $self["@performBlock"]=(function(){
  58129. return $core.withContext(function($ctx2) {
  58130. return $self._error_("performBlock not initialized");
  58131. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58132. });
  58133. return self;
  58134. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  58135. },
  58136. args: [],
  58137. 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' ]",
  58138. referencedClasses: [],
  58139. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  58140. }),
  58141. $globals.MethodInheritanceTest);
  58142. $core.addMethod(
  58143. $core.method({
  58144. selector: "shouldMNU",
  58145. protocol: "testing",
  58146. fn: function (){
  58147. var self=this,$self=this;
  58148. return $core.withContext(function($ctx1) {
  58149. $self._shouldMNUTop();
  58150. $self._shouldMNUMiddle();
  58151. $self._shouldMNUBottom();
  58152. return self;
  58153. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  58154. },
  58155. args: [],
  58156. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  58157. referencedClasses: [],
  58158. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  58159. }),
  58160. $globals.MethodInheritanceTest);
  58161. $core.addMethod(
  58162. $core.method({
  58163. selector: "shouldMNUBottom",
  58164. protocol: "testing",
  58165. fn: function (){
  58166. var self=this,$self=this;
  58167. return $core.withContext(function($ctx1) {
  58168. $self._should_raise_((function(){
  58169. return $core.withContext(function($ctx2) {
  58170. return $recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58172. }),$globals.MessageNotUnderstood);
  58173. return self;
  58174. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  58175. },
  58176. args: [],
  58177. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  58178. referencedClasses: ["MessageNotUnderstood"],
  58179. messageSends: ["should:raise:", "value:"]
  58180. }),
  58181. $globals.MethodInheritanceTest);
  58182. $core.addMethod(
  58183. $core.method({
  58184. selector: "shouldMNUMiddle",
  58185. protocol: "testing",
  58186. fn: function (){
  58187. var self=this,$self=this;
  58188. return $core.withContext(function($ctx1) {
  58189. $self._should_raise_((function(){
  58190. return $core.withContext(function($ctx2) {
  58191. return $recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58193. }),$globals.MessageNotUnderstood);
  58194. return self;
  58195. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  58196. },
  58197. args: [],
  58198. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  58199. referencedClasses: ["MessageNotUnderstood"],
  58200. messageSends: ["should:raise:", "value:"]
  58201. }),
  58202. $globals.MethodInheritanceTest);
  58203. $core.addMethod(
  58204. $core.method({
  58205. selector: "shouldMNUTop",
  58206. protocol: "testing",
  58207. fn: function (){
  58208. var self=this,$self=this;
  58209. return $core.withContext(function($ctx1) {
  58210. $self._should_raise_((function(){
  58211. return $core.withContext(function($ctx2) {
  58212. return $recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58214. }),$globals.MessageNotUnderstood);
  58215. return self;
  58216. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  58217. },
  58218. args: [],
  58219. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  58220. referencedClasses: ["MessageNotUnderstood"],
  58221. messageSends: ["should:raise:", "value:"]
  58222. }),
  58223. $globals.MethodInheritanceTest);
  58224. $core.addMethod(
  58225. $core.method({
  58226. selector: "shouldReturn:",
  58227. protocol: "testing",
  58228. fn: function (anObject){
  58229. var self=this,$self=this;
  58230. var result;
  58231. return $core.withContext(function($ctx1) {
  58232. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58233. $ctx1.sendIdx["value:"]=1;
  58234. $self._assert_equals_(["top",anObject],["top",result]);
  58235. $ctx1.sendIdx["assert:equals:"]=1;
  58236. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58237. $ctx1.sendIdx["value:"]=2;
  58238. $self._assert_equals_(["middle",anObject],["middle",result]);
  58239. $ctx1.sendIdx["assert:equals:"]=2;
  58240. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58241. $self._assert_equals_(["bottom",anObject],["bottom",result]);
  58242. return self;
  58243. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  58244. },
  58245. args: ["anObject"],
  58246. 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 }",
  58247. referencedClasses: [],
  58248. messageSends: ["value:", "assert:equals:"]
  58249. }),
  58250. $globals.MethodInheritanceTest);
  58251. $core.addMethod(
  58252. $core.method({
  58253. selector: "shouldReturn:and:and:",
  58254. protocol: "testing",
  58255. fn: function (anObject,anObject2,anObject3){
  58256. var self=this,$self=this;
  58257. var result;
  58258. return $core.withContext(function($ctx1) {
  58259. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58260. $ctx1.sendIdx["value:"]=1;
  58261. $self._assert_equals_(["top",anObject],["top",result]);
  58262. $ctx1.sendIdx["assert:equals:"]=1;
  58263. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58264. $ctx1.sendIdx["value:"]=2;
  58265. $self._assert_equals_(["middle",anObject2],["middle",result]);
  58266. $ctx1.sendIdx["assert:equals:"]=2;
  58267. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58268. $self._assert_equals_(["bottom",anObject3],["bottom",result]);
  58269. return self;
  58270. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  58271. },
  58272. args: ["anObject", "anObject2", "anObject3"],
  58273. 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 }",
  58274. referencedClasses: [],
  58275. messageSends: ["value:", "assert:equals:"]
  58276. }),
  58277. $globals.MethodInheritanceTest);
  58278. $core.addMethod(
  58279. $core.method({
  58280. selector: "targetClassBottom",
  58281. protocol: "accessing",
  58282. fn: function (){
  58283. var self=this,$self=this;
  58284. return $globals.JavaScriptException;
  58285. },
  58286. args: [],
  58287. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  58288. referencedClasses: ["JavaScriptException"],
  58289. messageSends: []
  58290. }),
  58291. $globals.MethodInheritanceTest);
  58292. $core.addMethod(
  58293. $core.method({
  58294. selector: "targetClassMiddle",
  58295. protocol: "accessing",
  58296. fn: function (){
  58297. var self=this,$self=this;
  58298. return $globals.Error;
  58299. },
  58300. args: [],
  58301. source: "targetClassMiddle\x0a\x09^ Error",
  58302. referencedClasses: ["Error"],
  58303. messageSends: []
  58304. }),
  58305. $globals.MethodInheritanceTest);
  58306. $core.addMethod(
  58307. $core.method({
  58308. selector: "targetClassTop",
  58309. protocol: "accessing",
  58310. fn: function (){
  58311. var self=this,$self=this;
  58312. return $globals.Object;
  58313. },
  58314. args: [],
  58315. source: "targetClassTop\x0a\x09^ Object",
  58316. referencedClasses: ["Object"],
  58317. messageSends: []
  58318. }),
  58319. $globals.MethodInheritanceTest);
  58320. $core.addMethod(
  58321. $core.method({
  58322. selector: "tearDown",
  58323. protocol: "initialization",
  58324. fn: function (){
  58325. var self=this,$self=this;
  58326. return $core.withContext(function($ctx1) {
  58327. $recv((function(){
  58328. return $core.withContext(function($ctx2) {
  58329. return $self._deinstallTop();
  58330. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58331. }))._on_do_($globals.Error,(function(){
  58332. }));
  58333. $ctx1.sendIdx["on:do:"]=1;
  58334. $recv((function(){
  58335. return $core.withContext(function($ctx2) {
  58336. return $self._deinstallMiddle();
  58337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58338. }))._on_do_($globals.Error,(function(){
  58339. }));
  58340. $ctx1.sendIdx["on:do:"]=2;
  58341. $recv((function(){
  58342. return $core.withContext(function($ctx2) {
  58343. return $self._deinstallBottom();
  58344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58345. }))._on_do_($globals.Error,(function(){
  58346. }));
  58347. return self;
  58348. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  58349. },
  58350. args: [],
  58351. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  58352. referencedClasses: ["Error"],
  58353. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  58354. }),
  58355. $globals.MethodInheritanceTest);
  58356. $core.addMethod(
  58357. $core.method({
  58358. selector: "testMNU11",
  58359. protocol: "tests",
  58360. fn: function (){
  58361. var self=this,$self=this;
  58362. return $core.withContext(function($ctx1) {
  58363. $self["@performBlock"]=(function(x){
  58364. return $core.withContext(function($ctx2) {
  58365. return $recv(x)._foo();
  58366. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58367. });
  58368. $self._shouldMNU();
  58369. $ctx1.sendIdx["shouldMNU"]=1;
  58370. $self._installTop_("foo ^ false");
  58371. $ctx1.sendIdx["installTop:"]=1;
  58372. $self._installTop_("foo ^ true");
  58373. $self._deinstallTop();
  58374. $self._shouldMNU();
  58375. return self;
  58376. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  58377. },
  58378. args: [],
  58379. 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",
  58380. referencedClasses: [],
  58381. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  58382. }),
  58383. $globals.MethodInheritanceTest);
  58384. $core.addMethod(
  58385. $core.method({
  58386. selector: "testMNU22",
  58387. protocol: "tests",
  58388. fn: function (){
  58389. var self=this,$self=this;
  58390. return $core.withContext(function($ctx1) {
  58391. $self["@performBlock"]=(function(x){
  58392. return $core.withContext(function($ctx2) {
  58393. return $recv(x)._foo();
  58394. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58395. });
  58396. $self._shouldMNU();
  58397. $ctx1.sendIdx["shouldMNU"]=1;
  58398. $self._installMiddle_("foo ^ false");
  58399. $ctx1.sendIdx["installMiddle:"]=1;
  58400. $self._installMiddle_("foo ^ true");
  58401. $self._deinstallMiddle();
  58402. $self._shouldMNU();
  58403. return self;
  58404. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  58405. },
  58406. args: [],
  58407. 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",
  58408. referencedClasses: [],
  58409. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  58410. }),
  58411. $globals.MethodInheritanceTest);
  58412. $core.addMethod(
  58413. $core.method({
  58414. selector: "testReturns1",
  58415. protocol: "tests",
  58416. fn: function (){
  58417. var self=this,$self=this;
  58418. return $core.withContext(function($ctx1) {
  58419. $self["@performBlock"]=(function(x){
  58420. return $core.withContext(function($ctx2) {
  58421. return $recv(x)._foo();
  58422. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58423. });
  58424. $self._installTop_("foo ^ false");
  58425. $ctx1.sendIdx["installTop:"]=1;
  58426. $self._shouldReturn_(false);
  58427. $ctx1.sendIdx["shouldReturn:"]=1;
  58428. $self._installTop_("foo ^ true");
  58429. $self._shouldReturn_(true);
  58430. return self;
  58431. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  58432. },
  58433. args: [],
  58434. 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",
  58435. referencedClasses: [],
  58436. messageSends: ["foo", "installTop:", "shouldReturn:"]
  58437. }),
  58438. $globals.MethodInheritanceTest);
  58439. $core.addClass("NumberTest", $globals.TestCase, [], "Kernel-Tests");
  58440. $core.addMethod(
  58441. $core.method({
  58442. selector: "testAbs",
  58443. protocol: "tests",
  58444. fn: function (){
  58445. var self=this,$self=this;
  58446. return $core.withContext(function($ctx1) {
  58447. var $1;
  58448. $1=(4)._abs();
  58449. $ctx1.sendIdx["abs"]=1;
  58450. $self._assert_equals_($1,(4));
  58451. $ctx1.sendIdx["assert:equals:"]=1;
  58452. $self._assert_equals_((-4)._abs(),(4));
  58453. return self;
  58454. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  58455. },
  58456. args: [],
  58457. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  58458. referencedClasses: [],
  58459. messageSends: ["assert:equals:", "abs"]
  58460. }),
  58461. $globals.NumberTest);
  58462. $core.addMethod(
  58463. $core.method({
  58464. selector: "testArithmetic",
  58465. protocol: "tests",
  58466. fn: function (){
  58467. var self=this,$self=this;
  58468. return $core.withContext(function($ctx1) {
  58469. var $1,$2,$3,$5,$4;
  58470. $1=(1.5).__plus((1));
  58471. $ctx1.sendIdx["+"]=1;
  58472. $self._assert_equals_($1,(2.5));
  58473. $ctx1.sendIdx["assert:equals:"]=1;
  58474. $2=(2).__minus((1));
  58475. $ctx1.sendIdx["-"]=1;
  58476. $self._assert_equals_($2,(1));
  58477. $ctx1.sendIdx["assert:equals:"]=2;
  58478. $self._assert_equals_((-2).__minus((1)),(-3));
  58479. $ctx1.sendIdx["assert:equals:"]=3;
  58480. $self._assert_equals_((12).__slash((2)),(6));
  58481. $ctx1.sendIdx["assert:equals:"]=4;
  58482. $3=(3).__star((4));
  58483. $ctx1.sendIdx["*"]=1;
  58484. $self._assert_equals_($3,(12));
  58485. $ctx1.sendIdx["assert:equals:"]=5;
  58486. $self._assert_equals_((7).__slash_slash((2)),(3));
  58487. $ctx1.sendIdx["assert:equals:"]=6;
  58488. $self._assert_equals_((7).__backslash_backslash((2)),(1));
  58489. $ctx1.sendIdx["assert:equals:"]=7;
  58490. $5=(1).__plus((2));
  58491. $ctx1.sendIdx["+"]=2;
  58492. $4=$recv($5).__star((3));
  58493. $ctx1.sendIdx["*"]=2;
  58494. $self._assert_equals_($4,(9));
  58495. $ctx1.sendIdx["assert:equals:"]=8;
  58496. $self._assert_equals_((1).__plus((2).__star((3))),(7));
  58497. return self;
  58498. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  58499. },
  58500. args: [],
  58501. 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",
  58502. referencedClasses: [],
  58503. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  58504. }),
  58505. $globals.NumberTest);
  58506. $core.addMethod(
  58507. $core.method({
  58508. selector: "testAsNumber",
  58509. protocol: "tests",
  58510. fn: function (){
  58511. var self=this,$self=this;
  58512. return $core.withContext(function($ctx1) {
  58513. $self._assert_equals_((3)._asNumber(),(3));
  58514. return self;
  58515. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  58516. },
  58517. args: [],
  58518. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  58519. referencedClasses: [],
  58520. messageSends: ["assert:equals:", "asNumber"]
  58521. }),
  58522. $globals.NumberTest);
  58523. $core.addMethod(
  58524. $core.method({
  58525. selector: "testBetweenAnd",
  58526. protocol: "tests",
  58527. fn: function (){
  58528. var self=this,$self=this;
  58529. return $core.withContext(function($ctx1) {
  58530. var $1,$3,$2,$5,$4;
  58531. $1=(4)._between_and_((3),(5));
  58532. $ctx1.sendIdx["between:and:"]=1;
  58533. $self._assert_($1);
  58534. $ctx1.sendIdx["assert:"]=1;
  58535. $3=(1)._between_and_((5),(6));
  58536. $ctx1.sendIdx["between:and:"]=2;
  58537. $2=$recv($3)._not();
  58538. $ctx1.sendIdx["not"]=1;
  58539. $self._assert_($2);
  58540. $ctx1.sendIdx["assert:"]=2;
  58541. $5=(90)._between_and_((67),(87));
  58542. $ctx1.sendIdx["between:and:"]=3;
  58543. $4=$recv($5)._not();
  58544. $self._assert_($4);
  58545. $ctx1.sendIdx["assert:"]=3;
  58546. $self._assert_((1)._between_and_((1),(1)));
  58547. return self;
  58548. }, function($ctx1) {$ctx1.fill(self,"testBetweenAnd",{},$globals.NumberTest)});
  58549. },
  58550. args: [],
  58551. 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).",
  58552. referencedClasses: [],
  58553. messageSends: ["assert:", "between:and:", "not"]
  58554. }),
  58555. $globals.NumberTest);
  58556. $core.addMethod(
  58557. $core.method({
  58558. selector: "testBitAnd",
  58559. protocol: "tests",
  58560. fn: function (){
  58561. var self=this,$self=this;
  58562. return $core.withContext(function($ctx1) {
  58563. var $1,$2;
  58564. $1=(15)._bitAnd_((2));
  58565. $ctx1.sendIdx["bitAnd:"]=1;
  58566. $self._assert_equals_($1,(2));
  58567. $ctx1.sendIdx["assert:equals:"]=1;
  58568. $2=(15)._bitAnd_((15));
  58569. $ctx1.sendIdx["bitAnd:"]=2;
  58570. $self._assert_equals_($2,(15));
  58571. $ctx1.sendIdx["assert:equals:"]=2;
  58572. $self._assert_equals_((-1)._bitAnd_((1021)),(1021));
  58573. return self;
  58574. }, function($ctx1) {$ctx1.fill(self,"testBitAnd",{},$globals.NumberTest)});
  58575. },
  58576. args: [],
  58577. source: "testBitAnd\x0a\x09self assert: (15 bitAnd: 2) equals: 2.\x0a\x09self assert: (15 bitAnd: 15) equals: 15.\x0a\x09self assert: (-1 bitAnd: 1021) equals: 1021",
  58578. referencedClasses: [],
  58579. messageSends: ["assert:equals:", "bitAnd:"]
  58580. }),
  58581. $globals.NumberTest);
  58582. $core.addMethod(
  58583. $core.method({
  58584. selector: "testBitNot",
  58585. protocol: "tests",
  58586. fn: function (){
  58587. var self=this,$self=this;
  58588. return $core.withContext(function($ctx1) {
  58589. var $1,$2;
  58590. $1=(2)._bitNot();
  58591. $ctx1.sendIdx["bitNot"]=1;
  58592. $self._assert_equals_($1,(-3));
  58593. $ctx1.sendIdx["assert:equals:"]=1;
  58594. $2=(-1)._bitNot();
  58595. $ctx1.sendIdx["bitNot"]=2;
  58596. $self._assert_equals_($2,(0));
  58597. $ctx1.sendIdx["assert:equals:"]=2;
  58598. $self._assert_equals_((-1022)._bitNot(),(1021));
  58599. return self;
  58600. }, function($ctx1) {$ctx1.fill(self,"testBitNot",{},$globals.NumberTest)});
  58601. },
  58602. args: [],
  58603. source: "testBitNot\x0a\x09self assert: 2 bitNot equals: -3.\x0a\x09self assert: -1 bitNot equals: 0.\x0a\x09self assert: -1022 bitNot equals: 1021",
  58604. referencedClasses: [],
  58605. messageSends: ["assert:equals:", "bitNot"]
  58606. }),
  58607. $globals.NumberTest);
  58608. $core.addMethod(
  58609. $core.method({
  58610. selector: "testBitOr",
  58611. protocol: "tests",
  58612. fn: function (){
  58613. var self=this,$self=this;
  58614. return $core.withContext(function($ctx1) {
  58615. var $1,$2;
  58616. $1=(2)._bitOr_((4));
  58617. $ctx1.sendIdx["bitOr:"]=1;
  58618. $self._assert_equals_($1,(6));
  58619. $ctx1.sendIdx["assert:equals:"]=1;
  58620. $2=(7)._bitOr_((2));
  58621. $ctx1.sendIdx["bitOr:"]=2;
  58622. $self._assert_equals_($2,(7));
  58623. $ctx1.sendIdx["assert:equals:"]=2;
  58624. $self._assert_equals_((-1)._bitOr_((1021)),(-1));
  58625. return self;
  58626. }, function($ctx1) {$ctx1.fill(self,"testBitOr",{},$globals.NumberTest)});
  58627. },
  58628. args: [],
  58629. source: "testBitOr\x0a\x09self assert: (2 bitOr: 4) equals: 6.\x0a\x09self assert: (7 bitOr: 2) equals: 7.\x0a\x09self assert: (-1 bitOr: 1021) equals: -1",
  58630. referencedClasses: [],
  58631. messageSends: ["assert:equals:", "bitOr:"]
  58632. }),
  58633. $globals.NumberTest);
  58634. $core.addMethod(
  58635. $core.method({
  58636. selector: "testBitXor",
  58637. protocol: "tests",
  58638. fn: function (){
  58639. var self=this,$self=this;
  58640. return $core.withContext(function($ctx1) {
  58641. var $1,$2,$3;
  58642. $1=(2)._bitXor_((4));
  58643. $ctx1.sendIdx["bitXor:"]=1;
  58644. $self._assert_equals_($1,(6));
  58645. $ctx1.sendIdx["assert:equals:"]=1;
  58646. $2=(7)._bitXor_((2));
  58647. $ctx1.sendIdx["bitXor:"]=2;
  58648. $self._assert_equals_($2,(5));
  58649. $ctx1.sendIdx["assert:equals:"]=2;
  58650. $3=(-1)._bitXor_((1021));
  58651. $ctx1.sendIdx["bitXor:"]=3;
  58652. $self._assert_equals_($3,(-1022));
  58653. $ctx1.sendIdx["assert:equals:"]=3;
  58654. $self._assert_equals_((91)._bitXor_((91)),(0));
  58655. return self;
  58656. }, function($ctx1) {$ctx1.fill(self,"testBitXor",{},$globals.NumberTest)});
  58657. },
  58658. args: [],
  58659. source: "testBitXor\x0a\x09self assert: (2 bitXor: 4) equals: 6.\x0a\x09self assert: (7 bitXor: 2) equals: 5.\x0a\x09self assert: (-1 bitXor: 1021) equals: -1022.\x0a\x09self assert: (91 bitXor: 91) equals: 0",
  58660. referencedClasses: [],
  58661. messageSends: ["assert:equals:", "bitXor:"]
  58662. }),
  58663. $globals.NumberTest);
  58664. $core.addMethod(
  58665. $core.method({
  58666. selector: "testCeiling",
  58667. protocol: "tests",
  58668. fn: function (){
  58669. var self=this,$self=this;
  58670. return $core.withContext(function($ctx1) {
  58671. var $1,$2;
  58672. $1=(1.2)._ceiling();
  58673. $ctx1.sendIdx["ceiling"]=1;
  58674. $self._assert_equals_($1,(2));
  58675. $ctx1.sendIdx["assert:equals:"]=1;
  58676. $2=(-1.2)._ceiling();
  58677. $ctx1.sendIdx["ceiling"]=2;
  58678. $self._assert_equals_($2,(-1));
  58679. $ctx1.sendIdx["assert:equals:"]=2;
  58680. $self._assert_equals_((1)._ceiling(),(1));
  58681. return self;
  58682. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  58683. },
  58684. args: [],
  58685. 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.",
  58686. referencedClasses: [],
  58687. messageSends: ["assert:equals:", "ceiling"]
  58688. }),
  58689. $globals.NumberTest);
  58690. $core.addMethod(
  58691. $core.method({
  58692. selector: "testComparison",
  58693. protocol: "tests",
  58694. fn: function (){
  58695. var self=this,$self=this;
  58696. return $core.withContext(function($ctx1) {
  58697. var $1,$2,$3,$4;
  58698. $1=(3).__gt((2));
  58699. $ctx1.sendIdx[">"]=1;
  58700. $self._assert_($1);
  58701. $ctx1.sendIdx["assert:"]=1;
  58702. $2=(2).__lt((3));
  58703. $ctx1.sendIdx["<"]=1;
  58704. $self._assert_($2);
  58705. $ctx1.sendIdx["assert:"]=2;
  58706. $self._deny_((3).__lt((2)));
  58707. $ctx1.sendIdx["deny:"]=1;
  58708. $self._deny_((2).__gt((3)));
  58709. $3=(3).__gt_eq((3));
  58710. $ctx1.sendIdx[">="]=1;
  58711. $self._assert_($3);
  58712. $ctx1.sendIdx["assert:"]=3;
  58713. $self._assert_((3.1).__gt_eq((3)));
  58714. $ctx1.sendIdx["assert:"]=4;
  58715. $4=(3).__lt_eq((3));
  58716. $ctx1.sendIdx["<="]=1;
  58717. $self._assert_($4);
  58718. $ctx1.sendIdx["assert:"]=5;
  58719. $self._assert_((3).__lt_eq((3.1)));
  58720. return self;
  58721. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  58722. },
  58723. args: [],
  58724. 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",
  58725. referencedClasses: [],
  58726. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  58727. }),
  58728. $globals.NumberTest);
  58729. $core.addMethod(
  58730. $core.method({
  58731. selector: "testCopying",
  58732. protocol: "tests",
  58733. fn: function (){
  58734. var self=this,$self=this;
  58735. return $core.withContext(function($ctx1) {
  58736. var $1;
  58737. $1=$recv((1)._copy()).__eq_eq((1));
  58738. $ctx1.sendIdx["=="]=1;
  58739. $self._assert_($1);
  58740. $ctx1.sendIdx["assert:"]=1;
  58741. $self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  58742. return self;
  58743. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  58744. },
  58745. args: [],
  58746. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  58747. referencedClasses: [],
  58748. messageSends: ["assert:", "==", "copy", "deepCopy"]
  58749. }),
  58750. $globals.NumberTest);
  58751. $core.addMethod(
  58752. $core.method({
  58753. selector: "testDegreesToRadians",
  58754. protocol: "tests",
  58755. fn: function (){
  58756. var self=this,$self=this;
  58757. return $core.withContext(function($ctx1) {
  58758. $self._assert_($recv($recv($recv((180)._degreesToRadians()).__minus($recv($globals.Number)._pi()))._abs()).__lt_eq((0.01)));
  58759. return self;
  58760. }, function($ctx1) {$ctx1.fill(self,"testDegreesToRadians",{},$globals.NumberTest)});
  58761. },
  58762. args: [],
  58763. source: "testDegreesToRadians\x0a\x09self assert: (180 degreesToRadians - Number pi) abs <= 0.01.",
  58764. referencedClasses: ["Number"],
  58765. messageSends: ["assert:", "<=", "abs", "-", "degreesToRadians", "pi"]
  58766. }),
  58767. $globals.NumberTest);
  58768. $core.addMethod(
  58769. $core.method({
  58770. selector: "testEquality",
  58771. protocol: "tests",
  58772. fn: function (){
  58773. var self=this,$self=this;
  58774. return $core.withContext(function($ctx1) {
  58775. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  58776. $1=(1).__eq((1));
  58777. $ctx1.sendIdx["="]=1;
  58778. $self._assert_($1);
  58779. $ctx1.sendIdx["assert:"]=1;
  58780. $2=(0).__eq((0));
  58781. $ctx1.sendIdx["="]=2;
  58782. $self._assert_($2);
  58783. $ctx1.sendIdx["assert:"]=2;
  58784. $3=(1).__eq((0));
  58785. $ctx1.sendIdx["="]=3;
  58786. $self._deny_($3);
  58787. $ctx1.sendIdx["deny:"]=1;
  58788. $5=(1)._yourself();
  58789. $ctx1.sendIdx["yourself"]=1;
  58790. $4=$recv($5).__eq((1));
  58791. $ctx1.sendIdx["="]=4;
  58792. $self._assert_($4);
  58793. $ctx1.sendIdx["assert:"]=3;
  58794. $7=(1)._yourself();
  58795. $ctx1.sendIdx["yourself"]=2;
  58796. $6=(1).__eq($7);
  58797. $ctx1.sendIdx["="]=5;
  58798. $self._assert_($6);
  58799. $ctx1.sendIdx["assert:"]=4;
  58800. $9=(1)._yourself();
  58801. $ctx1.sendIdx["yourself"]=3;
  58802. $8=$recv($9).__eq((1)._yourself());
  58803. $ctx1.sendIdx["="]=6;
  58804. $self._assert_($8);
  58805. $10=(0).__eq(false);
  58806. $ctx1.sendIdx["="]=7;
  58807. $self._deny_($10);
  58808. $ctx1.sendIdx["deny:"]=2;
  58809. $11=false.__eq((0));
  58810. $ctx1.sendIdx["="]=8;
  58811. $self._deny_($11);
  58812. $ctx1.sendIdx["deny:"]=3;
  58813. $12="".__eq((0));
  58814. $ctx1.sendIdx["="]=9;
  58815. $self._deny_($12);
  58816. $ctx1.sendIdx["deny:"]=4;
  58817. $self._deny_((0).__eq(""));
  58818. return self;
  58819. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  58820. },
  58821. args: [],
  58822. 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 = ''",
  58823. referencedClasses: [],
  58824. messageSends: ["assert:", "=", "deny:", "yourself"]
  58825. }),
  58826. $globals.NumberTest);
  58827. $core.addMethod(
  58828. $core.method({
  58829. selector: "testFloor",
  58830. protocol: "tests",
  58831. fn: function (){
  58832. var self=this,$self=this;
  58833. return $core.withContext(function($ctx1) {
  58834. var $1,$2;
  58835. $1=(1.2)._floor();
  58836. $ctx1.sendIdx["floor"]=1;
  58837. $self._assert_equals_($1,(1));
  58838. $ctx1.sendIdx["assert:equals:"]=1;
  58839. $2=(-1.2)._floor();
  58840. $ctx1.sendIdx["floor"]=2;
  58841. $self._assert_equals_($2,(-2));
  58842. $ctx1.sendIdx["assert:equals:"]=2;
  58843. $self._assert_equals_((1)._floor(),(1));
  58844. return self;
  58845. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  58846. },
  58847. args: [],
  58848. 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.",
  58849. referencedClasses: [],
  58850. messageSends: ["assert:equals:", "floor"]
  58851. }),
  58852. $globals.NumberTest);
  58853. $core.addMethod(
  58854. $core.method({
  58855. selector: "testHexNumbers",
  58856. protocol: "tests",
  58857. fn: function (){
  58858. var self=this,$self=this;
  58859. return $core.withContext(function($ctx1) {
  58860. var $1,$2,$3,$4,$5;
  58861. $self._assert_equals_((9),(9));
  58862. $ctx1.sendIdx["assert:equals:"]=1;
  58863. $1=(10)._truncated();
  58864. $ctx1.sendIdx["truncated"]=1;
  58865. $self._assert_equals_($1,(10));
  58866. $ctx1.sendIdx["assert:equals:"]=2;
  58867. $2=(11)._truncated();
  58868. $ctx1.sendIdx["truncated"]=2;
  58869. $self._assert_equals_($2,(11));
  58870. $ctx1.sendIdx["assert:equals:"]=3;
  58871. $3=(12)._truncated();
  58872. $ctx1.sendIdx["truncated"]=3;
  58873. $self._assert_equals_($3,(12));
  58874. $ctx1.sendIdx["assert:equals:"]=4;
  58875. $4=(13)._truncated();
  58876. $ctx1.sendIdx["truncated"]=4;
  58877. $self._assert_equals_($4,(13));
  58878. $ctx1.sendIdx["assert:equals:"]=5;
  58879. $5=(14)._truncated();
  58880. $ctx1.sendIdx["truncated"]=5;
  58881. $self._assert_equals_($5,(14));
  58882. $ctx1.sendIdx["assert:equals:"]=6;
  58883. $self._assert_equals_((15)._truncated(),(15));
  58884. return self;
  58885. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  58886. },
  58887. args: [],
  58888. 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",
  58889. referencedClasses: [],
  58890. messageSends: ["assert:equals:", "truncated"]
  58891. }),
  58892. $globals.NumberTest);
  58893. $core.addMethod(
  58894. $core.method({
  58895. selector: "testIdentity",
  58896. protocol: "tests",
  58897. fn: function (){
  58898. var self=this,$self=this;
  58899. return $core.withContext(function($ctx1) {
  58900. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  58901. $1=(1).__eq_eq((1));
  58902. $ctx1.sendIdx["=="]=1;
  58903. $self._assert_($1);
  58904. $ctx1.sendIdx["assert:"]=1;
  58905. $2=(0).__eq_eq((0));
  58906. $ctx1.sendIdx["=="]=2;
  58907. $self._assert_($2);
  58908. $ctx1.sendIdx["assert:"]=2;
  58909. $3=(1).__eq_eq((0));
  58910. $ctx1.sendIdx["=="]=3;
  58911. $self._deny_($3);
  58912. $ctx1.sendIdx["deny:"]=1;
  58913. $5=(1)._yourself();
  58914. $ctx1.sendIdx["yourself"]=1;
  58915. $4=$recv($5).__eq_eq((1));
  58916. $ctx1.sendIdx["=="]=4;
  58917. $self._assert_($4);
  58918. $ctx1.sendIdx["assert:"]=3;
  58919. $7=(1)._yourself();
  58920. $ctx1.sendIdx["yourself"]=2;
  58921. $6=(1).__eq_eq($7);
  58922. $ctx1.sendIdx["=="]=5;
  58923. $self._assert_($6);
  58924. $ctx1.sendIdx["assert:"]=4;
  58925. $9=(1)._yourself();
  58926. $ctx1.sendIdx["yourself"]=3;
  58927. $8=$recv($9).__eq_eq((1)._yourself());
  58928. $ctx1.sendIdx["=="]=6;
  58929. $self._assert_($8);
  58930. $self._deny_((1).__eq_eq((2)));
  58931. return self;
  58932. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  58933. },
  58934. args: [],
  58935. 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",
  58936. referencedClasses: [],
  58937. messageSends: ["assert:", "==", "deny:", "yourself"]
  58938. }),
  58939. $globals.NumberTest);
  58940. $core.addMethod(
  58941. $core.method({
  58942. selector: "testInvalidHexNumbers",
  58943. protocol: "tests",
  58944. fn: function (){
  58945. var self=this,$self=this;
  58946. return $core.withContext(function($ctx1) {
  58947. $self._should_raise_((function(){
  58948. return $core.withContext(function($ctx2) {
  58949. return (16)._rG();
  58950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58951. }),$globals.MessageNotUnderstood);
  58952. $ctx1.sendIdx["should:raise:"]=1;
  58953. $self._should_raise_((function(){
  58954. return $core.withContext(function($ctx2) {
  58955. return (16)._rg();
  58956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58957. }),$globals.MessageNotUnderstood);
  58958. $ctx1.sendIdx["should:raise:"]=2;
  58959. $self._should_raise_((function(){
  58960. return $core.withContext(function($ctx2) {
  58961. return (16)._rH();
  58962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58963. }),$globals.MessageNotUnderstood);
  58964. $ctx1.sendIdx["should:raise:"]=3;
  58965. $self._should_raise_((function(){
  58966. return $core.withContext(function($ctx2) {
  58967. return (16)._rh();
  58968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  58969. }),$globals.MessageNotUnderstood);
  58970. $ctx1.sendIdx["should:raise:"]=4;
  58971. $self._should_raise_((function(){
  58972. return $core.withContext(function($ctx2) {
  58973. return (16)._rI();
  58974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58975. }),$globals.MessageNotUnderstood);
  58976. $ctx1.sendIdx["should:raise:"]=5;
  58977. $self._should_raise_((function(){
  58978. return $core.withContext(function($ctx2) {
  58979. return (16)._ri();
  58980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  58981. }),$globals.MessageNotUnderstood);
  58982. $ctx1.sendIdx["should:raise:"]=6;
  58983. $self._should_raise_((function(){
  58984. return $core.withContext(function($ctx2) {
  58985. return (16)._rJ();
  58986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  58987. }),$globals.MessageNotUnderstood);
  58988. $ctx1.sendIdx["should:raise:"]=7;
  58989. $self._should_raise_((function(){
  58990. return $core.withContext(function($ctx2) {
  58991. return (16)._rj();
  58992. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  58993. }),$globals.MessageNotUnderstood);
  58994. $ctx1.sendIdx["should:raise:"]=8;
  58995. $self._should_raise_((function(){
  58996. return $core.withContext(function($ctx2) {
  58997. return (16)._rK();
  58998. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  58999. }),$globals.MessageNotUnderstood);
  59000. $ctx1.sendIdx["should:raise:"]=9;
  59001. $self._should_raise_((function(){
  59002. return $core.withContext(function($ctx2) {
  59003. return (16)._rk();
  59004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  59005. }),$globals.MessageNotUnderstood);
  59006. $ctx1.sendIdx["should:raise:"]=10;
  59007. $self._should_raise_((function(){
  59008. return $core.withContext(function($ctx2) {
  59009. return (16)._rL();
  59010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  59011. }),$globals.MessageNotUnderstood);
  59012. $ctx1.sendIdx["should:raise:"]=11;
  59013. $self._should_raise_((function(){
  59014. return $core.withContext(function($ctx2) {
  59015. return (16)._rl();
  59016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  59017. }),$globals.MessageNotUnderstood);
  59018. $ctx1.sendIdx["should:raise:"]=12;
  59019. $self._should_raise_((function(){
  59020. return $core.withContext(function($ctx2) {
  59021. return (16)._rM();
  59022. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  59023. }),$globals.MessageNotUnderstood);
  59024. $ctx1.sendIdx["should:raise:"]=13;
  59025. $self._should_raise_((function(){
  59026. return $core.withContext(function($ctx2) {
  59027. return (16)._rm();
  59028. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  59029. }),$globals.MessageNotUnderstood);
  59030. $ctx1.sendIdx["should:raise:"]=14;
  59031. $self._should_raise_((function(){
  59032. return $core.withContext(function($ctx2) {
  59033. return (16)._rN();
  59034. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  59035. }),$globals.MessageNotUnderstood);
  59036. $ctx1.sendIdx["should:raise:"]=15;
  59037. $self._should_raise_((function(){
  59038. return $core.withContext(function($ctx2) {
  59039. return (16)._rn();
  59040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  59041. }),$globals.MessageNotUnderstood);
  59042. $ctx1.sendIdx["should:raise:"]=16;
  59043. $self._should_raise_((function(){
  59044. return $core.withContext(function($ctx2) {
  59045. return (16)._rO();
  59046. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  59047. }),$globals.MessageNotUnderstood);
  59048. $ctx1.sendIdx["should:raise:"]=17;
  59049. $self._should_raise_((function(){
  59050. return $core.withContext(function($ctx2) {
  59051. return (16)._ro();
  59052. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  59053. }),$globals.MessageNotUnderstood);
  59054. $ctx1.sendIdx["should:raise:"]=18;
  59055. $self._should_raise_((function(){
  59056. return $core.withContext(function($ctx2) {
  59057. return (16)._rP();
  59058. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  59059. }),$globals.MessageNotUnderstood);
  59060. $ctx1.sendIdx["should:raise:"]=19;
  59061. $self._should_raise_((function(){
  59062. return $core.withContext(function($ctx2) {
  59063. return (16)._rp();
  59064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  59065. }),$globals.MessageNotUnderstood);
  59066. $ctx1.sendIdx["should:raise:"]=20;
  59067. $self._should_raise_((function(){
  59068. return $core.withContext(function($ctx2) {
  59069. return (16)._rQ();
  59070. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  59071. }),$globals.MessageNotUnderstood);
  59072. $ctx1.sendIdx["should:raise:"]=21;
  59073. $self._should_raise_((function(){
  59074. return $core.withContext(function($ctx2) {
  59075. return (16)._rq();
  59076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  59077. }),$globals.MessageNotUnderstood);
  59078. $ctx1.sendIdx["should:raise:"]=22;
  59079. $self._should_raise_((function(){
  59080. return $core.withContext(function($ctx2) {
  59081. return (16)._rR();
  59082. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  59083. }),$globals.MessageNotUnderstood);
  59084. $ctx1.sendIdx["should:raise:"]=23;
  59085. $self._should_raise_((function(){
  59086. return $core.withContext(function($ctx2) {
  59087. return (16)._rr();
  59088. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  59089. }),$globals.MessageNotUnderstood);
  59090. $ctx1.sendIdx["should:raise:"]=24;
  59091. $self._should_raise_((function(){
  59092. return $core.withContext(function($ctx2) {
  59093. return (16)._rS();
  59094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  59095. }),$globals.MessageNotUnderstood);
  59096. $ctx1.sendIdx["should:raise:"]=25;
  59097. $self._should_raise_((function(){
  59098. return $core.withContext(function($ctx2) {
  59099. return (16)._rs();
  59100. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  59101. }),$globals.MessageNotUnderstood);
  59102. $ctx1.sendIdx["should:raise:"]=26;
  59103. $self._should_raise_((function(){
  59104. return $core.withContext(function($ctx2) {
  59105. return (16)._rT();
  59106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  59107. }),$globals.MessageNotUnderstood);
  59108. $ctx1.sendIdx["should:raise:"]=27;
  59109. $self._should_raise_((function(){
  59110. return $core.withContext(function($ctx2) {
  59111. return (16)._rt();
  59112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  59113. }),$globals.MessageNotUnderstood);
  59114. $ctx1.sendIdx["should:raise:"]=28;
  59115. $self._should_raise_((function(){
  59116. return $core.withContext(function($ctx2) {
  59117. return (16)._rU();
  59118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  59119. }),$globals.MessageNotUnderstood);
  59120. $ctx1.sendIdx["should:raise:"]=29;
  59121. $self._should_raise_((function(){
  59122. return $core.withContext(function($ctx2) {
  59123. return (16)._ru();
  59124. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  59125. }),$globals.MessageNotUnderstood);
  59126. $ctx1.sendIdx["should:raise:"]=30;
  59127. $self._should_raise_((function(){
  59128. return $core.withContext(function($ctx2) {
  59129. return (16)._rV();
  59130. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  59131. }),$globals.MessageNotUnderstood);
  59132. $ctx1.sendIdx["should:raise:"]=31;
  59133. $self._should_raise_((function(){
  59134. return $core.withContext(function($ctx2) {
  59135. return (16)._rv();
  59136. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  59137. }),$globals.MessageNotUnderstood);
  59138. $ctx1.sendIdx["should:raise:"]=32;
  59139. $self._should_raise_((function(){
  59140. return $core.withContext(function($ctx2) {
  59141. return (16)._rW();
  59142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  59143. }),$globals.MessageNotUnderstood);
  59144. $ctx1.sendIdx["should:raise:"]=33;
  59145. $self._should_raise_((function(){
  59146. return $core.withContext(function($ctx2) {
  59147. return (16)._rw();
  59148. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  59149. }),$globals.MessageNotUnderstood);
  59150. $ctx1.sendIdx["should:raise:"]=34;
  59151. $self._should_raise_((function(){
  59152. return $core.withContext(function($ctx2) {
  59153. return (16)._rX();
  59154. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  59155. }),$globals.MessageNotUnderstood);
  59156. $ctx1.sendIdx["should:raise:"]=35;
  59157. $self._should_raise_((function(){
  59158. return $core.withContext(function($ctx2) {
  59159. return (16)._rx();
  59160. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  59161. }),$globals.MessageNotUnderstood);
  59162. $ctx1.sendIdx["should:raise:"]=36;
  59163. $self._should_raise_((function(){
  59164. return $core.withContext(function($ctx2) {
  59165. return (16)._rY();
  59166. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  59167. }),$globals.MessageNotUnderstood);
  59168. $ctx1.sendIdx["should:raise:"]=37;
  59169. $self._should_raise_((function(){
  59170. return $core.withContext(function($ctx2) {
  59171. return (16)._ry();
  59172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  59173. }),$globals.MessageNotUnderstood);
  59174. $ctx1.sendIdx["should:raise:"]=38;
  59175. $self._should_raise_((function(){
  59176. return $core.withContext(function($ctx2) {
  59177. return (16)._rZ();
  59178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  59179. }),$globals.MessageNotUnderstood);
  59180. $ctx1.sendIdx["should:raise:"]=39;
  59181. $self._should_raise_((function(){
  59182. return $core.withContext(function($ctx2) {
  59183. return (16)._rz();
  59184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  59185. }),$globals.MessageNotUnderstood);
  59186. $ctx1.sendIdx["should:raise:"]=40;
  59187. $self._should_raise_((function(){
  59188. return $core.withContext(function($ctx2) {
  59189. return (11259375)._Z();
  59190. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  59191. }),$globals.MessageNotUnderstood);
  59192. return self;
  59193. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  59194. },
  59195. args: [],
  59196. 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.",
  59197. referencedClasses: ["MessageNotUnderstood"],
  59198. 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"]
  59199. }),
  59200. $globals.NumberTest);
  59201. $core.addMethod(
  59202. $core.method({
  59203. selector: "testLog",
  59204. protocol: "tests",
  59205. fn: function (){
  59206. var self=this,$self=this;
  59207. return $core.withContext(function($ctx1) {
  59208. $self._assert_equals_((10000)._log(),(4));
  59209. $ctx1.sendIdx["assert:equals:"]=1;
  59210. $self._assert_equals_((512)._log_((2)),(9));
  59211. $ctx1.sendIdx["assert:equals:"]=2;
  59212. $self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  59213. return self;
  59214. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  59215. },
  59216. args: [],
  59217. 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.",
  59218. referencedClasses: ["Number"],
  59219. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  59220. }),
  59221. $globals.NumberTest);
  59222. $core.addMethod(
  59223. $core.method({
  59224. selector: "testMinMax",
  59225. protocol: "tests",
  59226. fn: function (){
  59227. var self=this,$self=this;
  59228. return $core.withContext(function($ctx1) {
  59229. var $1,$2;
  59230. $self._assert_equals_((2)._max_((5)),(5));
  59231. $ctx1.sendIdx["assert:equals:"]=1;
  59232. $self._assert_equals_((2)._min_((5)),(2));
  59233. $ctx1.sendIdx["assert:equals:"]=2;
  59234. $1=(2)._min_max_((5),(3));
  59235. $ctx1.sendIdx["min:max:"]=1;
  59236. $self._assert_equals_($1,(3));
  59237. $ctx1.sendIdx["assert:equals:"]=3;
  59238. $2=(7)._min_max_((5),(3));
  59239. $ctx1.sendIdx["min:max:"]=2;
  59240. $self._assert_equals_($2,(5));
  59241. $ctx1.sendIdx["assert:equals:"]=4;
  59242. $self._assert_equals_((4)._min_max_((5),(3)),(4));
  59243. return self;
  59244. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  59245. },
  59246. args: [],
  59247. 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.",
  59248. referencedClasses: [],
  59249. messageSends: ["assert:equals:", "max:", "min:", "min:max:"]
  59250. }),
  59251. $globals.NumberTest);
  59252. $core.addMethod(
  59253. $core.method({
  59254. selector: "testNegated",
  59255. protocol: "tests",
  59256. fn: function (){
  59257. var self=this,$self=this;
  59258. return $core.withContext(function($ctx1) {
  59259. var $1;
  59260. $1=(3)._negated();
  59261. $ctx1.sendIdx["negated"]=1;
  59262. $self._assert_equals_($1,(-3));
  59263. $ctx1.sendIdx["assert:equals:"]=1;
  59264. $self._assert_equals_((-3)._negated(),(3));
  59265. return self;
  59266. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  59267. },
  59268. args: [],
  59269. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  59270. referencedClasses: [],
  59271. messageSends: ["assert:equals:", "negated"]
  59272. }),
  59273. $globals.NumberTest);
  59274. $core.addMethod(
  59275. $core.method({
  59276. selector: "testPrintShowingDecimalPlaces",
  59277. protocol: "tests",
  59278. fn: function (){
  59279. var self=this,$self=this;
  59280. return $core.withContext(function($ctx1) {
  59281. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  59282. $1=(23)._printShowingDecimalPlaces_((2));
  59283. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  59284. $self._assert_equals_($1,"23.00");
  59285. $ctx1.sendIdx["assert:equals:"]=1;
  59286. $2=(23.5698)._printShowingDecimalPlaces_((2));
  59287. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  59288. $self._assert_equals_($2,"23.57");
  59289. $ctx1.sendIdx["assert:equals:"]=2;
  59290. $4=(234.567)._negated();
  59291. $ctx1.sendIdx["negated"]=1;
  59292. $3=$recv($4)._printShowingDecimalPlaces_((5));
  59293. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  59294. $self._assert_equals_($3,"-234.56700");
  59295. $ctx1.sendIdx["assert:equals:"]=3;
  59296. $5=(23.4567)._printShowingDecimalPlaces_((0));
  59297. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  59298. $self._assert_equals_($5,"23");
  59299. $ctx1.sendIdx["assert:equals:"]=4;
  59300. $6=(23.5567)._printShowingDecimalPlaces_((0));
  59301. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  59302. $self._assert_equals_($6,"24");
  59303. $ctx1.sendIdx["assert:equals:"]=5;
  59304. $8=(23.4567)._negated();
  59305. $ctx1.sendIdx["negated"]=2;
  59306. $7=$recv($8)._printShowingDecimalPlaces_((0));
  59307. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  59308. $self._assert_equals_($7,"-23");
  59309. $ctx1.sendIdx["assert:equals:"]=6;
  59310. $10=(23.5567)._negated();
  59311. $ctx1.sendIdx["negated"]=3;
  59312. $9=$recv($10)._printShowingDecimalPlaces_((0));
  59313. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  59314. $self._assert_equals_($9,"-24");
  59315. $ctx1.sendIdx["assert:equals:"]=7;
  59316. $11=(100000000)._printShowingDecimalPlaces_((1));
  59317. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  59318. $self._assert_equals_($11,"100000000.0");
  59319. $ctx1.sendIdx["assert:equals:"]=8;
  59320. $12=(0.98)._printShowingDecimalPlaces_((5));
  59321. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  59322. $self._assert_equals_($12,"0.98000");
  59323. $ctx1.sendIdx["assert:equals:"]=9;
  59324. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  59325. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  59326. $self._assert_equals_($13,"-0.98");
  59327. $ctx1.sendIdx["assert:equals:"]=10;
  59328. $14=(2.567)._printShowingDecimalPlaces_((2));
  59329. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  59330. $self._assert_equals_($14,"2.57");
  59331. $ctx1.sendIdx["assert:equals:"]=11;
  59332. $15=(-2.567)._printShowingDecimalPlaces_((2));
  59333. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  59334. $self._assert_equals_($15,"-2.57");
  59335. $ctx1.sendIdx["assert:equals:"]=12;
  59336. $self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  59337. return self;
  59338. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  59339. },
  59340. args: [],
  59341. 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'.",
  59342. referencedClasses: [],
  59343. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  59344. }),
  59345. $globals.NumberTest);
  59346. $core.addMethod(
  59347. $core.method({
  59348. selector: "testPrintStringBase",
  59349. protocol: "tests",
  59350. fn: function (){
  59351. var self=this,$self=this;
  59352. return $core.withContext(function($ctx1) {
  59353. var $1,$2,$3;
  59354. $1=(15)._printStringBase_((2));
  59355. $ctx1.sendIdx["printStringBase:"]=1;
  59356. $self._assert_equals_($1,"1111");
  59357. $ctx1.sendIdx["assert:equals:"]=1;
  59358. $2=(15)._printStringBase_((16));
  59359. $ctx1.sendIdx["printStringBase:"]=2;
  59360. $self._assert_equals_($2,"f");
  59361. $ctx1.sendIdx["assert:equals:"]=2;
  59362. $3=(256)._printStringBase_((16));
  59363. $ctx1.sendIdx["printStringBase:"]=3;
  59364. $self._assert_equals_($3,"100");
  59365. $ctx1.sendIdx["assert:equals:"]=3;
  59366. $self._assert_equals_((256)._printStringBase_((2)),"100000000");
  59367. return self;
  59368. }, function($ctx1) {$ctx1.fill(self,"testPrintStringBase",{},$globals.NumberTest)});
  59369. },
  59370. args: [],
  59371. source: "testPrintStringBase\x0a\x09self assert: (15 printStringBase: 2) equals: '1111'.\x0a\x09self assert: (15 printStringBase: 16) equals: 'f'.\x0a\x09self assert: (256 printStringBase: 16) equals: '100'.\x0a\x09self assert: (256 printStringBase: 2) equals: '100000000'",
  59372. referencedClasses: [],
  59373. messageSends: ["assert:equals:", "printStringBase:"]
  59374. }),
  59375. $globals.NumberTest);
  59376. $core.addMethod(
  59377. $core.method({
  59378. selector: "testRadiansToDegrees",
  59379. protocol: "tests",
  59380. fn: function (){
  59381. var self=this,$self=this;
  59382. return $core.withContext(function($ctx1) {
  59383. $self._assert_($recv($recv($recv($recv($recv($globals.Number)._pi())._radiansToDegrees()).__minus((180)))._abs()).__lt_eq((0.01)));
  59384. return self;
  59385. }, function($ctx1) {$ctx1.fill(self,"testRadiansToDegrees",{},$globals.NumberTest)});
  59386. },
  59387. args: [],
  59388. source: "testRadiansToDegrees\x0a\x09self assert: (Number pi radiansToDegrees - 180) abs <= 0.01.",
  59389. referencedClasses: ["Number"],
  59390. messageSends: ["assert:", "<=", "abs", "-", "radiansToDegrees", "pi"]
  59391. }),
  59392. $globals.NumberTest);
  59393. $core.addMethod(
  59394. $core.method({
  59395. selector: "testRaisedTo",
  59396. protocol: "tests",
  59397. fn: function (){
  59398. var self=this,$self=this;
  59399. return $core.withContext(function($ctx1) {
  59400. var $1,$2,$3;
  59401. $1=(2)._raisedTo_((4));
  59402. $ctx1.sendIdx["raisedTo:"]=1;
  59403. $self._assert_equals_($1,(16));
  59404. $ctx1.sendIdx["assert:equals:"]=1;
  59405. $2=(2)._raisedTo_((0));
  59406. $ctx1.sendIdx["raisedTo:"]=2;
  59407. $self._assert_equals_($2,(1));
  59408. $ctx1.sendIdx["assert:equals:"]=2;
  59409. $3=(2)._raisedTo_((-3));
  59410. $ctx1.sendIdx["raisedTo:"]=3;
  59411. $self._assert_equals_($3,(0.125));
  59412. $ctx1.sendIdx["assert:equals:"]=3;
  59413. $self._assert_equals_((4)._raisedTo_((0.5)),(2));
  59414. $ctx1.sendIdx["assert:equals:"]=4;
  59415. $self._assert_equals_((2).__star_star((4)),(16));
  59416. return self;
  59417. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  59418. },
  59419. args: [],
  59420. 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.",
  59421. referencedClasses: [],
  59422. messageSends: ["assert:equals:", "raisedTo:", "**"]
  59423. }),
  59424. $globals.NumberTest);
  59425. $core.addMethod(
  59426. $core.method({
  59427. selector: "testRounded",
  59428. protocol: "tests",
  59429. fn: function (){
  59430. var self=this,$self=this;
  59431. return $core.withContext(function($ctx1) {
  59432. var $1,$2;
  59433. $1=(3)._rounded();
  59434. $ctx1.sendIdx["rounded"]=1;
  59435. $self._assert_equals_($1,(3));
  59436. $ctx1.sendIdx["assert:equals:"]=1;
  59437. $2=(3.212)._rounded();
  59438. $ctx1.sendIdx["rounded"]=2;
  59439. $self._assert_equals_($2,(3));
  59440. $ctx1.sendIdx["assert:equals:"]=2;
  59441. $self._assert_equals_((3.51)._rounded(),(4));
  59442. return self;
  59443. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  59444. },
  59445. args: [],
  59446. 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",
  59447. referencedClasses: [],
  59448. messageSends: ["assert:equals:", "rounded"]
  59449. }),
  59450. $globals.NumberTest);
  59451. $core.addMethod(
  59452. $core.method({
  59453. selector: "testSign",
  59454. protocol: "tests",
  59455. fn: function (){
  59456. var self=this,$self=this;
  59457. return $core.withContext(function($ctx1) {
  59458. var $1,$2;
  59459. $1=(5)._sign();
  59460. $ctx1.sendIdx["sign"]=1;
  59461. $self._assert_equals_($1,(1));
  59462. $ctx1.sendIdx["assert:equals:"]=1;
  59463. $2=(0)._sign();
  59464. $ctx1.sendIdx["sign"]=2;
  59465. $self._assert_equals_($2,(0));
  59466. $ctx1.sendIdx["assert:equals:"]=2;
  59467. $self._assert_equals_((-1.4)._sign(),(-1));
  59468. return self;
  59469. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  59470. },
  59471. args: [],
  59472. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  59473. referencedClasses: [],
  59474. messageSends: ["assert:equals:", "sign"]
  59475. }),
  59476. $globals.NumberTest);
  59477. $core.addMethod(
  59478. $core.method({
  59479. selector: "testSqrt",
  59480. protocol: "tests",
  59481. fn: function (){
  59482. var self=this,$self=this;
  59483. return $core.withContext(function($ctx1) {
  59484. var $1;
  59485. $1=(4)._sqrt();
  59486. $ctx1.sendIdx["sqrt"]=1;
  59487. $self._assert_equals_($1,(2));
  59488. $ctx1.sendIdx["assert:equals:"]=1;
  59489. $self._assert_equals_((16)._sqrt(),(4));
  59490. return self;
  59491. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  59492. },
  59493. args: [],
  59494. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  59495. referencedClasses: [],
  59496. messageSends: ["assert:equals:", "sqrt"]
  59497. }),
  59498. $globals.NumberTest);
  59499. $core.addMethod(
  59500. $core.method({
  59501. selector: "testSquared",
  59502. protocol: "tests",
  59503. fn: function (){
  59504. var self=this,$self=this;
  59505. return $core.withContext(function($ctx1) {
  59506. $self._assert_equals_((4)._squared(),(16));
  59507. return self;
  59508. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  59509. },
  59510. args: [],
  59511. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  59512. referencedClasses: [],
  59513. messageSends: ["assert:equals:", "squared"]
  59514. }),
  59515. $globals.NumberTest);
  59516. $core.addMethod(
  59517. $core.method({
  59518. selector: "testTimesRepeat",
  59519. protocol: "tests",
  59520. fn: function (){
  59521. var self=this,$self=this;
  59522. var i;
  59523. return $core.withContext(function($ctx1) {
  59524. i=(0);
  59525. (0)._timesRepeat_((function(){
  59526. return $core.withContext(function($ctx2) {
  59527. i=$recv(i).__plus((1));
  59528. $ctx2.sendIdx["+"]=1;
  59529. return i;
  59530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59531. }));
  59532. $ctx1.sendIdx["timesRepeat:"]=1;
  59533. $self._assert_equals_(i,(0));
  59534. $ctx1.sendIdx["assert:equals:"]=1;
  59535. (5)._timesRepeat_((function(){
  59536. return $core.withContext(function($ctx2) {
  59537. i=$recv(i).__plus((1));
  59538. return i;
  59539. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59540. }));
  59541. $self._assert_equals_(i,(5));
  59542. return self;
  59543. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  59544. },
  59545. args: [],
  59546. 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",
  59547. referencedClasses: [],
  59548. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  59549. }),
  59550. $globals.NumberTest);
  59551. $core.addMethod(
  59552. $core.method({
  59553. selector: "testTo",
  59554. protocol: "tests",
  59555. fn: function (){
  59556. var self=this,$self=this;
  59557. return $core.withContext(function($ctx1) {
  59558. $self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  59559. return self;
  59560. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  59561. },
  59562. args: [],
  59563. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  59564. referencedClasses: [],
  59565. messageSends: ["assert:equals:", "to:"]
  59566. }),
  59567. $globals.NumberTest);
  59568. $core.addMethod(
  59569. $core.method({
  59570. selector: "testToBy",
  59571. protocol: "tests",
  59572. fn: function (){
  59573. var self=this,$self=this;
  59574. return $core.withContext(function($ctx1) {
  59575. var $1;
  59576. $1=(0)._to_by_((6),(2));
  59577. $ctx1.sendIdx["to:by:"]=1;
  59578. $self._assert_equals_($1,[(0), (2), (4), (6)]);
  59579. $self._should_raise_((function(){
  59580. return $core.withContext(function($ctx2) {
  59581. return (1)._to_by_((4),(0));
  59582. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59583. }),$globals.Error);
  59584. return self;
  59585. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  59586. },
  59587. args: [],
  59588. 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",
  59589. referencedClasses: ["Error"],
  59590. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  59591. }),
  59592. $globals.NumberTest);
  59593. $core.addMethod(
  59594. $core.method({
  59595. selector: "testTrigonometry",
  59596. protocol: "tests",
  59597. fn: function (){
  59598. var self=this,$self=this;
  59599. return $core.withContext(function($ctx1) {
  59600. var $1;
  59601. $self._assert_equals_((0)._cos(),(1));
  59602. $ctx1.sendIdx["assert:equals:"]=1;
  59603. $self._assert_equals_((0)._sin(),(0));
  59604. $ctx1.sendIdx["assert:equals:"]=2;
  59605. $self._assert_equals_((0)._tan(),(0));
  59606. $ctx1.sendIdx["assert:equals:"]=3;
  59607. $self._assert_equals_((1)._arcCos(),(0));
  59608. $ctx1.sendIdx["assert:equals:"]=4;
  59609. $self._assert_equals_((0)._arcSin(),(0));
  59610. $ctx1.sendIdx["assert:equals:"]=5;
  59611. $self._assert_equals_((0)._arcTan(),(0));
  59612. $ctx1.sendIdx["assert:equals:"]=6;
  59613. $1=(0)._arcTan_((1));
  59614. $ctx1.sendIdx["arcTan:"]=1;
  59615. $self._assert_equals_($1,(0));
  59616. $ctx1.sendIdx["assert:equals:"]=7;
  59617. $self._assert_equals_((1)._arcTan_((0)),$recv($recv($globals.Number)._pi()).__slash((2)));
  59618. return self;
  59619. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  59620. },
  59621. args: [],
  59622. 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)",
  59623. referencedClasses: ["Number"],
  59624. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan", "arcTan:", "/", "pi"]
  59625. }),
  59626. $globals.NumberTest);
  59627. $core.addMethod(
  59628. $core.method({
  59629. selector: "testTruncated",
  59630. protocol: "tests",
  59631. fn: function (){
  59632. var self=this,$self=this;
  59633. return $core.withContext(function($ctx1) {
  59634. var $1,$2;
  59635. $1=(3)._truncated();
  59636. $ctx1.sendIdx["truncated"]=1;
  59637. $self._assert_equals_($1,(3));
  59638. $ctx1.sendIdx["assert:equals:"]=1;
  59639. $2=(3.212)._truncated();
  59640. $ctx1.sendIdx["truncated"]=2;
  59641. $self._assert_equals_($2,(3));
  59642. $ctx1.sendIdx["assert:equals:"]=2;
  59643. $self._assert_equals_((3.51)._truncated(),(3));
  59644. return self;
  59645. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  59646. },
  59647. args: [],
  59648. 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",
  59649. referencedClasses: [],
  59650. messageSends: ["assert:equals:", "truncated"]
  59651. }),
  59652. $globals.NumberTest);
  59653. $core.addClass("ObjectMock", $globals.Object, ["foo", "bar"], "Kernel-Tests");
  59654. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  59655. $core.addMethod(
  59656. $core.method({
  59657. selector: "foo",
  59658. protocol: "not yet classified",
  59659. fn: function (){
  59660. var self=this,$self=this;
  59661. return $self["@foo"];
  59662. },
  59663. args: [],
  59664. source: "foo\x0a\x09^ foo",
  59665. referencedClasses: [],
  59666. messageSends: []
  59667. }),
  59668. $globals.ObjectMock);
  59669. $core.addMethod(
  59670. $core.method({
  59671. selector: "foo:",
  59672. protocol: "not yet classified",
  59673. fn: function (anObject){
  59674. var self=this,$self=this;
  59675. $self["@foo"]=anObject;
  59676. return self;
  59677. },
  59678. args: ["anObject"],
  59679. source: "foo: anObject\x0a\x09foo := anObject",
  59680. referencedClasses: [],
  59681. messageSends: []
  59682. }),
  59683. $globals.ObjectMock);
  59684. $core.addClass("ObjectTest", $globals.TestCase, [], "Kernel-Tests");
  59685. $core.addMethod(
  59686. $core.method({
  59687. selector: "notDefined",
  59688. protocol: "tests",
  59689. fn: function (){
  59690. var self=this,$self=this;
  59691. return $core.withContext(function($ctx1) {
  59692. return void 0;;
  59693. return self;
  59694. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  59695. },
  59696. args: [],
  59697. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  59698. referencedClasses: [],
  59699. messageSends: []
  59700. }),
  59701. $globals.ObjectTest);
  59702. $core.addMethod(
  59703. $core.method({
  59704. selector: "testBasicAccess",
  59705. protocol: "tests",
  59706. fn: function (){
  59707. var self=this,$self=this;
  59708. var o;
  59709. return $core.withContext(function($ctx1) {
  59710. var $1;
  59711. o=$recv($globals.Object)._new();
  59712. $recv(o)._basicAt_put_("a",(1));
  59713. $1=$recv(o)._basicAt_("a");
  59714. $ctx1.sendIdx["basicAt:"]=1;
  59715. $self._assert_equals_($1,(1));
  59716. $ctx1.sendIdx["assert:equals:"]=1;
  59717. $self._assert_equals_($recv(o)._basicAt_("b"),nil);
  59718. return self;
  59719. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  59720. },
  59721. args: [],
  59722. 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",
  59723. referencedClasses: ["Object"],
  59724. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  59725. }),
  59726. $globals.ObjectTest);
  59727. $core.addMethod(
  59728. $core.method({
  59729. selector: "testBasicPerform",
  59730. protocol: "tests",
  59731. fn: function (){
  59732. var self=this,$self=this;
  59733. var o;
  59734. return $core.withContext(function($ctx1) {
  59735. o=$recv($globals.Object)._new();
  59736. $recv(o)._basicAt_put_("func",(function(){
  59737. return "hello";
  59738. }));
  59739. $ctx1.sendIdx["basicAt:put:"]=1;
  59740. $recv(o)._basicAt_put_("func2",(function(a){
  59741. return $core.withContext(function($ctx2) {
  59742. return $recv(a).__plus((1));
  59743. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  59744. }));
  59745. $self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  59746. $ctx1.sendIdx["assert:equals:"]=1;
  59747. $self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  59748. return self;
  59749. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  59750. },
  59751. args: [],
  59752. 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",
  59753. referencedClasses: ["Object"],
  59754. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  59755. }),
  59756. $globals.ObjectTest);
  59757. $core.addMethod(
  59758. $core.method({
  59759. selector: "testDNU",
  59760. protocol: "tests",
  59761. fn: function (){
  59762. var self=this,$self=this;
  59763. return $core.withContext(function($ctx1) {
  59764. $self._should_raise_((function(){
  59765. return $core.withContext(function($ctx2) {
  59766. return $recv($recv($globals.Object)._new())._foo();
  59767. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59768. }),$globals.MessageNotUnderstood);
  59769. return self;
  59770. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  59771. },
  59772. args: [],
  59773. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  59774. referencedClasses: ["Object", "MessageNotUnderstood"],
  59775. messageSends: ["should:raise:", "foo", "new"]
  59776. }),
  59777. $globals.ObjectTest);
  59778. $core.addMethod(
  59779. $core.method({
  59780. selector: "testEquality",
  59781. protocol: "tests",
  59782. fn: function (){
  59783. var self=this,$self=this;
  59784. var o;
  59785. return $core.withContext(function($ctx1) {
  59786. var $1,$2,$4,$3;
  59787. o=$recv($globals.Object)._new();
  59788. $ctx1.sendIdx["new"]=1;
  59789. $1=$recv(o).__eq($recv($globals.Object)._new());
  59790. $ctx1.sendIdx["="]=1;
  59791. $self._deny_($1);
  59792. $2=$recv(o).__eq(o);
  59793. $ctx1.sendIdx["="]=2;
  59794. $self._assert_($2);
  59795. $ctx1.sendIdx["assert:"]=1;
  59796. $4=$recv(o)._yourself();
  59797. $ctx1.sendIdx["yourself"]=1;
  59798. $3=$recv($4).__eq(o);
  59799. $ctx1.sendIdx["="]=3;
  59800. $self._assert_($3);
  59801. $ctx1.sendIdx["assert:"]=2;
  59802. $self._assert_($recv(o).__eq($recv(o)._yourself()));
  59803. return self;
  59804. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  59805. },
  59806. args: [],
  59807. 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)",
  59808. referencedClasses: ["Object"],
  59809. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  59810. }),
  59811. $globals.ObjectTest);
  59812. $core.addMethod(
  59813. $core.method({
  59814. selector: "testHalt",
  59815. protocol: "tests",
  59816. fn: function (){
  59817. var self=this,$self=this;
  59818. return $core.withContext(function($ctx1) {
  59819. $self._should_raise_((function(){
  59820. return $core.withContext(function($ctx2) {
  59821. return $recv($recv($globals.Object)._new())._halt();
  59822. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59823. }),$globals.Error);
  59824. return self;
  59825. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  59826. },
  59827. args: [],
  59828. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  59829. referencedClasses: ["Object", "Error"],
  59830. messageSends: ["should:raise:", "halt", "new"]
  59831. }),
  59832. $globals.ObjectTest);
  59833. $core.addMethod(
  59834. $core.method({
  59835. selector: "testIdentity",
  59836. protocol: "tests",
  59837. fn: function (){
  59838. var self=this,$self=this;
  59839. var o;
  59840. return $core.withContext(function($ctx1) {
  59841. var $1,$2,$4,$3;
  59842. o=$recv($globals.Object)._new();
  59843. $ctx1.sendIdx["new"]=1;
  59844. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  59845. $ctx1.sendIdx["=="]=1;
  59846. $self._deny_($1);
  59847. $2=$recv(o).__eq_eq(o);
  59848. $ctx1.sendIdx["=="]=2;
  59849. $self._assert_($2);
  59850. $ctx1.sendIdx["assert:"]=1;
  59851. $4=$recv(o)._yourself();
  59852. $ctx1.sendIdx["yourself"]=1;
  59853. $3=$recv($4).__eq_eq(o);
  59854. $ctx1.sendIdx["=="]=3;
  59855. $self._assert_($3);
  59856. $ctx1.sendIdx["assert:"]=2;
  59857. $self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  59858. return self;
  59859. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  59860. },
  59861. args: [],
  59862. 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",
  59863. referencedClasses: ["Object"],
  59864. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  59865. }),
  59866. $globals.ObjectTest);
  59867. $core.addMethod(
  59868. $core.method({
  59869. selector: "testIfNil",
  59870. protocol: "tests",
  59871. fn: function (){
  59872. var self=this,$self=this;
  59873. return $core.withContext(function($ctx1) {
  59874. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  59875. $2=$recv($globals.Object)._new();
  59876. $ctx1.sendIdx["new"]=1;
  59877. $1=$recv($2)._isNil();
  59878. $self._deny_($1);
  59879. $ctx1.sendIdx["deny:"]=1;
  59880. $5=$recv($globals.Object)._new();
  59881. $ctx1.sendIdx["new"]=2;
  59882. if(($receiver = $5) == null || $receiver.a$nil){
  59883. $4=true;
  59884. } else {
  59885. $4=$5;
  59886. }
  59887. $3=$recv($4).__eq(true);
  59888. $self._deny_($3);
  59889. $7=$recv($globals.Object)._new();
  59890. $ctx1.sendIdx["new"]=3;
  59891. if(($receiver = $7) == null || $receiver.a$nil){
  59892. $6=$7;
  59893. } else {
  59894. $6=true;
  59895. }
  59896. $self._assert_equals_($6,true);
  59897. $ctx1.sendIdx["assert:equals:"]=1;
  59898. $9=$recv($globals.Object)._new();
  59899. $ctx1.sendIdx["new"]=4;
  59900. if(($receiver = $9) == null || $receiver.a$nil){
  59901. $8=false;
  59902. } else {
  59903. $8=true;
  59904. }
  59905. $self._assert_equals_($8,true);
  59906. $ctx1.sendIdx["assert:equals:"]=2;
  59907. $11=$recv($globals.Object)._new();
  59908. if(($receiver = $11) == null || $receiver.a$nil){
  59909. $10=false;
  59910. } else {
  59911. $10=true;
  59912. }
  59913. $self._assert_equals_($10,true);
  59914. return self;
  59915. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  59916. },
  59917. args: [],
  59918. 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",
  59919. referencedClasses: ["Object"],
  59920. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  59921. }),
  59922. $globals.ObjectTest);
  59923. $core.addMethod(
  59924. $core.method({
  59925. selector: "testInstVars",
  59926. protocol: "tests",
  59927. fn: function (){
  59928. var self=this,$self=this;
  59929. var o;
  59930. return $core.withContext(function($ctx1) {
  59931. var $1,$2;
  59932. o=$recv($globals.ObjectMock)._new();
  59933. $1=$recv(o)._instVarAt_("foo");
  59934. $ctx1.sendIdx["instVarAt:"]=1;
  59935. $self._assert_equals_($1,nil);
  59936. $ctx1.sendIdx["assert:equals:"]=1;
  59937. $recv(o)._instVarAt_put_("foo",(1));
  59938. $2=$recv(o)._instVarAt_("foo");
  59939. $ctx1.sendIdx["instVarAt:"]=2;
  59940. $self._assert_equals_($2,(1));
  59941. $ctx1.sendIdx["assert:equals:"]=2;
  59942. $self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  59943. return self;
  59944. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  59945. },
  59946. args: [],
  59947. 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",
  59948. referencedClasses: ["ObjectMock"],
  59949. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  59950. }),
  59951. $globals.ObjectTest);
  59952. $core.addMethod(
  59953. $core.method({
  59954. selector: "testNilUndefined",
  59955. protocol: "tests",
  59956. fn: function (){
  59957. var self=this,$self=this;
  59958. return $core.withContext(function($ctx1) {
  59959. $self._assert_equals_($self._notDefined(),nil);
  59960. return self;
  59961. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  59962. },
  59963. args: [],
  59964. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  59965. referencedClasses: [],
  59966. messageSends: ["assert:equals:", "notDefined"]
  59967. }),
  59968. $globals.ObjectTest);
  59969. $core.addMethod(
  59970. $core.method({
  59971. selector: "testYourself",
  59972. protocol: "tests",
  59973. fn: function (){
  59974. var self=this,$self=this;
  59975. var o;
  59976. return $core.withContext(function($ctx1) {
  59977. o=$recv($globals.ObjectMock)._new();
  59978. $self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  59979. return self;
  59980. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  59981. },
  59982. args: [],
  59983. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  59984. referencedClasses: ["ObjectMock"],
  59985. messageSends: ["new", "assert:", "==", "yourself"]
  59986. }),
  59987. $globals.ObjectTest);
  59988. $core.addClass("PointTest", $globals.TestCase, [], "Kernel-Tests");
  59989. $core.addMethod(
  59990. $core.method({
  59991. selector: "testAccessing",
  59992. protocol: "tests",
  59993. fn: function (){
  59994. var self=this,$self=this;
  59995. return $core.withContext(function($ctx1) {
  59996. var $2,$1,$3,$6,$5,$4;
  59997. $2=$recv($globals.Point)._x_y_((3),(4));
  59998. $ctx1.sendIdx["x:y:"]=1;
  59999. $1=$recv($2)._x();
  60000. $ctx1.sendIdx["x"]=1;
  60001. $self._assert_equals_($1,(3));
  60002. $ctx1.sendIdx["assert:equals:"]=1;
  60003. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  60004. $ctx1.sendIdx["y"]=1;
  60005. $self._assert_equals_($3,(4));
  60006. $ctx1.sendIdx["assert:equals:"]=2;
  60007. $6=$recv($globals.Point)._new();
  60008. $ctx1.sendIdx["new"]=1;
  60009. $5=$recv($6)._x_((3));
  60010. $4=$recv($5)._x();
  60011. $self._assert_equals_($4,(3));
  60012. $ctx1.sendIdx["assert:equals:"]=3;
  60013. $self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  60014. return self;
  60015. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  60016. },
  60017. args: [],
  60018. 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",
  60019. referencedClasses: ["Point"],
  60020. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  60021. }),
  60022. $globals.PointTest);
  60023. $core.addMethod(
  60024. $core.method({
  60025. selector: "testAngle",
  60026. protocol: "tests",
  60027. fn: function (){
  60028. var self=this,$self=this;
  60029. return $core.withContext(function($ctx1) {
  60030. $self._assert_equals_($recv((-1).__at((0)))._angle(),$recv($globals.Number)._pi());
  60031. return self;
  60032. }, function($ctx1) {$ctx1.fill(self,"testAngle",{},$globals.PointTest)});
  60033. },
  60034. args: [],
  60035. source: "testAngle\x0a\x09self assert: (-1@0) angle equals: Number pi",
  60036. referencedClasses: ["Number"],
  60037. messageSends: ["assert:equals:", "angle", "@", "pi"]
  60038. }),
  60039. $globals.PointTest);
  60040. $core.addMethod(
  60041. $core.method({
  60042. selector: "testArithmetic",
  60043. protocol: "tests",
  60044. fn: function (){
  60045. var self=this,$self=this;
  60046. return $core.withContext(function($ctx1) {
  60047. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  60048. $2=(3).__at((4));
  60049. $ctx1.sendIdx["@"]=1;
  60050. $3=(3).__at((4));
  60051. $ctx1.sendIdx["@"]=2;
  60052. $1=$recv($2).__star($3);
  60053. $4=$recv($globals.Point)._x_y_((9),(16));
  60054. $ctx1.sendIdx["x:y:"]=1;
  60055. $self._assert_equals_($1,$4);
  60056. $ctx1.sendIdx["assert:equals:"]=1;
  60057. $6=(3).__at((4));
  60058. $ctx1.sendIdx["@"]=3;
  60059. $7=(3).__at((4));
  60060. $ctx1.sendIdx["@"]=4;
  60061. $5=$recv($6).__plus($7);
  60062. $8=$recv($globals.Point)._x_y_((6),(8));
  60063. $ctx1.sendIdx["x:y:"]=2;
  60064. $self._assert_equals_($5,$8);
  60065. $ctx1.sendIdx["assert:equals:"]=2;
  60066. $10=(3).__at((4));
  60067. $ctx1.sendIdx["@"]=5;
  60068. $11=(3).__at((4));
  60069. $ctx1.sendIdx["@"]=6;
  60070. $9=$recv($10).__minus($11);
  60071. $12=$recv($globals.Point)._x_y_((0),(0));
  60072. $ctx1.sendIdx["x:y:"]=3;
  60073. $self._assert_equals_($9,$12);
  60074. $ctx1.sendIdx["assert:equals:"]=3;
  60075. $14=(6).__at((8));
  60076. $ctx1.sendIdx["@"]=7;
  60077. $13=$recv($14).__slash((3).__at((4)));
  60078. $self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  60079. return self;
  60080. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  60081. },
  60082. args: [],
  60083. 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)",
  60084. referencedClasses: ["Point"],
  60085. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  60086. }),
  60087. $globals.PointTest);
  60088. $core.addMethod(
  60089. $core.method({
  60090. selector: "testAt",
  60091. protocol: "tests",
  60092. fn: function (){
  60093. var self=this,$self=this;
  60094. return $core.withContext(function($ctx1) {
  60095. $self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  60096. return self;
  60097. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  60098. },
  60099. args: [],
  60100. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  60101. referencedClasses: ["Point"],
  60102. messageSends: ["assert:equals:", "@", "x:y:"]
  60103. }),
  60104. $globals.PointTest);
  60105. $core.addMethod(
  60106. $core.method({
  60107. selector: "testComparison",
  60108. protocol: "tests",
  60109. fn: function (){
  60110. var self=this,$self=this;
  60111. return $core.withContext(function($ctx1) {
  60112. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  60113. $2=(3).__at((4));
  60114. $ctx1.sendIdx["@"]=1;
  60115. $3=(4).__at((5));
  60116. $ctx1.sendIdx["@"]=2;
  60117. $1=$recv($2).__lt($3);
  60118. $ctx1.sendIdx["<"]=1;
  60119. $self._assert_($1);
  60120. $ctx1.sendIdx["assert:"]=1;
  60121. $5=(3).__at((4));
  60122. $ctx1.sendIdx["@"]=3;
  60123. $6=(4).__at((4));
  60124. $ctx1.sendIdx["@"]=4;
  60125. $4=$recv($5).__lt($6);
  60126. $self._deny_($4);
  60127. $ctx1.sendIdx["deny:"]=1;
  60128. $8=(4).__at((5));
  60129. $ctx1.sendIdx["@"]=5;
  60130. $9=(4).__at((5));
  60131. $ctx1.sendIdx["@"]=6;
  60132. $7=$recv($8).__lt_eq($9);
  60133. $ctx1.sendIdx["<="]=1;
  60134. $self._assert_($7);
  60135. $ctx1.sendIdx["assert:"]=2;
  60136. $11=(4).__at((5));
  60137. $ctx1.sendIdx["@"]=7;
  60138. $12=(3).__at((5));
  60139. $ctx1.sendIdx["@"]=8;
  60140. $10=$recv($11).__lt_eq($12);
  60141. $self._deny_($10);
  60142. $ctx1.sendIdx["deny:"]=2;
  60143. $14=(5).__at((6));
  60144. $ctx1.sendIdx["@"]=9;
  60145. $15=(4).__at((5));
  60146. $ctx1.sendIdx["@"]=10;
  60147. $13=$recv($14).__gt($15);
  60148. $ctx1.sendIdx[">"]=1;
  60149. $self._assert_($13);
  60150. $ctx1.sendIdx["assert:"]=3;
  60151. $17=(5).__at((6));
  60152. $ctx1.sendIdx["@"]=11;
  60153. $18=(6).__at((6));
  60154. $ctx1.sendIdx["@"]=12;
  60155. $16=$recv($17).__gt($18);
  60156. $self._deny_($16);
  60157. $ctx1.sendIdx["deny:"]=3;
  60158. $20=(4).__at((5));
  60159. $ctx1.sendIdx["@"]=13;
  60160. $21=(4).__at((5));
  60161. $ctx1.sendIdx["@"]=14;
  60162. $19=$recv($20).__gt_eq($21);
  60163. $ctx1.sendIdx[">="]=1;
  60164. $self._assert_($19);
  60165. $23=(4).__at((5));
  60166. $ctx1.sendIdx["@"]=15;
  60167. $22=$recv($23).__gt_eq((5).__at((5)));
  60168. $self._deny_($22);
  60169. return self;
  60170. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  60171. },
  60172. args: [],
  60173. 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)",
  60174. referencedClasses: [],
  60175. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  60176. }),
  60177. $globals.PointTest);
  60178. $core.addMethod(
  60179. $core.method({
  60180. selector: "testDotProduct",
  60181. protocol: "tests",
  60182. fn: function (){
  60183. var self=this,$self=this;
  60184. return $core.withContext(function($ctx1) {
  60185. var $2,$1;
  60186. $2=(2).__at((3));
  60187. $ctx1.sendIdx["@"]=1;
  60188. $1=$recv($2)._dotProduct_((3).__at((7)));
  60189. $self._assert_equals_($1,(27));
  60190. return self;
  60191. }, function($ctx1) {$ctx1.fill(self,"testDotProduct",{},$globals.PointTest)});
  60192. },
  60193. args: [],
  60194. source: "testDotProduct\x0a\x09self assert: (2@3 dotProduct: 3@7) equals: 27",
  60195. referencedClasses: [],
  60196. messageSends: ["assert:equals:", "dotProduct:", "@"]
  60197. }),
  60198. $globals.PointTest);
  60199. $core.addMethod(
  60200. $core.method({
  60201. selector: "testEgality",
  60202. protocol: "tests",
  60203. fn: function (){
  60204. var self=this,$self=this;
  60205. return $core.withContext(function($ctx1) {
  60206. var $2,$3,$1,$5,$4;
  60207. $2=(3).__at((4));
  60208. $ctx1.sendIdx["@"]=1;
  60209. $3=(3).__at((4));
  60210. $ctx1.sendIdx["@"]=2;
  60211. $1=$recv($2).__eq($3);
  60212. $ctx1.sendIdx["="]=1;
  60213. $self._assert_($1);
  60214. $5=(3).__at((5));
  60215. $ctx1.sendIdx["@"]=3;
  60216. $4=$recv($5).__eq((3).__at((6)));
  60217. $self._deny_($4);
  60218. return self;
  60219. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  60220. },
  60221. args: [],
  60222. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  60223. referencedClasses: [],
  60224. messageSends: ["assert:", "=", "@", "deny:"]
  60225. }),
  60226. $globals.PointTest);
  60227. $core.addMethod(
  60228. $core.method({
  60229. selector: "testNew",
  60230. protocol: "tests",
  60231. fn: function (){
  60232. var self=this,$self=this;
  60233. return $core.withContext(function($ctx1) {
  60234. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  60235. $3=$recv($globals.Point)._new();
  60236. $ctx1.sendIdx["new"]=1;
  60237. $2=$recv($3)._x_((3));
  60238. $ctx1.sendIdx["x:"]=1;
  60239. $1=$recv($2)._y();
  60240. $ctx1.sendIdx["y"]=1;
  60241. $self._assert_equals_($1,nil);
  60242. $ctx1.sendIdx["assert:equals:"]=1;
  60243. $7=$recv($globals.Point)._new();
  60244. $ctx1.sendIdx["new"]=2;
  60245. $6=$recv($7)._x_((3));
  60246. $5=$recv($6)._x();
  60247. $ctx1.sendIdx["x"]=1;
  60248. $4=$recv($5).__eq((0));
  60249. $ctx1.sendIdx["="]=1;
  60250. $self._deny_($4);
  60251. $ctx1.sendIdx["deny:"]=1;
  60252. $10=$recv($globals.Point)._new();
  60253. $ctx1.sendIdx["new"]=3;
  60254. $9=$recv($10)._y_((4));
  60255. $ctx1.sendIdx["y:"]=1;
  60256. $8=$recv($9)._x();
  60257. $self._assert_equals_($8,nil);
  60258. $self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  60259. return self;
  60260. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  60261. },
  60262. args: [],
  60263. 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",
  60264. referencedClasses: ["Point"],
  60265. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  60266. }),
  60267. $globals.PointTest);
  60268. $core.addMethod(
  60269. $core.method({
  60270. selector: "testNormal",
  60271. protocol: "tests",
  60272. fn: function (){
  60273. var self=this,$self=this;
  60274. return $core.withContext(function($ctx1) {
  60275. var $2,$1;
  60276. $2=(1).__at((0));
  60277. $ctx1.sendIdx["@"]=1;
  60278. $1=$recv($2)._normal();
  60279. $self._assert_equals_($1,(0).__at((1)));
  60280. return self;
  60281. }, function($ctx1) {$ctx1.fill(self,"testNormal",{},$globals.PointTest)});
  60282. },
  60283. args: [],
  60284. source: "testNormal\x0a\x09self assert: (1@0) normal equals: 0@1",
  60285. referencedClasses: [],
  60286. messageSends: ["assert:equals:", "normal", "@"]
  60287. }),
  60288. $globals.PointTest);
  60289. $core.addMethod(
  60290. $core.method({
  60291. selector: "testNormalized",
  60292. protocol: "tests",
  60293. fn: function (){
  60294. var self=this,$self=this;
  60295. return $core.withContext(function($ctx1) {
  60296. var $2,$1,$3,$5,$4;
  60297. $2=(0).__at((2));
  60298. $ctx1.sendIdx["@"]=1;
  60299. $1=$recv($2)._normalized();
  60300. $ctx1.sendIdx["normalized"]=1;
  60301. $3=(0).__at((1));
  60302. $ctx1.sendIdx["@"]=2;
  60303. $self._assert_equals_($1,$3);
  60304. $ctx1.sendIdx["assert:equals:"]=1;
  60305. $5=(0).__at((0));
  60306. $ctx1.sendIdx["@"]=3;
  60307. $4=$recv($5)._normalized();
  60308. $self._assert_equals_($4,(0).__at((0)));
  60309. return self;
  60310. }, function($ctx1) {$ctx1.fill(self,"testNormalized",{},$globals.PointTest)});
  60311. },
  60312. args: [],
  60313. source: "testNormalized\x0a\x09self assert: (0@2) normalized equals: 0@1.\x0a\x09self assert: (0@0) normalized equals: 0@0.",
  60314. referencedClasses: [],
  60315. messageSends: ["assert:equals:", "normalized", "@"]
  60316. }),
  60317. $globals.PointTest);
  60318. $core.addMethod(
  60319. $core.method({
  60320. selector: "testPolarCoordinates",
  60321. protocol: "tests",
  60322. fn: function (){
  60323. var self=this,$self=this;
  60324. return $core.withContext(function($ctx1) {
  60325. var $2,$1;
  60326. $2=(1).__at((0));
  60327. $ctx1.sendIdx["@"]=1;
  60328. $1=$recv($2)._r();
  60329. $ctx1.sendIdx["r"]=1;
  60330. $self._assert_equals_($1,(1));
  60331. $ctx1.sendIdx["assert:equals:"]=1;
  60332. $self._assert_equals_($recv((0).__at((0)))._r(),(0));
  60333. return self;
  60334. }, function($ctx1) {$ctx1.fill(self,"testPolarCoordinates",{},$globals.PointTest)});
  60335. },
  60336. args: [],
  60337. source: "testPolarCoordinates\x0a\x09self assert: (1@0) r equals: 1.\x0a\x09self assert: (0@0) r equals: 0.",
  60338. referencedClasses: [],
  60339. messageSends: ["assert:equals:", "r", "@"]
  60340. }),
  60341. $globals.PointTest);
  60342. $core.addMethod(
  60343. $core.method({
  60344. selector: "testRectangleCreation",
  60345. protocol: "tests",
  60346. fn: function (){
  60347. var self=this,$self=this;
  60348. return $core.withContext(function($ctx1) {
  60349. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$16;
  60350. $2=(1).__at((1));
  60351. $ctx1.sendIdx["@"]=1;
  60352. $3=(2).__at((2));
  60353. $ctx1.sendIdx["@"]=2;
  60354. $1=$recv($2)._corner_($3);
  60355. $5=(1).__at((1));
  60356. $ctx1.sendIdx["@"]=3;
  60357. $6=(2).__at((2));
  60358. $ctx1.sendIdx["@"]=4;
  60359. $4=$recv($globals.Rectangle)._origin_corner_($5,$6);
  60360. $self._assert_equals_($1,$4);
  60361. $ctx1.sendIdx["assert:equals:"]=1;
  60362. $8=(1).__at((1));
  60363. $ctx1.sendIdx["@"]=5;
  60364. $9=(2).__at((2));
  60365. $ctx1.sendIdx["@"]=6;
  60366. $7=$recv($8)._rectangle_($9);
  60367. $11=(1).__at((1));
  60368. $ctx1.sendIdx["@"]=7;
  60369. $12=(2).__at((2));
  60370. $ctx1.sendIdx["@"]=8;
  60371. $10=$recv($globals.Rectangle)._point_point_($11,$12);
  60372. $self._assert_equals_($7,$10);
  60373. $ctx1.sendIdx["assert:equals:"]=2;
  60374. $14=(1).__at((1));
  60375. $ctx1.sendIdx["@"]=9;
  60376. $15=(2).__at((2));
  60377. $ctx1.sendIdx["@"]=10;
  60378. $13=$recv($14)._extent_($15);
  60379. $17=(1).__at((1));
  60380. $ctx1.sendIdx["@"]=11;
  60381. $16=$recv($globals.Rectangle)._origin_extent_($17,(2).__at((2)));
  60382. $self._assert_equals_($13,$16);
  60383. return self;
  60384. }, function($ctx1) {$ctx1.fill(self,"testRectangleCreation",{},$globals.PointTest)});
  60385. },
  60386. args: [],
  60387. 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)",
  60388. referencedClasses: ["Rectangle"],
  60389. messageSends: ["assert:equals:", "corner:", "@", "origin:corner:", "rectangle:", "point:point:", "extent:", "origin:extent:"]
  60390. }),
  60391. $globals.PointTest);
  60392. $core.addMethod(
  60393. $core.method({
  60394. selector: "testTranslateBy",
  60395. protocol: "tests",
  60396. fn: function (){
  60397. var self=this,$self=this;
  60398. return $core.withContext(function($ctx1) {
  60399. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  60400. $2=(3).__at((3));
  60401. $ctx1.sendIdx["@"]=1;
  60402. $3=(0).__at((1));
  60403. $ctx1.sendIdx["@"]=2;
  60404. $1=$recv($2)._translateBy_($3);
  60405. $ctx1.sendIdx["translateBy:"]=1;
  60406. $4=(3).__at((4));
  60407. $ctx1.sendIdx["@"]=3;
  60408. $self._assert_equals_($1,$4);
  60409. $ctx1.sendIdx["assert:equals:"]=1;
  60410. $6=(3).__at((3));
  60411. $ctx1.sendIdx["@"]=4;
  60412. $8=(1)._negated();
  60413. $ctx1.sendIdx["negated"]=1;
  60414. $7=(0).__at($8);
  60415. $ctx1.sendIdx["@"]=5;
  60416. $5=$recv($6)._translateBy_($7);
  60417. $ctx1.sendIdx["translateBy:"]=2;
  60418. $9=(3).__at((2));
  60419. $ctx1.sendIdx["@"]=6;
  60420. $self._assert_equals_($5,$9);
  60421. $ctx1.sendIdx["assert:equals:"]=2;
  60422. $11=(3).__at((3));
  60423. $ctx1.sendIdx["@"]=7;
  60424. $12=(2).__at((3));
  60425. $ctx1.sendIdx["@"]=8;
  60426. $10=$recv($11)._translateBy_($12);
  60427. $ctx1.sendIdx["translateBy:"]=3;
  60428. $13=(5).__at((6));
  60429. $ctx1.sendIdx["@"]=9;
  60430. $self._assert_equals_($10,$13);
  60431. $ctx1.sendIdx["assert:equals:"]=3;
  60432. $15=(3).__at((3));
  60433. $ctx1.sendIdx["@"]=10;
  60434. $16=$recv((3)._negated()).__at((0));
  60435. $ctx1.sendIdx["@"]=11;
  60436. $14=$recv($15)._translateBy_($16);
  60437. $self._assert_equals_($14,(0).__at((3)));
  60438. return self;
  60439. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  60440. },
  60441. args: [],
  60442. 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.",
  60443. referencedClasses: [],
  60444. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  60445. }),
  60446. $globals.PointTest);
  60447. $core.addClass("QueueTest", $globals.TestCase, [], "Kernel-Tests");
  60448. $core.addMethod(
  60449. $core.method({
  60450. selector: "testNextIfAbsent",
  60451. protocol: "tests",
  60452. fn: function (){
  60453. var self=this,$self=this;
  60454. var queue;
  60455. return $core.withContext(function($ctx1) {
  60456. var $2,$1;
  60457. queue=$recv($globals.Queue)._new();
  60458. $recv(queue)._nextPut_("index1");
  60459. $2=$recv(queue)._nextIfAbsent_("empty");
  60460. $ctx1.sendIdx["nextIfAbsent:"]=1;
  60461. $1=$recv($2).__eq("index1");
  60462. $ctx1.sendIdx["="]=1;
  60463. $self._assert_($1);
  60464. $self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  60465. return self;
  60466. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  60467. },
  60468. args: [],
  60469. 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'",
  60470. referencedClasses: ["Queue"],
  60471. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  60472. }),
  60473. $globals.QueueTest);
  60474. $core.addMethod(
  60475. $core.method({
  60476. selector: "testQueueNext",
  60477. protocol: "tests",
  60478. fn: function (){
  60479. var self=this,$self=this;
  60480. var queue;
  60481. return $core.withContext(function($ctx1) {
  60482. var $1,$3,$2,$5,$4;
  60483. queue=$recv($globals.Queue)._new();
  60484. $1=queue;
  60485. $recv($1)._nextPut_("index1");
  60486. $ctx1.sendIdx["nextPut:"]=1;
  60487. $recv($1)._nextPut_("index2");
  60488. $3=$recv(queue)._next();
  60489. $ctx1.sendIdx["next"]=1;
  60490. $2=$recv($3).__eq("index1");
  60491. $ctx1.sendIdx["="]=1;
  60492. $self._assert_($2);
  60493. $5=$recv(queue)._next();
  60494. $ctx1.sendIdx["next"]=2;
  60495. $4=$recv($5).__eq("index");
  60496. $self._deny_($4);
  60497. $self._should_raise_((function(){
  60498. return $core.withContext(function($ctx2) {
  60499. return $recv(queue)._next();
  60500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60501. }),$globals.Error);
  60502. return self;
  60503. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  60504. },
  60505. args: [],
  60506. 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",
  60507. referencedClasses: ["Queue", "Error"],
  60508. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  60509. }),
  60510. $globals.QueueTest);
  60511. $core.addClass("RandomTest", $globals.TestCase, [], "Kernel-Tests");
  60512. $core.addMethod(
  60513. $core.method({
  60514. selector: "testAtRandomNumber",
  60515. protocol: "tests",
  60516. fn: function (){
  60517. var self=this,$self=this;
  60518. var val;
  60519. return $core.withContext(function($ctx1) {
  60520. (100)._timesRepeat_((function(){
  60521. return $core.withContext(function($ctx2) {
  60522. val=(10)._atRandom();
  60523. $self._assert_($recv(val).__gt((0)));
  60524. $ctx2.sendIdx["assert:"]=1;
  60525. return $self._assert_($recv(val).__lt((11)));
  60526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60527. }));
  60528. return self;
  60529. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  60530. },
  60531. args: [],
  60532. 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]",
  60533. referencedClasses: [],
  60534. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  60535. }),
  60536. $globals.RandomTest);
  60537. $core.addMethod(
  60538. $core.method({
  60539. selector: "testAtRandomSequenceableCollection",
  60540. protocol: "tests",
  60541. fn: function (){
  60542. var self=this,$self=this;
  60543. var val;
  60544. return $core.withContext(function($ctx1) {
  60545. var $3,$4,$2,$1;
  60546. (100)._timesRepeat_((function(){
  60547. return $core.withContext(function($ctx2) {
  60548. val="abc"._atRandom();
  60549. $3=$recv(val).__eq("a");
  60550. $ctx2.sendIdx["="]=1;
  60551. $4=$recv(val).__eq("b");
  60552. $ctx2.sendIdx["="]=2;
  60553. $2=$recv($3).__or($4);
  60554. $1=$recv($2).__or($recv(val).__eq("c"));
  60555. $ctx2.sendIdx["|"]=1;
  60556. return $self._assert_($1);
  60557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60558. }));
  60559. return self;
  60560. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  60561. },
  60562. args: [],
  60563. 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].",
  60564. referencedClasses: [],
  60565. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  60566. }),
  60567. $globals.RandomTest);
  60568. $core.addMethod(
  60569. $core.method({
  60570. selector: "textNext",
  60571. protocol: "tests",
  60572. fn: function (){
  60573. var self=this,$self=this;
  60574. return $core.withContext(function($ctx1) {
  60575. var $1;
  60576. (10000)._timesRepeat_((function(){
  60577. var current,next;
  60578. return $core.withContext(function($ctx2) {
  60579. next=$recv($recv($globals.Random)._new())._next();
  60580. $self._assert_($recv(next).__gt_eq((0)));
  60581. $ctx2.sendIdx["assert:"]=1;
  60582. $self._assert_($recv(next).__lt((1)));
  60583. $1=$recv(current).__eq(next);
  60584. $ctx2.sendIdx["="]=1;
  60585. $self._deny_($1);
  60586. return $recv(next).__eq(current);
  60587. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  60588. }));
  60589. return self;
  60590. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  60591. },
  60592. args: [],
  60593. 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 ]",
  60594. referencedClasses: ["Random"],
  60595. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  60596. }),
  60597. $globals.RandomTest);
  60598. $core.addClass("RectangleTest", $globals.TestCase, [], "Kernel-Tests");
  60599. $core.addMethod(
  60600. $core.method({
  60601. selector: "testContainsPoint",
  60602. protocol: "tests",
  60603. fn: function (){
  60604. var self=this,$self=this;
  60605. var rect;
  60606. return $core.withContext(function($ctx1) {
  60607. var $1,$2,$4,$5,$3;
  60608. $1=(0).__at((0));
  60609. $ctx1.sendIdx["@"]=1;
  60610. $2=(4).__at((4));
  60611. $ctx1.sendIdx["@"]=2;
  60612. rect=$recv($globals.Rectangle)._origin_corner_($1,$2);
  60613. $4=rect;
  60614. $5=(1).__at((2));
  60615. $ctx1.sendIdx["@"]=3;
  60616. $3=$recv($4)._containsPoint_($5);
  60617. $ctx1.sendIdx["containsPoint:"]=1;
  60618. $self._assert_($3);
  60619. $ctx1.sendIdx["assert:"]=1;
  60620. $self._assert_($recv($recv(rect)._containsPoint_((5).__at((4))))._not());
  60621. return self;
  60622. }, function($ctx1) {$ctx1.fill(self,"testContainsPoint",{rect:rect},$globals.RectangleTest)});
  60623. },
  60624. args: [],
  60625. 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.",
  60626. referencedClasses: ["Rectangle"],
  60627. messageSends: ["origin:corner:", "@", "assert:", "containsPoint:", "not"]
  60628. }),
  60629. $globals.RectangleTest);
  60630. $core.addMethod(
  60631. $core.method({
  60632. selector: "testContainsRect",
  60633. protocol: "tests",
  60634. fn: function (){
  60635. var self=this,$self=this;
  60636. return $core.withContext(function($ctx1) {
  60637. var $3,$4,$2,$6,$7,$5,$1,$11,$12,$10,$14,$13,$9,$8;
  60638. $3=(0).__at((0));
  60639. $ctx1.sendIdx["@"]=1;
  60640. $4=(6).__at((6));
  60641. $ctx1.sendIdx["@"]=2;
  60642. $2=$recv($globals.Rectangle)._origin_corner_($3,$4);
  60643. $ctx1.sendIdx["origin:corner:"]=1;
  60644. $6=(1).__at((1));
  60645. $ctx1.sendIdx["@"]=3;
  60646. $7=(5).__at((5));
  60647. $ctx1.sendIdx["@"]=4;
  60648. $5=$recv($globals.Rectangle)._origin_corner_($6,$7);
  60649. $ctx1.sendIdx["origin:corner:"]=2;
  60650. $1=$recv($2)._containsRect_($5);
  60651. $ctx1.sendIdx["containsRect:"]=1;
  60652. $self._assert_($1);
  60653. $ctx1.sendIdx["assert:"]=1;
  60654. $11=(0).__at((0));
  60655. $ctx1.sendIdx["@"]=5;
  60656. $12=(6).__at((6));
  60657. $ctx1.sendIdx["@"]=6;
  60658. $10=$recv($globals.Rectangle)._origin_corner_($11,$12);
  60659. $ctx1.sendIdx["origin:corner:"]=3;
  60660. $14=(1).__at((-1));
  60661. $ctx1.sendIdx["@"]=7;
  60662. $13=$recv($globals.Rectangle)._origin_corner_($14,(5).__at((5)));
  60663. $9=$recv($10)._containsRect_($13);
  60664. $8=$recv($9)._not();
  60665. $self._assert_($8);
  60666. return self;
  60667. }, function($ctx1) {$ctx1.fill(self,"testContainsRect",{},$globals.RectangleTest)});
  60668. },
  60669. args: [],
  60670. 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.",
  60671. referencedClasses: ["Rectangle"],
  60672. messageSends: ["assert:", "containsRect:", "origin:corner:", "@", "not"]
  60673. }),
  60674. $globals.RectangleTest);
  60675. $core.addMethod(
  60676. $core.method({
  60677. selector: "testOriginExtent",
  60678. protocol: "tests",
  60679. fn: function (){
  60680. var self=this,$self=this;
  60681. var rectangle;
  60682. return $core.withContext(function($ctx1) {
  60683. var $1,$2,$3,$4;
  60684. $1=(3).__at((4));
  60685. $ctx1.sendIdx["@"]=1;
  60686. $2=(7).__at((8));
  60687. $ctx1.sendIdx["@"]=2;
  60688. rectangle=$recv($globals.Rectangle)._origin_extent_($1,$2);
  60689. $3=$recv(rectangle)._origin();
  60690. $4=(3).__at((4));
  60691. $ctx1.sendIdx["@"]=3;
  60692. $self._assert_equals_($3,$4);
  60693. $ctx1.sendIdx["assert:equals:"]=1;
  60694. $self._assert_equals_($recv(rectangle)._corner(),(10).__at((12)));
  60695. return self;
  60696. }, function($ctx1) {$ctx1.fill(self,"testOriginExtent",{rectangle:rectangle},$globals.RectangleTest)});
  60697. },
  60698. args: [],
  60699. 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.",
  60700. referencedClasses: ["Rectangle"],
  60701. messageSends: ["origin:extent:", "@", "assert:equals:", "origin", "corner"]
  60702. }),
  60703. $globals.RectangleTest);
  60704. $core.addClass("StreamTest", $globals.TestCase, [], "Kernel-Tests");
  60705. $core.addMethod(
  60706. $core.method({
  60707. selector: "collectionClass",
  60708. protocol: "accessing",
  60709. fn: function (){
  60710. var self=this,$self=this;
  60711. return $core.withContext(function($ctx1) {
  60712. return $recv($self._class())._collectionClass();
  60713. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  60714. },
  60715. args: [],
  60716. source: "collectionClass\x0a\x09^ self class collectionClass",
  60717. referencedClasses: [],
  60718. messageSends: ["collectionClass", "class"]
  60719. }),
  60720. $globals.StreamTest);
  60721. $core.addMethod(
  60722. $core.method({
  60723. selector: "newCollection",
  60724. protocol: "accessing",
  60725. fn: function (){
  60726. var self=this,$self=this;
  60727. return $core.withContext(function($ctx1) {
  60728. return $recv($self._collectionClass())._new();
  60729. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  60730. },
  60731. args: [],
  60732. source: "newCollection\x0a\x09^ self collectionClass new",
  60733. referencedClasses: [],
  60734. messageSends: ["new", "collectionClass"]
  60735. }),
  60736. $globals.StreamTest);
  60737. $core.addMethod(
  60738. $core.method({
  60739. selector: "newStream",
  60740. protocol: "accessing",
  60741. fn: function (){
  60742. var self=this,$self=this;
  60743. return $core.withContext(function($ctx1) {
  60744. return $recv($recv($self._collectionClass())._new())._stream();
  60745. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  60746. },
  60747. args: [],
  60748. source: "newStream\x0a\x09^ self collectionClass new stream",
  60749. referencedClasses: [],
  60750. messageSends: ["stream", "new", "collectionClass"]
  60751. }),
  60752. $globals.StreamTest);
  60753. $core.addMethod(
  60754. $core.method({
  60755. selector: "testAtStartAtEnd",
  60756. protocol: "tests",
  60757. fn: function (){
  60758. var self=this,$self=this;
  60759. var stream;
  60760. return $core.withContext(function($ctx1) {
  60761. var $1,$2,$3,$4;
  60762. stream=$self._newStream();
  60763. $1=$recv(stream)._atStart();
  60764. $ctx1.sendIdx["atStart"]=1;
  60765. $self._assert_($1);
  60766. $ctx1.sendIdx["assert:"]=1;
  60767. $2=$recv(stream)._atEnd();
  60768. $ctx1.sendIdx["atEnd"]=1;
  60769. $self._assert_($2);
  60770. $ctx1.sendIdx["assert:"]=2;
  60771. $recv(stream)._nextPutAll_($self._newCollection());
  60772. $3=$recv(stream)._atEnd();
  60773. $ctx1.sendIdx["atEnd"]=2;
  60774. $self._assert_($3);
  60775. $4=$recv(stream)._atStart();
  60776. $ctx1.sendIdx["atStart"]=2;
  60777. $self._deny_($4);
  60778. $ctx1.sendIdx["deny:"]=1;
  60779. $recv(stream)._position_((1));
  60780. $self._deny_($recv(stream)._atEnd());
  60781. $ctx1.sendIdx["deny:"]=2;
  60782. $self._deny_($recv(stream)._atStart());
  60783. return self;
  60784. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  60785. },
  60786. args: [],
  60787. 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",
  60788. referencedClasses: [],
  60789. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  60790. }),
  60791. $globals.StreamTest);
  60792. $core.addMethod(
  60793. $core.method({
  60794. selector: "testContents",
  60795. protocol: "tests",
  60796. fn: function (){
  60797. var self=this,$self=this;
  60798. var stream;
  60799. return $core.withContext(function($ctx1) {
  60800. var $1,$2;
  60801. stream=$self._newStream();
  60802. $1=stream;
  60803. $2=$self._newCollection();
  60804. $ctx1.sendIdx["newCollection"]=1;
  60805. $recv($1)._nextPutAll_($2);
  60806. $self._assert_equals_($recv(stream)._contents(),$self._newCollection());
  60807. return self;
  60808. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  60809. },
  60810. args: [],
  60811. 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",
  60812. referencedClasses: [],
  60813. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  60814. }),
  60815. $globals.StreamTest);
  60816. $core.addMethod(
  60817. $core.method({
  60818. selector: "testIsEmpty",
  60819. protocol: "tests",
  60820. fn: function (){
  60821. var self=this,$self=this;
  60822. var stream;
  60823. return $core.withContext(function($ctx1) {
  60824. var $1;
  60825. stream=$self._newStream();
  60826. $1=$recv(stream)._isEmpty();
  60827. $ctx1.sendIdx["isEmpty"]=1;
  60828. $self._assert_($1);
  60829. $recv(stream)._nextPutAll_($self._newCollection());
  60830. $self._deny_($recv(stream)._isEmpty());
  60831. return self;
  60832. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  60833. },
  60834. args: [],
  60835. 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",
  60836. referencedClasses: [],
  60837. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  60838. }),
  60839. $globals.StreamTest);
  60840. $core.addMethod(
  60841. $core.method({
  60842. selector: "testPosition",
  60843. protocol: "tests",
  60844. fn: function (){
  60845. var self=this,$self=this;
  60846. var collection,stream;
  60847. return $core.withContext(function($ctx1) {
  60848. var $1,$2,$3;
  60849. collection=$self._newCollection();
  60850. stream=$self._newStream();
  60851. $recv(stream)._nextPutAll_(collection);
  60852. $1=$recv(stream)._position();
  60853. $ctx1.sendIdx["position"]=1;
  60854. $self._assert_equals_($1,$recv(collection)._size());
  60855. $ctx1.sendIdx["assert:equals:"]=1;
  60856. $recv(stream)._position_((0));
  60857. $2=$recv(stream)._position();
  60858. $ctx1.sendIdx["position"]=2;
  60859. $self._assert_equals_($2,(0));
  60860. $ctx1.sendIdx["assert:equals:"]=2;
  60861. $recv(stream)._next();
  60862. $ctx1.sendIdx["next"]=1;
  60863. $3=$recv(stream)._position();
  60864. $ctx1.sendIdx["position"]=3;
  60865. $self._assert_equals_($3,(1));
  60866. $ctx1.sendIdx["assert:equals:"]=3;
  60867. $recv(stream)._next();
  60868. $self._assert_equals_($recv(stream)._position(),(2));
  60869. return self;
  60870. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  60871. },
  60872. args: [],
  60873. 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",
  60874. referencedClasses: [],
  60875. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  60876. }),
  60877. $globals.StreamTest);
  60878. $core.addMethod(
  60879. $core.method({
  60880. selector: "testReading",
  60881. protocol: "tests",
  60882. fn: function (){
  60883. var self=this,$self=this;
  60884. var stream,collection;
  60885. return $core.withContext(function($ctx1) {
  60886. var $1,$2;
  60887. collection=$self._newCollection();
  60888. stream=$self._newStream();
  60889. $1=stream;
  60890. $recv($1)._nextPutAll_(collection);
  60891. $recv($1)._position_((0));
  60892. $recv(collection)._do_((function(each){
  60893. return $core.withContext(function($ctx2) {
  60894. $2=$recv(stream)._next();
  60895. $ctx2.sendIdx["next"]=1;
  60896. return $self._assert_equals_($2,each);
  60897. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60898. }));
  60899. $self._assert_($recv($recv(stream)._next())._isNil());
  60900. return self;
  60901. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  60902. },
  60903. args: [],
  60904. 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",
  60905. referencedClasses: [],
  60906. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  60907. }),
  60908. $globals.StreamTest);
  60909. $core.addMethod(
  60910. $core.method({
  60911. selector: "testStreamContents",
  60912. protocol: "tests",
  60913. fn: function (){
  60914. var self=this,$self=this;
  60915. return self;
  60916. },
  60917. args: [],
  60918. source: "testStreamContents",
  60919. referencedClasses: [],
  60920. messageSends: []
  60921. }),
  60922. $globals.StreamTest);
  60923. $core.addMethod(
  60924. $core.method({
  60925. selector: "testWrite",
  60926. protocol: "tests",
  60927. fn: function (){
  60928. var self=this,$self=this;
  60929. var stream,collection;
  60930. return $core.withContext(function($ctx1) {
  60931. collection=$self._newCollection();
  60932. stream=$self._newStream();
  60933. $recv(collection)._do_((function(each){
  60934. return $core.withContext(function($ctx2) {
  60935. return $recv(stream).__lt_lt(each);
  60936. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60937. }));
  60938. $self._assert_equals_($recv(stream)._contents(),collection);
  60939. return self;
  60940. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  60941. },
  60942. args: [],
  60943. 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",
  60944. referencedClasses: [],
  60945. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  60946. }),
  60947. $globals.StreamTest);
  60948. $core.addMethod(
  60949. $core.method({
  60950. selector: "testWriting",
  60951. protocol: "tests",
  60952. fn: function (){
  60953. var self=this,$self=this;
  60954. var stream,collection;
  60955. return $core.withContext(function($ctx1) {
  60956. var $1;
  60957. collection=$self._newCollection();
  60958. stream=$self._newStream();
  60959. $ctx1.sendIdx["newStream"]=1;
  60960. $recv(collection)._do_((function(each){
  60961. return $core.withContext(function($ctx2) {
  60962. return $recv(stream)._nextPut_(each);
  60963. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60964. }));
  60965. $1=$recv(stream)._contents();
  60966. $ctx1.sendIdx["contents"]=1;
  60967. $self._assert_equals_($1,collection);
  60968. $ctx1.sendIdx["assert:equals:"]=1;
  60969. stream=$self._newStream();
  60970. $recv(stream)._nextPutAll_(collection);
  60971. $self._assert_equals_($recv(stream)._contents(),collection);
  60972. return self;
  60973. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  60974. },
  60975. args: [],
  60976. 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",
  60977. referencedClasses: [],
  60978. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  60979. }),
  60980. $globals.StreamTest);
  60981. $core.addMethod(
  60982. $core.method({
  60983. selector: "collectionClass",
  60984. protocol: "accessing",
  60985. fn: function (){
  60986. var self=this,$self=this;
  60987. return nil;
  60988. },
  60989. args: [],
  60990. source: "collectionClass\x0a\x09^ nil",
  60991. referencedClasses: [],
  60992. messageSends: []
  60993. }),
  60994. $globals.StreamTest.a$cls);
  60995. $core.addMethod(
  60996. $core.method({
  60997. selector: "isAbstract",
  60998. protocol: "testing",
  60999. fn: function (){
  61000. var self=this,$self=this;
  61001. return $core.withContext(function($ctx1) {
  61002. return $recv($self._collectionClass())._isNil();
  61003. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.a$cls)});
  61004. },
  61005. args: [],
  61006. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  61007. referencedClasses: [],
  61008. messageSends: ["isNil", "collectionClass"]
  61009. }),
  61010. $globals.StreamTest.a$cls);
  61011. $core.addClass("ArrayStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  61012. $core.addMethod(
  61013. $core.method({
  61014. selector: "newCollection",
  61015. protocol: "accessing",
  61016. fn: function (){
  61017. var self=this,$self=this;
  61018. return $core.withContext(function($ctx1) {
  61019. return [true,(1),(3).__at((4)),"foo"];
  61020. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  61021. },
  61022. args: [],
  61023. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  61024. referencedClasses: [],
  61025. messageSends: ["@"]
  61026. }),
  61027. $globals.ArrayStreamTest);
  61028. $core.addMethod(
  61029. $core.method({
  61030. selector: "collectionClass",
  61031. protocol: "accessing",
  61032. fn: function (){
  61033. var self=this,$self=this;
  61034. return $globals.Array;
  61035. },
  61036. args: [],
  61037. source: "collectionClass\x0a\x09^ Array",
  61038. referencedClasses: ["Array"],
  61039. messageSends: []
  61040. }),
  61041. $globals.ArrayStreamTest.a$cls);
  61042. $core.addClass("StringStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  61043. $core.addMethod(
  61044. $core.method({
  61045. selector: "newCollection",
  61046. protocol: "accessing",
  61047. fn: function (){
  61048. var self=this,$self=this;
  61049. return "hello world";
  61050. },
  61051. args: [],
  61052. source: "newCollection\x0a\x09^ 'hello world'",
  61053. referencedClasses: [],
  61054. messageSends: []
  61055. }),
  61056. $globals.StringStreamTest);
  61057. $core.addMethod(
  61058. $core.method({
  61059. selector: "collectionClass",
  61060. protocol: "accessing",
  61061. fn: function (){
  61062. var self=this,$self=this;
  61063. return $globals.String;
  61064. },
  61065. args: [],
  61066. source: "collectionClass\x0a\x09^ String",
  61067. referencedClasses: ["String"],
  61068. messageSends: []
  61069. }),
  61070. $globals.StringStreamTest.a$cls);
  61071. $core.addClass("UndefinedTest", $globals.TestCase, [], "Kernel-Tests");
  61072. $core.addMethod(
  61073. $core.method({
  61074. selector: "testCopying",
  61075. protocol: "tests",
  61076. fn: function (){
  61077. var self=this,$self=this;
  61078. return $core.withContext(function($ctx1) {
  61079. $self._assert_equals_(nil._copy(),nil);
  61080. return self;
  61081. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  61082. },
  61083. args: [],
  61084. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  61085. referencedClasses: [],
  61086. messageSends: ["assert:equals:", "copy"]
  61087. }),
  61088. $globals.UndefinedTest);
  61089. $core.addMethod(
  61090. $core.method({
  61091. selector: "testDeepCopy",
  61092. protocol: "tests",
  61093. fn: function (){
  61094. var self=this,$self=this;
  61095. return $core.withContext(function($ctx1) {
  61096. $self._assert_($recv(nil._deepCopy()).__eq(nil));
  61097. return self;
  61098. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  61099. },
  61100. args: [],
  61101. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  61102. referencedClasses: [],
  61103. messageSends: ["assert:", "=", "deepCopy"]
  61104. }),
  61105. $globals.UndefinedTest);
  61106. $core.addMethod(
  61107. $core.method({
  61108. selector: "testIfNil",
  61109. protocol: "tests",
  61110. fn: function (){
  61111. var self=this,$self=this;
  61112. return $core.withContext(function($ctx1) {
  61113. var $1,$3,$2,$4,$6,$5,$receiver;
  61114. if(($receiver = nil) == null || $receiver.a$nil){
  61115. $1=true;
  61116. } else {
  61117. $1=nil;
  61118. }
  61119. $self._assert_equals_($1,true);
  61120. $ctx1.sendIdx["assert:equals:"]=1;
  61121. if(($receiver = nil) == null || $receiver.a$nil){
  61122. $3=nil;
  61123. } else {
  61124. $3=true;
  61125. }
  61126. $2=$recv($3).__eq(true);
  61127. $ctx1.sendIdx["="]=1;
  61128. $self._deny_($2);
  61129. $ctx1.sendIdx["deny:"]=1;
  61130. if(($receiver = nil) == null || $receiver.a$nil){
  61131. $4=true;
  61132. } else {
  61133. $4=false;
  61134. }
  61135. $self._assert_equals_($4,true);
  61136. if(($receiver = nil) == null || $receiver.a$nil){
  61137. $6=false;
  61138. } else {
  61139. $6=true;
  61140. }
  61141. $5=$recv($6).__eq(true);
  61142. $self._deny_($5);
  61143. return self;
  61144. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  61145. },
  61146. args: [],
  61147. 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",
  61148. referencedClasses: [],
  61149. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  61150. }),
  61151. $globals.UndefinedTest);
  61152. $core.addMethod(
  61153. $core.method({
  61154. selector: "testIsNil",
  61155. protocol: "tests",
  61156. fn: function (){
  61157. var self=this,$self=this;
  61158. return $core.withContext(function($ctx1) {
  61159. $self._assert_(nil._isNil());
  61160. $self._deny_(nil._notNil());
  61161. return self;
  61162. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  61163. },
  61164. args: [],
  61165. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  61166. referencedClasses: [],
  61167. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  61168. }),
  61169. $globals.UndefinedTest);
  61170. });
  61171. define('amber_core/Platform-DOM-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  61172. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61173. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61174. var $pkg = $core.addPackage("Platform-DOM-Tests");
  61175. $pkg.innerEval = function (expr) { return eval(expr); };
  61176. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  61177. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  61178. $core.addMethod(
  61179. $core.method({
  61180. selector: "testEntityConversion",
  61181. protocol: "testing",
  61182. fn: function (){
  61183. var self=this,$self=this;
  61184. return $core.withContext(function($ctx1) {
  61185. var $1;
  61186. $1=$recv($globals.PlatformDom)._isFeasible();
  61187. if($core.assert($1)){
  61188. $self._assert_equals_("&copy;"._htmlTextContent(),"©");
  61189. }
  61190. return self;
  61191. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{},$globals.PlatformDomTest)});
  61192. },
  61193. args: [],
  61194. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  61195. referencedClasses: ["PlatformDom"],
  61196. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  61197. }),
  61198. $globals.PlatformDomTest);
  61199. $core.addMethod(
  61200. $core.method({
  61201. selector: "testTextContentDoesNotRunScript",
  61202. protocol: "testing",
  61203. fn: function (){
  61204. var self=this,$self=this;
  61205. return $core.withContext(function($ctx1) {
  61206. var $1;
  61207. $1=$recv($globals.PlatformDom)._isFeasible();
  61208. if($core.assert($1)){
  61209. $self._shouldnt_raise_((function(){
  61210. return $core.withContext(function($ctx2) {
  61211. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  61212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61213. }),$globals.Error);
  61214. }
  61215. return self;
  61216. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{},$globals.PlatformDomTest)});
  61217. },
  61218. args: [],
  61219. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  61220. referencedClasses: ["PlatformDom", "Error"],
  61221. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  61222. }),
  61223. $globals.PlatformDomTest);
  61224. });
  61225. define('amber_core/SUnit-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  61226. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61227. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61228. var $pkg = $core.addPackage("SUnit-Tests");
  61229. $pkg.innerEval = function (expr) { return eval(expr); };
  61230. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  61231. $core.addClass("ExampleSetTest", $globals.TestCase, ["empty", "full"], "SUnit-Tests");
  61232. $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.";
  61233. $core.addMethod(
  61234. $core.method({
  61235. selector: "setUp",
  61236. protocol: "running",
  61237. fn: function (){
  61238. var self=this,$self=this;
  61239. return $core.withContext(function($ctx1) {
  61240. $self["@empty"]=$recv($globals.Set)._new();
  61241. $self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  61242. return self;
  61243. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  61244. },
  61245. args: [],
  61246. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  61247. referencedClasses: ["Set"],
  61248. messageSends: ["new", "with:with:"]
  61249. }),
  61250. $globals.ExampleSetTest);
  61251. $core.addMethod(
  61252. $core.method({
  61253. selector: "testAdd",
  61254. protocol: "tests",
  61255. fn: function (){
  61256. var self=this,$self=this;
  61257. return $core.withContext(function($ctx1) {
  61258. $recv($self["@empty"])._add_((5));
  61259. $self._assert_($recv($self["@empty"])._includes_((5)));
  61260. return self;
  61261. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  61262. },
  61263. args: [],
  61264. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  61265. referencedClasses: [],
  61266. messageSends: ["add:", "assert:", "includes:"]
  61267. }),
  61268. $globals.ExampleSetTest);
  61269. $core.addMethod(
  61270. $core.method({
  61271. selector: "testGrow",
  61272. protocol: "tests",
  61273. fn: function (){
  61274. var self=this,$self=this;
  61275. return $core.withContext(function($ctx1) {
  61276. $recv($self["@empty"])._addAll_((1)._to_((100)));
  61277. $self._assert_equals_($recv($self["@empty"])._size(),(100));
  61278. return self;
  61279. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  61280. },
  61281. args: [],
  61282. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  61283. referencedClasses: [],
  61284. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  61285. }),
  61286. $globals.ExampleSetTest);
  61287. $core.addMethod(
  61288. $core.method({
  61289. selector: "testIllegal",
  61290. protocol: "tests",
  61291. fn: function (){
  61292. var self=this,$self=this;
  61293. return $core.withContext(function($ctx1) {
  61294. $self._should_raise_((function(){
  61295. return $core.withContext(function($ctx2) {
  61296. return $recv($self["@empty"])._at_((5));
  61297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61298. }),$globals.Error);
  61299. $ctx1.sendIdx["should:raise:"]=1;
  61300. $self._should_raise_((function(){
  61301. return $core.withContext(function($ctx2) {
  61302. return $recv($self["@empty"])._at_put_((5),"abc");
  61303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61304. }),$globals.Error);
  61305. return self;
  61306. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  61307. },
  61308. args: [],
  61309. 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",
  61310. referencedClasses: ["Error"],
  61311. messageSends: ["should:raise:", "at:", "at:put:"]
  61312. }),
  61313. $globals.ExampleSetTest);
  61314. $core.addMethod(
  61315. $core.method({
  61316. selector: "testIncludes",
  61317. protocol: "tests",
  61318. fn: function (){
  61319. var self=this,$self=this;
  61320. return $core.withContext(function($ctx1) {
  61321. var $1;
  61322. $1=$recv($self["@full"])._includes_((5));
  61323. $ctx1.sendIdx["includes:"]=1;
  61324. $self._assert_($1);
  61325. $ctx1.sendIdx["assert:"]=1;
  61326. $self._assert_($recv($self["@full"])._includes_("abc"));
  61327. return self;
  61328. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  61329. },
  61330. args: [],
  61331. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  61332. referencedClasses: [],
  61333. messageSends: ["assert:", "includes:"]
  61334. }),
  61335. $globals.ExampleSetTest);
  61336. $core.addMethod(
  61337. $core.method({
  61338. selector: "testOccurrences",
  61339. protocol: "tests",
  61340. fn: function (){
  61341. var self=this,$self=this;
  61342. return $core.withContext(function($ctx1) {
  61343. var $1,$2;
  61344. $1=$recv($self["@empty"])._occurrencesOf_((0));
  61345. $ctx1.sendIdx["occurrencesOf:"]=1;
  61346. $self._assert_equals_($1,(0));
  61347. $ctx1.sendIdx["assert:equals:"]=1;
  61348. $2=$recv($self["@full"])._occurrencesOf_((5));
  61349. $ctx1.sendIdx["occurrencesOf:"]=2;
  61350. $self._assert_equals_($2,(1));
  61351. $ctx1.sendIdx["assert:equals:"]=2;
  61352. $recv($self["@full"])._add_((5));
  61353. $self._assert_equals_($recv($self["@full"])._occurrencesOf_((5)),(1));
  61354. return self;
  61355. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  61356. },
  61357. args: [],
  61358. 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",
  61359. referencedClasses: [],
  61360. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  61361. }),
  61362. $globals.ExampleSetTest);
  61363. $core.addMethod(
  61364. $core.method({
  61365. selector: "testRemove",
  61366. protocol: "tests",
  61367. fn: function (){
  61368. var self=this,$self=this;
  61369. return $core.withContext(function($ctx1) {
  61370. var $1;
  61371. $recv($self["@full"])._remove_((5));
  61372. $1=$recv($self["@full"])._includes_("abc");
  61373. $ctx1.sendIdx["includes:"]=1;
  61374. $self._assert_($1);
  61375. $self._deny_($recv($self["@full"])._includes_((5)));
  61376. return self;
  61377. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  61378. },
  61379. args: [],
  61380. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  61381. referencedClasses: [],
  61382. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  61383. }),
  61384. $globals.ExampleSetTest);
  61385. $core.addClass("SUnitAsyncTest", $globals.TestCase, ["flag"], "SUnit-Tests");
  61386. $core.addMethod(
  61387. $core.method({
  61388. selector: "fakeError",
  61389. protocol: "helpers",
  61390. fn: function (){
  61391. var self=this,$self=this;
  61392. return $core.withContext(function($ctx1) {
  61393. $self["@flag"]="bad";
  61394. $self._timeout_((30));
  61395. $self["@flag"]=$recv($self._async_((function(){
  61396. return $core.withContext(function($ctx2) {
  61397. $self["@flag"]="ok";
  61398. return $self._error_("Intentional");
  61399. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61400. })))._valueWithTimeout_((20));
  61401. return self;
  61402. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  61403. },
  61404. args: [],
  61405. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  61406. referencedClasses: [],
  61407. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61408. }),
  61409. $globals.SUnitAsyncTest);
  61410. $core.addMethod(
  61411. $core.method({
  61412. selector: "fakeErrorFailingInTearDown",
  61413. protocol: "helpers",
  61414. fn: function (){
  61415. var self=this,$self=this;
  61416. return $core.withContext(function($ctx1) {
  61417. $self["@flag"]="bad";
  61418. $self._timeout_((30));
  61419. $self["@flag"]=$recv($self._async_((function(){
  61420. return $core.withContext(function($ctx2) {
  61421. return $self._error_("Intentional");
  61422. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61423. })))._valueWithTimeout_((20));
  61424. return self;
  61425. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  61426. },
  61427. args: [],
  61428. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  61429. referencedClasses: [],
  61430. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61431. }),
  61432. $globals.SUnitAsyncTest);
  61433. $core.addMethod(
  61434. $core.method({
  61435. selector: "fakeFailure",
  61436. protocol: "helpers",
  61437. fn: function (){
  61438. var self=this,$self=this;
  61439. return $core.withContext(function($ctx1) {
  61440. $self["@flag"]="bad";
  61441. $self._timeout_((30));
  61442. $self["@flag"]=$recv($self._async_((function(){
  61443. return $core.withContext(function($ctx2) {
  61444. $self["@flag"]="ok";
  61445. return $self._assert_(false);
  61446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61447. })))._valueWithTimeout_((20));
  61448. return self;
  61449. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  61450. },
  61451. args: [],
  61452. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  61453. referencedClasses: [],
  61454. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  61455. }),
  61456. $globals.SUnitAsyncTest);
  61457. $core.addMethod(
  61458. $core.method({
  61459. selector: "fakeMultipleTimeoutFailing",
  61460. protocol: "helpers",
  61461. fn: function (){
  61462. var self=this,$self=this;
  61463. return $core.withContext(function($ctx1) {
  61464. var $1;
  61465. $self._timeout_((100));
  61466. $ctx1.sendIdx["timeout:"]=1;
  61467. $1=$self._async_((function(){
  61468. return $core.withContext(function($ctx2) {
  61469. $self._timeout_((20));
  61470. return $recv($self._async_((function(){
  61471. return $core.withContext(function($ctx3) {
  61472. return $self._finished();
  61473. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61474. })))._valueWithTimeout_((30));
  61475. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61476. }));
  61477. $ctx1.sendIdx["async:"]=1;
  61478. $recv($1)._valueWithTimeout_((20));
  61479. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61480. return self;
  61481. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  61482. },
  61483. args: [],
  61484. 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",
  61485. referencedClasses: [],
  61486. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61487. }),
  61488. $globals.SUnitAsyncTest);
  61489. $core.addMethod(
  61490. $core.method({
  61491. selector: "fakeMultipleTimeoutPassing",
  61492. protocol: "helpers",
  61493. fn: function (){
  61494. var self=this,$self=this;
  61495. return $core.withContext(function($ctx1) {
  61496. var $1;
  61497. $self._timeout_((20));
  61498. $ctx1.sendIdx["timeout:"]=1;
  61499. $1=$self._async_((function(){
  61500. return $core.withContext(function($ctx2) {
  61501. $self._timeout_((40));
  61502. return $recv($self._async_((function(){
  61503. return $core.withContext(function($ctx3) {
  61504. return $self._finished();
  61505. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61506. })))._valueWithTimeout_((20));
  61507. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61508. }));
  61509. $ctx1.sendIdx["async:"]=1;
  61510. $recv($1)._valueWithTimeout_((10));
  61511. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61512. return self;
  61513. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  61514. },
  61515. args: [],
  61516. 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",
  61517. referencedClasses: [],
  61518. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61519. }),
  61520. $globals.SUnitAsyncTest);
  61521. $core.addMethod(
  61522. $core.method({
  61523. selector: "fakeTimeout",
  61524. protocol: "helpers",
  61525. fn: function (){
  61526. var self=this,$self=this;
  61527. return $core.withContext(function($ctx1) {
  61528. $self._timeout_((10));
  61529. $recv($self._async_((function(){
  61530. return $core.withContext(function($ctx2) {
  61531. return $self._finished();
  61532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61533. })))._valueWithTimeout_((20));
  61534. return self;
  61535. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  61536. },
  61537. args: [],
  61538. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  61539. referencedClasses: [],
  61540. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61541. }),
  61542. $globals.SUnitAsyncTest);
  61543. $core.addMethod(
  61544. $core.method({
  61545. selector: "selectorSetOf:",
  61546. protocol: "private",
  61547. fn: function (aCollection){
  61548. var self=this,$self=this;
  61549. return $core.withContext(function($ctx1) {
  61550. return $recv($recv(aCollection)._collect_((function(each){
  61551. return $core.withContext(function($ctx2) {
  61552. return $recv(each)._selector();
  61553. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61554. })))._asSet();
  61555. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  61556. },
  61557. args: ["aCollection"],
  61558. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  61559. referencedClasses: [],
  61560. messageSends: ["asSet", "collect:", "selector"]
  61561. }),
  61562. $globals.SUnitAsyncTest);
  61563. $core.addMethod(
  61564. $core.method({
  61565. selector: "setUp",
  61566. protocol: "running",
  61567. fn: function (){
  61568. var self=this,$self=this;
  61569. $self["@flag"]="ok";
  61570. return self;
  61571. },
  61572. args: [],
  61573. source: "setUp\x0a\x09flag := 'ok'",
  61574. referencedClasses: [],
  61575. messageSends: []
  61576. }),
  61577. $globals.SUnitAsyncTest);
  61578. $core.addMethod(
  61579. $core.method({
  61580. selector: "tearDown",
  61581. protocol: "running",
  61582. fn: function (){
  61583. var self=this,$self=this;
  61584. return $core.withContext(function($ctx1) {
  61585. $self._assert_equals_("ok",$self["@flag"]);
  61586. return self;
  61587. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  61588. },
  61589. args: [],
  61590. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  61591. referencedClasses: [],
  61592. messageSends: ["assert:equals:"]
  61593. }),
  61594. $globals.SUnitAsyncTest);
  61595. $core.addMethod(
  61596. $core.method({
  61597. selector: "testAsyncErrorsAndFailures",
  61598. protocol: "tests",
  61599. fn: function (){
  61600. var self=this,$self=this;
  61601. var suite,runner,result,assertBlock;
  61602. return $core.withContext(function($ctx1) {
  61603. var $1,$2,$3,$4;
  61604. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  61605. return $core.withContext(function($ctx2) {
  61606. return $recv($self._class())._selector_(each);
  61607. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61608. }));
  61609. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61610. $self._timeout_((200));
  61611. result=$recv(runner)._result();
  61612. $ctx1.sendIdx["result"]=1;
  61613. assertBlock=$self._async_((function(){
  61614. return $core.withContext(function($ctx2) {
  61615. $1=$self._selectorSetOf_($recv(result)._errors());
  61616. $ctx2.sendIdx["selectorSetOf:"]=1;
  61617. $2=["fakeError"]._asSet();
  61618. $ctx2.sendIdx["asSet"]=1;
  61619. $self._assert_equals_($1,$2);
  61620. $ctx2.sendIdx["assert:equals:"]=1;
  61621. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  61622. return $self._finished();
  61623. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61624. }));
  61625. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61626. return $core.withContext(function($ctx2) {
  61627. $3=$recv($recv(ann)._result()).__eq_eq(result);
  61628. if($core.assert($3)){
  61629. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61630. return $recv($4)._ifTrue_(assertBlock);
  61631. }
  61632. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61633. }));
  61634. $recv(runner)._run();
  61635. return self;
  61636. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61637. },
  61638. args: [],
  61639. 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",
  61640. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  61641. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61642. }),
  61643. $globals.SUnitAsyncTest);
  61644. $core.addMethod(
  61645. $core.method({
  61646. selector: "testAsyncNeedsTimeout",
  61647. protocol: "tests",
  61648. fn: function (){
  61649. var self=this,$self=this;
  61650. return $core.withContext(function($ctx1) {
  61651. $self._should_raise_((function(){
  61652. return $core.withContext(function($ctx2) {
  61653. return $self._async_((function(){
  61654. }));
  61655. $ctx2.sendIdx["async:"]=1;
  61656. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61657. }),$globals.Error);
  61658. $self._timeout_((0));
  61659. $self._shouldnt_raise_((function(){
  61660. return $core.withContext(function($ctx2) {
  61661. return $self._async_((function(){
  61662. }));
  61663. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61664. }),$globals.Error);
  61665. $self._finished();
  61666. return self;
  61667. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61668. },
  61669. args: [],
  61670. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  61671. referencedClasses: ["Error"],
  61672. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  61673. }),
  61674. $globals.SUnitAsyncTest);
  61675. $core.addMethod(
  61676. $core.method({
  61677. selector: "testFinishedNeedsTimeout",
  61678. protocol: "tests",
  61679. fn: function (){
  61680. var self=this,$self=this;
  61681. return $core.withContext(function($ctx1) {
  61682. $self._should_raise_((function(){
  61683. return $core.withContext(function($ctx2) {
  61684. return $self._finished();
  61685. $ctx2.sendIdx["finished"]=1;
  61686. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61687. }),$globals.Error);
  61688. $self._timeout_((0));
  61689. $self._shouldnt_raise_((function(){
  61690. return $core.withContext(function($ctx2) {
  61691. return $self._finished();
  61692. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61693. }),$globals.Error);
  61694. return self;
  61695. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61696. },
  61697. args: [],
  61698. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  61699. referencedClasses: ["Error"],
  61700. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  61701. }),
  61702. $globals.SUnitAsyncTest);
  61703. $core.addMethod(
  61704. $core.method({
  61705. selector: "testIsAsyncReturnsCorrectValues",
  61706. protocol: "tests",
  61707. fn: function (){
  61708. var self=this,$self=this;
  61709. return $core.withContext(function($ctx1) {
  61710. var $1,$2;
  61711. $1=$self._isAsync();
  61712. $ctx1.sendIdx["isAsync"]=1;
  61713. $self._deny_($1);
  61714. $ctx1.sendIdx["deny:"]=1;
  61715. $self._timeout_((0));
  61716. $2=$self._isAsync();
  61717. $ctx1.sendIdx["isAsync"]=2;
  61718. $self._assert_($2);
  61719. $self._finished();
  61720. $self._deny_($self._isAsync());
  61721. return self;
  61722. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  61723. },
  61724. args: [],
  61725. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  61726. referencedClasses: [],
  61727. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  61728. }),
  61729. $globals.SUnitAsyncTest);
  61730. $core.addMethod(
  61731. $core.method({
  61732. selector: "testPass",
  61733. protocol: "tests",
  61734. fn: function (){
  61735. var self=this,$self=this;
  61736. return $core.withContext(function($ctx1) {
  61737. $self["@flag"]="bad";
  61738. $self._timeout_((10));
  61739. $self["@flag"]=$recv($self._async_((function(){
  61740. return $core.withContext(function($ctx2) {
  61741. $self._assert_(true);
  61742. $self._finished();
  61743. $self["@flag"]="ok";
  61744. return $self["@flag"];
  61745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61746. })))._valueWithTimeout_((5));
  61747. return self;
  61748. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  61749. },
  61750. args: [],
  61751. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  61752. referencedClasses: [],
  61753. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  61754. }),
  61755. $globals.SUnitAsyncTest);
  61756. $core.addMethod(
  61757. $core.method({
  61758. selector: "testTimeouts",
  61759. protocol: "tests",
  61760. fn: function (){
  61761. var self=this,$self=this;
  61762. var suite,runner,result,assertBlock;
  61763. return $core.withContext(function($ctx1) {
  61764. var $1,$2,$3;
  61765. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  61766. return $core.withContext(function($ctx2) {
  61767. return $recv($self._class())._selector_(each);
  61768. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61769. }));
  61770. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61771. $self._timeout_((200));
  61772. result=$recv(runner)._result();
  61773. $ctx1.sendIdx["result"]=1;
  61774. assertBlock=$self._async_((function(){
  61775. return $core.withContext(function($ctx2) {
  61776. $1=$self._selectorSetOf_($recv(result)._errors());
  61777. $ctx2.sendIdx["selectorSetOf:"]=1;
  61778. $self._assert_equals_($1,$recv($globals.Set)._new());
  61779. $ctx2.sendIdx["assert:equals:"]=1;
  61780. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  61781. return $self._finished();
  61782. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61783. }));
  61784. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61785. return $core.withContext(function($ctx2) {
  61786. $2=$recv($recv(ann)._result()).__eq_eq(result);
  61787. if($core.assert($2)){
  61788. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61789. return $recv($3)._ifTrue_(assertBlock);
  61790. }
  61791. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61792. }));
  61793. $recv(runner)._run();
  61794. return self;
  61795. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61796. },
  61797. args: [],
  61798. 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",
  61799. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  61800. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61801. }),
  61802. $globals.SUnitAsyncTest);
  61803. $core.addMethod(
  61804. $core.method({
  61805. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  61806. protocol: "tests",
  61807. fn: function (){
  61808. var self=this,$self=this;
  61809. var x;
  61810. return $core.withContext(function($ctx1) {
  61811. var $1;
  61812. $self["@flag"]="bad";
  61813. $self._timeout_((10));
  61814. x=(0);
  61815. $1=$self._async_((function(){
  61816. return $core.withContext(function($ctx2) {
  61817. $self._finished();
  61818. $ctx2.sendIdx["finished"]=1;
  61819. $self["@flag"]="ok";
  61820. x=$recv(x).__plus((1));
  61821. $ctx2.sendIdx["+"]=1;
  61822. return $self._assert_equals_(x,(1));
  61823. $ctx2.sendIdx["assert:equals:"]=1;
  61824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61825. }));
  61826. $ctx1.sendIdx["async:"]=1;
  61827. $self["@flag"]=$recv($1)._valueWithTimeout_((0));
  61828. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61829. $self["@flag"]=$recv($self._async_((function(){
  61830. return $core.withContext(function($ctx2) {
  61831. $self._finished();
  61832. $self["@flag"]="ok";
  61833. x=$recv(x).__plus((1));
  61834. return $self._assert_equals_(x,(1));
  61835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61836. })))._valueWithTimeout_((0));
  61837. return self;
  61838. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  61839. },
  61840. args: [],
  61841. 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.",
  61842. referencedClasses: [],
  61843. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  61844. }),
  61845. $globals.SUnitAsyncTest);
  61846. });
  61847. define('amber/devel',[
  61848. './lang',
  61849. './brikz', // pre-fetch, dep of ./boot
  61850. './kernel-checks', // pre-fetch, dep of ./boot
  61851. './kernel-fundamentals', // pre-fetch, dep of ./boot
  61852. './kernel-language', // pre-fetch, dep of ./boot
  61853. './boot', // pre-fetch, class loader
  61854. './deploy', // pre-fetch, dep of ./lang
  61855. // --- packages of the development only Amber begin here ---
  61856. 'amber_core/Platform-DOM',
  61857. 'amber_core/SUnit',
  61858. 'amber_core/Compiler-Tests',
  61859. 'amber_core/Kernel-Tests',
  61860. 'amber_core/Platform-DOM-Tests',
  61861. 'amber_core/SUnit-Tests'
  61862. // --- packages of the development only Amber end here ---
  61863. ], function (amber) {
  61864. return amber;
  61865. });
  61866. define('amber_core/Platform-Node',["amber/boot"
  61867. , "amber_core/Platform-Services"
  61868. , "amber_core/Kernel-Objects"], function($boot
  61869. ){"use strict";
  61870. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61871. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61872. var $pkg = $core.addPackage("Platform-Node");
  61873. $pkg.innerEval = function (expr) { return eval(expr); };
  61874. $pkg.imports = ["amber_core/Platform-Services"];
  61875. $pkg.transport = {"type":"amd","amdNamespace":"amber_core"};
  61876. $core.addClass("NodePlatform", $globals.Object, [], "Platform-Node");
  61877. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  61878. $core.addMethod(
  61879. $core.method({
  61880. selector: "globals",
  61881. protocol: "accessing",
  61882. fn: function (){
  61883. var self=this,$self=this;
  61884. return global;
  61885. },
  61886. args: [],
  61887. source: "globals\x0a\x09^ global",
  61888. referencedClasses: [],
  61889. messageSends: []
  61890. }),
  61891. $globals.NodePlatform);
  61892. $core.addMethod(
  61893. $core.method({
  61894. selector: "newXhr",
  61895. protocol: "accessing",
  61896. fn: function (){
  61897. var self=this,$self=this;
  61898. return $core.withContext(function($ctx1) {
  61899. var $receiver;
  61900. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.a$nil){
  61901. $self._error_("XMLHttpRequest not available.");
  61902. } else {
  61903. return $recv($globals.XMLHttpRequest)._new();
  61904. }
  61905. return self;
  61906. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  61907. },
  61908. args: [],
  61909. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  61910. referencedClasses: ["XMLHttpRequest"],
  61911. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  61912. }),
  61913. $globals.NodePlatform);
  61914. $core.addMethod(
  61915. $core.method({
  61916. selector: "initialize",
  61917. protocol: "testing",
  61918. fn: function (){
  61919. var self=this,$self=this;
  61920. return $core.withContext(function($ctx1) {
  61921. var $1;
  61922. $1=$self._isFeasible();
  61923. if($core.assert($1)){
  61924. $recv($globals.Platform)._registerIfNone_($self._new());
  61925. }
  61926. return self;
  61927. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.a$cls)});
  61928. },
  61929. args: [],
  61930. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  61931. referencedClasses: ["Platform"],
  61932. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  61933. }),
  61934. $globals.NodePlatform.a$cls);
  61935. $core.addMethod(
  61936. $core.method({
  61937. selector: "isFeasible",
  61938. protocol: "testing",
  61939. fn: function (){
  61940. var self=this,$self=this;
  61941. return $core.withContext(function($ctx1) {
  61942. return typeof process !== "undefined" && process && process.versions && process.versions.node != null;
  61943. return self;
  61944. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.a$cls)});
  61945. },
  61946. args: [],
  61947. source: "isFeasible\x0a<inlineJS: 'return typeof process !== \x22undefined\x22 && process && process.versions && process.versions.node != null'>",
  61948. referencedClasses: [],
  61949. messageSends: []
  61950. }),
  61951. $globals.NodePlatform.a$cls);
  61952. });
  61953. define('amber_cli/AmberCli',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61954. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61955. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61956. var $pkg = $core.addPackage("AmberCli");
  61957. $pkg.innerEval = function (expr) { return eval(expr); };
  61958. $pkg.transport = {"type":"amd","amdNamespace":"amber_cli"};
  61959. $core.addClass("AmberCli", $globals.Object, [], "AmberCli");
  61960. $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.";
  61961. $core.addMethod(
  61962. $core.method({
  61963. selector: "commandLineSwitches",
  61964. protocol: "commandline",
  61965. fn: function (){
  61966. var self=this,$self=this;
  61967. var switches;
  61968. return $core.withContext(function($ctx1) {
  61969. switches=$recv($recv($self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  61970. return $core.withContext(function($ctx2) {
  61971. return $recv(each)._selector();
  61972. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61973. }));
  61974. $ctx1.sendIdx["collect:"]=1;
  61975. switches=$recv(switches)._select_((function(each){
  61976. return $core.withContext(function($ctx2) {
  61977. return $recv(each)._match_("^[^:]*:$");
  61978. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61979. }));
  61980. switches=$recv(switches)._collect_((function(each){
  61981. return $core.withContext(function($ctx2) {
  61982. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  61983. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  61984. }));
  61985. return switches;
  61986. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.a$cls)});
  61987. },
  61988. args: [],
  61989. 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",
  61990. referencedClasses: [],
  61991. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  61992. }),
  61993. $globals.AmberCli.a$cls);
  61994. $core.addMethod(
  61995. $core.method({
  61996. selector: "config:",
  61997. protocol: "commands",
  61998. fn: function (args){
  61999. var self=this,$self=this;
  62000. return $core.withContext(function($ctx1) {
  62001. $recv($recv($globals.Configurator)._new())._start();
  62002. return self;
  62003. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.a$cls)});
  62004. },
  62005. args: ["args"],
  62006. source: "config: args\x0a\x09Configurator new start",
  62007. referencedClasses: ["Configurator"],
  62008. messageSends: ["start", "new"]
  62009. }),
  62010. $globals.AmberCli.a$cls);
  62011. $core.addMethod(
  62012. $core.method({
  62013. selector: "handleArguments:",
  62014. protocol: "commandline",
  62015. fn: function (args){
  62016. var self=this,$self=this;
  62017. var selector;
  62018. return $core.withContext(function($ctx1) {
  62019. var $1;
  62020. $1=$recv(args)._first();
  62021. $ctx1.sendIdx["first"]=1;
  62022. selector=$self._selectorForCommandLineSwitch_($1);
  62023. $recv(args)._remove_($recv(args)._first());
  62024. $self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  62025. return self;
  62026. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.a$cls)});
  62027. },
  62028. args: ["args"],
  62029. 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)",
  62030. referencedClasses: ["Array"],
  62031. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  62032. }),
  62033. $globals.AmberCli.a$cls);
  62034. $core.addMethod(
  62035. $core.method({
  62036. selector: "help:",
  62037. protocol: "commands",
  62038. fn: function (args){
  62039. var self=this,$self=this;
  62040. return $core.withContext(function($ctx1) {
  62041. $recv($globals.Transcript)._show_("Available commands");
  62042. $recv($self._commandLineSwitches())._do_((function(each){
  62043. return $core.withContext(function($ctx2) {
  62044. return $recv(console)._log_(each);
  62045. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62046. }));
  62047. return self;
  62048. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.a$cls)});
  62049. },
  62050. args: ["args"],
  62051. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  62052. referencedClasses: ["Transcript"],
  62053. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  62054. }),
  62055. $globals.AmberCli.a$cls);
  62056. $core.addMethod(
  62057. $core.method({
  62058. selector: "init:",
  62059. protocol: "commands",
  62060. fn: function (args){
  62061. var self=this,$self=this;
  62062. return $core.withContext(function($ctx1) {
  62063. $recv($recv($globals.Initer)._new())._start();
  62064. return self;
  62065. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.a$cls)});
  62066. },
  62067. args: ["args"],
  62068. source: "init: args\x0a\x09Initer new start",
  62069. referencedClasses: ["Initer"],
  62070. messageSends: ["start", "new"]
  62071. }),
  62072. $globals.AmberCli.a$cls);
  62073. $core.addMethod(
  62074. $core.method({
  62075. selector: "main",
  62076. protocol: "startup",
  62077. fn: function (){
  62078. var self=this,$self=this;
  62079. var args,packageJSON;
  62080. return $core.withContext(function($ctx1) {
  62081. var $7,$6,$5,$4,$3,$2,$1;
  62082. var $early={};
  62083. try {
  62084. packageJSON=$recv(require)._value_("../package.json");
  62085. $7=$recv(packageJSON)._version();
  62086. $ctx1.sendIdx["version"]=1;
  62087. $6="Welcome to Amber CLI version ".__comma($7);
  62088. $5=$recv($6).__comma(" (Amber ");
  62089. $ctx1.sendIdx[","]=5;
  62090. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  62091. $ctx1.sendIdx[","]=4;
  62092. $3=$recv($4).__comma(", NodeJS ");
  62093. $ctx1.sendIdx[","]=3;
  62094. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  62095. $ctx1.sendIdx[","]=2;
  62096. $1=$recv($2).__comma(").");
  62097. $ctx1.sendIdx[","]=1;
  62098. $recv($globals.Transcript)._show_($1);
  62099. args=$recv(process)._argv();
  62100. $recv(args)._removeFrom_to_((1),(2));
  62101. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  62102. return $core.withContext(function($ctx2) {
  62103. return $self._help_(nil);
  62104. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62105. }),(function(){
  62106. return $core.withContext(function($ctx2) {
  62107. throw $early=[$self._handleArguments_(args)];
  62108. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  62109. }));
  62110. return self;
  62111. }
  62112. catch(e) {if(e===$early)return e[0]; throw e}
  62113. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON},$globals.AmberCli.a$cls)});
  62114. },
  62115. args: [],
  62116. 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]",
  62117. referencedClasses: ["Transcript", "Smalltalk"],
  62118. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  62119. }),
  62120. $globals.AmberCli.a$cls);
  62121. $core.addMethod(
  62122. $core.method({
  62123. selector: "repl:",
  62124. protocol: "commands",
  62125. fn: function (args){
  62126. var self=this,$self=this;
  62127. return $core.withContext(function($ctx1) {
  62128. return $recv($recv($globals.Repl)._new())._createInterface();
  62129. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.a$cls)});
  62130. },
  62131. args: ["args"],
  62132. source: "repl: args\x0a\x09^ Repl new createInterface",
  62133. referencedClasses: ["Repl"],
  62134. messageSends: ["createInterface", "new"]
  62135. }),
  62136. $globals.AmberCli.a$cls);
  62137. $core.addMethod(
  62138. $core.method({
  62139. selector: "selectorForCommandLineSwitch:",
  62140. protocol: "commandline",
  62141. fn: function (aSwitch){
  62142. var self=this,$self=this;
  62143. var command,selector;
  62144. return $core.withContext(function($ctx1) {
  62145. var $1;
  62146. $1=$recv($self._commandLineSwitches())._includes_(aSwitch);
  62147. if($core.assert($1)){
  62148. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  62149. return $core.withContext(function($ctx2) {
  62150. return $recv($recv(each)._second())._asUppercase();
  62151. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  62152. }))).__comma(":");
  62153. selector;
  62154. } else {
  62155. selector="help:";
  62156. selector;
  62157. }
  62158. return selector;
  62159. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.a$cls)});
  62160. },
  62161. args: ["aSwitch"],
  62162. 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",
  62163. referencedClasses: [],
  62164. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  62165. }),
  62166. $globals.AmberCli.a$cls);
  62167. $core.addMethod(
  62168. $core.method({
  62169. selector: "serve:",
  62170. protocol: "commands",
  62171. fn: function (args){
  62172. var self=this,$self=this;
  62173. return $core.withContext(function($ctx1) {
  62174. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  62175. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.a$cls)});
  62176. },
  62177. args: ["args"],
  62178. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  62179. referencedClasses: ["FileServer"],
  62180. messageSends: ["start", "createServerWithArguments:"]
  62181. }),
  62182. $globals.AmberCli.a$cls);
  62183. $core.addMethod(
  62184. $core.method({
  62185. selector: "version:",
  62186. protocol: "commands",
  62187. fn: function (arguments_){
  62188. var self=this,$self=this;
  62189. return self;
  62190. },
  62191. args: ["arguments"],
  62192. source: "version: arguments",
  62193. referencedClasses: [],
  62194. messageSends: []
  62195. }),
  62196. $globals.AmberCli.a$cls);
  62197. $core.addClass("BaseFileManipulator", $globals.Object, ["path", "fs"], "AmberCli");
  62198. $core.addMethod(
  62199. $core.method({
  62200. selector: "dirname",
  62201. protocol: "private",
  62202. fn: function (){
  62203. var self=this,$self=this;
  62204. return $core.withContext(function($ctx1) {
  62205. return __dirname;
  62206. return self;
  62207. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  62208. },
  62209. args: [],
  62210. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  62211. referencedClasses: [],
  62212. messageSends: []
  62213. }),
  62214. $globals.BaseFileManipulator);
  62215. $core.addMethod(
  62216. $core.method({
  62217. selector: "initialize",
  62218. protocol: "initialization",
  62219. fn: function (){
  62220. var self=this,$self=this;
  62221. return $core.withContext(function($ctx1) {
  62222. (
  62223. $ctx1.supercall = true,
  62224. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62225. $ctx1.supercall = false;
  62226. $self["@path"]=$recv(require)._value_("path");
  62227. $ctx1.sendIdx["value:"]=1;
  62228. $self["@fs"]=$recv(require)._value_("fs");
  62229. return self;
  62230. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  62231. },
  62232. args: [],
  62233. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  62234. referencedClasses: [],
  62235. messageSends: ["initialize", "value:"]
  62236. }),
  62237. $globals.BaseFileManipulator);
  62238. $core.addMethod(
  62239. $core.method({
  62240. selector: "rootDirname",
  62241. protocol: "private",
  62242. fn: function (){
  62243. var self=this,$self=this;
  62244. return $core.withContext(function($ctx1) {
  62245. return $recv($self["@path"])._join_with_($self._dirname(),"..");
  62246. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  62247. },
  62248. args: [],
  62249. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  62250. referencedClasses: [],
  62251. messageSends: ["join:with:", "dirname"]
  62252. }),
  62253. $globals.BaseFileManipulator);
  62254. $core.addClass("Configurator", $globals.BaseFileManipulator, [], "AmberCli");
  62255. $core.addMethod(
  62256. $core.method({
  62257. selector: "initialize",
  62258. protocol: "initialization",
  62259. fn: function (){
  62260. var self=this,$self=this;
  62261. return $core.withContext(function($ctx1) {
  62262. (
  62263. $ctx1.supercall = true,
  62264. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62265. $ctx1.supercall = false;
  62266. return self;
  62267. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  62268. },
  62269. args: [],
  62270. source: "initialize\x0a\x09super initialize",
  62271. referencedClasses: [],
  62272. messageSends: ["initialize"]
  62273. }),
  62274. $globals.Configurator);
  62275. $core.addMethod(
  62276. $core.method({
  62277. selector: "start",
  62278. protocol: "action",
  62279. fn: function (){
  62280. var self=this,$self=this;
  62281. return $core.withContext(function($ctx1) {
  62282. var $receiver;
  62283. $self._writeConfigThenDo_((function(err){
  62284. return $core.withContext(function($ctx2) {
  62285. if(($receiver = err) == null || $receiver.a$nil){
  62286. return $recv(process)._exit();
  62287. } else {
  62288. return $recv(process)._exit_((111));
  62289. }
  62290. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  62291. }));
  62292. return self;
  62293. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  62294. },
  62295. args: [],
  62296. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  62297. referencedClasses: [],
  62298. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  62299. }),
  62300. $globals.Configurator);
  62301. $core.addMethod(
  62302. $core.method({
  62303. selector: "writeConfigThenDo:",
  62304. protocol: "action",
  62305. fn: function (aBlock){
  62306. var self=this,$self=this;
  62307. return $core.withContext(function($ctx1) {
  62308. $recv($recv($recv(require)._value_("@ambers/sdk"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  62309. return self;
  62310. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  62311. },
  62312. args: ["aBlock"],
  62313. source: "writeConfigThenDo: aBlock\x0a\x09(require value: '@ambers/sdk') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  62314. referencedClasses: [],
  62315. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  62316. }),
  62317. $globals.Configurator);
  62318. $core.addClass("FileServer", $globals.BaseFileManipulator, ["http", "url", "host", "port", "basePath", "util", "username", "password", "fallbackPage"], "AmberCli");
  62319. $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.";
  62320. $core.addMethod(
  62321. $core.method({
  62322. selector: "base64Decode:",
  62323. protocol: "private",
  62324. fn: function (aString){
  62325. var self=this,$self=this;
  62326. return $core.withContext(function($ctx1) {
  62327. return (new Buffer(aString, "base64").toString());
  62328. return self;
  62329. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  62330. },
  62331. args: ["aString"],
  62332. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  62333. referencedClasses: [],
  62334. messageSends: []
  62335. }),
  62336. $globals.FileServer);
  62337. $core.addMethod(
  62338. $core.method({
  62339. selector: "basePath",
  62340. protocol: "accessing",
  62341. fn: function (){
  62342. var self=this,$self=this;
  62343. return $core.withContext(function($ctx1) {
  62344. var $1,$receiver;
  62345. $1=$self["@basePath"];
  62346. if(($receiver = $1) == null || $receiver.a$nil){
  62347. return $recv($self._class())._defaultBasePath();
  62348. } else {
  62349. return $1;
  62350. }
  62351. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  62352. },
  62353. args: [],
  62354. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  62355. referencedClasses: [],
  62356. messageSends: ["ifNil:", "defaultBasePath", "class"]
  62357. }),
  62358. $globals.FileServer);
  62359. $core.addMethod(
  62360. $core.method({
  62361. selector: "basePath:",
  62362. protocol: "accessing",
  62363. fn: function (aString){
  62364. var self=this,$self=this;
  62365. return $core.withContext(function($ctx1) {
  62366. $self["@basePath"]=aString;
  62367. $self._validateBasePath();
  62368. return self;
  62369. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  62370. },
  62371. args: ["aString"],
  62372. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  62373. referencedClasses: [],
  62374. messageSends: ["validateBasePath"]
  62375. }),
  62376. $globals.FileServer);
  62377. $core.addMethod(
  62378. $core.method({
  62379. selector: "checkDirectoryLayout",
  62380. protocol: "initialization",
  62381. fn: function (){
  62382. var self=this,$self=this;
  62383. return $core.withContext(function($ctx1) {
  62384. var $1;
  62385. $1=$recv($self["@fs"])._existsSync_($self._withBasePath_("index.html"));
  62386. if(!$core.assert($1)){
  62387. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  62388. $ctx1.sendIdx["warn:"]=1;
  62389. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  62390. $ctx1.sendIdx["warn:"]=2;
  62391. $recv(console)._warn_(" You can also specify a page to be served by default,");
  62392. $ctx1.sendIdx["warn:"]=3;
  62393. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  62394. }
  62395. return self;
  62396. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  62397. },
  62398. args: [],
  62399. 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.'].",
  62400. referencedClasses: [],
  62401. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  62402. }),
  62403. $globals.FileServer);
  62404. $core.addMethod(
  62405. $core.method({
  62406. selector: "fallbackPage",
  62407. protocol: "accessing",
  62408. fn: function (){
  62409. var self=this,$self=this;
  62410. return $self["@fallbackPage"];
  62411. },
  62412. args: [],
  62413. source: "fallbackPage\x0a\x09^ fallbackPage",
  62414. referencedClasses: [],
  62415. messageSends: []
  62416. }),
  62417. $globals.FileServer);
  62418. $core.addMethod(
  62419. $core.method({
  62420. selector: "fallbackPage:",
  62421. protocol: "accessing",
  62422. fn: function (aString){
  62423. var self=this,$self=this;
  62424. $self["@fallbackPage"]=aString;
  62425. return self;
  62426. },
  62427. args: ["aString"],
  62428. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  62429. referencedClasses: [],
  62430. messageSends: []
  62431. }),
  62432. $globals.FileServer);
  62433. $core.addMethod(
  62434. $core.method({
  62435. selector: "handleGETRequest:respondTo:",
  62436. protocol: "request handling",
  62437. fn: function (aRequest,aResponse){
  62438. var self=this,$self=this;
  62439. var uri,filename;
  62440. return $core.withContext(function($ctx1) {
  62441. var $1;
  62442. uri=$recv($self["@url"])._parse_($recv(aRequest)._url());
  62443. filename=$recv($self["@path"])._join_with_($self._basePath(),$recv(uri)._pathname());
  62444. $recv($self["@fs"])._exists_do_(filename,(function(aBoolean){
  62445. return $core.withContext(function($ctx2) {
  62446. if($core.assert(aBoolean)){
  62447. $1=$recv($recv($self["@fs"])._statSync_(filename))._isDirectory();
  62448. if($core.assert($1)){
  62449. return $self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  62450. } else {
  62451. return $self._respondFileNamed_to_(filename,aResponse);
  62452. }
  62453. } else {
  62454. return $self._respondNotFoundTo_(aResponse);
  62455. }
  62456. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  62457. }));
  62458. return self;
  62459. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  62460. },
  62461. args: ["aRequest", "aResponse"],
  62462. 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]]]",
  62463. referencedClasses: [],
  62464. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  62465. }),
  62466. $globals.FileServer);
  62467. $core.addMethod(
  62468. $core.method({
  62469. selector: "handleOPTIONSRequest:respondTo:",
  62470. protocol: "request handling",
  62471. fn: function (aRequest,aResponse){
  62472. var self=this,$self=this;
  62473. return $core.withContext(function($ctx1) {
  62474. $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)]));
  62475. $recv(aResponse)._end();
  62476. return self;
  62477. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62478. },
  62479. args: ["aRequest", "aResponse"],
  62480. 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",
  62481. referencedClasses: [],
  62482. messageSends: ["writeHead:options:", "end"]
  62483. }),
  62484. $globals.FileServer);
  62485. $core.addMethod(
  62486. $core.method({
  62487. selector: "handlePUTRequest:respondTo:",
  62488. protocol: "request handling",
  62489. fn: function (aRequest,aResponse){
  62490. var self=this,$self=this;
  62491. var file,stream;
  62492. return $core.withContext(function($ctx1) {
  62493. var $1,$2,$3,$4;
  62494. $1=$self._isAuthenticated_(aRequest);
  62495. if(!$core.assert($1)){
  62496. $self._respondAuthenticationRequiredTo_(aResponse);
  62497. return nil;
  62498. }
  62499. file=".".__comma($recv(aRequest)._url());
  62500. $ctx1.sendIdx[","]=1;
  62501. stream=$recv($self["@fs"])._createWriteStream_(file);
  62502. $recv(stream)._on_do_("error",(function(error){
  62503. return $core.withContext(function($ctx2) {
  62504. $2=console;
  62505. $3="Error creating WriteStream for file ".__comma(file);
  62506. $ctx2.sendIdx[","]=2;
  62507. $recv($2)._warn_($3);
  62508. $ctx2.sendIdx["warn:"]=1;
  62509. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  62510. $ctx2.sendIdx["warn:"]=2;
  62511. $recv(console)._warn_(" The exact error is: ".__comma(error));
  62512. return $self._respondNotCreatedTo_(aResponse);
  62513. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  62514. }));
  62515. $ctx1.sendIdx["on:do:"]=1;
  62516. $recv(stream)._on_do_("close",(function(){
  62517. return $core.withContext(function($ctx2) {
  62518. return $self._respondCreatedTo_(aResponse);
  62519. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62520. }));
  62521. $ctx1.sendIdx["on:do:"]=2;
  62522. $recv(aRequest)._setEncoding_("utf8");
  62523. $recv(aRequest)._on_do_("data",(function(data){
  62524. return $core.withContext(function($ctx2) {
  62525. return $recv(stream)._write_(data);
  62526. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  62527. }));
  62528. $ctx1.sendIdx["on:do:"]=3;
  62529. $recv(aRequest)._on_do_("end",(function(){
  62530. return $core.withContext(function($ctx2) {
  62531. $4=$recv(stream)._writable();
  62532. if($core.assert($4)){
  62533. return $recv(stream)._end();
  62534. }
  62535. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62536. }));
  62537. return self;
  62538. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  62539. },
  62540. args: ["aRequest", "aResponse"],
  62541. 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]]",
  62542. referencedClasses: [],
  62543. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  62544. }),
  62545. $globals.FileServer);
  62546. $core.addMethod(
  62547. $core.method({
  62548. selector: "handleRequest:respondTo:",
  62549. protocol: "request handling",
  62550. fn: function (aRequest,aResponse){
  62551. var self=this,$self=this;
  62552. return $core.withContext(function($ctx1) {
  62553. var $2,$1,$4,$3,$5;
  62554. $2=$recv(aRequest)._method();
  62555. $ctx1.sendIdx["method"]=1;
  62556. $1=$recv($2).__eq("PUT");
  62557. $ctx1.sendIdx["="]=1;
  62558. if($core.assert($1)){
  62559. $self._handlePUTRequest_respondTo_(aRequest,aResponse);
  62560. }
  62561. $4=$recv(aRequest)._method();
  62562. $ctx1.sendIdx["method"]=2;
  62563. $3=$recv($4).__eq("GET");
  62564. $ctx1.sendIdx["="]=2;
  62565. if($core.assert($3)){
  62566. $self._handleGETRequest_respondTo_(aRequest,aResponse);
  62567. }
  62568. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  62569. if($core.assert($5)){
  62570. $self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  62571. }
  62572. return self;
  62573. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62574. },
  62575. args: ["aRequest", "aResponse"],
  62576. 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]",
  62577. referencedClasses: [],
  62578. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  62579. }),
  62580. $globals.FileServer);
  62581. $core.addMethod(
  62582. $core.method({
  62583. selector: "host",
  62584. protocol: "accessing",
  62585. fn: function (){
  62586. var self=this,$self=this;
  62587. return $self["@host"];
  62588. },
  62589. args: [],
  62590. source: "host\x0a\x09^ host",
  62591. referencedClasses: [],
  62592. messageSends: []
  62593. }),
  62594. $globals.FileServer);
  62595. $core.addMethod(
  62596. $core.method({
  62597. selector: "host:",
  62598. protocol: "accessing",
  62599. fn: function (hostname){
  62600. var self=this,$self=this;
  62601. $self["@host"]=hostname;
  62602. return self;
  62603. },
  62604. args: ["hostname"],
  62605. source: "host: hostname\x0a\x09host := hostname",
  62606. referencedClasses: [],
  62607. messageSends: []
  62608. }),
  62609. $globals.FileServer);
  62610. $core.addMethod(
  62611. $core.method({
  62612. selector: "initialize",
  62613. protocol: "initialization",
  62614. fn: function (){
  62615. var self=this,$self=this;
  62616. return $core.withContext(function($ctx1) {
  62617. var $1;
  62618. (
  62619. $ctx1.supercall = true,
  62620. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62621. $ctx1.supercall = false;
  62622. $self["@http"]=$self._require_("http");
  62623. $ctx1.sendIdx["require:"]=1;
  62624. $self["@util"]=$self._require_("util");
  62625. $ctx1.sendIdx["require:"]=2;
  62626. $self["@url"]=$self._require_("url");
  62627. $1=$self._class();
  62628. $ctx1.sendIdx["class"]=1;
  62629. $self["@host"]=$recv($1)._defaultHost();
  62630. $self["@port"]=$recv($self._class())._defaultPort();
  62631. $self["@username"]=nil;
  62632. $self["@password"]=nil;
  62633. $self["@fallbackPage"]=nil;
  62634. return self;
  62635. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  62636. },
  62637. args: [],
  62638. 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.",
  62639. referencedClasses: [],
  62640. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  62641. }),
  62642. $globals.FileServer);
  62643. $core.addMethod(
  62644. $core.method({
  62645. selector: "isAuthenticated:",
  62646. protocol: "private",
  62647. fn: function (aRequest){
  62648. var self=this,$self=this;
  62649. var header,token,auth,parts;
  62650. return $core.withContext(function($ctx1) {
  62651. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  62652. var $early={};
  62653. try {
  62654. $2=$recv($self["@username"])._isNil();
  62655. $ctx1.sendIdx["isNil"]=1;
  62656. $1=$recv($2)._and_((function(){
  62657. return $core.withContext(function($ctx2) {
  62658. return $recv($self["@password"])._isNil();
  62659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62660. }));
  62661. $ctx1.sendIdx["and:"]=1;
  62662. if($core.assert($1)){
  62663. return true;
  62664. }
  62665. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  62666. $ctx1.sendIdx["at:"]=1;
  62667. if(($receiver = $3) == null || $receiver.a$nil){
  62668. header="";
  62669. } else {
  62670. header=$3;
  62671. }
  62672. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  62673. throw $early=[false];
  62674. }),(function(){
  62675. return $core.withContext(function($ctx2) {
  62676. $4=$recv(header)._tokenize_(" ");
  62677. $ctx2.sendIdx["tokenize:"]=1;
  62678. if(($receiver = $4) == null || $receiver.a$nil){
  62679. token="";
  62680. } else {
  62681. token=$4;
  62682. }
  62683. $5=$recv(token)._at_((2));
  62684. $ctx2.sendIdx["at:"]=2;
  62685. auth=$self._base64Decode_($5);
  62686. parts=$recv(auth)._tokenize_(":");
  62687. $8=$self["@username"];
  62688. $9=$recv(parts)._at_((1));
  62689. $ctx2.sendIdx["at:"]=3;
  62690. $7=$recv($8).__eq($9);
  62691. $ctx2.sendIdx["="]=1;
  62692. $6=$recv($7)._and_((function(){
  62693. return $core.withContext(function($ctx3) {
  62694. return $recv($self["@password"]).__eq($recv(parts)._at_((2)));
  62695. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  62696. }));
  62697. if($core.assert($6)){
  62698. throw $early=[true];
  62699. } else {
  62700. throw $early=[false];
  62701. }
  62702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62703. }));
  62704. return self;
  62705. }
  62706. catch(e) {if(e===$early)return e[0]; throw e}
  62707. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  62708. },
  62709. args: ["aRequest"],
  62710. 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].",
  62711. referencedClasses: [],
  62712. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  62713. }),
  62714. $globals.FileServer);
  62715. $core.addMethod(
  62716. $core.method({
  62717. selector: "password:",
  62718. protocol: "accessing",
  62719. fn: function (aPassword){
  62720. var self=this,$self=this;
  62721. $self["@password"]=aPassword;
  62722. return self;
  62723. },
  62724. args: ["aPassword"],
  62725. source: "password: aPassword\x0a\x09password := aPassword.",
  62726. referencedClasses: [],
  62727. messageSends: []
  62728. }),
  62729. $globals.FileServer);
  62730. $core.addMethod(
  62731. $core.method({
  62732. selector: "port",
  62733. protocol: "accessing",
  62734. fn: function (){
  62735. var self=this,$self=this;
  62736. return $self["@port"];
  62737. },
  62738. args: [],
  62739. source: "port\x0a\x09^ port",
  62740. referencedClasses: [],
  62741. messageSends: []
  62742. }),
  62743. $globals.FileServer);
  62744. $core.addMethod(
  62745. $core.method({
  62746. selector: "port:",
  62747. protocol: "accessing",
  62748. fn: function (aNumber){
  62749. var self=this,$self=this;
  62750. $self["@port"]=aNumber;
  62751. return self;
  62752. },
  62753. args: ["aNumber"],
  62754. source: "port: aNumber\x0a\x09port := aNumber",
  62755. referencedClasses: [],
  62756. messageSends: []
  62757. }),
  62758. $globals.FileServer);
  62759. $core.addMethod(
  62760. $core.method({
  62761. selector: "require:",
  62762. protocol: "private",
  62763. fn: function (aModuleString){
  62764. var self=this,$self=this;
  62765. return $core.withContext(function($ctx1) {
  62766. return $recv(require)._value_(aModuleString);
  62767. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  62768. },
  62769. args: ["aModuleString"],
  62770. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  62771. referencedClasses: [],
  62772. messageSends: ["value:"]
  62773. }),
  62774. $globals.FileServer);
  62775. $core.addMethod(
  62776. $core.method({
  62777. selector: "respondAuthenticationRequiredTo:",
  62778. protocol: "request handling",
  62779. fn: function (aResponse){
  62780. var self=this,$self=this;
  62781. return $core.withContext(function($ctx1) {
  62782. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  62783. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  62784. $recv(aResponse)._end();
  62785. return self;
  62786. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  62787. },
  62788. args: ["aResponse"],
  62789. 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.",
  62790. referencedClasses: [],
  62791. messageSends: ["writeHead:options:", "write:", "end"]
  62792. }),
  62793. $globals.FileServer);
  62794. $core.addMethod(
  62795. $core.method({
  62796. selector: "respondCreatedTo:",
  62797. protocol: "request handling",
  62798. fn: function (aResponse){
  62799. var self=this,$self=this;
  62800. return $core.withContext(function($ctx1) {
  62801. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62802. $recv(aResponse)._end();
  62803. return self;
  62804. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62805. },
  62806. args: ["aResponse"],
  62807. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62808. referencedClasses: [],
  62809. messageSends: ["writeHead:options:", "end"]
  62810. }),
  62811. $globals.FileServer);
  62812. $core.addMethod(
  62813. $core.method({
  62814. selector: "respondDirectoryNamed:from:to:",
  62815. protocol: "request handling",
  62816. fn: function (aDirname,aUrl,aResponse){
  62817. var self=this,$self=this;
  62818. return $core.withContext(function($ctx1) {
  62819. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  62820. $2=$recv(aUrl)._pathname();
  62821. $ctx1.sendIdx["pathname"]=1;
  62822. $1=$recv($2)._endsWith_("/");
  62823. if($core.assert($1)){
  62824. $3=$recv(aDirname).__comma("index.html");
  62825. $ctx1.sendIdx[","]=1;
  62826. $self._respondFileNamed_to_($3,aResponse);
  62827. } else {
  62828. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  62829. $7=$recv(aUrl)._search();
  62830. if(($receiver = $7) == null || $receiver.a$nil){
  62831. $6="";
  62832. } else {
  62833. $6=$7;
  62834. }
  62835. $4=$recv($5).__comma($6);
  62836. $ctx1.sendIdx[","]=2;
  62837. $self._respondRedirect_to_($4,aResponse);
  62838. }
  62839. return self;
  62840. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  62841. },
  62842. args: ["aDirname", "aUrl", "aResponse"],
  62843. 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]",
  62844. referencedClasses: [],
  62845. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  62846. }),
  62847. $globals.FileServer);
  62848. $core.addMethod(
  62849. $core.method({
  62850. selector: "respondFileNamed:to:",
  62851. protocol: "request handling",
  62852. fn: function (aFilename,aResponse){
  62853. var self=this,$self=this;
  62854. var type,filename;
  62855. return $core.withContext(function($ctx1) {
  62856. var $1,$2,$3,$4;
  62857. filename=aFilename;
  62858. $recv($self["@fs"])._readFile_do_(filename,(function(ex,file){
  62859. return $core.withContext(function($ctx2) {
  62860. $1=$recv(ex)._notNil();
  62861. if($core.assert($1)){
  62862. $2=console;
  62863. $3=$recv(filename).__comma(" does not exist");
  62864. $ctx2.sendIdx[","]=1;
  62865. $recv($2)._log_($3);
  62866. return $self._respondNotFoundTo_(aResponse);
  62867. } else {
  62868. type=$recv($self._class())._mimeTypeFor_(filename);
  62869. $4=$recv(type).__eq("application/javascript");
  62870. if($core.assert($4)){
  62871. type=$recv(type).__comma(";charset=utf-8");
  62872. type;
  62873. }
  62874. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  62875. $recv(aResponse)._write_encoding_(file,"binary");
  62876. return $recv(aResponse)._end();
  62877. }
  62878. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  62879. }));
  62880. return self;
  62881. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  62882. },
  62883. args: ["aFilename", "aResponse"],
  62884. 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]]",
  62885. referencedClasses: [],
  62886. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  62887. }),
  62888. $globals.FileServer);
  62889. $core.addMethod(
  62890. $core.method({
  62891. selector: "respondInternalErrorTo:",
  62892. protocol: "request handling",
  62893. fn: function (aResponse){
  62894. var self=this,$self=this;
  62895. return $core.withContext(function($ctx1) {
  62896. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62897. $recv(aResponse)._write_("500 Internal server error");
  62898. $recv(aResponse)._end();
  62899. return self;
  62900. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  62901. },
  62902. args: ["aResponse"],
  62903. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  62904. referencedClasses: [],
  62905. messageSends: ["writeHead:options:", "write:", "end"]
  62906. }),
  62907. $globals.FileServer);
  62908. $core.addMethod(
  62909. $core.method({
  62910. selector: "respondNotCreatedTo:",
  62911. protocol: "request handling",
  62912. fn: function (aResponse){
  62913. var self=this,$self=this;
  62914. return $core.withContext(function($ctx1) {
  62915. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62916. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  62917. $recv(aResponse)._end();
  62918. return self;
  62919. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62920. },
  62921. args: ["aResponse"],
  62922. 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.",
  62923. referencedClasses: [],
  62924. messageSends: ["writeHead:options:", "write:", "end"]
  62925. }),
  62926. $globals.FileServer);
  62927. $core.addMethod(
  62928. $core.method({
  62929. selector: "respondNotFoundTo:",
  62930. protocol: "request handling",
  62931. fn: function (aResponse){
  62932. var self=this,$self=this;
  62933. return $core.withContext(function($ctx1) {
  62934. var $2,$1;
  62935. $2=$self._fallbackPage();
  62936. $ctx1.sendIdx["fallbackPage"]=1;
  62937. $1=$recv($2)._isNil();
  62938. if(!$core.assert($1)){
  62939. return $self._respondFileNamed_to_($self._fallbackPage(),aResponse);
  62940. }
  62941. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  62942. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  62943. $ctx1.sendIdx["write:"]=1;
  62944. $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>");
  62945. $ctx1.sendIdx["write:"]=2;
  62946. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  62947. $ctx1.sendIdx["write:"]=3;
  62948. $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>");
  62949. $ctx1.sendIdx["write:"]=4;
  62950. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  62951. $ctx1.sendIdx["write:"]=5;
  62952. $recv(aResponse)._write_("</ul></p></body></html>");
  62953. $recv(aResponse)._end();
  62954. return self;
  62955. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  62956. },
  62957. args: ["aResponse"],
  62958. 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",
  62959. referencedClasses: [],
  62960. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  62961. }),
  62962. $globals.FileServer);
  62963. $core.addMethod(
  62964. $core.method({
  62965. selector: "respondOKTo:",
  62966. protocol: "request handling",
  62967. fn: function (aResponse){
  62968. var self=this,$self=this;
  62969. return $core.withContext(function($ctx1) {
  62970. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62971. $recv(aResponse)._end();
  62972. return self;
  62973. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  62974. },
  62975. args: ["aResponse"],
  62976. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62977. referencedClasses: [],
  62978. messageSends: ["writeHead:options:", "end"]
  62979. }),
  62980. $globals.FileServer);
  62981. $core.addMethod(
  62982. $core.method({
  62983. selector: "respondRedirect:to:",
  62984. protocol: "request handling",
  62985. fn: function (aString,aResponse){
  62986. var self=this,$self=this;
  62987. return $core.withContext(function($ctx1) {
  62988. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  62989. $recv(aResponse)._end();
  62990. return self;
  62991. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  62992. },
  62993. args: ["aString", "aResponse"],
  62994. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  62995. referencedClasses: [],
  62996. messageSends: ["writeHead:options:", "end"]
  62997. }),
  62998. $globals.FileServer);
  62999. $core.addMethod(
  63000. $core.method({
  63001. selector: "start",
  63002. protocol: "starting",
  63003. fn: function (){
  63004. var self=this,$self=this;
  63005. return $core.withContext(function($ctx1) {
  63006. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  63007. $self._checkDirectoryLayout();
  63008. $1=$recv($self["@http"])._createServer_((function(request,response){
  63009. return $core.withContext(function($ctx2) {
  63010. return $self._handleRequest_respondTo_(request,response);
  63011. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  63012. }));
  63013. $recv($1)._on_do_("error",(function(error){
  63014. return $core.withContext(function($ctx2) {
  63015. $2=console;
  63016. $3="Error starting server: ".__comma(error);
  63017. $ctx2.sendIdx[","]=1;
  63018. return $recv($2)._log_($3);
  63019. $ctx2.sendIdx["log:"]=1;
  63020. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  63021. }));
  63022. $ctx1.sendIdx["on:do:"]=1;
  63023. $recv($1)._on_do_("listening",(function(){
  63024. return $core.withContext(function($ctx2) {
  63025. $4=console;
  63026. $8=$self._host();
  63027. $ctx2.sendIdx["host"]=1;
  63028. $7="Starting file server on http://".__comma($8);
  63029. $6=$recv($7).__comma(":");
  63030. $ctx2.sendIdx[","]=3;
  63031. $10=$self._port();
  63032. $ctx2.sendIdx["port"]=1;
  63033. $9=$recv($10)._asString();
  63034. $5=$recv($6).__comma($9);
  63035. $ctx2.sendIdx[","]=2;
  63036. return $recv($4)._log_($5);
  63037. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  63038. }));
  63039. $recv($1)._listen_host_($self._port(),$self._host());
  63040. return self;
  63041. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  63042. },
  63043. args: [],
  63044. 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.",
  63045. referencedClasses: [],
  63046. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  63047. }),
  63048. $globals.FileServer);
  63049. $core.addMethod(
  63050. $core.method({
  63051. selector: "startOn:",
  63052. protocol: "starting",
  63053. fn: function (aPort){
  63054. var self=this,$self=this;
  63055. return $core.withContext(function($ctx1) {
  63056. $self._port_(aPort);
  63057. $self._start();
  63058. return self;
  63059. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  63060. },
  63061. args: ["aPort"],
  63062. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  63063. referencedClasses: [],
  63064. messageSends: ["port:", "start"]
  63065. }),
  63066. $globals.FileServer);
  63067. $core.addMethod(
  63068. $core.method({
  63069. selector: "username:",
  63070. protocol: "accessing",
  63071. fn: function (aUsername){
  63072. var self=this,$self=this;
  63073. $self["@username"]=aUsername;
  63074. return self;
  63075. },
  63076. args: ["aUsername"],
  63077. source: "username: aUsername\x0a\x09username := aUsername.",
  63078. referencedClasses: [],
  63079. messageSends: []
  63080. }),
  63081. $globals.FileServer);
  63082. $core.addMethod(
  63083. $core.method({
  63084. selector: "validateBasePath",
  63085. protocol: "private",
  63086. fn: function (){
  63087. var self=this,$self=this;
  63088. return $core.withContext(function($ctx1) {
  63089. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  63090. $1=$self["@fs"];
  63091. $2=$self._basePath();
  63092. $ctx1.sendIdx["basePath"]=1;
  63093. $recv($1)._stat_then_($2,(function(err,stat){
  63094. return $core.withContext(function($ctx2) {
  63095. if(($receiver = err) == null || $receiver.a$nil){
  63096. $3=$recv(stat)._isDirectory();
  63097. if(!$core.assert($3)){
  63098. $4=console;
  63099. $7=$self._basePath();
  63100. $ctx2.sendIdx["basePath"]=2;
  63101. $6="Warning: --base-path parameter ".__comma($7);
  63102. $ctx2.sendIdx[","]=2;
  63103. $5=$recv($6).__comma(" is not a directory.");
  63104. $ctx2.sendIdx[","]=1;
  63105. return $recv($4)._warn_($5);
  63106. $ctx2.sendIdx["warn:"]=1;
  63107. }
  63108. } else {
  63109. $8=console;
  63110. $9=$recv("Warning: path at --base-path parameter ".__comma($self._basePath())).__comma(" does not exist.");
  63111. $ctx2.sendIdx[","]=3;
  63112. return $recv($8)._warn_($9);
  63113. }
  63114. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  63115. }));
  63116. return self;
  63117. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  63118. },
  63119. args: [],
  63120. 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.' ]].",
  63121. referencedClasses: [],
  63122. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  63123. }),
  63124. $globals.FileServer);
  63125. $core.addMethod(
  63126. $core.method({
  63127. selector: "withBasePath:",
  63128. protocol: "private",
  63129. fn: function (aBaseRelativePath){
  63130. var self=this,$self=this;
  63131. return $core.withContext(function($ctx1) {
  63132. return $recv($self["@path"])._join_with_($self._basePath(),aBaseRelativePath);
  63133. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  63134. },
  63135. args: ["aBaseRelativePath"],
  63136. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  63137. referencedClasses: [],
  63138. messageSends: ["join:with:", "basePath"]
  63139. }),
  63140. $globals.FileServer);
  63141. $core.addMethod(
  63142. $core.method({
  63143. selector: "writeData:toFileNamed:",
  63144. protocol: "private",
  63145. fn: function (data,aFilename){
  63146. var self=this,$self=this;
  63147. return $core.withContext(function($ctx1) {
  63148. $recv(console)._log_(aFilename);
  63149. return self;
  63150. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  63151. },
  63152. args: ["data", "aFilename"],
  63153. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  63154. referencedClasses: [],
  63155. messageSends: ["log:"]
  63156. }),
  63157. $globals.FileServer);
  63158. $globals.FileServer.a$cls.iVarNames = ["mimeTypes"];
  63159. $core.addMethod(
  63160. $core.method({
  63161. selector: "commandLineSwitches",
  63162. protocol: "accessing",
  63163. fn: function (){
  63164. var self=this,$self=this;
  63165. var switches;
  63166. return $core.withContext(function($ctx1) {
  63167. switches=$recv($self._methodsInProtocol_("accessing"))._collect_((function(each){
  63168. return $core.withContext(function($ctx2) {
  63169. return $recv(each)._selector();
  63170. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63171. }));
  63172. $ctx1.sendIdx["collect:"]=1;
  63173. switches=$recv(switches)._select_((function(each){
  63174. return $core.withContext(function($ctx2) {
  63175. return $recv(each)._match_("^[^:]*:$");
  63176. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  63177. }));
  63178. switches=$recv(switches)._collect_((function(each){
  63179. return $core.withContext(function($ctx2) {
  63180. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  63181. $ctx2.sendIdx["replace:with:"]=1;
  63182. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  63183. }));
  63184. return switches;
  63185. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.a$cls)});
  63186. },
  63187. args: [],
  63188. 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",
  63189. referencedClasses: [],
  63190. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  63191. }),
  63192. $globals.FileServer.a$cls);
  63193. $core.addMethod(
  63194. $core.method({
  63195. selector: "createServerWithArguments:",
  63196. protocol: "initialization",
  63197. fn: function (options){
  63198. var self=this,$self=this;
  63199. var server,popFront,front,optionName,optionValue,switches;
  63200. return $core.withContext(function($ctx1) {
  63201. var $1,$2,$3,$4,$5,$6,$7,$8;
  63202. var $early={};
  63203. try {
  63204. switches=$self._commandLineSwitches();
  63205. server=$self._new();
  63206. $recv(options)._ifEmpty_((function(){
  63207. throw $early=[server];
  63208. }));
  63209. $1=$recv($recv(options)._size())._even();
  63210. if(!$core.assert($1)){
  63211. $recv(console)._log_("Using default parameters.");
  63212. $ctx1.sendIdx["log:"]=1;
  63213. $2=console;
  63214. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  63215. $ctx1.sendIdx[","]=1;
  63216. $recv($2)._log_($3);
  63217. $ctx1.sendIdx["log:"]=2;
  63218. $4=console;
  63219. $5="Use any of the following ones: ".__comma(switches);
  63220. $ctx1.sendIdx[","]=2;
  63221. $recv($4)._log_($5);
  63222. $ctx1.sendIdx["log:"]=3;
  63223. return server;
  63224. }
  63225. popFront=(function(args){
  63226. return $core.withContext(function($ctx2) {
  63227. front=$recv(args)._first();
  63228. $recv(args)._remove_(front);
  63229. return front;
  63230. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  63231. });
  63232. $recv((function(){
  63233. return $core.withContext(function($ctx2) {
  63234. return $recv(options)._notEmpty();
  63235. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  63236. }))._whileTrue_((function(){
  63237. return $core.withContext(function($ctx2) {
  63238. optionName=$recv(popFront)._value_(options);
  63239. $ctx2.sendIdx["value:"]=1;
  63240. optionValue=$recv(popFront)._value_(options);
  63241. $6=$recv(switches)._includes_(optionName);
  63242. if($core.assert($6)){
  63243. optionName=$self._selectorForCommandLineSwitch_(optionName);
  63244. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  63245. } else {
  63246. $7=console;
  63247. $8=$recv(optionName).__comma(" is not a valid commandline option");
  63248. $ctx2.sendIdx[","]=3;
  63249. $recv($7)._log_($8);
  63250. $ctx2.sendIdx["log:"]=4;
  63251. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  63252. }
  63253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  63254. }));
  63255. return server;
  63256. }
  63257. catch(e) {if(e===$early)return e[0]; throw e}
  63258. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.a$cls)});
  63259. },
  63260. args: ["options"],
  63261. 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.",
  63262. referencedClasses: ["Array"],
  63263. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  63264. }),
  63265. $globals.FileServer.a$cls);
  63266. $core.addMethod(
  63267. $core.method({
  63268. selector: "defaultBasePath",
  63269. protocol: "accessing",
  63270. fn: function (){
  63271. var self=this,$self=this;
  63272. return "./";
  63273. },
  63274. args: [],
  63275. source: "defaultBasePath\x0a\x09^ './'",
  63276. referencedClasses: [],
  63277. messageSends: []
  63278. }),
  63279. $globals.FileServer.a$cls);
  63280. $core.addMethod(
  63281. $core.method({
  63282. selector: "defaultHost",
  63283. protocol: "accessing",
  63284. fn: function (){
  63285. var self=this,$self=this;
  63286. return "127.0.0.1";
  63287. },
  63288. args: [],
  63289. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  63290. referencedClasses: [],
  63291. messageSends: []
  63292. }),
  63293. $globals.FileServer.a$cls);
  63294. $core.addMethod(
  63295. $core.method({
  63296. selector: "defaultMimeTypes",
  63297. protocol: "accessing",
  63298. fn: function (){
  63299. var self=this,$self=this;
  63300. 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"]);
  63301. },
  63302. args: [],
  63303. 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}",
  63304. referencedClasses: [],
  63305. messageSends: []
  63306. }),
  63307. $globals.FileServer.a$cls);
  63308. $core.addMethod(
  63309. $core.method({
  63310. selector: "defaultPort",
  63311. protocol: "accessing",
  63312. fn: function (){
  63313. var self=this,$self=this;
  63314. return (4000);
  63315. },
  63316. args: [],
  63317. source: "defaultPort\x0a\x09^ 4000",
  63318. referencedClasses: [],
  63319. messageSends: []
  63320. }),
  63321. $globals.FileServer.a$cls);
  63322. $core.addMethod(
  63323. $core.method({
  63324. selector: "main",
  63325. protocol: "initialization",
  63326. fn: function (){
  63327. var self=this,$self=this;
  63328. var fileServer,args;
  63329. return $core.withContext(function($ctx1) {
  63330. var $1;
  63331. var $early={};
  63332. try {
  63333. args=$recv(process)._argv();
  63334. $recv(args)._removeFrom_to_((1),(3));
  63335. $recv(args)._detect_ifNone_((function(each){
  63336. return $core.withContext(function($ctx2) {
  63337. $1=$recv(each).__eq("--help");
  63338. if($core.assert($1)){
  63339. return $recv($globals.FileServer)._printHelp();
  63340. }
  63341. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63342. }),(function(){
  63343. return $core.withContext(function($ctx2) {
  63344. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  63345. throw $early=[$recv(fileServer)._start()];
  63346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  63347. }));
  63348. return self;
  63349. }
  63350. catch(e) {if(e===$early)return e[0]; throw e}
  63351. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.a$cls)});
  63352. },
  63353. args: [],
  63354. 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]",
  63355. referencedClasses: ["FileServer"],
  63356. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  63357. }),
  63358. $globals.FileServer.a$cls);
  63359. $core.addMethod(
  63360. $core.method({
  63361. selector: "mimeTypeFor:",
  63362. protocol: "accessing",
  63363. fn: function (aString){
  63364. var self=this,$self=this;
  63365. return $core.withContext(function($ctx1) {
  63366. return $recv($self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  63367. return "text/plain";
  63368. }));
  63369. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.a$cls)});
  63370. },
  63371. args: ["aString"],
  63372. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  63373. referencedClasses: [],
  63374. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  63375. }),
  63376. $globals.FileServer.a$cls);
  63377. $core.addMethod(
  63378. $core.method({
  63379. selector: "mimeTypes",
  63380. protocol: "accessing",
  63381. fn: function (){
  63382. var self=this,$self=this;
  63383. return $core.withContext(function($ctx1) {
  63384. var $1,$receiver;
  63385. $1=$self["@mimeTypes"];
  63386. if(($receiver = $1) == null || $receiver.a$nil){
  63387. $self["@mimeTypes"]=$self._defaultMimeTypes();
  63388. return $self["@mimeTypes"];
  63389. } else {
  63390. return $1;
  63391. }
  63392. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.a$cls)});
  63393. },
  63394. args: [],
  63395. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  63396. referencedClasses: [],
  63397. messageSends: ["ifNil:", "defaultMimeTypes"]
  63398. }),
  63399. $globals.FileServer.a$cls);
  63400. $core.addMethod(
  63401. $core.method({
  63402. selector: "printHelp",
  63403. protocol: "accessing",
  63404. fn: function (){
  63405. var self=this,$self=this;
  63406. return $core.withContext(function($ctx1) {
  63407. $recv(console)._log_("Available commandline options are:");
  63408. $ctx1.sendIdx["log:"]=1;
  63409. $recv(console)._log_("--help");
  63410. $ctx1.sendIdx["log:"]=2;
  63411. $recv($self._commandLineSwitches())._do_((function(each){
  63412. return $core.withContext(function($ctx2) {
  63413. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  63414. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63415. }));
  63416. return self;
  63417. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.a$cls)});
  63418. },
  63419. args: [],
  63420. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  63421. referencedClasses: [],
  63422. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  63423. }),
  63424. $globals.FileServer.a$cls);
  63425. $core.addMethod(
  63426. $core.method({
  63427. selector: "selectorForCommandLineSwitch:",
  63428. protocol: "accessing",
  63429. fn: function (aSwitch){
  63430. var self=this,$self=this;
  63431. return $core.withContext(function($ctx1) {
  63432. var $1;
  63433. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  63434. return $core.withContext(function($ctx2) {
  63435. return $recv($recv(each)._second())._asUppercase();
  63436. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63437. }));
  63438. $ctx1.sendIdx["replace:with:"]=1;
  63439. return $recv($1).__comma(":");
  63440. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.a$cls)});
  63441. },
  63442. args: ["aSwitch"],
  63443. 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 ]), ':'",
  63444. referencedClasses: [],
  63445. messageSends: [",", "replace:with:", "asUppercase", "second"]
  63446. }),
  63447. $globals.FileServer.a$cls);
  63448. $core.addClass("Initer", $globals.BaseFileManipulator, ["childProcess", "nmPath"], "AmberCli");
  63449. $core.addMethod(
  63450. $core.method({
  63451. selector: "finishMessage",
  63452. protocol: "action",
  63453. fn: function (){
  63454. var self=this,$self=this;
  63455. return $core.withContext(function($ctx1) {
  63456. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  63457. $recv((function(){
  63458. }))._valueWithTimeout_((600));
  63459. return self;
  63460. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  63461. },
  63462. args: [],
  63463. 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",
  63464. referencedClasses: ["String"],
  63465. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  63466. }),
  63467. $globals.Initer);
  63468. $core.addMethod(
  63469. $core.method({
  63470. selector: "gruntInitThenDo:",
  63471. protocol: "action",
  63472. fn: function (aBlock){
  63473. var self=this,$self=this;
  63474. var child,sanitizedTemplatePath;
  63475. return $core.withContext(function($ctx1) {
  63476. var $1,$3,$2;
  63477. sanitizedTemplatePath=$recv($recv($recv($self["@path"])._join_with_($self["@nmPath"],"@ambers/grunt-init-amber-project"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  63478. $ctx1.sendIdx["replace:with:"]=1;
  63479. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  63480. $1=child;
  63481. $recv($1)._on_do_("error",aBlock);
  63482. $ctx1.sendIdx["on:do:"]=1;
  63483. $recv($1)._on_do_("close",(function(code){
  63484. return $core.withContext(function($ctx2) {
  63485. $3=$recv(code).__eq((0));
  63486. if($core.assert($3)){
  63487. $2=nil;
  63488. } else {
  63489. $2=code;
  63490. }
  63491. return $recv(aBlock)._value_($2);
  63492. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63493. }));
  63494. return self;
  63495. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  63496. },
  63497. args: ["aBlock"],
  63498. source: "gruntInitThenDo: aBlock\x0a\x09| child sanitizedTemplatePath |\x0a\x09sanitizedTemplatePath := ((path join: nmPath with: '@ambers/grunt-init-amber-project')\x0a\x09\x09replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:'.\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-init' named: 'grunt-init')\x0a\x09\x09args: {sanitizedTemplatePath}.\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  63499. referencedClasses: [],
  63500. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63501. }),
  63502. $globals.Initer);
  63503. $core.addMethod(
  63504. $core.method({
  63505. selector: "initProjectThenDo:",
  63506. protocol: "action",
  63507. fn: function (aBlock){
  63508. var self=this,$self=this;
  63509. var child;
  63510. return $core.withContext(function($ctx1) {
  63511. var $1;
  63512. child=$recv($self["@childProcess"])._exec_thenDo_("npm run init",aBlock);
  63513. $1=$recv(child)._stdout();
  63514. $ctx1.sendIdx["stdout"]=1;
  63515. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  63516. return self;
  63517. }, function($ctx1) {$ctx1.fill(self,"initProjectThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63518. },
  63519. args: ["aBlock"],
  63520. source: "initProjectThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: 'npm run init'\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
  63521. referencedClasses: [],
  63522. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  63523. }),
  63524. $globals.Initer);
  63525. $core.addMethod(
  63526. $core.method({
  63527. selector: "initialize",
  63528. protocol: "initialization",
  63529. fn: function (){
  63530. var self=this,$self=this;
  63531. return $core.withContext(function($ctx1) {
  63532. (
  63533. $ctx1.supercall = true,
  63534. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63535. $ctx1.supercall = false;
  63536. $self["@childProcess"]=$recv(require)._value_("child_process");
  63537. $self["@nmPath"]=$recv($self["@path"])._join_with_($self._rootDirname(),"node_modules");
  63538. return self;
  63539. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  63540. },
  63541. args: [],
  63542. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  63543. referencedClasses: [],
  63544. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  63545. }),
  63546. $globals.Initer);
  63547. $core.addMethod(
  63548. $core.method({
  63549. selector: "npmScriptForModule:named:",
  63550. protocol: "npm",
  63551. fn: function (aString,anotherString){
  63552. var self=this,$self=this;
  63553. var modulePath,packageJson,binSection,scriptPath;
  63554. return $core.withContext(function($ctx1) {
  63555. var $1,$3,$4,$2,$5;
  63556. $1=$self["@path"];
  63557. $3=$recv(require)._provided();
  63558. $4=$recv(aString).__comma("/package.json");
  63559. $ctx1.sendIdx[","]=1;
  63560. $2=$recv($3)._resolve_($4);
  63561. modulePath=$recv($1)._dirname_($2);
  63562. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  63563. binSection=$recv(packageJson)._at_("bin");
  63564. $ctx1.sendIdx["at:"]=1;
  63565. $5=$recv(binSection)._isString();
  63566. if($core.assert($5)){
  63567. scriptPath=binSection;
  63568. } else {
  63569. scriptPath=$recv(binSection)._at_(anotherString);
  63570. }
  63571. return $recv($self["@path"])._join_with_(modulePath,scriptPath);
  63572. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  63573. },
  63574. args: ["aString", "anotherString"],
  63575. source: "npmScriptForModule: aString named: anotherString\x0a\x09| modulePath packageJson binSection scriptPath |\x0a\x09modulePath := path dirname: (\x0a\x09\x09require provided resolve: aString, '/package.json').\x0a\x09packageJson := Smalltalk readJSObject: (\x0a\x09\x09require value: aString, '/package.json').\x0a\x09binSection := packageJson at: 'bin'.\x0a\x09scriptPath := binSection isString\x0a\x09\x09ifTrue: [ binSection ]\x0a\x09\x09ifFalse: [ binSection at: anotherString ].\x0a\x09^ path join: modulePath with: scriptPath",
  63576. referencedClasses: ["Smalltalk"],
  63577. messageSends: ["dirname:", "resolve:", "provided", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  63578. }),
  63579. $globals.Initer);
  63580. $core.addMethod(
  63581. $core.method({
  63582. selector: "start",
  63583. protocol: "action",
  63584. fn: function (){
  63585. var self=this,$self=this;
  63586. return $core.withContext(function($ctx1) {
  63587. var $1,$2,$3,$receiver;
  63588. $self._gruntInitThenDo_((function(error){
  63589. return $core.withContext(function($ctx2) {
  63590. if(($receiver = error) == null || $receiver.a$nil){
  63591. return $self._initProjectThenDo_((function(error2){
  63592. return $core.withContext(function($ctx3) {
  63593. if(($receiver = error2) == null || $receiver.a$nil){
  63594. $self._finishMessage();
  63595. return $recv(process)._exit();
  63596. } else {
  63597. $3=console;
  63598. $recv($3)._log_("npm run init exec error:");
  63599. $ctx3.sendIdx["log:"]=3;
  63600. $recv($3)._log_(error2);
  63601. return $recv(process)._exit_((105));
  63602. }
  63603. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  63604. }));
  63605. } else {
  63606. $1=console;
  63607. $recv($1)._log_("grunt-init exec error:");
  63608. $ctx2.sendIdx["log:"]=1;
  63609. $2=$recv($1)._log_(error);
  63610. $ctx2.sendIdx["log:"]=2;
  63611. return $recv(process)._exit_((101));
  63612. $ctx2.sendIdx["exit:"]=1;
  63613. }
  63614. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  63615. }));
  63616. return self;
  63617. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  63618. },
  63619. args: [],
  63620. source: "start\x0a\x09self gruntInitThenDo: [ :error | error\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt-init exec error:'; log: error.\x0a\x09\x09process exit: 101 ]\x0a\x09ifNil: [\x0a\x0a\x09self initProjectThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm run init exec error:'; log: error2.\x0a\x09\x09process exit: 105 ]\x0a\x09ifNil: [\x0a\x0a\x09self finishMessage.\x0a\x09process exit ]]]]",
  63621. referencedClasses: [],
  63622. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "initProjectThenDo:", "finishMessage", "exit"]
  63623. }),
  63624. $globals.Initer);
  63625. $core.addClass("Repl", $globals.Object, ["readline", "interface", "util", "session", "resultCount", "commands"], "AmberCli");
  63626. $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.";
  63627. $core.addMethod(
  63628. $core.method({
  63629. selector: "addVariableNamed:to:",
  63630. protocol: "private",
  63631. fn: function (aString,anObject){
  63632. var self=this,$self=this;
  63633. var newClass,newObject;
  63634. return $core.withContext(function($ctx1) {
  63635. newClass=$self._subclass_withVariable_($recv(anObject)._class(),aString);
  63636. $self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  63637. newObject=$recv(newClass)._new();
  63638. $self._setPreviousVariablesFor_from_(newObject,anObject);
  63639. return newObject;
  63640. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  63641. },
  63642. args: ["aString", "anObject"],
  63643. 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",
  63644. referencedClasses: [],
  63645. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  63646. }),
  63647. $globals.Repl);
  63648. $core.addMethod(
  63649. $core.method({
  63650. selector: "assignNewVariable:do:",
  63651. protocol: "private",
  63652. fn: function (buffer,aBlock){
  63653. var self=this,$self=this;
  63654. return $core.withContext(function($ctx1) {
  63655. var $2,$3,$1,$receiver;
  63656. return $self._parseAssignment_do_(buffer,(function(name,expr){
  63657. var varName,value;
  63658. return $core.withContext(function($ctx2) {
  63659. if(($receiver = name) == null || $receiver.a$nil){
  63660. varName=$self._nextResultName();
  63661. } else {
  63662. varName=name;
  63663. }
  63664. $self["@session"]=$self._addVariableNamed_to_(varName,$self["@session"]);
  63665. $recv((function(){
  63666. return $core.withContext(function($ctx3) {
  63667. $2=$recv(varName).__comma(" := ");
  63668. if(($receiver = expr) == null || $receiver.a$nil){
  63669. $3=buffer;
  63670. } else {
  63671. $3=expr;
  63672. }
  63673. $1=$recv($2).__comma($3);
  63674. $ctx3.sendIdx[","]=1;
  63675. value=$self._eval_on_($1,$self["@session"]);
  63676. return value;
  63677. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  63678. }))._on_do_($globals.Error,(function(e){
  63679. return $core.withContext(function($ctx3) {
  63680. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  63681. value=nil;
  63682. return value;
  63683. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  63684. }));
  63685. return $recv(aBlock)._value_value_(varName,value);
  63686. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  63687. }));
  63688. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  63689. },
  63690. args: ["buffer", "aBlock"],
  63691. 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]",
  63692. referencedClasses: ["Error", "ConsoleErrorHandler"],
  63693. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  63694. }),
  63695. $globals.Repl);
  63696. $core.addMethod(
  63697. $core.method({
  63698. selector: "clearScreen",
  63699. protocol: "actions",
  63700. fn: function (){
  63701. var self=this,$self=this;
  63702. var esc,cls;
  63703. return $core.withContext(function($ctx1) {
  63704. var $1;
  63705. esc=$recv($globals.String)._fromCharCode_((27));
  63706. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  63707. $ctx1.sendIdx[","]=2;
  63708. cls=$recv($1).__comma("[0;0f");
  63709. $ctx1.sendIdx[","]=1;
  63710. $recv($recv(process)._stdout())._write_(cls);
  63711. $recv($self["@interface"])._prompt();
  63712. return self;
  63713. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  63714. },
  63715. args: [],
  63716. 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",
  63717. referencedClasses: ["String"],
  63718. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  63719. }),
  63720. $globals.Repl);
  63721. $core.addMethod(
  63722. $core.method({
  63723. selector: "close",
  63724. protocol: "actions",
  63725. fn: function (){
  63726. var self=this,$self=this;
  63727. return $core.withContext(function($ctx1) {
  63728. $recv($recv(process)._stdin())._destroy();
  63729. return self;
  63730. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  63731. },
  63732. args: [],
  63733. source: "close\x0a\x09process stdin destroy",
  63734. referencedClasses: [],
  63735. messageSends: ["destroy", "stdin"]
  63736. }),
  63737. $globals.Repl);
  63738. $core.addMethod(
  63739. $core.method({
  63740. selector: "commands",
  63741. protocol: "accessing",
  63742. fn: function (){
  63743. var self=this,$self=this;
  63744. return $self["@commands"];
  63745. },
  63746. args: [],
  63747. source: "commands\x0a\x09^ commands",
  63748. referencedClasses: [],
  63749. messageSends: []
  63750. }),
  63751. $globals.Repl);
  63752. $core.addMethod(
  63753. $core.method({
  63754. selector: "createInterface",
  63755. protocol: "actions",
  63756. fn: function (){
  63757. var self=this,$self=this;
  63758. return $core.withContext(function($ctx1) {
  63759. $self["@interface"]=$recv($self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  63760. $recv($self["@interface"])._on_do_("line",(function(buffer){
  63761. return $core.withContext(function($ctx2) {
  63762. return $self._processLine_(buffer);
  63763. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  63764. }));
  63765. $ctx1.sendIdx["on:do:"]=1;
  63766. $recv($self["@interface"])._on_do_("close",(function(){
  63767. return $core.withContext(function($ctx2) {
  63768. return $self._close();
  63769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63770. }));
  63771. $self._printWelcome();
  63772. $self._setupHotkeys();
  63773. $self._setPrompt();
  63774. $recv($self["@interface"])._prompt();
  63775. return self;
  63776. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  63777. },
  63778. args: [],
  63779. 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",
  63780. referencedClasses: [],
  63781. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  63782. }),
  63783. $globals.Repl);
  63784. $core.addMethod(
  63785. $core.method({
  63786. selector: "encapsulateVariable:withValue:in:",
  63787. protocol: "private",
  63788. fn: function (aString,anObject,aClass){
  63789. var self=this,$self=this;
  63790. var compiler;
  63791. return $core.withContext(function($ctx1) {
  63792. var $1,$4,$3,$2,$5,$6;
  63793. compiler=$recv($globals.Compiler)._new();
  63794. $1=compiler;
  63795. $4=$recv(aString).__comma(": anObject ^ ");
  63796. $ctx1.sendIdx[","]=3;
  63797. $3=$recv($4).__comma(aString);
  63798. $ctx1.sendIdx[","]=2;
  63799. $2=$recv($3).__comma(" := anObject");
  63800. $ctx1.sendIdx[","]=1;
  63801. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  63802. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  63803. $5=compiler;
  63804. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  63805. $ctx1.sendIdx[","]=4;
  63806. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  63807. return self;
  63808. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  63809. },
  63810. args: ["aString", "anObject", "aClass"],
  63811. 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'.",
  63812. referencedClasses: ["Compiler"],
  63813. messageSends: ["new", "install:forClass:protocol:", ","]
  63814. }),
  63815. $globals.Repl);
  63816. $core.addMethod(
  63817. $core.method({
  63818. selector: "eval:",
  63819. protocol: "actions",
  63820. fn: function (buffer){
  63821. var self=this,$self=this;
  63822. return $core.withContext(function($ctx1) {
  63823. return $self._eval_on_(buffer,$recv($globals.DoIt)._new());
  63824. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  63825. },
  63826. args: ["buffer"],
  63827. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  63828. referencedClasses: ["DoIt"],
  63829. messageSends: ["eval:on:", "new"]
  63830. }),
  63831. $globals.Repl);
  63832. $core.addMethod(
  63833. $core.method({
  63834. selector: "eval:on:",
  63835. protocol: "actions",
  63836. fn: function (buffer,anObject){
  63837. var self=this,$self=this;
  63838. var result;
  63839. return $core.withContext(function($ctx1) {
  63840. var $1;
  63841. $recv(buffer)._ifNotEmpty_((function(){
  63842. return $core.withContext(function($ctx2) {
  63843. return $recv((function(){
  63844. return $core.withContext(function($ctx3) {
  63845. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  63846. return result;
  63847. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63848. }))._tryCatch_((function(e){
  63849. return $core.withContext(function($ctx3) {
  63850. $1=$recv(e)._isSmalltalkError();
  63851. if($core.assert($1)){
  63852. return $recv(e)._pass();
  63853. } else {
  63854. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  63855. }
  63856. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  63857. }));
  63858. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63859. }));
  63860. return result;
  63861. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  63862. },
  63863. args: ["buffer", "anObject"],
  63864. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer ifNotEmpty: [\x0a\x09\x09[result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09\x09tryCatch: [:e |\x0a\x09\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09\x09\x09ifTrue: [ e pass ]\x0a\x09\x09\x09\x09\x09ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  63865. referencedClasses: ["Compiler"],
  63866. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "pass", "write:", "stdout", "jsStack"]
  63867. }),
  63868. $globals.Repl);
  63869. $core.addMethod(
  63870. $core.method({
  63871. selector: "executeCommand:",
  63872. protocol: "private",
  63873. fn: function (aString){
  63874. var self=this,$self=this;
  63875. return $core.withContext(function($ctx1) {
  63876. var $1;
  63877. var $early={};
  63878. try {
  63879. $recv($self._commands())._keysAndValuesDo_((function(names,cmd){
  63880. return $core.withContext(function($ctx2) {
  63881. $1=$recv(names)._includes_(aString);
  63882. if($core.assert($1)){
  63883. $recv(cmd)._value();
  63884. throw $early=[true];
  63885. }
  63886. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  63887. }));
  63888. return false;
  63889. }
  63890. catch(e) {if(e===$early)return e[0]; throw e}
  63891. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  63892. },
  63893. args: ["aString"],
  63894. 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",
  63895. referencedClasses: [],
  63896. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  63897. }),
  63898. $globals.Repl);
  63899. $core.addMethod(
  63900. $core.method({
  63901. selector: "initialize",
  63902. protocol: "initialization",
  63903. fn: function (){
  63904. var self=this,$self=this;
  63905. return $core.withContext(function($ctx1) {
  63906. (
  63907. $ctx1.supercall = true,
  63908. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63909. $ctx1.supercall = false;
  63910. $self["@session"]=$recv($globals.DoIt)._new();
  63911. $self["@readline"]=$recv(require)._value_("readline");
  63912. $ctx1.sendIdx["value:"]=1;
  63913. $self["@util"]=$recv(require)._value_("util");
  63914. $self._setupCommands();
  63915. return self;
  63916. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  63917. },
  63918. args: [],
  63919. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  63920. referencedClasses: ["DoIt"],
  63921. messageSends: ["initialize", "new", "value:", "setupCommands"]
  63922. }),
  63923. $globals.Repl);
  63924. $core.addMethod(
  63925. $core.method({
  63926. selector: "instanceVariableNamesFor:",
  63927. protocol: "private",
  63928. fn: function (aClass){
  63929. var self=this,$self=this;
  63930. return $core.withContext(function($ctx1) {
  63931. var $1,$2,$receiver;
  63932. $1=$recv(aClass)._superclass();
  63933. $ctx1.sendIdx["superclass"]=1;
  63934. if(($receiver = $1) == null || $receiver.a$nil){
  63935. return $recv(aClass)._instanceVariableNames();
  63936. } else {
  63937. $2=$recv(aClass)._instanceVariableNames();
  63938. $ctx1.sendIdx["instanceVariableNames"]=1;
  63939. return $recv($2)._copyWithAll_($self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  63940. }
  63941. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  63942. },
  63943. args: ["aClass"],
  63944. 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]",
  63945. referencedClasses: [],
  63946. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  63947. }),
  63948. $globals.Repl);
  63949. $core.addMethod(
  63950. $core.method({
  63951. selector: "isIdentifier:",
  63952. protocol: "private",
  63953. fn: function (aString){
  63954. var self=this,$self=this;
  63955. return $core.withContext(function($ctx1) {
  63956. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  63957. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  63958. },
  63959. args: ["aString"],
  63960. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  63961. referencedClasses: [],
  63962. messageSends: ["match:", "asRegexp"]
  63963. }),
  63964. $globals.Repl);
  63965. $core.addMethod(
  63966. $core.method({
  63967. selector: "isVariableDefined:",
  63968. protocol: "private",
  63969. fn: function (aString){
  63970. var self=this,$self=this;
  63971. return $core.withContext(function($ctx1) {
  63972. return $recv($self._instanceVariableNamesFor_($recv($self["@session"])._class()))._includes_(aString);
  63973. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  63974. },
  63975. args: ["aString"],
  63976. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  63977. referencedClasses: [],
  63978. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  63979. }),
  63980. $globals.Repl);
  63981. $core.addMethod(
  63982. $core.method({
  63983. selector: "nextResultName",
  63984. protocol: "private",
  63985. fn: function (){
  63986. var self=this,$self=this;
  63987. return $core.withContext(function($ctx1) {
  63988. var $1,$receiver;
  63989. $1=$self["@resultCount"];
  63990. if(($receiver = $1) == null || $receiver.a$nil){
  63991. $self["@resultCount"]=(1);
  63992. } else {
  63993. $self["@resultCount"]=$recv($self["@resultCount"]).__plus((1));
  63994. }
  63995. return "res".__comma($recv($self["@resultCount"])._asString());
  63996. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  63997. },
  63998. args: [],
  63999. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  64000. referencedClasses: [],
  64001. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  64002. }),
  64003. $globals.Repl);
  64004. $core.addMethod(
  64005. $core.method({
  64006. selector: "onKeyPress:",
  64007. protocol: "private",
  64008. fn: function (key){
  64009. var self=this,$self=this;
  64010. return $core.withContext(function($ctx1) {
  64011. var $1;
  64012. $1=$recv($recv(key)._ctrl())._and_((function(){
  64013. return $core.withContext(function($ctx2) {
  64014. return $recv($recv(key)._name()).__eq("l");
  64015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64016. }));
  64017. if($core.assert($1)){
  64018. $self._clearScreen();
  64019. }
  64020. return self;
  64021. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  64022. },
  64023. args: ["key"],
  64024. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  64025. referencedClasses: [],
  64026. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  64027. }),
  64028. $globals.Repl);
  64029. $core.addMethod(
  64030. $core.method({
  64031. selector: "parseAssignment:do:",
  64032. protocol: "private",
  64033. fn: function (aString,aBlock){
  64034. var self=this,$self=this;
  64035. var assignment;
  64036. return $core.withContext(function($ctx1) {
  64037. var $2,$1;
  64038. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  64039. return $core.withContext(function($ctx2) {
  64040. return $recv(s)._trimBoth();
  64041. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  64042. }));
  64043. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  64044. return $core.withContext(function($ctx2) {
  64045. $2=$recv(assignment)._first();
  64046. $ctx2.sendIdx["first"]=1;
  64047. return $self._isIdentifier_($2);
  64048. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64049. }));
  64050. if($core.assert($1)){
  64051. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  64052. $ctx1.sendIdx["value:value:"]=1;
  64053. } else {
  64054. return $recv(aBlock)._value_value_(nil,nil);
  64055. }
  64056. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  64057. },
  64058. args: ["aString", "aBlock"],
  64059. 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 ]",
  64060. referencedClasses: [],
  64061. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  64062. }),
  64063. $globals.Repl);
  64064. $core.addMethod(
  64065. $core.method({
  64066. selector: "presentResultNamed:withValue:",
  64067. protocol: "private",
  64068. fn: function (varName,value){
  64069. var self=this,$self=this;
  64070. return $core.withContext(function($ctx1) {
  64071. var $3,$2,$1;
  64072. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  64073. $ctx1.sendIdx[","]=3;
  64074. $2=$recv($3).__comma(" = ");
  64075. $ctx1.sendIdx[","]=2;
  64076. $1=$recv($2).__comma($recv(value)._asString());
  64077. $ctx1.sendIdx[","]=1;
  64078. $recv($globals.Transcript)._show_($1);
  64079. $recv($globals.Transcript)._cr();
  64080. $recv($self["@interface"])._prompt();
  64081. return self;
  64082. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  64083. },
  64084. args: ["varName", "value"],
  64085. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  64086. referencedClasses: ["Transcript"],
  64087. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  64088. }),
  64089. $globals.Repl);
  64090. $core.addMethod(
  64091. $core.method({
  64092. selector: "printWelcome",
  64093. protocol: "actions",
  64094. fn: function (){
  64095. var self=this,$self=this;
  64096. return $core.withContext(function($ctx1) {
  64097. $recv($globals.Transcript)._show_("Type :q to exit.");
  64098. $recv($globals.Transcript)._cr();
  64099. return self;
  64100. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  64101. },
  64102. args: [],
  64103. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  64104. referencedClasses: ["Transcript"],
  64105. messageSends: ["show:", "cr"]
  64106. }),
  64107. $globals.Repl);
  64108. $core.addMethod(
  64109. $core.method({
  64110. selector: "processLine:",
  64111. protocol: "private",
  64112. fn: function (buffer){
  64113. var self=this,$self=this;
  64114. var show;
  64115. return $core.withContext(function($ctx1) {
  64116. var $1,$2;
  64117. show=(function(varName,value){
  64118. return $core.withContext(function($ctx2) {
  64119. return $self._presentResultNamed_withValue_(varName,value);
  64120. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  64121. });
  64122. $1=$self._executeCommand_(buffer);
  64123. if(!$core.assert($1)){
  64124. $2=$self._isVariableDefined_(buffer);
  64125. if($core.assert($2)){
  64126. $recv(show)._value_value_(buffer,$recv($self["@session"])._perform_(buffer));
  64127. } else {
  64128. $self._assignNewVariable_do_(buffer,show);
  64129. }
  64130. }
  64131. return self;
  64132. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  64133. },
  64134. args: ["buffer"],
  64135. 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]]",
  64136. referencedClasses: [],
  64137. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  64138. }),
  64139. $globals.Repl);
  64140. $core.addMethod(
  64141. $core.method({
  64142. selector: "prompt",
  64143. protocol: "accessing",
  64144. fn: function (){
  64145. var self=this,$self=this;
  64146. return "amber >> ";
  64147. },
  64148. args: [],
  64149. source: "prompt\x0a\x09^ 'amber >> '",
  64150. referencedClasses: [],
  64151. messageSends: []
  64152. }),
  64153. $globals.Repl);
  64154. $core.addMethod(
  64155. $core.method({
  64156. selector: "setPreviousVariablesFor:from:",
  64157. protocol: "private",
  64158. fn: function (newObject,oldObject){
  64159. var self=this,$self=this;
  64160. return $core.withContext(function($ctx1) {
  64161. $recv($self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  64162. return $core.withContext(function($ctx2) {
  64163. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  64164. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  64165. }));
  64166. return self;
  64167. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  64168. },
  64169. args: ["newObject", "oldObject"],
  64170. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  64171. referencedClasses: [],
  64172. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  64173. }),
  64174. $globals.Repl);
  64175. $core.addMethod(
  64176. $core.method({
  64177. selector: "setPrompt",
  64178. protocol: "actions",
  64179. fn: function (){
  64180. var self=this,$self=this;
  64181. return $core.withContext(function($ctx1) {
  64182. $recv($self["@interface"])._setPrompt_($self._prompt());
  64183. return self;
  64184. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  64185. },
  64186. args: [],
  64187. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  64188. referencedClasses: [],
  64189. messageSends: ["setPrompt:", "prompt"]
  64190. }),
  64191. $globals.Repl);
  64192. $core.addMethod(
  64193. $core.method({
  64194. selector: "setupCommands",
  64195. protocol: "initialization",
  64196. fn: function (){
  64197. var self=this,$self=this;
  64198. return $core.withContext(function($ctx1) {
  64199. var $2,$1;
  64200. $2=$recv([":q"]).__minus_gt((function(){
  64201. return $core.withContext(function($ctx2) {
  64202. return $recv(process)._exit();
  64203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64204. }));
  64205. $ctx1.sendIdx["->"]=1;
  64206. $1=[$2,$recv([""]).__minus_gt((function(){
  64207. return $core.withContext(function($ctx2) {
  64208. return $recv($self["@interface"])._prompt();
  64209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64210. }))];
  64211. $self["@commands"]=$recv($globals.Dictionary)._from_($1);
  64212. return self;
  64213. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  64214. },
  64215. args: [],
  64216. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  64217. referencedClasses: ["Dictionary"],
  64218. messageSends: ["from:", "->", "exit", "prompt"]
  64219. }),
  64220. $globals.Repl);
  64221. $core.addMethod(
  64222. $core.method({
  64223. selector: "setupHotkeys",
  64224. protocol: "initialization",
  64225. fn: function (){
  64226. var self=this,$self=this;
  64227. return $core.withContext(function($ctx1) {
  64228. var $receiver;
  64229. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  64230. return $core.withContext(function($ctx2) {
  64231. if(($receiver = key) == null || $receiver.a$nil){
  64232. return key;
  64233. } else {
  64234. return $self._onKeyPress_(key);
  64235. }
  64236. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  64237. }));
  64238. return self;
  64239. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  64240. },
  64241. args: [],
  64242. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  64243. referencedClasses: [],
  64244. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  64245. }),
  64246. $globals.Repl);
  64247. $core.addMethod(
  64248. $core.method({
  64249. selector: "subclass:withVariable:",
  64250. protocol: "private",
  64251. fn: function (aClass,varName){
  64252. var self=this,$self=this;
  64253. return $core.withContext(function($ctx1) {
  64254. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv($self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  64255. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  64256. },
  64257. args: ["aClass", "varName"],
  64258. 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'",
  64259. referencedClasses: ["ClassBuilder"],
  64260. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  64261. }),
  64262. $globals.Repl);
  64263. $core.addMethod(
  64264. $core.method({
  64265. selector: "subclassNameFor:",
  64266. protocol: "private",
  64267. fn: function (aClass){
  64268. var self=this,$self=this;
  64269. return $core.withContext(function($ctx1) {
  64270. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  64271. $2=$recv(aClass)._name();
  64272. $ctx1.sendIdx["name"]=1;
  64273. $1=$recv($2)._matchesOf_("\x5cd+$");
  64274. $ctx1.sendIdx["matchesOf:"]=1;
  64275. if(($receiver = $1) == null || $receiver.a$nil){
  64276. return $recv($recv(aClass)._name()).__comma("2");
  64277. } else {
  64278. var counter;
  64279. $6=$recv(aClass)._name();
  64280. $ctx1.sendIdx["name"]=2;
  64281. $5=$recv($6)._matchesOf_("\x5cd+$");
  64282. $4=$recv($5)._first();
  64283. $3=$recv($4)._asNumber();
  64284. counter=$recv($3).__plus((1));
  64285. $7=$recv(aClass)._name();
  64286. $ctx1.sendIdx["name"]=3;
  64287. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  64288. }
  64289. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  64290. },
  64291. args: ["aClass"],
  64292. 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'].",
  64293. referencedClasses: [],
  64294. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  64295. }),
  64296. $globals.Repl);
  64297. $core.addMethod(
  64298. $core.method({
  64299. selector: "main",
  64300. protocol: "initialization",
  64301. fn: function (){
  64302. var self=this,$self=this;
  64303. return $core.withContext(function($ctx1) {
  64304. $recv($self._new())._createInterface();
  64305. return self;
  64306. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.a$cls)});
  64307. },
  64308. args: [],
  64309. source: "main\x0a\x09self new createInterface",
  64310. referencedClasses: [],
  64311. messageSends: ["createInterface", "new"]
  64312. }),
  64313. $globals.Repl.a$cls);
  64314. });
  64315. (function () {
  64316. define('__app__',["amber/devel", "amber_core/Platform-Node", "amber_cli/AmberCli"], function (amber) {
  64317. amber.initialize().then(function () {
  64318. amber.globals.AmberCli._main();
  64319. });
  64320. });
  64321. }());
  64322. require(["app"]);
  64323. });
  64324. define.require('__wrap__');
  64325. }((function amdefine(module, requireFn) {
  64326. 'use strict';
  64327. var defineCache = {},
  64328. loaderCache = {},
  64329. alreadyCalled = false,
  64330. path = require('path'),
  64331. makeRequire, stringRequire;
  64332. /**
  64333. * Trims the . and .. from an array of path segments.
  64334. * It will keep a leading path segment if a .. will become
  64335. * the first path segment, to help with module name lookups,
  64336. * which act like paths, but can be remapped. But the end result,
  64337. * all paths that use this function should look normalized.
  64338. * NOTE: this method MODIFIES the input array.
  64339. * @param {Array} ary the array of path segments.
  64340. */
  64341. function trimDots(ary) {
  64342. var i, part;
  64343. for (i = 0; ary[i]; i+= 1) {
  64344. part = ary[i];
  64345. if (part === '.') {
  64346. ary.splice(i, 1);
  64347. i -= 1;
  64348. } else if (part === '..') {
  64349. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  64350. //End of the line. Keep at least one non-dot
  64351. //path segment at the front so it can be mapped
  64352. //correctly to disk. Otherwise, there is likely
  64353. //no path mapping for a path starting with '..'.
  64354. //This can still fail, but catches the most reasonable
  64355. //uses of ..
  64356. break;
  64357. } else if (i > 0) {
  64358. ary.splice(i - 1, 2);
  64359. i -= 2;
  64360. }
  64361. }
  64362. }
  64363. }
  64364. function normalize(name, baseName) {
  64365. var baseParts;
  64366. //Adjust any relative paths.
  64367. if (name && name.charAt(0) === '.') {
  64368. //If have a base name, try to normalize against it,
  64369. //otherwise, assume it is a top-level require that will
  64370. //be relative to baseUrl in the end.
  64371. if (baseName) {
  64372. baseParts = baseName.split('/');
  64373. baseParts = baseParts.slice(0, baseParts.length - 1);
  64374. baseParts = baseParts.concat(name.split('/'));
  64375. trimDots(baseParts);
  64376. name = baseParts.join('/');
  64377. }
  64378. }
  64379. return name;
  64380. }
  64381. /**
  64382. * Create the normalize() function passed to a loader plugin's
  64383. * normalize method.
  64384. */
  64385. function makeNormalize(relName) {
  64386. return function (name) {
  64387. return normalize(name, relName);
  64388. };
  64389. }
  64390. function makeLoad(id) {
  64391. function load(value) {
  64392. loaderCache[id] = value;
  64393. }
  64394. load.fromText = function (id, text) {
  64395. //This one is difficult because the text can/probably uses
  64396. //define, and any relative paths and requires should be relative
  64397. //to that id was it would be found on disk. But this would require
  64398. //bootstrapping a module/require fairly deeply from node core.
  64399. //Not sure how best to go about that yet.
  64400. throw new Error('amdefine does not implement load.fromText');
  64401. };
  64402. return load;
  64403. }
  64404. makeRequire = function (systemRequire, exports, module, relId) {
  64405. function amdRequire(deps, callback) {
  64406. if (typeof deps === 'string') {
  64407. //Synchronous, single module require('')
  64408. return stringRequire(systemRequire, exports, module, deps, relId);
  64409. } else {
  64410. //Array of dependencies with a callback.
  64411. //Convert the dependencies to modules.
  64412. deps = deps.map(function (depName) {
  64413. return stringRequire(systemRequire, exports, module, depName, relId);
  64414. });
  64415. //Wait for next tick to call back the require call.
  64416. if (callback) {
  64417. process.nextTick(function () {
  64418. callback.apply(null, deps);
  64419. });
  64420. }
  64421. }
  64422. }
  64423. amdRequire.toUrl = function (filePath) {
  64424. if (filePath.indexOf('.') === 0) {
  64425. return normalize(filePath, path.dirname(module.filename));
  64426. } else {
  64427. return filePath;
  64428. }
  64429. };
  64430. return amdRequire;
  64431. };
  64432. //Favor explicit value, passed in if the module wants to support Node 0.4.
  64433. requireFn = requireFn || function req() {
  64434. return module.require.apply(module, arguments);
  64435. };
  64436. function runFactory(id, deps, factory) {
  64437. var r, e, m, result;
  64438. if (id) {
  64439. e = loaderCache[id] = {};
  64440. m = {
  64441. id: id,
  64442. uri: __filename,
  64443. exports: e
  64444. };
  64445. r = makeRequire(requireFn, e, m, id);
  64446. } else {
  64447. //Only support one define call per file
  64448. if (alreadyCalled) {
  64449. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  64450. }
  64451. alreadyCalled = true;
  64452. //Use the real variables from node
  64453. //Use module.exports for exports, since
  64454. //the exports in here is amdefine exports.
  64455. e = module.exports;
  64456. m = module;
  64457. r = makeRequire(requireFn, e, m, module.id);
  64458. }
  64459. //If there are dependencies, they are strings, so need
  64460. //to convert them to dependency values.
  64461. if (deps) {
  64462. deps = deps.map(function (depName) {
  64463. return r(depName);
  64464. });
  64465. }
  64466. //Call the factory with the right dependencies.
  64467. if (typeof factory === 'function') {
  64468. result = factory.apply(m.exports, deps);
  64469. } else {
  64470. result = factory;
  64471. }
  64472. if (result !== undefined) {
  64473. m.exports = result;
  64474. if (id) {
  64475. loaderCache[id] = m.exports;
  64476. }
  64477. }
  64478. }
  64479. stringRequire = function (systemRequire, exports, module, id, relId) {
  64480. //Split the ID by a ! so that
  64481. var index = id.indexOf('!'),
  64482. originalId = id,
  64483. prefix, plugin;
  64484. if (index === -1) {
  64485. id = normalize(id, relId);
  64486. //Straight module lookup. If it is one of the special dependencies,
  64487. //deal with it, otherwise, delegate to node.
  64488. if (id === 'require') {
  64489. return makeRequire(systemRequire, exports, module, relId);
  64490. } else if (id === 'exports') {
  64491. return exports;
  64492. } else if (id === 'module') {
  64493. return module;
  64494. } else if (loaderCache.hasOwnProperty(id)) {
  64495. return loaderCache[id];
  64496. } else if (defineCache[id]) {
  64497. runFactory.apply(null, defineCache[id]);
  64498. return loaderCache[id];
  64499. } else {
  64500. if(systemRequire) {
  64501. return systemRequire(originalId);
  64502. } else {
  64503. throw new Error('No module with ID: ' + id);
  64504. }
  64505. }
  64506. } else {
  64507. //There is a plugin in play.
  64508. prefix = id.substring(0, index);
  64509. id = id.substring(index + 1, id.length);
  64510. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  64511. if (plugin.normalize) {
  64512. id = plugin.normalize(id, makeNormalize(relId));
  64513. } else {
  64514. //Normalize the ID normally.
  64515. id = normalize(id, relId);
  64516. }
  64517. if (loaderCache[id]) {
  64518. return loaderCache[id];
  64519. } else {
  64520. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  64521. return loaderCache[id];
  64522. }
  64523. }
  64524. };
  64525. //Create a define function specific to the module asking for amdefine.
  64526. function define(id, deps, factory) {
  64527. if (Array.isArray(id)) {
  64528. factory = deps;
  64529. deps = id;
  64530. id = undefined;
  64531. } else if (typeof id !== 'string') {
  64532. factory = id;
  64533. id = deps = undefined;
  64534. }
  64535. if (deps && !Array.isArray(deps)) {
  64536. factory = deps;
  64537. deps = undefined;
  64538. }
  64539. if (!deps) {
  64540. deps = ['require', 'exports', 'module'];
  64541. }
  64542. //Set up properties for this module. If an ID, then use
  64543. //internal cache. If no ID, then use the external variables
  64544. //for this node module.
  64545. if (id) {
  64546. //Put the module in deep freeze until there is a
  64547. //require call for it.
  64548. defineCache[id] = [id, deps, factory];
  64549. } else {
  64550. runFactory(id, deps, factory);
  64551. }
  64552. }
  64553. //define.require, which has access to all the values in the
  64554. //cache. Useful for AMD modules that all have IDs in the file,
  64555. //but need to finally export a value to node based on one of those
  64556. //IDs.
  64557. define.require = function (id) {
  64558. if (loaderCache[id]) {
  64559. return loaderCache[id];
  64560. }
  64561. if (defineCache[id]) {
  64562. runFactory.apply(null, defineCache[id]);
  64563. return loaderCache[id];
  64564. }
  64565. };
  64566. define.amd = {};
  64567. return define;
  64568. }(module)), require));