amber-cli.js 2.1 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756
  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. // This file is used to make additional changes
  8. // when building an app to run in node.js.
  9. // Free to edit. You can break tests (cli test runner uses
  10. // this to build itself - it is a node executable).
  11. define("amber/Platform", ["amber_core/Platform-Node"], {});
  12. define("amber/compatibility", ["amber/node-compatibility"], {});
  13. define("jquery", {});
  14. define("config-node", function(){});
  15. define('amber/brikz',[], function () {
  16. return function Brikz(api, apiKey, initKey) {
  17. "use strict";
  18. //jshint eqnull:true
  19. var brikz = this,
  20. backup = {};
  21. apiKey = apiKey || 'exports';
  22. initKey = initKey || '__init__';
  23. function mixin(src, target, what) {
  24. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  25. if (src == null) {
  26. target[keys[i]] = undefined;
  27. } else {
  28. var value = src[keys[i]];
  29. if (typeof value !== "undefined") {
  30. target[keys[i]] = value;
  31. }
  32. }
  33. }
  34. return target;
  35. }
  36. Object.defineProperties(this, {
  37. rebuild: { value: null, enumerable: false, configurable: true, writable: true }
  38. });
  39. var exclude = mixin(this, {});
  40. this.rebuild = function () {
  41. Object.keys(backup).forEach(function (key) {
  42. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  43. });
  44. var oapi = mixin(api, {}),
  45. order = [],
  46. chk = {};
  47. function ensure(key) {
  48. if (key in exclude) {
  49. return null;
  50. }
  51. var b = brikz[key],
  52. bak = backup[key];
  53. mixin(null, api, api);
  54. while (typeof b === "function") {
  55. (b.deps || []).forEach(ensure);
  56. b = new b(brikz, api, bak);
  57. }
  58. brikz[key] = b;
  59. if (b && !chk[key]) {
  60. chk[key] = true;
  61. order.push(b);
  62. }
  63. if (b && !b[apiKey]) {
  64. b[apiKey] = mixin(api, {});
  65. }
  66. }
  67. Object.keys(brikz).forEach(ensure);
  68. mixin(oapi, mixin(null, api, api));
  69. order.forEach(function (brik) {
  70. mixin(brik[apiKey] || {}, api);
  71. });
  72. order.forEach(function (brik) {
  73. if (brik[initKey]) {
  74. brik[initKey]();
  75. if (brik[initKey].once) {
  76. delete brik[initKey];
  77. }
  78. }
  79. });
  80. backup = mixin(brikz, {});
  81. };
  82. };
  83. });
  84. /*!
  85. * @overview es6-promise - a tiny implementation of Promises/A+.
  86. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  87. * @license Licensed under MIT license
  88. * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
  89. * @version 3.3.1
  90. */
  91. (function (global, factory) {
  92. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  93. typeof define === 'function' && define.amd ? define('amber/es6-promise',factory) :
  94. (global.ES6Promise = factory());
  95. }(this, (function () { 'use strict';
  96. function objectOrFunction(x) {
  97. return typeof x === 'function' || typeof x === 'object' && x !== null;
  98. }
  99. function isFunction(x) {
  100. return typeof x === 'function';
  101. }
  102. var _isArray = undefined;
  103. if (!Array.isArray) {
  104. _isArray = function (x) {
  105. return Object.prototype.toString.call(x) === '[object Array]';
  106. };
  107. } else {
  108. _isArray = Array.isArray;
  109. }
  110. var isArray = _isArray;
  111. var len = 0;
  112. var vertxNext = undefined;
  113. var customSchedulerFn = undefined;
  114. var asap = function asap(callback, arg) {
  115. queue[len] = callback;
  116. queue[len + 1] = arg;
  117. len += 2;
  118. if (len === 2) {
  119. // If len is 2, that means that we need to schedule an async flush.
  120. // If additional callbacks are queued before the queue is flushed, they
  121. // will be processed by this flush that we are scheduling.
  122. if (customSchedulerFn) {
  123. customSchedulerFn(flush);
  124. } else {
  125. scheduleFlush();
  126. }
  127. }
  128. };
  129. function setScheduler(scheduleFn) {
  130. customSchedulerFn = scheduleFn;
  131. }
  132. function setAsap(asapFn) {
  133. asap = asapFn;
  134. }
  135. var browserWindow = typeof window !== 'undefined' ? window : undefined;
  136. var browserGlobal = browserWindow || {};
  137. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  138. var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]';
  139. // test for web worker but not in IE10
  140. var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
  141. // node
  142. function useNextTick() {
  143. // node version 0.10.x displays a deprecation warning when nextTick is used recursively
  144. // see https://github.com/cujojs/when/issues/410 for details
  145. return function () {
  146. return process.nextTick(flush);
  147. };
  148. }
  149. // vertx
  150. function useVertxTimer() {
  151. return function () {
  152. vertxNext(flush);
  153. };
  154. }
  155. function useMutationObserver() {
  156. var iterations = 0;
  157. var observer = new BrowserMutationObserver(flush);
  158. var node = document.createTextNode('');
  159. observer.observe(node, { characterData: true });
  160. return function () {
  161. node.data = iterations = ++iterations % 2;
  162. };
  163. }
  164. // web worker
  165. function useMessageChannel() {
  166. var channel = new MessageChannel();
  167. channel.port1.onmessage = flush;
  168. return function () {
  169. return channel.port2.postMessage(0);
  170. };
  171. }
  172. function useSetTimeout() {
  173. // Store setTimeout reference so es6-promise will be unaffected by
  174. // other code modifying setTimeout (like sinon.useFakeTimers())
  175. var globalSetTimeout = setTimeout;
  176. return function () {
  177. return globalSetTimeout(flush, 1);
  178. };
  179. }
  180. var queue = new Array(1000);
  181. function flush() {
  182. for (var i = 0; i < len; i += 2) {
  183. var callback = queue[i];
  184. var arg = queue[i + 1];
  185. callback(arg);
  186. queue[i] = undefined;
  187. queue[i + 1] = undefined;
  188. }
  189. len = 0;
  190. }
  191. function attemptVertx() {
  192. try {
  193. var r = require;
  194. var vertx = r('vertx');
  195. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  196. return useVertxTimer();
  197. } catch (e) {
  198. return useSetTimeout();
  199. }
  200. }
  201. var scheduleFlush = undefined;
  202. // Decide what async method to use to triggering processing of queued callbacks:
  203. if (isNode) {
  204. scheduleFlush = useNextTick();
  205. } else if (BrowserMutationObserver) {
  206. scheduleFlush = useMutationObserver();
  207. } else if (isWorker) {
  208. scheduleFlush = useMessageChannel();
  209. } else if (browserWindow === undefined && typeof require === 'function') {
  210. scheduleFlush = attemptVertx();
  211. } else {
  212. scheduleFlush = useSetTimeout();
  213. }
  214. function then(onFulfillment, onRejection) {
  215. var _arguments = arguments;
  216. var parent = this;
  217. var child = new this.constructor(noop);
  218. if (child[PROMISE_ID] === undefined) {
  219. makePromise(child);
  220. }
  221. var _state = parent._state;
  222. if (_state) {
  223. (function () {
  224. var callback = _arguments[_state - 1];
  225. asap(function () {
  226. return invokeCallback(_state, child, callback, parent._result);
  227. });
  228. })();
  229. } else {
  230. subscribe(parent, child, onFulfillment, onRejection);
  231. }
  232. return child;
  233. }
  234. /**
  235. `Promise.resolve` returns a promise that will become resolved with the
  236. passed `value`. It is shorthand for the following:
  237. ```javascript
  238. let promise = new Promise(function(resolve, reject){
  239. resolve(1);
  240. });
  241. promise.then(function(value){
  242. // value === 1
  243. });
  244. ```
  245. Instead of writing the above, your code now simply becomes the following:
  246. ```javascript
  247. let promise = Promise.resolve(1);
  248. promise.then(function(value){
  249. // value === 1
  250. });
  251. ```
  252. @method resolve
  253. @static
  254. @param {Any} value value that the returned promise will be resolved with
  255. Useful for tooling.
  256. @return {Promise} a promise that will become fulfilled with the given
  257. `value`
  258. */
  259. function resolve(object) {
  260. /*jshint validthis:true */
  261. var Constructor = this;
  262. if (object && typeof object === 'object' && object.constructor === Constructor) {
  263. return object;
  264. }
  265. var promise = new Constructor(noop);
  266. _resolve(promise, object);
  267. return promise;
  268. }
  269. var PROMISE_ID = Math.random().toString(36).substring(16);
  270. function noop() {}
  271. var PENDING = void 0;
  272. var FULFILLED = 1;
  273. var REJECTED = 2;
  274. var GET_THEN_ERROR = new ErrorObject();
  275. function selfFulfillment() {
  276. return new TypeError("You cannot resolve a promise with itself");
  277. }
  278. function cannotReturnOwn() {
  279. return new TypeError('A promises callback cannot return that same promise.');
  280. }
  281. function getThen(promise) {
  282. try {
  283. return promise.then;
  284. } catch (error) {
  285. GET_THEN_ERROR.error = error;
  286. return GET_THEN_ERROR;
  287. }
  288. }
  289. function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
  290. try {
  291. then.call(value, fulfillmentHandler, rejectionHandler);
  292. } catch (e) {
  293. return e;
  294. }
  295. }
  296. function handleForeignThenable(promise, thenable, then) {
  297. asap(function (promise) {
  298. var sealed = false;
  299. var error = tryThen(then, thenable, function (value) {
  300. if (sealed) {
  301. return;
  302. }
  303. sealed = true;
  304. if (thenable !== value) {
  305. _resolve(promise, value);
  306. } else {
  307. fulfill(promise, value);
  308. }
  309. }, function (reason) {
  310. if (sealed) {
  311. return;
  312. }
  313. sealed = true;
  314. _reject(promise, reason);
  315. }, 'Settle: ' + (promise._label || ' unknown promise'));
  316. if (!sealed && error) {
  317. sealed = true;
  318. _reject(promise, error);
  319. }
  320. }, promise);
  321. }
  322. function handleOwnThenable(promise, thenable) {
  323. if (thenable._state === FULFILLED) {
  324. fulfill(promise, thenable._result);
  325. } else if (thenable._state === REJECTED) {
  326. _reject(promise, thenable._result);
  327. } else {
  328. subscribe(thenable, undefined, function (value) {
  329. return _resolve(promise, value);
  330. }, function (reason) {
  331. return _reject(promise, reason);
  332. });
  333. }
  334. }
  335. function handleMaybeThenable(promise, maybeThenable, then$$) {
  336. if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {
  337. handleOwnThenable(promise, maybeThenable);
  338. } else {
  339. if (then$$ === GET_THEN_ERROR) {
  340. _reject(promise, GET_THEN_ERROR.error);
  341. } else if (then$$ === undefined) {
  342. fulfill(promise, maybeThenable);
  343. } else if (isFunction(then$$)) {
  344. handleForeignThenable(promise, maybeThenable, then$$);
  345. } else {
  346. fulfill(promise, maybeThenable);
  347. }
  348. }
  349. }
  350. function _resolve(promise, value) {
  351. if (promise === value) {
  352. _reject(promise, selfFulfillment());
  353. } else if (objectOrFunction(value)) {
  354. handleMaybeThenable(promise, value, getThen(value));
  355. } else {
  356. fulfill(promise, value);
  357. }
  358. }
  359. function publishRejection(promise) {
  360. if (promise._onerror) {
  361. promise._onerror(promise._result);
  362. }
  363. publish(promise);
  364. }
  365. function fulfill(promise, value) {
  366. if (promise._state !== PENDING) {
  367. return;
  368. }
  369. promise._result = value;
  370. promise._state = FULFILLED;
  371. if (promise._subscribers.length !== 0) {
  372. asap(publish, promise);
  373. }
  374. }
  375. function _reject(promise, reason) {
  376. if (promise._state !== PENDING) {
  377. return;
  378. }
  379. promise._state = REJECTED;
  380. promise._result = reason;
  381. asap(publishRejection, promise);
  382. }
  383. function subscribe(parent, child, onFulfillment, onRejection) {
  384. var _subscribers = parent._subscribers;
  385. var length = _subscribers.length;
  386. parent._onerror = null;
  387. _subscribers[length] = child;
  388. _subscribers[length + FULFILLED] = onFulfillment;
  389. _subscribers[length + REJECTED] = onRejection;
  390. if (length === 0 && parent._state) {
  391. asap(publish, parent);
  392. }
  393. }
  394. function publish(promise) {
  395. var subscribers = promise._subscribers;
  396. var settled = promise._state;
  397. if (subscribers.length === 0) {
  398. return;
  399. }
  400. var child = undefined,
  401. callback = undefined,
  402. detail = promise._result;
  403. for (var i = 0; i < subscribers.length; i += 3) {
  404. child = subscribers[i];
  405. callback = subscribers[i + settled];
  406. if (child) {
  407. invokeCallback(settled, child, callback, detail);
  408. } else {
  409. callback(detail);
  410. }
  411. }
  412. promise._subscribers.length = 0;
  413. }
  414. function ErrorObject() {
  415. this.error = null;
  416. }
  417. var TRY_CATCH_ERROR = new ErrorObject();
  418. function tryCatch(callback, detail) {
  419. try {
  420. return callback(detail);
  421. } catch (e) {
  422. TRY_CATCH_ERROR.error = e;
  423. return TRY_CATCH_ERROR;
  424. }
  425. }
  426. function invokeCallback(settled, promise, callback, detail) {
  427. var hasCallback = isFunction(callback),
  428. value = undefined,
  429. error = undefined,
  430. succeeded = undefined,
  431. failed = undefined;
  432. if (hasCallback) {
  433. value = tryCatch(callback, detail);
  434. if (value === TRY_CATCH_ERROR) {
  435. failed = true;
  436. error = value.error;
  437. value = null;
  438. } else {
  439. succeeded = true;
  440. }
  441. if (promise === value) {
  442. _reject(promise, cannotReturnOwn());
  443. return;
  444. }
  445. } else {
  446. value = detail;
  447. succeeded = true;
  448. }
  449. if (promise._state !== PENDING) {
  450. // noop
  451. } else if (hasCallback && succeeded) {
  452. _resolve(promise, value);
  453. } else if (failed) {
  454. _reject(promise, error);
  455. } else if (settled === FULFILLED) {
  456. fulfill(promise, value);
  457. } else if (settled === REJECTED) {
  458. _reject(promise, value);
  459. }
  460. }
  461. function initializePromise(promise, resolver) {
  462. try {
  463. resolver(function resolvePromise(value) {
  464. _resolve(promise, value);
  465. }, function rejectPromise(reason) {
  466. _reject(promise, reason);
  467. });
  468. } catch (e) {
  469. _reject(promise, e);
  470. }
  471. }
  472. var id = 0;
  473. function nextId() {
  474. return id++;
  475. }
  476. function makePromise(promise) {
  477. promise[PROMISE_ID] = id++;
  478. promise._state = undefined;
  479. promise._result = undefined;
  480. promise._subscribers = [];
  481. }
  482. function Enumerator(Constructor, input) {
  483. this._instanceConstructor = Constructor;
  484. this.promise = new Constructor(noop);
  485. if (!this.promise[PROMISE_ID]) {
  486. makePromise(this.promise);
  487. }
  488. if (isArray(input)) {
  489. this._input = input;
  490. this.length = input.length;
  491. this._remaining = input.length;
  492. this._result = new Array(this.length);
  493. if (this.length === 0) {
  494. fulfill(this.promise, this._result);
  495. } else {
  496. this.length = this.length || 0;
  497. this._enumerate();
  498. if (this._remaining === 0) {
  499. fulfill(this.promise, this._result);
  500. }
  501. }
  502. } else {
  503. _reject(this.promise, validationError());
  504. }
  505. }
  506. function validationError() {
  507. return new Error('Array Methods must be provided an Array');
  508. };
  509. Enumerator.prototype._enumerate = function () {
  510. var length = this.length;
  511. var _input = this._input;
  512. for (var i = 0; this._state === PENDING && i < length; i++) {
  513. this._eachEntry(_input[i], i);
  514. }
  515. };
  516. Enumerator.prototype._eachEntry = function (entry, i) {
  517. var c = this._instanceConstructor;
  518. var resolve$$ = c.resolve;
  519. if (resolve$$ === resolve) {
  520. var _then = getThen(entry);
  521. if (_then === then && entry._state !== PENDING) {
  522. this._settledAt(entry._state, i, entry._result);
  523. } else if (typeof _then !== 'function') {
  524. this._remaining--;
  525. this._result[i] = entry;
  526. } else if (c === Promise) {
  527. var promise = new c(noop);
  528. handleMaybeThenable(promise, entry, _then);
  529. this._willSettleAt(promise, i);
  530. } else {
  531. this._willSettleAt(new c(function (resolve$$) {
  532. return resolve$$(entry);
  533. }), i);
  534. }
  535. } else {
  536. this._willSettleAt(resolve$$(entry), i);
  537. }
  538. };
  539. Enumerator.prototype._settledAt = function (state, i, value) {
  540. var promise = this.promise;
  541. if (promise._state === PENDING) {
  542. this._remaining--;
  543. if (state === REJECTED) {
  544. _reject(promise, value);
  545. } else {
  546. this._result[i] = value;
  547. }
  548. }
  549. if (this._remaining === 0) {
  550. fulfill(promise, this._result);
  551. }
  552. };
  553. Enumerator.prototype._willSettleAt = function (promise, i) {
  554. var enumerator = this;
  555. subscribe(promise, undefined, function (value) {
  556. return enumerator._settledAt(FULFILLED, i, value);
  557. }, function (reason) {
  558. return enumerator._settledAt(REJECTED, i, reason);
  559. });
  560. };
  561. /**
  562. `Promise.all` accepts an array of promises, and returns a new promise which
  563. is fulfilled with an array of fulfillment values for the passed promises, or
  564. rejected with the reason of the first passed promise to be rejected. It casts all
  565. elements of the passed iterable to promises as it runs this algorithm.
  566. Example:
  567. ```javascript
  568. let promise1 = resolve(1);
  569. let promise2 = resolve(2);
  570. let promise3 = resolve(3);
  571. let promises = [ promise1, promise2, promise3 ];
  572. Promise.all(promises).then(function(array){
  573. // The array here would be [ 1, 2, 3 ];
  574. });
  575. ```
  576. If any of the `promises` given to `all` are rejected, the first promise
  577. that is rejected will be given as an argument to the returned promises's
  578. rejection handler. For example:
  579. Example:
  580. ```javascript
  581. let promise1 = resolve(1);
  582. let promise2 = reject(new Error("2"));
  583. let promise3 = reject(new Error("3"));
  584. let promises = [ promise1, promise2, promise3 ];
  585. Promise.all(promises).then(function(array){
  586. // Code here never runs because there are rejected promises!
  587. }, function(error) {
  588. // error.message === "2"
  589. });
  590. ```
  591. @method all
  592. @static
  593. @param {Array} entries array of promises
  594. @param {String} label optional string for labeling the promise.
  595. Useful for tooling.
  596. @return {Promise} promise that is fulfilled when all `promises` have been
  597. fulfilled, or rejected if any of them become rejected.
  598. @static
  599. */
  600. function all(entries) {
  601. return new Enumerator(this, entries).promise;
  602. }
  603. /**
  604. `Promise.race` returns a new promise which is settled in the same way as the
  605. first passed promise to settle.
  606. Example:
  607. ```javascript
  608. let promise1 = new Promise(function(resolve, reject){
  609. setTimeout(function(){
  610. resolve('promise 1');
  611. }, 200);
  612. });
  613. let promise2 = new Promise(function(resolve, reject){
  614. setTimeout(function(){
  615. resolve('promise 2');
  616. }, 100);
  617. });
  618. Promise.race([promise1, promise2]).then(function(result){
  619. // result === 'promise 2' because it was resolved before promise1
  620. // was resolved.
  621. });
  622. ```
  623. `Promise.race` is deterministic in that only the state of the first
  624. settled promise matters. For example, even if other promises given to the
  625. `promises` array argument are resolved, but the first settled promise has
  626. become rejected before the other promises became fulfilled, the returned
  627. promise will become rejected:
  628. ```javascript
  629. let promise1 = new Promise(function(resolve, reject){
  630. setTimeout(function(){
  631. resolve('promise 1');
  632. }, 200);
  633. });
  634. let promise2 = new Promise(function(resolve, reject){
  635. setTimeout(function(){
  636. reject(new Error('promise 2'));
  637. }, 100);
  638. });
  639. Promise.race([promise1, promise2]).then(function(result){
  640. // Code here never runs
  641. }, function(reason){
  642. // reason.message === 'promise 2' because promise 2 became rejected before
  643. // promise 1 became fulfilled
  644. });
  645. ```
  646. An example real-world use case is implementing timeouts:
  647. ```javascript
  648. Promise.race([ajax('foo.json'), timeout(5000)])
  649. ```
  650. @method race
  651. @static
  652. @param {Array} promises array of promises to observe
  653. Useful for tooling.
  654. @return {Promise} a promise which settles in the same way as the first passed
  655. promise to settle.
  656. */
  657. function race(entries) {
  658. /*jshint validthis:true */
  659. var Constructor = this;
  660. if (!isArray(entries)) {
  661. return new Constructor(function (_, reject) {
  662. return reject(new TypeError('You must pass an array to race.'));
  663. });
  664. } else {
  665. return new Constructor(function (resolve, reject) {
  666. var length = entries.length;
  667. for (var i = 0; i < length; i++) {
  668. Constructor.resolve(entries[i]).then(resolve, reject);
  669. }
  670. });
  671. }
  672. }
  673. /**
  674. `Promise.reject` returns a promise rejected with the passed `reason`.
  675. It is shorthand for the following:
  676. ```javascript
  677. let promise = new Promise(function(resolve, reject){
  678. reject(new Error('WHOOPS'));
  679. });
  680. promise.then(function(value){
  681. // Code here doesn't run because the promise is rejected!
  682. }, function(reason){
  683. // reason.message === 'WHOOPS'
  684. });
  685. ```
  686. Instead of writing the above, your code now simply becomes the following:
  687. ```javascript
  688. let promise = Promise.reject(new Error('WHOOPS'));
  689. promise.then(function(value){
  690. // Code here doesn't run because the promise is rejected!
  691. }, function(reason){
  692. // reason.message === 'WHOOPS'
  693. });
  694. ```
  695. @method reject
  696. @static
  697. @param {Any} reason value that the returned promise will be rejected with.
  698. Useful for tooling.
  699. @return {Promise} a promise rejected with the given `reason`.
  700. */
  701. function reject(reason) {
  702. /*jshint validthis:true */
  703. var Constructor = this;
  704. var promise = new Constructor(noop);
  705. _reject(promise, reason);
  706. return promise;
  707. }
  708. function needsResolver() {
  709. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  710. }
  711. function needsNew() {
  712. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  713. }
  714. /**
  715. Promise objects represent the eventual result of an asynchronous operation. The
  716. primary way of interacting with a promise is through its `then` method, which
  717. registers callbacks to receive either a promise's eventual value or the reason
  718. why the promise cannot be fulfilled.
  719. Terminology
  720. -----------
  721. - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
  722. - `thenable` is an object or function that defines a `then` method.
  723. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
  724. - `exception` is a value that is thrown using the throw statement.
  725. - `reason` is a value that indicates why a promise was rejected.
  726. - `settled` the final resting state of a promise, fulfilled or rejected.
  727. A promise can be in one of three states: pending, fulfilled, or rejected.
  728. Promises that are fulfilled have a fulfillment value and are in the fulfilled
  729. state. Promises that are rejected have a rejection reason and are in the
  730. rejected state. A fulfillment value is never a thenable.
  731. Promises can also be said to *resolve* a value. If this value is also a
  732. promise, then the original promise's settled state will match the value's
  733. settled state. So a promise that *resolves* a promise that rejects will
  734. itself reject, and a promise that *resolves* a promise that fulfills will
  735. itself fulfill.
  736. Basic Usage:
  737. ------------
  738. ```js
  739. let promise = new Promise(function(resolve, reject) {
  740. // on success
  741. resolve(value);
  742. // on failure
  743. reject(reason);
  744. });
  745. promise.then(function(value) {
  746. // on fulfillment
  747. }, function(reason) {
  748. // on rejection
  749. });
  750. ```
  751. Advanced Usage:
  752. ---------------
  753. Promises shine when abstracting away asynchronous interactions such as
  754. `XMLHttpRequest`s.
  755. ```js
  756. function getJSON(url) {
  757. return new Promise(function(resolve, reject){
  758. let xhr = new XMLHttpRequest();
  759. xhr.open('GET', url);
  760. xhr.onreadystatechange = handler;
  761. xhr.responseType = 'json';
  762. xhr.setRequestHeader('Accept', 'application/json');
  763. xhr.send();
  764. function handler() {
  765. if (this.readyState === this.DONE) {
  766. if (this.status === 200) {
  767. resolve(this.response);
  768. } else {
  769. reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
  770. }
  771. }
  772. };
  773. });
  774. }
  775. getJSON('/posts.json').then(function(json) {
  776. // on fulfillment
  777. }, function(reason) {
  778. // on rejection
  779. });
  780. ```
  781. Unlike callbacks, promises are great composable primitives.
  782. ```js
  783. Promise.all([
  784. getJSON('/posts'),
  785. getJSON('/comments')
  786. ]).then(function(values){
  787. values[0] // => postsJSON
  788. values[1] // => commentsJSON
  789. return values;
  790. });
  791. ```
  792. @class Promise
  793. @param {function} resolver
  794. Useful for tooling.
  795. @constructor
  796. */
  797. function Promise(resolver) {
  798. this[PROMISE_ID] = nextId();
  799. this._result = this._state = undefined;
  800. this._subscribers = [];
  801. if (noop !== resolver) {
  802. typeof resolver !== 'function' && needsResolver();
  803. this instanceof Promise ? initializePromise(this, resolver) : needsNew();
  804. }
  805. }
  806. Promise.all = all;
  807. Promise.race = race;
  808. Promise.resolve = resolve;
  809. Promise.reject = reject;
  810. Promise._setScheduler = setScheduler;
  811. Promise._setAsap = setAsap;
  812. Promise._asap = asap;
  813. Promise.prototype = {
  814. constructor: Promise,
  815. /**
  816. The primary way of interacting with a promise is through its `then` method,
  817. which registers callbacks to receive either a promise's eventual value or the
  818. reason why the promise cannot be fulfilled.
  819. ```js
  820. findUser().then(function(user){
  821. // user is available
  822. }, function(reason){
  823. // user is unavailable, and you are given the reason why
  824. });
  825. ```
  826. Chaining
  827. --------
  828. The return value of `then` is itself a promise. This second, 'downstream'
  829. promise is resolved with the return value of the first promise's fulfillment
  830. or rejection handler, or rejected if the handler throws an exception.
  831. ```js
  832. findUser().then(function (user) {
  833. return user.name;
  834. }, function (reason) {
  835. return 'default name';
  836. }).then(function (userName) {
  837. // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
  838. // will be `'default name'`
  839. });
  840. findUser().then(function (user) {
  841. throw new Error('Found user, but still unhappy');
  842. }, function (reason) {
  843. throw new Error('`findUser` rejected and we're unhappy');
  844. }).then(function (value) {
  845. // never reached
  846. }, function (reason) {
  847. // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
  848. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
  849. });
  850. ```
  851. If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  852. ```js
  853. findUser().then(function (user) {
  854. throw new PedagogicalException('Upstream error');
  855. }).then(function (value) {
  856. // never reached
  857. }).then(function (value) {
  858. // never reached
  859. }, function (reason) {
  860. // The `PedgagocialException` is propagated all the way down to here
  861. });
  862. ```
  863. Assimilation
  864. ------------
  865. Sometimes the value you want to propagate to a downstream promise can only be
  866. retrieved asynchronously. This can be achieved by returning a promise in the
  867. fulfillment or rejection handler. The downstream promise will then be pending
  868. until the returned promise is settled. This is called *assimilation*.
  869. ```js
  870. findUser().then(function (user) {
  871. return findCommentsByAuthor(user);
  872. }).then(function (comments) {
  873. // The user's comments are now available
  874. });
  875. ```
  876. If the assimliated promise rejects, then the downstream promise will also reject.
  877. ```js
  878. findUser().then(function (user) {
  879. return findCommentsByAuthor(user);
  880. }).then(function (comments) {
  881. // If `findCommentsByAuthor` fulfills, we'll have the value here
  882. }, function (reason) {
  883. // If `findCommentsByAuthor` rejects, we'll have the reason here
  884. });
  885. ```
  886. Simple Example
  887. --------------
  888. Synchronous Example
  889. ```javascript
  890. let result;
  891. try {
  892. result = findResult();
  893. // success
  894. } catch(reason) {
  895. // failure
  896. }
  897. ```
  898. Errback Example
  899. ```js
  900. findResult(function(result, err){
  901. if (err) {
  902. // failure
  903. } else {
  904. // success
  905. }
  906. });
  907. ```
  908. Promise Example;
  909. ```javascript
  910. findResult().then(function(result){
  911. // success
  912. }, function(reason){
  913. // failure
  914. });
  915. ```
  916. Advanced Example
  917. --------------
  918. Synchronous Example
  919. ```javascript
  920. let author, books;
  921. try {
  922. author = findAuthor();
  923. books = findBooksByAuthor(author);
  924. // success
  925. } catch(reason) {
  926. // failure
  927. }
  928. ```
  929. Errback Example
  930. ```js
  931. function foundBooks(books) {
  932. }
  933. function failure(reason) {
  934. }
  935. findAuthor(function(author, err){
  936. if (err) {
  937. failure(err);
  938. // failure
  939. } else {
  940. try {
  941. findBoooksByAuthor(author, function(books, err) {
  942. if (err) {
  943. failure(err);
  944. } else {
  945. try {
  946. foundBooks(books);
  947. } catch(reason) {
  948. failure(reason);
  949. }
  950. }
  951. });
  952. } catch(error) {
  953. failure(err);
  954. }
  955. // success
  956. }
  957. });
  958. ```
  959. Promise Example;
  960. ```javascript
  961. findAuthor().
  962. then(findBooksByAuthor).
  963. then(function(books){
  964. // found books
  965. }).catch(function(reason){
  966. // something went wrong
  967. });
  968. ```
  969. @method then
  970. @param {Function} onFulfilled
  971. @param {Function} onRejected
  972. Useful for tooling.
  973. @return {Promise}
  974. */
  975. then: then,
  976. /**
  977. `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
  978. as the catch block of a try/catch statement.
  979. ```js
  980. function findAuthor(){
  981. throw new Error('couldn't find that author');
  982. }
  983. // synchronous
  984. try {
  985. findAuthor();
  986. } catch(reason) {
  987. // something went wrong
  988. }
  989. // async with promises
  990. findAuthor().catch(function(reason){
  991. // something went wrong
  992. });
  993. ```
  994. @method catch
  995. @param {Function} onRejection
  996. Useful for tooling.
  997. @return {Promise}
  998. */
  999. 'catch': function _catch(onRejection) {
  1000. return this.then(null, onRejection);
  1001. }
  1002. };
  1003. function polyfill() {
  1004. var local = undefined;
  1005. if (typeof global !== 'undefined') {
  1006. local = global;
  1007. } else if (typeof self !== 'undefined') {
  1008. local = self;
  1009. } else {
  1010. try {
  1011. local = Function('return this')();
  1012. } catch (e) {
  1013. throw new Error('polyfill failed because global object is unavailable in this environment');
  1014. }
  1015. }
  1016. var P = local.Promise;
  1017. if (P) {
  1018. var promiseToString = null;
  1019. try {
  1020. promiseToString = Object.prototype.toString.call(P.resolve());
  1021. } catch (e) {
  1022. // silently ignored
  1023. }
  1024. if (promiseToString === '[object Promise]' && !P.cast) {
  1025. return;
  1026. }
  1027. }
  1028. local.Promise = Promise;
  1029. }
  1030. polyfill();
  1031. // Strange compat..
  1032. Promise.polyfill = polyfill;
  1033. Promise.Promise = Promise;
  1034. return Promise;
  1035. })));
  1036. //# sourceMappingURL=es6-promise.map;
  1037. define('amber/es2015-polyfills',['amber/es6-promise'], function (promiseLib) {
  1038. promiseLib.polyfill();
  1039. });
  1040. // This file is injected dependencies by amber-compat-xxx modules.
  1041. // Therefore it is important that it _does_not_have_ define call.
  1042. ;
  1043. define("amber/node-compatibility", ["./es2015-polyfills"], function(){});
  1044. /* ====================================================================
  1045. |
  1046. | Amber Smalltalk
  1047. | http://amber-lang.net
  1048. |
  1049. ======================================================================
  1050. ======================================================================
  1051. |
  1052. | Copyright (c) 2010-2014
  1053. | Nicolas Petton <petton.nicolas@gmail.com>
  1054. |
  1055. | Copyright (c) 2012-2016
  1056. | The Amber team https://lolg.it/org/amber/members
  1057. | Amber contributors (see /CONTRIBUTORS)
  1058. |
  1059. | Amber is released under the MIT license
  1060. |
  1061. | Permission is hereby granted, free of charge, to any person obtaining
  1062. | a copy of this software and associated documentation files (the
  1063. | 'Software'), to deal in the Software without restriction, including
  1064. | without limitation the rights to use, copy, modify, merge, publish,
  1065. | distribute, sublicense, and/or sell copies of the Software, and to
  1066. | permit persons to whom the Software is furnished to do so, subject to
  1067. | the following conditions:
  1068. |
  1069. | The above copyright notice and this permission notice shall be
  1070. | included in all copies or substantial portions of the Software.
  1071. |
  1072. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1073. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1074. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1075. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1076. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1077. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1078. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1079. |
  1080. ==================================================================== */
  1081. //jshint eqnull:true
  1082. define('amber/kernel-fundamentals',['./compatibility'], function () {
  1083. "use strict";
  1084. function inherits (child, parent) {
  1085. child.prototype = Object.create(parent.prototype, {
  1086. constructor: {
  1087. value: child,
  1088. enumerable: false, configurable: true, writable: true
  1089. }
  1090. });
  1091. return child;
  1092. }
  1093. function SmalltalkGlobalsBrik (brikz, st) {
  1094. // jshint evil:true
  1095. var jsGlobals = new Function("return this")();
  1096. var globals = Object.create(jsGlobals);
  1097. globals.SmalltalkSettings = {};
  1098. this.globals = globals;
  1099. }
  1100. function RootBrik (brikz, st) {
  1101. /* Smalltalk foundational objects */
  1102. var coreFns = this.coreFns = {};
  1103. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1104. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1105. Detached roots (eg. wrapped JS classes like Number or Date)
  1106. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1107. function SmalltalkRoot () {
  1108. }
  1109. function SmalltalkProtoObject () {
  1110. }
  1111. function SmalltalkObject () {
  1112. }
  1113. coreFns.ProtoObject = inherits(SmalltalkProtoObject, SmalltalkRoot);
  1114. coreFns.Object = inherits(SmalltalkObject, SmalltalkProtoObject);
  1115. this.Root = SmalltalkRoot;
  1116. this.Object = SmalltalkObject;
  1117. }
  1118. OrganizeBrik.deps = ["arraySet", "root"];
  1119. function OrganizeBrik (brikz, st) {
  1120. var SmalltalkObject = brikz.root.Object;
  1121. var coreFns = brikz.root.coreFns;
  1122. var addElement = brikz.arraySet.addElement;
  1123. var removeElement = brikz.arraySet.removeElement;
  1124. function SmalltalkOrganizer () {
  1125. }
  1126. function SmalltalkPackageOrganizer () {
  1127. this.elements = [];
  1128. }
  1129. function SmalltalkClassOrganizer () {
  1130. this.elements = [];
  1131. }
  1132. coreFns.Organizer = inherits(SmalltalkOrganizer, SmalltalkObject);
  1133. coreFns.PackageOrganizer = inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  1134. coreFns.ClassOrganizer = inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  1135. this.setupClassOrganization = function (behaviorBody) {
  1136. behaviorBody.organization = new SmalltalkClassOrganizer();
  1137. behaviorBody.organization.theClass = behaviorBody;
  1138. };
  1139. this.setupPackageOrganization = function (pkg) {
  1140. pkg.organization = new SmalltalkPackageOrganizer();
  1141. };
  1142. this.addOrganizationElement = function (owner, element) {
  1143. addElement(owner.organization.elements, element);
  1144. };
  1145. this.removeOrganizationElement = function (owner, element) {
  1146. removeElement(owner.organization.elements, element);
  1147. };
  1148. }
  1149. SelectorsBrik.deps = ["selectorConversion"];
  1150. function SelectorsBrik (brikz, st) {
  1151. var selectorSet = Object.create(null);
  1152. var selectors = this.selectors = [];
  1153. var selectorPairs = this.selectorPairs = [];
  1154. this.registerSelector = function (stSelector) {
  1155. if (selectorSet[stSelector]) return null;
  1156. var jsSelector = st.st2js(stSelector);
  1157. selectorSet[stSelector] = true;
  1158. selectors.push(stSelector);
  1159. var pair = {st: stSelector, js: jsSelector};
  1160. selectorPairs.push(pair);
  1161. return pair;
  1162. };
  1163. st.allSelectors = function () {
  1164. return selectors;
  1165. };
  1166. }
  1167. PackagesBrik.deps = ["organize", "root"];
  1168. function PackagesBrik (brikz, st) {
  1169. var setupPackageOrganization = brikz.organize.setupPackageOrganization;
  1170. var SmalltalkObject = brikz.root.Object;
  1171. var coreFns = brikz.root.coreFns;
  1172. function SmalltalkPackage () {
  1173. }
  1174. coreFns.Package = inherits(SmalltalkPackage, SmalltalkObject);
  1175. st.packages = {};
  1176. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  1177. function pkg (spec) {
  1178. var that = new SmalltalkPackage();
  1179. that.pkgName = spec.pkgName;
  1180. setupPackageOrganization(that);
  1181. that.properties = spec.properties || {};
  1182. return that;
  1183. }
  1184. /* Add a package to the system, creating a new one if needed.
  1185. If pkgName is null or empty we return nil.
  1186. If package already exists we still update the properties of it. */
  1187. st.addPackage = function (pkgName, properties) {
  1188. if (!pkgName) return null;
  1189. if (!st.packages[pkgName]) {
  1190. st.packages[pkgName] = pkg({
  1191. pkgName: pkgName,
  1192. properties: properties
  1193. });
  1194. } else {
  1195. if (properties) {
  1196. st.packages[pkgName].properties = properties;
  1197. }
  1198. }
  1199. return st.packages[pkgName];
  1200. };
  1201. }
  1202. BehaviorsBrik.deps = ["organize", "root", "smalltalkGlobals", "arraySet"];
  1203. function BehaviorsBrik (brikz, st) {
  1204. var addOrganizationElement = brikz.organize.addOrganizationElement;
  1205. var removeOrganizationElement = brikz.organize.removeOrganizationElement;
  1206. var globals = brikz.smalltalkGlobals.globals;
  1207. var SmalltalkObject = brikz.root.Object;
  1208. var coreFns = brikz.root.coreFns;
  1209. var addElement = brikz.arraySet.addElement;
  1210. var removeElement = brikz.arraySet.removeElement;
  1211. function SmalltalkBehaviorBody () {
  1212. }
  1213. coreFns.BehaviorBody = inherits(SmalltalkBehaviorBody, SmalltalkObject);
  1214. this.BehaviorBody = SmalltalkBehaviorBody;
  1215. /* Smalltalk classes */
  1216. var classes = [];
  1217. this.buildBehaviorBody = function (pkgName, builder) {
  1218. var pkg = st.packages[pkgName];
  1219. if (!pkg) throw new Error("Missing package " + pkgName);
  1220. var behaviorBody = globals.hasOwnProperty(builder.className) && globals[builder.className];
  1221. if (behaviorBody) {
  1222. builder.updateExisting(behaviorBody, pkg);
  1223. } else {
  1224. behaviorBody = builder.make(pkg);
  1225. }
  1226. addBehaviorBody(behaviorBody);
  1227. return behaviorBody;
  1228. };
  1229. function addBehaviorBody (behaviorBody) {
  1230. globals[behaviorBody.className] = behaviorBody;
  1231. addElement(classes, behaviorBody);
  1232. addOrganizationElement(behaviorBody.pkg, behaviorBody);
  1233. behaviorBody.added();
  1234. }
  1235. function removeBehaviorBody (behaviorBody) {
  1236. behaviorBody.removed();
  1237. removeOrganizationElement(behaviorBody.pkg, behaviorBody);
  1238. removeElement(classes, behaviorBody);
  1239. delete globals[behaviorBody.className];
  1240. }
  1241. this.removeBehaviorBody = removeBehaviorBody;
  1242. /* Create an alias for an existing class */
  1243. st.alias = function (behaviorBody, alias) {
  1244. globals[alias] = behaviorBody;
  1245. };
  1246. /* Answer all registered Smalltalk classes */
  1247. //TODO: remove the function and make smalltalk.classes an array
  1248. st.classes = this.classes = function () {
  1249. return classes;
  1250. };
  1251. }
  1252. MethodsBrik.deps = ["composition", "selectors", "root", "selectorConversion"];
  1253. function MethodsBrik (brikz, st) {
  1254. var registerSelector = brikz.selectors.registerSelector;
  1255. var updateMethod = brikz.composition.updateMethod;
  1256. var SmalltalkObject = brikz.root.Object;
  1257. var coreFns = brikz.root.coreFns;
  1258. function SmalltalkMethod () {
  1259. }
  1260. coreFns.CompiledMethod = inherits(SmalltalkMethod, SmalltalkObject);
  1261. /* Smalltalk method object. To add a method to a class,
  1262. use api.addMethod() */
  1263. st.method = function (spec) {
  1264. var that = new SmalltalkMethod();
  1265. var selector = spec.selector;
  1266. that.selector = selector;
  1267. that.jsSelector = st.st2js(selector);
  1268. that.args = spec.args || {};
  1269. that.protocol = spec.protocol;
  1270. that.source = spec.source;
  1271. that.messageSends = spec.messageSends || [];
  1272. that.referencedClasses = spec.referencedClasses || [];
  1273. that.fn = spec.fn;
  1274. return that;
  1275. };
  1276. /* Add/remove a method to/from a class */
  1277. st.addMethod = function (method, behaviorBody) {
  1278. if (method.methodClass != null) {
  1279. throw new Error("addMethod: Method " + method.selector + " already bound to " + method.methodClass);
  1280. }
  1281. method.methodClass = behaviorBody;
  1282. registerNewSelectors(method);
  1283. behaviorBody.localMethods[method.selector] = method;
  1284. updateMethod(method.selector, behaviorBody);
  1285. };
  1286. function registerNewSelectors (method) {
  1287. var newSelectors = [];
  1288. function selectorInUse (stSelector) {
  1289. var pair = registerSelector(stSelector);
  1290. if (pair) {
  1291. newSelectors.push(pair);
  1292. }
  1293. }
  1294. selectorInUse(method.selector);
  1295. method.messageSends.forEach(selectorInUse);
  1296. if (st._selectorsAdded) st._selectorsAdded(newSelectors);
  1297. }
  1298. st.removeMethod = function (method, behaviorBody) {
  1299. if (behaviorBody.localMethods[method.selector] !== method) return;
  1300. delete behaviorBody.localMethods[method.selector];
  1301. updateMethod(method.selector, behaviorBody);
  1302. };
  1303. }
  1304. MethodCompositionBrik.deps = ["organize"];
  1305. function MethodCompositionBrik (brikz, st) {
  1306. var setupClassOrganization = brikz.organize.setupClassOrganization;
  1307. var addOrganizationElement = brikz.organize.addOrganizationElement;
  1308. this.setupMethods = function (behaviorBody) {
  1309. setupClassOrganization(behaviorBody);
  1310. behaviorBody.traitComposition = [];
  1311. behaviorBody.localMethods = Object.create(null);
  1312. behaviorBody.methods = Object.create(null);
  1313. };
  1314. function addMethod (method, behaviorBody) {
  1315. behaviorBody.methods[method.selector] = method;
  1316. // During the bootstrap, #addCompiledMethod is not used.
  1317. // Therefore we populate the organizer here too
  1318. addOrganizationElement(behaviorBody, method.protocol);
  1319. behaviorBody.methodAdded(method);
  1320. }
  1321. function removeMethod (method, behaviorBody) {
  1322. delete behaviorBody.methods[method.selector];
  1323. behaviorBody.methodRemoved(method);
  1324. // Do *not* delete protocols from here.
  1325. // This is handled by #removeCompiledMethod
  1326. }
  1327. function aliased (selector, method) {
  1328. if (method.selector === selector) return method;
  1329. var result = st.method({
  1330. selector: selector,
  1331. args: method.args,
  1332. protocol: method.protocol,
  1333. source: '"Aliased as ' + selector + '"\n' + method.source,
  1334. messageSends: method.messageSends,
  1335. referencesClasses: method.referencedClasses,
  1336. fn: method.fn
  1337. });
  1338. result.methodClass = method.methodClass;
  1339. return result;
  1340. }
  1341. function deleteKeysFrom (keys, obj) {
  1342. keys.forEach(function (each) {
  1343. delete obj[each];
  1344. });
  1345. }
  1346. function fillTraitTransformation (traitTransformation, obj) {
  1347. // assert(Object.getOwnProperties(obj).length === 0)
  1348. var traitMethods = traitTransformation.trait.methods;
  1349. Object.keys(traitMethods).forEach(function (selector) {
  1350. obj[selector] = traitMethods[selector];
  1351. });
  1352. var traitAliases = traitTransformation.aliases;
  1353. if (traitAliases) {
  1354. Object.keys(traitAliases).forEach(function (aliasSelector) {
  1355. var aliasedMethod = traitMethods[traitAliases[aliasSelector]];
  1356. if (aliasedMethod) obj[aliasSelector] = aliased(aliasSelector, aliasedMethod);
  1357. // else delete obj[aliasSelector]; // semantically correct; optimized away
  1358. });
  1359. }
  1360. var traitExclusions = traitTransformation.exclusions;
  1361. if (traitExclusions) {
  1362. deleteKeysFrom(traitExclusions, obj);
  1363. }
  1364. return obj;
  1365. }
  1366. function buildCompositionChain (traitComposition) {
  1367. return traitComposition.reduce(function (soFar, each) {
  1368. return fillTraitTransformation(each, Object.create(soFar));
  1369. }, null);
  1370. }
  1371. st.setTraitComposition = function (traitComposition, behaviorBody) {
  1372. var oldLocalMethods = behaviorBody.localMethods,
  1373. newLocalMethods = Object.create(buildCompositionChain(traitComposition));
  1374. Object.keys(oldLocalMethods).forEach(function (selector) {
  1375. newLocalMethods[selector] = oldLocalMethods[selector];
  1376. });
  1377. behaviorBody.localMethods = newLocalMethods;
  1378. for (var selector in newLocalMethods) {
  1379. updateMethod(selector, behaviorBody);
  1380. }
  1381. for (var selector in oldLocalMethods) {
  1382. updateMethod(selector, behaviorBody);
  1383. }
  1384. behaviorBody.traitComposition.forEach(function (each) {
  1385. each.trait.removeUser(behaviorBody);
  1386. });
  1387. behaviorBody.traitComposition = traitComposition;
  1388. behaviorBody.traitComposition.forEach(function (each) {
  1389. each.trait.addUser(behaviorBody);
  1390. });
  1391. };
  1392. function updateMethod (selector, behaviorBody) {
  1393. var oldMethod = behaviorBody.methods[selector],
  1394. newMethod = behaviorBody.localMethods[selector];
  1395. if (oldMethod == null && newMethod == null) {
  1396. console.warn("Removal of nonexistent method " + behaviorBody + " >> " + selector);
  1397. return;
  1398. }
  1399. if (newMethod === oldMethod) return;
  1400. if (newMethod != null) addMethod(newMethod, behaviorBody);
  1401. else removeMethod(oldMethod, behaviorBody);
  1402. }
  1403. this.updateMethod = updateMethod;
  1404. function aliasesOfSelector (selector, traitAliases) {
  1405. if (!traitAliases) return [selector];
  1406. var result = Object.keys(traitAliases).filter(function (aliasSelector) {
  1407. return traitAliases[aliasSelector] === selector
  1408. });
  1409. if (!traitAliases[selector]) result.push(selector);
  1410. return result;
  1411. }
  1412. function applyTraitMethodAddition (selector, method, traitTransformation, obj) {
  1413. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  1414. changes.forEach(function (aliasSelector) {
  1415. obj[aliasSelector] = aliased(aliasSelector, method);
  1416. });
  1417. var traitExclusions = traitTransformation.exclusions;
  1418. if (traitExclusions) {
  1419. deleteKeysFrom(traitExclusions, obj);
  1420. }
  1421. return changes;
  1422. }
  1423. function applyTraitMethodDeletion (selector, traitTransformation, obj) {
  1424. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  1425. deleteKeysFrom(changes, obj);
  1426. return changes;
  1427. }
  1428. function traitMethodChanged (selector, method, trait, behaviorBody) {
  1429. var traitComposition = behaviorBody.traitComposition,
  1430. chain = behaviorBody.localMethods,
  1431. changes = [];
  1432. for (var i = traitComposition.length - 1; i >= 0; --i) {
  1433. chain = Object.getPrototypeOf(chain);
  1434. var traitTransformation = traitComposition[i];
  1435. if (traitTransformation.trait !== trait) continue;
  1436. changes.push.apply(changes, method ?
  1437. applyTraitMethodAddition(selector, method, traitTransformation, chain) :
  1438. applyTraitMethodDeletion(selector, traitTransformation, chain));
  1439. }
  1440. // assert(chain === null);
  1441. changes.forEach(function (each) {
  1442. updateMethod(each, behaviorBody);
  1443. });
  1444. }
  1445. this.traitMethodChanged = traitMethodChanged;
  1446. }
  1447. function ArraySetBrik (brikz, st) {
  1448. st.addElement = this.addElement = function (array, el) {
  1449. if (typeof el === 'undefined') {
  1450. return;
  1451. }
  1452. if (array.indexOf(el) === -1) {
  1453. array.push(el);
  1454. }
  1455. };
  1456. st.removeElement = this.removeElement = function (array, el) {
  1457. var i = array.indexOf(el);
  1458. if (i !== -1) {
  1459. array.splice(i, 1);
  1460. }
  1461. };
  1462. }
  1463. function SelectorConversionBrik (brikz, st) {
  1464. /* Convert a Smalltalk selector into a JS selector */
  1465. st.st2js = function (string) {
  1466. return '_' + string
  1467. .replace(/:/g, '_')
  1468. .replace(/[\&]/g, '_and')
  1469. .replace(/[\|]/g, '_or')
  1470. .replace(/[+]/g, '_plus')
  1471. .replace(/-/g, '_minus')
  1472. .replace(/[*]/g, '_star')
  1473. .replace(/[\/]/g, '_slash')
  1474. .replace(/[\\]/g, '_backslash')
  1475. .replace(/[\~]/g, '_tild')
  1476. .replace(/%/g, '_percent')
  1477. .replace(/>/g, '_gt')
  1478. .replace(/</g, '_lt')
  1479. .replace(/=/g, '_eq')
  1480. .replace(/,/g, '_comma')
  1481. .replace(/[@]/g, '_at');
  1482. };
  1483. /* Convert a string to a valid smalltalk selector.
  1484. if you modify the following functions, also change st2js
  1485. accordingly */
  1486. st.js2st = function (selector) {
  1487. if (selector.match(/^__/)) {
  1488. return binaryJsToSt(selector);
  1489. } else {
  1490. return keywordJsToSt(selector);
  1491. }
  1492. };
  1493. function keywordJsToSt (selector) {
  1494. return selector.replace(/^_/, '').replace(/_/g, ':');
  1495. }
  1496. function binaryJsToSt (selector) {
  1497. return selector
  1498. .replace(/^_/, '')
  1499. .replace(/_and/g, '&')
  1500. .replace(/_or/g, '|')
  1501. .replace(/_plus/g, '+')
  1502. .replace(/_minus/g, '-')
  1503. .replace(/_star/g, '*')
  1504. .replace(/_slash/g, '/')
  1505. .replace(/_backslash/g, '\\')
  1506. .replace(/_tild/g, '~')
  1507. .replace(/_percent/g, '%')
  1508. .replace(/_gt/g, '>')
  1509. .replace(/_lt/g, '<')
  1510. .replace(/_eq/g, '=')
  1511. .replace(/_comma/g, ',')
  1512. .replace(/_at/g, '@');
  1513. }
  1514. st.st2prop = function (stSelector) {
  1515. var colonPosition = stSelector.indexOf(':');
  1516. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1517. };
  1518. }
  1519. /* Making smalltalk that has basic building blocks */
  1520. function configureWithFundamentals (brikz) {
  1521. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1522. brikz.root = RootBrik;
  1523. brikz.arraySet = ArraySetBrik;
  1524. brikz.organize = OrganizeBrik;
  1525. brikz.selectorConversion = SelectorConversionBrik;
  1526. brikz.selectors = SelectorsBrik;
  1527. brikz.packages = PackagesBrik;
  1528. brikz.composition = MethodCompositionBrik;
  1529. brikz.behaviors = BehaviorsBrik;
  1530. brikz.methods = MethodsBrik;
  1531. brikz.rebuild();
  1532. }
  1533. return configureWithFundamentals;
  1534. });
  1535. /* ====================================================================
  1536. |
  1537. | Amber Smalltalk
  1538. | http://amber-lang.net
  1539. |
  1540. ======================================================================
  1541. ======================================================================
  1542. |
  1543. | Copyright (c) 2010-2014
  1544. | Nicolas Petton <petton.nicolas@gmail.com>
  1545. |
  1546. | Copyright (c) 2012-2016
  1547. | The Amber team https://lolg.it/org/amber/members
  1548. | Amber contributors (see /CONTRIBUTORS)
  1549. |
  1550. | Amber is released under the MIT license
  1551. |
  1552. | Permission is hereby granted, free of charge, to any person obtaining
  1553. | a copy of this software and associated documentation files (the
  1554. | 'Software'), to deal in the Software without restriction, including
  1555. | without limitation the rights to use, copy, modify, merge, publish,
  1556. | distribute, sublicense, and/or sell copies of the Software, and to
  1557. | permit persons to whom the Software is furnished to do so, subject to
  1558. | the following conditions:
  1559. |
  1560. | The above copyright notice and this permission notice shall be
  1561. | included in all copies or substantial portions of the Software.
  1562. |
  1563. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1564. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1565. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1566. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1567. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1568. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1569. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1570. |
  1571. ==================================================================== */
  1572. //jshint eqnull:true
  1573. define('amber/kernel-language',['./compatibility'], function () {
  1574. "use strict";
  1575. function inherits (child, parent) {
  1576. child.prototype = Object.create(parent.prototype, {
  1577. constructor: {
  1578. value: child,
  1579. enumerable: false, configurable: true, writable: true
  1580. }
  1581. });
  1582. return child;
  1583. }
  1584. function defineMethod (klass, name, method) {
  1585. Object.defineProperty(klass.prototype, name, {
  1586. value: method,
  1587. enumerable: false, configurable: true, writable: true
  1588. });
  1589. }
  1590. TraitsBrik.deps = ["behaviors", "composition", "arraySet", "root"];
  1591. function TraitsBrik (brikz, st) {
  1592. var coreFns = brikz.root.coreFns;
  1593. var SmalltalkBehaviorBody = brikz.behaviors.BehaviorBody;
  1594. var setupMethods = brikz.composition.setupMethods;
  1595. var traitMethodChanged = brikz.composition.traitMethodChanged;
  1596. var buildBehaviorBody = brikz.behaviors.buildBehaviorBody;
  1597. var addElement = brikz.arraySet.addElement;
  1598. var removeElement = brikz.arraySet.removeElement;
  1599. function SmalltalkTrait () {
  1600. }
  1601. coreFns.Trait = inherits(SmalltalkTrait, SmalltalkBehaviorBody);
  1602. SmalltalkTrait.prototype.trait = true;
  1603. defineMethod(SmalltalkTrait, "toString", function () {
  1604. return 'Smalltalk Trait ' + this.className;
  1605. });
  1606. defineMethod(SmalltalkTrait, "added", function () {
  1607. if (st._traitAdded) st._traitAdded(this);
  1608. });
  1609. defineMethod(SmalltalkTrait, "removed", function () {
  1610. if (st._traitRemoved) st._traitRemoved(this);
  1611. });
  1612. defineMethod(SmalltalkTrait, "methodAdded", function (method) {
  1613. var self = this;
  1614. this.traitUsers.forEach(function (each) {
  1615. traitMethodChanged(method.selector, method, self, each);
  1616. });
  1617. if (st._traitMethodAdded) st._traitMethodAdded(method, this);
  1618. });
  1619. defineMethod(SmalltalkTrait, "methodRemoved", function (method) {
  1620. var self = this;
  1621. this.traitUsers.forEach(function (each) {
  1622. traitMethodChanged(method.selector, null, self, each);
  1623. });
  1624. if (st._traitMethodRemoved) st._traitMethodRemoved(method, this);
  1625. });
  1626. defineMethod(SmalltalkTrait, "addUser", function (behaviorBody) {
  1627. addElement(this.traitUsers, behaviorBody);
  1628. });
  1629. defineMethod(SmalltalkTrait, "removeUser", function (behaviorBody) {
  1630. removeElement(this.traitUsers, behaviorBody);
  1631. });
  1632. function traitBuilder (className) {
  1633. return {
  1634. className: className,
  1635. make: function (pkg) {
  1636. var that = new SmalltalkTrait();
  1637. that.className = className;
  1638. that.pkg = pkg;
  1639. that.traitUsers = [];
  1640. setupMethods(that);
  1641. return that;
  1642. },
  1643. updateExisting: function (trait, pkg) {
  1644. if (pkg) trait.pkg = pkg;
  1645. }
  1646. };
  1647. }
  1648. st.addTrait = function (className, pkgName) {
  1649. return buildBehaviorBody(pkgName, traitBuilder(className));
  1650. };
  1651. }
  1652. ClassesBrik.deps = ["root", "behaviors", "composition", "arraySet", "smalltalkGlobals"];
  1653. function ClassesBrik (brikz, st) {
  1654. var SmalltalkRoot = brikz.root.Root;
  1655. var coreFns = brikz.root.coreFns;
  1656. var globals = brikz.smalltalkGlobals.globals;
  1657. var SmalltalkBehaviorBody = brikz.behaviors.BehaviorBody;
  1658. var buildBehaviorBody = brikz.behaviors.buildBehaviorBody;
  1659. var setupMethods = brikz.composition.setupMethods;
  1660. var removeBehaviorBody = brikz.behaviors.removeBehaviorBody;
  1661. var addElement = brikz.arraySet.addElement;
  1662. var removeElement = brikz.arraySet.removeElement;
  1663. function SmalltalkBehavior () {
  1664. }
  1665. function SmalltalkClass () {
  1666. }
  1667. function SmalltalkMetaclass () {
  1668. }
  1669. coreFns.Behavior = inherits(SmalltalkBehavior, SmalltalkBehaviorBody);
  1670. coreFns.Class = inherits(SmalltalkClass, SmalltalkBehavior);
  1671. coreFns.Metaclass = inherits(SmalltalkMetaclass, SmalltalkBehavior);
  1672. // Fake root class of the system.
  1673. // Effective superclass of all classes created with `nil subclass: ...`.
  1674. var nilAsClass = this.nilAsClass = {fn: SmalltalkRoot, klass: {fn: SmalltalkClass}};
  1675. SmalltalkMetaclass.prototype.meta = true;
  1676. defineMethod(SmalltalkClass, "toString", function () {
  1677. return 'Smalltalk ' + this.className;
  1678. });
  1679. defineMethod(SmalltalkMetaclass, "toString", function () {
  1680. return 'Smalltalk Metaclass ' + this.instanceClass.className;
  1681. });
  1682. defineMethod(SmalltalkClass, "added", function () {
  1683. addSubclass(this);
  1684. if (st._classAdded) st._classAdded(this);
  1685. });
  1686. defineMethod(SmalltalkClass, "removed", function () {
  1687. if (st._classRemoved) st._classRemoved(this);
  1688. removeSubclass(this);
  1689. });
  1690. defineMethod(SmalltalkBehavior, "methodAdded", function (method) {
  1691. if (st._methodAdded) st._methodAdded(method, this);
  1692. });
  1693. defineMethod(SmalltalkBehavior, "methodRemoved", function (method) {
  1694. if (st._methodRemoved) st._methodRemoved(method, this);
  1695. });
  1696. this.bootstrapHierarchy = function () {
  1697. var nilSubclasses = [globals.ProtoObject];
  1698. nilAsClass.klass = globals.Class;
  1699. nilSubclasses.forEach(function (each) {
  1700. each.klass.superclass = globals.Class;
  1701. addSubclass(each.klass);
  1702. });
  1703. };
  1704. /* Smalltalk class creation. A class is an instance of an automatically
  1705. created metaclass object. Newly created classes (not their metaclass)
  1706. should be added to the system, see smalltalk.addClass().
  1707. Superclass linking is *not* handled here, see api.initialize() */
  1708. function classBuilder (className, superclass, iVarNames, fn) {
  1709. var logicalSuperclass = superclass;
  1710. if (superclass == null || superclass.isNil) {
  1711. superclass = nilAsClass;
  1712. logicalSuperclass = null;
  1713. }
  1714. function klass (pkg) {
  1715. var that = metaclass().instanceClass;
  1716. that.superclass = logicalSuperclass;
  1717. that.fn = fn || inherits(function () {
  1718. }, superclass.fn);
  1719. that.iVarNames = iVarNames || [];
  1720. that.className = className;
  1721. that.pkg = pkg;
  1722. that.subclasses = [];
  1723. setupMethods(that);
  1724. return that;
  1725. }
  1726. function metaclass () {
  1727. var that = new SmalltalkMetaclass();
  1728. that.superclass = superclass.klass;
  1729. that.fn = inherits(function () {
  1730. }, that.superclass.fn);
  1731. that.iVarNames = [];
  1732. that.instanceClass = new that.fn();
  1733. wireKlass(that);
  1734. setupMethods(that);
  1735. return that;
  1736. }
  1737. return {
  1738. className: className,
  1739. make: klass,
  1740. updateExisting: function (klass, pkg) {
  1741. if (klass.superclass == logicalSuperclass && (!fn || fn === klass.fn)) {
  1742. if (iVarNames) klass.iVarNames = iVarNames;
  1743. if (pkg) klass.pkg = pkg;
  1744. } else throw new Error("Incompatible change of class: " + klass.className);
  1745. }
  1746. };
  1747. }
  1748. function wireKlass (klass) {
  1749. Object.defineProperty(klass.fn.prototype, "klass", {
  1750. value: klass,
  1751. enumerable: false, configurable: true, writable: true
  1752. });
  1753. }
  1754. this.wireKlass = wireKlass;
  1755. /* Add a class to the system, creating a new one if needed.
  1756. A Package is lazily created if one with given name does not exist. */
  1757. st.addClass = function (className, superclass, iVarNames, pkgName) {
  1758. // While subclassing nil is allowed, it might be an error, so
  1759. // warn about it.
  1760. if (typeof superclass == 'undefined' || superclass && superclass.isNil) {
  1761. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  1762. }
  1763. return buildBehaviorBody(pkgName, classBuilder(className, superclass, iVarNames, coreFns[className]));
  1764. };
  1765. st.removeClass = removeBehaviorBody;
  1766. function addSubclass (klass) {
  1767. if (klass.superclass) {
  1768. addElement(klass.superclass.subclasses, klass);
  1769. }
  1770. }
  1771. function removeSubclass (klass) {
  1772. if (klass.superclass) {
  1773. removeElement(klass.superclass.subclasses, klass);
  1774. }
  1775. }
  1776. function metaSubclasses (metaclass) {
  1777. return metaclass.instanceClass.subclasses
  1778. .filter(function (each) {
  1779. return !each.meta;
  1780. })
  1781. .map(function (each) {
  1782. return each.klass;
  1783. });
  1784. }
  1785. st.metaSubclasses = metaSubclasses;
  1786. st.traverseClassTree = function (klass, fn) {
  1787. var queue = [klass], sentinel = {};
  1788. for (var i = 0; i < queue.length; ++i) {
  1789. var item = queue[i];
  1790. if (fn(item, sentinel) === sentinel) continue;
  1791. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  1792. queue.push.apply(queue, subclasses);
  1793. }
  1794. };
  1795. }
  1796. NilBrik.deps = ["root"];
  1797. function NilBrik (brikz, st) {
  1798. var SmalltalkObject = brikz.root.Object;
  1799. var coreFns = brikz.root.coreFns;
  1800. function SmalltalkNil () {
  1801. }
  1802. coreFns.UndefinedObject = inherits(SmalltalkNil, SmalltalkObject);
  1803. this.nilAsReceiver = new SmalltalkNil();
  1804. // Adds an `isNil` property to the `nil` object. When sending
  1805. // nil objects from one environment to another, doing
  1806. // `anObject == nil` (in JavaScript) does not always answer
  1807. // true as the referenced nil object might come from the other
  1808. // environment.
  1809. Object.defineProperty(this.nilAsReceiver, 'isNil', {
  1810. value: true,
  1811. enumerable: false, configurable: false, writable: false
  1812. });
  1813. }
  1814. /* Defines asReceiver to be present at load time */
  1815. /* (logically it belongs more to PrimitiveBrik) */
  1816. AsReceiverBrik.deps = ["nil"];
  1817. function AsReceiverBrik (brikz, st) {
  1818. var nilAsReceiver = brikz.nil.nilAsReceiver;
  1819. /**
  1820. * This function is used all over the compiled amber code.
  1821. * It takes any value (JavaScript or Smalltalk)
  1822. * and returns a proper Amber Smalltalk receiver.
  1823. *
  1824. * null or undefined -> nilAsReceiver,
  1825. * object having Smalltalk signature -> unchanged,
  1826. * otherwise wrapped foreign (JS) object
  1827. */
  1828. this.asReceiver = function (o) {
  1829. if (o == null) return nilAsReceiver;
  1830. else if (o.klass != null) return o;
  1831. else return st.wrapJavaScript(o);
  1832. };
  1833. }
  1834. /* Making smalltalk that can load */
  1835. function configureWithHierarchy (brikz) {
  1836. brikz.traits = TraitsBrik;
  1837. brikz.classes = ClassesBrik;
  1838. brikz.nil = NilBrik;
  1839. brikz.asReceiver = AsReceiverBrik;
  1840. brikz.rebuild();
  1841. }
  1842. return configureWithHierarchy;
  1843. });
  1844. /* ====================================================================
  1845. |
  1846. | Amber Smalltalk
  1847. | http://amber-lang.net
  1848. |
  1849. ======================================================================
  1850. ======================================================================
  1851. |
  1852. | Copyright (c) 2010-2014
  1853. | Nicolas Petton <petton.nicolas@gmail.com>
  1854. |
  1855. | Copyright (c) 2012-2016
  1856. | The Amber team https://lolg.it/org/amber/members
  1857. | Amber contributors (see /CONTRIBUTORS)
  1858. |
  1859. | Amber is released under the MIT license
  1860. |
  1861. | Permission is hereby granted, free of charge, to any person obtaining
  1862. | a copy of this software and associated documentation files (the
  1863. | 'Software'), to deal in the Software without restriction, including
  1864. | without limitation the rights to use, copy, modify, merge, publish,
  1865. | distribute, sublicense, and/or sell copies of the Software, and to
  1866. | permit persons to whom the Software is furnished to do so, subject to
  1867. | the following conditions:
  1868. |
  1869. | The above copyright notice and this permission notice shall be
  1870. | included in all copies or substantial portions of the Software.
  1871. |
  1872. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1873. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1874. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1875. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1876. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1877. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1878. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1879. |
  1880. ==================================================================== */
  1881. //jshint eqnull:true
  1882. define('amber/boot',[
  1883. 'require', './brikz', './kernel-fundamentals', './kernel-language', './compatibility'
  1884. ], function (require, Brikz, configureWithFundamentals, configureWithHierarchy) {
  1885. "use strict";
  1886. require(['./kernel-runtime']); // preload
  1887. SmalltalkInitBrik.deps = ["classes"];
  1888. function SmalltalkInitBrik (brikz, st) {
  1889. var bootstrapHierarchy = brikz.classes.bootstrapHierarchy;
  1890. var initialized = false;
  1891. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  1892. require(['./kernel-runtime'], resolve, reject);
  1893. });
  1894. /* Smalltalk initialization. Called on page load */
  1895. st.initialize = function () {
  1896. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  1897. if (initialized) return;
  1898. bootstrapHierarchy();
  1899. configureWithRuntime(brikz);
  1900. initialized = true;
  1901. });
  1902. };
  1903. }
  1904. /* Adds AMD and requirejs related methods to the api */
  1905. function AMDBrik (brikz, st) {
  1906. st.amdRequire = require;
  1907. st.defaultTransportType = st.defaultTransportType || "amd";
  1908. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  1909. }
  1910. var api = {};
  1911. var brikz = new Brikz(api);
  1912. configureWithFundamentals(brikz);
  1913. configureWithHierarchy(brikz);
  1914. brikz.stInit = SmalltalkInitBrik;
  1915. brikz.amd = AMDBrik;
  1916. brikz.rebuild();
  1917. return {
  1918. api: api,
  1919. nil/* TODO deprecate */: brikz.nil.nilAsReceiver,
  1920. nilAsReceiver: brikz.nil.nilAsReceiver,
  1921. dnu/* TODO deprecate */: brikz.classes.nilAsClass,
  1922. nilAsClass: brikz.classes.nilAsClass,
  1923. globals: brikz.smalltalkGlobals.globals,
  1924. asReceiver: brikz.asReceiver.asReceiver
  1925. };
  1926. });
  1927. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  1928. var globals = boot.globals,
  1929. exports = {},
  1930. api = boot.api,
  1931. nil = boot.nilAsReceiver;
  1932. // API
  1933. exports.popupHelios = function () {
  1934. require(['helios/index'], function (helios) {
  1935. helios.popup();
  1936. }, function (err) {
  1937. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  1938. });
  1939. };
  1940. Object.defineProperty(exports, "api", {
  1941. value: api,
  1942. enumerable: true, configurable: true, writable: false
  1943. });
  1944. Object.defineProperty(exports, "globals", {
  1945. value: globals,
  1946. enumerable: true, configurable: true, writable: false
  1947. });
  1948. Object.defineProperty(exports, "nil", {
  1949. value: nil,
  1950. enumerable: true, configurable: true, writable: false
  1951. });
  1952. function mixinToSettings (source) {
  1953. var settings = globals.SmalltalkSettings;
  1954. Object.keys(source).forEach(function (key) {
  1955. settings[key] = source[key];
  1956. });
  1957. }
  1958. function settingsInLocalStorage () {
  1959. //jshint evil:true
  1960. var global = new Function('return this')(),
  1961. storage = 'localStorage' in global && global.localStorage;
  1962. if (storage) {
  1963. var fromStorage;
  1964. try {
  1965. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  1966. } catch (ex) {
  1967. // pass
  1968. }
  1969. mixinToSettings(fromStorage || {});
  1970. if (typeof window !== "undefined") {
  1971. requirejs(['jquery'], function ($) {
  1972. $(window).on('beforeunload', function () {
  1973. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  1974. });
  1975. });
  1976. }
  1977. }
  1978. }
  1979. exports.initialize = function (options) {
  1980. return Promise.resolve()
  1981. .then(function () {
  1982. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  1983. })
  1984. .then(settingsInLocalStorage)
  1985. .then(function () {
  1986. return options || {};
  1987. })
  1988. .then(mixinToSettings)
  1989. .then(function () {
  1990. return api.initialize();
  1991. });
  1992. };
  1993. // Exports
  1994. return exports;
  1995. });
  1996. define('amber_core/Kernel-Objects',["amber/boot"], function($boot){"use strict";
  1997. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  1998. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  1999. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  2000. $core.addPackage("Kernel-Objects");
  2001. $core.packages["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  2002. $core.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2003. $core.addClass("ProtoObject", null, [], "Kernel-Objects");
  2004. $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.";
  2005. $core.addMethod(
  2006. $core.method({
  2007. selector: "=",
  2008. protocol: "comparing",
  2009. fn: function (anObject){
  2010. var self=this;
  2011. return $core.withContext(function($ctx1) {
  2012. return self.__eq_eq(anObject);
  2013. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  2014. },
  2015. args: ["anObject"],
  2016. source: "= anObject\x0a\x09^ self == anObject",
  2017. referencedClasses: [],
  2018. messageSends: ["=="]
  2019. }),
  2020. $globals.ProtoObject);
  2021. $core.addMethod(
  2022. $core.method({
  2023. selector: "==",
  2024. protocol: "comparing",
  2025. fn: function (anObject){
  2026. var self=this;
  2027. return $core.withContext(function($ctx1) {
  2028. return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject);
  2029. return self;
  2030. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  2031. },
  2032. args: ["anObject"],
  2033. source: "== anObject\x0a<inlineJS:\x0a\x09'return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject)'>",
  2034. referencedClasses: [],
  2035. messageSends: []
  2036. }),
  2037. $globals.ProtoObject);
  2038. $core.addMethod(
  2039. $core.method({
  2040. selector: "asJSON",
  2041. protocol: "converting",
  2042. fn: function (){
  2043. var self=this;
  2044. return $core.withContext(function($ctx1) {
  2045. self._deprecatedAPI_("Use #asJavaScriptObject instead.");
  2046. return self._asJavaScriptObject();
  2047. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.ProtoObject)});
  2048. },
  2049. args: [],
  2050. source: "asJSON\x0a\x09self deprecatedAPI: 'Use #asJavaScriptObject instead.'.\x0a\x09^ self asJavaScriptObject",
  2051. referencedClasses: [],
  2052. messageSends: ["deprecatedAPI:", "asJavaScriptObject"]
  2053. }),
  2054. $globals.ProtoObject);
  2055. $core.addMethod(
  2056. $core.method({
  2057. selector: "asJavascript",
  2058. protocol: "converting",
  2059. fn: function (){
  2060. var self=this;
  2061. return $core.withContext(function($ctx1) {
  2062. self._deprecatedAPI_("Use #asJavaScriptSource instead.");
  2063. return self._asJavaScriptSource();
  2064. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.ProtoObject)});
  2065. },
  2066. args: [],
  2067. source: "asJavascript\x0a\x09self deprecatedAPI: 'Use #asJavaScriptSource instead.'.\x0a\x09^ self asJavaScriptSource",
  2068. referencedClasses: [],
  2069. messageSends: ["deprecatedAPI:", "asJavaScriptSource"]
  2070. }),
  2071. $globals.ProtoObject);
  2072. $core.addMethod(
  2073. $core.method({
  2074. selector: "asString",
  2075. protocol: "converting",
  2076. fn: function (){
  2077. var self=this;
  2078. return $core.withContext(function($ctx1) {
  2079. return self._printString();
  2080. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  2081. },
  2082. args: [],
  2083. source: "asString\x0a\x09^ self printString",
  2084. referencedClasses: [],
  2085. messageSends: ["printString"]
  2086. }),
  2087. $globals.ProtoObject);
  2088. $core.addMethod(
  2089. $core.method({
  2090. selector: "class",
  2091. protocol: "accessing",
  2092. fn: function (){
  2093. var self=this;
  2094. return $core.withContext(function($ctx1) {
  2095. return self.klass;
  2096. return self;
  2097. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  2098. },
  2099. args: [],
  2100. source: "class\x0a\x09<inlineJS: 'return self.klass'>",
  2101. referencedClasses: [],
  2102. messageSends: []
  2103. }),
  2104. $globals.ProtoObject);
  2105. $core.addMethod(
  2106. $core.method({
  2107. selector: "doesNotUnderstand:",
  2108. protocol: "error handling",
  2109. fn: function (aMessage){
  2110. var self=this;
  2111. return $core.withContext(function($ctx1) {
  2112. var $1;
  2113. $1=$recv($globals.MessageNotUnderstood)._new();
  2114. $recv($1)._receiver_(self);
  2115. $recv($1)._message_(aMessage);
  2116. $recv($1)._signal();
  2117. return self;
  2118. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  2119. },
  2120. args: ["aMessage"],
  2121. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  2122. referencedClasses: ["MessageNotUnderstood"],
  2123. messageSends: ["receiver:", "new", "message:", "signal"]
  2124. }),
  2125. $globals.ProtoObject);
  2126. $core.addMethod(
  2127. $core.method({
  2128. selector: "evaluate:on:",
  2129. protocol: "evaluating",
  2130. fn: function (aString,anEvaluator){
  2131. var self=this;
  2132. return $core.withContext(function($ctx1) {
  2133. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  2134. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  2135. },
  2136. args: ["aString", "anEvaluator"],
  2137. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  2138. referencedClasses: [],
  2139. messageSends: ["evaluate:receiver:"]
  2140. }),
  2141. $globals.ProtoObject);
  2142. $core.addMethod(
  2143. $core.method({
  2144. selector: "identityHash",
  2145. protocol: "accessing",
  2146. fn: function (){
  2147. var self=this;
  2148. return $core.withContext(function($ctx1) {
  2149. var hash=self.identityHash;
  2150. if (hash) return hash;
  2151. hash=$core.nextId();
  2152. Object.defineProperty(self, 'identityHash', {value:hash});
  2153. return hash;
  2154. ;
  2155. return self;
  2156. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  2157. },
  2158. args: [],
  2159. source: "identityHash\x0a\x09<inlineJS: '\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'>",
  2160. referencedClasses: [],
  2161. messageSends: []
  2162. }),
  2163. $globals.ProtoObject);
  2164. $core.addMethod(
  2165. $core.method({
  2166. selector: "ifNil:",
  2167. protocol: "testing",
  2168. fn: function (aBlock){
  2169. var self=this;
  2170. return self;
  2171. },
  2172. args: ["aBlock"],
  2173. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2174. referencedClasses: [],
  2175. messageSends: []
  2176. }),
  2177. $globals.ProtoObject);
  2178. $core.addMethod(
  2179. $core.method({
  2180. selector: "ifNil:ifNotNil:",
  2181. protocol: "testing",
  2182. fn: function (aBlock,anotherBlock){
  2183. var self=this;
  2184. return $core.withContext(function($ctx1) {
  2185. return $recv(anotherBlock)._value_(self);
  2186. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2187. },
  2188. args: ["aBlock", "anotherBlock"],
  2189. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2190. referencedClasses: [],
  2191. messageSends: ["value:"]
  2192. }),
  2193. $globals.ProtoObject);
  2194. $core.addMethod(
  2195. $core.method({
  2196. selector: "ifNotNil:",
  2197. protocol: "testing",
  2198. fn: function (aBlock){
  2199. var self=this;
  2200. return $core.withContext(function($ctx1) {
  2201. return $recv(aBlock)._value_(self);
  2202. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  2203. },
  2204. args: ["aBlock"],
  2205. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2206. referencedClasses: [],
  2207. messageSends: ["value:"]
  2208. }),
  2209. $globals.ProtoObject);
  2210. $core.addMethod(
  2211. $core.method({
  2212. selector: "ifNotNil:ifNil:",
  2213. protocol: "testing",
  2214. fn: function (aBlock,anotherBlock){
  2215. var self=this;
  2216. return $core.withContext(function($ctx1) {
  2217. return $recv(aBlock)._value_(self);
  2218. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2219. },
  2220. args: ["aBlock", "anotherBlock"],
  2221. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2222. referencedClasses: [],
  2223. messageSends: ["value:"]
  2224. }),
  2225. $globals.ProtoObject);
  2226. $core.addMethod(
  2227. $core.method({
  2228. selector: "initialize",
  2229. protocol: "initialization",
  2230. fn: function (){
  2231. var self=this;
  2232. return self;
  2233. },
  2234. args: [],
  2235. source: "initialize",
  2236. referencedClasses: [],
  2237. messageSends: []
  2238. }),
  2239. $globals.ProtoObject);
  2240. $core.addMethod(
  2241. $core.method({
  2242. selector: "inspect",
  2243. protocol: "inspecting",
  2244. fn: function (){
  2245. var self=this;
  2246. return $core.withContext(function($ctx1) {
  2247. $recv($globals.Inspector)._inspect_(self);
  2248. return self;
  2249. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  2250. },
  2251. args: [],
  2252. source: "inspect\x0a\x09Inspector inspect: self",
  2253. referencedClasses: ["Inspector"],
  2254. messageSends: ["inspect:"]
  2255. }),
  2256. $globals.ProtoObject);
  2257. $core.addMethod(
  2258. $core.method({
  2259. selector: "inspectOn:",
  2260. protocol: "inspecting",
  2261. fn: function (anInspector){
  2262. var self=this;
  2263. return self;
  2264. },
  2265. args: ["anInspector"],
  2266. source: "inspectOn: anInspector",
  2267. referencedClasses: [],
  2268. messageSends: []
  2269. }),
  2270. $globals.ProtoObject);
  2271. $core.addMethod(
  2272. $core.method({
  2273. selector: "instVarAt:",
  2274. protocol: "accessing",
  2275. fn: function (aString){
  2276. var self=this;
  2277. return $core.withContext(function($ctx1) {
  2278. return self['@'+aString];
  2279. return self;
  2280. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  2281. },
  2282. args: ["aString"],
  2283. source: "instVarAt: aString\x0a\x09<inlineJS: 'return self[''@''+aString]'>",
  2284. referencedClasses: [],
  2285. messageSends: []
  2286. }),
  2287. $globals.ProtoObject);
  2288. $core.addMethod(
  2289. $core.method({
  2290. selector: "instVarAt:put:",
  2291. protocol: "accessing",
  2292. fn: function (aString,anObject){
  2293. var self=this;
  2294. return $core.withContext(function($ctx1) {
  2295. self['@' + aString] = anObject;
  2296. return self;
  2297. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  2298. },
  2299. args: ["aString", "anObject"],
  2300. source: "instVarAt: aString put: anObject\x0a\x09<inlineJS: 'self[''@'' + aString] = anObject'>",
  2301. referencedClasses: [],
  2302. messageSends: []
  2303. }),
  2304. $globals.ProtoObject);
  2305. $core.addMethod(
  2306. $core.method({
  2307. selector: "isKindOf:",
  2308. protocol: "testing",
  2309. fn: function (aClass){
  2310. var self=this;
  2311. return $core.withContext(function($ctx1) {
  2312. var $1;
  2313. $1=self._isMemberOf_(aClass);
  2314. if($core.assert($1)){
  2315. return true;
  2316. } else {
  2317. return $recv(self._class())._inheritsFrom_(aClass);
  2318. }
  2319. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  2320. },
  2321. args: ["aClass"],
  2322. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  2323. referencedClasses: [],
  2324. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  2325. }),
  2326. $globals.ProtoObject);
  2327. $core.addMethod(
  2328. $core.method({
  2329. selector: "isNil",
  2330. protocol: "testing",
  2331. fn: function (){
  2332. var self=this;
  2333. return false;
  2334. },
  2335. args: [],
  2336. source: "isNil\x0a\x09^ false",
  2337. referencedClasses: [],
  2338. messageSends: []
  2339. }),
  2340. $globals.ProtoObject);
  2341. $core.addMethod(
  2342. $core.method({
  2343. selector: "isSameInstanceAs:",
  2344. protocol: "comparing",
  2345. fn: function (anObject){
  2346. var self=this;
  2347. return $core.withContext(function($ctx1) {
  2348. var $1;
  2349. $1=self._identityHash();
  2350. $ctx1.sendIdx["identityHash"]=1;
  2351. return $recv($1).__eq($recv(anObject)._identityHash());
  2352. }, function($ctx1) {$ctx1.fill(self,"isSameInstanceAs:",{anObject:anObject},$globals.ProtoObject)});
  2353. },
  2354. args: ["anObject"],
  2355. source: "isSameInstanceAs: anObject\x0a\x09^ self identityHash = anObject identityHash",
  2356. referencedClasses: [],
  2357. messageSends: ["=", "identityHash"]
  2358. }),
  2359. $globals.ProtoObject);
  2360. $core.addMethod(
  2361. $core.method({
  2362. selector: "notNil",
  2363. protocol: "testing",
  2364. fn: function (){
  2365. var self=this;
  2366. return $core.withContext(function($ctx1) {
  2367. return $recv(self._isNil())._not();
  2368. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  2369. },
  2370. args: [],
  2371. source: "notNil\x0a\x09^ self isNil not",
  2372. referencedClasses: [],
  2373. messageSends: ["not", "isNil"]
  2374. }),
  2375. $globals.ProtoObject);
  2376. $core.addMethod(
  2377. $core.method({
  2378. selector: "perform:",
  2379. protocol: "message handling",
  2380. fn: function (aString){
  2381. var self=this;
  2382. return $core.withContext(function($ctx1) {
  2383. return self._perform_withArguments_(aString,[]);
  2384. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  2385. },
  2386. args: ["aString"],
  2387. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  2388. referencedClasses: [],
  2389. messageSends: ["perform:withArguments:"]
  2390. }),
  2391. $globals.ProtoObject);
  2392. $core.addMethod(
  2393. $core.method({
  2394. selector: "perform:withArguments:",
  2395. protocol: "message handling",
  2396. fn: function (aString,aCollection){
  2397. var self=this;
  2398. return $core.withContext(function($ctx1) {
  2399. return $core.send2(self, aString, aCollection);
  2400. return self;
  2401. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  2402. },
  2403. args: ["aString", "aCollection"],
  2404. source: "perform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return $core.send2(self, aString, aCollection)'>",
  2405. referencedClasses: [],
  2406. messageSends: []
  2407. }),
  2408. $globals.ProtoObject);
  2409. $core.addMethod(
  2410. $core.method({
  2411. selector: "printOn:",
  2412. protocol: "printing",
  2413. fn: function (aStream){
  2414. var self=this;
  2415. return $core.withContext(function($ctx1) {
  2416. var $5,$4,$3,$2,$1;
  2417. $5=self._class();
  2418. $ctx1.sendIdx["class"]=1;
  2419. $4=$recv($5)._name();
  2420. $ctx1.sendIdx["name"]=1;
  2421. $3=$recv($4)._first();
  2422. $2=$recv($3)._isVowel();
  2423. if($core.assert($2)){
  2424. $1="an ";
  2425. } else {
  2426. $1="a ";
  2427. }
  2428. $recv(aStream)._nextPutAll_($1);
  2429. $ctx1.sendIdx["nextPutAll:"]=1;
  2430. $recv(aStream)._nextPutAll_($recv(self._class())._name());
  2431. return self;
  2432. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  2433. },
  2434. args: ["aStream"],
  2435. 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",
  2436. referencedClasses: [],
  2437. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  2438. }),
  2439. $globals.ProtoObject);
  2440. $core.addMethod(
  2441. $core.method({
  2442. selector: "printString",
  2443. protocol: "printing",
  2444. fn: function (){
  2445. var self=this;
  2446. return $core.withContext(function($ctx1) {
  2447. return $recv($globals.String)._streamContents_((function(str){
  2448. return $core.withContext(function($ctx2) {
  2449. return self._printOn_(str);
  2450. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  2451. }));
  2452. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  2453. },
  2454. args: [],
  2455. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  2456. referencedClasses: ["String"],
  2457. messageSends: ["streamContents:", "printOn:"]
  2458. }),
  2459. $globals.ProtoObject);
  2460. $core.addMethod(
  2461. $core.method({
  2462. selector: "yourself",
  2463. protocol: "accessing",
  2464. fn: function (){
  2465. var self=this;
  2466. return self;
  2467. },
  2468. args: [],
  2469. source: "yourself\x0a\x09^ self",
  2470. referencedClasses: [],
  2471. messageSends: []
  2472. }),
  2473. $globals.ProtoObject);
  2474. $core.addMethod(
  2475. $core.method({
  2476. selector: "~=",
  2477. protocol: "comparing",
  2478. fn: function (anObject){
  2479. var self=this;
  2480. return $core.withContext(function($ctx1) {
  2481. var $1;
  2482. $1=$recv(self.__eq(anObject)).__eq(false);
  2483. $ctx1.sendIdx["="]=1;
  2484. return $1;
  2485. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  2486. },
  2487. args: ["anObject"],
  2488. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  2489. referencedClasses: [],
  2490. messageSends: ["="]
  2491. }),
  2492. $globals.ProtoObject);
  2493. $core.addMethod(
  2494. $core.method({
  2495. selector: "~~",
  2496. protocol: "comparing",
  2497. fn: function (anObject){
  2498. var self=this;
  2499. return $core.withContext(function($ctx1) {
  2500. return $recv(self.__eq_eq(anObject)).__eq(false);
  2501. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  2502. },
  2503. args: ["anObject"],
  2504. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  2505. referencedClasses: [],
  2506. messageSends: ["=", "=="]
  2507. }),
  2508. $globals.ProtoObject);
  2509. $core.addMethod(
  2510. $core.method({
  2511. selector: "initialize",
  2512. protocol: "initialization",
  2513. fn: function (){
  2514. var self=this;
  2515. return self;
  2516. },
  2517. args: [],
  2518. source: "initialize",
  2519. referencedClasses: [],
  2520. messageSends: []
  2521. }),
  2522. $globals.ProtoObject.klass);
  2523. $core.addClass("Object", $globals.ProtoObject, [], "Kernel-Objects");
  2524. $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.";
  2525. $core.addMethod(
  2526. $core.method({
  2527. selector: "->",
  2528. protocol: "converting",
  2529. fn: function (anObject){
  2530. var self=this;
  2531. return $core.withContext(function($ctx1) {
  2532. return $recv($globals.Association)._key_value_(self,anObject);
  2533. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  2534. },
  2535. args: ["anObject"],
  2536. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  2537. referencedClasses: ["Association"],
  2538. messageSends: ["key:value:"]
  2539. }),
  2540. $globals.Object);
  2541. $core.addMethod(
  2542. $core.method({
  2543. selector: "asJSONString",
  2544. protocol: "converting",
  2545. fn: function (){
  2546. var self=this;
  2547. return $core.withContext(function($ctx1) {
  2548. return $recv($globals.JSON)._stringify_(self._asJavaScriptObject());
  2549. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  2550. },
  2551. args: [],
  2552. source: "asJSONString\x0a\x09^ JSON stringify: self asJavaScriptObject",
  2553. referencedClasses: ["JSON"],
  2554. messageSends: ["stringify:", "asJavaScriptObject"]
  2555. }),
  2556. $globals.Object);
  2557. $core.addMethod(
  2558. $core.method({
  2559. selector: "asJavaScriptObject",
  2560. protocol: "converting",
  2561. fn: function (){
  2562. var self=this;
  2563. var variables;
  2564. return $core.withContext(function($ctx1) {
  2565. variables=$recv($globals.HashedCollection)._new();
  2566. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  2567. return $core.withContext(function($ctx2) {
  2568. return $recv(variables)._at_put_(each,$recv(self._instVarAt_(each))._asJavaScriptObject());
  2569. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2570. }));
  2571. return variables;
  2572. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{variables:variables},$globals.Object)});
  2573. },
  2574. args: [],
  2575. 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",
  2576. referencedClasses: ["HashedCollection"],
  2577. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJavaScriptObject", "instVarAt:"]
  2578. }),
  2579. $globals.Object);
  2580. $core.addMethod(
  2581. $core.method({
  2582. selector: "asJavaScriptSource",
  2583. protocol: "converting",
  2584. fn: function (){
  2585. var self=this;
  2586. return $core.withContext(function($ctx1) {
  2587. return self._asString();
  2588. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Object)});
  2589. },
  2590. args: [],
  2591. source: "asJavaScriptSource\x0a\x09^ self asString",
  2592. referencedClasses: [],
  2593. messageSends: ["asString"]
  2594. }),
  2595. $globals.Object);
  2596. $core.addMethod(
  2597. $core.method({
  2598. selector: "basicAt:",
  2599. protocol: "accessing",
  2600. fn: function (aString){
  2601. var self=this;
  2602. return $core.withContext(function($ctx1) {
  2603. return self[aString];
  2604. return self;
  2605. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  2606. },
  2607. args: ["aString"],
  2608. source: "basicAt: aString\x0a\x09<inlineJS: 'return self[aString]'>",
  2609. referencedClasses: [],
  2610. messageSends: []
  2611. }),
  2612. $globals.Object);
  2613. $core.addMethod(
  2614. $core.method({
  2615. selector: "basicAt:put:",
  2616. protocol: "accessing",
  2617. fn: function (aString,anObject){
  2618. var self=this;
  2619. return $core.withContext(function($ctx1) {
  2620. return self[aString] = anObject;
  2621. return self;
  2622. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  2623. },
  2624. args: ["aString", "anObject"],
  2625. source: "basicAt: aString put: anObject\x0a\x09<inlineJS: 'return self[aString] = anObject'>",
  2626. referencedClasses: [],
  2627. messageSends: []
  2628. }),
  2629. $globals.Object);
  2630. $core.addMethod(
  2631. $core.method({
  2632. selector: "basicDelete:",
  2633. protocol: "accessing",
  2634. fn: function (aString){
  2635. var self=this;
  2636. return $core.withContext(function($ctx1) {
  2637. delete self[aString]; return aString;
  2638. return self;
  2639. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  2640. },
  2641. args: ["aString"],
  2642. source: "basicDelete: aString\x0a\x09<inlineJS: 'delete self[aString]; return aString'>",
  2643. referencedClasses: [],
  2644. messageSends: []
  2645. }),
  2646. $globals.Object);
  2647. $core.addMethod(
  2648. $core.method({
  2649. selector: "basicPerform:",
  2650. protocol: "message handling",
  2651. fn: function (aString){
  2652. var self=this;
  2653. return $core.withContext(function($ctx1) {
  2654. return self._basicPerform_withArguments_(aString,[]);
  2655. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  2656. },
  2657. args: ["aString"],
  2658. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  2659. referencedClasses: [],
  2660. messageSends: ["basicPerform:withArguments:"]
  2661. }),
  2662. $globals.Object);
  2663. $core.addMethod(
  2664. $core.method({
  2665. selector: "basicPerform:withArguments:",
  2666. protocol: "message handling",
  2667. fn: function (aString,aCollection){
  2668. var self=this;
  2669. return $core.withContext(function($ctx1) {
  2670. return self[aString].apply(self, aCollection);;
  2671. return self;
  2672. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  2673. },
  2674. args: ["aString", "aCollection"],
  2675. source: "basicPerform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return self[aString].apply(self, aCollection);'>",
  2676. referencedClasses: [],
  2677. messageSends: []
  2678. }),
  2679. $globals.Object);
  2680. $core.addMethod(
  2681. $core.method({
  2682. selector: "browse",
  2683. protocol: "browsing",
  2684. fn: function (){
  2685. var self=this;
  2686. return $core.withContext(function($ctx1) {
  2687. $recv($globals.Finder)._findClass_(self._class());
  2688. return self;
  2689. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  2690. },
  2691. args: [],
  2692. source: "browse\x0a\x09Finder findClass: self class",
  2693. referencedClasses: ["Finder"],
  2694. messageSends: ["findClass:", "class"]
  2695. }),
  2696. $globals.Object);
  2697. $core.addMethod(
  2698. $core.method({
  2699. selector: "copy",
  2700. protocol: "copying",
  2701. fn: function (){
  2702. var self=this;
  2703. return $core.withContext(function($ctx1) {
  2704. return $recv(self._shallowCopy())._postCopy();
  2705. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  2706. },
  2707. args: [],
  2708. source: "copy\x0a\x09^ self shallowCopy postCopy",
  2709. referencedClasses: [],
  2710. messageSends: ["postCopy", "shallowCopy"]
  2711. }),
  2712. $globals.Object);
  2713. $core.addMethod(
  2714. $core.method({
  2715. selector: "deepCopy",
  2716. protocol: "copying",
  2717. fn: function (){
  2718. var self=this;
  2719. return $core.withContext(function($ctx1) {
  2720. var copy = self.klass._new();
  2721. Object.keys(self).forEach(function (i) {
  2722. if(/^@.+/.test(i)) {
  2723. copy[i] = self[i]._deepCopy();
  2724. }
  2725. });
  2726. return copy;
  2727. ;
  2728. return self;
  2729. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  2730. },
  2731. args: [],
  2732. source: "deepCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i]._deepCopy();\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  2733. referencedClasses: [],
  2734. messageSends: []
  2735. }),
  2736. $globals.Object);
  2737. $core.addMethod(
  2738. $core.method({
  2739. selector: "deprecatedAPI",
  2740. protocol: "error handling",
  2741. fn: function (){
  2742. var self=this;
  2743. return $core.withContext(function($ctx1) {
  2744. var $1,$6,$5,$4,$8,$7,$3,$2;
  2745. $1=console;
  2746. $6=$core.getThisContext()._home();
  2747. $ctx1.sendIdx["home"]=1;
  2748. $5=$recv($6)._asString();
  2749. $ctx1.sendIdx["asString"]=1;
  2750. $4=$recv($5).__comma(" is deprecated! (in ");
  2751. $8=$recv($core.getThisContext()._home())._home();
  2752. $ctx1.sendIdx["home"]=2;
  2753. $7=$recv($8)._asString();
  2754. $3=$recv($4).__comma($7);
  2755. $ctx1.sendIdx[","]=2;
  2756. $2=$recv($3).__comma(")");
  2757. $ctx1.sendIdx[","]=1;
  2758. $recv($1)._warn_($2);
  2759. return self;
  2760. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  2761. },
  2762. args: [],
  2763. 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, ')'.",
  2764. referencedClasses: [],
  2765. messageSends: ["warn:", ",", "asString", "home"]
  2766. }),
  2767. $globals.Object);
  2768. $core.addMethod(
  2769. $core.method({
  2770. selector: "deprecatedAPI:",
  2771. protocol: "error handling",
  2772. fn: function (aString){
  2773. var self=this;
  2774. return $core.withContext(function($ctx1) {
  2775. var $1,$6,$5,$4,$8,$7,$3,$2;
  2776. $1=console;
  2777. $6=$core.getThisContext()._home();
  2778. $ctx1.sendIdx["home"]=1;
  2779. $5=$recv($6)._asString();
  2780. $ctx1.sendIdx["asString"]=1;
  2781. $4=$recv($5).__comma(" is deprecated! (in ");
  2782. $8=$recv($core.getThisContext()._home())._home();
  2783. $ctx1.sendIdx["home"]=2;
  2784. $7=$recv($8)._asString();
  2785. $3=$recv($4).__comma($7);
  2786. $ctx1.sendIdx[","]=2;
  2787. $2=$recv($3).__comma(")");
  2788. $ctx1.sendIdx[","]=1;
  2789. $recv($1)._warn_($2);
  2790. $ctx1.sendIdx["warn:"]=1;
  2791. $recv(console)._warn_(aString);
  2792. return self;
  2793. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  2794. },
  2795. args: ["aString"],
  2796. 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",
  2797. referencedClasses: [],
  2798. messageSends: ["warn:", ",", "asString", "home"]
  2799. }),
  2800. $globals.Object);
  2801. $core.addMethod(
  2802. $core.method({
  2803. selector: "error:",
  2804. protocol: "error handling",
  2805. fn: function (aString){
  2806. var self=this;
  2807. return $core.withContext(function($ctx1) {
  2808. $recv($globals.Error)._signal_(aString);
  2809. return self;
  2810. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  2811. },
  2812. args: ["aString"],
  2813. source: "error: aString\x0a\x09Error signal: aString",
  2814. referencedClasses: ["Error"],
  2815. messageSends: ["signal:"]
  2816. }),
  2817. $globals.Object);
  2818. $core.addMethod(
  2819. $core.method({
  2820. selector: "halt",
  2821. protocol: "error handling",
  2822. fn: function (){
  2823. var self=this;
  2824. return $core.withContext(function($ctx1) {
  2825. $recv($globals.Halt)._signal();
  2826. return self;
  2827. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  2828. },
  2829. args: [],
  2830. source: "halt\x0a\x09Halt signal",
  2831. referencedClasses: ["Halt"],
  2832. messageSends: ["signal"]
  2833. }),
  2834. $globals.Object);
  2835. $core.addMethod(
  2836. $core.method({
  2837. selector: "in:",
  2838. protocol: "evaluating",
  2839. fn: function (aValuable){
  2840. var self=this;
  2841. return $core.withContext(function($ctx1) {
  2842. return $recv(aValuable)._value_(self);
  2843. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  2844. },
  2845. args: ["aValuable"],
  2846. source: "in: aValuable\x0a\x09^ aValuable value: self",
  2847. referencedClasses: [],
  2848. messageSends: ["value:"]
  2849. }),
  2850. $globals.Object);
  2851. $core.addMethod(
  2852. $core.method({
  2853. selector: "isBehavior",
  2854. protocol: "testing",
  2855. fn: function (){
  2856. var self=this;
  2857. return false;
  2858. },
  2859. args: [],
  2860. source: "isBehavior\x0a\x09^ false",
  2861. referencedClasses: [],
  2862. messageSends: []
  2863. }),
  2864. $globals.Object);
  2865. $core.addMethod(
  2866. $core.method({
  2867. selector: "isBoolean",
  2868. protocol: "testing",
  2869. fn: function (){
  2870. var self=this;
  2871. return false;
  2872. },
  2873. args: [],
  2874. source: "isBoolean\x0a\x09^ false",
  2875. referencedClasses: [],
  2876. messageSends: []
  2877. }),
  2878. $globals.Object);
  2879. $core.addMethod(
  2880. $core.method({
  2881. selector: "isClass",
  2882. protocol: "testing",
  2883. fn: function (){
  2884. var self=this;
  2885. return false;
  2886. },
  2887. args: [],
  2888. source: "isClass\x0a\x09^ false",
  2889. referencedClasses: [],
  2890. messageSends: []
  2891. }),
  2892. $globals.Object);
  2893. $core.addMethod(
  2894. $core.method({
  2895. selector: "isCompiledMethod",
  2896. protocol: "testing",
  2897. fn: function (){
  2898. var self=this;
  2899. return false;
  2900. },
  2901. args: [],
  2902. source: "isCompiledMethod\x0a\x09^ false",
  2903. referencedClasses: [],
  2904. messageSends: []
  2905. }),
  2906. $globals.Object);
  2907. $core.addMethod(
  2908. $core.method({
  2909. selector: "isImmutable",
  2910. protocol: "testing",
  2911. fn: function (){
  2912. var self=this;
  2913. return false;
  2914. },
  2915. args: [],
  2916. source: "isImmutable\x0a\x09^ false",
  2917. referencedClasses: [],
  2918. messageSends: []
  2919. }),
  2920. $globals.Object);
  2921. $core.addMethod(
  2922. $core.method({
  2923. selector: "isMemberOf:",
  2924. protocol: "testing",
  2925. fn: function (aClass){
  2926. var self=this;
  2927. return $core.withContext(function($ctx1) {
  2928. return $recv(self._class()).__eq(aClass);
  2929. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  2930. },
  2931. args: ["aClass"],
  2932. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  2933. referencedClasses: [],
  2934. messageSends: ["=", "class"]
  2935. }),
  2936. $globals.Object);
  2937. $core.addMethod(
  2938. $core.method({
  2939. selector: "isMetaclass",
  2940. protocol: "testing",
  2941. fn: function (){
  2942. var self=this;
  2943. return false;
  2944. },
  2945. args: [],
  2946. source: "isMetaclass\x0a\x09^ false",
  2947. referencedClasses: [],
  2948. messageSends: []
  2949. }),
  2950. $globals.Object);
  2951. $core.addMethod(
  2952. $core.method({
  2953. selector: "isNumber",
  2954. protocol: "testing",
  2955. fn: function (){
  2956. var self=this;
  2957. return false;
  2958. },
  2959. args: [],
  2960. source: "isNumber\x0a\x09^ false",
  2961. referencedClasses: [],
  2962. messageSends: []
  2963. }),
  2964. $globals.Object);
  2965. $core.addMethod(
  2966. $core.method({
  2967. selector: "isPackage",
  2968. protocol: "testing",
  2969. fn: function (){
  2970. var self=this;
  2971. return false;
  2972. },
  2973. args: [],
  2974. source: "isPackage\x0a\x09^ false",
  2975. referencedClasses: [],
  2976. messageSends: []
  2977. }),
  2978. $globals.Object);
  2979. $core.addMethod(
  2980. $core.method({
  2981. selector: "isParseFailure",
  2982. protocol: "testing",
  2983. fn: function (){
  2984. var self=this;
  2985. return false;
  2986. },
  2987. args: [],
  2988. source: "isParseFailure\x0a\x09^ false",
  2989. referencedClasses: [],
  2990. messageSends: []
  2991. }),
  2992. $globals.Object);
  2993. $core.addMethod(
  2994. $core.method({
  2995. selector: "isString",
  2996. protocol: "testing",
  2997. fn: function (){
  2998. var self=this;
  2999. return false;
  3000. },
  3001. args: [],
  3002. source: "isString\x0a\x09^ false",
  3003. referencedClasses: [],
  3004. messageSends: []
  3005. }),
  3006. $globals.Object);
  3007. $core.addMethod(
  3008. $core.method({
  3009. selector: "isSymbol",
  3010. protocol: "testing",
  3011. fn: function (){
  3012. var self=this;
  3013. return false;
  3014. },
  3015. args: [],
  3016. source: "isSymbol\x0a\x09^ false",
  3017. referencedClasses: [],
  3018. messageSends: []
  3019. }),
  3020. $globals.Object);
  3021. $core.addMethod(
  3022. $core.method({
  3023. selector: "postCopy",
  3024. protocol: "copying",
  3025. fn: function (){
  3026. var self=this;
  3027. return self;
  3028. },
  3029. args: [],
  3030. source: "postCopy",
  3031. referencedClasses: [],
  3032. messageSends: []
  3033. }),
  3034. $globals.Object);
  3035. $core.addMethod(
  3036. $core.method({
  3037. selector: "putOn:",
  3038. protocol: "streaming",
  3039. fn: function (aStream){
  3040. var self=this;
  3041. return $core.withContext(function($ctx1) {
  3042. $recv(aStream)._nextPut_(self);
  3043. return self;
  3044. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  3045. },
  3046. args: ["aStream"],
  3047. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  3048. referencedClasses: [],
  3049. messageSends: ["nextPut:"]
  3050. }),
  3051. $globals.Object);
  3052. $core.addMethod(
  3053. $core.method({
  3054. selector: "respondsTo:",
  3055. protocol: "testing",
  3056. fn: function (aSelector){
  3057. var self=this;
  3058. return $core.withContext(function($ctx1) {
  3059. return $recv(self._class())._canUnderstand_(aSelector);
  3060. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  3061. },
  3062. args: ["aSelector"],
  3063. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  3064. referencedClasses: [],
  3065. messageSends: ["canUnderstand:", "class"]
  3066. }),
  3067. $globals.Object);
  3068. $core.addMethod(
  3069. $core.method({
  3070. selector: "shallowCopy",
  3071. protocol: "copying",
  3072. fn: function (){
  3073. var self=this;
  3074. return $core.withContext(function($ctx1) {
  3075. var copy = self.klass._new();
  3076. Object.keys(self).forEach(function(i) {
  3077. if(/^@.+/.test(i)) {
  3078. copy[i] = self[i];
  3079. }
  3080. });
  3081. return copy;
  3082. ;
  3083. return self;
  3084. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  3085. },
  3086. args: [],
  3087. source: "shallowCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.klass._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'>",
  3088. referencedClasses: [],
  3089. messageSends: []
  3090. }),
  3091. $globals.Object);
  3092. $core.addMethod(
  3093. $core.method({
  3094. selector: "shouldNotImplement",
  3095. protocol: "error handling",
  3096. fn: function (){
  3097. var self=this;
  3098. return $core.withContext(function($ctx1) {
  3099. self._error_("This method should not be implemented in ".__comma($recv(self._class())._name()));
  3100. return self;
  3101. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  3102. },
  3103. args: [],
  3104. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  3105. referencedClasses: [],
  3106. messageSends: ["error:", ",", "name", "class"]
  3107. }),
  3108. $globals.Object);
  3109. $core.addMethod(
  3110. $core.method({
  3111. selector: "size",
  3112. protocol: "accessing",
  3113. fn: function (){
  3114. var self=this;
  3115. return $core.withContext(function($ctx1) {
  3116. self._error_("Object not indexable");
  3117. return self;
  3118. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  3119. },
  3120. args: [],
  3121. source: "size\x0a\x09self error: 'Object not indexable'",
  3122. referencedClasses: [],
  3123. messageSends: ["error:"]
  3124. }),
  3125. $globals.Object);
  3126. $core.addMethod(
  3127. $core.method({
  3128. selector: "subclassResponsibility",
  3129. protocol: "error handling",
  3130. fn: function (){
  3131. var self=this;
  3132. return $core.withContext(function($ctx1) {
  3133. self._error_("This method is a responsibility of a subclass");
  3134. return self;
  3135. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  3136. },
  3137. args: [],
  3138. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  3139. referencedClasses: [],
  3140. messageSends: ["error:"]
  3141. }),
  3142. $globals.Object);
  3143. $core.addMethod(
  3144. $core.method({
  3145. selector: "value",
  3146. protocol: "evaluating",
  3147. fn: function (){
  3148. var self=this;
  3149. return $core.withContext(function($ctx1) {
  3150. return self.valueOf();
  3151. return self;
  3152. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  3153. },
  3154. args: [],
  3155. source: "value\x0a\x09<inlineJS: 'return self.valueOf()'>",
  3156. referencedClasses: [],
  3157. messageSends: []
  3158. }),
  3159. $globals.Object);
  3160. $core.addMethod(
  3161. $core.method({
  3162. selector: "accessorProtocolWith:",
  3163. protocol: "helios",
  3164. fn: function (aGenerator){
  3165. var self=this;
  3166. return $core.withContext(function($ctx1) {
  3167. $recv(aGenerator)._accessorProtocolForObject();
  3168. return self;
  3169. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  3170. },
  3171. args: ["aGenerator"],
  3172. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  3173. referencedClasses: [],
  3174. messageSends: ["accessorProtocolForObject"]
  3175. }),
  3176. $globals.Object.klass);
  3177. $core.addMethod(
  3178. $core.method({
  3179. selector: "accessorsSourceCodesWith:",
  3180. protocol: "helios",
  3181. fn: function (aGenerator){
  3182. var self=this;
  3183. return $core.withContext(function($ctx1) {
  3184. $recv(aGenerator)._accessorsForObject();
  3185. return self;
  3186. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  3187. },
  3188. args: ["aGenerator"],
  3189. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  3190. referencedClasses: [],
  3191. messageSends: ["accessorsForObject"]
  3192. }),
  3193. $globals.Object.klass);
  3194. $core.addMethod(
  3195. $core.method({
  3196. selector: "initialize",
  3197. protocol: "initialization",
  3198. fn: function (){
  3199. var self=this;
  3200. return self;
  3201. },
  3202. args: [],
  3203. source: "initialize\x0a\x09\x22no op\x22",
  3204. referencedClasses: [],
  3205. messageSends: []
  3206. }),
  3207. $globals.Object.klass);
  3208. $core.addMethod(
  3209. $core.method({
  3210. selector: "initializeProtocolWith:",
  3211. protocol: "helios",
  3212. fn: function (aGenerator){
  3213. var self=this;
  3214. return $core.withContext(function($ctx1) {
  3215. $recv(aGenerator)._initializeProtocolForObject();
  3216. return self;
  3217. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  3218. },
  3219. args: ["aGenerator"],
  3220. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  3221. referencedClasses: [],
  3222. messageSends: ["initializeProtocolForObject"]
  3223. }),
  3224. $globals.Object.klass);
  3225. $core.addMethod(
  3226. $core.method({
  3227. selector: "initializeSourceCodesWith:",
  3228. protocol: "helios",
  3229. fn: function (aGenerator){
  3230. var self=this;
  3231. return $core.withContext(function($ctx1) {
  3232. $recv(aGenerator)._initializeForObject();
  3233. return self;
  3234. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  3235. },
  3236. args: ["aGenerator"],
  3237. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  3238. referencedClasses: [],
  3239. messageSends: ["initializeForObject"]
  3240. }),
  3241. $globals.Object.klass);
  3242. $core.addClass("Boolean", $globals.Object, [], "Kernel-Objects");
  3243. $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: [ ... ]";
  3244. $core.addMethod(
  3245. $core.method({
  3246. selector: "&",
  3247. protocol: "controlling",
  3248. fn: function (aBoolean){
  3249. var self=this;
  3250. return $core.withContext(function($ctx1) {
  3251. if(self == true) {
  3252. return aBoolean;
  3253. } else {
  3254. return false;
  3255. }
  3256. ;
  3257. return self;
  3258. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  3259. },
  3260. args: ["aBoolean"],
  3261. 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'>",
  3262. referencedClasses: [],
  3263. messageSends: []
  3264. }),
  3265. $globals.Boolean);
  3266. $core.addMethod(
  3267. $core.method({
  3268. selector: "==",
  3269. protocol: "comparing",
  3270. fn: function (aBoolean){
  3271. var self=this;
  3272. return $core.withContext(function($ctx1) {
  3273. if (typeof aBoolean === "boolean") return self.valueOf() === aBoolean;
  3274. else if (aBoolean != null && typeof aBoolean === "object") return self.valueOf() === aBoolean.valueOf();
  3275. else return false;;
  3276. return self;
  3277. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  3278. },
  3279. args: ["aBoolean"],
  3280. source: "== aBoolean\x0a<inlineJS: '\x0a\x09if (typeof aBoolean === \x22boolean\x22) return self.valueOf() === aBoolean;\x0a\x09else if (aBoolean != null && typeof aBoolean === \x22object\x22) return self.valueOf() === aBoolean.valueOf();\x0a\x09else return false;\x0a'>",
  3281. referencedClasses: [],
  3282. messageSends: []
  3283. }),
  3284. $globals.Boolean);
  3285. $core.addMethod(
  3286. $core.method({
  3287. selector: "and:",
  3288. protocol: "controlling",
  3289. fn: function (aBlock){
  3290. var self=this;
  3291. return $core.withContext(function($ctx1) {
  3292. if($core.assert(self)){
  3293. return $recv(aBlock)._value();
  3294. } else {
  3295. return false;
  3296. }
  3297. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  3298. },
  3299. args: ["aBlock"],
  3300. source: "and: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ false ]",
  3301. referencedClasses: [],
  3302. messageSends: ["ifTrue:ifFalse:", "value"]
  3303. }),
  3304. $globals.Boolean);
  3305. $core.addMethod(
  3306. $core.method({
  3307. selector: "asBit",
  3308. protocol: "converting",
  3309. fn: function (){
  3310. var self=this;
  3311. return $core.withContext(function($ctx1) {
  3312. if($core.assert(self)){
  3313. return (1);
  3314. } else {
  3315. return (0);
  3316. }
  3317. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  3318. },
  3319. args: [],
  3320. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3321. referencedClasses: [],
  3322. messageSends: ["ifTrue:ifFalse:"]
  3323. }),
  3324. $globals.Boolean);
  3325. $core.addMethod(
  3326. $core.method({
  3327. selector: "asJavaScriptObject",
  3328. protocol: "converting",
  3329. fn: function (){
  3330. var self=this;
  3331. return self;
  3332. },
  3333. args: [],
  3334. source: "asJavaScriptObject\x0a\x09^ self",
  3335. referencedClasses: [],
  3336. messageSends: []
  3337. }),
  3338. $globals.Boolean);
  3339. $core.addMethod(
  3340. $core.method({
  3341. selector: "asString",
  3342. protocol: "converting",
  3343. fn: function (){
  3344. var self=this;
  3345. return $core.withContext(function($ctx1) {
  3346. return self.toString();
  3347. return self;
  3348. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  3349. },
  3350. args: [],
  3351. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3352. referencedClasses: [],
  3353. messageSends: []
  3354. }),
  3355. $globals.Boolean);
  3356. $core.addMethod(
  3357. $core.method({
  3358. selector: "deepCopy",
  3359. protocol: "copying",
  3360. fn: function (){
  3361. var self=this;
  3362. return self;
  3363. },
  3364. args: [],
  3365. source: "deepCopy\x0a\x09^ self",
  3366. referencedClasses: [],
  3367. messageSends: []
  3368. }),
  3369. $globals.Boolean);
  3370. $core.addMethod(
  3371. $core.method({
  3372. selector: "ifFalse:",
  3373. protocol: "controlling",
  3374. fn: function (aBlock){
  3375. var self=this;
  3376. return $core.withContext(function($ctx1) {
  3377. return self._ifTrue_ifFalse_((function(){
  3378. }),aBlock);
  3379. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  3380. },
  3381. args: ["aBlock"],
  3382. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3383. referencedClasses: [],
  3384. messageSends: ["ifTrue:ifFalse:"]
  3385. }),
  3386. $globals.Boolean);
  3387. $core.addMethod(
  3388. $core.method({
  3389. selector: "ifFalse:ifTrue:",
  3390. protocol: "controlling",
  3391. fn: function (aBlock,anotherBlock){
  3392. var self=this;
  3393. return $core.withContext(function($ctx1) {
  3394. return self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3395. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3396. },
  3397. args: ["aBlock", "anotherBlock"],
  3398. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3399. referencedClasses: [],
  3400. messageSends: ["ifTrue:ifFalse:"]
  3401. }),
  3402. $globals.Boolean);
  3403. $core.addMethod(
  3404. $core.method({
  3405. selector: "ifTrue:",
  3406. protocol: "controlling",
  3407. fn: function (aBlock){
  3408. var self=this;
  3409. return $core.withContext(function($ctx1) {
  3410. return self._ifTrue_ifFalse_(aBlock,(function(){
  3411. }));
  3412. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  3413. },
  3414. args: ["aBlock"],
  3415. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3416. referencedClasses: [],
  3417. messageSends: ["ifTrue:ifFalse:"]
  3418. }),
  3419. $globals.Boolean);
  3420. $core.addMethod(
  3421. $core.method({
  3422. selector: "ifTrue:ifFalse:",
  3423. protocol: "controlling",
  3424. fn: function (aBlock,anotherBlock){
  3425. var self=this;
  3426. return $core.withContext(function($ctx1) {
  3427. if(self == true) {
  3428. return aBlock._value();
  3429. } else {
  3430. return anotherBlock._value();
  3431. }
  3432. ;
  3433. return self;
  3434. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3435. },
  3436. args: ["aBlock", "anotherBlock"],
  3437. 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'>",
  3438. referencedClasses: [],
  3439. messageSends: []
  3440. }),
  3441. $globals.Boolean);
  3442. $core.addMethod(
  3443. $core.method({
  3444. selector: "isBoolean",
  3445. protocol: "testing",
  3446. fn: function (){
  3447. var self=this;
  3448. return true;
  3449. },
  3450. args: [],
  3451. source: "isBoolean\x0a\x09^ true",
  3452. referencedClasses: [],
  3453. messageSends: []
  3454. }),
  3455. $globals.Boolean);
  3456. $core.addMethod(
  3457. $core.method({
  3458. selector: "isImmutable",
  3459. protocol: "testing",
  3460. fn: function (){
  3461. var self=this;
  3462. return true;
  3463. },
  3464. args: [],
  3465. source: "isImmutable\x0a\x09^ true",
  3466. referencedClasses: [],
  3467. messageSends: []
  3468. }),
  3469. $globals.Boolean);
  3470. $core.addMethod(
  3471. $core.method({
  3472. selector: "not",
  3473. protocol: "controlling",
  3474. fn: function (){
  3475. var self=this;
  3476. return $core.withContext(function($ctx1) {
  3477. return self.__eq(false);
  3478. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  3479. },
  3480. args: [],
  3481. source: "not\x0a\x09^ self = false",
  3482. referencedClasses: [],
  3483. messageSends: ["="]
  3484. }),
  3485. $globals.Boolean);
  3486. $core.addMethod(
  3487. $core.method({
  3488. selector: "or:",
  3489. protocol: "controlling",
  3490. fn: function (aBlock){
  3491. var self=this;
  3492. return $core.withContext(function($ctx1) {
  3493. if($core.assert(self)){
  3494. return true;
  3495. } else {
  3496. return $recv(aBlock)._value();
  3497. }
  3498. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  3499. },
  3500. args: ["aBlock"],
  3501. source: "or: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: \x22aBlock\x22 [ aBlock value ]",
  3502. referencedClasses: [],
  3503. messageSends: ["ifTrue:ifFalse:", "value"]
  3504. }),
  3505. $globals.Boolean);
  3506. $core.addMethod(
  3507. $core.method({
  3508. selector: "printOn:",
  3509. protocol: "printing",
  3510. fn: function (aStream){
  3511. var self=this;
  3512. return $core.withContext(function($ctx1) {
  3513. $recv(aStream)._nextPutAll_(self._asString());
  3514. return self;
  3515. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  3516. },
  3517. args: ["aStream"],
  3518. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3519. referencedClasses: [],
  3520. messageSends: ["nextPutAll:", "asString"]
  3521. }),
  3522. $globals.Boolean);
  3523. $core.addMethod(
  3524. $core.method({
  3525. selector: "shallowCopy",
  3526. protocol: "copying",
  3527. fn: function (){
  3528. var self=this;
  3529. return self;
  3530. },
  3531. args: [],
  3532. source: "shallowCopy\x0a\x09^ self",
  3533. referencedClasses: [],
  3534. messageSends: []
  3535. }),
  3536. $globals.Boolean);
  3537. $core.addMethod(
  3538. $core.method({
  3539. selector: "|",
  3540. protocol: "controlling",
  3541. fn: function (aBoolean){
  3542. var self=this;
  3543. return $core.withContext(function($ctx1) {
  3544. if(self == true) {
  3545. return true;
  3546. } else {
  3547. return aBoolean;
  3548. }
  3549. ;
  3550. return self;
  3551. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  3552. },
  3553. args: ["aBoolean"],
  3554. 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'>",
  3555. referencedClasses: [],
  3556. messageSends: []
  3557. }),
  3558. $globals.Boolean);
  3559. $core.addClass("Date", $globals.Object, [], "Kernel-Objects");
  3560. $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.).";
  3561. $core.addMethod(
  3562. $core.method({
  3563. selector: "+",
  3564. protocol: "arithmetic",
  3565. fn: function (aDate){
  3566. var self=this;
  3567. return $core.withContext(function($ctx1) {
  3568. return self + aDate;
  3569. return self;
  3570. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  3571. },
  3572. args: ["aDate"],
  3573. source: "+ aDate\x0a\x09<inlineJS: 'return self + aDate'>",
  3574. referencedClasses: [],
  3575. messageSends: []
  3576. }),
  3577. $globals.Date);
  3578. $core.addMethod(
  3579. $core.method({
  3580. selector: "-",
  3581. protocol: "arithmetic",
  3582. fn: function (aDate){
  3583. var self=this;
  3584. return $core.withContext(function($ctx1) {
  3585. return self - aDate;
  3586. return self;
  3587. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  3588. },
  3589. args: ["aDate"],
  3590. source: "- aDate\x0a\x09<inlineJS: 'return self - aDate'>",
  3591. referencedClasses: [],
  3592. messageSends: []
  3593. }),
  3594. $globals.Date);
  3595. $core.addMethod(
  3596. $core.method({
  3597. selector: "<",
  3598. protocol: "comparing",
  3599. fn: function (aDate){
  3600. var self=this;
  3601. return $core.withContext(function($ctx1) {
  3602. return self < aDate;
  3603. return self;
  3604. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  3605. },
  3606. args: ["aDate"],
  3607. source: "< aDate\x0a\x09<inlineJS: 'return self < aDate'>",
  3608. referencedClasses: [],
  3609. messageSends: []
  3610. }),
  3611. $globals.Date);
  3612. $core.addMethod(
  3613. $core.method({
  3614. selector: "<=",
  3615. protocol: "comparing",
  3616. fn: function (aDate){
  3617. var self=this;
  3618. return $core.withContext(function($ctx1) {
  3619. return self <= aDate;
  3620. return self;
  3621. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  3622. },
  3623. args: ["aDate"],
  3624. source: "<= aDate\x0a\x09<inlineJS: 'return self <= aDate'>",
  3625. referencedClasses: [],
  3626. messageSends: []
  3627. }),
  3628. $globals.Date);
  3629. $core.addMethod(
  3630. $core.method({
  3631. selector: "=",
  3632. protocol: "comparing",
  3633. fn: function (aDate){
  3634. var self=this;
  3635. return $core.withContext(function($ctx1) {
  3636. var $2,$1,$3;
  3637. $2=$recv(aDate)._class();
  3638. $ctx1.sendIdx["class"]=1;
  3639. $1=$recv($2).__eq_eq(self._class());
  3640. $ctx1.sendIdx["=="]=1;
  3641. return $recv($1)._and_((function(){
  3642. return $core.withContext(function($ctx2) {
  3643. $3=self._asMilliseconds();
  3644. $ctx2.sendIdx["asMilliseconds"]=1;
  3645. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  3646. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3647. }));
  3648. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  3649. },
  3650. args: ["aDate"],
  3651. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  3652. referencedClasses: [],
  3653. messageSends: ["and:", "==", "class", "asMilliseconds"]
  3654. }),
  3655. $globals.Date);
  3656. $core.addMethod(
  3657. $core.method({
  3658. selector: ">",
  3659. protocol: "comparing",
  3660. fn: function (aDate){
  3661. var self=this;
  3662. return $core.withContext(function($ctx1) {
  3663. return self > aDate;
  3664. return self;
  3665. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  3666. },
  3667. args: ["aDate"],
  3668. source: "> aDate\x0a\x09<inlineJS: 'return self > aDate'>",
  3669. referencedClasses: [],
  3670. messageSends: []
  3671. }),
  3672. $globals.Date);
  3673. $core.addMethod(
  3674. $core.method({
  3675. selector: ">=",
  3676. protocol: "comparing",
  3677. fn: function (aDate){
  3678. var self=this;
  3679. return $core.withContext(function($ctx1) {
  3680. return self >= aDate;
  3681. return self;
  3682. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  3683. },
  3684. args: ["aDate"],
  3685. source: ">= aDate\x0a\x09<inlineJS: 'return self >= aDate'>",
  3686. referencedClasses: [],
  3687. messageSends: []
  3688. }),
  3689. $globals.Date);
  3690. $core.addMethod(
  3691. $core.method({
  3692. selector: "asDateString",
  3693. protocol: "converting",
  3694. fn: function (){
  3695. var self=this;
  3696. return $core.withContext(function($ctx1) {
  3697. return self.toDateString();
  3698. return self;
  3699. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  3700. },
  3701. args: [],
  3702. source: "asDateString\x0a\x09<inlineJS: 'return self.toDateString()'>",
  3703. referencedClasses: [],
  3704. messageSends: []
  3705. }),
  3706. $globals.Date);
  3707. $core.addMethod(
  3708. $core.method({
  3709. selector: "asLocaleString",
  3710. protocol: "converting",
  3711. fn: function (){
  3712. var self=this;
  3713. return $core.withContext(function($ctx1) {
  3714. return self.toLocaleString();
  3715. return self;
  3716. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  3717. },
  3718. args: [],
  3719. source: "asLocaleString\x0a\x09<inlineJS: 'return self.toLocaleString()'>",
  3720. referencedClasses: [],
  3721. messageSends: []
  3722. }),
  3723. $globals.Date);
  3724. $core.addMethod(
  3725. $core.method({
  3726. selector: "asMilliseconds",
  3727. protocol: "converting",
  3728. fn: function (){
  3729. var self=this;
  3730. return $core.withContext(function($ctx1) {
  3731. return self._time();
  3732. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  3733. },
  3734. args: [],
  3735. source: "asMilliseconds\x0a\x09^ self time",
  3736. referencedClasses: [],
  3737. messageSends: ["time"]
  3738. }),
  3739. $globals.Date);
  3740. $core.addMethod(
  3741. $core.method({
  3742. selector: "asNumber",
  3743. protocol: "converting",
  3744. fn: function (){
  3745. var self=this;
  3746. return $core.withContext(function($ctx1) {
  3747. return self._asMilliseconds();
  3748. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  3749. },
  3750. args: [],
  3751. source: "asNumber\x0a\x09^ self asMilliseconds",
  3752. referencedClasses: [],
  3753. messageSends: ["asMilliseconds"]
  3754. }),
  3755. $globals.Date);
  3756. $core.addMethod(
  3757. $core.method({
  3758. selector: "asString",
  3759. protocol: "converting",
  3760. fn: function (){
  3761. var self=this;
  3762. return $core.withContext(function($ctx1) {
  3763. return self.toString();
  3764. return self;
  3765. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  3766. },
  3767. args: [],
  3768. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3769. referencedClasses: [],
  3770. messageSends: []
  3771. }),
  3772. $globals.Date);
  3773. $core.addMethod(
  3774. $core.method({
  3775. selector: "asTimeString",
  3776. protocol: "converting",
  3777. fn: function (){
  3778. var self=this;
  3779. return $core.withContext(function($ctx1) {
  3780. return self.toTimeString();
  3781. return self;
  3782. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  3783. },
  3784. args: [],
  3785. source: "asTimeString\x0a\x09<inlineJS: 'return self.toTimeString()'>",
  3786. referencedClasses: [],
  3787. messageSends: []
  3788. }),
  3789. $globals.Date);
  3790. $core.addMethod(
  3791. $core.method({
  3792. selector: "day",
  3793. protocol: "accessing",
  3794. fn: function (){
  3795. var self=this;
  3796. return $core.withContext(function($ctx1) {
  3797. return self._dayOfWeek();
  3798. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  3799. },
  3800. args: [],
  3801. source: "day\x0a\x09^ self dayOfWeek",
  3802. referencedClasses: [],
  3803. messageSends: ["dayOfWeek"]
  3804. }),
  3805. $globals.Date);
  3806. $core.addMethod(
  3807. $core.method({
  3808. selector: "day:",
  3809. protocol: "accessing",
  3810. fn: function (aNumber){
  3811. var self=this;
  3812. return $core.withContext(function($ctx1) {
  3813. self._dayOfWeek_(aNumber);
  3814. return self;
  3815. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  3816. },
  3817. args: ["aNumber"],
  3818. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  3819. referencedClasses: [],
  3820. messageSends: ["dayOfWeek:"]
  3821. }),
  3822. $globals.Date);
  3823. $core.addMethod(
  3824. $core.method({
  3825. selector: "dayOfMonth",
  3826. protocol: "accessing",
  3827. fn: function (){
  3828. var self=this;
  3829. return $core.withContext(function($ctx1) {
  3830. return self.getDate();
  3831. return self;
  3832. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  3833. },
  3834. args: [],
  3835. source: "dayOfMonth\x0a\x09<inlineJS: 'return self.getDate()'>",
  3836. referencedClasses: [],
  3837. messageSends: []
  3838. }),
  3839. $globals.Date);
  3840. $core.addMethod(
  3841. $core.method({
  3842. selector: "dayOfMonth:",
  3843. protocol: "accessing",
  3844. fn: function (aNumber){
  3845. var self=this;
  3846. return $core.withContext(function($ctx1) {
  3847. self.setDate(aNumber);
  3848. return self;
  3849. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  3850. },
  3851. args: ["aNumber"],
  3852. source: "dayOfMonth: aNumber\x0a\x09<inlineJS: 'self.setDate(aNumber)'>",
  3853. referencedClasses: [],
  3854. messageSends: []
  3855. }),
  3856. $globals.Date);
  3857. $core.addMethod(
  3858. $core.method({
  3859. selector: "dayOfWeek",
  3860. protocol: "accessing",
  3861. fn: function (){
  3862. var self=this;
  3863. return $core.withContext(function($ctx1) {
  3864. return self.getDay() + 1;
  3865. return self;
  3866. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  3867. },
  3868. args: [],
  3869. source: "dayOfWeek\x0a\x09<inlineJS: 'return self.getDay() + 1'>",
  3870. referencedClasses: [],
  3871. messageSends: []
  3872. }),
  3873. $globals.Date);
  3874. $core.addMethod(
  3875. $core.method({
  3876. selector: "dayOfWeek:",
  3877. protocol: "accessing",
  3878. fn: function (aNumber){
  3879. var self=this;
  3880. return $core.withContext(function($ctx1) {
  3881. return self.setDay(aNumber - 1);
  3882. return self;
  3883. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  3884. },
  3885. args: ["aNumber"],
  3886. source: "dayOfWeek: aNumber\x0a\x09<inlineJS: 'return self.setDay(aNumber - 1)'>",
  3887. referencedClasses: [],
  3888. messageSends: []
  3889. }),
  3890. $globals.Date);
  3891. $core.addMethod(
  3892. $core.method({
  3893. selector: "hours",
  3894. protocol: "accessing",
  3895. fn: function (){
  3896. var self=this;
  3897. return $core.withContext(function($ctx1) {
  3898. return self.getHours();
  3899. return self;
  3900. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  3901. },
  3902. args: [],
  3903. source: "hours\x0a\x09<inlineJS: 'return self.getHours()'>",
  3904. referencedClasses: [],
  3905. messageSends: []
  3906. }),
  3907. $globals.Date);
  3908. $core.addMethod(
  3909. $core.method({
  3910. selector: "hours:",
  3911. protocol: "accessing",
  3912. fn: function (aNumber){
  3913. var self=this;
  3914. return $core.withContext(function($ctx1) {
  3915. self.setHours(aNumber);
  3916. return self;
  3917. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  3918. },
  3919. args: ["aNumber"],
  3920. source: "hours: aNumber\x0a\x09<inlineJS: 'self.setHours(aNumber)'>",
  3921. referencedClasses: [],
  3922. messageSends: []
  3923. }),
  3924. $globals.Date);
  3925. $core.addMethod(
  3926. $core.method({
  3927. selector: "milliseconds",
  3928. protocol: "accessing",
  3929. fn: function (){
  3930. var self=this;
  3931. return $core.withContext(function($ctx1) {
  3932. return self.getMilliseconds();
  3933. return self;
  3934. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  3935. },
  3936. args: [],
  3937. source: "milliseconds\x0a\x09<inlineJS: 'return self.getMilliseconds()'>",
  3938. referencedClasses: [],
  3939. messageSends: []
  3940. }),
  3941. $globals.Date);
  3942. $core.addMethod(
  3943. $core.method({
  3944. selector: "milliseconds:",
  3945. protocol: "accessing",
  3946. fn: function (aNumber){
  3947. var self=this;
  3948. return $core.withContext(function($ctx1) {
  3949. self.setMilliseconds(aNumber);
  3950. return self;
  3951. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  3952. },
  3953. args: ["aNumber"],
  3954. source: "milliseconds: aNumber\x0a\x09<inlineJS: 'self.setMilliseconds(aNumber)'>",
  3955. referencedClasses: [],
  3956. messageSends: []
  3957. }),
  3958. $globals.Date);
  3959. $core.addMethod(
  3960. $core.method({
  3961. selector: "minutes",
  3962. protocol: "accessing",
  3963. fn: function (){
  3964. var self=this;
  3965. return $core.withContext(function($ctx1) {
  3966. return self.getMinutes();
  3967. return self;
  3968. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  3969. },
  3970. args: [],
  3971. source: "minutes\x0a\x09<inlineJS: 'return self.getMinutes()'>",
  3972. referencedClasses: [],
  3973. messageSends: []
  3974. }),
  3975. $globals.Date);
  3976. $core.addMethod(
  3977. $core.method({
  3978. selector: "minutes:",
  3979. protocol: "accessing",
  3980. fn: function (aNumber){
  3981. var self=this;
  3982. return $core.withContext(function($ctx1) {
  3983. self.setMinutes(aNumber);
  3984. return self;
  3985. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  3986. },
  3987. args: ["aNumber"],
  3988. source: "minutes: aNumber\x0a\x09<inlineJS: 'self.setMinutes(aNumber)'>",
  3989. referencedClasses: [],
  3990. messageSends: []
  3991. }),
  3992. $globals.Date);
  3993. $core.addMethod(
  3994. $core.method({
  3995. selector: "month",
  3996. protocol: "accessing",
  3997. fn: function (){
  3998. var self=this;
  3999. return $core.withContext(function($ctx1) {
  4000. return self.getMonth() + 1;
  4001. return self;
  4002. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  4003. },
  4004. args: [],
  4005. source: "month\x0a\x09<inlineJS: 'return self.getMonth() + 1'>",
  4006. referencedClasses: [],
  4007. messageSends: []
  4008. }),
  4009. $globals.Date);
  4010. $core.addMethod(
  4011. $core.method({
  4012. selector: "month:",
  4013. protocol: "accessing",
  4014. fn: function (aNumber){
  4015. var self=this;
  4016. return $core.withContext(function($ctx1) {
  4017. self.setMonth(aNumber - 1);
  4018. return self;
  4019. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  4020. },
  4021. args: ["aNumber"],
  4022. source: "month: aNumber\x0a\x09<inlineJS: 'self.setMonth(aNumber - 1)'>",
  4023. referencedClasses: [],
  4024. messageSends: []
  4025. }),
  4026. $globals.Date);
  4027. $core.addMethod(
  4028. $core.method({
  4029. selector: "printOn:",
  4030. protocol: "printing",
  4031. fn: function (aStream){
  4032. var self=this;
  4033. return $core.withContext(function($ctx1) {
  4034. $recv(aStream)._nextPutAll_(self._asString());
  4035. return self;
  4036. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  4037. },
  4038. args: ["aStream"],
  4039. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4040. referencedClasses: [],
  4041. messageSends: ["nextPutAll:", "asString"]
  4042. }),
  4043. $globals.Date);
  4044. $core.addMethod(
  4045. $core.method({
  4046. selector: "seconds",
  4047. protocol: "accessing",
  4048. fn: function (){
  4049. var self=this;
  4050. return $core.withContext(function($ctx1) {
  4051. return self.getSeconds();
  4052. return self;
  4053. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  4054. },
  4055. args: [],
  4056. source: "seconds\x0a\x09<inlineJS: 'return self.getSeconds()'>",
  4057. referencedClasses: [],
  4058. messageSends: []
  4059. }),
  4060. $globals.Date);
  4061. $core.addMethod(
  4062. $core.method({
  4063. selector: "seconds:",
  4064. protocol: "accessing",
  4065. fn: function (aNumber){
  4066. var self=this;
  4067. return $core.withContext(function($ctx1) {
  4068. self.setSeconds(aNumber);
  4069. return self;
  4070. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  4071. },
  4072. args: ["aNumber"],
  4073. source: "seconds: aNumber\x0a\x09<inlineJS: 'self.setSeconds(aNumber)'>",
  4074. referencedClasses: [],
  4075. messageSends: []
  4076. }),
  4077. $globals.Date);
  4078. $core.addMethod(
  4079. $core.method({
  4080. selector: "time",
  4081. protocol: "accessing",
  4082. fn: function (){
  4083. var self=this;
  4084. return $core.withContext(function($ctx1) {
  4085. return self.getTime();
  4086. return self;
  4087. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  4088. },
  4089. args: [],
  4090. source: "time\x0a\x09<inlineJS: 'return self.getTime()'>",
  4091. referencedClasses: [],
  4092. messageSends: []
  4093. }),
  4094. $globals.Date);
  4095. $core.addMethod(
  4096. $core.method({
  4097. selector: "time:",
  4098. protocol: "accessing",
  4099. fn: function (aNumber){
  4100. var self=this;
  4101. return $core.withContext(function($ctx1) {
  4102. self.setTime(aNumber);
  4103. return self;
  4104. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  4105. },
  4106. args: ["aNumber"],
  4107. source: "time: aNumber\x0a\x09<inlineJS: 'self.setTime(aNumber)'>",
  4108. referencedClasses: [],
  4109. messageSends: []
  4110. }),
  4111. $globals.Date);
  4112. $core.addMethod(
  4113. $core.method({
  4114. selector: "year",
  4115. protocol: "accessing",
  4116. fn: function (){
  4117. var self=this;
  4118. return $core.withContext(function($ctx1) {
  4119. return self.getFullYear();
  4120. return self;
  4121. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  4122. },
  4123. args: [],
  4124. source: "year\x0a\x09<inlineJS: 'return self.getFullYear()'>",
  4125. referencedClasses: [],
  4126. messageSends: []
  4127. }),
  4128. $globals.Date);
  4129. $core.addMethod(
  4130. $core.method({
  4131. selector: "year:",
  4132. protocol: "accessing",
  4133. fn: function (aNumber){
  4134. var self=this;
  4135. return $core.withContext(function($ctx1) {
  4136. self.setFullYear(aNumber);
  4137. return self;
  4138. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  4139. },
  4140. args: ["aNumber"],
  4141. source: "year: aNumber\x0a\x09<inlineJS: 'self.setFullYear(aNumber)'>",
  4142. referencedClasses: [],
  4143. messageSends: []
  4144. }),
  4145. $globals.Date);
  4146. $core.addMethod(
  4147. $core.method({
  4148. selector: "classTag",
  4149. protocol: "accessing",
  4150. fn: function (){
  4151. var self=this;
  4152. return "magnitude";
  4153. },
  4154. args: [],
  4155. 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'",
  4156. referencedClasses: [],
  4157. messageSends: []
  4158. }),
  4159. $globals.Date.klass);
  4160. $core.addMethod(
  4161. $core.method({
  4162. selector: "fromMilliseconds:",
  4163. protocol: "instance creation",
  4164. fn: function (aNumber){
  4165. var self=this;
  4166. return $core.withContext(function($ctx1) {
  4167. return self._new_(aNumber);
  4168. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.klass)});
  4169. },
  4170. args: ["aNumber"],
  4171. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4172. referencedClasses: [],
  4173. messageSends: ["new:"]
  4174. }),
  4175. $globals.Date.klass);
  4176. $core.addMethod(
  4177. $core.method({
  4178. selector: "fromSeconds:",
  4179. protocol: "instance creation",
  4180. fn: function (aNumber){
  4181. var self=this;
  4182. return $core.withContext(function($ctx1) {
  4183. return self._fromMilliseconds_($recv(aNumber).__star((1000)));
  4184. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.klass)});
  4185. },
  4186. args: ["aNumber"],
  4187. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4188. referencedClasses: [],
  4189. messageSends: ["fromMilliseconds:", "*"]
  4190. }),
  4191. $globals.Date.klass);
  4192. $core.addMethod(
  4193. $core.method({
  4194. selector: "fromString:",
  4195. protocol: "instance creation",
  4196. fn: function (aString){
  4197. var self=this;
  4198. return $core.withContext(function($ctx1) {
  4199. return self._new_(aString);
  4200. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.klass)});
  4201. },
  4202. args: ["aString"],
  4203. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4204. referencedClasses: [],
  4205. messageSends: ["new:"]
  4206. }),
  4207. $globals.Date.klass);
  4208. $core.addMethod(
  4209. $core.method({
  4210. selector: "millisecondsToRun:",
  4211. protocol: "instance creation",
  4212. fn: function (aBlock){
  4213. var self=this;
  4214. var t;
  4215. return $core.withContext(function($ctx1) {
  4216. t=$recv($globals.Date)._now();
  4217. $ctx1.sendIdx["now"]=1;
  4218. $recv(aBlock)._value();
  4219. return $recv($recv($globals.Date)._now()).__minus(t);
  4220. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.klass)});
  4221. },
  4222. args: ["aBlock"],
  4223. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  4224. referencedClasses: ["Date"],
  4225. messageSends: ["now", "value", "-"]
  4226. }),
  4227. $globals.Date.klass);
  4228. $core.addMethod(
  4229. $core.method({
  4230. selector: "new:",
  4231. protocol: "instance creation",
  4232. fn: function (anObject){
  4233. var self=this;
  4234. return $core.withContext(function($ctx1) {
  4235. return new Date(anObject);
  4236. return self;
  4237. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.klass)});
  4238. },
  4239. args: ["anObject"],
  4240. source: "new: anObject\x0a\x09<inlineJS: 'return new Date(anObject)'>",
  4241. referencedClasses: [],
  4242. messageSends: []
  4243. }),
  4244. $globals.Date.klass);
  4245. $core.addMethod(
  4246. $core.method({
  4247. selector: "now",
  4248. protocol: "instance creation",
  4249. fn: function (){
  4250. var self=this;
  4251. return $core.withContext(function($ctx1) {
  4252. return self._today();
  4253. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.klass)});
  4254. },
  4255. args: [],
  4256. source: "now\x0a\x09^ self today",
  4257. referencedClasses: [],
  4258. messageSends: ["today"]
  4259. }),
  4260. $globals.Date.klass);
  4261. $core.addMethod(
  4262. $core.method({
  4263. selector: "today",
  4264. protocol: "instance creation",
  4265. fn: function (){
  4266. var self=this;
  4267. return $core.withContext(function($ctx1) {
  4268. return self._new();
  4269. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.klass)});
  4270. },
  4271. args: [],
  4272. source: "today\x0a\x09^ self new",
  4273. referencedClasses: [],
  4274. messageSends: ["new"]
  4275. }),
  4276. $globals.Date.klass);
  4277. $core.addClass("Number", $globals.Object, [], "Kernel-Objects");
  4278. $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 ].";
  4279. $core.addMethod(
  4280. $core.method({
  4281. selector: "&",
  4282. protocol: "converting",
  4283. fn: function (aNumber){
  4284. var self=this;
  4285. return $core.withContext(function($ctx1) {
  4286. return self & aNumber;
  4287. return self;
  4288. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  4289. },
  4290. args: ["aNumber"],
  4291. source: "& aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  4292. referencedClasses: [],
  4293. messageSends: []
  4294. }),
  4295. $globals.Number);
  4296. $core.addMethod(
  4297. $core.method({
  4298. selector: "*",
  4299. protocol: "arithmetic",
  4300. fn: function (aNumber){
  4301. var self=this;
  4302. return $core.withContext(function($ctx1) {
  4303. return self * aNumber;
  4304. return self;
  4305. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  4306. },
  4307. args: ["aNumber"],
  4308. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self * aNumber'>",
  4309. referencedClasses: [],
  4310. messageSends: []
  4311. }),
  4312. $globals.Number);
  4313. $core.addMethod(
  4314. $core.method({
  4315. selector: "**",
  4316. protocol: "mathematical functions",
  4317. fn: function (exponent){
  4318. var self=this;
  4319. return $core.withContext(function($ctx1) {
  4320. return self._raisedTo_(exponent);
  4321. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  4322. },
  4323. args: ["exponent"],
  4324. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4325. referencedClasses: [],
  4326. messageSends: ["raisedTo:"]
  4327. }),
  4328. $globals.Number);
  4329. $core.addMethod(
  4330. $core.method({
  4331. selector: "+",
  4332. protocol: "arithmetic",
  4333. fn: function (aNumber){
  4334. var self=this;
  4335. return $core.withContext(function($ctx1) {
  4336. return self + aNumber;
  4337. return self;
  4338. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  4339. },
  4340. args: ["aNumber"],
  4341. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self + aNumber'>",
  4342. referencedClasses: [],
  4343. messageSends: []
  4344. }),
  4345. $globals.Number);
  4346. $core.addMethod(
  4347. $core.method({
  4348. selector: "-",
  4349. protocol: "arithmetic",
  4350. fn: function (aNumber){
  4351. var self=this;
  4352. return $core.withContext(function($ctx1) {
  4353. return self - aNumber;
  4354. return self;
  4355. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  4356. },
  4357. args: ["aNumber"],
  4358. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self - aNumber'>",
  4359. referencedClasses: [],
  4360. messageSends: []
  4361. }),
  4362. $globals.Number);
  4363. $core.addMethod(
  4364. $core.method({
  4365. selector: "/",
  4366. protocol: "arithmetic",
  4367. fn: function (aNumber){
  4368. var self=this;
  4369. return $core.withContext(function($ctx1) {
  4370. return self / aNumber;
  4371. return self;
  4372. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  4373. },
  4374. args: ["aNumber"],
  4375. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self / aNumber'>",
  4376. referencedClasses: [],
  4377. messageSends: []
  4378. }),
  4379. $globals.Number);
  4380. $core.addMethod(
  4381. $core.method({
  4382. selector: "//",
  4383. protocol: "arithmetic",
  4384. fn: function (aNumber){
  4385. var self=this;
  4386. return $core.withContext(function($ctx1) {
  4387. return $recv(self.__slash(aNumber))._floor();
  4388. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  4389. },
  4390. args: ["aNumber"],
  4391. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4392. referencedClasses: [],
  4393. messageSends: ["floor", "/"]
  4394. }),
  4395. $globals.Number);
  4396. $core.addMethod(
  4397. $core.method({
  4398. selector: "<",
  4399. protocol: "comparing",
  4400. fn: function (aNumber){
  4401. var self=this;
  4402. return $core.withContext(function($ctx1) {
  4403. return self < aNumber;
  4404. return self;
  4405. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  4406. },
  4407. args: ["aNumber"],
  4408. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self < aNumber'>",
  4409. referencedClasses: [],
  4410. messageSends: []
  4411. }),
  4412. $globals.Number);
  4413. $core.addMethod(
  4414. $core.method({
  4415. selector: "<=",
  4416. protocol: "comparing",
  4417. fn: function (aNumber){
  4418. var self=this;
  4419. return $core.withContext(function($ctx1) {
  4420. return self <= aNumber;
  4421. return self;
  4422. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  4423. },
  4424. args: ["aNumber"],
  4425. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self <= aNumber'>",
  4426. referencedClasses: [],
  4427. messageSends: []
  4428. }),
  4429. $globals.Number);
  4430. $core.addMethod(
  4431. $core.method({
  4432. selector: "==",
  4433. protocol: "comparing",
  4434. fn: function (aNumber){
  4435. var self=this;
  4436. return $core.withContext(function($ctx1) {
  4437. if (typeof aNumber === "number") return Number(self) === aNumber;
  4438. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  4439. else return false;;
  4440. return self;
  4441. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  4442. },
  4443. args: ["aNumber"],
  4444. 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'>",
  4445. referencedClasses: [],
  4446. messageSends: []
  4447. }),
  4448. $globals.Number);
  4449. $core.addMethod(
  4450. $core.method({
  4451. selector: ">",
  4452. protocol: "comparing",
  4453. fn: function (aNumber){
  4454. var self=this;
  4455. return $core.withContext(function($ctx1) {
  4456. return self > aNumber;
  4457. return self;
  4458. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  4459. },
  4460. args: ["aNumber"],
  4461. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self > aNumber'>",
  4462. referencedClasses: [],
  4463. messageSends: []
  4464. }),
  4465. $globals.Number);
  4466. $core.addMethod(
  4467. $core.method({
  4468. selector: ">=",
  4469. protocol: "comparing",
  4470. fn: function (aNumber){
  4471. var self=this;
  4472. return $core.withContext(function($ctx1) {
  4473. return self >= aNumber;
  4474. return self;
  4475. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  4476. },
  4477. args: ["aNumber"],
  4478. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self >= aNumber'>",
  4479. referencedClasses: [],
  4480. messageSends: []
  4481. }),
  4482. $globals.Number);
  4483. $core.addMethod(
  4484. $core.method({
  4485. selector: "@",
  4486. protocol: "converting",
  4487. fn: function (aNumber){
  4488. var self=this;
  4489. return $core.withContext(function($ctx1) {
  4490. return $recv($globals.Point)._x_y_(self,aNumber);
  4491. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  4492. },
  4493. args: ["aNumber"],
  4494. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  4495. referencedClasses: ["Point"],
  4496. messageSends: ["x:y:"]
  4497. }),
  4498. $globals.Number);
  4499. $core.addMethod(
  4500. $core.method({
  4501. selector: "\x5c\x5c",
  4502. protocol: "arithmetic",
  4503. fn: function (aNumber){
  4504. var self=this;
  4505. return $core.withContext(function($ctx1) {
  4506. return self % aNumber;
  4507. return self;
  4508. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  4509. },
  4510. args: ["aNumber"],
  4511. source: "\x5c\x5c aNumber\x0a\x09<inlineJS: 'return self % aNumber'>",
  4512. referencedClasses: [],
  4513. messageSends: []
  4514. }),
  4515. $globals.Number);
  4516. $core.addMethod(
  4517. $core.method({
  4518. selector: "abs",
  4519. protocol: "arithmetic",
  4520. fn: function (){
  4521. var self=this;
  4522. return $core.withContext(function($ctx1) {
  4523. return Math.abs(self);;
  4524. return self;
  4525. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  4526. },
  4527. args: [],
  4528. source: "abs\x0a\x09<inlineJS: 'return Math.abs(self);'>",
  4529. referencedClasses: [],
  4530. messageSends: []
  4531. }),
  4532. $globals.Number);
  4533. $core.addMethod(
  4534. $core.method({
  4535. selector: "arcCos",
  4536. protocol: "mathematical functions",
  4537. fn: function (){
  4538. var self=this;
  4539. return $core.withContext(function($ctx1) {
  4540. return Math.acos(self);;
  4541. return self;
  4542. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  4543. },
  4544. args: [],
  4545. source: "arcCos\x0a\x09<inlineJS: 'return Math.acos(self);'>",
  4546. referencedClasses: [],
  4547. messageSends: []
  4548. }),
  4549. $globals.Number);
  4550. $core.addMethod(
  4551. $core.method({
  4552. selector: "arcSin",
  4553. protocol: "mathematical functions",
  4554. fn: function (){
  4555. var self=this;
  4556. return $core.withContext(function($ctx1) {
  4557. return Math.asin(self);;
  4558. return self;
  4559. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  4560. },
  4561. args: [],
  4562. source: "arcSin\x0a\x09<inlineJS: 'return Math.asin(self);'>",
  4563. referencedClasses: [],
  4564. messageSends: []
  4565. }),
  4566. $globals.Number);
  4567. $core.addMethod(
  4568. $core.method({
  4569. selector: "arcTan",
  4570. protocol: "mathematical functions",
  4571. fn: function (){
  4572. var self=this;
  4573. return $core.withContext(function($ctx1) {
  4574. return Math.atan(self);;
  4575. return self;
  4576. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  4577. },
  4578. args: [],
  4579. source: "arcTan\x0a\x09<inlineJS: 'return Math.atan(self);'>",
  4580. referencedClasses: [],
  4581. messageSends: []
  4582. }),
  4583. $globals.Number);
  4584. $core.addMethod(
  4585. $core.method({
  4586. selector: "asJavaScriptObject",
  4587. protocol: "converting",
  4588. fn: function (){
  4589. var self=this;
  4590. return self;
  4591. },
  4592. args: [],
  4593. source: "asJavaScriptObject\x0a\x09^ self",
  4594. referencedClasses: [],
  4595. messageSends: []
  4596. }),
  4597. $globals.Number);
  4598. $core.addMethod(
  4599. $core.method({
  4600. selector: "asJavaScriptSource",
  4601. protocol: "converting",
  4602. fn: function (){
  4603. var self=this;
  4604. return $core.withContext(function($ctx1) {
  4605. var $1;
  4606. $1=$recv("(".__comma(self._printString())).__comma(")");
  4607. $ctx1.sendIdx[","]=1;
  4608. return $1;
  4609. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Number)});
  4610. },
  4611. args: [],
  4612. source: "asJavaScriptSource\x0a\x09^ '(', self printString, ')'",
  4613. referencedClasses: [],
  4614. messageSends: [",", "printString"]
  4615. }),
  4616. $globals.Number);
  4617. $core.addMethod(
  4618. $core.method({
  4619. selector: "asNumber",
  4620. protocol: "converting",
  4621. fn: function (){
  4622. var self=this;
  4623. return self;
  4624. },
  4625. args: [],
  4626. source: "asNumber\x0a\x09^ self",
  4627. referencedClasses: [],
  4628. messageSends: []
  4629. }),
  4630. $globals.Number);
  4631. $core.addMethod(
  4632. $core.method({
  4633. selector: "asPoint",
  4634. protocol: "converting",
  4635. fn: function (){
  4636. var self=this;
  4637. return $core.withContext(function($ctx1) {
  4638. return $recv($globals.Point)._x_y_(self,self);
  4639. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  4640. },
  4641. args: [],
  4642. source: "asPoint\x0a\x09^ Point x: self y: self",
  4643. referencedClasses: ["Point"],
  4644. messageSends: ["x:y:"]
  4645. }),
  4646. $globals.Number);
  4647. $core.addMethod(
  4648. $core.method({
  4649. selector: "asString",
  4650. protocol: "converting",
  4651. fn: function (){
  4652. var self=this;
  4653. return $core.withContext(function($ctx1) {
  4654. return String(self);
  4655. return self;
  4656. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  4657. },
  4658. args: [],
  4659. source: "asString\x0a\x09<inlineJS: 'return String(self)'>",
  4660. referencedClasses: [],
  4661. messageSends: []
  4662. }),
  4663. $globals.Number);
  4664. $core.addMethod(
  4665. $core.method({
  4666. selector: "atRandom",
  4667. protocol: "converting",
  4668. fn: function (){
  4669. var self=this;
  4670. return $core.withContext(function($ctx1) {
  4671. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  4672. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  4673. },
  4674. args: [],
  4675. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  4676. referencedClasses: ["Random"],
  4677. messageSends: ["+", "truncated", "*", "next", "new"]
  4678. }),
  4679. $globals.Number);
  4680. $core.addMethod(
  4681. $core.method({
  4682. selector: "ceiling",
  4683. protocol: "converting",
  4684. fn: function (){
  4685. var self=this;
  4686. return $core.withContext(function($ctx1) {
  4687. return Math.ceil(self);;
  4688. return self;
  4689. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  4690. },
  4691. args: [],
  4692. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  4693. referencedClasses: [],
  4694. messageSends: []
  4695. }),
  4696. $globals.Number);
  4697. $core.addMethod(
  4698. $core.method({
  4699. selector: "copy",
  4700. protocol: "copying",
  4701. fn: function (){
  4702. var self=this;
  4703. return self;
  4704. },
  4705. args: [],
  4706. source: "copy\x0a\x09^ self",
  4707. referencedClasses: [],
  4708. messageSends: []
  4709. }),
  4710. $globals.Number);
  4711. $core.addMethod(
  4712. $core.method({
  4713. selector: "cos",
  4714. protocol: "mathematical functions",
  4715. fn: function (){
  4716. var self=this;
  4717. return $core.withContext(function($ctx1) {
  4718. return Math.cos(self);;
  4719. return self;
  4720. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  4721. },
  4722. args: [],
  4723. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  4724. referencedClasses: [],
  4725. messageSends: []
  4726. }),
  4727. $globals.Number);
  4728. $core.addMethod(
  4729. $core.method({
  4730. selector: "deepCopy",
  4731. protocol: "copying",
  4732. fn: function (){
  4733. var self=this;
  4734. return $core.withContext(function($ctx1) {
  4735. return self._copy();
  4736. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  4737. },
  4738. args: [],
  4739. source: "deepCopy\x0a\x09^ self copy",
  4740. referencedClasses: [],
  4741. messageSends: ["copy"]
  4742. }),
  4743. $globals.Number);
  4744. $core.addMethod(
  4745. $core.method({
  4746. selector: "even",
  4747. protocol: "testing",
  4748. fn: function (){
  4749. var self=this;
  4750. return $core.withContext(function($ctx1) {
  4751. return (0).__eq(self.__backslash_backslash((2)));
  4752. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  4753. },
  4754. args: [],
  4755. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  4756. referencedClasses: [],
  4757. messageSends: ["=", "\x5c\x5c"]
  4758. }),
  4759. $globals.Number);
  4760. $core.addMethod(
  4761. $core.method({
  4762. selector: "floor",
  4763. protocol: "converting",
  4764. fn: function (){
  4765. var self=this;
  4766. return $core.withContext(function($ctx1) {
  4767. return Math.floor(self);;
  4768. return self;
  4769. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  4770. },
  4771. args: [],
  4772. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  4773. referencedClasses: [],
  4774. messageSends: []
  4775. }),
  4776. $globals.Number);
  4777. $core.addMethod(
  4778. $core.method({
  4779. selector: "isImmutable",
  4780. protocol: "testing",
  4781. fn: function (){
  4782. var self=this;
  4783. return true;
  4784. },
  4785. args: [],
  4786. source: "isImmutable\x0a\x09^ true",
  4787. referencedClasses: [],
  4788. messageSends: []
  4789. }),
  4790. $globals.Number);
  4791. $core.addMethod(
  4792. $core.method({
  4793. selector: "isNumber",
  4794. protocol: "testing",
  4795. fn: function (){
  4796. var self=this;
  4797. return true;
  4798. },
  4799. args: [],
  4800. source: "isNumber\x0a\x09^ true",
  4801. referencedClasses: [],
  4802. messageSends: []
  4803. }),
  4804. $globals.Number);
  4805. $core.addMethod(
  4806. $core.method({
  4807. selector: "isZero",
  4808. protocol: "testing",
  4809. fn: function (){
  4810. var self=this;
  4811. return $core.withContext(function($ctx1) {
  4812. return self.__eq((0));
  4813. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  4814. },
  4815. args: [],
  4816. source: "isZero\x0a\x09^ self = 0",
  4817. referencedClasses: [],
  4818. messageSends: ["="]
  4819. }),
  4820. $globals.Number);
  4821. $core.addMethod(
  4822. $core.method({
  4823. selector: "ln",
  4824. protocol: "mathematical functions",
  4825. fn: function (){
  4826. var self=this;
  4827. return $core.withContext(function($ctx1) {
  4828. return Math.log(self);;
  4829. return self;
  4830. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  4831. },
  4832. args: [],
  4833. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  4834. referencedClasses: [],
  4835. messageSends: []
  4836. }),
  4837. $globals.Number);
  4838. $core.addMethod(
  4839. $core.method({
  4840. selector: "log",
  4841. protocol: "mathematical functions",
  4842. fn: function (){
  4843. var self=this;
  4844. return $core.withContext(function($ctx1) {
  4845. return Math.log(self) / Math.LN10;;
  4846. return self;
  4847. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  4848. },
  4849. args: [],
  4850. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  4851. referencedClasses: [],
  4852. messageSends: []
  4853. }),
  4854. $globals.Number);
  4855. $core.addMethod(
  4856. $core.method({
  4857. selector: "log:",
  4858. protocol: "mathematical functions",
  4859. fn: function (aNumber){
  4860. var self=this;
  4861. return $core.withContext(function($ctx1) {
  4862. return Math.log(self) / Math.log(aNumber);;
  4863. return self;
  4864. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  4865. },
  4866. args: ["aNumber"],
  4867. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  4868. referencedClasses: [],
  4869. messageSends: []
  4870. }),
  4871. $globals.Number);
  4872. $core.addMethod(
  4873. $core.method({
  4874. selector: "max:",
  4875. protocol: "arithmetic",
  4876. fn: function (aNumber){
  4877. var self=this;
  4878. return $core.withContext(function($ctx1) {
  4879. return Math.max(self, aNumber);;
  4880. return self;
  4881. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  4882. },
  4883. args: ["aNumber"],
  4884. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  4885. referencedClasses: [],
  4886. messageSends: []
  4887. }),
  4888. $globals.Number);
  4889. $core.addMethod(
  4890. $core.method({
  4891. selector: "min:",
  4892. protocol: "arithmetic",
  4893. fn: function (aNumber){
  4894. var self=this;
  4895. return $core.withContext(function($ctx1) {
  4896. return Math.min(self, aNumber);;
  4897. return self;
  4898. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  4899. },
  4900. args: ["aNumber"],
  4901. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  4902. referencedClasses: [],
  4903. messageSends: []
  4904. }),
  4905. $globals.Number);
  4906. $core.addMethod(
  4907. $core.method({
  4908. selector: "negated",
  4909. protocol: "arithmetic",
  4910. fn: function (){
  4911. var self=this;
  4912. return $core.withContext(function($ctx1) {
  4913. return (0).__minus(self);
  4914. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  4915. },
  4916. args: [],
  4917. source: "negated\x0a\x09^ 0 - self",
  4918. referencedClasses: [],
  4919. messageSends: ["-"]
  4920. }),
  4921. $globals.Number);
  4922. $core.addMethod(
  4923. $core.method({
  4924. selector: "negative",
  4925. protocol: "testing",
  4926. fn: function (){
  4927. var self=this;
  4928. return $core.withContext(function($ctx1) {
  4929. return self.__lt((0));
  4930. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  4931. },
  4932. args: [],
  4933. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  4934. referencedClasses: [],
  4935. messageSends: ["<"]
  4936. }),
  4937. $globals.Number);
  4938. $core.addMethod(
  4939. $core.method({
  4940. selector: "odd",
  4941. protocol: "testing",
  4942. fn: function (){
  4943. var self=this;
  4944. return $core.withContext(function($ctx1) {
  4945. return $recv(self._even())._not();
  4946. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  4947. },
  4948. args: [],
  4949. source: "odd\x0a\x09^ self even not",
  4950. referencedClasses: [],
  4951. messageSends: ["not", "even"]
  4952. }),
  4953. $globals.Number);
  4954. $core.addMethod(
  4955. $core.method({
  4956. selector: "positive",
  4957. protocol: "testing",
  4958. fn: function (){
  4959. var self=this;
  4960. return $core.withContext(function($ctx1) {
  4961. return self.__gt_eq((0));
  4962. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  4963. },
  4964. args: [],
  4965. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  4966. referencedClasses: [],
  4967. messageSends: [">="]
  4968. }),
  4969. $globals.Number);
  4970. $core.addMethod(
  4971. $core.method({
  4972. selector: "printOn:",
  4973. protocol: "printing",
  4974. fn: function (aStream){
  4975. var self=this;
  4976. return $core.withContext(function($ctx1) {
  4977. $recv(aStream)._nextPutAll_(self._asString());
  4978. return self;
  4979. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  4980. },
  4981. args: ["aStream"],
  4982. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4983. referencedClasses: [],
  4984. messageSends: ["nextPutAll:", "asString"]
  4985. }),
  4986. $globals.Number);
  4987. $core.addMethod(
  4988. $core.method({
  4989. selector: "printShowingDecimalPlaces:",
  4990. protocol: "printing",
  4991. fn: function (placesDesired){
  4992. var self=this;
  4993. return $core.withContext(function($ctx1) {
  4994. return self.toFixed(placesDesired);
  4995. return self;
  4996. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  4997. },
  4998. args: ["placesDesired"],
  4999. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  5000. referencedClasses: [],
  5001. messageSends: []
  5002. }),
  5003. $globals.Number);
  5004. $core.addMethod(
  5005. $core.method({
  5006. selector: "raisedTo:",
  5007. protocol: "mathematical functions",
  5008. fn: function (exponent){
  5009. var self=this;
  5010. return $core.withContext(function($ctx1) {
  5011. return Math.pow(self, exponent);;
  5012. return self;
  5013. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  5014. },
  5015. args: ["exponent"],
  5016. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  5017. referencedClasses: [],
  5018. messageSends: []
  5019. }),
  5020. $globals.Number);
  5021. $core.addMethod(
  5022. $core.method({
  5023. selector: "rounded",
  5024. protocol: "converting",
  5025. fn: function (){
  5026. var self=this;
  5027. return $core.withContext(function($ctx1) {
  5028. return Math.round(self);;
  5029. return self;
  5030. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  5031. },
  5032. args: [],
  5033. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  5034. referencedClasses: [],
  5035. messageSends: []
  5036. }),
  5037. $globals.Number);
  5038. $core.addMethod(
  5039. $core.method({
  5040. selector: "sign",
  5041. protocol: "mathematical functions",
  5042. fn: function (){
  5043. var self=this;
  5044. return $core.withContext(function($ctx1) {
  5045. var $1,$2;
  5046. $1=self._isZero();
  5047. if($core.assert($1)){
  5048. return (0);
  5049. }
  5050. $2=self._positive();
  5051. if($core.assert($2)){
  5052. return (1);
  5053. } else {
  5054. return (-1);
  5055. }
  5056. return self;
  5057. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  5058. },
  5059. args: [],
  5060. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  5061. referencedClasses: [],
  5062. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  5063. }),
  5064. $globals.Number);
  5065. $core.addMethod(
  5066. $core.method({
  5067. selector: "sin",
  5068. protocol: "mathematical functions",
  5069. fn: function (){
  5070. var self=this;
  5071. return $core.withContext(function($ctx1) {
  5072. return Math.sin(self);;
  5073. return self;
  5074. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  5075. },
  5076. args: [],
  5077. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  5078. referencedClasses: [],
  5079. messageSends: []
  5080. }),
  5081. $globals.Number);
  5082. $core.addMethod(
  5083. $core.method({
  5084. selector: "sqrt",
  5085. protocol: "mathematical functions",
  5086. fn: function (){
  5087. var self=this;
  5088. return $core.withContext(function($ctx1) {
  5089. return Math.sqrt(self);
  5090. return self;
  5091. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  5092. },
  5093. args: [],
  5094. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  5095. referencedClasses: [],
  5096. messageSends: []
  5097. }),
  5098. $globals.Number);
  5099. $core.addMethod(
  5100. $core.method({
  5101. selector: "squared",
  5102. protocol: "mathematical functions",
  5103. fn: function (){
  5104. var self=this;
  5105. return $core.withContext(function($ctx1) {
  5106. return self.__star(self);
  5107. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  5108. },
  5109. args: [],
  5110. source: "squared\x0a\x09^ self * self",
  5111. referencedClasses: [],
  5112. messageSends: ["*"]
  5113. }),
  5114. $globals.Number);
  5115. $core.addMethod(
  5116. $core.method({
  5117. selector: "tan",
  5118. protocol: "mathematical functions",
  5119. fn: function (){
  5120. var self=this;
  5121. return $core.withContext(function($ctx1) {
  5122. return Math.tan(self);;
  5123. return self;
  5124. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  5125. },
  5126. args: [],
  5127. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  5128. referencedClasses: [],
  5129. messageSends: []
  5130. }),
  5131. $globals.Number);
  5132. $core.addMethod(
  5133. $core.method({
  5134. selector: "timesRepeat:",
  5135. protocol: "enumerating",
  5136. fn: function (aBlock){
  5137. var self=this;
  5138. var count;
  5139. return $core.withContext(function($ctx1) {
  5140. count=(1);
  5141. $recv((function(){
  5142. return $core.withContext(function($ctx2) {
  5143. return $recv(count).__gt(self);
  5144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5145. }))._whileFalse_((function(){
  5146. return $core.withContext(function($ctx2) {
  5147. $recv(aBlock)._value();
  5148. count=$recv(count).__plus((1));
  5149. return count;
  5150. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5151. }));
  5152. return self;
  5153. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  5154. },
  5155. args: ["aBlock"],
  5156. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  5157. referencedClasses: [],
  5158. messageSends: ["whileFalse:", ">", "value", "+"]
  5159. }),
  5160. $globals.Number);
  5161. $core.addMethod(
  5162. $core.method({
  5163. selector: "to:",
  5164. protocol: "converting",
  5165. fn: function (aNumber){
  5166. var self=this;
  5167. var array,first,last,count;
  5168. return $core.withContext(function($ctx1) {
  5169. first=self._truncated();
  5170. $ctx1.sendIdx["truncated"]=1;
  5171. last=$recv($recv(aNumber)._truncated()).__plus((1));
  5172. $ctx1.sendIdx["+"]=1;
  5173. count=(1);
  5174. array=$recv($globals.Array)._new();
  5175. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  5176. return $core.withContext(function($ctx2) {
  5177. $recv(array)._at_put_(count,first);
  5178. count=$recv(count).__plus((1));
  5179. $ctx2.sendIdx["+"]=2;
  5180. count;
  5181. first=$recv(first).__plus((1));
  5182. return first;
  5183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5184. }));
  5185. return array;
  5186. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  5187. },
  5188. args: ["aNumber"],
  5189. 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",
  5190. referencedClasses: ["Array"],
  5191. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  5192. }),
  5193. $globals.Number);
  5194. $core.addMethod(
  5195. $core.method({
  5196. selector: "to:by:",
  5197. protocol: "converting",
  5198. fn: function (stop,step){
  5199. var self=this;
  5200. var array,value,pos;
  5201. return $core.withContext(function($ctx1) {
  5202. var $1,$2;
  5203. value=self;
  5204. array=$recv($globals.Array)._new();
  5205. pos=(1);
  5206. $1=$recv(step).__eq((0));
  5207. if($core.assert($1)){
  5208. self._error_("step must be non-zero");
  5209. }
  5210. $2=$recv(step).__lt((0));
  5211. if($core.assert($2)){
  5212. $recv((function(){
  5213. return $core.withContext(function($ctx2) {
  5214. return $recv(value).__gt_eq(stop);
  5215. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5216. }))._whileTrue_((function(){
  5217. return $core.withContext(function($ctx2) {
  5218. $recv(array)._at_put_(pos,value);
  5219. $ctx2.sendIdx["at:put:"]=1;
  5220. pos=$recv(pos).__plus((1));
  5221. $ctx2.sendIdx["+"]=1;
  5222. pos;
  5223. value=$recv(value).__plus(step);
  5224. $ctx2.sendIdx["+"]=2;
  5225. return value;
  5226. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5227. }));
  5228. $ctx1.sendIdx["whileTrue:"]=1;
  5229. } else {
  5230. $recv((function(){
  5231. return $core.withContext(function($ctx2) {
  5232. return $recv(value).__lt_eq(stop);
  5233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5234. }))._whileTrue_((function(){
  5235. return $core.withContext(function($ctx2) {
  5236. $recv(array)._at_put_(pos,value);
  5237. pos=$recv(pos).__plus((1));
  5238. $ctx2.sendIdx["+"]=3;
  5239. pos;
  5240. value=$recv(value).__plus(step);
  5241. return value;
  5242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5243. }));
  5244. }
  5245. return array;
  5246. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  5247. },
  5248. args: ["stop", "step"],
  5249. 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",
  5250. referencedClasses: ["Array"],
  5251. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  5252. }),
  5253. $globals.Number);
  5254. $core.addMethod(
  5255. $core.method({
  5256. selector: "to:by:do:",
  5257. protocol: "enumerating",
  5258. fn: function (stop,step,aBlock){
  5259. var self=this;
  5260. var value;
  5261. return $core.withContext(function($ctx1) {
  5262. var $1,$2;
  5263. value=self;
  5264. $1=$recv(step).__eq((0));
  5265. if($core.assert($1)){
  5266. self._error_("step must be non-zero");
  5267. }
  5268. $2=$recv(step).__lt((0));
  5269. if($core.assert($2)){
  5270. $recv((function(){
  5271. return $core.withContext(function($ctx2) {
  5272. return $recv(value).__gt_eq(stop);
  5273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5274. }))._whileTrue_((function(){
  5275. return $core.withContext(function($ctx2) {
  5276. $recv(aBlock)._value_(value);
  5277. $ctx2.sendIdx["value:"]=1;
  5278. value=$recv(value).__plus(step);
  5279. $ctx2.sendIdx["+"]=1;
  5280. return value;
  5281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5282. }));
  5283. $ctx1.sendIdx["whileTrue:"]=1;
  5284. } else {
  5285. $recv((function(){
  5286. return $core.withContext(function($ctx2) {
  5287. return $recv(value).__lt_eq(stop);
  5288. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5289. }))._whileTrue_((function(){
  5290. return $core.withContext(function($ctx2) {
  5291. $recv(aBlock)._value_(value);
  5292. value=$recv(value).__plus(step);
  5293. return value;
  5294. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5295. }));
  5296. }
  5297. return self;
  5298. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  5299. },
  5300. args: ["stop", "step", "aBlock"],
  5301. 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 ]]",
  5302. referencedClasses: [],
  5303. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  5304. }),
  5305. $globals.Number);
  5306. $core.addMethod(
  5307. $core.method({
  5308. selector: "to:do:",
  5309. protocol: "enumerating",
  5310. fn: function (stop,aBlock){
  5311. var self=this;
  5312. var nextValue;
  5313. return $core.withContext(function($ctx1) {
  5314. nextValue=self;
  5315. $recv((function(){
  5316. return $core.withContext(function($ctx2) {
  5317. return $recv(nextValue).__lt_eq(stop);
  5318. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5319. }))._whileTrue_((function(){
  5320. return $core.withContext(function($ctx2) {
  5321. $recv(aBlock)._value_(nextValue);
  5322. nextValue=$recv(nextValue).__plus((1));
  5323. return nextValue;
  5324. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5325. }));
  5326. return self;
  5327. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  5328. },
  5329. args: ["stop", "aBlock"],
  5330. 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 ]",
  5331. referencedClasses: [],
  5332. messageSends: ["whileTrue:", "<=", "value:", "+"]
  5333. }),
  5334. $globals.Number);
  5335. $core.addMethod(
  5336. $core.method({
  5337. selector: "truncated",
  5338. protocol: "converting",
  5339. fn: function (){
  5340. var self=this;
  5341. return $core.withContext(function($ctx1) {
  5342. if(self >= 0) {
  5343. return Math.floor(self);
  5344. } else {
  5345. return Math.floor(self * (-1)) * (-1);
  5346. };
  5347. ;
  5348. return self;
  5349. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  5350. },
  5351. args: [],
  5352. 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'>",
  5353. referencedClasses: [],
  5354. messageSends: []
  5355. }),
  5356. $globals.Number);
  5357. $core.addMethod(
  5358. $core.method({
  5359. selector: "|",
  5360. protocol: "converting",
  5361. fn: function (aNumber){
  5362. var self=this;
  5363. return $core.withContext(function($ctx1) {
  5364. return self | aNumber;
  5365. return self;
  5366. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  5367. },
  5368. args: ["aNumber"],
  5369. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  5370. referencedClasses: [],
  5371. messageSends: []
  5372. }),
  5373. $globals.Number);
  5374. $core.addMethod(
  5375. $core.method({
  5376. selector: "classTag",
  5377. protocol: "accessing",
  5378. fn: function (){
  5379. var self=this;
  5380. return "magnitude";
  5381. },
  5382. args: [],
  5383. 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'",
  5384. referencedClasses: [],
  5385. messageSends: []
  5386. }),
  5387. $globals.Number.klass);
  5388. $core.addMethod(
  5389. $core.method({
  5390. selector: "e",
  5391. protocol: "instance creation",
  5392. fn: function (){
  5393. var self=this;
  5394. return $core.withContext(function($ctx1) {
  5395. return Math.E;;
  5396. return self;
  5397. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.klass)});
  5398. },
  5399. args: [],
  5400. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  5401. referencedClasses: [],
  5402. messageSends: []
  5403. }),
  5404. $globals.Number.klass);
  5405. $core.addMethod(
  5406. $core.method({
  5407. selector: "pi",
  5408. protocol: "instance creation",
  5409. fn: function (){
  5410. var self=this;
  5411. return $core.withContext(function($ctx1) {
  5412. return Math.PI;
  5413. return self;
  5414. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.klass)});
  5415. },
  5416. args: [],
  5417. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  5418. referencedClasses: [],
  5419. messageSends: []
  5420. }),
  5421. $globals.Number.klass);
  5422. $core.addClass("Point", $globals.Object, ["x", "y"], "Kernel-Objects");
  5423. $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";
  5424. $core.addMethod(
  5425. $core.method({
  5426. selector: "*",
  5427. protocol: "arithmetic",
  5428. fn: function (aPoint){
  5429. var self=this;
  5430. return $core.withContext(function($ctx1) {
  5431. var $2,$4,$3,$1,$6,$5;
  5432. $2=self._x();
  5433. $ctx1.sendIdx["x"]=1;
  5434. $4=$recv(aPoint)._asPoint();
  5435. $ctx1.sendIdx["asPoint"]=1;
  5436. $3=$recv($4)._x();
  5437. $1=$recv($2).__star($3);
  5438. $ctx1.sendIdx["*"]=1;
  5439. $6=self._y();
  5440. $ctx1.sendIdx["y"]=1;
  5441. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  5442. return $recv($globals.Point)._x_y_($1,$5);
  5443. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  5444. },
  5445. args: ["aPoint"],
  5446. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  5447. referencedClasses: ["Point"],
  5448. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  5449. }),
  5450. $globals.Point);
  5451. $core.addMethod(
  5452. $core.method({
  5453. selector: "+",
  5454. protocol: "arithmetic",
  5455. fn: function (aPoint){
  5456. var self=this;
  5457. return $core.withContext(function($ctx1) {
  5458. var $2,$4,$3,$1,$6,$5;
  5459. $2=self._x();
  5460. $ctx1.sendIdx["x"]=1;
  5461. $4=$recv(aPoint)._asPoint();
  5462. $ctx1.sendIdx["asPoint"]=1;
  5463. $3=$recv($4)._x();
  5464. $1=$recv($2).__plus($3);
  5465. $ctx1.sendIdx["+"]=1;
  5466. $6=self._y();
  5467. $ctx1.sendIdx["y"]=1;
  5468. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  5469. return $recv($globals.Point)._x_y_($1,$5);
  5470. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  5471. },
  5472. args: ["aPoint"],
  5473. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  5474. referencedClasses: ["Point"],
  5475. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  5476. }),
  5477. $globals.Point);
  5478. $core.addMethod(
  5479. $core.method({
  5480. selector: "-",
  5481. protocol: "arithmetic",
  5482. fn: function (aPoint){
  5483. var self=this;
  5484. return $core.withContext(function($ctx1) {
  5485. var $2,$4,$3,$1,$6,$5;
  5486. $2=self._x();
  5487. $ctx1.sendIdx["x"]=1;
  5488. $4=$recv(aPoint)._asPoint();
  5489. $ctx1.sendIdx["asPoint"]=1;
  5490. $3=$recv($4)._x();
  5491. $1=$recv($2).__minus($3);
  5492. $ctx1.sendIdx["-"]=1;
  5493. $6=self._y();
  5494. $ctx1.sendIdx["y"]=1;
  5495. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  5496. return $recv($globals.Point)._x_y_($1,$5);
  5497. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  5498. },
  5499. args: ["aPoint"],
  5500. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  5501. referencedClasses: ["Point"],
  5502. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  5503. }),
  5504. $globals.Point);
  5505. $core.addMethod(
  5506. $core.method({
  5507. selector: "/",
  5508. protocol: "arithmetic",
  5509. fn: function (aPoint){
  5510. var self=this;
  5511. return $core.withContext(function($ctx1) {
  5512. var $2,$4,$3,$1,$6,$5;
  5513. $2=self._x();
  5514. $ctx1.sendIdx["x"]=1;
  5515. $4=$recv(aPoint)._asPoint();
  5516. $ctx1.sendIdx["asPoint"]=1;
  5517. $3=$recv($4)._x();
  5518. $1=$recv($2).__slash($3);
  5519. $ctx1.sendIdx["/"]=1;
  5520. $6=self._y();
  5521. $ctx1.sendIdx["y"]=1;
  5522. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  5523. return $recv($globals.Point)._x_y_($1,$5);
  5524. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  5525. },
  5526. args: ["aPoint"],
  5527. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  5528. referencedClasses: ["Point"],
  5529. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  5530. }),
  5531. $globals.Point);
  5532. $core.addMethod(
  5533. $core.method({
  5534. selector: "<",
  5535. protocol: "comparing",
  5536. fn: function (aPoint){
  5537. var self=this;
  5538. return $core.withContext(function($ctx1) {
  5539. var $2,$1,$3;
  5540. $2=self._x();
  5541. $ctx1.sendIdx["x"]=1;
  5542. $1=$recv($2).__lt($recv(aPoint)._x());
  5543. $ctx1.sendIdx["<"]=1;
  5544. return $recv($1)._and_((function(){
  5545. return $core.withContext(function($ctx2) {
  5546. $3=self._y();
  5547. $ctx2.sendIdx["y"]=1;
  5548. return $recv($3).__lt($recv(aPoint)._y());
  5549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5550. }));
  5551. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  5552. },
  5553. args: ["aPoint"],
  5554. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  5555. referencedClasses: [],
  5556. messageSends: ["and:", "<", "x", "y"]
  5557. }),
  5558. $globals.Point);
  5559. $core.addMethod(
  5560. $core.method({
  5561. selector: "<=",
  5562. protocol: "comparing",
  5563. fn: function (aPoint){
  5564. var self=this;
  5565. return $core.withContext(function($ctx1) {
  5566. var $2,$1,$3;
  5567. $2=self._x();
  5568. $ctx1.sendIdx["x"]=1;
  5569. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  5570. $ctx1.sendIdx["<="]=1;
  5571. return $recv($1)._and_((function(){
  5572. return $core.withContext(function($ctx2) {
  5573. $3=self._y();
  5574. $ctx2.sendIdx["y"]=1;
  5575. return $recv($3).__lt_eq($recv(aPoint)._y());
  5576. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5577. }));
  5578. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  5579. },
  5580. args: ["aPoint"],
  5581. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  5582. referencedClasses: [],
  5583. messageSends: ["and:", "<=", "x", "y"]
  5584. }),
  5585. $globals.Point);
  5586. $core.addMethod(
  5587. $core.method({
  5588. selector: "=",
  5589. protocol: "comparing",
  5590. fn: function (aPoint){
  5591. var self=this;
  5592. return $core.withContext(function($ctx1) {
  5593. var $2,$1,$4,$3,$6,$5;
  5594. $2=$recv(aPoint)._class();
  5595. $ctx1.sendIdx["class"]=1;
  5596. $1=$recv($2).__eq(self._class());
  5597. $ctx1.sendIdx["="]=1;
  5598. return $recv($1)._and_((function(){
  5599. return $core.withContext(function($ctx2) {
  5600. $4=$recv(aPoint)._x();
  5601. $ctx2.sendIdx["x"]=1;
  5602. $3=$recv($4).__eq(self._x());
  5603. $ctx2.sendIdx["="]=2;
  5604. $6=$recv(aPoint)._y();
  5605. $ctx2.sendIdx["y"]=1;
  5606. $5=$recv($6).__eq(self._y());
  5607. return $recv($3).__and($5);
  5608. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5609. }));
  5610. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  5611. },
  5612. args: ["aPoint"],
  5613. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  5614. referencedClasses: [],
  5615. messageSends: ["and:", "=", "class", "&", "x", "y"]
  5616. }),
  5617. $globals.Point);
  5618. $core.addMethod(
  5619. $core.method({
  5620. selector: ">",
  5621. protocol: "comparing",
  5622. fn: function (aPoint){
  5623. var self=this;
  5624. return $core.withContext(function($ctx1) {
  5625. var $2,$1,$3;
  5626. $2=self._x();
  5627. $ctx1.sendIdx["x"]=1;
  5628. $1=$recv($2).__gt($recv(aPoint)._x());
  5629. $ctx1.sendIdx[">"]=1;
  5630. return $recv($1)._and_((function(){
  5631. return $core.withContext(function($ctx2) {
  5632. $3=self._y();
  5633. $ctx2.sendIdx["y"]=1;
  5634. return $recv($3).__gt($recv(aPoint)._y());
  5635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5636. }));
  5637. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  5638. },
  5639. args: ["aPoint"],
  5640. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  5641. referencedClasses: [],
  5642. messageSends: ["and:", ">", "x", "y"]
  5643. }),
  5644. $globals.Point);
  5645. $core.addMethod(
  5646. $core.method({
  5647. selector: ">=",
  5648. protocol: "comparing",
  5649. fn: function (aPoint){
  5650. var self=this;
  5651. return $core.withContext(function($ctx1) {
  5652. var $2,$1,$3;
  5653. $2=self._x();
  5654. $ctx1.sendIdx["x"]=1;
  5655. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  5656. $ctx1.sendIdx[">="]=1;
  5657. return $recv($1)._and_((function(){
  5658. return $core.withContext(function($ctx2) {
  5659. $3=self._y();
  5660. $ctx2.sendIdx["y"]=1;
  5661. return $recv($3).__gt_eq($recv(aPoint)._y());
  5662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5663. }));
  5664. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  5665. },
  5666. args: ["aPoint"],
  5667. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  5668. referencedClasses: [],
  5669. messageSends: ["and:", ">=", "x", "y"]
  5670. }),
  5671. $globals.Point);
  5672. $core.addMethod(
  5673. $core.method({
  5674. selector: "asPoint",
  5675. protocol: "converting",
  5676. fn: function (){
  5677. var self=this;
  5678. return self;
  5679. },
  5680. args: [],
  5681. source: "asPoint\x0a\x09^ self",
  5682. referencedClasses: [],
  5683. messageSends: []
  5684. }),
  5685. $globals.Point);
  5686. $core.addMethod(
  5687. $core.method({
  5688. selector: "dist:",
  5689. protocol: "transforming",
  5690. fn: function (aPoint){
  5691. var self=this;
  5692. var dx,dy;
  5693. return $core.withContext(function($ctx1) {
  5694. var $2,$1;
  5695. dx=$recv($recv(aPoint)._x()).__minus(self["@x"]);
  5696. $ctx1.sendIdx["-"]=1;
  5697. dy=$recv($recv(aPoint)._y()).__minus(self["@y"]);
  5698. $2=$recv(dx).__star(dx);
  5699. $ctx1.sendIdx["*"]=1;
  5700. $1=$recv($2).__plus($recv(dy).__star(dy));
  5701. return $recv($1)._sqrt();
  5702. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  5703. },
  5704. args: ["aPoint"],
  5705. 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",
  5706. referencedClasses: [],
  5707. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  5708. }),
  5709. $globals.Point);
  5710. $core.addMethod(
  5711. $core.method({
  5712. selector: "printOn:",
  5713. protocol: "printing",
  5714. fn: function (aStream){
  5715. var self=this;
  5716. return $core.withContext(function($ctx1) {
  5717. var $1;
  5718. $recv(self["@x"])._printOn_(aStream);
  5719. $ctx1.sendIdx["printOn:"]=1;
  5720. $recv(aStream)._nextPutAll_("@");
  5721. $1=$recv($recv(self["@y"])._notNil())._and_((function(){
  5722. return $core.withContext(function($ctx2) {
  5723. return $recv(self["@y"])._negative();
  5724. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5725. }));
  5726. if($core.assert($1)){
  5727. $recv(aStream)._space();
  5728. }
  5729. $recv(self["@y"])._printOn_(aStream);
  5730. return self;
  5731. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  5732. },
  5733. args: ["aStream"],
  5734. 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",
  5735. referencedClasses: [],
  5736. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  5737. }),
  5738. $globals.Point);
  5739. $core.addMethod(
  5740. $core.method({
  5741. selector: "translateBy:",
  5742. protocol: "transforming",
  5743. fn: function (delta){
  5744. var self=this;
  5745. return $core.withContext(function($ctx1) {
  5746. var $1;
  5747. $1=$recv($recv(delta)._x()).__plus(self["@x"]);
  5748. $ctx1.sendIdx["+"]=1;
  5749. return $recv($1).__at($recv($recv(delta)._y()).__plus(self["@y"]));
  5750. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  5751. },
  5752. args: ["delta"],
  5753. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  5754. referencedClasses: [],
  5755. messageSends: ["@", "+", "x", "y"]
  5756. }),
  5757. $globals.Point);
  5758. $core.addMethod(
  5759. $core.method({
  5760. selector: "x",
  5761. protocol: "accessing",
  5762. fn: function (){
  5763. var self=this;
  5764. return self["@x"];
  5765. },
  5766. args: [],
  5767. source: "x\x0a\x09^ x",
  5768. referencedClasses: [],
  5769. messageSends: []
  5770. }),
  5771. $globals.Point);
  5772. $core.addMethod(
  5773. $core.method({
  5774. selector: "x:",
  5775. protocol: "accessing",
  5776. fn: function (aNumber){
  5777. var self=this;
  5778. self["@x"]=aNumber;
  5779. return self;
  5780. },
  5781. args: ["aNumber"],
  5782. source: "x: aNumber\x0a\x09x := aNumber",
  5783. referencedClasses: [],
  5784. messageSends: []
  5785. }),
  5786. $globals.Point);
  5787. $core.addMethod(
  5788. $core.method({
  5789. selector: "y",
  5790. protocol: "accessing",
  5791. fn: function (){
  5792. var self=this;
  5793. return self["@y"];
  5794. },
  5795. args: [],
  5796. source: "y\x0a\x09^ y",
  5797. referencedClasses: [],
  5798. messageSends: []
  5799. }),
  5800. $globals.Point);
  5801. $core.addMethod(
  5802. $core.method({
  5803. selector: "y:",
  5804. protocol: "accessing",
  5805. fn: function (aNumber){
  5806. var self=this;
  5807. self["@y"]=aNumber;
  5808. return self;
  5809. },
  5810. args: ["aNumber"],
  5811. source: "y: aNumber\x0a\x09y := aNumber",
  5812. referencedClasses: [],
  5813. messageSends: []
  5814. }),
  5815. $globals.Point);
  5816. $core.addMethod(
  5817. $core.method({
  5818. selector: "classTag",
  5819. protocol: "accessing",
  5820. fn: function (){
  5821. var self=this;
  5822. return "magnitude";
  5823. },
  5824. args: [],
  5825. 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'",
  5826. referencedClasses: [],
  5827. messageSends: []
  5828. }),
  5829. $globals.Point.klass);
  5830. $core.addMethod(
  5831. $core.method({
  5832. selector: "x:y:",
  5833. protocol: "instance creation",
  5834. fn: function (aNumber,anotherNumber){
  5835. var self=this;
  5836. return $core.withContext(function($ctx1) {
  5837. var $1;
  5838. $1=self._new();
  5839. $recv($1)._x_(aNumber);
  5840. $recv($1)._y_(anotherNumber);
  5841. return $recv($1)._yourself();
  5842. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.klass)});
  5843. },
  5844. args: ["aNumber", "anotherNumber"],
  5845. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  5846. referencedClasses: [],
  5847. messageSends: ["x:", "new", "y:", "yourself"]
  5848. }),
  5849. $globals.Point.klass);
  5850. $core.addClass("Random", $globals.Object, [], "Kernel-Objects");
  5851. $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'`.";
  5852. $core.addMethod(
  5853. $core.method({
  5854. selector: "next",
  5855. protocol: "accessing",
  5856. fn: function (){
  5857. var self=this;
  5858. return $core.withContext(function($ctx1) {
  5859. return Math.random();
  5860. return self;
  5861. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  5862. },
  5863. args: [],
  5864. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  5865. referencedClasses: [],
  5866. messageSends: []
  5867. }),
  5868. $globals.Random);
  5869. $core.addMethod(
  5870. $core.method({
  5871. selector: "next:",
  5872. protocol: "accessing",
  5873. fn: function (anInteger){
  5874. var self=this;
  5875. return $core.withContext(function($ctx1) {
  5876. return $recv((1)._to_(anInteger))._collect_((function(each){
  5877. return $core.withContext(function($ctx2) {
  5878. return self._next();
  5879. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5880. }));
  5881. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  5882. },
  5883. args: ["anInteger"],
  5884. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  5885. referencedClasses: [],
  5886. messageSends: ["collect:", "to:", "next"]
  5887. }),
  5888. $globals.Random);
  5889. $core.addClass("UndefinedObject", $globals.Object, [], "Kernel-Objects");
  5890. $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`.";
  5891. $core.addMethod(
  5892. $core.method({
  5893. selector: "asJavaScriptObject",
  5894. protocol: "converting",
  5895. fn: function (){
  5896. var self=this;
  5897. return null;
  5898. },
  5899. args: [],
  5900. source: "asJavaScriptObject\x0a\x09^ null",
  5901. referencedClasses: [],
  5902. messageSends: []
  5903. }),
  5904. $globals.UndefinedObject);
  5905. $core.addMethod(
  5906. $core.method({
  5907. selector: "deepCopy",
  5908. protocol: "copying",
  5909. fn: function (){
  5910. var self=this;
  5911. return self;
  5912. },
  5913. args: [],
  5914. source: "deepCopy\x0a\x09^ self",
  5915. referencedClasses: [],
  5916. messageSends: []
  5917. }),
  5918. $globals.UndefinedObject);
  5919. $core.addMethod(
  5920. $core.method({
  5921. selector: "ifNil:",
  5922. protocol: "testing",
  5923. fn: function (aBlock){
  5924. var self=this;
  5925. return $core.withContext(function($ctx1) {
  5926. return self._ifNil_ifNotNil_(aBlock,(function(){
  5927. }));
  5928. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  5929. },
  5930. args: ["aBlock"],
  5931. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  5932. referencedClasses: [],
  5933. messageSends: ["ifNil:ifNotNil:"]
  5934. }),
  5935. $globals.UndefinedObject);
  5936. $core.addMethod(
  5937. $core.method({
  5938. selector: "ifNil:ifNotNil:",
  5939. protocol: "testing",
  5940. fn: function (aBlock,anotherBlock){
  5941. var self=this;
  5942. return $core.withContext(function($ctx1) {
  5943. return $recv(aBlock)._value();
  5944. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5945. },
  5946. args: ["aBlock", "anotherBlock"],
  5947. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  5948. referencedClasses: [],
  5949. messageSends: ["value"]
  5950. }),
  5951. $globals.UndefinedObject);
  5952. $core.addMethod(
  5953. $core.method({
  5954. selector: "ifNotNil:",
  5955. protocol: "testing",
  5956. fn: function (aBlock){
  5957. var self=this;
  5958. return self;
  5959. },
  5960. args: ["aBlock"],
  5961. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  5962. referencedClasses: [],
  5963. messageSends: []
  5964. }),
  5965. $globals.UndefinedObject);
  5966. $core.addMethod(
  5967. $core.method({
  5968. selector: "ifNotNil:ifNil:",
  5969. protocol: "testing",
  5970. fn: function (aBlock,anotherBlock){
  5971. var self=this;
  5972. return $core.withContext(function($ctx1) {
  5973. return $recv(anotherBlock)._value();
  5974. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5975. },
  5976. args: ["aBlock", "anotherBlock"],
  5977. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  5978. referencedClasses: [],
  5979. messageSends: ["value"]
  5980. }),
  5981. $globals.UndefinedObject);
  5982. $core.addMethod(
  5983. $core.method({
  5984. selector: "isImmutable",
  5985. protocol: "testing",
  5986. fn: function (){
  5987. var self=this;
  5988. return true;
  5989. },
  5990. args: [],
  5991. source: "isImmutable\x0a\x09^ true",
  5992. referencedClasses: [],
  5993. messageSends: []
  5994. }),
  5995. $globals.UndefinedObject);
  5996. $core.addMethod(
  5997. $core.method({
  5998. selector: "isNil",
  5999. protocol: "testing",
  6000. fn: function (){
  6001. var self=this;
  6002. return true;
  6003. },
  6004. args: [],
  6005. source: "isNil\x0a\x09^ true",
  6006. referencedClasses: [],
  6007. messageSends: []
  6008. }),
  6009. $globals.UndefinedObject);
  6010. $core.addMethod(
  6011. $core.method({
  6012. selector: "notNil",
  6013. protocol: "testing",
  6014. fn: function (){
  6015. var self=this;
  6016. return false;
  6017. },
  6018. args: [],
  6019. source: "notNil\x0a\x09^ false",
  6020. referencedClasses: [],
  6021. messageSends: []
  6022. }),
  6023. $globals.UndefinedObject);
  6024. $core.addMethod(
  6025. $core.method({
  6026. selector: "printOn:",
  6027. protocol: "printing",
  6028. fn: function (aStream){
  6029. var self=this;
  6030. return $core.withContext(function($ctx1) {
  6031. $recv(aStream)._nextPutAll_("nil");
  6032. return self;
  6033. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  6034. },
  6035. args: ["aStream"],
  6036. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  6037. referencedClasses: [],
  6038. messageSends: ["nextPutAll:"]
  6039. }),
  6040. $globals.UndefinedObject);
  6041. $core.addMethod(
  6042. $core.method({
  6043. selector: "shallowCopy",
  6044. protocol: "copying",
  6045. fn: function (){
  6046. var self=this;
  6047. return self;
  6048. },
  6049. args: [],
  6050. source: "shallowCopy\x0a\x09^ self",
  6051. referencedClasses: [],
  6052. messageSends: []
  6053. }),
  6054. $globals.UndefinedObject);
  6055. $core.addMethod(
  6056. $core.method({
  6057. selector: "new",
  6058. protocol: "instance creation",
  6059. fn: function (){
  6060. var self=this;
  6061. return $core.withContext(function($ctx1) {
  6062. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  6063. return self;
  6064. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.klass)});
  6065. },
  6066. args: [],
  6067. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  6068. referencedClasses: [],
  6069. messageSends: ["error:"]
  6070. }),
  6071. $globals.UndefinedObject.klass);
  6072. });
  6073. define('amber_core/Kernel-Collections',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  6074. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  6075. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  6076. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  6077. $core.addPackage("Kernel-Collections");
  6078. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  6079. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  6080. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  6081. $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:`";
  6082. $core.addMethod(
  6083. $core.method({
  6084. selector: "=",
  6085. protocol: "comparing",
  6086. fn: function (anAssociation){
  6087. var self=this;
  6088. return $core.withContext(function($ctx1) {
  6089. var $3,$2,$5,$4,$6,$1;
  6090. $3=self._class();
  6091. $ctx1.sendIdx["class"]=1;
  6092. $2=$recv($3).__eq($recv(anAssociation)._class());
  6093. $ctx1.sendIdx["="]=1;
  6094. $1=$recv($2)._and_((function(){
  6095. return $core.withContext(function($ctx2) {
  6096. $5=self._key();
  6097. $ctx2.sendIdx["key"]=1;
  6098. $4=$recv($5).__eq($recv(anAssociation)._key());
  6099. $ctx2.sendIdx["="]=2;
  6100. return $recv($4)._and_((function(){
  6101. return $core.withContext(function($ctx3) {
  6102. $6=self._value();
  6103. $ctx3.sendIdx["value"]=1;
  6104. return $recv($6).__eq($recv(anAssociation)._value());
  6105. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6106. }));
  6107. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6108. }));
  6109. $ctx1.sendIdx["and:"]=1;
  6110. return $1;
  6111. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  6112. },
  6113. args: ["anAssociation"],
  6114. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  6115. referencedClasses: [],
  6116. messageSends: ["and:", "=", "class", "key", "value"]
  6117. }),
  6118. $globals.Association);
  6119. $core.addMethod(
  6120. $core.method({
  6121. selector: "key",
  6122. protocol: "accessing",
  6123. fn: function (){
  6124. var self=this;
  6125. return self["@key"];
  6126. },
  6127. args: [],
  6128. source: "key\x0a\x09^ key",
  6129. referencedClasses: [],
  6130. messageSends: []
  6131. }),
  6132. $globals.Association);
  6133. $core.addMethod(
  6134. $core.method({
  6135. selector: "key:",
  6136. protocol: "accessing",
  6137. fn: function (aKey){
  6138. var self=this;
  6139. self["@key"]=aKey;
  6140. return self;
  6141. },
  6142. args: ["aKey"],
  6143. source: "key: aKey\x0a\x09key := aKey",
  6144. referencedClasses: [],
  6145. messageSends: []
  6146. }),
  6147. $globals.Association);
  6148. $core.addMethod(
  6149. $core.method({
  6150. selector: "printOn:",
  6151. protocol: "printing",
  6152. fn: function (aStream){
  6153. var self=this;
  6154. return $core.withContext(function($ctx1) {
  6155. $recv(self._key())._printOn_(aStream);
  6156. $ctx1.sendIdx["printOn:"]=1;
  6157. $recv(aStream)._nextPutAll_(" -> ");
  6158. $recv(self._value())._printOn_(aStream);
  6159. return self;
  6160. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  6161. },
  6162. args: ["aStream"],
  6163. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  6164. referencedClasses: [],
  6165. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  6166. }),
  6167. $globals.Association);
  6168. $core.addMethod(
  6169. $core.method({
  6170. selector: "value",
  6171. protocol: "accessing",
  6172. fn: function (){
  6173. var self=this;
  6174. return self["@value"];
  6175. },
  6176. args: [],
  6177. source: "value\x0a\x09^ value",
  6178. referencedClasses: [],
  6179. messageSends: []
  6180. }),
  6181. $globals.Association);
  6182. $core.addMethod(
  6183. $core.method({
  6184. selector: "value:",
  6185. protocol: "accessing",
  6186. fn: function (aValue){
  6187. var self=this;
  6188. self["@value"]=aValue;
  6189. return self;
  6190. },
  6191. args: ["aValue"],
  6192. source: "value: aValue\x0a\x09value := aValue",
  6193. referencedClasses: [],
  6194. messageSends: []
  6195. }),
  6196. $globals.Association);
  6197. $core.addMethod(
  6198. $core.method({
  6199. selector: "key:value:",
  6200. protocol: "instance creation",
  6201. fn: function (aKey,aValue){
  6202. var self=this;
  6203. return $core.withContext(function($ctx1) {
  6204. var $1;
  6205. $1=self._new();
  6206. $recv($1)._key_(aKey);
  6207. $recv($1)._value_(aValue);
  6208. return $recv($1)._yourself();
  6209. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.klass)});
  6210. },
  6211. args: ["aKey", "aValue"],
  6212. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  6213. referencedClasses: [],
  6214. messageSends: ["key:", "new", "value:", "yourself"]
  6215. }),
  6216. $globals.Association.klass);
  6217. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  6218. $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`.";
  6219. $core.addMethod(
  6220. $core.method({
  6221. selector: "bucketOfElement:",
  6222. protocol: "accessing",
  6223. fn: function (anObject){
  6224. var self=this;
  6225. return $core.withContext(function($ctx1) {
  6226. var hash = self['@hashBlock'](anObject);
  6227. if (!hash) return null;
  6228. var buckets = self['@buckets'],
  6229. bucket = buckets[hash];
  6230. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  6231. return bucket;
  6232. ;
  6233. return self;
  6234. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  6235. },
  6236. args: ["anObject"],
  6237. 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'>",
  6238. referencedClasses: [],
  6239. messageSends: []
  6240. }),
  6241. $globals.BucketStore);
  6242. $core.addMethod(
  6243. $core.method({
  6244. selector: "do:",
  6245. protocol: "enumerating",
  6246. fn: function (aBlock){
  6247. var self=this;
  6248. return $core.withContext(function($ctx1) {
  6249. var buckets = self['@buckets'];
  6250. var keys = Object.keys(buckets);
  6251. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  6252. ;
  6253. return self;
  6254. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  6255. },
  6256. args: ["aBlock"],
  6257. 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'>",
  6258. referencedClasses: [],
  6259. messageSends: []
  6260. }),
  6261. $globals.BucketStore);
  6262. $core.addMethod(
  6263. $core.method({
  6264. selector: "hashBlock:",
  6265. protocol: "accessing",
  6266. fn: function (aBlock){
  6267. var self=this;
  6268. self["@hashBlock"]=aBlock;
  6269. return self;
  6270. },
  6271. args: ["aBlock"],
  6272. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  6273. referencedClasses: [],
  6274. messageSends: []
  6275. }),
  6276. $globals.BucketStore);
  6277. $core.addMethod(
  6278. $core.method({
  6279. selector: "initialize",
  6280. protocol: "initialization",
  6281. fn: function (){
  6282. var self=this;
  6283. return $core.withContext(function($ctx1) {
  6284. (
  6285. $ctx1.supercall = true,
  6286. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  6287. $ctx1.supercall = false;
  6288. self._removeAll();
  6289. return self;
  6290. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  6291. },
  6292. args: [],
  6293. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  6294. referencedClasses: [],
  6295. messageSends: ["initialize", "removeAll"]
  6296. }),
  6297. $globals.BucketStore);
  6298. $core.addMethod(
  6299. $core.method({
  6300. selector: "newBucket",
  6301. protocol: "private",
  6302. fn: function (){
  6303. var self=this;
  6304. return $core.withContext(function($ctx1) {
  6305. self._subclassResponsibility();
  6306. return self;
  6307. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  6308. },
  6309. args: [],
  6310. source: "newBucket\x0a\x09self subclassResponsibility",
  6311. referencedClasses: [],
  6312. messageSends: ["subclassResponsibility"]
  6313. }),
  6314. $globals.BucketStore);
  6315. $core.addMethod(
  6316. $core.method({
  6317. selector: "removeAll",
  6318. protocol: "adding/removing",
  6319. fn: function (){
  6320. var self=this;
  6321. return $core.withContext(function($ctx1) {
  6322. self['@buckets'] = Object.create(null);;
  6323. return self;
  6324. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  6325. },
  6326. args: [],
  6327. source: "removeAll\x0a\x09<inlineJS: 'self[''@buckets''] = Object.create(null);'>",
  6328. referencedClasses: [],
  6329. messageSends: []
  6330. }),
  6331. $globals.BucketStore);
  6332. $core.addMethod(
  6333. $core.method({
  6334. selector: "hashBlock:",
  6335. protocol: "instance creation",
  6336. fn: function (aBlock){
  6337. var self=this;
  6338. return $core.withContext(function($ctx1) {
  6339. var $1;
  6340. $1=self._new();
  6341. $recv($1)._hashBlock_(aBlock);
  6342. return $recv($1)._yourself();
  6343. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.klass)});
  6344. },
  6345. args: ["aBlock"],
  6346. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  6347. referencedClasses: [],
  6348. messageSends: ["hashBlock:", "new", "yourself"]
  6349. }),
  6350. $globals.BucketStore.klass);
  6351. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  6352. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  6353. $core.addMethod(
  6354. $core.method({
  6355. selector: "newBucket",
  6356. protocol: "private",
  6357. fn: function (){
  6358. var self=this;
  6359. return [];
  6360. },
  6361. args: [],
  6362. source: "newBucket\x0a\x09^ #()",
  6363. referencedClasses: [],
  6364. messageSends: []
  6365. }),
  6366. $globals.ArrayBucketStore);
  6367. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  6368. $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.";
  6369. $core.addMethod(
  6370. $core.method({
  6371. selector: ",",
  6372. protocol: "copying",
  6373. fn: function (aCollection){
  6374. var self=this;
  6375. return $core.withContext(function($ctx1) {
  6376. var $1;
  6377. $1=self._copy();
  6378. $recv($1)._addAll_(aCollection);
  6379. return $recv($1)._yourself();
  6380. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  6381. },
  6382. args: ["aCollection"],
  6383. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  6384. referencedClasses: [],
  6385. messageSends: ["addAll:", "copy", "yourself"]
  6386. }),
  6387. $globals.Collection);
  6388. $core.addMethod(
  6389. $core.method({
  6390. selector: "add:",
  6391. protocol: "adding/removing",
  6392. fn: function (anObject){
  6393. var self=this;
  6394. return $core.withContext(function($ctx1) {
  6395. self._subclassResponsibility();
  6396. return self;
  6397. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  6398. },
  6399. args: ["anObject"],
  6400. source: "add: anObject\x0a\x09self subclassResponsibility",
  6401. referencedClasses: [],
  6402. messageSends: ["subclassResponsibility"]
  6403. }),
  6404. $globals.Collection);
  6405. $core.addMethod(
  6406. $core.method({
  6407. selector: "addAll:",
  6408. protocol: "adding/removing",
  6409. fn: function (aCollection){
  6410. var self=this;
  6411. return $core.withContext(function($ctx1) {
  6412. $recv(aCollection)._do_((function(each){
  6413. return $core.withContext(function($ctx2) {
  6414. return self._add_(each);
  6415. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6416. }));
  6417. return aCollection;
  6418. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  6419. },
  6420. args: ["aCollection"],
  6421. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  6422. referencedClasses: [],
  6423. messageSends: ["do:", "add:"]
  6424. }),
  6425. $globals.Collection);
  6426. $core.addMethod(
  6427. $core.method({
  6428. selector: "allSatisfy:",
  6429. protocol: "enumerating",
  6430. fn: function (aBlock){
  6431. var self=this;
  6432. return $core.withContext(function($ctx1) {
  6433. var $1;
  6434. var $early={};
  6435. try {
  6436. self._do_((function(each){
  6437. return $core.withContext(function($ctx2) {
  6438. $1=$recv(aBlock)._value_(each);
  6439. if(!$core.assert($1)){
  6440. throw $early=[false];
  6441. }
  6442. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6443. }));
  6444. return true;
  6445. }
  6446. catch(e) {if(e===$early)return e[0]; throw e}
  6447. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  6448. },
  6449. args: ["aBlock"],
  6450. 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",
  6451. referencedClasses: [],
  6452. messageSends: ["do:", "ifFalse:", "value:"]
  6453. }),
  6454. $globals.Collection);
  6455. $core.addMethod(
  6456. $core.method({
  6457. selector: "anyOne",
  6458. protocol: "accessing",
  6459. fn: function (){
  6460. var self=this;
  6461. return $core.withContext(function($ctx1) {
  6462. var $early={};
  6463. try {
  6464. self._ifEmpty_((function(){
  6465. return $core.withContext(function($ctx2) {
  6466. return self._error_("Collection is empty");
  6467. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6468. }));
  6469. self._do_((function(each){
  6470. throw $early=[each];
  6471. }));
  6472. return self;
  6473. }
  6474. catch(e) {if(e===$early)return e[0]; throw e}
  6475. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  6476. },
  6477. args: [],
  6478. 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 ]",
  6479. referencedClasses: [],
  6480. messageSends: ["ifEmpty:", "error:", "do:"]
  6481. }),
  6482. $globals.Collection);
  6483. $core.addMethod(
  6484. $core.method({
  6485. selector: "anySatisfy:",
  6486. protocol: "enumerating",
  6487. fn: function (aBlock){
  6488. var self=this;
  6489. return $core.withContext(function($ctx1) {
  6490. var $1;
  6491. var $early={};
  6492. try {
  6493. self._do_((function(each){
  6494. return $core.withContext(function($ctx2) {
  6495. $1=$recv(aBlock)._value_(each);
  6496. if($core.assert($1)){
  6497. throw $early=[true];
  6498. }
  6499. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6500. }));
  6501. return false;
  6502. }
  6503. catch(e) {if(e===$early)return e[0]; throw e}
  6504. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  6505. },
  6506. args: ["aBlock"],
  6507. 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",
  6508. referencedClasses: [],
  6509. messageSends: ["do:", "ifTrue:", "value:"]
  6510. }),
  6511. $globals.Collection);
  6512. $core.addMethod(
  6513. $core.method({
  6514. selector: "asArray",
  6515. protocol: "converting",
  6516. fn: function (){
  6517. var self=this;
  6518. return $core.withContext(function($ctx1) {
  6519. return $recv($globals.Array)._withAll_(self);
  6520. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  6521. },
  6522. args: [],
  6523. source: "asArray\x0a\x09^ Array withAll: self",
  6524. referencedClasses: ["Array"],
  6525. messageSends: ["withAll:"]
  6526. }),
  6527. $globals.Collection);
  6528. $core.addMethod(
  6529. $core.method({
  6530. selector: "asJavaScriptObject",
  6531. protocol: "converting",
  6532. fn: function (){
  6533. var self=this;
  6534. return $core.withContext(function($ctx1) {
  6535. return $recv(self._asArray())._collect_((function(each){
  6536. return $core.withContext(function($ctx2) {
  6537. return $recv(each)._asJavaScriptObject();
  6538. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6539. }));
  6540. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  6541. },
  6542. args: [],
  6543. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  6544. referencedClasses: [],
  6545. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  6546. }),
  6547. $globals.Collection);
  6548. $core.addMethod(
  6549. $core.method({
  6550. selector: "asOrderedCollection",
  6551. protocol: "converting",
  6552. fn: function (){
  6553. var self=this;
  6554. return $core.withContext(function($ctx1) {
  6555. return self._asArray();
  6556. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  6557. },
  6558. args: [],
  6559. source: "asOrderedCollection\x0a\x09^ self asArray",
  6560. referencedClasses: [],
  6561. messageSends: ["asArray"]
  6562. }),
  6563. $globals.Collection);
  6564. $core.addMethod(
  6565. $core.method({
  6566. selector: "asSet",
  6567. protocol: "converting",
  6568. fn: function (){
  6569. var self=this;
  6570. return $core.withContext(function($ctx1) {
  6571. return $recv($globals.Set)._withAll_(self);
  6572. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  6573. },
  6574. args: [],
  6575. source: "asSet\x0a\x09^ Set withAll: self",
  6576. referencedClasses: ["Set"],
  6577. messageSends: ["withAll:"]
  6578. }),
  6579. $globals.Collection);
  6580. $core.addMethod(
  6581. $core.method({
  6582. selector: "collect:",
  6583. protocol: "enumerating",
  6584. fn: function (aBlock){
  6585. var self=this;
  6586. var stream;
  6587. return $core.withContext(function($ctx1) {
  6588. stream=$recv($recv(self._class())._new())._writeStream();
  6589. self._do_((function(each){
  6590. return $core.withContext(function($ctx2) {
  6591. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  6592. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6593. }));
  6594. return $recv(stream)._contents();
  6595. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  6596. },
  6597. args: ["aBlock"],
  6598. 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",
  6599. referencedClasses: [],
  6600. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  6601. }),
  6602. $globals.Collection);
  6603. $core.addMethod(
  6604. $core.method({
  6605. selector: "copyWith:",
  6606. protocol: "copying",
  6607. fn: function (anObject){
  6608. var self=this;
  6609. return $core.withContext(function($ctx1) {
  6610. var $1;
  6611. $1=self._copy();
  6612. $recv($1)._add_(anObject);
  6613. return $recv($1)._yourself();
  6614. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  6615. },
  6616. args: ["anObject"],
  6617. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  6618. referencedClasses: [],
  6619. messageSends: ["add:", "copy", "yourself"]
  6620. }),
  6621. $globals.Collection);
  6622. $core.addMethod(
  6623. $core.method({
  6624. selector: "copyWithAll:",
  6625. protocol: "copying",
  6626. fn: function (aCollection){
  6627. var self=this;
  6628. return $core.withContext(function($ctx1) {
  6629. var $1;
  6630. $1=self._copy();
  6631. $recv($1)._addAll_(aCollection);
  6632. return $recv($1)._yourself();
  6633. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  6634. },
  6635. args: ["aCollection"],
  6636. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  6637. referencedClasses: [],
  6638. messageSends: ["addAll:", "copy", "yourself"]
  6639. }),
  6640. $globals.Collection);
  6641. $core.addMethod(
  6642. $core.method({
  6643. selector: "copyWithout:",
  6644. protocol: "copying",
  6645. fn: function (anObject){
  6646. var self=this;
  6647. return $core.withContext(function($ctx1) {
  6648. return self._reject_((function(each){
  6649. return $core.withContext(function($ctx2) {
  6650. return $recv(each).__eq(anObject);
  6651. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6652. }));
  6653. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  6654. },
  6655. args: ["anObject"],
  6656. 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 ]",
  6657. referencedClasses: [],
  6658. messageSends: ["reject:", "="]
  6659. }),
  6660. $globals.Collection);
  6661. $core.addMethod(
  6662. $core.method({
  6663. selector: "copyWithoutAll:",
  6664. protocol: "copying",
  6665. fn: function (aCollection){
  6666. var self=this;
  6667. return $core.withContext(function($ctx1) {
  6668. return self._reject_((function(each){
  6669. return $core.withContext(function($ctx2) {
  6670. return $recv(aCollection)._includes_(each);
  6671. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6672. }));
  6673. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  6674. },
  6675. args: ["aCollection"],
  6676. 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 ]",
  6677. referencedClasses: [],
  6678. messageSends: ["reject:", "includes:"]
  6679. }),
  6680. $globals.Collection);
  6681. $core.addMethod(
  6682. $core.method({
  6683. selector: "deepCopy",
  6684. protocol: "copying",
  6685. fn: function (){
  6686. var self=this;
  6687. return $core.withContext(function($ctx1) {
  6688. return self._collect_((function(each){
  6689. return $core.withContext(function($ctx2) {
  6690. return $recv(each)._deepCopy();
  6691. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6692. }));
  6693. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  6694. },
  6695. args: [],
  6696. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  6697. referencedClasses: [],
  6698. messageSends: ["collect:", "deepCopy"]
  6699. }),
  6700. $globals.Collection);
  6701. $core.addMethod(
  6702. $core.method({
  6703. selector: "detect:",
  6704. protocol: "enumerating",
  6705. fn: function (aBlock){
  6706. var self=this;
  6707. return $core.withContext(function($ctx1) {
  6708. return self._detect_ifNone_(aBlock,(function(){
  6709. return $core.withContext(function($ctx2) {
  6710. return self._errorNotFound();
  6711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6712. }));
  6713. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  6714. },
  6715. args: ["aBlock"],
  6716. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  6717. referencedClasses: [],
  6718. messageSends: ["detect:ifNone:", "errorNotFound"]
  6719. }),
  6720. $globals.Collection);
  6721. $core.addMethod(
  6722. $core.method({
  6723. selector: "detect:ifNone:",
  6724. protocol: "enumerating",
  6725. fn: function (aBlock,anotherBlock){
  6726. var self=this;
  6727. return $core.withContext(function($ctx1) {
  6728. self._subclassResponsibility();
  6729. return self;
  6730. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  6731. },
  6732. args: ["aBlock", "anotherBlock"],
  6733. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  6734. referencedClasses: [],
  6735. messageSends: ["subclassResponsibility"]
  6736. }),
  6737. $globals.Collection);
  6738. $core.addMethod(
  6739. $core.method({
  6740. selector: "do:",
  6741. protocol: "enumerating",
  6742. fn: function (aBlock){
  6743. var self=this;
  6744. return $core.withContext(function($ctx1) {
  6745. self._subclassResponsibility();
  6746. return self;
  6747. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  6748. },
  6749. args: ["aBlock"],
  6750. source: "do: aBlock\x0a\x09self subclassResponsibility",
  6751. referencedClasses: [],
  6752. messageSends: ["subclassResponsibility"]
  6753. }),
  6754. $globals.Collection);
  6755. $core.addMethod(
  6756. $core.method({
  6757. selector: "do:separatedBy:",
  6758. protocol: "enumerating",
  6759. fn: function (aBlock,anotherBlock){
  6760. var self=this;
  6761. var actionBeforeElement;
  6762. return $core.withContext(function($ctx1) {
  6763. actionBeforeElement=(function(){
  6764. actionBeforeElement=anotherBlock;
  6765. return actionBeforeElement;
  6766. });
  6767. self._do_((function(each){
  6768. return $core.withContext(function($ctx2) {
  6769. $recv(actionBeforeElement)._value();
  6770. return $recv(aBlock)._value_(each);
  6771. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  6772. }));
  6773. return self;
  6774. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  6775. },
  6776. args: ["aBlock", "anotherBlock"],
  6777. 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 ]",
  6778. referencedClasses: [],
  6779. messageSends: ["do:", "value", "value:"]
  6780. }),
  6781. $globals.Collection);
  6782. $core.addMethod(
  6783. $core.method({
  6784. selector: "errorNotFound",
  6785. protocol: "error handling",
  6786. fn: function (){
  6787. var self=this;
  6788. return $core.withContext(function($ctx1) {
  6789. self._error_("Object is not in the collection");
  6790. return self;
  6791. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  6792. },
  6793. args: [],
  6794. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  6795. referencedClasses: [],
  6796. messageSends: ["error:"]
  6797. }),
  6798. $globals.Collection);
  6799. $core.addMethod(
  6800. $core.method({
  6801. selector: "ifEmpty:",
  6802. protocol: "testing",
  6803. fn: function (aBlock){
  6804. var self=this;
  6805. return $core.withContext(function($ctx1) {
  6806. var $1;
  6807. $1=self._isEmpty();
  6808. if($core.assert($1)){
  6809. return $recv(aBlock)._value();
  6810. } else {
  6811. return self;
  6812. }
  6813. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  6814. },
  6815. args: ["aBlock"],
  6816. 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 ]",
  6817. referencedClasses: [],
  6818. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  6819. }),
  6820. $globals.Collection);
  6821. $core.addMethod(
  6822. $core.method({
  6823. selector: "ifEmpty:ifNotEmpty:",
  6824. protocol: "testing",
  6825. fn: function (aBlock,anotherBlock){
  6826. var self=this;
  6827. return $core.withContext(function($ctx1) {
  6828. var $1;
  6829. $1=self._isEmpty();
  6830. if($core.assert($1)){
  6831. return $recv(aBlock)._value();
  6832. } else {
  6833. return $recv(anotherBlock)._value_(self);
  6834. }
  6835. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  6836. },
  6837. args: ["aBlock", "anotherBlock"],
  6838. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  6839. referencedClasses: [],
  6840. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  6841. }),
  6842. $globals.Collection);
  6843. $core.addMethod(
  6844. $core.method({
  6845. selector: "ifNotEmpty:",
  6846. protocol: "testing",
  6847. fn: function (aBlock){
  6848. var self=this;
  6849. return $core.withContext(function($ctx1) {
  6850. var $1;
  6851. $1=self._notEmpty();
  6852. if($core.assert($1)){
  6853. return $recv(aBlock)._value_(self);
  6854. } else {
  6855. return self;
  6856. }
  6857. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  6858. },
  6859. args: ["aBlock"],
  6860. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  6861. referencedClasses: [],
  6862. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  6863. }),
  6864. $globals.Collection);
  6865. $core.addMethod(
  6866. $core.method({
  6867. selector: "ifNotEmpty:ifEmpty:",
  6868. protocol: "testing",
  6869. fn: function (aBlock,anotherBlock){
  6870. var self=this;
  6871. return $core.withContext(function($ctx1) {
  6872. var $1;
  6873. $1=self._notEmpty();
  6874. if($core.assert($1)){
  6875. return $recv(aBlock)._value_(self);
  6876. } else {
  6877. return $recv(anotherBlock)._value();
  6878. }
  6879. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  6880. },
  6881. args: ["aBlock", "anotherBlock"],
  6882. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  6883. referencedClasses: [],
  6884. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  6885. }),
  6886. $globals.Collection);
  6887. $core.addMethod(
  6888. $core.method({
  6889. selector: "includes:",
  6890. protocol: "testing",
  6891. fn: function (anObject){
  6892. var self=this;
  6893. return $core.withContext(function($ctx1) {
  6894. return self._anySatisfy_((function(each){
  6895. return $core.withContext(function($ctx2) {
  6896. return $recv(each).__eq(anObject);
  6897. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6898. }));
  6899. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  6900. },
  6901. args: ["anObject"],
  6902. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  6903. referencedClasses: [],
  6904. messageSends: ["anySatisfy:", "="]
  6905. }),
  6906. $globals.Collection);
  6907. $core.addMethod(
  6908. $core.method({
  6909. selector: "inject:into:",
  6910. protocol: "enumerating",
  6911. fn: function (anObject,aBlock){
  6912. var self=this;
  6913. var result;
  6914. return $core.withContext(function($ctx1) {
  6915. result=anObject;
  6916. self._do_((function(each){
  6917. return $core.withContext(function($ctx2) {
  6918. result=$recv(aBlock)._value_value_(result,each);
  6919. return result;
  6920. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6921. }));
  6922. return result;
  6923. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  6924. },
  6925. args: ["anObject", "aBlock"],
  6926. 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",
  6927. referencedClasses: [],
  6928. messageSends: ["do:", "value:value:"]
  6929. }),
  6930. $globals.Collection);
  6931. $core.addMethod(
  6932. $core.method({
  6933. selector: "intersection:",
  6934. protocol: "enumerating",
  6935. fn: function (aCollection){
  6936. var self=this;
  6937. var set,outputSet;
  6938. return $core.withContext(function($ctx1) {
  6939. var $2,$1;
  6940. set=self._asSet();
  6941. outputSet=$recv($globals.Set)._new();
  6942. $recv(aCollection)._do_((function(each){
  6943. return $core.withContext(function($ctx2) {
  6944. $2=$recv(set)._includes_(each);
  6945. $ctx2.sendIdx["includes:"]=1;
  6946. $1=$recv($2)._and_((function(){
  6947. return $core.withContext(function($ctx3) {
  6948. return $recv($recv(outputSet)._includes_(each))._not();
  6949. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6950. }));
  6951. if($core.assert($1)){
  6952. return $recv(outputSet)._add_(each);
  6953. }
  6954. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6955. }));
  6956. return $recv(self._class())._withAll_($recv(outputSet)._asArray());
  6957. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  6958. },
  6959. args: ["aCollection"],
  6960. 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",
  6961. referencedClasses: ["Set"],
  6962. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  6963. }),
  6964. $globals.Collection);
  6965. $core.addMethod(
  6966. $core.method({
  6967. selector: "isEmpty",
  6968. protocol: "testing",
  6969. fn: function (){
  6970. var self=this;
  6971. return $core.withContext(function($ctx1) {
  6972. return $recv(self._size()).__eq((0));
  6973. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  6974. },
  6975. args: [],
  6976. source: "isEmpty\x0a\x09^ self size = 0",
  6977. referencedClasses: [],
  6978. messageSends: ["=", "size"]
  6979. }),
  6980. $globals.Collection);
  6981. $core.addMethod(
  6982. $core.method({
  6983. selector: "noneSatisfy:",
  6984. protocol: "enumerating",
  6985. fn: function (aBlock){
  6986. var self=this;
  6987. return $core.withContext(function($ctx1) {
  6988. var $1;
  6989. var $early={};
  6990. try {
  6991. self._do_((function(item){
  6992. return $core.withContext(function($ctx2) {
  6993. $1=$recv(aBlock)._value_(item);
  6994. if($core.assert($1)){
  6995. throw $early=[false];
  6996. }
  6997. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  6998. }));
  6999. return true;
  7000. }
  7001. catch(e) {if(e===$early)return e[0]; throw e}
  7002. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  7003. },
  7004. args: ["aBlock"],
  7005. 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",
  7006. referencedClasses: [],
  7007. messageSends: ["do:", "ifTrue:", "value:"]
  7008. }),
  7009. $globals.Collection);
  7010. $core.addMethod(
  7011. $core.method({
  7012. selector: "notEmpty",
  7013. protocol: "testing",
  7014. fn: function (){
  7015. var self=this;
  7016. return $core.withContext(function($ctx1) {
  7017. return $recv(self._isEmpty())._not();
  7018. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  7019. },
  7020. args: [],
  7021. source: "notEmpty\x0a\x09^ self isEmpty not",
  7022. referencedClasses: [],
  7023. messageSends: ["not", "isEmpty"]
  7024. }),
  7025. $globals.Collection);
  7026. $core.addMethod(
  7027. $core.method({
  7028. selector: "occurrencesOf:",
  7029. protocol: "accessing",
  7030. fn: function (anObject){
  7031. var self=this;
  7032. var tally;
  7033. return $core.withContext(function($ctx1) {
  7034. var $1;
  7035. tally=(0);
  7036. self._do_((function(each){
  7037. return $core.withContext(function($ctx2) {
  7038. $1=$recv(anObject).__eq(each);
  7039. if($core.assert($1)){
  7040. tally=$recv(tally).__plus((1));
  7041. return tally;
  7042. }
  7043. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7044. }));
  7045. return tally;
  7046. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  7047. },
  7048. args: ["anObject"],
  7049. 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",
  7050. referencedClasses: [],
  7051. messageSends: ["do:", "ifTrue:", "=", "+"]
  7052. }),
  7053. $globals.Collection);
  7054. $core.addMethod(
  7055. $core.method({
  7056. selector: "putOn:",
  7057. protocol: "streaming",
  7058. fn: function (aStream){
  7059. var self=this;
  7060. return $core.withContext(function($ctx1) {
  7061. self._do_((function(each){
  7062. return $core.withContext(function($ctx2) {
  7063. return $recv(each)._putOn_(aStream);
  7064. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7065. }));
  7066. return self;
  7067. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  7068. },
  7069. args: ["aStream"],
  7070. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  7071. referencedClasses: [],
  7072. messageSends: ["do:", "putOn:"]
  7073. }),
  7074. $globals.Collection);
  7075. $core.addMethod(
  7076. $core.method({
  7077. selector: "reject:",
  7078. protocol: "enumerating",
  7079. fn: function (aBlock){
  7080. var self=this;
  7081. return $core.withContext(function($ctx1) {
  7082. return self._select_((function(each){
  7083. return $core.withContext(function($ctx2) {
  7084. return $recv($recv(aBlock)._value_(each)).__eq(false);
  7085. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7086. }));
  7087. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  7088. },
  7089. args: ["aBlock"],
  7090. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  7091. referencedClasses: [],
  7092. messageSends: ["select:", "=", "value:"]
  7093. }),
  7094. $globals.Collection);
  7095. $core.addMethod(
  7096. $core.method({
  7097. selector: "remove:",
  7098. protocol: "adding/removing",
  7099. fn: function (anObject){
  7100. var self=this;
  7101. return $core.withContext(function($ctx1) {
  7102. return self._remove_ifAbsent_(anObject,(function(){
  7103. return $core.withContext(function($ctx2) {
  7104. return self._errorNotFound();
  7105. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7106. }));
  7107. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  7108. },
  7109. args: ["anObject"],
  7110. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  7111. referencedClasses: [],
  7112. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  7113. }),
  7114. $globals.Collection);
  7115. $core.addMethod(
  7116. $core.method({
  7117. selector: "remove:ifAbsent:",
  7118. protocol: "adding/removing",
  7119. fn: function (anObject,aBlock){
  7120. var self=this;
  7121. return $core.withContext(function($ctx1) {
  7122. self._subclassResponsibility();
  7123. return self;
  7124. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  7125. },
  7126. args: ["anObject", "aBlock"],
  7127. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  7128. referencedClasses: [],
  7129. messageSends: ["subclassResponsibility"]
  7130. }),
  7131. $globals.Collection);
  7132. $core.addMethod(
  7133. $core.method({
  7134. selector: "removeAll",
  7135. protocol: "adding/removing",
  7136. fn: function (){
  7137. var self=this;
  7138. return $core.withContext(function($ctx1) {
  7139. self._subclassResponsibility();
  7140. return self;
  7141. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  7142. },
  7143. args: [],
  7144. source: "removeAll\x0a\x09self subclassResponsibility",
  7145. referencedClasses: [],
  7146. messageSends: ["subclassResponsibility"]
  7147. }),
  7148. $globals.Collection);
  7149. $core.addMethod(
  7150. $core.method({
  7151. selector: "select:",
  7152. protocol: "enumerating",
  7153. fn: function (aBlock){
  7154. var self=this;
  7155. var stream;
  7156. return $core.withContext(function($ctx1) {
  7157. var $1;
  7158. stream=$recv($recv(self._class())._new())._writeStream();
  7159. self._do_((function(each){
  7160. return $core.withContext(function($ctx2) {
  7161. $1=$recv(aBlock)._value_(each);
  7162. if($core.assert($1)){
  7163. return $recv(stream)._nextPut_(each);
  7164. }
  7165. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7166. }));
  7167. return $recv(stream)._contents();
  7168. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  7169. },
  7170. args: ["aBlock"],
  7171. 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",
  7172. referencedClasses: [],
  7173. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  7174. }),
  7175. $globals.Collection);
  7176. $core.addMethod(
  7177. $core.method({
  7178. selector: "select:thenCollect:",
  7179. protocol: "enumerating",
  7180. fn: function (selectBlock,collectBlock){
  7181. var self=this;
  7182. var stream;
  7183. return $core.withContext(function($ctx1) {
  7184. var $1;
  7185. stream=$recv($recv(self._class())._new())._writeStream();
  7186. self._do_((function(each){
  7187. return $core.withContext(function($ctx2) {
  7188. $1=$recv(selectBlock)._value_(each);
  7189. $ctx2.sendIdx["value:"]=1;
  7190. if($core.assert($1)){
  7191. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  7192. }
  7193. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7194. }));
  7195. return $recv(stream)._contents();
  7196. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  7197. },
  7198. args: ["selectBlock", "collectBlock"],
  7199. 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",
  7200. referencedClasses: [],
  7201. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  7202. }),
  7203. $globals.Collection);
  7204. $core.addMethod(
  7205. $core.method({
  7206. selector: "shallowCopy",
  7207. protocol: "copying",
  7208. fn: function (){
  7209. var self=this;
  7210. return $core.withContext(function($ctx1) {
  7211. return self._collect_((function(each){
  7212. return each;
  7213. }));
  7214. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  7215. },
  7216. args: [],
  7217. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  7218. referencedClasses: [],
  7219. messageSends: ["collect:"]
  7220. }),
  7221. $globals.Collection);
  7222. $core.addMethod(
  7223. $core.method({
  7224. selector: "single",
  7225. protocol: "accessing",
  7226. fn: function (){
  7227. var self=this;
  7228. return $core.withContext(function($ctx1) {
  7229. var $1;
  7230. self._ifEmpty_((function(){
  7231. return $core.withContext(function($ctx2) {
  7232. return self._error_("Collection is empty");
  7233. $ctx2.sendIdx["error:"]=1;
  7234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7235. }));
  7236. $1=$recv(self._size()).__gt((1));
  7237. if($core.assert($1)){
  7238. self._error_("Collection holds more than one element");
  7239. }
  7240. return self._anyOne();
  7241. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  7242. },
  7243. args: [],
  7244. 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",
  7245. referencedClasses: [],
  7246. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  7247. }),
  7248. $globals.Collection);
  7249. $core.addMethod(
  7250. $core.method({
  7251. selector: "size",
  7252. protocol: "accessing",
  7253. fn: function (){
  7254. var self=this;
  7255. return $core.withContext(function($ctx1) {
  7256. self._subclassResponsibility();
  7257. return self;
  7258. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  7259. },
  7260. args: [],
  7261. source: "size\x0a\x09self subclassResponsibility",
  7262. referencedClasses: [],
  7263. messageSends: ["subclassResponsibility"]
  7264. }),
  7265. $globals.Collection);
  7266. $core.addMethod(
  7267. $core.method({
  7268. selector: "classTag",
  7269. protocol: "accessing",
  7270. fn: function (){
  7271. var self=this;
  7272. return "collection";
  7273. },
  7274. args: [],
  7275. 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'",
  7276. referencedClasses: [],
  7277. messageSends: []
  7278. }),
  7279. $globals.Collection.klass);
  7280. $core.addMethod(
  7281. $core.method({
  7282. selector: "new:",
  7283. protocol: "instance creation",
  7284. fn: function (anInteger){
  7285. var self=this;
  7286. return $core.withContext(function($ctx1) {
  7287. return self._new();
  7288. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)});
  7289. },
  7290. args: ["anInteger"],
  7291. source: "new: anInteger\x0a\x09^ self new",
  7292. referencedClasses: [],
  7293. messageSends: ["new"]
  7294. }),
  7295. $globals.Collection.klass);
  7296. $core.addMethod(
  7297. $core.method({
  7298. selector: "with:",
  7299. protocol: "instance creation",
  7300. fn: function (anObject){
  7301. var self=this;
  7302. return $core.withContext(function($ctx1) {
  7303. var $1;
  7304. $1=self._new();
  7305. $recv($1)._add_(anObject);
  7306. return $recv($1)._yourself();
  7307. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)});
  7308. },
  7309. args: ["anObject"],
  7310. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  7311. referencedClasses: [],
  7312. messageSends: ["add:", "new", "yourself"]
  7313. }),
  7314. $globals.Collection.klass);
  7315. $core.addMethod(
  7316. $core.method({
  7317. selector: "with:with:",
  7318. protocol: "instance creation",
  7319. fn: function (anObject,anotherObject){
  7320. var self=this;
  7321. return $core.withContext(function($ctx1) {
  7322. var $1;
  7323. $1=self._new();
  7324. $recv($1)._add_(anObject);
  7325. $ctx1.sendIdx["add:"]=1;
  7326. $recv($1)._add_(anotherObject);
  7327. return $recv($1)._yourself();
  7328. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)});
  7329. },
  7330. args: ["anObject", "anotherObject"],
  7331. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  7332. referencedClasses: [],
  7333. messageSends: ["add:", "new", "yourself"]
  7334. }),
  7335. $globals.Collection.klass);
  7336. $core.addMethod(
  7337. $core.method({
  7338. selector: "with:with:with:",
  7339. protocol: "instance creation",
  7340. fn: function (firstObject,secondObject,thirdObject){
  7341. var self=this;
  7342. return $core.withContext(function($ctx1) {
  7343. var $1;
  7344. $1=self._new();
  7345. $recv($1)._add_(firstObject);
  7346. $ctx1.sendIdx["add:"]=1;
  7347. $recv($1)._add_(secondObject);
  7348. $ctx1.sendIdx["add:"]=2;
  7349. $recv($1)._add_(thirdObject);
  7350. return $recv($1)._yourself();
  7351. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)});
  7352. },
  7353. args: ["firstObject", "secondObject", "thirdObject"],
  7354. 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",
  7355. referencedClasses: [],
  7356. messageSends: ["add:", "new", "yourself"]
  7357. }),
  7358. $globals.Collection.klass);
  7359. $core.addMethod(
  7360. $core.method({
  7361. selector: "withAll:",
  7362. protocol: "instance creation",
  7363. fn: function (aCollection){
  7364. var self=this;
  7365. return $core.withContext(function($ctx1) {
  7366. var $1;
  7367. $1=self._new();
  7368. $recv($1)._addAll_(aCollection);
  7369. return $recv($1)._yourself();
  7370. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)});
  7371. },
  7372. args: ["aCollection"],
  7373. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  7374. referencedClasses: [],
  7375. messageSends: ["addAll:", "new", "yourself"]
  7376. }),
  7377. $globals.Collection.klass);
  7378. $core.addClass("IndexableCollection", $globals.Collection, [], "Kernel-Collections");
  7379. $globals.IndexableCollection.comment="I am a key-value store collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection.";
  7380. $core.addMethod(
  7381. $core.method({
  7382. selector: "at:",
  7383. protocol: "accessing",
  7384. fn: function (anIndex){
  7385. var self=this;
  7386. return $core.withContext(function($ctx1) {
  7387. return self._at_ifAbsent_(anIndex,(function(){
  7388. return $core.withContext(function($ctx2) {
  7389. return self._errorNotFound();
  7390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7391. }));
  7392. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  7393. },
  7394. args: ["anIndex"],
  7395. 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 ]",
  7396. referencedClasses: [],
  7397. messageSends: ["at:ifAbsent:", "errorNotFound"]
  7398. }),
  7399. $globals.IndexableCollection);
  7400. $core.addMethod(
  7401. $core.method({
  7402. selector: "at:ifAbsent:",
  7403. protocol: "accessing",
  7404. fn: function (anIndex,aBlock){
  7405. var self=this;
  7406. return $core.withContext(function($ctx1) {
  7407. self._subclassResponsibility();
  7408. return self;
  7409. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  7410. },
  7411. args: ["anIndex", "aBlock"],
  7412. 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",
  7413. referencedClasses: [],
  7414. messageSends: ["subclassResponsibility"]
  7415. }),
  7416. $globals.IndexableCollection);
  7417. $core.addMethod(
  7418. $core.method({
  7419. selector: "at:ifAbsentPut:",
  7420. protocol: "accessing",
  7421. fn: function (aKey,aBlock){
  7422. var self=this;
  7423. return $core.withContext(function($ctx1) {
  7424. return self._at_ifAbsent_(aKey,(function(){
  7425. return $core.withContext(function($ctx2) {
  7426. return self._at_put_(aKey,$recv(aBlock)._value());
  7427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7428. }));
  7429. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  7430. },
  7431. args: ["aKey", "aBlock"],
  7432. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  7433. referencedClasses: [],
  7434. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  7435. }),
  7436. $globals.IndexableCollection);
  7437. $core.addMethod(
  7438. $core.method({
  7439. selector: "at:ifPresent:",
  7440. protocol: "accessing",
  7441. fn: function (anIndex,aBlock){
  7442. var self=this;
  7443. return $core.withContext(function($ctx1) {
  7444. return self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  7445. return nil;
  7446. }));
  7447. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  7448. },
  7449. args: ["anIndex", "aBlock"],
  7450. 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 ]",
  7451. referencedClasses: [],
  7452. messageSends: ["at:ifPresent:ifAbsent:"]
  7453. }),
  7454. $globals.IndexableCollection);
  7455. $core.addMethod(
  7456. $core.method({
  7457. selector: "at:ifPresent:ifAbsent:",
  7458. protocol: "accessing",
  7459. fn: function (anIndex,aBlock,anotherBlock){
  7460. var self=this;
  7461. return $core.withContext(function($ctx1) {
  7462. self._subclassResponsibility();
  7463. return self;
  7464. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  7465. },
  7466. args: ["anIndex", "aBlock", "anotherBlock"],
  7467. 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",
  7468. referencedClasses: [],
  7469. messageSends: ["subclassResponsibility"]
  7470. }),
  7471. $globals.IndexableCollection);
  7472. $core.addMethod(
  7473. $core.method({
  7474. selector: "at:put:",
  7475. protocol: "accessing",
  7476. fn: function (anIndex,anObject){
  7477. var self=this;
  7478. return $core.withContext(function($ctx1) {
  7479. self._subclassResponsibility();
  7480. return self;
  7481. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  7482. },
  7483. args: ["anIndex", "anObject"],
  7484. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  7485. referencedClasses: [],
  7486. messageSends: ["subclassResponsibility"]
  7487. }),
  7488. $globals.IndexableCollection);
  7489. $core.addMethod(
  7490. $core.method({
  7491. selector: "indexOf:",
  7492. protocol: "accessing",
  7493. fn: function (anObject){
  7494. var self=this;
  7495. return $core.withContext(function($ctx1) {
  7496. return self._indexOf_ifAbsent_(anObject,(function(){
  7497. return $core.withContext(function($ctx2) {
  7498. return self._errorNotFound();
  7499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7500. }));
  7501. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  7502. },
  7503. args: ["anObject"],
  7504. 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 ]",
  7505. referencedClasses: [],
  7506. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  7507. }),
  7508. $globals.IndexableCollection);
  7509. $core.addMethod(
  7510. $core.method({
  7511. selector: "indexOf:ifAbsent:",
  7512. protocol: "accessing",
  7513. fn: function (anObject,aBlock){
  7514. var self=this;
  7515. return $core.withContext(function($ctx1) {
  7516. self._subclassResponsibility();
  7517. return self;
  7518. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  7519. },
  7520. args: ["anObject", "aBlock"],
  7521. 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",
  7522. referencedClasses: [],
  7523. messageSends: ["subclassResponsibility"]
  7524. }),
  7525. $globals.IndexableCollection);
  7526. $core.addMethod(
  7527. $core.method({
  7528. selector: "with:do:",
  7529. protocol: "enumerating",
  7530. fn: function (anotherCollection,aBlock){
  7531. var self=this;
  7532. return $core.withContext(function($ctx1) {
  7533. self._withIndexDo_((function(each,index){
  7534. return $core.withContext(function($ctx2) {
  7535. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  7536. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  7537. }));
  7538. return self;
  7539. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  7540. },
  7541. args: ["anotherCollection", "aBlock"],
  7542. 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) ]",
  7543. referencedClasses: [],
  7544. messageSends: ["withIndexDo:", "value:value:", "at:"]
  7545. }),
  7546. $globals.IndexableCollection);
  7547. $core.addMethod(
  7548. $core.method({
  7549. selector: "withIndexDo:",
  7550. protocol: "enumerating",
  7551. fn: function (aBlock){
  7552. var self=this;
  7553. return $core.withContext(function($ctx1) {
  7554. self._subclassResponsibility();
  7555. return self;
  7556. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  7557. },
  7558. args: ["aBlock"],
  7559. 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",
  7560. referencedClasses: [],
  7561. messageSends: ["subclassResponsibility"]
  7562. }),
  7563. $globals.IndexableCollection);
  7564. $core.addClass("AssociativeCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  7565. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  7566. $core.addMethod(
  7567. $core.method({
  7568. selector: "=",
  7569. protocol: "comparing",
  7570. fn: function (anAssocitativeCollection){
  7571. var self=this;
  7572. return $core.withContext(function($ctx1) {
  7573. var $2,$1,$4,$3,$5;
  7574. $2=self._class();
  7575. $ctx1.sendIdx["class"]=1;
  7576. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  7577. $ctx1.sendIdx["="]=1;
  7578. if(!$core.assert($1)){
  7579. return false;
  7580. }
  7581. $4=self._size();
  7582. $ctx1.sendIdx["size"]=1;
  7583. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  7584. $ctx1.sendIdx["="]=2;
  7585. if(!$core.assert($3)){
  7586. return false;
  7587. }
  7588. $5=self._associations();
  7589. $ctx1.sendIdx["associations"]=1;
  7590. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  7591. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  7592. },
  7593. args: ["anAssocitativeCollection"],
  7594. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  7595. referencedClasses: [],
  7596. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  7597. }),
  7598. $globals.AssociativeCollection);
  7599. $core.addMethod(
  7600. $core.method({
  7601. selector: "add:",
  7602. protocol: "adding/removing",
  7603. fn: function (anAssociation){
  7604. var self=this;
  7605. return $core.withContext(function($ctx1) {
  7606. self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  7607. return self;
  7608. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  7609. },
  7610. args: ["anAssociation"],
  7611. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  7612. referencedClasses: [],
  7613. messageSends: ["at:put:", "key", "value"]
  7614. }),
  7615. $globals.AssociativeCollection);
  7616. $core.addMethod(
  7617. $core.method({
  7618. selector: "addAll:",
  7619. protocol: "adding/removing",
  7620. fn: function (anAssociativeCollection){
  7621. var self=this;
  7622. return $core.withContext(function($ctx1) {
  7623. (
  7624. $ctx1.supercall = true,
  7625. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()]));
  7626. $ctx1.supercall = false;
  7627. return anAssociativeCollection;
  7628. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  7629. },
  7630. args: ["anAssociativeCollection"],
  7631. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  7632. referencedClasses: [],
  7633. messageSends: ["addAll:", "associations"]
  7634. }),
  7635. $globals.AssociativeCollection);
  7636. $core.addMethod(
  7637. $core.method({
  7638. selector: "asDictionary",
  7639. protocol: "converting",
  7640. fn: function (){
  7641. var self=this;
  7642. return $core.withContext(function($ctx1) {
  7643. return $recv($globals.Dictionary)._from_(self._associations());
  7644. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  7645. },
  7646. args: [],
  7647. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  7648. referencedClasses: ["Dictionary"],
  7649. messageSends: ["from:", "associations"]
  7650. }),
  7651. $globals.AssociativeCollection);
  7652. $core.addMethod(
  7653. $core.method({
  7654. selector: "asHashedCollection",
  7655. protocol: "converting",
  7656. fn: function (){
  7657. var self=this;
  7658. return $core.withContext(function($ctx1) {
  7659. return $recv($globals.HashedCollection)._from_(self._associations());
  7660. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  7661. },
  7662. args: [],
  7663. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  7664. referencedClasses: ["HashedCollection"],
  7665. messageSends: ["from:", "associations"]
  7666. }),
  7667. $globals.AssociativeCollection);
  7668. $core.addMethod(
  7669. $core.method({
  7670. selector: "asJavaScriptObject",
  7671. protocol: "converting",
  7672. fn: function (){
  7673. var self=this;
  7674. var hash;
  7675. return $core.withContext(function($ctx1) {
  7676. hash=$recv($globals.HashedCollection)._new();
  7677. self._keysAndValuesDo_((function(key,value){
  7678. return $core.withContext(function($ctx2) {
  7679. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  7680. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  7681. }));
  7682. return hash;
  7683. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  7684. },
  7685. args: [],
  7686. 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",
  7687. referencedClasses: ["HashedCollection"],
  7688. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  7689. }),
  7690. $globals.AssociativeCollection);
  7691. $core.addMethod(
  7692. $core.method({
  7693. selector: "associations",
  7694. protocol: "accessing",
  7695. fn: function (){
  7696. var self=this;
  7697. var associations;
  7698. return $core.withContext(function($ctx1) {
  7699. associations=[];
  7700. self._associationsDo_((function(each){
  7701. return $core.withContext(function($ctx2) {
  7702. return $recv(associations)._add_(each);
  7703. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7704. }));
  7705. return associations;
  7706. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  7707. },
  7708. args: [],
  7709. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  7710. referencedClasses: [],
  7711. messageSends: ["associationsDo:", "add:"]
  7712. }),
  7713. $globals.AssociativeCollection);
  7714. $core.addMethod(
  7715. $core.method({
  7716. selector: "associationsDo:",
  7717. protocol: "enumerating",
  7718. fn: function (aBlock){
  7719. var self=this;
  7720. return $core.withContext(function($ctx1) {
  7721. self._keysAndValuesDo_((function(key,value){
  7722. return $core.withContext(function($ctx2) {
  7723. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  7724. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  7725. }));
  7726. return self;
  7727. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  7728. },
  7729. args: ["aBlock"],
  7730. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  7731. referencedClasses: ["Association"],
  7732. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  7733. }),
  7734. $globals.AssociativeCollection);
  7735. $core.addMethod(
  7736. $core.method({
  7737. selector: "at:ifPresent:ifAbsent:",
  7738. protocol: "accessing",
  7739. fn: function (aKey,aBlock,anotherBlock){
  7740. var self=this;
  7741. return $core.withContext(function($ctx1) {
  7742. var $1;
  7743. $1=self._includesKey_(aKey);
  7744. if($core.assert($1)){
  7745. return $recv(aBlock)._value_(self._at_(aKey));
  7746. } else {
  7747. return $recv(anotherBlock)._value();
  7748. }
  7749. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  7750. },
  7751. args: ["aKey", "aBlock", "anotherBlock"],
  7752. 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 ]",
  7753. referencedClasses: [],
  7754. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  7755. }),
  7756. $globals.AssociativeCollection);
  7757. $core.addMethod(
  7758. $core.method({
  7759. selector: "collect:",
  7760. protocol: "enumerating",
  7761. fn: function (aBlock){
  7762. var self=this;
  7763. var newDict;
  7764. return $core.withContext(function($ctx1) {
  7765. newDict=$recv(self._class())._new();
  7766. self._keysAndValuesDo_((function(key,value){
  7767. return $core.withContext(function($ctx2) {
  7768. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  7769. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  7770. }));
  7771. return newDict;
  7772. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  7773. },
  7774. args: ["aBlock"],
  7775. 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",
  7776. referencedClasses: [],
  7777. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  7778. }),
  7779. $globals.AssociativeCollection);
  7780. $core.addMethod(
  7781. $core.method({
  7782. selector: "deepCopy",
  7783. protocol: "copying",
  7784. fn: function (){
  7785. var self=this;
  7786. var copy;
  7787. return $core.withContext(function($ctx1) {
  7788. copy=$recv(self._class())._new();
  7789. self._keysAndValuesDo_((function(key,value){
  7790. return $core.withContext(function($ctx2) {
  7791. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  7792. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  7793. }));
  7794. return copy;
  7795. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  7796. },
  7797. args: [],
  7798. 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",
  7799. referencedClasses: [],
  7800. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  7801. }),
  7802. $globals.AssociativeCollection);
  7803. $core.addMethod(
  7804. $core.method({
  7805. selector: "detect:ifNone:",
  7806. protocol: "enumerating",
  7807. fn: function (aBlock,anotherBlock){
  7808. var self=this;
  7809. return $core.withContext(function($ctx1) {
  7810. return $recv(self._values())._detect_ifNone_(aBlock,anotherBlock);
  7811. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  7812. },
  7813. args: ["aBlock", "anotherBlock"],
  7814. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  7815. referencedClasses: [],
  7816. messageSends: ["detect:ifNone:", "values"]
  7817. }),
  7818. $globals.AssociativeCollection);
  7819. $core.addMethod(
  7820. $core.method({
  7821. selector: "do:",
  7822. protocol: "enumerating",
  7823. fn: function (aBlock){
  7824. var self=this;
  7825. return $core.withContext(function($ctx1) {
  7826. self._valuesDo_(aBlock);
  7827. return self;
  7828. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  7829. },
  7830. args: ["aBlock"],
  7831. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  7832. referencedClasses: [],
  7833. messageSends: ["valuesDo:"]
  7834. }),
  7835. $globals.AssociativeCollection);
  7836. $core.addMethod(
  7837. $core.method({
  7838. selector: "includes:",
  7839. protocol: "enumerating",
  7840. fn: function (anObject){
  7841. var self=this;
  7842. return $core.withContext(function($ctx1) {
  7843. return $recv(self._values())._includes_(anObject);
  7844. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  7845. },
  7846. args: ["anObject"],
  7847. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  7848. referencedClasses: [],
  7849. messageSends: ["includes:", "values"]
  7850. }),
  7851. $globals.AssociativeCollection);
  7852. $core.addMethod(
  7853. $core.method({
  7854. selector: "includesKey:",
  7855. protocol: "testing",
  7856. fn: function (aKey){
  7857. var self=this;
  7858. return $core.withContext(function($ctx1) {
  7859. self._subclassResponsibility();
  7860. return self;
  7861. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  7862. },
  7863. args: ["aKey"],
  7864. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  7865. referencedClasses: [],
  7866. messageSends: ["subclassResponsibility"]
  7867. }),
  7868. $globals.AssociativeCollection);
  7869. $core.addMethod(
  7870. $core.method({
  7871. selector: "indexOf:ifAbsent:",
  7872. protocol: "accessing",
  7873. fn: function (anObject,aBlock){
  7874. var self=this;
  7875. return $core.withContext(function($ctx1) {
  7876. return $recv(self._keys())._detect_ifNone_((function(each){
  7877. return $core.withContext(function($ctx2) {
  7878. return $recv(self._at_(each)).__eq(anObject);
  7879. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7880. }),aBlock);
  7881. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  7882. },
  7883. args: ["anObject", "aBlock"],
  7884. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  7885. referencedClasses: [],
  7886. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  7887. }),
  7888. $globals.AssociativeCollection);
  7889. $core.addMethod(
  7890. $core.method({
  7891. selector: "keyAtValue:",
  7892. protocol: "accessing",
  7893. fn: function (anObject){
  7894. var self=this;
  7895. return $core.withContext(function($ctx1) {
  7896. return self._keyAtValue_ifAbsent_(anObject,(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,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  7902. },
  7903. args: ["anObject"],
  7904. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  7905. referencedClasses: [],
  7906. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  7907. }),
  7908. $globals.AssociativeCollection);
  7909. $core.addMethod(
  7910. $core.method({
  7911. selector: "keyAtValue:ifAbsent:",
  7912. protocol: "accessing",
  7913. fn: function (anObject,aBlock){
  7914. var self=this;
  7915. return $core.withContext(function($ctx1) {
  7916. return self._indexOf_ifAbsent_(anObject,aBlock);
  7917. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  7918. },
  7919. args: ["anObject", "aBlock"],
  7920. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  7921. referencedClasses: [],
  7922. messageSends: ["indexOf:ifAbsent:"]
  7923. }),
  7924. $globals.AssociativeCollection);
  7925. $core.addMethod(
  7926. $core.method({
  7927. selector: "keys",
  7928. protocol: "accessing",
  7929. fn: function (){
  7930. var self=this;
  7931. return $core.withContext(function($ctx1) {
  7932. self._subclassResponsibility();
  7933. return self;
  7934. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  7935. },
  7936. args: [],
  7937. source: "keys\x0a\x09self subclassResponsibility",
  7938. referencedClasses: [],
  7939. messageSends: ["subclassResponsibility"]
  7940. }),
  7941. $globals.AssociativeCollection);
  7942. $core.addMethod(
  7943. $core.method({
  7944. selector: "keysAndValuesDo:",
  7945. protocol: "enumerating",
  7946. fn: function (aBlock){
  7947. var self=this;
  7948. return $core.withContext(function($ctx1) {
  7949. self._keysDo_((function(each){
  7950. return $core.withContext(function($ctx2) {
  7951. return $recv(aBlock)._value_value_(each,self._at_(each));
  7952. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7953. }));
  7954. return self;
  7955. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  7956. },
  7957. args: ["aBlock"],
  7958. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  7959. referencedClasses: [],
  7960. messageSends: ["keysDo:", "value:value:", "at:"]
  7961. }),
  7962. $globals.AssociativeCollection);
  7963. $core.addMethod(
  7964. $core.method({
  7965. selector: "keysDo:",
  7966. protocol: "enumerating",
  7967. fn: function (aBlock){
  7968. var self=this;
  7969. return $core.withContext(function($ctx1) {
  7970. self._subclassResponsibility();
  7971. return self;
  7972. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  7973. },
  7974. args: ["aBlock"],
  7975. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  7976. referencedClasses: [],
  7977. messageSends: ["subclassResponsibility"]
  7978. }),
  7979. $globals.AssociativeCollection);
  7980. $core.addMethod(
  7981. $core.method({
  7982. selector: "printOn:",
  7983. protocol: "printing",
  7984. fn: function (aStream){
  7985. var self=this;
  7986. return $core.withContext(function($ctx1) {
  7987. (
  7988. $ctx1.supercall = true,
  7989. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  7990. $ctx1.supercall = false;
  7991. $ctx1.sendIdx["printOn:"]=1;
  7992. $recv(aStream)._nextPutAll_(" (");
  7993. $ctx1.sendIdx["nextPutAll:"]=1;
  7994. $recv(self._associations())._do_separatedBy_((function(each){
  7995. return $core.withContext(function($ctx2) {
  7996. return $recv(each)._printOn_(aStream);
  7997. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7998. }),(function(){
  7999. return $core.withContext(function($ctx2) {
  8000. return $recv(aStream)._nextPutAll_(" , ");
  8001. $ctx2.sendIdx["nextPutAll:"]=2;
  8002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8003. }));
  8004. $recv(aStream)._nextPutAll_(")");
  8005. return self;
  8006. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  8007. },
  8008. args: ["aStream"],
  8009. 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: ')'",
  8010. referencedClasses: [],
  8011. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  8012. }),
  8013. $globals.AssociativeCollection);
  8014. $core.addMethod(
  8015. $core.method({
  8016. selector: "remove:ifAbsent:",
  8017. protocol: "adding/removing",
  8018. fn: function (aKey,aBlock){
  8019. var self=this;
  8020. return $core.withContext(function($ctx1) {
  8021. return self._removeKey_ifAbsent_(aKey,aBlock);
  8022. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  8023. },
  8024. args: ["aKey", "aBlock"],
  8025. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  8026. referencedClasses: [],
  8027. messageSends: ["removeKey:ifAbsent:"]
  8028. }),
  8029. $globals.AssociativeCollection);
  8030. $core.addMethod(
  8031. $core.method({
  8032. selector: "removeAll",
  8033. protocol: "adding/removing",
  8034. fn: function (){
  8035. var self=this;
  8036. return $core.withContext(function($ctx1) {
  8037. return $recv(self._keys())._do_((function(each){
  8038. return $core.withContext(function($ctx2) {
  8039. return self._removeKey_(each);
  8040. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8041. }));
  8042. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  8043. },
  8044. args: [],
  8045. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  8046. referencedClasses: [],
  8047. messageSends: ["do:", "keys", "removeKey:"]
  8048. }),
  8049. $globals.AssociativeCollection);
  8050. $core.addMethod(
  8051. $core.method({
  8052. selector: "removeKey:",
  8053. protocol: "adding/removing",
  8054. fn: function (aKey){
  8055. var self=this;
  8056. return $core.withContext(function($ctx1) {
  8057. return self._remove_(aKey);
  8058. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  8059. },
  8060. args: ["aKey"],
  8061. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  8062. referencedClasses: [],
  8063. messageSends: ["remove:"]
  8064. }),
  8065. $globals.AssociativeCollection);
  8066. $core.addMethod(
  8067. $core.method({
  8068. selector: "removeKey:ifAbsent:",
  8069. protocol: "adding/removing",
  8070. fn: function (aKey,aBlock){
  8071. var self=this;
  8072. return $core.withContext(function($ctx1) {
  8073. self._subclassResponsibility();
  8074. return self;
  8075. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  8076. },
  8077. args: ["aKey", "aBlock"],
  8078. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  8079. referencedClasses: [],
  8080. messageSends: ["subclassResponsibility"]
  8081. }),
  8082. $globals.AssociativeCollection);
  8083. $core.addMethod(
  8084. $core.method({
  8085. selector: "select:",
  8086. protocol: "enumerating",
  8087. fn: function (aBlock){
  8088. var self=this;
  8089. var newDict;
  8090. return $core.withContext(function($ctx1) {
  8091. var $1;
  8092. newDict=$recv(self._class())._new();
  8093. self._keysAndValuesDo_((function(key,value){
  8094. return $core.withContext(function($ctx2) {
  8095. $1=$recv(aBlock)._value_(value);
  8096. if($core.assert($1)){
  8097. return $recv(newDict)._at_put_(key,value);
  8098. }
  8099. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8100. }));
  8101. return newDict;
  8102. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  8103. },
  8104. args: ["aBlock"],
  8105. 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",
  8106. referencedClasses: [],
  8107. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  8108. }),
  8109. $globals.AssociativeCollection);
  8110. $core.addMethod(
  8111. $core.method({
  8112. selector: "select:thenCollect:",
  8113. protocol: "enumerating",
  8114. fn: function (selectBlock,collectBlock){
  8115. var self=this;
  8116. var newDict;
  8117. return $core.withContext(function($ctx1) {
  8118. var $1;
  8119. newDict=$recv(self._class())._new();
  8120. self._keysAndValuesDo_((function(key,value){
  8121. return $core.withContext(function($ctx2) {
  8122. $1=$recv(selectBlock)._value_(value);
  8123. $ctx2.sendIdx["value:"]=1;
  8124. if($core.assert($1)){
  8125. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  8126. }
  8127. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8128. }));
  8129. return newDict;
  8130. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  8131. },
  8132. args: ["selectBlock", "collectBlock"],
  8133. 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",
  8134. referencedClasses: [],
  8135. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  8136. }),
  8137. $globals.AssociativeCollection);
  8138. $core.addMethod(
  8139. $core.method({
  8140. selector: "shallowCopy",
  8141. protocol: "copying",
  8142. fn: function (){
  8143. var self=this;
  8144. var copy;
  8145. return $core.withContext(function($ctx1) {
  8146. copy=$recv(self._class())._new();
  8147. self._keysAndValuesDo_((function(key,value){
  8148. return $core.withContext(function($ctx2) {
  8149. return $recv(copy)._at_put_(key,value);
  8150. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8151. }));
  8152. return copy;
  8153. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  8154. },
  8155. args: [],
  8156. 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",
  8157. referencedClasses: [],
  8158. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  8159. }),
  8160. $globals.AssociativeCollection);
  8161. $core.addMethod(
  8162. $core.method({
  8163. selector: "size",
  8164. protocol: "accessing",
  8165. fn: function (){
  8166. var self=this;
  8167. return $core.withContext(function($ctx1) {
  8168. return $recv(self._keys())._size();
  8169. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  8170. },
  8171. args: [],
  8172. source: "size\x0a\x09^ self keys size",
  8173. referencedClasses: [],
  8174. messageSends: ["size", "keys"]
  8175. }),
  8176. $globals.AssociativeCollection);
  8177. $core.addMethod(
  8178. $core.method({
  8179. selector: "values",
  8180. protocol: "accessing",
  8181. fn: function (){
  8182. var self=this;
  8183. return $core.withContext(function($ctx1) {
  8184. self._subclassResponsibility();
  8185. return self;
  8186. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  8187. },
  8188. args: [],
  8189. source: "values\x0a\x09self subclassResponsibility",
  8190. referencedClasses: [],
  8191. messageSends: ["subclassResponsibility"]
  8192. }),
  8193. $globals.AssociativeCollection);
  8194. $core.addMethod(
  8195. $core.method({
  8196. selector: "valuesDo:",
  8197. protocol: "enumerating",
  8198. fn: function (aBlock){
  8199. var self=this;
  8200. return $core.withContext(function($ctx1) {
  8201. self._subclassResponsibility();
  8202. return self;
  8203. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8204. },
  8205. args: ["aBlock"],
  8206. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  8207. referencedClasses: [],
  8208. messageSends: ["subclassResponsibility"]
  8209. }),
  8210. $globals.AssociativeCollection);
  8211. $core.addMethod(
  8212. $core.method({
  8213. selector: "withIndexDo:",
  8214. protocol: "enumerating",
  8215. fn: function (aBlock){
  8216. var self=this;
  8217. return $core.withContext(function($ctx1) {
  8218. self._keysAndValuesDo_((function(key,value){
  8219. return $core.withContext(function($ctx2) {
  8220. return $recv(aBlock)._value_value_(value,key);
  8221. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8222. }));
  8223. return self;
  8224. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8225. },
  8226. args: ["aBlock"],
  8227. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  8228. referencedClasses: [],
  8229. messageSends: ["keysAndValuesDo:", "value:value:"]
  8230. }),
  8231. $globals.AssociativeCollection);
  8232. $core.addMethod(
  8233. $core.method({
  8234. selector: "from:",
  8235. protocol: "instance creation",
  8236. fn: function (aCollection){
  8237. var self=this;
  8238. var newCollection;
  8239. return $core.withContext(function($ctx1) {
  8240. newCollection=self._new();
  8241. $recv(aCollection)._do_((function(each){
  8242. return $core.withContext(function($ctx2) {
  8243. return $recv(newCollection)._add_(each);
  8244. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8245. }));
  8246. return newCollection;
  8247. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  8248. },
  8249. args: ["aCollection"],
  8250. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  8251. referencedClasses: [],
  8252. messageSends: ["new", "do:", "add:"]
  8253. }),
  8254. $globals.AssociativeCollection.klass);
  8255. $core.addMethod(
  8256. $core.method({
  8257. selector: "fromPairs:",
  8258. protocol: "instance creation",
  8259. fn: function (aCollection){
  8260. var self=this;
  8261. return $core.withContext(function($ctx1) {
  8262. return self._from_(aCollection);
  8263. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)});
  8264. },
  8265. args: ["aCollection"],
  8266. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  8267. referencedClasses: [],
  8268. messageSends: ["from:"]
  8269. }),
  8270. $globals.AssociativeCollection.klass);
  8271. $core.addMethod(
  8272. $core.method({
  8273. selector: "newFromPairs:",
  8274. protocol: "instance creation",
  8275. fn: function (aCollection){
  8276. var self=this;
  8277. var newCollection;
  8278. return $core.withContext(function($ctx1) {
  8279. var $2,$1,$3,$4;
  8280. $2=$recv(aCollection)._size();
  8281. $ctx1.sendIdx["size"]=1;
  8282. $1=$recv($2)._even();
  8283. if(!$core.assert($1)){
  8284. self._error_("#newFromPairs only accepts arrays of an even length");
  8285. }
  8286. newCollection=self._new();
  8287. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  8288. return $core.withContext(function($ctx2) {
  8289. $3=newCollection;
  8290. $4=$recv(aCollection)._at_(each);
  8291. $ctx2.sendIdx["at:"]=1;
  8292. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  8293. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  8294. }));
  8295. return newCollection;
  8296. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  8297. },
  8298. args: ["aCollection"],
  8299. 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",
  8300. referencedClasses: [],
  8301. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  8302. }),
  8303. $globals.AssociativeCollection.klass);
  8304. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  8305. $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.";
  8306. $core.addMethod(
  8307. $core.method({
  8308. selector: "at:ifAbsent:",
  8309. protocol: "accessing",
  8310. fn: function (aKey,aBlock){
  8311. var self=this;
  8312. return $core.withContext(function($ctx1) {
  8313. var index = self._positionOfKey_(aKey);
  8314. return index >=0 ? self['@values'][index] : aBlock._value();
  8315. ;
  8316. return self;
  8317. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  8318. },
  8319. args: ["aKey", "aBlock"],
  8320. 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'>",
  8321. referencedClasses: [],
  8322. messageSends: []
  8323. }),
  8324. $globals.Dictionary);
  8325. $core.addMethod(
  8326. $core.method({
  8327. selector: "at:put:",
  8328. protocol: "accessing",
  8329. fn: function (aKey,aValue){
  8330. var self=this;
  8331. return $core.withContext(function($ctx1) {
  8332. var index = self._positionOfKey_(aKey);
  8333. if(index === -1) {
  8334. var keys = self['@keys'];
  8335. index = keys.length;
  8336. keys.push(aKey);
  8337. }
  8338. return self['@values'][index] = aValue;
  8339. ;
  8340. return self;
  8341. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  8342. },
  8343. args: ["aKey", "aValue"],
  8344. 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'>",
  8345. referencedClasses: [],
  8346. messageSends: []
  8347. }),
  8348. $globals.Dictionary);
  8349. $core.addMethod(
  8350. $core.method({
  8351. selector: "includesKey:",
  8352. protocol: "testing",
  8353. fn: function (aKey){
  8354. var self=this;
  8355. return $core.withContext(function($ctx1) {
  8356. return self._positionOfKey_(aKey) >= 0;;
  8357. return self;
  8358. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  8359. },
  8360. args: ["aKey"],
  8361. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self._positionOfKey_(aKey) >= 0;'>",
  8362. referencedClasses: [],
  8363. messageSends: []
  8364. }),
  8365. $globals.Dictionary);
  8366. $core.addMethod(
  8367. $core.method({
  8368. selector: "indexOf:ifAbsent:",
  8369. protocol: "accessing",
  8370. fn: function (anObject,aBlock){
  8371. var self=this;
  8372. var index;
  8373. return $core.withContext(function($ctx1) {
  8374. var $1;
  8375. index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  8376. return (0);
  8377. }));
  8378. $1=$recv(index).__eq((0));
  8379. if($core.assert($1)){
  8380. return $recv(aBlock)._value();
  8381. } else {
  8382. return $recv(self["@keys"])._at_(index);
  8383. }
  8384. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  8385. },
  8386. args: ["anObject", "aBlock"],
  8387. 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 ]",
  8388. referencedClasses: [],
  8389. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  8390. }),
  8391. $globals.Dictionary);
  8392. $core.addMethod(
  8393. $core.method({
  8394. selector: "initialize",
  8395. protocol: "initialization",
  8396. fn: function (){
  8397. var self=this;
  8398. return $core.withContext(function($ctx1) {
  8399. (
  8400. $ctx1.supercall = true,
  8401. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  8402. $ctx1.supercall = false;
  8403. self["@keys"]=[];
  8404. self["@values"]=[];
  8405. return self;
  8406. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  8407. },
  8408. args: [],
  8409. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  8410. referencedClasses: [],
  8411. messageSends: ["initialize"]
  8412. }),
  8413. $globals.Dictionary);
  8414. $core.addMethod(
  8415. $core.method({
  8416. selector: "keys",
  8417. protocol: "accessing",
  8418. fn: function (){
  8419. var self=this;
  8420. return $core.withContext(function($ctx1) {
  8421. return $recv(self["@keys"])._copy();
  8422. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  8423. },
  8424. args: [],
  8425. source: "keys\x0a\x09^ keys copy",
  8426. referencedClasses: [],
  8427. messageSends: ["copy"]
  8428. }),
  8429. $globals.Dictionary);
  8430. $core.addMethod(
  8431. $core.method({
  8432. selector: "keysAndValuesDo:",
  8433. protocol: "enumerating",
  8434. fn: function (aBlock){
  8435. var self=this;
  8436. return $core.withContext(function($ctx1) {
  8437. return $recv(self["@keys"])._with_do_(self["@values"],aBlock);
  8438. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  8439. },
  8440. args: ["aBlock"],
  8441. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  8442. referencedClasses: [],
  8443. messageSends: ["with:do:"]
  8444. }),
  8445. $globals.Dictionary);
  8446. $core.addMethod(
  8447. $core.method({
  8448. selector: "keysDo:",
  8449. protocol: "enumerating",
  8450. fn: function (aBlock){
  8451. var self=this;
  8452. return $core.withContext(function($ctx1) {
  8453. return $recv(self["@keys"])._do_(aBlock);
  8454. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  8455. },
  8456. args: ["aBlock"],
  8457. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  8458. referencedClasses: [],
  8459. messageSends: ["do:"]
  8460. }),
  8461. $globals.Dictionary);
  8462. $core.addMethod(
  8463. $core.method({
  8464. selector: "positionOfKey:",
  8465. protocol: "private",
  8466. fn: function (anObject){
  8467. var self=this;
  8468. return $core.withContext(function($ctx1) {
  8469. var keys = self['@keys'];
  8470. for(var i=0;i<keys.length;i++){
  8471. if(keys[i].__eq(anObject)) { return i;}
  8472. }
  8473. return -1;
  8474. ;
  8475. return self;
  8476. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  8477. },
  8478. args: ["anObject"],
  8479. 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'>",
  8480. referencedClasses: [],
  8481. messageSends: []
  8482. }),
  8483. $globals.Dictionary);
  8484. $core.addMethod(
  8485. $core.method({
  8486. selector: "removeAll",
  8487. protocol: "adding/removing",
  8488. fn: function (){
  8489. var self=this;
  8490. return $core.withContext(function($ctx1) {
  8491. $recv(self["@keys"])._removeAll();
  8492. $ctx1.sendIdx["removeAll"]=1;
  8493. $recv(self["@values"])._removeAll();
  8494. return self;
  8495. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  8496. },
  8497. args: [],
  8498. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  8499. referencedClasses: [],
  8500. messageSends: ["removeAll"]
  8501. }),
  8502. $globals.Dictionary);
  8503. $core.addMethod(
  8504. $core.method({
  8505. selector: "removeKey:ifAbsent:",
  8506. protocol: "adding/removing",
  8507. fn: function (aKey,aBlock){
  8508. var self=this;
  8509. return $core.withContext(function($ctx1) {
  8510. var index = self._positionOfKey_(aKey);
  8511. if(index === -1) {
  8512. return aBlock._value()
  8513. } else {
  8514. var keys = self['@keys'], values = self['@values'];
  8515. var value = values[index], l = keys.length;
  8516. keys[index] = keys[l-1];
  8517. keys.pop();
  8518. values[index] = values[l-1];
  8519. values.pop();
  8520. return value;
  8521. }
  8522. ;
  8523. return self;
  8524. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  8525. },
  8526. args: ["aKey", "aBlock"],
  8527. 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'>",
  8528. referencedClasses: [],
  8529. messageSends: []
  8530. }),
  8531. $globals.Dictionary);
  8532. $core.addMethod(
  8533. $core.method({
  8534. selector: "values",
  8535. protocol: "accessing",
  8536. fn: function (){
  8537. var self=this;
  8538. return self["@values"];
  8539. },
  8540. args: [],
  8541. source: "values\x0a\x09^ values",
  8542. referencedClasses: [],
  8543. messageSends: []
  8544. }),
  8545. $globals.Dictionary);
  8546. $core.addMethod(
  8547. $core.method({
  8548. selector: "valuesDo:",
  8549. protocol: "enumerating",
  8550. fn: function (aBlock){
  8551. var self=this;
  8552. return $core.withContext(function($ctx1) {
  8553. return $recv(self["@values"])._do_(aBlock);
  8554. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  8555. },
  8556. args: ["aBlock"],
  8557. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  8558. referencedClasses: [],
  8559. messageSends: ["do:"]
  8560. }),
  8561. $globals.Dictionary);
  8562. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  8563. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  8564. $core.addMethod(
  8565. $core.method({
  8566. selector: "at:ifAbsent:",
  8567. protocol: "accessing",
  8568. fn: function (aKey,aBlock){
  8569. var self=this;
  8570. return $core.withContext(function($ctx1) {
  8571. var $1;
  8572. $1=self._includesKey_(aKey);
  8573. if($core.assert($1)){
  8574. return self._basicAt_(aKey);
  8575. } else {
  8576. return $recv(aBlock)._value();
  8577. }
  8578. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  8579. },
  8580. args: ["aKey", "aBlock"],
  8581. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  8582. referencedClasses: [],
  8583. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  8584. }),
  8585. $globals.HashedCollection);
  8586. $core.addMethod(
  8587. $core.method({
  8588. selector: "at:put:",
  8589. protocol: "accessing",
  8590. fn: function (aKey,aValue){
  8591. var self=this;
  8592. return $core.withContext(function($ctx1) {
  8593. return self._basicAt_put_(aKey,aValue);
  8594. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  8595. },
  8596. args: ["aKey", "aValue"],
  8597. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  8598. referencedClasses: [],
  8599. messageSends: ["basicAt:put:"]
  8600. }),
  8601. $globals.HashedCollection);
  8602. $core.addMethod(
  8603. $core.method({
  8604. selector: "includesKey:",
  8605. protocol: "testing",
  8606. fn: function (aKey){
  8607. var self=this;
  8608. return $core.withContext(function($ctx1) {
  8609. return self.hasOwnProperty(aKey);
  8610. return self;
  8611. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  8612. },
  8613. args: ["aKey"],
  8614. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  8615. referencedClasses: [],
  8616. messageSends: []
  8617. }),
  8618. $globals.HashedCollection);
  8619. $core.addMethod(
  8620. $core.method({
  8621. selector: "keys",
  8622. protocol: "accessing",
  8623. fn: function (){
  8624. var self=this;
  8625. return $core.withContext(function($ctx1) {
  8626. return Object.keys(self);
  8627. return self;
  8628. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  8629. },
  8630. args: [],
  8631. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  8632. referencedClasses: [],
  8633. messageSends: []
  8634. }),
  8635. $globals.HashedCollection);
  8636. $core.addMethod(
  8637. $core.method({
  8638. selector: "keysDo:",
  8639. protocol: "enumerating",
  8640. fn: function (aBlock){
  8641. var self=this;
  8642. return $core.withContext(function($ctx1) {
  8643. $recv(self._keys())._do_(aBlock);
  8644. return self;
  8645. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  8646. },
  8647. args: ["aBlock"],
  8648. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  8649. referencedClasses: [],
  8650. messageSends: ["do:", "keys"]
  8651. }),
  8652. $globals.HashedCollection);
  8653. $core.addMethod(
  8654. $core.method({
  8655. selector: "removeKey:ifAbsent:",
  8656. protocol: "adding/removing",
  8657. fn: function (aKey,aBlock){
  8658. var self=this;
  8659. return $core.withContext(function($ctx1) {
  8660. return self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  8661. return $core.withContext(function($ctx2) {
  8662. self._basicDelete_(aKey);
  8663. return removed;
  8664. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  8665. }),(function(){
  8666. return $core.withContext(function($ctx2) {
  8667. return $recv(aBlock)._value();
  8668. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8669. }));
  8670. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  8671. },
  8672. args: ["aKey", "aBlock"],
  8673. 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 ]",
  8674. referencedClasses: [],
  8675. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  8676. }),
  8677. $globals.HashedCollection);
  8678. $core.addMethod(
  8679. $core.method({
  8680. selector: "values",
  8681. protocol: "accessing",
  8682. fn: function (){
  8683. var self=this;
  8684. return $core.withContext(function($ctx1) {
  8685. return self._keys().map(function(key){
  8686. return self._at_(key);
  8687. });
  8688. ;
  8689. return self;
  8690. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  8691. },
  8692. args: [],
  8693. 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'>",
  8694. referencedClasses: [],
  8695. messageSends: []
  8696. }),
  8697. $globals.HashedCollection);
  8698. $core.addMethod(
  8699. $core.method({
  8700. selector: "valuesDo:",
  8701. protocol: "enumerating",
  8702. fn: function (aBlock){
  8703. var self=this;
  8704. return $core.withContext(function($ctx1) {
  8705. $recv(self._values())._do_(aBlock);
  8706. return self;
  8707. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  8708. },
  8709. args: ["aBlock"],
  8710. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  8711. referencedClasses: [],
  8712. messageSends: ["do:", "values"]
  8713. }),
  8714. $globals.HashedCollection);
  8715. $core.addClass("SequenceableCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  8716. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  8717. $core.addMethod(
  8718. $core.method({
  8719. selector: "=",
  8720. protocol: "comparing",
  8721. fn: function (aCollection){
  8722. var self=this;
  8723. return $core.withContext(function($ctx1) {
  8724. var $3,$2,$4,$1,$5;
  8725. var $early={};
  8726. try {
  8727. $3=self._class();
  8728. $ctx1.sendIdx["class"]=1;
  8729. $2=$recv($3).__eq($recv(aCollection)._class());
  8730. $ctx1.sendIdx["="]=1;
  8731. $1=$recv($2)._and_((function(){
  8732. return $core.withContext(function($ctx2) {
  8733. $4=self._size();
  8734. $ctx2.sendIdx["size"]=1;
  8735. return $recv($4).__eq($recv(aCollection)._size());
  8736. $ctx2.sendIdx["="]=2;
  8737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8738. }));
  8739. if(!$core.assert($1)){
  8740. return false;
  8741. }
  8742. self._withIndexDo_((function(each,i){
  8743. return $core.withContext(function($ctx2) {
  8744. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  8745. if(!$core.assert($5)){
  8746. throw $early=[false];
  8747. }
  8748. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  8749. }));
  8750. return true;
  8751. }
  8752. catch(e) {if(e===$early)return e[0]; throw e}
  8753. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  8754. },
  8755. args: ["aCollection"],
  8756. 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",
  8757. referencedClasses: [],
  8758. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  8759. }),
  8760. $globals.SequenceableCollection);
  8761. $core.addMethod(
  8762. $core.method({
  8763. selector: "addLast:",
  8764. protocol: "adding/removing",
  8765. fn: function (anObject){
  8766. var self=this;
  8767. return $core.withContext(function($ctx1) {
  8768. self._add_(anObject);
  8769. return self;
  8770. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  8771. },
  8772. args: ["anObject"],
  8773. source: "addLast: anObject\x0a\x09self add: anObject",
  8774. referencedClasses: [],
  8775. messageSends: ["add:"]
  8776. }),
  8777. $globals.SequenceableCollection);
  8778. $core.addMethod(
  8779. $core.method({
  8780. selector: "allButFirst",
  8781. protocol: "accessing",
  8782. fn: function (){
  8783. var self=this;
  8784. return $core.withContext(function($ctx1) {
  8785. return self._copyFrom_to_((2),self._size());
  8786. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  8787. },
  8788. args: [],
  8789. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  8790. referencedClasses: [],
  8791. messageSends: ["copyFrom:to:", "size"]
  8792. }),
  8793. $globals.SequenceableCollection);
  8794. $core.addMethod(
  8795. $core.method({
  8796. selector: "allButLast",
  8797. protocol: "accessing",
  8798. fn: function (){
  8799. var self=this;
  8800. return $core.withContext(function($ctx1) {
  8801. return self._copyFrom_to_((1),$recv(self._size()).__minus((1)));
  8802. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  8803. },
  8804. args: [],
  8805. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  8806. referencedClasses: [],
  8807. messageSends: ["copyFrom:to:", "-", "size"]
  8808. }),
  8809. $globals.SequenceableCollection);
  8810. $core.addMethod(
  8811. $core.method({
  8812. selector: "anyOne",
  8813. protocol: "accessing",
  8814. fn: function (){
  8815. var self=this;
  8816. return $core.withContext(function($ctx1) {
  8817. return self._at_((1));
  8818. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  8819. },
  8820. args: [],
  8821. source: "anyOne\x0a\x09^ self at: 1",
  8822. referencedClasses: [],
  8823. messageSends: ["at:"]
  8824. }),
  8825. $globals.SequenceableCollection);
  8826. $core.addMethod(
  8827. $core.method({
  8828. selector: "atRandom",
  8829. protocol: "accessing",
  8830. fn: function (){
  8831. var self=this;
  8832. return $core.withContext(function($ctx1) {
  8833. return self._at_($recv(self._size())._atRandom());
  8834. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  8835. },
  8836. args: [],
  8837. source: "atRandom\x0a\x09^ self at: self size atRandom",
  8838. referencedClasses: [],
  8839. messageSends: ["at:", "atRandom", "size"]
  8840. }),
  8841. $globals.SequenceableCollection);
  8842. $core.addMethod(
  8843. $core.method({
  8844. selector: "beginsWith:",
  8845. protocol: "testing",
  8846. fn: function (prefix){
  8847. var self=this;
  8848. return $core.withContext(function($ctx1) {
  8849. var $2,$3,$1;
  8850. $2=self._size();
  8851. $ctx1.sendIdx["size"]=1;
  8852. $3=$recv(prefix)._size();
  8853. $ctx1.sendIdx["size"]=2;
  8854. $1=$recv($2).__lt($3);
  8855. if($core.assert($1)){
  8856. return false;
  8857. }
  8858. return $recv(self._first_($recv(prefix)._size())).__eq(prefix);
  8859. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  8860. },
  8861. args: ["prefix"],
  8862. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  8863. referencedClasses: [],
  8864. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  8865. }),
  8866. $globals.SequenceableCollection);
  8867. $core.addMethod(
  8868. $core.method({
  8869. selector: "copyFrom:to:",
  8870. protocol: "copying",
  8871. fn: function (anIndex,anotherIndex){
  8872. var self=this;
  8873. return $core.withContext(function($ctx1) {
  8874. self._subclassResponsibility();
  8875. return self;
  8876. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  8877. },
  8878. args: ["anIndex", "anotherIndex"],
  8879. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  8880. referencedClasses: [],
  8881. messageSends: ["subclassResponsibility"]
  8882. }),
  8883. $globals.SequenceableCollection);
  8884. $core.addMethod(
  8885. $core.method({
  8886. selector: "detect:ifNone:",
  8887. protocol: "enumerating",
  8888. fn: function (aBlock,anotherBlock){
  8889. var self=this;
  8890. return $core.withContext(function($ctx1) {
  8891. self = self._numericallyIndexable();
  8892. for(var i = 0; i < self.length; i++)
  8893. if(aBlock._value_(self[i]))
  8894. return self[i];
  8895. return anotherBlock._value();
  8896. ;
  8897. return self;
  8898. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  8899. },
  8900. args: ["aBlock", "anotherBlock"],
  8901. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\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'>",
  8902. referencedClasses: [],
  8903. messageSends: []
  8904. }),
  8905. $globals.SequenceableCollection);
  8906. $core.addMethod(
  8907. $core.method({
  8908. selector: "do:",
  8909. protocol: "enumerating",
  8910. fn: function (aBlock){
  8911. var self=this;
  8912. return $core.withContext(function($ctx1) {
  8913. self = self._numericallyIndexable();
  8914. for(var i=0; i < self.length; i++) {
  8915. aBlock._value_(self[i]);
  8916. }
  8917. ;
  8918. return self;
  8919. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  8920. },
  8921. args: ["aBlock"],
  8922. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09'>",
  8923. referencedClasses: [],
  8924. messageSends: []
  8925. }),
  8926. $globals.SequenceableCollection);
  8927. $core.addMethod(
  8928. $core.method({
  8929. selector: "endsWith:",
  8930. protocol: "testing",
  8931. fn: function (suffix){
  8932. var self=this;
  8933. return $core.withContext(function($ctx1) {
  8934. var $2,$3,$1;
  8935. $2=self._size();
  8936. $ctx1.sendIdx["size"]=1;
  8937. $3=$recv(suffix)._size();
  8938. $ctx1.sendIdx["size"]=2;
  8939. $1=$recv($2).__lt($3);
  8940. if($core.assert($1)){
  8941. return false;
  8942. }
  8943. return $recv(self._last_($recv(suffix)._size())).__eq(suffix);
  8944. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  8945. },
  8946. args: ["suffix"],
  8947. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  8948. referencedClasses: [],
  8949. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  8950. }),
  8951. $globals.SequenceableCollection);
  8952. $core.addMethod(
  8953. $core.method({
  8954. selector: "first",
  8955. protocol: "accessing",
  8956. fn: function (){
  8957. var self=this;
  8958. return $core.withContext(function($ctx1) {
  8959. return self._at_((1));
  8960. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  8961. },
  8962. args: [],
  8963. source: "first\x0a\x09^ self at: 1",
  8964. referencedClasses: [],
  8965. messageSends: ["at:"]
  8966. }),
  8967. $globals.SequenceableCollection);
  8968. $core.addMethod(
  8969. $core.method({
  8970. selector: "first:",
  8971. protocol: "accessing",
  8972. fn: function (aNumber){
  8973. var self=this;
  8974. return $core.withContext(function($ctx1) {
  8975. var $1;
  8976. $1=$recv(self._size()).__lt(aNumber);
  8977. if($core.assert($1)){
  8978. self._error_("Invalid number of elements");
  8979. }
  8980. return self._copyFrom_to_((1),aNumber);
  8981. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  8982. },
  8983. args: ["aNumber"],
  8984. 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",
  8985. referencedClasses: [],
  8986. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  8987. }),
  8988. $globals.SequenceableCollection);
  8989. $core.addMethod(
  8990. $core.method({
  8991. selector: "fourth",
  8992. protocol: "accessing",
  8993. fn: function (){
  8994. var self=this;
  8995. return $core.withContext(function($ctx1) {
  8996. return self._at_((4));
  8997. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  8998. },
  8999. args: [],
  9000. source: "fourth\x0a\x09^ self at: 4",
  9001. referencedClasses: [],
  9002. messageSends: ["at:"]
  9003. }),
  9004. $globals.SequenceableCollection);
  9005. $core.addMethod(
  9006. $core.method({
  9007. selector: "includes:",
  9008. protocol: "testing",
  9009. fn: function (anObject){
  9010. var self=this;
  9011. return $core.withContext(function($ctx1) {
  9012. return $recv(self._indexOf_ifAbsent_(anObject,(function(){
  9013. return nil;
  9014. })))._notNil();
  9015. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  9016. },
  9017. args: ["anObject"],
  9018. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  9019. referencedClasses: [],
  9020. messageSends: ["notNil", "indexOf:ifAbsent:"]
  9021. }),
  9022. $globals.SequenceableCollection);
  9023. $core.addMethod(
  9024. $core.method({
  9025. selector: "indexOf:ifAbsent:",
  9026. protocol: "accessing",
  9027. fn: function (anObject,aBlock){
  9028. var self=this;
  9029. return $core.withContext(function($ctx1) {
  9030. self = self._numericallyIndexable();
  9031. for(var i=0; i < self.length; i++) {
  9032. if($recv(self[i]).__eq(anObject)) {return i+1}
  9033. };
  9034. return aBlock._value();
  9035. ;
  9036. return self;
  9037. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  9038. },
  9039. args: ["anObject", "aBlock"],
  9040. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\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'>",
  9041. referencedClasses: [],
  9042. messageSends: []
  9043. }),
  9044. $globals.SequenceableCollection);
  9045. $core.addMethod(
  9046. $core.method({
  9047. selector: "indexOf:startingAt:",
  9048. protocol: "accessing",
  9049. fn: function (anObject,start){
  9050. var self=this;
  9051. return $core.withContext(function($ctx1) {
  9052. return self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  9053. return (0);
  9054. }));
  9055. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  9056. },
  9057. args: ["anObject", "start"],
  9058. 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 ]",
  9059. referencedClasses: [],
  9060. messageSends: ["indexOf:startingAt:ifAbsent:"]
  9061. }),
  9062. $globals.SequenceableCollection);
  9063. $core.addMethod(
  9064. $core.method({
  9065. selector: "indexOf:startingAt:ifAbsent:",
  9066. protocol: "accessing",
  9067. fn: function (anObject,start,aBlock){
  9068. var self=this;
  9069. return $core.withContext(function($ctx1) {
  9070. self = self._numericallyIndexable();
  9071. for(var i=start - 1; i < self.length; i++){
  9072. if($recv(self[i]).__eq(anObject)) {return i+1}
  9073. }
  9074. return aBlock._value();
  9075. ;
  9076. return self;
  9077. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  9078. },
  9079. args: ["anObject", "start", "aBlock"],
  9080. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\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'>",
  9081. referencedClasses: [],
  9082. messageSends: []
  9083. }),
  9084. $globals.SequenceableCollection);
  9085. $core.addMethod(
  9086. $core.method({
  9087. selector: "last",
  9088. protocol: "accessing",
  9089. fn: function (){
  9090. var self=this;
  9091. return $core.withContext(function($ctx1) {
  9092. return self._at_(self._size());
  9093. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  9094. },
  9095. args: [],
  9096. source: "last\x0a\x09^ self at: self size",
  9097. referencedClasses: [],
  9098. messageSends: ["at:", "size"]
  9099. }),
  9100. $globals.SequenceableCollection);
  9101. $core.addMethod(
  9102. $core.method({
  9103. selector: "last:",
  9104. protocol: "accessing",
  9105. fn: function (aNumber){
  9106. var self=this;
  9107. return $core.withContext(function($ctx1) {
  9108. var $2,$1,$5,$4,$3;
  9109. $2=self._size();
  9110. $ctx1.sendIdx["size"]=1;
  9111. $1=$recv($2).__lt(aNumber);
  9112. if($core.assert($1)){
  9113. self._error_("Invalid number of elements");
  9114. }
  9115. $5=self._size();
  9116. $ctx1.sendIdx["size"]=2;
  9117. $4=$recv($5).__minus(aNumber);
  9118. $3=$recv($4).__plus((1));
  9119. return self._copyFrom_to_($3,self._size());
  9120. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  9121. },
  9122. args: ["aNumber"],
  9123. 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",
  9124. referencedClasses: [],
  9125. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  9126. }),
  9127. $globals.SequenceableCollection);
  9128. $core.addMethod(
  9129. $core.method({
  9130. selector: "newStream",
  9131. protocol: "streaming",
  9132. fn: function (){
  9133. var self=this;
  9134. return $core.withContext(function($ctx1) {
  9135. return $recv(self._streamClass())._on_(self);
  9136. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  9137. },
  9138. args: [],
  9139. source: "newStream\x0a\x09^ self streamClass on: self",
  9140. referencedClasses: [],
  9141. messageSends: ["on:", "streamClass"]
  9142. }),
  9143. $globals.SequenceableCollection);
  9144. $core.addMethod(
  9145. $core.method({
  9146. selector: "numericallyIndexable",
  9147. protocol: "private",
  9148. fn: function (){
  9149. var self=this;
  9150. return $core.withContext(function($ctx1) {
  9151. self._subclassResponsibility();
  9152. return self;
  9153. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  9154. },
  9155. args: [],
  9156. source: "numericallyIndexable\x0a\x09\x22This is an internal converting message.\x0a\x09It answeres a representation of the receiver\x0a\x09that can use foo[i] in JavaScript code.\x0a\x09\x0a\x09It fixes IE8, where boxed String is unable\x0a\x09to numerically index its characters,\x0a\x09but primitive string can.\x22\x0a\x09\x0a\x09self subclassResponsibility",
  9157. referencedClasses: [],
  9158. messageSends: ["subclassResponsibility"]
  9159. }),
  9160. $globals.SequenceableCollection);
  9161. $core.addMethod(
  9162. $core.method({
  9163. selector: "readStream",
  9164. protocol: "streaming",
  9165. fn: function (){
  9166. var self=this;
  9167. return $core.withContext(function($ctx1) {
  9168. return self._stream();
  9169. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  9170. },
  9171. args: [],
  9172. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  9173. referencedClasses: [],
  9174. messageSends: ["stream"]
  9175. }),
  9176. $globals.SequenceableCollection);
  9177. $core.addMethod(
  9178. $core.method({
  9179. selector: "removeLast",
  9180. protocol: "adding/removing",
  9181. fn: function (){
  9182. var self=this;
  9183. return $core.withContext(function($ctx1) {
  9184. return self._remove_(self._last());
  9185. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  9186. },
  9187. args: [],
  9188. source: "removeLast\x0a\x09^ self remove: self last",
  9189. referencedClasses: [],
  9190. messageSends: ["remove:", "last"]
  9191. }),
  9192. $globals.SequenceableCollection);
  9193. $core.addMethod(
  9194. $core.method({
  9195. selector: "reverseDo:",
  9196. protocol: "enumerating",
  9197. fn: function (aBlock){
  9198. var self=this;
  9199. return $core.withContext(function($ctx1) {
  9200. $recv(self._reversed())._do_(aBlock);
  9201. return self;
  9202. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  9203. },
  9204. args: ["aBlock"],
  9205. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  9206. referencedClasses: [],
  9207. messageSends: ["do:", "reversed"]
  9208. }),
  9209. $globals.SequenceableCollection);
  9210. $core.addMethod(
  9211. $core.method({
  9212. selector: "reversed",
  9213. protocol: "converting",
  9214. fn: function (){
  9215. var self=this;
  9216. return $core.withContext(function($ctx1) {
  9217. self._subclassResponsibility();
  9218. return self;
  9219. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  9220. },
  9221. args: [],
  9222. source: "reversed\x0a\x09self subclassResponsibility",
  9223. referencedClasses: [],
  9224. messageSends: ["subclassResponsibility"]
  9225. }),
  9226. $globals.SequenceableCollection);
  9227. $core.addMethod(
  9228. $core.method({
  9229. selector: "second",
  9230. protocol: "accessing",
  9231. fn: function (){
  9232. var self=this;
  9233. return $core.withContext(function($ctx1) {
  9234. return self._at_((2));
  9235. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  9236. },
  9237. args: [],
  9238. source: "second\x0a\x09^ self at: 2",
  9239. referencedClasses: [],
  9240. messageSends: ["at:"]
  9241. }),
  9242. $globals.SequenceableCollection);
  9243. $core.addMethod(
  9244. $core.method({
  9245. selector: "single",
  9246. protocol: "accessing",
  9247. fn: function (){
  9248. var self=this;
  9249. return $core.withContext(function($ctx1) {
  9250. if (self.length == 0) throw new Error("Collection is empty");
  9251. if (self.length > 1) throw new Error("Collection holds more than one element.");
  9252. return self[0];;
  9253. return self;
  9254. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.SequenceableCollection)});
  9255. },
  9256. args: [],
  9257. 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'>",
  9258. referencedClasses: [],
  9259. messageSends: []
  9260. }),
  9261. $globals.SequenceableCollection);
  9262. $core.addMethod(
  9263. $core.method({
  9264. selector: "stream",
  9265. protocol: "streaming",
  9266. fn: function (){
  9267. var self=this;
  9268. return $core.withContext(function($ctx1) {
  9269. return self._newStream();
  9270. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  9271. },
  9272. args: [],
  9273. source: "stream\x0a\x09^ self newStream",
  9274. referencedClasses: [],
  9275. messageSends: ["newStream"]
  9276. }),
  9277. $globals.SequenceableCollection);
  9278. $core.addMethod(
  9279. $core.method({
  9280. selector: "streamClass",
  9281. protocol: "streaming",
  9282. fn: function (){
  9283. var self=this;
  9284. return $core.withContext(function($ctx1) {
  9285. return $recv(self._class())._streamClass();
  9286. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  9287. },
  9288. args: [],
  9289. source: "streamClass\x0a\x09^ self class streamClass",
  9290. referencedClasses: [],
  9291. messageSends: ["streamClass", "class"]
  9292. }),
  9293. $globals.SequenceableCollection);
  9294. $core.addMethod(
  9295. $core.method({
  9296. selector: "third",
  9297. protocol: "accessing",
  9298. fn: function (){
  9299. var self=this;
  9300. return $core.withContext(function($ctx1) {
  9301. return self._at_((3));
  9302. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  9303. },
  9304. args: [],
  9305. source: "third\x0a\x09^ self at: 3",
  9306. referencedClasses: [],
  9307. messageSends: ["at:"]
  9308. }),
  9309. $globals.SequenceableCollection);
  9310. $core.addMethod(
  9311. $core.method({
  9312. selector: "with:do:",
  9313. protocol: "enumerating",
  9314. fn: function (anotherCollection,aBlock){
  9315. var self=this;
  9316. return $core.withContext(function($ctx1) {
  9317. self = self._numericallyIndexable();
  9318. anotherCollection = anotherCollection._numericallyIndexable();
  9319. for(var i=0; i<self.length; i++) {
  9320. aBlock._value_value_(self[i], anotherCollection[i]);
  9321. }
  9322. ;
  9323. return self;
  9324. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  9325. },
  9326. args: ["anotherCollection", "aBlock"],
  9327. source: "with: anotherCollection do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09anotherCollection = anotherCollection._numericallyIndexable();\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'>",
  9328. referencedClasses: [],
  9329. messageSends: []
  9330. }),
  9331. $globals.SequenceableCollection);
  9332. $core.addMethod(
  9333. $core.method({
  9334. selector: "withIndexDo:",
  9335. protocol: "enumerating",
  9336. fn: function (aBlock){
  9337. var self=this;
  9338. return $core.withContext(function($ctx1) {
  9339. self = self._numericallyIndexable();
  9340. for(var i=0; i < self.length; i++) {
  9341. aBlock._value_value_(self[i], i+1);
  9342. }
  9343. ;
  9344. return self;
  9345. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  9346. },
  9347. args: ["aBlock"],
  9348. source: "withIndexDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\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'>",
  9349. referencedClasses: [],
  9350. messageSends: []
  9351. }),
  9352. $globals.SequenceableCollection);
  9353. $core.addMethod(
  9354. $core.method({
  9355. selector: "writeStream",
  9356. protocol: "streaming",
  9357. fn: function (){
  9358. var self=this;
  9359. return $core.withContext(function($ctx1) {
  9360. return self._stream();
  9361. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  9362. },
  9363. args: [],
  9364. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  9365. referencedClasses: [],
  9366. messageSends: ["stream"]
  9367. }),
  9368. $globals.SequenceableCollection);
  9369. $core.addMethod(
  9370. $core.method({
  9371. selector: "streamClass",
  9372. protocol: "accessing",
  9373. fn: function (){
  9374. var self=this;
  9375. return $globals.Stream;
  9376. },
  9377. args: [],
  9378. source: "streamClass\x0a\x09\x09^ Stream",
  9379. referencedClasses: ["Stream"],
  9380. messageSends: []
  9381. }),
  9382. $globals.SequenceableCollection.klass);
  9383. $core.addMethod(
  9384. $core.method({
  9385. selector: "streamContents:",
  9386. protocol: "streaming",
  9387. fn: function (aBlock){
  9388. var self=this;
  9389. var stream;
  9390. return $core.withContext(function($ctx1) {
  9391. stream=$recv(self._streamClass())._on_(self._new());
  9392. $recv(aBlock)._value_(stream);
  9393. return $recv(stream)._contents();
  9394. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)});
  9395. },
  9396. args: ["aBlock"],
  9397. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  9398. referencedClasses: [],
  9399. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  9400. }),
  9401. $globals.SequenceableCollection.klass);
  9402. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  9403. $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`.";
  9404. $core.addMethod(
  9405. $core.method({
  9406. selector: "add:",
  9407. protocol: "adding/removing",
  9408. fn: function (anObject){
  9409. var self=this;
  9410. return $core.withContext(function($ctx1) {
  9411. self.push(anObject); return anObject;;
  9412. return self;
  9413. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  9414. },
  9415. args: ["anObject"],
  9416. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  9417. referencedClasses: [],
  9418. messageSends: []
  9419. }),
  9420. $globals.Array);
  9421. $core.addMethod(
  9422. $core.method({
  9423. selector: "addAll:",
  9424. protocol: "adding/removing",
  9425. fn: function (aCollection){
  9426. var self=this;
  9427. return $core.withContext(function($ctx1) {
  9428. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  9429. else $globals.Array.superclass.fn.prototype._addAll_.call(self, aCollection);
  9430. return aCollection;;
  9431. return self;
  9432. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  9433. },
  9434. args: ["aCollection"],
  9435. 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'>",
  9436. referencedClasses: [],
  9437. messageSends: []
  9438. }),
  9439. $globals.Array);
  9440. $core.addMethod(
  9441. $core.method({
  9442. selector: "addFirst:",
  9443. protocol: "adding/removing",
  9444. fn: function (anObject){
  9445. var self=this;
  9446. return $core.withContext(function($ctx1) {
  9447. self.unshift(anObject); return anObject;;
  9448. return self;
  9449. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  9450. },
  9451. args: ["anObject"],
  9452. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  9453. referencedClasses: [],
  9454. messageSends: []
  9455. }),
  9456. $globals.Array);
  9457. $core.addMethod(
  9458. $core.method({
  9459. selector: "asJavaScriptSource",
  9460. protocol: "converting",
  9461. fn: function (){
  9462. var self=this;
  9463. return $core.withContext(function($ctx1) {
  9464. var $1;
  9465. $1=$recv("[".__comma($recv(self._collect_((function(each){
  9466. return $core.withContext(function($ctx2) {
  9467. return $recv(each)._asJavaScriptSource();
  9468. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9469. })))._join_(", "))).__comma("]");
  9470. $ctx1.sendIdx[","]=1;
  9471. return $1;
  9472. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  9473. },
  9474. args: [],
  9475. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  9476. referencedClasses: [],
  9477. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  9478. }),
  9479. $globals.Array);
  9480. $core.addMethod(
  9481. $core.method({
  9482. selector: "at:ifAbsent:",
  9483. protocol: "accessing",
  9484. fn: function (anIndex,aBlock){
  9485. var self=this;
  9486. return $core.withContext(function($ctx1) {
  9487. return anIndex >= 1 && anIndex <= self.length
  9488. ? self[anIndex - 1]
  9489. : aBlock._value()
  9490. ;
  9491. return self;
  9492. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  9493. },
  9494. args: ["anIndex", "aBlock"],
  9495. 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'>",
  9496. referencedClasses: [],
  9497. messageSends: []
  9498. }),
  9499. $globals.Array);
  9500. $core.addMethod(
  9501. $core.method({
  9502. selector: "at:ifPresent:ifAbsent:",
  9503. protocol: "accessing",
  9504. fn: function (anIndex,aBlock,anotherBlock){
  9505. var self=this;
  9506. return $core.withContext(function($ctx1) {
  9507. return anIndex >= 1 && anIndex <= self.length
  9508. ? aBlock._value_(self[anIndex - 1])
  9509. : anotherBlock._value()
  9510. ;
  9511. return self;
  9512. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  9513. },
  9514. args: ["anIndex", "aBlock", "anotherBlock"],
  9515. 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'>",
  9516. referencedClasses: [],
  9517. messageSends: []
  9518. }),
  9519. $globals.Array);
  9520. $core.addMethod(
  9521. $core.method({
  9522. selector: "at:put:",
  9523. protocol: "accessing",
  9524. fn: function (anIndex,anObject){
  9525. var self=this;
  9526. return $core.withContext(function($ctx1) {
  9527. return self[anIndex - 1] = anObject;
  9528. return self;
  9529. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  9530. },
  9531. args: ["anIndex", "anObject"],
  9532. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  9533. referencedClasses: [],
  9534. messageSends: []
  9535. }),
  9536. $globals.Array);
  9537. $core.addMethod(
  9538. $core.method({
  9539. selector: "collect:",
  9540. protocol: "enumerating",
  9541. fn: function (aBlock){
  9542. var self=this;
  9543. return $core.withContext(function($ctx1) {
  9544. return self.map(function(each) {return aBlock._value_(each)});
  9545. return self;
  9546. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  9547. },
  9548. args: ["aBlock"],
  9549. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  9550. referencedClasses: [],
  9551. messageSends: []
  9552. }),
  9553. $globals.Array);
  9554. $core.addMethod(
  9555. $core.method({
  9556. selector: "copyFrom:to:",
  9557. protocol: "copying",
  9558. fn: function (anIndex,anotherIndex){
  9559. var self=this;
  9560. return $core.withContext(function($ctx1) {
  9561. if (anIndex >= 1 && anotherIndex <= self.length) {
  9562. return self.slice(anIndex - 1, anotherIndex);
  9563. } else {
  9564. self._at_(anIndex);
  9565. self._at_(self.length + 1);
  9566. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  9567. };
  9568. return self;
  9569. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  9570. },
  9571. args: ["anIndex", "anotherIndex"],
  9572. 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'>",
  9573. referencedClasses: [],
  9574. messageSends: []
  9575. }),
  9576. $globals.Array);
  9577. $core.addMethod(
  9578. $core.method({
  9579. selector: "join:",
  9580. protocol: "enumerating",
  9581. fn: function (aString){
  9582. var self=this;
  9583. return $core.withContext(function($ctx1) {
  9584. return self.join(aString);
  9585. return self;
  9586. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  9587. },
  9588. args: ["aString"],
  9589. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  9590. referencedClasses: [],
  9591. messageSends: []
  9592. }),
  9593. $globals.Array);
  9594. $core.addMethod(
  9595. $core.method({
  9596. selector: "numericallyIndexable",
  9597. protocol: "private",
  9598. fn: function (){
  9599. var self=this;
  9600. return self;
  9601. },
  9602. args: [],
  9603. source: "numericallyIndexable\x0a\x09^ self",
  9604. referencedClasses: [],
  9605. messageSends: []
  9606. }),
  9607. $globals.Array);
  9608. $core.addMethod(
  9609. $core.method({
  9610. selector: "printOn:",
  9611. protocol: "printing",
  9612. fn: function (aStream){
  9613. var self=this;
  9614. return $core.withContext(function($ctx1) {
  9615. (
  9616. $ctx1.supercall = true,
  9617. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9618. $ctx1.supercall = false;
  9619. $ctx1.sendIdx["printOn:"]=1;
  9620. $recv(aStream)._nextPutAll_(" (");
  9621. $ctx1.sendIdx["nextPutAll:"]=1;
  9622. self._do_separatedBy_((function(each){
  9623. return $core.withContext(function($ctx2) {
  9624. return $recv(each)._printOn_(aStream);
  9625. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9626. }),(function(){
  9627. return $core.withContext(function($ctx2) {
  9628. return $recv(aStream)._nextPutAll_(" ");
  9629. $ctx2.sendIdx["nextPutAll:"]=2;
  9630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9631. }));
  9632. $recv(aStream)._nextPutAll_(")");
  9633. return self;
  9634. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  9635. },
  9636. args: ["aStream"],
  9637. 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: ')'",
  9638. referencedClasses: [],
  9639. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  9640. }),
  9641. $globals.Array);
  9642. $core.addMethod(
  9643. $core.method({
  9644. selector: "remove:ifAbsent:",
  9645. protocol: "adding/removing",
  9646. fn: function (anObject,aBlock){
  9647. var self=this;
  9648. var index;
  9649. return $core.withContext(function($ctx1) {
  9650. var $1;
  9651. index=self._indexOf_ifAbsent_(anObject,(function(){
  9652. return (0);
  9653. }));
  9654. $1=$recv(index).__eq((0));
  9655. if($core.assert($1)){
  9656. return $recv(aBlock)._value();
  9657. } else {
  9658. self._removeIndex_(index);
  9659. return anObject;
  9660. }
  9661. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  9662. },
  9663. args: ["anObject", "aBlock"],
  9664. 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 ]",
  9665. referencedClasses: [],
  9666. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  9667. }),
  9668. $globals.Array);
  9669. $core.addMethod(
  9670. $core.method({
  9671. selector: "removeAll",
  9672. protocol: "adding/removing",
  9673. fn: function (){
  9674. var self=this;
  9675. return $core.withContext(function($ctx1) {
  9676. self.length = 0;
  9677. return self;
  9678. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  9679. },
  9680. args: [],
  9681. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  9682. referencedClasses: [],
  9683. messageSends: []
  9684. }),
  9685. $globals.Array);
  9686. $core.addMethod(
  9687. $core.method({
  9688. selector: "removeFrom:to:",
  9689. protocol: "adding/removing",
  9690. fn: function (aNumber,anotherNumber){
  9691. var self=this;
  9692. return $core.withContext(function($ctx1) {
  9693. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  9694. return self;
  9695. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  9696. },
  9697. args: ["aNumber", "anotherNumber"],
  9698. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  9699. referencedClasses: [],
  9700. messageSends: []
  9701. }),
  9702. $globals.Array);
  9703. $core.addMethod(
  9704. $core.method({
  9705. selector: "removeIndex:",
  9706. protocol: "adding/removing",
  9707. fn: function (anInteger){
  9708. var self=this;
  9709. return $core.withContext(function($ctx1) {
  9710. self.splice(anInteger - 1, 1);
  9711. return self;
  9712. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  9713. },
  9714. args: ["anInteger"],
  9715. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  9716. referencedClasses: [],
  9717. messageSends: []
  9718. }),
  9719. $globals.Array);
  9720. $core.addMethod(
  9721. $core.method({
  9722. selector: "removeLast",
  9723. protocol: "adding/removing",
  9724. fn: function (){
  9725. var self=this;
  9726. return $core.withContext(function($ctx1) {
  9727. return self.pop();;
  9728. return self;
  9729. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  9730. },
  9731. args: [],
  9732. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  9733. referencedClasses: [],
  9734. messageSends: []
  9735. }),
  9736. $globals.Array);
  9737. $core.addMethod(
  9738. $core.method({
  9739. selector: "reversed",
  9740. protocol: "converting",
  9741. fn: function (){
  9742. var self=this;
  9743. return $core.withContext(function($ctx1) {
  9744. return self.slice().reverse();
  9745. return self;
  9746. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  9747. },
  9748. args: [],
  9749. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  9750. referencedClasses: [],
  9751. messageSends: []
  9752. }),
  9753. $globals.Array);
  9754. $core.addMethod(
  9755. $core.method({
  9756. selector: "select:",
  9757. protocol: "enumerating",
  9758. fn: function (aBlock){
  9759. var self=this;
  9760. return $core.withContext(function($ctx1) {
  9761. return self.filter(function(each) {return aBlock._value_(each)});
  9762. return self;
  9763. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  9764. },
  9765. args: ["aBlock"],
  9766. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  9767. referencedClasses: [],
  9768. messageSends: []
  9769. }),
  9770. $globals.Array);
  9771. $core.addMethod(
  9772. $core.method({
  9773. selector: "shallowCopy",
  9774. protocol: "copying",
  9775. fn: function (){
  9776. var self=this;
  9777. return $core.withContext(function($ctx1) {
  9778. return self.slice();
  9779. return self;
  9780. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  9781. },
  9782. args: [],
  9783. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  9784. referencedClasses: [],
  9785. messageSends: []
  9786. }),
  9787. $globals.Array);
  9788. $core.addMethod(
  9789. $core.method({
  9790. selector: "size",
  9791. protocol: "accessing",
  9792. fn: function (){
  9793. var self=this;
  9794. return $core.withContext(function($ctx1) {
  9795. return self.length;
  9796. return self;
  9797. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  9798. },
  9799. args: [],
  9800. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  9801. referencedClasses: [],
  9802. messageSends: []
  9803. }),
  9804. $globals.Array);
  9805. $core.addMethod(
  9806. $core.method({
  9807. selector: "sort",
  9808. protocol: "enumerating",
  9809. fn: function (){
  9810. var self=this;
  9811. return $core.withContext(function($ctx1) {
  9812. return self._sort_((function(a,b){
  9813. return $core.withContext(function($ctx2) {
  9814. return $recv(a).__lt(b);
  9815. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  9816. }));
  9817. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  9818. },
  9819. args: [],
  9820. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  9821. referencedClasses: [],
  9822. messageSends: ["sort:", "<"]
  9823. }),
  9824. $globals.Array);
  9825. $core.addMethod(
  9826. $core.method({
  9827. selector: "sort:",
  9828. protocol: "enumerating",
  9829. fn: function (aBlock){
  9830. var self=this;
  9831. return $core.withContext(function($ctx1) {
  9832. return self.sort(function(a, b) {
  9833. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  9834. })
  9835. ;
  9836. return self;
  9837. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  9838. },
  9839. args: ["aBlock"],
  9840. 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'>",
  9841. referencedClasses: [],
  9842. messageSends: []
  9843. }),
  9844. $globals.Array);
  9845. $core.addMethod(
  9846. $core.method({
  9847. selector: "sorted",
  9848. protocol: "enumerating",
  9849. fn: function (){
  9850. var self=this;
  9851. return $core.withContext(function($ctx1) {
  9852. return $recv(self._copy())._sort();
  9853. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  9854. },
  9855. args: [],
  9856. source: "sorted\x0a\x09^ self copy sort",
  9857. referencedClasses: [],
  9858. messageSends: ["sort", "copy"]
  9859. }),
  9860. $globals.Array);
  9861. $core.addMethod(
  9862. $core.method({
  9863. selector: "sorted:",
  9864. protocol: "enumerating",
  9865. fn: function (aBlock){
  9866. var self=this;
  9867. return $core.withContext(function($ctx1) {
  9868. return $recv(self._copy())._sort_(aBlock);
  9869. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  9870. },
  9871. args: ["aBlock"],
  9872. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  9873. referencedClasses: [],
  9874. messageSends: ["sort:", "copy"]
  9875. }),
  9876. $globals.Array);
  9877. $core.addMethod(
  9878. $core.method({
  9879. selector: "new:",
  9880. protocol: "instance creation",
  9881. fn: function (anInteger){
  9882. var self=this;
  9883. return $core.withContext(function($ctx1) {
  9884. return new Array(anInteger);
  9885. return self;
  9886. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)});
  9887. },
  9888. args: ["anInteger"],
  9889. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  9890. referencedClasses: [],
  9891. messageSends: []
  9892. }),
  9893. $globals.Array.klass);
  9894. $core.addMethod(
  9895. $core.method({
  9896. selector: "with:",
  9897. protocol: "instance creation",
  9898. fn: function (anObject){
  9899. var self=this;
  9900. return $core.withContext(function($ctx1) {
  9901. var $1;
  9902. $1=self._new_((1));
  9903. $recv($1)._at_put_((1),anObject);
  9904. return $recv($1)._yourself();
  9905. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)});
  9906. },
  9907. args: ["anObject"],
  9908. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  9909. referencedClasses: [],
  9910. messageSends: ["at:put:", "new:", "yourself"]
  9911. }),
  9912. $globals.Array.klass);
  9913. $core.addMethod(
  9914. $core.method({
  9915. selector: "with:with:",
  9916. protocol: "instance creation",
  9917. fn: function (anObject,anObject2){
  9918. var self=this;
  9919. return $core.withContext(function($ctx1) {
  9920. var $1;
  9921. $1=self._new_((2));
  9922. $recv($1)._at_put_((1),anObject);
  9923. $ctx1.sendIdx["at:put:"]=1;
  9924. $recv($1)._at_put_((2),anObject2);
  9925. return $recv($1)._yourself();
  9926. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)});
  9927. },
  9928. args: ["anObject", "anObject2"],
  9929. 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",
  9930. referencedClasses: [],
  9931. messageSends: ["at:put:", "new:", "yourself"]
  9932. }),
  9933. $globals.Array.klass);
  9934. $core.addMethod(
  9935. $core.method({
  9936. selector: "with:with:with:",
  9937. protocol: "instance creation",
  9938. fn: function (anObject,anObject2,anObject3){
  9939. var self=this;
  9940. return $core.withContext(function($ctx1) {
  9941. var $1;
  9942. $1=self._new_((3));
  9943. $recv($1)._at_put_((1),anObject);
  9944. $ctx1.sendIdx["at:put:"]=1;
  9945. $recv($1)._at_put_((2),anObject2);
  9946. $ctx1.sendIdx["at:put:"]=2;
  9947. $recv($1)._at_put_((3),anObject3);
  9948. return $recv($1)._yourself();
  9949. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)});
  9950. },
  9951. args: ["anObject", "anObject2", "anObject3"],
  9952. 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",
  9953. referencedClasses: [],
  9954. messageSends: ["at:put:", "new:", "yourself"]
  9955. }),
  9956. $globals.Array.klass);
  9957. $core.addMethod(
  9958. $core.method({
  9959. selector: "withAll:",
  9960. protocol: "instance creation",
  9961. fn: function (aCollection){
  9962. var self=this;
  9963. var instance,index;
  9964. return $core.withContext(function($ctx1) {
  9965. index=(1);
  9966. instance=self._new_($recv(aCollection)._size());
  9967. $recv(aCollection)._do_((function(each){
  9968. return $core.withContext(function($ctx2) {
  9969. $recv(instance)._at_put_(index,each);
  9970. index=$recv(index).__plus((1));
  9971. return index;
  9972. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9973. }));
  9974. return instance;
  9975. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)});
  9976. },
  9977. args: ["aCollection"],
  9978. 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",
  9979. referencedClasses: [],
  9980. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  9981. }),
  9982. $globals.Array.klass);
  9983. $core.addClass("CharacterArray", $globals.SequenceableCollection, [], "Kernel-Collections");
  9984. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  9985. $core.addMethod(
  9986. $core.method({
  9987. selector: ",",
  9988. protocol: "copying",
  9989. fn: function (aString){
  9990. var self=this;
  9991. return $core.withContext(function($ctx1) {
  9992. var $1;
  9993. $1=self._asString();
  9994. $ctx1.sendIdx["asString"]=1;
  9995. return $recv($1).__comma($recv(aString)._asString());
  9996. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  9997. },
  9998. args: ["aString"],
  9999. source: ", aString\x0a\x09^ self asString, aString asString",
  10000. referencedClasses: [],
  10001. messageSends: [",", "asString"]
  10002. }),
  10003. $globals.CharacterArray);
  10004. $core.addMethod(
  10005. $core.method({
  10006. selector: "add:",
  10007. protocol: "adding/removing",
  10008. fn: function (anObject){
  10009. var self=this;
  10010. return $core.withContext(function($ctx1) {
  10011. self._errorReadOnly();
  10012. return self;
  10013. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  10014. },
  10015. args: ["anObject"],
  10016. source: "add: anObject\x0a\x09self errorReadOnly",
  10017. referencedClasses: [],
  10018. messageSends: ["errorReadOnly"]
  10019. }),
  10020. $globals.CharacterArray);
  10021. $core.addMethod(
  10022. $core.method({
  10023. selector: "asLowercase",
  10024. protocol: "converting",
  10025. fn: function (){
  10026. var self=this;
  10027. return $core.withContext(function($ctx1) {
  10028. return $recv(self._class())._fromString_($recv(self._asString())._asLowercase());
  10029. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  10030. },
  10031. args: [],
  10032. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  10033. referencedClasses: [],
  10034. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  10035. }),
  10036. $globals.CharacterArray);
  10037. $core.addMethod(
  10038. $core.method({
  10039. selector: "asNumber",
  10040. protocol: "converting",
  10041. fn: function (){
  10042. var self=this;
  10043. return $core.withContext(function($ctx1) {
  10044. return $recv(self._asString())._asNumber();
  10045. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  10046. },
  10047. args: [],
  10048. source: "asNumber\x0a\x09^ self asString asNumber",
  10049. referencedClasses: [],
  10050. messageSends: ["asNumber", "asString"]
  10051. }),
  10052. $globals.CharacterArray);
  10053. $core.addMethod(
  10054. $core.method({
  10055. selector: "asString",
  10056. protocol: "converting",
  10057. fn: function (){
  10058. var self=this;
  10059. return $core.withContext(function($ctx1) {
  10060. return self._subclassResponsibility();
  10061. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  10062. },
  10063. args: [],
  10064. source: "asString\x0a\x09^ self subclassResponsibility",
  10065. referencedClasses: [],
  10066. messageSends: ["subclassResponsibility"]
  10067. }),
  10068. $globals.CharacterArray);
  10069. $core.addMethod(
  10070. $core.method({
  10071. selector: "asSymbol",
  10072. protocol: "converting",
  10073. fn: function (){
  10074. var self=this;
  10075. return $core.withContext(function($ctx1) {
  10076. return self._asString();
  10077. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  10078. },
  10079. args: [],
  10080. source: "asSymbol\x0a\x09^ self asString",
  10081. referencedClasses: [],
  10082. messageSends: ["asString"]
  10083. }),
  10084. $globals.CharacterArray);
  10085. $core.addMethod(
  10086. $core.method({
  10087. selector: "asSymbolPrintOn:",
  10088. protocol: "printing",
  10089. fn: function (aStream){
  10090. var self=this;
  10091. return $core.withContext(function($ctx1) {
  10092. var $1;
  10093. $recv(aStream)._nextPutAll_("#");
  10094. $1=$recv(self._asString())._isSelector();
  10095. if($core.assert($1)){
  10096. $recv(aStream)._nextPut_(self);
  10097. } else {
  10098. self._printOn_(aStream);
  10099. }
  10100. return self;
  10101. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.CharacterArray)});
  10102. },
  10103. args: ["aStream"],
  10104. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  10105. referencedClasses: [],
  10106. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  10107. }),
  10108. $globals.CharacterArray);
  10109. $core.addMethod(
  10110. $core.method({
  10111. selector: "asUppercase",
  10112. protocol: "converting",
  10113. fn: function (){
  10114. var self=this;
  10115. return $core.withContext(function($ctx1) {
  10116. return $recv(self._class())._fromString_($recv(self._asString())._asUppercase());
  10117. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  10118. },
  10119. args: [],
  10120. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  10121. referencedClasses: [],
  10122. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  10123. }),
  10124. $globals.CharacterArray);
  10125. $core.addMethod(
  10126. $core.method({
  10127. selector: "at:put:",
  10128. protocol: "accessing",
  10129. fn: function (anIndex,anObject){
  10130. var self=this;
  10131. return $core.withContext(function($ctx1) {
  10132. self._errorReadOnly();
  10133. return self;
  10134. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  10135. },
  10136. args: ["anIndex", "anObject"],
  10137. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  10138. referencedClasses: [],
  10139. messageSends: ["errorReadOnly"]
  10140. }),
  10141. $globals.CharacterArray);
  10142. $core.addMethod(
  10143. $core.method({
  10144. selector: "errorReadOnly",
  10145. protocol: "error handling",
  10146. fn: function (){
  10147. var self=this;
  10148. return $core.withContext(function($ctx1) {
  10149. self._error_("Object is read-only");
  10150. return self;
  10151. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  10152. },
  10153. args: [],
  10154. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  10155. referencedClasses: [],
  10156. messageSends: ["error:"]
  10157. }),
  10158. $globals.CharacterArray);
  10159. $core.addMethod(
  10160. $core.method({
  10161. selector: "printOn:",
  10162. protocol: "printing",
  10163. fn: function (aStream){
  10164. var self=this;
  10165. return $core.withContext(function($ctx1) {
  10166. $recv(self._asString())._printOn_(aStream);
  10167. return self;
  10168. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  10169. },
  10170. args: ["aStream"],
  10171. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  10172. referencedClasses: [],
  10173. messageSends: ["printOn:", "asString"]
  10174. }),
  10175. $globals.CharacterArray);
  10176. $core.addMethod(
  10177. $core.method({
  10178. selector: "putOn:",
  10179. protocol: "streaming",
  10180. fn: function (aStream){
  10181. var self=this;
  10182. return $core.withContext(function($ctx1) {
  10183. $recv(aStream)._nextPutString_(self);
  10184. return self;
  10185. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  10186. },
  10187. args: ["aStream"],
  10188. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  10189. referencedClasses: [],
  10190. messageSends: ["nextPutString:"]
  10191. }),
  10192. $globals.CharacterArray);
  10193. $core.addMethod(
  10194. $core.method({
  10195. selector: "remove:",
  10196. protocol: "adding/removing",
  10197. fn: function (anObject){
  10198. var self=this;
  10199. return $core.withContext(function($ctx1) {
  10200. self._errorReadOnly();
  10201. return self;
  10202. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  10203. },
  10204. args: ["anObject"],
  10205. source: "remove: anObject\x0a\x09self errorReadOnly",
  10206. referencedClasses: [],
  10207. messageSends: ["errorReadOnly"]
  10208. }),
  10209. $globals.CharacterArray);
  10210. $core.addMethod(
  10211. $core.method({
  10212. selector: "symbolPrintString",
  10213. protocol: "printing",
  10214. fn: function (){
  10215. var self=this;
  10216. return $core.withContext(function($ctx1) {
  10217. return $recv($globals.String)._streamContents_((function(str){
  10218. return $core.withContext(function($ctx2) {
  10219. return self._asSymbolPrintOn_(str);
  10220. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  10221. }));
  10222. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.CharacterArray)});
  10223. },
  10224. args: [],
  10225. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  10226. referencedClasses: ["String"],
  10227. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  10228. }),
  10229. $globals.CharacterArray);
  10230. $core.addMethod(
  10231. $core.method({
  10232. selector: "fromString:",
  10233. protocol: "instance creation",
  10234. fn: function (aString){
  10235. var self=this;
  10236. return $core.withContext(function($ctx1) {
  10237. self._subclassResponsibility();
  10238. return self;
  10239. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)});
  10240. },
  10241. args: ["aString"],
  10242. source: "fromString: aString\x0a\x09self subclassResponsibility",
  10243. referencedClasses: [],
  10244. messageSends: ["subclassResponsibility"]
  10245. }),
  10246. $globals.CharacterArray.klass);
  10247. $core.addClass("String", $globals.CharacterArray, [], "Kernel-Collections");
  10248. $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 >> #,`";
  10249. $core.addMethod(
  10250. $core.method({
  10251. selector: ",",
  10252. protocol: "copying",
  10253. fn: function (aString){
  10254. var self=this;
  10255. return $core.withContext(function($ctx1) {
  10256. return String(self) + aString;
  10257. return self;
  10258. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  10259. },
  10260. args: ["aString"],
  10261. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  10262. referencedClasses: [],
  10263. messageSends: []
  10264. }),
  10265. $globals.String);
  10266. $core.addMethod(
  10267. $core.method({
  10268. selector: "<",
  10269. protocol: "comparing",
  10270. fn: function (aString){
  10271. var self=this;
  10272. return $core.withContext(function($ctx1) {
  10273. return String(self) < aString._asString();
  10274. return self;
  10275. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  10276. },
  10277. args: ["aString"],
  10278. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  10279. referencedClasses: [],
  10280. messageSends: []
  10281. }),
  10282. $globals.String);
  10283. $core.addMethod(
  10284. $core.method({
  10285. selector: "<=",
  10286. protocol: "comparing",
  10287. fn: function (aString){
  10288. var self=this;
  10289. return $core.withContext(function($ctx1) {
  10290. return String(self) <= aString._asString();
  10291. return self;
  10292. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  10293. },
  10294. args: ["aString"],
  10295. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  10296. referencedClasses: [],
  10297. messageSends: []
  10298. }),
  10299. $globals.String);
  10300. $core.addMethod(
  10301. $core.method({
  10302. selector: "=",
  10303. protocol: "comparing",
  10304. fn: function (aString){
  10305. var self=this;
  10306. return $core.withContext(function($ctx1) {
  10307. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  10308. return self;
  10309. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  10310. },
  10311. args: ["aString"],
  10312. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  10313. referencedClasses: [],
  10314. messageSends: []
  10315. }),
  10316. $globals.String);
  10317. $core.addMethod(
  10318. $core.method({
  10319. selector: "==",
  10320. protocol: "comparing",
  10321. fn: function (aString){
  10322. var self=this;
  10323. return $core.withContext(function($ctx1) {
  10324. if (typeof aString === "string") return String(self) === aString;
  10325. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  10326. else return false;;
  10327. return self;
  10328. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  10329. },
  10330. args: ["aString"],
  10331. 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'>",
  10332. referencedClasses: [],
  10333. messageSends: []
  10334. }),
  10335. $globals.String);
  10336. $core.addMethod(
  10337. $core.method({
  10338. selector: ">",
  10339. protocol: "comparing",
  10340. fn: function (aString){
  10341. var self=this;
  10342. return $core.withContext(function($ctx1) {
  10343. return String(self) > aString._asString();
  10344. return self;
  10345. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  10346. },
  10347. args: ["aString"],
  10348. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  10349. referencedClasses: [],
  10350. messageSends: []
  10351. }),
  10352. $globals.String);
  10353. $core.addMethod(
  10354. $core.method({
  10355. selector: ">=",
  10356. protocol: "comparing",
  10357. fn: function (aString){
  10358. var self=this;
  10359. return $core.withContext(function($ctx1) {
  10360. return String(self) >= aString._asString();
  10361. return self;
  10362. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  10363. },
  10364. args: ["aString"],
  10365. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  10366. referencedClasses: [],
  10367. messageSends: []
  10368. }),
  10369. $globals.String);
  10370. $core.addMethod(
  10371. $core.method({
  10372. selector: "asJavaScriptMethodName",
  10373. protocol: "converting",
  10374. fn: function (){
  10375. var self=this;
  10376. return $core.withContext(function($ctx1) {
  10377. return $core.st2js(self);
  10378. return self;
  10379. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  10380. },
  10381. args: [],
  10382. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  10383. referencedClasses: [],
  10384. messageSends: []
  10385. }),
  10386. $globals.String);
  10387. $core.addMethod(
  10388. $core.method({
  10389. selector: "asJavaScriptObject",
  10390. protocol: "converting",
  10391. fn: function (){
  10392. var self=this;
  10393. return self;
  10394. },
  10395. args: [],
  10396. source: "asJavaScriptObject\x0a\x09^ self",
  10397. referencedClasses: [],
  10398. messageSends: []
  10399. }),
  10400. $globals.String);
  10401. $core.addMethod(
  10402. $core.method({
  10403. selector: "asJavaScriptSource",
  10404. protocol: "converting",
  10405. fn: function (){
  10406. var self=this;
  10407. return $core.withContext(function($ctx1) {
  10408. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  10409. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  10410. else
  10411. return "\"" + self + "\"";
  10412. ;
  10413. return self;
  10414. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  10415. },
  10416. args: [],
  10417. 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'>",
  10418. referencedClasses: [],
  10419. messageSends: []
  10420. }),
  10421. $globals.String);
  10422. $core.addMethod(
  10423. $core.method({
  10424. selector: "asLowercase",
  10425. protocol: "converting",
  10426. fn: function (){
  10427. var self=this;
  10428. return $core.withContext(function($ctx1) {
  10429. return self.toLowerCase();
  10430. return self;
  10431. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  10432. },
  10433. args: [],
  10434. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  10435. referencedClasses: [],
  10436. messageSends: []
  10437. }),
  10438. $globals.String);
  10439. $core.addMethod(
  10440. $core.method({
  10441. selector: "asMutator",
  10442. protocol: "converting",
  10443. fn: function (){
  10444. var self=this;
  10445. return $core.withContext(function($ctx1) {
  10446. var $1;
  10447. $1=$recv(self._last()).__eq(":");
  10448. if(!$core.assert($1)){
  10449. return self.__comma(":");
  10450. }
  10451. return self;
  10452. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  10453. },
  10454. args: [],
  10455. 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",
  10456. referencedClasses: [],
  10457. messageSends: ["ifFalse:", "=", "last", ","]
  10458. }),
  10459. $globals.String);
  10460. $core.addMethod(
  10461. $core.method({
  10462. selector: "asNumber",
  10463. protocol: "converting",
  10464. fn: function (){
  10465. var self=this;
  10466. return $core.withContext(function($ctx1) {
  10467. return Number(self);
  10468. return self;
  10469. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  10470. },
  10471. args: [],
  10472. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  10473. referencedClasses: [],
  10474. messageSends: []
  10475. }),
  10476. $globals.String);
  10477. $core.addMethod(
  10478. $core.method({
  10479. selector: "asRegexp",
  10480. protocol: "converting",
  10481. fn: function (){
  10482. var self=this;
  10483. return $core.withContext(function($ctx1) {
  10484. return $recv($globals.RegularExpression)._fromString_(self);
  10485. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  10486. },
  10487. args: [],
  10488. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  10489. referencedClasses: ["RegularExpression"],
  10490. messageSends: ["fromString:"]
  10491. }),
  10492. $globals.String);
  10493. $core.addMethod(
  10494. $core.method({
  10495. selector: "asString",
  10496. protocol: "converting",
  10497. fn: function (){
  10498. var self=this;
  10499. return self;
  10500. },
  10501. args: [],
  10502. source: "asString\x0a\x09^ self",
  10503. referencedClasses: [],
  10504. messageSends: []
  10505. }),
  10506. $globals.String);
  10507. $core.addMethod(
  10508. $core.method({
  10509. selector: "asSymbol",
  10510. protocol: "converting",
  10511. fn: function (){
  10512. var self=this;
  10513. return self;
  10514. },
  10515. args: [],
  10516. source: "asSymbol\x0a\x09^ self",
  10517. referencedClasses: [],
  10518. messageSends: []
  10519. }),
  10520. $globals.String);
  10521. $core.addMethod(
  10522. $core.method({
  10523. selector: "asUppercase",
  10524. protocol: "converting",
  10525. fn: function (){
  10526. var self=this;
  10527. return $core.withContext(function($ctx1) {
  10528. return self.toUpperCase();
  10529. return self;
  10530. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  10531. },
  10532. args: [],
  10533. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  10534. referencedClasses: [],
  10535. messageSends: []
  10536. }),
  10537. $globals.String);
  10538. $core.addMethod(
  10539. $core.method({
  10540. selector: "asciiValue",
  10541. protocol: "accessing",
  10542. fn: function (){
  10543. var self=this;
  10544. return $core.withContext(function($ctx1) {
  10545. return self.charCodeAt(0);;
  10546. return self;
  10547. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  10548. },
  10549. args: [],
  10550. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  10551. referencedClasses: [],
  10552. messageSends: []
  10553. }),
  10554. $globals.String);
  10555. $core.addMethod(
  10556. $core.method({
  10557. selector: "at:ifAbsent:",
  10558. protocol: "accessing",
  10559. fn: function (anIndex,aBlock){
  10560. var self=this;
  10561. return $core.withContext(function($ctx1) {
  10562. return String(self)[anIndex - 1] || aBlock._value();
  10563. return self;
  10564. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  10565. },
  10566. args: ["anIndex", "aBlock"],
  10567. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  10568. referencedClasses: [],
  10569. messageSends: []
  10570. }),
  10571. $globals.String);
  10572. $core.addMethod(
  10573. $core.method({
  10574. selector: "at:ifPresent:ifAbsent:",
  10575. protocol: "accessing",
  10576. fn: function (anIndex,aBlock,anotherBlock){
  10577. var self=this;
  10578. return $core.withContext(function($ctx1) {
  10579. var result = String(self)[anIndex - 1];
  10580. return result ? aBlock._value_(result) : anotherBlock._value();
  10581. ;
  10582. return self;
  10583. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  10584. },
  10585. args: ["anIndex", "aBlock", "anotherBlock"],
  10586. 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'>",
  10587. referencedClasses: [],
  10588. messageSends: []
  10589. }),
  10590. $globals.String);
  10591. $core.addMethod(
  10592. $core.method({
  10593. selector: "capitalized",
  10594. protocol: "converting",
  10595. fn: function (){
  10596. var self=this;
  10597. return $core.withContext(function($ctx1) {
  10598. return self._ifNotEmpty_((function(){
  10599. return $core.withContext(function($ctx2) {
  10600. return $recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
  10601. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10602. }));
  10603. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  10604. },
  10605. args: [],
  10606. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  10607. referencedClasses: [],
  10608. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  10609. }),
  10610. $globals.String);
  10611. $core.addMethod(
  10612. $core.method({
  10613. selector: "charCodeAt:",
  10614. protocol: "accessing",
  10615. fn: function (anInteger){
  10616. var self=this;
  10617. return $core.withContext(function($ctx1) {
  10618. return self.charCodeAt(anInteger - 1);
  10619. return self;
  10620. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  10621. },
  10622. args: ["anInteger"],
  10623. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  10624. referencedClasses: [],
  10625. messageSends: []
  10626. }),
  10627. $globals.String);
  10628. $core.addMethod(
  10629. $core.method({
  10630. selector: "copyFrom:to:",
  10631. protocol: "copying",
  10632. fn: function (anIndex,anotherIndex){
  10633. var self=this;
  10634. return $core.withContext(function($ctx1) {
  10635. return self.substring(anIndex - 1, anotherIndex);
  10636. return self;
  10637. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  10638. },
  10639. args: ["anIndex", "anotherIndex"],
  10640. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  10641. referencedClasses: [],
  10642. messageSends: []
  10643. }),
  10644. $globals.String);
  10645. $core.addMethod(
  10646. $core.method({
  10647. selector: "crlfSanitized",
  10648. protocol: "converting",
  10649. fn: function (){
  10650. var self=this;
  10651. return $core.withContext(function($ctx1) {
  10652. return $recv(self._lines())._join_($recv($globals.String)._lf());
  10653. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  10654. },
  10655. args: [],
  10656. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  10657. referencedClasses: ["String"],
  10658. messageSends: ["join:", "lines", "lf"]
  10659. }),
  10660. $globals.String);
  10661. $core.addMethod(
  10662. $core.method({
  10663. selector: "deepCopy",
  10664. protocol: "copying",
  10665. fn: function (){
  10666. var self=this;
  10667. return $core.withContext(function($ctx1) {
  10668. return self._shallowCopy();
  10669. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  10670. },
  10671. args: [],
  10672. source: "deepCopy\x0a\x09^ self shallowCopy",
  10673. referencedClasses: [],
  10674. messageSends: ["shallowCopy"]
  10675. }),
  10676. $globals.String);
  10677. $core.addMethod(
  10678. $core.method({
  10679. selector: "escaped",
  10680. protocol: "converting",
  10681. fn: function (){
  10682. var self=this;
  10683. return $core.withContext(function($ctx1) {
  10684. return escape(self);
  10685. return self;
  10686. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  10687. },
  10688. args: [],
  10689. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  10690. referencedClasses: [],
  10691. messageSends: []
  10692. }),
  10693. $globals.String);
  10694. $core.addMethod(
  10695. $core.method({
  10696. selector: "includesSubString:",
  10697. protocol: "testing",
  10698. fn: function (subString){
  10699. var self=this;
  10700. return $core.withContext(function($ctx1) {
  10701. return self.indexOf(subString) != -1;
  10702. return self;
  10703. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  10704. },
  10705. args: ["subString"],
  10706. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  10707. referencedClasses: [],
  10708. messageSends: []
  10709. }),
  10710. $globals.String);
  10711. $core.addMethod(
  10712. $core.method({
  10713. selector: "isCapitalized",
  10714. protocol: "testing",
  10715. fn: function (){
  10716. var self=this;
  10717. return $core.withContext(function($ctx1) {
  10718. var $2,$1;
  10719. $2=self._first();
  10720. $ctx1.sendIdx["first"]=1;
  10721. $1=$recv($2)._asUppercase();
  10722. return $recv($1).__eq_eq(self._first());
  10723. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  10724. },
  10725. args: [],
  10726. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  10727. referencedClasses: [],
  10728. messageSends: ["==", "asUppercase", "first"]
  10729. }),
  10730. $globals.String);
  10731. $core.addMethod(
  10732. $core.method({
  10733. selector: "isImmutable",
  10734. protocol: "testing",
  10735. fn: function (){
  10736. var self=this;
  10737. return true;
  10738. },
  10739. args: [],
  10740. source: "isImmutable\x0a\x09^ true",
  10741. referencedClasses: [],
  10742. messageSends: []
  10743. }),
  10744. $globals.String);
  10745. $core.addMethod(
  10746. $core.method({
  10747. selector: "isSelector",
  10748. protocol: "testing",
  10749. fn: function (){
  10750. var self=this;
  10751. return $core.withContext(function($ctx1) {
  10752. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  10753. return self;
  10754. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  10755. },
  10756. args: [],
  10757. 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>",
  10758. referencedClasses: [],
  10759. messageSends: []
  10760. }),
  10761. $globals.String);
  10762. $core.addMethod(
  10763. $core.method({
  10764. selector: "isString",
  10765. protocol: "testing",
  10766. fn: function (){
  10767. var self=this;
  10768. return true;
  10769. },
  10770. args: [],
  10771. source: "isString\x0a\x09^ true",
  10772. referencedClasses: [],
  10773. messageSends: []
  10774. }),
  10775. $globals.String);
  10776. $core.addMethod(
  10777. $core.method({
  10778. selector: "isVowel",
  10779. protocol: "testing",
  10780. fn: function (){
  10781. var self=this;
  10782. return $core.withContext(function($ctx1) {
  10783. return $recv($recv(self._size()).__eq((1)))._and_((function(){
  10784. return $core.withContext(function($ctx2) {
  10785. return "aeiou"._includes_(self._asLowercase());
  10786. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10787. }));
  10788. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  10789. },
  10790. args: [],
  10791. 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 ]",
  10792. referencedClasses: [],
  10793. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  10794. }),
  10795. $globals.String);
  10796. $core.addMethod(
  10797. $core.method({
  10798. selector: "join:",
  10799. protocol: "split join",
  10800. fn: function (aCollection){
  10801. var self=this;
  10802. return $core.withContext(function($ctx1) {
  10803. return $recv($globals.String)._streamContents_((function(stream){
  10804. return $core.withContext(function($ctx2) {
  10805. return $recv(aCollection)._do_separatedBy_((function(each){
  10806. return $core.withContext(function($ctx3) {
  10807. return $recv(stream)._nextPutAll_($recv(each)._asString());
  10808. $ctx3.sendIdx["nextPutAll:"]=1;
  10809. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  10810. }),(function(){
  10811. return $core.withContext(function($ctx3) {
  10812. return $recv(stream)._nextPutAll_(self);
  10813. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  10814. }));
  10815. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  10816. }));
  10817. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  10818. },
  10819. args: ["aCollection"],
  10820. 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 ]]",
  10821. referencedClasses: ["String"],
  10822. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  10823. }),
  10824. $globals.String);
  10825. $core.addMethod(
  10826. $core.method({
  10827. selector: "lineIndicesDo:",
  10828. protocol: "split join",
  10829. fn: function (aBlock){
  10830. var self=this;
  10831. var cr,lf,start,sz,nextLF,nextCR;
  10832. return $core.withContext(function($ctx1) {
  10833. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  10834. var $early={};
  10835. try {
  10836. start=(1);
  10837. sz=self._size();
  10838. cr=$recv($globals.String)._cr();
  10839. nextCR=self._indexOf_startingAt_(cr,(1));
  10840. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  10841. lf=$recv($globals.String)._lf();
  10842. nextLF=self._indexOf_startingAt_(lf,(1));
  10843. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  10844. $recv((function(){
  10845. return $core.withContext(function($ctx2) {
  10846. return $recv(start).__lt_eq(sz);
  10847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10848. }))._whileTrue_((function(){
  10849. return $core.withContext(function($ctx2) {
  10850. $2=$recv(nextLF).__eq((0));
  10851. $ctx2.sendIdx["="]=1;
  10852. $1=$recv($2)._and_((function(){
  10853. return $core.withContext(function($ctx3) {
  10854. return $recv(nextCR).__eq((0));
  10855. $ctx3.sendIdx["="]=2;
  10856. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  10857. }));
  10858. $ctx2.sendIdx["and:"]=1;
  10859. if($core.assert($1)){
  10860. $recv(aBlock)._value_value_value_(start,sz,sz);
  10861. $ctx2.sendIdx["value:value:value:"]=1;
  10862. throw $early=[self];
  10863. }
  10864. $4=$recv(nextCR).__eq((0));
  10865. $ctx2.sendIdx["="]=3;
  10866. $3=$recv($4)._or_((function(){
  10867. return $core.withContext(function($ctx3) {
  10868. $5=(0).__lt(nextLF);
  10869. $ctx3.sendIdx["<"]=1;
  10870. return $recv($5)._and_((function(){
  10871. return $core.withContext(function($ctx4) {
  10872. return $recv(nextLF).__lt(nextCR);
  10873. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  10874. }));
  10875. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  10876. }));
  10877. if($core.assert($3)){
  10878. $6=start;
  10879. $7=$recv(nextLF).__minus((1));
  10880. $ctx2.sendIdx["-"]=1;
  10881. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  10882. $ctx2.sendIdx["value:value:value:"]=2;
  10883. start=(1).__plus(nextLF);
  10884. $ctx2.sendIdx["+"]=1;
  10885. start;
  10886. nextLF=self._indexOf_startingAt_(lf,start);
  10887. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  10888. return nextLF;
  10889. } else {
  10890. $9=(1).__plus(nextCR);
  10891. $ctx2.sendIdx["+"]=2;
  10892. $8=$recv($9).__eq(nextLF);
  10893. if($core.assert($8)){
  10894. $10=start;
  10895. $11=$recv(nextCR).__minus((1));
  10896. $ctx2.sendIdx["-"]=2;
  10897. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  10898. $ctx2.sendIdx["value:value:value:"]=3;
  10899. start=(1).__plus(nextLF);
  10900. $ctx2.sendIdx["+"]=3;
  10901. start;
  10902. nextCR=self._indexOf_startingAt_(cr,start);
  10903. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  10904. nextCR;
  10905. nextLF=self._indexOf_startingAt_(lf,start);
  10906. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  10907. return nextLF;
  10908. } else {
  10909. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  10910. start=(1).__plus(nextCR);
  10911. start;
  10912. nextCR=self._indexOf_startingAt_(cr,start);
  10913. return nextCR;
  10914. }
  10915. }
  10916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10917. }));
  10918. return self;
  10919. }
  10920. catch(e) {if(e===$early)return e[0]; throw e}
  10921. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  10922. },
  10923. args: ["aBlock"],
  10924. 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 ] ]]",
  10925. referencedClasses: ["String"],
  10926. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  10927. }),
  10928. $globals.String);
  10929. $core.addMethod(
  10930. $core.method({
  10931. selector: "lineNumber:",
  10932. protocol: "split join",
  10933. fn: function (anIndex){
  10934. var self=this;
  10935. var lineCount;
  10936. return $core.withContext(function($ctx1) {
  10937. var $2,$1;
  10938. var $early={};
  10939. try {
  10940. lineCount=(0);
  10941. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  10942. return $core.withContext(function($ctx2) {
  10943. lineCount=$recv(lineCount).__plus((1));
  10944. $2=lineCount;
  10945. $1=$recv($2).__eq(anIndex);
  10946. if($core.assert($1)){
  10947. throw $early=[self._copyFrom_to_(start,endWithoutDelimiters)];
  10948. }
  10949. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  10950. }));
  10951. return nil;
  10952. }
  10953. catch(e) {if(e===$early)return e[0]; throw e}
  10954. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  10955. },
  10956. args: ["anIndex"],
  10957. 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",
  10958. referencedClasses: [],
  10959. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  10960. }),
  10961. $globals.String);
  10962. $core.addMethod(
  10963. $core.method({
  10964. selector: "lines",
  10965. protocol: "split join",
  10966. fn: function (){
  10967. var self=this;
  10968. return $core.withContext(function($ctx1) {
  10969. var result = self.split(/\r\n|\r|\n/);
  10970. if (!result[result.length-1]) result.pop();
  10971. return result;;
  10972. return self;
  10973. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  10974. },
  10975. args: [],
  10976. 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'>",
  10977. referencedClasses: [],
  10978. messageSends: []
  10979. }),
  10980. $globals.String);
  10981. $core.addMethod(
  10982. $core.method({
  10983. selector: "linesDo:",
  10984. protocol: "split join",
  10985. fn: function (aBlock){
  10986. var self=this;
  10987. return $core.withContext(function($ctx1) {
  10988. $recv(self._lines())._do_(aBlock);
  10989. return self;
  10990. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  10991. },
  10992. args: ["aBlock"],
  10993. 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",
  10994. referencedClasses: [],
  10995. messageSends: ["do:", "lines"]
  10996. }),
  10997. $globals.String);
  10998. $core.addMethod(
  10999. $core.method({
  11000. selector: "match:",
  11001. protocol: "regular expressions",
  11002. fn: function (aRegexp){
  11003. var self=this;
  11004. return $core.withContext(function($ctx1) {
  11005. return self.search(aRegexp) != -1;
  11006. return self;
  11007. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  11008. },
  11009. args: ["aRegexp"],
  11010. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  11011. referencedClasses: [],
  11012. messageSends: []
  11013. }),
  11014. $globals.String);
  11015. $core.addMethod(
  11016. $core.method({
  11017. selector: "matchesOf:",
  11018. protocol: "regular expressions",
  11019. fn: function (aRegularExpression){
  11020. var self=this;
  11021. return $core.withContext(function($ctx1) {
  11022. return self.match(aRegularExpression);
  11023. return self;
  11024. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  11025. },
  11026. args: ["aRegularExpression"],
  11027. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  11028. referencedClasses: [],
  11029. messageSends: []
  11030. }),
  11031. $globals.String);
  11032. $core.addMethod(
  11033. $core.method({
  11034. selector: "numericallyIndexable",
  11035. protocol: "private",
  11036. fn: function (){
  11037. var self=this;
  11038. return $core.withContext(function($ctx1) {
  11039. return String(self);
  11040. return self;
  11041. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  11042. },
  11043. args: [],
  11044. source: "numericallyIndexable\x0a\x09<inlineJS: 'return String(self)'>",
  11045. referencedClasses: [],
  11046. messageSends: []
  11047. }),
  11048. $globals.String);
  11049. $core.addMethod(
  11050. $core.method({
  11051. selector: "printNl",
  11052. protocol: "printing",
  11053. fn: function (){
  11054. var self=this;
  11055. return $core.withContext(function($ctx1) {
  11056. console.log(self);
  11057. return self;
  11058. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  11059. },
  11060. args: [],
  11061. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  11062. referencedClasses: [],
  11063. messageSends: []
  11064. }),
  11065. $globals.String);
  11066. $core.addMethod(
  11067. $core.method({
  11068. selector: "printOn:",
  11069. protocol: "printing",
  11070. fn: function (aStream){
  11071. var self=this;
  11072. return $core.withContext(function($ctx1) {
  11073. $recv(aStream)._nextPutAll_("'");
  11074. $ctx1.sendIdx["nextPutAll:"]=1;
  11075. $recv(aStream)._nextPutAll_(self._replace_with_("'","''"));
  11076. $ctx1.sendIdx["nextPutAll:"]=2;
  11077. $recv(aStream)._nextPutAll_("'");
  11078. return self;
  11079. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  11080. },
  11081. args: ["aStream"],
  11082. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  11083. referencedClasses: [],
  11084. messageSends: ["nextPutAll:", "replace:with:"]
  11085. }),
  11086. $globals.String);
  11087. $core.addMethod(
  11088. $core.method({
  11089. selector: "replace:with:",
  11090. protocol: "regular expressions",
  11091. fn: function (aString,anotherString){
  11092. var self=this;
  11093. return $core.withContext(function($ctx1) {
  11094. return self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  11095. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  11096. },
  11097. args: ["aString", "anotherString"],
  11098. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  11099. referencedClasses: ["RegularExpression"],
  11100. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  11101. }),
  11102. $globals.String);
  11103. $core.addMethod(
  11104. $core.method({
  11105. selector: "replaceRegexp:with:",
  11106. protocol: "regular expressions",
  11107. fn: function (aRegexp,aString){
  11108. var self=this;
  11109. return $core.withContext(function($ctx1) {
  11110. return self.replace(aRegexp, aString);
  11111. return self;
  11112. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  11113. },
  11114. args: ["aRegexp", "aString"],
  11115. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  11116. referencedClasses: [],
  11117. messageSends: []
  11118. }),
  11119. $globals.String);
  11120. $core.addMethod(
  11121. $core.method({
  11122. selector: "reversed",
  11123. protocol: "converting",
  11124. fn: function (){
  11125. var self=this;
  11126. return $core.withContext(function($ctx1) {
  11127. return self.split("").reverse().join("");
  11128. return self;
  11129. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  11130. },
  11131. args: [],
  11132. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  11133. referencedClasses: [],
  11134. messageSends: []
  11135. }),
  11136. $globals.String);
  11137. $core.addMethod(
  11138. $core.method({
  11139. selector: "shallowCopy",
  11140. protocol: "copying",
  11141. fn: function (){
  11142. var self=this;
  11143. return self;
  11144. },
  11145. args: [],
  11146. source: "shallowCopy\x0a\x09^ self",
  11147. referencedClasses: [],
  11148. messageSends: []
  11149. }),
  11150. $globals.String);
  11151. $core.addMethod(
  11152. $core.method({
  11153. selector: "size",
  11154. protocol: "accessing",
  11155. fn: function (){
  11156. var self=this;
  11157. return $core.withContext(function($ctx1) {
  11158. return self.length;
  11159. return self;
  11160. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  11161. },
  11162. args: [],
  11163. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  11164. referencedClasses: [],
  11165. messageSends: []
  11166. }),
  11167. $globals.String);
  11168. $core.addMethod(
  11169. $core.method({
  11170. selector: "subStrings:",
  11171. protocol: "split join",
  11172. fn: function (aString){
  11173. var self=this;
  11174. return $core.withContext(function($ctx1) {
  11175. return self._tokenize_(aString);
  11176. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  11177. },
  11178. args: ["aString"],
  11179. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  11180. referencedClasses: [],
  11181. messageSends: ["tokenize:"]
  11182. }),
  11183. $globals.String);
  11184. $core.addMethod(
  11185. $core.method({
  11186. selector: "tokenize:",
  11187. protocol: "split join",
  11188. fn: function (aString){
  11189. var self=this;
  11190. return $core.withContext(function($ctx1) {
  11191. return self.split(aString);
  11192. return self;
  11193. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  11194. },
  11195. args: ["aString"],
  11196. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  11197. referencedClasses: [],
  11198. messageSends: []
  11199. }),
  11200. $globals.String);
  11201. $core.addMethod(
  11202. $core.method({
  11203. selector: "trimBoth",
  11204. protocol: "regular expressions",
  11205. fn: function (){
  11206. var self=this;
  11207. return $core.withContext(function($ctx1) {
  11208. return self._trimBoth_("\x5cs");
  11209. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  11210. },
  11211. args: [],
  11212. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  11213. referencedClasses: [],
  11214. messageSends: ["trimBoth:"]
  11215. }),
  11216. $globals.String);
  11217. $core.addMethod(
  11218. $core.method({
  11219. selector: "trimBoth:",
  11220. protocol: "regular expressions",
  11221. fn: function (separators){
  11222. var self=this;
  11223. return $core.withContext(function($ctx1) {
  11224. return $recv(self._trimLeft_(separators))._trimRight_(separators);
  11225. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  11226. },
  11227. args: ["separators"],
  11228. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  11229. referencedClasses: [],
  11230. messageSends: ["trimRight:", "trimLeft:"]
  11231. }),
  11232. $globals.String);
  11233. $core.addMethod(
  11234. $core.method({
  11235. selector: "trimLeft",
  11236. protocol: "regular expressions",
  11237. fn: function (){
  11238. var self=this;
  11239. return $core.withContext(function($ctx1) {
  11240. return self._trimLeft_("\x5cs");
  11241. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  11242. },
  11243. args: [],
  11244. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  11245. referencedClasses: [],
  11246. messageSends: ["trimLeft:"]
  11247. }),
  11248. $globals.String);
  11249. $core.addMethod(
  11250. $core.method({
  11251. selector: "trimLeft:",
  11252. protocol: "regular expressions",
  11253. fn: function (separators){
  11254. var self=this;
  11255. return $core.withContext(function($ctx1) {
  11256. var $2,$1;
  11257. $2=$recv("^[".__comma(separators)).__comma("]+");
  11258. $ctx1.sendIdx[","]=1;
  11259. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  11260. return self._replaceRegexp_with_($1,"");
  11261. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  11262. },
  11263. args: ["separators"],
  11264. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  11265. referencedClasses: ["RegularExpression"],
  11266. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  11267. }),
  11268. $globals.String);
  11269. $core.addMethod(
  11270. $core.method({
  11271. selector: "trimRight",
  11272. protocol: "regular expressions",
  11273. fn: function (){
  11274. var self=this;
  11275. return $core.withContext(function($ctx1) {
  11276. return self._trimRight_("\x5cs");
  11277. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  11278. },
  11279. args: [],
  11280. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  11281. referencedClasses: [],
  11282. messageSends: ["trimRight:"]
  11283. }),
  11284. $globals.String);
  11285. $core.addMethod(
  11286. $core.method({
  11287. selector: "trimRight:",
  11288. protocol: "regular expressions",
  11289. fn: function (separators){
  11290. var self=this;
  11291. return $core.withContext(function($ctx1) {
  11292. var $2,$1;
  11293. $2=$recv("[".__comma(separators)).__comma("]+$");
  11294. $ctx1.sendIdx[","]=1;
  11295. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  11296. return self._replaceRegexp_with_($1,"");
  11297. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  11298. },
  11299. args: ["separators"],
  11300. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  11301. referencedClasses: ["RegularExpression"],
  11302. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  11303. }),
  11304. $globals.String);
  11305. $core.addMethod(
  11306. $core.method({
  11307. selector: "unescaped",
  11308. protocol: "converting",
  11309. fn: function (){
  11310. var self=this;
  11311. return $core.withContext(function($ctx1) {
  11312. return unescape(self);
  11313. return self;
  11314. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  11315. },
  11316. args: [],
  11317. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  11318. referencedClasses: [],
  11319. messageSends: []
  11320. }),
  11321. $globals.String);
  11322. $core.addMethod(
  11323. $core.method({
  11324. selector: "uriComponentDecoded",
  11325. protocol: "converting",
  11326. fn: function (){
  11327. var self=this;
  11328. return $core.withContext(function($ctx1) {
  11329. return decodeURIComponent(self);
  11330. return self;
  11331. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  11332. },
  11333. args: [],
  11334. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  11335. referencedClasses: [],
  11336. messageSends: []
  11337. }),
  11338. $globals.String);
  11339. $core.addMethod(
  11340. $core.method({
  11341. selector: "uriComponentEncoded",
  11342. protocol: "converting",
  11343. fn: function (){
  11344. var self=this;
  11345. return $core.withContext(function($ctx1) {
  11346. return encodeURIComponent(self);
  11347. return self;
  11348. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  11349. },
  11350. args: [],
  11351. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  11352. referencedClasses: [],
  11353. messageSends: []
  11354. }),
  11355. $globals.String);
  11356. $core.addMethod(
  11357. $core.method({
  11358. selector: "uriDecoded",
  11359. protocol: "converting",
  11360. fn: function (){
  11361. var self=this;
  11362. return $core.withContext(function($ctx1) {
  11363. return decodeURI(self);
  11364. return self;
  11365. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  11366. },
  11367. args: [],
  11368. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  11369. referencedClasses: [],
  11370. messageSends: []
  11371. }),
  11372. $globals.String);
  11373. $core.addMethod(
  11374. $core.method({
  11375. selector: "uriEncoded",
  11376. protocol: "converting",
  11377. fn: function (){
  11378. var self=this;
  11379. return $core.withContext(function($ctx1) {
  11380. return encodeURI(self);
  11381. return self;
  11382. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  11383. },
  11384. args: [],
  11385. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  11386. referencedClasses: [],
  11387. messageSends: []
  11388. }),
  11389. $globals.String);
  11390. $core.addMethod(
  11391. $core.method({
  11392. selector: "value:",
  11393. protocol: "evaluating",
  11394. fn: function (anObject){
  11395. var self=this;
  11396. return $core.withContext(function($ctx1) {
  11397. return $recv(anObject)._perform_(self);
  11398. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  11399. },
  11400. args: ["anObject"],
  11401. source: "value: anObject \x0a\x09^ anObject perform: self",
  11402. referencedClasses: [],
  11403. messageSends: ["perform:"]
  11404. }),
  11405. $globals.String);
  11406. $core.addMethod(
  11407. $core.method({
  11408. selector: "cr",
  11409. protocol: "accessing",
  11410. fn: function (){
  11411. var self=this;
  11412. return $core.withContext(function($ctx1) {
  11413. return "\r";
  11414. return self;
  11415. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
  11416. },
  11417. args: [],
  11418. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  11419. referencedClasses: [],
  11420. messageSends: []
  11421. }),
  11422. $globals.String.klass);
  11423. $core.addMethod(
  11424. $core.method({
  11425. selector: "crlf",
  11426. protocol: "accessing",
  11427. fn: function (){
  11428. var self=this;
  11429. return $core.withContext(function($ctx1) {
  11430. return "\r\n";
  11431. return self;
  11432. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
  11433. },
  11434. args: [],
  11435. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  11436. referencedClasses: [],
  11437. messageSends: []
  11438. }),
  11439. $globals.String.klass);
  11440. $core.addMethod(
  11441. $core.method({
  11442. selector: "esc",
  11443. protocol: "accessing",
  11444. fn: function (){
  11445. var self=this;
  11446. return $core.withContext(function($ctx1) {
  11447. return self._fromCharCode_((27));
  11448. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
  11449. },
  11450. args: [],
  11451. source: "esc\x0a\x09^ self fromCharCode: 27",
  11452. referencedClasses: [],
  11453. messageSends: ["fromCharCode:"]
  11454. }),
  11455. $globals.String.klass);
  11456. $core.addMethod(
  11457. $core.method({
  11458. selector: "fromCharCode:",
  11459. protocol: "instance creation",
  11460. fn: function (anInteger){
  11461. var self=this;
  11462. return $core.withContext(function($ctx1) {
  11463. return String.fromCharCode(anInteger);
  11464. return self;
  11465. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
  11466. },
  11467. args: ["anInteger"],
  11468. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  11469. referencedClasses: [],
  11470. messageSends: []
  11471. }),
  11472. $globals.String.klass);
  11473. $core.addMethod(
  11474. $core.method({
  11475. selector: "fromString:",
  11476. protocol: "instance creation",
  11477. fn: function (aString){
  11478. var self=this;
  11479. return $core.withContext(function($ctx1) {
  11480. return String(aString);
  11481. return self;
  11482. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
  11483. },
  11484. args: ["aString"],
  11485. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  11486. referencedClasses: [],
  11487. messageSends: []
  11488. }),
  11489. $globals.String.klass);
  11490. $core.addMethod(
  11491. $core.method({
  11492. selector: "lf",
  11493. protocol: "accessing",
  11494. fn: function (){
  11495. var self=this;
  11496. return $core.withContext(function($ctx1) {
  11497. return "\n";
  11498. return self;
  11499. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
  11500. },
  11501. args: [],
  11502. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  11503. referencedClasses: [],
  11504. messageSends: []
  11505. }),
  11506. $globals.String.klass);
  11507. $core.addMethod(
  11508. $core.method({
  11509. selector: "random",
  11510. protocol: "random",
  11511. fn: function (){
  11512. var self=this;
  11513. return $core.withContext(function($ctx1) {
  11514. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  11515. return self;
  11516. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
  11517. },
  11518. args: [],
  11519. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);'>",
  11520. referencedClasses: [],
  11521. messageSends: []
  11522. }),
  11523. $globals.String.klass);
  11524. $core.addMethod(
  11525. $core.method({
  11526. selector: "randomNotIn:",
  11527. protocol: "random",
  11528. fn: function (aString){
  11529. var self=this;
  11530. var result;
  11531. return $core.withContext(function($ctx1) {
  11532. $recv((function(){
  11533. return $core.withContext(function($ctx2) {
  11534. result=self._random();
  11535. result;
  11536. return $recv(aString)._includesSubString_(result);
  11537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11538. }))._whileTrue();
  11539. return result;
  11540. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
  11541. },
  11542. args: ["aString"],
  11543. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  11544. referencedClasses: [],
  11545. messageSends: ["whileTrue", "random", "includesSubString:"]
  11546. }),
  11547. $globals.String.klass);
  11548. $core.addMethod(
  11549. $core.method({
  11550. selector: "space",
  11551. protocol: "accessing",
  11552. fn: function (){
  11553. var self=this;
  11554. return $core.withContext(function($ctx1) {
  11555. return " ";
  11556. return self;
  11557. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
  11558. },
  11559. args: [],
  11560. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  11561. referencedClasses: [],
  11562. messageSends: []
  11563. }),
  11564. $globals.String.klass);
  11565. $core.addMethod(
  11566. $core.method({
  11567. selector: "streamClass",
  11568. protocol: "accessing",
  11569. fn: function (){
  11570. var self=this;
  11571. return $globals.StringStream;
  11572. },
  11573. args: [],
  11574. source: "streamClass\x0a\x09\x09^ StringStream",
  11575. referencedClasses: ["StringStream"],
  11576. messageSends: []
  11577. }),
  11578. $globals.String.klass);
  11579. $core.addMethod(
  11580. $core.method({
  11581. selector: "tab",
  11582. protocol: "accessing",
  11583. fn: function (){
  11584. var self=this;
  11585. return $core.withContext(function($ctx1) {
  11586. return "\t";
  11587. return self;
  11588. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
  11589. },
  11590. args: [],
  11591. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  11592. referencedClasses: [],
  11593. messageSends: []
  11594. }),
  11595. $globals.String.klass);
  11596. $core.addMethod(
  11597. $core.method({
  11598. selector: "value:",
  11599. protocol: "instance creation",
  11600. fn: function (aUTFCharCode){
  11601. var self=this;
  11602. return $core.withContext(function($ctx1) {
  11603. return String.fromCharCode(aUTFCharCode);;
  11604. return self;
  11605. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
  11606. },
  11607. args: ["aUTFCharCode"],
  11608. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  11609. referencedClasses: [],
  11610. messageSends: []
  11611. }),
  11612. $globals.String.klass);
  11613. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  11614. $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`.";
  11615. $core.addMethod(
  11616. $core.method({
  11617. selector: "=",
  11618. protocol: "comparing",
  11619. fn: function (aCollection){
  11620. var self=this;
  11621. return $core.withContext(function($ctx1) {
  11622. var $2,$1,$4,$3,$5;
  11623. var $early={};
  11624. try {
  11625. $2=self._class();
  11626. $ctx1.sendIdx["class"]=1;
  11627. $1=$recv($2).__eq($recv(aCollection)._class());
  11628. $ctx1.sendIdx["="]=1;
  11629. if(!$core.assert($1)){
  11630. return false;
  11631. }
  11632. $4=self._size();
  11633. $ctx1.sendIdx["size"]=1;
  11634. $3=$recv($4).__eq($recv(aCollection)._size());
  11635. if(!$core.assert($3)){
  11636. return false;
  11637. }
  11638. self._do_((function(each){
  11639. return $core.withContext(function($ctx2) {
  11640. $5=$recv(aCollection)._includes_(each);
  11641. if(!$core.assert($5)){
  11642. throw $early=[false];
  11643. }
  11644. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  11645. }));
  11646. return true;
  11647. }
  11648. catch(e) {if(e===$early)return e[0]; throw e}
  11649. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  11650. },
  11651. args: ["aCollection"],
  11652. 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",
  11653. referencedClasses: [],
  11654. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  11655. }),
  11656. $globals.Set);
  11657. $core.addMethod(
  11658. $core.method({
  11659. selector: "add:",
  11660. protocol: "adding/removing",
  11661. fn: function (anObject){
  11662. var self=this;
  11663. var bucket;
  11664. return $core.withContext(function($ctx1) {
  11665. var $1,$receiver;
  11666. bucket=self._bucketsOfElement_(anObject);
  11667. $1=$recv(bucket)._second();
  11668. if(($receiver = $1) == null || $receiver.isNil){
  11669. var object,slowBucket;
  11670. object=$recv(bucket)._first();
  11671. $ctx1.sendIdx["first"]=1;
  11672. object;
  11673. slowBucket=$recv(bucket)._third();
  11674. slowBucket;
  11675. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  11676. return $core.withContext(function($ctx2) {
  11677. $recv(slowBucket)._add_(object);
  11678. self["@size"]=$recv(self["@size"]).__plus((1));
  11679. return self["@size"];
  11680. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  11681. }));
  11682. return object;
  11683. } else {
  11684. var primitiveBucket;
  11685. primitiveBucket=$receiver;
  11686. return self._add_in_($recv(bucket)._first(),primitiveBucket);
  11687. }
  11688. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  11689. },
  11690. args: ["anObject"],
  11691. 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 ]",
  11692. referencedClasses: [],
  11693. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  11694. }),
  11695. $globals.Set);
  11696. $core.addMethod(
  11697. $core.method({
  11698. selector: "add:in:",
  11699. protocol: "private",
  11700. fn: function (anObject,anotherObject){
  11701. var self=this;
  11702. return $core.withContext(function($ctx1) {
  11703. if (anObject in anotherObject.store) { return false; }
  11704. self['@size']++;
  11705. anotherObject.store[anObject] = true;
  11706. return anObject;
  11707. ;
  11708. return self;
  11709. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  11710. },
  11711. args: ["anObject", "anotherObject"],
  11712. source: "add: anObject in: anotherObject\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09self[''@size'']++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09'>",
  11713. referencedClasses: [],
  11714. messageSends: []
  11715. }),
  11716. $globals.Set);
  11717. $core.addMethod(
  11718. $core.method({
  11719. selector: "bucketsOfElement:",
  11720. protocol: "private",
  11721. fn: function (anObject){
  11722. var self=this;
  11723. return $core.withContext(function($ctx1) {
  11724. // include nil to well-known objects under "boolean" fastBucket
  11725. if (anObject == null || anObject.isNil) return [ null, self['@fastBuckets'].boolean ];
  11726. var prim = anObject.valueOf();
  11727. if (typeof prim === "object" || typeof prim === "function" || !self['@fastBuckets'][typeof prim]) {
  11728. var bucket = null;
  11729. self['@slowBucketStores'].some(function (store) {
  11730. return bucket = store._bucketOfElement_(anObject);
  11731. });
  11732. return [ anObject, null, bucket || self['@defaultBucket'] ];
  11733. }
  11734. return [ prim, self['@fastBuckets'][typeof prim] ];
  11735. ;
  11736. return self;
  11737. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  11738. },
  11739. args: ["anObject"],
  11740. 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.isNil) 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\x09self[''@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'>",
  11741. referencedClasses: [],
  11742. messageSends: []
  11743. }),
  11744. $globals.Set);
  11745. $core.addMethod(
  11746. $core.method({
  11747. selector: "classNameOf:",
  11748. protocol: "private",
  11749. fn: function (anObject){
  11750. var self=this;
  11751. return $core.withContext(function($ctx1) {
  11752. return anObject.klass != null && anObject.klass.className;
  11753. return self;
  11754. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  11755. },
  11756. args: ["anObject"],
  11757. 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.klass != null && anObject.klass.className'>",
  11758. referencedClasses: [],
  11759. messageSends: []
  11760. }),
  11761. $globals.Set);
  11762. $core.addMethod(
  11763. $core.method({
  11764. selector: "collect:",
  11765. protocol: "enumerating",
  11766. fn: function (aBlock){
  11767. var self=this;
  11768. var collection;
  11769. return $core.withContext(function($ctx1) {
  11770. collection=$recv(self._class())._new();
  11771. self._do_((function(each){
  11772. return $core.withContext(function($ctx2) {
  11773. return $recv(collection)._add_($recv(aBlock)._value_(each));
  11774. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11775. }));
  11776. return collection;
  11777. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  11778. },
  11779. args: ["aBlock"],
  11780. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  11781. referencedClasses: [],
  11782. messageSends: ["new", "class", "do:", "add:", "value:"]
  11783. }),
  11784. $globals.Set);
  11785. $core.addMethod(
  11786. $core.method({
  11787. selector: "detect:ifNone:",
  11788. protocol: "enumerating",
  11789. fn: function (aBlock,anotherBlock){
  11790. var self=this;
  11791. return $core.withContext(function($ctx1) {
  11792. var $1;
  11793. var $early={};
  11794. try {
  11795. self._do_((function(each){
  11796. return $core.withContext(function($ctx2) {
  11797. $1=$recv(aBlock)._value_(each);
  11798. if($core.assert($1)){
  11799. throw $early=[each];
  11800. }
  11801. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11802. }));
  11803. return $recv(anotherBlock)._value();
  11804. }
  11805. catch(e) {if(e===$early)return e[0]; throw e}
  11806. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  11807. },
  11808. args: ["aBlock", "anotherBlock"],
  11809. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  11810. referencedClasses: [],
  11811. messageSends: ["do:", "ifTrue:", "value:", "value"]
  11812. }),
  11813. $globals.Set);
  11814. $core.addMethod(
  11815. $core.method({
  11816. selector: "do:",
  11817. protocol: "enumerating",
  11818. fn: function (aBlock){
  11819. var self=this;
  11820. return $core.withContext(function($ctx1) {
  11821. var el, keys, i;
  11822. el = self['@fastBuckets'];
  11823. keys = Object.keys(el);
  11824. for (i = 0; i < keys.length; ++i) {
  11825. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  11826. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  11827. else { store._do_(aBlock); }
  11828. }
  11829. el = self['@slowBucketStores'];
  11830. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  11831. self['@defaultBucket']._do_(aBlock);
  11832. ;
  11833. return self;
  11834. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  11835. },
  11836. args: ["aBlock"],
  11837. 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\x09self[''@defaultBucket'']._do_(aBlock);\x0a\x09'>",
  11838. referencedClasses: [],
  11839. messageSends: []
  11840. }),
  11841. $globals.Set);
  11842. $core.addMethod(
  11843. $core.method({
  11844. selector: "includes:",
  11845. protocol: "testing",
  11846. fn: function (anObject){
  11847. var self=this;
  11848. var bucket;
  11849. return $core.withContext(function($ctx1) {
  11850. var $1,$2,$3,$receiver;
  11851. bucket=self._bucketsOfElement_(anObject);
  11852. $1=$recv(bucket)._second();
  11853. if(($receiver = $1) == null || $receiver.isNil){
  11854. $2=$recv(bucket)._third();
  11855. $3=$recv(bucket)._first();
  11856. $ctx1.sendIdx["first"]=1;
  11857. return $recv($2)._includes_($3);
  11858. } else {
  11859. var primitiveBucket;
  11860. primitiveBucket=$receiver;
  11861. return self._includes_in_($recv(bucket)._first(),primitiveBucket);
  11862. }
  11863. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  11864. },
  11865. args: ["anObject"],
  11866. 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 ]",
  11867. referencedClasses: [],
  11868. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  11869. }),
  11870. $globals.Set);
  11871. $core.addMethod(
  11872. $core.method({
  11873. selector: "includes:in:",
  11874. protocol: "private",
  11875. fn: function (anObject,anotherObject){
  11876. var self=this;
  11877. return $core.withContext(function($ctx1) {
  11878. return anObject in anotherObject.store;
  11879. return self;
  11880. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  11881. },
  11882. args: ["anObject", "anotherObject"],
  11883. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  11884. referencedClasses: [],
  11885. messageSends: []
  11886. }),
  11887. $globals.Set);
  11888. $core.addMethod(
  11889. $core.method({
  11890. selector: "initialize",
  11891. protocol: "initialization",
  11892. fn: function (){
  11893. var self=this;
  11894. return $core.withContext(function($ctx1) {
  11895. (
  11896. $ctx1.supercall = true,
  11897. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  11898. $ctx1.supercall = false;
  11899. self["@defaultBucket"]=[];
  11900. self._initializeSlowBucketStores();
  11901. self._removeAll();
  11902. return self;
  11903. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  11904. },
  11905. args: [],
  11906. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  11907. referencedClasses: [],
  11908. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  11909. }),
  11910. $globals.Set);
  11911. $core.addMethod(
  11912. $core.method({
  11913. selector: "initializeSlowBucketStores",
  11914. protocol: "initialization",
  11915. fn: function (){
  11916. var self=this;
  11917. return $core.withContext(function($ctx1) {
  11918. var $1;
  11919. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  11920. return $core.withContext(function($ctx2) {
  11921. return self._classNameOf_(x);
  11922. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  11923. }));
  11924. $ctx1.sendIdx["hashBlock:"]=1;
  11925. self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  11926. return $core.withContext(function($ctx2) {
  11927. return self._jsConstructorNameOf_(x);
  11928. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  11929. }))];
  11930. return self;
  11931. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  11932. },
  11933. args: [],
  11934. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  11935. referencedClasses: ["ArrayBucketStore"],
  11936. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  11937. }),
  11938. $globals.Set);
  11939. $core.addMethod(
  11940. $core.method({
  11941. selector: "jsConstructorNameOf:",
  11942. protocol: "private",
  11943. fn: function (anObject){
  11944. var self=this;
  11945. return $core.withContext(function($ctx1) {
  11946. return anObject.constructor && anObject.constructor.name;
  11947. return self;
  11948. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  11949. },
  11950. args: ["anObject"],
  11951. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  11952. referencedClasses: [],
  11953. messageSends: []
  11954. }),
  11955. $globals.Set);
  11956. $core.addMethod(
  11957. $core.method({
  11958. selector: "printOn:",
  11959. protocol: "printing",
  11960. fn: function (aStream){
  11961. var self=this;
  11962. return $core.withContext(function($ctx1) {
  11963. (
  11964. $ctx1.supercall = true,
  11965. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  11966. $ctx1.supercall = false;
  11967. $ctx1.sendIdx["printOn:"]=1;
  11968. $recv(aStream)._nextPutAll_(" (");
  11969. $ctx1.sendIdx["nextPutAll:"]=1;
  11970. self._do_separatedBy_((function(each){
  11971. return $core.withContext(function($ctx2) {
  11972. return $recv(each)._printOn_(aStream);
  11973. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11974. }),(function(){
  11975. return $core.withContext(function($ctx2) {
  11976. return $recv(aStream)._nextPutAll_(" ");
  11977. $ctx2.sendIdx["nextPutAll:"]=2;
  11978. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  11979. }));
  11980. $recv(aStream)._nextPutAll_(")");
  11981. return self;
  11982. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  11983. },
  11984. args: ["aStream"],
  11985. 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: ')'",
  11986. referencedClasses: [],
  11987. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  11988. }),
  11989. $globals.Set);
  11990. $core.addMethod(
  11991. $core.method({
  11992. selector: "remove:ifAbsent:",
  11993. protocol: "adding/removing",
  11994. fn: function (anObject,aBlock){
  11995. var self=this;
  11996. var bucket;
  11997. return $core.withContext(function($ctx1) {
  11998. var $1,$2,$3,$receiver;
  11999. var $early={};
  12000. try {
  12001. bucket=self._bucketsOfElement_(anObject);
  12002. $1=$recv(bucket)._second();
  12003. if(($receiver = $1) == null || $receiver.isNil){
  12004. $2=$recv(bucket)._third();
  12005. $3=$recv(bucket)._first();
  12006. $ctx1.sendIdx["first"]=1;
  12007. $recv($2)._remove_ifAbsent_($3,(function(){
  12008. return $core.withContext(function($ctx2) {
  12009. throw $early=[$recv(aBlock)._value()];
  12010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12011. }));
  12012. self["@size"]=$recv(self["@size"]).__minus((1));
  12013. return self["@size"];
  12014. } else {
  12015. var primitiveBucket;
  12016. primitiveBucket=$receiver;
  12017. return self._remove_in_($recv(bucket)._first(),primitiveBucket);
  12018. }
  12019. }
  12020. catch(e) {if(e===$early)return e[0]; throw e}
  12021. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  12022. },
  12023. args: ["anObject", "aBlock"],
  12024. 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 ]",
  12025. referencedClasses: [],
  12026. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  12027. }),
  12028. $globals.Set);
  12029. $core.addMethod(
  12030. $core.method({
  12031. selector: "remove:in:",
  12032. protocol: "private",
  12033. fn: function (anObject,anotherObject){
  12034. var self=this;
  12035. return $core.withContext(function($ctx1) {
  12036. if (delete anotherObject.store[anObject]) self['@size']--;
  12037. return self;
  12038. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12039. },
  12040. args: ["anObject", "anotherObject"],
  12041. source: "remove: anObject in: anotherObject\x0a\x09<inlineJS: 'if (delete anotherObject.store[anObject]) self[''@size'']--'>",
  12042. referencedClasses: [],
  12043. messageSends: []
  12044. }),
  12045. $globals.Set);
  12046. $core.addMethod(
  12047. $core.method({
  12048. selector: "removeAll",
  12049. protocol: "adding/removing",
  12050. fn: function (){
  12051. var self=this;
  12052. return $core.withContext(function($ctx1) {
  12053. self['@fastBuckets'] = {
  12054. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  12055. "number": { store: Object.create(null), fn: Number },
  12056. "string": { store: Object.create(null) }
  12057. };
  12058. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  12059. self['@defaultBucket']._removeAll();
  12060. self['@size'] = 0;
  12061. ;
  12062. return self;
  12063. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  12064. },
  12065. args: [],
  12066. source: "removeAll\x0a\x09<inlineJS: '\x0a\x09\x09self[''@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\x09self[''@slowBucketStores''].forEach(function (x) { x._removeAll(); });\x0a\x09\x09self[''@defaultBucket'']._removeAll();\x0a\x09\x09self[''@size''] = 0;\x0a\x09'>",
  12067. referencedClasses: [],
  12068. messageSends: []
  12069. }),
  12070. $globals.Set);
  12071. $core.addMethod(
  12072. $core.method({
  12073. selector: "select:",
  12074. protocol: "enumerating",
  12075. fn: function (aBlock){
  12076. var self=this;
  12077. var collection;
  12078. return $core.withContext(function($ctx1) {
  12079. var $1;
  12080. collection=$recv(self._class())._new();
  12081. self._do_((function(each){
  12082. return $core.withContext(function($ctx2) {
  12083. $1=$recv(aBlock)._value_(each);
  12084. if($core.assert($1)){
  12085. return $recv(collection)._add_(each);
  12086. }
  12087. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12088. }));
  12089. return collection;
  12090. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12091. },
  12092. args: ["aBlock"],
  12093. 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",
  12094. referencedClasses: [],
  12095. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  12096. }),
  12097. $globals.Set);
  12098. $core.addMethod(
  12099. $core.method({
  12100. selector: "select:thenCollect:",
  12101. protocol: "enumerating",
  12102. fn: function (selectBlock,collectBlock){
  12103. var self=this;
  12104. var collection;
  12105. return $core.withContext(function($ctx1) {
  12106. var $1;
  12107. collection=$recv(self._class())._new();
  12108. self._do_((function(each){
  12109. return $core.withContext(function($ctx2) {
  12110. $1=$recv(selectBlock)._value_(each);
  12111. $ctx2.sendIdx["value:"]=1;
  12112. if($core.assert($1)){
  12113. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  12114. }
  12115. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12116. }));
  12117. return collection;
  12118. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  12119. },
  12120. args: ["selectBlock", "collectBlock"],
  12121. 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",
  12122. referencedClasses: [],
  12123. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  12124. }),
  12125. $globals.Set);
  12126. $core.addMethod(
  12127. $core.method({
  12128. selector: "size",
  12129. protocol: "accessing",
  12130. fn: function (){
  12131. var self=this;
  12132. return self["@size"];
  12133. },
  12134. args: [],
  12135. source: "size\x0a\x09^ size",
  12136. referencedClasses: [],
  12137. messageSends: []
  12138. }),
  12139. $globals.Set);
  12140. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  12141. $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.";
  12142. $core.addMethod(
  12143. $core.method({
  12144. selector: "<<",
  12145. protocol: "writing",
  12146. fn: function (anObject){
  12147. var self=this;
  12148. return $core.withContext(function($ctx1) {
  12149. self._write_(anObject);
  12150. return self;
  12151. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  12152. },
  12153. args: ["anObject"],
  12154. source: "<< anObject\x0a\x09self write: anObject",
  12155. referencedClasses: [],
  12156. messageSends: ["write:"]
  12157. }),
  12158. $globals.ProtoStream);
  12159. $core.addMethod(
  12160. $core.method({
  12161. selector: "atEnd",
  12162. protocol: "testing",
  12163. fn: function (){
  12164. var self=this;
  12165. return $core.withContext(function($ctx1) {
  12166. self._subclassResponsibility();
  12167. return self;
  12168. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  12169. },
  12170. args: [],
  12171. source: "atEnd\x0a\x09self subclassResponsibility",
  12172. referencedClasses: [],
  12173. messageSends: ["subclassResponsibility"]
  12174. }),
  12175. $globals.ProtoStream);
  12176. $core.addMethod(
  12177. $core.method({
  12178. selector: "atStart",
  12179. protocol: "testing",
  12180. fn: function (){
  12181. var self=this;
  12182. return $core.withContext(function($ctx1) {
  12183. self._subclassResponsibility();
  12184. return self;
  12185. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  12186. },
  12187. args: [],
  12188. source: "atStart\x0a\x09self subclassResponsibility",
  12189. referencedClasses: [],
  12190. messageSends: ["subclassResponsibility"]
  12191. }),
  12192. $globals.ProtoStream);
  12193. $core.addMethod(
  12194. $core.method({
  12195. selector: "contents",
  12196. protocol: "accessing",
  12197. fn: function (){
  12198. var self=this;
  12199. return $core.withContext(function($ctx1) {
  12200. self._subclassResponsibility();
  12201. return self;
  12202. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  12203. },
  12204. args: [],
  12205. source: "contents\x0a\x09self subclassResponsibility",
  12206. referencedClasses: [],
  12207. messageSends: ["subclassResponsibility"]
  12208. }),
  12209. $globals.ProtoStream);
  12210. $core.addMethod(
  12211. $core.method({
  12212. selector: "do:",
  12213. protocol: "enumerating",
  12214. fn: function (aBlock){
  12215. var self=this;
  12216. return $core.withContext(function($ctx1) {
  12217. $recv((function(){
  12218. return $core.withContext(function($ctx2) {
  12219. return self._atEnd();
  12220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12221. }))._whileFalse_((function(){
  12222. return $core.withContext(function($ctx2) {
  12223. return $recv(aBlock)._value_(self._next());
  12224. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12225. }));
  12226. return self;
  12227. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  12228. },
  12229. args: ["aBlock"],
  12230. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  12231. referencedClasses: [],
  12232. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  12233. }),
  12234. $globals.ProtoStream);
  12235. $core.addMethod(
  12236. $core.method({
  12237. selector: "isEmpty",
  12238. protocol: "testing",
  12239. fn: function (){
  12240. var self=this;
  12241. return $core.withContext(function($ctx1) {
  12242. return $recv(self._atStart())._and_((function(){
  12243. return $core.withContext(function($ctx2) {
  12244. return self._atEnd();
  12245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12246. }));
  12247. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  12248. },
  12249. args: [],
  12250. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  12251. referencedClasses: [],
  12252. messageSends: ["and:", "atStart", "atEnd"]
  12253. }),
  12254. $globals.ProtoStream);
  12255. $core.addMethod(
  12256. $core.method({
  12257. selector: "next",
  12258. protocol: "reading",
  12259. fn: function (){
  12260. var self=this;
  12261. return $core.withContext(function($ctx1) {
  12262. var $1;
  12263. $1=self._atEnd();
  12264. if($core.assert($1)){
  12265. return nil;
  12266. } else {
  12267. return self._subclassResponsibility();
  12268. }
  12269. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  12270. },
  12271. args: [],
  12272. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  12273. referencedClasses: [],
  12274. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  12275. }),
  12276. $globals.ProtoStream);
  12277. $core.addMethod(
  12278. $core.method({
  12279. selector: "nextPut:",
  12280. protocol: "writing",
  12281. fn: function (anObject){
  12282. var self=this;
  12283. return $core.withContext(function($ctx1) {
  12284. self._subclassResponsibility();
  12285. return self;
  12286. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  12287. },
  12288. args: ["anObject"],
  12289. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  12290. referencedClasses: [],
  12291. messageSends: ["subclassResponsibility"]
  12292. }),
  12293. $globals.ProtoStream);
  12294. $core.addMethod(
  12295. $core.method({
  12296. selector: "nextPutAll:",
  12297. protocol: "writing",
  12298. fn: function (aCollection){
  12299. var self=this;
  12300. return $core.withContext(function($ctx1) {
  12301. $recv(aCollection)._do_((function(each){
  12302. return $core.withContext(function($ctx2) {
  12303. return self._nextPut_(each);
  12304. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12305. }));
  12306. return self;
  12307. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  12308. },
  12309. args: ["aCollection"],
  12310. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  12311. referencedClasses: [],
  12312. messageSends: ["do:", "nextPut:"]
  12313. }),
  12314. $globals.ProtoStream);
  12315. $core.addMethod(
  12316. $core.method({
  12317. selector: "nextPutJSObject:",
  12318. protocol: "writing",
  12319. fn: function (aJSObject){
  12320. var self=this;
  12321. return $core.withContext(function($ctx1) {
  12322. self._nextPut_(aJSObject);
  12323. return self;
  12324. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  12325. },
  12326. args: ["aJSObject"],
  12327. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  12328. referencedClasses: [],
  12329. messageSends: ["nextPut:"]
  12330. }),
  12331. $globals.ProtoStream);
  12332. $core.addMethod(
  12333. $core.method({
  12334. selector: "nextPutString:",
  12335. protocol: "writing",
  12336. fn: function (aString){
  12337. var self=this;
  12338. return $core.withContext(function($ctx1) {
  12339. self._nextPut_(aString);
  12340. return self;
  12341. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  12342. },
  12343. args: ["aString"],
  12344. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  12345. referencedClasses: [],
  12346. messageSends: ["nextPut:"]
  12347. }),
  12348. $globals.ProtoStream);
  12349. $core.addMethod(
  12350. $core.method({
  12351. selector: "peek",
  12352. protocol: "reading",
  12353. fn: function (){
  12354. var self=this;
  12355. return $core.withContext(function($ctx1) {
  12356. var $1;
  12357. $1=self._atEnd();
  12358. if($core.assert($1)){
  12359. return nil;
  12360. } else {
  12361. return self._subclassResponsibility();
  12362. }
  12363. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  12364. },
  12365. args: [],
  12366. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  12367. referencedClasses: [],
  12368. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  12369. }),
  12370. $globals.ProtoStream);
  12371. $core.addMethod(
  12372. $core.method({
  12373. selector: "reset",
  12374. protocol: "actions",
  12375. fn: function (){
  12376. var self=this;
  12377. return $core.withContext(function($ctx1) {
  12378. self._subclassResponsibility();
  12379. return self;
  12380. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  12381. },
  12382. args: [],
  12383. source: "reset\x0a\x09self subclassResponsibility",
  12384. referencedClasses: [],
  12385. messageSends: ["subclassResponsibility"]
  12386. }),
  12387. $globals.ProtoStream);
  12388. $core.addMethod(
  12389. $core.method({
  12390. selector: "resetContents",
  12391. protocol: "actions",
  12392. fn: function (){
  12393. var self=this;
  12394. return $core.withContext(function($ctx1) {
  12395. self._subclassResponsibility();
  12396. return self;
  12397. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  12398. },
  12399. args: [],
  12400. source: "resetContents\x0a\x09self subclassResponsibility",
  12401. referencedClasses: [],
  12402. messageSends: ["subclassResponsibility"]
  12403. }),
  12404. $globals.ProtoStream);
  12405. $core.addMethod(
  12406. $core.method({
  12407. selector: "setToEnd",
  12408. protocol: "positioning",
  12409. fn: function (){
  12410. var self=this;
  12411. return $core.withContext(function($ctx1) {
  12412. self._subclassResponsibility();
  12413. return self;
  12414. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  12415. },
  12416. args: [],
  12417. source: "setToEnd\x0a\x09self subclassResponsibility",
  12418. referencedClasses: [],
  12419. messageSends: ["subclassResponsibility"]
  12420. }),
  12421. $globals.ProtoStream);
  12422. $core.addMethod(
  12423. $core.method({
  12424. selector: "setToStart",
  12425. protocol: "positioning",
  12426. fn: function (){
  12427. var self=this;
  12428. return $core.withContext(function($ctx1) {
  12429. self._reset();
  12430. return self;
  12431. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  12432. },
  12433. args: [],
  12434. source: "setToStart\x0a\x09self reset",
  12435. referencedClasses: [],
  12436. messageSends: ["reset"]
  12437. }),
  12438. $globals.ProtoStream);
  12439. $core.addMethod(
  12440. $core.method({
  12441. selector: "write:",
  12442. protocol: "writing",
  12443. fn: function (anObject){
  12444. var self=this;
  12445. return $core.withContext(function($ctx1) {
  12446. $recv(anObject)._putOn_(self);
  12447. return self;
  12448. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  12449. },
  12450. args: ["anObject"],
  12451. source: "write: anObject\x0a\x09anObject putOn: self",
  12452. referencedClasses: [],
  12453. messageSends: ["putOn:"]
  12454. }),
  12455. $globals.ProtoStream);
  12456. $core.addMethod(
  12457. $core.method({
  12458. selector: "on:",
  12459. protocol: "instance creation",
  12460. fn: function (aCollection){
  12461. var self=this;
  12462. return $core.withContext(function($ctx1) {
  12463. var $1;
  12464. $1=self._new();
  12465. $recv($1)._setCollection_(aCollection);
  12466. $recv($1)._setStreamSize_($recv(aCollection)._size());
  12467. return $recv($1)._yourself();
  12468. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
  12469. },
  12470. args: ["aCollection"],
  12471. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  12472. referencedClasses: [],
  12473. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  12474. }),
  12475. $globals.ProtoStream.klass);
  12476. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  12477. $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.";
  12478. $core.addMethod(
  12479. $core.method({
  12480. selector: "atEnd",
  12481. protocol: "testing",
  12482. fn: function (){
  12483. var self=this;
  12484. return $core.withContext(function($ctx1) {
  12485. return $recv(self._position()).__eq(self._size());
  12486. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  12487. },
  12488. args: [],
  12489. source: "atEnd\x0a\x09^ self position = self size",
  12490. referencedClasses: [],
  12491. messageSends: ["=", "position", "size"]
  12492. }),
  12493. $globals.Stream);
  12494. $core.addMethod(
  12495. $core.method({
  12496. selector: "atStart",
  12497. protocol: "testing",
  12498. fn: function (){
  12499. var self=this;
  12500. return $core.withContext(function($ctx1) {
  12501. return $recv(self._position()).__eq((0));
  12502. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  12503. },
  12504. args: [],
  12505. source: "atStart\x0a\x09^ self position = 0",
  12506. referencedClasses: [],
  12507. messageSends: ["=", "position"]
  12508. }),
  12509. $globals.Stream);
  12510. $core.addMethod(
  12511. $core.method({
  12512. selector: "close",
  12513. protocol: "actions",
  12514. fn: function (){
  12515. var self=this;
  12516. return self;
  12517. },
  12518. args: [],
  12519. source: "close",
  12520. referencedClasses: [],
  12521. messageSends: []
  12522. }),
  12523. $globals.Stream);
  12524. $core.addMethod(
  12525. $core.method({
  12526. selector: "collection",
  12527. protocol: "accessing",
  12528. fn: function (){
  12529. var self=this;
  12530. return self["@collection"];
  12531. },
  12532. args: [],
  12533. source: "collection\x0a\x09^ collection",
  12534. referencedClasses: [],
  12535. messageSends: []
  12536. }),
  12537. $globals.Stream);
  12538. $core.addMethod(
  12539. $core.method({
  12540. selector: "contents",
  12541. protocol: "accessing",
  12542. fn: function (){
  12543. var self=this;
  12544. return $core.withContext(function($ctx1) {
  12545. return $recv(self._collection())._copyFrom_to_((1),self._streamSize());
  12546. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  12547. },
  12548. args: [],
  12549. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  12550. referencedClasses: [],
  12551. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  12552. }),
  12553. $globals.Stream);
  12554. $core.addMethod(
  12555. $core.method({
  12556. selector: "flush",
  12557. protocol: "actions",
  12558. fn: function (){
  12559. var self=this;
  12560. return self;
  12561. },
  12562. args: [],
  12563. source: "flush",
  12564. referencedClasses: [],
  12565. messageSends: []
  12566. }),
  12567. $globals.Stream);
  12568. $core.addMethod(
  12569. $core.method({
  12570. selector: "isEmpty",
  12571. protocol: "testing",
  12572. fn: function (){
  12573. var self=this;
  12574. return $core.withContext(function($ctx1) {
  12575. return $recv(self._size()).__eq((0));
  12576. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  12577. },
  12578. args: [],
  12579. source: "isEmpty\x0a\x09^ self size = 0",
  12580. referencedClasses: [],
  12581. messageSends: ["=", "size"]
  12582. }),
  12583. $globals.Stream);
  12584. $core.addMethod(
  12585. $core.method({
  12586. selector: "next",
  12587. protocol: "reading",
  12588. fn: function (){
  12589. var self=this;
  12590. return $core.withContext(function($ctx1) {
  12591. var $1,$3,$2;
  12592. $1=self._atEnd();
  12593. if($core.assert($1)){
  12594. return nil;
  12595. } else {
  12596. $3=self._position();
  12597. $ctx1.sendIdx["position"]=1;
  12598. $2=$recv($3).__plus((1));
  12599. self._position_($2);
  12600. return $recv(self["@collection"])._at_(self._position());
  12601. }
  12602. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  12603. },
  12604. args: [],
  12605. 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 ]",
  12606. referencedClasses: [],
  12607. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  12608. }),
  12609. $globals.Stream);
  12610. $core.addMethod(
  12611. $core.method({
  12612. selector: "next:",
  12613. protocol: "reading",
  12614. fn: function (anInteger){
  12615. var self=this;
  12616. var tempCollection;
  12617. return $core.withContext(function($ctx1) {
  12618. var $1;
  12619. tempCollection=$recv($recv(self._collection())._class())._new();
  12620. $recv(anInteger)._timesRepeat_((function(){
  12621. return $core.withContext(function($ctx2) {
  12622. $1=self._atEnd();
  12623. if(!$core.assert($1)){
  12624. return $recv(tempCollection)._add_(self._next());
  12625. }
  12626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12627. }));
  12628. return tempCollection;
  12629. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  12630. },
  12631. args: ["anInteger"],
  12632. 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",
  12633. referencedClasses: [],
  12634. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  12635. }),
  12636. $globals.Stream);
  12637. $core.addMethod(
  12638. $core.method({
  12639. selector: "nextPut:",
  12640. protocol: "writing",
  12641. fn: function (anObject){
  12642. var self=this;
  12643. return $core.withContext(function($ctx1) {
  12644. var $2,$1,$3,$4;
  12645. $2=self._position();
  12646. $ctx1.sendIdx["position"]=1;
  12647. $1=$recv($2).__plus((1));
  12648. self._position_($1);
  12649. $3=self._collection();
  12650. $4=self._position();
  12651. $ctx1.sendIdx["position"]=2;
  12652. $recv($3)._at_put_($4,anObject);
  12653. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  12654. return self;
  12655. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  12656. },
  12657. args: ["anObject"],
  12658. 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)",
  12659. referencedClasses: [],
  12660. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  12661. }),
  12662. $globals.Stream);
  12663. $core.addMethod(
  12664. $core.method({
  12665. selector: "peek",
  12666. protocol: "reading",
  12667. fn: function (){
  12668. var self=this;
  12669. return $core.withContext(function($ctx1) {
  12670. var $1;
  12671. $1=self._atEnd();
  12672. if(!$core.assert($1)){
  12673. return $recv(self._collection())._at_($recv(self._position()).__plus((1)));
  12674. }
  12675. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  12676. },
  12677. args: [],
  12678. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  12679. referencedClasses: [],
  12680. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  12681. }),
  12682. $globals.Stream);
  12683. $core.addMethod(
  12684. $core.method({
  12685. selector: "position",
  12686. protocol: "accessing",
  12687. fn: function (){
  12688. var self=this;
  12689. return $core.withContext(function($ctx1) {
  12690. var $1,$receiver;
  12691. $1=self["@position"];
  12692. if(($receiver = $1) == null || $receiver.isNil){
  12693. self["@position"]=(0);
  12694. return self["@position"];
  12695. } else {
  12696. return $1;
  12697. }
  12698. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  12699. },
  12700. args: [],
  12701. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  12702. referencedClasses: [],
  12703. messageSends: ["ifNil:"]
  12704. }),
  12705. $globals.Stream);
  12706. $core.addMethod(
  12707. $core.method({
  12708. selector: "position:",
  12709. protocol: "accessing",
  12710. fn: function (anInteger){
  12711. var self=this;
  12712. self["@position"]=anInteger;
  12713. return self;
  12714. },
  12715. args: ["anInteger"],
  12716. source: "position: anInteger\x0a\x09position := anInteger",
  12717. referencedClasses: [],
  12718. messageSends: []
  12719. }),
  12720. $globals.Stream);
  12721. $core.addMethod(
  12722. $core.method({
  12723. selector: "reset",
  12724. protocol: "actions",
  12725. fn: function (){
  12726. var self=this;
  12727. return $core.withContext(function($ctx1) {
  12728. self._position_((0));
  12729. return self;
  12730. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  12731. },
  12732. args: [],
  12733. source: "reset\x0a\x09self position: 0",
  12734. referencedClasses: [],
  12735. messageSends: ["position:"]
  12736. }),
  12737. $globals.Stream);
  12738. $core.addMethod(
  12739. $core.method({
  12740. selector: "resetContents",
  12741. protocol: "actions",
  12742. fn: function (){
  12743. var self=this;
  12744. return $core.withContext(function($ctx1) {
  12745. self._reset();
  12746. self._setStreamSize_((0));
  12747. return self;
  12748. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  12749. },
  12750. args: [],
  12751. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  12752. referencedClasses: [],
  12753. messageSends: ["reset", "setStreamSize:"]
  12754. }),
  12755. $globals.Stream);
  12756. $core.addMethod(
  12757. $core.method({
  12758. selector: "setCollection:",
  12759. protocol: "accessing",
  12760. fn: function (aCollection){
  12761. var self=this;
  12762. self["@collection"]=aCollection;
  12763. return self;
  12764. },
  12765. args: ["aCollection"],
  12766. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  12767. referencedClasses: [],
  12768. messageSends: []
  12769. }),
  12770. $globals.Stream);
  12771. $core.addMethod(
  12772. $core.method({
  12773. selector: "setStreamSize:",
  12774. protocol: "accessing",
  12775. fn: function (anInteger){
  12776. var self=this;
  12777. self["@streamSize"]=anInteger;
  12778. return self;
  12779. },
  12780. args: ["anInteger"],
  12781. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  12782. referencedClasses: [],
  12783. messageSends: []
  12784. }),
  12785. $globals.Stream);
  12786. $core.addMethod(
  12787. $core.method({
  12788. selector: "setToEnd",
  12789. protocol: "positioning",
  12790. fn: function (){
  12791. var self=this;
  12792. return $core.withContext(function($ctx1) {
  12793. self._position_(self._size());
  12794. return self;
  12795. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  12796. },
  12797. args: [],
  12798. source: "setToEnd\x0a\x09self position: self size",
  12799. referencedClasses: [],
  12800. messageSends: ["position:", "size"]
  12801. }),
  12802. $globals.Stream);
  12803. $core.addMethod(
  12804. $core.method({
  12805. selector: "size",
  12806. protocol: "accessing",
  12807. fn: function (){
  12808. var self=this;
  12809. return $core.withContext(function($ctx1) {
  12810. return self._streamSize();
  12811. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  12812. },
  12813. args: [],
  12814. source: "size\x0a\x09^ self streamSize",
  12815. referencedClasses: [],
  12816. messageSends: ["streamSize"]
  12817. }),
  12818. $globals.Stream);
  12819. $core.addMethod(
  12820. $core.method({
  12821. selector: "skip:",
  12822. protocol: "positioning",
  12823. fn: function (anInteger){
  12824. var self=this;
  12825. return $core.withContext(function($ctx1) {
  12826. self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  12827. return self;
  12828. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  12829. },
  12830. args: ["anInteger"],
  12831. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  12832. referencedClasses: [],
  12833. messageSends: ["position:", "min:max:", "+", "position", "size"]
  12834. }),
  12835. $globals.Stream);
  12836. $core.addMethod(
  12837. $core.method({
  12838. selector: "streamSize",
  12839. protocol: "accessing",
  12840. fn: function (){
  12841. var self=this;
  12842. return self["@streamSize"];
  12843. },
  12844. args: [],
  12845. source: "streamSize\x0a\x09^ streamSize",
  12846. referencedClasses: [],
  12847. messageSends: []
  12848. }),
  12849. $globals.Stream);
  12850. $core.addMethod(
  12851. $core.method({
  12852. selector: "on:",
  12853. protocol: "instance creation",
  12854. fn: function (aCollection){
  12855. var self=this;
  12856. return $core.withContext(function($ctx1) {
  12857. var $1;
  12858. $1=self._new();
  12859. $recv($1)._setCollection_(aCollection);
  12860. $recv($1)._setStreamSize_($recv(aCollection)._size());
  12861. return $recv($1)._yourself();
  12862. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
  12863. },
  12864. args: ["aCollection"],
  12865. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  12866. referencedClasses: [],
  12867. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  12868. }),
  12869. $globals.Stream.klass);
  12870. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  12871. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  12872. $core.addMethod(
  12873. $core.method({
  12874. selector: "cr",
  12875. protocol: "writing",
  12876. fn: function (){
  12877. var self=this;
  12878. return $core.withContext(function($ctx1) {
  12879. return self._nextPutAll_($recv($globals.String)._cr());
  12880. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  12881. },
  12882. args: [],
  12883. source: "cr\x0a\x09^ self nextPutAll: String cr",
  12884. referencedClasses: ["String"],
  12885. messageSends: ["nextPutAll:", "cr"]
  12886. }),
  12887. $globals.StringStream);
  12888. $core.addMethod(
  12889. $core.method({
  12890. selector: "crlf",
  12891. protocol: "writing",
  12892. fn: function (){
  12893. var self=this;
  12894. return $core.withContext(function($ctx1) {
  12895. return self._nextPutAll_($recv($globals.String)._crlf());
  12896. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  12897. },
  12898. args: [],
  12899. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  12900. referencedClasses: ["String"],
  12901. messageSends: ["nextPutAll:", "crlf"]
  12902. }),
  12903. $globals.StringStream);
  12904. $core.addMethod(
  12905. $core.method({
  12906. selector: "lf",
  12907. protocol: "writing",
  12908. fn: function (){
  12909. var self=this;
  12910. return $core.withContext(function($ctx1) {
  12911. return self._nextPutAll_($recv($globals.String)._lf());
  12912. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  12913. },
  12914. args: [],
  12915. source: "lf\x0a\x09^ self nextPutAll: String lf",
  12916. referencedClasses: ["String"],
  12917. messageSends: ["nextPutAll:", "lf"]
  12918. }),
  12919. $globals.StringStream);
  12920. $core.addMethod(
  12921. $core.method({
  12922. selector: "next:",
  12923. protocol: "reading",
  12924. fn: function (anInteger){
  12925. var self=this;
  12926. var tempCollection;
  12927. return $core.withContext(function($ctx1) {
  12928. var $1;
  12929. tempCollection=$recv($recv(self._collection())._class())._new();
  12930. $recv(anInteger)._timesRepeat_((function(){
  12931. return $core.withContext(function($ctx2) {
  12932. $1=self._atEnd();
  12933. if(!$core.assert($1)){
  12934. tempCollection=$recv(tempCollection).__comma(self._next());
  12935. return tempCollection;
  12936. }
  12937. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12938. }));
  12939. return tempCollection;
  12940. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  12941. },
  12942. args: ["anInteger"],
  12943. 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",
  12944. referencedClasses: [],
  12945. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  12946. }),
  12947. $globals.StringStream);
  12948. $core.addMethod(
  12949. $core.method({
  12950. selector: "nextPut:",
  12951. protocol: "writing",
  12952. fn: function (aString){
  12953. var self=this;
  12954. return $core.withContext(function($ctx1) {
  12955. self._nextPutAll_(aString);
  12956. return self;
  12957. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  12958. },
  12959. args: ["aString"],
  12960. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  12961. referencedClasses: [],
  12962. messageSends: ["nextPutAll:"]
  12963. }),
  12964. $globals.StringStream);
  12965. $core.addMethod(
  12966. $core.method({
  12967. selector: "nextPutAll:",
  12968. protocol: "writing",
  12969. fn: function (aString){
  12970. var self=this;
  12971. var pre,post;
  12972. return $core.withContext(function($ctx1) {
  12973. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  12974. $1=self._atEnd();
  12975. if($core.assert($1)){
  12976. $3=self._collection();
  12977. $ctx1.sendIdx["collection"]=1;
  12978. $2=$recv($3).__comma(aString);
  12979. $ctx1.sendIdx[","]=1;
  12980. self._setCollection_($2);
  12981. $ctx1.sendIdx["setCollection:"]=1;
  12982. } else {
  12983. $4=self._collection();
  12984. $ctx1.sendIdx["collection"]=2;
  12985. $5=self._position();
  12986. $ctx1.sendIdx["position"]=1;
  12987. pre=$recv($4)._copyFrom_to_((1),$5);
  12988. $ctx1.sendIdx["copyFrom:to:"]=1;
  12989. pre;
  12990. $6=self._collection();
  12991. $ctx1.sendIdx["collection"]=3;
  12992. $9=self._position();
  12993. $ctx1.sendIdx["position"]=2;
  12994. $8=$recv($9).__plus((1));
  12995. $ctx1.sendIdx["+"]=2;
  12996. $10=$recv(aString)._size();
  12997. $ctx1.sendIdx["size"]=1;
  12998. $7=$recv($8).__plus($10);
  12999. $ctx1.sendIdx["+"]=1;
  13000. $11=$recv(self._collection())._size();
  13001. $ctx1.sendIdx["size"]=2;
  13002. post=$recv($6)._copyFrom_to_($7,$11);
  13003. post;
  13004. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  13005. $ctx1.sendIdx[","]=2;
  13006. self._setCollection_($12);
  13007. }
  13008. $14=self._position();
  13009. $ctx1.sendIdx["position"]=3;
  13010. $13=$recv($14).__plus($recv(aString)._size());
  13011. self._position_($13);
  13012. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  13013. return self;
  13014. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  13015. },
  13016. args: ["aString"],
  13017. 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)",
  13018. referencedClasses: [],
  13019. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  13020. }),
  13021. $globals.StringStream);
  13022. $core.addMethod(
  13023. $core.method({
  13024. selector: "nextPutString:",
  13025. protocol: "writing",
  13026. fn: function (aString){
  13027. var self=this;
  13028. return $core.withContext(function($ctx1) {
  13029. self._nextPutAll_(aString);
  13030. return self;
  13031. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  13032. },
  13033. args: ["aString"],
  13034. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  13035. referencedClasses: [],
  13036. messageSends: ["nextPutAll:"]
  13037. }),
  13038. $globals.StringStream);
  13039. $core.addMethod(
  13040. $core.method({
  13041. selector: "print:",
  13042. protocol: "writing",
  13043. fn: function (anObject){
  13044. var self=this;
  13045. return $core.withContext(function($ctx1) {
  13046. $recv(anObject)._printOn_(self);
  13047. return self;
  13048. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  13049. },
  13050. args: ["anObject"],
  13051. source: "print: anObject\x0a\x09anObject printOn: self",
  13052. referencedClasses: [],
  13053. messageSends: ["printOn:"]
  13054. }),
  13055. $globals.StringStream);
  13056. $core.addMethod(
  13057. $core.method({
  13058. selector: "printSymbol:",
  13059. protocol: "writing",
  13060. fn: function (anObject){
  13061. var self=this;
  13062. return $core.withContext(function($ctx1) {
  13063. $recv(anObject)._asSymbolPrintOn_(self);
  13064. return self;
  13065. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  13066. },
  13067. args: ["anObject"],
  13068. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  13069. referencedClasses: [],
  13070. messageSends: ["asSymbolPrintOn:"]
  13071. }),
  13072. $globals.StringStream);
  13073. $core.addMethod(
  13074. $core.method({
  13075. selector: "space",
  13076. protocol: "writing",
  13077. fn: function (){
  13078. var self=this;
  13079. return $core.withContext(function($ctx1) {
  13080. self._nextPut_(" ");
  13081. return self;
  13082. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  13083. },
  13084. args: [],
  13085. source: "space\x0a\x09self nextPut: ' '",
  13086. referencedClasses: [],
  13087. messageSends: ["nextPut:"]
  13088. }),
  13089. $globals.StringStream);
  13090. $core.addMethod(
  13091. $core.method({
  13092. selector: "tab",
  13093. protocol: "writing",
  13094. fn: function (){
  13095. var self=this;
  13096. return $core.withContext(function($ctx1) {
  13097. return self._nextPutAll_($recv($globals.String)._tab());
  13098. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  13099. },
  13100. args: [],
  13101. source: "tab\x0a\x09^ self nextPutAll: String tab",
  13102. referencedClasses: ["String"],
  13103. messageSends: ["nextPutAll:", "tab"]
  13104. }),
  13105. $globals.StringStream);
  13106. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  13107. $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.";
  13108. $core.addMethod(
  13109. $core.method({
  13110. selector: "initialize",
  13111. protocol: "initialization",
  13112. fn: function (){
  13113. var self=this;
  13114. return $core.withContext(function($ctx1) {
  13115. (
  13116. $ctx1.supercall = true,
  13117. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  13118. $ctx1.supercall = false;
  13119. self["@read"]=$recv($globals.OrderedCollection)._new();
  13120. $ctx1.sendIdx["new"]=1;
  13121. self["@write"]=$recv($globals.OrderedCollection)._new();
  13122. self["@readIndex"]=(1);
  13123. return self;
  13124. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  13125. },
  13126. args: [],
  13127. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  13128. referencedClasses: ["OrderedCollection"],
  13129. messageSends: ["initialize", "new"]
  13130. }),
  13131. $globals.Queue);
  13132. $core.addMethod(
  13133. $core.method({
  13134. selector: "next",
  13135. protocol: "accessing",
  13136. fn: function (){
  13137. var self=this;
  13138. return $core.withContext(function($ctx1) {
  13139. return self._nextIfAbsent_((function(){
  13140. return $core.withContext(function($ctx2) {
  13141. return self._error_("Cannot read from empty Queue.");
  13142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13143. }));
  13144. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  13145. },
  13146. args: [],
  13147. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  13148. referencedClasses: [],
  13149. messageSends: ["nextIfAbsent:", "error:"]
  13150. }),
  13151. $globals.Queue);
  13152. $core.addMethod(
  13153. $core.method({
  13154. selector: "nextIfAbsent:",
  13155. protocol: "accessing",
  13156. fn: function (aBlock){
  13157. var self=this;
  13158. var result;
  13159. return $core.withContext(function($ctx1) {
  13160. var $1;
  13161. var $early={};
  13162. try {
  13163. result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  13164. return $core.withContext(function($ctx2) {
  13165. $recv(self["@write"])._ifEmpty_((function(){
  13166. return $core.withContext(function($ctx3) {
  13167. $1=$recv(self["@readIndex"]).__gt((1));
  13168. if($core.assert($1)){
  13169. self["@read"]=[];
  13170. self["@read"];
  13171. self["@readIndex"]=(1);
  13172. self["@readIndex"];
  13173. }
  13174. throw $early=[$recv(aBlock)._value()];
  13175. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  13176. }));
  13177. self["@read"]=self["@write"];
  13178. self["@read"];
  13179. self["@readIndex"]=(1);
  13180. self["@readIndex"];
  13181. self["@write"]=$recv($globals.OrderedCollection)._new();
  13182. self["@write"];
  13183. return $recv(self["@read"])._first();
  13184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13185. }));
  13186. $recv(self["@read"])._at_put_(self["@readIndex"],nil);
  13187. self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
  13188. return result;
  13189. }
  13190. catch(e) {if(e===$early)return e[0]; throw e}
  13191. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  13192. },
  13193. args: ["aBlock"],
  13194. 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",
  13195. referencedClasses: ["OrderedCollection"],
  13196. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  13197. }),
  13198. $globals.Queue);
  13199. $core.addMethod(
  13200. $core.method({
  13201. selector: "nextPut:",
  13202. protocol: "accessing",
  13203. fn: function (anObject){
  13204. var self=this;
  13205. return $core.withContext(function($ctx1) {
  13206. $recv(self["@write"])._add_(anObject);
  13207. return self;
  13208. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  13209. },
  13210. args: ["anObject"],
  13211. source: "nextPut: anObject\x0a\x09write add: anObject",
  13212. referencedClasses: [],
  13213. messageSends: ["add:"]
  13214. }),
  13215. $globals.Queue);
  13216. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  13217. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  13218. $core.addMethod(
  13219. $core.method({
  13220. selector: "compile:",
  13221. protocol: "evaluating",
  13222. fn: function (aString){
  13223. var self=this;
  13224. return $core.withContext(function($ctx1) {
  13225. return self.compile(aString);
  13226. return self;
  13227. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  13228. },
  13229. args: ["aString"],
  13230. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  13231. referencedClasses: [],
  13232. messageSends: []
  13233. }),
  13234. $globals.RegularExpression);
  13235. $core.addMethod(
  13236. $core.method({
  13237. selector: "exec:",
  13238. protocol: "evaluating",
  13239. fn: function (aString){
  13240. var self=this;
  13241. return $core.withContext(function($ctx1) {
  13242. return self.exec(aString) || nil;
  13243. return self;
  13244. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  13245. },
  13246. args: ["aString"],
  13247. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  13248. referencedClasses: [],
  13249. messageSends: []
  13250. }),
  13251. $globals.RegularExpression);
  13252. $core.addMethod(
  13253. $core.method({
  13254. selector: "test:",
  13255. protocol: "evaluating",
  13256. fn: function (aString){
  13257. var self=this;
  13258. return $core.withContext(function($ctx1) {
  13259. return self.test(aString);
  13260. return self;
  13261. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  13262. },
  13263. args: ["aString"],
  13264. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  13265. referencedClasses: [],
  13266. messageSends: []
  13267. }),
  13268. $globals.RegularExpression);
  13269. $core.addMethod(
  13270. $core.method({
  13271. selector: "fromString:",
  13272. protocol: "instance creation",
  13273. fn: function (aString){
  13274. var self=this;
  13275. return $core.withContext(function($ctx1) {
  13276. return self._fromString_flag_(aString,"");
  13277. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
  13278. },
  13279. args: ["aString"],
  13280. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  13281. referencedClasses: [],
  13282. messageSends: ["fromString:flag:"]
  13283. }),
  13284. $globals.RegularExpression.klass);
  13285. $core.addMethod(
  13286. $core.method({
  13287. selector: "fromString:flag:",
  13288. protocol: "instance creation",
  13289. fn: function (aString,anotherString){
  13290. var self=this;
  13291. return $core.withContext(function($ctx1) {
  13292. return new RegExp(aString, anotherString);
  13293. return self;
  13294. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
  13295. },
  13296. args: ["aString", "anotherString"],
  13297. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  13298. referencedClasses: [],
  13299. messageSends: []
  13300. }),
  13301. $globals.RegularExpression.klass);
  13302. });
  13303. define('amber_core/Kernel-Classes',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Objects"], function($boot){"use strict";
  13304. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  13305. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  13306. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  13307. $core.addPackage("Kernel-Classes");
  13308. $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  13309. $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  13310. $core.addClass("BehaviorBody", $globals.Object, [], "Kernel-Classes");
  13311. $globals.BehaviorBody.comment="I am the superclass of all behaviors.\x0a\x0aMy instances hold the method dictionary.\x0a\x0aI also provides methods for compiling methods and examining the method dictionary.";
  13312. $core.addMethod(
  13313. $core.method({
  13314. selector: ">>",
  13315. protocol: "accessing",
  13316. fn: function (aString){
  13317. var self=this;
  13318. return $core.withContext(function($ctx1) {
  13319. return self._methodAt_(aString);
  13320. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.BehaviorBody)});
  13321. },
  13322. args: ["aString"],
  13323. source: ">> aString\x0a\x09^ self methodAt: aString",
  13324. referencedClasses: [],
  13325. messageSends: ["methodAt:"]
  13326. }),
  13327. $globals.BehaviorBody);
  13328. $core.addMethod(
  13329. $core.method({
  13330. selector: "addCompiledMethod:",
  13331. protocol: "compiling",
  13332. fn: function (aMethod){
  13333. var self=this;
  13334. var oldMethod,announcement;
  13335. return $core.withContext(function($ctx1) {
  13336. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$receiver;
  13337. oldMethod=$recv(self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  13338. return nil;
  13339. }));
  13340. $2=self._protocols();
  13341. $3=$recv(aMethod)._protocol();
  13342. $ctx1.sendIdx["protocol"]=1;
  13343. $1=$recv($2)._includes_($3);
  13344. if(!$core.assert($1)){
  13345. $4=self._organization();
  13346. $5=$recv(aMethod)._protocol();
  13347. $ctx1.sendIdx["protocol"]=2;
  13348. $recv($4)._addElement_($5);
  13349. }
  13350. self._basicAddCompiledMethod_(aMethod);
  13351. $6=oldMethod;
  13352. if(($receiver = $6) == null || $receiver.isNil){
  13353. $6;
  13354. } else {
  13355. self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  13356. }
  13357. $7=oldMethod;
  13358. if(($receiver = $7) == null || $receiver.isNil){
  13359. $8=$recv($globals.MethodAdded)._new();
  13360. $ctx1.sendIdx["new"]=1;
  13361. $recv($8)._method_(aMethod);
  13362. $ctx1.sendIdx["method:"]=1;
  13363. $9=$recv($8)._yourself();
  13364. $ctx1.sendIdx["yourself"]=1;
  13365. announcement=$9;
  13366. } else {
  13367. $10=$recv($globals.MethodModified)._new();
  13368. $recv($10)._oldMethod_(oldMethod);
  13369. $recv($10)._method_(aMethod);
  13370. announcement=$recv($10)._yourself();
  13371. }
  13372. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  13373. return self;
  13374. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.BehaviorBody)});
  13375. },
  13376. args: ["aMethod"],
  13377. 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\x09(self protocols includes: aMethod protocol)\x0a\x09\x09ifFalse: [ self organization addElement: aMethod protocol ].\x0a\x0a\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09oldMethod ifNotNil: [\x0a\x09\x09self removeProtocolIfEmpty: oldMethod protocol ].\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",
  13378. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  13379. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  13380. }),
  13381. $globals.BehaviorBody);
  13382. $core.addMethod(
  13383. $core.method({
  13384. selector: "allInstanceVariableNames",
  13385. protocol: "accessing",
  13386. fn: function (){
  13387. var self=this;
  13388. return [];
  13389. },
  13390. args: [],
  13391. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  13392. referencedClasses: [],
  13393. messageSends: []
  13394. }),
  13395. $globals.BehaviorBody);
  13396. $core.addMethod(
  13397. $core.method({
  13398. selector: "allSubclassesDo:",
  13399. protocol: "enumerating",
  13400. fn: function (aBlock){
  13401. var self=this;
  13402. return self;
  13403. },
  13404. args: ["aBlock"],
  13405. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  13406. referencedClasses: [],
  13407. messageSends: []
  13408. }),
  13409. $globals.BehaviorBody);
  13410. $core.addMethod(
  13411. $core.method({
  13412. selector: "basicAddCompiledMethod:",
  13413. protocol: "private",
  13414. fn: function (aMethod){
  13415. var self=this;
  13416. return $core.withContext(function($ctx1) {
  13417. $core.addMethod(aMethod, self);
  13418. return self;
  13419. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.BehaviorBody)});
  13420. },
  13421. args: ["aMethod"],
  13422. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  13423. referencedClasses: [],
  13424. messageSends: []
  13425. }),
  13426. $globals.BehaviorBody);
  13427. $core.addMethod(
  13428. $core.method({
  13429. selector: "basicRemoveCompiledMethod:",
  13430. protocol: "private",
  13431. fn: function (aMethod){
  13432. var self=this;
  13433. return $core.withContext(function($ctx1) {
  13434. $core.removeMethod(aMethod,self);
  13435. return self;
  13436. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.BehaviorBody)});
  13437. },
  13438. args: ["aMethod"],
  13439. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  13440. referencedClasses: [],
  13441. messageSends: []
  13442. }),
  13443. $globals.BehaviorBody);
  13444. $core.addMethod(
  13445. $core.method({
  13446. selector: "comment",
  13447. protocol: "accessing",
  13448. fn: function (){
  13449. var self=this;
  13450. return $core.withContext(function($ctx1) {
  13451. var $1,$receiver;
  13452. $1=self._basicAt_("comment");
  13453. if(($receiver = $1) == null || $receiver.isNil){
  13454. return "";
  13455. } else {
  13456. return $1;
  13457. }
  13458. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.BehaviorBody)});
  13459. },
  13460. args: [],
  13461. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  13462. referencedClasses: [],
  13463. messageSends: ["ifNil:", "basicAt:"]
  13464. }),
  13465. $globals.BehaviorBody);
  13466. $core.addMethod(
  13467. $core.method({
  13468. selector: "comment:",
  13469. protocol: "accessing",
  13470. fn: function (aString){
  13471. var self=this;
  13472. return $core.withContext(function($ctx1) {
  13473. var $1,$3,$2;
  13474. self._basicAt_put_("comment",aString);
  13475. $1=$recv($globals.SystemAnnouncer)._current();
  13476. $3=$recv($globals.ClassCommentChanged)._new();
  13477. $recv($3)._theClass_(self);
  13478. $2=$recv($3)._yourself();
  13479. $recv($1)._announce_($2);
  13480. return self;
  13481. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.BehaviorBody)});
  13482. },
  13483. args: ["aString"],
  13484. 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)",
  13485. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  13486. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  13487. }),
  13488. $globals.BehaviorBody);
  13489. $core.addMethod(
  13490. $core.method({
  13491. selector: "compile:protocol:",
  13492. protocol: "compiling",
  13493. fn: function (aString,anotherString){
  13494. var self=this;
  13495. return $core.withContext(function($ctx1) {
  13496. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  13497. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.BehaviorBody)});
  13498. },
  13499. args: ["aString", "anotherString"],
  13500. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  13501. referencedClasses: ["Compiler"],
  13502. messageSends: ["install:forClass:protocol:", "new"]
  13503. }),
  13504. $globals.BehaviorBody);
  13505. $core.addMethod(
  13506. $core.method({
  13507. selector: "definition",
  13508. protocol: "accessing",
  13509. fn: function (){
  13510. var self=this;
  13511. return $core.withContext(function($ctx1) {
  13512. self._subclassResponsibility();
  13513. return self;
  13514. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.BehaviorBody)});
  13515. },
  13516. args: [],
  13517. source: "definition\x0a\x09self subclassResponsibility",
  13518. referencedClasses: [],
  13519. messageSends: ["subclassResponsibility"]
  13520. }),
  13521. $globals.BehaviorBody);
  13522. $core.addMethod(
  13523. $core.method({
  13524. selector: "includesSelector:",
  13525. protocol: "testing",
  13526. fn: function (aString){
  13527. var self=this;
  13528. return $core.withContext(function($ctx1) {
  13529. return $recv(self._methodDictionary())._includesKey_(aString);
  13530. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.BehaviorBody)});
  13531. },
  13532. args: ["aString"],
  13533. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  13534. referencedClasses: [],
  13535. messageSends: ["includesKey:", "methodDictionary"]
  13536. }),
  13537. $globals.BehaviorBody);
  13538. $core.addMethod(
  13539. $core.method({
  13540. selector: "methodAt:",
  13541. protocol: "accessing",
  13542. fn: function (aString){
  13543. var self=this;
  13544. return $core.withContext(function($ctx1) {
  13545. return $recv(self._methodDictionary())._at_(aString);
  13546. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.BehaviorBody)});
  13547. },
  13548. args: ["aString"],
  13549. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  13550. referencedClasses: [],
  13551. messageSends: ["at:", "methodDictionary"]
  13552. }),
  13553. $globals.BehaviorBody);
  13554. $core.addMethod(
  13555. $core.method({
  13556. selector: "methodDictionary",
  13557. protocol: "accessing",
  13558. fn: function (){
  13559. var self=this;
  13560. return $core.withContext(function($ctx1) {
  13561. var dict = $globals.HashedCollection._new();
  13562. var methods = self.methods;
  13563. Object.keys(methods).forEach(function(i) {
  13564. if(methods[i].selector) {
  13565. dict._at_put_(methods[i].selector, methods[i]);
  13566. }
  13567. });
  13568. return dict;
  13569. return self;
  13570. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.BehaviorBody)});
  13571. },
  13572. args: [],
  13573. 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'>",
  13574. referencedClasses: [],
  13575. messageSends: []
  13576. }),
  13577. $globals.BehaviorBody);
  13578. $core.addMethod(
  13579. $core.method({
  13580. selector: "methodTemplate",
  13581. protocol: "accessing",
  13582. fn: function (){
  13583. var self=this;
  13584. return $core.withContext(function($ctx1) {
  13585. return $recv($globals.String)._streamContents_((function(stream){
  13586. return $core.withContext(function($ctx2) {
  13587. $recv(stream)._write_("messageSelectorAndArgumentNames");
  13588. $ctx2.sendIdx["write:"]=1;
  13589. $recv(stream)._lf();
  13590. $ctx2.sendIdx["lf"]=1;
  13591. $recv(stream)._tab();
  13592. $ctx2.sendIdx["tab"]=1;
  13593. $recv(stream)._write_("\x22comment stating purpose of message\x22");
  13594. $ctx2.sendIdx["write:"]=2;
  13595. $recv(stream)._lf();
  13596. $ctx2.sendIdx["lf"]=2;
  13597. $recv(stream)._lf();
  13598. $ctx2.sendIdx["lf"]=3;
  13599. $recv(stream)._tab();
  13600. $ctx2.sendIdx["tab"]=2;
  13601. $recv(stream)._write_("| temporary variable names |");
  13602. $ctx2.sendIdx["write:"]=3;
  13603. $recv(stream)._lf();
  13604. $recv(stream)._tab();
  13605. return $recv(stream)._write_("statements");
  13606. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  13607. }));
  13608. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.BehaviorBody)});
  13609. },
  13610. args: [],
  13611. 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' ]",
  13612. referencedClasses: ["String"],
  13613. messageSends: ["streamContents:", "write:", "lf", "tab"]
  13614. }),
  13615. $globals.BehaviorBody);
  13616. $core.addMethod(
  13617. $core.method({
  13618. selector: "methods",
  13619. protocol: "accessing",
  13620. fn: function (){
  13621. var self=this;
  13622. return $core.withContext(function($ctx1) {
  13623. return $recv(self._methodDictionary())._values();
  13624. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.BehaviorBody)});
  13625. },
  13626. args: [],
  13627. source: "methods\x0a\x09^ self methodDictionary values",
  13628. referencedClasses: [],
  13629. messageSends: ["values", "methodDictionary"]
  13630. }),
  13631. $globals.BehaviorBody);
  13632. $core.addMethod(
  13633. $core.method({
  13634. selector: "methodsInProtocol:",
  13635. protocol: "accessing",
  13636. fn: function (aString){
  13637. var self=this;
  13638. return $core.withContext(function($ctx1) {
  13639. return $recv(self._methods())._select_((function(each){
  13640. return $core.withContext(function($ctx2) {
  13641. return $recv($recv(each)._protocol()).__eq(aString);
  13642. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13643. }));
  13644. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.BehaviorBody)});
  13645. },
  13646. args: ["aString"],
  13647. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  13648. referencedClasses: [],
  13649. messageSends: ["select:", "methods", "=", "protocol"]
  13650. }),
  13651. $globals.BehaviorBody);
  13652. $core.addMethod(
  13653. $core.method({
  13654. selector: "name",
  13655. protocol: "accessing",
  13656. fn: function (){
  13657. var self=this;
  13658. return $core.withContext(function($ctx1) {
  13659. return self.className || nil;
  13660. return self;
  13661. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.BehaviorBody)});
  13662. },
  13663. args: [],
  13664. source: "name\x0a\x09<inlineJS: 'return self.className || nil'>",
  13665. referencedClasses: [],
  13666. messageSends: []
  13667. }),
  13668. $globals.BehaviorBody);
  13669. $core.addMethod(
  13670. $core.method({
  13671. selector: "organization",
  13672. protocol: "accessing",
  13673. fn: function (){
  13674. var self=this;
  13675. return $core.withContext(function($ctx1) {
  13676. return self._basicAt_("organization");
  13677. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.BehaviorBody)});
  13678. },
  13679. args: [],
  13680. source: "organization\x0a\x09^ self basicAt: 'organization'",
  13681. referencedClasses: [],
  13682. messageSends: ["basicAt:"]
  13683. }),
  13684. $globals.BehaviorBody);
  13685. $core.addMethod(
  13686. $core.method({
  13687. selector: "ownMethods",
  13688. protocol: "accessing",
  13689. fn: function (){
  13690. var self=this;
  13691. return $core.withContext(function($ctx1) {
  13692. var $1;
  13693. return $recv($recv(self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  13694. return $core.withContext(function($ctx2) {
  13695. return $recv(acc).__comma(self._ownMethodsInProtocol_(each));
  13696. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  13697. })))._sorted_((function(a,b){
  13698. return $core.withContext(function($ctx2) {
  13699. $1=$recv(a)._selector();
  13700. $ctx2.sendIdx["selector"]=1;
  13701. return $recv($1).__lt_eq($recv(b)._selector());
  13702. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  13703. }));
  13704. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.BehaviorBody)});
  13705. },
  13706. args: [],
  13707. 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 ]",
  13708. referencedClasses: ["OrderedCollection"],
  13709. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  13710. }),
  13711. $globals.BehaviorBody);
  13712. $core.addMethod(
  13713. $core.method({
  13714. selector: "ownMethodsInProtocol:",
  13715. protocol: "accessing",
  13716. fn: function (aString){
  13717. var self=this;
  13718. return $core.withContext(function($ctx1) {
  13719. return $recv(self._methodsInProtocol_(aString))._select_((function(each){
  13720. return $core.withContext(function($ctx2) {
  13721. return $recv($recv(each)._methodClass()).__eq(self);
  13722. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13723. }));
  13724. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString},$globals.BehaviorBody)});
  13725. },
  13726. args: ["aString"],
  13727. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each methodClass = self ]",
  13728. referencedClasses: [],
  13729. messageSends: ["select:", "methodsInProtocol:", "=", "methodClass"]
  13730. }),
  13731. $globals.BehaviorBody);
  13732. $core.addMethod(
  13733. $core.method({
  13734. selector: "ownProtocols",
  13735. protocol: "accessing",
  13736. fn: function (){
  13737. var self=this;
  13738. return $core.withContext(function($ctx1) {
  13739. return $recv(self._protocols())._reject_((function(each){
  13740. return $core.withContext(function($ctx2) {
  13741. return $recv(each)._match_("^\x5c*");
  13742. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13743. }));
  13744. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.BehaviorBody)});
  13745. },
  13746. args: [],
  13747. 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*' ]",
  13748. referencedClasses: [],
  13749. messageSends: ["reject:", "protocols", "match:"]
  13750. }),
  13751. $globals.BehaviorBody);
  13752. $core.addMethod(
  13753. $core.method({
  13754. selector: "packageOfProtocol:",
  13755. protocol: "accessing",
  13756. fn: function (aString){
  13757. var self=this;
  13758. return $core.withContext(function($ctx1) {
  13759. var $1;
  13760. $1=$recv(aString)._beginsWith_("*");
  13761. if(!$core.assert($1)){
  13762. return self._package();
  13763. }
  13764. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  13765. return nil;
  13766. }));
  13767. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.BehaviorBody)});
  13768. },
  13769. args: ["aString"],
  13770. 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 ]",
  13771. referencedClasses: ["Package"],
  13772. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  13773. }),
  13774. $globals.BehaviorBody);
  13775. $core.addMethod(
  13776. $core.method({
  13777. selector: "printOn:",
  13778. protocol: "printing",
  13779. fn: function (aStream){
  13780. var self=this;
  13781. return $core.withContext(function($ctx1) {
  13782. var $1,$receiver;
  13783. $1=self._name();
  13784. if(($receiver = $1) == null || $receiver.isNil){
  13785. (
  13786. $ctx1.supercall = true,
  13787. ($globals.BehaviorBody.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  13788. $ctx1.supercall = false;
  13789. } else {
  13790. var name;
  13791. name=$receiver;
  13792. $recv(aStream)._nextPutAll_(name);
  13793. }
  13794. return self;
  13795. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.BehaviorBody)});
  13796. },
  13797. args: ["aStream"],
  13798. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  13799. referencedClasses: [],
  13800. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  13801. }),
  13802. $globals.BehaviorBody);
  13803. $core.addMethod(
  13804. $core.method({
  13805. selector: "protocols",
  13806. protocol: "accessing",
  13807. fn: function (){
  13808. var self=this;
  13809. return $core.withContext(function($ctx1) {
  13810. return $recv($recv(self._organization())._elements())._sorted();
  13811. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.BehaviorBody)});
  13812. },
  13813. args: [],
  13814. source: "protocols\x0a\x09^ self organization elements sorted",
  13815. referencedClasses: [],
  13816. messageSends: ["sorted", "elements", "organization"]
  13817. }),
  13818. $globals.BehaviorBody);
  13819. $core.addMethod(
  13820. $core.method({
  13821. selector: "protocolsDo:",
  13822. protocol: "enumerating",
  13823. fn: function (aBlock){
  13824. var self=this;
  13825. var methodsByProtocol;
  13826. return $core.withContext(function($ctx1) {
  13827. methodsByProtocol=$recv($globals.HashedCollection)._new();
  13828. $ctx1.sendIdx["new"]=1;
  13829. $recv(self._methodDictionary())._valuesDo_((function(m){
  13830. return $core.withContext(function($ctx2) {
  13831. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  13832. return $core.withContext(function($ctx3) {
  13833. return $recv($globals.Array)._new();
  13834. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  13835. })))._add_(m);
  13836. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  13837. }));
  13838. $recv(self._protocols())._do_((function(protocol){
  13839. return $core.withContext(function($ctx2) {
  13840. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  13841. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  13842. }));
  13843. return self;
  13844. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.BehaviorBody)});
  13845. },
  13846. args: ["aBlock"],
  13847. 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) ]",
  13848. referencedClasses: ["HashedCollection", "Array"],
  13849. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  13850. }),
  13851. $globals.BehaviorBody);
  13852. $core.addMethod(
  13853. $core.method({
  13854. selector: "recompile",
  13855. protocol: "compiling",
  13856. fn: function (){
  13857. var self=this;
  13858. return $core.withContext(function($ctx1) {
  13859. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  13860. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.BehaviorBody)});
  13861. },
  13862. args: [],
  13863. source: "recompile\x0a\x09^ Compiler new recompile: self",
  13864. referencedClasses: ["Compiler"],
  13865. messageSends: ["recompile:", "new"]
  13866. }),
  13867. $globals.BehaviorBody);
  13868. $core.addMethod(
  13869. $core.method({
  13870. selector: "removeCompiledMethod:",
  13871. protocol: "compiling",
  13872. fn: function (aMethod){
  13873. var self=this;
  13874. return $core.withContext(function($ctx1) {
  13875. var $1,$3,$2;
  13876. self._basicRemoveCompiledMethod_(aMethod);
  13877. self._removeProtocolIfEmpty_($recv(aMethod)._protocol());
  13878. $1=$recv($globals.SystemAnnouncer)._current();
  13879. $3=$recv($globals.MethodRemoved)._new();
  13880. $recv($3)._method_(aMethod);
  13881. $2=$recv($3)._yourself();
  13882. $recv($1)._announce_($2);
  13883. return self;
  13884. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.BehaviorBody)});
  13885. },
  13886. args: ["aMethod"],
  13887. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09self removeProtocolIfEmpty: aMethod protocol.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  13888. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  13889. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
  13890. }),
  13891. $globals.BehaviorBody);
  13892. $core.addMethod(
  13893. $core.method({
  13894. selector: "removeProtocolIfEmpty:",
  13895. protocol: "accessing",
  13896. fn: function (aString){
  13897. var self=this;
  13898. return $core.withContext(function($ctx1) {
  13899. $recv(self._methods())._detect_ifNone_((function(each){
  13900. return $core.withContext(function($ctx2) {
  13901. return $recv($recv(each)._protocol()).__eq(aString);
  13902. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13903. }),(function(){
  13904. return $core.withContext(function($ctx2) {
  13905. return $recv(self._organization())._removeElement_(aString);
  13906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13907. }));
  13908. return self;
  13909. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.BehaviorBody)});
  13910. },
  13911. args: ["aString"],
  13912. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  13913. referencedClasses: [],
  13914. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  13915. }),
  13916. $globals.BehaviorBody);
  13917. $core.addMethod(
  13918. $core.method({
  13919. selector: "selectors",
  13920. protocol: "accessing",
  13921. fn: function (){
  13922. var self=this;
  13923. return $core.withContext(function($ctx1) {
  13924. return $recv(self._methodDictionary())._keys();
  13925. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.BehaviorBody)});
  13926. },
  13927. args: [],
  13928. source: "selectors\x0a\x09^ self methodDictionary keys",
  13929. referencedClasses: [],
  13930. messageSends: ["keys", "methodDictionary"]
  13931. }),
  13932. $globals.BehaviorBody);
  13933. $core.addMethod(
  13934. $core.method({
  13935. selector: "setTraitComposition:",
  13936. protocol: "compiling",
  13937. fn: function (aTraitComposition){
  13938. var self=this;
  13939. return $core.withContext(function($ctx1) {
  13940. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  13941. return self;
  13942. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition},$globals.BehaviorBody)});
  13943. },
  13944. args: ["aTraitComposition"],
  13945. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  13946. referencedClasses: [],
  13947. messageSends: []
  13948. }),
  13949. $globals.BehaviorBody);
  13950. $core.addMethod(
  13951. $core.method({
  13952. selector: "superclass",
  13953. protocol: "accessing",
  13954. fn: function (){
  13955. var self=this;
  13956. return nil;
  13957. },
  13958. args: [],
  13959. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  13960. referencedClasses: [],
  13961. messageSends: []
  13962. }),
  13963. $globals.BehaviorBody);
  13964. $core.addMethod(
  13965. $core.method({
  13966. selector: "theMetaClass",
  13967. protocol: "accessing",
  13968. fn: function (){
  13969. var self=this;
  13970. return $core.withContext(function($ctx1) {
  13971. self._subclassResponsibility();
  13972. return self;
  13973. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.BehaviorBody)});
  13974. },
  13975. args: [],
  13976. source: "theMetaClass\x0a\x09self subclassResponsibility",
  13977. referencedClasses: [],
  13978. messageSends: ["subclassResponsibility"]
  13979. }),
  13980. $globals.BehaviorBody);
  13981. $core.addMethod(
  13982. $core.method({
  13983. selector: "theNonMetaClass",
  13984. protocol: "accessing",
  13985. fn: function (){
  13986. var self=this;
  13987. return $core.withContext(function($ctx1) {
  13988. self._subclassResponsibility();
  13989. return self;
  13990. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.BehaviorBody)});
  13991. },
  13992. args: [],
  13993. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  13994. referencedClasses: [],
  13995. messageSends: ["subclassResponsibility"]
  13996. }),
  13997. $globals.BehaviorBody);
  13998. $core.addMethod(
  13999. $core.method({
  14000. selector: "traitComposition",
  14001. protocol: "accessing",
  14002. fn: function (){
  14003. var self=this;
  14004. return $core.withContext(function($ctx1) {
  14005. return $recv(self._basicAt_("traitComposition"))._collect_((function(each){
  14006. return $core.withContext(function($ctx2) {
  14007. return $recv($globals.TraitTransformation)._fromJSON_(each);
  14008. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14009. }));
  14010. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{},$globals.BehaviorBody)});
  14011. },
  14012. args: [],
  14013. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition') collect: [ :each | TraitTransformation fromJSON: each ]",
  14014. referencedClasses: ["TraitTransformation"],
  14015. messageSends: ["collect:", "basicAt:", "fromJSON:"]
  14016. }),
  14017. $globals.BehaviorBody);
  14018. $core.addMethod(
  14019. $core.method({
  14020. selector: "traitCompositionDefinition",
  14021. protocol: "accessing",
  14022. fn: function (){
  14023. var self=this;
  14024. return $core.withContext(function($ctx1) {
  14025. return $recv(self._traitComposition())._ifNotEmpty_((function(traitComposition){
  14026. return $core.withContext(function($ctx2) {
  14027. return $recv($globals.String)._streamContents_((function(str){
  14028. return $core.withContext(function($ctx3) {
  14029. $recv(str)._write_("{");
  14030. $ctx3.sendIdx["write:"]=1;
  14031. $recv(traitComposition)._do_separatedBy_((function(each){
  14032. return $core.withContext(function($ctx4) {
  14033. return $recv(str)._write_($recv(each)._definition());
  14034. $ctx4.sendIdx["write:"]=2;
  14035. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  14036. }),(function(){
  14037. return $core.withContext(function($ctx4) {
  14038. return $recv(str)._write_(". ");
  14039. $ctx4.sendIdx["write:"]=3;
  14040. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  14041. }));
  14042. return $recv(str)._write_("}");
  14043. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  14044. }));
  14045. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  14046. }));
  14047. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{},$globals.BehaviorBody)});
  14048. },
  14049. args: [],
  14050. 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: '}' ] ]",
  14051. referencedClasses: ["String"],
  14052. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  14053. }),
  14054. $globals.BehaviorBody);
  14055. $core.addMethod(
  14056. $core.method({
  14057. selector: "traitUsers",
  14058. protocol: "accessing",
  14059. fn: function (){
  14060. var self=this;
  14061. return [];
  14062. },
  14063. args: [],
  14064. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  14065. referencedClasses: [],
  14066. messageSends: []
  14067. }),
  14068. $globals.BehaviorBody);
  14069. $core.addClass("Behavior", $globals.BehaviorBody, [], "Kernel-Classes");
  14070. $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.";
  14071. $core.addMethod(
  14072. $core.method({
  14073. selector: "allInstanceVariableNames",
  14074. protocol: "accessing",
  14075. fn: function (){
  14076. var self=this;
  14077. var result;
  14078. return $core.withContext(function($ctx1) {
  14079. var $1,$receiver;
  14080. result=$recv(self._instanceVariableNames())._copy();
  14081. $1=self._superclass();
  14082. $ctx1.sendIdx["superclass"]=1;
  14083. if(($receiver = $1) == null || $receiver.isNil){
  14084. $1;
  14085. } else {
  14086. $recv(result)._addAll_($recv(self._superclass())._allInstanceVariableNames());
  14087. }
  14088. return result;
  14089. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  14090. },
  14091. args: [],
  14092. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  14093. referencedClasses: [],
  14094. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  14095. }),
  14096. $globals.Behavior);
  14097. $core.addMethod(
  14098. $core.method({
  14099. selector: "allSelectors",
  14100. protocol: "accessing",
  14101. fn: function (){
  14102. var self=this;
  14103. return $core.withContext(function($ctx1) {
  14104. var $1,$2;
  14105. $1=self._allSuperclasses();
  14106. $2=self._selectors();
  14107. $ctx1.sendIdx["selectors"]=1;
  14108. return $recv($1)._inject_into_($2,(function(acc,each){
  14109. return $core.withContext(function($ctx2) {
  14110. $recv(acc)._addAll_($recv(each)._selectors());
  14111. return $recv(acc)._yourself();
  14112. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  14113. }));
  14114. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  14115. },
  14116. args: [],
  14117. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  14118. referencedClasses: [],
  14119. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  14120. }),
  14121. $globals.Behavior);
  14122. $core.addMethod(
  14123. $core.method({
  14124. selector: "allSubclasses",
  14125. protocol: "accessing",
  14126. fn: function (){
  14127. var self=this;
  14128. return $core.withContext(function($ctx1) {
  14129. return $recv($globals.Array)._streamContents_((function(str){
  14130. return $core.withContext(function($ctx2) {
  14131. return self._allSubclassesDo_((function(each){
  14132. return $core.withContext(function($ctx3) {
  14133. return $recv(str)._nextPut_(each);
  14134. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14135. }));
  14136. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  14137. }));
  14138. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  14139. },
  14140. args: [],
  14141. 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 ] ]",
  14142. referencedClasses: ["Array"],
  14143. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  14144. }),
  14145. $globals.Behavior);
  14146. $core.addMethod(
  14147. $core.method({
  14148. selector: "allSubclassesDo:",
  14149. protocol: "enumerating",
  14150. fn: function (aBlock){
  14151. var self=this;
  14152. return $core.withContext(function($ctx1) {
  14153. $core.traverseClassTree(self, function(subclass) {
  14154. if (subclass !== self) aBlock._value_(subclass);
  14155. });
  14156. return self;
  14157. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  14158. },
  14159. args: ["aBlock"],
  14160. 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})'>",
  14161. referencedClasses: [],
  14162. messageSends: []
  14163. }),
  14164. $globals.Behavior);
  14165. $core.addMethod(
  14166. $core.method({
  14167. selector: "allSuperclasses",
  14168. protocol: "accessing",
  14169. fn: function (){
  14170. var self=this;
  14171. return $core.withContext(function($ctx1) {
  14172. var $1,$3,$2,$receiver;
  14173. $1=self._superclass();
  14174. $ctx1.sendIdx["superclass"]=1;
  14175. if(($receiver = $1) == null || $receiver.isNil){
  14176. return [];
  14177. } else {
  14178. $1;
  14179. }
  14180. $3=self._superclass();
  14181. $ctx1.sendIdx["superclass"]=2;
  14182. $2=$recv($globals.OrderedCollection)._with_($3);
  14183. $recv($2)._addAll_($recv(self._superclass())._allSuperclasses());
  14184. return $recv($2)._yourself();
  14185. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  14186. },
  14187. args: [],
  14188. 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",
  14189. referencedClasses: ["OrderedCollection"],
  14190. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  14191. }),
  14192. $globals.Behavior);
  14193. $core.addMethod(
  14194. $core.method({
  14195. selector: "basicNew",
  14196. protocol: "instance creation",
  14197. fn: function (){
  14198. var self=this;
  14199. return $core.withContext(function($ctx1) {
  14200. return new self.fn();
  14201. return self;
  14202. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  14203. },
  14204. args: [],
  14205. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  14206. referencedClasses: [],
  14207. messageSends: []
  14208. }),
  14209. $globals.Behavior);
  14210. $core.addMethod(
  14211. $core.method({
  14212. selector: "canUnderstand:",
  14213. protocol: "testing",
  14214. fn: function (aSelector){
  14215. var self=this;
  14216. return $core.withContext(function($ctx1) {
  14217. var $2,$1;
  14218. return $recv(self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  14219. return $core.withContext(function($ctx2) {
  14220. $2=self._superclass();
  14221. $ctx2.sendIdx["superclass"]=1;
  14222. $1=$recv($2)._notNil();
  14223. return $recv($1)._and_((function(){
  14224. return $core.withContext(function($ctx3) {
  14225. return $recv(self._superclass())._canUnderstand_(aSelector);
  14226. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14227. }));
  14228. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14229. }));
  14230. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  14231. },
  14232. args: ["aSelector"],
  14233. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  14234. referencedClasses: [],
  14235. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  14236. }),
  14237. $globals.Behavior);
  14238. $core.addMethod(
  14239. $core.method({
  14240. selector: "includesBehavior:",
  14241. protocol: "testing",
  14242. fn: function (aClass){
  14243. var self=this;
  14244. return $core.withContext(function($ctx1) {
  14245. return $recv(self.__eq_eq(aClass))._or_((function(){
  14246. return $core.withContext(function($ctx2) {
  14247. return self._inheritsFrom_(aClass);
  14248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14249. }));
  14250. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  14251. },
  14252. args: ["aClass"],
  14253. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  14254. referencedClasses: [],
  14255. messageSends: ["or:", "==", "inheritsFrom:"]
  14256. }),
  14257. $globals.Behavior);
  14258. $core.addMethod(
  14259. $core.method({
  14260. selector: "inheritsFrom:",
  14261. protocol: "testing",
  14262. fn: function (aClass){
  14263. var self=this;
  14264. return $core.withContext(function($ctx1) {
  14265. var $1,$3,$2,$receiver;
  14266. $1=self._superclass();
  14267. $ctx1.sendIdx["superclass"]=1;
  14268. if(($receiver = $1) == null || $receiver.isNil){
  14269. return false;
  14270. } else {
  14271. $1;
  14272. }
  14273. $3=self._superclass();
  14274. $ctx1.sendIdx["superclass"]=2;
  14275. $2=$recv(aClass).__eq_eq($3);
  14276. return $recv($2)._or_((function(){
  14277. return $core.withContext(function($ctx2) {
  14278. return $recv(self._superclass())._inheritsFrom_(aClass);
  14279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14280. }));
  14281. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  14282. },
  14283. args: ["aClass"],
  14284. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  14285. referencedClasses: [],
  14286. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  14287. }),
  14288. $globals.Behavior);
  14289. $core.addMethod(
  14290. $core.method({
  14291. selector: "instanceVariableNames",
  14292. protocol: "accessing",
  14293. fn: function (){
  14294. var self=this;
  14295. return $core.withContext(function($ctx1) {
  14296. return self.iVarNames;
  14297. return self;
  14298. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  14299. },
  14300. args: [],
  14301. source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
  14302. referencedClasses: [],
  14303. messageSends: []
  14304. }),
  14305. $globals.Behavior);
  14306. $core.addMethod(
  14307. $core.method({
  14308. selector: "isBehavior",
  14309. protocol: "testing",
  14310. fn: function (){
  14311. var self=this;
  14312. return true;
  14313. },
  14314. args: [],
  14315. source: "isBehavior\x0a\x09^ true",
  14316. referencedClasses: [],
  14317. messageSends: []
  14318. }),
  14319. $globals.Behavior);
  14320. $core.addMethod(
  14321. $core.method({
  14322. selector: "javascriptConstructor",
  14323. protocol: "accessing",
  14324. fn: function (){
  14325. var self=this;
  14326. return $core.withContext(function($ctx1) {
  14327. return self.fn;
  14328. return self;
  14329. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  14330. },
  14331. args: [],
  14332. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
  14333. referencedClasses: [],
  14334. messageSends: []
  14335. }),
  14336. $globals.Behavior);
  14337. $core.addMethod(
  14338. $core.method({
  14339. selector: "javascriptConstructor:",
  14340. protocol: "accessing",
  14341. fn: function (aJavaScriptFunction){
  14342. var self=this;
  14343. return $core.withContext(function($ctx1) {
  14344. $core.setClassConstructor(self, aJavaScriptFunction);;
  14345. return self;
  14346. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  14347. },
  14348. args: ["aJavaScriptFunction"],
  14349. 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);'>",
  14350. referencedClasses: [],
  14351. messageSends: []
  14352. }),
  14353. $globals.Behavior);
  14354. $core.addMethod(
  14355. $core.method({
  14356. selector: "lookupSelector:",
  14357. protocol: "accessing",
  14358. fn: function (selector){
  14359. var self=this;
  14360. var lookupClass;
  14361. return $core.withContext(function($ctx1) {
  14362. var $1;
  14363. var $early={};
  14364. try {
  14365. lookupClass=self;
  14366. $recv((function(){
  14367. return $core.withContext(function($ctx2) {
  14368. return $recv(lookupClass).__eq(nil);
  14369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14370. }))._whileFalse_((function(){
  14371. return $core.withContext(function($ctx2) {
  14372. $1=$recv(lookupClass)._includesSelector_(selector);
  14373. if($core.assert($1)){
  14374. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  14375. }
  14376. lookupClass=$recv(lookupClass)._superclass();
  14377. return lookupClass;
  14378. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14379. }));
  14380. return nil;
  14381. }
  14382. catch(e) {if(e===$early)return e[0]; throw e}
  14383. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  14384. },
  14385. args: ["selector"],
  14386. 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",
  14387. referencedClasses: [],
  14388. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  14389. }),
  14390. $globals.Behavior);
  14391. $core.addMethod(
  14392. $core.method({
  14393. selector: "new",
  14394. protocol: "instance creation",
  14395. fn: function (){
  14396. var self=this;
  14397. return $core.withContext(function($ctx1) {
  14398. return $recv(self._basicNew())._initialize();
  14399. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  14400. },
  14401. args: [],
  14402. source: "new\x0a\x09^ self basicNew initialize",
  14403. referencedClasses: [],
  14404. messageSends: ["initialize", "basicNew"]
  14405. }),
  14406. $globals.Behavior);
  14407. $core.addMethod(
  14408. $core.method({
  14409. selector: "prototype",
  14410. protocol: "accessing",
  14411. fn: function (){
  14412. var self=this;
  14413. return $core.withContext(function($ctx1) {
  14414. return self.fn.prototype;
  14415. return self;
  14416. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  14417. },
  14418. args: [],
  14419. source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
  14420. referencedClasses: [],
  14421. messageSends: []
  14422. }),
  14423. $globals.Behavior);
  14424. $core.addMethod(
  14425. $core.method({
  14426. selector: "subclasses",
  14427. protocol: "accessing",
  14428. fn: function (){
  14429. var self=this;
  14430. return $core.withContext(function($ctx1) {
  14431. self._subclassResponsibility();
  14432. return self;
  14433. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  14434. },
  14435. args: [],
  14436. source: "subclasses\x0a\x09self subclassResponsibility",
  14437. referencedClasses: [],
  14438. messageSends: ["subclassResponsibility"]
  14439. }),
  14440. $globals.Behavior);
  14441. $core.addMethod(
  14442. $core.method({
  14443. selector: "superclass",
  14444. protocol: "accessing",
  14445. fn: function (){
  14446. var self=this;
  14447. return $core.withContext(function($ctx1) {
  14448. return self.superclass;
  14449. return self;
  14450. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  14451. },
  14452. args: [],
  14453. source: "superclass\x0a\x09<inlineJS: 'return self.superclass'>",
  14454. referencedClasses: [],
  14455. messageSends: []
  14456. }),
  14457. $globals.Behavior);
  14458. $core.addMethod(
  14459. $core.method({
  14460. selector: "theMetaClass",
  14461. protocol: "accessing",
  14462. fn: function (){
  14463. var self=this;
  14464. return $core.withContext(function($ctx1) {
  14465. self._subclassResponsibility();
  14466. return self;
  14467. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  14468. },
  14469. args: [],
  14470. source: "theMetaClass\x0a\x09self subclassResponsibility",
  14471. referencedClasses: [],
  14472. messageSends: ["subclassResponsibility"]
  14473. }),
  14474. $globals.Behavior);
  14475. $core.addMethod(
  14476. $core.method({
  14477. selector: "theNonMetaClass",
  14478. protocol: "accessing",
  14479. fn: function (){
  14480. var self=this;
  14481. return $core.withContext(function($ctx1) {
  14482. self._subclassResponsibility();
  14483. return self;
  14484. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  14485. },
  14486. args: [],
  14487. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  14488. referencedClasses: [],
  14489. messageSends: ["subclassResponsibility"]
  14490. }),
  14491. $globals.Behavior);
  14492. $core.addMethod(
  14493. $core.method({
  14494. selector: "withAllSubclasses",
  14495. protocol: "accessing",
  14496. fn: function (){
  14497. var self=this;
  14498. return $core.withContext(function($ctx1) {
  14499. var $1;
  14500. $1=$recv($globals.Array)._with_(self);
  14501. $recv($1)._addAll_(self._allSubclasses());
  14502. return $recv($1)._yourself();
  14503. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  14504. },
  14505. args: [],
  14506. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  14507. referencedClasses: ["Array"],
  14508. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  14509. }),
  14510. $globals.Behavior);
  14511. $core.addClass("Class", $globals.Behavior, [], "Kernel-Classes");
  14512. $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.";
  14513. $core.addMethod(
  14514. $core.method({
  14515. selector: "asJavaScriptSource",
  14516. protocol: "converting",
  14517. fn: function (){
  14518. var self=this;
  14519. return $core.withContext(function($ctx1) {
  14520. return "$globals.".__comma(self._name());
  14521. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Class)});
  14522. },
  14523. args: [],
  14524. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  14525. referencedClasses: [],
  14526. messageSends: [",", "name"]
  14527. }),
  14528. $globals.Class);
  14529. $core.addMethod(
  14530. $core.method({
  14531. selector: "browse",
  14532. protocol: "browsing",
  14533. fn: function (){
  14534. var self=this;
  14535. return $core.withContext(function($ctx1) {
  14536. $recv($globals.Finder)._findClass_(self);
  14537. return self;
  14538. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Class)});
  14539. },
  14540. args: [],
  14541. source: "browse\x0a\x09Finder findClass: self",
  14542. referencedClasses: ["Finder"],
  14543. messageSends: ["findClass:"]
  14544. }),
  14545. $globals.Class);
  14546. $core.addMethod(
  14547. $core.method({
  14548. selector: "category",
  14549. protocol: "accessing",
  14550. fn: function (){
  14551. var self=this;
  14552. return $core.withContext(function($ctx1) {
  14553. var $1,$receiver;
  14554. $1=self._package();
  14555. $ctx1.sendIdx["package"]=1;
  14556. if(($receiver = $1) == null || $receiver.isNil){
  14557. return "Unclassified";
  14558. } else {
  14559. return $recv(self._package())._name();
  14560. }
  14561. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.Class)});
  14562. },
  14563. args: [],
  14564. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  14565. referencedClasses: [],
  14566. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  14567. }),
  14568. $globals.Class);
  14569. $core.addMethod(
  14570. $core.method({
  14571. selector: "classTag",
  14572. protocol: "accessing",
  14573. fn: function (){
  14574. var self=this;
  14575. return "class";
  14576. },
  14577. args: [],
  14578. 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'",
  14579. referencedClasses: [],
  14580. messageSends: []
  14581. }),
  14582. $globals.Class);
  14583. $core.addMethod(
  14584. $core.method({
  14585. selector: "definition",
  14586. protocol: "accessing",
  14587. fn: function (){
  14588. var self=this;
  14589. return $core.withContext(function($ctx1) {
  14590. var $1,$2;
  14591. return $recv($globals.String)._streamContents_((function(stream){
  14592. return $core.withContext(function($ctx2) {
  14593. $recv(stream)._print_(self._superclass());
  14594. $ctx2.sendIdx["print:"]=1;
  14595. $recv(stream)._write_(" subclass: ");
  14596. $ctx2.sendIdx["write:"]=1;
  14597. $recv(stream)._printSymbol_(self._name());
  14598. $recv(stream)._lf();
  14599. $ctx2.sendIdx["lf"]=1;
  14600. $recv(stream)._write_($recv(self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  14601. return $core.withContext(function($ctx3) {
  14602. $1=$recv($globals.String)._tab();
  14603. $ctx3.sendIdx["tab"]=1;
  14604. $2=$recv($globals.String)._lf();
  14605. $ctx3.sendIdx["lf"]=2;
  14606. return [$1,"uses: ",tcd,$2];
  14607. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  14608. })));
  14609. $ctx2.sendIdx["write:"]=2;
  14610. $recv(stream)._tab();
  14611. $ctx2.sendIdx["tab"]=2;
  14612. $recv(stream)._write_("instanceVariableNames: ");
  14613. $ctx2.sendIdx["write:"]=3;
  14614. $recv(stream)._print_(" "._join_(self._instanceVariableNames()));
  14615. $ctx2.sendIdx["print:"]=2;
  14616. $recv(stream)._lf();
  14617. $recv(stream)._tab();
  14618. $recv(stream)._write_("package: ");
  14619. return $recv(stream)._print_(self._category());
  14620. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14621. }));
  14622. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  14623. },
  14624. args: [],
  14625. 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 ]",
  14626. referencedClasses: ["String"],
  14627. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "instanceVariableNames", "category"]
  14628. }),
  14629. $globals.Class);
  14630. $core.addMethod(
  14631. $core.method({
  14632. selector: "isClass",
  14633. protocol: "testing",
  14634. fn: function (){
  14635. var self=this;
  14636. return true;
  14637. },
  14638. args: [],
  14639. source: "isClass\x0a\x09^ true",
  14640. referencedClasses: [],
  14641. messageSends: []
  14642. }),
  14643. $globals.Class);
  14644. $core.addMethod(
  14645. $core.method({
  14646. selector: "package",
  14647. protocol: "accessing",
  14648. fn: function (){
  14649. var self=this;
  14650. return $core.withContext(function($ctx1) {
  14651. return self._basicAt_("pkg");
  14652. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Class)});
  14653. },
  14654. args: [],
  14655. source: "package\x0a\x09^ self basicAt: 'pkg'",
  14656. referencedClasses: [],
  14657. messageSends: ["basicAt:"]
  14658. }),
  14659. $globals.Class);
  14660. $core.addMethod(
  14661. $core.method({
  14662. selector: "package:",
  14663. protocol: "accessing",
  14664. fn: function (aPackage){
  14665. var self=this;
  14666. var oldPackage;
  14667. return $core.withContext(function($ctx1) {
  14668. var $2,$1,$3,$4,$6,$5;
  14669. $2=self._package();
  14670. $ctx1.sendIdx["package"]=1;
  14671. $1=$recv($2).__eq(aPackage);
  14672. if($core.assert($1)){
  14673. return self;
  14674. }
  14675. oldPackage=self._package();
  14676. self._basicAt_put_("pkg",aPackage);
  14677. $3=$recv(oldPackage)._organization();
  14678. $ctx1.sendIdx["organization"]=1;
  14679. $recv($3)._removeElement_(self);
  14680. $recv($recv(aPackage)._organization())._addElement_(self);
  14681. $4=$recv($globals.SystemAnnouncer)._current();
  14682. $6=$recv($globals.ClassMoved)._new();
  14683. $recv($6)._theClass_(self);
  14684. $recv($6)._oldPackage_(oldPackage);
  14685. $5=$recv($6)._yourself();
  14686. $recv($4)._announce_($5);
  14687. return self;
  14688. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.Class)});
  14689. },
  14690. args: ["aPackage"],
  14691. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self basicAt: 'pkg' put: aPackage.\x0a\x09oldPackage organization removeElement: self.\x0a\x09aPackage organization addElement: self.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  14692. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  14693. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  14694. }),
  14695. $globals.Class);
  14696. $core.addMethod(
  14697. $core.method({
  14698. selector: "rename:",
  14699. protocol: "accessing",
  14700. fn: function (aString){
  14701. var self=this;
  14702. return $core.withContext(function($ctx1) {
  14703. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  14704. return self;
  14705. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  14706. },
  14707. args: ["aString"],
  14708. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  14709. referencedClasses: ["ClassBuilder"],
  14710. messageSends: ["renameClass:to:", "new"]
  14711. }),
  14712. $globals.Class);
  14713. $core.addMethod(
  14714. $core.method({
  14715. selector: "subclass:",
  14716. protocol: "class creation",
  14717. fn: function (aString){
  14718. var self=this;
  14719. return $core.withContext(function($ctx1) {
  14720. return self._subclass_instanceVariableNames_package_(aString,"",nil);
  14721. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString},$globals.Class)});
  14722. },
  14723. args: ["aString"],
  14724. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: '' package: nil",
  14725. referencedClasses: [],
  14726. messageSends: ["subclass:instanceVariableNames:package:"]
  14727. }),
  14728. $globals.Class);
  14729. $core.addMethod(
  14730. $core.method({
  14731. selector: "subclass:instanceVariableNames:",
  14732. protocol: "class creation",
  14733. fn: function (aString,anotherString){
  14734. var self=this;
  14735. return $core.withContext(function($ctx1) {
  14736. return self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  14737. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.Class)});
  14738. },
  14739. args: ["aString", "anotherString"],
  14740. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  14741. referencedClasses: [],
  14742. messageSends: ["subclass:instanceVariableNames:package:"]
  14743. }),
  14744. $globals.Class);
  14745. $core.addMethod(
  14746. $core.method({
  14747. selector: "subclass:instanceVariableNames:category:",
  14748. protocol: "class creation",
  14749. fn: function (aString,aString2,aString3){
  14750. var self=this;
  14751. return $core.withContext(function($ctx1) {
  14752. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  14753. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  14754. },
  14755. args: ["aString", "aString2", "aString3"],
  14756. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  14757. referencedClasses: [],
  14758. messageSends: ["subclass:instanceVariableNames:package:"]
  14759. }),
  14760. $globals.Class);
  14761. $core.addMethod(
  14762. $core.method({
  14763. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  14764. protocol: "class creation",
  14765. fn: function (aString,aString2,classVars,pools,aString3){
  14766. var self=this;
  14767. return $core.withContext(function($ctx1) {
  14768. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  14769. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.Class)});
  14770. },
  14771. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  14772. 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",
  14773. referencedClasses: [],
  14774. messageSends: ["subclass:instanceVariableNames:package:"]
  14775. }),
  14776. $globals.Class);
  14777. $core.addMethod(
  14778. $core.method({
  14779. selector: "subclass:instanceVariableNames:package:",
  14780. protocol: "class creation",
  14781. fn: function (aString,aString2,aString3){
  14782. var self=this;
  14783. return $core.withContext(function($ctx1) {
  14784. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  14785. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  14786. },
  14787. args: ["aString", "aString2", "aString3"],
  14788. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  14789. referencedClasses: ["ClassBuilder"],
  14790. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  14791. }),
  14792. $globals.Class);
  14793. $core.addMethod(
  14794. $core.method({
  14795. selector: "subclass:uses:",
  14796. protocol: "class creation",
  14797. fn: function (aString,aTraitCompositionDescription){
  14798. var self=this;
  14799. return $core.withContext(function($ctx1) {
  14800. return self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,"",nil);
  14801. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription},$globals.Class)});
  14802. },
  14803. args: ["aString", "aTraitCompositionDescription"],
  14804. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: '' package: nil",
  14805. referencedClasses: [],
  14806. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  14807. }),
  14808. $globals.Class);
  14809. $core.addMethod(
  14810. $core.method({
  14811. selector: "subclass:uses:instanceVariableNames:",
  14812. protocol: "class creation",
  14813. fn: function (aString,aTraitCompositionDescription,anotherString){
  14814. var self=this;
  14815. return $core.withContext(function($ctx1) {
  14816. return self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  14817. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString},$globals.Class)});
  14818. },
  14819. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  14820. 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",
  14821. referencedClasses: [],
  14822. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  14823. }),
  14824. $globals.Class);
  14825. $core.addMethod(
  14826. $core.method({
  14827. selector: "subclass:uses:instanceVariableNames:category:",
  14828. protocol: "class creation",
  14829. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  14830. var self=this;
  14831. return $core.withContext(function($ctx1) {
  14832. return self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  14833. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3},$globals.Class)});
  14834. },
  14835. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  14836. 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",
  14837. referencedClasses: [],
  14838. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  14839. }),
  14840. $globals.Class);
  14841. $core.addMethod(
  14842. $core.method({
  14843. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  14844. protocol: "class creation",
  14845. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  14846. var self=this;
  14847. return $core.withContext(function($ctx1) {
  14848. return self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  14849. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.Class)});
  14850. },
  14851. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  14852. 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",
  14853. referencedClasses: [],
  14854. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  14855. }),
  14856. $globals.Class);
  14857. $core.addMethod(
  14858. $core.method({
  14859. selector: "subclass:uses:instanceVariableNames:package:",
  14860. protocol: "class creation",
  14861. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  14862. var self=this;
  14863. var cls;
  14864. return $core.withContext(function($ctx1) {
  14865. cls=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  14866. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  14867. return cls;
  14868. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3,cls:cls},$globals.Class)});
  14869. },
  14870. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  14871. 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",
  14872. referencedClasses: [],
  14873. messageSends: ["subclass:instanceVariableNames:package:", "setTraitComposition:", "asTraitComposition"]
  14874. }),
  14875. $globals.Class);
  14876. $core.addMethod(
  14877. $core.method({
  14878. selector: "subclasses",
  14879. protocol: "accessing",
  14880. fn: function (){
  14881. var self=this;
  14882. return $core.withContext(function($ctx1) {
  14883. return self.subclasses._copy();
  14884. return self;
  14885. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  14886. },
  14887. args: [],
  14888. source: "subclasses\x0a\x09<inlineJS: 'return self.subclasses._copy()'>",
  14889. referencedClasses: [],
  14890. messageSends: []
  14891. }),
  14892. $globals.Class);
  14893. $core.addMethod(
  14894. $core.method({
  14895. selector: "theMetaClass",
  14896. protocol: "accessing",
  14897. fn: function (){
  14898. var self=this;
  14899. return $core.withContext(function($ctx1) {
  14900. return self._class();
  14901. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  14902. },
  14903. args: [],
  14904. source: "theMetaClass\x0a\x09^ self class",
  14905. referencedClasses: [],
  14906. messageSends: ["class"]
  14907. }),
  14908. $globals.Class);
  14909. $core.addMethod(
  14910. $core.method({
  14911. selector: "theNonMetaClass",
  14912. protocol: "accessing",
  14913. fn: function (){
  14914. var self=this;
  14915. return self;
  14916. },
  14917. args: [],
  14918. source: "theNonMetaClass\x0a\x09^ self",
  14919. referencedClasses: [],
  14920. messageSends: []
  14921. }),
  14922. $globals.Class);
  14923. $core.addClass("Metaclass", $globals.Behavior, [], "Kernel-Classes");
  14924. $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.";
  14925. $core.addMethod(
  14926. $core.method({
  14927. selector: "asJavaScriptSource",
  14928. protocol: "converting",
  14929. fn: function (){
  14930. var self=this;
  14931. return $core.withContext(function($ctx1) {
  14932. var $1;
  14933. $1=$recv("$globals.".__comma($recv(self._instanceClass())._name())).__comma(".klass");
  14934. $ctx1.sendIdx[","]=1;
  14935. return $1;
  14936. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Metaclass)});
  14937. },
  14938. args: [],
  14939. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.klass'",
  14940. referencedClasses: [],
  14941. messageSends: [",", "name", "instanceClass"]
  14942. }),
  14943. $globals.Metaclass);
  14944. $core.addMethod(
  14945. $core.method({
  14946. selector: "definition",
  14947. protocol: "accessing",
  14948. fn: function (){
  14949. var self=this;
  14950. return $core.withContext(function($ctx1) {
  14951. var $1,$2;
  14952. return $recv($globals.String)._streamContents_((function(stream){
  14953. return $core.withContext(function($ctx2) {
  14954. $recv(stream)._print_(self);
  14955. $ctx2.sendIdx["print:"]=1;
  14956. $recv(stream)._write_($recv(self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  14957. return " ";
  14958. }),(function(tcd){
  14959. return $core.withContext(function($ctx3) {
  14960. $1=$recv($globals.String)._lf();
  14961. $ctx3.sendIdx["lf"]=1;
  14962. $2=$recv($globals.String)._tab();
  14963. $ctx3.sendIdx["tab"]=1;
  14964. return [$1,$2,"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  14965. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  14966. })));
  14967. $ctx2.sendIdx["write:"]=1;
  14968. $recv(stream)._write_("instanceVariableNames: ");
  14969. return $recv(stream)._print_(" "._join_(self._instanceVariableNames()));
  14970. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14971. }));
  14972. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  14973. },
  14974. args: [],
  14975. 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) ]",
  14976. referencedClasses: ["String"],
  14977. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "instanceVariableNames"]
  14978. }),
  14979. $globals.Metaclass);
  14980. $core.addMethod(
  14981. $core.method({
  14982. selector: "instanceClass",
  14983. protocol: "accessing",
  14984. fn: function (){
  14985. var self=this;
  14986. return $core.withContext(function($ctx1) {
  14987. return self.instanceClass;
  14988. return self;
  14989. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  14990. },
  14991. args: [],
  14992. source: "instanceClass\x0a\x09<inlineJS: 'return self.instanceClass'>",
  14993. referencedClasses: [],
  14994. messageSends: []
  14995. }),
  14996. $globals.Metaclass);
  14997. $core.addMethod(
  14998. $core.method({
  14999. selector: "instanceVariableNames:",
  15000. protocol: "accessing",
  15001. fn: function (aCollection){
  15002. var self=this;
  15003. return $core.withContext(function($ctx1) {
  15004. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  15005. return self;
  15006. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  15007. },
  15008. args: ["aCollection"],
  15009. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection.\x0a\x09^ self",
  15010. referencedClasses: ["ClassBuilder"],
  15011. messageSends: ["class:instanceVariableNames:", "new"]
  15012. }),
  15013. $globals.Metaclass);
  15014. $core.addMethod(
  15015. $core.method({
  15016. selector: "isMetaclass",
  15017. protocol: "testing",
  15018. fn: function (){
  15019. var self=this;
  15020. return true;
  15021. },
  15022. args: [],
  15023. source: "isMetaclass\x0a\x09^ true",
  15024. referencedClasses: [],
  15025. messageSends: []
  15026. }),
  15027. $globals.Metaclass);
  15028. $core.addMethod(
  15029. $core.method({
  15030. selector: "name",
  15031. protocol: "accessing",
  15032. fn: function (){
  15033. var self=this;
  15034. return $core.withContext(function($ctx1) {
  15035. return $recv($recv(self._instanceClass())._name()).__comma(" class");
  15036. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Metaclass)});
  15037. },
  15038. args: [],
  15039. source: "name\x0a\x09^ self instanceClass name, ' class'",
  15040. referencedClasses: [],
  15041. messageSends: [",", "name", "instanceClass"]
  15042. }),
  15043. $globals.Metaclass);
  15044. $core.addMethod(
  15045. $core.method({
  15046. selector: "package",
  15047. protocol: "accessing",
  15048. fn: function (){
  15049. var self=this;
  15050. return $core.withContext(function($ctx1) {
  15051. return $recv(self._instanceClass())._package();
  15052. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  15053. },
  15054. args: [],
  15055. source: "package\x0a\x09^ self instanceClass package",
  15056. referencedClasses: [],
  15057. messageSends: ["package", "instanceClass"]
  15058. }),
  15059. $globals.Metaclass);
  15060. $core.addMethod(
  15061. $core.method({
  15062. selector: "subclasses",
  15063. protocol: "accessing",
  15064. fn: function (){
  15065. var self=this;
  15066. return $core.withContext(function($ctx1) {
  15067. return $core.metaSubclasses(self);
  15068. return self;
  15069. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  15070. },
  15071. args: [],
  15072. source: "subclasses\x0a\x09<inlineJS: 'return $core.metaSubclasses(self)'>",
  15073. referencedClasses: [],
  15074. messageSends: []
  15075. }),
  15076. $globals.Metaclass);
  15077. $core.addMethod(
  15078. $core.method({
  15079. selector: "theMetaClass",
  15080. protocol: "accessing",
  15081. fn: function (){
  15082. var self=this;
  15083. return self;
  15084. },
  15085. args: [],
  15086. source: "theMetaClass\x0a\x09^ self",
  15087. referencedClasses: [],
  15088. messageSends: []
  15089. }),
  15090. $globals.Metaclass);
  15091. $core.addMethod(
  15092. $core.method({
  15093. selector: "theNonMetaClass",
  15094. protocol: "accessing",
  15095. fn: function (){
  15096. var self=this;
  15097. return $core.withContext(function($ctx1) {
  15098. return self._instanceClass();
  15099. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  15100. },
  15101. args: [],
  15102. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  15103. referencedClasses: [],
  15104. messageSends: ["instanceClass"]
  15105. }),
  15106. $globals.Metaclass);
  15107. $core.addMethod(
  15108. $core.method({
  15109. selector: "uses:instanceVariableNames:",
  15110. protocol: "accessing",
  15111. fn: function (aTraitCompositionDescription,aCollection){
  15112. var self=this;
  15113. var metaclass;
  15114. return $core.withContext(function($ctx1) {
  15115. metaclass=self._instanceVariableNames_(aCollection);
  15116. $recv(metaclass)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15117. return metaclass;
  15118. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,metaclass:metaclass},$globals.Metaclass)});
  15119. },
  15120. args: ["aTraitCompositionDescription", "aCollection"],
  15121. source: "uses: aTraitCompositionDescription instanceVariableNames: aCollection\x0a\x09| metaclass |\x0a\x09metaclass := self instanceVariableNames: aCollection.\x0a\x09metaclass setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ metaclass",
  15122. referencedClasses: [],
  15123. messageSends: ["instanceVariableNames:", "setTraitComposition:", "asTraitComposition"]
  15124. }),
  15125. $globals.Metaclass);
  15126. $core.addClass("Trait", $globals.BehaviorBody, [], "Kernel-Classes");
  15127. $core.addMethod(
  15128. $core.method({
  15129. selector: "-",
  15130. protocol: "composition",
  15131. fn: function (anArray){
  15132. var self=this;
  15133. return $core.withContext(function($ctx1) {
  15134. return $recv(self._asTraitTransformation()).__minus(anArray);
  15135. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.Trait)});
  15136. },
  15137. args: ["anArray"],
  15138. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  15139. referencedClasses: [],
  15140. messageSends: ["-", "asTraitTransformation"]
  15141. }),
  15142. $globals.Trait);
  15143. $core.addMethod(
  15144. $core.method({
  15145. selector: "@",
  15146. protocol: "composition",
  15147. fn: function (anArrayOfAssociations){
  15148. var self=this;
  15149. return $core.withContext(function($ctx1) {
  15150. return $recv(self._asTraitTransformation()).__at(anArrayOfAssociations);
  15151. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.Trait)});
  15152. },
  15153. args: ["anArrayOfAssociations"],
  15154. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  15155. referencedClasses: [],
  15156. messageSends: ["@", "asTraitTransformation"]
  15157. }),
  15158. $globals.Trait);
  15159. $core.addMethod(
  15160. $core.method({
  15161. selector: "asJavaScriptSource",
  15162. protocol: "converting",
  15163. fn: function (){
  15164. var self=this;
  15165. return $core.withContext(function($ctx1) {
  15166. return "$globals.".__comma(self._name());
  15167. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Trait)});
  15168. },
  15169. args: [],
  15170. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  15171. referencedClasses: [],
  15172. messageSends: [",", "name"]
  15173. }),
  15174. $globals.Trait);
  15175. $core.addMethod(
  15176. $core.method({
  15177. selector: "asTraitComposition",
  15178. protocol: "converting",
  15179. fn: function (){
  15180. var self=this;
  15181. return $core.withContext(function($ctx1) {
  15182. return $recv(self._asTraitTransformation())._asTraitComposition();
  15183. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Trait)});
  15184. },
  15185. args: [],
  15186. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  15187. referencedClasses: [],
  15188. messageSends: ["asTraitComposition", "asTraitTransformation"]
  15189. }),
  15190. $globals.Trait);
  15191. $core.addMethod(
  15192. $core.method({
  15193. selector: "asTraitTransformation",
  15194. protocol: "converting",
  15195. fn: function (){
  15196. var self=this;
  15197. return $core.withContext(function($ctx1) {
  15198. return $recv($globals.TraitTransformation)._on_(self);
  15199. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{},$globals.Trait)});
  15200. },
  15201. args: [],
  15202. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  15203. referencedClasses: ["TraitTransformation"],
  15204. messageSends: ["on:"]
  15205. }),
  15206. $globals.Trait);
  15207. $core.addMethod(
  15208. $core.method({
  15209. selector: "category",
  15210. protocol: "accessing",
  15211. fn: function (){
  15212. var self=this;
  15213. return $core.withContext(function($ctx1) {
  15214. var $1,$receiver;
  15215. $1=self._package();
  15216. $ctx1.sendIdx["package"]=1;
  15217. if(($receiver = $1) == null || $receiver.isNil){
  15218. return "Unclassified";
  15219. } else {
  15220. return $recv(self._package())._name();
  15221. }
  15222. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.Trait)});
  15223. },
  15224. args: [],
  15225. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  15226. referencedClasses: [],
  15227. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  15228. }),
  15229. $globals.Trait);
  15230. $core.addMethod(
  15231. $core.method({
  15232. selector: "classTag",
  15233. protocol: "accessing",
  15234. fn: function (){
  15235. var self=this;
  15236. return "trait";
  15237. },
  15238. args: [],
  15239. source: "classTag\x0a\x09^ 'trait'",
  15240. referencedClasses: [],
  15241. messageSends: []
  15242. }),
  15243. $globals.Trait);
  15244. $core.addMethod(
  15245. $core.method({
  15246. selector: "definition",
  15247. protocol: "accessing",
  15248. fn: function (){
  15249. var self=this;
  15250. return $core.withContext(function($ctx1) {
  15251. var $1;
  15252. return $recv($globals.String)._streamContents_((function(stream){
  15253. return $core.withContext(function($ctx2) {
  15254. $recv(stream)._write_("Trait named: ");
  15255. $ctx2.sendIdx["write:"]=1;
  15256. $recv(stream)._printSymbol_(self._name());
  15257. $recv(stream)._lf();
  15258. $ctx2.sendIdx["lf"]=1;
  15259. $recv(stream)._write_($recv(self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  15260. return $core.withContext(function($ctx3) {
  15261. $1=$recv($globals.String)._tab();
  15262. $ctx3.sendIdx["tab"]=1;
  15263. return [$1,"uses: ",tcd,$recv($globals.String)._lf()];
  15264. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  15265. })));
  15266. $ctx2.sendIdx["write:"]=2;
  15267. $recv(stream)._tab();
  15268. $recv(stream)._write_("package: ");
  15269. return $recv(stream)._print_(self._category());
  15270. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15271. }));
  15272. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Trait)});
  15273. },
  15274. args: [],
  15275. 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 ]",
  15276. referencedClasses: ["String"],
  15277. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  15278. }),
  15279. $globals.Trait);
  15280. $core.addMethod(
  15281. $core.method({
  15282. selector: "package",
  15283. protocol: "accessing",
  15284. fn: function (){
  15285. var self=this;
  15286. return $core.withContext(function($ctx1) {
  15287. return self._basicAt_("pkg");
  15288. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Trait)});
  15289. },
  15290. args: [],
  15291. source: "package\x0a\x09^ self basicAt: 'pkg'",
  15292. referencedClasses: [],
  15293. messageSends: ["basicAt:"]
  15294. }),
  15295. $globals.Trait);
  15296. $core.addMethod(
  15297. $core.method({
  15298. selector: "package:",
  15299. protocol: "accessing",
  15300. fn: function (aPackage){
  15301. var self=this;
  15302. var oldPackage;
  15303. return $core.withContext(function($ctx1) {
  15304. var $2,$1,$3,$4,$6,$5;
  15305. $2=self._package();
  15306. $ctx1.sendIdx["package"]=1;
  15307. $1=$recv($2).__eq(aPackage);
  15308. if($core.assert($1)){
  15309. return self;
  15310. }
  15311. oldPackage=self._package();
  15312. self._basicAt_put_("pkg",aPackage);
  15313. $3=$recv(oldPackage)._organization();
  15314. $ctx1.sendIdx["organization"]=1;
  15315. $recv($3)._removeElement_(self);
  15316. $recv($recv(aPackage)._organization())._addElement_(self);
  15317. $4=$recv($globals.SystemAnnouncer)._current();
  15318. $6=$recv($globals.ClassMoved)._new();
  15319. $recv($6)._theClass_(self);
  15320. $recv($6)._oldPackage_(oldPackage);
  15321. $5=$recv($6)._yourself();
  15322. $recv($4)._announce_($5);
  15323. return self;
  15324. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.Trait)});
  15325. },
  15326. args: ["aPackage"],
  15327. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self basicAt: 'pkg' put: aPackage.\x0a\x09oldPackage organization removeElement: self.\x0a\x09aPackage organization addElement: self.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  15328. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  15329. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  15330. }),
  15331. $globals.Trait);
  15332. $core.addMethod(
  15333. $core.method({
  15334. selector: "theMetaClass",
  15335. protocol: "accessing",
  15336. fn: function (){
  15337. var self=this;
  15338. return nil;
  15339. },
  15340. args: [],
  15341. source: "theMetaClass\x0a\x09^ nil",
  15342. referencedClasses: [],
  15343. messageSends: []
  15344. }),
  15345. $globals.Trait);
  15346. $core.addMethod(
  15347. $core.method({
  15348. selector: "theNonMetaClass",
  15349. protocol: "accessing",
  15350. fn: function (){
  15351. var self=this;
  15352. return self;
  15353. },
  15354. args: [],
  15355. source: "theNonMetaClass\x0a\x09^ self",
  15356. referencedClasses: [],
  15357. messageSends: []
  15358. }),
  15359. $globals.Trait);
  15360. $core.addMethod(
  15361. $core.method({
  15362. selector: "traitUsers",
  15363. protocol: "accessing",
  15364. fn: function (){
  15365. var self=this;
  15366. return $core.withContext(function($ctx1) {
  15367. return $recv(self._basicAt_("traitUsers"))._copy();
  15368. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{},$globals.Trait)});
  15369. },
  15370. args: [],
  15371. source: "traitUsers\x0a\x09^ (self basicAt: 'traitUsers') copy",
  15372. referencedClasses: [],
  15373. messageSends: ["copy", "basicAt:"]
  15374. }),
  15375. $globals.Trait);
  15376. $core.addMethod(
  15377. $core.method({
  15378. selector: "named:package:",
  15379. protocol: "instance creation",
  15380. fn: function (aString,anotherString){
  15381. var self=this;
  15382. return $core.withContext(function($ctx1) {
  15383. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  15384. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString},$globals.Trait.klass)});
  15385. },
  15386. args: ["aString", "anotherString"],
  15387. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  15388. referencedClasses: ["ClassBuilder"],
  15389. messageSends: ["addTraitNamed:package:", "new"]
  15390. }),
  15391. $globals.Trait.klass);
  15392. $core.addMethod(
  15393. $core.method({
  15394. selector: "named:uses:package:",
  15395. protocol: "instance creation",
  15396. fn: function (aString,aTraitCompositionDescription,anotherString){
  15397. var self=this;
  15398. var trait;
  15399. return $core.withContext(function($ctx1) {
  15400. trait=self._named_package_(aString,anotherString);
  15401. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15402. return trait;
  15403. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait},$globals.Trait.klass)});
  15404. },
  15405. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  15406. 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",
  15407. referencedClasses: [],
  15408. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  15409. }),
  15410. $globals.Trait.klass);
  15411. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  15412. $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:`.";
  15413. $core.addMethod(
  15414. $core.method({
  15415. selector: "addSubclassOf:named:instanceVariableNames:package:",
  15416. protocol: "class definition",
  15417. fn: function (aClass,className,aCollection,packageName){
  15418. var self=this;
  15419. var theClass,thePackage;
  15420. return $core.withContext(function($ctx1) {
  15421. var $1,$2,$3,$receiver;
  15422. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15423. thePackage=$recv($globals.Package)._named_(packageName);
  15424. $1=theClass;
  15425. if(($receiver = $1) == null || $receiver.isNil){
  15426. $1;
  15427. } else {
  15428. $recv(theClass)._package_(thePackage);
  15429. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  15430. if($core.assert($2)){
  15431. $3=theClass;
  15432. $recv($3)._recompile();
  15433. return $recv($3)._yourself();
  15434. } else {
  15435. return self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  15436. }
  15437. }
  15438. return self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  15439. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  15440. },
  15441. args: ["aClass", "className", "aCollection", "packageName"],
  15442. 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\x09ifTrue: [ ^ theClass recompile; yourself ] ].\x0a\x09\x09\x0a\x09^ self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName",
  15443. referencedClasses: ["Smalltalk", "Package"],
  15444. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:ifTrue:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "yourself", "basicAddSubclassOf:named:instanceVariableNames:package:"]
  15445. }),
  15446. $globals.ClassBuilder);
  15447. $core.addMethod(
  15448. $core.method({
  15449. selector: "addTraitNamed:package:",
  15450. protocol: "class definition",
  15451. fn: function (traitName,packageName){
  15452. var self=this;
  15453. var theTrait,thePackage;
  15454. return $core.withContext(function($ctx1) {
  15455. var $1,$2,$receiver;
  15456. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  15457. thePackage=$recv($globals.Package)._named_(packageName);
  15458. $1=theTrait;
  15459. if(($receiver = $1) == null || $receiver.isNil){
  15460. $1;
  15461. } else {
  15462. $2=theTrait;
  15463. $recv($2)._package_(thePackage);
  15464. $recv($2)._recompile();
  15465. return $recv($2)._yourself();
  15466. }
  15467. return self._basicAddTraitNamed_package_(traitName,packageName);
  15468. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage},$globals.ClassBuilder)});
  15469. },
  15470. args: ["traitName", "packageName"],
  15471. 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",
  15472. referencedClasses: ["Smalltalk", "Package"],
  15473. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  15474. }),
  15475. $globals.ClassBuilder);
  15476. $core.addMethod(
  15477. $core.method({
  15478. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  15479. protocol: "private",
  15480. fn: function (aClass,aString,aCollection,packageName){
  15481. var self=this;
  15482. return $core.withContext(function($ctx1) {
  15483. return $core.addClass(aString, aClass, aCollection, packageName);
  15484. ;
  15485. return self;
  15486. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  15487. },
  15488. args: ["aClass", "aString", "aCollection", "packageName"],
  15489. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  15490. referencedClasses: [],
  15491. messageSends: []
  15492. }),
  15493. $globals.ClassBuilder);
  15494. $core.addMethod(
  15495. $core.method({
  15496. selector: "basicAddTraitNamed:package:",
  15497. protocol: "private",
  15498. fn: function (aString,anotherString){
  15499. var self=this;
  15500. return $core.withContext(function($ctx1) {
  15501. return $core.addTrait(aString, anotherString);
  15502. return self;
  15503. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString},$globals.ClassBuilder)});
  15504. },
  15505. args: ["aString", "anotherString"],
  15506. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  15507. referencedClasses: [],
  15508. messageSends: []
  15509. }),
  15510. $globals.ClassBuilder);
  15511. $core.addMethod(
  15512. $core.method({
  15513. selector: "basicClass:instanceVariableNames:",
  15514. protocol: "private",
  15515. fn: function (aClass,aString){
  15516. var self=this;
  15517. return $core.withContext(function($ctx1) {
  15518. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  15519. return self;
  15520. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15521. },
  15522. args: ["aClass", "aString"],
  15523. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  15524. referencedClasses: [],
  15525. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  15526. }),
  15527. $globals.ClassBuilder);
  15528. $core.addMethod(
  15529. $core.method({
  15530. selector: "basicClass:instanceVariables:",
  15531. protocol: "private",
  15532. fn: function (aClass,aCollection){
  15533. var self=this;
  15534. return $core.withContext(function($ctx1) {
  15535. var $1;
  15536. $1=$recv(aClass)._isMetaclass();
  15537. if(!$core.assert($1)){
  15538. self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  15539. }
  15540. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  15541. return self;
  15542. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15543. },
  15544. args: ["aClass", "aCollection"],
  15545. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  15546. referencedClasses: [],
  15547. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  15548. }),
  15549. $globals.ClassBuilder);
  15550. $core.addMethod(
  15551. $core.method({
  15552. selector: "basicRemoveClass:",
  15553. protocol: "private",
  15554. fn: function (aClass){
  15555. var self=this;
  15556. return $core.withContext(function($ctx1) {
  15557. $core.removeClass(aClass);
  15558. return self;
  15559. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  15560. },
  15561. args: ["aClass"],
  15562. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  15563. referencedClasses: [],
  15564. messageSends: []
  15565. }),
  15566. $globals.ClassBuilder);
  15567. $core.addMethod(
  15568. $core.method({
  15569. selector: "basicRenameClass:to:",
  15570. protocol: "private",
  15571. fn: function (aClass,aString){
  15572. var self=this;
  15573. return $core.withContext(function($ctx1) {
  15574. $globals[aString] = aClass;
  15575. delete $globals[aClass.className];
  15576. aClass.className = aString;
  15577. ;
  15578. return self;
  15579. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15580. },
  15581. args: ["aClass", "aString"],
  15582. source: "basicRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09'>",
  15583. referencedClasses: [],
  15584. messageSends: []
  15585. }),
  15586. $globals.ClassBuilder);
  15587. $core.addMethod(
  15588. $core.method({
  15589. selector: "basicSwapClassNames:with:",
  15590. protocol: "private",
  15591. fn: function (aClass,anotherClass){
  15592. var self=this;
  15593. return $core.withContext(function($ctx1) {
  15594. var tmp = aClass.className;
  15595. aClass.className = anotherClass.className;
  15596. anotherClass.className = tmp;
  15597. ;
  15598. return self;
  15599. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15600. },
  15601. args: ["aClass", "anotherClass"],
  15602. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<inlineJS: '\x0a\x09\x09var tmp = aClass.className;\x0a\x09\x09aClass.className = anotherClass.className;\x0a\x09\x09anotherClass.className = tmp;\x0a\x09'>",
  15603. referencedClasses: [],
  15604. messageSends: []
  15605. }),
  15606. $globals.ClassBuilder);
  15607. $core.addMethod(
  15608. $core.method({
  15609. selector: "class:instanceVariableNames:",
  15610. protocol: "class definition",
  15611. fn: function (aClass,ivarNames){
  15612. var self=this;
  15613. return $core.withContext(function($ctx1) {
  15614. var $1,$3,$2;
  15615. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  15616. $1=$recv($globals.SystemAnnouncer)._current();
  15617. $3=$recv($globals.ClassDefinitionChanged)._new();
  15618. $recv($3)._theClass_(aClass);
  15619. $2=$recv($3)._yourself();
  15620. $recv($1)._announce_($2);
  15621. return self;
  15622. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  15623. },
  15624. args: ["aClass", "ivarNames"],
  15625. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  15626. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  15627. messageSends: ["basicClass:instanceVariableNames:", "announce:", "current", "theClass:", "new", "yourself"]
  15628. }),
  15629. $globals.ClassBuilder);
  15630. $core.addMethod(
  15631. $core.method({
  15632. selector: "copyClass:named:",
  15633. protocol: "copying",
  15634. fn: function (aClass,className){
  15635. var self=this;
  15636. var newClass;
  15637. return $core.withContext(function($ctx1) {
  15638. var $1,$3,$2;
  15639. newClass=self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15640. self._copyClass_to_(aClass,newClass);
  15641. $1=$recv($globals.SystemAnnouncer)._current();
  15642. $3=$recv($globals.ClassAdded)._new();
  15643. $recv($3)._theClass_(newClass);
  15644. $2=$recv($3)._yourself();
  15645. $recv($1)._announce_($2);
  15646. return newClass;
  15647. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  15648. },
  15649. args: ["aClass", "className"],
  15650. 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",
  15651. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15652. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  15653. }),
  15654. $globals.ClassBuilder);
  15655. $core.addMethod(
  15656. $core.method({
  15657. selector: "copyClass:to:",
  15658. protocol: "copying",
  15659. fn: function (aClass,anotherClass){
  15660. var self=this;
  15661. return $core.withContext(function($ctx1) {
  15662. var $1,$3,$2,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$16,$17,$18,$19;
  15663. $recv(anotherClass)._comment_($recv(aClass)._comment());
  15664. $1=$recv(aClass)._methodDictionary();
  15665. $ctx1.sendIdx["methodDictionary"]=1;
  15666. $recv($1)._valuesDo_((function(each){
  15667. return $core.withContext(function($ctx2) {
  15668. $3=$recv(each)._methodClass();
  15669. $ctx2.sendIdx["methodClass"]=1;
  15670. $2=$recv($3).__eq(aClass);
  15671. $ctx2.sendIdx["="]=1;
  15672. if($core.assert($2)){
  15673. $4=$recv($globals.Compiler)._new();
  15674. $ctx2.sendIdx["new"]=1;
  15675. $5=$recv(each)._source();
  15676. $ctx2.sendIdx["source"]=1;
  15677. $6=$recv(each)._protocol();
  15678. $ctx2.sendIdx["protocol"]=1;
  15679. return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
  15680. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  15681. }
  15682. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15683. }));
  15684. $ctx1.sendIdx["valuesDo:"]=1;
  15685. $7=$recv(aClass)._traitComposition();
  15686. $ctx1.sendIdx["traitComposition"]=1;
  15687. $recv(anotherClass)._setTraitComposition_($7);
  15688. $ctx1.sendIdx["setTraitComposition:"]=1;
  15689. $8=$recv(anotherClass)._class();
  15690. $ctx1.sendIdx["class"]=1;
  15691. $10=$recv(aClass)._class();
  15692. $ctx1.sendIdx["class"]=2;
  15693. $9=$recv($10)._instanceVariableNames();
  15694. self._basicClass_instanceVariables_($8,$9);
  15695. $12=$recv(aClass)._class();
  15696. $ctx1.sendIdx["class"]=3;
  15697. $11=$recv($12)._methodDictionary();
  15698. $recv($11)._valuesDo_((function(each){
  15699. return $core.withContext(function($ctx2) {
  15700. $14=$recv(each)._methodClass();
  15701. $15=$recv(aClass)._class();
  15702. $ctx2.sendIdx["class"]=4;
  15703. $13=$recv($14).__eq($15);
  15704. if($core.assert($13)){
  15705. $16=$recv($globals.Compiler)._new();
  15706. $17=$recv(each)._source();
  15707. $18=$recv(anotherClass)._class();
  15708. $ctx2.sendIdx["class"]=5;
  15709. return $recv($16)._install_forClass_protocol_($17,$18,$recv(each)._protocol());
  15710. }
  15711. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15712. }));
  15713. $19=$recv(anotherClass)._class();
  15714. $ctx1.sendIdx["class"]=6;
  15715. $recv($19)._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  15716. return self;
  15717. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15718. },
  15719. args: ["aClass", "anotherClass"],
  15720. 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",
  15721. referencedClasses: ["Compiler"],
  15722. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  15723. }),
  15724. $globals.ClassBuilder);
  15725. $core.addMethod(
  15726. $core.method({
  15727. selector: "installMethod:forClass:protocol:",
  15728. protocol: "method definition",
  15729. fn: function (aCompiledMethod,aBehavior,aString){
  15730. var self=this;
  15731. return $core.withContext(function($ctx1) {
  15732. $recv(aCompiledMethod)._protocol_(aString);
  15733. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  15734. return aCompiledMethod;
  15735. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  15736. },
  15737. args: ["aCompiledMethod", "aBehavior", "aString"],
  15738. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  15739. referencedClasses: [],
  15740. messageSends: ["protocol:", "addCompiledMethod:"]
  15741. }),
  15742. $globals.ClassBuilder);
  15743. $core.addMethod(
  15744. $core.method({
  15745. selector: "instanceVariableNamesFor:",
  15746. protocol: "accessing",
  15747. fn: function (aString){
  15748. var self=this;
  15749. return $core.withContext(function($ctx1) {
  15750. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  15751. return $core.withContext(function($ctx2) {
  15752. return $recv(each)._isEmpty();
  15753. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15754. }));
  15755. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  15756. },
  15757. args: ["aString"],
  15758. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  15759. referencedClasses: [],
  15760. messageSends: ["reject:", "tokenize:", "isEmpty"]
  15761. }),
  15762. $globals.ClassBuilder);
  15763. $core.addMethod(
  15764. $core.method({
  15765. selector: "migrateClass:superclass:",
  15766. protocol: "class migration",
  15767. fn: function (aClass,anotherClass){
  15768. var self=this;
  15769. return $core.withContext(function($ctx1) {
  15770. var $1;
  15771. $1=$recv(aClass)._name();
  15772. $ctx1.sendIdx["name"]=1;
  15773. return self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15774. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15775. },
  15776. args: ["aClass", "anotherClass"],
  15777. 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",
  15778. referencedClasses: [],
  15779. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  15780. }),
  15781. $globals.ClassBuilder);
  15782. $core.addMethod(
  15783. $core.method({
  15784. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  15785. protocol: "class migration",
  15786. fn: function (className,aClass,aCollection,packageName){
  15787. var self=this;
  15788. var oldClass,newClass,tmp;
  15789. return $core.withContext(function($ctx1) {
  15790. var $1,$2,$4,$3;
  15791. tmp="new*".__comma(className);
  15792. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15793. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  15794. self._basicSwapClassNames_with_(oldClass,newClass);
  15795. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  15796. $recv((function(){
  15797. return $core.withContext(function($ctx2) {
  15798. return self._copyClass_to_(oldClass,newClass);
  15799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15800. }))._on_do_($globals.Error,(function(exception){
  15801. return $core.withContext(function($ctx2) {
  15802. self._basicSwapClassNames_with_(oldClass,newClass);
  15803. $1=self._basicRemoveClass_(newClass);
  15804. $ctx2.sendIdx["basicRemoveClass:"]=1;
  15805. $1;
  15806. return $recv(exception)._resignal();
  15807. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  15808. }));
  15809. self._rawRenameClass_to_(oldClass,tmp);
  15810. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  15811. self._rawRenameClass_to_(newClass,className);
  15812. $recv($recv(oldClass)._subclasses())._do_((function(each){
  15813. return $core.withContext(function($ctx2) {
  15814. return self._migrateClass_superclass_(each,newClass);
  15815. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15816. }));
  15817. self._basicRemoveClass_(oldClass);
  15818. $2=$recv($globals.SystemAnnouncer)._current();
  15819. $4=$recv($globals.ClassMigrated)._new();
  15820. $recv($4)._theClass_(newClass);
  15821. $recv($4)._oldClass_(oldClass);
  15822. $3=$recv($4)._yourself();
  15823. $recv($2)._announce_($3);
  15824. return newClass;
  15825. }, 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)});
  15826. },
  15827. args: ["className", "aClass", "aCollection", "packageName"],
  15828. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09\x09exception resignal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  15829. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  15830. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "resignal", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  15831. }),
  15832. $globals.ClassBuilder);
  15833. $core.addMethod(
  15834. $core.method({
  15835. selector: "rawRenameClass:to:",
  15836. protocol: "private",
  15837. fn: function (aClass,aString){
  15838. var self=this;
  15839. return $core.withContext(function($ctx1) {
  15840. $globals[aString] = aClass;
  15841. ;
  15842. return self;
  15843. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15844. },
  15845. args: ["aClass", "aString"],
  15846. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  15847. referencedClasses: [],
  15848. messageSends: []
  15849. }),
  15850. $globals.ClassBuilder);
  15851. $core.addMethod(
  15852. $core.method({
  15853. selector: "renameClass:to:",
  15854. protocol: "class migration",
  15855. fn: function (aClass,className){
  15856. var self=this;
  15857. return $core.withContext(function($ctx1) {
  15858. var $1,$3,$2;
  15859. self._basicRenameClass_to_(aClass,className);
  15860. $recv(aClass)._recompile();
  15861. $1=$recv($globals.SystemAnnouncer)._current();
  15862. $3=$recv($globals.ClassRenamed)._new();
  15863. $recv($3)._theClass_(aClass);
  15864. $2=$recv($3)._yourself();
  15865. $recv($1)._announce_($2);
  15866. return self;
  15867. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15868. },
  15869. args: ["aClass", "className"],
  15870. 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)",
  15871. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  15872. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  15873. }),
  15874. $globals.ClassBuilder);
  15875. $core.addMethod(
  15876. $core.method({
  15877. selector: "setupClass:",
  15878. protocol: "public",
  15879. fn: function (aClass){
  15880. var self=this;
  15881. return $core.withContext(function($ctx1) {
  15882. self._deprecatedAPI_("Classes are now auto-inited.");
  15883. return self;
  15884. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  15885. },
  15886. args: ["aClass"],
  15887. source: "setupClass: aClass\x0a\x09self deprecatedAPI: 'Classes are now auto-inited.'",
  15888. referencedClasses: [],
  15889. messageSends: ["deprecatedAPI:"]
  15890. }),
  15891. $globals.ClassBuilder);
  15892. $core.addMethod(
  15893. $core.method({
  15894. selector: "superclass:subclass:",
  15895. protocol: "class definition",
  15896. fn: function (aClass,className){
  15897. var self=this;
  15898. return $core.withContext(function($ctx1) {
  15899. return self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  15900. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15901. },
  15902. args: ["aClass", "className"],
  15903. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  15904. referencedClasses: [],
  15905. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  15906. }),
  15907. $globals.ClassBuilder);
  15908. $core.addMethod(
  15909. $core.method({
  15910. selector: "superclass:subclass:instanceVariableNames:package:",
  15911. protocol: "class definition",
  15912. fn: function (aClass,className,ivarNames,packageName){
  15913. var self=this;
  15914. var newClass;
  15915. return $core.withContext(function($ctx1) {
  15916. var $1,$2,$3,$5,$4,$receiver;
  15917. $1=self._instanceVariableNamesFor_(ivarNames);
  15918. if(($receiver = packageName) == null || $receiver.isNil){
  15919. $2="unclassified";
  15920. } else {
  15921. $2=packageName;
  15922. }
  15923. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  15924. $3=$recv($globals.SystemAnnouncer)._current();
  15925. $5=$recv($globals.ClassAdded)._new();
  15926. $recv($5)._theClass_(newClass);
  15927. $4=$recv($5)._yourself();
  15928. $recv($3)._announce_($4);
  15929. return newClass;
  15930. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  15931. },
  15932. args: ["aClass", "className", "ivarNames", "packageName"],
  15933. 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",
  15934. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15935. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  15936. }),
  15937. $globals.ClassBuilder);
  15938. $core.addClass("ClassSorterNode", $globals.Object, ["theClass", "level", "nodes"], "Kernel-Classes");
  15939. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  15940. $core.addMethod(
  15941. $core.method({
  15942. selector: "getNodesFrom:",
  15943. protocol: "accessing",
  15944. fn: function (aCollection){
  15945. var self=this;
  15946. var children,others;
  15947. return $core.withContext(function($ctx1) {
  15948. var $1;
  15949. children=[];
  15950. others=[];
  15951. $recv(aCollection)._do_((function(each){
  15952. return $core.withContext(function($ctx2) {
  15953. $1=$recv($recv(each)._superclass()).__eq(self._theClass());
  15954. if($core.assert($1)){
  15955. return $recv(children)._add_(each);
  15956. $ctx2.sendIdx["add:"]=1;
  15957. } else {
  15958. return $recv(others)._add_(each);
  15959. }
  15960. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15961. }));
  15962. self["@nodes"]=$recv(children)._collect_((function(each){
  15963. return $core.withContext(function($ctx2) {
  15964. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv(self._level()).__plus((1)));
  15965. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  15966. }));
  15967. return self;
  15968. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  15969. },
  15970. args: ["aCollection"],
  15971. 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 ]",
  15972. referencedClasses: ["ClassSorterNode"],
  15973. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  15974. }),
  15975. $globals.ClassSorterNode);
  15976. $core.addMethod(
  15977. $core.method({
  15978. selector: "level",
  15979. protocol: "accessing",
  15980. fn: function (){
  15981. var self=this;
  15982. return self["@level"];
  15983. },
  15984. args: [],
  15985. source: "level\x0a\x09^ level",
  15986. referencedClasses: [],
  15987. messageSends: []
  15988. }),
  15989. $globals.ClassSorterNode);
  15990. $core.addMethod(
  15991. $core.method({
  15992. selector: "level:",
  15993. protocol: "accessing",
  15994. fn: function (anInteger){
  15995. var self=this;
  15996. self["@level"]=anInteger;
  15997. return self;
  15998. },
  15999. args: ["anInteger"],
  16000. source: "level: anInteger\x0a\x09level := anInteger",
  16001. referencedClasses: [],
  16002. messageSends: []
  16003. }),
  16004. $globals.ClassSorterNode);
  16005. $core.addMethod(
  16006. $core.method({
  16007. selector: "nodes",
  16008. protocol: "accessing",
  16009. fn: function (){
  16010. var self=this;
  16011. return self["@nodes"];
  16012. },
  16013. args: [],
  16014. source: "nodes\x0a\x09^ nodes",
  16015. referencedClasses: [],
  16016. messageSends: []
  16017. }),
  16018. $globals.ClassSorterNode);
  16019. $core.addMethod(
  16020. $core.method({
  16021. selector: "theClass",
  16022. protocol: "accessing",
  16023. fn: function (){
  16024. var self=this;
  16025. return self["@theClass"];
  16026. },
  16027. args: [],
  16028. source: "theClass\x0a\x09^ theClass",
  16029. referencedClasses: [],
  16030. messageSends: []
  16031. }),
  16032. $globals.ClassSorterNode);
  16033. $core.addMethod(
  16034. $core.method({
  16035. selector: "theClass:",
  16036. protocol: "accessing",
  16037. fn: function (aClass){
  16038. var self=this;
  16039. self["@theClass"]=aClass;
  16040. return self;
  16041. },
  16042. args: ["aClass"],
  16043. source: "theClass: aClass\x0a\x09theClass := aClass",
  16044. referencedClasses: [],
  16045. messageSends: []
  16046. }),
  16047. $globals.ClassSorterNode);
  16048. $core.addMethod(
  16049. $core.method({
  16050. selector: "traverseClassesWith:",
  16051. protocol: "visiting",
  16052. fn: function (aCollection){
  16053. var self=this;
  16054. return $core.withContext(function($ctx1) {
  16055. var $1,$3,$2;
  16056. $1=self._theClass();
  16057. $ctx1.sendIdx["theClass"]=1;
  16058. $recv(aCollection)._add_($1);
  16059. $recv($recv(self._nodes())._sorted_((function(a,b){
  16060. return $core.withContext(function($ctx2) {
  16061. $3=$recv(a)._theClass();
  16062. $ctx2.sendIdx["theClass"]=2;
  16063. $2=$recv($3)._name();
  16064. $ctx2.sendIdx["name"]=1;
  16065. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  16066. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  16067. })))._do_((function(aNode){
  16068. return $core.withContext(function($ctx2) {
  16069. return $recv(aNode)._traverseClassesWith_(aCollection);
  16070. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  16071. }));
  16072. return self;
  16073. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  16074. },
  16075. args: ["aCollection"],
  16076. 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 ].",
  16077. referencedClasses: [],
  16078. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  16079. }),
  16080. $globals.ClassSorterNode);
  16081. $core.addMethod(
  16082. $core.method({
  16083. selector: "on:classes:level:",
  16084. protocol: "instance creation",
  16085. fn: function (aClass,aCollection,anInteger){
  16086. var self=this;
  16087. return $core.withContext(function($ctx1) {
  16088. var $1;
  16089. $1=self._new();
  16090. $recv($1)._theClass_(aClass);
  16091. $recv($1)._level_(anInteger);
  16092. $recv($1)._getNodesFrom_(aCollection);
  16093. return $recv($1)._yourself();
  16094. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.klass)});
  16095. },
  16096. args: ["aClass", "aCollection", "anInteger"],
  16097. 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",
  16098. referencedClasses: [],
  16099. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  16100. }),
  16101. $globals.ClassSorterNode.klass);
  16102. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  16103. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  16104. $core.addMethod(
  16105. $core.method({
  16106. selector: "-",
  16107. protocol: "composition",
  16108. fn: function (anArray){
  16109. var self=this;
  16110. return $core.withContext(function($ctx1) {
  16111. var $1;
  16112. $1=self._copy();
  16113. $recv($1)._addExclusions_(anArray);
  16114. return $recv($1)._yourself();
  16115. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.TraitTransformation)});
  16116. },
  16117. args: ["anArray"],
  16118. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  16119. referencedClasses: [],
  16120. messageSends: ["addExclusions:", "copy", "yourself"]
  16121. }),
  16122. $globals.TraitTransformation);
  16123. $core.addMethod(
  16124. $core.method({
  16125. selector: "@",
  16126. protocol: "composition",
  16127. fn: function (anArrayOfAssociations){
  16128. var self=this;
  16129. return $core.withContext(function($ctx1) {
  16130. var $1;
  16131. $1=self._copy();
  16132. $recv($1)._addAliases_(anArrayOfAssociations);
  16133. return $recv($1)._yourself();
  16134. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  16135. },
  16136. args: ["anArrayOfAssociations"],
  16137. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  16138. referencedClasses: [],
  16139. messageSends: ["addAliases:", "copy", "yourself"]
  16140. }),
  16141. $globals.TraitTransformation);
  16142. $core.addMethod(
  16143. $core.method({
  16144. selector: "addAliases:",
  16145. protocol: "accessing",
  16146. fn: function (anArrayOfAssociations){
  16147. var self=this;
  16148. return $core.withContext(function($ctx1) {
  16149. $recv(anArrayOfAssociations)._do_((function(each){
  16150. var key;
  16151. return $core.withContext(function($ctx2) {
  16152. key=$recv(each)._key();
  16153. key;
  16154. return $recv(self["@aliases"])._at_ifPresent_ifAbsent_(key,(function(){
  16155. return $core.withContext(function($ctx3) {
  16156. return self._error_("Cannot use same alias name twice.");
  16157. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  16158. }),(function(){
  16159. return $core.withContext(function($ctx3) {
  16160. return $recv(self["@aliases"])._at_put_(key,$recv(each)._value());
  16161. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  16162. }));
  16163. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  16164. }));
  16165. return anArrayOfAssociations;
  16166. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  16167. },
  16168. args: ["anArrayOfAssociations"],
  16169. 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",
  16170. referencedClasses: [],
  16171. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  16172. }),
  16173. $globals.TraitTransformation);
  16174. $core.addMethod(
  16175. $core.method({
  16176. selector: "addExclusions:",
  16177. protocol: "accessing",
  16178. fn: function (anArray){
  16179. var self=this;
  16180. return $core.withContext(function($ctx1) {
  16181. $recv(self["@exclusions"])._addAll_(anArray);
  16182. return anArray;
  16183. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray},$globals.TraitTransformation)});
  16184. },
  16185. args: ["anArray"],
  16186. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  16187. referencedClasses: [],
  16188. messageSends: ["addAll:"]
  16189. }),
  16190. $globals.TraitTransformation);
  16191. $core.addMethod(
  16192. $core.method({
  16193. selector: "aliases",
  16194. protocol: "accessing",
  16195. fn: function (){
  16196. var self=this;
  16197. return self["@aliases"];
  16198. },
  16199. args: [],
  16200. source: "aliases\x0a\x09^ aliases",
  16201. referencedClasses: [],
  16202. messageSends: []
  16203. }),
  16204. $globals.TraitTransformation);
  16205. $core.addMethod(
  16206. $core.method({
  16207. selector: "asJavaScriptObject",
  16208. protocol: "converting",
  16209. fn: function (){
  16210. var self=this;
  16211. return $core.withContext(function($ctx1) {
  16212. return $globals.HashedCollection._newFromPairs_(["trait",self._trait(),"aliases",self._aliases(),"exclusions",$recv($recv(self._exclusions())._asArray())._sorted()]);
  16213. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.TraitTransformation)});
  16214. },
  16215. args: [],
  16216. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  16217. referencedClasses: [],
  16218. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  16219. }),
  16220. $globals.TraitTransformation);
  16221. $core.addMethod(
  16222. $core.method({
  16223. selector: "asJavaScriptSource",
  16224. protocol: "converting",
  16225. fn: function (){
  16226. var self=this;
  16227. return $core.withContext(function($ctx1) {
  16228. var $2,$3,$1;
  16229. return $recv($globals.String)._streamContents_((function(str){
  16230. return $core.withContext(function($ctx2) {
  16231. $2=$recv(self._trait())._asJavaScriptSource();
  16232. $ctx2.sendIdx["asJavaScriptSource"]=1;
  16233. $3=$recv(self._aliases())._ifNotEmpty_((function(al){
  16234. return $core.withContext(function($ctx3) {
  16235. return [", aliases: ",$recv(al)._asJSONString()];
  16236. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  16237. }));
  16238. $ctx2.sendIdx["ifNotEmpty:"]=1;
  16239. $1=["{trait: ",$2,$3,$recv(self._exclusions())._ifNotEmpty_((function(ex){
  16240. return $core.withContext(function($ctx3) {
  16241. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  16242. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  16243. })),"}"];
  16244. return $recv(str)._write_($1);
  16245. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  16246. }));
  16247. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TraitTransformation)});
  16248. },
  16249. args: [],
  16250. 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'}' } ]",
  16251. referencedClasses: ["String"],
  16252. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  16253. }),
  16254. $globals.TraitTransformation);
  16255. $core.addMethod(
  16256. $core.method({
  16257. selector: "asTraitComposition",
  16258. protocol: "converting",
  16259. fn: function (){
  16260. var self=this;
  16261. return [self];
  16262. },
  16263. args: [],
  16264. source: "asTraitComposition\x0a\x09^ { self }",
  16265. referencedClasses: [],
  16266. messageSends: []
  16267. }),
  16268. $globals.TraitTransformation);
  16269. $core.addMethod(
  16270. $core.method({
  16271. selector: "asTraitTransformation",
  16272. protocol: "converting",
  16273. fn: function (){
  16274. var self=this;
  16275. return self;
  16276. },
  16277. args: [],
  16278. source: "asTraitTransformation\x0a\x09^ self",
  16279. referencedClasses: [],
  16280. messageSends: []
  16281. }),
  16282. $globals.TraitTransformation);
  16283. $core.addMethod(
  16284. $core.method({
  16285. selector: "definition",
  16286. protocol: "accessing",
  16287. fn: function (){
  16288. var self=this;
  16289. return $core.withContext(function($ctx1) {
  16290. return $recv($globals.String)._streamContents_((function(str){
  16291. return $core.withContext(function($ctx2) {
  16292. $recv(str)._print_(self._trait());
  16293. $recv(self._aliases())._ifNotEmpty_((function(al){
  16294. return $core.withContext(function($ctx3) {
  16295. $recv(str)._write_(" @ {");
  16296. $ctx3.sendIdx["write:"]=1;
  16297. $recv($recv(al)._associations())._do_separatedBy_((function(each){
  16298. return $core.withContext(function($ctx4) {
  16299. $recv(str)._printSymbol_($recv(each)._key());
  16300. $ctx4.sendIdx["printSymbol:"]=1;
  16301. $recv(str)._write_(" -> ");
  16302. $ctx4.sendIdx["write:"]=2;
  16303. return $recv(str)._printSymbol_($recv(each)._value());
  16304. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  16305. }),(function(){
  16306. return $core.withContext(function($ctx4) {
  16307. return $recv(str)._write_(". ");
  16308. $ctx4.sendIdx["write:"]=3;
  16309. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  16310. }));
  16311. $ctx3.sendIdx["do:separatedBy:"]=1;
  16312. return $recv(str)._write_("}");
  16313. $ctx3.sendIdx["write:"]=4;
  16314. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  16315. }));
  16316. $ctx2.sendIdx["ifNotEmpty:"]=1;
  16317. return $recv(self._exclusions())._ifNotEmpty_((function(ex){
  16318. return $core.withContext(function($ctx3) {
  16319. $recv(str)._write_(" - #(");
  16320. $ctx3.sendIdx["write:"]=5;
  16321. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  16322. return $core.withContext(function($ctx4) {
  16323. return $recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst());
  16324. $ctx4.sendIdx["write:"]=6;
  16325. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  16326. }),(function(){
  16327. return $core.withContext(function($ctx4) {
  16328. return $recv(str)._space();
  16329. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  16330. }));
  16331. return $recv(str)._write_(")");
  16332. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  16333. }));
  16334. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  16335. }));
  16336. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.TraitTransformation)});
  16337. },
  16338. args: [],
  16339. 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: ')' ] ]",
  16340. referencedClasses: ["String"],
  16341. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  16342. }),
  16343. $globals.TraitTransformation);
  16344. $core.addMethod(
  16345. $core.method({
  16346. selector: "exclusions",
  16347. protocol: "accessing",
  16348. fn: function (){
  16349. var self=this;
  16350. return self["@exclusions"];
  16351. },
  16352. args: [],
  16353. source: "exclusions\x0a\x09^ exclusions",
  16354. referencedClasses: [],
  16355. messageSends: []
  16356. }),
  16357. $globals.TraitTransformation);
  16358. $core.addMethod(
  16359. $core.method({
  16360. selector: "initialize",
  16361. protocol: "initialization",
  16362. fn: function (){
  16363. var self=this;
  16364. return $core.withContext(function($ctx1) {
  16365. (
  16366. $ctx1.supercall = true,
  16367. ($globals.TraitTransformation.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  16368. $ctx1.supercall = false;
  16369. self["@aliases"]=$globals.HashedCollection._newFromPairs_([]);
  16370. self["@exclusions"]=$recv($globals.Set)._new();
  16371. self["@trait"]=nil;
  16372. return self;
  16373. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TraitTransformation)});
  16374. },
  16375. args: [],
  16376. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  16377. referencedClasses: ["Set"],
  16378. messageSends: ["initialize", "new"]
  16379. }),
  16380. $globals.TraitTransformation);
  16381. $core.addMethod(
  16382. $core.method({
  16383. selector: "postCopy",
  16384. protocol: "copying",
  16385. fn: function (){
  16386. var self=this;
  16387. return $core.withContext(function($ctx1) {
  16388. self["@aliases"]=$recv(self["@aliases"])._copy();
  16389. $ctx1.sendIdx["copy"]=1;
  16390. self["@exclusions"]=$recv(self["@exclusions"])._copy();
  16391. return self;
  16392. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.TraitTransformation)});
  16393. },
  16394. args: [],
  16395. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  16396. referencedClasses: [],
  16397. messageSends: ["copy"]
  16398. }),
  16399. $globals.TraitTransformation);
  16400. $core.addMethod(
  16401. $core.method({
  16402. selector: "trait",
  16403. protocol: "accessing",
  16404. fn: function (){
  16405. var self=this;
  16406. return self["@trait"];
  16407. },
  16408. args: [],
  16409. source: "trait\x0a\x09^ trait",
  16410. referencedClasses: [],
  16411. messageSends: []
  16412. }),
  16413. $globals.TraitTransformation);
  16414. $core.addMethod(
  16415. $core.method({
  16416. selector: "trait:",
  16417. protocol: "accessing",
  16418. fn: function (anObject){
  16419. var self=this;
  16420. self["@trait"]=anObject;
  16421. return self;
  16422. },
  16423. args: ["anObject"],
  16424. source: "trait: anObject\x0a\x09trait := anObject",
  16425. referencedClasses: [],
  16426. messageSends: []
  16427. }),
  16428. $globals.TraitTransformation);
  16429. $core.addMethod(
  16430. $core.method({
  16431. selector: "fromJSON:",
  16432. protocol: "instance creation",
  16433. fn: function (aJSObject){
  16434. var self=this;
  16435. return $core.withContext(function($ctx1) {
  16436. var $1,$4,$3,$2;
  16437. $1=(
  16438. $ctx1.supercall = true,
  16439. ($globals.TraitTransformation.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  16440. $ctx1.supercall = false;
  16441. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  16442. $4=$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  16443. return $globals.HashedCollection._newFromPairs_([]);
  16444. }));
  16445. $ctx1.sendIdx["at:ifAbsent:"]=1;
  16446. $3=$recv($globals.Smalltalk)._readJSObject_($4);
  16447. $2=$recv($3)._associations();
  16448. $recv($1)._addAliases_($2);
  16449. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  16450. return [];
  16451. })));
  16452. return $recv($1)._yourself();
  16453. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject},$globals.TraitTransformation.klass)});
  16454. },
  16455. args: ["aJSObject"],
  16456. 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",
  16457. referencedClasses: ["Smalltalk"],
  16458. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  16459. }),
  16460. $globals.TraitTransformation.klass);
  16461. $core.addMethod(
  16462. $core.method({
  16463. selector: "on:",
  16464. protocol: "instance creation",
  16465. fn: function (aTrait){
  16466. var self=this;
  16467. return $core.withContext(function($ctx1) {
  16468. var $1;
  16469. $1=(
  16470. $ctx1.supercall = true,
  16471. ($globals.TraitTransformation.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  16472. $ctx1.supercall = false;
  16473. $recv($1)._trait_(aTrait);
  16474. return $recv($1)._yourself();
  16475. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait},$globals.TraitTransformation.klass)});
  16476. },
  16477. args: ["aTrait"],
  16478. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  16479. referencedClasses: [],
  16480. messageSends: ["trait:", "new", "yourself"]
  16481. }),
  16482. $globals.TraitTransformation.klass);
  16483. $core.addMethod(
  16484. $core.method({
  16485. selector: "asTraitComposition",
  16486. protocol: "*Kernel-Classes",
  16487. fn: function (){
  16488. var self=this;
  16489. return $core.withContext(function($ctx1) {
  16490. return self._collect_((function(each){
  16491. return $core.withContext(function($ctx2) {
  16492. return $recv(each)._asTraitTransformation();
  16493. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16494. }));
  16495. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Array)});
  16496. },
  16497. args: [],
  16498. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  16499. referencedClasses: [],
  16500. messageSends: ["collect:", "asTraitTransformation"]
  16501. }),
  16502. $globals.Array);
  16503. $core.addMethod(
  16504. $core.method({
  16505. selector: "subclass:",
  16506. protocol: "*Kernel-Classes",
  16507. fn: function (aString){
  16508. var self=this;
  16509. return $core.withContext(function($ctx1) {
  16510. return self._subclass_instanceVariableNames_package_(aString,"",nil);
  16511. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString},$globals.UndefinedObject)});
  16512. },
  16513. args: ["aString"],
  16514. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: '' package: nil",
  16515. referencedClasses: [],
  16516. messageSends: ["subclass:instanceVariableNames:package:"]
  16517. }),
  16518. $globals.UndefinedObject);
  16519. $core.addMethod(
  16520. $core.method({
  16521. selector: "subclass:instanceVariableNames:",
  16522. protocol: "*Kernel-Classes",
  16523. fn: function (aString,anotherString){
  16524. var self=this;
  16525. return $core.withContext(function($ctx1) {
  16526. return self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  16527. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.UndefinedObject)});
  16528. },
  16529. args: ["aString", "anotherString"],
  16530. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  16531. referencedClasses: [],
  16532. messageSends: ["subclass:instanceVariableNames:package:"]
  16533. }),
  16534. $globals.UndefinedObject);
  16535. $core.addMethod(
  16536. $core.method({
  16537. selector: "subclass:instanceVariableNames:category:",
  16538. protocol: "*Kernel-Classes",
  16539. fn: function (aString,aString2,aString3){
  16540. var self=this;
  16541. return $core.withContext(function($ctx1) {
  16542. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  16543. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  16544. },
  16545. args: ["aString", "aString2", "aString3"],
  16546. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  16547. referencedClasses: [],
  16548. messageSends: ["subclass:instanceVariableNames:package:"]
  16549. }),
  16550. $globals.UndefinedObject);
  16551. $core.addMethod(
  16552. $core.method({
  16553. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  16554. protocol: "*Kernel-Classes",
  16555. fn: function (aString,aString2,classVars,pools,aString3){
  16556. var self=this;
  16557. return $core.withContext(function($ctx1) {
  16558. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  16559. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.UndefinedObject)});
  16560. },
  16561. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  16562. 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",
  16563. referencedClasses: [],
  16564. messageSends: ["subclass:instanceVariableNames:package:"]
  16565. }),
  16566. $globals.UndefinedObject);
  16567. $core.addMethod(
  16568. $core.method({
  16569. selector: "subclass:instanceVariableNames:package:",
  16570. protocol: "*Kernel-Classes",
  16571. fn: function (aString,aString2,aString3){
  16572. var self=this;
  16573. return $core.withContext(function($ctx1) {
  16574. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  16575. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  16576. },
  16577. args: ["aString", "aString2", "aString3"],
  16578. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  16579. referencedClasses: ["ClassBuilder"],
  16580. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  16581. }),
  16582. $globals.UndefinedObject);
  16583. $core.addMethod(
  16584. $core.method({
  16585. selector: "subclass:uses:",
  16586. protocol: "*Kernel-Classes",
  16587. fn: function (aString,aTraitCompositionDescription){
  16588. var self=this;
  16589. return $core.withContext(function($ctx1) {
  16590. return self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,"",nil);
  16591. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription},$globals.UndefinedObject)});
  16592. },
  16593. args: ["aString", "aTraitCompositionDescription"],
  16594. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: '' package: nil",
  16595. referencedClasses: [],
  16596. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  16597. }),
  16598. $globals.UndefinedObject);
  16599. $core.addMethod(
  16600. $core.method({
  16601. selector: "subclass:uses:instanceVariableNames:",
  16602. protocol: "*Kernel-Classes",
  16603. fn: function (aString,aTraitCompositionDescription,anotherString){
  16604. var self=this;
  16605. return $core.withContext(function($ctx1) {
  16606. return self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  16607. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString},$globals.UndefinedObject)});
  16608. },
  16609. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  16610. 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",
  16611. referencedClasses: [],
  16612. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  16613. }),
  16614. $globals.UndefinedObject);
  16615. $core.addMethod(
  16616. $core.method({
  16617. selector: "subclass:uses:instanceVariableNames:category:",
  16618. protocol: "*Kernel-Classes",
  16619. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  16620. var self=this;
  16621. return $core.withContext(function($ctx1) {
  16622. return self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  16623. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  16624. },
  16625. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  16626. 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",
  16627. referencedClasses: [],
  16628. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  16629. }),
  16630. $globals.UndefinedObject);
  16631. $core.addMethod(
  16632. $core.method({
  16633. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  16634. protocol: "*Kernel-Classes",
  16635. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  16636. var self=this;
  16637. return $core.withContext(function($ctx1) {
  16638. return self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  16639. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.UndefinedObject)});
  16640. },
  16641. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  16642. 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",
  16643. referencedClasses: [],
  16644. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  16645. }),
  16646. $globals.UndefinedObject);
  16647. $core.addMethod(
  16648. $core.method({
  16649. selector: "subclass:uses:instanceVariableNames:package:",
  16650. protocol: "*Kernel-Classes",
  16651. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  16652. var self=this;
  16653. var cls;
  16654. return $core.withContext(function($ctx1) {
  16655. cls=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  16656. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  16657. return cls;
  16658. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3,cls:cls},$globals.UndefinedObject)});
  16659. },
  16660. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  16661. 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",
  16662. referencedClasses: [],
  16663. messageSends: ["subclass:instanceVariableNames:package:", "setTraitComposition:", "asTraitComposition"]
  16664. }),
  16665. $globals.UndefinedObject);
  16666. });
  16667. define('amber_core/Kernel-Methods',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  16668. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  16669. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  16670. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  16671. $core.addPackage("Kernel-Methods");
  16672. $core.packages["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  16673. $core.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  16674. $core.addClass("BlockClosure", $globals.Object, [], "Kernel-Methods");
  16675. $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 | ... ] `";
  16676. $core.addMethod(
  16677. $core.method({
  16678. selector: "applyTo:arguments:",
  16679. protocol: "evaluating",
  16680. fn: function (anObject,aCollection){
  16681. var self=this;
  16682. return $core.withContext(function($ctx1) {
  16683. return self.apply(anObject, aCollection);
  16684. return self;
  16685. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  16686. },
  16687. args: ["anObject", "aCollection"],
  16688. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  16689. referencedClasses: [],
  16690. messageSends: []
  16691. }),
  16692. $globals.BlockClosure);
  16693. $core.addMethod(
  16694. $core.method({
  16695. selector: "asCompiledMethod:",
  16696. protocol: "converting",
  16697. fn: function (aString){
  16698. var self=this;
  16699. return $core.withContext(function($ctx1) {
  16700. return $core.method({selector:aString, fn:self});;
  16701. return self;
  16702. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  16703. },
  16704. args: ["aString"],
  16705. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  16706. referencedClasses: [],
  16707. messageSends: []
  16708. }),
  16709. $globals.BlockClosure);
  16710. $core.addMethod(
  16711. $core.method({
  16712. selector: "compiledSource",
  16713. protocol: "accessing",
  16714. fn: function (){
  16715. var self=this;
  16716. return $core.withContext(function($ctx1) {
  16717. return self.toString();
  16718. return self;
  16719. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  16720. },
  16721. args: [],
  16722. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  16723. referencedClasses: [],
  16724. messageSends: []
  16725. }),
  16726. $globals.BlockClosure);
  16727. $core.addMethod(
  16728. $core.method({
  16729. selector: "currySelf",
  16730. protocol: "converting",
  16731. fn: function (){
  16732. var self=this;
  16733. return $core.withContext(function($ctx1) {
  16734. return function () {
  16735. var args = [ this ];
  16736. args.push.apply(args, arguments);
  16737. return self.apply(null, args);
  16738. }
  16739. ;
  16740. return self;
  16741. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  16742. },
  16743. args: [],
  16744. 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'>",
  16745. referencedClasses: [],
  16746. messageSends: []
  16747. }),
  16748. $globals.BlockClosure);
  16749. $core.addMethod(
  16750. $core.method({
  16751. selector: "ensure:",
  16752. protocol: "evaluating",
  16753. fn: function (aBlock){
  16754. var self=this;
  16755. return $core.withContext(function($ctx1) {
  16756. try{return self._value()}finally{aBlock._value()};
  16757. return self;
  16758. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  16759. },
  16760. args: ["aBlock"],
  16761. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return self._value()}finally{aBlock._value()}'>",
  16762. referencedClasses: [],
  16763. messageSends: []
  16764. }),
  16765. $globals.BlockClosure);
  16766. $core.addMethod(
  16767. $core.method({
  16768. selector: "fork",
  16769. protocol: "timeout/interval",
  16770. fn: function (){
  16771. var self=this;
  16772. return $core.withContext(function($ctx1) {
  16773. $recv($recv($globals.ForkPool)._default())._fork_(self);
  16774. return self;
  16775. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  16776. },
  16777. args: [],
  16778. source: "fork\x0a\x09ForkPool default fork: self",
  16779. referencedClasses: ["ForkPool"],
  16780. messageSends: ["fork:", "default"]
  16781. }),
  16782. $globals.BlockClosure);
  16783. $core.addMethod(
  16784. $core.method({
  16785. selector: "new",
  16786. protocol: "evaluating",
  16787. fn: function (){
  16788. var self=this;
  16789. return $core.withContext(function($ctx1) {
  16790. return new self();
  16791. return self;
  16792. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  16793. },
  16794. args: [],
  16795. 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()'>",
  16796. referencedClasses: [],
  16797. messageSends: []
  16798. }),
  16799. $globals.BlockClosure);
  16800. $core.addMethod(
  16801. $core.method({
  16802. selector: "newValue:",
  16803. protocol: "evaluating",
  16804. fn: function (anObject){
  16805. var self=this;
  16806. return $core.withContext(function($ctx1) {
  16807. return self._newWithValues_([anObject]);
  16808. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  16809. },
  16810. args: ["anObject"],
  16811. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  16812. referencedClasses: [],
  16813. messageSends: ["newWithValues:"]
  16814. }),
  16815. $globals.BlockClosure);
  16816. $core.addMethod(
  16817. $core.method({
  16818. selector: "newValue:value:",
  16819. protocol: "evaluating",
  16820. fn: function (anObject,anObject2){
  16821. var self=this;
  16822. return $core.withContext(function($ctx1) {
  16823. return self._newWithValues_([anObject,anObject2]);
  16824. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  16825. },
  16826. args: ["anObject", "anObject2"],
  16827. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  16828. referencedClasses: [],
  16829. messageSends: ["newWithValues:"]
  16830. }),
  16831. $globals.BlockClosure);
  16832. $core.addMethod(
  16833. $core.method({
  16834. selector: "newValue:value:value:",
  16835. protocol: "evaluating",
  16836. fn: function (anObject,anObject2,anObject3){
  16837. var self=this;
  16838. return $core.withContext(function($ctx1) {
  16839. return self._newWithValues_([anObject,anObject2,anObject3]);
  16840. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  16841. },
  16842. args: ["anObject", "anObject2", "anObject3"],
  16843. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  16844. referencedClasses: [],
  16845. messageSends: ["newWithValues:"]
  16846. }),
  16847. $globals.BlockClosure);
  16848. $core.addMethod(
  16849. $core.method({
  16850. selector: "newWithValues:",
  16851. protocol: "evaluating",
  16852. fn: function (aCollection){
  16853. var self=this;
  16854. return $core.withContext(function($ctx1) {
  16855. var object = Object.create(self.prototype);
  16856. var result = self.apply(object, aCollection);
  16857. return typeof result === "object" ? result : object;
  16858. ;
  16859. return self;
  16860. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  16861. },
  16862. args: ["aCollection"],
  16863. 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'>",
  16864. referencedClasses: [],
  16865. messageSends: []
  16866. }),
  16867. $globals.BlockClosure);
  16868. $core.addMethod(
  16869. $core.method({
  16870. selector: "numArgs",
  16871. protocol: "accessing",
  16872. fn: function (){
  16873. var self=this;
  16874. return $core.withContext(function($ctx1) {
  16875. return self.length;
  16876. return self;
  16877. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  16878. },
  16879. args: [],
  16880. source: "numArgs\x0a\x09<inlineJS: 'return self.length'>",
  16881. referencedClasses: [],
  16882. messageSends: []
  16883. }),
  16884. $globals.BlockClosure);
  16885. $core.addMethod(
  16886. $core.method({
  16887. selector: "on:do:",
  16888. protocol: "error handling",
  16889. fn: function (anErrorClass,aBlock){
  16890. var self=this;
  16891. return $core.withContext(function($ctx1) {
  16892. var $1;
  16893. return self._tryCatch_((function(error){
  16894. var smalltalkError;
  16895. return $core.withContext(function($ctx2) {
  16896. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  16897. smalltalkError;
  16898. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  16899. if($core.assert($1)){
  16900. return $recv(aBlock)._value_(smalltalkError);
  16901. } else {
  16902. return $recv(smalltalkError)._resignal();
  16903. }
  16904. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  16905. }));
  16906. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  16907. },
  16908. args: ["anErrorClass", "aBlock"],
  16909. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError resignal ] ]",
  16910. referencedClasses: ["Smalltalk"],
  16911. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  16912. }),
  16913. $globals.BlockClosure);
  16914. $core.addMethod(
  16915. $core.method({
  16916. selector: "receiver",
  16917. protocol: "accessing",
  16918. fn: function (){
  16919. var self=this;
  16920. return nil;
  16921. },
  16922. args: [],
  16923. source: "receiver\x0a\x09^ nil",
  16924. referencedClasses: [],
  16925. messageSends: []
  16926. }),
  16927. $globals.BlockClosure);
  16928. $core.addMethod(
  16929. $core.method({
  16930. selector: "timeToRun",
  16931. protocol: "evaluating",
  16932. fn: function (){
  16933. var self=this;
  16934. return $core.withContext(function($ctx1) {
  16935. return $recv($globals.Date)._millisecondsToRun_(self);
  16936. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  16937. },
  16938. args: [],
  16939. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  16940. referencedClasses: ["Date"],
  16941. messageSends: ["millisecondsToRun:"]
  16942. }),
  16943. $globals.BlockClosure);
  16944. $core.addMethod(
  16945. $core.method({
  16946. selector: "tryCatch:",
  16947. protocol: "error handling",
  16948. fn: function (aBlock){
  16949. var self=this;
  16950. return $core.withContext(function($ctx1) {
  16951. try {
  16952. return self._value();
  16953. } catch(error) {
  16954. // pass non-local returns undetected
  16955. if (Array.isArray(error) && error.length === 1) throw error;
  16956. return aBlock._value_(error);
  16957. }
  16958. ;
  16959. return self;
  16960. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  16961. },
  16962. args: ["aBlock"],
  16963. 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'>",
  16964. referencedClasses: [],
  16965. messageSends: []
  16966. }),
  16967. $globals.BlockClosure);
  16968. $core.addMethod(
  16969. $core.method({
  16970. selector: "value",
  16971. protocol: "evaluating",
  16972. fn: function (){
  16973. var self=this;
  16974. return $core.withContext(function($ctx1) {
  16975. return self();;
  16976. return self;
  16977. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  16978. },
  16979. args: [],
  16980. source: "value\x0a\x09<inlineJS: 'return self();'>",
  16981. referencedClasses: [],
  16982. messageSends: []
  16983. }),
  16984. $globals.BlockClosure);
  16985. $core.addMethod(
  16986. $core.method({
  16987. selector: "value:",
  16988. protocol: "evaluating",
  16989. fn: function (anArg){
  16990. var self=this;
  16991. return $core.withContext(function($ctx1) {
  16992. return self(anArg);;
  16993. return self;
  16994. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  16995. },
  16996. args: ["anArg"],
  16997. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  16998. referencedClasses: [],
  16999. messageSends: []
  17000. }),
  17001. $globals.BlockClosure);
  17002. $core.addMethod(
  17003. $core.method({
  17004. selector: "value:value:",
  17005. protocol: "evaluating",
  17006. fn: function (firstArg,secondArg){
  17007. var self=this;
  17008. return $core.withContext(function($ctx1) {
  17009. return self(firstArg, secondArg);;
  17010. return self;
  17011. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  17012. },
  17013. args: ["firstArg", "secondArg"],
  17014. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  17015. referencedClasses: [],
  17016. messageSends: []
  17017. }),
  17018. $globals.BlockClosure);
  17019. $core.addMethod(
  17020. $core.method({
  17021. selector: "value:value:value:",
  17022. protocol: "evaluating",
  17023. fn: function (firstArg,secondArg,thirdArg){
  17024. var self=this;
  17025. return $core.withContext(function($ctx1) {
  17026. return self(firstArg, secondArg, thirdArg);;
  17027. return self;
  17028. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  17029. },
  17030. args: ["firstArg", "secondArg", "thirdArg"],
  17031. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  17032. referencedClasses: [],
  17033. messageSends: []
  17034. }),
  17035. $globals.BlockClosure);
  17036. $core.addMethod(
  17037. $core.method({
  17038. selector: "valueWithInterval:",
  17039. protocol: "timeout/interval",
  17040. fn: function (aNumber){
  17041. var self=this;
  17042. return $core.withContext(function($ctx1) {
  17043. var interval = setInterval(self, aNumber);
  17044. return $globals.Timeout._on_(interval);
  17045. ;
  17046. return self;
  17047. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  17048. },
  17049. args: ["aNumber"],
  17050. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  17051. referencedClasses: [],
  17052. messageSends: []
  17053. }),
  17054. $globals.BlockClosure);
  17055. $core.addMethod(
  17056. $core.method({
  17057. selector: "valueWithPossibleArguments:",
  17058. protocol: "evaluating",
  17059. fn: function (aCollection){
  17060. var self=this;
  17061. return $core.withContext(function($ctx1) {
  17062. return self.apply(null, aCollection);;
  17063. return self;
  17064. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  17065. },
  17066. args: ["aCollection"],
  17067. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  17068. referencedClasses: [],
  17069. messageSends: []
  17070. }),
  17071. $globals.BlockClosure);
  17072. $core.addMethod(
  17073. $core.method({
  17074. selector: "valueWithTimeout:",
  17075. protocol: "timeout/interval",
  17076. fn: function (aNumber){
  17077. var self=this;
  17078. return $core.withContext(function($ctx1) {
  17079. var timeout = setTimeout(self, aNumber);
  17080. return $globals.Timeout._on_(timeout);
  17081. ;
  17082. return self;
  17083. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  17084. },
  17085. args: ["aNumber"],
  17086. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  17087. referencedClasses: [],
  17088. messageSends: []
  17089. }),
  17090. $globals.BlockClosure);
  17091. $core.addMethod(
  17092. $core.method({
  17093. selector: "whileFalse",
  17094. protocol: "controlling",
  17095. fn: function (){
  17096. var self=this;
  17097. return $core.withContext(function($ctx1) {
  17098. self._whileFalse_((function(){
  17099. }));
  17100. return self;
  17101. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  17102. },
  17103. args: [],
  17104. source: "whileFalse\x0a\x09self whileFalse: []",
  17105. referencedClasses: [],
  17106. messageSends: ["whileFalse:"]
  17107. }),
  17108. $globals.BlockClosure);
  17109. $core.addMethod(
  17110. $core.method({
  17111. selector: "whileFalse:",
  17112. protocol: "controlling",
  17113. fn: function (aBlock){
  17114. var self=this;
  17115. return $core.withContext(function($ctx1) {
  17116. while(!$core.assert(self._value())) {aBlock._value()};
  17117. return self;
  17118. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  17119. },
  17120. args: ["aBlock"],
  17121. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert(self._value())) {aBlock._value()}'>",
  17122. referencedClasses: [],
  17123. messageSends: []
  17124. }),
  17125. $globals.BlockClosure);
  17126. $core.addMethod(
  17127. $core.method({
  17128. selector: "whileTrue",
  17129. protocol: "controlling",
  17130. fn: function (){
  17131. var self=this;
  17132. return $core.withContext(function($ctx1) {
  17133. self._whileTrue_((function(){
  17134. }));
  17135. return self;
  17136. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  17137. },
  17138. args: [],
  17139. source: "whileTrue\x0a\x09self whileTrue: []",
  17140. referencedClasses: [],
  17141. messageSends: ["whileTrue:"]
  17142. }),
  17143. $globals.BlockClosure);
  17144. $core.addMethod(
  17145. $core.method({
  17146. selector: "whileTrue:",
  17147. protocol: "controlling",
  17148. fn: function (aBlock){
  17149. var self=this;
  17150. return $core.withContext(function($ctx1) {
  17151. while($core.assert(self._value())) {aBlock._value()};
  17152. return self;
  17153. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  17154. },
  17155. args: ["aBlock"],
  17156. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert(self._value())) {aBlock._value()}'>",
  17157. referencedClasses: [],
  17158. messageSends: []
  17159. }),
  17160. $globals.BlockClosure);
  17161. $core.addClass("CompiledMethod", $globals.Object, [], "Kernel-Methods");
  17162. $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";
  17163. $core.addMethod(
  17164. $core.method({
  17165. selector: "arguments",
  17166. protocol: "accessing",
  17167. fn: function (){
  17168. var self=this;
  17169. return $core.withContext(function($ctx1) {
  17170. return self.args || [];
  17171. return self;
  17172. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  17173. },
  17174. args: [],
  17175. source: "arguments\x0a\x09<inlineJS: 'return self.args || []'>",
  17176. referencedClasses: [],
  17177. messageSends: []
  17178. }),
  17179. $globals.CompiledMethod);
  17180. $core.addMethod(
  17181. $core.method({
  17182. selector: "browse",
  17183. protocol: "browsing",
  17184. fn: function (){
  17185. var self=this;
  17186. return $core.withContext(function($ctx1) {
  17187. $recv($globals.Finder)._findMethod_(self);
  17188. return self;
  17189. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  17190. },
  17191. args: [],
  17192. source: "browse\x0a\x09Finder findMethod: self",
  17193. referencedClasses: ["Finder"],
  17194. messageSends: ["findMethod:"]
  17195. }),
  17196. $globals.CompiledMethod);
  17197. $core.addMethod(
  17198. $core.method({
  17199. selector: "category",
  17200. protocol: "accessing",
  17201. fn: function (){
  17202. var self=this;
  17203. return $core.withContext(function($ctx1) {
  17204. return self._protocol();
  17205. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  17206. },
  17207. args: [],
  17208. source: "category\x0a\x09^ self protocol",
  17209. referencedClasses: [],
  17210. messageSends: ["protocol"]
  17211. }),
  17212. $globals.CompiledMethod);
  17213. $core.addMethod(
  17214. $core.method({
  17215. selector: "defaultProtocol",
  17216. protocol: "defaults",
  17217. fn: function (){
  17218. var self=this;
  17219. return "as yet unclassified";
  17220. },
  17221. args: [],
  17222. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  17223. referencedClasses: [],
  17224. messageSends: []
  17225. }),
  17226. $globals.CompiledMethod);
  17227. $core.addMethod(
  17228. $core.method({
  17229. selector: "fn",
  17230. protocol: "accessing",
  17231. fn: function (){
  17232. var self=this;
  17233. return $core.withContext(function($ctx1) {
  17234. return self._basicAt_("fn");
  17235. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  17236. },
  17237. args: [],
  17238. source: "fn\x0a\x09^ self basicAt: 'fn'",
  17239. referencedClasses: [],
  17240. messageSends: ["basicAt:"]
  17241. }),
  17242. $globals.CompiledMethod);
  17243. $core.addMethod(
  17244. $core.method({
  17245. selector: "fn:",
  17246. protocol: "accessing",
  17247. fn: function (aBlock){
  17248. var self=this;
  17249. return $core.withContext(function($ctx1) {
  17250. self._basicAt_put_("fn",aBlock);
  17251. return self;
  17252. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  17253. },
  17254. args: ["aBlock"],
  17255. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  17256. referencedClasses: [],
  17257. messageSends: ["basicAt:put:"]
  17258. }),
  17259. $globals.CompiledMethod);
  17260. $core.addMethod(
  17261. $core.method({
  17262. selector: "isCompiledMethod",
  17263. protocol: "testing",
  17264. fn: function (){
  17265. var self=this;
  17266. return true;
  17267. },
  17268. args: [],
  17269. source: "isCompiledMethod\x0a\x09^ true",
  17270. referencedClasses: [],
  17271. messageSends: []
  17272. }),
  17273. $globals.CompiledMethod);
  17274. $core.addMethod(
  17275. $core.method({
  17276. selector: "isOverridden",
  17277. protocol: "testing",
  17278. fn: function (){
  17279. var self=this;
  17280. var selector;
  17281. return $core.withContext(function($ctx1) {
  17282. var $1;
  17283. var $early={};
  17284. try {
  17285. selector=self._selector();
  17286. $recv(self._methodClass())._allSubclassesDo_((function(each){
  17287. return $core.withContext(function($ctx2) {
  17288. $1=$recv(each)._includesSelector_(selector);
  17289. if($core.assert($1)){
  17290. throw $early=[true];
  17291. }
  17292. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17293. }));
  17294. return false;
  17295. }
  17296. catch(e) {if(e===$early)return e[0]; throw e}
  17297. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  17298. },
  17299. args: [],
  17300. 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",
  17301. referencedClasses: [],
  17302. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  17303. }),
  17304. $globals.CompiledMethod);
  17305. $core.addMethod(
  17306. $core.method({
  17307. selector: "isOverride",
  17308. protocol: "testing",
  17309. fn: function (){
  17310. var self=this;
  17311. var superclass;
  17312. return $core.withContext(function($ctx1) {
  17313. var $1,$2,$receiver;
  17314. $1=self._methodClass();
  17315. $ctx1.sendIdx["methodClass"]=1;
  17316. superclass=$recv($1)._superclass();
  17317. $ctx1.sendIdx["superclass"]=1;
  17318. $2=superclass;
  17319. if(($receiver = $2) == null || $receiver.isNil){
  17320. return false;
  17321. } else {
  17322. $2;
  17323. }
  17324. return $recv($recv($recv(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  17325. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  17326. },
  17327. args: [],
  17328. 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",
  17329. referencedClasses: [],
  17330. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  17331. }),
  17332. $globals.CompiledMethod);
  17333. $core.addMethod(
  17334. $core.method({
  17335. selector: "messageSends",
  17336. protocol: "accessing",
  17337. fn: function (){
  17338. var self=this;
  17339. return $core.withContext(function($ctx1) {
  17340. return self._basicAt_("messageSends");
  17341. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  17342. },
  17343. args: [],
  17344. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  17345. referencedClasses: [],
  17346. messageSends: ["basicAt:"]
  17347. }),
  17348. $globals.CompiledMethod);
  17349. $core.addMethod(
  17350. $core.method({
  17351. selector: "methodClass",
  17352. protocol: "accessing",
  17353. fn: function (){
  17354. var self=this;
  17355. return $core.withContext(function($ctx1) {
  17356. return self._basicAt_("methodClass");
  17357. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  17358. },
  17359. args: [],
  17360. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  17361. referencedClasses: [],
  17362. messageSends: ["basicAt:"]
  17363. }),
  17364. $globals.CompiledMethod);
  17365. $core.addMethod(
  17366. $core.method({
  17367. selector: "package",
  17368. protocol: "accessing",
  17369. fn: function (){
  17370. var self=this;
  17371. return $core.withContext(function($ctx1) {
  17372. var $1,$receiver;
  17373. $1=self._methodClass();
  17374. if(($receiver = $1) == null || $receiver.isNil){
  17375. return $1;
  17376. } else {
  17377. var class_;
  17378. class_=$receiver;
  17379. return $recv(class_)._packageOfProtocol_(self._protocol());
  17380. }
  17381. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  17382. },
  17383. args: [],
  17384. 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 ]",
  17385. referencedClasses: [],
  17386. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  17387. }),
  17388. $globals.CompiledMethod);
  17389. $core.addMethod(
  17390. $core.method({
  17391. selector: "protocol",
  17392. protocol: "accessing",
  17393. fn: function (){
  17394. var self=this;
  17395. return $core.withContext(function($ctx1) {
  17396. var $1,$receiver;
  17397. $1=self._basicAt_("protocol");
  17398. if(($receiver = $1) == null || $receiver.isNil){
  17399. return self._defaultProtocol();
  17400. } else {
  17401. return $1;
  17402. }
  17403. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  17404. },
  17405. args: [],
  17406. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  17407. referencedClasses: [],
  17408. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  17409. }),
  17410. $globals.CompiledMethod);
  17411. $core.addMethod(
  17412. $core.method({
  17413. selector: "protocol:",
  17414. protocol: "accessing",
  17415. fn: function (aString){
  17416. var self=this;
  17417. var oldProtocol;
  17418. return $core.withContext(function($ctx1) {
  17419. var $1,$3,$2,$4,$receiver;
  17420. oldProtocol=self._protocol();
  17421. self._basicAt_put_("protocol",aString);
  17422. $1=$recv($globals.SystemAnnouncer)._current();
  17423. $3=$recv($globals.MethodMoved)._new();
  17424. $recv($3)._method_(self);
  17425. $recv($3)._oldProtocol_(oldProtocol);
  17426. $2=$recv($3)._yourself();
  17427. $recv($1)._announce_($2);
  17428. $4=self._methodClass();
  17429. if(($receiver = $4) == null || $receiver.isNil){
  17430. $4;
  17431. } else {
  17432. var methodClass;
  17433. methodClass=$receiver;
  17434. $recv($recv(methodClass)._organization())._addElement_(aString);
  17435. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  17436. }
  17437. return self;
  17438. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  17439. },
  17440. args: ["aString"],
  17441. 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 ]",
  17442. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  17443. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  17444. }),
  17445. $globals.CompiledMethod);
  17446. $core.addMethod(
  17447. $core.method({
  17448. selector: "referencedClasses",
  17449. protocol: "accessing",
  17450. fn: function (){
  17451. var self=this;
  17452. return $core.withContext(function($ctx1) {
  17453. return self._basicAt_("referencedClasses");
  17454. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  17455. },
  17456. args: [],
  17457. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  17458. referencedClasses: [],
  17459. messageSends: ["basicAt:"]
  17460. }),
  17461. $globals.CompiledMethod);
  17462. $core.addMethod(
  17463. $core.method({
  17464. selector: "selector",
  17465. protocol: "accessing",
  17466. fn: function (){
  17467. var self=this;
  17468. return $core.withContext(function($ctx1) {
  17469. return self._basicAt_("selector");
  17470. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  17471. },
  17472. args: [],
  17473. source: "selector\x0a\x09^ self basicAt: 'selector'",
  17474. referencedClasses: [],
  17475. messageSends: ["basicAt:"]
  17476. }),
  17477. $globals.CompiledMethod);
  17478. $core.addMethod(
  17479. $core.method({
  17480. selector: "selector:",
  17481. protocol: "accessing",
  17482. fn: function (aString){
  17483. var self=this;
  17484. return $core.withContext(function($ctx1) {
  17485. self._basicAt_put_("selector",aString);
  17486. return self;
  17487. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  17488. },
  17489. args: ["aString"],
  17490. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  17491. referencedClasses: [],
  17492. messageSends: ["basicAt:put:"]
  17493. }),
  17494. $globals.CompiledMethod);
  17495. $core.addMethod(
  17496. $core.method({
  17497. selector: "sendTo:arguments:",
  17498. protocol: "evaluating",
  17499. fn: function (anObject,aCollection){
  17500. var self=this;
  17501. return $core.withContext(function($ctx1) {
  17502. return $recv(self._fn())._applyTo_arguments_(anObject,aCollection);
  17503. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  17504. },
  17505. args: ["anObject", "aCollection"],
  17506. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  17507. referencedClasses: [],
  17508. messageSends: ["applyTo:arguments:", "fn"]
  17509. }),
  17510. $globals.CompiledMethod);
  17511. $core.addMethod(
  17512. $core.method({
  17513. selector: "source",
  17514. protocol: "accessing",
  17515. fn: function (){
  17516. var self=this;
  17517. return $core.withContext(function($ctx1) {
  17518. var $1,$receiver;
  17519. $1=self._basicAt_("source");
  17520. if(($receiver = $1) == null || $receiver.isNil){
  17521. return "";
  17522. } else {
  17523. return $1;
  17524. }
  17525. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  17526. },
  17527. args: [],
  17528. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  17529. referencedClasses: [],
  17530. messageSends: ["ifNil:", "basicAt:"]
  17531. }),
  17532. $globals.CompiledMethod);
  17533. $core.addMethod(
  17534. $core.method({
  17535. selector: "source:",
  17536. protocol: "accessing",
  17537. fn: function (aString){
  17538. var self=this;
  17539. return $core.withContext(function($ctx1) {
  17540. self._basicAt_put_("source",aString);
  17541. return self;
  17542. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  17543. },
  17544. args: ["aString"],
  17545. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  17546. referencedClasses: [],
  17547. messageSends: ["basicAt:put:"]
  17548. }),
  17549. $globals.CompiledMethod);
  17550. $core.addClass("ForkPool", $globals.Object, ["poolSize", "maxPoolSize", "queue", "worker"], "Kernel-Methods");
  17551. $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`";
  17552. $core.addMethod(
  17553. $core.method({
  17554. selector: "addWorker",
  17555. protocol: "private",
  17556. fn: function (){
  17557. var self=this;
  17558. return $core.withContext(function($ctx1) {
  17559. $recv(self["@worker"])._valueWithTimeout_((0));
  17560. self["@poolSize"]=$recv(self["@poolSize"]).__plus((1));
  17561. return self;
  17562. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  17563. },
  17564. args: [],
  17565. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  17566. referencedClasses: [],
  17567. messageSends: ["valueWithTimeout:", "+"]
  17568. }),
  17569. $globals.ForkPool);
  17570. $core.addMethod(
  17571. $core.method({
  17572. selector: "defaultMaxPoolSize",
  17573. protocol: "defaults",
  17574. fn: function (){
  17575. var self=this;
  17576. return $core.withContext(function($ctx1) {
  17577. return $recv(self._class())._defaultMaxPoolSize();
  17578. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  17579. },
  17580. args: [],
  17581. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  17582. referencedClasses: [],
  17583. messageSends: ["defaultMaxPoolSize", "class"]
  17584. }),
  17585. $globals.ForkPool);
  17586. $core.addMethod(
  17587. $core.method({
  17588. selector: "fork:",
  17589. protocol: "actions",
  17590. fn: function (aBlock){
  17591. var self=this;
  17592. return $core.withContext(function($ctx1) {
  17593. var $1;
  17594. $1=$recv(self["@poolSize"]).__lt(self._maxPoolSize());
  17595. if($core.assert($1)){
  17596. self._addWorker();
  17597. }
  17598. $recv(self["@queue"])._nextPut_(aBlock);
  17599. return self;
  17600. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  17601. },
  17602. args: ["aBlock"],
  17603. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  17604. referencedClasses: [],
  17605. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  17606. }),
  17607. $globals.ForkPool);
  17608. $core.addMethod(
  17609. $core.method({
  17610. selector: "initialize",
  17611. protocol: "initialization",
  17612. fn: function (){
  17613. var self=this;
  17614. return $core.withContext(function($ctx1) {
  17615. (
  17616. $ctx1.supercall = true,
  17617. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  17618. $ctx1.supercall = false;
  17619. self["@poolSize"]=(0);
  17620. self["@queue"]=$recv($globals.Queue)._new();
  17621. self["@worker"]=self._makeWorker();
  17622. return self;
  17623. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  17624. },
  17625. args: [],
  17626. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  17627. referencedClasses: ["Queue"],
  17628. messageSends: ["initialize", "new", "makeWorker"]
  17629. }),
  17630. $globals.ForkPool);
  17631. $core.addMethod(
  17632. $core.method({
  17633. selector: "makeWorker",
  17634. protocol: "initialization",
  17635. fn: function (){
  17636. var self=this;
  17637. var sentinel;
  17638. return $core.withContext(function($ctx1) {
  17639. var $1;
  17640. sentinel=$recv($globals.Object)._new();
  17641. return (function(){
  17642. var block;
  17643. return $core.withContext(function($ctx2) {
  17644. self["@poolSize"]=$recv(self["@poolSize"]).__minus((1));
  17645. self["@poolSize"];
  17646. block=$recv(self["@queue"])._nextIfAbsent_((function(){
  17647. return sentinel;
  17648. }));
  17649. block;
  17650. $1=$recv(block).__eq_eq(sentinel);
  17651. if(!$core.assert($1)){
  17652. return $recv((function(){
  17653. return $core.withContext(function($ctx3) {
  17654. return $recv(block)._value();
  17655. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  17656. }))._ensure_((function(){
  17657. return $core.withContext(function($ctx3) {
  17658. return self._addWorker();
  17659. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  17660. }));
  17661. }
  17662. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  17663. });
  17664. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  17665. },
  17666. args: [],
  17667. 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 ] ]]",
  17668. referencedClasses: ["Object"],
  17669. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  17670. }),
  17671. $globals.ForkPool);
  17672. $core.addMethod(
  17673. $core.method({
  17674. selector: "maxPoolSize",
  17675. protocol: "accessing",
  17676. fn: function (){
  17677. var self=this;
  17678. return $core.withContext(function($ctx1) {
  17679. var $1,$receiver;
  17680. $1=self["@maxPoolSize"];
  17681. if(($receiver = $1) == null || $receiver.isNil){
  17682. return self._defaultMaxPoolSize();
  17683. } else {
  17684. return $1;
  17685. }
  17686. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  17687. },
  17688. args: [],
  17689. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  17690. referencedClasses: [],
  17691. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  17692. }),
  17693. $globals.ForkPool);
  17694. $core.addMethod(
  17695. $core.method({
  17696. selector: "maxPoolSize:",
  17697. protocol: "accessing",
  17698. fn: function (anInteger){
  17699. var self=this;
  17700. self["@maxPoolSize"]=anInteger;
  17701. return self;
  17702. },
  17703. args: ["anInteger"],
  17704. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  17705. referencedClasses: [],
  17706. messageSends: []
  17707. }),
  17708. $globals.ForkPool);
  17709. $globals.ForkPool.klass.iVarNames = ["default"];
  17710. $core.addMethod(
  17711. $core.method({
  17712. selector: "default",
  17713. protocol: "accessing",
  17714. fn: function (){
  17715. var self=this;
  17716. return $core.withContext(function($ctx1) {
  17717. var $1,$receiver;
  17718. $1=self["@default"];
  17719. if(($receiver = $1) == null || $receiver.isNil){
  17720. self["@default"]=self._new();
  17721. return self["@default"];
  17722. } else {
  17723. return $1;
  17724. }
  17725. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.klass)});
  17726. },
  17727. args: [],
  17728. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  17729. referencedClasses: [],
  17730. messageSends: ["ifNil:", "new"]
  17731. }),
  17732. $globals.ForkPool.klass);
  17733. $core.addMethod(
  17734. $core.method({
  17735. selector: "defaultMaxPoolSize",
  17736. protocol: "accessing",
  17737. fn: function (){
  17738. var self=this;
  17739. return (100);
  17740. },
  17741. args: [],
  17742. source: "defaultMaxPoolSize\x0a\x09^ 100",
  17743. referencedClasses: [],
  17744. messageSends: []
  17745. }),
  17746. $globals.ForkPool.klass);
  17747. $core.addMethod(
  17748. $core.method({
  17749. selector: "resetDefault",
  17750. protocol: "accessing",
  17751. fn: function (){
  17752. var self=this;
  17753. self["@default"]=nil;
  17754. return self;
  17755. },
  17756. args: [],
  17757. source: "resetDefault\x0a\x09default := nil",
  17758. referencedClasses: [],
  17759. messageSends: []
  17760. }),
  17761. $globals.ForkPool.klass);
  17762. $core.addClass("Message", $globals.Object, ["selector", "arguments"], "Kernel-Methods");
  17763. $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.";
  17764. $core.addMethod(
  17765. $core.method({
  17766. selector: "arguments",
  17767. protocol: "accessing",
  17768. fn: function (){
  17769. var self=this;
  17770. return self["@arguments"];
  17771. },
  17772. args: [],
  17773. source: "arguments\x0a\x09^ arguments",
  17774. referencedClasses: [],
  17775. messageSends: []
  17776. }),
  17777. $globals.Message);
  17778. $core.addMethod(
  17779. $core.method({
  17780. selector: "arguments:",
  17781. protocol: "accessing",
  17782. fn: function (anArray){
  17783. var self=this;
  17784. self["@arguments"]=anArray;
  17785. return self;
  17786. },
  17787. args: ["anArray"],
  17788. source: "arguments: anArray\x0a\x09arguments := anArray",
  17789. referencedClasses: [],
  17790. messageSends: []
  17791. }),
  17792. $globals.Message);
  17793. $core.addMethod(
  17794. $core.method({
  17795. selector: "printOn:",
  17796. protocol: "printing",
  17797. fn: function (aStream){
  17798. var self=this;
  17799. return $core.withContext(function($ctx1) {
  17800. (
  17801. $ctx1.supercall = true,
  17802. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  17803. $ctx1.supercall = false;
  17804. $recv(aStream)._nextPutAll_("(");
  17805. $ctx1.sendIdx["nextPutAll:"]=1;
  17806. $recv(aStream)._nextPutAll_(self._selector());
  17807. $ctx1.sendIdx["nextPutAll:"]=2;
  17808. $recv(aStream)._nextPutAll_(")");
  17809. return self;
  17810. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  17811. },
  17812. args: ["aStream"],
  17813. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  17814. referencedClasses: [],
  17815. messageSends: ["printOn:", "nextPutAll:", "selector"]
  17816. }),
  17817. $globals.Message);
  17818. $core.addMethod(
  17819. $core.method({
  17820. selector: "selector",
  17821. protocol: "accessing",
  17822. fn: function (){
  17823. var self=this;
  17824. return self["@selector"];
  17825. },
  17826. args: [],
  17827. source: "selector\x0a\x09^ selector",
  17828. referencedClasses: [],
  17829. messageSends: []
  17830. }),
  17831. $globals.Message);
  17832. $core.addMethod(
  17833. $core.method({
  17834. selector: "selector:",
  17835. protocol: "accessing",
  17836. fn: function (aString){
  17837. var self=this;
  17838. self["@selector"]=aString;
  17839. return self;
  17840. },
  17841. args: ["aString"],
  17842. source: "selector: aString\x0a\x09selector := aString",
  17843. referencedClasses: [],
  17844. messageSends: []
  17845. }),
  17846. $globals.Message);
  17847. $core.addMethod(
  17848. $core.method({
  17849. selector: "sendTo:",
  17850. protocol: "actions",
  17851. fn: function (anObject){
  17852. var self=this;
  17853. return $core.withContext(function($ctx1) {
  17854. return $recv(anObject)._perform_withArguments_(self._selector(),self._arguments());
  17855. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  17856. },
  17857. args: ["anObject"],
  17858. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  17859. referencedClasses: [],
  17860. messageSends: ["perform:withArguments:", "selector", "arguments"]
  17861. }),
  17862. $globals.Message);
  17863. $core.addMethod(
  17864. $core.method({
  17865. selector: "selector:arguments:",
  17866. protocol: "instance creation",
  17867. fn: function (aString,anArray){
  17868. var self=this;
  17869. return $core.withContext(function($ctx1) {
  17870. var $1;
  17871. $1=self._new();
  17872. $recv($1)._selector_(aString);
  17873. $recv($1)._arguments_(anArray);
  17874. return $recv($1)._yourself();
  17875. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.klass)});
  17876. },
  17877. args: ["aString", "anArray"],
  17878. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  17879. referencedClasses: [],
  17880. messageSends: ["selector:", "new", "arguments:", "yourself"]
  17881. }),
  17882. $globals.Message.klass);
  17883. $core.addClass("MessageSend", $globals.Object, ["receiver", "message"], "Kernel-Methods");
  17884. $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.";
  17885. $core.addMethod(
  17886. $core.method({
  17887. selector: "arguments",
  17888. protocol: "accessing",
  17889. fn: function (){
  17890. var self=this;
  17891. return $core.withContext(function($ctx1) {
  17892. return $recv(self["@message"])._arguments();
  17893. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  17894. },
  17895. args: [],
  17896. source: "arguments\x0a\x09^ message arguments",
  17897. referencedClasses: [],
  17898. messageSends: ["arguments"]
  17899. }),
  17900. $globals.MessageSend);
  17901. $core.addMethod(
  17902. $core.method({
  17903. selector: "arguments:",
  17904. protocol: "accessing",
  17905. fn: function (aCollection){
  17906. var self=this;
  17907. return $core.withContext(function($ctx1) {
  17908. $recv(self["@message"])._arguments_(aCollection);
  17909. return self;
  17910. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  17911. },
  17912. args: ["aCollection"],
  17913. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  17914. referencedClasses: [],
  17915. messageSends: ["arguments:"]
  17916. }),
  17917. $globals.MessageSend);
  17918. $core.addMethod(
  17919. $core.method({
  17920. selector: "initialize",
  17921. protocol: "initialization",
  17922. fn: function (){
  17923. var self=this;
  17924. return $core.withContext(function($ctx1) {
  17925. (
  17926. $ctx1.supercall = true,
  17927. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  17928. $ctx1.supercall = false;
  17929. self["@message"]=$recv($globals.Message)._new();
  17930. return self;
  17931. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  17932. },
  17933. args: [],
  17934. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  17935. referencedClasses: ["Message"],
  17936. messageSends: ["initialize", "new"]
  17937. }),
  17938. $globals.MessageSend);
  17939. $core.addMethod(
  17940. $core.method({
  17941. selector: "printOn:",
  17942. protocol: "printing",
  17943. fn: function (aStream){
  17944. var self=this;
  17945. return $core.withContext(function($ctx1) {
  17946. (
  17947. $ctx1.supercall = true,
  17948. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  17949. $ctx1.supercall = false;
  17950. $recv(aStream)._nextPutAll_("(");
  17951. $ctx1.sendIdx["nextPutAll:"]=1;
  17952. $recv(aStream)._nextPutAll_(self._receiver());
  17953. $ctx1.sendIdx["nextPutAll:"]=2;
  17954. $recv(aStream)._nextPutAll_(" >> ");
  17955. $ctx1.sendIdx["nextPutAll:"]=3;
  17956. $recv(aStream)._nextPutAll_(self._selector());
  17957. $ctx1.sendIdx["nextPutAll:"]=4;
  17958. $recv(aStream)._nextPutAll_(")");
  17959. return self;
  17960. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  17961. },
  17962. args: ["aStream"],
  17963. 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: ')'",
  17964. referencedClasses: [],
  17965. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  17966. }),
  17967. $globals.MessageSend);
  17968. $core.addMethod(
  17969. $core.method({
  17970. selector: "receiver",
  17971. protocol: "accessing",
  17972. fn: function (){
  17973. var self=this;
  17974. return self["@receiver"];
  17975. },
  17976. args: [],
  17977. source: "receiver\x0a\x09^ receiver",
  17978. referencedClasses: [],
  17979. messageSends: []
  17980. }),
  17981. $globals.MessageSend);
  17982. $core.addMethod(
  17983. $core.method({
  17984. selector: "receiver:",
  17985. protocol: "accessing",
  17986. fn: function (anObject){
  17987. var self=this;
  17988. self["@receiver"]=anObject;
  17989. return self;
  17990. },
  17991. args: ["anObject"],
  17992. source: "receiver: anObject\x0a\x09receiver := anObject",
  17993. referencedClasses: [],
  17994. messageSends: []
  17995. }),
  17996. $globals.MessageSend);
  17997. $core.addMethod(
  17998. $core.method({
  17999. selector: "selector",
  18000. protocol: "accessing",
  18001. fn: function (){
  18002. var self=this;
  18003. return $core.withContext(function($ctx1) {
  18004. return $recv(self["@message"])._selector();
  18005. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  18006. },
  18007. args: [],
  18008. source: "selector\x0a\x09^ message selector",
  18009. referencedClasses: [],
  18010. messageSends: ["selector"]
  18011. }),
  18012. $globals.MessageSend);
  18013. $core.addMethod(
  18014. $core.method({
  18015. selector: "selector:",
  18016. protocol: "accessing",
  18017. fn: function (aString){
  18018. var self=this;
  18019. return $core.withContext(function($ctx1) {
  18020. $recv(self["@message"])._selector_(aString);
  18021. return self;
  18022. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  18023. },
  18024. args: ["aString"],
  18025. source: "selector: aString\x0a\x09message selector: aString",
  18026. referencedClasses: [],
  18027. messageSends: ["selector:"]
  18028. }),
  18029. $globals.MessageSend);
  18030. $core.addMethod(
  18031. $core.method({
  18032. selector: "value",
  18033. protocol: "evaluating",
  18034. fn: function (){
  18035. var self=this;
  18036. return $core.withContext(function($ctx1) {
  18037. return $recv(self["@message"])._sendTo_(self._receiver());
  18038. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  18039. },
  18040. args: [],
  18041. source: "value\x0a\x09^ message sendTo: self receiver",
  18042. referencedClasses: [],
  18043. messageSends: ["sendTo:", "receiver"]
  18044. }),
  18045. $globals.MessageSend);
  18046. $core.addMethod(
  18047. $core.method({
  18048. selector: "value:",
  18049. protocol: "evaluating",
  18050. fn: function (anObject){
  18051. var self=this;
  18052. return $core.withContext(function($ctx1) {
  18053. var $1;
  18054. $1=self["@message"];
  18055. $recv($1)._arguments_([anObject]);
  18056. return $recv($1)._sendTo_(self._receiver());
  18057. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  18058. },
  18059. args: ["anObject"],
  18060. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  18061. referencedClasses: [],
  18062. messageSends: ["arguments:", "sendTo:", "receiver"]
  18063. }),
  18064. $globals.MessageSend);
  18065. $core.addMethod(
  18066. $core.method({
  18067. selector: "value:value:",
  18068. protocol: "evaluating",
  18069. fn: function (firstArgument,secondArgument){
  18070. var self=this;
  18071. return $core.withContext(function($ctx1) {
  18072. var $1;
  18073. $1=self["@message"];
  18074. $recv($1)._arguments_([firstArgument,secondArgument]);
  18075. return $recv($1)._sendTo_(self._receiver());
  18076. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  18077. },
  18078. args: ["firstArgument", "secondArgument"],
  18079. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  18080. referencedClasses: [],
  18081. messageSends: ["arguments:", "sendTo:", "receiver"]
  18082. }),
  18083. $globals.MessageSend);
  18084. $core.addMethod(
  18085. $core.method({
  18086. selector: "value:value:value:",
  18087. protocol: "evaluating",
  18088. fn: function (firstArgument,secondArgument,thirdArgument){
  18089. var self=this;
  18090. return $core.withContext(function($ctx1) {
  18091. var $1;
  18092. $1=self["@message"];
  18093. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  18094. return $recv($1)._sendTo_(self._receiver());
  18095. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  18096. },
  18097. args: ["firstArgument", "secondArgument", "thirdArgument"],
  18098. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  18099. referencedClasses: [],
  18100. messageSends: ["arguments:", "sendTo:", "receiver"]
  18101. }),
  18102. $globals.MessageSend);
  18103. $core.addMethod(
  18104. $core.method({
  18105. selector: "valueWithPossibleArguments:",
  18106. protocol: "evaluating",
  18107. fn: function (aCollection){
  18108. var self=this;
  18109. return $core.withContext(function($ctx1) {
  18110. self._arguments_(aCollection);
  18111. return self._value();
  18112. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  18113. },
  18114. args: ["aCollection"],
  18115. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  18116. referencedClasses: [],
  18117. messageSends: ["arguments:", "value"]
  18118. }),
  18119. $globals.MessageSend);
  18120. $core.addClass("MethodContext", $globals.Object, [], "Kernel-Methods");
  18121. $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`.";
  18122. $core.addMethod(
  18123. $core.method({
  18124. selector: "asString",
  18125. protocol: "converting",
  18126. fn: function (){
  18127. var self=this;
  18128. return $core.withContext(function($ctx1) {
  18129. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  18130. $2=self._isBlockContext();
  18131. if($core.assert($2)){
  18132. $3="a block (in ".__comma($recv(self._methodContext())._asString());
  18133. $ctx1.sendIdx[","]=2;
  18134. $1=$recv($3).__comma(")");
  18135. $ctx1.sendIdx[","]=1;
  18136. } else {
  18137. var methodClass;
  18138. methodClass=$recv(self._method())._methodClass();
  18139. methodClass;
  18140. $5=methodClass;
  18141. $7=self._receiver();
  18142. $ctx1.sendIdx["receiver"]=1;
  18143. $6=$recv($7)._class();
  18144. $ctx1.sendIdx["class"]=1;
  18145. $4=$recv($5).__eq($6);
  18146. if($core.assert($4)){
  18147. $11=self._receiver();
  18148. $ctx1.sendIdx["receiver"]=2;
  18149. $10=$recv($11)._class();
  18150. $ctx1.sendIdx["class"]=2;
  18151. $9=$recv($10)._name();
  18152. $ctx1.sendIdx["name"]=1;
  18153. $8=$recv($9).__comma(" >> ");
  18154. $ctx1.sendIdx[","]=4;
  18155. $12=self._selector();
  18156. $ctx1.sendIdx["selector"]=1;
  18157. $1=$recv($8).__comma($12);
  18158. $ctx1.sendIdx[","]=3;
  18159. } else {
  18160. $16=$recv($recv(self._receiver())._class())._name();
  18161. $ctx1.sendIdx["name"]=2;
  18162. $15=$recv($16).__comma("(");
  18163. $14=$recv($15).__comma($recv(methodClass)._name());
  18164. $ctx1.sendIdx[","]=7;
  18165. $13=$recv($14).__comma(") >> ");
  18166. $ctx1.sendIdx[","]=6;
  18167. $1=$recv($13).__comma(self._selector());
  18168. $ctx1.sendIdx[","]=5;
  18169. }
  18170. }
  18171. return $1;
  18172. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  18173. },
  18174. args: [],
  18175. 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 ] ]",
  18176. referencedClasses: [],
  18177. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  18178. }),
  18179. $globals.MethodContext);
  18180. $core.addMethod(
  18181. $core.method({
  18182. selector: "basicReceiver",
  18183. protocol: "accessing",
  18184. fn: function (){
  18185. var self=this;
  18186. return $core.withContext(function($ctx1) {
  18187. return self.receiver;
  18188. return self;
  18189. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  18190. },
  18191. args: [],
  18192. source: "basicReceiver\x0a\x09<inlineJS: 'return self.receiver'>",
  18193. referencedClasses: [],
  18194. messageSends: []
  18195. }),
  18196. $globals.MethodContext);
  18197. $core.addMethod(
  18198. $core.method({
  18199. selector: "evaluatedSelector",
  18200. protocol: "accessing",
  18201. fn: function (){
  18202. var self=this;
  18203. return $core.withContext(function($ctx1) {
  18204. return self.evaluatedSelector;
  18205. return self;
  18206. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  18207. },
  18208. args: [],
  18209. source: "evaluatedSelector\x0a\x09<inlineJS: 'return self.evaluatedSelector'>",
  18210. referencedClasses: [],
  18211. messageSends: []
  18212. }),
  18213. $globals.MethodContext);
  18214. $core.addMethod(
  18215. $core.method({
  18216. selector: "findContextSuchThat:",
  18217. protocol: "accessing",
  18218. fn: function (testBlock){
  18219. var self=this;
  18220. var context;
  18221. return $core.withContext(function($ctx1) {
  18222. var $1;
  18223. var $early={};
  18224. try {
  18225. context=self;
  18226. $recv((function(){
  18227. return $core.withContext(function($ctx2) {
  18228. return $recv(context)._isNil();
  18229. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  18230. }))._whileFalse_((function(){
  18231. return $core.withContext(function($ctx2) {
  18232. $1=$recv(testBlock)._value_(context);
  18233. if($core.assert($1)){
  18234. throw $early=[context];
  18235. }
  18236. context=$recv(context)._outerContext();
  18237. return context;
  18238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  18239. }));
  18240. return nil;
  18241. }
  18242. catch(e) {if(e===$early)return e[0]; throw e}
  18243. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  18244. },
  18245. args: ["testBlock"],
  18246. 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",
  18247. referencedClasses: [],
  18248. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  18249. }),
  18250. $globals.MethodContext);
  18251. $core.addMethod(
  18252. $core.method({
  18253. selector: "home",
  18254. protocol: "accessing",
  18255. fn: function (){
  18256. var self=this;
  18257. return $core.withContext(function($ctx1) {
  18258. return self.homeContext;
  18259. return self;
  18260. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  18261. },
  18262. args: [],
  18263. source: "home\x0a\x09<inlineJS: 'return self.homeContext'>",
  18264. referencedClasses: [],
  18265. messageSends: []
  18266. }),
  18267. $globals.MethodContext);
  18268. $core.addMethod(
  18269. $core.method({
  18270. selector: "index",
  18271. protocol: "accessing",
  18272. fn: function (){
  18273. var self=this;
  18274. return $core.withContext(function($ctx1) {
  18275. return self.index || 0;
  18276. return self;
  18277. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  18278. },
  18279. args: [],
  18280. source: "index\x0a\x09<inlineJS: 'return self.index || 0'>",
  18281. referencedClasses: [],
  18282. messageSends: []
  18283. }),
  18284. $globals.MethodContext);
  18285. $core.addMethod(
  18286. $core.method({
  18287. selector: "isBlockContext",
  18288. protocol: "testing",
  18289. fn: function (){
  18290. var self=this;
  18291. return $core.withContext(function($ctx1) {
  18292. return $recv(self._selector())._isNil();
  18293. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  18294. },
  18295. args: [],
  18296. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  18297. referencedClasses: [],
  18298. messageSends: ["isNil", "selector"]
  18299. }),
  18300. $globals.MethodContext);
  18301. $core.addMethod(
  18302. $core.method({
  18303. selector: "locals",
  18304. protocol: "accessing",
  18305. fn: function (){
  18306. var self=this;
  18307. return $core.withContext(function($ctx1) {
  18308. return self.locals || {};
  18309. return self;
  18310. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  18311. },
  18312. args: [],
  18313. source: "locals\x0a\x09<inlineJS: 'return self.locals || {}'>",
  18314. referencedClasses: [],
  18315. messageSends: []
  18316. }),
  18317. $globals.MethodContext);
  18318. $core.addMethod(
  18319. $core.method({
  18320. selector: "method",
  18321. protocol: "accessing",
  18322. fn: function (){
  18323. var self=this;
  18324. var method,lookupClass,receiverClass,supercall;
  18325. return $core.withContext(function($ctx1) {
  18326. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  18327. $1=self._methodContext();
  18328. $ctx1.sendIdx["methodContext"]=1;
  18329. if(($receiver = $1) == null || $receiver.isNil){
  18330. return nil;
  18331. } else {
  18332. $1;
  18333. }
  18334. $3=self._methodContext();
  18335. $ctx1.sendIdx["methodContext"]=2;
  18336. $2=$recv($3)._receiver();
  18337. receiverClass=$recv($2)._class();
  18338. $4=receiverClass;
  18339. $6=self._methodContext();
  18340. $ctx1.sendIdx["methodContext"]=3;
  18341. $5=$recv($6)._selector();
  18342. $ctx1.sendIdx["selector"]=1;
  18343. method=$recv($4)._lookupSelector_($5);
  18344. $ctx1.sendIdx["lookupSelector:"]=1;
  18345. $7=self._outerContext();
  18346. if(($receiver = $7) == null || $receiver.isNil){
  18347. supercall=false;
  18348. } else {
  18349. var outer;
  18350. outer=$receiver;
  18351. supercall=$recv(outer)._supercall();
  18352. }
  18353. $8=supercall;
  18354. if($core.assert($8)){
  18355. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv(self._methodContext())._selector());
  18356. } else {
  18357. return method;
  18358. }
  18359. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  18360. },
  18361. args: [],
  18362. 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 ]",
  18363. referencedClasses: [],
  18364. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  18365. }),
  18366. $globals.MethodContext);
  18367. $core.addMethod(
  18368. $core.method({
  18369. selector: "methodContext",
  18370. protocol: "accessing",
  18371. fn: function (){
  18372. var self=this;
  18373. return $core.withContext(function($ctx1) {
  18374. var $1,$2,$receiver;
  18375. $1=self._isBlockContext();
  18376. if(!$core.assert($1)){
  18377. return self;
  18378. }
  18379. $2=self._outerContext();
  18380. if(($receiver = $2) == null || $receiver.isNil){
  18381. return $2;
  18382. } else {
  18383. var outer;
  18384. outer=$receiver;
  18385. return $recv(outer)._methodContext();
  18386. }
  18387. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  18388. },
  18389. args: [],
  18390. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  18391. referencedClasses: [],
  18392. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  18393. }),
  18394. $globals.MethodContext);
  18395. $core.addMethod(
  18396. $core.method({
  18397. selector: "outerContext",
  18398. protocol: "accessing",
  18399. fn: function (){
  18400. var self=this;
  18401. return $core.withContext(function($ctx1) {
  18402. return self.outerContext || self.homeContext;
  18403. return self;
  18404. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  18405. },
  18406. args: [],
  18407. source: "outerContext\x0a\x09<inlineJS: 'return self.outerContext || self.homeContext'>",
  18408. referencedClasses: [],
  18409. messageSends: []
  18410. }),
  18411. $globals.MethodContext);
  18412. $core.addMethod(
  18413. $core.method({
  18414. selector: "printOn:",
  18415. protocol: "printing",
  18416. fn: function (aStream){
  18417. var self=this;
  18418. return $core.withContext(function($ctx1) {
  18419. (
  18420. $ctx1.supercall = true,
  18421. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  18422. $ctx1.supercall = false;
  18423. $recv(aStream)._nextPutAll_("(");
  18424. $ctx1.sendIdx["nextPutAll:"]=1;
  18425. $recv(aStream)._nextPutAll_(self._asString());
  18426. $ctx1.sendIdx["nextPutAll:"]=2;
  18427. $recv(aStream)._nextPutAll_(")");
  18428. return self;
  18429. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  18430. },
  18431. args: ["aStream"],
  18432. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  18433. referencedClasses: [],
  18434. messageSends: ["printOn:", "nextPutAll:", "asString"]
  18435. }),
  18436. $globals.MethodContext);
  18437. $core.addMethod(
  18438. $core.method({
  18439. selector: "receiver",
  18440. protocol: "accessing",
  18441. fn: function (){
  18442. var self=this;
  18443. return $core.withContext(function($ctx1) {
  18444. var $2,$1;
  18445. $1=$recv(self._isBlockContext())._and_((function(){
  18446. return $core.withContext(function($ctx2) {
  18447. $2=self._outerContext();
  18448. $ctx2.sendIdx["outerContext"]=1;
  18449. return $recv($2)._notNil();
  18450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  18451. }));
  18452. if($core.assert($1)){
  18453. return $recv(self._outerContext())._receiver();
  18454. } else {
  18455. return self._basicReceiver();
  18456. }
  18457. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  18458. },
  18459. args: [],
  18460. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  18461. referencedClasses: [],
  18462. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  18463. }),
  18464. $globals.MethodContext);
  18465. $core.addMethod(
  18466. $core.method({
  18467. selector: "selector",
  18468. protocol: "accessing",
  18469. fn: function (){
  18470. var self=this;
  18471. return $core.withContext(function($ctx1) {
  18472. if(self.selector) {
  18473. return $core.js2st(self.selector);
  18474. } else {
  18475. return nil;
  18476. }
  18477. ;
  18478. return self;
  18479. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  18480. },
  18481. args: [],
  18482. 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'>",
  18483. referencedClasses: [],
  18484. messageSends: []
  18485. }),
  18486. $globals.MethodContext);
  18487. $core.addMethod(
  18488. $core.method({
  18489. selector: "sendIndexAt:",
  18490. protocol: "accessing",
  18491. fn: function (aSelector){
  18492. var self=this;
  18493. return $core.withContext(function($ctx1) {
  18494. return self.sendIdx[aSelector] || 0;
  18495. return self;
  18496. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  18497. },
  18498. args: ["aSelector"],
  18499. source: "sendIndexAt: aSelector\x0a\x09<inlineJS: 'return self.sendIdx[aSelector] || 0'>",
  18500. referencedClasses: [],
  18501. messageSends: []
  18502. }),
  18503. $globals.MethodContext);
  18504. $core.addMethod(
  18505. $core.method({
  18506. selector: "sendIndexes",
  18507. protocol: "accessing",
  18508. fn: function (){
  18509. var self=this;
  18510. return $core.withContext(function($ctx1) {
  18511. return self.sendIdx;
  18512. return self;
  18513. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  18514. },
  18515. args: [],
  18516. source: "sendIndexes\x0a\x09<inlineJS: 'return self.sendIdx'>",
  18517. referencedClasses: [],
  18518. messageSends: []
  18519. }),
  18520. $globals.MethodContext);
  18521. $core.addMethod(
  18522. $core.method({
  18523. selector: "supercall",
  18524. protocol: "accessing",
  18525. fn: function (){
  18526. var self=this;
  18527. return $core.withContext(function($ctx1) {
  18528. return self.supercall == true;
  18529. return self;
  18530. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  18531. },
  18532. args: [],
  18533. source: "supercall\x0a\x09<inlineJS: 'return self.supercall == true'>",
  18534. referencedClasses: [],
  18535. messageSends: []
  18536. }),
  18537. $globals.MethodContext);
  18538. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  18539. $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' ]";
  18540. $core.addMethod(
  18541. $core.method({
  18542. selector: "constructorNamed:",
  18543. protocol: "instance creation",
  18544. fn: function (aString){
  18545. var self=this;
  18546. return $core.withContext(function($ctx1) {
  18547. var nativeFunc=(new Function('return this'))()[aString];
  18548. return new nativeFunc();
  18549. ;
  18550. return self;
  18551. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.klass)});
  18552. },
  18553. args: ["aString"],
  18554. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  18555. referencedClasses: [],
  18556. messageSends: []
  18557. }),
  18558. $globals.NativeFunction.klass);
  18559. $core.addMethod(
  18560. $core.method({
  18561. selector: "constructorNamed:value:",
  18562. protocol: "instance creation",
  18563. fn: function (aString,anObject){
  18564. var self=this;
  18565. return $core.withContext(function($ctx1) {
  18566. var nativeFunc=(new Function('return this'))()[aString];
  18567. return new nativeFunc(anObject);
  18568. ;
  18569. return self;
  18570. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  18571. },
  18572. args: ["aString", "anObject"],
  18573. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  18574. referencedClasses: [],
  18575. messageSends: []
  18576. }),
  18577. $globals.NativeFunction.klass);
  18578. $core.addMethod(
  18579. $core.method({
  18580. selector: "constructorNamed:value:value:",
  18581. protocol: "instance creation",
  18582. fn: function (aString,anObject,anObject2){
  18583. var self=this;
  18584. return $core.withContext(function($ctx1) {
  18585. var nativeFunc=(new Function('return this'))()[aString];
  18586. return new nativeFunc(anObject,anObject2);
  18587. ;
  18588. return self;
  18589. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  18590. },
  18591. args: ["aString", "anObject", "anObject2"],
  18592. source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  18593. referencedClasses: [],
  18594. messageSends: []
  18595. }),
  18596. $globals.NativeFunction.klass);
  18597. $core.addMethod(
  18598. $core.method({
  18599. selector: "constructorNamed:value:value:value:",
  18600. protocol: "instance creation",
  18601. fn: function (aString,anObject,anObject2,anObject3){
  18602. var self=this;
  18603. return $core.withContext(function($ctx1) {
  18604. var nativeFunc=(new Function('return this'))()[aString];
  18605. return new nativeFunc(anObject,anObject2, anObject3);
  18606. ;
  18607. return self;
  18608. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  18609. },
  18610. args: ["aString", "anObject", "anObject2", "anObject3"],
  18611. source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  18612. referencedClasses: [],
  18613. messageSends: []
  18614. }),
  18615. $globals.NativeFunction.klass);
  18616. $core.addMethod(
  18617. $core.method({
  18618. selector: "constructorOf:",
  18619. protocol: "instance creation",
  18620. fn: function (nativeFunc){
  18621. var self=this;
  18622. return $core.withContext(function($ctx1) {
  18623. return new nativeFunc();
  18624. ;
  18625. return self;
  18626. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  18627. },
  18628. args: ["nativeFunc"],
  18629. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  18630. referencedClasses: [],
  18631. messageSends: []
  18632. }),
  18633. $globals.NativeFunction.klass);
  18634. $core.addMethod(
  18635. $core.method({
  18636. selector: "constructorOf:value:",
  18637. protocol: "instance creation",
  18638. fn: function (nativeFunc,anObject){
  18639. var self=this;
  18640. return $core.withContext(function($ctx1) {
  18641. return new nativeFunc(anObject);
  18642. ;
  18643. return self;
  18644. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  18645. },
  18646. args: ["nativeFunc", "anObject"],
  18647. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  18648. referencedClasses: [],
  18649. messageSends: []
  18650. }),
  18651. $globals.NativeFunction.klass);
  18652. $core.addMethod(
  18653. $core.method({
  18654. selector: "constructorOf:value:value:",
  18655. protocol: "instance creation",
  18656. fn: function (nativeFunc,anObject,anObject2){
  18657. var self=this;
  18658. return $core.withContext(function($ctx1) {
  18659. return new nativeFunc(anObject,anObject2);
  18660. ;
  18661. return self;
  18662. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  18663. },
  18664. args: ["nativeFunc", "anObject", "anObject2"],
  18665. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  18666. referencedClasses: [],
  18667. messageSends: []
  18668. }),
  18669. $globals.NativeFunction.klass);
  18670. $core.addMethod(
  18671. $core.method({
  18672. selector: "constructorOf:value:value:value:",
  18673. protocol: "instance creation",
  18674. fn: function (nativeFunc,anObject,anObject2,anObject3){
  18675. var self=this;
  18676. return $core.withContext(function($ctx1) {
  18677. return new nativeFunc(anObject,anObject2, anObject3);
  18678. ;
  18679. return self;
  18680. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  18681. },
  18682. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  18683. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  18684. referencedClasses: [],
  18685. messageSends: []
  18686. }),
  18687. $globals.NativeFunction.klass);
  18688. $core.addMethod(
  18689. $core.method({
  18690. selector: "exists:",
  18691. protocol: "testing",
  18692. fn: function (aString){
  18693. var self=this;
  18694. return $core.withContext(function($ctx1) {
  18695. return $recv($globals.Smalltalk)._existsJsGlobal_(aString);
  18696. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.klass)});
  18697. },
  18698. args: ["aString"],
  18699. source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString",
  18700. referencedClasses: ["Smalltalk"],
  18701. messageSends: ["existsJsGlobal:"]
  18702. }),
  18703. $globals.NativeFunction.klass);
  18704. $core.addMethod(
  18705. $core.method({
  18706. selector: "functionNamed:",
  18707. protocol: "function calling",
  18708. fn: function (aString){
  18709. var self=this;
  18710. return $core.withContext(function($ctx1) {
  18711. var nativeFunc=(new Function('return this'))()[aString];
  18712. return nativeFunc();
  18713. ;
  18714. return self;
  18715. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.klass)});
  18716. },
  18717. args: ["aString"],
  18718. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  18719. referencedClasses: [],
  18720. messageSends: []
  18721. }),
  18722. $globals.NativeFunction.klass);
  18723. $core.addMethod(
  18724. $core.method({
  18725. selector: "functionNamed:value:",
  18726. protocol: "function calling",
  18727. fn: function (aString,anObject){
  18728. var self=this;
  18729. return $core.withContext(function($ctx1) {
  18730. var nativeFunc=(new Function('return this'))()[aString];
  18731. return nativeFunc(anObject);
  18732. ;
  18733. return self;
  18734. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  18735. },
  18736. args: ["aString", "anObject"],
  18737. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  18738. referencedClasses: [],
  18739. messageSends: []
  18740. }),
  18741. $globals.NativeFunction.klass);
  18742. $core.addMethod(
  18743. $core.method({
  18744. selector: "functionNamed:value:value:",
  18745. protocol: "function calling",
  18746. fn: function (aString,anObject,anObject2){
  18747. var self=this;
  18748. return $core.withContext(function($ctx1) {
  18749. var nativeFunc=(new Function('return this'))()[aString];
  18750. return nativeFunc(anObject,anObject2);
  18751. ;
  18752. return self;
  18753. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  18754. },
  18755. args: ["aString", "anObject", "anObject2"],
  18756. source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  18757. referencedClasses: [],
  18758. messageSends: []
  18759. }),
  18760. $globals.NativeFunction.klass);
  18761. $core.addMethod(
  18762. $core.method({
  18763. selector: "functionNamed:value:value:value:",
  18764. protocol: "function calling",
  18765. fn: function (aString,anObject,anObject2,anObject3){
  18766. var self=this;
  18767. return $core.withContext(function($ctx1) {
  18768. var nativeFunc=(new Function('return this'))()[aString];
  18769. return nativeFunc(anObject,anObject2, anObject3);
  18770. ;
  18771. return self;
  18772. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  18773. },
  18774. args: ["aString", "anObject", "anObject2", "anObject3"],
  18775. source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  18776. referencedClasses: [],
  18777. messageSends: []
  18778. }),
  18779. $globals.NativeFunction.klass);
  18780. $core.addMethod(
  18781. $core.method({
  18782. selector: "functionNamed:valueWithArgs:",
  18783. protocol: "function calling",
  18784. fn: function (aString,args){
  18785. var self=this;
  18786. return $core.withContext(function($ctx1) {
  18787. var nativeFunc=(new Function('return this'))()[aString];
  18788. return Function.prototype.apply.call(nativeFunc, null, args);
  18789. ;
  18790. return self;
  18791. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.klass)});
  18792. },
  18793. args: ["aString", "args"],
  18794. source: "functionNamed: aString valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  18795. referencedClasses: [],
  18796. messageSends: []
  18797. }),
  18798. $globals.NativeFunction.klass);
  18799. $core.addMethod(
  18800. $core.method({
  18801. selector: "functionOf:",
  18802. protocol: "function calling",
  18803. fn: function (nativeFunc){
  18804. var self=this;
  18805. return $core.withContext(function($ctx1) {
  18806. return nativeFunc();
  18807. ;
  18808. return self;
  18809. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  18810. },
  18811. args: ["nativeFunc"],
  18812. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  18813. referencedClasses: [],
  18814. messageSends: []
  18815. }),
  18816. $globals.NativeFunction.klass);
  18817. $core.addMethod(
  18818. $core.method({
  18819. selector: "functionOf:value:",
  18820. protocol: "function calling",
  18821. fn: function (nativeFunc,anObject){
  18822. var self=this;
  18823. return $core.withContext(function($ctx1) {
  18824. return nativeFunc(anObject);
  18825. ;
  18826. return self;
  18827. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  18828. },
  18829. args: ["nativeFunc", "anObject"],
  18830. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  18831. referencedClasses: [],
  18832. messageSends: []
  18833. }),
  18834. $globals.NativeFunction.klass);
  18835. $core.addMethod(
  18836. $core.method({
  18837. selector: "functionOf:value:value:",
  18838. protocol: "function calling",
  18839. fn: function (nativeFunc,anObject,anObject2){
  18840. var self=this;
  18841. return $core.withContext(function($ctx1) {
  18842. return nativeFunc(anObject,anObject2);
  18843. ;
  18844. return self;
  18845. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  18846. },
  18847. args: ["nativeFunc", "anObject", "anObject2"],
  18848. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  18849. referencedClasses: [],
  18850. messageSends: []
  18851. }),
  18852. $globals.NativeFunction.klass);
  18853. $core.addMethod(
  18854. $core.method({
  18855. selector: "functionOf:value:value:value:",
  18856. protocol: "function calling",
  18857. fn: function (nativeFunc,anObject,anObject2,anObject3){
  18858. var self=this;
  18859. return $core.withContext(function($ctx1) {
  18860. return nativeFunc(anObject,anObject2, anObject3);
  18861. ;
  18862. return self;
  18863. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  18864. },
  18865. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  18866. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  18867. referencedClasses: [],
  18868. messageSends: []
  18869. }),
  18870. $globals.NativeFunction.klass);
  18871. $core.addMethod(
  18872. $core.method({
  18873. selector: "functionOf:valueWithArgs:",
  18874. protocol: "function calling",
  18875. fn: function (nativeFunc,args){
  18876. var self=this;
  18877. return $core.withContext(function($ctx1) {
  18878. return Function.prototype.apply.call(nativeFunc, null, args);
  18879. ;
  18880. return self;
  18881. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.klass)});
  18882. },
  18883. args: ["nativeFunc", "args"],
  18884. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  18885. referencedClasses: [],
  18886. messageSends: []
  18887. }),
  18888. $globals.NativeFunction.klass);
  18889. $core.addMethod(
  18890. $core.method({
  18891. selector: "methodOf:this:",
  18892. protocol: "method calling",
  18893. fn: function (nativeFunc,thisObject){
  18894. var self=this;
  18895. return $core.withContext(function($ctx1) {
  18896. return Function.prototype.call.call(nativeFunc, thisObject);
  18897. ;
  18898. return self;
  18899. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.klass)});
  18900. },
  18901. args: ["nativeFunc", "thisObject"],
  18902. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  18903. referencedClasses: [],
  18904. messageSends: []
  18905. }),
  18906. $globals.NativeFunction.klass);
  18907. $core.addMethod(
  18908. $core.method({
  18909. selector: "methodOf:this:value:",
  18910. protocol: "method calling",
  18911. fn: function (nativeFunc,thisObject,anObject){
  18912. var self=this;
  18913. return $core.withContext(function($ctx1) {
  18914. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  18915. ;
  18916. return self;
  18917. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.klass)});
  18918. },
  18919. args: ["nativeFunc", "thisObject", "anObject"],
  18920. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  18921. referencedClasses: [],
  18922. messageSends: []
  18923. }),
  18924. $globals.NativeFunction.klass);
  18925. $core.addMethod(
  18926. $core.method({
  18927. selector: "methodOf:this:value:value:",
  18928. protocol: "method calling",
  18929. fn: function (nativeFunc,thisObject,anObject,anObject2){
  18930. var self=this;
  18931. return $core.withContext(function($ctx1) {
  18932. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  18933. ;
  18934. return self;
  18935. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  18936. },
  18937. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  18938. 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'>",
  18939. referencedClasses: [],
  18940. messageSends: []
  18941. }),
  18942. $globals.NativeFunction.klass);
  18943. $core.addMethod(
  18944. $core.method({
  18945. selector: "methodOf:this:value:value:value:",
  18946. protocol: "method calling",
  18947. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  18948. var self=this;
  18949. return $core.withContext(function($ctx1) {
  18950. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  18951. ;
  18952. return self;
  18953. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  18954. },
  18955. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  18956. 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'>",
  18957. referencedClasses: [],
  18958. messageSends: []
  18959. }),
  18960. $globals.NativeFunction.klass);
  18961. $core.addMethod(
  18962. $core.method({
  18963. selector: "methodOf:this:valueWithArgs:",
  18964. protocol: "method calling",
  18965. fn: function (nativeFunc,thisObject,args){
  18966. var self=this;
  18967. return $core.withContext(function($ctx1) {
  18968. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  18969. ;
  18970. return self;
  18971. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.klass)});
  18972. },
  18973. args: ["nativeFunc", "thisObject", "args"],
  18974. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  18975. referencedClasses: [],
  18976. messageSends: []
  18977. }),
  18978. $globals.NativeFunction.klass);
  18979. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  18980. $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.";
  18981. $core.addMethod(
  18982. $core.method({
  18983. selector: "clearInterval",
  18984. protocol: "timeout/interval",
  18985. fn: function (){
  18986. var self=this;
  18987. return $core.withContext(function($ctx1) {
  18988. var interval = self["@rawTimeout"];
  18989. clearInterval(interval);
  18990. ;
  18991. return self;
  18992. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  18993. },
  18994. args: [],
  18995. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  18996. referencedClasses: [],
  18997. messageSends: []
  18998. }),
  18999. $globals.Timeout);
  19000. $core.addMethod(
  19001. $core.method({
  19002. selector: "clearTimeout",
  19003. protocol: "timeout/interval",
  19004. fn: function (){
  19005. var self=this;
  19006. return $core.withContext(function($ctx1) {
  19007. var timeout = self["@rawTimeout"];
  19008. clearTimeout(timeout);
  19009. ;
  19010. return self;
  19011. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  19012. },
  19013. args: [],
  19014. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  19015. referencedClasses: [],
  19016. messageSends: []
  19017. }),
  19018. $globals.Timeout);
  19019. $core.addMethod(
  19020. $core.method({
  19021. selector: "rawTimeout:",
  19022. protocol: "accessing",
  19023. fn: function (anObject){
  19024. var self=this;
  19025. self["@rawTimeout"]=anObject;
  19026. return self;
  19027. },
  19028. args: ["anObject"],
  19029. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  19030. referencedClasses: [],
  19031. messageSends: []
  19032. }),
  19033. $globals.Timeout);
  19034. $core.addMethod(
  19035. $core.method({
  19036. selector: "on:",
  19037. protocol: "instance creation",
  19038. fn: function (anObject){
  19039. var self=this;
  19040. return $core.withContext(function($ctx1) {
  19041. var $1;
  19042. $1=self._new();
  19043. $recv($1)._rawTimeout_(anObject);
  19044. return $recv($1)._yourself();
  19045. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.klass)});
  19046. },
  19047. args: ["anObject"],
  19048. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  19049. referencedClasses: [],
  19050. messageSends: ["rawTimeout:", "new", "yourself"]
  19051. }),
  19052. $globals.Timeout.klass);
  19053. });
  19054. define('amber_core/Kernel-Dag',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  19055. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  19056. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  19057. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  19058. $core.addPackage("Kernel-Dag");
  19059. $core.packages["Kernel-Dag"].innerEval = function (expr) { return eval(expr); };
  19060. $core.packages["Kernel-Dag"].transport = {"type":"amd","amdNamespace":"amber_core"};
  19061. $core.addClass("AbstractDagVisitor", $globals.Object, [], "Kernel-Dag");
  19062. $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:`.";
  19063. $core.addMethod(
  19064. $core.method({
  19065. selector: "value:",
  19066. protocol: "evaluating",
  19067. fn: function (anObject){
  19068. var self=this;
  19069. return $core.withContext(function($ctx1) {
  19070. return self._visit_(anObject);
  19071. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AbstractDagVisitor)});
  19072. },
  19073. args: ["anObject"],
  19074. source: "value: anObject\x0a\x09^ self visit: anObject",
  19075. referencedClasses: [],
  19076. messageSends: ["visit:"]
  19077. }),
  19078. $globals.AbstractDagVisitor);
  19079. $core.addMethod(
  19080. $core.method({
  19081. selector: "visit:",
  19082. protocol: "visiting",
  19083. fn: function (aNode){
  19084. var self=this;
  19085. return $core.withContext(function($ctx1) {
  19086. return $recv(aNode)._acceptDagVisitor_(self);
  19087. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.AbstractDagVisitor)});
  19088. },
  19089. args: ["aNode"],
  19090. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  19091. referencedClasses: [],
  19092. messageSends: ["acceptDagVisitor:"]
  19093. }),
  19094. $globals.AbstractDagVisitor);
  19095. $core.addMethod(
  19096. $core.method({
  19097. selector: "visitAll:",
  19098. protocol: "visiting",
  19099. fn: function (aCollection){
  19100. var self=this;
  19101. return $core.withContext(function($ctx1) {
  19102. return $recv(aCollection)._collect_((function(each){
  19103. return $core.withContext(function($ctx2) {
  19104. return self._visit_(each);
  19105. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19106. }));
  19107. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.AbstractDagVisitor)});
  19108. },
  19109. args: ["aCollection"],
  19110. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  19111. referencedClasses: [],
  19112. messageSends: ["collect:", "visit:"]
  19113. }),
  19114. $globals.AbstractDagVisitor);
  19115. $core.addMethod(
  19116. $core.method({
  19117. selector: "visitAllChildren:",
  19118. protocol: "visiting",
  19119. fn: function (aDagNode){
  19120. var self=this;
  19121. return $core.withContext(function($ctx1) {
  19122. return self._visitAll_($recv(aDagNode)._dagChildren());
  19123. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode},$globals.AbstractDagVisitor)});
  19124. },
  19125. args: ["aDagNode"],
  19126. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  19127. referencedClasses: [],
  19128. messageSends: ["visitAll:", "dagChildren"]
  19129. }),
  19130. $globals.AbstractDagVisitor);
  19131. $core.addMethod(
  19132. $core.method({
  19133. selector: "visitDagNode:",
  19134. protocol: "visiting",
  19135. fn: function (aNode){
  19136. var self=this;
  19137. return $core.withContext(function($ctx1) {
  19138. self._subclassResponsibility();
  19139. return self;
  19140. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.AbstractDagVisitor)});
  19141. },
  19142. args: ["aNode"],
  19143. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  19144. referencedClasses: [],
  19145. messageSends: ["subclassResponsibility"]
  19146. }),
  19147. $globals.AbstractDagVisitor);
  19148. $core.addMethod(
  19149. $core.method({
  19150. selector: "visitDagNodeVariantRedux:",
  19151. protocol: "visiting",
  19152. fn: function (aNode){
  19153. var self=this;
  19154. var newChildren,oldChildren;
  19155. return $core.withContext(function($ctx1) {
  19156. var $2,$3,$1,$4,$5;
  19157. var $early={};
  19158. try {
  19159. oldChildren=$recv(aNode)._dagChildren();
  19160. newChildren=self._visitAllChildren_(aNode);
  19161. $2=$recv(oldChildren)._size();
  19162. $ctx1.sendIdx["size"]=1;
  19163. $3=$recv(newChildren)._size();
  19164. $ctx1.sendIdx["size"]=2;
  19165. $1=$recv($2).__eq($3);
  19166. if($core.assert($1)){
  19167. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  19168. return $core.withContext(function($ctx2) {
  19169. $4=$recv(oldChildren)._at_(i);
  19170. $ctx2.sendIdx["at:"]=1;
  19171. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  19172. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  19173. }),(function(){
  19174. throw $early=[aNode];
  19175. }));
  19176. }
  19177. $5=$recv(aNode)._copy();
  19178. $recv($5)._dagChildren_(newChildren);
  19179. return $recv($5)._yourself();
  19180. }
  19181. catch(e) {if(e===$early)return e[0]; throw e}
  19182. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren},$globals.AbstractDagVisitor)});
  19183. },
  19184. args: ["aNode"],
  19185. 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",
  19186. referencedClasses: [],
  19187. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  19188. }),
  19189. $globals.AbstractDagVisitor);
  19190. $core.addMethod(
  19191. $core.method({
  19192. selector: "visitDagNodeVariantSimple:",
  19193. protocol: "visiting",
  19194. fn: function (aNode){
  19195. var self=this;
  19196. return $core.withContext(function($ctx1) {
  19197. self._visitAllChildren_(aNode);
  19198. return aNode;
  19199. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode},$globals.AbstractDagVisitor)});
  19200. },
  19201. args: ["aNode"],
  19202. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  19203. referencedClasses: [],
  19204. messageSends: ["visitAllChildren:"]
  19205. }),
  19206. $globals.AbstractDagVisitor);
  19207. $core.addClass("PathDagVisitor", $globals.AbstractDagVisitor, ["path"], "Kernel-Dag");
  19208. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  19209. $core.addMethod(
  19210. $core.method({
  19211. selector: "initialize",
  19212. protocol: "initialization",
  19213. fn: function (){
  19214. var self=this;
  19215. return $core.withContext(function($ctx1) {
  19216. (
  19217. $ctx1.supercall = true,
  19218. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  19219. $ctx1.supercall = false;
  19220. self["@path"]=[];
  19221. return self;
  19222. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PathDagVisitor)});
  19223. },
  19224. args: [],
  19225. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  19226. referencedClasses: [],
  19227. messageSends: ["initialize"]
  19228. }),
  19229. $globals.PathDagVisitor);
  19230. $core.addMethod(
  19231. $core.method({
  19232. selector: "path",
  19233. protocol: "accessing",
  19234. fn: function (){
  19235. var self=this;
  19236. return self["@path"];
  19237. },
  19238. args: [],
  19239. source: "path\x0a\x09^ path",
  19240. referencedClasses: [],
  19241. messageSends: []
  19242. }),
  19243. $globals.PathDagVisitor);
  19244. $core.addMethod(
  19245. $core.method({
  19246. selector: "visit:",
  19247. protocol: "visiting",
  19248. fn: function (aNode){
  19249. var self=this;
  19250. var oldPath,result;
  19251. return $core.withContext(function($ctx1) {
  19252. result=aNode;
  19253. oldPath=self["@path"];
  19254. $recv((function(){
  19255. return $core.withContext(function($ctx2) {
  19256. self["@path"]=$recv(self["@path"]).__comma([aNode]);
  19257. self["@path"];
  19258. result=(
  19259. $ctx2.supercall = true,
  19260. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($recv(self), [aNode]));
  19261. $ctx2.supercall = false;
  19262. return result;
  19263. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19264. }))._ensure_((function(){
  19265. self["@path"]=oldPath;
  19266. return self["@path"];
  19267. }));
  19268. return result;
  19269. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result},$globals.PathDagVisitor)});
  19270. },
  19271. args: ["aNode"],
  19272. 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",
  19273. referencedClasses: [],
  19274. messageSends: ["ensure:", ",", "visit:"]
  19275. }),
  19276. $globals.PathDagVisitor);
  19277. $core.addMethod(
  19278. $core.method({
  19279. selector: "visitDagNodeVariantRedux:",
  19280. protocol: "visiting",
  19281. fn: function (aNode){
  19282. var self=this;
  19283. var newNode;
  19284. return $core.withContext(function($ctx1) {
  19285. var $1;
  19286. newNode=(
  19287. $ctx1.supercall = true,
  19288. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($recv(self), [aNode]));
  19289. $ctx1.supercall = false;
  19290. $1=$recv(aNode).__eq_eq(newNode);
  19291. if(!$core.assert($1)){
  19292. $recv(self["@path"])._at_put_($recv(self["@path"])._size(),newNode);
  19293. }
  19294. return newNode;
  19295. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode},$globals.PathDagVisitor)});
  19296. },
  19297. args: ["aNode"],
  19298. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  19299. referencedClasses: [],
  19300. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  19301. }),
  19302. $globals.PathDagVisitor);
  19303. $core.addClass("DagNode", $globals.Object, [], "Kernel-Dag");
  19304. $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).";
  19305. $core.addMethod(
  19306. $core.method({
  19307. selector: "acceptDagVisitor:",
  19308. protocol: "visiting",
  19309. fn: function (aVisitor){
  19310. var self=this;
  19311. return $core.withContext(function($ctx1) {
  19312. return $recv(aVisitor)._visitDagNode_(self);
  19313. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DagNode)});
  19314. },
  19315. args: ["aVisitor"],
  19316. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  19317. referencedClasses: [],
  19318. messageSends: ["visitDagNode:"]
  19319. }),
  19320. $globals.DagNode);
  19321. $core.addMethod(
  19322. $core.method({
  19323. selector: "allDagChildren",
  19324. protocol: "accessing",
  19325. fn: function (){
  19326. var self=this;
  19327. var allNodes;
  19328. return $core.withContext(function($ctx1) {
  19329. var $1;
  19330. $1=self._dagChildren();
  19331. $ctx1.sendIdx["dagChildren"]=1;
  19332. allNodes=$recv($1)._asSet();
  19333. $recv(self._dagChildren())._do_((function(each){
  19334. return $core.withContext(function($ctx2) {
  19335. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  19336. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19337. }));
  19338. return allNodes;
  19339. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes},$globals.DagNode)});
  19340. },
  19341. args: [],
  19342. 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",
  19343. referencedClasses: [],
  19344. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  19345. }),
  19346. $globals.DagNode);
  19347. $core.addMethod(
  19348. $core.method({
  19349. selector: "dagChildren",
  19350. protocol: "accessing",
  19351. fn: function (){
  19352. var self=this;
  19353. return $core.withContext(function($ctx1) {
  19354. self._subclassResponsibility();
  19355. return self;
  19356. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagNode)});
  19357. },
  19358. args: [],
  19359. source: "dagChildren\x0a\x09self subclassResponsibility",
  19360. referencedClasses: [],
  19361. messageSends: ["subclassResponsibility"]
  19362. }),
  19363. $globals.DagNode);
  19364. $core.addMethod(
  19365. $core.method({
  19366. selector: "dagChildren:",
  19367. protocol: "accessing",
  19368. fn: function (aCollection){
  19369. var self=this;
  19370. return $core.withContext(function($ctx1) {
  19371. self._subclassResponsibility();
  19372. return self;
  19373. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagNode)});
  19374. },
  19375. args: ["aCollection"],
  19376. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  19377. referencedClasses: [],
  19378. messageSends: ["subclassResponsibility"]
  19379. }),
  19380. $globals.DagNode);
  19381. $core.addMethod(
  19382. $core.method({
  19383. selector: "isDagNode",
  19384. protocol: "testing",
  19385. fn: function (){
  19386. var self=this;
  19387. return true;
  19388. },
  19389. args: [],
  19390. source: "isDagNode\x0a\x09^ true",
  19391. referencedClasses: [],
  19392. messageSends: []
  19393. }),
  19394. $globals.DagNode);
  19395. $core.addClass("DagParentNode", $globals.DagNode, ["nodes"], "Kernel-Dag");
  19396. $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.";
  19397. $core.addMethod(
  19398. $core.method({
  19399. selector: "addDagChild:",
  19400. protocol: "accessing",
  19401. fn: function (aDagNode){
  19402. var self=this;
  19403. return $core.withContext(function($ctx1) {
  19404. $recv(self._dagChildren())._add_(aDagNode);
  19405. return self;
  19406. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode},$globals.DagParentNode)});
  19407. },
  19408. args: ["aDagNode"],
  19409. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  19410. referencedClasses: [],
  19411. messageSends: ["add:", "dagChildren"]
  19412. }),
  19413. $globals.DagParentNode);
  19414. $core.addMethod(
  19415. $core.method({
  19416. selector: "dagChildren",
  19417. protocol: "accessing",
  19418. fn: function (){
  19419. var self=this;
  19420. return $core.withContext(function($ctx1) {
  19421. var $1,$receiver;
  19422. $1=self["@nodes"];
  19423. if(($receiver = $1) == null || $receiver.isNil){
  19424. self["@nodes"]=$recv($globals.Array)._new();
  19425. return self["@nodes"];
  19426. } else {
  19427. return $1;
  19428. }
  19429. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagParentNode)});
  19430. },
  19431. args: [],
  19432. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  19433. referencedClasses: ["Array"],
  19434. messageSends: ["ifNil:", "new"]
  19435. }),
  19436. $globals.DagParentNode);
  19437. $core.addMethod(
  19438. $core.method({
  19439. selector: "dagChildren:",
  19440. protocol: "accessing",
  19441. fn: function (aCollection){
  19442. var self=this;
  19443. self["@nodes"]=aCollection;
  19444. return self;
  19445. },
  19446. args: ["aCollection"],
  19447. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  19448. referencedClasses: [],
  19449. messageSends: []
  19450. }),
  19451. $globals.DagParentNode);
  19452. $core.addClass("DagSink", $globals.DagNode, ["nodes"], "Kernel-Dag");
  19453. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  19454. $core.addMethod(
  19455. $core.method({
  19456. selector: "dagChildren",
  19457. protocol: "accessing",
  19458. fn: function (){
  19459. var self=this;
  19460. return [];
  19461. },
  19462. args: [],
  19463. source: "dagChildren\x0a\x09^ #()",
  19464. referencedClasses: [],
  19465. messageSends: []
  19466. }),
  19467. $globals.DagSink);
  19468. $core.addMethod(
  19469. $core.method({
  19470. selector: "dagChildren:",
  19471. protocol: "accessing",
  19472. fn: function (aCollection){
  19473. var self=this;
  19474. return $core.withContext(function($ctx1) {
  19475. $recv(aCollection)._ifNotEmpty_((function(){
  19476. return $core.withContext(function($ctx2) {
  19477. return self._error_("A DagSink cannot have children.");
  19478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19479. }));
  19480. return self;
  19481. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagSink)});
  19482. },
  19483. args: ["aCollection"],
  19484. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  19485. referencedClasses: [],
  19486. messageSends: ["ifNotEmpty:", "error:"]
  19487. }),
  19488. $globals.DagSink);
  19489. $core.addMethod(
  19490. $core.method({
  19491. selector: "isDagNode",
  19492. protocol: "*Kernel-Dag",
  19493. fn: function (){
  19494. var self=this;
  19495. return false;
  19496. },
  19497. args: [],
  19498. source: "isDagNode\x0a\x09^ false",
  19499. referencedClasses: [],
  19500. messageSends: []
  19501. }),
  19502. $globals.Object);
  19503. });
  19504. define('amber_core/Kernel-Exceptions',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  19505. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  19506. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  19507. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  19508. $core.addPackage("Kernel-Exceptions");
  19509. $core.packages["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  19510. $core.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  19511. $core.addClass("Error", $globals.Object, ["messageText"], "Kernel-Exceptions");
  19512. $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.";
  19513. $core.addMethod(
  19514. $core.method({
  19515. selector: "beHandled",
  19516. protocol: "accessing",
  19517. fn: function (){
  19518. var self=this;
  19519. return $core.withContext(function($ctx1) {
  19520. self.amberHandled = true;
  19521. return self;
  19522. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  19523. },
  19524. args: [],
  19525. source: "beHandled\x0a\x09<inlineJS: 'self.amberHandled = true'>",
  19526. referencedClasses: [],
  19527. messageSends: []
  19528. }),
  19529. $globals.Error);
  19530. $core.addMethod(
  19531. $core.method({
  19532. selector: "beUnhandled",
  19533. protocol: "accessing",
  19534. fn: function (){
  19535. var self=this;
  19536. return $core.withContext(function($ctx1) {
  19537. self.amberHandled = false;
  19538. return self;
  19539. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  19540. },
  19541. args: [],
  19542. source: "beUnhandled\x0a\x09<inlineJS: 'self.amberHandled = false'>",
  19543. referencedClasses: [],
  19544. messageSends: []
  19545. }),
  19546. $globals.Error);
  19547. $core.addMethod(
  19548. $core.method({
  19549. selector: "context",
  19550. protocol: "accessing",
  19551. fn: function (){
  19552. var self=this;
  19553. return $core.withContext(function($ctx1) {
  19554. return self.context;
  19555. return self;
  19556. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  19557. },
  19558. args: [],
  19559. source: "context\x0a\x09<inlineJS: 'return self.context'>",
  19560. referencedClasses: [],
  19561. messageSends: []
  19562. }),
  19563. $globals.Error);
  19564. $core.addMethod(
  19565. $core.method({
  19566. selector: "initialize",
  19567. protocol: "initialization",
  19568. fn: function (){
  19569. var self=this;
  19570. return $core.withContext(function($ctx1) {
  19571. self._messageText_("Errorclass: ".__comma($recv(self._class())._name()));
  19572. return self;
  19573. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  19574. },
  19575. args: [],
  19576. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  19577. referencedClasses: [],
  19578. messageSends: ["messageText:", ",", "name", "class"]
  19579. }),
  19580. $globals.Error);
  19581. $core.addMethod(
  19582. $core.method({
  19583. selector: "isSmalltalkError",
  19584. protocol: "testing",
  19585. fn: function (){
  19586. var self=this;
  19587. return $core.withContext(function($ctx1) {
  19588. return self.smalltalkError === true;
  19589. return self;
  19590. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  19591. },
  19592. args: [],
  19593. source: "isSmalltalkError\x0a\x09<inlineJS: 'return self.smalltalkError === true'>",
  19594. referencedClasses: [],
  19595. messageSends: []
  19596. }),
  19597. $globals.Error);
  19598. $core.addMethod(
  19599. $core.method({
  19600. selector: "jsStack",
  19601. protocol: "accessing",
  19602. fn: function (){
  19603. var self=this;
  19604. return $core.withContext(function($ctx1) {
  19605. return self.stack;
  19606. return self;
  19607. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  19608. },
  19609. args: [],
  19610. source: "jsStack\x0a\x09<inlineJS: 'return self.stack'>",
  19611. referencedClasses: [],
  19612. messageSends: []
  19613. }),
  19614. $globals.Error);
  19615. $core.addMethod(
  19616. $core.method({
  19617. selector: "messageText",
  19618. protocol: "accessing",
  19619. fn: function (){
  19620. var self=this;
  19621. return self["@messageText"];
  19622. },
  19623. args: [],
  19624. source: "messageText\x0a\x09^ messageText",
  19625. referencedClasses: [],
  19626. messageSends: []
  19627. }),
  19628. $globals.Error);
  19629. $core.addMethod(
  19630. $core.method({
  19631. selector: "messageText:",
  19632. protocol: "accessing",
  19633. fn: function (aString){
  19634. var self=this;
  19635. self["@messageText"]=aString;
  19636. return self;
  19637. },
  19638. args: ["aString"],
  19639. source: "messageText: aString\x0a\x09messageText := aString",
  19640. referencedClasses: [],
  19641. messageSends: []
  19642. }),
  19643. $globals.Error);
  19644. $core.addMethod(
  19645. $core.method({
  19646. selector: "resignal",
  19647. protocol: "signaling",
  19648. fn: function (){
  19649. var self=this;
  19650. return $core.withContext(function($ctx1) {
  19651. self.amberHandled = false;
  19652. throw(self);
  19653. ;
  19654. return self;
  19655. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  19656. },
  19657. args: [],
  19658. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw(self);\x0a\x09'>",
  19659. referencedClasses: [],
  19660. messageSends: []
  19661. }),
  19662. $globals.Error);
  19663. $core.addMethod(
  19664. $core.method({
  19665. selector: "signal",
  19666. protocol: "signaling",
  19667. fn: function (){
  19668. var self=this;
  19669. return $core.withContext(function($ctx1) {
  19670. self.amberHandled = false;
  19671. self.context = $core.getThisContext();
  19672. self.smalltalkError = true;
  19673. throw self;
  19674. ;
  19675. return self;
  19676. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  19677. },
  19678. args: [],
  19679. 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'>",
  19680. referencedClasses: [],
  19681. messageSends: []
  19682. }),
  19683. $globals.Error);
  19684. $core.addMethod(
  19685. $core.method({
  19686. selector: "signal:",
  19687. protocol: "signaling",
  19688. fn: function (aString){
  19689. var self=this;
  19690. return $core.withContext(function($ctx1) {
  19691. self._messageText_(aString);
  19692. self._signal();
  19693. return self;
  19694. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  19695. },
  19696. args: ["aString"],
  19697. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  19698. referencedClasses: [],
  19699. messageSends: ["messageText:", "signal"]
  19700. }),
  19701. $globals.Error);
  19702. $core.addMethod(
  19703. $core.method({
  19704. selector: "signalerContext",
  19705. protocol: "accessing",
  19706. fn: function (){
  19707. var self=this;
  19708. return $core.withContext(function($ctx1) {
  19709. return self._signalerContextFrom_(self._context());
  19710. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  19711. },
  19712. args: [],
  19713. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  19714. referencedClasses: [],
  19715. messageSends: ["signalerContextFrom:", "context"]
  19716. }),
  19717. $globals.Error);
  19718. $core.addMethod(
  19719. $core.method({
  19720. selector: "signalerContextFrom:",
  19721. protocol: "accessing",
  19722. fn: function (aContext){
  19723. var self=this;
  19724. return $core.withContext(function($ctx1) {
  19725. var $3,$2,$1;
  19726. return $recv(aContext)._findContextSuchThat_((function(context){
  19727. return $core.withContext(function($ctx2) {
  19728. $3=$recv(context)._receiver();
  19729. $ctx2.sendIdx["receiver"]=1;
  19730. $2=$recv($3).__eq_eq(self);
  19731. $ctx2.sendIdx["=="]=1;
  19732. $1=$recv($2)._or_((function(){
  19733. return $core.withContext(function($ctx3) {
  19734. return $recv($recv(context)._receiver()).__eq_eq(self._class());
  19735. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  19736. }));
  19737. return $recv($1)._not();
  19738. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  19739. }));
  19740. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  19741. },
  19742. args: ["aContext"],
  19743. 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 ]",
  19744. referencedClasses: [],
  19745. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  19746. }),
  19747. $globals.Error);
  19748. $core.addMethod(
  19749. $core.method({
  19750. selector: "wasHandled",
  19751. protocol: "testing",
  19752. fn: function (){
  19753. var self=this;
  19754. return $core.withContext(function($ctx1) {
  19755. return self.amberHandled || false;
  19756. return self;
  19757. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  19758. },
  19759. args: [],
  19760. source: "wasHandled\x0a\x09<inlineJS: 'return self.amberHandled || false'>",
  19761. referencedClasses: [],
  19762. messageSends: []
  19763. }),
  19764. $globals.Error);
  19765. $core.addMethod(
  19766. $core.method({
  19767. selector: "classTag",
  19768. protocol: "accessing",
  19769. fn: function (){
  19770. var self=this;
  19771. return "exception";
  19772. },
  19773. args: [],
  19774. 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'",
  19775. referencedClasses: [],
  19776. messageSends: []
  19777. }),
  19778. $globals.Error.klass);
  19779. $core.addMethod(
  19780. $core.method({
  19781. selector: "signal",
  19782. protocol: "instance creation",
  19783. fn: function (){
  19784. var self=this;
  19785. return $core.withContext(function($ctx1) {
  19786. return $recv(self._new())._signal();
  19787. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.klass)});
  19788. },
  19789. args: [],
  19790. source: "signal\x0a\x09^ self new signal",
  19791. referencedClasses: [],
  19792. messageSends: ["signal", "new"]
  19793. }),
  19794. $globals.Error.klass);
  19795. $core.addMethod(
  19796. $core.method({
  19797. selector: "signal:",
  19798. protocol: "instance creation",
  19799. fn: function (aString){
  19800. var self=this;
  19801. return $core.withContext(function($ctx1) {
  19802. return $recv(self._new())._signal_(aString);
  19803. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.klass)});
  19804. },
  19805. args: ["aString"],
  19806. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  19807. referencedClasses: [],
  19808. messageSends: ["signal:", "new"]
  19809. }),
  19810. $globals.Error.klass);
  19811. $core.addClass("Halt", $globals.Error, [], "Kernel-Exceptions");
  19812. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  19813. $core.addMethod(
  19814. $core.method({
  19815. selector: "messageText",
  19816. protocol: "accessing",
  19817. fn: function (){
  19818. var self=this;
  19819. return "Halt encountered";
  19820. },
  19821. args: [],
  19822. source: "messageText\x0a\x09^ 'Halt encountered'",
  19823. referencedClasses: [],
  19824. messageSends: []
  19825. }),
  19826. $globals.Halt);
  19827. $core.addMethod(
  19828. $core.method({
  19829. selector: "signalerContextFrom:",
  19830. protocol: "accessing",
  19831. fn: function (aContext){
  19832. var self=this;
  19833. return $core.withContext(function($ctx1) {
  19834. var $3,$2,$1;
  19835. return $recv(aContext)._findContextSuchThat_((function(context){
  19836. return $core.withContext(function($ctx2) {
  19837. $3=$recv(context)._receiver();
  19838. $ctx2.sendIdx["receiver"]=1;
  19839. $2=$recv($3).__eq_eq(self);
  19840. $ctx2.sendIdx["=="]=1;
  19841. $1=$recv($2)._or_((function(){
  19842. return $core.withContext(function($ctx3) {
  19843. return $recv($recv($recv(context)._receiver()).__eq_eq(self._class()))._or_((function(){
  19844. return $core.withContext(function($ctx4) {
  19845. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  19846. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  19847. }));
  19848. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  19849. }));
  19850. $ctx2.sendIdx["or:"]=1;
  19851. return $recv($1)._not();
  19852. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  19853. }));
  19854. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  19855. },
  19856. args: ["aContext"],
  19857. 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 ]",
  19858. referencedClasses: [],
  19859. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  19860. }),
  19861. $globals.Halt);
  19862. $core.addClass("JavaScriptException", $globals.Error, ["exception"], "Kernel-Exceptions");
  19863. $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:`";
  19864. $core.addMethod(
  19865. $core.method({
  19866. selector: "context:",
  19867. protocol: "accessing",
  19868. fn: function (aMethodContext){
  19869. var self=this;
  19870. return $core.withContext(function($ctx1) {
  19871. self.context = aMethodContext;
  19872. return self;
  19873. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  19874. },
  19875. args: ["aMethodContext"],
  19876. 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'>",
  19877. referencedClasses: [],
  19878. messageSends: []
  19879. }),
  19880. $globals.JavaScriptException);
  19881. $core.addMethod(
  19882. $core.method({
  19883. selector: "exception",
  19884. protocol: "accessing",
  19885. fn: function (){
  19886. var self=this;
  19887. return self["@exception"];
  19888. },
  19889. args: [],
  19890. source: "exception\x0a\x09^ exception",
  19891. referencedClasses: [],
  19892. messageSends: []
  19893. }),
  19894. $globals.JavaScriptException);
  19895. $core.addMethod(
  19896. $core.method({
  19897. selector: "exception:",
  19898. protocol: "accessing",
  19899. fn: function (anException){
  19900. var self=this;
  19901. self["@exception"]=anException;
  19902. return self;
  19903. },
  19904. args: ["anException"],
  19905. source: "exception: anException\x0a\x09exception := anException",
  19906. referencedClasses: [],
  19907. messageSends: []
  19908. }),
  19909. $globals.JavaScriptException);
  19910. $core.addMethod(
  19911. $core.method({
  19912. selector: "messageText",
  19913. protocol: "accessing",
  19914. fn: function (){
  19915. var self=this;
  19916. return $core.withContext(function($ctx1) {
  19917. return "JavaScript exception: " + self["@exception"].toString();
  19918. return self;
  19919. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  19920. },
  19921. args: [],
  19922. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + self[\x22@exception\x22].toString()'>",
  19923. referencedClasses: [],
  19924. messageSends: []
  19925. }),
  19926. $globals.JavaScriptException);
  19927. $core.addMethod(
  19928. $core.method({
  19929. selector: "on:",
  19930. protocol: "instance creation",
  19931. fn: function (anException){
  19932. var self=this;
  19933. return $core.withContext(function($ctx1) {
  19934. var $1;
  19935. $1=self._new();
  19936. $recv($1)._exception_(anException);
  19937. return $recv($1)._yourself();
  19938. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.klass)});
  19939. },
  19940. args: ["anException"],
  19941. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  19942. referencedClasses: [],
  19943. messageSends: ["exception:", "new", "yourself"]
  19944. }),
  19945. $globals.JavaScriptException.klass);
  19946. $core.addMethod(
  19947. $core.method({
  19948. selector: "on:context:",
  19949. protocol: "instance creation",
  19950. fn: function (anException,aMethodContext){
  19951. var self=this;
  19952. return $core.withContext(function($ctx1) {
  19953. var $1;
  19954. $1=self._new();
  19955. $recv($1)._exception_(anException);
  19956. $recv($1)._context_(aMethodContext);
  19957. return $recv($1)._yourself();
  19958. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.klass)});
  19959. },
  19960. args: ["anException", "aMethodContext"],
  19961. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  19962. referencedClasses: [],
  19963. messageSends: ["exception:", "new", "context:", "yourself"]
  19964. }),
  19965. $globals.JavaScriptException.klass);
  19966. $core.addClass("MessageNotUnderstood", $globals.Error, ["message", "receiver"], "Kernel-Exceptions");
  19967. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  19968. $core.addMethod(
  19969. $core.method({
  19970. selector: "message",
  19971. protocol: "accessing",
  19972. fn: function (){
  19973. var self=this;
  19974. return self["@message"];
  19975. },
  19976. args: [],
  19977. source: "message\x0a\x09^ message",
  19978. referencedClasses: [],
  19979. messageSends: []
  19980. }),
  19981. $globals.MessageNotUnderstood);
  19982. $core.addMethod(
  19983. $core.method({
  19984. selector: "message:",
  19985. protocol: "accessing",
  19986. fn: function (aMessage){
  19987. var self=this;
  19988. self["@message"]=aMessage;
  19989. return self;
  19990. },
  19991. args: ["aMessage"],
  19992. source: "message: aMessage\x0a\x09message := aMessage",
  19993. referencedClasses: [],
  19994. messageSends: []
  19995. }),
  19996. $globals.MessageNotUnderstood);
  19997. $core.addMethod(
  19998. $core.method({
  19999. selector: "messageText",
  20000. protocol: "accessing",
  20001. fn: function (){
  20002. var self=this;
  20003. return $core.withContext(function($ctx1) {
  20004. var $1;
  20005. $1=$recv($recv($recv(self._receiver())._asString()).__comma(" does not understand #")).__comma($recv(self._message())._selector());
  20006. $ctx1.sendIdx[","]=1;
  20007. return $1;
  20008. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  20009. },
  20010. args: [],
  20011. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  20012. referencedClasses: [],
  20013. messageSends: [",", "asString", "receiver", "selector", "message"]
  20014. }),
  20015. $globals.MessageNotUnderstood);
  20016. $core.addMethod(
  20017. $core.method({
  20018. selector: "receiver",
  20019. protocol: "accessing",
  20020. fn: function (){
  20021. var self=this;
  20022. return self["@receiver"];
  20023. },
  20024. args: [],
  20025. source: "receiver\x0a\x09^ receiver",
  20026. referencedClasses: [],
  20027. messageSends: []
  20028. }),
  20029. $globals.MessageNotUnderstood);
  20030. $core.addMethod(
  20031. $core.method({
  20032. selector: "receiver:",
  20033. protocol: "accessing",
  20034. fn: function (anObject){
  20035. var self=this;
  20036. self["@receiver"]=anObject;
  20037. return self;
  20038. },
  20039. args: ["anObject"],
  20040. source: "receiver: anObject\x0a\x09receiver := anObject",
  20041. referencedClasses: [],
  20042. messageSends: []
  20043. }),
  20044. $globals.MessageNotUnderstood);
  20045. $core.addClass("NonBooleanReceiver", $globals.Error, ["object"], "Kernel-Exceptions");
  20046. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  20047. $core.addMethod(
  20048. $core.method({
  20049. selector: "object",
  20050. protocol: "accessing",
  20051. fn: function (){
  20052. var self=this;
  20053. return self["@object"];
  20054. },
  20055. args: [],
  20056. source: "object\x0a\x09^ object",
  20057. referencedClasses: [],
  20058. messageSends: []
  20059. }),
  20060. $globals.NonBooleanReceiver);
  20061. $core.addMethod(
  20062. $core.method({
  20063. selector: "object:",
  20064. protocol: "accessing",
  20065. fn: function (anObject){
  20066. var self=this;
  20067. self["@object"]=anObject;
  20068. return self;
  20069. },
  20070. args: ["anObject"],
  20071. source: "object: anObject\x0a\x09object := anObject",
  20072. referencedClasses: [],
  20073. messageSends: []
  20074. }),
  20075. $globals.NonBooleanReceiver);
  20076. });
  20077. define('amber_core/Kernel-Infrastructure',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20078. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  20079. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20080. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  20081. $core.addPackage("Kernel-Infrastructure");
  20082. $core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  20083. $core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20084. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  20085. $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`.";
  20086. $core.addMethod(
  20087. $core.method({
  20088. selector: "=",
  20089. protocol: "comparing",
  20090. fn: function (anObject){
  20091. var self=this;
  20092. return $core.withContext(function($ctx1) {
  20093. var $2,$1;
  20094. $2=$recv(anObject)._class();
  20095. $ctx1.sendIdx["class"]=1;
  20096. $1=$recv($2).__eq_eq(self._class());
  20097. if(!$core.assert($1)){
  20098. return false;
  20099. }
  20100. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  20101. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  20102. },
  20103. args: ["anObject"],
  20104. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  20105. referencedClasses: ["JSObjectProxy"],
  20106. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  20107. }),
  20108. $globals.JSObjectProxy);
  20109. $core.addMethod(
  20110. $core.method({
  20111. selector: "asJavaScriptObject",
  20112. protocol: "converting",
  20113. fn: function (){
  20114. var self=this;
  20115. return self["@jsObject"];
  20116. },
  20117. args: [],
  20118. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  20119. referencedClasses: [],
  20120. messageSends: []
  20121. }),
  20122. $globals.JSObjectProxy);
  20123. $core.addMethod(
  20124. $core.method({
  20125. selector: "at:",
  20126. protocol: "accessing",
  20127. fn: function (aString){
  20128. var self=this;
  20129. return $core.withContext(function($ctx1) {
  20130. return self['@jsObject'][aString];
  20131. return self;
  20132. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  20133. },
  20134. args: ["aString"],
  20135. source: "at: aString\x0a\x09<inlineJS: 'return self[''@jsObject''][aString]'>",
  20136. referencedClasses: [],
  20137. messageSends: []
  20138. }),
  20139. $globals.JSObjectProxy);
  20140. $core.addMethod(
  20141. $core.method({
  20142. selector: "at:ifAbsent:",
  20143. protocol: "accessing",
  20144. fn: function (aString,aBlock){
  20145. var self=this;
  20146. return $core.withContext(function($ctx1) {
  20147. var obj = self['@jsObject'];
  20148. return aString in obj ? obj[aString] : aBlock._value();
  20149. ;
  20150. return self;
  20151. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  20152. },
  20153. args: ["aString", "aBlock"],
  20154. 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'>",
  20155. referencedClasses: [],
  20156. messageSends: []
  20157. }),
  20158. $globals.JSObjectProxy);
  20159. $core.addMethod(
  20160. $core.method({
  20161. selector: "at:ifPresent:",
  20162. protocol: "accessing",
  20163. fn: function (aString,aBlock){
  20164. var self=this;
  20165. return $core.withContext(function($ctx1) {
  20166. var obj = self['@jsObject'];
  20167. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  20168. ;
  20169. return self;
  20170. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  20171. },
  20172. args: ["aString", "aBlock"],
  20173. 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'>",
  20174. referencedClasses: [],
  20175. messageSends: []
  20176. }),
  20177. $globals.JSObjectProxy);
  20178. $core.addMethod(
  20179. $core.method({
  20180. selector: "at:ifPresent:ifAbsent:",
  20181. protocol: "accessing",
  20182. fn: function (aString,aBlock,anotherBlock){
  20183. var self=this;
  20184. return $core.withContext(function($ctx1) {
  20185. var obj = self['@jsObject'];
  20186. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  20187. ;
  20188. return self;
  20189. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  20190. },
  20191. args: ["aString", "aBlock", "anotherBlock"],
  20192. 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'>",
  20193. referencedClasses: [],
  20194. messageSends: []
  20195. }),
  20196. $globals.JSObjectProxy);
  20197. $core.addMethod(
  20198. $core.method({
  20199. selector: "at:put:",
  20200. protocol: "accessing",
  20201. fn: function (aString,anObject){
  20202. var self=this;
  20203. return $core.withContext(function($ctx1) {
  20204. return self['@jsObject'][aString] = anObject;
  20205. return self;
  20206. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  20207. },
  20208. args: ["aString", "anObject"],
  20209. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return self[''@jsObject''][aString] = anObject'>",
  20210. referencedClasses: [],
  20211. messageSends: []
  20212. }),
  20213. $globals.JSObjectProxy);
  20214. $core.addMethod(
  20215. $core.method({
  20216. selector: "doesNotUnderstand:",
  20217. protocol: "proxy",
  20218. fn: function (aMessage){
  20219. var self=this;
  20220. return $core.withContext(function($ctx1) {
  20221. var $1,$receiver;
  20222. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  20223. if(($receiver = $1) == null || $receiver.isNil){
  20224. return (
  20225. $ctx1.supercall = true,
  20226. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($recv(self), [aMessage]));
  20227. $ctx1.supercall = false;
  20228. } else {
  20229. var jsSelector;
  20230. jsSelector=$receiver;
  20231. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  20232. }
  20233. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  20234. },
  20235. args: ["aMessage"],
  20236. 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 ]",
  20237. referencedClasses: ["JSObjectProxy"],
  20238. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  20239. }),
  20240. $globals.JSObjectProxy);
  20241. $core.addMethod(
  20242. $core.method({
  20243. selector: "in:",
  20244. protocol: "accessing",
  20245. fn: function (aValuable){
  20246. var self=this;
  20247. return $core.withContext(function($ctx1) {
  20248. return $recv(aValuable)._value_(self["@jsObject"]);
  20249. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  20250. },
  20251. args: ["aValuable"],
  20252. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  20253. referencedClasses: [],
  20254. messageSends: ["value:"]
  20255. }),
  20256. $globals.JSObjectProxy);
  20257. $core.addMethod(
  20258. $core.method({
  20259. selector: "jsObject",
  20260. protocol: "accessing",
  20261. fn: function (){
  20262. var self=this;
  20263. return self["@jsObject"];
  20264. },
  20265. args: [],
  20266. source: "jsObject\x0a\x09^ jsObject",
  20267. referencedClasses: [],
  20268. messageSends: []
  20269. }),
  20270. $globals.JSObjectProxy);
  20271. $core.addMethod(
  20272. $core.method({
  20273. selector: "keysAndValuesDo:",
  20274. protocol: "enumerating",
  20275. fn: function (aBlock){
  20276. var self=this;
  20277. return $core.withContext(function($ctx1) {
  20278. var o = self['@jsObject'];
  20279. for(var i in o) {
  20280. aBlock._value_value_(i, o[i]);
  20281. }
  20282. ;
  20283. return self;
  20284. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  20285. },
  20286. args: ["aBlock"],
  20287. 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'>",
  20288. referencedClasses: [],
  20289. messageSends: []
  20290. }),
  20291. $globals.JSObjectProxy);
  20292. $core.addMethod(
  20293. $core.method({
  20294. selector: "printOn:",
  20295. protocol: "printing",
  20296. fn: function (aStream){
  20297. var self=this;
  20298. return $core.withContext(function($ctx1) {
  20299. $recv(aStream)._nextPutAll_(self._printString());
  20300. return self;
  20301. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  20302. },
  20303. args: ["aStream"],
  20304. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  20305. referencedClasses: [],
  20306. messageSends: ["nextPutAll:", "printString"]
  20307. }),
  20308. $globals.JSObjectProxy);
  20309. $core.addMethod(
  20310. $core.method({
  20311. selector: "printString",
  20312. protocol: "printing",
  20313. fn: function (){
  20314. var self=this;
  20315. return $core.withContext(function($ctx1) {
  20316. var js = self['@jsObject'];
  20317. return js.toString
  20318. ? js.toString()
  20319. : Object.prototype.toString.call(js)
  20320. ;
  20321. return self;
  20322. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  20323. },
  20324. args: [],
  20325. 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'>",
  20326. referencedClasses: [],
  20327. messageSends: []
  20328. }),
  20329. $globals.JSObjectProxy);
  20330. $core.addMethod(
  20331. $core.method({
  20332. selector: "putOn:",
  20333. protocol: "streaming",
  20334. fn: function (aStream){
  20335. var self=this;
  20336. return $core.withContext(function($ctx1) {
  20337. $recv(aStream)._nextPutJSObject_(self["@jsObject"]);
  20338. return self;
  20339. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  20340. },
  20341. args: ["aStream"],
  20342. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  20343. referencedClasses: [],
  20344. messageSends: ["nextPutJSObject:"]
  20345. }),
  20346. $globals.JSObjectProxy);
  20347. $core.addMethod(
  20348. $core.method({
  20349. selector: "addObjectVariablesTo:ofProxy:",
  20350. protocol: "proxy",
  20351. fn: function (aDictionary,aProxy){
  20352. var self=this;
  20353. return $core.withContext(function($ctx1) {
  20354. var jsObject = aProxy['@jsObject'];
  20355. for(var i in jsObject) {
  20356. aDictionary._at_put_(i, jsObject[i]);
  20357. }
  20358. ;
  20359. return self;
  20360. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  20361. },
  20362. args: ["aDictionary", "aProxy"],
  20363. 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'>",
  20364. referencedClasses: [],
  20365. messageSends: []
  20366. }),
  20367. $globals.JSObjectProxy.klass);
  20368. $core.addMethod(
  20369. $core.method({
  20370. selector: "compareJSObjectOfProxy:withProxy:",
  20371. protocol: "proxy",
  20372. fn: function (aProxy,anotherProxy){
  20373. var self=this;
  20374. return $core.withContext(function($ctx1) {
  20375. var anotherJSObject = anotherProxy.klass ? anotherProxy["@jsObject"] : anotherProxy;
  20376. return aProxy["@jsObject"] === anotherJSObject;
  20377. return self;
  20378. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.klass)});
  20379. },
  20380. args: ["aProxy", "anotherProxy"],
  20381. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<inlineJS: '\x0a\x09var anotherJSObject = anotherProxy.klass ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a'>",
  20382. referencedClasses: [],
  20383. messageSends: []
  20384. }),
  20385. $globals.JSObjectProxy.klass);
  20386. $core.addMethod(
  20387. $core.method({
  20388. selector: "forwardMessage:withArguments:ofProxy:",
  20389. protocol: "proxy",
  20390. fn: function (aString,anArray,aProxy){
  20391. var self=this;
  20392. return $core.withContext(function($ctx1) {
  20393. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  20394. ;
  20395. return self;
  20396. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  20397. },
  20398. args: ["aString", "anArray", "aProxy"],
  20399. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  20400. referencedClasses: [],
  20401. messageSends: []
  20402. }),
  20403. $globals.JSObjectProxy.klass);
  20404. $core.addMethod(
  20405. $core.method({
  20406. selector: "jsObject:ofProxy:",
  20407. protocol: "proxy",
  20408. fn: function (aJSObject,aProxy){
  20409. var self=this;
  20410. return $core.withContext(function($ctx1) {
  20411. aProxy['@jsObject'] = aJSObject;
  20412. return self;
  20413. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  20414. },
  20415. args: ["aJSObject", "aProxy"],
  20416. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>",
  20417. referencedClasses: [],
  20418. messageSends: []
  20419. }),
  20420. $globals.JSObjectProxy.klass);
  20421. $core.addMethod(
  20422. $core.method({
  20423. selector: "lookupProperty:ofProxy:",
  20424. protocol: "proxy",
  20425. fn: function (aString,aProxy){
  20426. var self=this;
  20427. return $core.withContext(function($ctx1) {
  20428. return aString in aProxy._jsObject() ? aString : nil;
  20429. return self;
  20430. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  20431. },
  20432. args: ["aString", "aProxy"],
  20433. 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'>",
  20434. referencedClasses: [],
  20435. messageSends: []
  20436. }),
  20437. $globals.JSObjectProxy.klass);
  20438. $core.addMethod(
  20439. $core.method({
  20440. selector: "on:",
  20441. protocol: "instance creation",
  20442. fn: function (aJSObject){
  20443. var self=this;
  20444. var instance;
  20445. return $core.withContext(function($ctx1) {
  20446. instance=self._new();
  20447. self._jsObject_ofProxy_(aJSObject,instance);
  20448. return instance;
  20449. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.klass)});
  20450. },
  20451. args: ["aJSObject"],
  20452. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  20453. referencedClasses: [],
  20454. messageSends: ["new", "jsObject:ofProxy:"]
  20455. }),
  20456. $globals.JSObjectProxy.klass);
  20457. $core.addClass("Organizer", $globals.Object, [], "Kernel-Infrastructure");
  20458. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  20459. $core.addMethod(
  20460. $core.method({
  20461. selector: "addElement:",
  20462. protocol: "accessing",
  20463. fn: function (anObject){
  20464. var self=this;
  20465. return $core.withContext(function($ctx1) {
  20466. $core.addElement(self.elements, anObject);
  20467. return self;
  20468. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  20469. },
  20470. args: ["anObject"],
  20471. source: "addElement: anObject\x0a\x09<inlineJS: '$core.addElement(self.elements, anObject)'>",
  20472. referencedClasses: [],
  20473. messageSends: []
  20474. }),
  20475. $globals.Organizer);
  20476. $core.addMethod(
  20477. $core.method({
  20478. selector: "elements",
  20479. protocol: "accessing",
  20480. fn: function (){
  20481. var self=this;
  20482. return $core.withContext(function($ctx1) {
  20483. return $recv(self._basicAt_("elements"))._copy();
  20484. }, function($ctx1) {$ctx1.fill(self,"elements",{},$globals.Organizer)});
  20485. },
  20486. args: [],
  20487. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  20488. referencedClasses: [],
  20489. messageSends: ["copy", "basicAt:"]
  20490. }),
  20491. $globals.Organizer);
  20492. $core.addMethod(
  20493. $core.method({
  20494. selector: "removeElement:",
  20495. protocol: "accessing",
  20496. fn: function (anObject){
  20497. var self=this;
  20498. return $core.withContext(function($ctx1) {
  20499. $core.removeElement(self.elements, anObject);
  20500. return self;
  20501. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  20502. },
  20503. args: ["anObject"],
  20504. source: "removeElement: anObject\x0a\x09<inlineJS: '$core.removeElement(self.elements, anObject)'>",
  20505. referencedClasses: [],
  20506. messageSends: []
  20507. }),
  20508. $globals.Organizer);
  20509. $core.addClass("ClassOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  20510. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  20511. $core.addMethod(
  20512. $core.method({
  20513. selector: "addElement:",
  20514. protocol: "accessing",
  20515. fn: function (aString){
  20516. var self=this;
  20517. return $core.withContext(function($ctx1) {
  20518. var $1,$3,$2;
  20519. (
  20520. $ctx1.supercall = true,
  20521. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($recv(self), [aString]));
  20522. $ctx1.supercall = false;
  20523. $1=$recv($globals.SystemAnnouncer)._current();
  20524. $3=$recv($globals.ProtocolAdded)._new();
  20525. $recv($3)._protocol_(aString);
  20526. $recv($3)._theClass_(self._theClass());
  20527. $2=$recv($3)._yourself();
  20528. $recv($1)._announce_($2);
  20529. return self;
  20530. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  20531. },
  20532. args: ["aString"],
  20533. 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)",
  20534. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  20535. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  20536. }),
  20537. $globals.ClassOrganizer);
  20538. $core.addMethod(
  20539. $core.method({
  20540. selector: "removeElement:",
  20541. protocol: "accessing",
  20542. fn: function (aString){
  20543. var self=this;
  20544. return $core.withContext(function($ctx1) {
  20545. var $1,$3,$2;
  20546. (
  20547. $ctx1.supercall = true,
  20548. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($recv(self), [aString]));
  20549. $ctx1.supercall = false;
  20550. $1=$recv($globals.SystemAnnouncer)._current();
  20551. $3=$recv($globals.ProtocolRemoved)._new();
  20552. $recv($3)._protocol_(aString);
  20553. $recv($3)._theClass_(self._theClass());
  20554. $2=$recv($3)._yourself();
  20555. $recv($1)._announce_($2);
  20556. return self;
  20557. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  20558. },
  20559. args: ["aString"],
  20560. 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)",
  20561. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  20562. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  20563. }),
  20564. $globals.ClassOrganizer);
  20565. $core.addMethod(
  20566. $core.method({
  20567. selector: "theClass",
  20568. protocol: "accessing",
  20569. fn: function (){
  20570. var self=this;
  20571. return $core.withContext(function($ctx1) {
  20572. return self.theClass;
  20573. return self;
  20574. }, function($ctx1) {$ctx1.fill(self,"theClass",{},$globals.ClassOrganizer)});
  20575. },
  20576. args: [],
  20577. source: "theClass\x0a\x09<inlineJS: 'return self.theClass'>",
  20578. referencedClasses: [],
  20579. messageSends: []
  20580. }),
  20581. $globals.ClassOrganizer);
  20582. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  20583. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  20584. $core.addClass("Package", $globals.Object, ["transport", "imports", "dirty"], "Kernel-Infrastructure");
  20585. $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'";
  20586. $core.addMethod(
  20587. $core.method({
  20588. selector: "basicImports",
  20589. protocol: "private",
  20590. fn: function (){
  20591. var self=this;
  20592. return $core.withContext(function($ctx1) {
  20593. return self.imports || [];
  20594. return self;
  20595. }, function($ctx1) {$ctx1.fill(self,"basicImports",{},$globals.Package)});
  20596. },
  20597. args: [],
  20598. source: "basicImports\x0a\x09\x22Answer the imports literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<inlineJS: 'return self.imports || []'>",
  20599. referencedClasses: [],
  20600. messageSends: []
  20601. }),
  20602. $globals.Package);
  20603. $core.addMethod(
  20604. $core.method({
  20605. selector: "basicName:",
  20606. protocol: "private",
  20607. fn: function (aString){
  20608. var self=this;
  20609. return $core.withContext(function($ctx1) {
  20610. self.pkgName = aString;
  20611. return self;
  20612. }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},$globals.Package)});
  20613. },
  20614. args: ["aString"],
  20615. source: "basicName: aString\x0a\x09<inlineJS: 'self.pkgName = aString'>",
  20616. referencedClasses: [],
  20617. messageSends: []
  20618. }),
  20619. $globals.Package);
  20620. $core.addMethod(
  20621. $core.method({
  20622. selector: "basicTransport",
  20623. protocol: "private",
  20624. fn: function (){
  20625. var self=this;
  20626. return $core.withContext(function($ctx1) {
  20627. return self.transport;
  20628. return self;
  20629. }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},$globals.Package)});
  20630. },
  20631. args: [],
  20632. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<inlineJS: 'return self.transport'>",
  20633. referencedClasses: [],
  20634. messageSends: []
  20635. }),
  20636. $globals.Package);
  20637. $core.addMethod(
  20638. $core.method({
  20639. selector: "beClean",
  20640. protocol: "accessing",
  20641. fn: function (){
  20642. var self=this;
  20643. return $core.withContext(function($ctx1) {
  20644. var $1,$3,$2;
  20645. self["@dirty"]=false;
  20646. $1=$recv($globals.SystemAnnouncer)._current();
  20647. $3=$recv($globals.PackageClean)._new();
  20648. $recv($3)._package_(self);
  20649. $2=$recv($3)._yourself();
  20650. $recv($1)._announce_($2);
  20651. return self;
  20652. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  20653. },
  20654. args: [],
  20655. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  20656. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  20657. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  20658. }),
  20659. $globals.Package);
  20660. $core.addMethod(
  20661. $core.method({
  20662. selector: "beDirty",
  20663. protocol: "accessing",
  20664. fn: function (){
  20665. var self=this;
  20666. return $core.withContext(function($ctx1) {
  20667. var $1,$3,$2;
  20668. self["@dirty"]=true;
  20669. $1=$recv($globals.SystemAnnouncer)._current();
  20670. $3=$recv($globals.PackageDirty)._new();
  20671. $recv($3)._package_(self);
  20672. $2=$recv($3)._yourself();
  20673. $recv($1)._announce_($2);
  20674. return self;
  20675. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  20676. },
  20677. args: [],
  20678. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  20679. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  20680. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  20681. }),
  20682. $globals.Package);
  20683. $core.addMethod(
  20684. $core.method({
  20685. selector: "classTemplate",
  20686. protocol: "accessing",
  20687. fn: function (){
  20688. var self=this;
  20689. return $core.withContext(function($ctx1) {
  20690. return $recv($globals.String)._streamContents_((function(stream){
  20691. return $core.withContext(function($ctx2) {
  20692. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  20693. $ctx2.sendIdx["write:"]=1;
  20694. $recv(stream)._lf();
  20695. $ctx2.sendIdx["lf"]=1;
  20696. $recv(stream)._tab();
  20697. $ctx2.sendIdx["tab"]=1;
  20698. $recv(stream)._write_("instanceVariableNames: ''");
  20699. $ctx2.sendIdx["write:"]=2;
  20700. $recv(stream)._lf();
  20701. $recv(stream)._tab();
  20702. $recv(stream)._write_("package: ");
  20703. return $recv(stream)._print_(self._name());
  20704. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  20705. }));
  20706. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  20707. },
  20708. args: [],
  20709. 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 ]",
  20710. referencedClasses: ["String"],
  20711. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  20712. }),
  20713. $globals.Package);
  20714. $core.addMethod(
  20715. $core.method({
  20716. selector: "classes",
  20717. protocol: "classes",
  20718. fn: function (){
  20719. var self=this;
  20720. return $core.withContext(function($ctx1) {
  20721. return $recv(self._organization())._elements();
  20722. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  20723. },
  20724. args: [],
  20725. source: "classes\x0a\x09^ self organization elements",
  20726. referencedClasses: [],
  20727. messageSends: ["elements", "organization"]
  20728. }),
  20729. $globals.Package);
  20730. $core.addMethod(
  20731. $core.method({
  20732. selector: "definition",
  20733. protocol: "accessing",
  20734. fn: function (){
  20735. var self=this;
  20736. return $core.withContext(function($ctx1) {
  20737. var $1;
  20738. return $recv($globals.String)._streamContents_((function(stream){
  20739. return $core.withContext(function($ctx2) {
  20740. $1=$recv(self._class())._name();
  20741. $ctx2.sendIdx["name"]=1;
  20742. $recv(stream)._write_($1);
  20743. $ctx2.sendIdx["write:"]=1;
  20744. $recv(stream)._lf();
  20745. $ctx2.sendIdx["lf"]=1;
  20746. $recv(stream)._tab();
  20747. $ctx2.sendIdx["tab"]=1;
  20748. $recv(stream)._write_("named: ");
  20749. $ctx2.sendIdx["write:"]=2;
  20750. $recv(stream)._print_(self._name());
  20751. $recv(stream)._lf();
  20752. $ctx2.sendIdx["lf"]=2;
  20753. $recv(stream)._tab();
  20754. $ctx2.sendIdx["tab"]=2;
  20755. $recv(stream)._write_(["imports: ",self._importsDefinition()]);
  20756. $ctx2.sendIdx["write:"]=3;
  20757. $recv(stream)._lf();
  20758. $recv(stream)._tab();
  20759. return $recv(stream)._write_(["transport: (",$recv(self._transport())._definition(),")"]);
  20760. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  20761. }));
  20762. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  20763. },
  20764. args: [],
  20765. 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. ')' } ]",
  20766. referencedClasses: ["String"],
  20767. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  20768. }),
  20769. $globals.Package);
  20770. $core.addMethod(
  20771. $core.method({
  20772. selector: "imports",
  20773. protocol: "accessing",
  20774. fn: function (){
  20775. var self=this;
  20776. return $core.withContext(function($ctx1) {
  20777. var $1,$receiver;
  20778. $1=self["@imports"];
  20779. if(($receiver = $1) == null || $receiver.isNil){
  20780. var parsed;
  20781. parsed=self._importsFromJson_(self._basicImports());
  20782. parsed;
  20783. self._imports_(parsed);
  20784. return self["@imports"];
  20785. } else {
  20786. return $1;
  20787. }
  20788. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  20789. },
  20790. args: [],
  20791. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09| parsed |\x0a\x09\x09parsed := self importsFromJson: self basicImports.\x0a\x09\x09self imports: parsed.\x0a\x09\x09imports ]",
  20792. referencedClasses: [],
  20793. messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"]
  20794. }),
  20795. $globals.Package);
  20796. $core.addMethod(
  20797. $core.method({
  20798. selector: "imports:",
  20799. protocol: "accessing",
  20800. fn: function (anArray){
  20801. var self=this;
  20802. return $core.withContext(function($ctx1) {
  20803. self._validateImports_(anArray);
  20804. self["@imports"]=$recv(anArray)._asSet();
  20805. return self;
  20806. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  20807. },
  20808. args: ["anArray"],
  20809. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  20810. referencedClasses: [],
  20811. messageSends: ["validateImports:", "asSet"]
  20812. }),
  20813. $globals.Package);
  20814. $core.addMethod(
  20815. $core.method({
  20816. selector: "importsAsJson",
  20817. protocol: "converting",
  20818. fn: function (){
  20819. var self=this;
  20820. return $core.withContext(function($ctx1) {
  20821. var $1;
  20822. return $recv(self._sortedImportsAsArray())._collect_((function(each){
  20823. return $core.withContext(function($ctx2) {
  20824. $1=$recv(each)._isString();
  20825. if($core.assert($1)){
  20826. return each;
  20827. } else {
  20828. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  20829. $ctx2.sendIdx[","]=1;
  20830. }
  20831. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20832. }));
  20833. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  20834. },
  20835. args: [],
  20836. 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 ]]",
  20837. referencedClasses: [],
  20838. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  20839. }),
  20840. $globals.Package);
  20841. $core.addMethod(
  20842. $core.method({
  20843. selector: "importsDefinition",
  20844. protocol: "accessing",
  20845. fn: function (){
  20846. var self=this;
  20847. return $core.withContext(function($ctx1) {
  20848. return $recv($globals.String)._streamContents_((function(stream){
  20849. return $core.withContext(function($ctx2) {
  20850. $recv(stream)._write_("{");
  20851. $ctx2.sendIdx["write:"]=1;
  20852. $recv(self._sortedImportsAsArray())._do_separatedBy_((function(each){
  20853. return $core.withContext(function($ctx3) {
  20854. return $recv(stream)._print_(each);
  20855. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  20856. }),(function(){
  20857. return $core.withContext(function($ctx3) {
  20858. return $recv(stream)._write_(". ");
  20859. $ctx3.sendIdx["write:"]=2;
  20860. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  20861. }));
  20862. return $recv(stream)._write_("}");
  20863. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  20864. }));
  20865. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  20866. },
  20867. args: [],
  20868. 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: '}' ]",
  20869. referencedClasses: ["String"],
  20870. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  20871. }),
  20872. $globals.Package);
  20873. $core.addMethod(
  20874. $core.method({
  20875. selector: "importsFromJson:",
  20876. protocol: "converting",
  20877. fn: function (anArray){
  20878. var self=this;
  20879. return $core.withContext(function($ctx1) {
  20880. var $1;
  20881. return $recv(anArray)._collect_((function(each){
  20882. var split;
  20883. return $core.withContext(function($ctx2) {
  20884. split=$recv(each)._tokenize_("=");
  20885. split;
  20886. $1=$recv($recv(split)._size()).__eq((1));
  20887. if($core.assert($1)){
  20888. return $recv(split)._first();
  20889. $ctx2.sendIdx["first"]=1;
  20890. } else {
  20891. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  20892. }
  20893. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  20894. }));
  20895. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  20896. },
  20897. args: ["anArray"],
  20898. 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 ]]",
  20899. referencedClasses: [],
  20900. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  20901. }),
  20902. $globals.Package);
  20903. $core.addMethod(
  20904. $core.method({
  20905. selector: "isDirty",
  20906. protocol: "testing",
  20907. fn: function (){
  20908. var self=this;
  20909. return $core.withContext(function($ctx1) {
  20910. var $1,$receiver;
  20911. $1=self["@dirty"];
  20912. if(($receiver = $1) == null || $receiver.isNil){
  20913. return false;
  20914. } else {
  20915. return $1;
  20916. }
  20917. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  20918. },
  20919. args: [],
  20920. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  20921. referencedClasses: [],
  20922. messageSends: ["ifNil:"]
  20923. }),
  20924. $globals.Package);
  20925. $core.addMethod(
  20926. $core.method({
  20927. selector: "isPackage",
  20928. protocol: "testing",
  20929. fn: function (){
  20930. var self=this;
  20931. return true;
  20932. },
  20933. args: [],
  20934. source: "isPackage\x0a\x09^ true",
  20935. referencedClasses: [],
  20936. messageSends: []
  20937. }),
  20938. $globals.Package);
  20939. $core.addMethod(
  20940. $core.method({
  20941. selector: "loadDependencies",
  20942. protocol: "dependencies",
  20943. fn: function (){
  20944. var self=this;
  20945. var classes,packages;
  20946. return $core.withContext(function($ctx1) {
  20947. var $1;
  20948. classes=self._loadDependencyClasses();
  20949. $1=$recv($recv(classes)._collect_((function(each){
  20950. return $core.withContext(function($ctx2) {
  20951. return $recv(each)._package();
  20952. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20953. })))._asSet();
  20954. $recv($1)._remove_ifAbsent_(self,(function(){
  20955. }));
  20956. return $recv($1)._yourself();
  20957. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  20958. },
  20959. args: [],
  20960. 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",
  20961. referencedClasses: [],
  20962. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  20963. }),
  20964. $globals.Package);
  20965. $core.addMethod(
  20966. $core.method({
  20967. selector: "loadDependencyClasses",
  20968. protocol: "dependencies",
  20969. fn: function (){
  20970. var self=this;
  20971. var starCategoryName;
  20972. return $core.withContext(function($ctx1) {
  20973. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  20974. starCategoryName="*".__comma(self._name());
  20975. $ctx1.sendIdx[","]=1;
  20976. $3=self._classes();
  20977. $ctx1.sendIdx["classes"]=1;
  20978. $2=$recv($3)._collect_((function(each){
  20979. return $core.withContext(function($ctx2) {
  20980. return $recv(each)._superclass();
  20981. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20982. }));
  20983. $ctx1.sendIdx["collect:"]=1;
  20984. $1=$recv($2)._asSet();
  20985. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  20986. return $core.withContext(function($ctx2) {
  20987. $5=$recv(each)._protocols();
  20988. $ctx2.sendIdx["protocols"]=1;
  20989. $7=$recv(each)._theMetaClass();
  20990. if(($receiver = $7) == null || $receiver.isNil){
  20991. $6=[];
  20992. } else {
  20993. var meta;
  20994. meta=$receiver;
  20995. $6=$recv(meta)._protocols();
  20996. }
  20997. $4=$recv($5).__comma($6);
  20998. return $recv($4)._includes_(starCategoryName);
  20999. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  21000. })));
  21001. $ctx1.sendIdx["addAll:"]=1;
  21002. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  21003. return $core.withContext(function($ctx2) {
  21004. return $recv(self._traitCompositions())._valuesDo_((function(each){
  21005. return $core.withContext(function($ctx3) {
  21006. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  21007. return $core.withContext(function($ctx4) {
  21008. return $recv(eachTT)._trait();
  21009. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  21010. })));
  21011. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  21012. }));
  21013. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  21014. })));
  21015. $recv($1)._remove_ifAbsent_(nil,(function(){
  21016. }));
  21017. return $recv($1)._yourself();
  21018. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  21019. },
  21020. args: [],
  21021. 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",
  21022. referencedClasses: ["Smalltalk", "Array"],
  21023. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  21024. }),
  21025. $globals.Package);
  21026. $core.addMethod(
  21027. $core.method({
  21028. selector: "name",
  21029. protocol: "accessing",
  21030. fn: function (){
  21031. var self=this;
  21032. return $core.withContext(function($ctx1) {
  21033. return self.pkgName;
  21034. return self;
  21035. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
  21036. },
  21037. args: [],
  21038. source: "name\x0a\x09<inlineJS: 'return self.pkgName'>",
  21039. referencedClasses: [],
  21040. messageSends: []
  21041. }),
  21042. $globals.Package);
  21043. $core.addMethod(
  21044. $core.method({
  21045. selector: "name:",
  21046. protocol: "accessing",
  21047. fn: function (aString){
  21048. var self=this;
  21049. return $core.withContext(function($ctx1) {
  21050. self._basicName_(aString);
  21051. self._beDirty();
  21052. return self;
  21053. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
  21054. },
  21055. args: ["aString"],
  21056. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  21057. referencedClasses: [],
  21058. messageSends: ["basicName:", "beDirty"]
  21059. }),
  21060. $globals.Package);
  21061. $core.addMethod(
  21062. $core.method({
  21063. selector: "organization",
  21064. protocol: "accessing",
  21065. fn: function (){
  21066. var self=this;
  21067. return $core.withContext(function($ctx1) {
  21068. return self._basicAt_("organization");
  21069. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
  21070. },
  21071. args: [],
  21072. source: "organization\x0a\x09^ self basicAt: 'organization'",
  21073. referencedClasses: [],
  21074. messageSends: ["basicAt:"]
  21075. }),
  21076. $globals.Package);
  21077. $core.addMethod(
  21078. $core.method({
  21079. selector: "printOn:",
  21080. protocol: "printing",
  21081. fn: function (aStream){
  21082. var self=this;
  21083. return $core.withContext(function($ctx1) {
  21084. (
  21085. $ctx1.supercall = true,
  21086. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  21087. $ctx1.supercall = false;
  21088. $recv(aStream)._nextPutAll_(" (");
  21089. $ctx1.sendIdx["nextPutAll:"]=1;
  21090. $recv(aStream)._nextPutAll_(self._name());
  21091. $ctx1.sendIdx["nextPutAll:"]=2;
  21092. $recv(aStream)._nextPutAll_(")");
  21093. return self;
  21094. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  21095. },
  21096. args: ["aStream"],
  21097. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  21098. referencedClasses: [],
  21099. messageSends: ["printOn:", "nextPutAll:", "name"]
  21100. }),
  21101. $globals.Package);
  21102. $core.addMethod(
  21103. $core.method({
  21104. selector: "setupClasses",
  21105. protocol: "classes",
  21106. fn: function (){
  21107. var self=this;
  21108. return $core.withContext(function($ctx1) {
  21109. $recv(self._classes())._do_((function(each){
  21110. return $core.withContext(function($ctx2) {
  21111. return $recv(each)._initialize();
  21112. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21113. }));
  21114. return self;
  21115. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  21116. },
  21117. args: [],
  21118. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  21119. referencedClasses: [],
  21120. messageSends: ["do:", "classes", "initialize"]
  21121. }),
  21122. $globals.Package);
  21123. $core.addMethod(
  21124. $core.method({
  21125. selector: "sortedClasses",
  21126. protocol: "classes",
  21127. fn: function (){
  21128. var self=this;
  21129. return $core.withContext(function($ctx1) {
  21130. return $recv(self._class())._sortedClasses_(self._classes());
  21131. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  21132. },
  21133. args: [],
  21134. 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",
  21135. referencedClasses: [],
  21136. messageSends: ["sortedClasses:", "class", "classes"]
  21137. }),
  21138. $globals.Package);
  21139. $core.addMethod(
  21140. $core.method({
  21141. selector: "sortedImportsAsArray",
  21142. protocol: "private",
  21143. fn: function (){
  21144. var self=this;
  21145. return $core.withContext(function($ctx1) {
  21146. var $3,$2,$4,$1,$6,$5,$7;
  21147. return $recv($recv(self._imports())._asArray())._sorted_((function(a,b){
  21148. return $core.withContext(function($ctx2) {
  21149. $3=$recv(a)._isString();
  21150. $ctx2.sendIdx["isString"]=1;
  21151. $2=$recv($3)._not();
  21152. $4=$recv(b)._isString();
  21153. $ctx2.sendIdx["isString"]=2;
  21154. $1=$recv($2).__and($4);
  21155. return $recv($1)._or_((function(){
  21156. return $core.withContext(function($ctx3) {
  21157. $6=$recv(a)._isString();
  21158. $ctx3.sendIdx["isString"]=3;
  21159. $5=$recv($6).__eq($recv(b)._isString());
  21160. return $recv($5)._and_((function(){
  21161. return $core.withContext(function($ctx4) {
  21162. $7=$recv(a)._value();
  21163. $ctx4.sendIdx["value"]=1;
  21164. return $recv($7).__lt_eq($recv(b)._value());
  21165. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  21166. }));
  21167. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  21168. }));
  21169. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  21170. }));
  21171. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  21172. },
  21173. args: [],
  21174. 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 ]]]",
  21175. referencedClasses: [],
  21176. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  21177. }),
  21178. $globals.Package);
  21179. $core.addMethod(
  21180. $core.method({
  21181. selector: "traitCompositions",
  21182. protocol: "dependencies",
  21183. fn: function (){
  21184. var self=this;
  21185. var traitCompositions;
  21186. return $core.withContext(function($ctx1) {
  21187. var $1,$2,$3,$receiver;
  21188. traitCompositions=$recv($globals.Dictionary)._new();
  21189. $recv(self._classes())._do_((function(each){
  21190. return $core.withContext(function($ctx2) {
  21191. $1=traitCompositions;
  21192. $2=$recv(each)._traitComposition();
  21193. $ctx2.sendIdx["traitComposition"]=1;
  21194. $recv($1)._at_put_(each,$2);
  21195. $ctx2.sendIdx["at:put:"]=1;
  21196. $3=$recv(each)._theMetaClass();
  21197. if(($receiver = $3) == null || $receiver.isNil){
  21198. return $3;
  21199. } else {
  21200. var meta;
  21201. meta=$receiver;
  21202. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  21203. }
  21204. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21205. }));
  21206. return $recv(traitCompositions)._reject_((function(each){
  21207. return $core.withContext(function($ctx2) {
  21208. return $recv(each)._isEmpty();
  21209. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  21210. }));
  21211. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  21212. },
  21213. args: [],
  21214. 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 ]",
  21215. referencedClasses: ["Dictionary"],
  21216. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  21217. }),
  21218. $globals.Package);
  21219. $core.addMethod(
  21220. $core.method({
  21221. selector: "transport",
  21222. protocol: "accessing",
  21223. fn: function (){
  21224. var self=this;
  21225. return $core.withContext(function($ctx1) {
  21226. var $1,$2,$receiver;
  21227. $1=self["@transport"];
  21228. if(($receiver = $1) == null || $receiver.isNil){
  21229. $2=$recv($globals.PackageTransport)._fromJson_(self._basicTransport());
  21230. $recv($2)._package_(self);
  21231. self["@transport"]=$recv($2)._yourself();
  21232. return self["@transport"];
  21233. } else {
  21234. return $1;
  21235. }
  21236. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  21237. },
  21238. args: [],
  21239. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  21240. referencedClasses: ["PackageTransport"],
  21241. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  21242. }),
  21243. $globals.Package);
  21244. $core.addMethod(
  21245. $core.method({
  21246. selector: "transport:",
  21247. protocol: "accessing",
  21248. fn: function (aPackageTransport){
  21249. var self=this;
  21250. return $core.withContext(function($ctx1) {
  21251. self["@transport"]=aPackageTransport;
  21252. $recv(aPackageTransport)._package_(self);
  21253. return self;
  21254. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  21255. },
  21256. args: ["aPackageTransport"],
  21257. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  21258. referencedClasses: [],
  21259. messageSends: ["package:"]
  21260. }),
  21261. $globals.Package);
  21262. $core.addMethod(
  21263. $core.method({
  21264. selector: "validateImports:",
  21265. protocol: "validation",
  21266. fn: function (aCollection){
  21267. var self=this;
  21268. return $core.withContext(function($ctx1) {
  21269. var $1,$2,$5,$4,$3,$6;
  21270. $recv(aCollection)._do_((function(import_){
  21271. return $core.withContext(function($ctx2) {
  21272. $1=$recv(import_)._isString();
  21273. $ctx2.sendIdx["isString"]=1;
  21274. if(!$core.assert($1)){
  21275. $2=$recv(import_)._respondsTo_("key");
  21276. if(!$core.assert($2)){
  21277. self._error_("Imports must be Strings or Associations");
  21278. $ctx2.sendIdx["error:"]=1;
  21279. }
  21280. $5=$recv(import_)._key();
  21281. $ctx2.sendIdx["key"]=1;
  21282. $4=$recv($5)._isString();
  21283. $ctx2.sendIdx["isString"]=2;
  21284. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  21285. if(!$core.assert($3)){
  21286. self._error_("Key and value must be Strings");
  21287. $ctx2.sendIdx["error:"]=2;
  21288. }
  21289. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  21290. if(!$core.assert($6)){
  21291. return self._error_("Keys must be identifiers");
  21292. }
  21293. }
  21294. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  21295. }));
  21296. return self;
  21297. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  21298. },
  21299. args: ["aCollection"],
  21300. 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' ]]]",
  21301. referencedClasses: [],
  21302. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  21303. }),
  21304. $globals.Package);
  21305. $globals.Package.klass.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  21306. $core.addMethod(
  21307. $core.method({
  21308. selector: "named:",
  21309. protocol: "accessing",
  21310. fn: function (aPackageName){
  21311. var self=this;
  21312. return $core.withContext(function($ctx1) {
  21313. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  21314. return $core.withContext(function($ctx2) {
  21315. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  21316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21317. }));
  21318. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.klass)});
  21319. },
  21320. args: ["aPackageName"],
  21321. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  21322. referencedClasses: ["Smalltalk"],
  21323. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  21324. }),
  21325. $globals.Package.klass);
  21326. $core.addMethod(
  21327. $core.method({
  21328. selector: "named:ifAbsent:",
  21329. protocol: "accessing",
  21330. fn: function (aPackageName,aBlock){
  21331. var self=this;
  21332. return $core.withContext(function($ctx1) {
  21333. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  21334. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.klass)});
  21335. },
  21336. args: ["aPackageName", "aBlock"],
  21337. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  21338. referencedClasses: ["Smalltalk"],
  21339. messageSends: ["packageAt:ifAbsent:"]
  21340. }),
  21341. $globals.Package.klass);
  21342. $core.addMethod(
  21343. $core.method({
  21344. selector: "named:imports:transport:",
  21345. protocol: "accessing",
  21346. fn: function (aPackageName,anArray,aTransport){
  21347. var self=this;
  21348. var package_;
  21349. return $core.withContext(function($ctx1) {
  21350. package_=self._named_(aPackageName);
  21351. $recv(package_)._imports_(anArray);
  21352. $recv(package_)._transport_(aTransport);
  21353. return package_;
  21354. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  21355. },
  21356. args: ["aPackageName", "anArray", "aTransport"],
  21357. source: "named: aPackageName imports: anArray transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package imports: anArray.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  21358. referencedClasses: [],
  21359. messageSends: ["named:", "imports:", "transport:"]
  21360. }),
  21361. $globals.Package.klass);
  21362. $core.addMethod(
  21363. $core.method({
  21364. selector: "named:transport:",
  21365. protocol: "accessing",
  21366. fn: function (aPackageName,aTransport){
  21367. var self=this;
  21368. var package_;
  21369. return $core.withContext(function($ctx1) {
  21370. package_=self._named_(aPackageName);
  21371. $recv(package_)._transport_(aTransport);
  21372. return package_;
  21373. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  21374. },
  21375. args: ["aPackageName", "aTransport"],
  21376. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  21377. referencedClasses: [],
  21378. messageSends: ["named:", "transport:"]
  21379. }),
  21380. $globals.Package.klass);
  21381. $core.addMethod(
  21382. $core.method({
  21383. selector: "sortedClasses:",
  21384. protocol: "sorting",
  21385. fn: function (classes){
  21386. var self=this;
  21387. var children,others,nodes,expandedClasses;
  21388. return $core.withContext(function($ctx1) {
  21389. var $1,$3,$2;
  21390. children=[];
  21391. others=[];
  21392. $recv(classes)._do_((function(each){
  21393. return $core.withContext(function($ctx2) {
  21394. $1=$recv(classes)._includes_($recv(each)._superclass());
  21395. if($core.assert($1)){
  21396. return $recv(others)._add_(each);
  21397. } else {
  21398. return $recv(children)._add_(each);
  21399. $ctx2.sendIdx["add:"]=1;
  21400. }
  21401. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21402. }));
  21403. $ctx1.sendIdx["do:"]=1;
  21404. nodes=$recv(children)._collect_((function(each){
  21405. return $core.withContext(function($ctx2) {
  21406. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  21407. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  21408. }));
  21409. nodes=$recv(nodes)._sorted_((function(a,b){
  21410. return $core.withContext(function($ctx2) {
  21411. $3=$recv(a)._theClass();
  21412. $ctx2.sendIdx["theClass"]=1;
  21413. $2=$recv($3)._name();
  21414. $ctx2.sendIdx["name"]=1;
  21415. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  21416. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  21417. }));
  21418. expandedClasses=$recv($globals.Array)._new();
  21419. $recv(nodes)._do_((function(aNode){
  21420. return $core.withContext(function($ctx2) {
  21421. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  21422. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  21423. }));
  21424. return expandedClasses;
  21425. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.klass)});
  21426. },
  21427. args: ["classes"],
  21428. 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",
  21429. referencedClasses: ["ClassSorterNode", "Array"],
  21430. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  21431. }),
  21432. $globals.Package.klass);
  21433. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  21434. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  21435. $core.addMethod(
  21436. $core.method({
  21437. selector: "announcer",
  21438. protocol: "accessing",
  21439. fn: function (){
  21440. var self=this;
  21441. return $core.withContext(function($ctx1) {
  21442. return $recv($globals.SystemAnnouncer)._current();
  21443. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  21444. },
  21445. args: [],
  21446. source: "announcer\x0a\x09^ SystemAnnouncer current",
  21447. referencedClasses: ["SystemAnnouncer"],
  21448. messageSends: ["current"]
  21449. }),
  21450. $globals.PackageStateObserver);
  21451. $core.addMethod(
  21452. $core.method({
  21453. selector: "observeSystem",
  21454. protocol: "actions",
  21455. fn: function (){
  21456. var self=this;
  21457. return $core.withContext(function($ctx1) {
  21458. var $1;
  21459. $1=self._announcer();
  21460. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  21461. $ctx1.sendIdx["on:send:to:"]=1;
  21462. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  21463. $ctx1.sendIdx["on:send:to:"]=2;
  21464. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  21465. $ctx1.sendIdx["on:send:to:"]=3;
  21466. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  21467. return self;
  21468. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  21469. },
  21470. args: [],
  21471. 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",
  21472. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  21473. messageSends: ["on:send:to:", "announcer"]
  21474. }),
  21475. $globals.PackageStateObserver);
  21476. $core.addMethod(
  21477. $core.method({
  21478. selector: "onClassModification:",
  21479. protocol: "reactions",
  21480. fn: function (anAnnouncement){
  21481. var self=this;
  21482. return $core.withContext(function($ctx1) {
  21483. var $1,$receiver;
  21484. $1=$recv(anAnnouncement)._theClass();
  21485. if(($receiver = $1) == null || $receiver.isNil){
  21486. $1;
  21487. } else {
  21488. var theClass;
  21489. theClass=$receiver;
  21490. $recv($recv(theClass)._package())._beDirty();
  21491. }
  21492. return self;
  21493. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  21494. },
  21495. args: ["anAnnouncement"],
  21496. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  21497. referencedClasses: [],
  21498. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  21499. }),
  21500. $globals.PackageStateObserver);
  21501. $core.addMethod(
  21502. $core.method({
  21503. selector: "onMethodModification:",
  21504. protocol: "reactions",
  21505. fn: function (anAnnouncement){
  21506. var self=this;
  21507. return $core.withContext(function($ctx1) {
  21508. var $1,$receiver;
  21509. $1=$recv($recv(anAnnouncement)._method())._package();
  21510. if(($receiver = $1) == null || $receiver.isNil){
  21511. $1;
  21512. } else {
  21513. var package_;
  21514. package_=$receiver;
  21515. $recv(package_)._beDirty();
  21516. }
  21517. return self;
  21518. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  21519. },
  21520. args: ["anAnnouncement"],
  21521. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  21522. referencedClasses: [],
  21523. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  21524. }),
  21525. $globals.PackageStateObserver);
  21526. $core.addMethod(
  21527. $core.method({
  21528. selector: "onPackageAdded:",
  21529. protocol: "reactions",
  21530. fn: function (anAnnouncement){
  21531. var self=this;
  21532. return $core.withContext(function($ctx1) {
  21533. $recv($recv(anAnnouncement)._package())._beDirty();
  21534. return self;
  21535. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  21536. },
  21537. args: ["anAnnouncement"],
  21538. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  21539. referencedClasses: [],
  21540. messageSends: ["beDirty", "package"]
  21541. }),
  21542. $globals.PackageStateObserver);
  21543. $core.addMethod(
  21544. $core.method({
  21545. selector: "onProtocolModification:",
  21546. protocol: "reactions",
  21547. fn: function (anAnnouncement){
  21548. var self=this;
  21549. return $core.withContext(function($ctx1) {
  21550. var $1,$receiver;
  21551. $1=$recv(anAnnouncement)._package();
  21552. if(($receiver = $1) == null || $receiver.isNil){
  21553. $1;
  21554. } else {
  21555. var package_;
  21556. package_=$receiver;
  21557. $recv(package_)._beDirty();
  21558. }
  21559. return self;
  21560. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  21561. },
  21562. args: ["anAnnouncement"],
  21563. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  21564. referencedClasses: [],
  21565. messageSends: ["ifNotNil:", "package", "beDirty"]
  21566. }),
  21567. $globals.PackageStateObserver);
  21568. $globals.PackageStateObserver.klass.iVarNames = ["current"];
  21569. $core.addMethod(
  21570. $core.method({
  21571. selector: "current",
  21572. protocol: "accessing",
  21573. fn: function (){
  21574. var self=this;
  21575. return $core.withContext(function($ctx1) {
  21576. var $1,$receiver;
  21577. $1=self["@current"];
  21578. if(($receiver = $1) == null || $receiver.isNil){
  21579. self["@current"]=self._new();
  21580. return self["@current"];
  21581. } else {
  21582. return $1;
  21583. }
  21584. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.klass)});
  21585. },
  21586. args: [],
  21587. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  21588. referencedClasses: [],
  21589. messageSends: ["ifNil:", "new"]
  21590. }),
  21591. $globals.PackageStateObserver.klass);
  21592. $core.addMethod(
  21593. $core.method({
  21594. selector: "initialize",
  21595. protocol: "initialization",
  21596. fn: function (){
  21597. var self=this;
  21598. return $core.withContext(function($ctx1) {
  21599. $recv(self._current())._observeSystem();
  21600. return self;
  21601. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.klass)});
  21602. },
  21603. args: [],
  21604. source: "initialize\x0a\x09self current observeSystem",
  21605. referencedClasses: [],
  21606. messageSends: ["observeSystem", "current"]
  21607. }),
  21608. $globals.PackageStateObserver.klass);
  21609. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  21610. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  21611. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  21612. $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`";
  21613. $core.addMethod(
  21614. $core.method({
  21615. selector: "defaultValue",
  21616. protocol: "accessing",
  21617. fn: function (){
  21618. var self=this;
  21619. return self["@defaultValue"];
  21620. },
  21621. args: [],
  21622. source: "defaultValue\x0a\x09^ defaultValue",
  21623. referencedClasses: [],
  21624. messageSends: []
  21625. }),
  21626. $globals.Setting);
  21627. $core.addMethod(
  21628. $core.method({
  21629. selector: "defaultValue:",
  21630. protocol: "accessing",
  21631. fn: function (aStringifiableObject){
  21632. var self=this;
  21633. self["@defaultValue"]=aStringifiableObject;
  21634. return self;
  21635. },
  21636. args: ["aStringifiableObject"],
  21637. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  21638. referencedClasses: [],
  21639. messageSends: []
  21640. }),
  21641. $globals.Setting);
  21642. $core.addMethod(
  21643. $core.method({
  21644. selector: "key",
  21645. protocol: "accessing",
  21646. fn: function (){
  21647. var self=this;
  21648. return self["@key"];
  21649. },
  21650. args: [],
  21651. source: "key\x0a\x09^ key",
  21652. referencedClasses: [],
  21653. messageSends: []
  21654. }),
  21655. $globals.Setting);
  21656. $core.addMethod(
  21657. $core.method({
  21658. selector: "key:",
  21659. protocol: "accessing",
  21660. fn: function (aString){
  21661. var self=this;
  21662. self["@key"]=aString;
  21663. return self;
  21664. },
  21665. args: ["aString"],
  21666. source: "key: aString\x0a\x09key := aString",
  21667. referencedClasses: [],
  21668. messageSends: []
  21669. }),
  21670. $globals.Setting);
  21671. $core.addMethod(
  21672. $core.method({
  21673. selector: "value",
  21674. protocol: "accessing",
  21675. fn: function (){
  21676. var self=this;
  21677. return $core.withContext(function($ctx1) {
  21678. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_(self._key(),(function(){
  21679. return $core.withContext(function($ctx2) {
  21680. return self._defaultValue();
  21681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21682. }));
  21683. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  21684. },
  21685. args: [],
  21686. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  21687. referencedClasses: ["Smalltalk"],
  21688. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  21689. }),
  21690. $globals.Setting);
  21691. $core.addMethod(
  21692. $core.method({
  21693. selector: "value:",
  21694. protocol: "accessing",
  21695. fn: function (aStringifiableObject){
  21696. var self=this;
  21697. return $core.withContext(function($ctx1) {
  21698. return $recv($recv($globals.Smalltalk)._settings())._at_put_(self._key(),aStringifiableObject);
  21699. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  21700. },
  21701. args: ["aStringifiableObject"],
  21702. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  21703. referencedClasses: ["Smalltalk"],
  21704. messageSends: ["at:put:", "settings", "key"]
  21705. }),
  21706. $globals.Setting);
  21707. $core.addMethod(
  21708. $core.method({
  21709. selector: "at:ifAbsent:",
  21710. protocol: "instance creation",
  21711. fn: function (aString,aDefaultValue){
  21712. var self=this;
  21713. return $core.withContext(function($ctx1) {
  21714. var $1;
  21715. $1=(
  21716. $ctx1.supercall = true,
  21717. ($globals.Setting.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  21718. $ctx1.supercall = false;
  21719. $recv($1)._key_(aString);
  21720. $recv($1)._defaultValue_(aDefaultValue);
  21721. return $recv($1)._yourself();
  21722. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.klass)});
  21723. },
  21724. args: ["aString", "aDefaultValue"],
  21725. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  21726. referencedClasses: [],
  21727. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  21728. }),
  21729. $globals.Setting.klass);
  21730. $core.addMethod(
  21731. $core.method({
  21732. selector: "new",
  21733. protocol: "instance creation",
  21734. fn: function (){
  21735. var self=this;
  21736. return $core.withContext(function($ctx1) {
  21737. self._shouldNotImplement();
  21738. return self;
  21739. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.klass)});
  21740. },
  21741. args: [],
  21742. source: "new\x0a\x09self shouldNotImplement",
  21743. referencedClasses: [],
  21744. messageSends: ["shouldNotImplement"]
  21745. }),
  21746. $globals.Setting.klass);
  21747. $core.addClass("SmalltalkImage", $globals.Object, [], "Kernel-Infrastructure");
  21748. $globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `$core` declared in `support/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with global variable `Smalltalk`.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#globals #at:` answers a specific global (usually, a class) or `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `support/parser.js` parser file in order to work.";
  21749. $core.addMethod(
  21750. $core.method({
  21751. selector: "addGlobalJsVariable:",
  21752. protocol: "globals",
  21753. fn: function (aString){
  21754. var self=this;
  21755. return $core.withContext(function($ctx1) {
  21756. $recv(self._globalJsVariables())._add_(aString);
  21757. return self;
  21758. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  21759. },
  21760. args: ["aString"],
  21761. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  21762. referencedClasses: [],
  21763. messageSends: ["add:", "globalJsVariables"]
  21764. }),
  21765. $globals.SmalltalkImage);
  21766. $core.addMethod(
  21767. $core.method({
  21768. selector: "amdRequire",
  21769. protocol: "accessing amd",
  21770. fn: function (){
  21771. var self=this;
  21772. return $core.withContext(function($ctx1) {
  21773. return $recv(self._core())._at_("amdRequire");
  21774. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  21775. },
  21776. args: [],
  21777. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  21778. referencedClasses: [],
  21779. messageSends: ["at:", "core"]
  21780. }),
  21781. $globals.SmalltalkImage);
  21782. $core.addMethod(
  21783. $core.method({
  21784. selector: "asSmalltalkException:",
  21785. protocol: "error handling",
  21786. fn: function (anObject){
  21787. var self=this;
  21788. return $core.withContext(function($ctx1) {
  21789. var $1;
  21790. $1=$recv(self._isSmalltalkObject_(anObject))._and_((function(){
  21791. return $core.withContext(function($ctx2) {
  21792. return $recv(anObject)._isKindOf_($globals.Error);
  21793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21794. }));
  21795. if($core.assert($1)){
  21796. return anObject;
  21797. } else {
  21798. return $recv($globals.JavaScriptException)._on_(anObject);
  21799. }
  21800. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  21801. },
  21802. args: ["anObject"],
  21803. 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 ]",
  21804. referencedClasses: ["Error", "JavaScriptException"],
  21805. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  21806. }),
  21807. $globals.SmalltalkImage);
  21808. $core.addMethod(
  21809. $core.method({
  21810. selector: "basicCreatePackage:",
  21811. protocol: "private",
  21812. fn: function (packageName){
  21813. var self=this;
  21814. return $core.withContext(function($ctx1) {
  21815. return $core.addPackage(packageName);
  21816. return self;
  21817. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  21818. },
  21819. args: ["packageName"],
  21820. source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09<inlineJS: 'return $core.addPackage(packageName)'>",
  21821. referencedClasses: [],
  21822. messageSends: []
  21823. }),
  21824. $globals.SmalltalkImage);
  21825. $core.addMethod(
  21826. $core.method({
  21827. selector: "basicParse:",
  21828. protocol: "private",
  21829. fn: function (aString){
  21830. var self=this;
  21831. return $core.withContext(function($ctx1) {
  21832. return $recv($globals.SmalltalkParser)._parse_(aString);
  21833. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  21834. },
  21835. args: ["aString"],
  21836. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  21837. referencedClasses: ["SmalltalkParser"],
  21838. messageSends: ["parse:"]
  21839. }),
  21840. $globals.SmalltalkImage);
  21841. $core.addMethod(
  21842. $core.method({
  21843. selector: "basicRegisterPackage:",
  21844. protocol: "private",
  21845. fn: function (aPackage){
  21846. var self=this;
  21847. return $core.withContext(function($ctx1) {
  21848. $core.packages[aPackage.pkgName]=aPackage;
  21849. return self;
  21850. }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)});
  21851. },
  21852. args: ["aPackage"],
  21853. source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<inlineJS: '$core.packages[aPackage.pkgName]=aPackage'>",
  21854. referencedClasses: [],
  21855. messageSends: []
  21856. }),
  21857. $globals.SmalltalkImage);
  21858. $core.addMethod(
  21859. $core.method({
  21860. selector: "cancelOptOut:",
  21861. protocol: "accessing",
  21862. fn: function (anObject){
  21863. var self=this;
  21864. return $core.withContext(function($ctx1) {
  21865. delete anObject.klass;
  21866. return self;
  21867. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  21868. },
  21869. args: ["anObject"],
  21870. source: "cancelOptOut: anObject\x0a\x09\x22A Smalltalk object has a 'klass' 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'>",
  21871. referencedClasses: [],
  21872. messageSends: []
  21873. }),
  21874. $globals.SmalltalkImage);
  21875. $core.addMethod(
  21876. $core.method({
  21877. selector: "classes",
  21878. protocol: "classes",
  21879. fn: function (){
  21880. var self=this;
  21881. return $core.withContext(function($ctx1) {
  21882. return $core.classes();
  21883. return self;
  21884. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  21885. },
  21886. args: [],
  21887. source: "classes\x0a\x09<inlineJS: 'return $core.classes()'>",
  21888. referencedClasses: [],
  21889. messageSends: []
  21890. }),
  21891. $globals.SmalltalkImage);
  21892. $core.addMethod(
  21893. $core.method({
  21894. selector: "core",
  21895. protocol: "accessing",
  21896. fn: function (){
  21897. var self=this;
  21898. return $core.withContext(function($ctx1) {
  21899. return $core;
  21900. return self;
  21901. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  21902. },
  21903. args: [],
  21904. source: "core\x0a\x09<inlineJS: 'return $core'>",
  21905. referencedClasses: [],
  21906. messageSends: []
  21907. }),
  21908. $globals.SmalltalkImage);
  21909. $core.addMethod(
  21910. $core.method({
  21911. selector: "createPackage:",
  21912. protocol: "packages",
  21913. fn: function (packageName){
  21914. var self=this;
  21915. var package_,announcement;
  21916. return $core.withContext(function($ctx1) {
  21917. var $1;
  21918. package_=self._basicCreatePackage_(packageName);
  21919. $1=$recv($globals.PackageAdded)._new();
  21920. $recv($1)._package_(package_);
  21921. announcement=$recv($1)._yourself();
  21922. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  21923. return package_;
  21924. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  21925. },
  21926. args: ["packageName"],
  21927. 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",
  21928. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  21929. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  21930. }),
  21931. $globals.SmalltalkImage);
  21932. $core.addMethod(
  21933. $core.method({
  21934. selector: "defaultAmdNamespace",
  21935. protocol: "accessing amd",
  21936. fn: function (){
  21937. var self=this;
  21938. return $core.withContext(function($ctx1) {
  21939. return "transport.defaultAmdNamespace"._settingValue();
  21940. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  21941. },
  21942. args: [],
  21943. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  21944. referencedClasses: [],
  21945. messageSends: ["settingValue"]
  21946. }),
  21947. $globals.SmalltalkImage);
  21948. $core.addMethod(
  21949. $core.method({
  21950. selector: "defaultAmdNamespace:",
  21951. protocol: "accessing amd",
  21952. fn: function (aString){
  21953. var self=this;
  21954. return $core.withContext(function($ctx1) {
  21955. "transport.defaultAmdNamespace"._settingValue_(aString);
  21956. return self;
  21957. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  21958. },
  21959. args: ["aString"],
  21960. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  21961. referencedClasses: [],
  21962. messageSends: ["settingValue:"]
  21963. }),
  21964. $globals.SmalltalkImage);
  21965. $core.addMethod(
  21966. $core.method({
  21967. selector: "deleteClass:",
  21968. protocol: "private",
  21969. fn: function (aClass){
  21970. var self=this;
  21971. return $core.withContext(function($ctx1) {
  21972. $core.removeClass(aClass);
  21973. return self;
  21974. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  21975. },
  21976. args: ["aClass"],
  21977. 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)'>",
  21978. referencedClasses: [],
  21979. messageSends: []
  21980. }),
  21981. $globals.SmalltalkImage);
  21982. $core.addMethod(
  21983. $core.method({
  21984. selector: "deleteGlobalJsVariable:",
  21985. protocol: "globals",
  21986. fn: function (aString){
  21987. var self=this;
  21988. return $core.withContext(function($ctx1) {
  21989. $recv(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  21990. }));
  21991. return self;
  21992. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  21993. },
  21994. args: ["aString"],
  21995. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  21996. referencedClasses: [],
  21997. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  21998. }),
  21999. $globals.SmalltalkImage);
  22000. $core.addMethod(
  22001. $core.method({
  22002. selector: "deletePackage:",
  22003. protocol: "private",
  22004. fn: function (packageName){
  22005. var self=this;
  22006. return $core.withContext(function($ctx1) {
  22007. delete $core.packages[packageName];
  22008. return self;
  22009. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  22010. },
  22011. args: ["packageName"],
  22012. source: "deletePackage: packageName\x0a\x09\x22Deletes a package by deleting its binding, but does not check if it contains classes etc.\x0a\x09To remove a package, use #removePackage instead.\x22\x0a\x0a\x09<inlineJS: 'delete $core.packages[packageName]'>",
  22013. referencedClasses: [],
  22014. messageSends: []
  22015. }),
  22016. $globals.SmalltalkImage);
  22017. $core.addMethod(
  22018. $core.method({
  22019. selector: "existsJsGlobal:",
  22020. protocol: "testing",
  22021. fn: function (aString){
  22022. var self=this;
  22023. return $core.withContext(function($ctx1) {
  22024. return $recv($recv($globals.Platform)._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  22025. return true;
  22026. }),(function(){
  22027. return false;
  22028. }));
  22029. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  22030. },
  22031. args: ["aString"],
  22032. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  22033. referencedClasses: ["Platform"],
  22034. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  22035. }),
  22036. $globals.SmalltalkImage);
  22037. $core.addMethod(
  22038. $core.method({
  22039. selector: "globalJsVariables",
  22040. protocol: "globals",
  22041. fn: function (){
  22042. var self=this;
  22043. return $core.withContext(function($ctx1) {
  22044. return $core.globalJsVariables;
  22045. return self;
  22046. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  22047. },
  22048. args: [],
  22049. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<inlineJS: 'return $core.globalJsVariables'>",
  22050. referencedClasses: [],
  22051. messageSends: []
  22052. }),
  22053. $globals.SmalltalkImage);
  22054. $core.addMethod(
  22055. $core.method({
  22056. selector: "globals",
  22057. protocol: "accessing",
  22058. fn: function (){
  22059. var self=this;
  22060. return $core.withContext(function($ctx1) {
  22061. return $globals;
  22062. return self;
  22063. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  22064. },
  22065. args: [],
  22066. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  22067. referencedClasses: [],
  22068. messageSends: []
  22069. }),
  22070. $globals.SmalltalkImage);
  22071. $core.addMethod(
  22072. $core.method({
  22073. selector: "includesKey:",
  22074. protocol: "accessing",
  22075. fn: function (aKey){
  22076. var self=this;
  22077. return $core.withContext(function($ctx1) {
  22078. return $core.hasOwnProperty(aKey);
  22079. return self;
  22080. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  22081. },
  22082. args: ["aKey"],
  22083. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  22084. referencedClasses: [],
  22085. messageSends: []
  22086. }),
  22087. $globals.SmalltalkImage);
  22088. $core.addMethod(
  22089. $core.method({
  22090. selector: "isSmalltalkObject:",
  22091. protocol: "testing",
  22092. fn: function (anObject){
  22093. var self=this;
  22094. return $core.withContext(function($ctx1) {
  22095. return anObject.klass != null;
  22096. return self;
  22097. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  22098. },
  22099. args: ["anObject"],
  22100. source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'klass' property.\x0a\x09Note that this may be unaccurate\x22\x0a\x09\x0a\x09<inlineJS: 'return anObject.klass != null'>",
  22101. referencedClasses: [],
  22102. messageSends: []
  22103. }),
  22104. $globals.SmalltalkImage);
  22105. $core.addMethod(
  22106. $core.method({
  22107. selector: "optOut:",
  22108. protocol: "accessing",
  22109. fn: function (anObject){
  22110. var self=this;
  22111. return $core.withContext(function($ctx1) {
  22112. anObject.klass = null;
  22113. return self;
  22114. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  22115. },
  22116. args: ["anObject"],
  22117. source: "optOut: anObject\x0a\x09\x22A Smalltalk object has a 'klass' 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'>",
  22118. referencedClasses: [],
  22119. messageSends: []
  22120. }),
  22121. $globals.SmalltalkImage);
  22122. $core.addMethod(
  22123. $core.method({
  22124. selector: "packageAt:",
  22125. protocol: "packages",
  22126. fn: function (packageName){
  22127. var self=this;
  22128. return $core.withContext(function($ctx1) {
  22129. return $core.packages[packageName];
  22130. return self;
  22131. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  22132. },
  22133. args: ["packageName"],
  22134. source: "packageAt: packageName\x0a\x09<inlineJS: 'return $core.packages[packageName]'>",
  22135. referencedClasses: [],
  22136. messageSends: []
  22137. }),
  22138. $globals.SmalltalkImage);
  22139. $core.addMethod(
  22140. $core.method({
  22141. selector: "packageAt:ifAbsent:",
  22142. protocol: "packages",
  22143. fn: function (packageName,aBlock){
  22144. var self=this;
  22145. return $core.withContext(function($ctx1) {
  22146. var $1;
  22147. $1=self._packageAt_(packageName);
  22148. return $recv($1)._ifNil_(aBlock);
  22149. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  22150. },
  22151. args: ["packageName", "aBlock"],
  22152. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  22153. referencedClasses: [],
  22154. messageSends: ["ifNil:", "packageAt:"]
  22155. }),
  22156. $globals.SmalltalkImage);
  22157. $core.addMethod(
  22158. $core.method({
  22159. selector: "packages",
  22160. protocol: "packages",
  22161. fn: function (){
  22162. var self=this;
  22163. return $core.withContext(function($ctx1) {
  22164. return Object.keys($core.packages).map(function(k) {
  22165. return $core.packages[k];
  22166. })
  22167. ;
  22168. return self;
  22169. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  22170. },
  22171. args: [],
  22172. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<inlineJS: '\x0a\x09\x09return Object.keys($core.packages).map(function(k) {\x0a\x09\x09\x09return $core.packages[k];\x0a\x09\x09})\x0a\x09'>",
  22173. referencedClasses: [],
  22174. messageSends: []
  22175. }),
  22176. $globals.SmalltalkImage);
  22177. $core.addMethod(
  22178. $core.method({
  22179. selector: "parse:",
  22180. protocol: "accessing",
  22181. fn: function (aString){
  22182. var self=this;
  22183. var result;
  22184. return $core.withContext(function($ctx1) {
  22185. var $1;
  22186. $recv((function(){
  22187. return $core.withContext(function($ctx2) {
  22188. result=self._basicParse_(aString);
  22189. return result;
  22190. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22191. }))._tryCatch_((function(ex){
  22192. return $core.withContext(function($ctx2) {
  22193. return $recv(self._parseError_parsing_(ex,aString))._signal();
  22194. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  22195. }));
  22196. $1=result;
  22197. $recv($1)._source_(aString);
  22198. return $recv($1)._yourself();
  22199. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  22200. },
  22201. args: ["aString"],
  22202. 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",
  22203. referencedClasses: [],
  22204. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  22205. }),
  22206. $globals.SmalltalkImage);
  22207. $core.addMethod(
  22208. $core.method({
  22209. selector: "parseError:parsing:",
  22210. protocol: "error handling",
  22211. fn: function (anException,aString){
  22212. var self=this;
  22213. return $core.withContext(function($ctx1) {
  22214. var $1,$7,$6,$5,$8,$4,$3,$2;
  22215. $1=$recv($globals.ParseError)._new();
  22216. $7=$recv(anException)._basicAt_("line");
  22217. $ctx1.sendIdx["basicAt:"]=1;
  22218. $6="Parse error on line ".__comma($7);
  22219. $5=$recv($6).__comma(" column ");
  22220. $ctx1.sendIdx[","]=4;
  22221. $8=$recv(anException)._basicAt_("column");
  22222. $ctx1.sendIdx["basicAt:"]=2;
  22223. $4=$recv($5).__comma($8);
  22224. $ctx1.sendIdx[","]=3;
  22225. $3=$recv($4).__comma(" : Unexpected character ");
  22226. $ctx1.sendIdx[","]=2;
  22227. $2=$recv($3).__comma($recv(anException)._basicAt_("found"));
  22228. $ctx1.sendIdx[","]=1;
  22229. return $recv($1)._messageText_($2);
  22230. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  22231. },
  22232. args: ["anException", "aString"],
  22233. source: "parseError: anException parsing: aString\x0a\x09^ ParseError new messageText: 'Parse error on line ', (anException basicAt: 'line') ,' column ' , (anException basicAt: 'column') ,' : Unexpected character ', (anException basicAt: 'found')",
  22234. referencedClasses: ["ParseError"],
  22235. messageSends: ["messageText:", "new", ",", "basicAt:"]
  22236. }),
  22237. $globals.SmalltalkImage);
  22238. $core.addMethod(
  22239. $core.method({
  22240. selector: "pseudoVariableNames",
  22241. protocol: "accessing",
  22242. fn: function (){
  22243. var self=this;
  22244. return ["self", "super", "nil", "true", "false", "thisContext"];
  22245. },
  22246. args: [],
  22247. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  22248. referencedClasses: [],
  22249. messageSends: []
  22250. }),
  22251. $globals.SmalltalkImage);
  22252. $core.addMethod(
  22253. $core.method({
  22254. selector: "readJSObject:",
  22255. protocol: "accessing",
  22256. fn: function (anObject){
  22257. var self=this;
  22258. return $core.withContext(function($ctx1) {
  22259. return $core.readJSObject(anObject);
  22260. return self;
  22261. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  22262. },
  22263. args: ["anObject"],
  22264. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  22265. referencedClasses: [],
  22266. messageSends: []
  22267. }),
  22268. $globals.SmalltalkImage);
  22269. $core.addMethod(
  22270. $core.method({
  22271. selector: "removeClass:",
  22272. protocol: "classes",
  22273. fn: function (aClass){
  22274. var self=this;
  22275. return $core.withContext(function($ctx1) {
  22276. var $1,$2,$5,$4,$6,$3,$7,$9,$8;
  22277. $1=$recv(aClass)._isMetaclass();
  22278. if($core.assert($1)){
  22279. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  22280. $ctx1.sendIdx[","]=1;
  22281. self._error_($2);
  22282. $ctx1.sendIdx["error:"]=1;
  22283. }
  22284. $recv(aClass)._allSubclassesDo_((function(subclass){
  22285. return $core.withContext(function($ctx2) {
  22286. $5=$recv(aClass)._name();
  22287. $ctx2.sendIdx["name"]=1;
  22288. $4=$recv($5).__comma(" has a subclass: ");
  22289. $ctx2.sendIdx[","]=3;
  22290. $6=$recv(subclass)._name();
  22291. $ctx2.sendIdx["name"]=2;
  22292. $3=$recv($4).__comma($6);
  22293. $ctx2.sendIdx[","]=2;
  22294. return self._error_($3);
  22295. $ctx2.sendIdx["error:"]=2;
  22296. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  22297. }));
  22298. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  22299. return $core.withContext(function($ctx2) {
  22300. return self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  22301. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  22302. }));
  22303. self._deleteClass_(aClass);
  22304. $recv(aClass)._setTraitComposition_([]);
  22305. $ctx1.sendIdx["setTraitComposition:"]=1;
  22306. $recv($recv(aClass)._class())._setTraitComposition_([]);
  22307. $7=$recv($globals.SystemAnnouncer)._current();
  22308. $9=$recv($globals.ClassRemoved)._new();
  22309. $recv($9)._theClass_(aClass);
  22310. $8=$recv($9)._yourself();
  22311. $recv($7)._announce_($8);
  22312. return self;
  22313. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  22314. },
  22315. args: ["aClass"],
  22316. 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 class setTraitComposition: #().\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  22317. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  22318. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "class", "announce:", "current", "theClass:", "new", "yourself"]
  22319. }),
  22320. $globals.SmalltalkImage);
  22321. $core.addMethod(
  22322. $core.method({
  22323. selector: "removePackage:",
  22324. protocol: "packages",
  22325. fn: function (packageName){
  22326. var self=this;
  22327. var pkg;
  22328. return $core.withContext(function($ctx1) {
  22329. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  22330. return $core.withContext(function($ctx2) {
  22331. return self._error_("Missing package: ".__comma(packageName));
  22332. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22333. }));
  22334. $recv($recv(pkg)._classes())._do_((function(each){
  22335. return $core.withContext(function($ctx2) {
  22336. return self._removeClass_(each);
  22337. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  22338. }));
  22339. self._deletePackage_(packageName);
  22340. return self;
  22341. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  22342. },
  22343. args: ["packageName"],
  22344. 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 deletePackage: packageName",
  22345. referencedClasses: [],
  22346. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  22347. }),
  22348. $globals.SmalltalkImage);
  22349. $core.addMethod(
  22350. $core.method({
  22351. selector: "renamePackage:to:",
  22352. protocol: "packages",
  22353. fn: function (packageName,newName){
  22354. var self=this;
  22355. var pkg;
  22356. return $core.withContext(function($ctx1) {
  22357. var $1,$2,$receiver;
  22358. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  22359. return $core.withContext(function($ctx2) {
  22360. $1="Missing package: ".__comma(packageName);
  22361. $ctx2.sendIdx[","]=1;
  22362. return self._error_($1);
  22363. $ctx2.sendIdx["error:"]=1;
  22364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22365. }));
  22366. $2=self._packageAt_(newName);
  22367. if(($receiver = $2) == null || $receiver.isNil){
  22368. $2;
  22369. } else {
  22370. self._error_("Already exists a package called: ".__comma(newName));
  22371. }
  22372. $recv(pkg)._name_(newName);
  22373. self._basicRegisterPackage_(pkg);
  22374. self._deletePackage_(packageName);
  22375. return self;
  22376. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  22377. },
  22378. args: ["packageName", "newName"],
  22379. 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\x09(self packageAt: newName) ifNotNil: [ self error: 'Already exists a package called: ', newName ].\x0a\x09pkg name: newName.\x0a\x09self basicRegisterPackage: pkg.\x0a\x09self deletePackage: packageName.",
  22380. referencedClasses: [],
  22381. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"]
  22382. }),
  22383. $globals.SmalltalkImage);
  22384. $core.addMethod(
  22385. $core.method({
  22386. selector: "reservedWords",
  22387. protocol: "accessing",
  22388. fn: function (){
  22389. var self=this;
  22390. return $core.withContext(function($ctx1) {
  22391. return $core.reservedWords;
  22392. return self;
  22393. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)});
  22394. },
  22395. args: [],
  22396. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<inlineJS: 'return $core.reservedWords'>",
  22397. referencedClasses: [],
  22398. messageSends: []
  22399. }),
  22400. $globals.SmalltalkImage);
  22401. $core.addMethod(
  22402. $core.method({
  22403. selector: "settings",
  22404. protocol: "accessing",
  22405. fn: function (){
  22406. var self=this;
  22407. return $globals.SmalltalkSettings;
  22408. },
  22409. args: [],
  22410. source: "settings\x0a\x09^ SmalltalkSettings",
  22411. referencedClasses: ["SmalltalkSettings"],
  22412. messageSends: []
  22413. }),
  22414. $globals.SmalltalkImage);
  22415. $core.addMethod(
  22416. $core.method({
  22417. selector: "version",
  22418. protocol: "accessing",
  22419. fn: function (){
  22420. var self=this;
  22421. return "0.18.3";
  22422. },
  22423. args: [],
  22424. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.18.3'",
  22425. referencedClasses: [],
  22426. messageSends: []
  22427. }),
  22428. $globals.SmalltalkImage);
  22429. $globals.SmalltalkImage.klass.iVarNames = ["current"];
  22430. $core.addMethod(
  22431. $core.method({
  22432. selector: "current",
  22433. protocol: "instance creation",
  22434. fn: function (){
  22435. var self=this;
  22436. return $core.withContext(function($ctx1) {
  22437. var $1,$receiver;
  22438. $1=self["@current"];
  22439. if(($receiver = $1) == null || $receiver.isNil){
  22440. self["@current"]=(
  22441. $ctx1.supercall = true,
  22442. ($globals.SmalltalkImage.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  22443. $ctx1.supercall = false;
  22444. return self["@current"];
  22445. } else {
  22446. self._deprecatedAPI();
  22447. return self["@current"];
  22448. }
  22449. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.klass)});
  22450. },
  22451. args: [],
  22452. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  22453. referencedClasses: [],
  22454. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  22455. }),
  22456. $globals.SmalltalkImage.klass);
  22457. $core.addMethod(
  22458. $core.method({
  22459. selector: "initialize",
  22460. protocol: "initialization",
  22461. fn: function (){
  22462. var self=this;
  22463. var st;
  22464. return $core.withContext(function($ctx1) {
  22465. st=self._current();
  22466. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  22467. return self;
  22468. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.klass)});
  22469. },
  22470. args: [],
  22471. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  22472. referencedClasses: [],
  22473. messageSends: ["current", "at:put:", "globals"]
  22474. }),
  22475. $globals.SmalltalkImage.klass);
  22476. $core.addMethod(
  22477. $core.method({
  22478. selector: "new",
  22479. protocol: "instance creation",
  22480. fn: function (){
  22481. var self=this;
  22482. return $core.withContext(function($ctx1) {
  22483. self._shouldNotImplement();
  22484. return self;
  22485. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.klass)});
  22486. },
  22487. args: [],
  22488. source: "new\x0a\x09self shouldNotImplement",
  22489. referencedClasses: [],
  22490. messageSends: ["shouldNotImplement"]
  22491. }),
  22492. $globals.SmalltalkImage.klass);
  22493. $core.addMethod(
  22494. $core.method({
  22495. selector: "asJavaScriptPropertyName",
  22496. protocol: "*Kernel-Infrastructure",
  22497. fn: function (){
  22498. var self=this;
  22499. return $core.withContext(function($ctx1) {
  22500. return $core.st2prop(self);
  22501. return self;
  22502. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  22503. },
  22504. args: [],
  22505. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  22506. referencedClasses: [],
  22507. messageSends: []
  22508. }),
  22509. $globals.String);
  22510. $core.addMethod(
  22511. $core.method({
  22512. selector: "asSetting",
  22513. protocol: "*Kernel-Infrastructure",
  22514. fn: function (){
  22515. var self=this;
  22516. return $core.withContext(function($ctx1) {
  22517. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  22518. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  22519. },
  22520. args: [],
  22521. 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",
  22522. referencedClasses: ["Setting"],
  22523. messageSends: ["at:ifAbsent:"]
  22524. }),
  22525. $globals.String);
  22526. $core.addMethod(
  22527. $core.method({
  22528. selector: "asSettingIfAbsent:",
  22529. protocol: "*Kernel-Infrastructure",
  22530. fn: function (aDefaultValue){
  22531. var self=this;
  22532. return $core.withContext(function($ctx1) {
  22533. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  22534. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  22535. },
  22536. args: ["aDefaultValue"],
  22537. 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",
  22538. referencedClasses: ["Setting"],
  22539. messageSends: ["at:ifAbsent:"]
  22540. }),
  22541. $globals.String);
  22542. $core.addMethod(
  22543. $core.method({
  22544. selector: "settingValue",
  22545. protocol: "*Kernel-Infrastructure",
  22546. fn: function (){
  22547. var self=this;
  22548. return $core.withContext(function($ctx1) {
  22549. return $recv(self._asSetting())._value();
  22550. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  22551. },
  22552. args: [],
  22553. source: "settingValue\x0a\x09^ self asSetting value",
  22554. referencedClasses: [],
  22555. messageSends: ["value", "asSetting"]
  22556. }),
  22557. $globals.String);
  22558. $core.addMethod(
  22559. $core.method({
  22560. selector: "settingValue:",
  22561. protocol: "*Kernel-Infrastructure",
  22562. fn: function (aValue){
  22563. var self=this;
  22564. return $core.withContext(function($ctx1) {
  22565. return $recv(self._asSetting())._value_(aValue);
  22566. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  22567. },
  22568. args: ["aValue"],
  22569. 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",
  22570. referencedClasses: [],
  22571. messageSends: ["value:", "asSetting"]
  22572. }),
  22573. $globals.String);
  22574. $core.addMethod(
  22575. $core.method({
  22576. selector: "settingValueIfAbsent:",
  22577. protocol: "*Kernel-Infrastructure",
  22578. fn: function (aDefaultValue){
  22579. var self=this;
  22580. return $core.withContext(function($ctx1) {
  22581. return $recv(self._asSettingIfAbsent_(aDefaultValue))._value();
  22582. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  22583. },
  22584. args: ["aDefaultValue"],
  22585. 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",
  22586. referencedClasses: [],
  22587. messageSends: ["value", "asSettingIfAbsent:"]
  22588. }),
  22589. $globals.String);
  22590. });
  22591. define('amber_core/Kernel-Promises',["amber/boot", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  22592. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  22593. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  22594. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  22595. $core.addPackage("Kernel-Promises");
  22596. $core.packages["Kernel-Promises"].innerEval = function (expr) { return eval(expr); };
  22597. $core.packages["Kernel-Promises"].transport = {"type":"amd","amdNamespace":"amber_core"};
  22598. $core.addClass("Thenable", $globals.Object, [], "Kernel-Promises");
  22599. $globals.Thenable.comment="I am the abstract base class for Promises.\x0a\x0aMy subclasses should wrap existing JS implementations.\x0a\x0aI contain methods that wrap Promises/A+ `.then` behaviour.";
  22600. $core.addMethod(
  22601. $core.method({
  22602. selector: "catch:",
  22603. protocol: "promises",
  22604. fn: function (aBlock){
  22605. var self=this;
  22606. return $core.withContext(function($ctx1) {
  22607. return self.then(null, function (err) {return $core.seamless(function () {
  22608. return aBlock._value_(err);
  22609. })});
  22610. return self;
  22611. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.Thenable)});
  22612. },
  22613. args: ["aBlock"],
  22614. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  22615. referencedClasses: [],
  22616. messageSends: []
  22617. }),
  22618. $globals.Thenable);
  22619. $core.addMethod(
  22620. $core.method({
  22621. selector: "on:do:",
  22622. protocol: "promises",
  22623. fn: function (aClass,aBlock){
  22624. var self=this;
  22625. return $core.withContext(function($ctx1) {
  22626. return self.then(null, function (err) {return $core.seamless(function () {
  22627. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  22628. else throw err;
  22629. })});
  22630. return self;
  22631. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Thenable)});
  22632. },
  22633. args: ["aClass", "aBlock"],
  22634. 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})})'>",
  22635. referencedClasses: [],
  22636. messageSends: []
  22637. }),
  22638. $globals.Thenable);
  22639. $core.addMethod(
  22640. $core.method({
  22641. selector: "on:do:catch:",
  22642. protocol: "promises",
  22643. fn: function (aClass,aBlock,anotherBlock){
  22644. var self=this;
  22645. return $core.withContext(function($ctx1) {
  22646. return self.then(null, function (err) {return $core.seamless(function () {
  22647. try { if (err._isKindOf_(aClass)) return aBlock._value_(err); } catch (e) { err = e; }
  22648. return anotherBlock._value_(err);
  22649. })});
  22650. return self;
  22651. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Thenable)});
  22652. },
  22653. args: ["aClass", "aBlock", "anotherBlock"],
  22654. source: "on: aClass do: aBlock catch: anotherBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a try { if (err._isKindOf_(aClass)) return aBlock._value_(err); } catch (e) { err = e; }\x0a return anotherBlock._value_(err);\x0a})})'>",
  22655. referencedClasses: [],
  22656. messageSends: []
  22657. }),
  22658. $globals.Thenable);
  22659. $core.addMethod(
  22660. $core.method({
  22661. selector: "then:",
  22662. protocol: "promises",
  22663. fn: function (aBlockOrArray){
  22664. var self=this;
  22665. return $core.withContext(function($ctx1) {
  22666. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  22667. return array.reduce(function (soFar, aBlock) {
  22668. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  22669. function (result) {return $core.seamless(function () {
  22670. if (Array.isArray(result)) {
  22671. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  22672. } else {
  22673. return aBlock._value_(result);
  22674. }
  22675. })} :
  22676. function (result) {return $core.seamless(function () {
  22677. return aBlock._value_(result);
  22678. })}
  22679. );
  22680. }, self);
  22681. return self;
  22682. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.Thenable)});
  22683. },
  22684. args: ["aBlockOrArray"],
  22685. 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)'>",
  22686. referencedClasses: [],
  22687. messageSends: []
  22688. }),
  22689. $globals.Thenable);
  22690. $core.addMethod(
  22691. $core.method({
  22692. selector: "then:catch:",
  22693. protocol: "promises",
  22694. fn: function (aBlockOrArray,anotherBlock){
  22695. var self=this;
  22696. return $core.withContext(function($ctx1) {
  22697. return $recv(self._then_(aBlockOrArray))._catch_(anotherBlock);
  22698. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.Thenable)});
  22699. },
  22700. args: ["aBlockOrArray", "anotherBlock"],
  22701. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  22702. referencedClasses: [],
  22703. messageSends: ["catch:", "then:"]
  22704. }),
  22705. $globals.Thenable);
  22706. $core.addMethod(
  22707. $core.method({
  22708. selector: "then:on:do:",
  22709. protocol: "promises",
  22710. fn: function (aBlockOrArray,aClass,aBlock){
  22711. var self=this;
  22712. return $core.withContext(function($ctx1) {
  22713. return $recv(self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  22714. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.Thenable)});
  22715. },
  22716. args: ["aBlockOrArray", "aClass", "aBlock"],
  22717. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  22718. referencedClasses: [],
  22719. messageSends: ["on:do:", "then:"]
  22720. }),
  22721. $globals.Thenable);
  22722. $core.addMethod(
  22723. $core.method({
  22724. selector: "then:on:do:catch:",
  22725. protocol: "promises",
  22726. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  22727. var self=this;
  22728. return $core.withContext(function($ctx1) {
  22729. return $recv($recv(self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  22730. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Thenable)});
  22731. },
  22732. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  22733. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  22734. referencedClasses: [],
  22735. messageSends: ["catch:", "on:do:", "then:"]
  22736. }),
  22737. $globals.Thenable);
  22738. $core.addClass("Promise", $globals.Thenable, [], "Kernel-Promises");
  22739. $core.addMethod(
  22740. $core.method({
  22741. selector: "all:",
  22742. protocol: "composites",
  22743. fn: function (aCollection){
  22744. var self=this;
  22745. return $core.withContext(function($ctx1) {
  22746. return Promise.all($recv(aCollection)._asArray());
  22747. return self;
  22748. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.klass)});
  22749. },
  22750. args: ["aCollection"],
  22751. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  22752. referencedClasses: [],
  22753. messageSends: []
  22754. }),
  22755. $globals.Promise.klass);
  22756. $core.addMethod(
  22757. $core.method({
  22758. selector: "any:",
  22759. protocol: "composites",
  22760. fn: function (aCollection){
  22761. var self=this;
  22762. return $core.withContext(function($ctx1) {
  22763. return Promise.race($recv(aCollection)._asArray());
  22764. return self;
  22765. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.klass)});
  22766. },
  22767. args: ["aCollection"],
  22768. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  22769. referencedClasses: [],
  22770. messageSends: []
  22771. }),
  22772. $globals.Promise.klass);
  22773. $core.addMethod(
  22774. $core.method({
  22775. selector: "forBlock:",
  22776. protocol: "instance creation",
  22777. fn: function (aBlock){
  22778. var self=this;
  22779. return $core.withContext(function($ctx1) {
  22780. return $recv(self._new())._then_(aBlock);
  22781. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.klass)});
  22782. },
  22783. args: ["aBlock"],
  22784. 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",
  22785. referencedClasses: [],
  22786. messageSends: ["then:", "new"]
  22787. }),
  22788. $globals.Promise.klass);
  22789. $core.addMethod(
  22790. $core.method({
  22791. selector: "new",
  22792. protocol: "instance creation",
  22793. fn: function (){
  22794. var self=this;
  22795. return $core.withContext(function($ctx1) {
  22796. return Promise.resolve();
  22797. return self;
  22798. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.klass)});
  22799. },
  22800. args: [],
  22801. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  22802. referencedClasses: [],
  22803. messageSends: []
  22804. }),
  22805. $globals.Promise.klass);
  22806. $core.addMethod(
  22807. $core.method({
  22808. selector: "new:",
  22809. protocol: "instance creation",
  22810. fn: function (aBlock){
  22811. var self=this;
  22812. return $core.withContext(function($ctx1) {
  22813. return new Promise(function (resolve, reject) {
  22814. var model = {value: resolve, signal: reject}; // TODO make faster
  22815. aBlock._value_(model);
  22816. });
  22817. return self;
  22818. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.klass)});
  22819. },
  22820. args: ["aBlock"],
  22821. source: "new: aBlock\x0a\x22Returns a Promise that is eventually resolved or rejected.\x0aPass a block that is called with one argument, model.\x0aYou should call model value: ... to resolve the promise\x0aand model signal: ... to reject the promise.\x0aIf error happens during run of the block,\x0apromise is rejected with that error as well.\x22\x0a<inlineJS: 'return new Promise(function (resolve, reject) {\x0a var model = {value: resolve, signal: reject}; // TODO make faster\x0a aBlock._value_(model);\x0a})'>",
  22822. referencedClasses: [],
  22823. messageSends: []
  22824. }),
  22825. $globals.Promise.klass);
  22826. $core.addMethod(
  22827. $core.method({
  22828. selector: "signal:",
  22829. protocol: "instance creation",
  22830. fn: function (anObject){
  22831. var self=this;
  22832. return $core.withContext(function($ctx1) {
  22833. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  22834. return self;
  22835. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.klass)});
  22836. },
  22837. args: ["anObject"],
  22838. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  22839. referencedClasses: [],
  22840. messageSends: []
  22841. }),
  22842. $globals.Promise.klass);
  22843. $core.addMethod(
  22844. $core.method({
  22845. selector: "value:",
  22846. protocol: "instance creation",
  22847. fn: function (anObject){
  22848. var self=this;
  22849. return $core.withContext(function($ctx1) {
  22850. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  22851. return self;
  22852. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.klass)});
  22853. },
  22854. args: ["anObject"],
  22855. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  22856. referencedClasses: [],
  22857. messageSends: []
  22858. }),
  22859. $globals.Promise.klass);
  22860. $core.addMethod(
  22861. $core.method({
  22862. selector: "catch:",
  22863. protocol: "*Kernel-Promises",
  22864. fn: function (aBlock){
  22865. var self=this;
  22866. return $core.withContext(function($ctx1) {
  22867. var js = self["@jsObject"];
  22868. if (typeof js.then === "function")
  22869. return $globals.Thenable.fn.prototype._catch_.call(js, aBlock);
  22870. else
  22871. return self._doesNotUnderstand_(
  22872. $globals.Message._new()
  22873. ._selector_("catch:")
  22874. ._arguments_([aBlock])
  22875. );
  22876. return self;
  22877. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  22878. },
  22879. args: ["aBlock"],
  22880. source: "catch: aBlock\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._catch_.call(js, aBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22catch:\x22)\x0a ._arguments_([aBlock])\x0a )'>",
  22881. referencedClasses: [],
  22882. messageSends: []
  22883. }),
  22884. $globals.JSObjectProxy);
  22885. $core.addMethod(
  22886. $core.method({
  22887. selector: "on:do:",
  22888. protocol: "*Kernel-Promises",
  22889. fn: function (aClass,aBlock){
  22890. var self=this;
  22891. return $core.withContext(function($ctx1) {
  22892. var js = self["@jsObject"];
  22893. if (typeof js.then === "function")
  22894. return $globals.Thenable.fn.prototype._on_do_.call(js, aClass, aBlock);
  22895. else
  22896. return self._doesNotUnderstand_(
  22897. $globals.Message._new()
  22898. ._selector_("on:do:")
  22899. ._arguments_([aClass, aBlock])
  22900. );
  22901. return self;
  22902. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  22903. },
  22904. args: ["aClass", "aBlock"],
  22905. source: "on: aClass do: aBlock\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._on_do_.call(js, aClass, aBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22on:do:\x22)\x0a ._arguments_([aClass, aBlock])\x0a )'>",
  22906. referencedClasses: [],
  22907. messageSends: []
  22908. }),
  22909. $globals.JSObjectProxy);
  22910. $core.addMethod(
  22911. $core.method({
  22912. selector: "on:do:catch:",
  22913. protocol: "*Kernel-Promises",
  22914. fn: function (aClass,aBlock,anotherBlock){
  22915. var self=this;
  22916. return $core.withContext(function($ctx1) {
  22917. var js = self["@jsObject"];
  22918. if (typeof js.then === "function")
  22919. return $globals.Thenable.fn.prototype._on_do_catch_.call(js, aClass, aBlock, anotherBlock);
  22920. else
  22921. return self._doesNotUnderstand_(
  22922. $globals.Message._new()
  22923. ._selector_("on:do:catch:")
  22924. ._arguments_([aClass, aBlock, anotherBlock])
  22925. );
  22926. return self;
  22927. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  22928. },
  22929. args: ["aClass", "aBlock", "anotherBlock"],
  22930. source: "on: aClass do: aBlock catch: anotherBlock\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._on_do_catch_.call(js, aClass, aBlock, anotherBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22on:do:catch:\x22)\x0a ._arguments_([aClass, aBlock, anotherBlock])\x0a )'>",
  22931. referencedClasses: [],
  22932. messageSends: []
  22933. }),
  22934. $globals.JSObjectProxy);
  22935. $core.addMethod(
  22936. $core.method({
  22937. selector: "then:",
  22938. protocol: "*Kernel-Promises",
  22939. fn: function (aBlockOrArray){
  22940. var self=this;
  22941. return $core.withContext(function($ctx1) {
  22942. var js = self["@jsObject"];
  22943. if (typeof js.then === "function")
  22944. return $globals.Thenable.fn.prototype._then_.call(js, aBlockOrArray);
  22945. else
  22946. return self._doesNotUnderstand_(
  22947. $globals.Message._new()
  22948. ._selector_("then:")
  22949. ._arguments_([aBlockOrArray])
  22950. );
  22951. return self;
  22952. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  22953. },
  22954. args: ["aBlockOrArray"],
  22955. source: "then: aBlockOrArray\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_.call(js, aBlockOrArray);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:\x22)\x0a ._arguments_([aBlockOrArray])\x0a )'>",
  22956. referencedClasses: [],
  22957. messageSends: []
  22958. }),
  22959. $globals.JSObjectProxy);
  22960. $core.addMethod(
  22961. $core.method({
  22962. selector: "then:catch:",
  22963. protocol: "*Kernel-Promises",
  22964. fn: function (aBlockOrArray,anotherBlock){
  22965. var self=this;
  22966. return $core.withContext(function($ctx1) {
  22967. var js = self["@jsObject"];
  22968. if (typeof js.then === "function")
  22969. return $globals.Thenable.fn.prototype._then_catch_.call(js, aBlockOrArray, anotherBlock);
  22970. else
  22971. return self._doesNotUnderstand_(
  22972. $globals.Message._new()
  22973. ._selector_("then:catch:")
  22974. ._arguments_([aBlockOrArray, anotherBlock])
  22975. );
  22976. return self;
  22977. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  22978. },
  22979. args: ["aBlockOrArray", "anotherBlock"],
  22980. source: "then: aBlockOrArray catch: anotherBlock\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_catch_.call(js, aBlockOrArray, anotherBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:catch:\x22)\x0a ._arguments_([aBlockOrArray, anotherBlock])\x0a )'>",
  22981. referencedClasses: [],
  22982. messageSends: []
  22983. }),
  22984. $globals.JSObjectProxy);
  22985. $core.addMethod(
  22986. $core.method({
  22987. selector: "then:on:do:",
  22988. protocol: "*Kernel-Promises",
  22989. fn: function (aBlockOrArray,aClass,aBlock){
  22990. var self=this;
  22991. return $core.withContext(function($ctx1) {
  22992. var js = self["@jsObject"];
  22993. if (typeof js.then === "function")
  22994. return $globals.Thenable.fn.prototype._then_on_do_.call(js, aBlockOrArray, aClass, aBlock);
  22995. else
  22996. return self._doesNotUnderstand_(
  22997. $globals.Message._new()
  22998. ._selector_("then:on:do:")
  22999. ._arguments_([aBlockOrArray, aClass, aBlock])
  23000. );
  23001. return self;
  23002. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  23003. },
  23004. args: ["aBlockOrArray", "aClass", "aBlock"],
  23005. source: "then: aBlockOrArray on: aClass do: aBlock\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_on_do_.call(js, aBlockOrArray, aClass, aBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:on:do:\x22)\x0a ._arguments_([aBlockOrArray, aClass, aBlock])\x0a )'>",
  23006. referencedClasses: [],
  23007. messageSends: []
  23008. }),
  23009. $globals.JSObjectProxy);
  23010. $core.addMethod(
  23011. $core.method({
  23012. selector: "then:on:do:catch:",
  23013. protocol: "*Kernel-Promises",
  23014. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  23015. var self=this;
  23016. return $core.withContext(function($ctx1) {
  23017. var js = self["@jsObject"];
  23018. if (typeof js.then === "function")
  23019. return $globals.Thenable.fn.prototype._then_on_do_catch_.call(js, aBlockOrArray, aClass, aBlock, anotherBlock);
  23020. else
  23021. return self._doesNotUnderstand_(
  23022. $globals.Message._new()
  23023. ._selector_("then:on:do:catch:")
  23024. ._arguments_([aBlockOrArray, aClass, aBlock, anotherBlock])
  23025. );
  23026. return self;
  23027. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  23028. },
  23029. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  23030. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_on_do_catch_.call(js, aBlockOrArray, aClass, aBlock, anotherBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:on:do:catch:\x22)\x0a ._arguments_([aBlockOrArray, aClass, aBlock, anotherBlock])\x0a )'>",
  23031. referencedClasses: [],
  23032. messageSends: []
  23033. }),
  23034. $globals.JSObjectProxy);
  23035. });
  23036. define('amber_core/Kernel-Announcements',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  23037. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  23038. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  23039. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  23040. $core.addPackage("Kernel-Announcements");
  23041. $core.packages["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  23042. $core.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  23043. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  23044. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  23045. $core.addMethod(
  23046. $core.method({
  23047. selector: "announcementClass",
  23048. protocol: "accessing",
  23049. fn: function (){
  23050. var self=this;
  23051. return self["@announcementClass"];
  23052. },
  23053. args: [],
  23054. source: "announcementClass\x0a\x09^ announcementClass",
  23055. referencedClasses: [],
  23056. messageSends: []
  23057. }),
  23058. $globals.AnnouncementSubscription);
  23059. $core.addMethod(
  23060. $core.method({
  23061. selector: "announcementClass:",
  23062. protocol: "accessing",
  23063. fn: function (aClass){
  23064. var self=this;
  23065. self["@announcementClass"]=aClass;
  23066. return self;
  23067. },
  23068. args: ["aClass"],
  23069. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  23070. referencedClasses: [],
  23071. messageSends: []
  23072. }),
  23073. $globals.AnnouncementSubscription);
  23074. $core.addMethod(
  23075. $core.method({
  23076. selector: "deliver:",
  23077. protocol: "announcing",
  23078. fn: function (anAnnouncement){
  23079. var self=this;
  23080. return $core.withContext(function($ctx1) {
  23081. var $1;
  23082. $1=self._handlesAnnouncement_(anAnnouncement);
  23083. if($core.assert($1)){
  23084. $recv(self._valuable())._value_(anAnnouncement);
  23085. }
  23086. return self;
  23087. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  23088. },
  23089. args: ["anAnnouncement"],
  23090. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  23091. referencedClasses: [],
  23092. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  23093. }),
  23094. $globals.AnnouncementSubscription);
  23095. $core.addMethod(
  23096. $core.method({
  23097. selector: "handlesAnnouncement:",
  23098. protocol: "announcing",
  23099. fn: function (anAnnouncement){
  23100. var self=this;
  23101. return $core.withContext(function($ctx1) {
  23102. var $2,$3,$1,$receiver;
  23103. $2=$recv($globals.Smalltalk)._globals();
  23104. $ctx1.sendIdx["globals"]=1;
  23105. $3=$recv(self._announcementClass())._name();
  23106. $ctx1.sendIdx["name"]=1;
  23107. $1=$recv($2)._at_($3);
  23108. $ctx1.sendIdx["at:"]=1;
  23109. if(($receiver = $1) == null || $receiver.isNil){
  23110. return false;
  23111. } else {
  23112. var class_;
  23113. class_=$receiver;
  23114. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  23115. }
  23116. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  23117. },
  23118. args: ["anAnnouncement"],
  23119. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk globals at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09(Smalltalk globals at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]",
  23120. referencedClasses: ["Smalltalk"],
  23121. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  23122. }),
  23123. $globals.AnnouncementSubscription);
  23124. $core.addMethod(
  23125. $core.method({
  23126. selector: "receiver",
  23127. protocol: "accessing",
  23128. fn: function (){
  23129. var self=this;
  23130. return $core.withContext(function($ctx1) {
  23131. return $recv(self._valuable())._receiver();
  23132. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  23133. },
  23134. args: [],
  23135. source: "receiver\x0a\x09^ self valuable receiver",
  23136. referencedClasses: [],
  23137. messageSends: ["receiver", "valuable"]
  23138. }),
  23139. $globals.AnnouncementSubscription);
  23140. $core.addMethod(
  23141. $core.method({
  23142. selector: "valuable",
  23143. protocol: "accessing",
  23144. fn: function (){
  23145. var self=this;
  23146. return self["@valuable"];
  23147. },
  23148. args: [],
  23149. source: "valuable\x0a\x09^ valuable",
  23150. referencedClasses: [],
  23151. messageSends: []
  23152. }),
  23153. $globals.AnnouncementSubscription);
  23154. $core.addMethod(
  23155. $core.method({
  23156. selector: "valuable:",
  23157. protocol: "accessing",
  23158. fn: function (aValuable){
  23159. var self=this;
  23160. self["@valuable"]=aValuable;
  23161. return self;
  23162. },
  23163. args: ["aValuable"],
  23164. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  23165. referencedClasses: [],
  23166. messageSends: []
  23167. }),
  23168. $globals.AnnouncementSubscription);
  23169. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  23170. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  23171. $core.addMethod(
  23172. $core.method({
  23173. selector: "receiver",
  23174. protocol: "accessing",
  23175. fn: function (){
  23176. var self=this;
  23177. return self["@receiver"];
  23178. },
  23179. args: [],
  23180. source: "receiver\x0a\x09^ receiver",
  23181. referencedClasses: [],
  23182. messageSends: []
  23183. }),
  23184. $globals.AnnouncementValuable);
  23185. $core.addMethod(
  23186. $core.method({
  23187. selector: "receiver:",
  23188. protocol: "accessing",
  23189. fn: function (anObject){
  23190. var self=this;
  23191. self["@receiver"]=anObject;
  23192. return self;
  23193. },
  23194. args: ["anObject"],
  23195. source: "receiver: anObject\x0a\x09receiver := anObject",
  23196. referencedClasses: [],
  23197. messageSends: []
  23198. }),
  23199. $globals.AnnouncementValuable);
  23200. $core.addMethod(
  23201. $core.method({
  23202. selector: "valuable",
  23203. protocol: "accessing",
  23204. fn: function (){
  23205. var self=this;
  23206. return self["@valuable"];
  23207. },
  23208. args: [],
  23209. source: "valuable\x0a\x09^ valuable",
  23210. referencedClasses: [],
  23211. messageSends: []
  23212. }),
  23213. $globals.AnnouncementValuable);
  23214. $core.addMethod(
  23215. $core.method({
  23216. selector: "valuable:",
  23217. protocol: "accessing",
  23218. fn: function (anObject){
  23219. var self=this;
  23220. self["@valuable"]=anObject;
  23221. return self;
  23222. },
  23223. args: ["anObject"],
  23224. source: "valuable: anObject\x0a\x09valuable := anObject",
  23225. referencedClasses: [],
  23226. messageSends: []
  23227. }),
  23228. $globals.AnnouncementValuable);
  23229. $core.addMethod(
  23230. $core.method({
  23231. selector: "value",
  23232. protocol: "evaluating",
  23233. fn: function (){
  23234. var self=this;
  23235. return $core.withContext(function($ctx1) {
  23236. return $recv(self._valuable())._value();
  23237. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  23238. },
  23239. args: [],
  23240. source: "value\x0a\x09^ self valuable value",
  23241. referencedClasses: [],
  23242. messageSends: ["value", "valuable"]
  23243. }),
  23244. $globals.AnnouncementValuable);
  23245. $core.addMethod(
  23246. $core.method({
  23247. selector: "value:",
  23248. protocol: "evaluating",
  23249. fn: function (anObject){
  23250. var self=this;
  23251. return $core.withContext(function($ctx1) {
  23252. return $recv(self._valuable())._value_(anObject);
  23253. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  23254. },
  23255. args: ["anObject"],
  23256. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  23257. referencedClasses: [],
  23258. messageSends: ["value:", "valuable"]
  23259. }),
  23260. $globals.AnnouncementValuable);
  23261. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  23262. $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' ].";
  23263. $core.addMethod(
  23264. $core.method({
  23265. selector: "announce:",
  23266. protocol: "announcing",
  23267. fn: function (anAnnouncement){
  23268. var self=this;
  23269. return $core.withContext(function($ctx1) {
  23270. $recv(self["@subscriptions"])._do_((function(each){
  23271. return $core.withContext(function($ctx2) {
  23272. return $recv(each)._deliver_(anAnnouncement);
  23273. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23274. }));
  23275. return self;
  23276. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  23277. },
  23278. args: ["anAnnouncement"],
  23279. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  23280. referencedClasses: [],
  23281. messageSends: ["do:", "deliver:"]
  23282. }),
  23283. $globals.Announcer);
  23284. $core.addMethod(
  23285. $core.method({
  23286. selector: "initialize",
  23287. protocol: "initialization",
  23288. fn: function (){
  23289. var self=this;
  23290. return $core.withContext(function($ctx1) {
  23291. (
  23292. $ctx1.supercall = true,
  23293. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  23294. $ctx1.supercall = false;
  23295. self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  23296. return self;
  23297. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  23298. },
  23299. args: [],
  23300. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  23301. referencedClasses: ["OrderedCollection"],
  23302. messageSends: ["initialize", "new"]
  23303. }),
  23304. $globals.Announcer);
  23305. $core.addMethod(
  23306. $core.method({
  23307. selector: "on:do:",
  23308. protocol: "subscribing",
  23309. fn: function (aClass,aBlock){
  23310. var self=this;
  23311. return $core.withContext(function($ctx1) {
  23312. self._on_do_for_(aClass,aBlock,nil);
  23313. return self;
  23314. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  23315. },
  23316. args: ["aClass", "aBlock"],
  23317. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  23318. referencedClasses: [],
  23319. messageSends: ["on:do:for:"]
  23320. }),
  23321. $globals.Announcer);
  23322. $core.addMethod(
  23323. $core.method({
  23324. selector: "on:do:for:",
  23325. protocol: "subscribing",
  23326. fn: function (aClass,aBlock,aReceiver){
  23327. var self=this;
  23328. return $core.withContext(function($ctx1) {
  23329. var $1,$3,$5,$6,$4,$2;
  23330. $1=self["@subscriptions"];
  23331. $3=$recv($globals.AnnouncementSubscription)._new();
  23332. $ctx1.sendIdx["new"]=1;
  23333. $5=$recv($globals.AnnouncementValuable)._new();
  23334. $recv($5)._valuable_(aBlock);
  23335. $recv($5)._receiver_(aReceiver);
  23336. $6=$recv($5)._yourself();
  23337. $ctx1.sendIdx["yourself"]=1;
  23338. $4=$6;
  23339. $recv($3)._valuable_($4);
  23340. $ctx1.sendIdx["valuable:"]=1;
  23341. $recv($3)._announcementClass_(aClass);
  23342. $2=$recv($3)._yourself();
  23343. $recv($1)._add_($2);
  23344. return self;
  23345. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  23346. },
  23347. args: ["aClass", "aBlock", "aReceiver"],
  23348. 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)",
  23349. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  23350. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  23351. }),
  23352. $globals.Announcer);
  23353. $core.addMethod(
  23354. $core.method({
  23355. selector: "on:doOnce:",
  23356. protocol: "subscribing",
  23357. fn: function (aClass,aBlock){
  23358. var self=this;
  23359. var subscription;
  23360. return $core.withContext(function($ctx1) {
  23361. var $1;
  23362. $1=$recv($globals.AnnouncementSubscription)._new();
  23363. $recv($1)._announcementClass_(aClass);
  23364. subscription=$recv($1)._yourself();
  23365. $recv(subscription)._valuable_((function(ann){
  23366. return $core.withContext(function($ctx2) {
  23367. $recv(self["@subscriptions"])._remove_(subscription);
  23368. return $recv(aBlock)._value_(ann);
  23369. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  23370. }));
  23371. $recv(self["@subscriptions"])._add_(subscription);
  23372. return self;
  23373. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  23374. },
  23375. args: ["aClass", "aBlock"],
  23376. 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",
  23377. referencedClasses: ["AnnouncementSubscription"],
  23378. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  23379. }),
  23380. $globals.Announcer);
  23381. $core.addMethod(
  23382. $core.method({
  23383. selector: "on:send:to:",
  23384. protocol: "subscribing",
  23385. fn: function (aClass,aSelector,anObject){
  23386. var self=this;
  23387. return $core.withContext(function($ctx1) {
  23388. var $1,$3,$5,$6,$4,$2;
  23389. $1=self["@subscriptions"];
  23390. $3=$recv($globals.AnnouncementSubscription)._new();
  23391. $ctx1.sendIdx["new"]=1;
  23392. $5=$recv($globals.MessageSend)._new();
  23393. $recv($5)._receiver_(anObject);
  23394. $recv($5)._selector_(aSelector);
  23395. $6=$recv($5)._yourself();
  23396. $ctx1.sendIdx["yourself"]=1;
  23397. $4=$6;
  23398. $recv($3)._valuable_($4);
  23399. $recv($3)._announcementClass_(aClass);
  23400. $2=$recv($3)._yourself();
  23401. $recv($1)._add_($2);
  23402. return self;
  23403. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  23404. },
  23405. args: ["aClass", "aSelector", "anObject"],
  23406. 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)",
  23407. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  23408. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  23409. }),
  23410. $globals.Announcer);
  23411. $core.addMethod(
  23412. $core.method({
  23413. selector: "unsubscribe:",
  23414. protocol: "subscribing",
  23415. fn: function (anObject){
  23416. var self=this;
  23417. return $core.withContext(function($ctx1) {
  23418. self["@subscriptions"]=$recv(self["@subscriptions"])._reject_((function(each){
  23419. return $core.withContext(function($ctx2) {
  23420. return $recv($recv(each)._receiver()).__eq(anObject);
  23421. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23422. }));
  23423. return self;
  23424. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  23425. },
  23426. args: ["anObject"],
  23427. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  23428. referencedClasses: [],
  23429. messageSends: ["reject:", "=", "receiver"]
  23430. }),
  23431. $globals.Announcer);
  23432. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  23433. $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`";
  23434. $globals.SystemAnnouncer.klass.iVarNames = ["current"];
  23435. $core.addMethod(
  23436. $core.method({
  23437. selector: "current",
  23438. protocol: "accessing",
  23439. fn: function (){
  23440. var self=this;
  23441. return $core.withContext(function($ctx1) {
  23442. var $1,$receiver;
  23443. $1=self["@current"];
  23444. if(($receiver = $1) == null || $receiver.isNil){
  23445. self["@current"]=(
  23446. $ctx1.supercall = true,
  23447. ($globals.SystemAnnouncer.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  23448. $ctx1.supercall = false;
  23449. return self["@current"];
  23450. } else {
  23451. return $1;
  23452. }
  23453. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.klass)});
  23454. },
  23455. args: [],
  23456. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  23457. referencedClasses: [],
  23458. messageSends: ["ifNil:", "new"]
  23459. }),
  23460. $globals.SystemAnnouncer.klass);
  23461. $core.addMethod(
  23462. $core.method({
  23463. selector: "new",
  23464. protocol: "instance creation",
  23465. fn: function (){
  23466. var self=this;
  23467. return $core.withContext(function($ctx1) {
  23468. self._shouldNotImplement();
  23469. return self;
  23470. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.klass)});
  23471. },
  23472. args: [],
  23473. source: "new\x0a\x09self shouldNotImplement",
  23474. referencedClasses: [],
  23475. messageSends: ["shouldNotImplement"]
  23476. }),
  23477. $globals.SystemAnnouncer.klass);
  23478. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  23479. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  23480. $core.addMethod(
  23481. $core.method({
  23482. selector: "classTag",
  23483. protocol: "accessing",
  23484. fn: function (){
  23485. var self=this;
  23486. return "announcement";
  23487. },
  23488. args: [],
  23489. 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'",
  23490. referencedClasses: [],
  23491. messageSends: []
  23492. }),
  23493. $globals.SystemAnnouncement.klass);
  23494. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  23495. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  23496. $core.addMethod(
  23497. $core.method({
  23498. selector: "theClass",
  23499. protocol: "accessing",
  23500. fn: function (){
  23501. var self=this;
  23502. return self["@theClass"];
  23503. },
  23504. args: [],
  23505. source: "theClass\x0a\x09^ theClass",
  23506. referencedClasses: [],
  23507. messageSends: []
  23508. }),
  23509. $globals.ClassAnnouncement);
  23510. $core.addMethod(
  23511. $core.method({
  23512. selector: "theClass:",
  23513. protocol: "accessing",
  23514. fn: function (aClass){
  23515. var self=this;
  23516. self["@theClass"]=aClass;
  23517. return self;
  23518. },
  23519. args: ["aClass"],
  23520. source: "theClass: aClass\x0a\x09theClass := aClass",
  23521. referencedClasses: [],
  23522. messageSends: []
  23523. }),
  23524. $globals.ClassAnnouncement);
  23525. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  23526. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  23527. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  23528. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  23529. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  23530. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  23531. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  23532. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  23533. $core.addMethod(
  23534. $core.method({
  23535. selector: "oldClass",
  23536. protocol: "accessing",
  23537. fn: function (){
  23538. var self=this;
  23539. return self["@oldClass"];
  23540. },
  23541. args: [],
  23542. source: "oldClass\x0a\x09^ oldClass",
  23543. referencedClasses: [],
  23544. messageSends: []
  23545. }),
  23546. $globals.ClassMigrated);
  23547. $core.addMethod(
  23548. $core.method({
  23549. selector: "oldClass:",
  23550. protocol: "accessing",
  23551. fn: function (aClass){
  23552. var self=this;
  23553. self["@oldClass"]=aClass;
  23554. return self;
  23555. },
  23556. args: ["aClass"],
  23557. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  23558. referencedClasses: [],
  23559. messageSends: []
  23560. }),
  23561. $globals.ClassMigrated);
  23562. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  23563. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  23564. $core.addMethod(
  23565. $core.method({
  23566. selector: "oldPackage",
  23567. protocol: "accessing",
  23568. fn: function (){
  23569. var self=this;
  23570. return self["@oldPackage"];
  23571. },
  23572. args: [],
  23573. source: "oldPackage\x0a\x09^ oldPackage",
  23574. referencedClasses: [],
  23575. messageSends: []
  23576. }),
  23577. $globals.ClassMoved);
  23578. $core.addMethod(
  23579. $core.method({
  23580. selector: "oldPackage:",
  23581. protocol: "accessing",
  23582. fn: function (aPackage){
  23583. var self=this;
  23584. self["@oldPackage"]=aPackage;
  23585. return self;
  23586. },
  23587. args: ["aPackage"],
  23588. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  23589. referencedClasses: [],
  23590. messageSends: []
  23591. }),
  23592. $globals.ClassMoved);
  23593. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  23594. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  23595. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  23596. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  23597. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  23598. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  23599. $core.addMethod(
  23600. $core.method({
  23601. selector: "method",
  23602. protocol: "accessing",
  23603. fn: function (){
  23604. var self=this;
  23605. return self["@method"];
  23606. },
  23607. args: [],
  23608. source: "method\x0a\x09^ method",
  23609. referencedClasses: [],
  23610. messageSends: []
  23611. }),
  23612. $globals.MethodAnnouncement);
  23613. $core.addMethod(
  23614. $core.method({
  23615. selector: "method:",
  23616. protocol: "accessing",
  23617. fn: function (aCompiledMethod){
  23618. var self=this;
  23619. self["@method"]=aCompiledMethod;
  23620. return self;
  23621. },
  23622. args: ["aCompiledMethod"],
  23623. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  23624. referencedClasses: [],
  23625. messageSends: []
  23626. }),
  23627. $globals.MethodAnnouncement);
  23628. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  23629. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  23630. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  23631. $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.";
  23632. $core.addMethod(
  23633. $core.method({
  23634. selector: "oldMethod",
  23635. protocol: "accessing",
  23636. fn: function (){
  23637. var self=this;
  23638. return self["@oldMethod"];
  23639. },
  23640. args: [],
  23641. source: "oldMethod\x0a\x09^ oldMethod",
  23642. referencedClasses: [],
  23643. messageSends: []
  23644. }),
  23645. $globals.MethodModified);
  23646. $core.addMethod(
  23647. $core.method({
  23648. selector: "oldMethod:",
  23649. protocol: "accessing",
  23650. fn: function (aMethod){
  23651. var self=this;
  23652. self["@oldMethod"]=aMethod;
  23653. return self;
  23654. },
  23655. args: ["aMethod"],
  23656. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  23657. referencedClasses: [],
  23658. messageSends: []
  23659. }),
  23660. $globals.MethodModified);
  23661. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  23662. $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.";
  23663. $core.addMethod(
  23664. $core.method({
  23665. selector: "oldProtocol",
  23666. protocol: "accessing",
  23667. fn: function (){
  23668. var self=this;
  23669. return self["@oldProtocol"];
  23670. },
  23671. args: [],
  23672. source: "oldProtocol\x0a\x09^ oldProtocol",
  23673. referencedClasses: [],
  23674. messageSends: []
  23675. }),
  23676. $globals.MethodMoved);
  23677. $core.addMethod(
  23678. $core.method({
  23679. selector: "oldProtocol:",
  23680. protocol: "accessing",
  23681. fn: function (aString){
  23682. var self=this;
  23683. self["@oldProtocol"]=aString;
  23684. return self;
  23685. },
  23686. args: ["aString"],
  23687. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  23688. referencedClasses: [],
  23689. messageSends: []
  23690. }),
  23691. $globals.MethodMoved);
  23692. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  23693. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  23694. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  23695. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  23696. $core.addMethod(
  23697. $core.method({
  23698. selector: "package",
  23699. protocol: "accessing",
  23700. fn: function (){
  23701. var self=this;
  23702. return self["@package"];
  23703. },
  23704. args: [],
  23705. source: "package\x0a\x09^ package",
  23706. referencedClasses: [],
  23707. messageSends: []
  23708. }),
  23709. $globals.PackageAnnouncement);
  23710. $core.addMethod(
  23711. $core.method({
  23712. selector: "package:",
  23713. protocol: "accessing",
  23714. fn: function (aPackage){
  23715. var self=this;
  23716. self["@package"]=aPackage;
  23717. return self;
  23718. },
  23719. args: ["aPackage"],
  23720. source: "package: aPackage\x0a\x09package := aPackage",
  23721. referencedClasses: [],
  23722. messageSends: []
  23723. }),
  23724. $globals.PackageAnnouncement);
  23725. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  23726. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  23727. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  23728. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  23729. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  23730. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  23731. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  23732. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  23733. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  23734. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  23735. $core.addMethod(
  23736. $core.method({
  23737. selector: "package",
  23738. protocol: "accessing",
  23739. fn: function (){
  23740. var self=this;
  23741. return $core.withContext(function($ctx1) {
  23742. var $1,$receiver;
  23743. $1=self._theClass();
  23744. if(($receiver = $1) == null || $receiver.isNil){
  23745. return $1;
  23746. } else {
  23747. var class_;
  23748. class_=$receiver;
  23749. return $recv(class_)._packageOfProtocol_(self._protocol());
  23750. }
  23751. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  23752. },
  23753. args: [],
  23754. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  23755. referencedClasses: [],
  23756. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  23757. }),
  23758. $globals.ProtocolAnnouncement);
  23759. $core.addMethod(
  23760. $core.method({
  23761. selector: "protocol",
  23762. protocol: "accessing",
  23763. fn: function (){
  23764. var self=this;
  23765. return self["@protocol"];
  23766. },
  23767. args: [],
  23768. source: "protocol\x0a\x09^ protocol",
  23769. referencedClasses: [],
  23770. messageSends: []
  23771. }),
  23772. $globals.ProtocolAnnouncement);
  23773. $core.addMethod(
  23774. $core.method({
  23775. selector: "protocol:",
  23776. protocol: "accessing",
  23777. fn: function (aString){
  23778. var self=this;
  23779. self["@protocol"]=aString;
  23780. return self;
  23781. },
  23782. args: ["aString"],
  23783. source: "protocol: aString\x0a\x09protocol := aString",
  23784. referencedClasses: [],
  23785. messageSends: []
  23786. }),
  23787. $globals.ProtocolAnnouncement);
  23788. $core.addMethod(
  23789. $core.method({
  23790. selector: "theClass",
  23791. protocol: "accessing",
  23792. fn: function (){
  23793. var self=this;
  23794. return self["@theClass"];
  23795. },
  23796. args: [],
  23797. source: "theClass\x0a\x09^ theClass",
  23798. referencedClasses: [],
  23799. messageSends: []
  23800. }),
  23801. $globals.ProtocolAnnouncement);
  23802. $core.addMethod(
  23803. $core.method({
  23804. selector: "theClass:",
  23805. protocol: "accessing",
  23806. fn: function (aClass){
  23807. var self=this;
  23808. self["@theClass"]=aClass;
  23809. return self;
  23810. },
  23811. args: ["aClass"],
  23812. source: "theClass: aClass\x0a\x09theClass := aClass",
  23813. referencedClasses: [],
  23814. messageSends: []
  23815. }),
  23816. $globals.ProtocolAnnouncement);
  23817. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  23818. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  23819. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  23820. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  23821. });
  23822. 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";
  23823. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  23824. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  23825. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  23826. $core.addPackage("Platform-Services");
  23827. $core.packages["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  23828. $core.packages["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  23829. $core.addClass("ConsoleErrorHandler", $globals.Object, [], "Platform-Services");
  23830. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  23831. $core.addMethod(
  23832. $core.method({
  23833. selector: "handleError:",
  23834. protocol: "error handling",
  23835. fn: function (anError){
  23836. var self=this;
  23837. return $core.withContext(function($ctx1) {
  23838. var $1,$receiver;
  23839. $1=$recv(anError)._context();
  23840. $ctx1.sendIdx["context"]=1;
  23841. if(($receiver = $1) == null || $receiver.isNil){
  23842. $1;
  23843. } else {
  23844. self._logErrorContext_($recv(anError)._context());
  23845. }
  23846. self._logError_(anError);
  23847. return self;
  23848. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  23849. },
  23850. args: ["anError"],
  23851. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  23852. referencedClasses: [],
  23853. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  23854. }),
  23855. $globals.ConsoleErrorHandler);
  23856. $core.addMethod(
  23857. $core.method({
  23858. selector: "log:",
  23859. protocol: "private",
  23860. fn: function (aString){
  23861. var self=this;
  23862. return $core.withContext(function($ctx1) {
  23863. $recv(console)._log_(aString);
  23864. return self;
  23865. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  23866. },
  23867. args: ["aString"],
  23868. source: "log: aString\x0a\x09console log: aString",
  23869. referencedClasses: [],
  23870. messageSends: ["log:"]
  23871. }),
  23872. $globals.ConsoleErrorHandler);
  23873. $core.addMethod(
  23874. $core.method({
  23875. selector: "logContext:",
  23876. protocol: "private",
  23877. fn: function (aContext){
  23878. var self=this;
  23879. return $core.withContext(function($ctx1) {
  23880. var $1,$receiver;
  23881. $1=$recv(aContext)._home();
  23882. $ctx1.sendIdx["home"]=1;
  23883. if(($receiver = $1) == null || $receiver.isNil){
  23884. $1;
  23885. } else {
  23886. self._logContext_($recv(aContext)._home());
  23887. }
  23888. self._log_($recv(aContext)._asString());
  23889. return self;
  23890. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  23891. },
  23892. args: ["aContext"],
  23893. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  23894. referencedClasses: [],
  23895. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  23896. }),
  23897. $globals.ConsoleErrorHandler);
  23898. $core.addMethod(
  23899. $core.method({
  23900. selector: "logError:",
  23901. protocol: "private",
  23902. fn: function (anError){
  23903. var self=this;
  23904. return $core.withContext(function($ctx1) {
  23905. self._log_($recv(anError)._messageText());
  23906. return self;
  23907. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  23908. },
  23909. args: ["anError"],
  23910. source: "logError: anError\x0a\x09self log: anError messageText",
  23911. referencedClasses: [],
  23912. messageSends: ["log:", "messageText"]
  23913. }),
  23914. $globals.ConsoleErrorHandler);
  23915. $core.addMethod(
  23916. $core.method({
  23917. selector: "logErrorContext:",
  23918. protocol: "private",
  23919. fn: function (aContext){
  23920. var self=this;
  23921. return $core.withContext(function($ctx1) {
  23922. var $1,$receiver;
  23923. if(($receiver = aContext) == null || $receiver.isNil){
  23924. aContext;
  23925. } else {
  23926. $1=$recv(aContext)._home();
  23927. $ctx1.sendIdx["home"]=1;
  23928. if(($receiver = $1) == null || $receiver.isNil){
  23929. $1;
  23930. } else {
  23931. self._logContext_($recv(aContext)._home());
  23932. }
  23933. }
  23934. return self;
  23935. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  23936. },
  23937. args: ["aContext"],
  23938. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  23939. referencedClasses: [],
  23940. messageSends: ["ifNotNil:", "home", "logContext:"]
  23941. }),
  23942. $globals.ConsoleErrorHandler);
  23943. $globals.ConsoleErrorHandler.klass.iVarNames = ["current"];
  23944. $core.addMethod(
  23945. $core.method({
  23946. selector: "initialize",
  23947. protocol: "initialization",
  23948. fn: function (){
  23949. var self=this;
  23950. return $core.withContext(function($ctx1) {
  23951. $recv($globals.ErrorHandler)._registerIfNone_(self._new());
  23952. return self;
  23953. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.klass)});
  23954. },
  23955. args: [],
  23956. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  23957. referencedClasses: ["ErrorHandler"],
  23958. messageSends: ["registerIfNone:", "new"]
  23959. }),
  23960. $globals.ConsoleErrorHandler.klass);
  23961. $core.addClass("ConsoleTranscript", $globals.Object, ["textarea"], "Platform-Services");
  23962. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  23963. $core.addMethod(
  23964. $core.method({
  23965. selector: "clear",
  23966. protocol: "printing",
  23967. fn: function (){
  23968. var self=this;
  23969. return self;
  23970. },
  23971. args: [],
  23972. source: "clear\x0a\x09\x22no op\x22",
  23973. referencedClasses: [],
  23974. messageSends: []
  23975. }),
  23976. $globals.ConsoleTranscript);
  23977. $core.addMethod(
  23978. $core.method({
  23979. selector: "cr",
  23980. protocol: "printing",
  23981. fn: function (){
  23982. var self=this;
  23983. return self;
  23984. },
  23985. args: [],
  23986. source: "cr\x0a\x09\x22no op\x22",
  23987. referencedClasses: [],
  23988. messageSends: []
  23989. }),
  23990. $globals.ConsoleTranscript);
  23991. $core.addMethod(
  23992. $core.method({
  23993. selector: "open",
  23994. protocol: "actions",
  23995. fn: function (){
  23996. var self=this;
  23997. return self;
  23998. },
  23999. args: [],
  24000. source: "open",
  24001. referencedClasses: [],
  24002. messageSends: []
  24003. }),
  24004. $globals.ConsoleTranscript);
  24005. $core.addMethod(
  24006. $core.method({
  24007. selector: "show:",
  24008. protocol: "printing",
  24009. fn: function (anObject){
  24010. var self=this;
  24011. return $core.withContext(function($ctx1) {
  24012. console.log(String($recv(anObject)._asString()));
  24013. return self;
  24014. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  24015. },
  24016. args: ["anObject"],
  24017. 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()))'>",
  24018. referencedClasses: [],
  24019. messageSends: []
  24020. }),
  24021. $globals.ConsoleTranscript);
  24022. $core.addMethod(
  24023. $core.method({
  24024. selector: "initialize",
  24025. protocol: "initialization",
  24026. fn: function (){
  24027. var self=this;
  24028. return $core.withContext(function($ctx1) {
  24029. $recv($globals.Transcript)._registerIfNone_(self._new());
  24030. return self;
  24031. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.klass)});
  24032. },
  24033. args: [],
  24034. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  24035. referencedClasses: ["Transcript"],
  24036. messageSends: ["registerIfNone:", "new"]
  24037. }),
  24038. $globals.ConsoleTranscript.klass);
  24039. $core.addClass("Environment", $globals.Object, [], "Platform-Services");
  24040. $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.";
  24041. $core.addMethod(
  24042. $core.method({
  24043. selector: "addInstVarNamed:to:",
  24044. protocol: "compiling",
  24045. fn: function (aString,aClass){
  24046. var self=this;
  24047. return $core.withContext(function($ctx1) {
  24048. var $1,$2,$3,$5,$4;
  24049. $1=self._classBuilder();
  24050. $2=$recv(aClass)._superclass();
  24051. $3=$recv(aClass)._name();
  24052. $ctx1.sendIdx["name"]=1;
  24053. $5=$recv($recv(aClass)._instanceVariableNames())._copy();
  24054. $recv($5)._add_(aString);
  24055. $4=$recv($5)._yourself();
  24056. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$recv($recv(aClass)._package())._name());
  24057. return self;
  24058. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  24059. },
  24060. args: ["aString", "aClass"],
  24061. source: "addInstVarNamed: aString to: aClass\x0a\x09self classBuilder\x0a\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09named: aClass name \x0a\x09\x09instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)\x0a\x09\x09package: aClass package name",
  24062. referencedClasses: [],
  24063. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  24064. }),
  24065. $globals.Environment);
  24066. $core.addMethod(
  24067. $core.method({
  24068. selector: "allSelectors",
  24069. protocol: "accessing",
  24070. fn: function (){
  24071. var self=this;
  24072. return $core.withContext(function($ctx1) {
  24073. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  24074. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  24075. },
  24076. args: [],
  24077. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  24078. referencedClasses: ["Smalltalk"],
  24079. messageSends: ["allSelectors", "core"]
  24080. }),
  24081. $globals.Environment);
  24082. $core.addMethod(
  24083. $core.method({
  24084. selector: "availableClassNames",
  24085. protocol: "accessing",
  24086. fn: function (){
  24087. var self=this;
  24088. return $core.withContext(function($ctx1) {
  24089. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  24090. return $core.withContext(function($ctx2) {
  24091. return $recv(each)._name();
  24092. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24093. }));
  24094. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  24095. },
  24096. args: [],
  24097. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  24098. referencedClasses: ["Smalltalk"],
  24099. messageSends: ["collect:", "classes", "name"]
  24100. }),
  24101. $globals.Environment);
  24102. $core.addMethod(
  24103. $core.method({
  24104. selector: "availablePackageNames",
  24105. protocol: "accessing",
  24106. fn: function (){
  24107. var self=this;
  24108. return $core.withContext(function($ctx1) {
  24109. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  24110. return $core.withContext(function($ctx2) {
  24111. return $recv(each)._name();
  24112. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24113. }));
  24114. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  24115. },
  24116. args: [],
  24117. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  24118. referencedClasses: ["Smalltalk"],
  24119. messageSends: ["collect:", "packages", "name"]
  24120. }),
  24121. $globals.Environment);
  24122. $core.addMethod(
  24123. $core.method({
  24124. selector: "availableProtocolsFor:",
  24125. protocol: "accessing",
  24126. fn: function (aClass){
  24127. var self=this;
  24128. var protocols;
  24129. return $core.withContext(function($ctx1) {
  24130. var $1,$receiver;
  24131. protocols=$recv(aClass)._protocols();
  24132. $1=$recv(aClass)._superclass();
  24133. $ctx1.sendIdx["superclass"]=1;
  24134. if(($receiver = $1) == null || $receiver.isNil){
  24135. $1;
  24136. } else {
  24137. $recv(protocols)._addAll_(self._availableProtocolsFor_($recv(aClass)._superclass()));
  24138. }
  24139. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  24140. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  24141. },
  24142. args: ["aClass"],
  24143. 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",
  24144. referencedClasses: [],
  24145. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  24146. }),
  24147. $globals.Environment);
  24148. $core.addMethod(
  24149. $core.method({
  24150. selector: "classBuilder",
  24151. protocol: "accessing",
  24152. fn: function (){
  24153. var self=this;
  24154. return $core.withContext(function($ctx1) {
  24155. return $recv($globals.ClassBuilder)._new();
  24156. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  24157. },
  24158. args: [],
  24159. source: "classBuilder\x0a\x09^ ClassBuilder new",
  24160. referencedClasses: ["ClassBuilder"],
  24161. messageSends: ["new"]
  24162. }),
  24163. $globals.Environment);
  24164. $core.addMethod(
  24165. $core.method({
  24166. selector: "classNamed:",
  24167. protocol: "accessing",
  24168. fn: function (aString){
  24169. var self=this;
  24170. return $core.withContext(function($ctx1) {
  24171. var $1,$receiver;
  24172. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  24173. if(($receiver = $1) == null || $receiver.isNil){
  24174. return self._error_("Invalid class name");
  24175. } else {
  24176. return $1;
  24177. }
  24178. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  24179. },
  24180. args: ["aString"],
  24181. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  24182. referencedClasses: ["Smalltalk"],
  24183. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  24184. }),
  24185. $globals.Environment);
  24186. $core.addMethod(
  24187. $core.method({
  24188. selector: "classes",
  24189. protocol: "accessing",
  24190. fn: function (){
  24191. var self=this;
  24192. return $core.withContext(function($ctx1) {
  24193. return $recv($globals.Smalltalk)._classes();
  24194. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  24195. },
  24196. args: [],
  24197. source: "classes\x0a\x09^ Smalltalk classes",
  24198. referencedClasses: ["Smalltalk"],
  24199. messageSends: ["classes"]
  24200. }),
  24201. $globals.Environment);
  24202. $core.addMethod(
  24203. $core.method({
  24204. selector: "commitPackage:onSuccess:onError:",
  24205. protocol: "actions",
  24206. fn: function (aPackage,aBlock,anotherBlock){
  24207. var self=this;
  24208. return $core.withContext(function($ctx1) {
  24209. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  24210. return self;
  24211. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  24212. },
  24213. args: ["aPackage", "aBlock", "anotherBlock"],
  24214. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  24215. referencedClasses: [],
  24216. messageSends: ["commitOnSuccess:onError:", "transport"]
  24217. }),
  24218. $globals.Environment);
  24219. $core.addMethod(
  24220. $core.method({
  24221. selector: "compileClassComment:for:",
  24222. protocol: "compiling",
  24223. fn: function (aString,aClass){
  24224. var self=this;
  24225. return $core.withContext(function($ctx1) {
  24226. $recv(aClass)._comment_(aString);
  24227. return self;
  24228. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  24229. },
  24230. args: ["aString", "aClass"],
  24231. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  24232. referencedClasses: [],
  24233. messageSends: ["comment:"]
  24234. }),
  24235. $globals.Environment);
  24236. $core.addMethod(
  24237. $core.method({
  24238. selector: "compileClassDefinition:",
  24239. protocol: "compiling",
  24240. fn: function (aString){
  24241. var self=this;
  24242. return $core.withContext(function($ctx1) {
  24243. $recv((function(){
  24244. return $core.withContext(function($ctx2) {
  24245. return self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  24246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  24247. }))._on_do_($globals.Error,(function(error){
  24248. return $core.withContext(function($ctx2) {
  24249. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  24250. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  24251. }));
  24252. return self;
  24253. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  24254. },
  24255. args: ["aString"],
  24256. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  24257. referencedClasses: ["DoIt", "Error", "Terminal"],
  24258. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  24259. }),
  24260. $globals.Environment);
  24261. $core.addMethod(
  24262. $core.method({
  24263. selector: "compileMethod:for:protocol:",
  24264. protocol: "compiling",
  24265. fn: function (sourceCode,class_,protocol){
  24266. var self=this;
  24267. return $core.withContext(function($ctx1) {
  24268. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  24269. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  24270. },
  24271. args: ["sourceCode", "class", "protocol"],
  24272. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  24273. referencedClasses: [],
  24274. messageSends: ["compile:protocol:"]
  24275. }),
  24276. $globals.Environment);
  24277. $core.addMethod(
  24278. $core.method({
  24279. selector: "copyClass:to:",
  24280. protocol: "actions",
  24281. fn: function (aClass,aClassName){
  24282. var self=this;
  24283. return $core.withContext(function($ctx1) {
  24284. var $1,$2,$receiver;
  24285. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  24286. if(($receiver = $1) == null || $receiver.isNil){
  24287. $1;
  24288. } else {
  24289. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  24290. $ctx1.sendIdx[","]=1;
  24291. self._error_($2);
  24292. }
  24293. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  24294. return self;
  24295. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  24296. },
  24297. args: ["aClass", "aClassName"],
  24298. 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",
  24299. referencedClasses: ["Smalltalk", "ClassBuilder"],
  24300. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  24301. }),
  24302. $globals.Environment);
  24303. $core.addMethod(
  24304. $core.method({
  24305. selector: "doItReceiver",
  24306. protocol: "accessing",
  24307. fn: function (){
  24308. var self=this;
  24309. return $core.withContext(function($ctx1) {
  24310. return $recv($globals.DoIt)._new();
  24311. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  24312. },
  24313. args: [],
  24314. source: "doItReceiver\x0a\x09^ DoIt new",
  24315. referencedClasses: ["DoIt"],
  24316. messageSends: ["new"]
  24317. }),
  24318. $globals.Environment);
  24319. $core.addMethod(
  24320. $core.method({
  24321. selector: "evaluate:for:",
  24322. protocol: "evaluating",
  24323. fn: function (aString,anObject){
  24324. var self=this;
  24325. return $core.withContext(function($ctx1) {
  24326. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  24327. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  24328. },
  24329. args: ["aString", "anObject"],
  24330. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  24331. referencedClasses: ["Evaluator"],
  24332. messageSends: ["evaluate:for:"]
  24333. }),
  24334. $globals.Environment);
  24335. $core.addMethod(
  24336. $core.method({
  24337. selector: "evaluate:on:do:",
  24338. protocol: "error handling",
  24339. fn: function (aBlock,anErrorClass,exceptionBlock){
  24340. var self=this;
  24341. return $core.withContext(function($ctx1) {
  24342. var $1;
  24343. $recv(aBlock)._tryCatch_((function(exception){
  24344. return $core.withContext(function($ctx2) {
  24345. $1=$recv(exception)._isKindOf_(self._classNamed_($recv(anErrorClass)._name()));
  24346. if($core.assert($1)){
  24347. return $recv(exceptionBlock)._value_(exception);
  24348. } else {
  24349. return $recv(exception)._resignal();
  24350. }
  24351. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  24352. }));
  24353. return self;
  24354. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  24355. },
  24356. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  24357. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception resignal ] ]",
  24358. referencedClasses: [],
  24359. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  24360. }),
  24361. $globals.Environment);
  24362. $core.addMethod(
  24363. $core.method({
  24364. selector: "inspect:",
  24365. protocol: "actions",
  24366. fn: function (anObject){
  24367. var self=this;
  24368. return $core.withContext(function($ctx1) {
  24369. $recv($globals.Inspector)._inspect_(anObject);
  24370. return self;
  24371. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  24372. },
  24373. args: ["anObject"],
  24374. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  24375. referencedClasses: ["Inspector"],
  24376. messageSends: ["inspect:"]
  24377. }),
  24378. $globals.Environment);
  24379. $core.addMethod(
  24380. $core.method({
  24381. selector: "moveClass:toPackage:",
  24382. protocol: "actions",
  24383. fn: function (aClass,aPackageName){
  24384. var self=this;
  24385. var package_;
  24386. return $core.withContext(function($ctx1) {
  24387. var $1,$2,$receiver;
  24388. package_=$recv($globals.Package)._named_(aPackageName);
  24389. $1=package_;
  24390. if(($receiver = $1) == null || $receiver.isNil){
  24391. self._error_("Invalid package name");
  24392. } else {
  24393. $1;
  24394. }
  24395. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  24396. if($core.assert($2)){
  24397. return self;
  24398. }
  24399. $recv(aClass)._package_(package_);
  24400. $recv(aClass)._recompile();
  24401. return self;
  24402. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  24403. },
  24404. args: ["aClass", "aPackageName"],
  24405. 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",
  24406. referencedClasses: ["Package"],
  24407. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:", "recompile"]
  24408. }),
  24409. $globals.Environment);
  24410. $core.addMethod(
  24411. $core.method({
  24412. selector: "moveMethod:toClass:",
  24413. protocol: "actions",
  24414. fn: function (aMethod,aClassName){
  24415. var self=this;
  24416. var destinationClass;
  24417. return $core.withContext(function($ctx1) {
  24418. var $2,$3,$1,$5,$4;
  24419. destinationClass=self._classNamed_(aClassName);
  24420. $2=destinationClass;
  24421. $3=$recv(aMethod)._methodClass();
  24422. $ctx1.sendIdx["methodClass"]=1;
  24423. $1=$recv($2).__eq_eq($3);
  24424. if($core.assert($1)){
  24425. return self;
  24426. }
  24427. $5=$recv(aMethod)._methodClass();
  24428. $ctx1.sendIdx["methodClass"]=2;
  24429. $4=$recv($5)._isMetaclass();
  24430. if($core.assert($4)){
  24431. destinationClass=$recv(destinationClass)._theMetaClass();
  24432. destinationClass;
  24433. }
  24434. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  24435. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  24436. return self;
  24437. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  24438. },
  24439. args: ["aMethod", "aClassName"],
  24440. 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",
  24441. referencedClasses: [],
  24442. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "theMetaClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  24443. }),
  24444. $globals.Environment);
  24445. $core.addMethod(
  24446. $core.method({
  24447. selector: "moveMethod:toProtocol:",
  24448. protocol: "actions",
  24449. fn: function (aMethod,aProtocol){
  24450. var self=this;
  24451. return $core.withContext(function($ctx1) {
  24452. $recv(aMethod)._protocol_(aProtocol);
  24453. $recv($recv(aMethod)._methodClass())._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  24454. return self;
  24455. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  24456. },
  24457. args: ["aMethod", "aProtocol"],
  24458. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol.\x0a\x0a\x09aMethod methodClass\x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol",
  24459. referencedClasses: [],
  24460. messageSends: ["protocol:", "compile:protocol:", "methodClass", "source", "protocol"]
  24461. }),
  24462. $globals.Environment);
  24463. $core.addMethod(
  24464. $core.method({
  24465. selector: "packages",
  24466. protocol: "accessing",
  24467. fn: function (){
  24468. var self=this;
  24469. return $core.withContext(function($ctx1) {
  24470. return $recv($globals.Smalltalk)._packages();
  24471. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  24472. },
  24473. args: [],
  24474. source: "packages\x0a\x09^ Smalltalk packages",
  24475. referencedClasses: ["Smalltalk"],
  24476. messageSends: ["packages"]
  24477. }),
  24478. $globals.Environment);
  24479. $core.addMethod(
  24480. $core.method({
  24481. selector: "registerErrorHandler:",
  24482. protocol: "services",
  24483. fn: function (anErrorHandler){
  24484. var self=this;
  24485. return $core.withContext(function($ctx1) {
  24486. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  24487. return self;
  24488. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  24489. },
  24490. args: ["anErrorHandler"],
  24491. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  24492. referencedClasses: ["ErrorHandler"],
  24493. messageSends: ["register:"]
  24494. }),
  24495. $globals.Environment);
  24496. $core.addMethod(
  24497. $core.method({
  24498. selector: "registerFinder:",
  24499. protocol: "services",
  24500. fn: function (aFinder){
  24501. var self=this;
  24502. return $core.withContext(function($ctx1) {
  24503. $recv($globals.Finder)._register_(aFinder);
  24504. return self;
  24505. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  24506. },
  24507. args: ["aFinder"],
  24508. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  24509. referencedClasses: ["Finder"],
  24510. messageSends: ["register:"]
  24511. }),
  24512. $globals.Environment);
  24513. $core.addMethod(
  24514. $core.method({
  24515. selector: "registerInspector:",
  24516. protocol: "services",
  24517. fn: function (anInspector){
  24518. var self=this;
  24519. return $core.withContext(function($ctx1) {
  24520. $recv($globals.Inspector)._register_(anInspector);
  24521. return self;
  24522. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  24523. },
  24524. args: ["anInspector"],
  24525. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  24526. referencedClasses: ["Inspector"],
  24527. messageSends: ["register:"]
  24528. }),
  24529. $globals.Environment);
  24530. $core.addMethod(
  24531. $core.method({
  24532. selector: "registerProgressHandler:",
  24533. protocol: "services",
  24534. fn: function (aProgressHandler){
  24535. var self=this;
  24536. return $core.withContext(function($ctx1) {
  24537. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  24538. return self;
  24539. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  24540. },
  24541. args: ["aProgressHandler"],
  24542. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  24543. referencedClasses: ["ProgressHandler"],
  24544. messageSends: ["register:"]
  24545. }),
  24546. $globals.Environment);
  24547. $core.addMethod(
  24548. $core.method({
  24549. selector: "registerTranscript:",
  24550. protocol: "services",
  24551. fn: function (aTranscript){
  24552. var self=this;
  24553. return $core.withContext(function($ctx1) {
  24554. $recv($globals.Transcript)._register_(aTranscript);
  24555. return self;
  24556. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  24557. },
  24558. args: ["aTranscript"],
  24559. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  24560. referencedClasses: ["Transcript"],
  24561. messageSends: ["register:"]
  24562. }),
  24563. $globals.Environment);
  24564. $core.addMethod(
  24565. $core.method({
  24566. selector: "removeClass:",
  24567. protocol: "actions",
  24568. fn: function (aClass){
  24569. var self=this;
  24570. return $core.withContext(function($ctx1) {
  24571. $recv($globals.Smalltalk)._removeClass_(aClass);
  24572. return self;
  24573. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  24574. },
  24575. args: ["aClass"],
  24576. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  24577. referencedClasses: ["Smalltalk"],
  24578. messageSends: ["removeClass:"]
  24579. }),
  24580. $globals.Environment);
  24581. $core.addMethod(
  24582. $core.method({
  24583. selector: "removeMethod:",
  24584. protocol: "actions",
  24585. fn: function (aMethod){
  24586. var self=this;
  24587. return $core.withContext(function($ctx1) {
  24588. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  24589. return self;
  24590. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  24591. },
  24592. args: ["aMethod"],
  24593. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  24594. referencedClasses: [],
  24595. messageSends: ["removeCompiledMethod:", "methodClass"]
  24596. }),
  24597. $globals.Environment);
  24598. $core.addMethod(
  24599. $core.method({
  24600. selector: "removeProtocol:from:",
  24601. protocol: "actions",
  24602. fn: function (aString,aClass){
  24603. var self=this;
  24604. return $core.withContext(function($ctx1) {
  24605. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  24606. return $core.withContext(function($ctx2) {
  24607. return $recv(aClass)._removeCompiledMethod_(each);
  24608. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24609. }));
  24610. return self;
  24611. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  24612. },
  24613. args: ["aString", "aClass"],
  24614. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  24615. referencedClasses: [],
  24616. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  24617. }),
  24618. $globals.Environment);
  24619. $core.addMethod(
  24620. $core.method({
  24621. selector: "renameClass:to:",
  24622. protocol: "actions",
  24623. fn: function (aClass,aClassName){
  24624. var self=this;
  24625. return $core.withContext(function($ctx1) {
  24626. var $1,$2,$receiver;
  24627. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  24628. if(($receiver = $1) == null || $receiver.isNil){
  24629. $1;
  24630. } else {
  24631. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  24632. $ctx1.sendIdx[","]=1;
  24633. self._error_($2);
  24634. }
  24635. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  24636. return self;
  24637. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  24638. },
  24639. args: ["aClass", "aClassName"],
  24640. 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",
  24641. referencedClasses: ["Smalltalk", "ClassBuilder"],
  24642. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  24643. }),
  24644. $globals.Environment);
  24645. $core.addMethod(
  24646. $core.method({
  24647. selector: "renamePackage:to:",
  24648. protocol: "actions",
  24649. fn: function (aPackageName,aNewPackageName){
  24650. var self=this;
  24651. return $core.withContext(function($ctx1) {
  24652. var $1,$2,$receiver;
  24653. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aNewPackageName);
  24654. if(($receiver = $1) == null || $receiver.isNil){
  24655. $1;
  24656. } else {
  24657. $2=$recv("A package named ".__comma(aNewPackageName)).__comma(" already exists");
  24658. $ctx1.sendIdx[","]=1;
  24659. self._error_($2);
  24660. }
  24661. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  24662. return self;
  24663. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  24664. },
  24665. args: ["aPackageName", "aNewPackageName"],
  24666. source: "renamePackage: aPackageName to: aNewPackageName\x0a (Smalltalk globals at: aNewPackageName)\x0a ifNotNil: [ self error: 'A package named ', aNewPackageName, ' already exists' ].\x0a\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  24667. referencedClasses: ["Smalltalk"],
  24668. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renamePackage:to:"]
  24669. }),
  24670. $globals.Environment);
  24671. $core.addMethod(
  24672. $core.method({
  24673. selector: "renameProtocol:to:in:",
  24674. protocol: "actions",
  24675. fn: function (aString,anotherString,aClass){
  24676. var self=this;
  24677. return $core.withContext(function($ctx1) {
  24678. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  24679. return $core.withContext(function($ctx2) {
  24680. return $recv(each)._protocol_(anotherString);
  24681. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24682. }));
  24683. return self;
  24684. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  24685. },
  24686. args: ["aString", "anotherString", "aClass"],
  24687. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  24688. referencedClasses: [],
  24689. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  24690. }),
  24691. $globals.Environment);
  24692. $core.addMethod(
  24693. $core.method({
  24694. selector: "setClassCommentOf:to:",
  24695. protocol: "actions",
  24696. fn: function (aClass,aString){
  24697. var self=this;
  24698. return $core.withContext(function($ctx1) {
  24699. $recv(aClass)._comment_(aString);
  24700. return self;
  24701. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  24702. },
  24703. args: ["aClass", "aString"],
  24704. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  24705. referencedClasses: [],
  24706. messageSends: ["comment:"]
  24707. }),
  24708. $globals.Environment);
  24709. $core.addMethod(
  24710. $core.method({
  24711. selector: "systemAnnouncer",
  24712. protocol: "accessing",
  24713. fn: function (){
  24714. var self=this;
  24715. return $core.withContext(function($ctx1) {
  24716. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  24717. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  24718. },
  24719. args: [],
  24720. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  24721. referencedClasses: ["Smalltalk"],
  24722. messageSends: ["current", "at:", "globals"]
  24723. }),
  24724. $globals.Environment);
  24725. $core.addClass("NullProgressHandler", $globals.Object, [], "Platform-Services");
  24726. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  24727. $core.addMethod(
  24728. $core.method({
  24729. selector: "do:on:displaying:",
  24730. protocol: "progress handling",
  24731. fn: function (aBlock,aCollection,aString){
  24732. var self=this;
  24733. return $core.withContext(function($ctx1) {
  24734. $recv(aCollection)._do_(aBlock);
  24735. return self;
  24736. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  24737. },
  24738. args: ["aBlock", "aCollection", "aString"],
  24739. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  24740. referencedClasses: [],
  24741. messageSends: ["do:"]
  24742. }),
  24743. $globals.NullProgressHandler);
  24744. $globals.NullProgressHandler.klass.iVarNames = ["current"];
  24745. $core.addMethod(
  24746. $core.method({
  24747. selector: "initialize",
  24748. protocol: "initialization",
  24749. fn: function (){
  24750. var self=this;
  24751. return $core.withContext(function($ctx1) {
  24752. $recv($globals.ProgressHandler)._registerIfNone_(self._new());
  24753. return self;
  24754. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.klass)});
  24755. },
  24756. args: [],
  24757. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  24758. referencedClasses: ["ProgressHandler"],
  24759. messageSends: ["registerIfNone:", "new"]
  24760. }),
  24761. $globals.NullProgressHandler.klass);
  24762. $core.addClass("Service", $globals.Object, [], "Platform-Services");
  24763. $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.";
  24764. $globals.Service.klass.iVarNames = ["current"];
  24765. $core.addMethod(
  24766. $core.method({
  24767. selector: "current",
  24768. protocol: "accessing",
  24769. fn: function (){
  24770. var self=this;
  24771. return self["@current"];
  24772. },
  24773. args: [],
  24774. source: "current\x0a\x09^ current",
  24775. referencedClasses: [],
  24776. messageSends: []
  24777. }),
  24778. $globals.Service.klass);
  24779. $core.addMethod(
  24780. $core.method({
  24781. selector: "new",
  24782. protocol: "instance creation",
  24783. fn: function (){
  24784. var self=this;
  24785. return $core.withContext(function($ctx1) {
  24786. self._shouldNotImplement();
  24787. return self;
  24788. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.klass)});
  24789. },
  24790. args: [],
  24791. source: "new\x0a\x09self shouldNotImplement",
  24792. referencedClasses: [],
  24793. messageSends: ["shouldNotImplement"]
  24794. }),
  24795. $globals.Service.klass);
  24796. $core.addMethod(
  24797. $core.method({
  24798. selector: "register:",
  24799. protocol: "registration",
  24800. fn: function (anObject){
  24801. var self=this;
  24802. self["@current"]=anObject;
  24803. return self;
  24804. },
  24805. args: ["anObject"],
  24806. source: "register: anObject\x0a\x09current := anObject",
  24807. referencedClasses: [],
  24808. messageSends: []
  24809. }),
  24810. $globals.Service.klass);
  24811. $core.addMethod(
  24812. $core.method({
  24813. selector: "registerIfNone:",
  24814. protocol: "registration",
  24815. fn: function (anObject){
  24816. var self=this;
  24817. return $core.withContext(function($ctx1) {
  24818. var $1,$receiver;
  24819. $1=self._current();
  24820. if(($receiver = $1) == null || $receiver.isNil){
  24821. self._register_(anObject);
  24822. } else {
  24823. $1;
  24824. }
  24825. return self;
  24826. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.klass)});
  24827. },
  24828. args: ["anObject"],
  24829. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  24830. referencedClasses: [],
  24831. messageSends: ["ifNil:", "current", "register:"]
  24832. }),
  24833. $globals.Service.klass);
  24834. $core.addClass("ErrorHandler", $globals.Service, [], "Platform-Services");
  24835. $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.";
  24836. $core.addMethod(
  24837. $core.method({
  24838. selector: "handleError:",
  24839. protocol: "error handling",
  24840. fn: function (anError){
  24841. var self=this;
  24842. return $core.withContext(function($ctx1) {
  24843. self._handleUnhandledError_(anError);
  24844. return self;
  24845. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.klass)});
  24846. },
  24847. args: ["anError"],
  24848. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  24849. referencedClasses: [],
  24850. messageSends: ["handleUnhandledError:"]
  24851. }),
  24852. $globals.ErrorHandler.klass);
  24853. $core.addMethod(
  24854. $core.method({
  24855. selector: "handleUnhandledError:",
  24856. protocol: "error handling",
  24857. fn: function (anError){
  24858. var self=this;
  24859. return $core.withContext(function($ctx1) {
  24860. var $1;
  24861. $1=$recv(anError)._wasHandled();
  24862. if($core.assert($1)){
  24863. return self;
  24864. }
  24865. return $recv(self._current())._handleError_(anError);
  24866. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.klass)});
  24867. },
  24868. args: ["anError"],
  24869. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  24870. referencedClasses: [],
  24871. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
  24872. }),
  24873. $globals.ErrorHandler.klass);
  24874. $core.addClass("Finder", $globals.Service, [], "Platform-Services");
  24875. $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.";
  24876. $core.addMethod(
  24877. $core.method({
  24878. selector: "findClass:",
  24879. protocol: "finding",
  24880. fn: function (aClass){
  24881. var self=this;
  24882. return $core.withContext(function($ctx1) {
  24883. return $recv(self._current())._findClass_(aClass);
  24884. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.klass)});
  24885. },
  24886. args: ["aClass"],
  24887. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  24888. referencedClasses: [],
  24889. messageSends: ["findClass:", "current"]
  24890. }),
  24891. $globals.Finder.klass);
  24892. $core.addMethod(
  24893. $core.method({
  24894. selector: "findMethod:",
  24895. protocol: "finding",
  24896. fn: function (aCompiledMethod){
  24897. var self=this;
  24898. return $core.withContext(function($ctx1) {
  24899. return $recv(self._current())._findMethod_(aCompiledMethod);
  24900. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.klass)});
  24901. },
  24902. args: ["aCompiledMethod"],
  24903. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  24904. referencedClasses: [],
  24905. messageSends: ["findMethod:", "current"]
  24906. }),
  24907. $globals.Finder.klass);
  24908. $core.addMethod(
  24909. $core.method({
  24910. selector: "findString:",
  24911. protocol: "finding",
  24912. fn: function (aString){
  24913. var self=this;
  24914. return $core.withContext(function($ctx1) {
  24915. return $recv(self._current())._findString_(aString);
  24916. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.klass)});
  24917. },
  24918. args: ["aString"],
  24919. source: "findString: aString\x0a\x09^ self current findString: aString",
  24920. referencedClasses: [],
  24921. messageSends: ["findString:", "current"]
  24922. }),
  24923. $globals.Finder.klass);
  24924. $core.addClass("Inspector", $globals.Service, [], "Platform-Services");
  24925. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  24926. $core.addMethod(
  24927. $core.method({
  24928. selector: "inspect:",
  24929. protocol: "inspecting",
  24930. fn: function (anObject){
  24931. var self=this;
  24932. return $core.withContext(function($ctx1) {
  24933. return $recv(self._current())._inspect_(anObject);
  24934. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.klass)});
  24935. },
  24936. args: ["anObject"],
  24937. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  24938. referencedClasses: [],
  24939. messageSends: ["inspect:", "current"]
  24940. }),
  24941. $globals.Inspector.klass);
  24942. $core.addClass("Platform", $globals.Service, [], "Platform-Services");
  24943. $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";
  24944. $core.addMethod(
  24945. $core.method({
  24946. selector: "globals",
  24947. protocol: "accessing",
  24948. fn: function (){
  24949. var self=this;
  24950. return $core.withContext(function($ctx1) {
  24951. return $recv(self._current())._globals();
  24952. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.klass)});
  24953. },
  24954. args: [],
  24955. source: "globals\x0a\x09^ self current globals",
  24956. referencedClasses: [],
  24957. messageSends: ["globals", "current"]
  24958. }),
  24959. $globals.Platform.klass);
  24960. $core.addMethod(
  24961. $core.method({
  24962. selector: "newXhr",
  24963. protocol: "accessing",
  24964. fn: function (){
  24965. var self=this;
  24966. return $core.withContext(function($ctx1) {
  24967. return $recv(self._current())._newXhr();
  24968. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.klass)});
  24969. },
  24970. args: [],
  24971. source: "newXhr\x0a\x09^ self current newXhr",
  24972. referencedClasses: [],
  24973. messageSends: ["newXhr", "current"]
  24974. }),
  24975. $globals.Platform.klass);
  24976. $core.addClass("ProgressHandler", $globals.Service, [], "Platform-Services");
  24977. $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`.";
  24978. $core.addMethod(
  24979. $core.method({
  24980. selector: "do:on:displaying:",
  24981. protocol: "progress handling",
  24982. fn: function (aBlock,aCollection,aString){
  24983. var self=this;
  24984. return $core.withContext(function($ctx1) {
  24985. $recv(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  24986. return self;
  24987. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.klass)});
  24988. },
  24989. args: ["aBlock", "aCollection", "aString"],
  24990. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  24991. referencedClasses: [],
  24992. messageSends: ["do:on:displaying:", "current"]
  24993. }),
  24994. $globals.ProgressHandler.klass);
  24995. $core.addClass("Terminal", $globals.Service, [], "Platform-Services");
  24996. $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:'.";
  24997. $core.addMethod(
  24998. $core.method({
  24999. selector: "alert:",
  25000. protocol: "dialogs",
  25001. fn: function (aString){
  25002. var self=this;
  25003. return $core.withContext(function($ctx1) {
  25004. return $recv(self._current())._alert_(aString);
  25005. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.klass)});
  25006. },
  25007. args: ["aString"],
  25008. source: "alert: aString\x0a\x09^ self current alert: aString",
  25009. referencedClasses: [],
  25010. messageSends: ["alert:", "current"]
  25011. }),
  25012. $globals.Terminal.klass);
  25013. $core.addMethod(
  25014. $core.method({
  25015. selector: "confirm:",
  25016. protocol: "dialogs",
  25017. fn: function (aString){
  25018. var self=this;
  25019. return $core.withContext(function($ctx1) {
  25020. return $recv(self._current())._confirm_(aString);
  25021. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.klass)});
  25022. },
  25023. args: ["aString"],
  25024. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  25025. referencedClasses: [],
  25026. messageSends: ["confirm:", "current"]
  25027. }),
  25028. $globals.Terminal.klass);
  25029. $core.addMethod(
  25030. $core.method({
  25031. selector: "prompt:",
  25032. protocol: "dialogs",
  25033. fn: function (aString){
  25034. var self=this;
  25035. return $core.withContext(function($ctx1) {
  25036. return $recv(self._current())._prompt_(aString);
  25037. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.klass)});
  25038. },
  25039. args: ["aString"],
  25040. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  25041. referencedClasses: [],
  25042. messageSends: ["prompt:", "current"]
  25043. }),
  25044. $globals.Terminal.klass);
  25045. $core.addMethod(
  25046. $core.method({
  25047. selector: "prompt:default:",
  25048. protocol: "dialogs",
  25049. fn: function (aString,defaultString){
  25050. var self=this;
  25051. return $core.withContext(function($ctx1) {
  25052. return $recv(self._current())._prompt_default_(aString,defaultString);
  25053. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.klass)});
  25054. },
  25055. args: ["aString", "defaultString"],
  25056. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  25057. referencedClasses: [],
  25058. messageSends: ["prompt:default:", "current"]
  25059. }),
  25060. $globals.Terminal.klass);
  25061. $core.addClass("Transcript", $globals.Service, [], "Platform-Services");
  25062. $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.";
  25063. $core.addMethod(
  25064. $core.method({
  25065. selector: "clear",
  25066. protocol: "printing",
  25067. fn: function (){
  25068. var self=this;
  25069. return $core.withContext(function($ctx1) {
  25070. $recv(self._current())._clear();
  25071. return self;
  25072. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.klass)});
  25073. },
  25074. args: [],
  25075. source: "clear\x0a\x09self current clear",
  25076. referencedClasses: [],
  25077. messageSends: ["clear", "current"]
  25078. }),
  25079. $globals.Transcript.klass);
  25080. $core.addMethod(
  25081. $core.method({
  25082. selector: "cr",
  25083. protocol: "printing",
  25084. fn: function (){
  25085. var self=this;
  25086. return $core.withContext(function($ctx1) {
  25087. $recv(self._current())._show_($recv($globals.String)._cr());
  25088. return self;
  25089. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.klass)});
  25090. },
  25091. args: [],
  25092. source: "cr\x0a\x09self current show: String cr",
  25093. referencedClasses: ["String"],
  25094. messageSends: ["show:", "current", "cr"]
  25095. }),
  25096. $globals.Transcript.klass);
  25097. $core.addMethod(
  25098. $core.method({
  25099. selector: "inspect:",
  25100. protocol: "printing",
  25101. fn: function (anObject){
  25102. var self=this;
  25103. return $core.withContext(function($ctx1) {
  25104. self._show_(anObject);
  25105. return self;
  25106. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.klass)});
  25107. },
  25108. args: ["anObject"],
  25109. source: "inspect: anObject\x0a\x09self show: anObject",
  25110. referencedClasses: [],
  25111. messageSends: ["show:"]
  25112. }),
  25113. $globals.Transcript.klass);
  25114. $core.addMethod(
  25115. $core.method({
  25116. selector: "open",
  25117. protocol: "instance creation",
  25118. fn: function (){
  25119. var self=this;
  25120. return $core.withContext(function($ctx1) {
  25121. $recv(self._current())._open();
  25122. return self;
  25123. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.klass)});
  25124. },
  25125. args: [],
  25126. source: "open\x0a\x09self current open",
  25127. referencedClasses: [],
  25128. messageSends: ["open", "current"]
  25129. }),
  25130. $globals.Transcript.klass);
  25131. $core.addMethod(
  25132. $core.method({
  25133. selector: "show:",
  25134. protocol: "printing",
  25135. fn: function (anObject){
  25136. var self=this;
  25137. return $core.withContext(function($ctx1) {
  25138. $recv(self._current())._show_(anObject);
  25139. return self;
  25140. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.klass)});
  25141. },
  25142. args: ["anObject"],
  25143. source: "show: anObject\x0a\x09self current show: anObject",
  25144. referencedClasses: [],
  25145. messageSends: ["show:", "current"]
  25146. }),
  25147. $globals.Transcript.klass);
  25148. $core.addMethod(
  25149. $core.method({
  25150. selector: "inspectOn:",
  25151. protocol: "*Platform-Services",
  25152. fn: function (anInspector){
  25153. var self=this;
  25154. var variables;
  25155. return $core.withContext(function($ctx1) {
  25156. variables=$recv($globals.Dictionary)._new();
  25157. $recv(variables)._at_put_("#self",self);
  25158. $ctx1.sendIdx["at:put:"]=1;
  25159. $recv(variables)._at_put_("#keys",self._keys());
  25160. $ctx1.sendIdx["at:put:"]=2;
  25161. self._keysAndValuesDo_((function(key,value){
  25162. return $core.withContext(function($ctx2) {
  25163. return $recv(variables)._at_put_(key,value);
  25164. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  25165. }));
  25166. $recv(anInspector)._setLabel_(self._printString());
  25167. $recv(anInspector)._setVariables_(variables);
  25168. return self;
  25169. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  25170. },
  25171. args: ["anInspector"],
  25172. 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",
  25173. referencedClasses: ["Dictionary"],
  25174. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  25175. }),
  25176. $globals.AssociativeCollection);
  25177. $core.addMethod(
  25178. $core.method({
  25179. selector: "inspectOn:",
  25180. protocol: "*Platform-Services",
  25181. fn: function (anInspector){
  25182. var self=this;
  25183. var variables;
  25184. return $core.withContext(function($ctx1) {
  25185. variables=$recv($globals.Dictionary)._new();
  25186. $recv(variables)._at_put_("#self",self);
  25187. $ctx1.sendIdx["at:put:"]=1;
  25188. self._withIndexDo_((function(each,i){
  25189. return $core.withContext(function($ctx2) {
  25190. return $recv(variables)._at_put_(i,each);
  25191. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  25192. }));
  25193. $recv(anInspector)._setLabel_(self._printString());
  25194. $recv(anInspector)._setVariables_(variables);
  25195. return self;
  25196. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  25197. },
  25198. args: ["anInspector"],
  25199. 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",
  25200. referencedClasses: ["Dictionary"],
  25201. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  25202. }),
  25203. $globals.Collection);
  25204. $core.addMethod(
  25205. $core.method({
  25206. selector: "inspectOn:",
  25207. protocol: "*Platform-Services",
  25208. fn: function (anInspector){
  25209. var self=this;
  25210. var variables;
  25211. return $core.withContext(function($ctx1) {
  25212. variables=$recv($globals.Dictionary)._new();
  25213. $recv(variables)._at_put_("#self",self);
  25214. $ctx1.sendIdx["at:put:"]=1;
  25215. $recv(variables)._at_put_("#year",self._year());
  25216. $ctx1.sendIdx["at:put:"]=2;
  25217. $recv(variables)._at_put_("#month",self._month());
  25218. $ctx1.sendIdx["at:put:"]=3;
  25219. $recv(variables)._at_put_("#day",self._day());
  25220. $ctx1.sendIdx["at:put:"]=4;
  25221. $recv(variables)._at_put_("#hours",self._hours());
  25222. $ctx1.sendIdx["at:put:"]=5;
  25223. $recv(variables)._at_put_("#minutes",self._minutes());
  25224. $ctx1.sendIdx["at:put:"]=6;
  25225. $recv(variables)._at_put_("#seconds",self._seconds());
  25226. $ctx1.sendIdx["at:put:"]=7;
  25227. $recv(variables)._at_put_("#milliseconds",self._milliseconds());
  25228. $recv(anInspector)._setLabel_(self._printString());
  25229. $recv(anInspector)._setVariables_(variables);
  25230. return self;
  25231. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  25232. },
  25233. args: ["anInspector"],
  25234. 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",
  25235. referencedClasses: ["Dictionary"],
  25236. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  25237. }),
  25238. $globals.Date);
  25239. $core.addMethod(
  25240. $core.method({
  25241. selector: "inspectOn:",
  25242. protocol: "*Platform-Services",
  25243. fn: function (anInspector){
  25244. var self=this;
  25245. var variables;
  25246. return $core.withContext(function($ctx1) {
  25247. variables=$recv($globals.Dictionary)._new();
  25248. $recv(variables)._at_put_("#self",self._jsObject());
  25249. $recv(anInspector)._setLabel_(self._printString());
  25250. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  25251. $recv(anInspector)._setVariables_(variables);
  25252. return self;
  25253. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  25254. },
  25255. args: ["anInspector"],
  25256. 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",
  25257. referencedClasses: ["Dictionary", "JSObjectProxy"],
  25258. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  25259. }),
  25260. $globals.JSObjectProxy);
  25261. $core.addMethod(
  25262. $core.method({
  25263. selector: "inspectOn:",
  25264. protocol: "*Platform-Services",
  25265. fn: function (anInspector){
  25266. var self=this;
  25267. var variables;
  25268. return $core.withContext(function($ctx1) {
  25269. variables=$recv($globals.Dictionary)._new();
  25270. $recv(variables)._at_put_("#self",self);
  25271. $ctx1.sendIdx["at:put:"]=1;
  25272. $recv(variables)._at_put_("#home",self._home());
  25273. $ctx1.sendIdx["at:put:"]=2;
  25274. $recv(variables)._at_put_("#receiver",self._receiver());
  25275. $ctx1.sendIdx["at:put:"]=3;
  25276. $recv(variables)._at_put_("#selector",self._selector());
  25277. $ctx1.sendIdx["at:put:"]=4;
  25278. $recv(variables)._at_put_("#locals",self._locals());
  25279. $ctx1.sendIdx["at:put:"]=5;
  25280. $recv($recv(self._class())._instanceVariableNames())._do_((function(each){
  25281. return $core.withContext(function($ctx2) {
  25282. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  25283. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25284. }));
  25285. $recv(anInspector)._setLabel_(self._printString());
  25286. $recv(anInspector)._setVariables_(variables);
  25287. return self;
  25288. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  25289. },
  25290. args: ["anInspector"],
  25291. 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",
  25292. referencedClasses: ["Dictionary"],
  25293. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  25294. }),
  25295. $globals.MethodContext);
  25296. $core.addMethod(
  25297. $core.method({
  25298. selector: "inspectOn:",
  25299. protocol: "*Platform-Services",
  25300. fn: function (anInspector){
  25301. var self=this;
  25302. var variables;
  25303. return $core.withContext(function($ctx1) {
  25304. variables=$recv($globals.Dictionary)._new();
  25305. $recv(variables)._at_put_("#self",self);
  25306. $ctx1.sendIdx["at:put:"]=1;
  25307. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  25308. return $core.withContext(function($ctx2) {
  25309. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  25310. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25311. }));
  25312. $recv(anInspector)._setLabel_(self._printString());
  25313. $recv(anInspector)._setVariables_(variables);
  25314. return self;
  25315. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  25316. },
  25317. args: ["anInspector"],
  25318. 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",
  25319. referencedClasses: ["Dictionary"],
  25320. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  25321. }),
  25322. $globals.Object);
  25323. $core.addMethod(
  25324. $core.method({
  25325. selector: "do:displayingProgress:",
  25326. protocol: "*Platform-Services",
  25327. fn: function (aBlock,aString){
  25328. var self=this;
  25329. return $core.withContext(function($ctx1) {
  25330. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  25331. return self;
  25332. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  25333. },
  25334. args: ["aBlock", "aString"],
  25335. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  25336. referencedClasses: ["ProgressHandler"],
  25337. messageSends: ["do:on:displaying:"]
  25338. }),
  25339. $globals.SequenceableCollection);
  25340. $core.addMethod(
  25341. $core.method({
  25342. selector: "inspectOn:",
  25343. protocol: "*Platform-Services",
  25344. fn: function (anInspector){
  25345. var self=this;
  25346. var variables,i;
  25347. return $core.withContext(function($ctx1) {
  25348. variables=$recv($globals.Dictionary)._new();
  25349. $recv(variables)._at_put_("#self",self);
  25350. $ctx1.sendIdx["at:put:"]=1;
  25351. i=(1);
  25352. self._do_((function(each){
  25353. return $core.withContext(function($ctx2) {
  25354. $recv(variables)._at_put_(i,each);
  25355. i=$recv(i).__plus((1));
  25356. return i;
  25357. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25358. }));
  25359. $recv(anInspector)._setLabel_(self._printString());
  25360. $recv(anInspector)._setVariables_(variables);
  25361. return self;
  25362. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  25363. },
  25364. args: ["anInspector"],
  25365. 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",
  25366. referencedClasses: ["Dictionary"],
  25367. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  25368. }),
  25369. $globals.Set);
  25370. $core.addMethod(
  25371. $core.method({
  25372. selector: "inspectOn:",
  25373. protocol: "*Platform-Services",
  25374. fn: function (anInspector){
  25375. var self=this;
  25376. var label;
  25377. return $core.withContext(function($ctx1) {
  25378. var $3,$2,$1,$5,$4;
  25379. (
  25380. $ctx1.supercall = true,
  25381. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($recv(self), [anInspector]));
  25382. $ctx1.supercall = false;
  25383. $3=self._printString();
  25384. $ctx1.sendIdx["printString"]=1;
  25385. $2=$recv($3)._size();
  25386. $1=$recv($2).__gt((30));
  25387. if($core.assert($1)){
  25388. $5=self._printString();
  25389. $ctx1.sendIdx["printString"]=2;
  25390. $4=$recv($5)._copyFrom_to_((1),(30));
  25391. label=$recv($4).__comma("...'");
  25392. label;
  25393. } else {
  25394. label=self._printString();
  25395. label;
  25396. }
  25397. $recv(anInspector)._setLabel_(label);
  25398. return self;
  25399. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  25400. },
  25401. args: ["anInspector"],
  25402. 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",
  25403. referencedClasses: [],
  25404. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  25405. }),
  25406. $globals.String);
  25407. });
  25408. define('amber_core/Platform-Node',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  25409. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  25410. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  25411. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  25412. $core.addPackage("Platform-Node");
  25413. $core.packages["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  25414. $core.packages["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  25415. $core.addClass("NodePlatform", $globals.Object, [], "Platform-Node");
  25416. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  25417. $core.addMethod(
  25418. $core.method({
  25419. selector: "globals",
  25420. protocol: "accessing",
  25421. fn: function (){
  25422. var self=this;
  25423. return global;
  25424. },
  25425. args: [],
  25426. source: "globals\x0a\x09^ global",
  25427. referencedClasses: [],
  25428. messageSends: []
  25429. }),
  25430. $globals.NodePlatform);
  25431. $core.addMethod(
  25432. $core.method({
  25433. selector: "newXhr",
  25434. protocol: "accessing",
  25435. fn: function (){
  25436. var self=this;
  25437. return $core.withContext(function($ctx1) {
  25438. var $receiver;
  25439. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.isNil){
  25440. self._error_("XMLHttpRequest not available.");
  25441. } else {
  25442. return $recv($globals.XMLHttpRequest)._new();
  25443. }
  25444. return self;
  25445. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  25446. },
  25447. args: [],
  25448. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  25449. referencedClasses: ["XMLHttpRequest"],
  25450. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  25451. }),
  25452. $globals.NodePlatform);
  25453. $core.addMethod(
  25454. $core.method({
  25455. selector: "initialize",
  25456. protocol: "testing",
  25457. fn: function (){
  25458. var self=this;
  25459. return $core.withContext(function($ctx1) {
  25460. var $1;
  25461. $1=self._isFeasible();
  25462. if($core.assert($1)){
  25463. $recv($globals.Platform)._registerIfNone_(self._new());
  25464. }
  25465. return self;
  25466. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.klass)});
  25467. },
  25468. args: [],
  25469. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  25470. referencedClasses: ["Platform"],
  25471. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  25472. }),
  25473. $globals.NodePlatform.klass);
  25474. $core.addMethod(
  25475. $core.method({
  25476. selector: "isFeasible",
  25477. protocol: "testing",
  25478. fn: function (){
  25479. var self=this;
  25480. return $core.withContext(function($ctx1) {
  25481. return typeof global !== "undefined";
  25482. return self;
  25483. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.klass)});
  25484. },
  25485. args: [],
  25486. source: "isFeasible\x0a<inlineJS: 'return typeof global !== \x22undefined\x22'>",
  25487. referencedClasses: [],
  25488. messageSends: []
  25489. }),
  25490. $globals.NodePlatform.klass);
  25491. });
  25492. define('amber/deploy',[
  25493. './helpers',
  25494. './compatibility', // pre-fetch, dep of ./boot
  25495. './kernel-fundamentals', // pre-fetch, dep of ./boot
  25496. './kernel-language', // pre-fetch, dep of ./boot
  25497. './boot', // pre-fetch, dep of ./helpers
  25498. // --- packages of the core Amber begin here ---
  25499. 'amber_core/Kernel-Objects',
  25500. 'amber_core/Kernel-Classes',
  25501. 'amber_core/Kernel-Methods',
  25502. 'amber_core/Kernel-Collections',
  25503. 'amber_core/Kernel-Dag',
  25504. 'amber_core/Kernel-Infrastructure',
  25505. 'amber_core/Kernel-Promises',
  25506. 'amber_core/Kernel-Exceptions',
  25507. 'amber_core/Kernel-Announcements',
  25508. 'amber_core/Platform-Services',
  25509. 'amber/Platform'
  25510. // --- packages of the core Amber end here ---
  25511. ], function (amber) {
  25512. return amber;
  25513. });
  25514. define('amber/parser',['./boot'], function($boot) {
  25515. var $globals = $boot.globals, nil = $boot.nilAsReceiver;
  25516. $globals.SmalltalkParser = (function() {
  25517. "use strict";
  25518. /*
  25519. * Generated by PEG.js 0.9.0.
  25520. *
  25521. * http://pegjs.org/
  25522. */
  25523. function peg$subclass(child, parent) {
  25524. function ctor() { this.constructor = child; }
  25525. ctor.prototype = parent.prototype;
  25526. child.prototype = new ctor();
  25527. }
  25528. function peg$SyntaxError(message, expected, found, location) {
  25529. this.message = message;
  25530. this.expected = expected;
  25531. this.found = found;
  25532. this.location = location;
  25533. this.name = "SyntaxError";
  25534. if (typeof Error.captureStackTrace === "function") {
  25535. Error.captureStackTrace(this, peg$SyntaxError);
  25536. }
  25537. }
  25538. peg$subclass(peg$SyntaxError, Error);
  25539. function peg$parse(input) {
  25540. var options = arguments.length > 1 ? arguments[1] : {},
  25541. parser = this,
  25542. peg$FAILED = {},
  25543. peg$startRuleFunctions = { start: peg$parsestart },
  25544. peg$startRuleFunction = peg$parsestart,
  25545. peg$c0 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/,
  25546. peg$c1 = { type: "class", value: "[ \\t\\v\\f\\u00A0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\v\\f\\u00A0\\uFEFF\\n\\r\\u2028\\u2029]" },
  25547. peg$c2 = "\"",
  25548. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  25549. peg$c4 = /^[^"]/,
  25550. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  25551. peg$c6 = ".",
  25552. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  25553. peg$c8 = /^[a-zA-Z]/,
  25554. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  25555. peg$c10 = /^[a-zA-Z0-9]/,
  25556. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  25557. peg$c12 = function(first, others) {return first + others.join("");},
  25558. peg$c13 = ":",
  25559. peg$c14 = { type: "literal", value: ":", description: "\":\"" },
  25560. peg$c15 = function(first, last) {return first + last;},
  25561. peg$c16 = /^[A-Z]/,
  25562. peg$c17 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  25563. peg$c18 = function(contents) {
  25564. return $globals.ValueNode._new()
  25565. ._location_(location())
  25566. ._source_(text())
  25567. ._value_(contents);
  25568. },
  25569. peg$c19 = "'",
  25570. peg$c20 = { type: "literal", value: "'", description: "\"'\"" },
  25571. peg$c21 = "''",
  25572. peg$c22 = { type: "literal", value: "''", description: "\"''\"" },
  25573. peg$c23 = function() {return "'";},
  25574. peg$c24 = /^[^']/,
  25575. peg$c25 = { type: "class", value: "[^']", description: "[^']" },
  25576. peg$c26 = function(val) {return val.join("");},
  25577. peg$c27 = "$",
  25578. peg$c28 = { type: "literal", value: "$", description: "\"$\"" },
  25579. peg$c29 = { type: "any", description: "any character" },
  25580. peg$c30 = function(char) {
  25581. return $globals.ValueNode._new()
  25582. ._location_(location())
  25583. ._source_(text())
  25584. ._value_(char);
  25585. },
  25586. peg$c31 = "#",
  25587. peg$c32 = { type: "literal", value: "#", description: "\"#\"" },
  25588. peg$c33 = function(rest) {return rest;},
  25589. peg$c34 = function(keywords) {return keywords.join("");},
  25590. peg$c35 = function(val) {
  25591. return $globals.ValueNode._new()
  25592. ._location_(location())
  25593. ._source_(text())
  25594. ._value_(val);
  25595. },
  25596. peg$c36 = function(n) {
  25597. return $globals.ValueNode._new()
  25598. ._location_(location())
  25599. ._source_(text())
  25600. ._value_(n);
  25601. },
  25602. peg$c37 = "e",
  25603. peg$c38 = { type: "literal", value: "e", description: "\"e\"" },
  25604. peg$c39 = function(n) {return parseFloat(n.join(""));},
  25605. peg$c40 = "-",
  25606. peg$c41 = { type: "literal", value: "-", description: "\"-\"" },
  25607. peg$c42 = "16r",
  25608. peg$c43 = { type: "literal", value: "16r", description: "\"16r\"" },
  25609. peg$c44 = /^[0-9a-fA-F]/,
  25610. peg$c45 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  25611. peg$c46 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);},
  25612. peg$c47 = /^[0-9]/,
  25613. peg$c48 = { type: "class", value: "[0-9]", description: "[0-9]" },
  25614. peg$c49 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);},
  25615. peg$c50 = function(neg, digits) {return (parseInt((neg || '') + digits.join(""), 10));},
  25616. peg$c51 = "#(",
  25617. peg$c52 = { type: "literal", value: "#(", description: "\"#(\"" },
  25618. peg$c53 = ")",
  25619. peg$c54 = { type: "literal", value: ")", description: "\")\"" },
  25620. peg$c55 = function(rest) {
  25621. return rest
  25622. ._location_(location())
  25623. ._source_(text());
  25624. },
  25625. peg$c56 = "(",
  25626. peg$c57 = { type: "literal", value: "(", description: "\"(\"" },
  25627. peg$c58 = function(lit) {return lit._value();},
  25628. peg$c59 = function(lits) {
  25629. return $globals.ValueNode._new()
  25630. ._value_(lits);
  25631. },
  25632. peg$c60 = "{",
  25633. peg$c61 = { type: "literal", value: "{", description: "\"{\"" },
  25634. peg$c62 = "}",
  25635. peg$c63 = { type: "literal", value: "}", description: "\"}\"" },
  25636. peg$c64 = function(expressions) {
  25637. return $globals.DynamicArrayNode._new()
  25638. ._location_(location())
  25639. ._source_(text())
  25640. ._dagChildren_(expressions || []);
  25641. },
  25642. peg$c65 = "#{",
  25643. peg$c66 = { type: "literal", value: "#{", description: "\"#{\"" },
  25644. peg$c67 = function(expressions) {
  25645. return $globals.DynamicDictionaryNode._new()
  25646. ._location_(location())
  25647. ._source_(text())
  25648. ._dagChildren_(expressions || []);
  25649. },
  25650. peg$c68 = "true",
  25651. peg$c69 = { type: "literal", value: "true", description: "\"true\"" },
  25652. peg$c70 = function() {return true;},
  25653. peg$c71 = "false",
  25654. peg$c72 = { type: "literal", value: "false", description: "\"false\"" },
  25655. peg$c73 = function() {return false;},
  25656. peg$c74 = "nil",
  25657. peg$c75 = { type: "literal", value: "nil", description: "\"nil\"" },
  25658. peg$c76 = function() {return nil;},
  25659. peg$c77 = function(val) {
  25660. return $globals.ValueNode._new()
  25661. ._location_(location())
  25662. ._source_(text())
  25663. ._value_(val);
  25664. },
  25665. peg$c78 = function(identifier) {
  25666. return $globals.VariableNode._new()
  25667. ._location_(location())
  25668. ._source_(text())
  25669. ._value_(identifier);
  25670. },
  25671. peg$c79 = /^[\\+*\/=><,@%~|&\-]/,
  25672. peg$c80 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  25673. peg$c81 = function(bin) {return bin.join("");},
  25674. peg$c82 = function(key, arg) {return {key:key, arg:arg};},
  25675. peg$c83 = function(pairs) {
  25676. var selector = "";
  25677. var params = [];
  25678. for(var i = 0; i < pairs.length; i++){
  25679. selector += pairs[i].key;
  25680. params.push(pairs[i].arg);
  25681. }
  25682. return [selector, params];
  25683. },
  25684. peg$c84 = function(selector, arg) {return [selector, [arg]];},
  25685. peg$c85 = function(selector) {return [selector, []];},
  25686. peg$c86 = function(expression) {return expression;},
  25687. peg$c87 = function(first, others) { return [first].concat(others); },
  25688. peg$c88 = ":=",
  25689. peg$c89 = { type: "literal", value: ":=", description: "\":=\"" },
  25690. peg$c90 = function(variable, expression) {
  25691. return $globals.AssignmentNode._new()
  25692. ._location_(location())
  25693. ._source_(text())
  25694. ._left_(variable)
  25695. ._right_(expression);
  25696. },
  25697. peg$c91 = "^",
  25698. peg$c92 = { type: "literal", value: "^", description: "\"^\"" },
  25699. peg$c93 = function(expression) {
  25700. return $globals.ReturnNode._new()
  25701. ._location_(location())
  25702. ._source_(text())
  25703. ._dagChildren_([expression]);
  25704. },
  25705. peg$c94 = "|",
  25706. peg$c95 = { type: "literal", value: "|", description: "\"|\"" },
  25707. peg$c96 = function(variable) {return variable;},
  25708. peg$c97 = function(vars) {return vars;},
  25709. peg$c98 = function(param) {return param;},
  25710. peg$c99 = function(params) {return params;},
  25711. peg$c100 = function(ret) {return [ret];},
  25712. peg$c101 = function(exps, ret) {
  25713. var expressions = exps;
  25714. expressions.push(ret);
  25715. return expressions;
  25716. },
  25717. peg$c102 = function(expressions) {
  25718. return expressions || [];
  25719. },
  25720. peg$c103 = function(js) { return js; },
  25721. peg$c104 = function(temps, statements) {
  25722. return $globals.SequenceNode._new()
  25723. ._location_(location())
  25724. ._source_(text())
  25725. ._temps_(temps || [])
  25726. ._dagChildren_(statements || []);
  25727. },
  25728. peg$c105 = "[",
  25729. peg$c106 = { type: "literal", value: "[", description: "\"[\"" },
  25730. peg$c107 = "]",
  25731. peg$c108 = { type: "literal", value: "]", description: "\"]\"" },
  25732. peg$c109 = function(params, sequence) {
  25733. return $globals.BlockNode._new()
  25734. ._location_(location())
  25735. ._source_(text())
  25736. ._parameters_(params || [])
  25737. ._dagChildren_([sequence._asBlockSequenceNode()]);
  25738. },
  25739. peg$c110 = function(selector) {
  25740. return $globals.SendNode._new()
  25741. ._location_(location())
  25742. ._source_(text())
  25743. ._selector_(selector);
  25744. },
  25745. peg$c111 = function(receiver, tail) {
  25746. return receiver._withTail_(tail);
  25747. },
  25748. peg$c112 = function(selector, arg) {
  25749. return $globals.SendNode._new()
  25750. ._location_(location())
  25751. ._source_(text())
  25752. ._selector_(selector)
  25753. ._arguments_([arg]);
  25754. },
  25755. peg$c113 = function(pairs) {
  25756. var selector = "";
  25757. var args = [];
  25758. for(var i = 0; i < pairs.length; i++) {
  25759. selector += pairs[i].key;
  25760. args.push(pairs[i].arg);
  25761. }
  25762. return $globals.SendNode._new()
  25763. ._location_(location())
  25764. ._source_(text())
  25765. ._selector_(selector)
  25766. ._arguments_(args);
  25767. },
  25768. peg$c114 = function(receiver, tail) {
  25769. return tail ? receiver._withTail_([tail]) : receiver;
  25770. },
  25771. peg$c115 = function(send) { return send._isSendNode(); },
  25772. peg$c116 = ";",
  25773. peg$c117 = { type: "literal", value: ";", description: "\";\"" },
  25774. peg$c118 = function(send, mess) {return mess;},
  25775. peg$c119 = function(send, messages) {
  25776. messages.unshift(send);
  25777. return $globals.CascadeNode._new()
  25778. ._location_(location())
  25779. ._source_(text())
  25780. ._dagChildren_(messages);
  25781. },
  25782. peg$c120 = "<",
  25783. peg$c121 = { type: "literal", value: "<", description: "\"<\"" },
  25784. peg$c122 = ">>",
  25785. peg$c123 = { type: "literal", value: ">>", description: "\">>\"" },
  25786. peg$c124 = function() {return ">";},
  25787. peg$c125 = /^[^>]/,
  25788. peg$c126 = { type: "class", value: "[^>]", description: "[^>]" },
  25789. peg$c127 = ">",
  25790. peg$c128 = { type: "literal", value: ">", description: "\">\"" },
  25791. peg$c129 = function(val) { return !/^\s*inlineJS/.test(val.join("")) },
  25792. peg$c130 = function(val) {
  25793. console.warn("Use of <...js code...> is deprecated, in:\n" + val.join(""));
  25794. return $globals.JSStatementNode._new()
  25795. ._location_(location())
  25796. ._source_(val.join(""))
  25797. },
  25798. peg$c131 = "inlineJS:",
  25799. peg$c132 = { type: "literal", value: "inlineJS:", description: "\"inlineJS:\"" },
  25800. peg$c133 = function(val) {
  25801. return $globals.JSStatementNode._new()
  25802. ._location_(location())
  25803. ._source_(val)
  25804. },
  25805. peg$c134 = function(pattern, sequence) {
  25806. return $globals.MethodNode._new()
  25807. ._location_(location())
  25808. ._source_(text())
  25809. ._selector_(pattern[0])
  25810. ._arguments_(pattern[1])
  25811. ._dagChildren_([sequence]);
  25812. },
  25813. peg$c135 = function(send) { return send._isSendNode() && send._selector() === "->" },
  25814. peg$c136 = function(send) { return [send._receiver(), send._arguments()[0]]; },
  25815. peg$c137 = function(first, others) { return first.concat.apply(first, others); },
  25816. peg$currPos = 0,
  25817. peg$savedPos = 0,
  25818. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  25819. peg$maxFailPos = 0,
  25820. peg$maxFailExpected = [],
  25821. peg$silentFails = 0,
  25822. peg$resultsCache = {},
  25823. peg$result;
  25824. if ("startRule" in options) {
  25825. if (!(options.startRule in peg$startRuleFunctions)) {
  25826. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  25827. }
  25828. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  25829. }
  25830. function text() {
  25831. return input.substring(peg$savedPos, peg$currPos);
  25832. }
  25833. function location() {
  25834. return peg$computeLocation(peg$savedPos, peg$currPos);
  25835. }
  25836. function expected(description) {
  25837. throw peg$buildException(
  25838. null,
  25839. [{ type: "other", description: description }],
  25840. input.substring(peg$savedPos, peg$currPos),
  25841. peg$computeLocation(peg$savedPos, peg$currPos)
  25842. );
  25843. }
  25844. function error(message) {
  25845. throw peg$buildException(
  25846. message,
  25847. null,
  25848. input.substring(peg$savedPos, peg$currPos),
  25849. peg$computeLocation(peg$savedPos, peg$currPos)
  25850. );
  25851. }
  25852. function peg$computePosDetails(pos) {
  25853. var details = peg$posDetailsCache[pos],
  25854. p, ch;
  25855. if (details) {
  25856. return details;
  25857. } else {
  25858. p = pos - 1;
  25859. while (!peg$posDetailsCache[p]) {
  25860. p--;
  25861. }
  25862. details = peg$posDetailsCache[p];
  25863. details = {
  25864. line: details.line,
  25865. column: details.column,
  25866. seenCR: details.seenCR
  25867. };
  25868. while (p < pos) {
  25869. ch = input.charAt(p);
  25870. if (ch === "\n") {
  25871. if (!details.seenCR) { details.line++; }
  25872. details.column = 1;
  25873. details.seenCR = false;
  25874. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  25875. details.line++;
  25876. details.column = 1;
  25877. details.seenCR = true;
  25878. } else {
  25879. details.column++;
  25880. details.seenCR = false;
  25881. }
  25882. p++;
  25883. }
  25884. peg$posDetailsCache[pos] = details;
  25885. return details;
  25886. }
  25887. }
  25888. function peg$computeLocation(startPos, endPos) {
  25889. var startPosDetails = peg$computePosDetails(startPos),
  25890. endPosDetails = peg$computePosDetails(endPos);
  25891. return {
  25892. start: {
  25893. offset: startPos,
  25894. line: startPosDetails.line,
  25895. column: startPosDetails.column
  25896. },
  25897. end: {
  25898. offset: endPos,
  25899. line: endPosDetails.line,
  25900. column: endPosDetails.column
  25901. }
  25902. };
  25903. }
  25904. function peg$fail(expected) {
  25905. if (peg$currPos < peg$maxFailPos) { return; }
  25906. if (peg$currPos > peg$maxFailPos) {
  25907. peg$maxFailPos = peg$currPos;
  25908. peg$maxFailExpected = [];
  25909. }
  25910. peg$maxFailExpected.push(expected);
  25911. }
  25912. function peg$buildException(message, expected, found, location) {
  25913. function cleanupExpected(expected) {
  25914. var i = 1;
  25915. expected.sort(function(a, b) {
  25916. if (a.description < b.description) {
  25917. return -1;
  25918. } else if (a.description > b.description) {
  25919. return 1;
  25920. } else {
  25921. return 0;
  25922. }
  25923. });
  25924. while (i < expected.length) {
  25925. if (expected[i - 1] === expected[i]) {
  25926. expected.splice(i, 1);
  25927. } else {
  25928. i++;
  25929. }
  25930. }
  25931. }
  25932. function buildMessage(expected, found) {
  25933. function stringEscape(s) {
  25934. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  25935. return s
  25936. .replace(/\\/g, '\\\\')
  25937. .replace(/"/g, '\\"')
  25938. .replace(/\x08/g, '\\b')
  25939. .replace(/\t/g, '\\t')
  25940. .replace(/\n/g, '\\n')
  25941. .replace(/\f/g, '\\f')
  25942. .replace(/\r/g, '\\r')
  25943. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  25944. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  25945. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  25946. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  25947. }
  25948. var expectedDescs = new Array(expected.length),
  25949. expectedDesc, foundDesc, i;
  25950. for (i = 0; i < expected.length; i++) {
  25951. expectedDescs[i] = expected[i].description;
  25952. }
  25953. expectedDesc = expected.length > 1
  25954. ? expectedDescs.slice(0, -1).join(", ")
  25955. + " or "
  25956. + expectedDescs[expected.length - 1]
  25957. : expectedDescs[0];
  25958. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  25959. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  25960. }
  25961. if (expected !== null) {
  25962. cleanupExpected(expected);
  25963. }
  25964. return new peg$SyntaxError(
  25965. message !== null ? message : buildMessage(expected, found),
  25966. expected,
  25967. found,
  25968. location
  25969. );
  25970. }
  25971. function peg$parsestart() {
  25972. var s0;
  25973. var key = peg$currPos * 61 + 0,
  25974. cached = peg$resultsCache[key];
  25975. if (cached) {
  25976. peg$currPos = cached.nextPos;
  25977. return cached.result;
  25978. }
  25979. s0 = peg$parsemethod();
  25980. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25981. return s0;
  25982. }
  25983. function peg$parseseparator() {
  25984. var s0, s1;
  25985. var key = peg$currPos * 61 + 1,
  25986. cached = peg$resultsCache[key];
  25987. if (cached) {
  25988. peg$currPos = cached.nextPos;
  25989. return cached.result;
  25990. }
  25991. s0 = [];
  25992. if (peg$c0.test(input.charAt(peg$currPos))) {
  25993. s1 = input.charAt(peg$currPos);
  25994. peg$currPos++;
  25995. } else {
  25996. s1 = peg$FAILED;
  25997. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  25998. }
  25999. if (s1 !== peg$FAILED) {
  26000. while (s1 !== peg$FAILED) {
  26001. s0.push(s1);
  26002. if (peg$c0.test(input.charAt(peg$currPos))) {
  26003. s1 = input.charAt(peg$currPos);
  26004. peg$currPos++;
  26005. } else {
  26006. s1 = peg$FAILED;
  26007. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  26008. }
  26009. }
  26010. } else {
  26011. s0 = peg$FAILED;
  26012. }
  26013. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26014. return s0;
  26015. }
  26016. function peg$parsecomments() {
  26017. var s0, s1, s2, s3, s4;
  26018. var key = peg$currPos * 61 + 2,
  26019. cached = peg$resultsCache[key];
  26020. if (cached) {
  26021. peg$currPos = cached.nextPos;
  26022. return cached.result;
  26023. }
  26024. s0 = [];
  26025. s1 = peg$currPos;
  26026. if (input.charCodeAt(peg$currPos) === 34) {
  26027. s2 = peg$c2;
  26028. peg$currPos++;
  26029. } else {
  26030. s2 = peg$FAILED;
  26031. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  26032. }
  26033. if (s2 !== peg$FAILED) {
  26034. s3 = [];
  26035. if (peg$c4.test(input.charAt(peg$currPos))) {
  26036. s4 = input.charAt(peg$currPos);
  26037. peg$currPos++;
  26038. } else {
  26039. s4 = peg$FAILED;
  26040. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  26041. }
  26042. while (s4 !== peg$FAILED) {
  26043. s3.push(s4);
  26044. if (peg$c4.test(input.charAt(peg$currPos))) {
  26045. s4 = input.charAt(peg$currPos);
  26046. peg$currPos++;
  26047. } else {
  26048. s4 = peg$FAILED;
  26049. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  26050. }
  26051. }
  26052. if (s3 !== peg$FAILED) {
  26053. if (input.charCodeAt(peg$currPos) === 34) {
  26054. s4 = peg$c2;
  26055. peg$currPos++;
  26056. } else {
  26057. s4 = peg$FAILED;
  26058. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  26059. }
  26060. if (s4 !== peg$FAILED) {
  26061. s2 = [s2, s3, s4];
  26062. s1 = s2;
  26063. } else {
  26064. peg$currPos = s1;
  26065. s1 = peg$FAILED;
  26066. }
  26067. } else {
  26068. peg$currPos = s1;
  26069. s1 = peg$FAILED;
  26070. }
  26071. } else {
  26072. peg$currPos = s1;
  26073. s1 = peg$FAILED;
  26074. }
  26075. if (s1 !== peg$FAILED) {
  26076. while (s1 !== peg$FAILED) {
  26077. s0.push(s1);
  26078. s1 = peg$currPos;
  26079. if (input.charCodeAt(peg$currPos) === 34) {
  26080. s2 = peg$c2;
  26081. peg$currPos++;
  26082. } else {
  26083. s2 = peg$FAILED;
  26084. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  26085. }
  26086. if (s2 !== peg$FAILED) {
  26087. s3 = [];
  26088. if (peg$c4.test(input.charAt(peg$currPos))) {
  26089. s4 = input.charAt(peg$currPos);
  26090. peg$currPos++;
  26091. } else {
  26092. s4 = peg$FAILED;
  26093. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  26094. }
  26095. while (s4 !== peg$FAILED) {
  26096. s3.push(s4);
  26097. if (peg$c4.test(input.charAt(peg$currPos))) {
  26098. s4 = input.charAt(peg$currPos);
  26099. peg$currPos++;
  26100. } else {
  26101. s4 = peg$FAILED;
  26102. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  26103. }
  26104. }
  26105. if (s3 !== peg$FAILED) {
  26106. if (input.charCodeAt(peg$currPos) === 34) {
  26107. s4 = peg$c2;
  26108. peg$currPos++;
  26109. } else {
  26110. s4 = peg$FAILED;
  26111. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  26112. }
  26113. if (s4 !== peg$FAILED) {
  26114. s2 = [s2, s3, s4];
  26115. s1 = s2;
  26116. } else {
  26117. peg$currPos = s1;
  26118. s1 = peg$FAILED;
  26119. }
  26120. } else {
  26121. peg$currPos = s1;
  26122. s1 = peg$FAILED;
  26123. }
  26124. } else {
  26125. peg$currPos = s1;
  26126. s1 = peg$FAILED;
  26127. }
  26128. }
  26129. } else {
  26130. s0 = peg$FAILED;
  26131. }
  26132. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26133. return s0;
  26134. }
  26135. function peg$parsews() {
  26136. var s0, s1;
  26137. var key = peg$currPos * 61 + 3,
  26138. cached = peg$resultsCache[key];
  26139. if (cached) {
  26140. peg$currPos = cached.nextPos;
  26141. return cached.result;
  26142. }
  26143. s0 = [];
  26144. s1 = peg$parseseparator();
  26145. if (s1 === peg$FAILED) {
  26146. s1 = peg$parsecomments();
  26147. }
  26148. while (s1 !== peg$FAILED) {
  26149. s0.push(s1);
  26150. s1 = peg$parseseparator();
  26151. if (s1 === peg$FAILED) {
  26152. s1 = peg$parsecomments();
  26153. }
  26154. }
  26155. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26156. return s0;
  26157. }
  26158. function peg$parsemaybeDotsWs() {
  26159. var s0, s1;
  26160. var key = peg$currPos * 61 + 4,
  26161. cached = peg$resultsCache[key];
  26162. if (cached) {
  26163. peg$currPos = cached.nextPos;
  26164. return cached.result;
  26165. }
  26166. s0 = [];
  26167. if (input.charCodeAt(peg$currPos) === 46) {
  26168. s1 = peg$c6;
  26169. peg$currPos++;
  26170. } else {
  26171. s1 = peg$FAILED;
  26172. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  26173. }
  26174. if (s1 === peg$FAILED) {
  26175. s1 = peg$parseseparator();
  26176. if (s1 === peg$FAILED) {
  26177. s1 = peg$parsecomments();
  26178. }
  26179. }
  26180. while (s1 !== peg$FAILED) {
  26181. s0.push(s1);
  26182. if (input.charCodeAt(peg$currPos) === 46) {
  26183. s1 = peg$c6;
  26184. peg$currPos++;
  26185. } else {
  26186. s1 = peg$FAILED;
  26187. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  26188. }
  26189. if (s1 === peg$FAILED) {
  26190. s1 = peg$parseseparator();
  26191. if (s1 === peg$FAILED) {
  26192. s1 = peg$parsecomments();
  26193. }
  26194. }
  26195. }
  26196. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26197. return s0;
  26198. }
  26199. function peg$parseidentifier() {
  26200. var s0, s1, s2, s3;
  26201. var key = peg$currPos * 61 + 5,
  26202. cached = peg$resultsCache[key];
  26203. if (cached) {
  26204. peg$currPos = cached.nextPos;
  26205. return cached.result;
  26206. }
  26207. s0 = peg$currPos;
  26208. if (peg$c8.test(input.charAt(peg$currPos))) {
  26209. s1 = input.charAt(peg$currPos);
  26210. peg$currPos++;
  26211. } else {
  26212. s1 = peg$FAILED;
  26213. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  26214. }
  26215. if (s1 !== peg$FAILED) {
  26216. s2 = [];
  26217. if (peg$c10.test(input.charAt(peg$currPos))) {
  26218. s3 = input.charAt(peg$currPos);
  26219. peg$currPos++;
  26220. } else {
  26221. s3 = peg$FAILED;
  26222. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  26223. }
  26224. while (s3 !== peg$FAILED) {
  26225. s2.push(s3);
  26226. if (peg$c10.test(input.charAt(peg$currPos))) {
  26227. s3 = input.charAt(peg$currPos);
  26228. peg$currPos++;
  26229. } else {
  26230. s3 = peg$FAILED;
  26231. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  26232. }
  26233. }
  26234. if (s2 !== peg$FAILED) {
  26235. peg$savedPos = s0;
  26236. s1 = peg$c12(s1, s2);
  26237. s0 = s1;
  26238. } else {
  26239. peg$currPos = s0;
  26240. s0 = peg$FAILED;
  26241. }
  26242. } else {
  26243. peg$currPos = s0;
  26244. s0 = peg$FAILED;
  26245. }
  26246. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26247. return s0;
  26248. }
  26249. function peg$parsekeyword() {
  26250. var s0, s1, s2;
  26251. var key = peg$currPos * 61 + 6,
  26252. cached = peg$resultsCache[key];
  26253. if (cached) {
  26254. peg$currPos = cached.nextPos;
  26255. return cached.result;
  26256. }
  26257. s0 = peg$currPos;
  26258. s1 = peg$parseidentifier();
  26259. if (s1 !== peg$FAILED) {
  26260. if (input.charCodeAt(peg$currPos) === 58) {
  26261. s2 = peg$c13;
  26262. peg$currPos++;
  26263. } else {
  26264. s2 = peg$FAILED;
  26265. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  26266. }
  26267. if (s2 !== peg$FAILED) {
  26268. peg$savedPos = s0;
  26269. s1 = peg$c15(s1, s2);
  26270. s0 = s1;
  26271. } else {
  26272. peg$currPos = s0;
  26273. s0 = peg$FAILED;
  26274. }
  26275. } else {
  26276. peg$currPos = s0;
  26277. s0 = peg$FAILED;
  26278. }
  26279. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26280. return s0;
  26281. }
  26282. function peg$parseclassName() {
  26283. var s0, s1, s2, s3;
  26284. var key = peg$currPos * 61 + 7,
  26285. cached = peg$resultsCache[key];
  26286. if (cached) {
  26287. peg$currPos = cached.nextPos;
  26288. return cached.result;
  26289. }
  26290. s0 = peg$currPos;
  26291. if (peg$c16.test(input.charAt(peg$currPos))) {
  26292. s1 = input.charAt(peg$currPos);
  26293. peg$currPos++;
  26294. } else {
  26295. s1 = peg$FAILED;
  26296. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  26297. }
  26298. if (s1 !== peg$FAILED) {
  26299. s2 = [];
  26300. if (peg$c10.test(input.charAt(peg$currPos))) {
  26301. s3 = input.charAt(peg$currPos);
  26302. peg$currPos++;
  26303. } else {
  26304. s3 = peg$FAILED;
  26305. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  26306. }
  26307. while (s3 !== peg$FAILED) {
  26308. s2.push(s3);
  26309. if (peg$c10.test(input.charAt(peg$currPos))) {
  26310. s3 = input.charAt(peg$currPos);
  26311. peg$currPos++;
  26312. } else {
  26313. s3 = peg$FAILED;
  26314. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  26315. }
  26316. }
  26317. if (s2 !== peg$FAILED) {
  26318. peg$savedPos = s0;
  26319. s1 = peg$c12(s1, s2);
  26320. s0 = s1;
  26321. } else {
  26322. peg$currPos = s0;
  26323. s0 = peg$FAILED;
  26324. }
  26325. } else {
  26326. peg$currPos = s0;
  26327. s0 = peg$FAILED;
  26328. }
  26329. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26330. return s0;
  26331. }
  26332. function peg$parsestring() {
  26333. var s0, s1;
  26334. var key = peg$currPos * 61 + 8,
  26335. cached = peg$resultsCache[key];
  26336. if (cached) {
  26337. peg$currPos = cached.nextPos;
  26338. return cached.result;
  26339. }
  26340. s0 = peg$currPos;
  26341. s1 = peg$parserawString();
  26342. if (s1 !== peg$FAILED) {
  26343. peg$savedPos = s0;
  26344. s1 = peg$c18(s1);
  26345. }
  26346. s0 = s1;
  26347. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26348. return s0;
  26349. }
  26350. function peg$parserawString() {
  26351. var s0, s1, s2, s3, s4;
  26352. var key = peg$currPos * 61 + 9,
  26353. cached = peg$resultsCache[key];
  26354. if (cached) {
  26355. peg$currPos = cached.nextPos;
  26356. return cached.result;
  26357. }
  26358. s0 = peg$currPos;
  26359. if (input.charCodeAt(peg$currPos) === 39) {
  26360. s1 = peg$c19;
  26361. peg$currPos++;
  26362. } else {
  26363. s1 = peg$FAILED;
  26364. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  26365. }
  26366. if (s1 !== peg$FAILED) {
  26367. s2 = [];
  26368. s3 = peg$currPos;
  26369. if (input.substr(peg$currPos, 2) === peg$c21) {
  26370. s4 = peg$c21;
  26371. peg$currPos += 2;
  26372. } else {
  26373. s4 = peg$FAILED;
  26374. if (peg$silentFails === 0) { peg$fail(peg$c22); }
  26375. }
  26376. if (s4 !== peg$FAILED) {
  26377. peg$savedPos = s3;
  26378. s4 = peg$c23();
  26379. }
  26380. s3 = s4;
  26381. if (s3 === peg$FAILED) {
  26382. if (peg$c24.test(input.charAt(peg$currPos))) {
  26383. s3 = input.charAt(peg$currPos);
  26384. peg$currPos++;
  26385. } else {
  26386. s3 = peg$FAILED;
  26387. if (peg$silentFails === 0) { peg$fail(peg$c25); }
  26388. }
  26389. }
  26390. while (s3 !== peg$FAILED) {
  26391. s2.push(s3);
  26392. s3 = peg$currPos;
  26393. if (input.substr(peg$currPos, 2) === peg$c21) {
  26394. s4 = peg$c21;
  26395. peg$currPos += 2;
  26396. } else {
  26397. s4 = peg$FAILED;
  26398. if (peg$silentFails === 0) { peg$fail(peg$c22); }
  26399. }
  26400. if (s4 !== peg$FAILED) {
  26401. peg$savedPos = s3;
  26402. s4 = peg$c23();
  26403. }
  26404. s3 = s4;
  26405. if (s3 === peg$FAILED) {
  26406. if (peg$c24.test(input.charAt(peg$currPos))) {
  26407. s3 = input.charAt(peg$currPos);
  26408. peg$currPos++;
  26409. } else {
  26410. s3 = peg$FAILED;
  26411. if (peg$silentFails === 0) { peg$fail(peg$c25); }
  26412. }
  26413. }
  26414. }
  26415. if (s2 !== peg$FAILED) {
  26416. if (input.charCodeAt(peg$currPos) === 39) {
  26417. s3 = peg$c19;
  26418. peg$currPos++;
  26419. } else {
  26420. s3 = peg$FAILED;
  26421. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  26422. }
  26423. if (s3 !== peg$FAILED) {
  26424. peg$savedPos = s0;
  26425. s1 = peg$c26(s2);
  26426. s0 = s1;
  26427. } else {
  26428. peg$currPos = s0;
  26429. s0 = peg$FAILED;
  26430. }
  26431. } else {
  26432. peg$currPos = s0;
  26433. s0 = peg$FAILED;
  26434. }
  26435. } else {
  26436. peg$currPos = s0;
  26437. s0 = peg$FAILED;
  26438. }
  26439. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26440. return s0;
  26441. }
  26442. function peg$parsecharacter() {
  26443. var s0, s1, s2;
  26444. var key = peg$currPos * 61 + 10,
  26445. cached = peg$resultsCache[key];
  26446. if (cached) {
  26447. peg$currPos = cached.nextPos;
  26448. return cached.result;
  26449. }
  26450. s0 = peg$currPos;
  26451. if (input.charCodeAt(peg$currPos) === 36) {
  26452. s1 = peg$c27;
  26453. peg$currPos++;
  26454. } else {
  26455. s1 = peg$FAILED;
  26456. if (peg$silentFails === 0) { peg$fail(peg$c28); }
  26457. }
  26458. if (s1 !== peg$FAILED) {
  26459. if (input.length > peg$currPos) {
  26460. s2 = input.charAt(peg$currPos);
  26461. peg$currPos++;
  26462. } else {
  26463. s2 = peg$FAILED;
  26464. if (peg$silentFails === 0) { peg$fail(peg$c29); }
  26465. }
  26466. if (s2 !== peg$FAILED) {
  26467. peg$savedPos = s0;
  26468. s1 = peg$c30(s2);
  26469. s0 = s1;
  26470. } else {
  26471. peg$currPos = s0;
  26472. s0 = peg$FAILED;
  26473. }
  26474. } else {
  26475. peg$currPos = s0;
  26476. s0 = peg$FAILED;
  26477. }
  26478. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26479. return s0;
  26480. }
  26481. function peg$parsesymbol() {
  26482. var s0, s1, s2;
  26483. var key = peg$currPos * 61 + 11,
  26484. cached = peg$resultsCache[key];
  26485. if (cached) {
  26486. peg$currPos = cached.nextPos;
  26487. return cached.result;
  26488. }
  26489. s0 = peg$currPos;
  26490. if (input.charCodeAt(peg$currPos) === 35) {
  26491. s1 = peg$c31;
  26492. peg$currPos++;
  26493. } else {
  26494. s1 = peg$FAILED;
  26495. if (peg$silentFails === 0) { peg$fail(peg$c32); }
  26496. }
  26497. if (s1 !== peg$FAILED) {
  26498. s2 = peg$parsebareSymbol();
  26499. if (s2 !== peg$FAILED) {
  26500. peg$savedPos = s0;
  26501. s1 = peg$c33(s2);
  26502. s0 = s1;
  26503. } else {
  26504. peg$currPos = s0;
  26505. s0 = peg$FAILED;
  26506. }
  26507. } else {
  26508. peg$currPos = s0;
  26509. s0 = peg$FAILED;
  26510. }
  26511. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26512. return s0;
  26513. }
  26514. function peg$parsebareSymbol() {
  26515. var s0, s1, s2, s3;
  26516. var key = peg$currPos * 61 + 12,
  26517. cached = peg$resultsCache[key];
  26518. if (cached) {
  26519. peg$currPos = cached.nextPos;
  26520. return cached.result;
  26521. }
  26522. s0 = peg$currPos;
  26523. s1 = peg$currPos;
  26524. s2 = [];
  26525. s3 = peg$parsekeyword();
  26526. if (s3 !== peg$FAILED) {
  26527. while (s3 !== peg$FAILED) {
  26528. s2.push(s3);
  26529. s3 = peg$parsekeyword();
  26530. }
  26531. } else {
  26532. s2 = peg$FAILED;
  26533. }
  26534. if (s2 !== peg$FAILED) {
  26535. peg$savedPos = s1;
  26536. s2 = peg$c34(s2);
  26537. }
  26538. s1 = s2;
  26539. if (s1 === peg$FAILED) {
  26540. s1 = peg$parsebinarySelector();
  26541. if (s1 === peg$FAILED) {
  26542. s1 = peg$parseidentifier();
  26543. if (s1 === peg$FAILED) {
  26544. s1 = peg$parserawString();
  26545. }
  26546. }
  26547. }
  26548. if (s1 !== peg$FAILED) {
  26549. peg$savedPos = s0;
  26550. s1 = peg$c35(s1);
  26551. }
  26552. s0 = s1;
  26553. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26554. return s0;
  26555. }
  26556. function peg$parsenumber() {
  26557. var s0, s1;
  26558. var key = peg$currPos * 61 + 13,
  26559. cached = peg$resultsCache[key];
  26560. if (cached) {
  26561. peg$currPos = cached.nextPos;
  26562. return cached.result;
  26563. }
  26564. s0 = peg$currPos;
  26565. s1 = peg$parsenumberExp();
  26566. if (s1 === peg$FAILED) {
  26567. s1 = peg$parsehex();
  26568. if (s1 === peg$FAILED) {
  26569. s1 = peg$parsefloat();
  26570. if (s1 === peg$FAILED) {
  26571. s1 = peg$parseinteger();
  26572. }
  26573. }
  26574. }
  26575. if (s1 !== peg$FAILED) {
  26576. peg$savedPos = s0;
  26577. s1 = peg$c36(s1);
  26578. }
  26579. s0 = s1;
  26580. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26581. return s0;
  26582. }
  26583. function peg$parsenumberExp() {
  26584. var s0, s1, s2, s3, s4;
  26585. var key = peg$currPos * 61 + 14,
  26586. cached = peg$resultsCache[key];
  26587. if (cached) {
  26588. peg$currPos = cached.nextPos;
  26589. return cached.result;
  26590. }
  26591. s0 = peg$currPos;
  26592. s1 = peg$currPos;
  26593. s2 = peg$parsefloat();
  26594. if (s2 === peg$FAILED) {
  26595. s2 = peg$parseinteger();
  26596. }
  26597. if (s2 !== peg$FAILED) {
  26598. if (input.charCodeAt(peg$currPos) === 101) {
  26599. s3 = peg$c37;
  26600. peg$currPos++;
  26601. } else {
  26602. s3 = peg$FAILED;
  26603. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  26604. }
  26605. if (s3 !== peg$FAILED) {
  26606. s4 = peg$parseinteger();
  26607. if (s4 !== peg$FAILED) {
  26608. s2 = [s2, s3, s4];
  26609. s1 = s2;
  26610. } else {
  26611. peg$currPos = s1;
  26612. s1 = peg$FAILED;
  26613. }
  26614. } else {
  26615. peg$currPos = s1;
  26616. s1 = peg$FAILED;
  26617. }
  26618. } else {
  26619. peg$currPos = s1;
  26620. s1 = peg$FAILED;
  26621. }
  26622. if (s1 !== peg$FAILED) {
  26623. peg$savedPos = s0;
  26624. s1 = peg$c39(s1);
  26625. }
  26626. s0 = s1;
  26627. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26628. return s0;
  26629. }
  26630. function peg$parsehex() {
  26631. var s0, s1, s2, s3, s4;
  26632. var key = peg$currPos * 61 + 15,
  26633. cached = peg$resultsCache[key];
  26634. if (cached) {
  26635. peg$currPos = cached.nextPos;
  26636. return cached.result;
  26637. }
  26638. s0 = peg$currPos;
  26639. if (input.charCodeAt(peg$currPos) === 45) {
  26640. s1 = peg$c40;
  26641. peg$currPos++;
  26642. } else {
  26643. s1 = peg$FAILED;
  26644. if (peg$silentFails === 0) { peg$fail(peg$c41); }
  26645. }
  26646. if (s1 === peg$FAILED) {
  26647. s1 = null;
  26648. }
  26649. if (s1 !== peg$FAILED) {
  26650. if (input.substr(peg$currPos, 3) === peg$c42) {
  26651. s2 = peg$c42;
  26652. peg$currPos += 3;
  26653. } else {
  26654. s2 = peg$FAILED;
  26655. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  26656. }
  26657. if (s2 !== peg$FAILED) {
  26658. s3 = [];
  26659. if (peg$c44.test(input.charAt(peg$currPos))) {
  26660. s4 = input.charAt(peg$currPos);
  26661. peg$currPos++;
  26662. } else {
  26663. s4 = peg$FAILED;
  26664. if (peg$silentFails === 0) { peg$fail(peg$c45); }
  26665. }
  26666. if (s4 !== peg$FAILED) {
  26667. while (s4 !== peg$FAILED) {
  26668. s3.push(s4);
  26669. if (peg$c44.test(input.charAt(peg$currPos))) {
  26670. s4 = input.charAt(peg$currPos);
  26671. peg$currPos++;
  26672. } else {
  26673. s4 = peg$FAILED;
  26674. if (peg$silentFails === 0) { peg$fail(peg$c45); }
  26675. }
  26676. }
  26677. } else {
  26678. s3 = peg$FAILED;
  26679. }
  26680. if (s3 !== peg$FAILED) {
  26681. peg$savedPos = s0;
  26682. s1 = peg$c46(s1, s3);
  26683. s0 = s1;
  26684. } else {
  26685. peg$currPos = s0;
  26686. s0 = peg$FAILED;
  26687. }
  26688. } else {
  26689. peg$currPos = s0;
  26690. s0 = peg$FAILED;
  26691. }
  26692. } else {
  26693. peg$currPos = s0;
  26694. s0 = peg$FAILED;
  26695. }
  26696. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26697. return s0;
  26698. }
  26699. function peg$parsefloat() {
  26700. var s0, s1, s2, s3, s4, s5;
  26701. var key = peg$currPos * 61 + 16,
  26702. cached = peg$resultsCache[key];
  26703. if (cached) {
  26704. peg$currPos = cached.nextPos;
  26705. return cached.result;
  26706. }
  26707. s0 = peg$currPos;
  26708. if (input.charCodeAt(peg$currPos) === 45) {
  26709. s1 = peg$c40;
  26710. peg$currPos++;
  26711. } else {
  26712. s1 = peg$FAILED;
  26713. if (peg$silentFails === 0) { peg$fail(peg$c41); }
  26714. }
  26715. if (s1 === peg$FAILED) {
  26716. s1 = null;
  26717. }
  26718. if (s1 !== peg$FAILED) {
  26719. s2 = [];
  26720. if (peg$c47.test(input.charAt(peg$currPos))) {
  26721. s3 = input.charAt(peg$currPos);
  26722. peg$currPos++;
  26723. } else {
  26724. s3 = peg$FAILED;
  26725. if (peg$silentFails === 0) { peg$fail(peg$c48); }
  26726. }
  26727. if (s3 !== peg$FAILED) {
  26728. while (s3 !== peg$FAILED) {
  26729. s2.push(s3);
  26730. if (peg$c47.test(input.charAt(peg$currPos))) {
  26731. s3 = input.charAt(peg$currPos);
  26732. peg$currPos++;
  26733. } else {
  26734. s3 = peg$FAILED;
  26735. if (peg$silentFails === 0) { peg$fail(peg$c48); }
  26736. }
  26737. }
  26738. } else {
  26739. s2 = peg$FAILED;
  26740. }
  26741. if (s2 !== peg$FAILED) {
  26742. if (input.charCodeAt(peg$currPos) === 46) {
  26743. s3 = peg$c6;
  26744. peg$currPos++;
  26745. } else {
  26746. s3 = peg$FAILED;
  26747. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  26748. }
  26749. if (s3 !== peg$FAILED) {
  26750. s4 = [];
  26751. if (peg$c47.test(input.charAt(peg$currPos))) {
  26752. s5 = input.charAt(peg$currPos);
  26753. peg$currPos++;
  26754. } else {
  26755. s5 = peg$FAILED;
  26756. if (peg$silentFails === 0) { peg$fail(peg$c48); }
  26757. }
  26758. if (s5 !== peg$FAILED) {
  26759. while (s5 !== peg$FAILED) {
  26760. s4.push(s5);
  26761. if (peg$c47.test(input.charAt(peg$currPos))) {
  26762. s5 = input.charAt(peg$currPos);
  26763. peg$currPos++;
  26764. } else {
  26765. s5 = peg$FAILED;
  26766. if (peg$silentFails === 0) { peg$fail(peg$c48); }
  26767. }
  26768. }
  26769. } else {
  26770. s4 = peg$FAILED;
  26771. }
  26772. if (s4 !== peg$FAILED) {
  26773. peg$savedPos = s0;
  26774. s1 = peg$c49(s1, s2, s4);
  26775. s0 = s1;
  26776. } else {
  26777. peg$currPos = s0;
  26778. s0 = peg$FAILED;
  26779. }
  26780. } else {
  26781. peg$currPos = s0;
  26782. s0 = peg$FAILED;
  26783. }
  26784. } else {
  26785. peg$currPos = s0;
  26786. s0 = peg$FAILED;
  26787. }
  26788. } else {
  26789. peg$currPos = s0;
  26790. s0 = peg$FAILED;
  26791. }
  26792. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26793. return s0;
  26794. }
  26795. function peg$parseinteger() {
  26796. var s0, s1, s2, s3;
  26797. var key = peg$currPos * 61 + 17,
  26798. cached = peg$resultsCache[key];
  26799. if (cached) {
  26800. peg$currPos = cached.nextPos;
  26801. return cached.result;
  26802. }
  26803. s0 = peg$currPos;
  26804. if (input.charCodeAt(peg$currPos) === 45) {
  26805. s1 = peg$c40;
  26806. peg$currPos++;
  26807. } else {
  26808. s1 = peg$FAILED;
  26809. if (peg$silentFails === 0) { peg$fail(peg$c41); }
  26810. }
  26811. if (s1 === peg$FAILED) {
  26812. s1 = null;
  26813. }
  26814. if (s1 !== peg$FAILED) {
  26815. s2 = [];
  26816. if (peg$c47.test(input.charAt(peg$currPos))) {
  26817. s3 = input.charAt(peg$currPos);
  26818. peg$currPos++;
  26819. } else {
  26820. s3 = peg$FAILED;
  26821. if (peg$silentFails === 0) { peg$fail(peg$c48); }
  26822. }
  26823. if (s3 !== peg$FAILED) {
  26824. while (s3 !== peg$FAILED) {
  26825. s2.push(s3);
  26826. if (peg$c47.test(input.charAt(peg$currPos))) {
  26827. s3 = input.charAt(peg$currPos);
  26828. peg$currPos++;
  26829. } else {
  26830. s3 = peg$FAILED;
  26831. if (peg$silentFails === 0) { peg$fail(peg$c48); }
  26832. }
  26833. }
  26834. } else {
  26835. s2 = peg$FAILED;
  26836. }
  26837. if (s2 !== peg$FAILED) {
  26838. peg$savedPos = s0;
  26839. s1 = peg$c50(s1, s2);
  26840. s0 = s1;
  26841. } else {
  26842. peg$currPos = s0;
  26843. s0 = peg$FAILED;
  26844. }
  26845. } else {
  26846. peg$currPos = s0;
  26847. s0 = peg$FAILED;
  26848. }
  26849. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26850. return s0;
  26851. }
  26852. function peg$parseliteralArray() {
  26853. var s0, s1, s2, s3, s4;
  26854. var key = peg$currPos * 61 + 18,
  26855. cached = peg$resultsCache[key];
  26856. if (cached) {
  26857. peg$currPos = cached.nextPos;
  26858. return cached.result;
  26859. }
  26860. s0 = peg$currPos;
  26861. if (input.substr(peg$currPos, 2) === peg$c51) {
  26862. s1 = peg$c51;
  26863. peg$currPos += 2;
  26864. } else {
  26865. s1 = peg$FAILED;
  26866. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26867. }
  26868. if (s1 !== peg$FAILED) {
  26869. s2 = peg$parsewsLiteralArrayContents();
  26870. if (s2 !== peg$FAILED) {
  26871. s3 = peg$parsews();
  26872. if (s3 !== peg$FAILED) {
  26873. if (input.charCodeAt(peg$currPos) === 41) {
  26874. s4 = peg$c53;
  26875. peg$currPos++;
  26876. } else {
  26877. s4 = peg$FAILED;
  26878. if (peg$silentFails === 0) { peg$fail(peg$c54); }
  26879. }
  26880. if (s4 !== peg$FAILED) {
  26881. peg$savedPos = s0;
  26882. s1 = peg$c55(s2);
  26883. s0 = s1;
  26884. } else {
  26885. peg$currPos = s0;
  26886. s0 = peg$FAILED;
  26887. }
  26888. } else {
  26889. peg$currPos = s0;
  26890. s0 = peg$FAILED;
  26891. }
  26892. } else {
  26893. peg$currPos = s0;
  26894. s0 = peg$FAILED;
  26895. }
  26896. } else {
  26897. peg$currPos = s0;
  26898. s0 = peg$FAILED;
  26899. }
  26900. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26901. return s0;
  26902. }
  26903. function peg$parsebareLiteralArray() {
  26904. var s0, s1, s2, s3, s4;
  26905. var key = peg$currPos * 61 + 19,
  26906. cached = peg$resultsCache[key];
  26907. if (cached) {
  26908. peg$currPos = cached.nextPos;
  26909. return cached.result;
  26910. }
  26911. s0 = peg$currPos;
  26912. if (input.charCodeAt(peg$currPos) === 40) {
  26913. s1 = peg$c56;
  26914. peg$currPos++;
  26915. } else {
  26916. s1 = peg$FAILED;
  26917. if (peg$silentFails === 0) { peg$fail(peg$c57); }
  26918. }
  26919. if (s1 !== peg$FAILED) {
  26920. s2 = peg$parsewsLiteralArrayContents();
  26921. if (s2 !== peg$FAILED) {
  26922. s3 = peg$parsews();
  26923. if (s3 !== peg$FAILED) {
  26924. if (input.charCodeAt(peg$currPos) === 41) {
  26925. s4 = peg$c53;
  26926. peg$currPos++;
  26927. } else {
  26928. s4 = peg$FAILED;
  26929. if (peg$silentFails === 0) { peg$fail(peg$c54); }
  26930. }
  26931. if (s4 !== peg$FAILED) {
  26932. peg$savedPos = s0;
  26933. s1 = peg$c55(s2);
  26934. s0 = s1;
  26935. } else {
  26936. peg$currPos = s0;
  26937. s0 = peg$FAILED;
  26938. }
  26939. } else {
  26940. peg$currPos = s0;
  26941. s0 = peg$FAILED;
  26942. }
  26943. } else {
  26944. peg$currPos = s0;
  26945. s0 = peg$FAILED;
  26946. }
  26947. } else {
  26948. peg$currPos = s0;
  26949. s0 = peg$FAILED;
  26950. }
  26951. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26952. return s0;
  26953. }
  26954. function peg$parseliteralArrayElement() {
  26955. var s0;
  26956. var key = peg$currPos * 61 + 20,
  26957. cached = peg$resultsCache[key];
  26958. if (cached) {
  26959. peg$currPos = cached.nextPos;
  26960. return cached.result;
  26961. }
  26962. s0 = peg$parseparseTimeLiteral();
  26963. if (s0 === peg$FAILED) {
  26964. s0 = peg$parsebareLiteralArray();
  26965. if (s0 === peg$FAILED) {
  26966. s0 = peg$parsebareSymbol();
  26967. }
  26968. }
  26969. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26970. return s0;
  26971. }
  26972. function peg$parsewsLiteralArrayContents() {
  26973. var s0, s1, s2, s3, s4;
  26974. var key = peg$currPos * 61 + 21,
  26975. cached = peg$resultsCache[key];
  26976. if (cached) {
  26977. peg$currPos = cached.nextPos;
  26978. return cached.result;
  26979. }
  26980. s0 = peg$currPos;
  26981. s1 = [];
  26982. s2 = peg$currPos;
  26983. s3 = peg$parsews();
  26984. if (s3 !== peg$FAILED) {
  26985. s4 = peg$parseliteralArrayElement();
  26986. if (s4 !== peg$FAILED) {
  26987. peg$savedPos = s2;
  26988. s3 = peg$c58(s4);
  26989. s2 = s3;
  26990. } else {
  26991. peg$currPos = s2;
  26992. s2 = peg$FAILED;
  26993. }
  26994. } else {
  26995. peg$currPos = s2;
  26996. s2 = peg$FAILED;
  26997. }
  26998. while (s2 !== peg$FAILED) {
  26999. s1.push(s2);
  27000. s2 = peg$currPos;
  27001. s3 = peg$parsews();
  27002. if (s3 !== peg$FAILED) {
  27003. s4 = peg$parseliteralArrayElement();
  27004. if (s4 !== peg$FAILED) {
  27005. peg$savedPos = s2;
  27006. s3 = peg$c58(s4);
  27007. s2 = s3;
  27008. } else {
  27009. peg$currPos = s2;
  27010. s2 = peg$FAILED;
  27011. }
  27012. } else {
  27013. peg$currPos = s2;
  27014. s2 = peg$FAILED;
  27015. }
  27016. }
  27017. if (s1 !== peg$FAILED) {
  27018. peg$savedPos = s0;
  27019. s1 = peg$c59(s1);
  27020. }
  27021. s0 = s1;
  27022. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27023. return s0;
  27024. }
  27025. function peg$parsedynamicArray() {
  27026. var s0, s1, s2, s3, s4;
  27027. var key = peg$currPos * 61 + 22,
  27028. cached = peg$resultsCache[key];
  27029. if (cached) {
  27030. peg$currPos = cached.nextPos;
  27031. return cached.result;
  27032. }
  27033. s0 = peg$currPos;
  27034. if (input.charCodeAt(peg$currPos) === 123) {
  27035. s1 = peg$c60;
  27036. peg$currPos++;
  27037. } else {
  27038. s1 = peg$FAILED;
  27039. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  27040. }
  27041. if (s1 !== peg$FAILED) {
  27042. s2 = peg$parsewsExpressions();
  27043. if (s2 === peg$FAILED) {
  27044. s2 = null;
  27045. }
  27046. if (s2 !== peg$FAILED) {
  27047. s3 = peg$parsemaybeDotsWs();
  27048. if (s3 !== peg$FAILED) {
  27049. if (input.charCodeAt(peg$currPos) === 125) {
  27050. s4 = peg$c62;
  27051. peg$currPos++;
  27052. } else {
  27053. s4 = peg$FAILED;
  27054. if (peg$silentFails === 0) { peg$fail(peg$c63); }
  27055. }
  27056. if (s4 !== peg$FAILED) {
  27057. peg$savedPos = s0;
  27058. s1 = peg$c64(s2);
  27059. s0 = s1;
  27060. } else {
  27061. peg$currPos = s0;
  27062. s0 = peg$FAILED;
  27063. }
  27064. } else {
  27065. peg$currPos = s0;
  27066. s0 = peg$FAILED;
  27067. }
  27068. } else {
  27069. peg$currPos = s0;
  27070. s0 = peg$FAILED;
  27071. }
  27072. } else {
  27073. peg$currPos = s0;
  27074. s0 = peg$FAILED;
  27075. }
  27076. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27077. return s0;
  27078. }
  27079. function peg$parsedynamicDictionary() {
  27080. var s0, s1, s2, s3, s4;
  27081. var key = peg$currPos * 61 + 23,
  27082. cached = peg$resultsCache[key];
  27083. if (cached) {
  27084. peg$currPos = cached.nextPos;
  27085. return cached.result;
  27086. }
  27087. s0 = peg$currPos;
  27088. if (input.substr(peg$currPos, 2) === peg$c65) {
  27089. s1 = peg$c65;
  27090. peg$currPos += 2;
  27091. } else {
  27092. s1 = peg$FAILED;
  27093. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  27094. }
  27095. if (s1 !== peg$FAILED) {
  27096. s2 = peg$parsewsAssociations();
  27097. if (s2 === peg$FAILED) {
  27098. s2 = null;
  27099. }
  27100. if (s2 !== peg$FAILED) {
  27101. s3 = peg$parsemaybeDotsWs();
  27102. if (s3 !== peg$FAILED) {
  27103. if (input.charCodeAt(peg$currPos) === 125) {
  27104. s4 = peg$c62;
  27105. peg$currPos++;
  27106. } else {
  27107. s4 = peg$FAILED;
  27108. if (peg$silentFails === 0) { peg$fail(peg$c63); }
  27109. }
  27110. if (s4 !== peg$FAILED) {
  27111. peg$savedPos = s0;
  27112. s1 = peg$c67(s2);
  27113. s0 = s1;
  27114. } else {
  27115. peg$currPos = s0;
  27116. s0 = peg$FAILED;
  27117. }
  27118. } else {
  27119. peg$currPos = s0;
  27120. s0 = peg$FAILED;
  27121. }
  27122. } else {
  27123. peg$currPos = s0;
  27124. s0 = peg$FAILED;
  27125. }
  27126. } else {
  27127. peg$currPos = s0;
  27128. s0 = peg$FAILED;
  27129. }
  27130. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27131. return s0;
  27132. }
  27133. function peg$parsepseudoVariable() {
  27134. var s0, s1, s2;
  27135. var key = peg$currPos * 61 + 24,
  27136. cached = peg$resultsCache[key];
  27137. if (cached) {
  27138. peg$currPos = cached.nextPos;
  27139. return cached.result;
  27140. }
  27141. s0 = peg$currPos;
  27142. s1 = peg$currPos;
  27143. if (input.substr(peg$currPos, 4) === peg$c68) {
  27144. s2 = peg$c68;
  27145. peg$currPos += 4;
  27146. } else {
  27147. s2 = peg$FAILED;
  27148. if (peg$silentFails === 0) { peg$fail(peg$c69); }
  27149. }
  27150. if (s2 !== peg$FAILED) {
  27151. peg$savedPos = s1;
  27152. s2 = peg$c70();
  27153. }
  27154. s1 = s2;
  27155. if (s1 === peg$FAILED) {
  27156. s1 = peg$currPos;
  27157. if (input.substr(peg$currPos, 5) === peg$c71) {
  27158. s2 = peg$c71;
  27159. peg$currPos += 5;
  27160. } else {
  27161. s2 = peg$FAILED;
  27162. if (peg$silentFails === 0) { peg$fail(peg$c72); }
  27163. }
  27164. if (s2 !== peg$FAILED) {
  27165. peg$savedPos = s1;
  27166. s2 = peg$c73();
  27167. }
  27168. s1 = s2;
  27169. if (s1 === peg$FAILED) {
  27170. s1 = peg$currPos;
  27171. if (input.substr(peg$currPos, 3) === peg$c74) {
  27172. s2 = peg$c74;
  27173. peg$currPos += 3;
  27174. } else {
  27175. s2 = peg$FAILED;
  27176. if (peg$silentFails === 0) { peg$fail(peg$c75); }
  27177. }
  27178. if (s2 !== peg$FAILED) {
  27179. peg$savedPos = s1;
  27180. s2 = peg$c76();
  27181. }
  27182. s1 = s2;
  27183. }
  27184. }
  27185. if (s1 !== peg$FAILED) {
  27186. peg$savedPos = s0;
  27187. s1 = peg$c77(s1);
  27188. }
  27189. s0 = s1;
  27190. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27191. return s0;
  27192. }
  27193. function peg$parseparseTimeLiteral() {
  27194. var s0;
  27195. var key = peg$currPos * 61 + 25,
  27196. cached = peg$resultsCache[key];
  27197. if (cached) {
  27198. peg$currPos = cached.nextPos;
  27199. return cached.result;
  27200. }
  27201. s0 = peg$parsepseudoVariable();
  27202. if (s0 === peg$FAILED) {
  27203. s0 = peg$parsenumber();
  27204. if (s0 === peg$FAILED) {
  27205. s0 = peg$parseliteralArray();
  27206. if (s0 === peg$FAILED) {
  27207. s0 = peg$parsestring();
  27208. if (s0 === peg$FAILED) {
  27209. s0 = peg$parsesymbol();
  27210. if (s0 === peg$FAILED) {
  27211. s0 = peg$parsecharacter();
  27212. }
  27213. }
  27214. }
  27215. }
  27216. }
  27217. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27218. return s0;
  27219. }
  27220. function peg$parseruntimeLiteral() {
  27221. var s0;
  27222. var key = peg$currPos * 61 + 26,
  27223. cached = peg$resultsCache[key];
  27224. if (cached) {
  27225. peg$currPos = cached.nextPos;
  27226. return cached.result;
  27227. }
  27228. s0 = peg$parsedynamicDictionary();
  27229. if (s0 === peg$FAILED) {
  27230. s0 = peg$parsedynamicArray();
  27231. if (s0 === peg$FAILED) {
  27232. s0 = peg$parseblock();
  27233. }
  27234. }
  27235. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27236. return s0;
  27237. }
  27238. function peg$parseliteral() {
  27239. var s0;
  27240. var key = peg$currPos * 61 + 27,
  27241. cached = peg$resultsCache[key];
  27242. if (cached) {
  27243. peg$currPos = cached.nextPos;
  27244. return cached.result;
  27245. }
  27246. s0 = peg$parseruntimeLiteral();
  27247. if (s0 === peg$FAILED) {
  27248. s0 = peg$parseparseTimeLiteral();
  27249. }
  27250. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27251. return s0;
  27252. }
  27253. function peg$parsevariable() {
  27254. var s0, s1;
  27255. var key = peg$currPos * 61 + 28,
  27256. cached = peg$resultsCache[key];
  27257. if (cached) {
  27258. peg$currPos = cached.nextPos;
  27259. return cached.result;
  27260. }
  27261. s0 = peg$currPos;
  27262. s1 = peg$parseidentifier();
  27263. if (s1 !== peg$FAILED) {
  27264. peg$savedPos = s0;
  27265. s1 = peg$c78(s1);
  27266. }
  27267. s0 = s1;
  27268. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27269. return s0;
  27270. }
  27271. function peg$parsebinarySelector() {
  27272. var s0, s1, s2;
  27273. var key = peg$currPos * 61 + 29,
  27274. cached = peg$resultsCache[key];
  27275. if (cached) {
  27276. peg$currPos = cached.nextPos;
  27277. return cached.result;
  27278. }
  27279. s0 = peg$currPos;
  27280. s1 = [];
  27281. if (peg$c79.test(input.charAt(peg$currPos))) {
  27282. s2 = input.charAt(peg$currPos);
  27283. peg$currPos++;
  27284. } else {
  27285. s2 = peg$FAILED;
  27286. if (peg$silentFails === 0) { peg$fail(peg$c80); }
  27287. }
  27288. if (s2 !== peg$FAILED) {
  27289. while (s2 !== peg$FAILED) {
  27290. s1.push(s2);
  27291. if (peg$c79.test(input.charAt(peg$currPos))) {
  27292. s2 = input.charAt(peg$currPos);
  27293. peg$currPos++;
  27294. } else {
  27295. s2 = peg$FAILED;
  27296. if (peg$silentFails === 0) { peg$fail(peg$c80); }
  27297. }
  27298. }
  27299. } else {
  27300. s1 = peg$FAILED;
  27301. }
  27302. if (s1 !== peg$FAILED) {
  27303. peg$savedPos = s0;
  27304. s1 = peg$c81(s1);
  27305. }
  27306. s0 = s1;
  27307. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27308. return s0;
  27309. }
  27310. function peg$parsewsKeywordPattern() {
  27311. var s0, s1, s2, s3, s4, s5, s6;
  27312. var key = peg$currPos * 61 + 30,
  27313. cached = peg$resultsCache[key];
  27314. if (cached) {
  27315. peg$currPos = cached.nextPos;
  27316. return cached.result;
  27317. }
  27318. s0 = peg$currPos;
  27319. s1 = [];
  27320. s2 = peg$currPos;
  27321. s3 = peg$parsews();
  27322. if (s3 !== peg$FAILED) {
  27323. s4 = peg$parsekeyword();
  27324. if (s4 !== peg$FAILED) {
  27325. s5 = peg$parsews();
  27326. if (s5 !== peg$FAILED) {
  27327. s6 = peg$parseidentifier();
  27328. if (s6 !== peg$FAILED) {
  27329. peg$savedPos = s2;
  27330. s3 = peg$c82(s4, s6);
  27331. s2 = s3;
  27332. } else {
  27333. peg$currPos = s2;
  27334. s2 = peg$FAILED;
  27335. }
  27336. } else {
  27337. peg$currPos = s2;
  27338. s2 = peg$FAILED;
  27339. }
  27340. } else {
  27341. peg$currPos = s2;
  27342. s2 = peg$FAILED;
  27343. }
  27344. } else {
  27345. peg$currPos = s2;
  27346. s2 = peg$FAILED;
  27347. }
  27348. if (s2 !== peg$FAILED) {
  27349. while (s2 !== peg$FAILED) {
  27350. s1.push(s2);
  27351. s2 = peg$currPos;
  27352. s3 = peg$parsews();
  27353. if (s3 !== peg$FAILED) {
  27354. s4 = peg$parsekeyword();
  27355. if (s4 !== peg$FAILED) {
  27356. s5 = peg$parsews();
  27357. if (s5 !== peg$FAILED) {
  27358. s6 = peg$parseidentifier();
  27359. if (s6 !== peg$FAILED) {
  27360. peg$savedPos = s2;
  27361. s3 = peg$c82(s4, s6);
  27362. s2 = s3;
  27363. } else {
  27364. peg$currPos = s2;
  27365. s2 = peg$FAILED;
  27366. }
  27367. } else {
  27368. peg$currPos = s2;
  27369. s2 = peg$FAILED;
  27370. }
  27371. } else {
  27372. peg$currPos = s2;
  27373. s2 = peg$FAILED;
  27374. }
  27375. } else {
  27376. peg$currPos = s2;
  27377. s2 = peg$FAILED;
  27378. }
  27379. }
  27380. } else {
  27381. s1 = peg$FAILED;
  27382. }
  27383. if (s1 !== peg$FAILED) {
  27384. peg$savedPos = s0;
  27385. s1 = peg$c83(s1);
  27386. }
  27387. s0 = s1;
  27388. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27389. return s0;
  27390. }
  27391. function peg$parsewsBinaryPattern() {
  27392. var s0, s1, s2, s3, s4;
  27393. var key = peg$currPos * 61 + 31,
  27394. cached = peg$resultsCache[key];
  27395. if (cached) {
  27396. peg$currPos = cached.nextPos;
  27397. return cached.result;
  27398. }
  27399. s0 = peg$currPos;
  27400. s1 = peg$parsews();
  27401. if (s1 !== peg$FAILED) {
  27402. s2 = peg$parsebinarySelector();
  27403. if (s2 !== peg$FAILED) {
  27404. s3 = peg$parsews();
  27405. if (s3 !== peg$FAILED) {
  27406. s4 = peg$parseidentifier();
  27407. if (s4 !== peg$FAILED) {
  27408. peg$savedPos = s0;
  27409. s1 = peg$c84(s2, s4);
  27410. s0 = s1;
  27411. } else {
  27412. peg$currPos = s0;
  27413. s0 = peg$FAILED;
  27414. }
  27415. } else {
  27416. peg$currPos = s0;
  27417. s0 = peg$FAILED;
  27418. }
  27419. } else {
  27420. peg$currPos = s0;
  27421. s0 = peg$FAILED;
  27422. }
  27423. } else {
  27424. peg$currPos = s0;
  27425. s0 = peg$FAILED;
  27426. }
  27427. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27428. return s0;
  27429. }
  27430. function peg$parsewsUnaryPattern() {
  27431. var s0, s1, s2;
  27432. var key = peg$currPos * 61 + 32,
  27433. cached = peg$resultsCache[key];
  27434. if (cached) {
  27435. peg$currPos = cached.nextPos;
  27436. return cached.result;
  27437. }
  27438. s0 = peg$currPos;
  27439. s1 = peg$parsews();
  27440. if (s1 !== peg$FAILED) {
  27441. s2 = peg$parseidentifier();
  27442. if (s2 !== peg$FAILED) {
  27443. peg$savedPos = s0;
  27444. s1 = peg$c85(s2);
  27445. s0 = s1;
  27446. } else {
  27447. peg$currPos = s0;
  27448. s0 = peg$FAILED;
  27449. }
  27450. } else {
  27451. peg$currPos = s0;
  27452. s0 = peg$FAILED;
  27453. }
  27454. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27455. return s0;
  27456. }
  27457. function peg$parseexpression() {
  27458. var s0;
  27459. var key = peg$currPos * 61 + 33,
  27460. cached = peg$resultsCache[key];
  27461. if (cached) {
  27462. peg$currPos = cached.nextPos;
  27463. return cached.result;
  27464. }
  27465. s0 = peg$parseassignment();
  27466. if (s0 === peg$FAILED) {
  27467. s0 = peg$parsecascade();
  27468. if (s0 === peg$FAILED) {
  27469. s0 = peg$parsekeywordSend();
  27470. }
  27471. }
  27472. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27473. return s0;
  27474. }
  27475. function peg$parsewsExpressionsRest() {
  27476. var s0, s1, s2, s3, s4;
  27477. var key = peg$currPos * 61 + 34,
  27478. cached = peg$resultsCache[key];
  27479. if (cached) {
  27480. peg$currPos = cached.nextPos;
  27481. return cached.result;
  27482. }
  27483. s0 = peg$currPos;
  27484. s1 = peg$parsews();
  27485. if (s1 !== peg$FAILED) {
  27486. if (input.charCodeAt(peg$currPos) === 46) {
  27487. s2 = peg$c6;
  27488. peg$currPos++;
  27489. } else {
  27490. s2 = peg$FAILED;
  27491. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27492. }
  27493. if (s2 !== peg$FAILED) {
  27494. s3 = peg$parsemaybeDotsWs();
  27495. if (s3 !== peg$FAILED) {
  27496. s4 = peg$parseexpression();
  27497. if (s4 !== peg$FAILED) {
  27498. peg$savedPos = s0;
  27499. s1 = peg$c86(s4);
  27500. s0 = s1;
  27501. } else {
  27502. peg$currPos = s0;
  27503. s0 = peg$FAILED;
  27504. }
  27505. } else {
  27506. peg$currPos = s0;
  27507. s0 = peg$FAILED;
  27508. }
  27509. } else {
  27510. peg$currPos = s0;
  27511. s0 = peg$FAILED;
  27512. }
  27513. } else {
  27514. peg$currPos = s0;
  27515. s0 = peg$FAILED;
  27516. }
  27517. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27518. return s0;
  27519. }
  27520. function peg$parsewsExpressions() {
  27521. var s0, s1, s2, s3, s4;
  27522. var key = peg$currPos * 61 + 35,
  27523. cached = peg$resultsCache[key];
  27524. if (cached) {
  27525. peg$currPos = cached.nextPos;
  27526. return cached.result;
  27527. }
  27528. s0 = peg$currPos;
  27529. s1 = peg$parsemaybeDotsWs();
  27530. if (s1 !== peg$FAILED) {
  27531. s2 = peg$parseexpression();
  27532. if (s2 !== peg$FAILED) {
  27533. s3 = [];
  27534. s4 = peg$parsewsExpressionsRest();
  27535. while (s4 !== peg$FAILED) {
  27536. s3.push(s4);
  27537. s4 = peg$parsewsExpressionsRest();
  27538. }
  27539. if (s3 !== peg$FAILED) {
  27540. peg$savedPos = s0;
  27541. s1 = peg$c87(s2, s3);
  27542. s0 = s1;
  27543. } else {
  27544. peg$currPos = s0;
  27545. s0 = peg$FAILED;
  27546. }
  27547. } else {
  27548. peg$currPos = s0;
  27549. s0 = peg$FAILED;
  27550. }
  27551. } else {
  27552. peg$currPos = s0;
  27553. s0 = peg$FAILED;
  27554. }
  27555. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27556. return s0;
  27557. }
  27558. function peg$parseassignment() {
  27559. var s0, s1, s2, s3, s4, s5;
  27560. var key = peg$currPos * 61 + 36,
  27561. cached = peg$resultsCache[key];
  27562. if (cached) {
  27563. peg$currPos = cached.nextPos;
  27564. return cached.result;
  27565. }
  27566. s0 = peg$currPos;
  27567. s1 = peg$parsevariable();
  27568. if (s1 !== peg$FAILED) {
  27569. s2 = peg$parsews();
  27570. if (s2 !== peg$FAILED) {
  27571. if (input.substr(peg$currPos, 2) === peg$c88) {
  27572. s3 = peg$c88;
  27573. peg$currPos += 2;
  27574. } else {
  27575. s3 = peg$FAILED;
  27576. if (peg$silentFails === 0) { peg$fail(peg$c89); }
  27577. }
  27578. if (s3 !== peg$FAILED) {
  27579. s4 = peg$parsews();
  27580. if (s4 !== peg$FAILED) {
  27581. s5 = peg$parseexpression();
  27582. if (s5 !== peg$FAILED) {
  27583. peg$savedPos = s0;
  27584. s1 = peg$c90(s1, s5);
  27585. s0 = s1;
  27586. } else {
  27587. peg$currPos = s0;
  27588. s0 = peg$FAILED;
  27589. }
  27590. } else {
  27591. peg$currPos = s0;
  27592. s0 = peg$FAILED;
  27593. }
  27594. } else {
  27595. peg$currPos = s0;
  27596. s0 = peg$FAILED;
  27597. }
  27598. } else {
  27599. peg$currPos = s0;
  27600. s0 = peg$FAILED;
  27601. }
  27602. } else {
  27603. peg$currPos = s0;
  27604. s0 = peg$FAILED;
  27605. }
  27606. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27607. return s0;
  27608. }
  27609. function peg$parseret() {
  27610. var s0, s1, s2, s3;
  27611. var key = peg$currPos * 61 + 37,
  27612. cached = peg$resultsCache[key];
  27613. if (cached) {
  27614. peg$currPos = cached.nextPos;
  27615. return cached.result;
  27616. }
  27617. s0 = peg$currPos;
  27618. if (input.charCodeAt(peg$currPos) === 94) {
  27619. s1 = peg$c91;
  27620. peg$currPos++;
  27621. } else {
  27622. s1 = peg$FAILED;
  27623. if (peg$silentFails === 0) { peg$fail(peg$c92); }
  27624. }
  27625. if (s1 !== peg$FAILED) {
  27626. s2 = peg$parsews();
  27627. if (s2 !== peg$FAILED) {
  27628. s3 = peg$parseexpression();
  27629. if (s3 !== peg$FAILED) {
  27630. peg$savedPos = s0;
  27631. s1 = peg$c93(s3);
  27632. s0 = s1;
  27633. } else {
  27634. peg$currPos = s0;
  27635. s0 = peg$FAILED;
  27636. }
  27637. } else {
  27638. peg$currPos = s0;
  27639. s0 = peg$FAILED;
  27640. }
  27641. } else {
  27642. peg$currPos = s0;
  27643. s0 = peg$FAILED;
  27644. }
  27645. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27646. return s0;
  27647. }
  27648. function peg$parsetemps() {
  27649. var s0, s1, s2, s3, s4, s5;
  27650. var key = peg$currPos * 61 + 38,
  27651. cached = peg$resultsCache[key];
  27652. if (cached) {
  27653. peg$currPos = cached.nextPos;
  27654. return cached.result;
  27655. }
  27656. s0 = peg$currPos;
  27657. if (input.charCodeAt(peg$currPos) === 124) {
  27658. s1 = peg$c94;
  27659. peg$currPos++;
  27660. } else {
  27661. s1 = peg$FAILED;
  27662. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  27663. }
  27664. if (s1 !== peg$FAILED) {
  27665. s2 = [];
  27666. s3 = peg$currPos;
  27667. s4 = peg$parsews();
  27668. if (s4 !== peg$FAILED) {
  27669. s5 = peg$parseidentifier();
  27670. if (s5 !== peg$FAILED) {
  27671. peg$savedPos = s3;
  27672. s4 = peg$c96(s5);
  27673. s3 = s4;
  27674. } else {
  27675. peg$currPos = s3;
  27676. s3 = peg$FAILED;
  27677. }
  27678. } else {
  27679. peg$currPos = s3;
  27680. s3 = peg$FAILED;
  27681. }
  27682. while (s3 !== peg$FAILED) {
  27683. s2.push(s3);
  27684. s3 = peg$currPos;
  27685. s4 = peg$parsews();
  27686. if (s4 !== peg$FAILED) {
  27687. s5 = peg$parseidentifier();
  27688. if (s5 !== peg$FAILED) {
  27689. peg$savedPos = s3;
  27690. s4 = peg$c96(s5);
  27691. s3 = s4;
  27692. } else {
  27693. peg$currPos = s3;
  27694. s3 = peg$FAILED;
  27695. }
  27696. } else {
  27697. peg$currPos = s3;
  27698. s3 = peg$FAILED;
  27699. }
  27700. }
  27701. if (s2 !== peg$FAILED) {
  27702. s3 = peg$parsews();
  27703. if (s3 !== peg$FAILED) {
  27704. if (input.charCodeAt(peg$currPos) === 124) {
  27705. s4 = peg$c94;
  27706. peg$currPos++;
  27707. } else {
  27708. s4 = peg$FAILED;
  27709. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  27710. }
  27711. if (s4 !== peg$FAILED) {
  27712. peg$savedPos = s0;
  27713. s1 = peg$c97(s2);
  27714. s0 = s1;
  27715. } else {
  27716. peg$currPos = s0;
  27717. s0 = peg$FAILED;
  27718. }
  27719. } else {
  27720. peg$currPos = s0;
  27721. s0 = peg$FAILED;
  27722. }
  27723. } else {
  27724. peg$currPos = s0;
  27725. s0 = peg$FAILED;
  27726. }
  27727. } else {
  27728. peg$currPos = s0;
  27729. s0 = peg$FAILED;
  27730. }
  27731. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27732. return s0;
  27733. }
  27734. function peg$parsewsBlockParamList() {
  27735. var s0, s1, s2, s3, s4, s5, s6;
  27736. var key = peg$currPos * 61 + 39,
  27737. cached = peg$resultsCache[key];
  27738. if (cached) {
  27739. peg$currPos = cached.nextPos;
  27740. return cached.result;
  27741. }
  27742. s0 = peg$currPos;
  27743. s1 = [];
  27744. s2 = peg$currPos;
  27745. s3 = peg$parsews();
  27746. if (s3 !== peg$FAILED) {
  27747. if (input.charCodeAt(peg$currPos) === 58) {
  27748. s4 = peg$c13;
  27749. peg$currPos++;
  27750. } else {
  27751. s4 = peg$FAILED;
  27752. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  27753. }
  27754. if (s4 !== peg$FAILED) {
  27755. s5 = peg$parsews();
  27756. if (s5 !== peg$FAILED) {
  27757. s6 = peg$parseidentifier();
  27758. if (s6 !== peg$FAILED) {
  27759. peg$savedPos = s2;
  27760. s3 = peg$c98(s6);
  27761. s2 = s3;
  27762. } else {
  27763. peg$currPos = s2;
  27764. s2 = peg$FAILED;
  27765. }
  27766. } else {
  27767. peg$currPos = s2;
  27768. s2 = peg$FAILED;
  27769. }
  27770. } else {
  27771. peg$currPos = s2;
  27772. s2 = peg$FAILED;
  27773. }
  27774. } else {
  27775. peg$currPos = s2;
  27776. s2 = peg$FAILED;
  27777. }
  27778. if (s2 !== peg$FAILED) {
  27779. while (s2 !== peg$FAILED) {
  27780. s1.push(s2);
  27781. s2 = peg$currPos;
  27782. s3 = peg$parsews();
  27783. if (s3 !== peg$FAILED) {
  27784. if (input.charCodeAt(peg$currPos) === 58) {
  27785. s4 = peg$c13;
  27786. peg$currPos++;
  27787. } else {
  27788. s4 = peg$FAILED;
  27789. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  27790. }
  27791. if (s4 !== peg$FAILED) {
  27792. s5 = peg$parsews();
  27793. if (s5 !== peg$FAILED) {
  27794. s6 = peg$parseidentifier();
  27795. if (s6 !== peg$FAILED) {
  27796. peg$savedPos = s2;
  27797. s3 = peg$c98(s6);
  27798. s2 = s3;
  27799. } else {
  27800. peg$currPos = s2;
  27801. s2 = peg$FAILED;
  27802. }
  27803. } else {
  27804. peg$currPos = s2;
  27805. s2 = peg$FAILED;
  27806. }
  27807. } else {
  27808. peg$currPos = s2;
  27809. s2 = peg$FAILED;
  27810. }
  27811. } else {
  27812. peg$currPos = s2;
  27813. s2 = peg$FAILED;
  27814. }
  27815. }
  27816. } else {
  27817. s1 = peg$FAILED;
  27818. }
  27819. if (s1 !== peg$FAILED) {
  27820. s2 = peg$parsews();
  27821. if (s2 !== peg$FAILED) {
  27822. if (input.charCodeAt(peg$currPos) === 124) {
  27823. s3 = peg$c94;
  27824. peg$currPos++;
  27825. } else {
  27826. s3 = peg$FAILED;
  27827. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  27828. }
  27829. if (s3 !== peg$FAILED) {
  27830. peg$savedPos = s0;
  27831. s1 = peg$c99(s1);
  27832. s0 = s1;
  27833. } else {
  27834. peg$currPos = s0;
  27835. s0 = peg$FAILED;
  27836. }
  27837. } else {
  27838. peg$currPos = s0;
  27839. s0 = peg$FAILED;
  27840. }
  27841. } else {
  27842. peg$currPos = s0;
  27843. s0 = peg$FAILED;
  27844. }
  27845. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27846. return s0;
  27847. }
  27848. function peg$parsesubexpression() {
  27849. var s0, s1, s2, s3, s4, s5;
  27850. var key = peg$currPos * 61 + 40,
  27851. cached = peg$resultsCache[key];
  27852. if (cached) {
  27853. peg$currPos = cached.nextPos;
  27854. return cached.result;
  27855. }
  27856. s0 = peg$currPos;
  27857. if (input.charCodeAt(peg$currPos) === 40) {
  27858. s1 = peg$c56;
  27859. peg$currPos++;
  27860. } else {
  27861. s1 = peg$FAILED;
  27862. if (peg$silentFails === 0) { peg$fail(peg$c57); }
  27863. }
  27864. if (s1 !== peg$FAILED) {
  27865. s2 = peg$parsews();
  27866. if (s2 !== peg$FAILED) {
  27867. s3 = peg$parseexpression();
  27868. if (s3 !== peg$FAILED) {
  27869. s4 = peg$parsews();
  27870. if (s4 !== peg$FAILED) {
  27871. if (input.charCodeAt(peg$currPos) === 41) {
  27872. s5 = peg$c53;
  27873. peg$currPos++;
  27874. } else {
  27875. s5 = peg$FAILED;
  27876. if (peg$silentFails === 0) { peg$fail(peg$c54); }
  27877. }
  27878. if (s5 !== peg$FAILED) {
  27879. peg$savedPos = s0;
  27880. s1 = peg$c86(s3);
  27881. s0 = s1;
  27882. } else {
  27883. peg$currPos = s0;
  27884. s0 = peg$FAILED;
  27885. }
  27886. } else {
  27887. peg$currPos = s0;
  27888. s0 = peg$FAILED;
  27889. }
  27890. } else {
  27891. peg$currPos = s0;
  27892. s0 = peg$FAILED;
  27893. }
  27894. } else {
  27895. peg$currPos = s0;
  27896. s0 = peg$FAILED;
  27897. }
  27898. } else {
  27899. peg$currPos = s0;
  27900. s0 = peg$FAILED;
  27901. }
  27902. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27903. return s0;
  27904. }
  27905. function peg$parsewsStatementsWs() {
  27906. var s0, s1, s2, s3, s4, s5, s6;
  27907. var key = peg$currPos * 61 + 41,
  27908. cached = peg$resultsCache[key];
  27909. if (cached) {
  27910. peg$currPos = cached.nextPos;
  27911. return cached.result;
  27912. }
  27913. s0 = peg$currPos;
  27914. s1 = peg$parsemaybeDotsWs();
  27915. if (s1 !== peg$FAILED) {
  27916. s2 = peg$parseret();
  27917. if (s2 !== peg$FAILED) {
  27918. s3 = peg$parsemaybeDotsWs();
  27919. if (s3 !== peg$FAILED) {
  27920. peg$savedPos = s0;
  27921. s1 = peg$c100(s2);
  27922. s0 = s1;
  27923. } else {
  27924. peg$currPos = s0;
  27925. s0 = peg$FAILED;
  27926. }
  27927. } else {
  27928. peg$currPos = s0;
  27929. s0 = peg$FAILED;
  27930. }
  27931. } else {
  27932. peg$currPos = s0;
  27933. s0 = peg$FAILED;
  27934. }
  27935. if (s0 === peg$FAILED) {
  27936. s0 = peg$currPos;
  27937. s1 = peg$parsewsExpressions();
  27938. if (s1 !== peg$FAILED) {
  27939. s2 = peg$parsews();
  27940. if (s2 !== peg$FAILED) {
  27941. if (input.charCodeAt(peg$currPos) === 46) {
  27942. s3 = peg$c6;
  27943. peg$currPos++;
  27944. } else {
  27945. s3 = peg$FAILED;
  27946. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27947. }
  27948. if (s3 !== peg$FAILED) {
  27949. s4 = peg$parsemaybeDotsWs();
  27950. if (s4 !== peg$FAILED) {
  27951. s5 = peg$parseret();
  27952. if (s5 !== peg$FAILED) {
  27953. s6 = peg$parsemaybeDotsWs();
  27954. if (s6 !== peg$FAILED) {
  27955. peg$savedPos = s0;
  27956. s1 = peg$c101(s1, s5);
  27957. s0 = s1;
  27958. } else {
  27959. peg$currPos = s0;
  27960. s0 = peg$FAILED;
  27961. }
  27962. } else {
  27963. peg$currPos = s0;
  27964. s0 = peg$FAILED;
  27965. }
  27966. } else {
  27967. peg$currPos = s0;
  27968. s0 = peg$FAILED;
  27969. }
  27970. } else {
  27971. peg$currPos = s0;
  27972. s0 = peg$FAILED;
  27973. }
  27974. } else {
  27975. peg$currPos = s0;
  27976. s0 = peg$FAILED;
  27977. }
  27978. } else {
  27979. peg$currPos = s0;
  27980. s0 = peg$FAILED;
  27981. }
  27982. if (s0 === peg$FAILED) {
  27983. s0 = peg$currPos;
  27984. s1 = peg$parsewsExpressions();
  27985. if (s1 === peg$FAILED) {
  27986. s1 = null;
  27987. }
  27988. if (s1 !== peg$FAILED) {
  27989. s2 = peg$parsemaybeDotsWs();
  27990. if (s2 !== peg$FAILED) {
  27991. peg$savedPos = s0;
  27992. s1 = peg$c102(s1);
  27993. s0 = s1;
  27994. } else {
  27995. peg$currPos = s0;
  27996. s0 = peg$FAILED;
  27997. }
  27998. } else {
  27999. peg$currPos = s0;
  28000. s0 = peg$FAILED;
  28001. }
  28002. }
  28003. }
  28004. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28005. return s0;
  28006. }
  28007. function peg$parsewsSequenceWs() {
  28008. var s0, s1, s2, s3;
  28009. var key = peg$currPos * 61 + 42,
  28010. cached = peg$resultsCache[key];
  28011. if (cached) {
  28012. peg$currPos = cached.nextPos;
  28013. return cached.result;
  28014. }
  28015. s0 = peg$currPos;
  28016. s1 = peg$parsews();
  28017. if (s1 !== peg$FAILED) {
  28018. s2 = peg$parsejsStatement();
  28019. if (s2 !== peg$FAILED) {
  28020. s3 = peg$parsews();
  28021. if (s3 !== peg$FAILED) {
  28022. peg$savedPos = s0;
  28023. s1 = peg$c103(s2);
  28024. s0 = s1;
  28025. } else {
  28026. peg$currPos = s0;
  28027. s0 = peg$FAILED;
  28028. }
  28029. } else {
  28030. peg$currPos = s0;
  28031. s0 = peg$FAILED;
  28032. }
  28033. } else {
  28034. peg$currPos = s0;
  28035. s0 = peg$FAILED;
  28036. }
  28037. if (s0 === peg$FAILED) {
  28038. s0 = peg$parsewsStSequenceWs();
  28039. }
  28040. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28041. return s0;
  28042. }
  28043. function peg$parsewsStSequenceWs() {
  28044. var s0, s1, s2, s3;
  28045. var key = peg$currPos * 61 + 43,
  28046. cached = peg$resultsCache[key];
  28047. if (cached) {
  28048. peg$currPos = cached.nextPos;
  28049. return cached.result;
  28050. }
  28051. s0 = peg$currPos;
  28052. s1 = peg$parsews();
  28053. if (s1 !== peg$FAILED) {
  28054. s2 = peg$parsetemps();
  28055. if (s2 === peg$FAILED) {
  28056. s2 = null;
  28057. }
  28058. if (s2 !== peg$FAILED) {
  28059. s3 = peg$parsewsStatementsWs();
  28060. if (s3 === peg$FAILED) {
  28061. s3 = null;
  28062. }
  28063. if (s3 !== peg$FAILED) {
  28064. peg$savedPos = s0;
  28065. s1 = peg$c104(s2, s3);
  28066. s0 = s1;
  28067. } else {
  28068. peg$currPos = s0;
  28069. s0 = peg$FAILED;
  28070. }
  28071. } else {
  28072. peg$currPos = s0;
  28073. s0 = peg$FAILED;
  28074. }
  28075. } else {
  28076. peg$currPos = s0;
  28077. s0 = peg$FAILED;
  28078. }
  28079. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28080. return s0;
  28081. }
  28082. function peg$parseblock() {
  28083. var s0, s1, s2, s3, s4;
  28084. var key = peg$currPos * 61 + 44,
  28085. cached = peg$resultsCache[key];
  28086. if (cached) {
  28087. peg$currPos = cached.nextPos;
  28088. return cached.result;
  28089. }
  28090. s0 = peg$currPos;
  28091. if (input.charCodeAt(peg$currPos) === 91) {
  28092. s1 = peg$c105;
  28093. peg$currPos++;
  28094. } else {
  28095. s1 = peg$FAILED;
  28096. if (peg$silentFails === 0) { peg$fail(peg$c106); }
  28097. }
  28098. if (s1 !== peg$FAILED) {
  28099. s2 = peg$parsewsBlockParamList();
  28100. if (s2 === peg$FAILED) {
  28101. s2 = null;
  28102. }
  28103. if (s2 !== peg$FAILED) {
  28104. s3 = peg$parsewsSequenceWs();
  28105. if (s3 === peg$FAILED) {
  28106. s3 = null;
  28107. }
  28108. if (s3 !== peg$FAILED) {
  28109. if (input.charCodeAt(peg$currPos) === 93) {
  28110. s4 = peg$c107;
  28111. peg$currPos++;
  28112. } else {
  28113. s4 = peg$FAILED;
  28114. if (peg$silentFails === 0) { peg$fail(peg$c108); }
  28115. }
  28116. if (s4 !== peg$FAILED) {
  28117. peg$savedPos = s0;
  28118. s1 = peg$c109(s2, s3);
  28119. s0 = s1;
  28120. } else {
  28121. peg$currPos = s0;
  28122. s0 = peg$FAILED;
  28123. }
  28124. } else {
  28125. peg$currPos = s0;
  28126. s0 = peg$FAILED;
  28127. }
  28128. } else {
  28129. peg$currPos = s0;
  28130. s0 = peg$FAILED;
  28131. }
  28132. } else {
  28133. peg$currPos = s0;
  28134. s0 = peg$FAILED;
  28135. }
  28136. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28137. return s0;
  28138. }
  28139. function peg$parseoperand() {
  28140. var s0;
  28141. var key = peg$currPos * 61 + 45,
  28142. cached = peg$resultsCache[key];
  28143. if (cached) {
  28144. peg$currPos = cached.nextPos;
  28145. return cached.result;
  28146. }
  28147. s0 = peg$parseliteral();
  28148. if (s0 === peg$FAILED) {
  28149. s0 = peg$parsevariable();
  28150. if (s0 === peg$FAILED) {
  28151. s0 = peg$parsesubexpression();
  28152. }
  28153. }
  28154. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28155. return s0;
  28156. }
  28157. function peg$parsewsUnaryMessage() {
  28158. var s0, s1, s2, s3, s4;
  28159. var key = peg$currPos * 61 + 46,
  28160. cached = peg$resultsCache[key];
  28161. if (cached) {
  28162. peg$currPos = cached.nextPos;
  28163. return cached.result;
  28164. }
  28165. s0 = peg$currPos;
  28166. s1 = peg$parsews();
  28167. if (s1 !== peg$FAILED) {
  28168. s2 = peg$parseidentifier();
  28169. if (s2 !== peg$FAILED) {
  28170. s3 = peg$currPos;
  28171. peg$silentFails++;
  28172. if (input.charCodeAt(peg$currPos) === 58) {
  28173. s4 = peg$c13;
  28174. peg$currPos++;
  28175. } else {
  28176. s4 = peg$FAILED;
  28177. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  28178. }
  28179. peg$silentFails--;
  28180. if (s4 === peg$FAILED) {
  28181. s3 = void 0;
  28182. } else {
  28183. peg$currPos = s3;
  28184. s3 = peg$FAILED;
  28185. }
  28186. if (s3 !== peg$FAILED) {
  28187. peg$savedPos = s0;
  28188. s1 = peg$c110(s2);
  28189. s0 = s1;
  28190. } else {
  28191. peg$currPos = s0;
  28192. s0 = peg$FAILED;
  28193. }
  28194. } else {
  28195. peg$currPos = s0;
  28196. s0 = peg$FAILED;
  28197. }
  28198. } else {
  28199. peg$currPos = s0;
  28200. s0 = peg$FAILED;
  28201. }
  28202. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28203. return s0;
  28204. }
  28205. function peg$parseunarySend() {
  28206. var s0, s1, s2, s3;
  28207. var key = peg$currPos * 61 + 47,
  28208. cached = peg$resultsCache[key];
  28209. if (cached) {
  28210. peg$currPos = cached.nextPos;
  28211. return cached.result;
  28212. }
  28213. s0 = peg$currPos;
  28214. s1 = peg$parseoperand();
  28215. if (s1 !== peg$FAILED) {
  28216. s2 = [];
  28217. s3 = peg$parsewsUnaryMessage();
  28218. while (s3 !== peg$FAILED) {
  28219. s2.push(s3);
  28220. s3 = peg$parsewsUnaryMessage();
  28221. }
  28222. if (s2 !== peg$FAILED) {
  28223. peg$savedPos = s0;
  28224. s1 = peg$c111(s1, s2);
  28225. s0 = s1;
  28226. } else {
  28227. peg$currPos = s0;
  28228. s0 = peg$FAILED;
  28229. }
  28230. } else {
  28231. peg$currPos = s0;
  28232. s0 = peg$FAILED;
  28233. }
  28234. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28235. return s0;
  28236. }
  28237. function peg$parsewsBinaryMessage() {
  28238. var s0, s1, s2, s3, s4;
  28239. var key = peg$currPos * 61 + 48,
  28240. cached = peg$resultsCache[key];
  28241. if (cached) {
  28242. peg$currPos = cached.nextPos;
  28243. return cached.result;
  28244. }
  28245. s0 = peg$currPos;
  28246. s1 = peg$parsews();
  28247. if (s1 !== peg$FAILED) {
  28248. s2 = peg$parsebinarySelector();
  28249. if (s2 !== peg$FAILED) {
  28250. s3 = peg$parsews();
  28251. if (s3 !== peg$FAILED) {
  28252. s4 = peg$parseunarySend();
  28253. if (s4 !== peg$FAILED) {
  28254. peg$savedPos = s0;
  28255. s1 = peg$c112(s2, s4);
  28256. s0 = s1;
  28257. } else {
  28258. peg$currPos = s0;
  28259. s0 = peg$FAILED;
  28260. }
  28261. } else {
  28262. peg$currPos = s0;
  28263. s0 = peg$FAILED;
  28264. }
  28265. } else {
  28266. peg$currPos = s0;
  28267. s0 = peg$FAILED;
  28268. }
  28269. } else {
  28270. peg$currPos = s0;
  28271. s0 = peg$FAILED;
  28272. }
  28273. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28274. return s0;
  28275. }
  28276. function peg$parsebinarySend() {
  28277. var s0, s1, s2, s3;
  28278. var key = peg$currPos * 61 + 49,
  28279. cached = peg$resultsCache[key];
  28280. if (cached) {
  28281. peg$currPos = cached.nextPos;
  28282. return cached.result;
  28283. }
  28284. s0 = peg$currPos;
  28285. s1 = peg$parseunarySend();
  28286. if (s1 !== peg$FAILED) {
  28287. s2 = [];
  28288. s3 = peg$parsewsBinaryMessage();
  28289. while (s3 !== peg$FAILED) {
  28290. s2.push(s3);
  28291. s3 = peg$parsewsBinaryMessage();
  28292. }
  28293. if (s2 !== peg$FAILED) {
  28294. peg$savedPos = s0;
  28295. s1 = peg$c111(s1, s2);
  28296. s0 = s1;
  28297. } else {
  28298. peg$currPos = s0;
  28299. s0 = peg$FAILED;
  28300. }
  28301. } else {
  28302. peg$currPos = s0;
  28303. s0 = peg$FAILED;
  28304. }
  28305. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28306. return s0;
  28307. }
  28308. function peg$parsewsKeywordMessage() {
  28309. var s0, s1, s2, s3, s4, s5, s6;
  28310. var key = peg$currPos * 61 + 50,
  28311. cached = peg$resultsCache[key];
  28312. if (cached) {
  28313. peg$currPos = cached.nextPos;
  28314. return cached.result;
  28315. }
  28316. s0 = peg$currPos;
  28317. s1 = [];
  28318. s2 = peg$currPos;
  28319. s3 = peg$parsews();
  28320. if (s3 !== peg$FAILED) {
  28321. s4 = peg$parsekeyword();
  28322. if (s4 !== peg$FAILED) {
  28323. s5 = peg$parsews();
  28324. if (s5 !== peg$FAILED) {
  28325. s6 = peg$parsebinarySend();
  28326. if (s6 !== peg$FAILED) {
  28327. peg$savedPos = s2;
  28328. s3 = peg$c82(s4, s6);
  28329. s2 = s3;
  28330. } else {
  28331. peg$currPos = s2;
  28332. s2 = peg$FAILED;
  28333. }
  28334. } else {
  28335. peg$currPos = s2;
  28336. s2 = peg$FAILED;
  28337. }
  28338. } else {
  28339. peg$currPos = s2;
  28340. s2 = peg$FAILED;
  28341. }
  28342. } else {
  28343. peg$currPos = s2;
  28344. s2 = peg$FAILED;
  28345. }
  28346. if (s2 !== peg$FAILED) {
  28347. while (s2 !== peg$FAILED) {
  28348. s1.push(s2);
  28349. s2 = peg$currPos;
  28350. s3 = peg$parsews();
  28351. if (s3 !== peg$FAILED) {
  28352. s4 = peg$parsekeyword();
  28353. if (s4 !== peg$FAILED) {
  28354. s5 = peg$parsews();
  28355. if (s5 !== peg$FAILED) {
  28356. s6 = peg$parsebinarySend();
  28357. if (s6 !== peg$FAILED) {
  28358. peg$savedPos = s2;
  28359. s3 = peg$c82(s4, s6);
  28360. s2 = s3;
  28361. } else {
  28362. peg$currPos = s2;
  28363. s2 = peg$FAILED;
  28364. }
  28365. } else {
  28366. peg$currPos = s2;
  28367. s2 = peg$FAILED;
  28368. }
  28369. } else {
  28370. peg$currPos = s2;
  28371. s2 = peg$FAILED;
  28372. }
  28373. } else {
  28374. peg$currPos = s2;
  28375. s2 = peg$FAILED;
  28376. }
  28377. }
  28378. } else {
  28379. s1 = peg$FAILED;
  28380. }
  28381. if (s1 !== peg$FAILED) {
  28382. peg$savedPos = s0;
  28383. s1 = peg$c113(s1);
  28384. }
  28385. s0 = s1;
  28386. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28387. return s0;
  28388. }
  28389. function peg$parsekeywordSend() {
  28390. var s0, s1, s2;
  28391. var key = peg$currPos * 61 + 51,
  28392. cached = peg$resultsCache[key];
  28393. if (cached) {
  28394. peg$currPos = cached.nextPos;
  28395. return cached.result;
  28396. }
  28397. s0 = peg$currPos;
  28398. s1 = peg$parsebinarySend();
  28399. if (s1 !== peg$FAILED) {
  28400. s2 = peg$parsewsKeywordMessage();
  28401. if (s2 === peg$FAILED) {
  28402. s2 = null;
  28403. }
  28404. if (s2 !== peg$FAILED) {
  28405. peg$savedPos = s0;
  28406. s1 = peg$c114(s1, s2);
  28407. s0 = s1;
  28408. } else {
  28409. peg$currPos = s0;
  28410. s0 = peg$FAILED;
  28411. }
  28412. } else {
  28413. peg$currPos = s0;
  28414. s0 = peg$FAILED;
  28415. }
  28416. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28417. return s0;
  28418. }
  28419. function peg$parsewsMessage() {
  28420. var s0;
  28421. var key = peg$currPos * 61 + 52,
  28422. cached = peg$resultsCache[key];
  28423. if (cached) {
  28424. peg$currPos = cached.nextPos;
  28425. return cached.result;
  28426. }
  28427. s0 = peg$parsewsBinaryMessage();
  28428. if (s0 === peg$FAILED) {
  28429. s0 = peg$parsewsUnaryMessage();
  28430. if (s0 === peg$FAILED) {
  28431. s0 = peg$parsewsKeywordMessage();
  28432. }
  28433. }
  28434. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28435. return s0;
  28436. }
  28437. function peg$parsecascade() {
  28438. var s0, s1, s2, s3, s4, s5, s6, s7;
  28439. var key = peg$currPos * 61 + 53,
  28440. cached = peg$resultsCache[key];
  28441. if (cached) {
  28442. peg$currPos = cached.nextPos;
  28443. return cached.result;
  28444. }
  28445. s0 = peg$currPos;
  28446. s1 = peg$parsekeywordSend();
  28447. if (s1 !== peg$FAILED) {
  28448. peg$savedPos = peg$currPos;
  28449. s2 = peg$c115(s1);
  28450. if (s2) {
  28451. s2 = void 0;
  28452. } else {
  28453. s2 = peg$FAILED;
  28454. }
  28455. if (s2 !== peg$FAILED) {
  28456. s3 = [];
  28457. s4 = peg$currPos;
  28458. s5 = peg$parsews();
  28459. if (s5 !== peg$FAILED) {
  28460. if (input.charCodeAt(peg$currPos) === 59) {
  28461. s6 = peg$c116;
  28462. peg$currPos++;
  28463. } else {
  28464. s6 = peg$FAILED;
  28465. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  28466. }
  28467. if (s6 !== peg$FAILED) {
  28468. s7 = peg$parsewsMessage();
  28469. if (s7 !== peg$FAILED) {
  28470. peg$savedPos = s4;
  28471. s5 = peg$c118(s1, s7);
  28472. s4 = s5;
  28473. } else {
  28474. peg$currPos = s4;
  28475. s4 = peg$FAILED;
  28476. }
  28477. } else {
  28478. peg$currPos = s4;
  28479. s4 = peg$FAILED;
  28480. }
  28481. } else {
  28482. peg$currPos = s4;
  28483. s4 = peg$FAILED;
  28484. }
  28485. if (s4 !== peg$FAILED) {
  28486. while (s4 !== peg$FAILED) {
  28487. s3.push(s4);
  28488. s4 = peg$currPos;
  28489. s5 = peg$parsews();
  28490. if (s5 !== peg$FAILED) {
  28491. if (input.charCodeAt(peg$currPos) === 59) {
  28492. s6 = peg$c116;
  28493. peg$currPos++;
  28494. } else {
  28495. s6 = peg$FAILED;
  28496. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  28497. }
  28498. if (s6 !== peg$FAILED) {
  28499. s7 = peg$parsewsMessage();
  28500. if (s7 !== peg$FAILED) {
  28501. peg$savedPos = s4;
  28502. s5 = peg$c118(s1, s7);
  28503. s4 = s5;
  28504. } else {
  28505. peg$currPos = s4;
  28506. s4 = peg$FAILED;
  28507. }
  28508. } else {
  28509. peg$currPos = s4;
  28510. s4 = peg$FAILED;
  28511. }
  28512. } else {
  28513. peg$currPos = s4;
  28514. s4 = peg$FAILED;
  28515. }
  28516. }
  28517. } else {
  28518. s3 = peg$FAILED;
  28519. }
  28520. if (s3 !== peg$FAILED) {
  28521. peg$savedPos = s0;
  28522. s1 = peg$c119(s1, s3);
  28523. s0 = s1;
  28524. } else {
  28525. peg$currPos = s0;
  28526. s0 = peg$FAILED;
  28527. }
  28528. } else {
  28529. peg$currPos = s0;
  28530. s0 = peg$FAILED;
  28531. }
  28532. } else {
  28533. peg$currPos = s0;
  28534. s0 = peg$FAILED;
  28535. }
  28536. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28537. return s0;
  28538. }
  28539. function peg$parsejsStatement() {
  28540. var s0;
  28541. var key = peg$currPos * 61 + 54,
  28542. cached = peg$resultsCache[key];
  28543. if (cached) {
  28544. peg$currPos = cached.nextPos;
  28545. return cached.result;
  28546. }
  28547. s0 = peg$parsepragmaJsStatement();
  28548. if (s0 === peg$FAILED) {
  28549. s0 = peg$parselegacyJsStatement();
  28550. }
  28551. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28552. return s0;
  28553. }
  28554. function peg$parselegacyJsStatement() {
  28555. var s0, s1, s2, s3, s4;
  28556. var key = peg$currPos * 61 + 55,
  28557. cached = peg$resultsCache[key];
  28558. if (cached) {
  28559. peg$currPos = cached.nextPos;
  28560. return cached.result;
  28561. }
  28562. s0 = peg$currPos;
  28563. if (input.charCodeAt(peg$currPos) === 60) {
  28564. s1 = peg$c120;
  28565. peg$currPos++;
  28566. } else {
  28567. s1 = peg$FAILED;
  28568. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  28569. }
  28570. if (s1 !== peg$FAILED) {
  28571. s2 = [];
  28572. s3 = peg$currPos;
  28573. if (input.substr(peg$currPos, 2) === peg$c122) {
  28574. s4 = peg$c122;
  28575. peg$currPos += 2;
  28576. } else {
  28577. s4 = peg$FAILED;
  28578. if (peg$silentFails === 0) { peg$fail(peg$c123); }
  28579. }
  28580. if (s4 !== peg$FAILED) {
  28581. peg$savedPos = s3;
  28582. s4 = peg$c124();
  28583. }
  28584. s3 = s4;
  28585. if (s3 === peg$FAILED) {
  28586. if (peg$c125.test(input.charAt(peg$currPos))) {
  28587. s3 = input.charAt(peg$currPos);
  28588. peg$currPos++;
  28589. } else {
  28590. s3 = peg$FAILED;
  28591. if (peg$silentFails === 0) { peg$fail(peg$c126); }
  28592. }
  28593. }
  28594. while (s3 !== peg$FAILED) {
  28595. s2.push(s3);
  28596. s3 = peg$currPos;
  28597. if (input.substr(peg$currPos, 2) === peg$c122) {
  28598. s4 = peg$c122;
  28599. peg$currPos += 2;
  28600. } else {
  28601. s4 = peg$FAILED;
  28602. if (peg$silentFails === 0) { peg$fail(peg$c123); }
  28603. }
  28604. if (s4 !== peg$FAILED) {
  28605. peg$savedPos = s3;
  28606. s4 = peg$c124();
  28607. }
  28608. s3 = s4;
  28609. if (s3 === peg$FAILED) {
  28610. if (peg$c125.test(input.charAt(peg$currPos))) {
  28611. s3 = input.charAt(peg$currPos);
  28612. peg$currPos++;
  28613. } else {
  28614. s3 = peg$FAILED;
  28615. if (peg$silentFails === 0) { peg$fail(peg$c126); }
  28616. }
  28617. }
  28618. }
  28619. if (s2 !== peg$FAILED) {
  28620. if (input.charCodeAt(peg$currPos) === 62) {
  28621. s3 = peg$c127;
  28622. peg$currPos++;
  28623. } else {
  28624. s3 = peg$FAILED;
  28625. if (peg$silentFails === 0) { peg$fail(peg$c128); }
  28626. }
  28627. if (s3 !== peg$FAILED) {
  28628. peg$savedPos = peg$currPos;
  28629. s4 = peg$c129(s2);
  28630. if (s4) {
  28631. s4 = void 0;
  28632. } else {
  28633. s4 = peg$FAILED;
  28634. }
  28635. if (s4 !== peg$FAILED) {
  28636. peg$savedPos = s0;
  28637. s1 = peg$c130(s2);
  28638. s0 = s1;
  28639. } else {
  28640. peg$currPos = s0;
  28641. s0 = peg$FAILED;
  28642. }
  28643. } else {
  28644. peg$currPos = s0;
  28645. s0 = peg$FAILED;
  28646. }
  28647. } else {
  28648. peg$currPos = s0;
  28649. s0 = peg$FAILED;
  28650. }
  28651. } else {
  28652. peg$currPos = s0;
  28653. s0 = peg$FAILED;
  28654. }
  28655. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28656. return s0;
  28657. }
  28658. function peg$parsepragmaJsStatement() {
  28659. var s0, s1, s2, s3, s4, s5, s6, s7;
  28660. var key = peg$currPos * 61 + 56,
  28661. cached = peg$resultsCache[key];
  28662. if (cached) {
  28663. peg$currPos = cached.nextPos;
  28664. return cached.result;
  28665. }
  28666. s0 = peg$currPos;
  28667. if (input.charCodeAt(peg$currPos) === 60) {
  28668. s1 = peg$c120;
  28669. peg$currPos++;
  28670. } else {
  28671. s1 = peg$FAILED;
  28672. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  28673. }
  28674. if (s1 !== peg$FAILED) {
  28675. s2 = peg$parsews();
  28676. if (s2 !== peg$FAILED) {
  28677. if (input.substr(peg$currPos, 9) === peg$c131) {
  28678. s3 = peg$c131;
  28679. peg$currPos += 9;
  28680. } else {
  28681. s3 = peg$FAILED;
  28682. if (peg$silentFails === 0) { peg$fail(peg$c132); }
  28683. }
  28684. if (s3 !== peg$FAILED) {
  28685. s4 = peg$parsews();
  28686. if (s4 !== peg$FAILED) {
  28687. s5 = peg$parserawString();
  28688. if (s5 !== peg$FAILED) {
  28689. s6 = peg$parsews();
  28690. if (s6 !== peg$FAILED) {
  28691. if (input.charCodeAt(peg$currPos) === 62) {
  28692. s7 = peg$c127;
  28693. peg$currPos++;
  28694. } else {
  28695. s7 = peg$FAILED;
  28696. if (peg$silentFails === 0) { peg$fail(peg$c128); }
  28697. }
  28698. if (s7 !== peg$FAILED) {
  28699. peg$savedPos = s0;
  28700. s1 = peg$c133(s5);
  28701. s0 = s1;
  28702. } else {
  28703. peg$currPos = s0;
  28704. s0 = peg$FAILED;
  28705. }
  28706. } else {
  28707. peg$currPos = s0;
  28708. s0 = peg$FAILED;
  28709. }
  28710. } else {
  28711. peg$currPos = s0;
  28712. s0 = peg$FAILED;
  28713. }
  28714. } else {
  28715. peg$currPos = s0;
  28716. s0 = peg$FAILED;
  28717. }
  28718. } else {
  28719. peg$currPos = s0;
  28720. s0 = peg$FAILED;
  28721. }
  28722. } else {
  28723. peg$currPos = s0;
  28724. s0 = peg$FAILED;
  28725. }
  28726. } else {
  28727. peg$currPos = s0;
  28728. s0 = peg$FAILED;
  28729. }
  28730. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28731. return s0;
  28732. }
  28733. function peg$parsemethod() {
  28734. var s0, s1, s2;
  28735. var key = peg$currPos * 61 + 57,
  28736. cached = peg$resultsCache[key];
  28737. if (cached) {
  28738. peg$currPos = cached.nextPos;
  28739. return cached.result;
  28740. }
  28741. s0 = peg$currPos;
  28742. s1 = peg$parsewsKeywordPattern();
  28743. if (s1 === peg$FAILED) {
  28744. s1 = peg$parsewsBinaryPattern();
  28745. if (s1 === peg$FAILED) {
  28746. s1 = peg$parsewsUnaryPattern();
  28747. }
  28748. }
  28749. if (s1 !== peg$FAILED) {
  28750. s2 = peg$parsewsSequenceWs();
  28751. if (s2 === peg$FAILED) {
  28752. s2 = null;
  28753. }
  28754. if (s2 !== peg$FAILED) {
  28755. peg$savedPos = s0;
  28756. s1 = peg$c134(s1, s2);
  28757. s0 = s1;
  28758. } else {
  28759. peg$currPos = s0;
  28760. s0 = peg$FAILED;
  28761. }
  28762. } else {
  28763. peg$currPos = s0;
  28764. s0 = peg$FAILED;
  28765. }
  28766. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28767. return s0;
  28768. }
  28769. function peg$parseassociationSend() {
  28770. var s0, s1, s2;
  28771. var key = peg$currPos * 61 + 58,
  28772. cached = peg$resultsCache[key];
  28773. if (cached) {
  28774. peg$currPos = cached.nextPos;
  28775. return cached.result;
  28776. }
  28777. s0 = peg$currPos;
  28778. s1 = peg$parsebinarySend();
  28779. if (s1 !== peg$FAILED) {
  28780. peg$savedPos = peg$currPos;
  28781. s2 = peg$c135(s1);
  28782. if (s2) {
  28783. s2 = void 0;
  28784. } else {
  28785. s2 = peg$FAILED;
  28786. }
  28787. if (s2 !== peg$FAILED) {
  28788. peg$savedPos = s0;
  28789. s1 = peg$c136(s1);
  28790. s0 = s1;
  28791. } else {
  28792. peg$currPos = s0;
  28793. s0 = peg$FAILED;
  28794. }
  28795. } else {
  28796. peg$currPos = s0;
  28797. s0 = peg$FAILED;
  28798. }
  28799. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28800. return s0;
  28801. }
  28802. function peg$parsewsAssociationsRest() {
  28803. var s0, s1, s2, s3, s4;
  28804. var key = peg$currPos * 61 + 59,
  28805. cached = peg$resultsCache[key];
  28806. if (cached) {
  28807. peg$currPos = cached.nextPos;
  28808. return cached.result;
  28809. }
  28810. s0 = peg$currPos;
  28811. s1 = peg$parsews();
  28812. if (s1 !== peg$FAILED) {
  28813. if (input.charCodeAt(peg$currPos) === 46) {
  28814. s2 = peg$c6;
  28815. peg$currPos++;
  28816. } else {
  28817. s2 = peg$FAILED;
  28818. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  28819. }
  28820. if (s2 !== peg$FAILED) {
  28821. s3 = peg$parsemaybeDotsWs();
  28822. if (s3 !== peg$FAILED) {
  28823. s4 = peg$parseassociationSend();
  28824. if (s4 !== peg$FAILED) {
  28825. peg$savedPos = s0;
  28826. s1 = peg$c86(s4);
  28827. s0 = s1;
  28828. } else {
  28829. peg$currPos = s0;
  28830. s0 = peg$FAILED;
  28831. }
  28832. } else {
  28833. peg$currPos = s0;
  28834. s0 = peg$FAILED;
  28835. }
  28836. } else {
  28837. peg$currPos = s0;
  28838. s0 = peg$FAILED;
  28839. }
  28840. } else {
  28841. peg$currPos = s0;
  28842. s0 = peg$FAILED;
  28843. }
  28844. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28845. return s0;
  28846. }
  28847. function peg$parsewsAssociations() {
  28848. var s0, s1, s2, s3, s4;
  28849. var key = peg$currPos * 61 + 60,
  28850. cached = peg$resultsCache[key];
  28851. if (cached) {
  28852. peg$currPos = cached.nextPos;
  28853. return cached.result;
  28854. }
  28855. s0 = peg$currPos;
  28856. s1 = peg$parsemaybeDotsWs();
  28857. if (s1 !== peg$FAILED) {
  28858. s2 = peg$parseassociationSend();
  28859. if (s2 !== peg$FAILED) {
  28860. s3 = [];
  28861. s4 = peg$parsewsAssociationsRest();
  28862. while (s4 !== peg$FAILED) {
  28863. s3.push(s4);
  28864. s4 = peg$parsewsAssociationsRest();
  28865. }
  28866. if (s3 !== peg$FAILED) {
  28867. peg$savedPos = s0;
  28868. s1 = peg$c137(s2, s3);
  28869. s0 = s1;
  28870. } else {
  28871. peg$currPos = s0;
  28872. s0 = peg$FAILED;
  28873. }
  28874. } else {
  28875. peg$currPos = s0;
  28876. s0 = peg$FAILED;
  28877. }
  28878. } else {
  28879. peg$currPos = s0;
  28880. s0 = peg$FAILED;
  28881. }
  28882. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28883. return s0;
  28884. }
  28885. peg$result = peg$startRuleFunction();
  28886. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  28887. return peg$result;
  28888. } else {
  28889. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  28890. peg$fail({ type: "end", description: "end of input" });
  28891. }
  28892. throw peg$buildException(
  28893. null,
  28894. peg$maxFailExpected,
  28895. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  28896. peg$maxFailPos < input.length
  28897. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  28898. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  28899. );
  28900. }
  28901. }
  28902. return {
  28903. SyntaxError: peg$SyntaxError,
  28904. parse: peg$parse
  28905. };
  28906. })();
  28907. });
  28908. 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";
  28909. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  28910. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  28911. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  28912. $core.addPackage("Platform-ImportExport");
  28913. $core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  28914. $core.packages["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  28915. $core.addClass("AbstractExporter", $globals.Object, [], "Platform-ImportExport");
  28916. $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.";
  28917. $core.addMethod(
  28918. $core.method({
  28919. selector: "exportPackage:on:",
  28920. protocol: "output",
  28921. fn: function (aPackage,aStream){
  28922. var self=this;
  28923. return $core.withContext(function($ctx1) {
  28924. self._subclassResponsibility();
  28925. return self;
  28926. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  28927. },
  28928. args: ["aPackage", "aStream"],
  28929. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  28930. referencedClasses: [],
  28931. messageSends: ["subclassResponsibility"]
  28932. }),
  28933. $globals.AbstractExporter);
  28934. $core.addMethod(
  28935. $core.method({
  28936. selector: "extensionMethodsOfPackage:",
  28937. protocol: "accessing",
  28938. fn: function (aPackage){
  28939. var self=this;
  28940. var result;
  28941. return $core.withContext(function($ctx1) {
  28942. result=$recv($globals.OrderedCollection)._new();
  28943. $recv(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  28944. return $core.withContext(function($ctx2) {
  28945. return $recv(result)._addAll_($recv(each)._methods());
  28946. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28947. }));
  28948. return result;
  28949. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  28950. },
  28951. args: ["aPackage"],
  28952. 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 methods ].\x0a\x09\x09\x0a\x09^ result",
  28953. referencedClasses: ["OrderedCollection"],
  28954. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"]
  28955. }),
  28956. $globals.AbstractExporter);
  28957. $core.addMethod(
  28958. $core.method({
  28959. selector: "extensionProtocolsOfPackage:",
  28960. protocol: "accessing",
  28961. fn: function (aPackage){
  28962. var self=this;
  28963. var extensionName,result;
  28964. return $core.withContext(function($ctx1) {
  28965. var $1,$2,$3;
  28966. $1=$recv(aPackage)._name();
  28967. $ctx1.sendIdx["name"]=1;
  28968. extensionName="*".__comma($1);
  28969. result=$recv($globals.OrderedCollection)._new();
  28970. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  28971. return $core.withContext(function($ctx2) {
  28972. $2=$recv(a)._name();
  28973. $ctx2.sendIdx["name"]=2;
  28974. return $recv($2).__lt($recv(b)._name());
  28975. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28976. })))._do_((function(each){
  28977. return $core.withContext(function($ctx2) {
  28978. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._do_((function(behavior){
  28979. return $core.withContext(function($ctx3) {
  28980. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  28981. if($core.assert($3)){
  28982. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  28983. }
  28984. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  28985. }));
  28986. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28987. }));
  28988. $ctx1.sendIdx["do:"]=1;
  28989. return result;
  28990. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  28991. },
  28992. args: ["aPackage"],
  28993. 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",
  28994. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  28995. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "copyWithout:", "theMetaClass", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  28996. }),
  28997. $globals.AbstractExporter);
  28998. $core.addClass("ChunkExporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  28999. $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.";
  29000. $core.addMethod(
  29001. $core.method({
  29002. selector: "chunkEscape:",
  29003. protocol: "convenience",
  29004. fn: function (aString){
  29005. var self=this;
  29006. return $core.withContext(function($ctx1) {
  29007. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  29008. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  29009. },
  29010. args: ["aString"],
  29011. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  29012. referencedClasses: [],
  29013. messageSends: ["trimBoth", "replace:with:"]
  29014. }),
  29015. $globals.ChunkExporter);
  29016. $core.addMethod(
  29017. $core.method({
  29018. selector: "exportBehavior:on:",
  29019. protocol: "output",
  29020. fn: function (aBehavior,aStream){
  29021. var self=this;
  29022. return $core.withContext(function($ctx1) {
  29023. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  29024. self._exportProtocols_on_(self._ownMethodProtocolsOfClass_(aBehavior),aStream);
  29025. return self;
  29026. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  29027. },
  29028. args: ["aBehavior", "aStream"],
  29029. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09self \x0a\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: aBehavior)\x0a\x09\x09on: aStream",
  29030. referencedClasses: [],
  29031. messageSends: ["exportBehaviorDefinitionTo:using:", "exportProtocols:on:", "ownMethodProtocolsOfClass:"]
  29032. }),
  29033. $globals.ChunkExporter);
  29034. $core.addMethod(
  29035. $core.method({
  29036. selector: "exportCategoryEpilogueOf:on:",
  29037. protocol: "output",
  29038. fn: function (aCategory,aStream){
  29039. var self=this;
  29040. return $core.withContext(function($ctx1) {
  29041. $recv(aStream)._write_(" !");
  29042. $recv(aStream)._lf();
  29043. $ctx1.sendIdx["lf"]=1;
  29044. $recv(aStream)._lf();
  29045. return self;
  29046. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  29047. },
  29048. args: ["aCategory", "aStream"],
  29049. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  29050. referencedClasses: [],
  29051. messageSends: ["write:", "lf"]
  29052. }),
  29053. $globals.ChunkExporter);
  29054. $core.addMethod(
  29055. $core.method({
  29056. selector: "exportCategoryPrologueOf:on:",
  29057. protocol: "output",
  29058. fn: function (aCategory,aStream){
  29059. var self=this;
  29060. return $core.withContext(function($ctx1) {
  29061. $recv(aStream)._write_("!");
  29062. $ctx1.sendIdx["write:"]=1;
  29063. $recv(aStream)._print_($recv(aCategory)._theClass());
  29064. $ctx1.sendIdx["print:"]=1;
  29065. $recv(aStream)._write_(" methodsFor: ");
  29066. $ctx1.sendIdx["write:"]=2;
  29067. $recv(aStream)._print_(aCategory);
  29068. $recv(aStream)._write_("!");
  29069. return self;
  29070. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  29071. },
  29072. args: ["aCategory", "aStream"],
  29073. 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: '!'",
  29074. referencedClasses: [],
  29075. messageSends: ["write:", "print:", "theClass"]
  29076. }),
  29077. $globals.ChunkExporter);
  29078. $core.addMethod(
  29079. $core.method({
  29080. selector: "exportDefinitionOf:on:",
  29081. protocol: "output",
  29082. fn: function (aClass,aStream){
  29083. var self=this;
  29084. return $core.withContext(function($ctx1) {
  29085. var $1,$2,$3,$4;
  29086. $recv(aStream)._print_($recv(aClass)._superclass());
  29087. $ctx1.sendIdx["print:"]=1;
  29088. $recv(aStream)._write_(" subclass: ");
  29089. $ctx1.sendIdx["write:"]=1;
  29090. $recv(aStream)._printSymbol_($recv(aClass)._name());
  29091. $1=$recv(aStream)._lf();
  29092. $ctx1.sendIdx["lf"]=1;
  29093. $recv(aStream)._tab();
  29094. $ctx1.sendIdx["tab"]=1;
  29095. $recv(aStream)._write_("instanceVariableNames: ");
  29096. $ctx1.sendIdx["write:"]=2;
  29097. $recv(aStream)._print_(" "._join_($recv(aClass)._instanceVariableNames()));
  29098. $ctx1.sendIdx["print:"]=2;
  29099. $recv(aStream)._lf();
  29100. $ctx1.sendIdx["lf"]=2;
  29101. $recv(aStream)._tab();
  29102. $recv(aStream)._write_("package: ");
  29103. $ctx1.sendIdx["write:"]=3;
  29104. $recv(aStream)._print_($recv(aClass)._category());
  29105. $ctx1.sendIdx["print:"]=3;
  29106. $recv(aStream)._write_("!");
  29107. $ctx1.sendIdx["write:"]=4;
  29108. $2=$recv(aStream)._lf();
  29109. $ctx1.sendIdx["lf"]=3;
  29110. $3=$recv(aClass)._comment();
  29111. $ctx1.sendIdx["comment"]=1;
  29112. $recv($3)._ifNotEmpty_((function(){
  29113. return $core.withContext(function($ctx2) {
  29114. $recv(aStream)._write_("!");
  29115. $ctx2.sendIdx["write:"]=5;
  29116. $recv(aStream)._print_(aClass);
  29117. $recv(aStream)._write_(" commentStamp!");
  29118. $ctx2.sendIdx["write:"]=6;
  29119. $recv(aStream)._lf();
  29120. $ctx2.sendIdx["lf"]=4;
  29121. $recv(aStream)._write_([self._chunkEscape_($recv(aClass)._comment()),"!"]);
  29122. $4=$recv(aStream)._lf();
  29123. $ctx2.sendIdx["lf"]=5;
  29124. return $4;
  29125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  29126. }));
  29127. $recv(aStream)._lf();
  29128. return self;
  29129. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  29130. },
  29131. args: ["aClass", "aStream"],
  29132. 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",
  29133. referencedClasses: [],
  29134. messageSends: ["print:", "superclass", "write:", "printSymbol:", "name", "lf", "tab", "join:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  29135. }),
  29136. $globals.ChunkExporter);
  29137. $core.addMethod(
  29138. $core.method({
  29139. selector: "exportMetaDefinitionOf:on:",
  29140. protocol: "output",
  29141. fn: function (aClass,aStream){
  29142. var self=this;
  29143. var classIvars,classTraitComposition;
  29144. return $core.withContext(function($ctx1) {
  29145. var $1,$2;
  29146. $1=$recv(aClass)._class();
  29147. $ctx1.sendIdx["class"]=1;
  29148. classIvars=$recv($1)._instanceVariableNames();
  29149. classTraitComposition=$recv($recv(aClass)._class())._traitComposition();
  29150. $2=$recv(classIvars)._notEmpty();
  29151. if($core.assert($2)){
  29152. $recv(aStream)._print_($recv(aClass)._theMetaClass());
  29153. $ctx1.sendIdx["print:"]=1;
  29154. $recv(aStream)._space();
  29155. $recv(aStream)._write_("instanceVariableNames: ");
  29156. $ctx1.sendIdx["write:"]=1;
  29157. $recv(aStream)._print_(" "._join_(classIvars));
  29158. $recv(aStream)._write_("!");
  29159. $recv(aStream)._lf();
  29160. $ctx1.sendIdx["lf"]=1;
  29161. $recv(aStream)._lf();
  29162. }
  29163. return self;
  29164. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream,classIvars:classIvars,classTraitComposition:classTraitComposition},$globals.ChunkExporter)});
  29165. },
  29166. args: ["aClass", "aStream"],
  29167. 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 ]",
  29168. referencedClasses: [],
  29169. messageSends: ["instanceVariableNames", "class", "traitComposition", "ifTrue:", "notEmpty", "print:", "theMetaClass", "space", "write:", "join:", "lf"]
  29170. }),
  29171. $globals.ChunkExporter);
  29172. $core.addMethod(
  29173. $core.method({
  29174. selector: "exportMethod:on:",
  29175. protocol: "output",
  29176. fn: function (aMethod,aStream){
  29177. var self=this;
  29178. return $core.withContext(function($ctx1) {
  29179. $recv(aStream)._lf();
  29180. $ctx1.sendIdx["lf"]=1;
  29181. $recv(aStream)._lf();
  29182. $ctx1.sendIdx["lf"]=2;
  29183. $recv(aStream)._write_(self._chunkEscape_($recv(aMethod)._source()));
  29184. $ctx1.sendIdx["write:"]=1;
  29185. $recv(aStream)._lf();
  29186. $recv(aStream)._write_("!");
  29187. return self;
  29188. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  29189. },
  29190. args: ["aMethod", "aStream"],
  29191. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; write: (self chunkEscape: aMethod source); lf;\x0a\x09\x09write: '!'",
  29192. referencedClasses: [],
  29193. messageSends: ["lf", "write:", "chunkEscape:", "source"]
  29194. }),
  29195. $globals.ChunkExporter);
  29196. $core.addMethod(
  29197. $core.method({
  29198. selector: "exportPackage:on:",
  29199. protocol: "output",
  29200. fn: function (aPackage,aStream){
  29201. var self=this;
  29202. return $core.withContext(function($ctx1) {
  29203. var $1,$receiver;
  29204. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  29205. self._exportPackageImportsOf_on_(aPackage,aStream);
  29206. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  29207. return $core.withContext(function($ctx2) {
  29208. self._exportBehavior_on_(each,aStream);
  29209. $ctx2.sendIdx["exportBehavior:on:"]=1;
  29210. $1=$recv(each)._theMetaClass();
  29211. if(($receiver = $1) == null || $receiver.isNil){
  29212. return $1;
  29213. } else {
  29214. var meta;
  29215. meta=$receiver;
  29216. return self._exportBehavior_on_(meta,aStream);
  29217. }
  29218. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29219. }));
  29220. self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  29221. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  29222. return self;
  29223. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  29224. },
  29225. args: ["aPackage", "aStream"],
  29226. 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",
  29227. referencedClasses: [],
  29228. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "exportProtocols:on:", "extensionProtocolsOfPackage:"]
  29229. }),
  29230. $globals.ChunkExporter);
  29231. $core.addMethod(
  29232. $core.method({
  29233. selector: "exportPackageDefinitionOf:on:",
  29234. protocol: "output",
  29235. fn: function (aPackage,aStream){
  29236. var self=this;
  29237. return $core.withContext(function($ctx1) {
  29238. $recv(aStream)._write_("Smalltalk createPackage: ");
  29239. $ctx1.sendIdx["write:"]=1;
  29240. $recv(aStream)._print_($recv(aPackage)._name());
  29241. $recv(aStream)._write_("!");
  29242. $recv(aStream)._lf();
  29243. return self;
  29244. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  29245. },
  29246. args: ["aPackage", "aStream"],
  29247. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'Smalltalk createPackage: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: '!';\x0a\x09\x09lf",
  29248. referencedClasses: [],
  29249. messageSends: ["write:", "print:", "name", "lf"]
  29250. }),
  29251. $globals.ChunkExporter);
  29252. $core.addMethod(
  29253. $core.method({
  29254. selector: "exportPackageImportsOf:on:",
  29255. protocol: "output",
  29256. fn: function (aPackage,aStream){
  29257. var self=this;
  29258. return $core.withContext(function($ctx1) {
  29259. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  29260. return $core.withContext(function($ctx2) {
  29261. $recv(aStream)._write_("(Smalltalk packageAt: ");
  29262. $ctx2.sendIdx["write:"]=1;
  29263. $recv(aStream)._print_($recv(aPackage)._name());
  29264. $recv(aStream)._write_([") imports: ",self._chunkEscape_($recv(aPackage)._importsDefinition()),"!"]);
  29265. return $recv(aStream)._lf();
  29266. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  29267. }));
  29268. return self;
  29269. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  29270. },
  29271. args: ["aPackage", "aStream"],
  29272. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage imports ifNotEmpty: [ :imports | aStream\x0a\x09\x09write: '(Smalltalk packageAt: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: { ') imports: '. self chunkEscape: aPackage importsDefinition. '!' };\x0a\x09\x09lf ]",
  29273. referencedClasses: [],
  29274. messageSends: ["ifNotEmpty:", "imports", "write:", "print:", "name", "chunkEscape:", "importsDefinition", "lf"]
  29275. }),
  29276. $globals.ChunkExporter);
  29277. $core.addMethod(
  29278. $core.method({
  29279. selector: "exportPackageTraitCompositionsOf:on:",
  29280. protocol: "output",
  29281. fn: function (aPackage,aStream){
  29282. var self=this;
  29283. return $core.withContext(function($ctx1) {
  29284. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  29285. return $core.withContext(function($ctx2) {
  29286. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  29287. return $core.withContext(function($ctx3) {
  29288. return self._exportTraitComposition_of_on_(value,key,aStream);
  29289. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  29290. }));
  29291. $recv(aStream)._write_("! !");
  29292. $recv(aStream)._lf();
  29293. $ctx2.sendIdx["lf"]=1;
  29294. return $recv(aStream)._lf();
  29295. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  29296. }));
  29297. return self;
  29298. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  29299. },
  29300. args: ["aPackage", "aStream"],
  29301. 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 ]",
  29302. referencedClasses: [],
  29303. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "write:", "lf"]
  29304. }),
  29305. $globals.ChunkExporter);
  29306. $core.addMethod(
  29307. $core.method({
  29308. selector: "exportProtocol:on:",
  29309. protocol: "output",
  29310. fn: function (aProtocol,aStream){
  29311. var self=this;
  29312. return $core.withContext(function($ctx1) {
  29313. $recv($recv(aProtocol)._ownMethods())._ifNotEmpty_((function(methods){
  29314. return $core.withContext(function($ctx2) {
  29315. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  29316. $recv(methods)._do_((function(method){
  29317. return $core.withContext(function($ctx3) {
  29318. return self._exportMethod_on_(method,aStream);
  29319. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  29320. }));
  29321. return self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  29322. }, function($ctx2) {$ctx2.fillBlock({methods:methods},$ctx1,1)});
  29323. }));
  29324. return self;
  29325. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  29326. },
  29327. args: ["aProtocol", "aStream"],
  29328. 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 ]",
  29329. referencedClasses: [],
  29330. messageSends: ["ifNotEmpty:", "ownMethods", "exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  29331. }),
  29332. $globals.ChunkExporter);
  29333. $core.addMethod(
  29334. $core.method({
  29335. selector: "exportProtocolEpilogueOf:on:",
  29336. protocol: "output",
  29337. fn: function (aProtocol,aStream){
  29338. var self=this;
  29339. return $core.withContext(function($ctx1) {
  29340. $recv(aStream)._write_(" !");
  29341. $recv(aStream)._lf();
  29342. $ctx1.sendIdx["lf"]=1;
  29343. $recv(aStream)._lf();
  29344. return self;
  29345. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  29346. },
  29347. args: ["aProtocol", "aStream"],
  29348. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  29349. referencedClasses: [],
  29350. messageSends: ["write:", "lf"]
  29351. }),
  29352. $globals.ChunkExporter);
  29353. $core.addMethod(
  29354. $core.method({
  29355. selector: "exportProtocolPrologueOf:on:",
  29356. protocol: "output",
  29357. fn: function (aProtocol,aStream){
  29358. var self=this;
  29359. return $core.withContext(function($ctx1) {
  29360. $recv(aStream)._write_("!");
  29361. $ctx1.sendIdx["write:"]=1;
  29362. $recv(aStream)._print_($recv(aProtocol)._theClass());
  29363. $ctx1.sendIdx["print:"]=1;
  29364. $recv(aStream)._write_(" methodsFor: ");
  29365. $ctx1.sendIdx["write:"]=2;
  29366. $recv(aStream)._print_($recv(aProtocol)._name());
  29367. $recv(aStream)._write_("!");
  29368. return self;
  29369. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  29370. },
  29371. args: ["aProtocol", "aStream"],
  29372. 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: '!'",
  29373. referencedClasses: [],
  29374. messageSends: ["write:", "print:", "theClass", "name"]
  29375. }),
  29376. $globals.ChunkExporter);
  29377. $core.addMethod(
  29378. $core.method({
  29379. selector: "exportProtocols:on:",
  29380. protocol: "output",
  29381. fn: function (aCollection,aStream){
  29382. var self=this;
  29383. return $core.withContext(function($ctx1) {
  29384. $recv(aCollection)._do_((function(each){
  29385. return $core.withContext(function($ctx2) {
  29386. return self._exportProtocol_on_(each,aStream);
  29387. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29388. }));
  29389. return self;
  29390. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  29391. },
  29392. args: ["aCollection", "aStream"],
  29393. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  29394. referencedClasses: [],
  29395. messageSends: ["do:", "exportProtocol:on:"]
  29396. }),
  29397. $globals.ChunkExporter);
  29398. $core.addMethod(
  29399. $core.method({
  29400. selector: "exportTraitComposition:of:on:",
  29401. protocol: "output",
  29402. fn: function (aTraitComposition,aBehavior,aStream){
  29403. var self=this;
  29404. return $core.withContext(function($ctx1) {
  29405. $recv(aStream)._print_(aBehavior);
  29406. $recv(aStream)._write_(" setTraitComposition: ");
  29407. $ctx1.sendIdx["write:"]=1;
  29408. $recv(aStream)._write_($recv(aBehavior)._traitCompositionDefinition());
  29409. $ctx1.sendIdx["write:"]=2;
  29410. $recv(aStream)._write_(" asTraitComposition!");
  29411. $recv(aStream)._lf();
  29412. return self;
  29413. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  29414. },
  29415. args: ["aTraitComposition", "aBehavior", "aStream"],
  29416. 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",
  29417. referencedClasses: [],
  29418. messageSends: ["print:", "write:", "traitCompositionDefinition", "lf"]
  29419. }),
  29420. $globals.ChunkExporter);
  29421. $core.addMethod(
  29422. $core.method({
  29423. selector: "exportTraitDefinitionOf:on:",
  29424. protocol: "output",
  29425. fn: function (aClass,aStream){
  29426. var self=this;
  29427. return $core.withContext(function($ctx1) {
  29428. var $1,$2,$3,$4;
  29429. $recv(aStream)._write_("Trait named: ");
  29430. $ctx1.sendIdx["write:"]=1;
  29431. $recv(aStream)._printSymbol_($recv(aClass)._name());
  29432. $1=$recv(aStream)._lf();
  29433. $ctx1.sendIdx["lf"]=1;
  29434. $recv(aStream)._tab();
  29435. $recv(aStream)._write_("package: ");
  29436. $ctx1.sendIdx["write:"]=2;
  29437. $recv(aStream)._print_($recv(aClass)._category());
  29438. $ctx1.sendIdx["print:"]=1;
  29439. $recv(aStream)._write_("!");
  29440. $ctx1.sendIdx["write:"]=3;
  29441. $2=$recv(aStream)._lf();
  29442. $ctx1.sendIdx["lf"]=2;
  29443. $3=$recv(aClass)._comment();
  29444. $ctx1.sendIdx["comment"]=1;
  29445. $recv($3)._ifNotEmpty_((function(){
  29446. return $core.withContext(function($ctx2) {
  29447. $recv(aStream)._write_("!");
  29448. $ctx2.sendIdx["write:"]=4;
  29449. $recv(aStream)._print_(aClass);
  29450. $recv(aStream)._write_(" commentStamp!");
  29451. $ctx2.sendIdx["write:"]=5;
  29452. $recv(aStream)._lf();
  29453. $ctx2.sendIdx["lf"]=3;
  29454. $recv(aStream)._write_([self._chunkEscape_($recv(aClass)._comment()),"!"]);
  29455. $4=$recv(aStream)._lf();
  29456. $ctx2.sendIdx["lf"]=4;
  29457. return $4;
  29458. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  29459. }));
  29460. $recv(aStream)._lf();
  29461. return self;
  29462. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  29463. },
  29464. args: ["aClass", "aStream"],
  29465. 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",
  29466. referencedClasses: [],
  29467. messageSends: ["write:", "printSymbol:", "name", "lf", "tab", "print:", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  29468. }),
  29469. $globals.ChunkExporter);
  29470. $core.addMethod(
  29471. $core.method({
  29472. selector: "extensionCategoriesOfPackage:",
  29473. protocol: "accessing",
  29474. fn: function (aPackage){
  29475. var self=this;
  29476. var name,map,result;
  29477. return $core.withContext(function($ctx1) {
  29478. var $1;
  29479. name=$recv(aPackage)._name();
  29480. result=$recv($globals.OrderedCollection)._new();
  29481. $ctx1.sendIdx["new"]=1;
  29482. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  29483. return $core.withContext(function($ctx2) {
  29484. return $recv([each,$recv(each)._theMetaClass()])._do_((function(aClass){
  29485. return $core.withContext(function($ctx3) {
  29486. map=$recv($globals.Dictionary)._new();
  29487. map;
  29488. $recv(aClass)._protocolsDo_((function(category,methods){
  29489. return $core.withContext(function($ctx4) {
  29490. $1=$recv(category).__eq("*".__comma(name));
  29491. if($core.assert($1)){
  29492. return $recv(map)._at_put_(category,methods);
  29493. }
  29494. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  29495. }));
  29496. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  29497. return $core.withContext(function($ctx4) {
  29498. return $recv(a).__lt_eq(b);
  29499. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  29500. })))._collect_((function(category){
  29501. return $core.withContext(function($ctx4) {
  29502. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  29503. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  29504. })));
  29505. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  29506. }));
  29507. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29508. }));
  29509. $ctx1.sendIdx["do:"]=1;
  29510. return result;
  29511. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  29512. },
  29513. args: ["aPackage"],
  29514. 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",
  29515. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  29516. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "theMetaClass", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  29517. }),
  29518. $globals.ChunkExporter);
  29519. $core.addMethod(
  29520. $core.method({
  29521. selector: "ownCategoriesOfClass:",
  29522. protocol: "accessing",
  29523. fn: function (aClass){
  29524. var self=this;
  29525. var map;
  29526. return $core.withContext(function($ctx1) {
  29527. var $1;
  29528. map=$recv($globals.Dictionary)._new();
  29529. $recv(aClass)._protocolsDo_((function(each,methods){
  29530. return $core.withContext(function($ctx2) {
  29531. $1=$recv(each)._match_("^\x5c*");
  29532. if(!$core.assert($1)){
  29533. return $recv(map)._at_put_(each,methods);
  29534. }
  29535. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  29536. }));
  29537. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  29538. return $core.withContext(function($ctx2) {
  29539. return $recv(a).__lt_eq(b);
  29540. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  29541. })))._collect_((function(each){
  29542. return $core.withContext(function($ctx2) {
  29543. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  29544. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  29545. }));
  29546. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  29547. },
  29548. args: ["aClass"],
  29549. 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) ]",
  29550. referencedClasses: ["Dictionary", "MethodCategory"],
  29551. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  29552. }),
  29553. $globals.ChunkExporter);
  29554. $core.addMethod(
  29555. $core.method({
  29556. selector: "ownCategoriesOfMetaClass:",
  29557. protocol: "accessing",
  29558. fn: function (aClass){
  29559. var self=this;
  29560. return $core.withContext(function($ctx1) {
  29561. return self._ownCategoriesOfClass_($recv(aClass)._theMetaClass());
  29562. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  29563. },
  29564. args: ["aClass"],
  29565. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass theMetaClass",
  29566. referencedClasses: [],
  29567. messageSends: ["ownCategoriesOfClass:", "theMetaClass"]
  29568. }),
  29569. $globals.ChunkExporter);
  29570. $core.addMethod(
  29571. $core.method({
  29572. selector: "ownMethodProtocolsOfClass:",
  29573. protocol: "accessing",
  29574. fn: function (aClass){
  29575. var self=this;
  29576. return $core.withContext(function($ctx1) {
  29577. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  29578. return $core.withContext(function($ctx2) {
  29579. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  29580. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29581. }));
  29582. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  29583. },
  29584. args: ["aClass"],
  29585. 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 ]",
  29586. referencedClasses: ["ExportMethodProtocol"],
  29587. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  29588. }),
  29589. $globals.ChunkExporter);
  29590. $core.addClass("Exporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  29591. $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.).";
  29592. $core.addMethod(
  29593. $core.method({
  29594. selector: "exportBehavior:on:",
  29595. protocol: "output",
  29596. fn: function (aBehavior,aStream){
  29597. var self=this;
  29598. return $core.withContext(function($ctx1) {
  29599. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  29600. $recv($recv(aBehavior)._ownMethods())._do_((function(method){
  29601. return $core.withContext(function($ctx2) {
  29602. return self._exportMethod_on_(method,aStream);
  29603. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  29604. }));
  29605. return self;
  29606. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  29607. },
  29608. args: ["aBehavior", "aStream"],
  29609. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09aBehavior ownMethods do: [ :method |\x0a\x09\x09self exportMethod: method on: aStream ]",
  29610. referencedClasses: [],
  29611. messageSends: ["exportBehaviorDefinitionTo:using:", "do:", "ownMethods", "exportMethod:on:"]
  29612. }),
  29613. $globals.Exporter);
  29614. $core.addMethod(
  29615. $core.method({
  29616. selector: "exportDefinitionOf:on:",
  29617. protocol: "output",
  29618. fn: function (aClass,aStream){
  29619. var self=this;
  29620. return $core.withContext(function($ctx1) {
  29621. var $3,$5,$4,$6,$7,$2,$1,$8,$10,$9,$receiver;
  29622. $recv(aStream)._lf();
  29623. $ctx1.sendIdx["lf"]=1;
  29624. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  29625. $ctx1.sendIdx["asJavaScriptSource"]=1;
  29626. $5=$recv(aClass)._superclass();
  29627. if(($receiver = $5) == null || $receiver.isNil){
  29628. $4="null";
  29629. } else {
  29630. var superclass;
  29631. superclass=$receiver;
  29632. $4=$recv(superclass)._asJavaScriptSource();
  29633. $ctx1.sendIdx["asJavaScriptSource"]=2;
  29634. }
  29635. $6=$recv($recv(aClass)._instanceVariableNames())._asJavaScriptSource();
  29636. $ctx1.sendIdx["asJavaScriptSource"]=3;
  29637. $7=$recv($recv(aClass)._category())._asJavaScriptSource();
  29638. $ctx1.sendIdx["asJavaScriptSource"]=4;
  29639. $2=["$core.addClass(",$3,", ",$4,", ",$6,", ",$7,");"];
  29640. $1=$recv(aStream)._write_($2);
  29641. $ctx1.sendIdx["write:"]=1;
  29642. $8=$recv(aClass)._comment();
  29643. $ctx1.sendIdx["comment"]=1;
  29644. $recv($8)._ifNotEmpty_((function(){
  29645. return $core.withContext(function($ctx2) {
  29646. $recv(aStream)._lf();
  29647. $ctx2.sendIdx["lf"]=2;
  29648. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  29649. $ctx2.sendIdx["write:"]=2;
  29650. $recv(aStream)._lf();
  29651. $ctx2.sendIdx["lf"]=3;
  29652. $10=$recv(aClass)._asJavaScriptSource();
  29653. $ctx2.sendIdx["asJavaScriptSource"]=5;
  29654. $9=[$10,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  29655. $recv(aStream)._write_($9);
  29656. $ctx2.sendIdx["write:"]=3;
  29657. $recv(aStream)._lf();
  29658. $ctx2.sendIdx["lf"]=4;
  29659. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  29660. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  29661. }));
  29662. $recv(aStream)._lf();
  29663. return self;
  29664. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  29665. },
  29666. args: ["aClass", "aStream"],
  29667. 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",
  29668. referencedClasses: [],
  29669. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "ifNil:ifNotNil:", "superclass", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  29670. }),
  29671. $globals.Exporter);
  29672. $core.addMethod(
  29673. $core.method({
  29674. selector: "exportMetaDefinitionOf:on:",
  29675. protocol: "output",
  29676. fn: function (aClass,aStream){
  29677. var self=this;
  29678. return $core.withContext(function($ctx1) {
  29679. var $2,$1,$4,$3;
  29680. $recv(aStream)._lf();
  29681. $ctx1.sendIdx["lf"]=1;
  29682. $2=$recv(aClass)._theMetaClass();
  29683. $ctx1.sendIdx["theMetaClass"]=1;
  29684. $1=$recv($2)._instanceVariableNames();
  29685. $recv($1)._ifNotEmpty_((function(classIvars){
  29686. return $core.withContext(function($ctx2) {
  29687. $4=$recv($recv(aClass)._theMetaClass())._asJavaScriptSource();
  29688. $ctx2.sendIdx["asJavaScriptSource"]=1;
  29689. $3=[$4,".iVarNames = ",$recv(classIvars)._asJavaScriptSource(),";"];
  29690. $recv(aStream)._write_($3);
  29691. return $recv(aStream)._lf();
  29692. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  29693. }));
  29694. return self;
  29695. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  29696. },
  29697. args: ["aClass", "aStream"],
  29698. 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 ]",
  29699. referencedClasses: [],
  29700. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "theMetaClass", "write:", "asJavaScriptSource"]
  29701. }),
  29702. $globals.Exporter);
  29703. $core.addMethod(
  29704. $core.method({
  29705. selector: "exportMethod:on:",
  29706. protocol: "output",
  29707. fn: function (aMethod,aStream){
  29708. var self=this;
  29709. return $core.withContext(function($ctx1) {
  29710. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  29711. $recv(aStream)._write_("$core.addMethod(");
  29712. $ctx1.sendIdx["write:"]=1;
  29713. $recv(aStream)._lf();
  29714. $ctx1.sendIdx["lf"]=1;
  29715. $recv(aStream)._write_("$core.method({");
  29716. $ctx1.sendIdx["write:"]=2;
  29717. $recv(aStream)._lf();
  29718. $ctx1.sendIdx["lf"]=2;
  29719. $2=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  29720. $ctx1.sendIdx["asJavaScriptSource"]=1;
  29721. $1=["selector: ",$2,","];
  29722. $recv(aStream)._write_($1);
  29723. $ctx1.sendIdx["write:"]=3;
  29724. $recv(aStream)._lf();
  29725. $ctx1.sendIdx["lf"]=3;
  29726. $4=$recv($recv(aMethod)._protocol())._asJavaScriptSource();
  29727. $ctx1.sendIdx["asJavaScriptSource"]=2;
  29728. $3=["protocol: ",$4,","];
  29729. $recv(aStream)._write_($3);
  29730. $ctx1.sendIdx["write:"]=4;
  29731. $recv(aStream)._lf();
  29732. $ctx1.sendIdx["lf"]=4;
  29733. $recv(aStream)._write_(["fn: ",$recv($recv(aMethod)._fn())._compiledSource(),","]);
  29734. $ctx1.sendIdx["write:"]=5;
  29735. $recv(aStream)._lf();
  29736. $ctx1.sendIdx["lf"]=5;
  29737. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  29738. $ctx1.sendIdx["write:"]=6;
  29739. $recv(aStream)._lf();
  29740. $ctx1.sendIdx["lf"]=6;
  29741. $6=$recv($recv(aMethod)._arguments())._asJavaScriptSource();
  29742. $ctx1.sendIdx["asJavaScriptSource"]=3;
  29743. $5=["args: ",$6,","];
  29744. $recv(aStream)._write_($5);
  29745. $ctx1.sendIdx["write:"]=7;
  29746. $recv(aStream)._lf();
  29747. $ctx1.sendIdx["lf"]=7;
  29748. $8=$recv($recv(aMethod)._source())._asJavaScriptSource();
  29749. $ctx1.sendIdx["asJavaScriptSource"]=4;
  29750. $7=["source: ",$8,","];
  29751. $recv(aStream)._write_($7);
  29752. $ctx1.sendIdx["write:"]=8;
  29753. $recv(aStream)._lf();
  29754. $ctx1.sendIdx["lf"]=8;
  29755. $10=$recv($recv(aMethod)._referencedClasses())._asJavaScriptSource();
  29756. $ctx1.sendIdx["asJavaScriptSource"]=5;
  29757. $9=["referencedClasses: ",$10,","];
  29758. $recv(aStream)._write_($9);
  29759. $ctx1.sendIdx["write:"]=9;
  29760. $recv(aStream)._lf();
  29761. $ctx1.sendIdx["lf"]=9;
  29762. $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  29763. $ctx1.sendIdx["write:"]=10;
  29764. $recv(aStream)._lf();
  29765. $ctx1.sendIdx["lf"]=10;
  29766. $12=$recv($recv(aMethod)._messageSends())._asJavaScriptSource();
  29767. $ctx1.sendIdx["asJavaScriptSource"]=6;
  29768. $11=["messageSends: ",$12];
  29769. $recv(aStream)._write_($11);
  29770. $ctx1.sendIdx["write:"]=11;
  29771. $recv(aStream)._lf();
  29772. $ctx1.sendIdx["lf"]=11;
  29773. $recv(aStream)._write_("}),");
  29774. $ctx1.sendIdx["write:"]=12;
  29775. $recv(aStream)._lf();
  29776. $ctx1.sendIdx["lf"]=12;
  29777. $recv(aStream)._write_([$recv($recv(aMethod)._methodClass())._asJavaScriptSource(),");"]);
  29778. $recv(aStream)._lf();
  29779. $ctx1.sendIdx["lf"]=13;
  29780. $recv(aStream)._lf();
  29781. return self;
  29782. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  29783. },
  29784. args: ["aMethod", "aStream"],
  29785. 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",
  29786. referencedClasses: [],
  29787. messageSends: ["write:", "lf", "asJavaScriptSource", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "methodClass"]
  29788. }),
  29789. $globals.Exporter);
  29790. $core.addMethod(
  29791. $core.method({
  29792. selector: "exportPackage:on:",
  29793. protocol: "output",
  29794. fn: function (aPackage,aStream){
  29795. var self=this;
  29796. return $core.withContext(function($ctx1) {
  29797. var $1,$receiver;
  29798. self._exportPackagePrologueOf_on_(aPackage,aStream);
  29799. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  29800. self._exportPackageContextOf_on_(aPackage,aStream);
  29801. self._exportPackageImportsOf_on_(aPackage,aStream);
  29802. self._exportPackageTransportOf_on_(aPackage,aStream);
  29803. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  29804. return $core.withContext(function($ctx2) {
  29805. self._exportBehavior_on_(each,aStream);
  29806. $ctx2.sendIdx["exportBehavior:on:"]=1;
  29807. $1=$recv(each)._theMetaClass();
  29808. if(($receiver = $1) == null || $receiver.isNil){
  29809. return $1;
  29810. } else {
  29811. var meta;
  29812. meta=$receiver;
  29813. return self._exportBehavior_on_(meta,aStream);
  29814. }
  29815. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29816. }));
  29817. $ctx1.sendIdx["do:"]=1;
  29818. self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  29819. $recv(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  29820. return $core.withContext(function($ctx2) {
  29821. return self._exportMethod_on_(each,aStream);
  29822. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  29823. }));
  29824. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  29825. return self;
  29826. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29827. },
  29828. args: ["aPackage", "aStream"],
  29829. 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",
  29830. referencedClasses: [],
  29831. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "extensionMethodsOfPackage:", "exportMethod:on:", "exportPackageEpilogueOf:on:"]
  29832. }),
  29833. $globals.Exporter);
  29834. $core.addMethod(
  29835. $core.method({
  29836. selector: "exportPackageBodyBlockPrologueOf:on:",
  29837. protocol: "output",
  29838. fn: function (aPackage,aStream){
  29839. var self=this;
  29840. return $core.withContext(function($ctx1) {
  29841. $recv(aStream)._write_("if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;");
  29842. $ctx1.sendIdx["write:"]=1;
  29843. $recv(aStream)._lf();
  29844. $ctx1.sendIdx["lf"]=1;
  29845. $recv(aStream)._write_("var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  29846. $ctx1.sendIdx["write:"]=2;
  29847. $recv(aStream)._lf();
  29848. $ctx1.sendIdx["lf"]=2;
  29849. $recv(aStream)._write_("if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;");
  29850. $recv(aStream)._lf();
  29851. return self;
  29852. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29853. },
  29854. args: ["aPackage", "aStream"],
  29855. source: "exportPackageBodyBlockPrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;'; lf;\x0a\x09\x09write: 'var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;'; lf;\x0a\x09\x09write: 'if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;'; lf",
  29856. referencedClasses: [],
  29857. messageSends: ["write:", "lf"]
  29858. }),
  29859. $globals.Exporter);
  29860. $core.addMethod(
  29861. $core.method({
  29862. selector: "exportPackageContextOf:on:",
  29863. protocol: "output",
  29864. fn: function (aPackage,aStream){
  29865. var self=this;
  29866. return $core.withContext(function($ctx1) {
  29867. $recv(aStream)._write_(["$core.packages[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].innerEval = ","function (expr) { return eval(expr); }",";"]);
  29868. $recv(aStream)._lf();
  29869. return self;
  29870. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29871. },
  29872. args: ["aPackage", "aStream"],
  29873. source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'$core.packages['.\x0a\x09\x09\x09aPackage name asJavaScriptSource.\x0a\x09\x09\x09'].innerEval = '.\x0a\x09\x09\x09'function (expr) { return eval(expr); }'.\x0a\x09\x09\x09';' };\x0a\x09\x09lf",
  29874. referencedClasses: [],
  29875. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  29876. }),
  29877. $globals.Exporter);
  29878. $core.addMethod(
  29879. $core.method({
  29880. selector: "exportPackageDefinitionOf:on:",
  29881. protocol: "output",
  29882. fn: function (aPackage,aStream){
  29883. var self=this;
  29884. return $core.withContext(function($ctx1) {
  29885. $recv(aStream)._write_(["$core.addPackage(",$recv($recv(aPackage)._name())._asJavaScriptSource(),");"]);
  29886. $recv(aStream)._lf();
  29887. return self;
  29888. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29889. },
  29890. args: ["aPackage", "aStream"],
  29891. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { '$core.addPackage('. aPackage name asJavaScriptSource. ');' };\x0a\x09\x09lf",
  29892. referencedClasses: [],
  29893. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  29894. }),
  29895. $globals.Exporter);
  29896. $core.addMethod(
  29897. $core.method({
  29898. selector: "exportPackageEpilogueOf:on:",
  29899. protocol: "output",
  29900. fn: function (aPackage,aStream){
  29901. var self=this;
  29902. return $core.withContext(function($ctx1) {
  29903. self._subclassResponsibility();
  29904. return self;
  29905. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29906. },
  29907. args: ["aPackage", "aStream"],
  29908. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  29909. referencedClasses: [],
  29910. messageSends: ["subclassResponsibility"]
  29911. }),
  29912. $globals.Exporter);
  29913. $core.addMethod(
  29914. $core.method({
  29915. selector: "exportPackageImportsOf:on:",
  29916. protocol: "output",
  29917. fn: function (aPackage,aStream){
  29918. var self=this;
  29919. return $core.withContext(function($ctx1) {
  29920. var $2,$1;
  29921. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  29922. return $core.withContext(function($ctx2) {
  29923. $2=$recv($recv(aPackage)._name())._asJavaScriptSource();
  29924. $ctx2.sendIdx["asJavaScriptSource"]=1;
  29925. $1=["$core.packages[",$2,"].imports = ",$recv(imports)._asJavaScriptSource(),";"];
  29926. $recv(aStream)._write_($1);
  29927. return $recv(aStream)._lf();
  29928. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  29929. }));
  29930. return self;
  29931. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29932. },
  29933. args: ["aPackage", "aStream"],
  29934. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage importsAsJson ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09write: {\x0a\x09\x09\x09\x09'$core.packages['.\x0a\x09\x09\x09\x09aPackage name asJavaScriptSource.\x0a\x09\x09\x09\x09'].imports = '.\x0a\x09\x09\x09\x09imports asJavaScriptSource.\x0a\x09\x09\x09\x09';' };\x0a\x09\x09\x09lf ]",
  29935. referencedClasses: [],
  29936. messageSends: ["ifNotEmpty:", "importsAsJson", "write:", "asJavaScriptSource", "name", "lf"]
  29937. }),
  29938. $globals.Exporter);
  29939. $core.addMethod(
  29940. $core.method({
  29941. selector: "exportPackagePrologueOf:on:",
  29942. protocol: "output",
  29943. fn: function (aPackage,aStream){
  29944. var self=this;
  29945. return $core.withContext(function($ctx1) {
  29946. self._subclassResponsibility();
  29947. return self;
  29948. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29949. },
  29950. args: ["aPackage", "aStream"],
  29951. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  29952. referencedClasses: [],
  29953. messageSends: ["subclassResponsibility"]
  29954. }),
  29955. $globals.Exporter);
  29956. $core.addMethod(
  29957. $core.method({
  29958. selector: "exportPackageTraitCompositionsOf:on:",
  29959. protocol: "output",
  29960. fn: function (aPackage,aStream){
  29961. var self=this;
  29962. return $core.withContext(function($ctx1) {
  29963. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  29964. return $core.withContext(function($ctx2) {
  29965. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  29966. return $core.withContext(function($ctx3) {
  29967. return self._exportTraitComposition_of_on_(value,key,aStream);
  29968. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  29969. }));
  29970. return $recv(aStream)._lf();
  29971. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  29972. }));
  29973. return self;
  29974. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29975. },
  29976. args: ["aPackage", "aStream"],
  29977. 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 ]",
  29978. referencedClasses: [],
  29979. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "lf"]
  29980. }),
  29981. $globals.Exporter);
  29982. $core.addMethod(
  29983. $core.method({
  29984. selector: "exportPackageTransportOf:on:",
  29985. protocol: "output",
  29986. fn: function (aPackage,aStream){
  29987. var self=this;
  29988. return $core.withContext(function($ctx1) {
  29989. $recv(aStream)._write_(["$core.packages[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].transport = ",$recv($recv(aPackage)._transport())._asJSONString(),";"]);
  29990. $recv(aStream)._lf();
  29991. return self;
  29992. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29993. },
  29994. args: ["aPackage", "aStream"],
  29995. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'$core.packages['.\x0a\x09\x09\x09aPackage name asJavaScriptSource.\x0a\x09\x09\x09'].transport = '.\x0a\x09\x09\x09aPackage transport asJSONString.\x0a\x09\x09\x09';' };\x0a\x09\x09lf",
  29996. referencedClasses: [],
  29997. messageSends: ["write:", "asJavaScriptSource", "name", "asJSONString", "transport", "lf"]
  29998. }),
  29999. $globals.Exporter);
  30000. $core.addMethod(
  30001. $core.method({
  30002. selector: "exportTraitComposition:of:on:",
  30003. protocol: "output",
  30004. fn: function (aTraitComposition,aBehavior,aStream){
  30005. var self=this;
  30006. return $core.withContext(function($ctx1) {
  30007. var $2,$1;
  30008. $2=$recv(aTraitComposition)._asJavaScriptSource();
  30009. $ctx1.sendIdx["asJavaScriptSource"]=1;
  30010. $1=["$core.setTraitComposition(",$2,", ",$recv(aBehavior)._asJavaScriptSource(),");"];
  30011. $recv(aStream)._write_($1);
  30012. $recv(aStream)._lf();
  30013. return self;
  30014. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  30015. },
  30016. args: ["aTraitComposition", "aBehavior", "aStream"],
  30017. 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",
  30018. referencedClasses: [],
  30019. messageSends: ["write:", "asJavaScriptSource", "lf"]
  30020. }),
  30021. $globals.Exporter);
  30022. $core.addMethod(
  30023. $core.method({
  30024. selector: "exportTraitDefinitionOf:on:",
  30025. protocol: "output",
  30026. fn: function (aClass,aStream){
  30027. var self=this;
  30028. return $core.withContext(function($ctx1) {
  30029. var $3,$4,$2,$1,$5,$7,$6;
  30030. $recv(aStream)._lf();
  30031. $ctx1.sendIdx["lf"]=1;
  30032. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  30033. $ctx1.sendIdx["asJavaScriptSource"]=1;
  30034. $4=$recv($recv(aClass)._category())._asJavaScriptSource();
  30035. $ctx1.sendIdx["asJavaScriptSource"]=2;
  30036. $2=["$core.addTrait(",$3,", ",$4,");"];
  30037. $1=$recv(aStream)._write_($2);
  30038. $ctx1.sendIdx["write:"]=1;
  30039. $5=$recv(aClass)._comment();
  30040. $ctx1.sendIdx["comment"]=1;
  30041. $recv($5)._ifNotEmpty_((function(){
  30042. return $core.withContext(function($ctx2) {
  30043. $recv(aStream)._lf();
  30044. $ctx2.sendIdx["lf"]=2;
  30045. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  30046. $ctx2.sendIdx["write:"]=2;
  30047. $recv(aStream)._lf();
  30048. $ctx2.sendIdx["lf"]=3;
  30049. $7=$recv(aClass)._asJavaScriptSource();
  30050. $ctx2.sendIdx["asJavaScriptSource"]=3;
  30051. $6=[$7,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  30052. $recv(aStream)._write_($6);
  30053. $ctx2.sendIdx["write:"]=3;
  30054. $recv(aStream)._lf();
  30055. $ctx2.sendIdx["lf"]=4;
  30056. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  30057. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30058. }));
  30059. $recv(aStream)._lf();
  30060. return self;
  30061. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  30062. },
  30063. args: ["aClass", "aStream"],
  30064. 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",
  30065. referencedClasses: [],
  30066. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  30067. }),
  30068. $globals.Exporter);
  30069. $core.addMethod(
  30070. $core.method({
  30071. selector: "ownMethodsOfClass:",
  30072. protocol: "accessing",
  30073. fn: function (aClass){
  30074. var self=this;
  30075. return $core.withContext(function($ctx1) {
  30076. var $1;
  30077. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  30078. return $core.withContext(function($ctx2) {
  30079. $1=$recv(a)._selector();
  30080. $ctx2.sendIdx["selector"]=1;
  30081. return $recv($1).__lt_eq($recv(b)._selector());
  30082. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30083. })))._reject_((function(each){
  30084. return $core.withContext(function($ctx2) {
  30085. return $recv($recv(each)._protocol())._match_("^\x5c*");
  30086. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  30087. }));
  30088. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  30089. },
  30090. args: ["aClass"],
  30091. 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*') ]",
  30092. referencedClasses: [],
  30093. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  30094. }),
  30095. $globals.Exporter);
  30096. $core.addMethod(
  30097. $core.method({
  30098. selector: "ownMethodsOfMetaClass:",
  30099. protocol: "accessing",
  30100. fn: function (aClass){
  30101. var self=this;
  30102. return $core.withContext(function($ctx1) {
  30103. return self._ownMethodsOfClass_($recv(aClass)._theMetaClass());
  30104. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  30105. },
  30106. args: ["aClass"],
  30107. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass theMetaClass",
  30108. referencedClasses: [],
  30109. messageSends: ["ownMethodsOfClass:", "theMetaClass"]
  30110. }),
  30111. $globals.Exporter);
  30112. $core.addClass("AmdExporter", $globals.Exporter, ["namespace"], "Platform-ImportExport");
  30113. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  30114. $core.addMethod(
  30115. $core.method({
  30116. selector: "amdNamesOfPackages:",
  30117. protocol: "private",
  30118. fn: function (anArray){
  30119. var self=this;
  30120. return $core.withContext(function($ctx1) {
  30121. var $1;
  30122. return $recv($recv(anArray)._select_((function(each){
  30123. return $core.withContext(function($ctx2) {
  30124. $1=self._amdNamespaceOfPackage_(each);
  30125. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  30126. return $recv($1)._notNil();
  30127. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30128. })))._collect_((function(each){
  30129. return $core.withContext(function($ctx2) {
  30130. return $recv($recv(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  30131. $ctx2.sendIdx[","]=1;
  30132. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  30133. }));
  30134. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  30135. },
  30136. args: ["anArray"],
  30137. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  30138. referencedClasses: [],
  30139. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  30140. }),
  30141. $globals.AmdExporter);
  30142. $core.addMethod(
  30143. $core.method({
  30144. selector: "amdNamespaceOfPackage:",
  30145. protocol: "private",
  30146. fn: function (aPackage){
  30147. var self=this;
  30148. return $core.withContext(function($ctx1) {
  30149. var $3,$2,$1;
  30150. $3=$recv(aPackage)._transport();
  30151. $ctx1.sendIdx["transport"]=1;
  30152. $2=$recv($3)._type();
  30153. $1=$recv($2).__eq("amd");
  30154. if($core.assert($1)){
  30155. return $recv($recv(aPackage)._transport())._namespace();
  30156. } else {
  30157. return nil;
  30158. }
  30159. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  30160. },
  30161. args: ["aPackage"],
  30162. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  30163. referencedClasses: [],
  30164. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  30165. }),
  30166. $globals.AmdExporter);
  30167. $core.addMethod(
  30168. $core.method({
  30169. selector: "exportPackageEpilogueOf:on:",
  30170. protocol: "output",
  30171. fn: function (aPackage,aStream){
  30172. var self=this;
  30173. return $core.withContext(function($ctx1) {
  30174. $recv(aStream)._write_("});");
  30175. $recv(aStream)._lf();
  30176. return self;
  30177. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  30178. },
  30179. args: ["aPackage", "aStream"],
  30180. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '});';\x0a\x09\x09lf",
  30181. referencedClasses: [],
  30182. messageSends: ["write:", "lf"]
  30183. }),
  30184. $globals.AmdExporter);
  30185. $core.addMethod(
  30186. $core.method({
  30187. selector: "exportPackagePrologueOf:on:",
  30188. protocol: "output",
  30189. fn: function (aPackage,aStream){
  30190. var self=this;
  30191. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  30192. return $core.withContext(function($ctx1) {
  30193. var $1,$3,$2,$4,$6,$5,$7,$14,$13,$12,$11,$10,$9,$18,$17,$16,$15,$8;
  30194. pragmaStart="";
  30195. pragmaEnd="";
  30196. importsForOutput=self._importsForOutput_(aPackage);
  30197. loadDependencies=self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  30198. $1=$recv(importsForOutput)._value();
  30199. $ctx1.sendIdx["value"]=1;
  30200. $recv($1)._ifNotEmpty_((function(){
  30201. return $core.withContext(function($ctx2) {
  30202. $3=$recv($globals.String)._lf();
  30203. $ctx2.sendIdx["lf"]=1;
  30204. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  30205. $ctx2.sendIdx[","]=2;
  30206. $4=$recv($globals.String)._lf();
  30207. $ctx2.sendIdx["lf"]=2;
  30208. pragmaStart=$recv($2).__comma($4);
  30209. $ctx2.sendIdx[","]=1;
  30210. pragmaStart;
  30211. $6=$recv($globals.String)._lf();
  30212. $ctx2.sendIdx["lf"]=3;
  30213. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  30214. $ctx2.sendIdx[","]=4;
  30215. $7=$recv($globals.String)._lf();
  30216. $ctx2.sendIdx["lf"]=4;
  30217. pragmaEnd=$recv($5).__comma($7);
  30218. $ctx2.sendIdx[","]=3;
  30219. return pragmaEnd;
  30220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30221. }));
  30222. $14=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  30223. $ctx1.sendIdx[","]=7;
  30224. $13=$recv($14).__comma([":2:"]);
  30225. $ctx1.sendIdx[","]=6;
  30226. $12=$recv($13).__comma($recv($recv(loadDependencies)._asArray())._sorted());
  30227. $ctx1.sendIdx[","]=5;
  30228. $11=$recv($12)._asJavaScriptSource();
  30229. $10=$recv($11)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  30230. $ctx1.sendIdx["replace:with:"]=2;
  30231. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  30232. $ctx1.sendIdx["replace:with:"]=1;
  30233. $18=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  30234. $ctx1.sendIdx[","]=8;
  30235. $17=$recv($18)._join_(",");
  30236. $16=$recv($17)._replace_with_(",\x5cs*:1:",pragmaStart);
  30237. $15=$recv($16)._replace_with_(",\x5cs*:2:",pragmaEnd);
  30238. $ctx1.sendIdx["replace:with:"]=3;
  30239. $8=["define(",$9,", function(",$15,"){\x22use strict\x22;"];
  30240. $recv(aStream)._write_($8);
  30241. $recv(aStream)._lf();
  30242. self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  30243. return self;
  30244. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  30245. },
  30246. args: ["aPackage", "aStream"],
  30247. 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",
  30248. referencedClasses: ["String"],
  30249. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "write:", "replace:with:", "asJavaScriptSource", "sorted", "asArray", "join:", "key", "exportPackageBodyBlockPrologueOf:on:"]
  30250. }),
  30251. $globals.AmdExporter);
  30252. $core.addMethod(
  30253. $core.method({
  30254. selector: "importsForOutput:",
  30255. protocol: "private",
  30256. fn: function (aPackage){
  30257. var self=this;
  30258. var namedImports,anonImports,importVarNames;
  30259. return $core.withContext(function($ctx1) {
  30260. var $1;
  30261. namedImports=[];
  30262. anonImports=[];
  30263. importVarNames=[];
  30264. $recv($recv(aPackage)._imports())._do_((function(each){
  30265. return $core.withContext(function($ctx2) {
  30266. $1=$recv(each)._isString();
  30267. if($core.assert($1)){
  30268. return $recv(anonImports)._add_(each);
  30269. $ctx2.sendIdx["add:"]=1;
  30270. } else {
  30271. $recv(namedImports)._add_($recv(each)._value());
  30272. $ctx2.sendIdx["add:"]=2;
  30273. return $recv(importVarNames)._add_($recv(each)._key());
  30274. }
  30275. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30276. }));
  30277. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  30278. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  30279. },
  30280. args: ["aPackage"],
  30281. 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)",
  30282. referencedClasses: [],
  30283. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  30284. }),
  30285. $globals.AmdExporter);
  30286. $core.addClass("ChunkParser", $globals.Object, ["stream", "last"], "Platform-ImportExport");
  30287. $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";
  30288. $core.addMethod(
  30289. $core.method({
  30290. selector: "last",
  30291. protocol: "accessing",
  30292. fn: function (){
  30293. var self=this;
  30294. return self["@last"];
  30295. },
  30296. args: [],
  30297. source: "last\x0a\x09^ last",
  30298. referencedClasses: [],
  30299. messageSends: []
  30300. }),
  30301. $globals.ChunkParser);
  30302. $core.addMethod(
  30303. $core.method({
  30304. selector: "nextChunk",
  30305. protocol: "reading",
  30306. fn: function (){
  30307. var self=this;
  30308. var char,result,chunk;
  30309. return $core.withContext(function($ctx1) {
  30310. var $1,$2,$3,$4;
  30311. var $early={};
  30312. try {
  30313. result=""._writeStream();
  30314. $recv((function(){
  30315. return $core.withContext(function($ctx2) {
  30316. char=$recv(self["@stream"])._next();
  30317. $ctx2.sendIdx["next"]=1;
  30318. char;
  30319. return $recv(char)._notNil();
  30320. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30321. }))._whileTrue_((function(){
  30322. return $core.withContext(function($ctx2) {
  30323. $1=$recv(char).__eq("!");
  30324. $ctx2.sendIdx["="]=1;
  30325. if($core.assert($1)){
  30326. $2=$recv($recv(self["@stream"])._peek()).__eq("!");
  30327. if($core.assert($2)){
  30328. $recv(self["@stream"])._next();
  30329. } else {
  30330. self["@last"]=$recv($recv(result)._contents())._trimBoth();
  30331. $3=self["@last"];
  30332. throw $early=[$3];
  30333. }
  30334. }
  30335. return $recv(result)._nextPut_(char);
  30336. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  30337. }));
  30338. self["@last"]=nil;
  30339. $4=self["@last"];
  30340. return $4;
  30341. }
  30342. catch(e) {if(e===$early)return e[0]; throw e}
  30343. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  30344. },
  30345. args: [],
  30346. 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",
  30347. referencedClasses: [],
  30348. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  30349. }),
  30350. $globals.ChunkParser);
  30351. $core.addMethod(
  30352. $core.method({
  30353. selector: "stream:",
  30354. protocol: "accessing",
  30355. fn: function (aStream){
  30356. var self=this;
  30357. self["@stream"]=aStream;
  30358. return self;
  30359. },
  30360. args: ["aStream"],
  30361. source: "stream: aStream\x0a\x09stream := aStream",
  30362. referencedClasses: [],
  30363. messageSends: []
  30364. }),
  30365. $globals.ChunkParser);
  30366. $core.addMethod(
  30367. $core.method({
  30368. selector: "on:",
  30369. protocol: "instance creation",
  30370. fn: function (aStream){
  30371. var self=this;
  30372. return $core.withContext(function($ctx1) {
  30373. return $recv(self._new())._stream_(aStream);
  30374. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.klass)});
  30375. },
  30376. args: ["aStream"],
  30377. source: "on: aStream\x0a\x09^ self new stream: aStream",
  30378. referencedClasses: [],
  30379. messageSends: ["stream:", "new"]
  30380. }),
  30381. $globals.ChunkParser.klass);
  30382. $core.addClass("ClassCommentReader", $globals.Object, ["class"], "Platform-ImportExport");
  30383. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  30384. $core.addMethod(
  30385. $core.method({
  30386. selector: "class:",
  30387. protocol: "accessing",
  30388. fn: function (aClass){
  30389. var self=this;
  30390. self["@class"]=aClass;
  30391. return self;
  30392. },
  30393. args: ["aClass"],
  30394. source: "class: aClass\x0a\x09class := aClass",
  30395. referencedClasses: [],
  30396. messageSends: []
  30397. }),
  30398. $globals.ClassCommentReader);
  30399. $core.addMethod(
  30400. $core.method({
  30401. selector: "initialize",
  30402. protocol: "initialization",
  30403. fn: function (){
  30404. var self=this;
  30405. return $core.withContext(function($ctx1) {
  30406. (
  30407. $ctx1.supercall = true,
  30408. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  30409. $ctx1.supercall = false;
  30410. return self;
  30411. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  30412. },
  30413. args: [],
  30414. source: "initialize\x0a\x09super initialize.",
  30415. referencedClasses: [],
  30416. messageSends: ["initialize"]
  30417. }),
  30418. $globals.ClassCommentReader);
  30419. $core.addMethod(
  30420. $core.method({
  30421. selector: "scanFrom:",
  30422. protocol: "fileIn",
  30423. fn: function (aChunkParser){
  30424. var self=this;
  30425. var chunk;
  30426. return $core.withContext(function($ctx1) {
  30427. chunk=$recv(aChunkParser)._nextChunk();
  30428. $recv(chunk)._ifNotEmpty_((function(){
  30429. return $core.withContext(function($ctx2) {
  30430. return self._setComment_(chunk);
  30431. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30432. }));
  30433. return self;
  30434. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  30435. },
  30436. args: ["aChunkParser"],
  30437. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  30438. referencedClasses: [],
  30439. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  30440. }),
  30441. $globals.ClassCommentReader);
  30442. $core.addMethod(
  30443. $core.method({
  30444. selector: "setComment:",
  30445. protocol: "private",
  30446. fn: function (aString){
  30447. var self=this;
  30448. return $core.withContext(function($ctx1) {
  30449. $recv(self["@class"])._comment_(aString);
  30450. return self;
  30451. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  30452. },
  30453. args: ["aString"],
  30454. source: "setComment: aString\x0a\x09class comment: aString",
  30455. referencedClasses: [],
  30456. messageSends: ["comment:"]
  30457. }),
  30458. $globals.ClassCommentReader);
  30459. $core.addClass("ClassProtocolReader", $globals.Object, ["class", "category"], "Platform-ImportExport");
  30460. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  30461. $core.addMethod(
  30462. $core.method({
  30463. selector: "class:category:",
  30464. protocol: "accessing",
  30465. fn: function (aClass,aString){
  30466. var self=this;
  30467. self["@class"]=aClass;
  30468. self["@category"]=aString;
  30469. return self;
  30470. },
  30471. args: ["aClass", "aString"],
  30472. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  30473. referencedClasses: [],
  30474. messageSends: []
  30475. }),
  30476. $globals.ClassProtocolReader);
  30477. $core.addMethod(
  30478. $core.method({
  30479. selector: "compileMethod:",
  30480. protocol: "private",
  30481. fn: function (aString){
  30482. var self=this;
  30483. return $core.withContext(function($ctx1) {
  30484. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
  30485. return self;
  30486. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  30487. },
  30488. args: ["aString"],
  30489. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  30490. referencedClasses: ["Compiler"],
  30491. messageSends: ["install:forClass:protocol:", "new"]
  30492. }),
  30493. $globals.ClassProtocolReader);
  30494. $core.addMethod(
  30495. $core.method({
  30496. selector: "initialize",
  30497. protocol: "initialization",
  30498. fn: function (){
  30499. var self=this;
  30500. return $core.withContext(function($ctx1) {
  30501. (
  30502. $ctx1.supercall = true,
  30503. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  30504. $ctx1.supercall = false;
  30505. return self;
  30506. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  30507. },
  30508. args: [],
  30509. source: "initialize\x0a\x09super initialize.",
  30510. referencedClasses: [],
  30511. messageSends: ["initialize"]
  30512. }),
  30513. $globals.ClassProtocolReader);
  30514. $core.addMethod(
  30515. $core.method({
  30516. selector: "scanFrom:",
  30517. protocol: "fileIn",
  30518. fn: function (aChunkParser){
  30519. var self=this;
  30520. var chunk;
  30521. return $core.withContext(function($ctx1) {
  30522. $recv((function(){
  30523. return $core.withContext(function($ctx2) {
  30524. chunk=$recv(aChunkParser)._nextChunk();
  30525. chunk;
  30526. return $recv(chunk)._isEmpty();
  30527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30528. }))._whileFalse_((function(){
  30529. return $core.withContext(function($ctx2) {
  30530. return self._compileMethod_(chunk);
  30531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  30532. }));
  30533. return self;
  30534. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  30535. },
  30536. args: ["aChunkParser"],
  30537. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  30538. referencedClasses: [],
  30539. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  30540. }),
  30541. $globals.ClassProtocolReader);
  30542. $core.addClass("ExportMethodProtocol", $globals.Object, ["name", "theClass"], "Platform-ImportExport");
  30543. $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.";
  30544. $core.addMethod(
  30545. $core.method({
  30546. selector: "methods",
  30547. protocol: "accessing",
  30548. fn: function (){
  30549. var self=this;
  30550. return $core.withContext(function($ctx1) {
  30551. var $1;
  30552. return $recv($recv(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  30553. return $core.withContext(function($ctx2) {
  30554. $1=$recv(a)._selector();
  30555. $ctx2.sendIdx["selector"]=1;
  30556. return $recv($1).__lt_eq($recv(b)._selector());
  30557. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30558. }));
  30559. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  30560. },
  30561. args: [],
  30562. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  30563. referencedClasses: [],
  30564. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  30565. }),
  30566. $globals.ExportMethodProtocol);
  30567. $core.addMethod(
  30568. $core.method({
  30569. selector: "name",
  30570. protocol: "accessing",
  30571. fn: function (){
  30572. var self=this;
  30573. return self["@name"];
  30574. },
  30575. args: [],
  30576. source: "name\x0a\x09^ name",
  30577. referencedClasses: [],
  30578. messageSends: []
  30579. }),
  30580. $globals.ExportMethodProtocol);
  30581. $core.addMethod(
  30582. $core.method({
  30583. selector: "name:",
  30584. protocol: "accessing",
  30585. fn: function (aString){
  30586. var self=this;
  30587. self["@name"]=aString;
  30588. return self;
  30589. },
  30590. args: ["aString"],
  30591. source: "name: aString\x0a\x09name := aString",
  30592. referencedClasses: [],
  30593. messageSends: []
  30594. }),
  30595. $globals.ExportMethodProtocol);
  30596. $core.addMethod(
  30597. $core.method({
  30598. selector: "ownMethods",
  30599. protocol: "accessing",
  30600. fn: function (){
  30601. var self=this;
  30602. return $core.withContext(function($ctx1) {
  30603. var $1;
  30604. return $recv($recv(self._theClass())._ownMethodsInProtocol_(self._name()))._sorted_((function(a,b){
  30605. return $core.withContext(function($ctx2) {
  30606. $1=$recv(a)._selector();
  30607. $ctx2.sendIdx["selector"]=1;
  30608. return $recv($1).__lt_eq($recv(b)._selector());
  30609. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30610. }));
  30611. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.ExportMethodProtocol)});
  30612. },
  30613. args: [],
  30614. source: "ownMethods\x0a\x09^ (self theClass ownMethodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  30615. referencedClasses: [],
  30616. messageSends: ["sorted:", "ownMethodsInProtocol:", "theClass", "name", "<=", "selector"]
  30617. }),
  30618. $globals.ExportMethodProtocol);
  30619. $core.addMethod(
  30620. $core.method({
  30621. selector: "theClass",
  30622. protocol: "accessing",
  30623. fn: function (){
  30624. var self=this;
  30625. return self["@theClass"];
  30626. },
  30627. args: [],
  30628. source: "theClass\x0a\x09^ theClass",
  30629. referencedClasses: [],
  30630. messageSends: []
  30631. }),
  30632. $globals.ExportMethodProtocol);
  30633. $core.addMethod(
  30634. $core.method({
  30635. selector: "theClass:",
  30636. protocol: "accessing",
  30637. fn: function (aClass){
  30638. var self=this;
  30639. self["@theClass"]=aClass;
  30640. return self;
  30641. },
  30642. args: ["aClass"],
  30643. source: "theClass: aClass\x0a\x09theClass := aClass",
  30644. referencedClasses: [],
  30645. messageSends: []
  30646. }),
  30647. $globals.ExportMethodProtocol);
  30648. $core.addMethod(
  30649. $core.method({
  30650. selector: "name:theClass:",
  30651. protocol: "instance creation",
  30652. fn: function (aString,aClass){
  30653. var self=this;
  30654. return $core.withContext(function($ctx1) {
  30655. var $1;
  30656. $1=self._new();
  30657. $recv($1)._name_(aString);
  30658. $recv($1)._theClass_(aClass);
  30659. return $recv($1)._yourself();
  30660. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.klass)});
  30661. },
  30662. args: ["aString", "aClass"],
  30663. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  30664. referencedClasses: [],
  30665. messageSends: ["name:", "new", "theClass:", "yourself"]
  30666. }),
  30667. $globals.ExportMethodProtocol.klass);
  30668. $core.addClass("Importer", $globals.Object, ["lastSection", "lastChunk"], "Platform-ImportExport");
  30669. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  30670. $core.addMethod(
  30671. $core.method({
  30672. selector: "import:",
  30673. protocol: "fileIn",
  30674. fn: function (aStream){
  30675. var self=this;
  30676. var chunk,result,parser,lastEmpty;
  30677. return $core.withContext(function($ctx1) {
  30678. var $1;
  30679. parser=$recv($globals.ChunkParser)._on_(aStream);
  30680. lastEmpty=false;
  30681. self["@lastSection"]="n/a, not started";
  30682. self["@lastChunk"]=nil;
  30683. $recv((function(){
  30684. return $core.withContext(function($ctx2) {
  30685. $recv((function(){
  30686. return $core.withContext(function($ctx3) {
  30687. chunk=$recv(parser)._nextChunk();
  30688. chunk;
  30689. return $recv(chunk)._isNil();
  30690. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  30691. }))._whileFalse_((function(){
  30692. return $core.withContext(function($ctx3) {
  30693. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  30694. lastEmpty=true;
  30695. return lastEmpty;
  30696. }),(function(){
  30697. return $core.withContext(function($ctx4) {
  30698. self["@lastSection"]=chunk;
  30699. self["@lastSection"];
  30700. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  30701. result;
  30702. $1=lastEmpty;
  30703. if($core.assert($1)){
  30704. lastEmpty=false;
  30705. lastEmpty;
  30706. return $recv(result)._scanFrom_(parser);
  30707. }
  30708. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  30709. }));
  30710. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  30711. }));
  30712. self["@lastSection"]="n/a, finished";
  30713. return self["@lastSection"];
  30714. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30715. }))._on_do_($globals.Error,(function(e){
  30716. return $core.withContext(function($ctx2) {
  30717. self["@lastChunk"]=$recv(parser)._last();
  30718. self["@lastChunk"];
  30719. return $recv(e)._resignal();
  30720. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  30721. }));
  30722. return self;
  30723. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  30724. },
  30725. args: ["aStream"],
  30726. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk\x0a\x09\x09\x09ifEmpty: [ lastEmpty := true ]\x0a\x09\x09\x09ifNotEmpty: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e resignal ].",
  30727. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  30728. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  30729. }),
  30730. $globals.Importer);
  30731. $core.addMethod(
  30732. $core.method({
  30733. selector: "lastChunk",
  30734. protocol: "accessing",
  30735. fn: function (){
  30736. var self=this;
  30737. return self["@lastChunk"];
  30738. },
  30739. args: [],
  30740. source: "lastChunk\x0a\x09^ lastChunk",
  30741. referencedClasses: [],
  30742. messageSends: []
  30743. }),
  30744. $globals.Importer);
  30745. $core.addMethod(
  30746. $core.method({
  30747. selector: "lastSection",
  30748. protocol: "accessing",
  30749. fn: function (){
  30750. var self=this;
  30751. return self["@lastSection"];
  30752. },
  30753. args: [],
  30754. source: "lastSection\x0a\x09^ lastSection",
  30755. referencedClasses: [],
  30756. messageSends: []
  30757. }),
  30758. $globals.Importer);
  30759. $core.addClass("PackageCommitError", $globals.Error, [], "Platform-ImportExport");
  30760. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  30761. $core.addClass("PackageHandler", $globals.Object, [], "Platform-ImportExport");
  30762. $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.";
  30763. $core.addMethod(
  30764. $core.method({
  30765. selector: "ajaxPutAt:data:onSuccess:onError:",
  30766. protocol: "private",
  30767. fn: function (aURL,aString,aBlock,anotherBlock){
  30768. var self=this;
  30769. var xhr;
  30770. return $core.withContext(function($ctx1) {
  30771. var $1,$4,$3,$2;
  30772. xhr=$recv($globals.Platform)._newXhr();
  30773. $recv(xhr)._open_url_async_("PUT",aURL,true);
  30774. $recv(xhr)._onreadystatechange_((function(){
  30775. return $core.withContext(function($ctx2) {
  30776. $1=$recv($recv(xhr)._readyState()).__eq((4));
  30777. if($core.assert($1)){
  30778. $4=$recv(xhr)._status();
  30779. $ctx2.sendIdx["status"]=1;
  30780. $3=$recv($4).__gt_eq((200));
  30781. $2=$recv($3)._and_((function(){
  30782. return $core.withContext(function($ctx3) {
  30783. return $recv($recv(xhr)._status()).__lt((300));
  30784. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  30785. }));
  30786. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  30787. }
  30788. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30789. }));
  30790. $recv(xhr)._send_(aString);
  30791. return self;
  30792. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  30793. },
  30794. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  30795. 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",
  30796. referencedClasses: ["Platform"],
  30797. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  30798. }),
  30799. $globals.PackageHandler);
  30800. $core.addMethod(
  30801. $core.method({
  30802. selector: "chunkContentsFor:",
  30803. protocol: "accessing",
  30804. fn: function (aPackage){
  30805. var self=this;
  30806. return $core.withContext(function($ctx1) {
  30807. return $recv($globals.String)._streamContents_((function(str){
  30808. return $core.withContext(function($ctx2) {
  30809. return $recv(self._chunkExporter())._exportPackage_on_(aPackage,str);
  30810. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  30811. }));
  30812. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  30813. },
  30814. args: ["aPackage"],
  30815. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  30816. referencedClasses: ["String"],
  30817. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  30818. }),
  30819. $globals.PackageHandler);
  30820. $core.addMethod(
  30821. $core.method({
  30822. selector: "chunkExporter",
  30823. protocol: "factory",
  30824. fn: function (){
  30825. var self=this;
  30826. return $core.withContext(function($ctx1) {
  30827. return $recv(self._chunkExporterClass())._new();
  30828. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  30829. },
  30830. args: [],
  30831. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  30832. referencedClasses: [],
  30833. messageSends: ["new", "chunkExporterClass"]
  30834. }),
  30835. $globals.PackageHandler);
  30836. $core.addMethod(
  30837. $core.method({
  30838. selector: "chunkExporterClass",
  30839. protocol: "accessing",
  30840. fn: function (){
  30841. var self=this;
  30842. return $globals.ChunkExporter;
  30843. },
  30844. args: [],
  30845. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  30846. referencedClasses: ["ChunkExporter"],
  30847. messageSends: []
  30848. }),
  30849. $globals.PackageHandler);
  30850. $core.addMethod(
  30851. $core.method({
  30852. selector: "commit:",
  30853. protocol: "committing",
  30854. fn: function (aPackage){
  30855. var self=this;
  30856. return $core.withContext(function($ctx1) {
  30857. var $1,$2;
  30858. self._commit_onSuccess_onError_(aPackage,(function(){
  30859. }),(function(error){
  30860. return $core.withContext(function($ctx2) {
  30861. $1=$recv($globals.PackageCommitError)._new();
  30862. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  30863. $ctx2.sendIdx[","]=1;
  30864. $recv($1)._messageText_($2);
  30865. return $recv($1)._signal();
  30866. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  30867. }));
  30868. return self;
  30869. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  30870. },
  30871. args: ["aPackage"],
  30872. 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 ]",
  30873. referencedClasses: ["PackageCommitError"],
  30874. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  30875. }),
  30876. $globals.PackageHandler);
  30877. $core.addMethod(
  30878. $core.method({
  30879. selector: "commit:onSuccess:onError:",
  30880. protocol: "committing",
  30881. fn: function (aPackage,aBlock,anotherBlock){
  30882. var self=this;
  30883. return $core.withContext(function($ctx1) {
  30884. self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  30885. return $core.withContext(function($ctx2) {
  30886. return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  30887. return $core.withContext(function($ctx3) {
  30888. $recv(aPackage)._beClean();
  30889. return $recv(aBlock)._value();
  30890. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  30891. }),anotherBlock);
  30892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30893. }),anotherBlock);
  30894. return self;
  30895. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  30896. },
  30897. args: ["aPackage", "aBlock", "anotherBlock"],
  30898. 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",
  30899. referencedClasses: [],
  30900. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  30901. }),
  30902. $globals.PackageHandler);
  30903. $core.addMethod(
  30904. $core.method({
  30905. selector: "commitJsFileFor:onSuccess:onError:",
  30906. protocol: "committing",
  30907. fn: function (aPackage,aBlock,anotherBlock){
  30908. var self=this;
  30909. return $core.withContext(function($ctx1) {
  30910. var $2,$1;
  30911. $2=$recv($recv(self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  30912. $ctx1.sendIdx[","]=2;
  30913. $1=$recv($2).__comma(".js");
  30914. $ctx1.sendIdx[","]=1;
  30915. self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
  30916. return self;
  30917. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  30918. },
  30919. args: ["aPackage", "aBlock", "anotherBlock"],
  30920. 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",
  30921. referencedClasses: [],
  30922. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  30923. }),
  30924. $globals.PackageHandler);
  30925. $core.addMethod(
  30926. $core.method({
  30927. selector: "commitPathJsFor:",
  30928. protocol: "accessing",
  30929. fn: function (aPackage){
  30930. var self=this;
  30931. return $core.withContext(function($ctx1) {
  30932. self._subclassResponsibility();
  30933. return self;
  30934. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  30935. },
  30936. args: ["aPackage"],
  30937. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  30938. referencedClasses: [],
  30939. messageSends: ["subclassResponsibility"]
  30940. }),
  30941. $globals.PackageHandler);
  30942. $core.addMethod(
  30943. $core.method({
  30944. selector: "commitPathStFor:",
  30945. protocol: "accessing",
  30946. fn: function (aPackage){
  30947. var self=this;
  30948. return $core.withContext(function($ctx1) {
  30949. self._subclassResponsibility();
  30950. return self;
  30951. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  30952. },
  30953. args: ["aPackage"],
  30954. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  30955. referencedClasses: [],
  30956. messageSends: ["subclassResponsibility"]
  30957. }),
  30958. $globals.PackageHandler);
  30959. $core.addMethod(
  30960. $core.method({
  30961. selector: "commitStFileFor:onSuccess:onError:",
  30962. protocol: "committing",
  30963. fn: function (aPackage,aBlock,anotherBlock){
  30964. var self=this;
  30965. return $core.withContext(function($ctx1) {
  30966. var $2,$1;
  30967. $2=$recv($recv(self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  30968. $ctx1.sendIdx[","]=2;
  30969. $1=$recv($2).__comma(".st");
  30970. $ctx1.sendIdx[","]=1;
  30971. self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  30972. return self;
  30973. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  30974. },
  30975. args: ["aPackage", "aBlock", "anotherBlock"],
  30976. 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",
  30977. referencedClasses: [],
  30978. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  30979. }),
  30980. $globals.PackageHandler);
  30981. $core.addMethod(
  30982. $core.method({
  30983. selector: "contentsFor:",
  30984. protocol: "accessing",
  30985. fn: function (aPackage){
  30986. var self=this;
  30987. return $core.withContext(function($ctx1) {
  30988. return $recv($globals.String)._streamContents_((function(str){
  30989. return $core.withContext(function($ctx2) {
  30990. return $recv(self._exporter())._exportPackage_on_(aPackage,str);
  30991. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  30992. }));
  30993. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  30994. },
  30995. args: ["aPackage"],
  30996. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  30997. referencedClasses: ["String"],
  30998. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  30999. }),
  31000. $globals.PackageHandler);
  31001. $core.addMethod(
  31002. $core.method({
  31003. selector: "exporter",
  31004. protocol: "factory",
  31005. fn: function (){
  31006. var self=this;
  31007. return $core.withContext(function($ctx1) {
  31008. return $recv(self._exporterClass())._new();
  31009. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  31010. },
  31011. args: [],
  31012. source: "exporter\x0a\x09^ self exporterClass new",
  31013. referencedClasses: [],
  31014. messageSends: ["new", "exporterClass"]
  31015. }),
  31016. $globals.PackageHandler);
  31017. $core.addMethod(
  31018. $core.method({
  31019. selector: "exporterClass",
  31020. protocol: "accessing",
  31021. fn: function (){
  31022. var self=this;
  31023. return $core.withContext(function($ctx1) {
  31024. self._subclassResponsibility();
  31025. return self;
  31026. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  31027. },
  31028. args: [],
  31029. source: "exporterClass\x0a\x09self subclassResponsibility",
  31030. referencedClasses: [],
  31031. messageSends: ["subclassResponsibility"]
  31032. }),
  31033. $globals.PackageHandler);
  31034. $core.addMethod(
  31035. $core.method({
  31036. selector: "load:",
  31037. protocol: "loading",
  31038. fn: function (aPackage){
  31039. var self=this;
  31040. return $core.withContext(function($ctx1) {
  31041. self._subclassResponsibility();
  31042. return self;
  31043. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  31044. },
  31045. args: ["aPackage"],
  31046. source: "load: aPackage\x0a\x09self subclassResponsibility",
  31047. referencedClasses: [],
  31048. messageSends: ["subclassResponsibility"]
  31049. }),
  31050. $globals.PackageHandler);
  31051. $core.addMethod(
  31052. $core.method({
  31053. selector: "onCommitError:",
  31054. protocol: "error handling",
  31055. fn: function (anError){
  31056. var self=this;
  31057. return $core.withContext(function($ctx1) {
  31058. var $1,$2;
  31059. $1=$recv($globals.PackageCommitError)._new();
  31060. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  31061. $ctx1.sendIdx[","]=1;
  31062. $recv($1)._messageText_($2);
  31063. $recv($1)._signal();
  31064. return self;
  31065. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  31066. },
  31067. args: ["anError"],
  31068. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  31069. referencedClasses: ["PackageCommitError"],
  31070. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  31071. }),
  31072. $globals.PackageHandler);
  31073. $core.addClass("AmdPackageHandler", $globals.PackageHandler, [], "Platform-ImportExport");
  31074. $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.";
  31075. $core.addMethod(
  31076. $core.method({
  31077. selector: "commitPathJsFor:",
  31078. protocol: "accessing",
  31079. fn: function (aPackage){
  31080. var self=this;
  31081. return $core.withContext(function($ctx1) {
  31082. return self._toUrl_(self._namespaceFor_(aPackage));
  31083. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  31084. },
  31085. args: ["aPackage"],
  31086. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  31087. referencedClasses: [],
  31088. messageSends: ["toUrl:", "namespaceFor:"]
  31089. }),
  31090. $globals.AmdPackageHandler);
  31091. $core.addMethod(
  31092. $core.method({
  31093. selector: "commitPathStFor:",
  31094. protocol: "accessing",
  31095. fn: function (aPackage){
  31096. var self=this;
  31097. var path,pathWithout;
  31098. return $core.withContext(function($ctx1) {
  31099. var $1,$2;
  31100. $1=$recv(self._namespaceFor_(aPackage)).__comma("/_source");
  31101. $ctx1.sendIdx[","]=1;
  31102. path=self._toUrl_($1);
  31103. pathWithout=self._commitPathJsFor_(aPackage);
  31104. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  31105. if($core.assert($2)){
  31106. return pathWithout;
  31107. } else {
  31108. return path;
  31109. }
  31110. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  31111. },
  31112. args: ["aPackage"],
  31113. 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 ]",
  31114. referencedClasses: [],
  31115. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  31116. }),
  31117. $globals.AmdPackageHandler);
  31118. $core.addMethod(
  31119. $core.method({
  31120. selector: "exporterClass",
  31121. protocol: "accessing",
  31122. fn: function (){
  31123. var self=this;
  31124. return $globals.AmdExporter;
  31125. },
  31126. args: [],
  31127. source: "exporterClass\x0a\x09^ AmdExporter",
  31128. referencedClasses: ["AmdExporter"],
  31129. messageSends: []
  31130. }),
  31131. $globals.AmdPackageHandler);
  31132. $core.addMethod(
  31133. $core.method({
  31134. selector: "load:",
  31135. protocol: "loading",
  31136. fn: function (aPackage){
  31137. var self=this;
  31138. return $core.withContext(function($ctx1) {
  31139. var $1,$3,$2,$receiver;
  31140. $1=$recv($globals.Smalltalk)._amdRequire();
  31141. if(($receiver = $1) == null || $receiver.isNil){
  31142. self._error_("AMD loader not present");
  31143. } else {
  31144. var require;
  31145. require=$receiver;
  31146. $3=$recv($recv(self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  31147. $ctx1.sendIdx[","]=1;
  31148. $2=$recv($globals.Array)._with_($3);
  31149. $recv(require)._value_($2);
  31150. }
  31151. return self;
  31152. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  31153. },
  31154. args: ["aPackage"],
  31155. source: "load: aPackage\x0a\x09Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09require value: (Array with: (self namespaceFor: aPackage), '/', aPackage name ) ]",
  31156. referencedClasses: ["Smalltalk", "Array"],
  31157. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  31158. }),
  31159. $globals.AmdPackageHandler);
  31160. $core.addMethod(
  31161. $core.method({
  31162. selector: "namespaceFor:",
  31163. protocol: "committing",
  31164. fn: function (aPackage){
  31165. var self=this;
  31166. return $core.withContext(function($ctx1) {
  31167. return $recv($recv(aPackage)._transport())._namespace();
  31168. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  31169. },
  31170. args: ["aPackage"],
  31171. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  31172. referencedClasses: [],
  31173. messageSends: ["namespace", "transport"]
  31174. }),
  31175. $globals.AmdPackageHandler);
  31176. $core.addMethod(
  31177. $core.method({
  31178. selector: "toUrl:",
  31179. protocol: "private",
  31180. fn: function (aString){
  31181. var self=this;
  31182. return $core.withContext(function($ctx1) {
  31183. var $1,$receiver;
  31184. $1=$recv($globals.Smalltalk)._amdRequire();
  31185. if(($receiver = $1) == null || $receiver.isNil){
  31186. return self._error_("AMD loader not present");
  31187. } else {
  31188. var require;
  31189. require=$receiver;
  31190. return $recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  31191. }
  31192. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  31193. },
  31194. args: ["aString"],
  31195. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]",
  31196. referencedClasses: ["Smalltalk"],
  31197. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  31198. }),
  31199. $globals.AmdPackageHandler);
  31200. $core.addMethod(
  31201. $core.method({
  31202. selector: "defaultNamespace",
  31203. protocol: "commit paths",
  31204. fn: function (){
  31205. var self=this;
  31206. return $core.withContext(function($ctx1) {
  31207. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  31208. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.klass)});
  31209. },
  31210. args: [],
  31211. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  31212. referencedClasses: ["Smalltalk"],
  31213. messageSends: ["defaultAmdNamespace"]
  31214. }),
  31215. $globals.AmdPackageHandler.klass);
  31216. $core.addMethod(
  31217. $core.method({
  31218. selector: "defaultNamespace:",
  31219. protocol: "commit paths",
  31220. fn: function (aString){
  31221. var self=this;
  31222. return $core.withContext(function($ctx1) {
  31223. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  31224. return self;
  31225. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.klass)});
  31226. },
  31227. args: ["aString"],
  31228. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  31229. referencedClasses: ["Smalltalk"],
  31230. messageSends: ["defaultAmdNamespace:"]
  31231. }),
  31232. $globals.AmdPackageHandler.klass);
  31233. $core.addClass("PackageTransport", $globals.Object, ["package"], "Platform-ImportExport");
  31234. $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.";
  31235. $core.addMethod(
  31236. $core.method({
  31237. selector: "asJavaScriptObject",
  31238. protocol: "converting",
  31239. fn: function (){
  31240. var self=this;
  31241. return $core.withContext(function($ctx1) {
  31242. return $globals.HashedCollection._newFromPairs_(["type",self._type()]);
  31243. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.PackageTransport)});
  31244. },
  31245. args: [],
  31246. source: "asJavaScriptObject\x0a\x09^ #{ 'type' -> self type }",
  31247. referencedClasses: [],
  31248. messageSends: ["type"]
  31249. }),
  31250. $globals.PackageTransport);
  31251. $core.addMethod(
  31252. $core.method({
  31253. selector: "commit",
  31254. protocol: "committing",
  31255. fn: function (){
  31256. var self=this;
  31257. return $core.withContext(function($ctx1) {
  31258. $recv(self._commitHandler())._commit_(self._package());
  31259. return self;
  31260. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  31261. },
  31262. args: [],
  31263. source: "commit\x0a\x09self commitHandler commit: self package",
  31264. referencedClasses: [],
  31265. messageSends: ["commit:", "commitHandler", "package"]
  31266. }),
  31267. $globals.PackageTransport);
  31268. $core.addMethod(
  31269. $core.method({
  31270. selector: "commitHandler",
  31271. protocol: "factory",
  31272. fn: function (){
  31273. var self=this;
  31274. return $core.withContext(function($ctx1) {
  31275. return $recv(self._commitHandlerClass())._new();
  31276. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  31277. },
  31278. args: [],
  31279. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  31280. referencedClasses: [],
  31281. messageSends: ["new", "commitHandlerClass"]
  31282. }),
  31283. $globals.PackageTransport);
  31284. $core.addMethod(
  31285. $core.method({
  31286. selector: "commitHandlerClass",
  31287. protocol: "accessing",
  31288. fn: function (){
  31289. var self=this;
  31290. return $core.withContext(function($ctx1) {
  31291. self._subclassResponsibility();
  31292. return self;
  31293. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  31294. },
  31295. args: [],
  31296. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  31297. referencedClasses: [],
  31298. messageSends: ["subclassResponsibility"]
  31299. }),
  31300. $globals.PackageTransport);
  31301. $core.addMethod(
  31302. $core.method({
  31303. selector: "commitOnSuccess:onError:",
  31304. protocol: "committing",
  31305. fn: function (aBlock,anotherBlock){
  31306. var self=this;
  31307. return $core.withContext(function($ctx1) {
  31308. $recv(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
  31309. return self;
  31310. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  31311. },
  31312. args: ["aBlock", "anotherBlock"],
  31313. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  31314. referencedClasses: [],
  31315. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  31316. }),
  31317. $globals.PackageTransport);
  31318. $core.addMethod(
  31319. $core.method({
  31320. selector: "definition",
  31321. protocol: "accessing",
  31322. fn: function (){
  31323. var self=this;
  31324. return "";
  31325. },
  31326. args: [],
  31327. source: "definition\x0a\x09^ ''",
  31328. referencedClasses: [],
  31329. messageSends: []
  31330. }),
  31331. $globals.PackageTransport);
  31332. $core.addMethod(
  31333. $core.method({
  31334. selector: "load",
  31335. protocol: "loading",
  31336. fn: function (){
  31337. var self=this;
  31338. return $core.withContext(function($ctx1) {
  31339. $recv(self._commitHandler())._load_(self._package());
  31340. return self;
  31341. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  31342. },
  31343. args: [],
  31344. source: "load\x0a\x09self commitHandler load: self package",
  31345. referencedClasses: [],
  31346. messageSends: ["load:", "commitHandler", "package"]
  31347. }),
  31348. $globals.PackageTransport);
  31349. $core.addMethod(
  31350. $core.method({
  31351. selector: "package",
  31352. protocol: "accessing",
  31353. fn: function (){
  31354. var self=this;
  31355. return self["@package"];
  31356. },
  31357. args: [],
  31358. source: "package\x0a\x09^ package",
  31359. referencedClasses: [],
  31360. messageSends: []
  31361. }),
  31362. $globals.PackageTransport);
  31363. $core.addMethod(
  31364. $core.method({
  31365. selector: "package:",
  31366. protocol: "accessing",
  31367. fn: function (aPackage){
  31368. var self=this;
  31369. self["@package"]=aPackage;
  31370. return self;
  31371. },
  31372. args: ["aPackage"],
  31373. source: "package: aPackage\x0a\x09package := aPackage",
  31374. referencedClasses: [],
  31375. messageSends: []
  31376. }),
  31377. $globals.PackageTransport);
  31378. $core.addMethod(
  31379. $core.method({
  31380. selector: "setupFromJson:",
  31381. protocol: "initialization",
  31382. fn: function (anObject){
  31383. var self=this;
  31384. return self;
  31385. },
  31386. args: ["anObject"],
  31387. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  31388. referencedClasses: [],
  31389. messageSends: []
  31390. }),
  31391. $globals.PackageTransport);
  31392. $core.addMethod(
  31393. $core.method({
  31394. selector: "type",
  31395. protocol: "accessing",
  31396. fn: function (){
  31397. var self=this;
  31398. return $core.withContext(function($ctx1) {
  31399. return $recv(self._class())._type();
  31400. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  31401. },
  31402. args: [],
  31403. source: "type\x0a\x09^ self class type",
  31404. referencedClasses: [],
  31405. messageSends: ["type", "class"]
  31406. }),
  31407. $globals.PackageTransport);
  31408. $globals.PackageTransport.klass.iVarNames = ["registry"];
  31409. $core.addMethod(
  31410. $core.method({
  31411. selector: "classRegisteredFor:",
  31412. protocol: "accessing",
  31413. fn: function (aString){
  31414. var self=this;
  31415. return $core.withContext(function($ctx1) {
  31416. return $recv(self["@registry"])._at_(aString);
  31417. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.klass)});
  31418. },
  31419. args: ["aString"],
  31420. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  31421. referencedClasses: [],
  31422. messageSends: ["at:"]
  31423. }),
  31424. $globals.PackageTransport.klass);
  31425. $core.addMethod(
  31426. $core.method({
  31427. selector: "defaultType",
  31428. protocol: "accessing",
  31429. fn: function (){
  31430. var self=this;
  31431. return $core.withContext(function($ctx1) {
  31432. return $recv($globals.AmdPackageTransport)._type();
  31433. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.klass)});
  31434. },
  31435. args: [],
  31436. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  31437. referencedClasses: ["AmdPackageTransport"],
  31438. messageSends: ["type"]
  31439. }),
  31440. $globals.PackageTransport.klass);
  31441. $core.addMethod(
  31442. $core.method({
  31443. selector: "for:",
  31444. protocol: "instance creation",
  31445. fn: function (aString){
  31446. var self=this;
  31447. return $core.withContext(function($ctx1) {
  31448. return $recv(self._classRegisteredFor_(aString))._new();
  31449. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.klass)});
  31450. },
  31451. args: ["aString"],
  31452. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  31453. referencedClasses: [],
  31454. messageSends: ["new", "classRegisteredFor:"]
  31455. }),
  31456. $globals.PackageTransport.klass);
  31457. $core.addMethod(
  31458. $core.method({
  31459. selector: "fromJson:",
  31460. protocol: "instance creation",
  31461. fn: function (anObject){
  31462. var self=this;
  31463. return $core.withContext(function($ctx1) {
  31464. var $1,$2,$receiver;
  31465. if(($receiver = anObject) == null || $receiver.isNil){
  31466. $1=self._for_(self._defaultType());
  31467. $ctx1.sendIdx["for:"]=1;
  31468. return $1;
  31469. } else {
  31470. anObject;
  31471. }
  31472. $2=self._for_($recv(anObject)._type());
  31473. $recv($2)._setupFromJson_(anObject);
  31474. return $recv($2)._yourself();
  31475. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.klass)});
  31476. },
  31477. args: ["anObject"],
  31478. 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",
  31479. referencedClasses: [],
  31480. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  31481. }),
  31482. $globals.PackageTransport.klass);
  31483. $core.addMethod(
  31484. $core.method({
  31485. selector: "initialize",
  31486. protocol: "initialization",
  31487. fn: function (){
  31488. var self=this;
  31489. return $core.withContext(function($ctx1) {
  31490. var $1;
  31491. (
  31492. $ctx1.supercall = true,
  31493. ($globals.PackageTransport.klass.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  31494. $ctx1.supercall = false;
  31495. $1=self.__eq_eq($globals.PackageTransport);
  31496. if($core.assert($1)){
  31497. self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  31498. self["@registry"];
  31499. } else {
  31500. self._register();
  31501. }
  31502. return self;
  31503. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.klass)});
  31504. },
  31505. args: [],
  31506. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  31507. referencedClasses: ["PackageTransport"],
  31508. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  31509. }),
  31510. $globals.PackageTransport.klass);
  31511. $core.addMethod(
  31512. $core.method({
  31513. selector: "register",
  31514. protocol: "registration",
  31515. fn: function (){
  31516. var self=this;
  31517. return $core.withContext(function($ctx1) {
  31518. $recv($globals.PackageTransport)._register_(self);
  31519. return self;
  31520. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.klass)});
  31521. },
  31522. args: [],
  31523. source: "register\x0a\x09PackageTransport register: self",
  31524. referencedClasses: ["PackageTransport"],
  31525. messageSends: ["register:"]
  31526. }),
  31527. $globals.PackageTransport.klass);
  31528. $core.addMethod(
  31529. $core.method({
  31530. selector: "register:",
  31531. protocol: "registration",
  31532. fn: function (aClass){
  31533. var self=this;
  31534. return $core.withContext(function($ctx1) {
  31535. var $1,$receiver;
  31536. $1=$recv(aClass)._type();
  31537. $ctx1.sendIdx["type"]=1;
  31538. if(($receiver = $1) == null || $receiver.isNil){
  31539. $1;
  31540. } else {
  31541. $recv(self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  31542. }
  31543. return self;
  31544. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.klass)});
  31545. },
  31546. args: ["aClass"],
  31547. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  31548. referencedClasses: [],
  31549. messageSends: ["ifNotNil:", "type", "at:put:"]
  31550. }),
  31551. $globals.PackageTransport.klass);
  31552. $core.addMethod(
  31553. $core.method({
  31554. selector: "type",
  31555. protocol: "accessing",
  31556. fn: function (){
  31557. var self=this;
  31558. return nil;
  31559. },
  31560. args: [],
  31561. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  31562. referencedClasses: [],
  31563. messageSends: []
  31564. }),
  31565. $globals.PackageTransport.klass);
  31566. $core.addClass("AmdPackageTransport", $globals.PackageTransport, ["namespace"], "Platform-ImportExport");
  31567. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  31568. $core.addMethod(
  31569. $core.method({
  31570. selector: "asJavaScriptObject",
  31571. protocol: "converting",
  31572. fn: function (){
  31573. var self=this;
  31574. return $core.withContext(function($ctx1) {
  31575. var $1;
  31576. $1=(
  31577. $ctx1.supercall = true,
  31578. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJavaScriptObject.apply($recv(self), []));
  31579. $ctx1.supercall = false;
  31580. $recv($1)._at_put_("amdNamespace",self._namespace());
  31581. return $recv($1)._yourself();
  31582. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.AmdPackageTransport)});
  31583. },
  31584. args: [],
  31585. source: "asJavaScriptObject\x0a\x09^ super asJavaScriptObject\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  31586. referencedClasses: [],
  31587. messageSends: ["at:put:", "asJavaScriptObject", "namespace", "yourself"]
  31588. }),
  31589. $globals.AmdPackageTransport);
  31590. $core.addMethod(
  31591. $core.method({
  31592. selector: "commitHandlerClass",
  31593. protocol: "accessing",
  31594. fn: function (){
  31595. var self=this;
  31596. return $globals.AmdPackageHandler;
  31597. },
  31598. args: [],
  31599. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  31600. referencedClasses: ["AmdPackageHandler"],
  31601. messageSends: []
  31602. }),
  31603. $globals.AmdPackageTransport);
  31604. $core.addMethod(
  31605. $core.method({
  31606. selector: "defaultNamespace",
  31607. protocol: "defaults",
  31608. fn: function (){
  31609. var self=this;
  31610. return $core.withContext(function($ctx1) {
  31611. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  31612. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  31613. },
  31614. args: [],
  31615. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  31616. referencedClasses: ["Smalltalk"],
  31617. messageSends: ["defaultAmdNamespace"]
  31618. }),
  31619. $globals.AmdPackageTransport);
  31620. $core.addMethod(
  31621. $core.method({
  31622. selector: "definition",
  31623. protocol: "accessing",
  31624. fn: function (){
  31625. var self=this;
  31626. return $core.withContext(function($ctx1) {
  31627. return $recv($globals.String)._streamContents_((function(stream){
  31628. return $core.withContext(function($ctx2) {
  31629. $recv(stream)._write_([$recv(self._class())._name()," namespace: "]);
  31630. return $recv(stream)._print_(self._namespace());
  31631. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  31632. }));
  31633. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  31634. },
  31635. args: [],
  31636. source: "definition\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: { self class name. ' namespace: ' }; print: self namespace ]",
  31637. referencedClasses: ["String"],
  31638. messageSends: ["streamContents:", "write:", "name", "class", "print:", "namespace"]
  31639. }),
  31640. $globals.AmdPackageTransport);
  31641. $core.addMethod(
  31642. $core.method({
  31643. selector: "namespace",
  31644. protocol: "accessing",
  31645. fn: function (){
  31646. var self=this;
  31647. return $core.withContext(function($ctx1) {
  31648. var $1,$receiver;
  31649. $1=self["@namespace"];
  31650. if(($receiver = $1) == null || $receiver.isNil){
  31651. return self._defaultNamespace();
  31652. } else {
  31653. return $1;
  31654. }
  31655. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  31656. },
  31657. args: [],
  31658. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  31659. referencedClasses: [],
  31660. messageSends: ["ifNil:", "defaultNamespace"]
  31661. }),
  31662. $globals.AmdPackageTransport);
  31663. $core.addMethod(
  31664. $core.method({
  31665. selector: "namespace:",
  31666. protocol: "accessing",
  31667. fn: function (aString){
  31668. var self=this;
  31669. self["@namespace"]=aString;
  31670. return self;
  31671. },
  31672. args: ["aString"],
  31673. source: "namespace: aString\x0a\x09namespace := aString",
  31674. referencedClasses: [],
  31675. messageSends: []
  31676. }),
  31677. $globals.AmdPackageTransport);
  31678. $core.addMethod(
  31679. $core.method({
  31680. selector: "printOn:",
  31681. protocol: "printing",
  31682. fn: function (aStream){
  31683. var self=this;
  31684. return $core.withContext(function($ctx1) {
  31685. (
  31686. $ctx1.supercall = true,
  31687. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  31688. $ctx1.supercall = false;
  31689. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  31690. $ctx1.sendIdx["nextPutAll:"]=1;
  31691. $recv(aStream)._nextPutAll_(self._namespace());
  31692. $ctx1.sendIdx["nextPutAll:"]=2;
  31693. $recv(aStream)._nextPutAll_(")");
  31694. return self;
  31695. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  31696. },
  31697. args: ["aStream"],
  31698. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  31699. referencedClasses: [],
  31700. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  31701. }),
  31702. $globals.AmdPackageTransport);
  31703. $core.addMethod(
  31704. $core.method({
  31705. selector: "setPath:",
  31706. protocol: "actions",
  31707. fn: function (aString){
  31708. var self=this;
  31709. return $core.withContext(function($ctx1) {
  31710. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
  31711. return self;
  31712. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  31713. },
  31714. args: ["aString"],
  31715. source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09(require basicAt: 'config') value: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
  31716. referencedClasses: [],
  31717. messageSends: ["value:", "basicAt:", "namespace"]
  31718. }),
  31719. $globals.AmdPackageTransport);
  31720. $core.addMethod(
  31721. $core.method({
  31722. selector: "setupFromJson:",
  31723. protocol: "initialization",
  31724. fn: function (anObject){
  31725. var self=this;
  31726. return $core.withContext(function($ctx1) {
  31727. self._namespace_($recv(anObject)._at_("amdNamespace"));
  31728. return self;
  31729. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  31730. },
  31731. args: ["anObject"],
  31732. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  31733. referencedClasses: [],
  31734. messageSends: ["namespace:", "at:"]
  31735. }),
  31736. $globals.AmdPackageTransport);
  31737. $core.addMethod(
  31738. $core.method({
  31739. selector: "namespace:",
  31740. protocol: "instance creation",
  31741. fn: function (aString){
  31742. var self=this;
  31743. return $core.withContext(function($ctx1) {
  31744. var $1;
  31745. $1=self._new();
  31746. $recv($1)._namespace_(aString);
  31747. return $recv($1)._yourself();
  31748. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.klass)});
  31749. },
  31750. args: ["aString"],
  31751. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  31752. referencedClasses: [],
  31753. messageSends: ["namespace:", "new", "yourself"]
  31754. }),
  31755. $globals.AmdPackageTransport.klass);
  31756. $core.addMethod(
  31757. $core.method({
  31758. selector: "type",
  31759. protocol: "accessing",
  31760. fn: function (){
  31761. var self=this;
  31762. return "amd";
  31763. },
  31764. args: [],
  31765. source: "type\x0a\x09^ 'amd'",
  31766. referencedClasses: [],
  31767. messageSends: []
  31768. }),
  31769. $globals.AmdPackageTransport.klass);
  31770. $core.addMethod(
  31771. $core.method({
  31772. selector: "commentStamp",
  31773. protocol: "*Platform-ImportExport",
  31774. fn: function (){
  31775. var self=this;
  31776. return $core.withContext(function($ctx1) {
  31777. var $1;
  31778. $1=$recv($globals.ClassCommentReader)._new();
  31779. $recv($1)._class_(self);
  31780. return $recv($1)._yourself();
  31781. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.BehaviorBody)});
  31782. },
  31783. args: [],
  31784. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  31785. referencedClasses: ["ClassCommentReader"],
  31786. messageSends: ["class:", "new", "yourself"]
  31787. }),
  31788. $globals.BehaviorBody);
  31789. $core.addMethod(
  31790. $core.method({
  31791. selector: "commentStamp:prior:",
  31792. protocol: "*Platform-ImportExport",
  31793. fn: function (aStamp,prior){
  31794. var self=this;
  31795. return $core.withContext(function($ctx1) {
  31796. return self._commentStamp();
  31797. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.BehaviorBody)});
  31798. },
  31799. args: ["aStamp", "prior"],
  31800. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  31801. referencedClasses: [],
  31802. messageSends: ["commentStamp"]
  31803. }),
  31804. $globals.BehaviorBody);
  31805. $core.addMethod(
  31806. $core.method({
  31807. selector: "exportBehaviorDefinitionTo:using:",
  31808. protocol: "*Platform-ImportExport",
  31809. fn: function (aStream,anExporter){
  31810. var self=this;
  31811. return $core.withContext(function($ctx1) {
  31812. self._subclassResponsibility();
  31813. return self;
  31814. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.BehaviorBody)});
  31815. },
  31816. args: ["aStream", "anExporter"],
  31817. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09self subclassResponsibility",
  31818. referencedClasses: [],
  31819. messageSends: ["subclassResponsibility"]
  31820. }),
  31821. $globals.BehaviorBody);
  31822. $core.addMethod(
  31823. $core.method({
  31824. selector: "methodsFor:",
  31825. protocol: "*Platform-ImportExport",
  31826. fn: function (aString){
  31827. var self=this;
  31828. return $core.withContext(function($ctx1) {
  31829. var $1;
  31830. $1=$recv($globals.ClassProtocolReader)._new();
  31831. $recv($1)._class_category_(self,aString);
  31832. return $recv($1)._yourself();
  31833. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.BehaviorBody)});
  31834. },
  31835. args: ["aString"],
  31836. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  31837. referencedClasses: ["ClassProtocolReader"],
  31838. messageSends: ["class:category:", "new", "yourself"]
  31839. }),
  31840. $globals.BehaviorBody);
  31841. $core.addMethod(
  31842. $core.method({
  31843. selector: "methodsFor:stamp:",
  31844. protocol: "*Platform-ImportExport",
  31845. fn: function (aString,aStamp){
  31846. var self=this;
  31847. return $core.withContext(function($ctx1) {
  31848. return self._methodsFor_(aString);
  31849. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.BehaviorBody)});
  31850. },
  31851. args: ["aString", "aStamp"],
  31852. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  31853. referencedClasses: [],
  31854. messageSends: ["methodsFor:"]
  31855. }),
  31856. $globals.BehaviorBody);
  31857. $core.addMethod(
  31858. $core.method({
  31859. selector: "exportBehaviorDefinitionTo:using:",
  31860. protocol: "*Platform-ImportExport",
  31861. fn: function (aStream,anExporter){
  31862. var self=this;
  31863. return $core.withContext(function($ctx1) {
  31864. $recv(anExporter)._exportDefinitionOf_on_(self,aStream);
  31865. return self;
  31866. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Class)});
  31867. },
  31868. args: ["aStream", "anExporter"],
  31869. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportDefinitionOf: self on: aStream",
  31870. referencedClasses: [],
  31871. messageSends: ["exportDefinitionOf:on:"]
  31872. }),
  31873. $globals.Class);
  31874. $core.addMethod(
  31875. $core.method({
  31876. selector: "exportBehaviorDefinitionTo:using:",
  31877. protocol: "*Platform-ImportExport",
  31878. fn: function (aStream,anExporter){
  31879. var self=this;
  31880. return $core.withContext(function($ctx1) {
  31881. $recv(anExporter)._exportMetaDefinitionOf_on_(self._instanceClass(),aStream);
  31882. return self;
  31883. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Metaclass)});
  31884. },
  31885. args: ["aStream", "anExporter"],
  31886. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportMetaDefinitionOf: self instanceClass on: aStream",
  31887. referencedClasses: [],
  31888. messageSends: ["exportMetaDefinitionOf:on:", "instanceClass"]
  31889. }),
  31890. $globals.Metaclass);
  31891. $core.addMethod(
  31892. $core.method({
  31893. selector: "commit",
  31894. protocol: "*Platform-ImportExport",
  31895. fn: function (){
  31896. var self=this;
  31897. return $core.withContext(function($ctx1) {
  31898. return $recv(self._transport())._commit();
  31899. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  31900. },
  31901. args: [],
  31902. source: "commit\x0a\x09^ self transport commit",
  31903. referencedClasses: [],
  31904. messageSends: ["commit", "transport"]
  31905. }),
  31906. $globals.Package);
  31907. $core.addMethod(
  31908. $core.method({
  31909. selector: "load",
  31910. protocol: "*Platform-ImportExport",
  31911. fn: function (){
  31912. var self=this;
  31913. return $core.withContext(function($ctx1) {
  31914. return $recv(self._transport())._load();
  31915. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  31916. },
  31917. args: [],
  31918. source: "load\x0a\x09^ self transport load",
  31919. referencedClasses: [],
  31920. messageSends: ["load", "transport"]
  31921. }),
  31922. $globals.Package);
  31923. $core.addMethod(
  31924. $core.method({
  31925. selector: "loadFromNamespace:",
  31926. protocol: "*Platform-ImportExport",
  31927. fn: function (aString){
  31928. var self=this;
  31929. return $core.withContext(function($ctx1) {
  31930. var $1;
  31931. $1=self._transport();
  31932. $recv($1)._namespace_(aString);
  31933. return $recv($1)._load();
  31934. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  31935. },
  31936. args: ["aString"],
  31937. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  31938. referencedClasses: [],
  31939. messageSends: ["namespace:", "transport", "load"]
  31940. }),
  31941. $globals.Package);
  31942. $core.addMethod(
  31943. $core.method({
  31944. selector: "load:",
  31945. protocol: "*Platform-ImportExport",
  31946. fn: function (aPackageName){
  31947. var self=this;
  31948. return $core.withContext(function($ctx1) {
  31949. $recv(self._named_(aPackageName))._load();
  31950. return self;
  31951. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.klass)});
  31952. },
  31953. args: ["aPackageName"],
  31954. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  31955. referencedClasses: [],
  31956. messageSends: ["load", "named:"]
  31957. }),
  31958. $globals.Package.klass);
  31959. $core.addMethod(
  31960. $core.method({
  31961. selector: "load:fromNamespace:",
  31962. protocol: "*Platform-ImportExport",
  31963. fn: function (aPackageName,aString){
  31964. var self=this;
  31965. return $core.withContext(function($ctx1) {
  31966. $recv(self._named_(aPackageName))._loadFromNamespace_(aString);
  31967. return self;
  31968. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.klass)});
  31969. },
  31970. args: ["aPackageName", "aString"],
  31971. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  31972. referencedClasses: [],
  31973. messageSends: ["loadFromNamespace:", "named:"]
  31974. }),
  31975. $globals.Package.klass);
  31976. $core.addMethod(
  31977. $core.method({
  31978. selector: "exportBehaviorDefinitionTo:using:",
  31979. protocol: "*Platform-ImportExport",
  31980. fn: function (aStream,anExporter){
  31981. var self=this;
  31982. return $core.withContext(function($ctx1) {
  31983. $recv(anExporter)._exportTraitDefinitionOf_on_(self,aStream);
  31984. return self;
  31985. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Trait)});
  31986. },
  31987. args: ["aStream", "anExporter"],
  31988. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportTraitDefinitionOf: self on: aStream",
  31989. referencedClasses: [],
  31990. messageSends: ["exportTraitDefinitionOf:on:"]
  31991. }),
  31992. $globals.Trait);
  31993. });
  31994. define('amber_core/Compiler-Core',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
  31995. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  31996. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  31997. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  31998. $core.addPackage("Compiler-Core");
  31999. $core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  32000. $core.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  32001. $core.addClass("AbstractCodeGenerator", $globals.Object, ["currentClass", "currentPackage", "source"], "Compiler-Core");
  32002. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  32003. $core.addMethod(
  32004. $core.method({
  32005. selector: "compileNode:",
  32006. protocol: "compiling",
  32007. fn: function (aNode){
  32008. var self=this;
  32009. return $core.withContext(function($ctx1) {
  32010. return $recv(self._transformers())._inject_into_(aNode,(function(input,transformer){
  32011. return $core.withContext(function($ctx2) {
  32012. return $recv(transformer)._value_(input);
  32013. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  32014. }));
  32015. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  32016. },
  32017. args: ["aNode"],
  32018. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  32019. referencedClasses: [],
  32020. messageSends: ["inject:into:", "transformers", "value:"]
  32021. }),
  32022. $globals.AbstractCodeGenerator);
  32023. $core.addMethod(
  32024. $core.method({
  32025. selector: "currentClass",
  32026. protocol: "accessing",
  32027. fn: function (){
  32028. var self=this;
  32029. return self["@currentClass"];
  32030. },
  32031. args: [],
  32032. source: "currentClass\x0a\x09^ currentClass",
  32033. referencedClasses: [],
  32034. messageSends: []
  32035. }),
  32036. $globals.AbstractCodeGenerator);
  32037. $core.addMethod(
  32038. $core.method({
  32039. selector: "currentClass:",
  32040. protocol: "accessing",
  32041. fn: function (aClass){
  32042. var self=this;
  32043. self["@currentClass"]=aClass;
  32044. return self;
  32045. },
  32046. args: ["aClass"],
  32047. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  32048. referencedClasses: [],
  32049. messageSends: []
  32050. }),
  32051. $globals.AbstractCodeGenerator);
  32052. $core.addMethod(
  32053. $core.method({
  32054. selector: "currentPackage",
  32055. protocol: "accessing",
  32056. fn: function (){
  32057. var self=this;
  32058. return self["@currentPackage"];
  32059. },
  32060. args: [],
  32061. source: "currentPackage\x0a\x09^ currentPackage",
  32062. referencedClasses: [],
  32063. messageSends: []
  32064. }),
  32065. $globals.AbstractCodeGenerator);
  32066. $core.addMethod(
  32067. $core.method({
  32068. selector: "currentPackage:",
  32069. protocol: "accessing",
  32070. fn: function (anObject){
  32071. var self=this;
  32072. self["@currentPackage"]=anObject;
  32073. return self;
  32074. },
  32075. args: ["anObject"],
  32076. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  32077. referencedClasses: [],
  32078. messageSends: []
  32079. }),
  32080. $globals.AbstractCodeGenerator);
  32081. $core.addMethod(
  32082. $core.method({
  32083. selector: "pseudoVariables",
  32084. protocol: "accessing",
  32085. fn: function (){
  32086. var self=this;
  32087. return $core.withContext(function($ctx1) {
  32088. return $recv($globals.Smalltalk)._pseudoVariableNames();
  32089. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  32090. },
  32091. args: [],
  32092. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  32093. referencedClasses: ["Smalltalk"],
  32094. messageSends: ["pseudoVariableNames"]
  32095. }),
  32096. $globals.AbstractCodeGenerator);
  32097. $core.addMethod(
  32098. $core.method({
  32099. selector: "source",
  32100. protocol: "accessing",
  32101. fn: function (){
  32102. var self=this;
  32103. return $core.withContext(function($ctx1) {
  32104. var $1,$receiver;
  32105. $1=self["@source"];
  32106. if(($receiver = $1) == null || $receiver.isNil){
  32107. return "";
  32108. } else {
  32109. return $1;
  32110. }
  32111. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  32112. },
  32113. args: [],
  32114. source: "source\x0a\x09^ source ifNil: [ '' ]",
  32115. referencedClasses: [],
  32116. messageSends: ["ifNil:"]
  32117. }),
  32118. $globals.AbstractCodeGenerator);
  32119. $core.addMethod(
  32120. $core.method({
  32121. selector: "source:",
  32122. protocol: "accessing",
  32123. fn: function (aString){
  32124. var self=this;
  32125. self["@source"]=aString;
  32126. return self;
  32127. },
  32128. args: ["aString"],
  32129. source: "source: aString\x0a\x09source := aString",
  32130. referencedClasses: [],
  32131. messageSends: []
  32132. }),
  32133. $globals.AbstractCodeGenerator);
  32134. $core.addMethod(
  32135. $core.method({
  32136. selector: "transformers",
  32137. protocol: "compiling",
  32138. fn: function (){
  32139. var self=this;
  32140. var dict;
  32141. return $core.withContext(function($ctx1) {
  32142. dict=self._transformersDictionary();
  32143. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  32144. return $core.withContext(function($ctx2) {
  32145. return $recv(dict)._at_(each);
  32146. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32147. }));
  32148. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict},$globals.AbstractCodeGenerator)});
  32149. },
  32150. args: [],
  32151. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  32152. referencedClasses: [],
  32153. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  32154. }),
  32155. $globals.AbstractCodeGenerator);
  32156. $core.addMethod(
  32157. $core.method({
  32158. selector: "transformersDictionary",
  32159. protocol: "compiling",
  32160. fn: function (){
  32161. var self=this;
  32162. return $core.withContext(function($ctx1) {
  32163. self._subclassResponsibility();
  32164. return self;
  32165. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.AbstractCodeGenerator)});
  32166. },
  32167. args: [],
  32168. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  32169. referencedClasses: [],
  32170. messageSends: ["subclassResponsibility"]
  32171. }),
  32172. $globals.AbstractCodeGenerator);
  32173. $core.addClass("CodeGenerator", $globals.AbstractCodeGenerator, [], "Compiler-Core");
  32174. $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.";
  32175. $core.addMethod(
  32176. $core.method({
  32177. selector: "irTranslator",
  32178. protocol: "compiling",
  32179. fn: function (){
  32180. var self=this;
  32181. return $core.withContext(function($ctx1) {
  32182. var $1;
  32183. $1=$recv(self._irTranslatorClass())._new();
  32184. $recv($1)._currentClass_(self._currentClass());
  32185. return $recv($1)._yourself();
  32186. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  32187. },
  32188. args: [],
  32189. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  32190. referencedClasses: [],
  32191. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  32192. }),
  32193. $globals.CodeGenerator);
  32194. $core.addMethod(
  32195. $core.method({
  32196. selector: "irTranslatorClass",
  32197. protocol: "compiling",
  32198. fn: function (){
  32199. var self=this;
  32200. return $globals.IRJSTranslator;
  32201. },
  32202. args: [],
  32203. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  32204. referencedClasses: ["IRJSTranslator"],
  32205. messageSends: []
  32206. }),
  32207. $globals.CodeGenerator);
  32208. $core.addMethod(
  32209. $core.method({
  32210. selector: "semanticAnalyzer",
  32211. protocol: "compiling",
  32212. fn: function (){
  32213. var self=this;
  32214. return $core.withContext(function($ctx1) {
  32215. var $1;
  32216. $1=$recv($globals.SemanticAnalyzer)._on_(self._currentClass());
  32217. $recv($1)._thePackage_(self._currentPackage());
  32218. return $recv($1)._yourself();
  32219. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  32220. },
  32221. args: [],
  32222. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  32223. referencedClasses: ["SemanticAnalyzer"],
  32224. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  32225. }),
  32226. $globals.CodeGenerator);
  32227. $core.addMethod(
  32228. $core.method({
  32229. selector: "transformersDictionary",
  32230. protocol: "compiling",
  32231. fn: function (){
  32232. var self=this;
  32233. return $core.withContext(function($ctx1) {
  32234. var $1;
  32235. $1=$recv($globals.Dictionary)._new();
  32236. $recv($1)._at_put_("2000-semantic",self._semanticAnalyzer());
  32237. $ctx1.sendIdx["at:put:"]=1;
  32238. $recv($1)._at_put_("5000-astToIr",self._translator());
  32239. $ctx1.sendIdx["at:put:"]=2;
  32240. $recv($1)._at_put_("8000-irToJs",self._irTranslator());
  32241. return $recv($1)._yourself();
  32242. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.CodeGenerator)});
  32243. },
  32244. args: [],
  32245. source: "transformersDictionary\x0a\x09^ Dictionary new\x0a\x09\x09at: '2000-semantic' put: self semanticAnalyzer;\x0a\x09\x09at: '5000-astToIr' put: self translator;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself",
  32246. referencedClasses: ["Dictionary"],
  32247. messageSends: ["at:put:", "new", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
  32248. }),
  32249. $globals.CodeGenerator);
  32250. $core.addMethod(
  32251. $core.method({
  32252. selector: "translator",
  32253. protocol: "compiling",
  32254. fn: function (){
  32255. var self=this;
  32256. return $core.withContext(function($ctx1) {
  32257. var $1;
  32258. $1=$recv($globals.IRASTTranslator)._new();
  32259. $recv($1)._source_(self._source());
  32260. $recv($1)._theClass_(self._currentClass());
  32261. return $recv($1)._yourself();
  32262. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  32263. },
  32264. args: [],
  32265. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  32266. referencedClasses: ["IRASTTranslator"],
  32267. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  32268. }),
  32269. $globals.CodeGenerator);
  32270. $core.addClass("Compiler", $globals.Object, ["currentClass", "currentPackage", "source", "unknownVariables", "codeGeneratorClass"], "Compiler-Core");
  32271. $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`";
  32272. $core.addMethod(
  32273. $core.method({
  32274. selector: "codeGeneratorClass",
  32275. protocol: "accessing",
  32276. fn: function (){
  32277. var self=this;
  32278. return $core.withContext(function($ctx1) {
  32279. var $1,$receiver;
  32280. $1=self["@codeGeneratorClass"];
  32281. if(($receiver = $1) == null || $receiver.isNil){
  32282. return $globals.InliningCodeGenerator;
  32283. } else {
  32284. return $1;
  32285. }
  32286. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  32287. },
  32288. args: [],
  32289. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  32290. referencedClasses: ["InliningCodeGenerator"],
  32291. messageSends: ["ifNil:"]
  32292. }),
  32293. $globals.Compiler);
  32294. $core.addMethod(
  32295. $core.method({
  32296. selector: "codeGeneratorClass:",
  32297. protocol: "accessing",
  32298. fn: function (aClass){
  32299. var self=this;
  32300. self["@codeGeneratorClass"]=aClass;
  32301. return self;
  32302. },
  32303. args: ["aClass"],
  32304. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  32305. referencedClasses: [],
  32306. messageSends: []
  32307. }),
  32308. $globals.Compiler);
  32309. $core.addMethod(
  32310. $core.method({
  32311. selector: "compile:forClass:protocol:",
  32312. protocol: "compiling",
  32313. fn: function (aString,aClass,anotherString){
  32314. var self=this;
  32315. return $core.withContext(function($ctx1) {
  32316. self._source_(aString);
  32317. return self._compileNode_forClass_package_(self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
  32318. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  32319. },
  32320. args: ["aString", "aClass", "anotherString"],
  32321. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09compileNode: (self parse: aString)\x0a\x09\x09forClass: aClass\x0a\x09\x09package: (aClass packageOfProtocol: anotherString)",
  32322. referencedClasses: [],
  32323. messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
  32324. }),
  32325. $globals.Compiler);
  32326. $core.addMethod(
  32327. $core.method({
  32328. selector: "compileExpression:on:",
  32329. protocol: "compiling",
  32330. fn: function (aString,anObject){
  32331. var self=this;
  32332. return $core.withContext(function($ctx1) {
  32333. var $1;
  32334. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  32335. $ctx1.sendIdx[","]=1;
  32336. return self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  32337. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  32338. },
  32339. args: ["aString", "anObject"],
  32340. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  32341. referencedClasses: [],
  32342. messageSends: ["compile:forClass:protocol:", ",", "class"]
  32343. }),
  32344. $globals.Compiler);
  32345. $core.addMethod(
  32346. $core.method({
  32347. selector: "compileNode:",
  32348. protocol: "compiling",
  32349. fn: function (aNode){
  32350. var self=this;
  32351. var generator,result;
  32352. return $core.withContext(function($ctx1) {
  32353. var $1;
  32354. generator=$recv(self._codeGeneratorClass())._new();
  32355. $1=generator;
  32356. $recv($1)._source_(self._source());
  32357. $recv($1)._currentClass_(self._currentClass());
  32358. $recv($1)._currentPackage_(self._currentPackage());
  32359. result=$recv(generator)._compileNode_(aNode);
  32360. self._unknownVariables_([]);
  32361. return result;
  32362. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
  32363. },
  32364. args: ["aNode"],
  32365. source: "compileNode: aNode\x0a\x09| generator result |\x0a\x09generator := self codeGeneratorClass new.\x0a\x09generator\x0a\x09\x09source: self source;\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09currentPackage: self currentPackage.\x0a\x09result := generator compileNode: aNode.\x0a\x09self unknownVariables: #().\x0a\x09^ result",
  32366. referencedClasses: [],
  32367. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:", "unknownVariables:"]
  32368. }),
  32369. $globals.Compiler);
  32370. $core.addMethod(
  32371. $core.method({
  32372. selector: "compileNode:forClass:package:",
  32373. protocol: "compiling",
  32374. fn: function (aNode,aClass,aPackage){
  32375. var self=this;
  32376. return $core.withContext(function($ctx1) {
  32377. self._currentClass_(aClass);
  32378. self._currentPackage_(aPackage);
  32379. return self._compileNode_(aNode);
  32380. }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
  32381. },
  32382. args: ["aNode", "aClass", "aPackage"],
  32383. source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
  32384. referencedClasses: [],
  32385. messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
  32386. }),
  32387. $globals.Compiler);
  32388. $core.addMethod(
  32389. $core.method({
  32390. selector: "currentClass",
  32391. protocol: "accessing",
  32392. fn: function (){
  32393. var self=this;
  32394. return self["@currentClass"];
  32395. },
  32396. args: [],
  32397. source: "currentClass\x0a\x09^ currentClass",
  32398. referencedClasses: [],
  32399. messageSends: []
  32400. }),
  32401. $globals.Compiler);
  32402. $core.addMethod(
  32403. $core.method({
  32404. selector: "currentClass:",
  32405. protocol: "accessing",
  32406. fn: function (aClass){
  32407. var self=this;
  32408. self["@currentClass"]=aClass;
  32409. return self;
  32410. },
  32411. args: ["aClass"],
  32412. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  32413. referencedClasses: [],
  32414. messageSends: []
  32415. }),
  32416. $globals.Compiler);
  32417. $core.addMethod(
  32418. $core.method({
  32419. selector: "currentPackage",
  32420. protocol: "accessing",
  32421. fn: function (){
  32422. var self=this;
  32423. return self["@currentPackage"];
  32424. },
  32425. args: [],
  32426. source: "currentPackage\x0a\x09^ currentPackage",
  32427. referencedClasses: [],
  32428. messageSends: []
  32429. }),
  32430. $globals.Compiler);
  32431. $core.addMethod(
  32432. $core.method({
  32433. selector: "currentPackage:",
  32434. protocol: "accessing",
  32435. fn: function (anObject){
  32436. var self=this;
  32437. self["@currentPackage"]=anObject;
  32438. return self;
  32439. },
  32440. args: ["anObject"],
  32441. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  32442. referencedClasses: [],
  32443. messageSends: []
  32444. }),
  32445. $globals.Compiler);
  32446. $core.addMethod(
  32447. $core.method({
  32448. selector: "eval:",
  32449. protocol: "compiling",
  32450. fn: function (aString){
  32451. var self=this;
  32452. return $core.withContext(function($ctx1) {
  32453. return eval(aString);
  32454. return self;
  32455. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  32456. },
  32457. args: ["aString"],
  32458. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  32459. referencedClasses: [],
  32460. messageSends: []
  32461. }),
  32462. $globals.Compiler);
  32463. $core.addMethod(
  32464. $core.method({
  32465. selector: "eval:forPackage:",
  32466. protocol: "compiling",
  32467. fn: function (aString,aPackage){
  32468. var self=this;
  32469. return $core.withContext(function($ctx1) {
  32470. return aPackage && aPackage.innerEval
  32471. ? aPackage.innerEval(aString)
  32472. : eval(aString);
  32473. return self;
  32474. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  32475. },
  32476. args: ["aString", "aPackage"],
  32477. source: "eval: aString forPackage: aPackage\x0a\x09<inlineJS: 'return aPackage && aPackage.innerEval\x0a\x09\x09? aPackage.innerEval(aString)\x0a\x09\x09: eval(aString)'>",
  32478. referencedClasses: [],
  32479. messageSends: []
  32480. }),
  32481. $globals.Compiler);
  32482. $core.addMethod(
  32483. $core.method({
  32484. selector: "evaluateExpression:",
  32485. protocol: "compiling",
  32486. fn: function (aString){
  32487. var self=this;
  32488. return $core.withContext(function($ctx1) {
  32489. return self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  32490. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  32491. },
  32492. args: ["aString"],
  32493. 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",
  32494. referencedClasses: ["DoIt"],
  32495. messageSends: ["evaluateExpression:on:", "new"]
  32496. }),
  32497. $globals.Compiler);
  32498. $core.addMethod(
  32499. $core.method({
  32500. selector: "evaluateExpression:on:",
  32501. protocol: "compiling",
  32502. fn: function (aString,anObject){
  32503. var self=this;
  32504. var result,method;
  32505. return $core.withContext(function($ctx1) {
  32506. var $1;
  32507. method=self._eval_(self._compileExpression_on_(aString,anObject));
  32508. $recv(method)._protocol_("**xxxDoIt");
  32509. $1=$recv(anObject)._class();
  32510. $ctx1.sendIdx["class"]=1;
  32511. $recv($1)._addCompiledMethod_(method);
  32512. result=$recv(anObject)._xxxDoIt();
  32513. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  32514. return result;
  32515. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  32516. },
  32517. args: ["aString", "anObject"],
  32518. 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",
  32519. referencedClasses: [],
  32520. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  32521. }),
  32522. $globals.Compiler);
  32523. $core.addMethod(
  32524. $core.method({
  32525. selector: "install:forClass:protocol:",
  32526. protocol: "compiling",
  32527. fn: function (aString,aBehavior,anotherString){
  32528. var self=this;
  32529. var compiledMethod;
  32530. return $core.withContext(function($ctx1) {
  32531. compiledMethod=self._eval_forPackage_(self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  32532. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  32533. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  32534. },
  32535. args: ["aString", "aBehavior", "anotherString"],
  32536. 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",
  32537. referencedClasses: ["ClassBuilder"],
  32538. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  32539. }),
  32540. $globals.Compiler);
  32541. $core.addMethod(
  32542. $core.method({
  32543. selector: "parse:",
  32544. protocol: "compiling",
  32545. fn: function (aString){
  32546. var self=this;
  32547. return $core.withContext(function($ctx1) {
  32548. return $recv($globals.Smalltalk)._parse_(aString);
  32549. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  32550. },
  32551. args: ["aString"],
  32552. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  32553. referencedClasses: ["Smalltalk"],
  32554. messageSends: ["parse:"]
  32555. }),
  32556. $globals.Compiler);
  32557. $core.addMethod(
  32558. $core.method({
  32559. selector: "parseExpression:",
  32560. protocol: "compiling",
  32561. fn: function (aString){
  32562. var self=this;
  32563. return $core.withContext(function($ctx1) {
  32564. var $1;
  32565. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  32566. $ctx1.sendIdx[","]=1;
  32567. return self._parse_($1);
  32568. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  32569. },
  32570. args: ["aString"],
  32571. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  32572. referencedClasses: [],
  32573. messageSends: ["parse:", ","]
  32574. }),
  32575. $globals.Compiler);
  32576. $core.addMethod(
  32577. $core.method({
  32578. selector: "recompile:",
  32579. protocol: "compiling",
  32580. fn: function (aClass){
  32581. var self=this;
  32582. return $core.withContext(function($ctx1) {
  32583. var $1,$2,$3,$receiver;
  32584. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  32585. return $core.withContext(function($ctx2) {
  32586. $1=$recv($recv(each)._methodClass()).__eq(aClass);
  32587. $ctx2.sendIdx["="]=1;
  32588. if($core.assert($1)){
  32589. return self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  32590. }
  32591. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32592. }),"Recompiling ".__comma($recv(aClass)._name()));
  32593. $2=$recv(aClass)._theMetaClass();
  32594. if(($receiver = $2) == null || $receiver.isNil){
  32595. $2;
  32596. } else {
  32597. var meta;
  32598. meta=$receiver;
  32599. $3=$recv(meta).__eq(aClass);
  32600. if(!$core.assert($3)){
  32601. self._recompile_(meta);
  32602. }
  32603. }
  32604. return self;
  32605. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  32606. },
  32607. args: ["aClass"],
  32608. 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 ] ]",
  32609. referencedClasses: [],
  32610. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifNotNil:", "theMetaClass", "ifFalse:", "recompile:"]
  32611. }),
  32612. $globals.Compiler);
  32613. $core.addMethod(
  32614. $core.method({
  32615. selector: "recompileAll",
  32616. protocol: "compiling",
  32617. fn: function (){
  32618. var self=this;
  32619. return $core.withContext(function($ctx1) {
  32620. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  32621. return $core.withContext(function($ctx2) {
  32622. return self._recompile_(each);
  32623. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32624. }),"Compiling all classes...");
  32625. return self;
  32626. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  32627. },
  32628. args: [],
  32629. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  32630. referencedClasses: ["Smalltalk"],
  32631. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  32632. }),
  32633. $globals.Compiler);
  32634. $core.addMethod(
  32635. $core.method({
  32636. selector: "source",
  32637. protocol: "accessing",
  32638. fn: function (){
  32639. var self=this;
  32640. return $core.withContext(function($ctx1) {
  32641. var $1,$receiver;
  32642. $1=self["@source"];
  32643. if(($receiver = $1) == null || $receiver.isNil){
  32644. return "";
  32645. } else {
  32646. return $1;
  32647. }
  32648. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  32649. },
  32650. args: [],
  32651. source: "source\x0a\x09^ source ifNil: [ '' ]",
  32652. referencedClasses: [],
  32653. messageSends: ["ifNil:"]
  32654. }),
  32655. $globals.Compiler);
  32656. $core.addMethod(
  32657. $core.method({
  32658. selector: "source:",
  32659. protocol: "accessing",
  32660. fn: function (aString){
  32661. var self=this;
  32662. self["@source"]=aString;
  32663. return self;
  32664. },
  32665. args: ["aString"],
  32666. source: "source: aString\x0a\x09source := aString",
  32667. referencedClasses: [],
  32668. messageSends: []
  32669. }),
  32670. $globals.Compiler);
  32671. $core.addMethod(
  32672. $core.method({
  32673. selector: "unknownVariables",
  32674. protocol: "accessing",
  32675. fn: function (){
  32676. var self=this;
  32677. return self["@unknownVariables"];
  32678. },
  32679. args: [],
  32680. source: "unknownVariables\x0a\x09^ unknownVariables",
  32681. referencedClasses: [],
  32682. messageSends: []
  32683. }),
  32684. $globals.Compiler);
  32685. $core.addMethod(
  32686. $core.method({
  32687. selector: "unknownVariables:",
  32688. protocol: "accessing",
  32689. fn: function (aCollection){
  32690. var self=this;
  32691. self["@unknownVariables"]=aCollection;
  32692. return self;
  32693. },
  32694. args: ["aCollection"],
  32695. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  32696. referencedClasses: [],
  32697. messageSends: []
  32698. }),
  32699. $globals.Compiler);
  32700. $core.addMethod(
  32701. $core.method({
  32702. selector: "recompile:",
  32703. protocol: "compiling",
  32704. fn: function (aClass){
  32705. var self=this;
  32706. return $core.withContext(function($ctx1) {
  32707. $recv(self._new())._recompile_(aClass);
  32708. return self;
  32709. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.klass)});
  32710. },
  32711. args: ["aClass"],
  32712. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  32713. referencedClasses: [],
  32714. messageSends: ["recompile:", "new"]
  32715. }),
  32716. $globals.Compiler.klass);
  32717. $core.addMethod(
  32718. $core.method({
  32719. selector: "recompileAll",
  32720. protocol: "compiling",
  32721. fn: function (){
  32722. var self=this;
  32723. return $core.withContext(function($ctx1) {
  32724. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  32725. return $core.withContext(function($ctx2) {
  32726. return self._recompile_(each);
  32727. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32728. }));
  32729. return self;
  32730. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.klass)});
  32731. },
  32732. args: [],
  32733. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  32734. referencedClasses: ["Smalltalk"],
  32735. messageSends: ["do:", "classes", "recompile:"]
  32736. }),
  32737. $globals.Compiler.klass);
  32738. $core.addClass("CompilerError", $globals.Error, [], "Compiler-Core");
  32739. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  32740. $core.addClass("DoIt", $globals.Object, [], "Compiler-Core");
  32741. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  32742. $core.addClass("Evaluator", $globals.Object, [], "Compiler-Core");
  32743. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  32744. $core.addMethod(
  32745. $core.method({
  32746. selector: "evaluate:context:",
  32747. protocol: "evaluating",
  32748. fn: function (aString,aContext){
  32749. var self=this;
  32750. var compiler,ast;
  32751. return $core.withContext(function($ctx1) {
  32752. var $1;
  32753. var $early={};
  32754. try {
  32755. compiler=$recv($globals.Compiler)._new();
  32756. $recv((function(){
  32757. return $core.withContext(function($ctx2) {
  32758. ast=$recv(compiler)._parseExpression_(aString);
  32759. return ast;
  32760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32761. }))._on_do_($globals.Error,(function(ex){
  32762. return $core.withContext(function($ctx2) {
  32763. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  32764. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  32765. }));
  32766. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  32767. $recv($1)._context_(aContext);
  32768. $recv($1)._visit_(ast);
  32769. return $recv(aContext)._evaluateNode_(ast);
  32770. }
  32771. catch(e) {if(e===$early)return e[0]; throw e}
  32772. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  32773. },
  32774. args: ["aString", "aContext"],
  32775. 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",
  32776. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  32777. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  32778. }),
  32779. $globals.Evaluator);
  32780. $core.addMethod(
  32781. $core.method({
  32782. selector: "evaluate:for:",
  32783. protocol: "evaluating",
  32784. fn: function (aString,anObject){
  32785. var self=this;
  32786. return $core.withContext(function($ctx1) {
  32787. return $recv(anObject)._evaluate_on_(aString,self);
  32788. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  32789. },
  32790. args: ["aString", "anObject"],
  32791. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  32792. referencedClasses: [],
  32793. messageSends: ["evaluate:on:"]
  32794. }),
  32795. $globals.Evaluator);
  32796. $core.addMethod(
  32797. $core.method({
  32798. selector: "evaluate:receiver:",
  32799. protocol: "evaluating",
  32800. fn: function (aString,anObject){
  32801. var self=this;
  32802. var compiler;
  32803. return $core.withContext(function($ctx1) {
  32804. var $early={};
  32805. try {
  32806. compiler=$recv($globals.Compiler)._new();
  32807. $recv((function(){
  32808. return $core.withContext(function($ctx2) {
  32809. return $recv(compiler)._parseExpression_(aString);
  32810. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32811. }))._on_do_($globals.Error,(function(ex){
  32812. return $core.withContext(function($ctx2) {
  32813. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  32814. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  32815. }));
  32816. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  32817. }
  32818. catch(e) {if(e===$early)return e[0]; throw e}
  32819. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  32820. },
  32821. args: ["aString", "anObject"],
  32822. 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",
  32823. referencedClasses: ["Compiler", "Error", "Terminal"],
  32824. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  32825. }),
  32826. $globals.Evaluator);
  32827. $core.addMethod(
  32828. $core.method({
  32829. selector: "evaluate:for:",
  32830. protocol: "instance creation",
  32831. fn: function (aString,anObject){
  32832. var self=this;
  32833. return $core.withContext(function($ctx1) {
  32834. return $recv(self._new())._evaluate_for_(aString,anObject);
  32835. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.klass)});
  32836. },
  32837. args: ["aString", "anObject"],
  32838. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  32839. referencedClasses: [],
  32840. messageSends: ["evaluate:for:", "new"]
  32841. }),
  32842. $globals.Evaluator.klass);
  32843. $core.addMethod(
  32844. $core.method({
  32845. selector: "asVariableName",
  32846. protocol: "*Compiler-Core",
  32847. fn: function (){
  32848. var self=this;
  32849. return $core.withContext(function($ctx1) {
  32850. var $1;
  32851. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  32852. if($core.assert($1)){
  32853. return self.__comma("_");
  32854. } else {
  32855. return self;
  32856. }
  32857. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  32858. },
  32859. args: [],
  32860. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  32861. referencedClasses: ["Smalltalk"],
  32862. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  32863. }),
  32864. $globals.String);
  32865. });
  32866. define('amber_core/Compiler-AST',["amber/boot", "amber_core/Kernel-Dag", "amber_core/Kernel-Methods"], function($boot){"use strict";
  32867. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  32868. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  32869. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  32870. $core.addPackage("Compiler-AST");
  32871. $core.packages["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  32872. $core.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  32873. $core.addClass("ASTNode", $globals.DagParentNode, ["parent", "position", "source", "shouldBeAliased"], "Compiler-AST");
  32874. $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.";
  32875. $core.addMethod(
  32876. $core.method({
  32877. selector: "inPosition:",
  32878. protocol: "testing",
  32879. fn: function (aPoint){
  32880. var self=this;
  32881. return $core.withContext(function($ctx1) {
  32882. return $recv($recv(self._positionStart()).__lt_eq(aPoint))._and_((function(){
  32883. return $core.withContext(function($ctx2) {
  32884. return $recv(self._positionEnd()).__gt_eq(aPoint);
  32885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32886. }));
  32887. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.ASTNode)});
  32888. },
  32889. args: ["aPoint"],
  32890. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  32891. referencedClasses: [],
  32892. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  32893. }),
  32894. $globals.ASTNode);
  32895. $core.addMethod(
  32896. $core.method({
  32897. selector: "isAssignmentNode",
  32898. protocol: "testing",
  32899. fn: function (){
  32900. var self=this;
  32901. return false;
  32902. },
  32903. args: [],
  32904. source: "isAssignmentNode\x0a\x09^ false",
  32905. referencedClasses: [],
  32906. messageSends: []
  32907. }),
  32908. $globals.ASTNode);
  32909. $core.addMethod(
  32910. $core.method({
  32911. selector: "isBlockNode",
  32912. protocol: "testing",
  32913. fn: function (){
  32914. var self=this;
  32915. return false;
  32916. },
  32917. args: [],
  32918. source: "isBlockNode\x0a\x09^ false",
  32919. referencedClasses: [],
  32920. messageSends: []
  32921. }),
  32922. $globals.ASTNode);
  32923. $core.addMethod(
  32924. $core.method({
  32925. selector: "isBlockSequenceNode",
  32926. protocol: "testing",
  32927. fn: function (){
  32928. var self=this;
  32929. return false;
  32930. },
  32931. args: [],
  32932. source: "isBlockSequenceNode\x0a\x09^ false",
  32933. referencedClasses: [],
  32934. messageSends: []
  32935. }),
  32936. $globals.ASTNode);
  32937. $core.addMethod(
  32938. $core.method({
  32939. selector: "isCascadeNode",
  32940. protocol: "testing",
  32941. fn: function (){
  32942. var self=this;
  32943. return false;
  32944. },
  32945. args: [],
  32946. source: "isCascadeNode\x0a\x09^ false",
  32947. referencedClasses: [],
  32948. messageSends: []
  32949. }),
  32950. $globals.ASTNode);
  32951. $core.addMethod(
  32952. $core.method({
  32953. selector: "isImmutable",
  32954. protocol: "testing",
  32955. fn: function (){
  32956. var self=this;
  32957. return false;
  32958. },
  32959. args: [],
  32960. source: "isImmutable\x0a\x09^ false",
  32961. referencedClasses: [],
  32962. messageSends: []
  32963. }),
  32964. $globals.ASTNode);
  32965. $core.addMethod(
  32966. $core.method({
  32967. selector: "isJSStatementNode",
  32968. protocol: "testing",
  32969. fn: function (){
  32970. var self=this;
  32971. return false;
  32972. },
  32973. args: [],
  32974. source: "isJSStatementNode\x0a\x09^ false",
  32975. referencedClasses: [],
  32976. messageSends: []
  32977. }),
  32978. $globals.ASTNode);
  32979. $core.addMethod(
  32980. $core.method({
  32981. selector: "isNavigationNode",
  32982. protocol: "testing",
  32983. fn: function (){
  32984. var self=this;
  32985. return false;
  32986. },
  32987. args: [],
  32988. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  32989. referencedClasses: [],
  32990. messageSends: []
  32991. }),
  32992. $globals.ASTNode);
  32993. $core.addMethod(
  32994. $core.method({
  32995. selector: "isReturnNode",
  32996. protocol: "testing",
  32997. fn: function (){
  32998. var self=this;
  32999. return false;
  33000. },
  33001. args: [],
  33002. source: "isReturnNode\x0a\x09^ false",
  33003. referencedClasses: [],
  33004. messageSends: []
  33005. }),
  33006. $globals.ASTNode);
  33007. $core.addMethod(
  33008. $core.method({
  33009. selector: "isSendNode",
  33010. protocol: "testing",
  33011. fn: function (){
  33012. var self=this;
  33013. return false;
  33014. },
  33015. args: [],
  33016. source: "isSendNode\x0a\x09^ false",
  33017. referencedClasses: [],
  33018. messageSends: []
  33019. }),
  33020. $globals.ASTNode);
  33021. $core.addMethod(
  33022. $core.method({
  33023. selector: "isSequenceNode",
  33024. protocol: "testing",
  33025. fn: function (){
  33026. var self=this;
  33027. return false;
  33028. },
  33029. args: [],
  33030. source: "isSequenceNode\x0a\x09^ false",
  33031. referencedClasses: [],
  33032. messageSends: []
  33033. }),
  33034. $globals.ASTNode);
  33035. $core.addMethod(
  33036. $core.method({
  33037. selector: "isSuperKeyword",
  33038. protocol: "testing",
  33039. fn: function (){
  33040. var self=this;
  33041. return false;
  33042. },
  33043. args: [],
  33044. source: "isSuperKeyword\x0a\x09^ false",
  33045. referencedClasses: [],
  33046. messageSends: []
  33047. }),
  33048. $globals.ASTNode);
  33049. $core.addMethod(
  33050. $core.method({
  33051. selector: "isValueNode",
  33052. protocol: "testing",
  33053. fn: function (){
  33054. var self=this;
  33055. return false;
  33056. },
  33057. args: [],
  33058. source: "isValueNode\x0a\x09^ false",
  33059. referencedClasses: [],
  33060. messageSends: []
  33061. }),
  33062. $globals.ASTNode);
  33063. $core.addMethod(
  33064. $core.method({
  33065. selector: "isVariableNode",
  33066. protocol: "testing",
  33067. fn: function (){
  33068. var self=this;
  33069. return false;
  33070. },
  33071. args: [],
  33072. source: "isVariableNode\x0a\x09^ false",
  33073. referencedClasses: [],
  33074. messageSends: []
  33075. }),
  33076. $globals.ASTNode);
  33077. $core.addMethod(
  33078. $core.method({
  33079. selector: "location:",
  33080. protocol: "accessing",
  33081. fn: function (aLocation){
  33082. var self=this;
  33083. return $core.withContext(function($ctx1) {
  33084. var $3,$2,$1;
  33085. $3=$recv(aLocation)._start();
  33086. $ctx1.sendIdx["start"]=1;
  33087. $2=$recv($3)._line();
  33088. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  33089. self._position_($1);
  33090. return self;
  33091. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.ASTNode)});
  33092. },
  33093. args: ["aLocation"],
  33094. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  33095. referencedClasses: [],
  33096. messageSends: ["position:", "@", "line", "start", "column"]
  33097. }),
  33098. $globals.ASTNode);
  33099. $core.addMethod(
  33100. $core.method({
  33101. selector: "method",
  33102. protocol: "accessing",
  33103. fn: function (){
  33104. var self=this;
  33105. return $core.withContext(function($ctx1) {
  33106. var $1,$receiver;
  33107. $1=self._parent();
  33108. if(($receiver = $1) == null || $receiver.isNil){
  33109. return $1;
  33110. } else {
  33111. var node;
  33112. node=$receiver;
  33113. return $recv(node)._method();
  33114. }
  33115. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTNode)});
  33116. },
  33117. args: [],
  33118. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  33119. referencedClasses: [],
  33120. messageSends: ["ifNotNil:", "parent", "method"]
  33121. }),
  33122. $globals.ASTNode);
  33123. $core.addMethod(
  33124. $core.method({
  33125. selector: "navigationNodeAt:ifAbsent:",
  33126. protocol: "accessing",
  33127. fn: function (aPoint,aBlock){
  33128. var self=this;
  33129. var children;
  33130. return $core.withContext(function($ctx1) {
  33131. var $2,$1;
  33132. var $early={};
  33133. try {
  33134. children=$recv(self._allDagChildren())._select_((function(each){
  33135. return $core.withContext(function($ctx2) {
  33136. return $recv($recv(each)._isNavigationNode())._and_((function(){
  33137. return $core.withContext(function($ctx3) {
  33138. return $recv(each)._inPosition_(aPoint);
  33139. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33140. }));
  33141. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33142. }));
  33143. $recv(children)._ifEmpty_((function(){
  33144. return $core.withContext(function($ctx2) {
  33145. throw $early=[$recv(aBlock)._value()];
  33146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  33147. }));
  33148. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  33149. return $core.withContext(function($ctx2) {
  33150. $2=$recv(a)._positionStart();
  33151. $ctx2.sendIdx["positionStart"]=1;
  33152. $1=$recv($2)._dist_(aPoint);
  33153. $ctx2.sendIdx["dist:"]=1;
  33154. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  33155. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  33156. })))._first();
  33157. }
  33158. catch(e) {if(e===$early)return e[0]; throw e}
  33159. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.ASTNode)});
  33160. },
  33161. args: ["aPoint", "aBlock"],
  33162. 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",
  33163. referencedClasses: [],
  33164. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  33165. }),
  33166. $globals.ASTNode);
  33167. $core.addMethod(
  33168. $core.method({
  33169. selector: "parent",
  33170. protocol: "accessing",
  33171. fn: function (){
  33172. var self=this;
  33173. return self["@parent"];
  33174. },
  33175. args: [],
  33176. source: "parent\x0a\x09^ parent",
  33177. referencedClasses: [],
  33178. messageSends: []
  33179. }),
  33180. $globals.ASTNode);
  33181. $core.addMethod(
  33182. $core.method({
  33183. selector: "parent:",
  33184. protocol: "accessing",
  33185. fn: function (aNode){
  33186. var self=this;
  33187. self["@parent"]=aNode;
  33188. return self;
  33189. },
  33190. args: ["aNode"],
  33191. source: "parent: aNode\x0a\x09parent := aNode",
  33192. referencedClasses: [],
  33193. messageSends: []
  33194. }),
  33195. $globals.ASTNode);
  33196. $core.addMethod(
  33197. $core.method({
  33198. selector: "position",
  33199. protocol: "accessing",
  33200. fn: function (){
  33201. var self=this;
  33202. return $core.withContext(function($ctx1) {
  33203. var $1,$2,$receiver;
  33204. $1=self["@position"];
  33205. if(($receiver = $1) == null || $receiver.isNil){
  33206. $2=self._parent();
  33207. if(($receiver = $2) == null || $receiver.isNil){
  33208. return $2;
  33209. } else {
  33210. var node;
  33211. node=$receiver;
  33212. return $recv(node)._position();
  33213. }
  33214. } else {
  33215. return $1;
  33216. }
  33217. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.ASTNode)});
  33218. },
  33219. args: [],
  33220. 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 ] ]",
  33221. referencedClasses: [],
  33222. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  33223. }),
  33224. $globals.ASTNode);
  33225. $core.addMethod(
  33226. $core.method({
  33227. selector: "position:",
  33228. protocol: "accessing",
  33229. fn: function (aPosition){
  33230. var self=this;
  33231. self["@position"]=aPosition;
  33232. return self;
  33233. },
  33234. args: ["aPosition"],
  33235. source: "position: aPosition\x0a\x09position := aPosition",
  33236. referencedClasses: [],
  33237. messageSends: []
  33238. }),
  33239. $globals.ASTNode);
  33240. $core.addMethod(
  33241. $core.method({
  33242. selector: "positionEnd",
  33243. protocol: "accessing",
  33244. fn: function (){
  33245. var self=this;
  33246. return $core.withContext(function($ctx1) {
  33247. var $1,$6,$5,$4,$3,$2;
  33248. $1=self._positionStart();
  33249. $6=self._source();
  33250. $ctx1.sendIdx["source"]=1;
  33251. $5=$recv($6)._lines();
  33252. $ctx1.sendIdx["lines"]=1;
  33253. $4=$recv($5)._size();
  33254. $ctx1.sendIdx["size"]=1;
  33255. $3=$recv($4).__minus((1));
  33256. $ctx1.sendIdx["-"]=1;
  33257. $2=$recv($3).__at($recv($recv($recv($recv(self._source())._lines())._last())._size()).__minus((1)));
  33258. return $recv($1).__plus($2);
  33259. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.ASTNode)});
  33260. },
  33261. args: [],
  33262. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  33263. referencedClasses: [],
  33264. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  33265. }),
  33266. $globals.ASTNode);
  33267. $core.addMethod(
  33268. $core.method({
  33269. selector: "positionStart",
  33270. protocol: "accessing",
  33271. fn: function (){
  33272. var self=this;
  33273. return $core.withContext(function($ctx1) {
  33274. return self._position();
  33275. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.ASTNode)});
  33276. },
  33277. args: [],
  33278. source: "positionStart\x0a\x09^ self position",
  33279. referencedClasses: [],
  33280. messageSends: ["position"]
  33281. }),
  33282. $globals.ASTNode);
  33283. $core.addMethod(
  33284. $core.method({
  33285. selector: "requiresSmalltalkContext",
  33286. protocol: "testing",
  33287. fn: function (){
  33288. var self=this;
  33289. return $core.withContext(function($ctx1) {
  33290. return $recv($recv(self._dagChildren())._detect_ifNone_((function(each){
  33291. return $core.withContext(function($ctx2) {
  33292. return $recv(each)._requiresSmalltalkContext();
  33293. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33294. }),(function(){
  33295. return nil;
  33296. })))._notNil();
  33297. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.ASTNode)});
  33298. },
  33299. args: [],
  33300. 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",
  33301. referencedClasses: [],
  33302. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  33303. }),
  33304. $globals.ASTNode);
  33305. $core.addMethod(
  33306. $core.method({
  33307. selector: "shouldBeAliased",
  33308. protocol: "accessing",
  33309. fn: function (){
  33310. var self=this;
  33311. return $core.withContext(function($ctx1) {
  33312. var $1,$receiver;
  33313. $1=self["@shouldBeAliased"];
  33314. if(($receiver = $1) == null || $receiver.isNil){
  33315. return false;
  33316. } else {
  33317. return $1;
  33318. }
  33319. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.ASTNode)});
  33320. },
  33321. args: [],
  33322. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  33323. referencedClasses: [],
  33324. messageSends: ["ifNil:"]
  33325. }),
  33326. $globals.ASTNode);
  33327. $core.addMethod(
  33328. $core.method({
  33329. selector: "shouldBeAliased:",
  33330. protocol: "accessing",
  33331. fn: function (aBoolean){
  33332. var self=this;
  33333. self["@shouldBeAliased"]=aBoolean;
  33334. return self;
  33335. },
  33336. args: ["aBoolean"],
  33337. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  33338. referencedClasses: [],
  33339. messageSends: []
  33340. }),
  33341. $globals.ASTNode);
  33342. $core.addMethod(
  33343. $core.method({
  33344. selector: "size",
  33345. protocol: "accessing",
  33346. fn: function (){
  33347. var self=this;
  33348. return $core.withContext(function($ctx1) {
  33349. return $recv(self._source())._size();
  33350. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.ASTNode)});
  33351. },
  33352. args: [],
  33353. source: "size\x0a\x09^ self source size",
  33354. referencedClasses: [],
  33355. messageSends: ["size", "source"]
  33356. }),
  33357. $globals.ASTNode);
  33358. $core.addMethod(
  33359. $core.method({
  33360. selector: "source",
  33361. protocol: "accessing",
  33362. fn: function (){
  33363. var self=this;
  33364. return $core.withContext(function($ctx1) {
  33365. var $1,$receiver;
  33366. $1=self["@source"];
  33367. if(($receiver = $1) == null || $receiver.isNil){
  33368. return "";
  33369. } else {
  33370. return $1;
  33371. }
  33372. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.ASTNode)});
  33373. },
  33374. args: [],
  33375. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33376. referencedClasses: [],
  33377. messageSends: ["ifNil:"]
  33378. }),
  33379. $globals.ASTNode);
  33380. $core.addMethod(
  33381. $core.method({
  33382. selector: "source:",
  33383. protocol: "accessing",
  33384. fn: function (aString){
  33385. var self=this;
  33386. self["@source"]=aString;
  33387. return self;
  33388. },
  33389. args: ["aString"],
  33390. source: "source: aString\x0a\x09source := aString",
  33391. referencedClasses: [],
  33392. messageSends: []
  33393. }),
  33394. $globals.ASTNode);
  33395. $core.addMethod(
  33396. $core.method({
  33397. selector: "withTail:",
  33398. protocol: "building",
  33399. fn: function (aCollection){
  33400. var self=this;
  33401. return $core.withContext(function($ctx1) {
  33402. var $1;
  33403. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  33404. return $core.withContext(function($ctx2) {
  33405. $1=$recv($globals.SendNode)._new();
  33406. $recv($1)._position_($recv(send)._position());
  33407. $recv($1)._source_($recv(send)._source());
  33408. $recv($1)._receiver_(receiver);
  33409. $recv($1)._selector_($recv(send)._selector());
  33410. $recv($1)._arguments_($recv(send)._arguments());
  33411. return $recv($1)._yourself();
  33412. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  33413. }));
  33414. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection},$globals.ASTNode)});
  33415. },
  33416. args: ["aCollection"],
  33417. 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 ]",
  33418. referencedClasses: ["SendNode"],
  33419. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  33420. }),
  33421. $globals.ASTNode);
  33422. $core.addClass("AssignmentNode", $globals.ASTNode, ["left", "right"], "Compiler-AST");
  33423. $globals.AssignmentNode.comment="I represent an assignment node.";
  33424. $core.addMethod(
  33425. $core.method({
  33426. selector: "acceptDagVisitor:",
  33427. protocol: "visiting",
  33428. fn: function (aVisitor){
  33429. var self=this;
  33430. return $core.withContext(function($ctx1) {
  33431. return $recv(aVisitor)._visitAssignmentNode_(self);
  33432. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  33433. },
  33434. args: ["aVisitor"],
  33435. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  33436. referencedClasses: [],
  33437. messageSends: ["visitAssignmentNode:"]
  33438. }),
  33439. $globals.AssignmentNode);
  33440. $core.addMethod(
  33441. $core.method({
  33442. selector: "dagChildren",
  33443. protocol: "accessing",
  33444. fn: function (){
  33445. var self=this;
  33446. return $core.withContext(function($ctx1) {
  33447. return $recv($globals.Array)._with_with_(self._left(),self._right());
  33448. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.AssignmentNode)});
  33449. },
  33450. args: [],
  33451. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  33452. referencedClasses: ["Array"],
  33453. messageSends: ["with:with:", "left", "right"]
  33454. }),
  33455. $globals.AssignmentNode);
  33456. $core.addMethod(
  33457. $core.method({
  33458. selector: "isAssignmentNode",
  33459. protocol: "testing",
  33460. fn: function (){
  33461. var self=this;
  33462. return true;
  33463. },
  33464. args: [],
  33465. source: "isAssignmentNode\x0a\x09^ true",
  33466. referencedClasses: [],
  33467. messageSends: []
  33468. }),
  33469. $globals.AssignmentNode);
  33470. $core.addMethod(
  33471. $core.method({
  33472. selector: "left",
  33473. protocol: "accessing",
  33474. fn: function (){
  33475. var self=this;
  33476. return self["@left"];
  33477. },
  33478. args: [],
  33479. source: "left\x0a\x09^ left",
  33480. referencedClasses: [],
  33481. messageSends: []
  33482. }),
  33483. $globals.AssignmentNode);
  33484. $core.addMethod(
  33485. $core.method({
  33486. selector: "left:",
  33487. protocol: "accessing",
  33488. fn: function (aNode){
  33489. var self=this;
  33490. self["@left"]=aNode;
  33491. return self;
  33492. },
  33493. args: ["aNode"],
  33494. source: "left: aNode\x0a\x09left := aNode",
  33495. referencedClasses: [],
  33496. messageSends: []
  33497. }),
  33498. $globals.AssignmentNode);
  33499. $core.addMethod(
  33500. $core.method({
  33501. selector: "right",
  33502. protocol: "accessing",
  33503. fn: function (){
  33504. var self=this;
  33505. return self["@right"];
  33506. },
  33507. args: [],
  33508. source: "right\x0a\x09^ right",
  33509. referencedClasses: [],
  33510. messageSends: []
  33511. }),
  33512. $globals.AssignmentNode);
  33513. $core.addMethod(
  33514. $core.method({
  33515. selector: "right:",
  33516. protocol: "accessing",
  33517. fn: function (aNode){
  33518. var self=this;
  33519. self["@right"]=aNode;
  33520. return self;
  33521. },
  33522. args: ["aNode"],
  33523. source: "right: aNode\x0a\x09right := aNode",
  33524. referencedClasses: [],
  33525. messageSends: []
  33526. }),
  33527. $globals.AssignmentNode);
  33528. $core.addClass("BlockNode", $globals.ASTNode, ["parameters", "scope"], "Compiler-AST");
  33529. $globals.BlockNode.comment="I represent an block closure node.";
  33530. $core.addMethod(
  33531. $core.method({
  33532. selector: "acceptDagVisitor:",
  33533. protocol: "visiting",
  33534. fn: function (aVisitor){
  33535. var self=this;
  33536. return $core.withContext(function($ctx1) {
  33537. return $recv(aVisitor)._visitBlockNode_(self);
  33538. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockNode)});
  33539. },
  33540. args: ["aVisitor"],
  33541. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  33542. referencedClasses: [],
  33543. messageSends: ["visitBlockNode:"]
  33544. }),
  33545. $globals.BlockNode);
  33546. $core.addMethod(
  33547. $core.method({
  33548. selector: "isBlockNode",
  33549. protocol: "testing",
  33550. fn: function (){
  33551. var self=this;
  33552. return true;
  33553. },
  33554. args: [],
  33555. source: "isBlockNode\x0a\x09^ true",
  33556. referencedClasses: [],
  33557. messageSends: []
  33558. }),
  33559. $globals.BlockNode);
  33560. $core.addMethod(
  33561. $core.method({
  33562. selector: "parameters",
  33563. protocol: "accessing",
  33564. fn: function (){
  33565. var self=this;
  33566. return $core.withContext(function($ctx1) {
  33567. var $1,$receiver;
  33568. $1=self["@parameters"];
  33569. if(($receiver = $1) == null || $receiver.isNil){
  33570. self["@parameters"]=$recv($globals.Array)._new();
  33571. return self["@parameters"];
  33572. } else {
  33573. return $1;
  33574. }
  33575. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  33576. },
  33577. args: [],
  33578. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  33579. referencedClasses: ["Array"],
  33580. messageSends: ["ifNil:", "new"]
  33581. }),
  33582. $globals.BlockNode);
  33583. $core.addMethod(
  33584. $core.method({
  33585. selector: "parameters:",
  33586. protocol: "accessing",
  33587. fn: function (aCollection){
  33588. var self=this;
  33589. self["@parameters"]=aCollection;
  33590. return self;
  33591. },
  33592. args: ["aCollection"],
  33593. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  33594. referencedClasses: [],
  33595. messageSends: []
  33596. }),
  33597. $globals.BlockNode);
  33598. $core.addMethod(
  33599. $core.method({
  33600. selector: "scope",
  33601. protocol: "accessing",
  33602. fn: function (){
  33603. var self=this;
  33604. return self["@scope"];
  33605. },
  33606. args: [],
  33607. source: "scope\x0a\x09^ scope",
  33608. referencedClasses: [],
  33609. messageSends: []
  33610. }),
  33611. $globals.BlockNode);
  33612. $core.addMethod(
  33613. $core.method({
  33614. selector: "scope:",
  33615. protocol: "accessing",
  33616. fn: function (aLexicalScope){
  33617. var self=this;
  33618. self["@scope"]=aLexicalScope;
  33619. return self;
  33620. },
  33621. args: ["aLexicalScope"],
  33622. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  33623. referencedClasses: [],
  33624. messageSends: []
  33625. }),
  33626. $globals.BlockNode);
  33627. $core.addClass("CascadeNode", $globals.ASTNode, ["receiver"], "Compiler-AST");
  33628. $globals.CascadeNode.comment="I represent an cascade node.";
  33629. $core.addMethod(
  33630. $core.method({
  33631. selector: "acceptDagVisitor:",
  33632. protocol: "visiting",
  33633. fn: function (aVisitor){
  33634. var self=this;
  33635. return $core.withContext(function($ctx1) {
  33636. return $recv(aVisitor)._visitCascadeNode_(self);
  33637. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.CascadeNode)});
  33638. },
  33639. args: ["aVisitor"],
  33640. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  33641. referencedClasses: [],
  33642. messageSends: ["visitCascadeNode:"]
  33643. }),
  33644. $globals.CascadeNode);
  33645. $core.addMethod(
  33646. $core.method({
  33647. selector: "isCascadeNode",
  33648. protocol: "testing",
  33649. fn: function (){
  33650. var self=this;
  33651. return true;
  33652. },
  33653. args: [],
  33654. source: "isCascadeNode\x0a\x09^ true",
  33655. referencedClasses: [],
  33656. messageSends: []
  33657. }),
  33658. $globals.CascadeNode);
  33659. $core.addMethod(
  33660. $core.method({
  33661. selector: "receiver",
  33662. protocol: "accessing",
  33663. fn: function (){
  33664. var self=this;
  33665. return self["@receiver"];
  33666. },
  33667. args: [],
  33668. source: "receiver\x0a\x09^ receiver",
  33669. referencedClasses: [],
  33670. messageSends: []
  33671. }),
  33672. $globals.CascadeNode);
  33673. $core.addMethod(
  33674. $core.method({
  33675. selector: "receiver:",
  33676. protocol: "accessing",
  33677. fn: function (aNode){
  33678. var self=this;
  33679. self["@receiver"]=aNode;
  33680. return self;
  33681. },
  33682. args: ["aNode"],
  33683. source: "receiver: aNode\x0a\x09receiver := aNode",
  33684. referencedClasses: [],
  33685. messageSends: []
  33686. }),
  33687. $globals.CascadeNode);
  33688. $core.addClass("DynamicArrayNode", $globals.ASTNode, [], "Compiler-AST");
  33689. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  33690. $core.addMethod(
  33691. $core.method({
  33692. selector: "acceptDagVisitor:",
  33693. protocol: "visiting",
  33694. fn: function (aVisitor){
  33695. var self=this;
  33696. return $core.withContext(function($ctx1) {
  33697. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  33698. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  33699. },
  33700. args: ["aVisitor"],
  33701. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  33702. referencedClasses: [],
  33703. messageSends: ["visitDynamicArrayNode:"]
  33704. }),
  33705. $globals.DynamicArrayNode);
  33706. $core.addClass("DynamicDictionaryNode", $globals.ASTNode, [], "Compiler-AST");
  33707. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  33708. $core.addMethod(
  33709. $core.method({
  33710. selector: "acceptDagVisitor:",
  33711. protocol: "visiting",
  33712. fn: function (aVisitor){
  33713. var self=this;
  33714. return $core.withContext(function($ctx1) {
  33715. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  33716. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  33717. },
  33718. args: ["aVisitor"],
  33719. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  33720. referencedClasses: [],
  33721. messageSends: ["visitDynamicDictionaryNode:"]
  33722. }),
  33723. $globals.DynamicDictionaryNode);
  33724. $core.addClass("JSStatementNode", $globals.ASTNode, [], "Compiler-AST");
  33725. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  33726. $core.addMethod(
  33727. $core.method({
  33728. selector: "acceptDagVisitor:",
  33729. protocol: "visiting",
  33730. fn: function (aVisitor){
  33731. var self=this;
  33732. return $core.withContext(function($ctx1) {
  33733. return $recv(aVisitor)._visitJSStatementNode_(self);
  33734. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  33735. },
  33736. args: ["aVisitor"],
  33737. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  33738. referencedClasses: [],
  33739. messageSends: ["visitJSStatementNode:"]
  33740. }),
  33741. $globals.JSStatementNode);
  33742. $core.addMethod(
  33743. $core.method({
  33744. selector: "isJSStatementNode",
  33745. protocol: "testing",
  33746. fn: function (){
  33747. var self=this;
  33748. return true;
  33749. },
  33750. args: [],
  33751. source: "isJSStatementNode\x0a\x09^ true",
  33752. referencedClasses: [],
  33753. messageSends: []
  33754. }),
  33755. $globals.JSStatementNode);
  33756. $core.addMethod(
  33757. $core.method({
  33758. selector: "requiresSmalltalkContext",
  33759. protocol: "testing",
  33760. fn: function (){
  33761. var self=this;
  33762. return true;
  33763. },
  33764. args: [],
  33765. source: "requiresSmalltalkContext\x0a\x09^ true",
  33766. referencedClasses: [],
  33767. messageSends: []
  33768. }),
  33769. $globals.JSStatementNode);
  33770. $core.addClass("MethodNode", $globals.ASTNode, ["selector", "arguments", "source", "scope", "classReferences", "sendIndexes"], "Compiler-AST");
  33771. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  33772. $core.addMethod(
  33773. $core.method({
  33774. selector: "acceptDagVisitor:",
  33775. protocol: "visiting",
  33776. fn: function (aVisitor){
  33777. var self=this;
  33778. return $core.withContext(function($ctx1) {
  33779. return $recv(aVisitor)._visitMethodNode_(self);
  33780. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.MethodNode)});
  33781. },
  33782. args: ["aVisitor"],
  33783. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  33784. referencedClasses: [],
  33785. messageSends: ["visitMethodNode:"]
  33786. }),
  33787. $globals.MethodNode);
  33788. $core.addMethod(
  33789. $core.method({
  33790. selector: "arguments",
  33791. protocol: "accessing",
  33792. fn: function (){
  33793. var self=this;
  33794. return $core.withContext(function($ctx1) {
  33795. var $1,$receiver;
  33796. $1=self["@arguments"];
  33797. if(($receiver = $1) == null || $receiver.isNil){
  33798. return [];
  33799. } else {
  33800. return $1;
  33801. }
  33802. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  33803. },
  33804. args: [],
  33805. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  33806. referencedClasses: [],
  33807. messageSends: ["ifNil:"]
  33808. }),
  33809. $globals.MethodNode);
  33810. $core.addMethod(
  33811. $core.method({
  33812. selector: "arguments:",
  33813. protocol: "accessing",
  33814. fn: function (aCollection){
  33815. var self=this;
  33816. self["@arguments"]=aCollection;
  33817. return self;
  33818. },
  33819. args: ["aCollection"],
  33820. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  33821. referencedClasses: [],
  33822. messageSends: []
  33823. }),
  33824. $globals.MethodNode);
  33825. $core.addMethod(
  33826. $core.method({
  33827. selector: "classReferences",
  33828. protocol: "accessing",
  33829. fn: function (){
  33830. var self=this;
  33831. return self["@classReferences"];
  33832. },
  33833. args: [],
  33834. source: "classReferences\x0a\x09^ classReferences",
  33835. referencedClasses: [],
  33836. messageSends: []
  33837. }),
  33838. $globals.MethodNode);
  33839. $core.addMethod(
  33840. $core.method({
  33841. selector: "classReferences:",
  33842. protocol: "accessing",
  33843. fn: function (aCollection){
  33844. var self=this;
  33845. self["@classReferences"]=aCollection;
  33846. return self;
  33847. },
  33848. args: ["aCollection"],
  33849. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  33850. referencedClasses: [],
  33851. messageSends: []
  33852. }),
  33853. $globals.MethodNode);
  33854. $core.addMethod(
  33855. $core.method({
  33856. selector: "messageSends",
  33857. protocol: "accessing",
  33858. fn: function (){
  33859. var self=this;
  33860. return $core.withContext(function($ctx1) {
  33861. return $recv(self._sendIndexes())._keys();
  33862. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  33863. },
  33864. args: [],
  33865. source: "messageSends\x0a\x09^ self sendIndexes keys",
  33866. referencedClasses: [],
  33867. messageSends: ["keys", "sendIndexes"]
  33868. }),
  33869. $globals.MethodNode);
  33870. $core.addMethod(
  33871. $core.method({
  33872. selector: "method",
  33873. protocol: "accessing",
  33874. fn: function (){
  33875. var self=this;
  33876. return self;
  33877. },
  33878. args: [],
  33879. source: "method\x0a\x09^ self",
  33880. referencedClasses: [],
  33881. messageSends: []
  33882. }),
  33883. $globals.MethodNode);
  33884. $core.addMethod(
  33885. $core.method({
  33886. selector: "scope",
  33887. protocol: "accessing",
  33888. fn: function (){
  33889. var self=this;
  33890. return self["@scope"];
  33891. },
  33892. args: [],
  33893. source: "scope\x0a\x09^ scope",
  33894. referencedClasses: [],
  33895. messageSends: []
  33896. }),
  33897. $globals.MethodNode);
  33898. $core.addMethod(
  33899. $core.method({
  33900. selector: "scope:",
  33901. protocol: "accessing",
  33902. fn: function (aMethodScope){
  33903. var self=this;
  33904. self["@scope"]=aMethodScope;
  33905. return self;
  33906. },
  33907. args: ["aMethodScope"],
  33908. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  33909. referencedClasses: [],
  33910. messageSends: []
  33911. }),
  33912. $globals.MethodNode);
  33913. $core.addMethod(
  33914. $core.method({
  33915. selector: "selector",
  33916. protocol: "accessing",
  33917. fn: function (){
  33918. var self=this;
  33919. return self["@selector"];
  33920. },
  33921. args: [],
  33922. source: "selector\x0a\x09^ selector",
  33923. referencedClasses: [],
  33924. messageSends: []
  33925. }),
  33926. $globals.MethodNode);
  33927. $core.addMethod(
  33928. $core.method({
  33929. selector: "selector:",
  33930. protocol: "accessing",
  33931. fn: function (aString){
  33932. var self=this;
  33933. self["@selector"]=aString;
  33934. return self;
  33935. },
  33936. args: ["aString"],
  33937. source: "selector: aString\x0a\x09selector := aString",
  33938. referencedClasses: [],
  33939. messageSends: []
  33940. }),
  33941. $globals.MethodNode);
  33942. $core.addMethod(
  33943. $core.method({
  33944. selector: "sendIndexes",
  33945. protocol: "accessing",
  33946. fn: function (){
  33947. var self=this;
  33948. return self["@sendIndexes"];
  33949. },
  33950. args: [],
  33951. source: "sendIndexes\x0a\x09^ sendIndexes",
  33952. referencedClasses: [],
  33953. messageSends: []
  33954. }),
  33955. $globals.MethodNode);
  33956. $core.addMethod(
  33957. $core.method({
  33958. selector: "sendIndexes:",
  33959. protocol: "accessing",
  33960. fn: function (aDictionary){
  33961. var self=this;
  33962. self["@sendIndexes"]=aDictionary;
  33963. return self;
  33964. },
  33965. args: ["aDictionary"],
  33966. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  33967. referencedClasses: [],
  33968. messageSends: []
  33969. }),
  33970. $globals.MethodNode);
  33971. $core.addMethod(
  33972. $core.method({
  33973. selector: "sequenceNode",
  33974. protocol: "accessing",
  33975. fn: function (){
  33976. var self=this;
  33977. return $core.withContext(function($ctx1) {
  33978. var $1;
  33979. var $early={};
  33980. try {
  33981. $recv(self._dagChildren())._do_((function(each){
  33982. return $core.withContext(function($ctx2) {
  33983. $1=$recv(each)._isSequenceNode();
  33984. if($core.assert($1)){
  33985. throw $early=[each];
  33986. }
  33987. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33988. }));
  33989. return nil;
  33990. }
  33991. catch(e) {if(e===$early)return e[0]; throw e}
  33992. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  33993. },
  33994. args: [],
  33995. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  33996. referencedClasses: [],
  33997. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  33998. }),
  33999. $globals.MethodNode);
  34000. $core.addMethod(
  34001. $core.method({
  34002. selector: "source",
  34003. protocol: "accessing",
  34004. fn: function (){
  34005. var self=this;
  34006. return self["@source"];
  34007. },
  34008. args: [],
  34009. source: "source\x0a\x09^ source",
  34010. referencedClasses: [],
  34011. messageSends: []
  34012. }),
  34013. $globals.MethodNode);
  34014. $core.addMethod(
  34015. $core.method({
  34016. selector: "source:",
  34017. protocol: "accessing",
  34018. fn: function (aString){
  34019. var self=this;
  34020. self["@source"]=aString;
  34021. return self;
  34022. },
  34023. args: ["aString"],
  34024. source: "source: aString\x0a\x09source := aString",
  34025. referencedClasses: [],
  34026. messageSends: []
  34027. }),
  34028. $globals.MethodNode);
  34029. $core.addClass("ReturnNode", $globals.ASTNode, ["scope"], "Compiler-AST");
  34030. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  34031. $core.addMethod(
  34032. $core.method({
  34033. selector: "acceptDagVisitor:",
  34034. protocol: "visiting",
  34035. fn: function (aVisitor){
  34036. var self=this;
  34037. return $core.withContext(function($ctx1) {
  34038. return $recv(aVisitor)._visitReturnNode_(self);
  34039. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ReturnNode)});
  34040. },
  34041. args: ["aVisitor"],
  34042. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  34043. referencedClasses: [],
  34044. messageSends: ["visitReturnNode:"]
  34045. }),
  34046. $globals.ReturnNode);
  34047. $core.addMethod(
  34048. $core.method({
  34049. selector: "isReturnNode",
  34050. protocol: "testing",
  34051. fn: function (){
  34052. var self=this;
  34053. return true;
  34054. },
  34055. args: [],
  34056. source: "isReturnNode\x0a\x09^ true",
  34057. referencedClasses: [],
  34058. messageSends: []
  34059. }),
  34060. $globals.ReturnNode);
  34061. $core.addMethod(
  34062. $core.method({
  34063. selector: "nonLocalReturn",
  34064. protocol: "testing",
  34065. fn: function (){
  34066. var self=this;
  34067. return $core.withContext(function($ctx1) {
  34068. return $recv($recv(self._scope())._isMethodScope())._not();
  34069. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  34070. },
  34071. args: [],
  34072. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  34073. referencedClasses: [],
  34074. messageSends: ["not", "isMethodScope", "scope"]
  34075. }),
  34076. $globals.ReturnNode);
  34077. $core.addMethod(
  34078. $core.method({
  34079. selector: "scope",
  34080. protocol: "accessing",
  34081. fn: function (){
  34082. var self=this;
  34083. return self["@scope"];
  34084. },
  34085. args: [],
  34086. source: "scope\x0a\x09^ scope",
  34087. referencedClasses: [],
  34088. messageSends: []
  34089. }),
  34090. $globals.ReturnNode);
  34091. $core.addMethod(
  34092. $core.method({
  34093. selector: "scope:",
  34094. protocol: "accessing",
  34095. fn: function (aLexicalScope){
  34096. var self=this;
  34097. self["@scope"]=aLexicalScope;
  34098. return self;
  34099. },
  34100. args: ["aLexicalScope"],
  34101. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34102. referencedClasses: [],
  34103. messageSends: []
  34104. }),
  34105. $globals.ReturnNode);
  34106. $core.addClass("SendNode", $globals.ASTNode, ["selector", "arguments", "receiver", "index", "shouldBeInlined"], "Compiler-AST");
  34107. $globals.SendNode.comment="I represent an message send node.";
  34108. $core.addMethod(
  34109. $core.method({
  34110. selector: "acceptDagVisitor:",
  34111. protocol: "visiting",
  34112. fn: function (aVisitor){
  34113. var self=this;
  34114. return $core.withContext(function($ctx1) {
  34115. return $recv(aVisitor)._visitSendNode_(self);
  34116. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SendNode)});
  34117. },
  34118. args: ["aVisitor"],
  34119. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  34120. referencedClasses: [],
  34121. messageSends: ["visitSendNode:"]
  34122. }),
  34123. $globals.SendNode);
  34124. $core.addMethod(
  34125. $core.method({
  34126. selector: "arguments",
  34127. protocol: "accessing",
  34128. fn: function (){
  34129. var self=this;
  34130. return $core.withContext(function($ctx1) {
  34131. var $1,$receiver;
  34132. $1=self["@arguments"];
  34133. if(($receiver = $1) == null || $receiver.isNil){
  34134. self["@arguments"]=[];
  34135. return self["@arguments"];
  34136. } else {
  34137. return $1;
  34138. }
  34139. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  34140. },
  34141. args: [],
  34142. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  34143. referencedClasses: [],
  34144. messageSends: ["ifNil:"]
  34145. }),
  34146. $globals.SendNode);
  34147. $core.addMethod(
  34148. $core.method({
  34149. selector: "arguments:",
  34150. protocol: "accessing",
  34151. fn: function (aCollection){
  34152. var self=this;
  34153. self["@arguments"]=aCollection;
  34154. return self;
  34155. },
  34156. args: ["aCollection"],
  34157. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34158. referencedClasses: [],
  34159. messageSends: []
  34160. }),
  34161. $globals.SendNode);
  34162. $core.addMethod(
  34163. $core.method({
  34164. selector: "dagChildren",
  34165. protocol: "accessing",
  34166. fn: function (){
  34167. var self=this;
  34168. return $core.withContext(function($ctx1) {
  34169. var $1,$2,$3,$receiver;
  34170. $1=self._receiver();
  34171. $ctx1.sendIdx["receiver"]=1;
  34172. if(($receiver = $1) == null || $receiver.isNil){
  34173. $2=self._arguments();
  34174. $ctx1.sendIdx["arguments"]=1;
  34175. return $recv($2)._copy();
  34176. } else {
  34177. $1;
  34178. }
  34179. $3=$recv($globals.Array)._with_(self._receiver());
  34180. $recv($3)._addAll_(self._arguments());
  34181. return $recv($3)._yourself();
  34182. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.SendNode)});
  34183. },
  34184. args: [],
  34185. 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",
  34186. referencedClasses: ["Array"],
  34187. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  34188. }),
  34189. $globals.SendNode);
  34190. $core.addMethod(
  34191. $core.method({
  34192. selector: "index",
  34193. protocol: "accessing",
  34194. fn: function (){
  34195. var self=this;
  34196. return self["@index"];
  34197. },
  34198. args: [],
  34199. source: "index\x0a\x09^ index",
  34200. referencedClasses: [],
  34201. messageSends: []
  34202. }),
  34203. $globals.SendNode);
  34204. $core.addMethod(
  34205. $core.method({
  34206. selector: "index:",
  34207. protocol: "accessing",
  34208. fn: function (anInteger){
  34209. var self=this;
  34210. self["@index"]=anInteger;
  34211. return self;
  34212. },
  34213. args: ["anInteger"],
  34214. source: "index: anInteger\x0a\x09index := anInteger",
  34215. referencedClasses: [],
  34216. messageSends: []
  34217. }),
  34218. $globals.SendNode);
  34219. $core.addMethod(
  34220. $core.method({
  34221. selector: "isNavigationNode",
  34222. protocol: "testing",
  34223. fn: function (){
  34224. var self=this;
  34225. return true;
  34226. },
  34227. args: [],
  34228. source: "isNavigationNode\x0a\x09^ true",
  34229. referencedClasses: [],
  34230. messageSends: []
  34231. }),
  34232. $globals.SendNode);
  34233. $core.addMethod(
  34234. $core.method({
  34235. selector: "isSendNode",
  34236. protocol: "testing",
  34237. fn: function (){
  34238. var self=this;
  34239. return true;
  34240. },
  34241. args: [],
  34242. source: "isSendNode\x0a\x09^ true",
  34243. referencedClasses: [],
  34244. messageSends: []
  34245. }),
  34246. $globals.SendNode);
  34247. $core.addMethod(
  34248. $core.method({
  34249. selector: "navigationLink",
  34250. protocol: "accessing",
  34251. fn: function (){
  34252. var self=this;
  34253. return $core.withContext(function($ctx1) {
  34254. return self._selector();
  34255. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  34256. },
  34257. args: [],
  34258. source: "navigationLink\x0a\x09^ self selector",
  34259. referencedClasses: [],
  34260. messageSends: ["selector"]
  34261. }),
  34262. $globals.SendNode);
  34263. $core.addMethod(
  34264. $core.method({
  34265. selector: "receiver",
  34266. protocol: "accessing",
  34267. fn: function (){
  34268. var self=this;
  34269. return self["@receiver"];
  34270. },
  34271. args: [],
  34272. source: "receiver\x0a\x09^ receiver",
  34273. referencedClasses: [],
  34274. messageSends: []
  34275. }),
  34276. $globals.SendNode);
  34277. $core.addMethod(
  34278. $core.method({
  34279. selector: "receiver:",
  34280. protocol: "accessing",
  34281. fn: function (aNode){
  34282. var self=this;
  34283. self["@receiver"]=aNode;
  34284. return self;
  34285. },
  34286. args: ["aNode"],
  34287. source: "receiver: aNode\x0a\x09receiver := aNode",
  34288. referencedClasses: [],
  34289. messageSends: []
  34290. }),
  34291. $globals.SendNode);
  34292. $core.addMethod(
  34293. $core.method({
  34294. selector: "requiresSmalltalkContext",
  34295. protocol: "testing",
  34296. fn: function (){
  34297. var self=this;
  34298. return true;
  34299. },
  34300. args: [],
  34301. source: "requiresSmalltalkContext\x0a\x09^ true",
  34302. referencedClasses: [],
  34303. messageSends: []
  34304. }),
  34305. $globals.SendNode);
  34306. $core.addMethod(
  34307. $core.method({
  34308. selector: "selector",
  34309. protocol: "accessing",
  34310. fn: function (){
  34311. var self=this;
  34312. return self["@selector"];
  34313. },
  34314. args: [],
  34315. source: "selector\x0a\x09^ selector",
  34316. referencedClasses: [],
  34317. messageSends: []
  34318. }),
  34319. $globals.SendNode);
  34320. $core.addMethod(
  34321. $core.method({
  34322. selector: "selector:",
  34323. protocol: "accessing",
  34324. fn: function (aString){
  34325. var self=this;
  34326. self["@selector"]=aString;
  34327. return self;
  34328. },
  34329. args: ["aString"],
  34330. source: "selector: aString\x0a\x09selector := aString",
  34331. referencedClasses: [],
  34332. messageSends: []
  34333. }),
  34334. $globals.SendNode);
  34335. $core.addMethod(
  34336. $core.method({
  34337. selector: "shouldBeInlined",
  34338. protocol: "accessing",
  34339. fn: function (){
  34340. var self=this;
  34341. return $core.withContext(function($ctx1) {
  34342. var $1,$receiver;
  34343. $1=self["@shouldBeInlined"];
  34344. if(($receiver = $1) == null || $receiver.isNil){
  34345. return false;
  34346. } else {
  34347. return $1;
  34348. }
  34349. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.SendNode)});
  34350. },
  34351. args: [],
  34352. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  34353. referencedClasses: [],
  34354. messageSends: ["ifNil:"]
  34355. }),
  34356. $globals.SendNode);
  34357. $core.addMethod(
  34358. $core.method({
  34359. selector: "shouldBeInlined:",
  34360. protocol: "accessing",
  34361. fn: function (aBoolean){
  34362. var self=this;
  34363. self["@shouldBeInlined"]=aBoolean;
  34364. return self;
  34365. },
  34366. args: ["aBoolean"],
  34367. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  34368. referencedClasses: [],
  34369. messageSends: []
  34370. }),
  34371. $globals.SendNode);
  34372. $core.addMethod(
  34373. $core.method({
  34374. selector: "superSend",
  34375. protocol: "accessing",
  34376. fn: function (){
  34377. var self=this;
  34378. return $core.withContext(function($ctx1) {
  34379. var $2,$1;
  34380. $2=self._receiver();
  34381. $ctx1.sendIdx["receiver"]=1;
  34382. $1=$recv($2)._notNil();
  34383. return $recv($1)._and_((function(){
  34384. return $core.withContext(function($ctx2) {
  34385. return $recv(self._receiver())._isSuperKeyword();
  34386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34387. }));
  34388. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  34389. },
  34390. args: [],
  34391. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  34392. referencedClasses: [],
  34393. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  34394. }),
  34395. $globals.SendNode);
  34396. $core.addClass("SequenceNode", $globals.ASTNode, ["temps", "scope"], "Compiler-AST");
  34397. $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).";
  34398. $core.addMethod(
  34399. $core.method({
  34400. selector: "acceptDagVisitor:",
  34401. protocol: "visiting",
  34402. fn: function (aVisitor){
  34403. var self=this;
  34404. return $core.withContext(function($ctx1) {
  34405. return $recv(aVisitor)._visitSequenceNode_(self);
  34406. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SequenceNode)});
  34407. },
  34408. args: ["aVisitor"],
  34409. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  34410. referencedClasses: [],
  34411. messageSends: ["visitSequenceNode:"]
  34412. }),
  34413. $globals.SequenceNode);
  34414. $core.addMethod(
  34415. $core.method({
  34416. selector: "asBlockSequenceNode",
  34417. protocol: "building",
  34418. fn: function (){
  34419. var self=this;
  34420. return $core.withContext(function($ctx1) {
  34421. var $1;
  34422. $1=$recv($globals.BlockSequenceNode)._new();
  34423. $recv($1)._position_(self._position());
  34424. $recv($1)._source_(self._source());
  34425. $recv($1)._dagChildren_(self._dagChildren());
  34426. $recv($1)._temps_(self._temps());
  34427. return $recv($1)._yourself();
  34428. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  34429. },
  34430. args: [],
  34431. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09dagChildren: self dagChildren;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself",
  34432. referencedClasses: ["BlockSequenceNode"],
  34433. messageSends: ["position:", "new", "position", "source:", "source", "dagChildren:", "dagChildren", "temps:", "temps", "yourself"]
  34434. }),
  34435. $globals.SequenceNode);
  34436. $core.addMethod(
  34437. $core.method({
  34438. selector: "isSequenceNode",
  34439. protocol: "testing",
  34440. fn: function (){
  34441. var self=this;
  34442. return true;
  34443. },
  34444. args: [],
  34445. source: "isSequenceNode\x0a\x09^ true",
  34446. referencedClasses: [],
  34447. messageSends: []
  34448. }),
  34449. $globals.SequenceNode);
  34450. $core.addMethod(
  34451. $core.method({
  34452. selector: "scope",
  34453. protocol: "accessing",
  34454. fn: function (){
  34455. var self=this;
  34456. return self["@scope"];
  34457. },
  34458. args: [],
  34459. source: "scope\x0a\x09^ scope",
  34460. referencedClasses: [],
  34461. messageSends: []
  34462. }),
  34463. $globals.SequenceNode);
  34464. $core.addMethod(
  34465. $core.method({
  34466. selector: "scope:",
  34467. protocol: "accessing",
  34468. fn: function (aLexicalScope){
  34469. var self=this;
  34470. self["@scope"]=aLexicalScope;
  34471. return self;
  34472. },
  34473. args: ["aLexicalScope"],
  34474. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34475. referencedClasses: [],
  34476. messageSends: []
  34477. }),
  34478. $globals.SequenceNode);
  34479. $core.addMethod(
  34480. $core.method({
  34481. selector: "temps",
  34482. protocol: "accessing",
  34483. fn: function (){
  34484. var self=this;
  34485. return $core.withContext(function($ctx1) {
  34486. var $1,$receiver;
  34487. $1=self["@temps"];
  34488. if(($receiver = $1) == null || $receiver.isNil){
  34489. return [];
  34490. } else {
  34491. return $1;
  34492. }
  34493. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  34494. },
  34495. args: [],
  34496. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  34497. referencedClasses: [],
  34498. messageSends: ["ifNil:"]
  34499. }),
  34500. $globals.SequenceNode);
  34501. $core.addMethod(
  34502. $core.method({
  34503. selector: "temps:",
  34504. protocol: "accessing",
  34505. fn: function (aCollection){
  34506. var self=this;
  34507. self["@temps"]=aCollection;
  34508. return self;
  34509. },
  34510. args: ["aCollection"],
  34511. source: "temps: aCollection\x0a\x09temps := aCollection",
  34512. referencedClasses: [],
  34513. messageSends: []
  34514. }),
  34515. $globals.SequenceNode);
  34516. $core.addClass("BlockSequenceNode", $globals.SequenceNode, [], "Compiler-AST");
  34517. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  34518. $core.addMethod(
  34519. $core.method({
  34520. selector: "acceptDagVisitor:",
  34521. protocol: "visiting",
  34522. fn: function (aVisitor){
  34523. var self=this;
  34524. return $core.withContext(function($ctx1) {
  34525. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  34526. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  34527. },
  34528. args: ["aVisitor"],
  34529. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  34530. referencedClasses: [],
  34531. messageSends: ["visitBlockSequenceNode:"]
  34532. }),
  34533. $globals.BlockSequenceNode);
  34534. $core.addMethod(
  34535. $core.method({
  34536. selector: "isBlockSequenceNode",
  34537. protocol: "testing",
  34538. fn: function (){
  34539. var self=this;
  34540. return true;
  34541. },
  34542. args: [],
  34543. source: "isBlockSequenceNode\x0a\x09^ true",
  34544. referencedClasses: [],
  34545. messageSends: []
  34546. }),
  34547. $globals.BlockSequenceNode);
  34548. $core.addClass("ValueNode", $globals.ASTNode, ["value"], "Compiler-AST");
  34549. $globals.ValueNode.comment="I represent a value node.";
  34550. $core.addMethod(
  34551. $core.method({
  34552. selector: "acceptDagVisitor:",
  34553. protocol: "visiting",
  34554. fn: function (aVisitor){
  34555. var self=this;
  34556. return $core.withContext(function($ctx1) {
  34557. return $recv(aVisitor)._visitValueNode_(self);
  34558. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ValueNode)});
  34559. },
  34560. args: ["aVisitor"],
  34561. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  34562. referencedClasses: [],
  34563. messageSends: ["visitValueNode:"]
  34564. }),
  34565. $globals.ValueNode);
  34566. $core.addMethod(
  34567. $core.method({
  34568. selector: "isImmutable",
  34569. protocol: "testing",
  34570. fn: function (){
  34571. var self=this;
  34572. return $core.withContext(function($ctx1) {
  34573. return $recv(self._value())._isImmutable();
  34574. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  34575. },
  34576. args: [],
  34577. source: "isImmutable\x0a\x09^ self value isImmutable",
  34578. referencedClasses: [],
  34579. messageSends: ["isImmutable", "value"]
  34580. }),
  34581. $globals.ValueNode);
  34582. $core.addMethod(
  34583. $core.method({
  34584. selector: "isValueNode",
  34585. protocol: "testing",
  34586. fn: function (){
  34587. var self=this;
  34588. return true;
  34589. },
  34590. args: [],
  34591. source: "isValueNode\x0a\x09^ true",
  34592. referencedClasses: [],
  34593. messageSends: []
  34594. }),
  34595. $globals.ValueNode);
  34596. $core.addMethod(
  34597. $core.method({
  34598. selector: "value",
  34599. protocol: "accessing",
  34600. fn: function (){
  34601. var self=this;
  34602. return self["@value"];
  34603. },
  34604. args: [],
  34605. source: "value\x0a\x09^ value",
  34606. referencedClasses: [],
  34607. messageSends: []
  34608. }),
  34609. $globals.ValueNode);
  34610. $core.addMethod(
  34611. $core.method({
  34612. selector: "value:",
  34613. protocol: "accessing",
  34614. fn: function (anObject){
  34615. var self=this;
  34616. self["@value"]=anObject;
  34617. return self;
  34618. },
  34619. args: ["anObject"],
  34620. source: "value: anObject\x0a\x09value := anObject",
  34621. referencedClasses: [],
  34622. messageSends: []
  34623. }),
  34624. $globals.ValueNode);
  34625. $core.addClass("VariableNode", $globals.ValueNode, ["assigned", "binding"], "Compiler-AST");
  34626. $globals.VariableNode.comment="I represent an variable node.";
  34627. $core.addMethod(
  34628. $core.method({
  34629. selector: "acceptDagVisitor:",
  34630. protocol: "visiting",
  34631. fn: function (aVisitor){
  34632. var self=this;
  34633. return $core.withContext(function($ctx1) {
  34634. return $recv(aVisitor)._visitVariableNode_(self);
  34635. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.VariableNode)});
  34636. },
  34637. args: ["aVisitor"],
  34638. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  34639. referencedClasses: [],
  34640. messageSends: ["visitVariableNode:"]
  34641. }),
  34642. $globals.VariableNode);
  34643. $core.addMethod(
  34644. $core.method({
  34645. selector: "alias",
  34646. protocol: "accessing",
  34647. fn: function (){
  34648. var self=this;
  34649. return $core.withContext(function($ctx1) {
  34650. return $recv(self._binding())._alias();
  34651. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  34652. },
  34653. args: [],
  34654. source: "alias\x0a\x09^ self binding alias",
  34655. referencedClasses: [],
  34656. messageSends: ["alias", "binding"]
  34657. }),
  34658. $globals.VariableNode);
  34659. $core.addMethod(
  34660. $core.method({
  34661. selector: "assigned",
  34662. protocol: "accessing",
  34663. fn: function (){
  34664. var self=this;
  34665. return $core.withContext(function($ctx1) {
  34666. var $1,$receiver;
  34667. $1=self["@assigned"];
  34668. if(($receiver = $1) == null || $receiver.isNil){
  34669. return false;
  34670. } else {
  34671. return $1;
  34672. }
  34673. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  34674. },
  34675. args: [],
  34676. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  34677. referencedClasses: [],
  34678. messageSends: ["ifNil:"]
  34679. }),
  34680. $globals.VariableNode);
  34681. $core.addMethod(
  34682. $core.method({
  34683. selector: "assigned:",
  34684. protocol: "accessing",
  34685. fn: function (aBoolean){
  34686. var self=this;
  34687. self["@assigned"]=aBoolean;
  34688. return self;
  34689. },
  34690. args: ["aBoolean"],
  34691. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  34692. referencedClasses: [],
  34693. messageSends: []
  34694. }),
  34695. $globals.VariableNode);
  34696. $core.addMethod(
  34697. $core.method({
  34698. selector: "beAssigned",
  34699. protocol: "accessing",
  34700. fn: function (){
  34701. var self=this;
  34702. return $core.withContext(function($ctx1) {
  34703. $recv(self._binding())._validateAssignment();
  34704. self["@assigned"]=true;
  34705. return self;
  34706. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  34707. },
  34708. args: [],
  34709. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  34710. referencedClasses: [],
  34711. messageSends: ["validateAssignment", "binding"]
  34712. }),
  34713. $globals.VariableNode);
  34714. $core.addMethod(
  34715. $core.method({
  34716. selector: "binding",
  34717. protocol: "accessing",
  34718. fn: function (){
  34719. var self=this;
  34720. return self["@binding"];
  34721. },
  34722. args: [],
  34723. source: "binding\x0a\x09^ binding",
  34724. referencedClasses: [],
  34725. messageSends: []
  34726. }),
  34727. $globals.VariableNode);
  34728. $core.addMethod(
  34729. $core.method({
  34730. selector: "binding:",
  34731. protocol: "accessing",
  34732. fn: function (aScopeVar){
  34733. var self=this;
  34734. self["@binding"]=aScopeVar;
  34735. return self;
  34736. },
  34737. args: ["aScopeVar"],
  34738. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  34739. referencedClasses: [],
  34740. messageSends: []
  34741. }),
  34742. $globals.VariableNode);
  34743. $core.addMethod(
  34744. $core.method({
  34745. selector: "isArgument",
  34746. protocol: "testing",
  34747. fn: function (){
  34748. var self=this;
  34749. return $core.withContext(function($ctx1) {
  34750. return $recv(self._binding())._isArgVar();
  34751. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  34752. },
  34753. args: [],
  34754. source: "isArgument\x0a\x09^ self binding isArgVar",
  34755. referencedClasses: [],
  34756. messageSends: ["isArgVar", "binding"]
  34757. }),
  34758. $globals.VariableNode);
  34759. $core.addMethod(
  34760. $core.method({
  34761. selector: "isImmutable",
  34762. protocol: "testing",
  34763. fn: function (){
  34764. var self=this;
  34765. return $core.withContext(function($ctx1) {
  34766. return $recv(self._binding())._isImmutable();
  34767. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  34768. },
  34769. args: [],
  34770. source: "isImmutable\x0a\x09^ self binding isImmutable",
  34771. referencedClasses: [],
  34772. messageSends: ["isImmutable", "binding"]
  34773. }),
  34774. $globals.VariableNode);
  34775. $core.addMethod(
  34776. $core.method({
  34777. selector: "isNavigationNode",
  34778. protocol: "testing",
  34779. fn: function (){
  34780. var self=this;
  34781. return true;
  34782. },
  34783. args: [],
  34784. source: "isNavigationNode\x0a\x09^ true",
  34785. referencedClasses: [],
  34786. messageSends: []
  34787. }),
  34788. $globals.VariableNode);
  34789. $core.addMethod(
  34790. $core.method({
  34791. selector: "isSuperKeyword",
  34792. protocol: "testing",
  34793. fn: function (){
  34794. var self=this;
  34795. return $core.withContext(function($ctx1) {
  34796. return $recv(self._value()).__eq("super");
  34797. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{},$globals.VariableNode)});
  34798. },
  34799. args: [],
  34800. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  34801. referencedClasses: [],
  34802. messageSends: ["=", "value"]
  34803. }),
  34804. $globals.VariableNode);
  34805. $core.addMethod(
  34806. $core.method({
  34807. selector: "isVariableNode",
  34808. protocol: "testing",
  34809. fn: function (){
  34810. var self=this;
  34811. return true;
  34812. },
  34813. args: [],
  34814. source: "isVariableNode\x0a\x09^ true",
  34815. referencedClasses: [],
  34816. messageSends: []
  34817. }),
  34818. $globals.VariableNode);
  34819. $core.addMethod(
  34820. $core.method({
  34821. selector: "navigationLink",
  34822. protocol: "accessing",
  34823. fn: function (){
  34824. var self=this;
  34825. return $core.withContext(function($ctx1) {
  34826. return self._value();
  34827. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  34828. },
  34829. args: [],
  34830. source: "navigationLink\x0a\x09^ self value",
  34831. referencedClasses: [],
  34832. messageSends: ["value"]
  34833. }),
  34834. $globals.VariableNode);
  34835. $core.addClass("ParentFakingPathDagVisitor", $globals.PathDagVisitor, ["setParentSelector"], "Compiler-AST");
  34836. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  34837. $core.addMethod(
  34838. $core.method({
  34839. selector: "visit:",
  34840. protocol: "visiting",
  34841. fn: function (aNode){
  34842. var self=this;
  34843. return $core.withContext(function($ctx1) {
  34844. var $1;
  34845. $recv(self._path())._ifNotEmpty_((function(p){
  34846. return $core.withContext(function($ctx2) {
  34847. return $recv(aNode)._parent_($recv(p)._last());
  34848. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  34849. }));
  34850. $1=(
  34851. $ctx1.supercall = true,
  34852. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($recv(self), [aNode]));
  34853. $ctx1.supercall = false;
  34854. return $1;
  34855. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ParentFakingPathDagVisitor)});
  34856. },
  34857. args: ["aNode"],
  34858. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  34859. referencedClasses: [],
  34860. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  34861. }),
  34862. $globals.ParentFakingPathDagVisitor);
  34863. $core.addClass("NodeVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-AST");
  34864. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  34865. $core.addMethod(
  34866. $core.method({
  34867. selector: "visitAssignmentNode:",
  34868. protocol: "visiting",
  34869. fn: function (aNode){
  34870. var self=this;
  34871. return $core.withContext(function($ctx1) {
  34872. return self._visitDagNode_(aNode);
  34873. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  34874. },
  34875. args: ["aNode"],
  34876. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34877. referencedClasses: [],
  34878. messageSends: ["visitDagNode:"]
  34879. }),
  34880. $globals.NodeVisitor);
  34881. $core.addMethod(
  34882. $core.method({
  34883. selector: "visitBlockNode:",
  34884. protocol: "visiting",
  34885. fn: function (aNode){
  34886. var self=this;
  34887. return $core.withContext(function($ctx1) {
  34888. return self._visitDagNode_(aNode);
  34889. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  34890. },
  34891. args: ["aNode"],
  34892. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34893. referencedClasses: [],
  34894. messageSends: ["visitDagNode:"]
  34895. }),
  34896. $globals.NodeVisitor);
  34897. $core.addMethod(
  34898. $core.method({
  34899. selector: "visitBlockSequenceNode:",
  34900. protocol: "visiting",
  34901. fn: function (aNode){
  34902. var self=this;
  34903. return $core.withContext(function($ctx1) {
  34904. return self._visitSequenceNode_(aNode);
  34905. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  34906. },
  34907. args: ["aNode"],
  34908. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  34909. referencedClasses: [],
  34910. messageSends: ["visitSequenceNode:"]
  34911. }),
  34912. $globals.NodeVisitor);
  34913. $core.addMethod(
  34914. $core.method({
  34915. selector: "visitCascadeNode:",
  34916. protocol: "visiting",
  34917. fn: function (aNode){
  34918. var self=this;
  34919. return $core.withContext(function($ctx1) {
  34920. return self._visitDagNode_(aNode);
  34921. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  34922. },
  34923. args: ["aNode"],
  34924. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34925. referencedClasses: [],
  34926. messageSends: ["visitDagNode:"]
  34927. }),
  34928. $globals.NodeVisitor);
  34929. $core.addMethod(
  34930. $core.method({
  34931. selector: "visitDagNode:",
  34932. protocol: "visiting",
  34933. fn: function (aNode){
  34934. var self=this;
  34935. return $core.withContext(function($ctx1) {
  34936. return self._visitDagNodeVariantSimple_(aNode);
  34937. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.NodeVisitor)});
  34938. },
  34939. args: ["aNode"],
  34940. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  34941. referencedClasses: [],
  34942. messageSends: ["visitDagNodeVariantSimple:"]
  34943. }),
  34944. $globals.NodeVisitor);
  34945. $core.addMethod(
  34946. $core.method({
  34947. selector: "visitDynamicArrayNode:",
  34948. protocol: "visiting",
  34949. fn: function (aNode){
  34950. var self=this;
  34951. return $core.withContext(function($ctx1) {
  34952. return self._visitDagNode_(aNode);
  34953. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  34954. },
  34955. args: ["aNode"],
  34956. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34957. referencedClasses: [],
  34958. messageSends: ["visitDagNode:"]
  34959. }),
  34960. $globals.NodeVisitor);
  34961. $core.addMethod(
  34962. $core.method({
  34963. selector: "visitDynamicDictionaryNode:",
  34964. protocol: "visiting",
  34965. fn: function (aNode){
  34966. var self=this;
  34967. return $core.withContext(function($ctx1) {
  34968. return self._visitDagNode_(aNode);
  34969. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  34970. },
  34971. args: ["aNode"],
  34972. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34973. referencedClasses: [],
  34974. messageSends: ["visitDagNode:"]
  34975. }),
  34976. $globals.NodeVisitor);
  34977. $core.addMethod(
  34978. $core.method({
  34979. selector: "visitJSStatementNode:",
  34980. protocol: "visiting",
  34981. fn: function (aNode){
  34982. var self=this;
  34983. return $core.withContext(function($ctx1) {
  34984. return self._visitDagNode_(aNode);
  34985. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  34986. },
  34987. args: ["aNode"],
  34988. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34989. referencedClasses: [],
  34990. messageSends: ["visitDagNode:"]
  34991. }),
  34992. $globals.NodeVisitor);
  34993. $core.addMethod(
  34994. $core.method({
  34995. selector: "visitMethodNode:",
  34996. protocol: "visiting",
  34997. fn: function (aNode){
  34998. var self=this;
  34999. return $core.withContext(function($ctx1) {
  35000. return self._visitDagNode_(aNode);
  35001. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  35002. },
  35003. args: ["aNode"],
  35004. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35005. referencedClasses: [],
  35006. messageSends: ["visitDagNode:"]
  35007. }),
  35008. $globals.NodeVisitor);
  35009. $core.addMethod(
  35010. $core.method({
  35011. selector: "visitReturnNode:",
  35012. protocol: "visiting",
  35013. fn: function (aNode){
  35014. var self=this;
  35015. return $core.withContext(function($ctx1) {
  35016. return self._visitDagNode_(aNode);
  35017. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  35018. },
  35019. args: ["aNode"],
  35020. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35021. referencedClasses: [],
  35022. messageSends: ["visitDagNode:"]
  35023. }),
  35024. $globals.NodeVisitor);
  35025. $core.addMethod(
  35026. $core.method({
  35027. selector: "visitSendNode:",
  35028. protocol: "visiting",
  35029. fn: function (aNode){
  35030. var self=this;
  35031. return $core.withContext(function($ctx1) {
  35032. return self._visitDagNode_(aNode);
  35033. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  35034. },
  35035. args: ["aNode"],
  35036. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35037. referencedClasses: [],
  35038. messageSends: ["visitDagNode:"]
  35039. }),
  35040. $globals.NodeVisitor);
  35041. $core.addMethod(
  35042. $core.method({
  35043. selector: "visitSequenceNode:",
  35044. protocol: "visiting",
  35045. fn: function (aNode){
  35046. var self=this;
  35047. return $core.withContext(function($ctx1) {
  35048. return self._visitDagNode_(aNode);
  35049. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35050. },
  35051. args: ["aNode"],
  35052. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35053. referencedClasses: [],
  35054. messageSends: ["visitDagNode:"]
  35055. }),
  35056. $globals.NodeVisitor);
  35057. $core.addMethod(
  35058. $core.method({
  35059. selector: "visitValueNode:",
  35060. protocol: "visiting",
  35061. fn: function (aNode){
  35062. var self=this;
  35063. return $core.withContext(function($ctx1) {
  35064. return self._visitDagNode_(aNode);
  35065. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  35066. },
  35067. args: ["aNode"],
  35068. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35069. referencedClasses: [],
  35070. messageSends: ["visitDagNode:"]
  35071. }),
  35072. $globals.NodeVisitor);
  35073. $core.addMethod(
  35074. $core.method({
  35075. selector: "visitVariableNode:",
  35076. protocol: "visiting",
  35077. fn: function (aNode){
  35078. var self=this;
  35079. return $core.withContext(function($ctx1) {
  35080. return self._visitDagNode_(aNode);
  35081. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  35082. },
  35083. args: ["aNode"],
  35084. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35085. referencedClasses: [],
  35086. messageSends: ["visitDagNode:"]
  35087. }),
  35088. $globals.NodeVisitor);
  35089. $core.addMethod(
  35090. $core.method({
  35091. selector: "ast",
  35092. protocol: "*Compiler-AST",
  35093. fn: function (){
  35094. var self=this;
  35095. return $core.withContext(function($ctx1) {
  35096. var $1;
  35097. $1=self._source();
  35098. $ctx1.sendIdx["source"]=1;
  35099. $recv($1)._ifEmpty_((function(){
  35100. return $core.withContext(function($ctx2) {
  35101. return self._error_("Method source is empty");
  35102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35103. }));
  35104. return $recv($globals.Smalltalk)._parse_(self._source());
  35105. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  35106. },
  35107. args: [],
  35108. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  35109. referencedClasses: ["Smalltalk"],
  35110. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  35111. }),
  35112. $globals.CompiledMethod);
  35113. });
  35114. define('amber_core/Compiler-Semantic',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Kernel-Objects"], function($boot){"use strict";
  35115. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  35116. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  35117. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  35118. $core.addPackage("Compiler-Semantic");
  35119. $core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  35120. $core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  35121. $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic");
  35122. $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.";
  35123. $core.addMethod(
  35124. $core.method({
  35125. selector: "addArg:",
  35126. protocol: "adding",
  35127. fn: function (aString){
  35128. var self=this;
  35129. return $core.withContext(function($ctx1) {
  35130. var $1;
  35131. $1=self._args();
  35132. $ctx1.sendIdx["args"]=1;
  35133. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  35134. $recv($recv(self._args())._at_(aString))._scope_(self);
  35135. return self;
  35136. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  35137. },
  35138. args: ["aString"],
  35139. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  35140. referencedClasses: ["ArgVar"],
  35141. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  35142. }),
  35143. $globals.LexicalScope);
  35144. $core.addMethod(
  35145. $core.method({
  35146. selector: "addTemp:",
  35147. protocol: "adding",
  35148. fn: function (aString){
  35149. var self=this;
  35150. return $core.withContext(function($ctx1) {
  35151. var $1;
  35152. $1=self._temps();
  35153. $ctx1.sendIdx["temps"]=1;
  35154. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  35155. $recv($recv(self._temps())._at_(aString))._scope_(self);
  35156. return self;
  35157. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  35158. },
  35159. args: ["aString"],
  35160. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  35161. referencedClasses: ["TempVar"],
  35162. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  35163. }),
  35164. $globals.LexicalScope);
  35165. $core.addMethod(
  35166. $core.method({
  35167. selector: "alias",
  35168. protocol: "accessing",
  35169. fn: function (){
  35170. var self=this;
  35171. return $core.withContext(function($ctx1) {
  35172. return "$ctx".__comma($recv(self._scopeLevel())._asString());
  35173. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  35174. },
  35175. args: [],
  35176. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  35177. referencedClasses: [],
  35178. messageSends: [",", "asString", "scopeLevel"]
  35179. }),
  35180. $globals.LexicalScope);
  35181. $core.addMethod(
  35182. $core.method({
  35183. selector: "allVariableNames",
  35184. protocol: "accessing",
  35185. fn: function (){
  35186. var self=this;
  35187. return $core.withContext(function($ctx1) {
  35188. var $1;
  35189. $1=$recv(self._args())._keys();
  35190. $ctx1.sendIdx["keys"]=1;
  35191. return $recv($1).__comma($recv(self._temps())._keys());
  35192. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  35193. },
  35194. args: [],
  35195. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  35196. referencedClasses: [],
  35197. messageSends: [",", "keys", "args", "temps"]
  35198. }),
  35199. $globals.LexicalScope);
  35200. $core.addMethod(
  35201. $core.method({
  35202. selector: "args",
  35203. protocol: "accessing",
  35204. fn: function (){
  35205. var self=this;
  35206. return $core.withContext(function($ctx1) {
  35207. var $1,$receiver;
  35208. $1=self["@args"];
  35209. if(($receiver = $1) == null || $receiver.isNil){
  35210. self["@args"]=$recv($globals.Dictionary)._new();
  35211. return self["@args"];
  35212. } else {
  35213. return $1;
  35214. }
  35215. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  35216. },
  35217. args: [],
  35218. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  35219. referencedClasses: ["Dictionary"],
  35220. messageSends: ["ifNil:", "new"]
  35221. }),
  35222. $globals.LexicalScope);
  35223. $core.addMethod(
  35224. $core.method({
  35225. selector: "bindingFor:",
  35226. protocol: "accessing",
  35227. fn: function (aStringOrNode){
  35228. var self=this;
  35229. return $core.withContext(function($ctx1) {
  35230. var $2,$3,$4,$5,$1;
  35231. $2=self._pseudoVars();
  35232. $3=$recv(aStringOrNode)._value();
  35233. $ctx1.sendIdx["value"]=1;
  35234. $1=$recv($2)._at_ifAbsent_($3,(function(){
  35235. return $core.withContext(function($ctx2) {
  35236. $4=self._args();
  35237. $5=$recv(aStringOrNode)._value();
  35238. $ctx2.sendIdx["value"]=2;
  35239. return $recv($4)._at_ifAbsent_($5,(function(){
  35240. return $core.withContext(function($ctx3) {
  35241. return $recv(self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  35242. return nil;
  35243. }));
  35244. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  35245. }));
  35246. $ctx2.sendIdx["at:ifAbsent:"]=2;
  35247. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35248. }));
  35249. $ctx1.sendIdx["at:ifAbsent:"]=1;
  35250. return $1;
  35251. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  35252. },
  35253. args: ["aStringOrNode"],
  35254. 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 ]]]",
  35255. referencedClasses: [],
  35256. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  35257. }),
  35258. $globals.LexicalScope);
  35259. $core.addMethod(
  35260. $core.method({
  35261. selector: "blockIndex",
  35262. protocol: "accessing",
  35263. fn: function (){
  35264. var self=this;
  35265. return $core.withContext(function($ctx1) {
  35266. var $1,$receiver;
  35267. $1=self["@blockIndex"];
  35268. if(($receiver = $1) == null || $receiver.isNil){
  35269. return (0);
  35270. } else {
  35271. return $1;
  35272. }
  35273. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  35274. },
  35275. args: [],
  35276. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  35277. referencedClasses: [],
  35278. messageSends: ["ifNil:"]
  35279. }),
  35280. $globals.LexicalScope);
  35281. $core.addMethod(
  35282. $core.method({
  35283. selector: "blockIndex:",
  35284. protocol: "accessing",
  35285. fn: function (anInteger){
  35286. var self=this;
  35287. self["@blockIndex"]=anInteger;
  35288. return self;
  35289. },
  35290. args: ["anInteger"],
  35291. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  35292. referencedClasses: [],
  35293. messageSends: []
  35294. }),
  35295. $globals.LexicalScope);
  35296. $core.addMethod(
  35297. $core.method({
  35298. selector: "canInlineNonLocalReturns",
  35299. protocol: "testing",
  35300. fn: function (){
  35301. var self=this;
  35302. return $core.withContext(function($ctx1) {
  35303. return $recv(self._isInlined())._and_((function(){
  35304. return $core.withContext(function($ctx2) {
  35305. return $recv(self._outerScope())._canInlineNonLocalReturns();
  35306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35307. }));
  35308. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  35309. },
  35310. args: [],
  35311. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  35312. referencedClasses: [],
  35313. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  35314. }),
  35315. $globals.LexicalScope);
  35316. $core.addMethod(
  35317. $core.method({
  35318. selector: "instruction",
  35319. protocol: "accessing",
  35320. fn: function (){
  35321. var self=this;
  35322. return self["@instruction"];
  35323. },
  35324. args: [],
  35325. source: "instruction\x0a\x09^ instruction",
  35326. referencedClasses: [],
  35327. messageSends: []
  35328. }),
  35329. $globals.LexicalScope);
  35330. $core.addMethod(
  35331. $core.method({
  35332. selector: "instruction:",
  35333. protocol: "accessing",
  35334. fn: function (anIRInstruction){
  35335. var self=this;
  35336. self["@instruction"]=anIRInstruction;
  35337. return self;
  35338. },
  35339. args: ["anIRInstruction"],
  35340. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  35341. referencedClasses: [],
  35342. messageSends: []
  35343. }),
  35344. $globals.LexicalScope);
  35345. $core.addMethod(
  35346. $core.method({
  35347. selector: "isBlockScope",
  35348. protocol: "testing",
  35349. fn: function (){
  35350. var self=this;
  35351. return $core.withContext(function($ctx1) {
  35352. return $recv(self._isMethodScope())._not();
  35353. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  35354. },
  35355. args: [],
  35356. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  35357. referencedClasses: [],
  35358. messageSends: ["not", "isMethodScope"]
  35359. }),
  35360. $globals.LexicalScope);
  35361. $core.addMethod(
  35362. $core.method({
  35363. selector: "isInlined",
  35364. protocol: "testing",
  35365. fn: function (){
  35366. var self=this;
  35367. return $core.withContext(function($ctx1) {
  35368. var $2,$1;
  35369. $2=self._instruction();
  35370. $ctx1.sendIdx["instruction"]=1;
  35371. $1=$recv($2)._notNil();
  35372. return $recv($1)._and_((function(){
  35373. return $core.withContext(function($ctx2) {
  35374. return $recv(self._instruction())._isInlined();
  35375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35376. }));
  35377. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  35378. },
  35379. args: [],
  35380. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  35381. referencedClasses: [],
  35382. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  35383. }),
  35384. $globals.LexicalScope);
  35385. $core.addMethod(
  35386. $core.method({
  35387. selector: "isMethodScope",
  35388. protocol: "testing",
  35389. fn: function (){
  35390. var self=this;
  35391. return false;
  35392. },
  35393. args: [],
  35394. source: "isMethodScope\x0a\x09^ false",
  35395. referencedClasses: [],
  35396. messageSends: []
  35397. }),
  35398. $globals.LexicalScope);
  35399. $core.addMethod(
  35400. $core.method({
  35401. selector: "lookupVariable:",
  35402. protocol: "accessing",
  35403. fn: function (aNode){
  35404. var self=this;
  35405. var lookup;
  35406. return $core.withContext(function($ctx1) {
  35407. var $1,$2,$receiver;
  35408. lookup=self._bindingFor_(aNode);
  35409. $1=lookup;
  35410. if(($receiver = $1) == null || $receiver.isNil){
  35411. $2=self._outerScope();
  35412. $ctx1.sendIdx["outerScope"]=1;
  35413. if(($receiver = $2) == null || $receiver.isNil){
  35414. lookup=$2;
  35415. } else {
  35416. lookup=$recv(self._outerScope())._lookupVariable_(aNode);
  35417. }
  35418. lookup;
  35419. } else {
  35420. $1;
  35421. }
  35422. return lookup;
  35423. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  35424. },
  35425. args: ["aNode"],
  35426. 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",
  35427. referencedClasses: [],
  35428. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  35429. }),
  35430. $globals.LexicalScope);
  35431. $core.addMethod(
  35432. $core.method({
  35433. selector: "methodScope",
  35434. protocol: "accessing",
  35435. fn: function (){
  35436. var self=this;
  35437. return $core.withContext(function($ctx1) {
  35438. var $1,$receiver;
  35439. $1=self._outerScope();
  35440. $ctx1.sendIdx["outerScope"]=1;
  35441. if(($receiver = $1) == null || $receiver.isNil){
  35442. return $1;
  35443. } else {
  35444. return $recv(self._outerScope())._methodScope();
  35445. }
  35446. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  35447. },
  35448. args: [],
  35449. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  35450. referencedClasses: [],
  35451. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  35452. }),
  35453. $globals.LexicalScope);
  35454. $core.addMethod(
  35455. $core.method({
  35456. selector: "node",
  35457. protocol: "accessing",
  35458. fn: function (){
  35459. var self=this;
  35460. return self["@node"];
  35461. },
  35462. args: [],
  35463. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  35464. referencedClasses: [],
  35465. messageSends: []
  35466. }),
  35467. $globals.LexicalScope);
  35468. $core.addMethod(
  35469. $core.method({
  35470. selector: "node:",
  35471. protocol: "accessing",
  35472. fn: function (aNode){
  35473. var self=this;
  35474. self["@node"]=aNode;
  35475. return self;
  35476. },
  35477. args: ["aNode"],
  35478. source: "node: aNode\x0a\x09node := aNode",
  35479. referencedClasses: [],
  35480. messageSends: []
  35481. }),
  35482. $globals.LexicalScope);
  35483. $core.addMethod(
  35484. $core.method({
  35485. selector: "outerScope",
  35486. protocol: "accessing",
  35487. fn: function (){
  35488. var self=this;
  35489. return self["@outerScope"];
  35490. },
  35491. args: [],
  35492. source: "outerScope\x0a\x09^ outerScope",
  35493. referencedClasses: [],
  35494. messageSends: []
  35495. }),
  35496. $globals.LexicalScope);
  35497. $core.addMethod(
  35498. $core.method({
  35499. selector: "outerScope:",
  35500. protocol: "accessing",
  35501. fn: function (aLexicalScope){
  35502. var self=this;
  35503. self["@outerScope"]=aLexicalScope;
  35504. return self;
  35505. },
  35506. args: ["aLexicalScope"],
  35507. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  35508. referencedClasses: [],
  35509. messageSends: []
  35510. }),
  35511. $globals.LexicalScope);
  35512. $core.addMethod(
  35513. $core.method({
  35514. selector: "pseudoVars",
  35515. protocol: "accessing",
  35516. fn: function (){
  35517. var self=this;
  35518. return $core.withContext(function($ctx1) {
  35519. return $recv(self._methodScope())._pseudoVars();
  35520. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  35521. },
  35522. args: [],
  35523. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  35524. referencedClasses: [],
  35525. messageSends: ["pseudoVars", "methodScope"]
  35526. }),
  35527. $globals.LexicalScope);
  35528. $core.addMethod(
  35529. $core.method({
  35530. selector: "scopeLevel",
  35531. protocol: "accessing",
  35532. fn: function (){
  35533. var self=this;
  35534. return $core.withContext(function($ctx1) {
  35535. var $1,$2,$4,$3,$receiver;
  35536. $1=self._outerScope();
  35537. $ctx1.sendIdx["outerScope"]=1;
  35538. if(($receiver = $1) == null || $receiver.isNil){
  35539. return (1);
  35540. } else {
  35541. $1;
  35542. }
  35543. $2=self._isInlined();
  35544. if($core.assert($2)){
  35545. $4=self._outerScope();
  35546. $ctx1.sendIdx["outerScope"]=2;
  35547. $3=$recv($4)._scopeLevel();
  35548. $ctx1.sendIdx["scopeLevel"]=1;
  35549. return $3;
  35550. }
  35551. return $recv($recv(self._outerScope())._scopeLevel()).__plus((1));
  35552. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  35553. },
  35554. args: [],
  35555. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  35556. referencedClasses: [],
  35557. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  35558. }),
  35559. $globals.LexicalScope);
  35560. $core.addMethod(
  35561. $core.method({
  35562. selector: "temps",
  35563. protocol: "accessing",
  35564. fn: function (){
  35565. var self=this;
  35566. return $core.withContext(function($ctx1) {
  35567. var $1,$receiver;
  35568. $1=self["@temps"];
  35569. if(($receiver = $1) == null || $receiver.isNil){
  35570. self["@temps"]=$recv($globals.Dictionary)._new();
  35571. return self["@temps"];
  35572. } else {
  35573. return $1;
  35574. }
  35575. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  35576. },
  35577. args: [],
  35578. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  35579. referencedClasses: ["Dictionary"],
  35580. messageSends: ["ifNil:", "new"]
  35581. }),
  35582. $globals.LexicalScope);
  35583. $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "unknownVariables", "localReturn", "nonLocalReturns"], "Compiler-Semantic");
  35584. $globals.MethodLexicalScope.comment="I represent a method scope.";
  35585. $core.addMethod(
  35586. $core.method({
  35587. selector: "addIVar:",
  35588. protocol: "adding",
  35589. fn: function (aString){
  35590. var self=this;
  35591. return $core.withContext(function($ctx1) {
  35592. var $1;
  35593. $1=self._iVars();
  35594. $ctx1.sendIdx["iVars"]=1;
  35595. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  35596. $recv($recv(self._iVars())._at_(aString))._scope_(self);
  35597. return self;
  35598. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  35599. },
  35600. args: ["aString"],
  35601. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  35602. referencedClasses: ["InstanceVar"],
  35603. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  35604. }),
  35605. $globals.MethodLexicalScope);
  35606. $core.addMethod(
  35607. $core.method({
  35608. selector: "addNonLocalReturn:",
  35609. protocol: "adding",
  35610. fn: function (aScope){
  35611. var self=this;
  35612. return $core.withContext(function($ctx1) {
  35613. $recv(self._nonLocalReturns())._add_(aScope);
  35614. return self;
  35615. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  35616. },
  35617. args: ["aScope"],
  35618. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  35619. referencedClasses: [],
  35620. messageSends: ["add:", "nonLocalReturns"]
  35621. }),
  35622. $globals.MethodLexicalScope);
  35623. $core.addMethod(
  35624. $core.method({
  35625. selector: "allVariableNames",
  35626. protocol: "accessing",
  35627. fn: function (){
  35628. var self=this;
  35629. return $core.withContext(function($ctx1) {
  35630. var $1;
  35631. $1=(
  35632. $ctx1.supercall = true,
  35633. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($recv(self), []));
  35634. $ctx1.supercall = false;
  35635. return $recv($1).__comma($recv(self._iVars())._keys());
  35636. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  35637. },
  35638. args: [],
  35639. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  35640. referencedClasses: [],
  35641. messageSends: [",", "allVariableNames", "keys", "iVars"]
  35642. }),
  35643. $globals.MethodLexicalScope);
  35644. $core.addMethod(
  35645. $core.method({
  35646. selector: "bindingFor:",
  35647. protocol: "accessing",
  35648. fn: function (aNode){
  35649. var self=this;
  35650. return $core.withContext(function($ctx1) {
  35651. var $1,$receiver;
  35652. $1=(
  35653. $ctx1.supercall = true,
  35654. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($recv(self), [aNode]));
  35655. $ctx1.supercall = false;
  35656. if(($receiver = $1) == null || $receiver.isNil){
  35657. return $recv(self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  35658. return nil;
  35659. }));
  35660. } else {
  35661. return $1;
  35662. }
  35663. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  35664. },
  35665. args: ["aNode"],
  35666. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  35667. referencedClasses: [],
  35668. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  35669. }),
  35670. $globals.MethodLexicalScope);
  35671. $core.addMethod(
  35672. $core.method({
  35673. selector: "canInlineNonLocalReturns",
  35674. protocol: "testing",
  35675. fn: function (){
  35676. var self=this;
  35677. return true;
  35678. },
  35679. args: [],
  35680. source: "canInlineNonLocalReturns\x0a\x09^ true",
  35681. referencedClasses: [],
  35682. messageSends: []
  35683. }),
  35684. $globals.MethodLexicalScope);
  35685. $core.addMethod(
  35686. $core.method({
  35687. selector: "hasLocalReturn",
  35688. protocol: "testing",
  35689. fn: function (){
  35690. var self=this;
  35691. return $core.withContext(function($ctx1) {
  35692. return self._localReturn();
  35693. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  35694. },
  35695. args: [],
  35696. source: "hasLocalReturn\x0a\x09^ self localReturn",
  35697. referencedClasses: [],
  35698. messageSends: ["localReturn"]
  35699. }),
  35700. $globals.MethodLexicalScope);
  35701. $core.addMethod(
  35702. $core.method({
  35703. selector: "hasNonLocalReturn",
  35704. protocol: "testing",
  35705. fn: function (){
  35706. var self=this;
  35707. return $core.withContext(function($ctx1) {
  35708. return $recv(self._nonLocalReturns())._notEmpty();
  35709. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  35710. },
  35711. args: [],
  35712. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  35713. referencedClasses: [],
  35714. messageSends: ["notEmpty", "nonLocalReturns"]
  35715. }),
  35716. $globals.MethodLexicalScope);
  35717. $core.addMethod(
  35718. $core.method({
  35719. selector: "iVars",
  35720. protocol: "accessing",
  35721. fn: function (){
  35722. var self=this;
  35723. return $core.withContext(function($ctx1) {
  35724. var $1,$receiver;
  35725. $1=self["@iVars"];
  35726. if(($receiver = $1) == null || $receiver.isNil){
  35727. self["@iVars"]=$recv($globals.Dictionary)._new();
  35728. return self["@iVars"];
  35729. } else {
  35730. return $1;
  35731. }
  35732. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  35733. },
  35734. args: [],
  35735. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  35736. referencedClasses: ["Dictionary"],
  35737. messageSends: ["ifNil:", "new"]
  35738. }),
  35739. $globals.MethodLexicalScope);
  35740. $core.addMethod(
  35741. $core.method({
  35742. selector: "isMethodScope",
  35743. protocol: "testing",
  35744. fn: function (){
  35745. var self=this;
  35746. return true;
  35747. },
  35748. args: [],
  35749. source: "isMethodScope\x0a\x09^ true",
  35750. referencedClasses: [],
  35751. messageSends: []
  35752. }),
  35753. $globals.MethodLexicalScope);
  35754. $core.addMethod(
  35755. $core.method({
  35756. selector: "localReturn",
  35757. protocol: "accessing",
  35758. fn: function (){
  35759. var self=this;
  35760. return $core.withContext(function($ctx1) {
  35761. var $1,$receiver;
  35762. $1=self["@localReturn"];
  35763. if(($receiver = $1) == null || $receiver.isNil){
  35764. return false;
  35765. } else {
  35766. return $1;
  35767. }
  35768. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  35769. },
  35770. args: [],
  35771. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  35772. referencedClasses: [],
  35773. messageSends: ["ifNil:"]
  35774. }),
  35775. $globals.MethodLexicalScope);
  35776. $core.addMethod(
  35777. $core.method({
  35778. selector: "localReturn:",
  35779. protocol: "accessing",
  35780. fn: function (aBoolean){
  35781. var self=this;
  35782. self["@localReturn"]=aBoolean;
  35783. return self;
  35784. },
  35785. args: ["aBoolean"],
  35786. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  35787. referencedClasses: [],
  35788. messageSends: []
  35789. }),
  35790. $globals.MethodLexicalScope);
  35791. $core.addMethod(
  35792. $core.method({
  35793. selector: "methodScope",
  35794. protocol: "accessing",
  35795. fn: function (){
  35796. var self=this;
  35797. return self;
  35798. },
  35799. args: [],
  35800. source: "methodScope\x0a\x09^ self",
  35801. referencedClasses: [],
  35802. messageSends: []
  35803. }),
  35804. $globals.MethodLexicalScope);
  35805. $core.addMethod(
  35806. $core.method({
  35807. selector: "nonLocalReturns",
  35808. protocol: "accessing",
  35809. fn: function (){
  35810. var self=this;
  35811. return $core.withContext(function($ctx1) {
  35812. var $1,$receiver;
  35813. $1=self["@nonLocalReturns"];
  35814. if(($receiver = $1) == null || $receiver.isNil){
  35815. self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  35816. return self["@nonLocalReturns"];
  35817. } else {
  35818. return $1;
  35819. }
  35820. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  35821. },
  35822. args: [],
  35823. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  35824. referencedClasses: ["OrderedCollection"],
  35825. messageSends: ["ifNil:", "new"]
  35826. }),
  35827. $globals.MethodLexicalScope);
  35828. $core.addMethod(
  35829. $core.method({
  35830. selector: "pseudoVars",
  35831. protocol: "accessing",
  35832. fn: function (){
  35833. var self=this;
  35834. return $core.withContext(function($ctx1) {
  35835. var $1,$2,$4,$3,$receiver;
  35836. $1=self["@pseudoVars"];
  35837. if(($receiver = $1) == null || $receiver.isNil){
  35838. self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  35839. self["@pseudoVars"];
  35840. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  35841. return $core.withContext(function($ctx2) {
  35842. $2=self["@pseudoVars"];
  35843. $4=$recv($globals.PseudoVar)._on_(each);
  35844. $recv($4)._scope_(self._methodScope());
  35845. $3=$recv($4)._yourself();
  35846. return $recv($2)._at_put_(each,$3);
  35847. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35848. }));
  35849. } else {
  35850. $1;
  35851. }
  35852. return self["@pseudoVars"];
  35853. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  35854. },
  35855. args: [],
  35856. 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",
  35857. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  35858. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  35859. }),
  35860. $globals.MethodLexicalScope);
  35861. $core.addMethod(
  35862. $core.method({
  35863. selector: "removeNonLocalReturn:",
  35864. protocol: "adding",
  35865. fn: function (aScope){
  35866. var self=this;
  35867. return $core.withContext(function($ctx1) {
  35868. $recv(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  35869. }));
  35870. return self;
  35871. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  35872. },
  35873. args: ["aScope"],
  35874. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  35875. referencedClasses: [],
  35876. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  35877. }),
  35878. $globals.MethodLexicalScope);
  35879. $core.addMethod(
  35880. $core.method({
  35881. selector: "unknownVariables",
  35882. protocol: "accessing",
  35883. fn: function (){
  35884. var self=this;
  35885. return $core.withContext(function($ctx1) {
  35886. var $1,$receiver;
  35887. $1=self["@unknownVariables"];
  35888. if(($receiver = $1) == null || $receiver.isNil){
  35889. self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  35890. return self["@unknownVariables"];
  35891. } else {
  35892. return $1;
  35893. }
  35894. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  35895. },
  35896. args: [],
  35897. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  35898. referencedClasses: ["OrderedCollection"],
  35899. messageSends: ["ifNil:", "new"]
  35900. }),
  35901. $globals.MethodLexicalScope);
  35902. $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic");
  35903. $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.";
  35904. $core.addMethod(
  35905. $core.method({
  35906. selector: "alias",
  35907. protocol: "accessing",
  35908. fn: function (){
  35909. var self=this;
  35910. return $core.withContext(function($ctx1) {
  35911. return $recv(self._name())._asVariableName();
  35912. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  35913. },
  35914. args: [],
  35915. source: "alias\x0a\x09^ self name asVariableName",
  35916. referencedClasses: [],
  35917. messageSends: ["asVariableName", "name"]
  35918. }),
  35919. $globals.ScopeVar);
  35920. $core.addMethod(
  35921. $core.method({
  35922. selector: "isArgVar",
  35923. protocol: "testing",
  35924. fn: function (){
  35925. var self=this;
  35926. return false;
  35927. },
  35928. args: [],
  35929. source: "isArgVar\x0a\x09^ false",
  35930. referencedClasses: [],
  35931. messageSends: []
  35932. }),
  35933. $globals.ScopeVar);
  35934. $core.addMethod(
  35935. $core.method({
  35936. selector: "isClassRefVar",
  35937. protocol: "testing",
  35938. fn: function (){
  35939. var self=this;
  35940. return false;
  35941. },
  35942. args: [],
  35943. source: "isClassRefVar\x0a\x09^ false",
  35944. referencedClasses: [],
  35945. messageSends: []
  35946. }),
  35947. $globals.ScopeVar);
  35948. $core.addMethod(
  35949. $core.method({
  35950. selector: "isImmutable",
  35951. protocol: "testing",
  35952. fn: function (){
  35953. var self=this;
  35954. return false;
  35955. },
  35956. args: [],
  35957. source: "isImmutable\x0a\x09^ false",
  35958. referencedClasses: [],
  35959. messageSends: []
  35960. }),
  35961. $globals.ScopeVar);
  35962. $core.addMethod(
  35963. $core.method({
  35964. selector: "isInstanceVar",
  35965. protocol: "testing",
  35966. fn: function (){
  35967. var self=this;
  35968. return false;
  35969. },
  35970. args: [],
  35971. source: "isInstanceVar\x0a\x09^ false",
  35972. referencedClasses: [],
  35973. messageSends: []
  35974. }),
  35975. $globals.ScopeVar);
  35976. $core.addMethod(
  35977. $core.method({
  35978. selector: "isPseudoVar",
  35979. protocol: "testing",
  35980. fn: function (){
  35981. var self=this;
  35982. return false;
  35983. },
  35984. args: [],
  35985. source: "isPseudoVar\x0a\x09^ false",
  35986. referencedClasses: [],
  35987. messageSends: []
  35988. }),
  35989. $globals.ScopeVar);
  35990. $core.addMethod(
  35991. $core.method({
  35992. selector: "isTempVar",
  35993. protocol: "testing",
  35994. fn: function (){
  35995. var self=this;
  35996. return false;
  35997. },
  35998. args: [],
  35999. source: "isTempVar\x0a\x09^ false",
  36000. referencedClasses: [],
  36001. messageSends: []
  36002. }),
  36003. $globals.ScopeVar);
  36004. $core.addMethod(
  36005. $core.method({
  36006. selector: "isUnknownVar",
  36007. protocol: "testing",
  36008. fn: function (){
  36009. var self=this;
  36010. return false;
  36011. },
  36012. args: [],
  36013. source: "isUnknownVar\x0a\x09^ false",
  36014. referencedClasses: [],
  36015. messageSends: []
  36016. }),
  36017. $globals.ScopeVar);
  36018. $core.addMethod(
  36019. $core.method({
  36020. selector: "name",
  36021. protocol: "accessing",
  36022. fn: function (){
  36023. var self=this;
  36024. return self["@name"];
  36025. },
  36026. args: [],
  36027. source: "name\x0a\x09^ name",
  36028. referencedClasses: [],
  36029. messageSends: []
  36030. }),
  36031. $globals.ScopeVar);
  36032. $core.addMethod(
  36033. $core.method({
  36034. selector: "name:",
  36035. protocol: "accessing",
  36036. fn: function (aString){
  36037. var self=this;
  36038. self["@name"]=aString;
  36039. return self;
  36040. },
  36041. args: ["aString"],
  36042. source: "name: aString\x0a\x09name := aString",
  36043. referencedClasses: [],
  36044. messageSends: []
  36045. }),
  36046. $globals.ScopeVar);
  36047. $core.addMethod(
  36048. $core.method({
  36049. selector: "scope",
  36050. protocol: "accessing",
  36051. fn: function (){
  36052. var self=this;
  36053. return self["@scope"];
  36054. },
  36055. args: [],
  36056. source: "scope\x0a\x09^ scope",
  36057. referencedClasses: [],
  36058. messageSends: []
  36059. }),
  36060. $globals.ScopeVar);
  36061. $core.addMethod(
  36062. $core.method({
  36063. selector: "scope:",
  36064. protocol: "accessing",
  36065. fn: function (aScope){
  36066. var self=this;
  36067. self["@scope"]=aScope;
  36068. return self;
  36069. },
  36070. args: ["aScope"],
  36071. source: "scope: aScope\x0a\x09scope := aScope",
  36072. referencedClasses: [],
  36073. messageSends: []
  36074. }),
  36075. $globals.ScopeVar);
  36076. $core.addMethod(
  36077. $core.method({
  36078. selector: "validateAssignment",
  36079. protocol: "testing",
  36080. fn: function (){
  36081. var self=this;
  36082. return $core.withContext(function($ctx1) {
  36083. var $1,$2;
  36084. $1=$recv(self._isArgVar())._or_((function(){
  36085. return $core.withContext(function($ctx2) {
  36086. return self._isPseudoVar();
  36087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36088. }));
  36089. if($core.assert($1)){
  36090. $2=$recv($globals.InvalidAssignmentError)._new();
  36091. $recv($2)._variableName_(self._name());
  36092. $recv($2)._signal();
  36093. }
  36094. return self;
  36095. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  36096. },
  36097. args: [],
  36098. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  36099. referencedClasses: ["InvalidAssignmentError"],
  36100. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  36101. }),
  36102. $globals.ScopeVar);
  36103. $core.addMethod(
  36104. $core.method({
  36105. selector: "on:",
  36106. protocol: "instance creation",
  36107. fn: function (aString){
  36108. var self=this;
  36109. return $core.withContext(function($ctx1) {
  36110. var $1;
  36111. $1=self._new();
  36112. $recv($1)._name_(aString);
  36113. return $recv($1)._yourself();
  36114. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.klass)});
  36115. },
  36116. args: ["aString"],
  36117. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  36118. referencedClasses: [],
  36119. messageSends: ["name:", "new", "yourself"]
  36120. }),
  36121. $globals.ScopeVar.klass);
  36122. $core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic");
  36123. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  36124. $core.addMethod(
  36125. $core.method({
  36126. selector: "isImmutable",
  36127. protocol: "testing",
  36128. fn: function (){
  36129. var self=this;
  36130. return true;
  36131. },
  36132. args: [],
  36133. source: "isImmutable\x0a\x09^ true",
  36134. referencedClasses: [],
  36135. messageSends: []
  36136. }),
  36137. $globals.AliasVar);
  36138. $core.addMethod(
  36139. $core.method({
  36140. selector: "node",
  36141. protocol: "accessing",
  36142. fn: function (){
  36143. var self=this;
  36144. return self["@node"];
  36145. },
  36146. args: [],
  36147. source: "node\x0a\x09^ node",
  36148. referencedClasses: [],
  36149. messageSends: []
  36150. }),
  36151. $globals.AliasVar);
  36152. $core.addMethod(
  36153. $core.method({
  36154. selector: "node:",
  36155. protocol: "accessing",
  36156. fn: function (aNode){
  36157. var self=this;
  36158. self["@node"]=aNode;
  36159. return self;
  36160. },
  36161. args: ["aNode"],
  36162. source: "node: aNode\x0a\x09node := aNode",
  36163. referencedClasses: [],
  36164. messageSends: []
  36165. }),
  36166. $globals.AliasVar);
  36167. $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic");
  36168. $globals.ArgVar.comment="I am an argument of a method or block.";
  36169. $core.addMethod(
  36170. $core.method({
  36171. selector: "isArgVar",
  36172. protocol: "testing",
  36173. fn: function (){
  36174. var self=this;
  36175. return true;
  36176. },
  36177. args: [],
  36178. source: "isArgVar\x0a\x09^ true",
  36179. referencedClasses: [],
  36180. messageSends: []
  36181. }),
  36182. $globals.ArgVar);
  36183. $core.addMethod(
  36184. $core.method({
  36185. selector: "isImmutable",
  36186. protocol: "testing",
  36187. fn: function (){
  36188. var self=this;
  36189. return true;
  36190. },
  36191. args: [],
  36192. source: "isImmutable\x0a\x09^ true",
  36193. referencedClasses: [],
  36194. messageSends: []
  36195. }),
  36196. $globals.ArgVar);
  36197. $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic");
  36198. $globals.ClassRefVar.comment="I am an class reference variable";
  36199. $core.addMethod(
  36200. $core.method({
  36201. selector: "alias",
  36202. protocol: "accessing",
  36203. fn: function (){
  36204. var self=this;
  36205. return $core.withContext(function($ctx1) {
  36206. return "$globals.".__comma(self._name());
  36207. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  36208. },
  36209. args: [],
  36210. 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",
  36211. referencedClasses: [],
  36212. messageSends: [",", "name"]
  36213. }),
  36214. $globals.ClassRefVar);
  36215. $core.addMethod(
  36216. $core.method({
  36217. selector: "isClassRefVar",
  36218. protocol: "testing",
  36219. fn: function (){
  36220. var self=this;
  36221. return true;
  36222. },
  36223. args: [],
  36224. source: "isClassRefVar\x0a\x09^ true",
  36225. referencedClasses: [],
  36226. messageSends: []
  36227. }),
  36228. $globals.ClassRefVar);
  36229. $core.addMethod(
  36230. $core.method({
  36231. selector: "isImmutable",
  36232. protocol: "testing",
  36233. fn: function (){
  36234. var self=this;
  36235. return true;
  36236. },
  36237. args: [],
  36238. source: "isImmutable\x0a\x09^ true",
  36239. referencedClasses: [],
  36240. messageSends: []
  36241. }),
  36242. $globals.ClassRefVar);
  36243. $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic");
  36244. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  36245. $core.addMethod(
  36246. $core.method({
  36247. selector: "alias",
  36248. protocol: "testing",
  36249. fn: function (){
  36250. var self=this;
  36251. return $core.withContext(function($ctx1) {
  36252. var $1;
  36253. $1=$recv("self[\x22@".__comma(self._name())).__comma("\x22]");
  36254. $ctx1.sendIdx[","]=1;
  36255. return $1;
  36256. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  36257. },
  36258. args: [],
  36259. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  36260. referencedClasses: [],
  36261. messageSends: [",", "name"]
  36262. }),
  36263. $globals.InstanceVar);
  36264. $core.addMethod(
  36265. $core.method({
  36266. selector: "isInstanceVar",
  36267. protocol: "testing",
  36268. fn: function (){
  36269. var self=this;
  36270. return true;
  36271. },
  36272. args: [],
  36273. source: "isInstanceVar\x0a\x09^ true",
  36274. referencedClasses: [],
  36275. messageSends: []
  36276. }),
  36277. $globals.InstanceVar);
  36278. $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic");
  36279. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  36280. $core.addMethod(
  36281. $core.method({
  36282. selector: "alias",
  36283. protocol: "accessing",
  36284. fn: function (){
  36285. var self=this;
  36286. return $core.withContext(function($ctx1) {
  36287. return self._name();
  36288. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  36289. },
  36290. args: [],
  36291. source: "alias\x0a\x09^ self name",
  36292. referencedClasses: [],
  36293. messageSends: ["name"]
  36294. }),
  36295. $globals.PseudoVar);
  36296. $core.addMethod(
  36297. $core.method({
  36298. selector: "isImmutable",
  36299. protocol: "testing",
  36300. fn: function (){
  36301. var self=this;
  36302. return true;
  36303. },
  36304. args: [],
  36305. source: "isImmutable\x0a\x09^ true",
  36306. referencedClasses: [],
  36307. messageSends: []
  36308. }),
  36309. $globals.PseudoVar);
  36310. $core.addMethod(
  36311. $core.method({
  36312. selector: "isPseudoVar",
  36313. protocol: "testing",
  36314. fn: function (){
  36315. var self=this;
  36316. return true;
  36317. },
  36318. args: [],
  36319. source: "isPseudoVar\x0a\x09^ true",
  36320. referencedClasses: [],
  36321. messageSends: []
  36322. }),
  36323. $globals.PseudoVar);
  36324. $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic");
  36325. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  36326. $core.addMethod(
  36327. $core.method({
  36328. selector: "isTempVar",
  36329. protocol: "testing",
  36330. fn: function (){
  36331. var self=this;
  36332. return true;
  36333. },
  36334. args: [],
  36335. source: "isTempVar\x0a\x09^ true",
  36336. referencedClasses: [],
  36337. messageSends: []
  36338. }),
  36339. $globals.TempVar);
  36340. $core.addClass("UnknownVar", $globals.ScopeVar, [], "Compiler-Semantic");
  36341. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  36342. $core.addMethod(
  36343. $core.method({
  36344. selector: "isUnknownVar",
  36345. protocol: "testing",
  36346. fn: function (){
  36347. var self=this;
  36348. return true;
  36349. },
  36350. args: [],
  36351. source: "isUnknownVar\x0a\x09^ true",
  36352. referencedClasses: [],
  36353. messageSends: []
  36354. }),
  36355. $globals.UnknownVar);
  36356. $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic");
  36357. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  36358. $core.addMethod(
  36359. $core.method({
  36360. selector: "classReferences",
  36361. protocol: "accessing",
  36362. fn: function (){
  36363. var self=this;
  36364. return $core.withContext(function($ctx1) {
  36365. var $1,$receiver;
  36366. $1=self["@classReferences"];
  36367. if(($receiver = $1) == null || $receiver.isNil){
  36368. self["@classReferences"]=$recv($globals.Set)._new();
  36369. return self["@classReferences"];
  36370. } else {
  36371. return $1;
  36372. }
  36373. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  36374. },
  36375. args: [],
  36376. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  36377. referencedClasses: ["Set"],
  36378. messageSends: ["ifNil:", "new"]
  36379. }),
  36380. $globals.SemanticAnalyzer);
  36381. $core.addMethod(
  36382. $core.method({
  36383. selector: "errorShadowingVariable:",
  36384. protocol: "error handling",
  36385. fn: function (aString){
  36386. var self=this;
  36387. return $core.withContext(function($ctx1) {
  36388. var $1;
  36389. $1=$recv($globals.ShadowingVariableError)._new();
  36390. $recv($1)._variableName_(aString);
  36391. $recv($1)._signal();
  36392. return self;
  36393. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  36394. },
  36395. args: ["aString"],
  36396. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  36397. referencedClasses: ["ShadowingVariableError"],
  36398. messageSends: ["variableName:", "new", "signal"]
  36399. }),
  36400. $globals.SemanticAnalyzer);
  36401. $core.addMethod(
  36402. $core.method({
  36403. selector: "errorUnknownVariable:",
  36404. protocol: "error handling",
  36405. fn: function (aNode){
  36406. var self=this;
  36407. var identifier;
  36408. return $core.withContext(function($ctx1) {
  36409. var $1,$2,$3;
  36410. identifier=$recv(aNode)._value();
  36411. $ctx1.sendIdx["value"]=1;
  36412. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  36413. return $core.withContext(function($ctx2) {
  36414. return self._isVariableUndefined_inPackage_(identifier,self._thePackage());
  36415. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36416. }));
  36417. if($core.assert($1)){
  36418. $2=$recv($globals.UnknownVariableError)._new();
  36419. $3=$recv(aNode)._value();
  36420. $ctx1.sendIdx["value"]=2;
  36421. $recv($2)._variableName_($3);
  36422. $recv($2)._signal();
  36423. } else {
  36424. $recv($recv($recv(self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  36425. }
  36426. return self;
  36427. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  36428. },
  36429. args: ["aNode"],
  36430. 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 ]",
  36431. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  36432. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  36433. }),
  36434. $globals.SemanticAnalyzer);
  36435. $core.addMethod(
  36436. $core.method({
  36437. selector: "isVariableUndefined:inPackage:",
  36438. protocol: "testing",
  36439. fn: function (aString,aPackage){
  36440. var self=this;
  36441. return $core.withContext(function($ctx1) {
  36442. var $1,$2,$3,$receiver;
  36443. if(($receiver = aPackage) == null || $receiver.isNil){
  36444. aPackage;
  36445. } else {
  36446. var packageKnownVars;
  36447. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  36448. packageKnownVars;
  36449. $1=$recv(packageKnownVars)._includes_(aString);
  36450. if($core.assert($1)){
  36451. return false;
  36452. }
  36453. }
  36454. $2=$recv($globals.Compiler)._new();
  36455. $3=$recv("typeof ".__comma(aString)).__comma(" == \x22undefined\x22");
  36456. $ctx1.sendIdx[","]=1;
  36457. return $recv($2)._eval_($3);
  36458. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  36459. },
  36460. args: ["aString", "aPackage"],
  36461. 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 new\x0a\x09\x09eval: 'typeof ', aString, ' == \x22undefined\x22'",
  36462. referencedClasses: ["Compiler"],
  36463. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", "new", ","]
  36464. }),
  36465. $globals.SemanticAnalyzer);
  36466. $core.addMethod(
  36467. $core.method({
  36468. selector: "messageSends",
  36469. protocol: "accessing",
  36470. fn: function (){
  36471. var self=this;
  36472. return $core.withContext(function($ctx1) {
  36473. var $1,$receiver;
  36474. $1=self["@messageSends"];
  36475. if(($receiver = $1) == null || $receiver.isNil){
  36476. self["@messageSends"]=$recv($globals.Dictionary)._new();
  36477. return self["@messageSends"];
  36478. } else {
  36479. return $1;
  36480. }
  36481. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  36482. },
  36483. args: [],
  36484. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  36485. referencedClasses: ["Dictionary"],
  36486. messageSends: ["ifNil:", "new"]
  36487. }),
  36488. $globals.SemanticAnalyzer);
  36489. $core.addMethod(
  36490. $core.method({
  36491. selector: "newBlockScope",
  36492. protocol: "factory",
  36493. fn: function (){
  36494. var self=this;
  36495. return $core.withContext(function($ctx1) {
  36496. return self._newScopeOfClass_($globals.LexicalScope);
  36497. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  36498. },
  36499. args: [],
  36500. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  36501. referencedClasses: ["LexicalScope"],
  36502. messageSends: ["newScopeOfClass:"]
  36503. }),
  36504. $globals.SemanticAnalyzer);
  36505. $core.addMethod(
  36506. $core.method({
  36507. selector: "newMethodScope",
  36508. protocol: "factory",
  36509. fn: function (){
  36510. var self=this;
  36511. return $core.withContext(function($ctx1) {
  36512. return self._newScopeOfClass_($globals.MethodLexicalScope);
  36513. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  36514. },
  36515. args: [],
  36516. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  36517. referencedClasses: ["MethodLexicalScope"],
  36518. messageSends: ["newScopeOfClass:"]
  36519. }),
  36520. $globals.SemanticAnalyzer);
  36521. $core.addMethod(
  36522. $core.method({
  36523. selector: "newScopeOfClass:",
  36524. protocol: "factory",
  36525. fn: function (aLexicalScopeClass){
  36526. var self=this;
  36527. return $core.withContext(function($ctx1) {
  36528. var $1;
  36529. $1=$recv(aLexicalScopeClass)._new();
  36530. $recv($1)._outerScope_(self["@currentScope"]);
  36531. return $recv($1)._yourself();
  36532. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  36533. },
  36534. args: ["aLexicalScopeClass"],
  36535. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  36536. referencedClasses: [],
  36537. messageSends: ["outerScope:", "new", "yourself"]
  36538. }),
  36539. $globals.SemanticAnalyzer);
  36540. $core.addMethod(
  36541. $core.method({
  36542. selector: "nextBlockIndex",
  36543. protocol: "private",
  36544. fn: function (){
  36545. var self=this;
  36546. return $core.withContext(function($ctx1) {
  36547. var $1,$receiver;
  36548. $1=self["@blockIndex"];
  36549. if(($receiver = $1) == null || $receiver.isNil){
  36550. self["@blockIndex"]=(0);
  36551. self["@blockIndex"];
  36552. } else {
  36553. $1;
  36554. }
  36555. self["@blockIndex"]=$recv(self["@blockIndex"]).__plus((1));
  36556. return self["@blockIndex"];
  36557. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  36558. },
  36559. args: [],
  36560. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  36561. referencedClasses: [],
  36562. messageSends: ["ifNil:", "+"]
  36563. }),
  36564. $globals.SemanticAnalyzer);
  36565. $core.addMethod(
  36566. $core.method({
  36567. selector: "popScope",
  36568. protocol: "scope",
  36569. fn: function (){
  36570. var self=this;
  36571. return $core.withContext(function($ctx1) {
  36572. var $1,$receiver;
  36573. $1=self["@currentScope"];
  36574. if(($receiver = $1) == null || $receiver.isNil){
  36575. $1;
  36576. } else {
  36577. self["@currentScope"]=$recv(self["@currentScope"])._outerScope();
  36578. self["@currentScope"];
  36579. }
  36580. return self;
  36581. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  36582. },
  36583. args: [],
  36584. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  36585. referencedClasses: [],
  36586. messageSends: ["ifNotNil:", "outerScope"]
  36587. }),
  36588. $globals.SemanticAnalyzer);
  36589. $core.addMethod(
  36590. $core.method({
  36591. selector: "pushScope:",
  36592. protocol: "scope",
  36593. fn: function (aScope){
  36594. var self=this;
  36595. return $core.withContext(function($ctx1) {
  36596. $recv(aScope)._outerScope_(self["@currentScope"]);
  36597. self["@currentScope"]=aScope;
  36598. return self;
  36599. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  36600. },
  36601. args: ["aScope"],
  36602. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  36603. referencedClasses: [],
  36604. messageSends: ["outerScope:"]
  36605. }),
  36606. $globals.SemanticAnalyzer);
  36607. $core.addMethod(
  36608. $core.method({
  36609. selector: "theClass",
  36610. protocol: "accessing",
  36611. fn: function (){
  36612. var self=this;
  36613. return self["@theClass"];
  36614. },
  36615. args: [],
  36616. source: "theClass\x0a\x09^ theClass",
  36617. referencedClasses: [],
  36618. messageSends: []
  36619. }),
  36620. $globals.SemanticAnalyzer);
  36621. $core.addMethod(
  36622. $core.method({
  36623. selector: "theClass:",
  36624. protocol: "accessing",
  36625. fn: function (aClass){
  36626. var self=this;
  36627. self["@theClass"]=aClass;
  36628. return self;
  36629. },
  36630. args: ["aClass"],
  36631. source: "theClass: aClass\x0a\x09theClass := aClass",
  36632. referencedClasses: [],
  36633. messageSends: []
  36634. }),
  36635. $globals.SemanticAnalyzer);
  36636. $core.addMethod(
  36637. $core.method({
  36638. selector: "thePackage",
  36639. protocol: "accessing",
  36640. fn: function (){
  36641. var self=this;
  36642. return self["@thePackage"];
  36643. },
  36644. args: [],
  36645. source: "thePackage\x0a\x09^ thePackage",
  36646. referencedClasses: [],
  36647. messageSends: []
  36648. }),
  36649. $globals.SemanticAnalyzer);
  36650. $core.addMethod(
  36651. $core.method({
  36652. selector: "thePackage:",
  36653. protocol: "accessing",
  36654. fn: function (aPackage){
  36655. var self=this;
  36656. self["@thePackage"]=aPackage;
  36657. return self;
  36658. },
  36659. args: ["aPackage"],
  36660. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  36661. referencedClasses: [],
  36662. messageSends: []
  36663. }),
  36664. $globals.SemanticAnalyzer);
  36665. $core.addMethod(
  36666. $core.method({
  36667. selector: "validateVariableScope:",
  36668. protocol: "scope",
  36669. fn: function (aString){
  36670. var self=this;
  36671. return $core.withContext(function($ctx1) {
  36672. var $1,$receiver;
  36673. $1=$recv(self["@currentScope"])._lookupVariable_(aString);
  36674. if(($receiver = $1) == null || $receiver.isNil){
  36675. $1;
  36676. } else {
  36677. self._errorShadowingVariable_(aString);
  36678. }
  36679. return self;
  36680. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  36681. },
  36682. args: ["aString"],
  36683. 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 ]",
  36684. referencedClasses: [],
  36685. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  36686. }),
  36687. $globals.SemanticAnalyzer);
  36688. $core.addMethod(
  36689. $core.method({
  36690. selector: "visitAssignmentNode:",
  36691. protocol: "visiting",
  36692. fn: function (aNode){
  36693. var self=this;
  36694. return $core.withContext(function($ctx1) {
  36695. (
  36696. $ctx1.supercall = true,
  36697. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($recv(self), [aNode]));
  36698. $ctx1.supercall = false;
  36699. $recv($recv(aNode)._left())._beAssigned();
  36700. return self;
  36701. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  36702. },
  36703. args: ["aNode"],
  36704. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  36705. referencedClasses: [],
  36706. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  36707. }),
  36708. $globals.SemanticAnalyzer);
  36709. $core.addMethod(
  36710. $core.method({
  36711. selector: "visitBlockNode:",
  36712. protocol: "visiting",
  36713. fn: function (aNode){
  36714. var self=this;
  36715. return $core.withContext(function($ctx1) {
  36716. self._pushScope_(self._newBlockScope());
  36717. $recv(aNode)._scope_(self["@currentScope"]);
  36718. $recv(self["@currentScope"])._node_(aNode);
  36719. $recv(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  36720. $recv($recv(aNode)._parameters())._do_((function(each){
  36721. return $core.withContext(function($ctx2) {
  36722. self._validateVariableScope_(each);
  36723. return $recv(self["@currentScope"])._addArg_(each);
  36724. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36725. }));
  36726. (
  36727. $ctx1.supercall = true,
  36728. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($recv(self), [aNode]));
  36729. $ctx1.supercall = false;
  36730. self._popScope();
  36731. return self;
  36732. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  36733. },
  36734. args: ["aNode"],
  36735. 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",
  36736. referencedClasses: [],
  36737. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  36738. }),
  36739. $globals.SemanticAnalyzer);
  36740. $core.addMethod(
  36741. $core.method({
  36742. selector: "visitCascadeNode:",
  36743. protocol: "visiting",
  36744. fn: function (aNode){
  36745. var self=this;
  36746. return $core.withContext(function($ctx1) {
  36747. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  36748. (
  36749. $ctx1.supercall = true,
  36750. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($recv(self), [aNode]));
  36751. $ctx1.supercall = false;
  36752. return self;
  36753. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  36754. },
  36755. args: ["aNode"],
  36756. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  36757. referencedClasses: [],
  36758. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  36759. }),
  36760. $globals.SemanticAnalyzer);
  36761. $core.addMethod(
  36762. $core.method({
  36763. selector: "visitMethodNode:",
  36764. protocol: "visiting",
  36765. fn: function (aNode){
  36766. var self=this;
  36767. return $core.withContext(function($ctx1) {
  36768. self._pushScope_(self._newMethodScope());
  36769. $recv(aNode)._scope_(self["@currentScope"]);
  36770. $recv(self["@currentScope"])._node_(aNode);
  36771. $recv($recv(self._theClass())._allInstanceVariableNames())._do_((function(each){
  36772. return $core.withContext(function($ctx2) {
  36773. return $recv(self["@currentScope"])._addIVar_(each);
  36774. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36775. }));
  36776. $ctx1.sendIdx["do:"]=1;
  36777. $recv($recv(aNode)._arguments())._do_((function(each){
  36778. return $core.withContext(function($ctx2) {
  36779. self._validateVariableScope_(each);
  36780. return $recv(self["@currentScope"])._addArg_(each);
  36781. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36782. }));
  36783. (
  36784. $ctx1.supercall = true,
  36785. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($recv(self), [aNode]));
  36786. $ctx1.supercall = false;
  36787. $recv(aNode)._classReferences_(self._classReferences());
  36788. $recv(aNode)._sendIndexes_(self._messageSends());
  36789. self._popScope();
  36790. return aNode;
  36791. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  36792. },
  36793. args: ["aNode"],
  36794. 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",
  36795. referencedClasses: [],
  36796. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  36797. }),
  36798. $globals.SemanticAnalyzer);
  36799. $core.addMethod(
  36800. $core.method({
  36801. selector: "visitReturnNode:",
  36802. protocol: "visiting",
  36803. fn: function (aNode){
  36804. var self=this;
  36805. return $core.withContext(function($ctx1) {
  36806. var $1;
  36807. $recv(aNode)._scope_(self["@currentScope"]);
  36808. $1=$recv(self["@currentScope"])._isMethodScope();
  36809. if($core.assert($1)){
  36810. $recv(self["@currentScope"])._localReturn_(true);
  36811. } else {
  36812. $recv($recv(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  36813. }
  36814. (
  36815. $ctx1.supercall = true,
  36816. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($recv(self), [aNode]));
  36817. $ctx1.supercall = false;
  36818. return self;
  36819. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  36820. },
  36821. args: ["aNode"],
  36822. 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",
  36823. referencedClasses: [],
  36824. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  36825. }),
  36826. $globals.SemanticAnalyzer);
  36827. $core.addMethod(
  36828. $core.method({
  36829. selector: "visitSendNode:",
  36830. protocol: "visiting",
  36831. fn: function (aNode){
  36832. var self=this;
  36833. var sends;
  36834. return $core.withContext(function($ctx1) {
  36835. sends=$recv(self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  36836. return $core.withContext(function($ctx2) {
  36837. return $recv($globals.OrderedCollection)._new();
  36838. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36839. }));
  36840. $recv(sends)._add_(aNode);
  36841. $recv(aNode)._index_($recv(sends)._size());
  36842. (
  36843. $ctx1.supercall = true,
  36844. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  36845. $ctx1.supercall = false;
  36846. return self;
  36847. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends},$globals.SemanticAnalyzer)});
  36848. },
  36849. args: ["aNode"],
  36850. 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",
  36851. referencedClasses: ["OrderedCollection"],
  36852. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  36853. }),
  36854. $globals.SemanticAnalyzer);
  36855. $core.addMethod(
  36856. $core.method({
  36857. selector: "visitSequenceNode:",
  36858. protocol: "visiting",
  36859. fn: function (aNode){
  36860. var self=this;
  36861. return $core.withContext(function($ctx1) {
  36862. $recv($recv(aNode)._temps())._do_((function(each){
  36863. return $core.withContext(function($ctx2) {
  36864. self._validateVariableScope_(each);
  36865. return $recv(self["@currentScope"])._addTemp_(each);
  36866. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36867. }));
  36868. (
  36869. $ctx1.supercall = true,
  36870. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  36871. $ctx1.supercall = false;
  36872. return self;
  36873. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  36874. },
  36875. args: ["aNode"],
  36876. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  36877. referencedClasses: [],
  36878. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  36879. }),
  36880. $globals.SemanticAnalyzer);
  36881. $core.addMethod(
  36882. $core.method({
  36883. selector: "visitVariableNode:",
  36884. protocol: "visiting",
  36885. fn: function (aNode){
  36886. var self=this;
  36887. var binding;
  36888. return $core.withContext(function($ctx1) {
  36889. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  36890. binding=$recv(self["@currentScope"])._lookupVariable_(aNode);
  36891. $1=binding;
  36892. if(($receiver = $1) == null || $receiver.isNil){
  36893. $3=$recv(aNode)._value();
  36894. $ctx1.sendIdx["value"]=1;
  36895. $2=$recv($3)._isCapitalized();
  36896. if($core.assert($2)){
  36897. $4=$recv($globals.ClassRefVar)._new();
  36898. $ctx1.sendIdx["new"]=1;
  36899. $5=$recv(aNode)._value();
  36900. $ctx1.sendIdx["value"]=2;
  36901. $recv($4)._name_($5);
  36902. $ctx1.sendIdx["name:"]=1;
  36903. $6=$recv($4)._yourself();
  36904. $ctx1.sendIdx["yourself"]=1;
  36905. binding=$6;
  36906. binding;
  36907. $7=self._classReferences();
  36908. $8=$recv(aNode)._value();
  36909. $ctx1.sendIdx["value"]=3;
  36910. $recv($7)._add_($8);
  36911. } else {
  36912. self._errorUnknownVariable_(aNode);
  36913. $9=$recv($globals.UnknownVar)._new();
  36914. $recv($9)._name_($recv(aNode)._value());
  36915. binding=$recv($9)._yourself();
  36916. binding;
  36917. }
  36918. } else {
  36919. $1;
  36920. }
  36921. $recv(aNode)._binding_(binding);
  36922. return self;
  36923. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  36924. },
  36925. args: ["aNode"],
  36926. 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.",
  36927. referencedClasses: ["ClassRefVar", "UnknownVar"],
  36928. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  36929. }),
  36930. $globals.SemanticAnalyzer);
  36931. $core.addMethod(
  36932. $core.method({
  36933. selector: "on:",
  36934. protocol: "instance creation",
  36935. fn: function (aClass){
  36936. var self=this;
  36937. return $core.withContext(function($ctx1) {
  36938. var $1;
  36939. $1=self._new();
  36940. $recv($1)._theClass_(aClass);
  36941. return $recv($1)._yourself();
  36942. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.klass)});
  36943. },
  36944. args: ["aClass"],
  36945. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  36946. referencedClasses: [],
  36947. messageSends: ["theClass:", "new", "yourself"]
  36948. }),
  36949. $globals.SemanticAnalyzer.klass);
  36950. $core.addClass("SemanticError", $globals.CompilerError, [], "Compiler-Semantic");
  36951. $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";
  36952. $core.addClass("InvalidAssignmentError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  36953. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  36954. $core.addMethod(
  36955. $core.method({
  36956. selector: "messageText",
  36957. protocol: "accessing",
  36958. fn: function (){
  36959. var self=this;
  36960. return $core.withContext(function($ctx1) {
  36961. return " Invalid assignment to variable: ".__comma(self._variableName());
  36962. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  36963. },
  36964. args: [],
  36965. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  36966. referencedClasses: [],
  36967. messageSends: [",", "variableName"]
  36968. }),
  36969. $globals.InvalidAssignmentError);
  36970. $core.addMethod(
  36971. $core.method({
  36972. selector: "variableName",
  36973. protocol: "accessing",
  36974. fn: function (){
  36975. var self=this;
  36976. return self["@variableName"];
  36977. },
  36978. args: [],
  36979. source: "variableName\x0a\x09^ variableName",
  36980. referencedClasses: [],
  36981. messageSends: []
  36982. }),
  36983. $globals.InvalidAssignmentError);
  36984. $core.addMethod(
  36985. $core.method({
  36986. selector: "variableName:",
  36987. protocol: "accessing",
  36988. fn: function (aString){
  36989. var self=this;
  36990. self["@variableName"]=aString;
  36991. return self;
  36992. },
  36993. args: ["aString"],
  36994. source: "variableName: aString\x0a\x09variableName := aString",
  36995. referencedClasses: [],
  36996. messageSends: []
  36997. }),
  36998. $globals.InvalidAssignmentError);
  36999. $core.addClass("ShadowingVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  37000. $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.";
  37001. $core.addMethod(
  37002. $core.method({
  37003. selector: "messageText",
  37004. protocol: "accessing",
  37005. fn: function (){
  37006. var self=this;
  37007. return $core.withContext(function($ctx1) {
  37008. var $1;
  37009. $1=$recv("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  37010. $ctx1.sendIdx[","]=1;
  37011. return $1;
  37012. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  37013. },
  37014. args: [],
  37015. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  37016. referencedClasses: [],
  37017. messageSends: [",", "variableName"]
  37018. }),
  37019. $globals.ShadowingVariableError);
  37020. $core.addMethod(
  37021. $core.method({
  37022. selector: "variableName",
  37023. protocol: "accessing",
  37024. fn: function (){
  37025. var self=this;
  37026. return self["@variableName"];
  37027. },
  37028. args: [],
  37029. source: "variableName\x0a\x09^ variableName",
  37030. referencedClasses: [],
  37031. messageSends: []
  37032. }),
  37033. $globals.ShadowingVariableError);
  37034. $core.addMethod(
  37035. $core.method({
  37036. selector: "variableName:",
  37037. protocol: "accessing",
  37038. fn: function (aString){
  37039. var self=this;
  37040. self["@variableName"]=aString;
  37041. return self;
  37042. },
  37043. args: ["aString"],
  37044. source: "variableName: aString\x0a\x09variableName := aString",
  37045. referencedClasses: [],
  37046. messageSends: []
  37047. }),
  37048. $globals.ShadowingVariableError);
  37049. $core.addClass("UnknownVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  37050. $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.";
  37051. $core.addMethod(
  37052. $core.method({
  37053. selector: "messageText",
  37054. protocol: "accessing",
  37055. fn: function (){
  37056. var self=this;
  37057. return $core.withContext(function($ctx1) {
  37058. var $1;
  37059. $1=$recv("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  37060. $ctx1.sendIdx[","]=1;
  37061. return $1;
  37062. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  37063. },
  37064. args: [],
  37065. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  37066. referencedClasses: [],
  37067. messageSends: [",", "variableName"]
  37068. }),
  37069. $globals.UnknownVariableError);
  37070. $core.addMethod(
  37071. $core.method({
  37072. selector: "variableName",
  37073. protocol: "accessing",
  37074. fn: function (){
  37075. var self=this;
  37076. return self["@variableName"];
  37077. },
  37078. args: [],
  37079. source: "variableName\x0a\x09^ variableName",
  37080. referencedClasses: [],
  37081. messageSends: []
  37082. }),
  37083. $globals.UnknownVariableError);
  37084. $core.addMethod(
  37085. $core.method({
  37086. selector: "variableName:",
  37087. protocol: "accessing",
  37088. fn: function (aString){
  37089. var self=this;
  37090. self["@variableName"]=aString;
  37091. return self;
  37092. },
  37093. args: ["aString"],
  37094. source: "variableName: aString\x0a\x09variableName := aString",
  37095. referencedClasses: [],
  37096. messageSends: []
  37097. }),
  37098. $globals.UnknownVariableError);
  37099. });
  37100. 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";
  37101. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  37102. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  37103. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  37104. $core.addPackage("Compiler-IR");
  37105. $core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  37106. $core.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  37107. $core.addClass("IRASTTranslator", $globals.NodeVisitor, ["source", "theClass", "method", "sequence", "nextAlias"], "Compiler-IR");
  37108. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  37109. $core.addMethod(
  37110. $core.method({
  37111. selector: "alias:",
  37112. protocol: "visiting",
  37113. fn: function (aNode){
  37114. var self=this;
  37115. var variable;
  37116. return $core.withContext(function($ctx1) {
  37117. var $1,$2,$3,$5,$4,$6,$7,$9,$8;
  37118. $1=$recv(aNode)._isImmutable();
  37119. if($core.assert($1)){
  37120. $2=self._visit_(aNode);
  37121. $ctx1.sendIdx["visit:"]=1;
  37122. return $2;
  37123. }
  37124. $3=$recv($globals.IRVariable)._new();
  37125. $ctx1.sendIdx["new"]=1;
  37126. $5=$recv($globals.AliasVar)._new();
  37127. $ctx1.sendIdx["new"]=2;
  37128. $4=$recv($5)._name_("$".__comma(self._nextAlias()));
  37129. $recv($3)._variable_($4);
  37130. $6=$recv($3)._yourself();
  37131. $ctx1.sendIdx["yourself"]=1;
  37132. variable=$6;
  37133. $7=self._sequence();
  37134. $9=$recv($globals.IRAssignment)._new();
  37135. $recv($9)._add_(variable);
  37136. $ctx1.sendIdx["add:"]=2;
  37137. $recv($9)._add_(self._visit_(aNode));
  37138. $ctx1.sendIdx["add:"]=3;
  37139. $8=$recv($9)._yourself();
  37140. $recv($7)._add_($8);
  37141. $ctx1.sendIdx["add:"]=1;
  37142. $recv($recv(self._method())._internalVariables())._add_(variable);
  37143. return variable;
  37144. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  37145. },
  37146. args: ["aNode"],
  37147. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  37148. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  37149. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  37150. }),
  37151. $globals.IRASTTranslator);
  37152. $core.addMethod(
  37153. $core.method({
  37154. selector: "aliasTemporally:",
  37155. protocol: "visiting",
  37156. fn: function (aCollection){
  37157. var self=this;
  37158. var threshold,result;
  37159. return $core.withContext(function($ctx1) {
  37160. var $1,$2,$4,$3;
  37161. threshold=(0);
  37162. $recv(aCollection)._withIndexDo_((function(each,i){
  37163. return $core.withContext(function($ctx2) {
  37164. $1=$recv(each)._subtreeNeedsAliasing();
  37165. if($core.assert($1)){
  37166. threshold=i;
  37167. return threshold;
  37168. }
  37169. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  37170. }));
  37171. $ctx1.sendIdx["withIndexDo:"]=1;
  37172. result=$recv($globals.OrderedCollection)._new();
  37173. $recv(aCollection)._withIndexDo_((function(each,i){
  37174. return $core.withContext(function($ctx2) {
  37175. $2=result;
  37176. $4=$recv(i).__lt_eq(threshold);
  37177. if($core.assert($4)){
  37178. $3=self._alias_(each);
  37179. } else {
  37180. $3=self._visit_(each);
  37181. }
  37182. return $recv($2)._add_($3);
  37183. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  37184. }));
  37185. return result;
  37186. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  37187. },
  37188. args: ["aCollection"],
  37189. 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",
  37190. referencedClasses: ["OrderedCollection"],
  37191. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  37192. }),
  37193. $globals.IRASTTranslator);
  37194. $core.addMethod(
  37195. $core.method({
  37196. selector: "method",
  37197. protocol: "accessing",
  37198. fn: function (){
  37199. var self=this;
  37200. return self["@method"];
  37201. },
  37202. args: [],
  37203. source: "method\x0a\x09^ method",
  37204. referencedClasses: [],
  37205. messageSends: []
  37206. }),
  37207. $globals.IRASTTranslator);
  37208. $core.addMethod(
  37209. $core.method({
  37210. selector: "method:",
  37211. protocol: "accessing",
  37212. fn: function (anIRMethod){
  37213. var self=this;
  37214. self["@method"]=anIRMethod;
  37215. return self;
  37216. },
  37217. args: ["anIRMethod"],
  37218. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  37219. referencedClasses: [],
  37220. messageSends: []
  37221. }),
  37222. $globals.IRASTTranslator);
  37223. $core.addMethod(
  37224. $core.method({
  37225. selector: "nextAlias",
  37226. protocol: "accessing",
  37227. fn: function (){
  37228. var self=this;
  37229. return $core.withContext(function($ctx1) {
  37230. var $1,$receiver;
  37231. $1=self["@nextAlias"];
  37232. if(($receiver = $1) == null || $receiver.isNil){
  37233. self["@nextAlias"]=(0);
  37234. self["@nextAlias"];
  37235. } else {
  37236. $1;
  37237. }
  37238. self["@nextAlias"]=$recv(self["@nextAlias"]).__plus((1));
  37239. return $recv(self["@nextAlias"])._asString();
  37240. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  37241. },
  37242. args: [],
  37243. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  37244. referencedClasses: [],
  37245. messageSends: ["ifNil:", "+", "asString"]
  37246. }),
  37247. $globals.IRASTTranslator);
  37248. $core.addMethod(
  37249. $core.method({
  37250. selector: "sequence",
  37251. protocol: "accessing",
  37252. fn: function (){
  37253. var self=this;
  37254. return self["@sequence"];
  37255. },
  37256. args: [],
  37257. source: "sequence\x0a\x09^ sequence",
  37258. referencedClasses: [],
  37259. messageSends: []
  37260. }),
  37261. $globals.IRASTTranslator);
  37262. $core.addMethod(
  37263. $core.method({
  37264. selector: "sequence:",
  37265. protocol: "accessing",
  37266. fn: function (anIRSequence){
  37267. var self=this;
  37268. self["@sequence"]=anIRSequence;
  37269. return self;
  37270. },
  37271. args: ["anIRSequence"],
  37272. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  37273. referencedClasses: [],
  37274. messageSends: []
  37275. }),
  37276. $globals.IRASTTranslator);
  37277. $core.addMethod(
  37278. $core.method({
  37279. selector: "source",
  37280. protocol: "accessing",
  37281. fn: function (){
  37282. var self=this;
  37283. return self["@source"];
  37284. },
  37285. args: [],
  37286. source: "source\x0a\x09^ source",
  37287. referencedClasses: [],
  37288. messageSends: []
  37289. }),
  37290. $globals.IRASTTranslator);
  37291. $core.addMethod(
  37292. $core.method({
  37293. selector: "source:",
  37294. protocol: "accessing",
  37295. fn: function (aString){
  37296. var self=this;
  37297. self["@source"]=aString;
  37298. return self;
  37299. },
  37300. args: ["aString"],
  37301. source: "source: aString\x0a\x09source := aString",
  37302. referencedClasses: [],
  37303. messageSends: []
  37304. }),
  37305. $globals.IRASTTranslator);
  37306. $core.addMethod(
  37307. $core.method({
  37308. selector: "theClass",
  37309. protocol: "accessing",
  37310. fn: function (){
  37311. var self=this;
  37312. return self["@theClass"];
  37313. },
  37314. args: [],
  37315. source: "theClass\x0a\x09^ theClass",
  37316. referencedClasses: [],
  37317. messageSends: []
  37318. }),
  37319. $globals.IRASTTranslator);
  37320. $core.addMethod(
  37321. $core.method({
  37322. selector: "theClass:",
  37323. protocol: "accessing",
  37324. fn: function (aClass){
  37325. var self=this;
  37326. self["@theClass"]=aClass;
  37327. return self;
  37328. },
  37329. args: ["aClass"],
  37330. source: "theClass: aClass\x0a\x09theClass := aClass",
  37331. referencedClasses: [],
  37332. messageSends: []
  37333. }),
  37334. $globals.IRASTTranslator);
  37335. $core.addMethod(
  37336. $core.method({
  37337. selector: "visitAssignmentNode:",
  37338. protocol: "visiting",
  37339. fn: function (aNode){
  37340. var self=this;
  37341. var left,right,assignment;
  37342. return $core.withContext(function($ctx1) {
  37343. var $1,$3,$2;
  37344. right=self._visit_($recv(aNode)._right());
  37345. $ctx1.sendIdx["visit:"]=1;
  37346. left=self._visit_($recv(aNode)._left());
  37347. $1=self._sequence();
  37348. $3=$recv($globals.IRAssignment)._new();
  37349. $recv($3)._add_(left);
  37350. $ctx1.sendIdx["add:"]=2;
  37351. $recv($3)._add_(right);
  37352. $2=$recv($3)._yourself();
  37353. $recv($1)._add_($2);
  37354. $ctx1.sendIdx["add:"]=1;
  37355. return left;
  37356. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  37357. },
  37358. args: ["aNode"],
  37359. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  37360. referencedClasses: ["IRAssignment"],
  37361. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  37362. }),
  37363. $globals.IRASTTranslator);
  37364. $core.addMethod(
  37365. $core.method({
  37366. selector: "visitBlockNode:",
  37367. protocol: "visiting",
  37368. fn: function (aNode){
  37369. var self=this;
  37370. var closure;
  37371. return $core.withContext(function($ctx1) {
  37372. var $1,$2,$3,$5,$4,$6,$8,$7;
  37373. $1=$recv($globals.IRClosure)._new();
  37374. $ctx1.sendIdx["new"]=1;
  37375. $recv($1)._arguments_($recv(aNode)._parameters());
  37376. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  37377. $2=$recv(aNode)._scope();
  37378. $ctx1.sendIdx["scope"]=1;
  37379. $recv($1)._scope_($2);
  37380. $ctx1.sendIdx["scope:"]=1;
  37381. $3=$recv($1)._yourself();
  37382. $ctx1.sendIdx["yourself"]=1;
  37383. closure=$3;
  37384. $5=$recv(aNode)._scope();
  37385. $ctx1.sendIdx["scope"]=2;
  37386. $4=$recv($5)._temps();
  37387. $recv($4)._do_((function(each){
  37388. return $core.withContext(function($ctx2) {
  37389. $6=closure;
  37390. $8=$recv($globals.IRTempDeclaration)._new();
  37391. $recv($8)._name_($recv(each)._name());
  37392. $recv($8)._scope_($recv(aNode)._scope());
  37393. $7=$recv($8)._yourself();
  37394. return $recv($6)._add_($7);
  37395. $ctx2.sendIdx["add:"]=1;
  37396. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37397. }));
  37398. $ctx1.sendIdx["do:"]=1;
  37399. $recv($recv(aNode)._dagChildren())._do_((function(each){
  37400. return $core.withContext(function($ctx2) {
  37401. return $recv(closure)._add_(self._visit_(each));
  37402. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37403. }));
  37404. return closure;
  37405. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  37406. },
  37407. args: ["aNode"],
  37408. 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",
  37409. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  37410. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  37411. }),
  37412. $globals.IRASTTranslator);
  37413. $core.addMethod(
  37414. $core.method({
  37415. selector: "visitBlockSequenceNode:",
  37416. protocol: "visiting",
  37417. fn: function (aNode){
  37418. var self=this;
  37419. return $core.withContext(function($ctx1) {
  37420. var $1,$2,$4,$3,$5,$6,$9,$8,$7,$10,$12,$15,$14,$13,$11;
  37421. $1=$recv($globals.IRBlockSequence)._new();
  37422. $ctx1.sendIdx["new"]=1;
  37423. return self._withSequence_do_($1,(function(){
  37424. return $core.withContext(function($ctx2) {
  37425. $2=$recv(aNode)._dagChildren();
  37426. $ctx2.sendIdx["dagChildren"]=1;
  37427. return $recv($2)._ifNotEmpty_((function(){
  37428. return $core.withContext(function($ctx3) {
  37429. $4=$recv(aNode)._dagChildren();
  37430. $ctx3.sendIdx["dagChildren"]=2;
  37431. $3=$recv($4)._allButLast();
  37432. $recv($3)._do_((function(each){
  37433. return $core.withContext(function($ctx4) {
  37434. $5=self._sequence();
  37435. $ctx4.sendIdx["sequence"]=1;
  37436. $6=self._visitOrAlias_(each);
  37437. $ctx4.sendIdx["visitOrAlias:"]=1;
  37438. return $recv($5)._add_($6);
  37439. $ctx4.sendIdx["add:"]=1;
  37440. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  37441. }));
  37442. $9=$recv(aNode)._dagChildren();
  37443. $ctx3.sendIdx["dagChildren"]=3;
  37444. $8=$recv($9)._last();
  37445. $ctx3.sendIdx["last"]=1;
  37446. $7=$recv($8)._isReturnNode();
  37447. if($core.assert($7)){
  37448. return $recv(self._sequence())._add_(self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  37449. } else {
  37450. $10=self._sequence();
  37451. $ctx3.sendIdx["sequence"]=2;
  37452. $12=$recv($globals.IRBlockReturn)._new();
  37453. $15=$recv(aNode)._dagChildren();
  37454. $ctx3.sendIdx["dagChildren"]=4;
  37455. $14=$recv($15)._last();
  37456. $ctx3.sendIdx["last"]=2;
  37457. $13=self._visitOrAlias_($14);
  37458. $ctx3.sendIdx["visitOrAlias:"]=2;
  37459. $recv($12)._add_($13);
  37460. $ctx3.sendIdx["add:"]=3;
  37461. $11=$recv($12)._yourself();
  37462. return $recv($10)._add_($11);
  37463. $ctx3.sendIdx["add:"]=2;
  37464. }
  37465. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  37466. }));
  37467. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37468. }));
  37469. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  37470. },
  37471. args: ["aNode"],
  37472. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren ifNotEmpty: [\x0a\x09\x09\x09\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self sequence add: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode dagChildren last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode dagChildren last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visitOrAlias: aNode dagChildren last) ] ]]",
  37473. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  37474. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  37475. }),
  37476. $globals.IRASTTranslator);
  37477. $core.addMethod(
  37478. $core.method({
  37479. selector: "visitCascadeNode:",
  37480. protocol: "visiting",
  37481. fn: function (aNode){
  37482. var self=this;
  37483. var receiver;
  37484. return $core.withContext(function($ctx1) {
  37485. var $1,$2,$4,$3;
  37486. receiver=$recv(aNode)._receiver();
  37487. $1=$recv(receiver)._isImmutable();
  37488. if(!$core.assert($1)){
  37489. var alias;
  37490. alias=self._alias_(receiver);
  37491. alias;
  37492. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  37493. receiver;
  37494. }
  37495. $2=$recv(aNode)._dagChildren();
  37496. $ctx1.sendIdx["dagChildren"]=1;
  37497. $recv($2)._do_((function(each){
  37498. return $core.withContext(function($ctx2) {
  37499. return $recv(each)._receiver_(receiver);
  37500. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37501. }));
  37502. $ctx1.sendIdx["do:"]=1;
  37503. $4=$recv(aNode)._dagChildren();
  37504. $ctx1.sendIdx["dagChildren"]=2;
  37505. $3=$recv($4)._allButLast();
  37506. $recv($3)._do_((function(each){
  37507. return $core.withContext(function($ctx2) {
  37508. return $recv(self._sequence())._add_(self._visit_(each));
  37509. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  37510. }));
  37511. return self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  37512. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver},$globals.IRASTTranslator)});
  37513. },
  37514. args: ["aNode"],
  37515. source: "visitCascadeNode: aNode\x0a\x09| receiver |\x0a\x09receiver := aNode receiver.\x0a\x09receiver isImmutable ifFalse: [\x0a\x09\x09| alias |\x0a\x09\x09alias := self alias: receiver.\x0a\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09aNode dagChildren do: [ :each | each receiver: receiver ].\x0a\x0a\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode dagChildren last",
  37516. referencedClasses: ["VariableNode"],
  37517. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "add:", "sequence", "visit:", "visitOrAlias:", "last"]
  37518. }),
  37519. $globals.IRASTTranslator);
  37520. $core.addMethod(
  37521. $core.method({
  37522. selector: "visitDynamicArrayNode:",
  37523. protocol: "visiting",
  37524. fn: function (aNode){
  37525. var self=this;
  37526. var array;
  37527. return $core.withContext(function($ctx1) {
  37528. array=$recv($globals.IRDynamicArray)._new();
  37529. $recv(self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  37530. return $core.withContext(function($ctx2) {
  37531. return $recv(array)._add_(each);
  37532. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37533. }));
  37534. return array;
  37535. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  37536. },
  37537. args: ["aNode"],
  37538. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  37539. referencedClasses: ["IRDynamicArray"],
  37540. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  37541. }),
  37542. $globals.IRASTTranslator);
  37543. $core.addMethod(
  37544. $core.method({
  37545. selector: "visitDynamicDictionaryNode:",
  37546. protocol: "visiting",
  37547. fn: function (aNode){
  37548. var self=this;
  37549. var dictionary;
  37550. return $core.withContext(function($ctx1) {
  37551. dictionary=$recv($globals.IRDynamicDictionary)._new();
  37552. $recv(self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  37553. return $core.withContext(function($ctx2) {
  37554. return $recv(dictionary)._add_(each);
  37555. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37556. }));
  37557. return dictionary;
  37558. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  37559. },
  37560. args: ["aNode"],
  37561. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  37562. referencedClasses: ["IRDynamicDictionary"],
  37563. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  37564. }),
  37565. $globals.IRASTTranslator);
  37566. $core.addMethod(
  37567. $core.method({
  37568. selector: "visitJSStatementNode:",
  37569. protocol: "visiting",
  37570. fn: function (aNode){
  37571. var self=this;
  37572. return $core.withContext(function($ctx1) {
  37573. var $1;
  37574. $1=$recv($globals.IRVerbatim)._new();
  37575. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  37576. return $recv($1)._yourself();
  37577. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  37578. },
  37579. args: ["aNode"],
  37580. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  37581. referencedClasses: ["IRVerbatim"],
  37582. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  37583. }),
  37584. $globals.IRASTTranslator);
  37585. $core.addMethod(
  37586. $core.method({
  37587. selector: "visitMethodNode:",
  37588. protocol: "visiting",
  37589. fn: function (aNode){
  37590. var self=this;
  37591. return $core.withContext(function($ctx1) {
  37592. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  37593. $2=$recv($globals.IRMethod)._new();
  37594. $ctx1.sendIdx["new"]=1;
  37595. $recv($2)._source_($recv(self._source())._crlfSanitized());
  37596. $ctx1.sendIdx["source:"]=1;
  37597. $recv($2)._theClass_(self._theClass());
  37598. $recv($2)._arguments_($recv(aNode)._arguments());
  37599. $recv($2)._selector_($recv(aNode)._selector());
  37600. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  37601. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  37602. $recv($2)._classReferences_($recv(aNode)._classReferences());
  37603. $3=$recv(aNode)._scope();
  37604. $ctx1.sendIdx["scope"]=1;
  37605. $recv($2)._scope_($3);
  37606. $ctx1.sendIdx["scope:"]=1;
  37607. $4=$recv($2)._yourself();
  37608. $ctx1.sendIdx["yourself"]=1;
  37609. $1=$4;
  37610. self._method_($1);
  37611. $6=$recv(aNode)._scope();
  37612. $ctx1.sendIdx["scope"]=2;
  37613. $5=$recv($6)._temps();
  37614. $recv($5)._do_((function(each){
  37615. return $core.withContext(function($ctx2) {
  37616. $7=self._method();
  37617. $ctx2.sendIdx["method"]=1;
  37618. $9=$recv($globals.IRTempDeclaration)._new();
  37619. $ctx2.sendIdx["new"]=2;
  37620. $recv($9)._name_($recv(each)._name());
  37621. $10=$recv(aNode)._scope();
  37622. $ctx2.sendIdx["scope"]=3;
  37623. $recv($9)._scope_($10);
  37624. $11=$recv($9)._yourself();
  37625. $ctx2.sendIdx["yourself"]=2;
  37626. $8=$11;
  37627. return $recv($7)._add_($8);
  37628. $ctx2.sendIdx["add:"]=1;
  37629. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37630. }));
  37631. $ctx1.sendIdx["do:"]=1;
  37632. $recv($recv(aNode)._dagChildren())._do_((function(each){
  37633. return $core.withContext(function($ctx2) {
  37634. $12=self._method();
  37635. $ctx2.sendIdx["method"]=2;
  37636. return $recv($12)._add_(self._visit_(each));
  37637. $ctx2.sendIdx["add:"]=2;
  37638. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37639. }));
  37640. $14=$recv(aNode)._scope();
  37641. $ctx1.sendIdx["scope"]=4;
  37642. $13=$recv($14)._hasLocalReturn();
  37643. if(!$core.assert($13)){
  37644. $15=self._method();
  37645. $ctx1.sendIdx["method"]=3;
  37646. $17=$recv($globals.IRReturn)._new();
  37647. $ctx1.sendIdx["new"]=3;
  37648. $19=$recv($globals.IRVariable)._new();
  37649. $ctx1.sendIdx["new"]=4;
  37650. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  37651. $20=$recv($19)._yourself();
  37652. $ctx1.sendIdx["yourself"]=3;
  37653. $18=$20;
  37654. $recv($17)._add_($18);
  37655. $ctx1.sendIdx["add:"]=4;
  37656. $21=$recv($17)._yourself();
  37657. $ctx1.sendIdx["yourself"]=4;
  37658. $16=$21;
  37659. $recv($15)._add_($16);
  37660. $ctx1.sendIdx["add:"]=3;
  37661. $23=$recv($globals.IRVerbatim)._new();
  37662. $recv($23)._source_("");
  37663. $22=$recv($23)._yourself();
  37664. $recv($15)._add_($22);
  37665. }
  37666. return self._method();
  37667. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  37668. },
  37669. args: ["aNode"],
  37670. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode dagChildren do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ''; yourself) ].\x0a\x0a\x09^ self method",
  37671. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  37672. 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"]
  37673. }),
  37674. $globals.IRASTTranslator);
  37675. $core.addMethod(
  37676. $core.method({
  37677. selector: "visitOrAlias:",
  37678. protocol: "visiting",
  37679. fn: function (aNode){
  37680. var self=this;
  37681. return $core.withContext(function($ctx1) {
  37682. var $1;
  37683. $1=$recv(aNode)._shouldBeAliased();
  37684. if($core.assert($1)){
  37685. return self._alias_(aNode);
  37686. } else {
  37687. return self._visit_(aNode);
  37688. }
  37689. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  37690. },
  37691. args: ["aNode"],
  37692. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  37693. referencedClasses: [],
  37694. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  37695. }),
  37696. $globals.IRASTTranslator);
  37697. $core.addMethod(
  37698. $core.method({
  37699. selector: "visitReturnNode:",
  37700. protocol: "visiting",
  37701. fn: function (aNode){
  37702. var self=this;
  37703. var return_;
  37704. return $core.withContext(function($ctx1) {
  37705. var $1;
  37706. $1=$recv(aNode)._nonLocalReturn();
  37707. if($core.assert($1)){
  37708. return_=$recv($globals.IRNonLocalReturn)._new();
  37709. $ctx1.sendIdx["new"]=1;
  37710. } else {
  37711. return_=$recv($globals.IRReturn)._new();
  37712. }
  37713. $recv(return_)._scope_($recv(aNode)._scope());
  37714. $recv($recv(aNode)._dagChildren())._do_((function(each){
  37715. return $core.withContext(function($ctx2) {
  37716. return $recv(return_)._add_(self._visitOrAlias_(each));
  37717. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  37718. }));
  37719. return return_;
  37720. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  37721. },
  37722. args: ["aNode"],
  37723. 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",
  37724. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  37725. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  37726. }),
  37727. $globals.IRASTTranslator);
  37728. $core.addMethod(
  37729. $core.method({
  37730. selector: "visitSendNode:",
  37731. protocol: "visiting",
  37732. fn: function (aNode){
  37733. var self=this;
  37734. var send;
  37735. return $core.withContext(function($ctx1) {
  37736. var $1;
  37737. send=$recv($globals.IRSend)._new();
  37738. $1=send;
  37739. $recv($1)._selector_($recv(aNode)._selector());
  37740. $recv($1)._index_($recv(aNode)._index());
  37741. $recv(self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  37742. return $core.withContext(function($ctx2) {
  37743. return $recv(send)._add_(each);
  37744. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37745. }));
  37746. return send;
  37747. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  37748. },
  37749. args: ["aNode"],
  37750. 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",
  37751. referencedClasses: ["IRSend"],
  37752. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  37753. }),
  37754. $globals.IRASTTranslator);
  37755. $core.addMethod(
  37756. $core.method({
  37757. selector: "visitSequenceNode:",
  37758. protocol: "visiting",
  37759. fn: function (aNode){
  37760. var self=this;
  37761. return $core.withContext(function($ctx1) {
  37762. var $1;
  37763. return self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  37764. return $core.withContext(function($ctx2) {
  37765. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  37766. var instruction;
  37767. return $core.withContext(function($ctx3) {
  37768. instruction=self._visitOrAlias_(each);
  37769. instruction;
  37770. $1=$recv(instruction)._isVariable();
  37771. if(!$core.assert($1)){
  37772. return $recv(self._sequence())._add_(instruction);
  37773. }
  37774. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  37775. }));
  37776. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37777. }));
  37778. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  37779. },
  37780. args: ["aNode"],
  37781. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visitOrAlias: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ] ]]",
  37782. referencedClasses: ["IRSequence"],
  37783. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  37784. }),
  37785. $globals.IRASTTranslator);
  37786. $core.addMethod(
  37787. $core.method({
  37788. selector: "visitValueNode:",
  37789. protocol: "visiting",
  37790. fn: function (aNode){
  37791. var self=this;
  37792. return $core.withContext(function($ctx1) {
  37793. var $1;
  37794. $1=$recv($globals.IRValue)._new();
  37795. $recv($1)._value_($recv(aNode)._value());
  37796. return $recv($1)._yourself();
  37797. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  37798. },
  37799. args: ["aNode"],
  37800. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  37801. referencedClasses: ["IRValue"],
  37802. messageSends: ["value:", "new", "value", "yourself"]
  37803. }),
  37804. $globals.IRASTTranslator);
  37805. $core.addMethod(
  37806. $core.method({
  37807. selector: "visitVariableNode:",
  37808. protocol: "visiting",
  37809. fn: function (aNode){
  37810. var self=this;
  37811. return $core.withContext(function($ctx1) {
  37812. var $1;
  37813. $1=$recv($globals.IRVariable)._new();
  37814. $recv($1)._variable_($recv(aNode)._binding());
  37815. return $recv($1)._yourself();
  37816. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  37817. },
  37818. args: ["aNode"],
  37819. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  37820. referencedClasses: ["IRVariable"],
  37821. messageSends: ["variable:", "new", "binding", "yourself"]
  37822. }),
  37823. $globals.IRASTTranslator);
  37824. $core.addMethod(
  37825. $core.method({
  37826. selector: "withSequence:do:",
  37827. protocol: "accessing",
  37828. fn: function (aSequence,aBlock){
  37829. var self=this;
  37830. var outerSequence;
  37831. return $core.withContext(function($ctx1) {
  37832. outerSequence=self._sequence();
  37833. self._sequence_(aSequence);
  37834. $ctx1.sendIdx["sequence:"]=1;
  37835. $recv(aBlock)._value();
  37836. self._sequence_(outerSequence);
  37837. return aSequence;
  37838. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  37839. },
  37840. args: ["aSequence", "aBlock"],
  37841. 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",
  37842. referencedClasses: [],
  37843. messageSends: ["sequence", "sequence:", "value"]
  37844. }),
  37845. $globals.IRASTTranslator);
  37846. $core.addClass("IRInstruction", $globals.DagParentNode, ["parent"], "Compiler-IR");
  37847. $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.";
  37848. $core.addMethod(
  37849. $core.method({
  37850. selector: "add:",
  37851. protocol: "building",
  37852. fn: function (anObject){
  37853. var self=this;
  37854. return $core.withContext(function($ctx1) {
  37855. $recv(anObject)._parent_(self);
  37856. return $recv(self._dagChildren())._add_(anObject);
  37857. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  37858. },
  37859. args: ["anObject"],
  37860. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  37861. referencedClasses: [],
  37862. messageSends: ["parent:", "add:", "dagChildren"]
  37863. }),
  37864. $globals.IRInstruction);
  37865. $core.addMethod(
  37866. $core.method({
  37867. selector: "isClosure",
  37868. protocol: "testing",
  37869. fn: function (){
  37870. var self=this;
  37871. return false;
  37872. },
  37873. args: [],
  37874. source: "isClosure\x0a\x09^ false",
  37875. referencedClasses: [],
  37876. messageSends: []
  37877. }),
  37878. $globals.IRInstruction);
  37879. $core.addMethod(
  37880. $core.method({
  37881. selector: "isInlined",
  37882. protocol: "testing",
  37883. fn: function (){
  37884. var self=this;
  37885. return false;
  37886. },
  37887. args: [],
  37888. source: "isInlined\x0a\x09^ false",
  37889. referencedClasses: [],
  37890. messageSends: []
  37891. }),
  37892. $globals.IRInstruction);
  37893. $core.addMethod(
  37894. $core.method({
  37895. selector: "isMethod",
  37896. protocol: "testing",
  37897. fn: function (){
  37898. var self=this;
  37899. return false;
  37900. },
  37901. args: [],
  37902. source: "isMethod\x0a\x09^ false",
  37903. referencedClasses: [],
  37904. messageSends: []
  37905. }),
  37906. $globals.IRInstruction);
  37907. $core.addMethod(
  37908. $core.method({
  37909. selector: "isSend",
  37910. protocol: "testing",
  37911. fn: function (){
  37912. var self=this;
  37913. return false;
  37914. },
  37915. args: [],
  37916. source: "isSend\x0a\x09^ false",
  37917. referencedClasses: [],
  37918. messageSends: []
  37919. }),
  37920. $globals.IRInstruction);
  37921. $core.addMethod(
  37922. $core.method({
  37923. selector: "isSequence",
  37924. protocol: "testing",
  37925. fn: function (){
  37926. var self=this;
  37927. return false;
  37928. },
  37929. args: [],
  37930. source: "isSequence\x0a\x09^ false",
  37931. referencedClasses: [],
  37932. messageSends: []
  37933. }),
  37934. $globals.IRInstruction);
  37935. $core.addMethod(
  37936. $core.method({
  37937. selector: "isTempDeclaration",
  37938. protocol: "testing",
  37939. fn: function (){
  37940. var self=this;
  37941. return false;
  37942. },
  37943. args: [],
  37944. source: "isTempDeclaration\x0a\x09^ false",
  37945. referencedClasses: [],
  37946. messageSends: []
  37947. }),
  37948. $globals.IRInstruction);
  37949. $core.addMethod(
  37950. $core.method({
  37951. selector: "isVariable",
  37952. protocol: "testing",
  37953. fn: function (){
  37954. var self=this;
  37955. return false;
  37956. },
  37957. args: [],
  37958. source: "isVariable\x0a\x09^ false",
  37959. referencedClasses: [],
  37960. messageSends: []
  37961. }),
  37962. $globals.IRInstruction);
  37963. $core.addMethod(
  37964. $core.method({
  37965. selector: "method",
  37966. protocol: "accessing",
  37967. fn: function (){
  37968. var self=this;
  37969. return $core.withContext(function($ctx1) {
  37970. return $recv(self._parent())._method();
  37971. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  37972. },
  37973. args: [],
  37974. source: "method\x0a\x09^ self parent method",
  37975. referencedClasses: [],
  37976. messageSends: ["method", "parent"]
  37977. }),
  37978. $globals.IRInstruction);
  37979. $core.addMethod(
  37980. $core.method({
  37981. selector: "needsBoxingAsReceiver",
  37982. protocol: "testing",
  37983. fn: function (){
  37984. var self=this;
  37985. return true;
  37986. },
  37987. args: [],
  37988. source: "needsBoxingAsReceiver\x0a\x09^ true",
  37989. referencedClasses: [],
  37990. messageSends: []
  37991. }),
  37992. $globals.IRInstruction);
  37993. $core.addMethod(
  37994. $core.method({
  37995. selector: "parent",
  37996. protocol: "accessing",
  37997. fn: function (){
  37998. var self=this;
  37999. return self["@parent"];
  38000. },
  38001. args: [],
  38002. source: "parent\x0a\x09^ parent",
  38003. referencedClasses: [],
  38004. messageSends: []
  38005. }),
  38006. $globals.IRInstruction);
  38007. $core.addMethod(
  38008. $core.method({
  38009. selector: "parent:",
  38010. protocol: "accessing",
  38011. fn: function (anIRInstruction){
  38012. var self=this;
  38013. self["@parent"]=anIRInstruction;
  38014. return self;
  38015. },
  38016. args: ["anIRInstruction"],
  38017. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  38018. referencedClasses: [],
  38019. messageSends: []
  38020. }),
  38021. $globals.IRInstruction);
  38022. $core.addMethod(
  38023. $core.method({
  38024. selector: "remove:",
  38025. protocol: "building",
  38026. fn: function (anIRInstruction){
  38027. var self=this;
  38028. return $core.withContext(function($ctx1) {
  38029. $recv(self._dagChildren())._remove_(anIRInstruction);
  38030. return self;
  38031. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  38032. },
  38033. args: ["anIRInstruction"],
  38034. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  38035. referencedClasses: [],
  38036. messageSends: ["remove:", "dagChildren"]
  38037. }),
  38038. $globals.IRInstruction);
  38039. $core.addMethod(
  38040. $core.method({
  38041. selector: "replace:with:",
  38042. protocol: "building",
  38043. fn: function (anIRInstruction,anotherIRInstruction){
  38044. var self=this;
  38045. return $core.withContext(function($ctx1) {
  38046. var $1;
  38047. $recv(anotherIRInstruction)._parent_(self);
  38048. $1=self._dagChildren();
  38049. $ctx1.sendIdx["dagChildren"]=1;
  38050. $recv($1)._at_put_($recv(self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  38051. return self;
  38052. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  38053. },
  38054. args: ["anIRInstruction", "anotherIRInstruction"],
  38055. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  38056. referencedClasses: [],
  38057. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  38058. }),
  38059. $globals.IRInstruction);
  38060. $core.addMethod(
  38061. $core.method({
  38062. selector: "replaceWith:",
  38063. protocol: "building",
  38064. fn: function (anIRInstruction){
  38065. var self=this;
  38066. return $core.withContext(function($ctx1) {
  38067. $recv(self._parent())._replace_with_(self,anIRInstruction);
  38068. return self;
  38069. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  38070. },
  38071. args: ["anIRInstruction"],
  38072. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  38073. referencedClasses: [],
  38074. messageSends: ["replace:with:", "parent"]
  38075. }),
  38076. $globals.IRInstruction);
  38077. $core.addMethod(
  38078. $core.method({
  38079. selector: "scope",
  38080. protocol: "accessing",
  38081. fn: function (){
  38082. var self=this;
  38083. return $core.withContext(function($ctx1) {
  38084. var $1,$receiver;
  38085. $1=self._parent();
  38086. if(($receiver = $1) == null || $receiver.isNil){
  38087. return $1;
  38088. } else {
  38089. var node;
  38090. node=$receiver;
  38091. return $recv(node)._scope();
  38092. }
  38093. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  38094. },
  38095. args: [],
  38096. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  38097. referencedClasses: [],
  38098. messageSends: ["ifNotNil:", "parent", "scope"]
  38099. }),
  38100. $globals.IRInstruction);
  38101. $core.addMethod(
  38102. $core.method({
  38103. selector: "yieldsValue",
  38104. protocol: "testing",
  38105. fn: function (){
  38106. var self=this;
  38107. return true;
  38108. },
  38109. args: [],
  38110. source: "yieldsValue\x0a\x09^ true",
  38111. referencedClasses: [],
  38112. messageSends: []
  38113. }),
  38114. $globals.IRInstruction);
  38115. $core.addMethod(
  38116. $core.method({
  38117. selector: "on:",
  38118. protocol: "instance creation",
  38119. fn: function (aBuilder){
  38120. var self=this;
  38121. return $core.withContext(function($ctx1) {
  38122. var $1;
  38123. $1=self._new();
  38124. $recv($1)._builder_(aBuilder);
  38125. return $recv($1)._yourself();
  38126. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.klass)});
  38127. },
  38128. args: ["aBuilder"],
  38129. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  38130. referencedClasses: [],
  38131. messageSends: ["builder:", "new", "yourself"]
  38132. }),
  38133. $globals.IRInstruction.klass);
  38134. $core.addClass("IRAssignment", $globals.IRInstruction, [], "Compiler-IR");
  38135. $core.addMethod(
  38136. $core.method({
  38137. selector: "acceptDagVisitor:",
  38138. protocol: "visiting",
  38139. fn: function (aVisitor){
  38140. var self=this;
  38141. return $core.withContext(function($ctx1) {
  38142. return $recv(aVisitor)._visitIRAssignment_(self);
  38143. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRAssignment)});
  38144. },
  38145. args: ["aVisitor"],
  38146. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  38147. referencedClasses: [],
  38148. messageSends: ["visitIRAssignment:"]
  38149. }),
  38150. $globals.IRAssignment);
  38151. $core.addMethod(
  38152. $core.method({
  38153. selector: "left",
  38154. protocol: "accessing",
  38155. fn: function (){
  38156. var self=this;
  38157. return $core.withContext(function($ctx1) {
  38158. return $recv(self._dagChildren())._first();
  38159. }, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
  38160. },
  38161. args: [],
  38162. source: "left\x0a\x09^ self dagChildren first",
  38163. referencedClasses: [],
  38164. messageSends: ["first", "dagChildren"]
  38165. }),
  38166. $globals.IRAssignment);
  38167. $core.addMethod(
  38168. $core.method({
  38169. selector: "right",
  38170. protocol: "accessing",
  38171. fn: function (){
  38172. var self=this;
  38173. return $core.withContext(function($ctx1) {
  38174. return $recv(self._dagChildren())._last();
  38175. }, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
  38176. },
  38177. args: [],
  38178. source: "right\x0a\x09^ self dagChildren last",
  38179. referencedClasses: [],
  38180. messageSends: ["last", "dagChildren"]
  38181. }),
  38182. $globals.IRAssignment);
  38183. $core.addClass("IRDynamicArray", $globals.IRInstruction, [], "Compiler-IR");
  38184. $core.addMethod(
  38185. $core.method({
  38186. selector: "acceptDagVisitor:",
  38187. protocol: "visiting",
  38188. fn: function (aVisitor){
  38189. var self=this;
  38190. return $core.withContext(function($ctx1) {
  38191. return $recv(aVisitor)._visitIRDynamicArray_(self);
  38192. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  38193. },
  38194. args: ["aVisitor"],
  38195. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  38196. referencedClasses: [],
  38197. messageSends: ["visitIRDynamicArray:"]
  38198. }),
  38199. $globals.IRDynamicArray);
  38200. $core.addClass("IRDynamicDictionary", $globals.IRInstruction, [], "Compiler-IR");
  38201. $core.addMethod(
  38202. $core.method({
  38203. selector: "acceptDagVisitor:",
  38204. protocol: "visiting",
  38205. fn: function (aVisitor){
  38206. var self=this;
  38207. return $core.withContext(function($ctx1) {
  38208. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  38209. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  38210. },
  38211. args: ["aVisitor"],
  38212. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  38213. referencedClasses: [],
  38214. messageSends: ["visitIRDynamicDictionary:"]
  38215. }),
  38216. $globals.IRDynamicDictionary);
  38217. $core.addClass("IRScopedInstruction", $globals.IRInstruction, ["scope"], "Compiler-IR");
  38218. $core.addMethod(
  38219. $core.method({
  38220. selector: "scope",
  38221. protocol: "accessing",
  38222. fn: function (){
  38223. var self=this;
  38224. return self["@scope"];
  38225. },
  38226. args: [],
  38227. source: "scope\x0a\x09^ scope",
  38228. referencedClasses: [],
  38229. messageSends: []
  38230. }),
  38231. $globals.IRScopedInstruction);
  38232. $core.addMethod(
  38233. $core.method({
  38234. selector: "scope:",
  38235. protocol: "accessing",
  38236. fn: function (aScope){
  38237. var self=this;
  38238. self["@scope"]=aScope;
  38239. return self;
  38240. },
  38241. args: ["aScope"],
  38242. source: "scope: aScope\x0a\x09scope := aScope",
  38243. referencedClasses: [],
  38244. messageSends: []
  38245. }),
  38246. $globals.IRScopedInstruction);
  38247. $core.addClass("IRClosureInstruction", $globals.IRScopedInstruction, ["arguments", "requiresSmalltalkContext"], "Compiler-IR");
  38248. $core.addMethod(
  38249. $core.method({
  38250. selector: "arguments",
  38251. protocol: "accessing",
  38252. fn: function (){
  38253. var self=this;
  38254. return $core.withContext(function($ctx1) {
  38255. var $1,$receiver;
  38256. $1=self["@arguments"];
  38257. if(($receiver = $1) == null || $receiver.isNil){
  38258. return [];
  38259. } else {
  38260. return $1;
  38261. }
  38262. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  38263. },
  38264. args: [],
  38265. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  38266. referencedClasses: [],
  38267. messageSends: ["ifNil:"]
  38268. }),
  38269. $globals.IRClosureInstruction);
  38270. $core.addMethod(
  38271. $core.method({
  38272. selector: "arguments:",
  38273. protocol: "accessing",
  38274. fn: function (aCollection){
  38275. var self=this;
  38276. self["@arguments"]=aCollection;
  38277. return self;
  38278. },
  38279. args: ["aCollection"],
  38280. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  38281. referencedClasses: [],
  38282. messageSends: []
  38283. }),
  38284. $globals.IRClosureInstruction);
  38285. $core.addMethod(
  38286. $core.method({
  38287. selector: "locals",
  38288. protocol: "accessing",
  38289. fn: function (){
  38290. var self=this;
  38291. return $core.withContext(function($ctx1) {
  38292. var $1;
  38293. $1=$recv(self._arguments())._copy();
  38294. $recv($1)._addAll_($recv(self._tempDeclarations())._collect_((function(each){
  38295. return $core.withContext(function($ctx2) {
  38296. return $recv(each)._name();
  38297. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38298. })));
  38299. return $recv($1)._yourself();
  38300. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  38301. },
  38302. args: [],
  38303. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  38304. referencedClasses: [],
  38305. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  38306. }),
  38307. $globals.IRClosureInstruction);
  38308. $core.addMethod(
  38309. $core.method({
  38310. selector: "requiresSmalltalkContext",
  38311. protocol: "accessing",
  38312. fn: function (){
  38313. var self=this;
  38314. return $core.withContext(function($ctx1) {
  38315. var $1,$receiver;
  38316. $1=self["@requiresSmalltalkContext"];
  38317. if(($receiver = $1) == null || $receiver.isNil){
  38318. return false;
  38319. } else {
  38320. return $1;
  38321. }
  38322. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  38323. },
  38324. args: [],
  38325. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  38326. referencedClasses: [],
  38327. messageSends: ["ifNil:"]
  38328. }),
  38329. $globals.IRClosureInstruction);
  38330. $core.addMethod(
  38331. $core.method({
  38332. selector: "requiresSmalltalkContext:",
  38333. protocol: "accessing",
  38334. fn: function (anObject){
  38335. var self=this;
  38336. self["@requiresSmalltalkContext"]=anObject;
  38337. return self;
  38338. },
  38339. args: ["anObject"],
  38340. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  38341. referencedClasses: [],
  38342. messageSends: []
  38343. }),
  38344. $globals.IRClosureInstruction);
  38345. $core.addMethod(
  38346. $core.method({
  38347. selector: "scope:",
  38348. protocol: "accessing",
  38349. fn: function (aScope){
  38350. var self=this;
  38351. return $core.withContext(function($ctx1) {
  38352. (
  38353. $ctx1.supercall = true,
  38354. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($recv(self), [aScope]));
  38355. $ctx1.supercall = false;
  38356. $recv(aScope)._instruction_(self);
  38357. return self;
  38358. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  38359. },
  38360. args: ["aScope"],
  38361. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  38362. referencedClasses: [],
  38363. messageSends: ["scope:", "instruction:"]
  38364. }),
  38365. $globals.IRClosureInstruction);
  38366. $core.addMethod(
  38367. $core.method({
  38368. selector: "tempDeclarations",
  38369. protocol: "accessing",
  38370. fn: function (){
  38371. var self=this;
  38372. return $core.withContext(function($ctx1) {
  38373. return $recv(self._dagChildren())._select_((function(each){
  38374. return $core.withContext(function($ctx2) {
  38375. return $recv(each)._isTempDeclaration();
  38376. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38377. }));
  38378. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  38379. },
  38380. args: [],
  38381. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  38382. referencedClasses: [],
  38383. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  38384. }),
  38385. $globals.IRClosureInstruction);
  38386. $core.addClass("IRClosure", $globals.IRClosureInstruction, [], "Compiler-IR");
  38387. $core.addMethod(
  38388. $core.method({
  38389. selector: "acceptDagVisitor:",
  38390. protocol: "visiting",
  38391. fn: function (aVisitor){
  38392. var self=this;
  38393. return $core.withContext(function($ctx1) {
  38394. return $recv(aVisitor)._visitIRClosure_(self);
  38395. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRClosure)});
  38396. },
  38397. args: ["aVisitor"],
  38398. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  38399. referencedClasses: [],
  38400. messageSends: ["visitIRClosure:"]
  38401. }),
  38402. $globals.IRClosure);
  38403. $core.addMethod(
  38404. $core.method({
  38405. selector: "isClosure",
  38406. protocol: "testing",
  38407. fn: function (){
  38408. var self=this;
  38409. return true;
  38410. },
  38411. args: [],
  38412. source: "isClosure\x0a\x09^ true",
  38413. referencedClasses: [],
  38414. messageSends: []
  38415. }),
  38416. $globals.IRClosure);
  38417. $core.addMethod(
  38418. $core.method({
  38419. selector: "sequence",
  38420. protocol: "accessing",
  38421. fn: function (){
  38422. var self=this;
  38423. return $core.withContext(function($ctx1) {
  38424. return $recv(self._dagChildren())._last();
  38425. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  38426. },
  38427. args: [],
  38428. source: "sequence\x0a\x09^ self dagChildren last",
  38429. referencedClasses: [],
  38430. messageSends: ["last", "dagChildren"]
  38431. }),
  38432. $globals.IRClosure);
  38433. $core.addClass("IRMethod", $globals.IRClosureInstruction, ["theClass", "source", "selector", "classReferences", "sendIndexes", "requiresSmalltalkContext", "internalVariables"], "Compiler-IR");
  38434. $globals.IRMethod.comment="I am a method instruction";
  38435. $core.addMethod(
  38436. $core.method({
  38437. selector: "acceptDagVisitor:",
  38438. protocol: "visiting",
  38439. fn: function (aVisitor){
  38440. var self=this;
  38441. return $core.withContext(function($ctx1) {
  38442. return $recv(aVisitor)._visitIRMethod_(self);
  38443. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRMethod)});
  38444. },
  38445. args: ["aVisitor"],
  38446. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  38447. referencedClasses: [],
  38448. messageSends: ["visitIRMethod:"]
  38449. }),
  38450. $globals.IRMethod);
  38451. $core.addMethod(
  38452. $core.method({
  38453. selector: "classReferences",
  38454. protocol: "accessing",
  38455. fn: function (){
  38456. var self=this;
  38457. return self["@classReferences"];
  38458. },
  38459. args: [],
  38460. source: "classReferences\x0a\x09^ classReferences",
  38461. referencedClasses: [],
  38462. messageSends: []
  38463. }),
  38464. $globals.IRMethod);
  38465. $core.addMethod(
  38466. $core.method({
  38467. selector: "classReferences:",
  38468. protocol: "accessing",
  38469. fn: function (aCollection){
  38470. var self=this;
  38471. self["@classReferences"]=aCollection;
  38472. return self;
  38473. },
  38474. args: ["aCollection"],
  38475. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  38476. referencedClasses: [],
  38477. messageSends: []
  38478. }),
  38479. $globals.IRMethod);
  38480. $core.addMethod(
  38481. $core.method({
  38482. selector: "internalVariables",
  38483. protocol: "accessing",
  38484. fn: function (){
  38485. var self=this;
  38486. return $core.withContext(function($ctx1) {
  38487. var $1,$receiver;
  38488. $1=self["@internalVariables"];
  38489. if(($receiver = $1) == null || $receiver.isNil){
  38490. self["@internalVariables"]=$recv($globals.Set)._new();
  38491. return self["@internalVariables"];
  38492. } else {
  38493. return $1;
  38494. }
  38495. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  38496. },
  38497. args: [],
  38498. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  38499. referencedClasses: ["Set"],
  38500. messageSends: ["ifNil:", "new"]
  38501. }),
  38502. $globals.IRMethod);
  38503. $core.addMethod(
  38504. $core.method({
  38505. selector: "isMethod",
  38506. protocol: "testing",
  38507. fn: function (){
  38508. var self=this;
  38509. return true;
  38510. },
  38511. args: [],
  38512. source: "isMethod\x0a\x09^ true",
  38513. referencedClasses: [],
  38514. messageSends: []
  38515. }),
  38516. $globals.IRMethod);
  38517. $core.addMethod(
  38518. $core.method({
  38519. selector: "messageSends",
  38520. protocol: "accessing",
  38521. fn: function (){
  38522. var self=this;
  38523. return $core.withContext(function($ctx1) {
  38524. return $recv(self._sendIndexes())._keys();
  38525. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  38526. },
  38527. args: [],
  38528. source: "messageSends\x0a\x09^ self sendIndexes keys",
  38529. referencedClasses: [],
  38530. messageSends: ["keys", "sendIndexes"]
  38531. }),
  38532. $globals.IRMethod);
  38533. $core.addMethod(
  38534. $core.method({
  38535. selector: "method",
  38536. protocol: "accessing",
  38537. fn: function (){
  38538. var self=this;
  38539. return self;
  38540. },
  38541. args: [],
  38542. source: "method\x0a\x09^ self",
  38543. referencedClasses: [],
  38544. messageSends: []
  38545. }),
  38546. $globals.IRMethod);
  38547. $core.addMethod(
  38548. $core.method({
  38549. selector: "selector",
  38550. protocol: "accessing",
  38551. fn: function (){
  38552. var self=this;
  38553. return self["@selector"];
  38554. },
  38555. args: [],
  38556. source: "selector\x0a\x09^ selector",
  38557. referencedClasses: [],
  38558. messageSends: []
  38559. }),
  38560. $globals.IRMethod);
  38561. $core.addMethod(
  38562. $core.method({
  38563. selector: "selector:",
  38564. protocol: "accessing",
  38565. fn: function (aString){
  38566. var self=this;
  38567. self["@selector"]=aString;
  38568. return self;
  38569. },
  38570. args: ["aString"],
  38571. source: "selector: aString\x0a\x09selector := aString",
  38572. referencedClasses: [],
  38573. messageSends: []
  38574. }),
  38575. $globals.IRMethod);
  38576. $core.addMethod(
  38577. $core.method({
  38578. selector: "sendIndexes",
  38579. protocol: "accessing",
  38580. fn: function (){
  38581. var self=this;
  38582. return self["@sendIndexes"];
  38583. },
  38584. args: [],
  38585. source: "sendIndexes\x0a\x09^ sendIndexes",
  38586. referencedClasses: [],
  38587. messageSends: []
  38588. }),
  38589. $globals.IRMethod);
  38590. $core.addMethod(
  38591. $core.method({
  38592. selector: "sendIndexes:",
  38593. protocol: "accessing",
  38594. fn: function (aDictionary){
  38595. var self=this;
  38596. self["@sendIndexes"]=aDictionary;
  38597. return self;
  38598. },
  38599. args: ["aDictionary"],
  38600. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  38601. referencedClasses: [],
  38602. messageSends: []
  38603. }),
  38604. $globals.IRMethod);
  38605. $core.addMethod(
  38606. $core.method({
  38607. selector: "source",
  38608. protocol: "accessing",
  38609. fn: function (){
  38610. var self=this;
  38611. return self["@source"];
  38612. },
  38613. args: [],
  38614. source: "source\x0a\x09^ source",
  38615. referencedClasses: [],
  38616. messageSends: []
  38617. }),
  38618. $globals.IRMethod);
  38619. $core.addMethod(
  38620. $core.method({
  38621. selector: "source:",
  38622. protocol: "accessing",
  38623. fn: function (aString){
  38624. var self=this;
  38625. self["@source"]=aString;
  38626. return self;
  38627. },
  38628. args: ["aString"],
  38629. source: "source: aString\x0a\x09source := aString",
  38630. referencedClasses: [],
  38631. messageSends: []
  38632. }),
  38633. $globals.IRMethod);
  38634. $core.addMethod(
  38635. $core.method({
  38636. selector: "theClass",
  38637. protocol: "accessing",
  38638. fn: function (){
  38639. var self=this;
  38640. return self["@theClass"];
  38641. },
  38642. args: [],
  38643. source: "theClass\x0a\x09^ theClass",
  38644. referencedClasses: [],
  38645. messageSends: []
  38646. }),
  38647. $globals.IRMethod);
  38648. $core.addMethod(
  38649. $core.method({
  38650. selector: "theClass:",
  38651. protocol: "accessing",
  38652. fn: function (aClass){
  38653. var self=this;
  38654. self["@theClass"]=aClass;
  38655. return self;
  38656. },
  38657. args: ["aClass"],
  38658. source: "theClass: aClass\x0a\x09theClass := aClass",
  38659. referencedClasses: [],
  38660. messageSends: []
  38661. }),
  38662. $globals.IRMethod);
  38663. $core.addClass("IRReturn", $globals.IRScopedInstruction, [], "Compiler-IR");
  38664. $globals.IRReturn.comment="I am a local return instruction.";
  38665. $core.addMethod(
  38666. $core.method({
  38667. selector: "acceptDagVisitor:",
  38668. protocol: "visiting",
  38669. fn: function (aVisitor){
  38670. var self=this;
  38671. return $core.withContext(function($ctx1) {
  38672. return $recv(aVisitor)._visitIRReturn_(self);
  38673. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRReturn)});
  38674. },
  38675. args: ["aVisitor"],
  38676. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  38677. referencedClasses: [],
  38678. messageSends: ["visitIRReturn:"]
  38679. }),
  38680. $globals.IRReturn);
  38681. $core.addMethod(
  38682. $core.method({
  38683. selector: "expression",
  38684. protocol: "accessing",
  38685. fn: function (){
  38686. var self=this;
  38687. return $core.withContext(function($ctx1) {
  38688. return $recv(self._dagChildren())._single();
  38689. }, function($ctx1) {$ctx1.fill(self,"expression",{},$globals.IRReturn)});
  38690. },
  38691. args: [],
  38692. source: "expression\x0a\x09^ self dagChildren single",
  38693. referencedClasses: [],
  38694. messageSends: ["single", "dagChildren"]
  38695. }),
  38696. $globals.IRReturn);
  38697. $core.addMethod(
  38698. $core.method({
  38699. selector: "scope",
  38700. protocol: "accessing",
  38701. fn: function (){
  38702. var self=this;
  38703. return $core.withContext(function($ctx1) {
  38704. var $1,$receiver;
  38705. $1=self["@scope"];
  38706. if(($receiver = $1) == null || $receiver.isNil){
  38707. return $recv(self._parent())._scope();
  38708. } else {
  38709. return $1;
  38710. }
  38711. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  38712. },
  38713. args: [],
  38714. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  38715. referencedClasses: [],
  38716. messageSends: ["ifNil:", "scope", "parent"]
  38717. }),
  38718. $globals.IRReturn);
  38719. $core.addMethod(
  38720. $core.method({
  38721. selector: "yieldsValue",
  38722. protocol: "testing",
  38723. fn: function (){
  38724. var self=this;
  38725. return false;
  38726. },
  38727. args: [],
  38728. source: "yieldsValue\x0a\x09^ false",
  38729. referencedClasses: [],
  38730. messageSends: []
  38731. }),
  38732. $globals.IRReturn);
  38733. $core.addClass("IRBlockReturn", $globals.IRReturn, [], "Compiler-IR");
  38734. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  38735. $core.addMethod(
  38736. $core.method({
  38737. selector: "acceptDagVisitor:",
  38738. protocol: "visiting",
  38739. fn: function (aVisitor){
  38740. var self=this;
  38741. return $core.withContext(function($ctx1) {
  38742. return $recv(aVisitor)._visitIRBlockReturn_(self);
  38743. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  38744. },
  38745. args: ["aVisitor"],
  38746. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  38747. referencedClasses: [],
  38748. messageSends: ["visitIRBlockReturn:"]
  38749. }),
  38750. $globals.IRBlockReturn);
  38751. $core.addClass("IRNonLocalReturn", $globals.IRReturn, [], "Compiler-IR");
  38752. $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.";
  38753. $core.addMethod(
  38754. $core.method({
  38755. selector: "acceptDagVisitor:",
  38756. protocol: "visiting",
  38757. fn: function (aVisitor){
  38758. var self=this;
  38759. return $core.withContext(function($ctx1) {
  38760. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  38761. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  38762. },
  38763. args: ["aVisitor"],
  38764. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  38765. referencedClasses: [],
  38766. messageSends: ["visitIRNonLocalReturn:"]
  38767. }),
  38768. $globals.IRNonLocalReturn);
  38769. $core.addClass("IRTempDeclaration", $globals.IRScopedInstruction, ["name"], "Compiler-IR");
  38770. $core.addMethod(
  38771. $core.method({
  38772. selector: "acceptDagVisitor:",
  38773. protocol: "visiting",
  38774. fn: function (aVisitor){
  38775. var self=this;
  38776. return $core.withContext(function($ctx1) {
  38777. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  38778. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  38779. },
  38780. args: ["aVisitor"],
  38781. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  38782. referencedClasses: [],
  38783. messageSends: ["visitIRTempDeclaration:"]
  38784. }),
  38785. $globals.IRTempDeclaration);
  38786. $core.addMethod(
  38787. $core.method({
  38788. selector: "isTempDeclaration",
  38789. protocol: "testing",
  38790. fn: function (){
  38791. var self=this;
  38792. return true;
  38793. },
  38794. args: [],
  38795. source: "isTempDeclaration\x0a\x09^ true",
  38796. referencedClasses: [],
  38797. messageSends: []
  38798. }),
  38799. $globals.IRTempDeclaration);
  38800. $core.addMethod(
  38801. $core.method({
  38802. selector: "name",
  38803. protocol: "accessing",
  38804. fn: function (){
  38805. var self=this;
  38806. return self["@name"];
  38807. },
  38808. args: [],
  38809. source: "name\x0a\x09^ name",
  38810. referencedClasses: [],
  38811. messageSends: []
  38812. }),
  38813. $globals.IRTempDeclaration);
  38814. $core.addMethod(
  38815. $core.method({
  38816. selector: "name:",
  38817. protocol: "accessing",
  38818. fn: function (aString){
  38819. var self=this;
  38820. self["@name"]=aString;
  38821. return self;
  38822. },
  38823. args: ["aString"],
  38824. source: "name: aString\x0a\x09name := aString",
  38825. referencedClasses: [],
  38826. messageSends: []
  38827. }),
  38828. $globals.IRTempDeclaration);
  38829. $core.addClass("IRSend", $globals.IRInstruction, ["selector", "index"], "Compiler-IR");
  38830. $globals.IRSend.comment="I am a message send instruction.";
  38831. $core.addMethod(
  38832. $core.method({
  38833. selector: "acceptDagVisitor:",
  38834. protocol: "visiting",
  38835. fn: function (aVisitor){
  38836. var self=this;
  38837. return $core.withContext(function($ctx1) {
  38838. return $recv(aVisitor)._visitIRSend_(self);
  38839. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSend)});
  38840. },
  38841. args: ["aVisitor"],
  38842. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  38843. referencedClasses: [],
  38844. messageSends: ["visitIRSend:"]
  38845. }),
  38846. $globals.IRSend);
  38847. $core.addMethod(
  38848. $core.method({
  38849. selector: "arguments",
  38850. protocol: "accessing",
  38851. fn: function (){
  38852. var self=this;
  38853. return $core.withContext(function($ctx1) {
  38854. return $recv(self._dagChildren())._allButFirst();
  38855. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
  38856. },
  38857. args: [],
  38858. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  38859. referencedClasses: [],
  38860. messageSends: ["allButFirst", "dagChildren"]
  38861. }),
  38862. $globals.IRSend);
  38863. $core.addMethod(
  38864. $core.method({
  38865. selector: "index",
  38866. protocol: "accessing",
  38867. fn: function (){
  38868. var self=this;
  38869. return self["@index"];
  38870. },
  38871. args: [],
  38872. source: "index\x0a\x09^ index",
  38873. referencedClasses: [],
  38874. messageSends: []
  38875. }),
  38876. $globals.IRSend);
  38877. $core.addMethod(
  38878. $core.method({
  38879. selector: "index:",
  38880. protocol: "accessing",
  38881. fn: function (anInteger){
  38882. var self=this;
  38883. self["@index"]=anInteger;
  38884. return self;
  38885. },
  38886. args: ["anInteger"],
  38887. source: "index: anInteger\x0a\x09index := anInteger",
  38888. referencedClasses: [],
  38889. messageSends: []
  38890. }),
  38891. $globals.IRSend);
  38892. $core.addMethod(
  38893. $core.method({
  38894. selector: "isSend",
  38895. protocol: "testing",
  38896. fn: function (){
  38897. var self=this;
  38898. return true;
  38899. },
  38900. args: [],
  38901. source: "isSend\x0a\x09^ true",
  38902. referencedClasses: [],
  38903. messageSends: []
  38904. }),
  38905. $globals.IRSend);
  38906. $core.addMethod(
  38907. $core.method({
  38908. selector: "isSuperSend",
  38909. protocol: "testing",
  38910. fn: function (){
  38911. var self=this;
  38912. var receiver;
  38913. return $core.withContext(function($ctx1) {
  38914. receiver=self._receiver();
  38915. return $recv($recv(receiver)._isVariable())._and_((function(){
  38916. return $core.withContext(function($ctx2) {
  38917. return $recv($recv($recv(receiver)._variable())._name()).__eq("super");
  38918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38919. }));
  38920. }, function($ctx1) {$ctx1.fill(self,"isSuperSend",{receiver:receiver},$globals.IRSend)});
  38921. },
  38922. args: [],
  38923. source: "isSuperSend\x0a\x09| receiver |\x0a\x09receiver := self receiver.\x0a\x09^ receiver isVariable and: [ receiver variable name = 'super' ]",
  38924. referencedClasses: [],
  38925. messageSends: ["receiver", "and:", "isVariable", "=", "name", "variable"]
  38926. }),
  38927. $globals.IRSend);
  38928. $core.addMethod(
  38929. $core.method({
  38930. selector: "receiver",
  38931. protocol: "accessing",
  38932. fn: function (){
  38933. var self=this;
  38934. return $core.withContext(function($ctx1) {
  38935. return $recv(self._dagChildren())._first();
  38936. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
  38937. },
  38938. args: [],
  38939. source: "receiver\x0a\x09^ self dagChildren first",
  38940. referencedClasses: [],
  38941. messageSends: ["first", "dagChildren"]
  38942. }),
  38943. $globals.IRSend);
  38944. $core.addMethod(
  38945. $core.method({
  38946. selector: "selector",
  38947. protocol: "accessing",
  38948. fn: function (){
  38949. var self=this;
  38950. return self["@selector"];
  38951. },
  38952. args: [],
  38953. source: "selector\x0a\x09^ selector",
  38954. referencedClasses: [],
  38955. messageSends: []
  38956. }),
  38957. $globals.IRSend);
  38958. $core.addMethod(
  38959. $core.method({
  38960. selector: "selector:",
  38961. protocol: "accessing",
  38962. fn: function (aString){
  38963. var self=this;
  38964. self["@selector"]=aString;
  38965. return self;
  38966. },
  38967. args: ["aString"],
  38968. source: "selector: aString\x0a\x09selector := aString",
  38969. referencedClasses: [],
  38970. messageSends: []
  38971. }),
  38972. $globals.IRSend);
  38973. $core.addClass("IRSequence", $globals.IRInstruction, [], "Compiler-IR");
  38974. $core.addMethod(
  38975. $core.method({
  38976. selector: "acceptDagVisitor:",
  38977. protocol: "visiting",
  38978. fn: function (aVisitor){
  38979. var self=this;
  38980. return $core.withContext(function($ctx1) {
  38981. return $recv(aVisitor)._visitIRSequence_(self);
  38982. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSequence)});
  38983. },
  38984. args: ["aVisitor"],
  38985. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  38986. referencedClasses: [],
  38987. messageSends: ["visitIRSequence:"]
  38988. }),
  38989. $globals.IRSequence);
  38990. $core.addMethod(
  38991. $core.method({
  38992. selector: "isSequence",
  38993. protocol: "testing",
  38994. fn: function (){
  38995. var self=this;
  38996. return true;
  38997. },
  38998. args: [],
  38999. source: "isSequence\x0a\x09^ true",
  39000. referencedClasses: [],
  39001. messageSends: []
  39002. }),
  39003. $globals.IRSequence);
  39004. $core.addClass("IRBlockSequence", $globals.IRSequence, [], "Compiler-IR");
  39005. $core.addMethod(
  39006. $core.method({
  39007. selector: "acceptDagVisitor:",
  39008. protocol: "visiting",
  39009. fn: function (aVisitor){
  39010. var self=this;
  39011. return $core.withContext(function($ctx1) {
  39012. return $recv(aVisitor)._visitIRBlockSequence_(self);
  39013. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  39014. },
  39015. args: ["aVisitor"],
  39016. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  39017. referencedClasses: [],
  39018. messageSends: ["visitIRBlockSequence:"]
  39019. }),
  39020. $globals.IRBlockSequence);
  39021. $core.addClass("IRValue", $globals.IRInstruction, ["value"], "Compiler-IR");
  39022. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  39023. $core.addMethod(
  39024. $core.method({
  39025. selector: "acceptDagVisitor:",
  39026. protocol: "visiting",
  39027. fn: function (aVisitor){
  39028. var self=this;
  39029. return $core.withContext(function($ctx1) {
  39030. return $recv(aVisitor)._visitIRValue_(self);
  39031. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRValue)});
  39032. },
  39033. args: ["aVisitor"],
  39034. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  39035. referencedClasses: [],
  39036. messageSends: ["visitIRValue:"]
  39037. }),
  39038. $globals.IRValue);
  39039. $core.addMethod(
  39040. $core.method({
  39041. selector: "needsBoxingAsReceiver",
  39042. protocol: "testing",
  39043. fn: function (){
  39044. var self=this;
  39045. return false;
  39046. },
  39047. args: [],
  39048. source: "needsBoxingAsReceiver\x0a\x09^ false",
  39049. referencedClasses: [],
  39050. messageSends: []
  39051. }),
  39052. $globals.IRValue);
  39053. $core.addMethod(
  39054. $core.method({
  39055. selector: "value",
  39056. protocol: "accessing",
  39057. fn: function (){
  39058. var self=this;
  39059. return self["@value"];
  39060. },
  39061. args: [],
  39062. source: "value\x0a\x09^ value",
  39063. referencedClasses: [],
  39064. messageSends: []
  39065. }),
  39066. $globals.IRValue);
  39067. $core.addMethod(
  39068. $core.method({
  39069. selector: "value:",
  39070. protocol: "accessing",
  39071. fn: function (aString){
  39072. var self=this;
  39073. self["@value"]=aString;
  39074. return self;
  39075. },
  39076. args: ["aString"],
  39077. source: "value: aString\x0a\x09value := aString",
  39078. referencedClasses: [],
  39079. messageSends: []
  39080. }),
  39081. $globals.IRValue);
  39082. $core.addClass("IRVariable", $globals.IRInstruction, ["variable"], "Compiler-IR");
  39083. $globals.IRVariable.comment="I am a variable instruction.";
  39084. $core.addMethod(
  39085. $core.method({
  39086. selector: "acceptDagVisitor:",
  39087. protocol: "visiting",
  39088. fn: function (aVisitor){
  39089. var self=this;
  39090. return $core.withContext(function($ctx1) {
  39091. return $recv(aVisitor)._visitIRVariable_(self);
  39092. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVariable)});
  39093. },
  39094. args: ["aVisitor"],
  39095. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  39096. referencedClasses: [],
  39097. messageSends: ["visitIRVariable:"]
  39098. }),
  39099. $globals.IRVariable);
  39100. $core.addMethod(
  39101. $core.method({
  39102. selector: "isVariable",
  39103. protocol: "testing",
  39104. fn: function (){
  39105. var self=this;
  39106. return true;
  39107. },
  39108. args: [],
  39109. source: "isVariable\x0a\x09^ true",
  39110. referencedClasses: [],
  39111. messageSends: []
  39112. }),
  39113. $globals.IRVariable);
  39114. $core.addMethod(
  39115. $core.method({
  39116. selector: "needsBoxingAsReceiver",
  39117. protocol: "testing",
  39118. fn: function (){
  39119. var self=this;
  39120. return $core.withContext(function($ctx1) {
  39121. return $recv($recv(self._variable())._isPseudoVar())._not();
  39122. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  39123. },
  39124. args: [],
  39125. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  39126. referencedClasses: [],
  39127. messageSends: ["not", "isPseudoVar", "variable"]
  39128. }),
  39129. $globals.IRVariable);
  39130. $core.addMethod(
  39131. $core.method({
  39132. selector: "variable",
  39133. protocol: "accessing",
  39134. fn: function (){
  39135. var self=this;
  39136. return self["@variable"];
  39137. },
  39138. args: [],
  39139. source: "variable\x0a\x09^ variable",
  39140. referencedClasses: [],
  39141. messageSends: []
  39142. }),
  39143. $globals.IRVariable);
  39144. $core.addMethod(
  39145. $core.method({
  39146. selector: "variable:",
  39147. protocol: "accessing",
  39148. fn: function (aScopeVariable){
  39149. var self=this;
  39150. self["@variable"]=aScopeVariable;
  39151. return self;
  39152. },
  39153. args: ["aScopeVariable"],
  39154. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  39155. referencedClasses: [],
  39156. messageSends: []
  39157. }),
  39158. $globals.IRVariable);
  39159. $core.addClass("IRVerbatim", $globals.IRInstruction, ["source"], "Compiler-IR");
  39160. $core.addMethod(
  39161. $core.method({
  39162. selector: "acceptDagVisitor:",
  39163. protocol: "visiting",
  39164. fn: function (aVisitor){
  39165. var self=this;
  39166. return $core.withContext(function($ctx1) {
  39167. return $recv(aVisitor)._visitIRVerbatim_(self);
  39168. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  39169. },
  39170. args: ["aVisitor"],
  39171. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  39172. referencedClasses: [],
  39173. messageSends: ["visitIRVerbatim:"]
  39174. }),
  39175. $globals.IRVerbatim);
  39176. $core.addMethod(
  39177. $core.method({
  39178. selector: "source",
  39179. protocol: "accessing",
  39180. fn: function (){
  39181. var self=this;
  39182. return self["@source"];
  39183. },
  39184. args: [],
  39185. source: "source\x0a\x09^ source",
  39186. referencedClasses: [],
  39187. messageSends: []
  39188. }),
  39189. $globals.IRVerbatim);
  39190. $core.addMethod(
  39191. $core.method({
  39192. selector: "source:",
  39193. protocol: "accessing",
  39194. fn: function (aString){
  39195. var self=this;
  39196. self["@source"]=aString;
  39197. return self;
  39198. },
  39199. args: ["aString"],
  39200. source: "source: aString\x0a\x09source := aString",
  39201. referencedClasses: [],
  39202. messageSends: []
  39203. }),
  39204. $globals.IRVerbatim);
  39205. $core.addClass("IRVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-IR");
  39206. $core.addMethod(
  39207. $core.method({
  39208. selector: "visitDagNode:",
  39209. protocol: "visiting",
  39210. fn: function (aNode){
  39211. var self=this;
  39212. return $core.withContext(function($ctx1) {
  39213. return self._visitDagNodeVariantSimple_(aNode);
  39214. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.IRVisitor)});
  39215. },
  39216. args: ["aNode"],
  39217. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  39218. referencedClasses: [],
  39219. messageSends: ["visitDagNodeVariantSimple:"]
  39220. }),
  39221. $globals.IRVisitor);
  39222. $core.addMethod(
  39223. $core.method({
  39224. selector: "visitIRAssignment:",
  39225. protocol: "visiting",
  39226. fn: function (anIRAssignment){
  39227. var self=this;
  39228. return $core.withContext(function($ctx1) {
  39229. return self._visitDagNode_(anIRAssignment);
  39230. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  39231. },
  39232. args: ["anIRAssignment"],
  39233. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  39234. referencedClasses: [],
  39235. messageSends: ["visitDagNode:"]
  39236. }),
  39237. $globals.IRVisitor);
  39238. $core.addMethod(
  39239. $core.method({
  39240. selector: "visitIRBlockReturn:",
  39241. protocol: "visiting",
  39242. fn: function (anIRBlockReturn){
  39243. var self=this;
  39244. return $core.withContext(function($ctx1) {
  39245. return self._visitIRReturn_(anIRBlockReturn);
  39246. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  39247. },
  39248. args: ["anIRBlockReturn"],
  39249. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  39250. referencedClasses: [],
  39251. messageSends: ["visitIRReturn:"]
  39252. }),
  39253. $globals.IRVisitor);
  39254. $core.addMethod(
  39255. $core.method({
  39256. selector: "visitIRBlockSequence:",
  39257. protocol: "visiting",
  39258. fn: function (anIRBlockSequence){
  39259. var self=this;
  39260. return $core.withContext(function($ctx1) {
  39261. return self._visitIRSequence_(anIRBlockSequence);
  39262. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  39263. },
  39264. args: ["anIRBlockSequence"],
  39265. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  39266. referencedClasses: [],
  39267. messageSends: ["visitIRSequence:"]
  39268. }),
  39269. $globals.IRVisitor);
  39270. $core.addMethod(
  39271. $core.method({
  39272. selector: "visitIRClosure:",
  39273. protocol: "visiting",
  39274. fn: function (anIRClosure){
  39275. var self=this;
  39276. return $core.withContext(function($ctx1) {
  39277. return self._visitDagNode_(anIRClosure);
  39278. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  39279. },
  39280. args: ["anIRClosure"],
  39281. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  39282. referencedClasses: [],
  39283. messageSends: ["visitDagNode:"]
  39284. }),
  39285. $globals.IRVisitor);
  39286. $core.addMethod(
  39287. $core.method({
  39288. selector: "visitIRDynamicArray:",
  39289. protocol: "visiting",
  39290. fn: function (anIRDynamicArray){
  39291. var self=this;
  39292. return $core.withContext(function($ctx1) {
  39293. return self._visitDagNode_(anIRDynamicArray);
  39294. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  39295. },
  39296. args: ["anIRDynamicArray"],
  39297. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  39298. referencedClasses: [],
  39299. messageSends: ["visitDagNode:"]
  39300. }),
  39301. $globals.IRVisitor);
  39302. $core.addMethod(
  39303. $core.method({
  39304. selector: "visitIRDynamicDictionary:",
  39305. protocol: "visiting",
  39306. fn: function (anIRDynamicDictionary){
  39307. var self=this;
  39308. return $core.withContext(function($ctx1) {
  39309. return self._visitDagNode_(anIRDynamicDictionary);
  39310. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  39311. },
  39312. args: ["anIRDynamicDictionary"],
  39313. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  39314. referencedClasses: [],
  39315. messageSends: ["visitDagNode:"]
  39316. }),
  39317. $globals.IRVisitor);
  39318. $core.addMethod(
  39319. $core.method({
  39320. selector: "visitIRInlinedClosure:",
  39321. protocol: "visiting",
  39322. fn: function (anIRInlinedClosure){
  39323. var self=this;
  39324. return $core.withContext(function($ctx1) {
  39325. return self._visitIRClosure_(anIRInlinedClosure);
  39326. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  39327. },
  39328. args: ["anIRInlinedClosure"],
  39329. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  39330. referencedClasses: [],
  39331. messageSends: ["visitIRClosure:"]
  39332. }),
  39333. $globals.IRVisitor);
  39334. $core.addMethod(
  39335. $core.method({
  39336. selector: "visitIRInlinedSequence:",
  39337. protocol: "visiting",
  39338. fn: function (anIRInlinedSequence){
  39339. var self=this;
  39340. return $core.withContext(function($ctx1) {
  39341. return self._visitIRSequence_(anIRInlinedSequence);
  39342. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  39343. },
  39344. args: ["anIRInlinedSequence"],
  39345. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  39346. referencedClasses: [],
  39347. messageSends: ["visitIRSequence:"]
  39348. }),
  39349. $globals.IRVisitor);
  39350. $core.addMethod(
  39351. $core.method({
  39352. selector: "visitIRMethod:",
  39353. protocol: "visiting",
  39354. fn: function (anIRMethod){
  39355. var self=this;
  39356. return $core.withContext(function($ctx1) {
  39357. return self._visitDagNode_(anIRMethod);
  39358. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  39359. },
  39360. args: ["anIRMethod"],
  39361. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  39362. referencedClasses: [],
  39363. messageSends: ["visitDagNode:"]
  39364. }),
  39365. $globals.IRVisitor);
  39366. $core.addMethod(
  39367. $core.method({
  39368. selector: "visitIRNonLocalReturn:",
  39369. protocol: "visiting",
  39370. fn: function (anIRNonLocalReturn){
  39371. var self=this;
  39372. return $core.withContext(function($ctx1) {
  39373. return self._visitDagNode_(anIRNonLocalReturn);
  39374. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  39375. },
  39376. args: ["anIRNonLocalReturn"],
  39377. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  39378. referencedClasses: [],
  39379. messageSends: ["visitDagNode:"]
  39380. }),
  39381. $globals.IRVisitor);
  39382. $core.addMethod(
  39383. $core.method({
  39384. selector: "visitIRNonLocalReturnHandling:",
  39385. protocol: "visiting",
  39386. fn: function (anIRNonLocalReturnHandling){
  39387. var self=this;
  39388. return $core.withContext(function($ctx1) {
  39389. return self._visitDagNode_(anIRNonLocalReturnHandling);
  39390. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  39391. },
  39392. args: ["anIRNonLocalReturnHandling"],
  39393. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  39394. referencedClasses: [],
  39395. messageSends: ["visitDagNode:"]
  39396. }),
  39397. $globals.IRVisitor);
  39398. $core.addMethod(
  39399. $core.method({
  39400. selector: "visitIRReturn:",
  39401. protocol: "visiting",
  39402. fn: function (anIRReturn){
  39403. var self=this;
  39404. return $core.withContext(function($ctx1) {
  39405. return self._visitDagNode_(anIRReturn);
  39406. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  39407. },
  39408. args: ["anIRReturn"],
  39409. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  39410. referencedClasses: [],
  39411. messageSends: ["visitDagNode:"]
  39412. }),
  39413. $globals.IRVisitor);
  39414. $core.addMethod(
  39415. $core.method({
  39416. selector: "visitIRSend:",
  39417. protocol: "visiting",
  39418. fn: function (anIRSend){
  39419. var self=this;
  39420. return $core.withContext(function($ctx1) {
  39421. return self._visitDagNode_(anIRSend);
  39422. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  39423. },
  39424. args: ["anIRSend"],
  39425. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  39426. referencedClasses: [],
  39427. messageSends: ["visitDagNode:"]
  39428. }),
  39429. $globals.IRVisitor);
  39430. $core.addMethod(
  39431. $core.method({
  39432. selector: "visitIRSequence:",
  39433. protocol: "visiting",
  39434. fn: function (anIRSequence){
  39435. var self=this;
  39436. return $core.withContext(function($ctx1) {
  39437. return self._visitDagNode_(anIRSequence);
  39438. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  39439. },
  39440. args: ["anIRSequence"],
  39441. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  39442. referencedClasses: [],
  39443. messageSends: ["visitDagNode:"]
  39444. }),
  39445. $globals.IRVisitor);
  39446. $core.addMethod(
  39447. $core.method({
  39448. selector: "visitIRTempDeclaration:",
  39449. protocol: "visiting",
  39450. fn: function (anIRTempDeclaration){
  39451. var self=this;
  39452. return $core.withContext(function($ctx1) {
  39453. return self._visitDagNode_(anIRTempDeclaration);
  39454. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  39455. },
  39456. args: ["anIRTempDeclaration"],
  39457. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  39458. referencedClasses: [],
  39459. messageSends: ["visitDagNode:"]
  39460. }),
  39461. $globals.IRVisitor);
  39462. $core.addMethod(
  39463. $core.method({
  39464. selector: "visitIRValue:",
  39465. protocol: "visiting",
  39466. fn: function (anIRValue){
  39467. var self=this;
  39468. return $core.withContext(function($ctx1) {
  39469. return self._visitDagNode_(anIRValue);
  39470. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  39471. },
  39472. args: ["anIRValue"],
  39473. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  39474. referencedClasses: [],
  39475. messageSends: ["visitDagNode:"]
  39476. }),
  39477. $globals.IRVisitor);
  39478. $core.addMethod(
  39479. $core.method({
  39480. selector: "visitIRVariable:",
  39481. protocol: "visiting",
  39482. fn: function (anIRVariable){
  39483. var self=this;
  39484. return $core.withContext(function($ctx1) {
  39485. return self._visitDagNode_(anIRVariable);
  39486. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  39487. },
  39488. args: ["anIRVariable"],
  39489. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  39490. referencedClasses: [],
  39491. messageSends: ["visitDagNode:"]
  39492. }),
  39493. $globals.IRVisitor);
  39494. $core.addMethod(
  39495. $core.method({
  39496. selector: "visitIRVerbatim:",
  39497. protocol: "visiting",
  39498. fn: function (anIRVerbatim){
  39499. var self=this;
  39500. return $core.withContext(function($ctx1) {
  39501. return self._visitDagNode_(anIRVerbatim);
  39502. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  39503. },
  39504. args: ["anIRVerbatim"],
  39505. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  39506. referencedClasses: [],
  39507. messageSends: ["visitDagNode:"]
  39508. }),
  39509. $globals.IRVisitor);
  39510. $core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
  39511. $core.addMethod(
  39512. $core.method({
  39513. selector: "contents",
  39514. protocol: "accessing",
  39515. fn: function (){
  39516. var self=this;
  39517. return $core.withContext(function($ctx1) {
  39518. return $recv(self._stream())._contents();
  39519. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  39520. },
  39521. args: [],
  39522. source: "contents\x0a\x09^ self stream contents",
  39523. referencedClasses: [],
  39524. messageSends: ["contents", "stream"]
  39525. }),
  39526. $globals.IRJSTranslator);
  39527. $core.addMethod(
  39528. $core.method({
  39529. selector: "currentClass",
  39530. protocol: "accessing",
  39531. fn: function (){
  39532. var self=this;
  39533. return self["@currentClass"];
  39534. },
  39535. args: [],
  39536. source: "currentClass\x0a\x09^ currentClass",
  39537. referencedClasses: [],
  39538. messageSends: []
  39539. }),
  39540. $globals.IRJSTranslator);
  39541. $core.addMethod(
  39542. $core.method({
  39543. selector: "currentClass:",
  39544. protocol: "accessing",
  39545. fn: function (aClass){
  39546. var self=this;
  39547. self["@currentClass"]=aClass;
  39548. return self;
  39549. },
  39550. args: ["aClass"],
  39551. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  39552. referencedClasses: [],
  39553. messageSends: []
  39554. }),
  39555. $globals.IRJSTranslator);
  39556. $core.addMethod(
  39557. $core.method({
  39558. selector: "initialize",
  39559. protocol: "initialization",
  39560. fn: function (){
  39561. var self=this;
  39562. return $core.withContext(function($ctx1) {
  39563. (
  39564. $ctx1.supercall = true,
  39565. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  39566. $ctx1.supercall = false;
  39567. self["@stream"]=$recv($globals.JSStream)._new();
  39568. return self;
  39569. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  39570. },
  39571. args: [],
  39572. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  39573. referencedClasses: ["JSStream"],
  39574. messageSends: ["initialize", "new"]
  39575. }),
  39576. $globals.IRJSTranslator);
  39577. $core.addMethod(
  39578. $core.method({
  39579. selector: "stream",
  39580. protocol: "accessing",
  39581. fn: function (){
  39582. var self=this;
  39583. return self["@stream"];
  39584. },
  39585. args: [],
  39586. source: "stream\x0a\x09^ stream",
  39587. referencedClasses: [],
  39588. messageSends: []
  39589. }),
  39590. $globals.IRJSTranslator);
  39591. $core.addMethod(
  39592. $core.method({
  39593. selector: "stream:",
  39594. protocol: "accessing",
  39595. fn: function (aStream){
  39596. var self=this;
  39597. self["@stream"]=aStream;
  39598. return self;
  39599. },
  39600. args: ["aStream"],
  39601. source: "stream: aStream\x0a\x09stream := aStream",
  39602. referencedClasses: [],
  39603. messageSends: []
  39604. }),
  39605. $globals.IRJSTranslator);
  39606. $core.addMethod(
  39607. $core.method({
  39608. selector: "visitIRAssignment:",
  39609. protocol: "visiting",
  39610. fn: function (anIRAssignment){
  39611. var self=this;
  39612. return $core.withContext(function($ctx1) {
  39613. $recv(self._stream())._nextPutAssignLhs_rhs_((function(){
  39614. return $core.withContext(function($ctx2) {
  39615. return self._visit_($recv(anIRAssignment)._left());
  39616. $ctx2.sendIdx["visit:"]=1;
  39617. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39618. }),(function(){
  39619. return $core.withContext(function($ctx2) {
  39620. return self._visit_($recv(anIRAssignment)._right());
  39621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39622. }));
  39623. return self;
  39624. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  39625. },
  39626. args: ["anIRAssignment"],
  39627. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  39628. referencedClasses: [],
  39629. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  39630. }),
  39631. $globals.IRJSTranslator);
  39632. $core.addMethod(
  39633. $core.method({
  39634. selector: "visitIRClosure:",
  39635. protocol: "visiting",
  39636. fn: function (anIRClosure){
  39637. var self=this;
  39638. return $core.withContext(function($ctx1) {
  39639. var $1,$2;
  39640. $1=self._stream();
  39641. $ctx1.sendIdx["stream"]=1;
  39642. $recv($1)._nextPutClosureWith_arguments_((function(){
  39643. return $core.withContext(function($ctx2) {
  39644. $2=self._stream();
  39645. $ctx2.sendIdx["stream"]=2;
  39646. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  39647. return $core.withContext(function($ctx3) {
  39648. return $recv($recv(each)._name())._asVariableName();
  39649. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39650. })));
  39651. return $recv(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  39652. return $core.withContext(function($ctx3) {
  39653. return (
  39654. $ctx3.supercall = true,
  39655. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($recv(self), [anIRClosure]));
  39656. $ctx3.supercall = false;
  39657. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  39658. }));
  39659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39660. }),$recv(anIRClosure)._arguments());
  39661. return self;
  39662. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  39663. },
  39664. args: ["anIRClosure"],
  39665. 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",
  39666. referencedClasses: [],
  39667. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  39668. }),
  39669. $globals.IRJSTranslator);
  39670. $core.addMethod(
  39671. $core.method({
  39672. selector: "visitIRDynamicArray:",
  39673. protocol: "visiting",
  39674. fn: function (anIRDynamicArray){
  39675. var self=this;
  39676. return $core.withContext(function($ctx1) {
  39677. self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  39678. return self;
  39679. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  39680. },
  39681. args: ["anIRDynamicArray"],
  39682. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  39683. referencedClasses: [],
  39684. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  39685. }),
  39686. $globals.IRJSTranslator);
  39687. $core.addMethod(
  39688. $core.method({
  39689. selector: "visitIRDynamicDictionary:",
  39690. protocol: "visiting",
  39691. fn: function (anIRDynamicDictionary){
  39692. var self=this;
  39693. return $core.withContext(function($ctx1) {
  39694. self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  39695. return self;
  39696. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  39697. },
  39698. args: ["anIRDynamicDictionary"],
  39699. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  39700. referencedClasses: [],
  39701. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  39702. }),
  39703. $globals.IRJSTranslator);
  39704. $core.addMethod(
  39705. $core.method({
  39706. selector: "visitIRMethod:",
  39707. protocol: "visiting",
  39708. fn: function (anIRMethod){
  39709. var self=this;
  39710. return $core.withContext(function($ctx1) {
  39711. var $1,$2,$3,$4,$5,$6,$7;
  39712. $1=self._stream();
  39713. $ctx1.sendIdx["stream"]=1;
  39714. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  39715. return $core.withContext(function($ctx2) {
  39716. $2=self._stream();
  39717. $ctx2.sendIdx["stream"]=2;
  39718. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  39719. return $core.withContext(function($ctx3) {
  39720. $3=self._stream();
  39721. $ctx3.sendIdx["stream"]=3;
  39722. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  39723. return $core.withContext(function($ctx4) {
  39724. return $recv($recv(each)._name())._asVariableName();
  39725. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  39726. }));
  39727. $ctx3.sendIdx["collect:"]=1;
  39728. $recv($3)._nextPutVars_($4);
  39729. $ctx3.sendIdx["nextPutVars:"]=1;
  39730. $5=self._stream();
  39731. $ctx3.sendIdx["stream"]=4;
  39732. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  39733. return $core.withContext(function($ctx4) {
  39734. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  39735. return $core.withContext(function($ctx5) {
  39736. $6=self._stream();
  39737. $ctx5.sendIdx["stream"]=5;
  39738. return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  39739. return $core.withContext(function($ctx6) {
  39740. return $recv($recv(each)._variable())._alias();
  39741. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  39742. })));
  39743. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  39744. }));
  39745. $7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  39746. if($core.assert($7)){
  39747. return $recv(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  39748. return $core.withContext(function($ctx5) {
  39749. return (
  39750. $ctx5.supercall = true,
  39751. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  39752. $ctx5.supercall = false;
  39753. $ctx5.sendIdx["visitIRMethod:"]=1;
  39754. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  39755. }));
  39756. } else {
  39757. return (
  39758. $ctx4.supercall = true,
  39759. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  39760. $ctx4.supercall = false;
  39761. }
  39762. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  39763. }));
  39764. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39765. }),$recv(anIRMethod)._arguments());
  39766. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39767. }));
  39768. return self._contents();
  39769. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  39770. },
  39771. args: ["anIRMethod"],
  39772. 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",
  39773. referencedClasses: [],
  39774. 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"]
  39775. }),
  39776. $globals.IRJSTranslator);
  39777. $core.addMethod(
  39778. $core.method({
  39779. selector: "visitIRNonLocalReturn:",
  39780. protocol: "visiting",
  39781. fn: function (anIRNonLocalReturn){
  39782. var self=this;
  39783. return $core.withContext(function($ctx1) {
  39784. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  39785. return $core.withContext(function($ctx2) {
  39786. return (
  39787. $ctx2.supercall = true,
  39788. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  39789. $ctx2.supercall = false;
  39790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39791. }));
  39792. return self;
  39793. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  39794. },
  39795. args: ["anIRNonLocalReturn"],
  39796. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  39797. referencedClasses: [],
  39798. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  39799. }),
  39800. $globals.IRJSTranslator);
  39801. $core.addMethod(
  39802. $core.method({
  39803. selector: "visitIRReturn:",
  39804. protocol: "visiting",
  39805. fn: function (anIRReturn){
  39806. var self=this;
  39807. return $core.withContext(function($ctx1) {
  39808. $recv(self._stream())._nextPutReturnWith_((function(){
  39809. return $core.withContext(function($ctx2) {
  39810. return (
  39811. $ctx2.supercall = true,
  39812. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  39813. $ctx2.supercall = false;
  39814. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39815. }));
  39816. return self;
  39817. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  39818. },
  39819. args: ["anIRReturn"],
  39820. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  39821. referencedClasses: [],
  39822. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  39823. }),
  39824. $globals.IRJSTranslator);
  39825. $core.addMethod(
  39826. $core.method({
  39827. selector: "visitIRSend:",
  39828. protocol: "visiting",
  39829. fn: function (anIRSend){
  39830. var self=this;
  39831. var sends,superclass;
  39832. return $core.withContext(function($ctx1) {
  39833. var $1,$2;
  39834. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  39835. $1=$recv(anIRSend)._isSuperSend();
  39836. if($core.assert($1)){
  39837. self._visitSuperSend_(anIRSend);
  39838. } else {
  39839. self._visitSend_(anIRSend);
  39840. }
  39841. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  39842. if($core.assert($2)){
  39843. $recv(self._stream())._nextPutSendIndexFor_(anIRSend);
  39844. }
  39845. return self;
  39846. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  39847. },
  39848. args: ["anIRSend"],
  39849. source: "visitIRSend: anIRSend\x0a\x09| sends superclass |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend isSuperSend\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 ]",
  39850. referencedClasses: [],
  39851. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuperSend", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  39852. }),
  39853. $globals.IRJSTranslator);
  39854. $core.addMethod(
  39855. $core.method({
  39856. selector: "visitIRSequence:",
  39857. protocol: "visiting",
  39858. fn: function (anIRSequence){
  39859. var self=this;
  39860. return $core.withContext(function($ctx1) {
  39861. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  39862. return $core.withContext(function($ctx2) {
  39863. return $recv(self._stream())._nextPutStatementWith_((function(){
  39864. return $core.withContext(function($ctx3) {
  39865. return self._visit_(each);
  39866. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39867. }));
  39868. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39869. }));
  39870. return self;
  39871. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  39872. },
  39873. args: ["anIRSequence"],
  39874. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  39875. referencedClasses: [],
  39876. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  39877. }),
  39878. $globals.IRJSTranslator);
  39879. $core.addMethod(
  39880. $core.method({
  39881. selector: "visitIRTempDeclaration:",
  39882. protocol: "visiting",
  39883. fn: function (anIRTempDeclaration){
  39884. var self=this;
  39885. return self;
  39886. },
  39887. args: ["anIRTempDeclaration"],
  39888. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  39889. referencedClasses: [],
  39890. messageSends: []
  39891. }),
  39892. $globals.IRJSTranslator);
  39893. $core.addMethod(
  39894. $core.method({
  39895. selector: "visitIRValue:",
  39896. protocol: "visiting",
  39897. fn: function (anIRValue){
  39898. var self=this;
  39899. return $core.withContext(function($ctx1) {
  39900. $recv(self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavaScriptSource());
  39901. return self;
  39902. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  39903. },
  39904. args: ["anIRValue"],
  39905. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavaScriptSource",
  39906. referencedClasses: [],
  39907. messageSends: ["nextPutAll:", "stream", "asJavaScriptSource", "value"]
  39908. }),
  39909. $globals.IRJSTranslator);
  39910. $core.addMethod(
  39911. $core.method({
  39912. selector: "visitIRVariable:",
  39913. protocol: "visiting",
  39914. fn: function (anIRVariable){
  39915. var self=this;
  39916. return $core.withContext(function($ctx1) {
  39917. var $3,$2,$1,$4;
  39918. $3=$recv(anIRVariable)._variable();
  39919. $ctx1.sendIdx["variable"]=1;
  39920. $2=$recv($3)._name();
  39921. $1=$recv($2).__eq("thisContext");
  39922. if($core.assert($1)){
  39923. $4=self._stream();
  39924. $ctx1.sendIdx["stream"]=1;
  39925. $recv($4)._nextPutAll_("$core.getThisContext()");
  39926. $ctx1.sendIdx["nextPutAll:"]=1;
  39927. } else {
  39928. $recv(self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  39929. }
  39930. return self;
  39931. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  39932. },
  39933. args: ["anIRVariable"],
  39934. 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 ]",
  39935. referencedClasses: [],
  39936. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  39937. }),
  39938. $globals.IRJSTranslator);
  39939. $core.addMethod(
  39940. $core.method({
  39941. selector: "visitIRVerbatim:",
  39942. protocol: "visiting",
  39943. fn: function (anIRVerbatim){
  39944. var self=this;
  39945. return $core.withContext(function($ctx1) {
  39946. var $1;
  39947. $1=self._stream();
  39948. $ctx1.sendIdx["stream"]=1;
  39949. $recv($1)._nextPutStatementWith_((function(){
  39950. return $core.withContext(function($ctx2) {
  39951. return $recv(self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  39952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39953. }));
  39954. return self;
  39955. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  39956. },
  39957. args: ["anIRVerbatim"],
  39958. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  39959. referencedClasses: [],
  39960. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  39961. }),
  39962. $globals.IRJSTranslator);
  39963. $core.addMethod(
  39964. $core.method({
  39965. selector: "visitInstructionList:enclosedBetween:and:",
  39966. protocol: "visiting",
  39967. fn: function (anArray,aString,anotherString){
  39968. var self=this;
  39969. return $core.withContext(function($ctx1) {
  39970. var $1;
  39971. $1=self._stream();
  39972. $ctx1.sendIdx["stream"]=1;
  39973. $recv($1)._nextPutAll_(aString);
  39974. $ctx1.sendIdx["nextPutAll:"]=1;
  39975. $recv(anArray)._do_separatedBy_((function(each){
  39976. return $core.withContext(function($ctx2) {
  39977. return self._visit_(each);
  39978. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39979. }),(function(){
  39980. return $core.withContext(function($ctx2) {
  39981. return $recv(self._stream())._nextPutAll_(",");
  39982. $ctx2.sendIdx["nextPutAll:"]=2;
  39983. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39984. }));
  39985. $recv(self["@stream"])._nextPutAll_(anotherString);
  39986. return self;
  39987. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  39988. },
  39989. args: ["anArray", "aString", "anotherString"],
  39990. 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",
  39991. referencedClasses: [],
  39992. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  39993. }),
  39994. $globals.IRJSTranslator);
  39995. $core.addMethod(
  39996. $core.method({
  39997. selector: "visitReceiver:",
  39998. protocol: "visiting",
  39999. fn: function (anIRInstruction){
  40000. var self=this;
  40001. return $core.withContext(function($ctx1) {
  40002. var $1,$2,$3;
  40003. $1=$recv(anIRInstruction)._needsBoxingAsReceiver();
  40004. if(!$core.assert($1)){
  40005. $2=self._visit_(anIRInstruction);
  40006. $ctx1.sendIdx["visit:"]=1;
  40007. return $2;
  40008. }
  40009. $3=self._stream();
  40010. $ctx1.sendIdx["stream"]=1;
  40011. $recv($3)._nextPutAll_("$recv(");
  40012. $ctx1.sendIdx["nextPutAll:"]=1;
  40013. self._visit_(anIRInstruction);
  40014. $recv(self._stream())._nextPutAll_(")");
  40015. return self;
  40016. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},$globals.IRJSTranslator)});
  40017. },
  40018. args: ["anIRInstruction"],
  40019. source: "visitReceiver: anIRInstruction\x0a\x09anIRInstruction needsBoxingAsReceiver ifFalse: [ ^ self visit: anIRInstruction ].\x0a\x09\x0a\x09self stream nextPutAll: '$recv('.\x0a\x09self visit: anIRInstruction.\x0a\x09self stream nextPutAll: ')'",
  40020. referencedClasses: [],
  40021. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  40022. }),
  40023. $globals.IRJSTranslator);
  40024. $core.addMethod(
  40025. $core.method({
  40026. selector: "visitSend:",
  40027. protocol: "visiting",
  40028. fn: function (anIRSend){
  40029. var self=this;
  40030. return $core.withContext(function($ctx1) {
  40031. self._visitReceiver_($recv(anIRSend)._receiver());
  40032. $recv(self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  40033. self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  40034. return self;
  40035. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  40036. },
  40037. args: ["anIRSend"],
  40038. 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: ')'",
  40039. referencedClasses: [],
  40040. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  40041. }),
  40042. $globals.IRJSTranslator);
  40043. $core.addMethod(
  40044. $core.method({
  40045. selector: "visitSuperSend:",
  40046. protocol: "visiting",
  40047. fn: function (anIRSend){
  40048. var self=this;
  40049. return $core.withContext(function($ctx1) {
  40050. var $1,$4,$3,$2,$5,$6,$7,$8;
  40051. $1=self._stream();
  40052. $ctx1.sendIdx["stream"]=1;
  40053. $recv($1)._nextPutAll_("(");
  40054. $ctx1.sendIdx["nextPutAll:"]=1;
  40055. $recv($1)._lf();
  40056. $ctx1.sendIdx["lf"]=1;
  40057. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40058. $ctx1.sendIdx["nextPutAll:"]=2;
  40059. $recv($1)._lf();
  40060. $ctx1.sendIdx["lf"]=2;
  40061. $4=$recv(anIRSend)._scope();
  40062. $ctx1.sendIdx["scope"]=1;
  40063. $3=$recv($4)._alias();
  40064. $ctx1.sendIdx["alias"]=1;
  40065. $2=$recv($3).__comma(".supercall = true,");
  40066. $ctx1.sendIdx[","]=1;
  40067. $recv($1)._nextPutAll_($2);
  40068. $ctx1.sendIdx["nextPutAll:"]=3;
  40069. $recv($1)._lf();
  40070. $ctx1.sendIdx["lf"]=3;
  40071. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40072. $ctx1.sendIdx["nextPutAll:"]=4;
  40073. $recv($1)._lf();
  40074. $ctx1.sendIdx["lf"]=4;
  40075. $5="(".__comma($recv(self._currentClass())._asJavaScriptSource());
  40076. $ctx1.sendIdx[","]=2;
  40077. $recv($1)._nextPutAll_($5);
  40078. $ctx1.sendIdx["nextPutAll:"]=5;
  40079. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  40080. $ctx1.sendIdx["nextPutAll:"]=6;
  40081. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  40082. $ctx1.sendIdx[","]=3;
  40083. $recv($1)._nextPutAll_($6);
  40084. $ctx1.sendIdx["nextPutAll:"]=7;
  40085. $7=$recv($1)._nextPutAll_("$recv(self), ");
  40086. $ctx1.sendIdx["nextPutAll:"]=8;
  40087. self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  40088. $8=self._stream();
  40089. $recv($8)._nextPutAll_("));");
  40090. $ctx1.sendIdx["nextPutAll:"]=9;
  40091. $recv($8)._lf();
  40092. $ctx1.sendIdx["lf"]=5;
  40093. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40094. $ctx1.sendIdx["nextPutAll:"]=10;
  40095. $recv($8)._lf();
  40096. $ctx1.sendIdx["lf"]=6;
  40097. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  40098. $ctx1.sendIdx["nextPutAll:"]=11;
  40099. $recv($8)._lf();
  40100. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40101. return self;
  40102. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  40103. },
  40104. args: ["anIRSend"],
  40105. 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: '$recv(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);'",
  40106. referencedClasses: [],
  40107. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavaScriptSource", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  40108. }),
  40109. $globals.IRJSTranslator);
  40110. $core.addClass("JSStream", $globals.Object, ["stream", "omitSemicolon"], "Compiler-IR");
  40111. $core.addMethod(
  40112. $core.method({
  40113. selector: "contents",
  40114. protocol: "accessing",
  40115. fn: function (){
  40116. var self=this;
  40117. return $core.withContext(function($ctx1) {
  40118. return $recv(self["@stream"])._contents();
  40119. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  40120. },
  40121. args: [],
  40122. source: "contents\x0a\x09^ stream contents",
  40123. referencedClasses: [],
  40124. messageSends: ["contents"]
  40125. }),
  40126. $globals.JSStream);
  40127. $core.addMethod(
  40128. $core.method({
  40129. selector: "initialize",
  40130. protocol: "initialization",
  40131. fn: function (){
  40132. var self=this;
  40133. return $core.withContext(function($ctx1) {
  40134. (
  40135. $ctx1.supercall = true,
  40136. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  40137. $ctx1.supercall = false;
  40138. self["@stream"]=""._writeStream();
  40139. return self;
  40140. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  40141. },
  40142. args: [],
  40143. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  40144. referencedClasses: [],
  40145. messageSends: ["initialize", "writeStream"]
  40146. }),
  40147. $globals.JSStream);
  40148. $core.addMethod(
  40149. $core.method({
  40150. selector: "lf",
  40151. protocol: "streaming",
  40152. fn: function (){
  40153. var self=this;
  40154. return $core.withContext(function($ctx1) {
  40155. $recv(self["@stream"])._lf();
  40156. return self;
  40157. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  40158. },
  40159. args: [],
  40160. source: "lf\x0a\x09stream lf",
  40161. referencedClasses: [],
  40162. messageSends: ["lf"]
  40163. }),
  40164. $globals.JSStream);
  40165. $core.addMethod(
  40166. $core.method({
  40167. selector: "nextPut:",
  40168. protocol: "streaming",
  40169. fn: function (aString){
  40170. var self=this;
  40171. return $core.withContext(function($ctx1) {
  40172. $recv(self["@stream"])._nextPut_(aString);
  40173. return self;
  40174. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  40175. },
  40176. args: ["aString"],
  40177. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  40178. referencedClasses: [],
  40179. messageSends: ["nextPut:"]
  40180. }),
  40181. $globals.JSStream);
  40182. $core.addMethod(
  40183. $core.method({
  40184. selector: "nextPutAll:",
  40185. protocol: "streaming",
  40186. fn: function (aString){
  40187. var self=this;
  40188. return $core.withContext(function($ctx1) {
  40189. $recv(self["@stream"])._nextPutAll_(aString);
  40190. return self;
  40191. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  40192. },
  40193. args: ["aString"],
  40194. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  40195. referencedClasses: [],
  40196. messageSends: ["nextPutAll:"]
  40197. }),
  40198. $globals.JSStream);
  40199. $core.addMethod(
  40200. $core.method({
  40201. selector: "nextPutAssignLhs:rhs:",
  40202. protocol: "streaming",
  40203. fn: function (aBlock,anotherBlock){
  40204. var self=this;
  40205. return $core.withContext(function($ctx1) {
  40206. $recv(aBlock)._value();
  40207. $ctx1.sendIdx["value"]=1;
  40208. $recv(self["@stream"])._nextPutAll_("=");
  40209. $recv(anotherBlock)._value();
  40210. return self;
  40211. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  40212. },
  40213. args: ["aBlock", "anotherBlock"],
  40214. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  40215. referencedClasses: [],
  40216. messageSends: ["value", "nextPutAll:"]
  40217. }),
  40218. $globals.JSStream);
  40219. $core.addMethod(
  40220. $core.method({
  40221. selector: "nextPutBlockContextFor:during:",
  40222. protocol: "streaming",
  40223. fn: function (anIRClosure,aBlock){
  40224. var self=this;
  40225. return $core.withContext(function($ctx1) {
  40226. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  40227. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  40228. if(!$core.assert($1)){
  40229. $2=$recv(aBlock)._value();
  40230. $ctx1.sendIdx["value"]=1;
  40231. return $2;
  40232. }
  40233. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40234. $ctx1.sendIdx["nextPutAll:"]=1;
  40235. self._lf();
  40236. $ctx1.sendIdx["lf"]=1;
  40237. $6=$recv(anIRClosure)._scope();
  40238. $ctx1.sendIdx["scope"]=1;
  40239. $5=$recv($6)._alias();
  40240. $ctx1.sendIdx["alias"]=1;
  40241. $4="return $core.withContext(function(".__comma($5);
  40242. $ctx1.sendIdx[","]=2;
  40243. $3=$recv($4).__comma(") {");
  40244. $ctx1.sendIdx[","]=1;
  40245. self._nextPutAll_($3);
  40246. $ctx1.sendIdx["nextPutAll:"]=2;
  40247. self._lf();
  40248. $ctx1.sendIdx["lf"]=2;
  40249. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40250. $ctx1.sendIdx["nextPutAll:"]=3;
  40251. $7=self._lf();
  40252. $ctx1.sendIdx["lf"]=3;
  40253. $recv(aBlock)._value();
  40254. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40255. $ctx1.sendIdx["nextPutAll:"]=4;
  40256. self._lf();
  40257. $ctx1.sendIdx["lf"]=4;
  40258. $11=$recv(anIRClosure)._scope();
  40259. $ctx1.sendIdx["scope"]=2;
  40260. $10=$recv($11)._alias();
  40261. $ctx1.sendIdx["alias"]=2;
  40262. $9="}, function(".__comma($10);
  40263. $ctx1.sendIdx[","]=4;
  40264. $8=$recv($9).__comma(") {");
  40265. $ctx1.sendIdx[","]=3;
  40266. self._nextPutAll_($8);
  40267. $ctx1.sendIdx["nextPutAll:"]=5;
  40268. $15=$recv(anIRClosure)._scope();
  40269. $ctx1.sendIdx["scope"]=3;
  40270. $14=$recv($15)._alias();
  40271. $ctx1.sendIdx["alias"]=3;
  40272. $13=$recv($14).__comma(".fillBlock({");
  40273. $ctx1.sendIdx[","]=5;
  40274. $12=self._nextPutAll_($13);
  40275. $ctx1.sendIdx["nextPutAll:"]=6;
  40276. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  40277. return $core.withContext(function($ctx2) {
  40278. $16=$recv(each)._asVariableName();
  40279. $ctx2.sendIdx["asVariableName"]=1;
  40280. self._nextPutAll_($16);
  40281. $ctx2.sendIdx["nextPutAll:"]=7;
  40282. self._nextPutAll_(":");
  40283. $ctx2.sendIdx["nextPutAll:"]=8;
  40284. $17=self._nextPutAll_($recv(each)._asVariableName());
  40285. $ctx2.sendIdx["nextPutAll:"]=9;
  40286. return $17;
  40287. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40288. }),(function(){
  40289. return $core.withContext(function($ctx2) {
  40290. return self._nextPutAll_(",");
  40291. $ctx2.sendIdx["nextPutAll:"]=10;
  40292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40293. }));
  40294. self._nextPutAll_("},");
  40295. $ctx1.sendIdx["nextPutAll:"]=11;
  40296. $23=$recv(anIRClosure)._scope();
  40297. $ctx1.sendIdx["scope"]=4;
  40298. $22=$recv($23)._outerScope();
  40299. $21=$recv($22)._alias();
  40300. $20=$recv($21).__comma(",");
  40301. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  40302. $ctx1.sendIdx[","]=7;
  40303. $18=$recv($19).__comma(")});");
  40304. $ctx1.sendIdx[","]=6;
  40305. self._nextPutAll_($18);
  40306. $ctx1.sendIdx["nextPutAll:"]=12;
  40307. self._lf();
  40308. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40309. return self;
  40310. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  40311. },
  40312. args: ["anIRClosure", "aBlock"],
  40313. 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);'",
  40314. referencedClasses: [],
  40315. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  40316. }),
  40317. $globals.JSStream);
  40318. $core.addMethod(
  40319. $core.method({
  40320. selector: "nextPutClosureWith:arguments:",
  40321. protocol: "streaming",
  40322. fn: function (aBlock,anArray){
  40323. var self=this;
  40324. return $core.withContext(function($ctx1) {
  40325. var $1,$2,$3;
  40326. $recv(self["@stream"])._nextPutAll_("(function(");
  40327. $ctx1.sendIdx["nextPutAll:"]=1;
  40328. $recv(anArray)._do_separatedBy_((function(each){
  40329. return $core.withContext(function($ctx2) {
  40330. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  40331. $ctx2.sendIdx["nextPutAll:"]=2;
  40332. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40333. }),(function(){
  40334. return $core.withContext(function($ctx2) {
  40335. return $recv(self["@stream"])._nextPut_(",");
  40336. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40337. }));
  40338. $1=self["@stream"];
  40339. $recv($1)._nextPutAll_("){");
  40340. $ctx1.sendIdx["nextPutAll:"]=3;
  40341. $2=$recv($1)._lf();
  40342. $ctx1.sendIdx["lf"]=1;
  40343. $recv(aBlock)._value();
  40344. $3=self["@stream"];
  40345. $recv($3)._lf();
  40346. $recv($3)._nextPutAll_("})");
  40347. return self;
  40348. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  40349. },
  40350. args: ["aBlock", "anArray"],
  40351. 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: '})'",
  40352. referencedClasses: [],
  40353. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  40354. }),
  40355. $globals.JSStream);
  40356. $core.addMethod(
  40357. $core.method({
  40358. selector: "nextPutContextFor:during:",
  40359. protocol: "streaming",
  40360. fn: function (aMethod,aBlock){
  40361. var self=this;
  40362. return $core.withContext(function($ctx1) {
  40363. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  40364. $1=$recv(aMethod)._requiresSmalltalkContext();
  40365. if(!$core.assert($1)){
  40366. $2=$recv(aBlock)._value();
  40367. $ctx1.sendIdx["value"]=1;
  40368. return $2;
  40369. }
  40370. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40371. $ctx1.sendIdx["nextPutAll:"]=1;
  40372. self._lf();
  40373. $ctx1.sendIdx["lf"]=1;
  40374. $6=$recv(aMethod)._scope();
  40375. $ctx1.sendIdx["scope"]=1;
  40376. $5=$recv($6)._alias();
  40377. $ctx1.sendIdx["alias"]=1;
  40378. $4="return $core.withContext(function(".__comma($5);
  40379. $ctx1.sendIdx[","]=2;
  40380. $3=$recv($4).__comma(") {");
  40381. $ctx1.sendIdx[","]=1;
  40382. self._nextPutAll_($3);
  40383. $ctx1.sendIdx["nextPutAll:"]=2;
  40384. self._lf();
  40385. $ctx1.sendIdx["lf"]=2;
  40386. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40387. $ctx1.sendIdx["nextPutAll:"]=3;
  40388. $7=self._lf();
  40389. $ctx1.sendIdx["lf"]=3;
  40390. $recv(aBlock)._value();
  40391. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40392. $ctx1.sendIdx["nextPutAll:"]=4;
  40393. self._lf();
  40394. $ctx1.sendIdx["lf"]=4;
  40395. $12=$recv(aMethod)._scope();
  40396. $ctx1.sendIdx["scope"]=2;
  40397. $11=$recv($12)._alias();
  40398. $ctx1.sendIdx["alias"]=2;
  40399. $10="}, function(".__comma($11);
  40400. $ctx1.sendIdx[","]=5;
  40401. $9=$recv($10).__comma(") {");
  40402. $ctx1.sendIdx[","]=4;
  40403. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  40404. $ctx1.sendIdx[","]=3;
  40405. self._nextPutAll_($8);
  40406. $ctx1.sendIdx["nextPutAll:"]=5;
  40407. $16=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  40408. $ctx1.sendIdx["asJavaScriptSource"]=1;
  40409. $15=".fill(self,".__comma($16);
  40410. $14=$recv($15).__comma(",{");
  40411. $ctx1.sendIdx[","]=6;
  40412. $13=self._nextPutAll_($14);
  40413. $ctx1.sendIdx["nextPutAll:"]=6;
  40414. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  40415. return $core.withContext(function($ctx2) {
  40416. $17=$recv(each)._asVariableName();
  40417. $ctx2.sendIdx["asVariableName"]=1;
  40418. self._nextPutAll_($17);
  40419. $ctx2.sendIdx["nextPutAll:"]=7;
  40420. self._nextPutAll_(":");
  40421. $ctx2.sendIdx["nextPutAll:"]=8;
  40422. $18=self._nextPutAll_($recv(each)._asVariableName());
  40423. $ctx2.sendIdx["nextPutAll:"]=9;
  40424. return $18;
  40425. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40426. }),(function(){
  40427. return $core.withContext(function($ctx2) {
  40428. return self._nextPutAll_(",");
  40429. $ctx2.sendIdx["nextPutAll:"]=10;
  40430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40431. }));
  40432. self._nextPutAll_("},");
  40433. $ctx1.sendIdx["nextPutAll:"]=11;
  40434. self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavaScriptSource());
  40435. $ctx1.sendIdx["nextPutAll:"]=12;
  40436. self._nextPutAll_(")});");
  40437. $ctx1.sendIdx["nextPutAll:"]=13;
  40438. self._lf();
  40439. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40440. return self;
  40441. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  40442. },
  40443. args: ["aMethod", "aBlock"],
  40444. 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);'",
  40445. referencedClasses: [],
  40446. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavaScriptSource", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  40447. }),
  40448. $globals.JSStream);
  40449. $core.addMethod(
  40450. $core.method({
  40451. selector: "nextPutFunctionWith:arguments:",
  40452. protocol: "streaming",
  40453. fn: function (aBlock,anArray){
  40454. var self=this;
  40455. return $core.withContext(function($ctx1) {
  40456. var $1,$2,$3,$4,$5;
  40457. $recv(self["@stream"])._nextPutAll_("fn: function(");
  40458. $ctx1.sendIdx["nextPutAll:"]=1;
  40459. $recv(anArray)._do_separatedBy_((function(each){
  40460. return $core.withContext(function($ctx2) {
  40461. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  40462. $ctx2.sendIdx["nextPutAll:"]=2;
  40463. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40464. }),(function(){
  40465. return $core.withContext(function($ctx2) {
  40466. return $recv(self["@stream"])._nextPut_(",");
  40467. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40468. }));
  40469. $1=self["@stream"];
  40470. $recv($1)._nextPutAll_("){");
  40471. $ctx1.sendIdx["nextPutAll:"]=3;
  40472. $2=$recv($1)._lf();
  40473. $ctx1.sendIdx["lf"]=1;
  40474. $3=self["@stream"];
  40475. $recv($3)._nextPutAll_("var self=this;");
  40476. $ctx1.sendIdx["nextPutAll:"]=4;
  40477. $4=$recv($3)._lf();
  40478. $ctx1.sendIdx["lf"]=2;
  40479. $recv(aBlock)._value();
  40480. $5=self["@stream"];
  40481. $recv($5)._lf();
  40482. $recv($5)._nextPutAll_("}");
  40483. return self;
  40484. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  40485. },
  40486. args: ["aBlock", "anArray"],
  40487. 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;'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '}'",
  40488. referencedClasses: [],
  40489. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  40490. }),
  40491. $globals.JSStream);
  40492. $core.addMethod(
  40493. $core.method({
  40494. selector: "nextPutIf:then:",
  40495. protocol: "streaming",
  40496. fn: function (aBlock,anotherBlock){
  40497. var self=this;
  40498. return $core.withContext(function($ctx1) {
  40499. var $1;
  40500. $recv(self["@stream"])._nextPutAll_("if(");
  40501. $ctx1.sendIdx["nextPutAll:"]=1;
  40502. $recv(aBlock)._value();
  40503. $ctx1.sendIdx["value"]=1;
  40504. $1=self["@stream"];
  40505. $recv($1)._nextPutAll_("){");
  40506. $ctx1.sendIdx["nextPutAll:"]=2;
  40507. $recv($1)._lf();
  40508. $recv(anotherBlock)._value();
  40509. $recv(self["@stream"])._nextPutAll_("}");
  40510. self._omitSemicolon_(true);
  40511. return self;
  40512. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  40513. },
  40514. args: ["aBlock", "anotherBlock"],
  40515. 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",
  40516. referencedClasses: [],
  40517. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  40518. }),
  40519. $globals.JSStream);
  40520. $core.addMethod(
  40521. $core.method({
  40522. selector: "nextPutIf:then:else:",
  40523. protocol: "streaming",
  40524. fn: function (aBlock,ifBlock,elseBlock){
  40525. var self=this;
  40526. return $core.withContext(function($ctx1) {
  40527. var $1,$2,$3;
  40528. $recv(self["@stream"])._nextPutAll_("if(");
  40529. $ctx1.sendIdx["nextPutAll:"]=1;
  40530. $recv(aBlock)._value();
  40531. $ctx1.sendIdx["value"]=1;
  40532. $1=self["@stream"];
  40533. $recv($1)._nextPutAll_("){");
  40534. $ctx1.sendIdx["nextPutAll:"]=2;
  40535. $2=$recv($1)._lf();
  40536. $ctx1.sendIdx["lf"]=1;
  40537. $recv(ifBlock)._value();
  40538. $ctx1.sendIdx["value"]=2;
  40539. $3=self["@stream"];
  40540. $recv($3)._nextPutAll_("} else {");
  40541. $ctx1.sendIdx["nextPutAll:"]=3;
  40542. $recv($3)._lf();
  40543. $recv(elseBlock)._value();
  40544. $recv(self["@stream"])._nextPutAll_("}");
  40545. self._omitSemicolon_(true);
  40546. return self;
  40547. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  40548. },
  40549. args: ["aBlock", "ifBlock", "elseBlock"],
  40550. 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",
  40551. referencedClasses: [],
  40552. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  40553. }),
  40554. $globals.JSStream);
  40555. $core.addMethod(
  40556. $core.method({
  40557. selector: "nextPutMethodDeclaration:with:",
  40558. protocol: "streaming",
  40559. fn: function (aMethod,aBlock){
  40560. var self=this;
  40561. return $core.withContext(function($ctx1) {
  40562. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  40563. $1=self["@stream"];
  40564. $recv($1)._nextPutAll_("$core.method({");
  40565. $ctx1.sendIdx["nextPutAll:"]=1;
  40566. $recv($1)._lf();
  40567. $ctx1.sendIdx["lf"]=1;
  40568. $4=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  40569. $ctx1.sendIdx["asJavaScriptSource"]=1;
  40570. $3="selector: ".__comma($4);
  40571. $ctx1.sendIdx[","]=2;
  40572. $2=$recv($3).__comma(",");
  40573. $ctx1.sendIdx[","]=1;
  40574. $recv($1)._nextPutAll_($2);
  40575. $ctx1.sendIdx["nextPutAll:"]=2;
  40576. $recv($1)._lf();
  40577. $ctx1.sendIdx["lf"]=2;
  40578. $7=$recv($recv(aMethod)._source())._asJavaScriptSource();
  40579. $ctx1.sendIdx["asJavaScriptSource"]=2;
  40580. $6="source: ".__comma($7);
  40581. $ctx1.sendIdx[","]=4;
  40582. $5=$recv($6).__comma(",");
  40583. $ctx1.sendIdx[","]=3;
  40584. $recv($1)._nextPutAll_($5);
  40585. $ctx1.sendIdx["nextPutAll:"]=3;
  40586. $8=$recv($1)._lf();
  40587. $ctx1.sendIdx["lf"]=3;
  40588. $recv(aBlock)._value();
  40589. $ctx1.sendIdx["value"]=1;
  40590. $9=self["@stream"];
  40591. $12=$recv($globals.String)._lf();
  40592. $ctx1.sendIdx["lf"]=4;
  40593. $11=",".__comma($12);
  40594. $ctx1.sendIdx[","]=6;
  40595. $10=$recv($11).__comma("messageSends: ");
  40596. $ctx1.sendIdx[","]=5;
  40597. $recv($9)._nextPutAll_($10);
  40598. $ctx1.sendIdx["nextPutAll:"]=4;
  40599. $15=$recv($recv(aMethod)._messageSends())._asArray();
  40600. $ctx1.sendIdx["asArray"]=1;
  40601. $14=$recv($15)._asJavaScriptSource();
  40602. $ctx1.sendIdx["asJavaScriptSource"]=3;
  40603. $13=$recv($14).__comma(",");
  40604. $ctx1.sendIdx[","]=7;
  40605. $recv($9)._nextPutAll_($13);
  40606. $ctx1.sendIdx["nextPutAll:"]=5;
  40607. $recv($9)._lf();
  40608. $ctx1.sendIdx["lf"]=5;
  40609. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  40610. return $core.withContext(function($ctx2) {
  40611. return $recv(each)._value();
  40612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40613. })))._asArray())._asJavaScriptSource();
  40614. $ctx1.sendIdx["asJavaScriptSource"]=4;
  40615. $17="args: ".__comma($18);
  40616. $16=$recv($17).__comma(",");
  40617. $ctx1.sendIdx[","]=8;
  40618. $recv($9)._nextPutAll_($16);
  40619. $ctx1.sendIdx["nextPutAll:"]=6;
  40620. $recv($9)._lf();
  40621. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  40622. $ctx1.sendIdx["nextPutAll:"]=7;
  40623. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  40624. return $core.withContext(function($ctx2) {
  40625. return $recv(self["@stream"])._nextPutAll_($recv(each)._asJavaScriptSource());
  40626. $ctx2.sendIdx["nextPutAll:"]=8;
  40627. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40628. }),(function(){
  40629. return $core.withContext(function($ctx2) {
  40630. return $recv(self["@stream"])._nextPutAll_(",");
  40631. $ctx2.sendIdx["nextPutAll:"]=9;
  40632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40633. }));
  40634. $20=self["@stream"];
  40635. $recv($20)._nextPutAll_("]");
  40636. $ctx1.sendIdx["nextPutAll:"]=10;
  40637. $recv($20)._nextPutAll_("})");
  40638. return self;
  40639. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  40640. },
  40641. args: ["aMethod", "aBlock"],
  40642. 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: '})'",
  40643. referencedClasses: ["String"],
  40644. messageSends: ["nextPutAll:", "lf", ",", "asJavaScriptSource", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  40645. }),
  40646. $globals.JSStream);
  40647. $core.addMethod(
  40648. $core.method({
  40649. selector: "nextPutNonLocalReturnHandlingWith:",
  40650. protocol: "streaming",
  40651. fn: function (aBlock){
  40652. var self=this;
  40653. return $core.withContext(function($ctx1) {
  40654. var $1,$2,$3;
  40655. $1=self["@stream"];
  40656. $recv($1)._nextPutAll_("var $early={};");
  40657. $ctx1.sendIdx["nextPutAll:"]=1;
  40658. $recv($1)._lf();
  40659. $ctx1.sendIdx["lf"]=1;
  40660. $recv($1)._nextPutAll_("try {");
  40661. $ctx1.sendIdx["nextPutAll:"]=2;
  40662. $2=$recv($1)._lf();
  40663. $ctx1.sendIdx["lf"]=2;
  40664. $recv(aBlock)._value();
  40665. $3=self["@stream"];
  40666. $recv($3)._nextPutAll_("}");
  40667. $ctx1.sendIdx["nextPutAll:"]=3;
  40668. $recv($3)._lf();
  40669. $ctx1.sendIdx["lf"]=3;
  40670. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  40671. $recv($3)._lf();
  40672. return self;
  40673. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  40674. },
  40675. args: ["aBlock"],
  40676. 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",
  40677. referencedClasses: [],
  40678. messageSends: ["nextPutAll:", "lf", "value"]
  40679. }),
  40680. $globals.JSStream);
  40681. $core.addMethod(
  40682. $core.method({
  40683. selector: "nextPutNonLocalReturnWith:",
  40684. protocol: "streaming",
  40685. fn: function (aBlock){
  40686. var self=this;
  40687. return $core.withContext(function($ctx1) {
  40688. $recv(self["@stream"])._nextPutAll_("throw $early=[");
  40689. $ctx1.sendIdx["nextPutAll:"]=1;
  40690. $recv(aBlock)._value();
  40691. $recv(self["@stream"])._nextPutAll_("]");
  40692. return self;
  40693. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  40694. },
  40695. args: ["aBlock"],
  40696. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  40697. referencedClasses: [],
  40698. messageSends: ["nextPutAll:", "value"]
  40699. }),
  40700. $globals.JSStream);
  40701. $core.addMethod(
  40702. $core.method({
  40703. selector: "nextPutReturnWith:",
  40704. protocol: "streaming",
  40705. fn: function (aBlock){
  40706. var self=this;
  40707. return $core.withContext(function($ctx1) {
  40708. $recv(self["@stream"])._nextPutAll_("return ");
  40709. $recv(aBlock)._value();
  40710. return self;
  40711. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  40712. },
  40713. args: ["aBlock"],
  40714. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  40715. referencedClasses: [],
  40716. messageSends: ["nextPutAll:", "value"]
  40717. }),
  40718. $globals.JSStream);
  40719. $core.addMethod(
  40720. $core.method({
  40721. selector: "nextPutSendIndexFor:",
  40722. protocol: "streaming",
  40723. fn: function (anIRSend){
  40724. var self=this;
  40725. return $core.withContext(function($ctx1) {
  40726. self._nextPutAll_(";");
  40727. $ctx1.sendIdx["nextPutAll:"]=1;
  40728. self._lf();
  40729. $ctx1.sendIdx["lf"]=1;
  40730. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40731. $ctx1.sendIdx["nextPutAll:"]=2;
  40732. self._lf();
  40733. $ctx1.sendIdx["lf"]=2;
  40734. self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  40735. $ctx1.sendIdx["nextPutAll:"]=3;
  40736. self._nextPutAll_(".sendIdx[");
  40737. $ctx1.sendIdx["nextPutAll:"]=4;
  40738. self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavaScriptSource());
  40739. $ctx1.sendIdx["nextPutAll:"]=5;
  40740. self._nextPutAll_("]=");
  40741. $ctx1.sendIdx["nextPutAll:"]=6;
  40742. self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  40743. $ctx1.sendIdx["nextPutAll:"]=7;
  40744. self._nextPutAll_(";");
  40745. $ctx1.sendIdx["nextPutAll:"]=8;
  40746. self._lf();
  40747. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  40748. return self;
  40749. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  40750. },
  40751. args: ["anIRSend"],
  40752. 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)'",
  40753. referencedClasses: [],
  40754. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavaScriptSource", "selector", "asString", "index"]
  40755. }),
  40756. $globals.JSStream);
  40757. $core.addMethod(
  40758. $core.method({
  40759. selector: "nextPutStatementWith:",
  40760. protocol: "streaming",
  40761. fn: function (aBlock){
  40762. var self=this;
  40763. return $core.withContext(function($ctx1) {
  40764. var $1;
  40765. self._omitSemicolon_(false);
  40766. $ctx1.sendIdx["omitSemicolon:"]=1;
  40767. $recv(aBlock)._value();
  40768. $1=self._omitSemicolon();
  40769. if(!$core.assert($1)){
  40770. $recv(self["@stream"])._nextPutAll_(";");
  40771. }
  40772. self._omitSemicolon_(false);
  40773. $recv(self["@stream"])._lf();
  40774. return self;
  40775. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  40776. },
  40777. args: ["aBlock"],
  40778. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  40779. referencedClasses: [],
  40780. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  40781. }),
  40782. $globals.JSStream);
  40783. $core.addMethod(
  40784. $core.method({
  40785. selector: "nextPutVars:",
  40786. protocol: "streaming",
  40787. fn: function (aCollection){
  40788. var self=this;
  40789. return $core.withContext(function($ctx1) {
  40790. var $1;
  40791. $recv(aCollection)._ifNotEmpty_((function(){
  40792. return $core.withContext(function($ctx2) {
  40793. $recv(self["@stream"])._nextPutAll_("var ");
  40794. $ctx2.sendIdx["nextPutAll:"]=1;
  40795. $recv(aCollection)._do_separatedBy_((function(each){
  40796. return $core.withContext(function($ctx3) {
  40797. return $recv(self["@stream"])._nextPutAll_(each);
  40798. $ctx3.sendIdx["nextPutAll:"]=2;
  40799. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  40800. }),(function(){
  40801. return $core.withContext(function($ctx3) {
  40802. return $recv(self["@stream"])._nextPutAll_(",");
  40803. $ctx3.sendIdx["nextPutAll:"]=3;
  40804. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  40805. }));
  40806. $1=self["@stream"];
  40807. $recv($1)._nextPutAll_(";");
  40808. return $recv($1)._lf();
  40809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40810. }));
  40811. return self;
  40812. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  40813. },
  40814. args: ["aCollection"],
  40815. 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 ]",
  40816. referencedClasses: [],
  40817. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  40818. }),
  40819. $globals.JSStream);
  40820. $core.addMethod(
  40821. $core.method({
  40822. selector: "omitSemicolon",
  40823. protocol: "accessing",
  40824. fn: function (){
  40825. var self=this;
  40826. return self["@omitSemicolon"];
  40827. },
  40828. args: [],
  40829. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  40830. referencedClasses: [],
  40831. messageSends: []
  40832. }),
  40833. $globals.JSStream);
  40834. $core.addMethod(
  40835. $core.method({
  40836. selector: "omitSemicolon:",
  40837. protocol: "accessing",
  40838. fn: function (aBoolean){
  40839. var self=this;
  40840. self["@omitSemicolon"]=aBoolean;
  40841. return self;
  40842. },
  40843. args: ["aBoolean"],
  40844. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  40845. referencedClasses: [],
  40846. messageSends: []
  40847. }),
  40848. $globals.JSStream);
  40849. $core.addMethod(
  40850. $core.method({
  40851. selector: "isReferenced",
  40852. protocol: "*Compiler-IR",
  40853. fn: function (){
  40854. var self=this;
  40855. return $core.withContext(function($ctx1) {
  40856. var $3,$2,$1;
  40857. $3=self._parent();
  40858. $ctx1.sendIdx["parent"]=1;
  40859. $2=$recv($3)._isSequenceNode();
  40860. $1=$recv($2)._or_((function(){
  40861. return $core.withContext(function($ctx2) {
  40862. return $recv(self._parent())._isAssignmentNode();
  40863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40864. }));
  40865. return $recv($1)._not();
  40866. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.ASTNode)});
  40867. },
  40868. args: [],
  40869. 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",
  40870. referencedClasses: [],
  40871. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  40872. }),
  40873. $globals.ASTNode);
  40874. $core.addMethod(
  40875. $core.method({
  40876. selector: "subtreeNeedsAliasing",
  40877. protocol: "*Compiler-IR",
  40878. fn: function (){
  40879. var self=this;
  40880. return $core.withContext(function($ctx1) {
  40881. return $recv(self._shouldBeAliased())._or_((function(){
  40882. return $core.withContext(function($ctx2) {
  40883. return $recv(self._dagChildren())._anySatisfy_((function(each){
  40884. return $core.withContext(function($ctx3) {
  40885. return $recv(each)._subtreeNeedsAliasing();
  40886. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  40887. }));
  40888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40889. }));
  40890. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.ASTNode)});
  40891. },
  40892. args: [],
  40893. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  40894. referencedClasses: [],
  40895. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  40896. }),
  40897. $globals.ASTNode);
  40898. $core.addMethod(
  40899. $core.method({
  40900. selector: "shouldBeAliased",
  40901. protocol: "*Compiler-IR",
  40902. fn: function (){
  40903. var self=this;
  40904. return $core.withContext(function($ctx1) {
  40905. var $1;
  40906. $1=(
  40907. $ctx1.supercall = true,
  40908. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($recv(self), []));
  40909. $ctx1.supercall = false;
  40910. return $recv($1)._or_((function(){
  40911. return $core.withContext(function($ctx2) {
  40912. return self._isReferenced();
  40913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40914. }));
  40915. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  40916. },
  40917. args: [],
  40918. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  40919. referencedClasses: [],
  40920. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  40921. }),
  40922. $globals.AssignmentNode);
  40923. $core.addMethod(
  40924. $core.method({
  40925. selector: "appendToInstruction:",
  40926. protocol: "*Compiler-IR",
  40927. fn: function (anIRInstruction){
  40928. var self=this;
  40929. return $core.withContext(function($ctx1) {
  40930. $recv(anIRInstruction)._appendBlock_(self);
  40931. return self;
  40932. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  40933. },
  40934. args: ["anIRInstruction"],
  40935. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  40936. referencedClasses: [],
  40937. messageSends: ["appendBlock:"]
  40938. }),
  40939. $globals.BlockClosure);
  40940. $core.addMethod(
  40941. $core.method({
  40942. selector: "subtreeNeedsAliasing",
  40943. protocol: "*Compiler-IR",
  40944. fn: function (){
  40945. var self=this;
  40946. return $core.withContext(function($ctx1) {
  40947. return self._shouldBeAliased();
  40948. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  40949. },
  40950. args: [],
  40951. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  40952. referencedClasses: [],
  40953. messageSends: ["shouldBeAliased"]
  40954. }),
  40955. $globals.BlockNode);
  40956. $core.addMethod(
  40957. $core.method({
  40958. selector: "subtreeNeedsAliasing",
  40959. protocol: "*Compiler-IR",
  40960. fn: function (){
  40961. var self=this;
  40962. return $core.withContext(function($ctx1) {
  40963. return $recv($recv(self._parent())._isSequenceNode())._not();
  40964. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  40965. },
  40966. args: [],
  40967. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  40968. referencedClasses: [],
  40969. messageSends: ["not", "isSequenceNode", "parent"]
  40970. }),
  40971. $globals.CascadeNode);
  40972. $core.addMethod(
  40973. $core.method({
  40974. selector: "shouldBeAliased",
  40975. protocol: "*Compiler-IR",
  40976. fn: function (){
  40977. var self=this;
  40978. var sends;
  40979. return $core.withContext(function($ctx1) {
  40980. var $2,$1;
  40981. sends=$recv($recv($recv(self._method())._sendIndexes())._at_(self._selector()))._size();
  40982. $2=(
  40983. $ctx1.supercall = true,
  40984. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($recv(self), []));
  40985. $ctx1.supercall = false;
  40986. $1=$recv($2)._or_((function(){
  40987. return $core.withContext(function($ctx2) {
  40988. return $recv(self._isReferenced())._and_((function(){
  40989. return $core.withContext(function($ctx3) {
  40990. return $recv($recv(self._index()).__lt(sends))._or_((function(){
  40991. return $core.withContext(function($ctx4) {
  40992. return self._superSend();
  40993. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  40994. }));
  40995. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40996. }));
  40997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40998. }));
  40999. $ctx1.sendIdx["or:"]=1;
  41000. return $1;
  41001. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  41002. },
  41003. args: [],
  41004. 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 ] ] ])",
  41005. referencedClasses: [],
  41006. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  41007. }),
  41008. $globals.SendNode);
  41009. $core.addMethod(
  41010. $core.method({
  41011. selector: "subtreeNeedsAliasing",
  41012. protocol: "*Compiler-IR",
  41013. fn: function (){
  41014. var self=this;
  41015. return $core.withContext(function($ctx1) {
  41016. return $recv(self._shouldBeInlined())._or_((function(){
  41017. return $core.withContext(function($ctx2) {
  41018. return (
  41019. $ctx2.supercall = true,
  41020. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($recv(self), []));
  41021. $ctx2.supercall = false;
  41022. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41023. }));
  41024. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.SendNode)});
  41025. },
  41026. args: [],
  41027. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  41028. referencedClasses: [],
  41029. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  41030. }),
  41031. $globals.SendNode);
  41032. });
  41033. 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";
  41034. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  41035. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  41036. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  41037. $core.addPackage("Compiler-Inlining");
  41038. $core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  41039. $core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  41040. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  41041. $core.addMethod(
  41042. $core.method({
  41043. selector: "visitSendNode:",
  41044. protocol: "visiting",
  41045. fn: function (aNode){
  41046. var self=this;
  41047. return $core.withContext(function($ctx1) {
  41048. var $1,$2,$3,$4,$receiver;
  41049. $1=$recv(aNode)._superSend();
  41050. if(!$core.assert($1)){
  41051. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  41052. if($core.assert($2)){
  41053. $recv(aNode)._shouldBeInlined_(true);
  41054. $3=$recv(aNode)._receiver();
  41055. if(($receiver = $3) == null || $receiver.isNil){
  41056. $3;
  41057. } else {
  41058. var receiver;
  41059. receiver=$receiver;
  41060. $recv(receiver)._shouldBeAliased_(true);
  41061. }
  41062. }
  41063. }
  41064. $4=(
  41065. $ctx1.supercall = true,
  41066. ($globals.ASTPreInliner.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  41067. $ctx1.supercall = false;
  41068. return $4;
  41069. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPreInliner)});
  41070. },
  41071. args: ["aNode"],
  41072. 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",
  41073. referencedClasses: ["IRSendInliner"],
  41074. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  41075. }),
  41076. $globals.ASTPreInliner);
  41077. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  41078. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  41079. $core.addMethod(
  41080. $core.method({
  41081. selector: "acceptDagVisitor:",
  41082. protocol: "visiting",
  41083. fn: function (aVisitor){
  41084. var self=this;
  41085. return $core.withContext(function($ctx1) {
  41086. $recv(aVisitor)._visitIRInlinedClosure_(self);
  41087. return self;
  41088. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  41089. },
  41090. args: ["aVisitor"],
  41091. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  41092. referencedClasses: [],
  41093. messageSends: ["visitIRInlinedClosure:"]
  41094. }),
  41095. $globals.IRInlinedClosure);
  41096. $core.addMethod(
  41097. $core.method({
  41098. selector: "isInlined",
  41099. protocol: "testing",
  41100. fn: function (){
  41101. var self=this;
  41102. return true;
  41103. },
  41104. args: [],
  41105. source: "isInlined\x0a\x09^ true",
  41106. referencedClasses: [],
  41107. messageSends: []
  41108. }),
  41109. $globals.IRInlinedClosure);
  41110. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  41111. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  41112. $core.addMethod(
  41113. $core.method({
  41114. selector: "acceptDagVisitor:",
  41115. protocol: "visiting",
  41116. fn: function (aVisitor){
  41117. var self=this;
  41118. return $core.withContext(function($ctx1) {
  41119. $recv(aVisitor)._visitInlinedSend_(self);
  41120. return self;
  41121. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  41122. },
  41123. args: ["aVisitor"],
  41124. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  41125. referencedClasses: [],
  41126. messageSends: ["visitInlinedSend:"]
  41127. }),
  41128. $globals.IRInlinedSend);
  41129. $core.addMethod(
  41130. $core.method({
  41131. selector: "internalVariables",
  41132. protocol: "accessing",
  41133. fn: function (){
  41134. var self=this;
  41135. return [];
  41136. },
  41137. args: [],
  41138. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  41139. referencedClasses: [],
  41140. messageSends: []
  41141. }),
  41142. $globals.IRInlinedSend);
  41143. $core.addMethod(
  41144. $core.method({
  41145. selector: "isInlined",
  41146. protocol: "testing",
  41147. fn: function (){
  41148. var self=this;
  41149. return true;
  41150. },
  41151. args: [],
  41152. source: "isInlined\x0a\x09^ true",
  41153. referencedClasses: [],
  41154. messageSends: []
  41155. }),
  41156. $globals.IRInlinedSend);
  41157. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  41158. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  41159. $core.addMethod(
  41160. $core.method({
  41161. selector: "acceptDagVisitor:",
  41162. protocol: "visiting",
  41163. fn: function (aVisitor){
  41164. var self=this;
  41165. return $core.withContext(function($ctx1) {
  41166. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  41167. return self;
  41168. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  41169. },
  41170. args: ["aVisitor"],
  41171. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  41172. referencedClasses: [],
  41173. messageSends: ["visitIRInlinedIfFalse:"]
  41174. }),
  41175. $globals.IRInlinedIfFalse);
  41176. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  41177. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  41178. $core.addMethod(
  41179. $core.method({
  41180. selector: "acceptDagVisitor:",
  41181. protocol: "visiting",
  41182. fn: function (aVisitor){
  41183. var self=this;
  41184. return $core.withContext(function($ctx1) {
  41185. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  41186. return self;
  41187. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  41188. },
  41189. args: ["aVisitor"],
  41190. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  41191. referencedClasses: [],
  41192. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  41193. }),
  41194. $globals.IRInlinedIfNilIfNotNil);
  41195. $core.addMethod(
  41196. $core.method({
  41197. selector: "internalVariables",
  41198. protocol: "accessing",
  41199. fn: function (){
  41200. var self=this;
  41201. return $core.withContext(function($ctx1) {
  41202. return $recv($globals.Array)._with_(self._receiverInternalVariable());
  41203. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  41204. },
  41205. args: [],
  41206. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  41207. referencedClasses: ["Array"],
  41208. messageSends: ["with:", "receiverInternalVariable"]
  41209. }),
  41210. $globals.IRInlinedIfNilIfNotNil);
  41211. $core.addMethod(
  41212. $core.method({
  41213. selector: "receiverInternalVariable",
  41214. protocol: "accessing",
  41215. fn: function (){
  41216. var self=this;
  41217. return $core.withContext(function($ctx1) {
  41218. var $1;
  41219. $1=$recv($globals.IRVariable)._new();
  41220. $ctx1.sendIdx["new"]=1;
  41221. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_(self._receiverInternalVariableName()));
  41222. return $recv($1)._yourself();
  41223. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  41224. },
  41225. args: [],
  41226. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  41227. referencedClasses: ["IRVariable", "AliasVar"],
  41228. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  41229. }),
  41230. $globals.IRInlinedIfNilIfNotNil);
  41231. $core.addMethod(
  41232. $core.method({
  41233. selector: "receiverInternalVariableName",
  41234. protocol: "accessing",
  41235. fn: function (){
  41236. var self=this;
  41237. return "$receiver";
  41238. },
  41239. args: [],
  41240. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  41241. referencedClasses: [],
  41242. messageSends: []
  41243. }),
  41244. $globals.IRInlinedIfNilIfNotNil);
  41245. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  41246. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  41247. $core.addMethod(
  41248. $core.method({
  41249. selector: "acceptDagVisitor:",
  41250. protocol: "visiting",
  41251. fn: function (aVisitor){
  41252. var self=this;
  41253. return $core.withContext(function($ctx1) {
  41254. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  41255. return self;
  41256. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  41257. },
  41258. args: ["aVisitor"],
  41259. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  41260. referencedClasses: [],
  41261. messageSends: ["visitIRInlinedIfTrue:"]
  41262. }),
  41263. $globals.IRInlinedIfTrue);
  41264. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  41265. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  41266. $core.addMethod(
  41267. $core.method({
  41268. selector: "acceptDagVisitor:",
  41269. protocol: "visiting",
  41270. fn: function (aVisitor){
  41271. var self=this;
  41272. return $core.withContext(function($ctx1) {
  41273. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  41274. return self;
  41275. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  41276. },
  41277. args: ["aVisitor"],
  41278. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  41279. referencedClasses: [],
  41280. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  41281. }),
  41282. $globals.IRInlinedIfTrueIfFalse);
  41283. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  41284. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  41285. $core.addMethod(
  41286. $core.method({
  41287. selector: "acceptDagVisitor:",
  41288. protocol: "visiting",
  41289. fn: function (aVisitor){
  41290. var self=this;
  41291. return $core.withContext(function($ctx1) {
  41292. $recv(aVisitor)._visitIRInlinedSequence_(self);
  41293. return self;
  41294. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  41295. },
  41296. args: ["aVisitor"],
  41297. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  41298. referencedClasses: [],
  41299. messageSends: ["visitIRInlinedSequence:"]
  41300. }),
  41301. $globals.IRInlinedSequence);
  41302. $core.addMethod(
  41303. $core.method({
  41304. selector: "isInlined",
  41305. protocol: "testing",
  41306. fn: function (){
  41307. var self=this;
  41308. return true;
  41309. },
  41310. args: [],
  41311. source: "isInlined\x0a\x09^ true",
  41312. referencedClasses: [],
  41313. messageSends: []
  41314. }),
  41315. $globals.IRInlinedSequence);
  41316. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  41317. $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`";
  41318. $core.addMethod(
  41319. $core.method({
  41320. selector: "assignmentInliner",
  41321. protocol: "factory",
  41322. fn: function (){
  41323. var self=this;
  41324. return $core.withContext(function($ctx1) {
  41325. var $1;
  41326. $1=$recv($globals.IRAssignmentInliner)._new();
  41327. $recv($1)._translator_(self);
  41328. return $recv($1)._yourself();
  41329. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  41330. },
  41331. args: [],
  41332. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  41333. referencedClasses: ["IRAssignmentInliner"],
  41334. messageSends: ["translator:", "new", "yourself"]
  41335. }),
  41336. $globals.IRInliner);
  41337. $core.addMethod(
  41338. $core.method({
  41339. selector: "returnInliner",
  41340. protocol: "factory",
  41341. fn: function (){
  41342. var self=this;
  41343. return $core.withContext(function($ctx1) {
  41344. var $1;
  41345. $1=$recv($globals.IRReturnInliner)._new();
  41346. $recv($1)._translator_(self);
  41347. return $recv($1)._yourself();
  41348. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  41349. },
  41350. args: [],
  41351. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  41352. referencedClasses: ["IRReturnInliner"],
  41353. messageSends: ["translator:", "new", "yourself"]
  41354. }),
  41355. $globals.IRInliner);
  41356. $core.addMethod(
  41357. $core.method({
  41358. selector: "sendInliner",
  41359. protocol: "factory",
  41360. fn: function (){
  41361. var self=this;
  41362. return $core.withContext(function($ctx1) {
  41363. var $1;
  41364. $1=$recv($globals.IRSendInliner)._new();
  41365. $recv($1)._translator_(self);
  41366. return $recv($1)._yourself();
  41367. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  41368. },
  41369. args: [],
  41370. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  41371. referencedClasses: ["IRSendInliner"],
  41372. messageSends: ["translator:", "new", "yourself"]
  41373. }),
  41374. $globals.IRInliner);
  41375. $core.addMethod(
  41376. $core.method({
  41377. selector: "shouldInlineAssignment:",
  41378. protocol: "testing",
  41379. fn: function (anIRAssignment){
  41380. var self=this;
  41381. return $core.withContext(function($ctx1) {
  41382. var $3,$2,$1;
  41383. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  41384. return $core.withContext(function($ctx2) {
  41385. $3=$recv(anIRAssignment)._right();
  41386. $ctx2.sendIdx["right"]=1;
  41387. $2=$recv($3)._isSend();
  41388. return $recv($2)._and_((function(){
  41389. return $core.withContext(function($ctx3) {
  41390. return self._shouldInlineSend_($recv(anIRAssignment)._right());
  41391. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41392. }));
  41393. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41394. }));
  41395. $ctx1.sendIdx["and:"]=1;
  41396. return $1;
  41397. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  41398. },
  41399. args: ["anIRAssignment"],
  41400. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  41401. referencedClasses: [],
  41402. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  41403. }),
  41404. $globals.IRInliner);
  41405. $core.addMethod(
  41406. $core.method({
  41407. selector: "shouldInlineReturn:",
  41408. protocol: "testing",
  41409. fn: function (anIRReturn){
  41410. var self=this;
  41411. return $core.withContext(function($ctx1) {
  41412. var $3,$2,$1;
  41413. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  41414. return $core.withContext(function($ctx2) {
  41415. $3=$recv(anIRReturn)._expression();
  41416. $ctx2.sendIdx["expression"]=1;
  41417. $2=$recv($3)._isSend();
  41418. return $recv($2)._and_((function(){
  41419. return $core.withContext(function($ctx3) {
  41420. return self._shouldInlineSend_($recv(anIRReturn)._expression());
  41421. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41422. }));
  41423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41424. }));
  41425. $ctx1.sendIdx["and:"]=1;
  41426. return $1;
  41427. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  41428. },
  41429. args: ["anIRReturn"],
  41430. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  41431. referencedClasses: [],
  41432. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  41433. }),
  41434. $globals.IRInliner);
  41435. $core.addMethod(
  41436. $core.method({
  41437. selector: "shouldInlineSend:",
  41438. protocol: "testing",
  41439. fn: function (anIRSend){
  41440. var self=this;
  41441. return $core.withContext(function($ctx1) {
  41442. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  41443. return $core.withContext(function($ctx2) {
  41444. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  41445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41446. }));
  41447. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  41448. },
  41449. args: ["anIRSend"],
  41450. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  41451. referencedClasses: ["IRSendInliner"],
  41452. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  41453. }),
  41454. $globals.IRInliner);
  41455. $core.addMethod(
  41456. $core.method({
  41457. selector: "visitIRAssignment:",
  41458. protocol: "visiting",
  41459. fn: function (anIRAssignment){
  41460. var self=this;
  41461. return $core.withContext(function($ctx1) {
  41462. var $1;
  41463. $1=self._shouldInlineAssignment_(anIRAssignment);
  41464. if($core.assert($1)){
  41465. return $recv(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  41466. } else {
  41467. return (
  41468. $ctx1.supercall = true,
  41469. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($recv(self), [anIRAssignment]));
  41470. $ctx1.supercall = false;
  41471. }
  41472. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  41473. },
  41474. args: ["anIRAssignment"],
  41475. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  41476. referencedClasses: [],
  41477. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  41478. }),
  41479. $globals.IRInliner);
  41480. $core.addMethod(
  41481. $core.method({
  41482. selector: "visitIRNonLocalReturn:",
  41483. protocol: "visiting",
  41484. fn: function (anIRNonLocalReturn){
  41485. var self=this;
  41486. var localReturn;
  41487. return $core.withContext(function($ctx1) {
  41488. var $2,$1,$4,$3,$5,$6,$7;
  41489. $2=$recv(anIRNonLocalReturn)._scope();
  41490. $ctx1.sendIdx["scope"]=1;
  41491. $1=$recv($2)._canInlineNonLocalReturns();
  41492. if($core.assert($1)){
  41493. $4=$recv(anIRNonLocalReturn)._scope();
  41494. $ctx1.sendIdx["scope"]=2;
  41495. $3=$recv($4)._methodScope();
  41496. $5=$recv(anIRNonLocalReturn)._scope();
  41497. $ctx1.sendIdx["scope"]=3;
  41498. $recv($3)._removeNonLocalReturn_($5);
  41499. $6=$recv($globals.IRReturn)._new();
  41500. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  41501. localReturn=$recv($6)._yourself();
  41502. localReturn;
  41503. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  41504. return $core.withContext(function($ctx2) {
  41505. return $recv(localReturn)._add_(each);
  41506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41507. }));
  41508. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  41509. return self._visitIRReturn_(localReturn);
  41510. }
  41511. $7=(
  41512. $ctx1.supercall = true,
  41513. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  41514. $ctx1.supercall = false;
  41515. return $7;
  41516. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  41517. },
  41518. args: ["anIRNonLocalReturn"],
  41519. 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",
  41520. referencedClasses: ["IRReturn"],
  41521. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  41522. }),
  41523. $globals.IRInliner);
  41524. $core.addMethod(
  41525. $core.method({
  41526. selector: "visitIRReturn:",
  41527. protocol: "visiting",
  41528. fn: function (anIRReturn){
  41529. var self=this;
  41530. return $core.withContext(function($ctx1) {
  41531. var $1;
  41532. $1=self._shouldInlineReturn_(anIRReturn);
  41533. if($core.assert($1)){
  41534. return $recv(self._returnInliner())._inlineReturn_(anIRReturn);
  41535. } else {
  41536. return (
  41537. $ctx1.supercall = true,
  41538. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  41539. $ctx1.supercall = false;
  41540. }
  41541. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  41542. },
  41543. args: ["anIRReturn"],
  41544. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  41545. referencedClasses: [],
  41546. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  41547. }),
  41548. $globals.IRInliner);
  41549. $core.addMethod(
  41550. $core.method({
  41551. selector: "visitIRSend:",
  41552. protocol: "visiting",
  41553. fn: function (anIRSend){
  41554. var self=this;
  41555. return $core.withContext(function($ctx1) {
  41556. var $1;
  41557. $1=self._shouldInlineSend_(anIRSend);
  41558. if($core.assert($1)){
  41559. return $recv(self._sendInliner())._inlineSend_(anIRSend);
  41560. } else {
  41561. return (
  41562. $ctx1.supercall = true,
  41563. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($recv(self), [anIRSend]));
  41564. $ctx1.supercall = false;
  41565. }
  41566. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  41567. },
  41568. args: ["anIRSend"],
  41569. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  41570. referencedClasses: [],
  41571. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  41572. }),
  41573. $globals.IRInliner);
  41574. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  41575. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  41576. $core.addMethod(
  41577. $core.method({
  41578. selector: "visitIRInlinedClosure:",
  41579. protocol: "visiting",
  41580. fn: function (anIRInlinedClosure){
  41581. var self=this;
  41582. return $core.withContext(function($ctx1) {
  41583. $recv(self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  41584. return $core.withContext(function($ctx2) {
  41585. return $recv($recv(each)._name())._asVariableName();
  41586. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41587. })));
  41588. self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  41589. return self;
  41590. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  41591. },
  41592. args: ["anIRInlinedClosure"],
  41593. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  41594. referencedClasses: [],
  41595. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  41596. }),
  41597. $globals.IRInliningJSTranslator);
  41598. $core.addMethod(
  41599. $core.method({
  41600. selector: "visitIRInlinedIfFalse:",
  41601. protocol: "visiting",
  41602. fn: function (anIRInlinedIfFalse){
  41603. var self=this;
  41604. return $core.withContext(function($ctx1) {
  41605. var $1,$2,$4,$3;
  41606. $1=self._stream();
  41607. $ctx1.sendIdx["stream"]=1;
  41608. $recv($1)._nextPutIf_then_((function(){
  41609. return $core.withContext(function($ctx2) {
  41610. $2=self._stream();
  41611. $ctx2.sendIdx["stream"]=2;
  41612. $recv($2)._nextPutAll_("!$core.assert(");
  41613. $ctx2.sendIdx["nextPutAll:"]=1;
  41614. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  41615. $ctx2.sendIdx["dagChildren"]=1;
  41616. $3=$recv($4)._first();
  41617. self._visit_($3);
  41618. $ctx2.sendIdx["visit:"]=1;
  41619. return $recv(self._stream())._nextPutAll_(")");
  41620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41621. }),(function(){
  41622. return $core.withContext(function($ctx2) {
  41623. return self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  41624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41625. }));
  41626. return self;
  41627. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  41628. },
  41629. args: ["anIRInlinedIfFalse"],
  41630. 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 ]",
  41631. referencedClasses: [],
  41632. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  41633. }),
  41634. $globals.IRInliningJSTranslator);
  41635. $core.addMethod(
  41636. $core.method({
  41637. selector: "visitIRInlinedIfNilIfNotNil:",
  41638. protocol: "visiting",
  41639. fn: function (anIRInlinedIfNilIfNotNil){
  41640. var self=this;
  41641. return $core.withContext(function($ctx1) {
  41642. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  41643. $1=self._stream();
  41644. $ctx1.sendIdx["stream"]=1;
  41645. $recv($1)._nextPutIf_then_else_((function(){
  41646. var recvVarName;
  41647. return $core.withContext(function($ctx2) {
  41648. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  41649. recvVarName;
  41650. $2=self._stream();
  41651. $ctx2.sendIdx["stream"]=2;
  41652. $4="(".__comma(recvVarName);
  41653. $ctx2.sendIdx[","]=2;
  41654. $3=$recv($4).__comma(" = ");
  41655. $ctx2.sendIdx[","]=1;
  41656. $recv($2)._nextPutAll_($3);
  41657. $ctx2.sendIdx["nextPutAll:"]=1;
  41658. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  41659. $ctx2.sendIdx["dagChildren"]=1;
  41660. $5=$recv($6)._first();
  41661. self._visit_($5);
  41662. $ctx2.sendIdx["visit:"]=1;
  41663. $7=self._stream();
  41664. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".isNil");
  41665. $ctx2.sendIdx[","]=3;
  41666. return $recv($7)._nextPutAll_($8);
  41667. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  41668. }),(function(){
  41669. return $core.withContext(function($ctx2) {
  41670. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  41671. $ctx2.sendIdx["dagChildren"]=2;
  41672. $9=$recv($10)._second();
  41673. return self._visit_($9);
  41674. $ctx2.sendIdx["visit:"]=2;
  41675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41676. }),(function(){
  41677. return $core.withContext(function($ctx2) {
  41678. return self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  41679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41680. }));
  41681. return self;
  41682. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  41683. },
  41684. args: ["anIRInlinedIfNilIfNotNil"],
  41685. 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, '.isNil' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfNilIfNotNil dagChildren second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfNilIfNotNil dagChildren third ]",
  41686. referencedClasses: [],
  41687. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  41688. }),
  41689. $globals.IRInliningJSTranslator);
  41690. $core.addMethod(
  41691. $core.method({
  41692. selector: "visitIRInlinedIfTrue:",
  41693. protocol: "visiting",
  41694. fn: function (anIRInlinedIfTrue){
  41695. var self=this;
  41696. return $core.withContext(function($ctx1) {
  41697. var $1,$2,$4,$3;
  41698. $1=self._stream();
  41699. $ctx1.sendIdx["stream"]=1;
  41700. $recv($1)._nextPutIf_then_((function(){
  41701. return $core.withContext(function($ctx2) {
  41702. $2=self._stream();
  41703. $ctx2.sendIdx["stream"]=2;
  41704. $recv($2)._nextPutAll_("$core.assert(");
  41705. $ctx2.sendIdx["nextPutAll:"]=1;
  41706. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  41707. $ctx2.sendIdx["dagChildren"]=1;
  41708. $3=$recv($4)._first();
  41709. self._visit_($3);
  41710. $ctx2.sendIdx["visit:"]=1;
  41711. return $recv(self._stream())._nextPutAll_(")");
  41712. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41713. }),(function(){
  41714. return $core.withContext(function($ctx2) {
  41715. return self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  41716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41717. }));
  41718. return self;
  41719. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  41720. },
  41721. args: ["anIRInlinedIfTrue"],
  41722. 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 ]",
  41723. referencedClasses: [],
  41724. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  41725. }),
  41726. $globals.IRInliningJSTranslator);
  41727. $core.addMethod(
  41728. $core.method({
  41729. selector: "visitIRInlinedIfTrueIfFalse:",
  41730. protocol: "visiting",
  41731. fn: function (anIRInlinedIfTrueIfFalse){
  41732. var self=this;
  41733. return $core.withContext(function($ctx1) {
  41734. var $1,$2,$4,$3,$6,$5;
  41735. $1=self._stream();
  41736. $ctx1.sendIdx["stream"]=1;
  41737. $recv($1)._nextPutIf_then_else_((function(){
  41738. return $core.withContext(function($ctx2) {
  41739. $2=self._stream();
  41740. $ctx2.sendIdx["stream"]=2;
  41741. $recv($2)._nextPutAll_("$core.assert(");
  41742. $ctx2.sendIdx["nextPutAll:"]=1;
  41743. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  41744. $ctx2.sendIdx["dagChildren"]=1;
  41745. $3=$recv($4)._first();
  41746. self._visit_($3);
  41747. $ctx2.sendIdx["visit:"]=1;
  41748. return $recv(self._stream())._nextPutAll_(")");
  41749. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41750. }),(function(){
  41751. return $core.withContext(function($ctx2) {
  41752. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  41753. $ctx2.sendIdx["dagChildren"]=2;
  41754. $5=$recv($6)._second();
  41755. return self._visit_($5);
  41756. $ctx2.sendIdx["visit:"]=2;
  41757. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41758. }),(function(){
  41759. return $core.withContext(function($ctx2) {
  41760. return self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  41761. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41762. }));
  41763. return self;
  41764. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  41765. },
  41766. args: ["anIRInlinedIfTrueIfFalse"],
  41767. 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 ]",
  41768. referencedClasses: [],
  41769. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  41770. }),
  41771. $globals.IRInliningJSTranslator);
  41772. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  41773. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  41774. $core.addMethod(
  41775. $core.method({
  41776. selector: "ifFalse:",
  41777. protocol: "inlining",
  41778. fn: function (anIRInstruction){
  41779. var self=this;
  41780. return $core.withContext(function($ctx1) {
  41781. return self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  41782. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41783. },
  41784. args: ["anIRInstruction"],
  41785. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  41786. referencedClasses: ["IRInlinedIfFalse"],
  41787. messageSends: ["inlinedSend:withBlock:", "new"]
  41788. }),
  41789. $globals.IRSendInliner);
  41790. $core.addMethod(
  41791. $core.method({
  41792. selector: "ifFalse:ifTrue:",
  41793. protocol: "inlining",
  41794. fn: function (anIRInstruction,anotherIRInstruction){
  41795. var self=this;
  41796. return $core.withContext(function($ctx1) {
  41797. return self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  41798. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41799. },
  41800. args: ["anIRInstruction", "anotherIRInstruction"],
  41801. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  41802. referencedClasses: [],
  41803. messageSends: ["perform:withArguments:"]
  41804. }),
  41805. $globals.IRSendInliner);
  41806. $core.addMethod(
  41807. $core.method({
  41808. selector: "ifNil:",
  41809. protocol: "inlining",
  41810. fn: function (anIRInstruction){
  41811. var self=this;
  41812. return $core.withContext(function($ctx1) {
  41813. var $1,$3,$5,$6,$4,$2;
  41814. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  41815. $ctx1.sendIdx["new"]=1;
  41816. $3=$recv($globals.IRClosure)._new();
  41817. $ctx1.sendIdx["new"]=2;
  41818. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  41819. $5=$recv($globals.IRBlockSequence)._new();
  41820. $recv($5)._add_($recv(self._send())._receiver());
  41821. $6=$recv($5)._yourself();
  41822. $ctx1.sendIdx["yourself"]=1;
  41823. $4=$6;
  41824. $recv($3)._add_($4);
  41825. $ctx1.sendIdx["add:"]=1;
  41826. $2=$recv($3)._yourself();
  41827. return self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  41828. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41829. },
  41830. args: ["anIRInstruction"],
  41831. 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)",
  41832. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  41833. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  41834. }),
  41835. $globals.IRSendInliner);
  41836. $core.addMethod(
  41837. $core.method({
  41838. selector: "ifNil:ifNotNil:",
  41839. protocol: "inlining",
  41840. fn: function (anIRInstruction,anotherIRInstruction){
  41841. var self=this;
  41842. return $core.withContext(function($ctx1) {
  41843. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  41844. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41845. },
  41846. args: ["anIRInstruction", "anotherIRInstruction"],
  41847. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  41848. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  41849. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  41850. }),
  41851. $globals.IRSendInliner);
  41852. $core.addMethod(
  41853. $core.method({
  41854. selector: "ifNotNil:",
  41855. protocol: "inlining",
  41856. fn: function (anIRInstruction){
  41857. var self=this;
  41858. return $core.withContext(function($ctx1) {
  41859. var $1,$3,$5,$6,$4,$2;
  41860. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  41861. $ctx1.sendIdx["new"]=1;
  41862. $3=$recv($globals.IRClosure)._new();
  41863. $ctx1.sendIdx["new"]=2;
  41864. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  41865. $5=$recv($globals.IRBlockSequence)._new();
  41866. $recv($5)._add_($recv(self._send())._receiver());
  41867. $6=$recv($5)._yourself();
  41868. $ctx1.sendIdx["yourself"]=1;
  41869. $4=$6;
  41870. $recv($3)._add_($4);
  41871. $ctx1.sendIdx["add:"]=1;
  41872. $2=$recv($3)._yourself();
  41873. return self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  41874. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41875. },
  41876. args: ["anIRInstruction"],
  41877. 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",
  41878. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  41879. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  41880. }),
  41881. $globals.IRSendInliner);
  41882. $core.addMethod(
  41883. $core.method({
  41884. selector: "ifNotNil:ifNil:",
  41885. protocol: "inlining",
  41886. fn: function (anIRInstruction,anotherIRInstruction){
  41887. var self=this;
  41888. return $core.withContext(function($ctx1) {
  41889. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  41890. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41891. },
  41892. args: ["anIRInstruction", "anotherIRInstruction"],
  41893. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  41894. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  41895. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  41896. }),
  41897. $globals.IRSendInliner);
  41898. $core.addMethod(
  41899. $core.method({
  41900. selector: "ifTrue:",
  41901. protocol: "inlining",
  41902. fn: function (anIRInstruction){
  41903. var self=this;
  41904. return $core.withContext(function($ctx1) {
  41905. return self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  41906. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41907. },
  41908. args: ["anIRInstruction"],
  41909. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  41910. referencedClasses: ["IRInlinedIfTrue"],
  41911. messageSends: ["inlinedSend:withBlock:", "new"]
  41912. }),
  41913. $globals.IRSendInliner);
  41914. $core.addMethod(
  41915. $core.method({
  41916. selector: "ifTrue:ifFalse:",
  41917. protocol: "inlining",
  41918. fn: function (anIRInstruction,anotherIRInstruction){
  41919. var self=this;
  41920. return $core.withContext(function($ctx1) {
  41921. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  41922. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41923. },
  41924. args: ["anIRInstruction", "anotherIRInstruction"],
  41925. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  41926. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  41927. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  41928. }),
  41929. $globals.IRSendInliner);
  41930. $core.addMethod(
  41931. $core.method({
  41932. selector: "inlineClosure:",
  41933. protocol: "inlining",
  41934. fn: function (anIRClosure){
  41935. var self=this;
  41936. var inlinedClosure,sequence,statements;
  41937. return $core.withContext(function($ctx1) {
  41938. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  41939. inlinedClosure=self._inlinedClosure();
  41940. $1=inlinedClosure;
  41941. $2=$recv(anIRClosure)._scope();
  41942. $ctx1.sendIdx["scope"]=1;
  41943. $recv($1)._scope_($2);
  41944. $ctx1.sendIdx["scope:"]=1;
  41945. $recv($1)._parent_($recv(anIRClosure)._parent());
  41946. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  41947. return $core.withContext(function($ctx2) {
  41948. return $recv(inlinedClosure)._add_(each);
  41949. $ctx2.sendIdx["add:"]=1;
  41950. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41951. }));
  41952. $ctx1.sendIdx["do:"]=1;
  41953. sequence=self._inlinedSequence();
  41954. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  41955. return $core.withContext(function($ctx2) {
  41956. $3=inlinedClosure;
  41957. $5=$recv($globals.IRTempDeclaration)._new();
  41958. $ctx2.sendIdx["new"]=1;
  41959. $recv($5)._name_(each);
  41960. $ctx2.sendIdx["name:"]=1;
  41961. $6=$recv($5)._yourself();
  41962. $ctx2.sendIdx["yourself"]=1;
  41963. $4=$6;
  41964. $recv($3)._add_($4);
  41965. $ctx2.sendIdx["add:"]=2;
  41966. $7=sequence;
  41967. $9=$recv($globals.IRAssignment)._new();
  41968. $ctx2.sendIdx["new"]=2;
  41969. $11=$recv($globals.IRVariable)._new();
  41970. $ctx2.sendIdx["new"]=3;
  41971. $13=$recv($globals.AliasVar)._new();
  41972. $ctx2.sendIdx["new"]=4;
  41973. $14=$recv(inlinedClosure)._scope();
  41974. $ctx2.sendIdx["scope"]=2;
  41975. $recv($13)._scope_($14);
  41976. $ctx2.sendIdx["scope:"]=2;
  41977. $recv($13)._name_(each);
  41978. $ctx2.sendIdx["name:"]=2;
  41979. $15=$recv($13)._yourself();
  41980. $ctx2.sendIdx["yourself"]=2;
  41981. $12=$15;
  41982. $10=$recv($11)._variable_($12);
  41983. $ctx2.sendIdx["variable:"]=1;
  41984. $recv($9)._add_($10);
  41985. $ctx2.sendIdx["add:"]=4;
  41986. $17=$recv($globals.IRVariable)._new();
  41987. $ctx2.sendIdx["new"]=5;
  41988. $19=$recv($globals.AliasVar)._new();
  41989. $recv($19)._scope_($recv(inlinedClosure)._scope());
  41990. $recv($19)._name_("$receiver");
  41991. $20=$recv($19)._yourself();
  41992. $ctx2.sendIdx["yourself"]=3;
  41993. $18=$20;
  41994. $16=$recv($17)._variable_($18);
  41995. $recv($9)._add_($16);
  41996. $ctx2.sendIdx["add:"]=5;
  41997. $8=$recv($9)._yourself();
  41998. return $recv($7)._add_($8);
  41999. $ctx2.sendIdx["add:"]=3;
  42000. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42001. }));
  42002. $ctx1.sendIdx["do:"]=2;
  42003. $recv(inlinedClosure)._add_(sequence);
  42004. $ctx1.sendIdx["add:"]=6;
  42005. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  42006. $recv(statements)._ifNotEmpty_((function(){
  42007. return $core.withContext(function($ctx2) {
  42008. $recv($recv(statements)._allButLast())._do_((function(each){
  42009. return $core.withContext(function($ctx3) {
  42010. return $recv(sequence)._add_(each);
  42011. $ctx3.sendIdx["add:"]=7;
  42012. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  42013. }));
  42014. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  42015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42016. }));
  42017. return inlinedClosure;
  42018. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  42019. },
  42020. args: ["anIRClosure"],
  42021. 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",
  42022. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  42023. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  42024. }),
  42025. $globals.IRSendInliner);
  42026. $core.addMethod(
  42027. $core.method({
  42028. selector: "inlineSend:",
  42029. protocol: "inlining",
  42030. fn: function (anIRSend){
  42031. var self=this;
  42032. return $core.withContext(function($ctx1) {
  42033. var $2,$1;
  42034. self._send_(anIRSend);
  42035. $2=self._send();
  42036. $ctx1.sendIdx["send"]=1;
  42037. $1=$recv($2)._selector();
  42038. return self._perform_withArguments_($1,$recv(self._send())._arguments());
  42039. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  42040. },
  42041. args: ["anIRSend"],
  42042. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  42043. referencedClasses: [],
  42044. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  42045. }),
  42046. $globals.IRSendInliner);
  42047. $core.addMethod(
  42048. $core.method({
  42049. selector: "inlineSend:andReplace:",
  42050. protocol: "private",
  42051. fn: function (anIRSend,anIRInstruction){
  42052. var self=this;
  42053. return $core.withContext(function($ctx1) {
  42054. $recv(anIRInstruction)._replaceWith_(anIRSend);
  42055. return self._inlineSend_(anIRSend);
  42056. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  42057. },
  42058. args: ["anIRSend", "anIRInstruction"],
  42059. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  42060. referencedClasses: [],
  42061. messageSends: ["replaceWith:", "inlineSend:"]
  42062. }),
  42063. $globals.IRSendInliner);
  42064. $core.addMethod(
  42065. $core.method({
  42066. selector: "inlinedClosure",
  42067. protocol: "factory",
  42068. fn: function (){
  42069. var self=this;
  42070. return $core.withContext(function($ctx1) {
  42071. return $recv($globals.IRInlinedClosure)._new();
  42072. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  42073. },
  42074. args: [],
  42075. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  42076. referencedClasses: ["IRInlinedClosure"],
  42077. messageSends: ["new"]
  42078. }),
  42079. $globals.IRSendInliner);
  42080. $core.addMethod(
  42081. $core.method({
  42082. selector: "inlinedSend:withBlock:",
  42083. protocol: "private",
  42084. fn: function (inlinedSend,anIRInstruction){
  42085. var self=this;
  42086. var inlinedClosure;
  42087. return $core.withContext(function($ctx1) {
  42088. var $1,$2,$4,$3,$5;
  42089. $1=$recv(anIRInstruction)._isClosure();
  42090. if(!$core.assert($1)){
  42091. self._inliningError_("Message argument should be a block");
  42092. $ctx1.sendIdx["inliningError:"]=1;
  42093. }
  42094. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  42095. if(!$core.assert($2)){
  42096. self._inliningError_("Inlined block should have zero argument");
  42097. }
  42098. inlinedClosure=$recv(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  42099. $4=self._send();
  42100. $ctx1.sendIdx["send"]=1;
  42101. $3=$recv($4)._receiver();
  42102. $recv(inlinedSend)._add_($3);
  42103. $ctx1.sendIdx["add:"]=1;
  42104. $recv(inlinedSend)._add_(inlinedClosure);
  42105. $recv(self._send())._replaceWith_(inlinedSend);
  42106. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  42107. $ctx1.sendIdx["internalVariables"]=1;
  42108. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  42109. return inlinedSend;
  42110. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  42111. },
  42112. args: ["inlinedSend", "anIRInstruction"],
  42113. 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",
  42114. referencedClasses: [],
  42115. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  42116. }),
  42117. $globals.IRSendInliner);
  42118. $core.addMethod(
  42119. $core.method({
  42120. selector: "inlinedSend:withBlock:withBlock:",
  42121. protocol: "private",
  42122. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  42123. var self=this;
  42124. var inlinedClosure1,inlinedClosure2;
  42125. return $core.withContext(function($ctx1) {
  42126. var $1,$2,$3,$4,$6,$5,$7;
  42127. $1=$recv(anIRInstruction)._isClosure();
  42128. $ctx1.sendIdx["isClosure"]=1;
  42129. if(!$core.assert($1)){
  42130. self._inliningError_("Message argument should be a block");
  42131. $ctx1.sendIdx["inliningError:"]=1;
  42132. }
  42133. $2=$recv(anotherIRInstruction)._isClosure();
  42134. if(!$core.assert($2)){
  42135. self._inliningError_("Message argument should be a block");
  42136. }
  42137. $3=self._translator();
  42138. $ctx1.sendIdx["translator"]=1;
  42139. $4=self._inlineClosure_(anIRInstruction);
  42140. $ctx1.sendIdx["inlineClosure:"]=1;
  42141. inlinedClosure1=$recv($3)._visit_($4);
  42142. $ctx1.sendIdx["visit:"]=1;
  42143. inlinedClosure2=$recv(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  42144. $6=self._send();
  42145. $ctx1.sendIdx["send"]=1;
  42146. $5=$recv($6)._receiver();
  42147. $recv(inlinedSend)._add_($5);
  42148. $ctx1.sendIdx["add:"]=1;
  42149. $recv(inlinedSend)._add_(inlinedClosure1);
  42150. $ctx1.sendIdx["add:"]=2;
  42151. $recv(inlinedSend)._add_(inlinedClosure2);
  42152. $recv(self._send())._replaceWith_(inlinedSend);
  42153. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  42154. $ctx1.sendIdx["internalVariables"]=1;
  42155. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  42156. return inlinedSend;
  42157. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  42158. },
  42159. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  42160. 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",
  42161. referencedClasses: [],
  42162. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  42163. }),
  42164. $globals.IRSendInliner);
  42165. $core.addMethod(
  42166. $core.method({
  42167. selector: "inlinedSequence",
  42168. protocol: "factory",
  42169. fn: function (){
  42170. var self=this;
  42171. return $core.withContext(function($ctx1) {
  42172. return $recv($globals.IRInlinedSequence)._new();
  42173. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  42174. },
  42175. args: [],
  42176. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  42177. referencedClasses: ["IRInlinedSequence"],
  42178. messageSends: ["new"]
  42179. }),
  42180. $globals.IRSendInliner);
  42181. $core.addMethod(
  42182. $core.method({
  42183. selector: "inliningError:",
  42184. protocol: "error handling",
  42185. fn: function (aString){
  42186. var self=this;
  42187. return $core.withContext(function($ctx1) {
  42188. $recv($globals.InliningError)._signal_(aString);
  42189. return self;
  42190. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  42191. },
  42192. args: ["aString"],
  42193. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  42194. referencedClasses: ["InliningError"],
  42195. messageSends: ["signal:"]
  42196. }),
  42197. $globals.IRSendInliner);
  42198. $core.addMethod(
  42199. $core.method({
  42200. selector: "send",
  42201. protocol: "accessing",
  42202. fn: function (){
  42203. var self=this;
  42204. return self["@send"];
  42205. },
  42206. args: [],
  42207. source: "send\x0a\x09^ send",
  42208. referencedClasses: [],
  42209. messageSends: []
  42210. }),
  42211. $globals.IRSendInliner);
  42212. $core.addMethod(
  42213. $core.method({
  42214. selector: "send:",
  42215. protocol: "accessing",
  42216. fn: function (anIRSend){
  42217. var self=this;
  42218. self["@send"]=anIRSend;
  42219. return self;
  42220. },
  42221. args: ["anIRSend"],
  42222. source: "send: anIRSend\x0a\x09send := anIRSend",
  42223. referencedClasses: [],
  42224. messageSends: []
  42225. }),
  42226. $globals.IRSendInliner);
  42227. $core.addMethod(
  42228. $core.method({
  42229. selector: "translator",
  42230. protocol: "accessing",
  42231. fn: function (){
  42232. var self=this;
  42233. return self["@translator"];
  42234. },
  42235. args: [],
  42236. source: "translator\x0a\x09^ translator",
  42237. referencedClasses: [],
  42238. messageSends: []
  42239. }),
  42240. $globals.IRSendInliner);
  42241. $core.addMethod(
  42242. $core.method({
  42243. selector: "translator:",
  42244. protocol: "accessing",
  42245. fn: function (anASTTranslator){
  42246. var self=this;
  42247. self["@translator"]=anASTTranslator;
  42248. return self;
  42249. },
  42250. args: ["anASTTranslator"],
  42251. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  42252. referencedClasses: [],
  42253. messageSends: []
  42254. }),
  42255. $globals.IRSendInliner);
  42256. $core.addMethod(
  42257. $core.method({
  42258. selector: "inlinedSelectors",
  42259. protocol: "accessing",
  42260. fn: function (){
  42261. var self=this;
  42262. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  42263. },
  42264. args: [],
  42265. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  42266. referencedClasses: [],
  42267. messageSends: []
  42268. }),
  42269. $globals.IRSendInliner.klass);
  42270. $core.addMethod(
  42271. $core.method({
  42272. selector: "shouldInline:",
  42273. protocol: "accessing",
  42274. fn: function (anIRSend){
  42275. var self=this;
  42276. return $core.withContext(function($ctx1) {
  42277. var $1;
  42278. $1=$recv(self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  42279. if(!$core.assert($1)){
  42280. return false;
  42281. }
  42282. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  42283. return $core.withContext(function($ctx2) {
  42284. return $recv(each)._isClosure();
  42285. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42286. }));
  42287. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.klass)});
  42288. },
  42289. args: ["anIRSend"],
  42290. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  42291. referencedClasses: [],
  42292. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  42293. }),
  42294. $globals.IRSendInliner.klass);
  42295. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  42296. $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};";
  42297. $core.addMethod(
  42298. $core.method({
  42299. selector: "inlineAssignment:",
  42300. protocol: "inlining",
  42301. fn: function (anIRAssignment){
  42302. var self=this;
  42303. return $core.withContext(function($ctx1) {
  42304. self._target_($recv(anIRAssignment)._left());
  42305. return self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  42306. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRAssignmentInliner)});
  42307. },
  42308. args: ["anIRAssignment"],
  42309. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  42310. referencedClasses: [],
  42311. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  42312. }),
  42313. $globals.IRAssignmentInliner);
  42314. $core.addMethod(
  42315. $core.method({
  42316. selector: "inlineClosure:",
  42317. protocol: "inlining",
  42318. fn: function (anIRClosure){
  42319. var self=this;
  42320. var closure,sequence,statements;
  42321. return $core.withContext(function($ctx1) {
  42322. var $1,$2,$3,$5,$4;
  42323. closure=(
  42324. $ctx1.supercall = true,
  42325. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  42326. $ctx1.supercall = false;
  42327. sequence=$recv(closure)._sequence();
  42328. statements=$recv(sequence)._dagChildren();
  42329. $recv(statements)._ifNotEmpty_((function(){
  42330. var final;
  42331. return $core.withContext(function($ctx2) {
  42332. final=$recv(statements)._last();
  42333. final;
  42334. $1=$recv(final)._yieldsValue();
  42335. if($core.assert($1)){
  42336. $2=sequence;
  42337. $3=final;
  42338. $5=$recv($globals.IRAssignment)._new();
  42339. $recv($5)._add_(self._target());
  42340. $ctx2.sendIdx["add:"]=1;
  42341. $recv($5)._add_($recv(final)._copy());
  42342. $4=$recv($5)._yourself();
  42343. return $recv($2)._replace_with_($3,$4);
  42344. }
  42345. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  42346. }));
  42347. return closure;
  42348. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRAssignmentInliner)});
  42349. },
  42350. args: ["anIRClosure"],
  42351. 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",
  42352. referencedClasses: ["IRAssignment"],
  42353. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  42354. }),
  42355. $globals.IRAssignmentInliner);
  42356. $core.addMethod(
  42357. $core.method({
  42358. selector: "target",
  42359. protocol: "accessing",
  42360. fn: function (){
  42361. var self=this;
  42362. return self["@target"];
  42363. },
  42364. args: [],
  42365. source: "target\x0a\x09^ target",
  42366. referencedClasses: [],
  42367. messageSends: []
  42368. }),
  42369. $globals.IRAssignmentInliner);
  42370. $core.addMethod(
  42371. $core.method({
  42372. selector: "target:",
  42373. protocol: "accessing",
  42374. fn: function (anObject){
  42375. var self=this;
  42376. self["@target"]=anObject;
  42377. return self;
  42378. },
  42379. args: ["anObject"],
  42380. source: "target: anObject\x0a\x09target := anObject",
  42381. referencedClasses: [],
  42382. messageSends: []
  42383. }),
  42384. $globals.IRAssignmentInliner);
  42385. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  42386. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  42387. $core.addMethod(
  42388. $core.method({
  42389. selector: "inlineClosure:",
  42390. protocol: "inlining",
  42391. fn: function (anIRClosure){
  42392. var self=this;
  42393. var closure,sequence,statements;
  42394. return $core.withContext(function($ctx1) {
  42395. var $1,$2,$3,$5,$4;
  42396. closure=(
  42397. $ctx1.supercall = true,
  42398. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  42399. $ctx1.supercall = false;
  42400. sequence=$recv(closure)._sequence();
  42401. statements=$recv(sequence)._dagChildren();
  42402. $recv(statements)._ifNotEmpty_((function(){
  42403. var final;
  42404. return $core.withContext(function($ctx2) {
  42405. final=$recv(statements)._last();
  42406. final;
  42407. $1=$recv(final)._yieldsValue();
  42408. if($core.assert($1)){
  42409. $2=sequence;
  42410. $3=final;
  42411. $5=$recv($globals.IRReturn)._new();
  42412. $recv($5)._add_($recv(final)._copy());
  42413. $4=$recv($5)._yourself();
  42414. return $recv($2)._replace_with_($3,$4);
  42415. }
  42416. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  42417. }));
  42418. return closure;
  42419. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRReturnInliner)});
  42420. },
  42421. args: ["anIRClosure"],
  42422. 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",
  42423. referencedClasses: ["IRReturn"],
  42424. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  42425. }),
  42426. $globals.IRReturnInliner);
  42427. $core.addMethod(
  42428. $core.method({
  42429. selector: "inlineReturn:",
  42430. protocol: "inlining",
  42431. fn: function (anIRReturn){
  42432. var self=this;
  42433. return $core.withContext(function($ctx1) {
  42434. return self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  42435. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn},$globals.IRReturnInliner)});
  42436. },
  42437. args: ["anIRReturn"],
  42438. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  42439. referencedClasses: [],
  42440. messageSends: ["inlineSend:andReplace:", "expression"]
  42441. }),
  42442. $globals.IRReturnInliner);
  42443. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  42444. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  42445. $core.addMethod(
  42446. $core.method({
  42447. selector: "inliner",
  42448. protocol: "compiling",
  42449. fn: function (){
  42450. var self=this;
  42451. return $core.withContext(function($ctx1) {
  42452. return $recv($globals.IRInliner)._new();
  42453. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  42454. },
  42455. args: [],
  42456. source: "inliner\x0a\x09^ IRInliner new",
  42457. referencedClasses: ["IRInliner"],
  42458. messageSends: ["new"]
  42459. }),
  42460. $globals.InliningCodeGenerator);
  42461. $core.addMethod(
  42462. $core.method({
  42463. selector: "irTranslatorClass",
  42464. protocol: "compiling",
  42465. fn: function (){
  42466. var self=this;
  42467. return $globals.IRInliningJSTranslator;
  42468. },
  42469. args: [],
  42470. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  42471. referencedClasses: ["IRInliningJSTranslator"],
  42472. messageSends: []
  42473. }),
  42474. $globals.InliningCodeGenerator);
  42475. $core.addMethod(
  42476. $core.method({
  42477. selector: "preInliner",
  42478. protocol: "compiling",
  42479. fn: function (){
  42480. var self=this;
  42481. return $core.withContext(function($ctx1) {
  42482. return $recv($globals.ASTPreInliner)._new();
  42483. }, function($ctx1) {$ctx1.fill(self,"preInliner",{},$globals.InliningCodeGenerator)});
  42484. },
  42485. args: [],
  42486. source: "preInliner\x0a\x09^ ASTPreInliner new",
  42487. referencedClasses: ["ASTPreInliner"],
  42488. messageSends: ["new"]
  42489. }),
  42490. $globals.InliningCodeGenerator);
  42491. $core.addMethod(
  42492. $core.method({
  42493. selector: "transformersDictionary",
  42494. protocol: "compiling",
  42495. fn: function (){
  42496. var self=this;
  42497. return $core.withContext(function($ctx1) {
  42498. var $1;
  42499. $1=(
  42500. $ctx1.supercall = true,
  42501. ($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($recv(self), []));
  42502. $ctx1.supercall = false;
  42503. $recv($1)._at_put_("3000-inlinerTagging",self._preInliner());
  42504. $ctx1.sendIdx["at:put:"]=1;
  42505. $recv($1)._at_put_("6000-inliner",self._inliner());
  42506. $ctx1.sendIdx["at:put:"]=2;
  42507. $recv($1)._at_put_("8000-irToJs",self._irTranslator());
  42508. return $recv($1)._yourself();
  42509. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.InliningCodeGenerator)});
  42510. },
  42511. args: [],
  42512. source: "transformersDictionary\x0a\x09^ 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",
  42513. referencedClasses: [],
  42514. messageSends: ["at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  42515. }),
  42516. $globals.InliningCodeGenerator);
  42517. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  42518. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  42519. $core.addClass("InliningSemanticAnalyzer", $globals.SemanticAnalyzer, [], "Compiler-Inlining");
  42520. $core.addMethod(
  42521. $core.method({
  42522. selector: "visitSendNode:",
  42523. protocol: "visiting",
  42524. fn: function (aNode){
  42525. var self=this;
  42526. return $core.withContext(function($ctx1) {
  42527. var $1,$2,$3,$receiver;
  42528. $1=$recv(aNode)._superSend();
  42529. if(!$core.assert($1)){
  42530. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  42531. if($core.assert($2)){
  42532. $recv(aNode)._shouldBeInlined_(true);
  42533. $3=$recv(aNode)._receiver();
  42534. if(($receiver = $3) == null || $receiver.isNil){
  42535. $3;
  42536. } else {
  42537. var receiver;
  42538. receiver=$receiver;
  42539. $recv(receiver)._shouldBeAliased_(true);
  42540. }
  42541. }
  42542. }
  42543. (
  42544. $ctx1.supercall = true,
  42545. ($globals.InliningSemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  42546. $ctx1.supercall = false;
  42547. return self;
  42548. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.InliningSemanticAnalyzer)});
  42549. },
  42550. args: ["aNode"],
  42551. 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",
  42552. referencedClasses: ["IRSendInliner"],
  42553. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  42554. }),
  42555. $globals.InliningSemanticAnalyzer);
  42556. $core.addMethod(
  42557. $core.method({
  42558. selector: "asInlinedBlockResult",
  42559. protocol: "*Compiler-Inlining",
  42560. fn: function (){
  42561. var self=this;
  42562. return $core.withContext(function($ctx1) {
  42563. return self._expression();
  42564. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{},$globals.IRBlockReturn)});
  42565. },
  42566. args: [],
  42567. source: "asInlinedBlockResult\x0a\x09^ self expression",
  42568. referencedClasses: [],
  42569. messageSends: ["expression"]
  42570. }),
  42571. $globals.IRBlockReturn);
  42572. $core.addMethod(
  42573. $core.method({
  42574. selector: "asInlinedBlockResult",
  42575. protocol: "*Compiler-Inlining",
  42576. fn: function (){
  42577. var self=this;
  42578. return self;
  42579. },
  42580. args: [],
  42581. source: "asInlinedBlockResult\x0a\x09^ self",
  42582. referencedClasses: [],
  42583. messageSends: []
  42584. }),
  42585. $globals.IRInstruction);
  42586. });
  42587. 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";
  42588. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  42589. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  42590. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  42591. $core.addPackage("Compiler-Interpreter");
  42592. $core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  42593. $core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  42594. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  42595. $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`).";
  42596. $core.addMethod(
  42597. $core.method({
  42598. selector: "applyTo:arguments:",
  42599. protocol: "evaluating",
  42600. fn: function (anObject,aCollection){
  42601. var self=this;
  42602. return $core.withContext(function($ctx1) {
  42603. self._interpreterError();
  42604. return self;
  42605. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  42606. },
  42607. args: ["anObject", "aCollection"],
  42608. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  42609. referencedClasses: [],
  42610. messageSends: ["interpreterError"]
  42611. }),
  42612. $globals.AIBlockClosure);
  42613. $core.addMethod(
  42614. $core.method({
  42615. selector: "compiledSource",
  42616. protocol: "accessing",
  42617. fn: function (){
  42618. var self=this;
  42619. return "[ AST Block closure ]";
  42620. },
  42621. args: [],
  42622. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  42623. referencedClasses: [],
  42624. messageSends: []
  42625. }),
  42626. $globals.AIBlockClosure);
  42627. $core.addMethod(
  42628. $core.method({
  42629. selector: "currySelf",
  42630. protocol: "converting",
  42631. fn: function (){
  42632. var self=this;
  42633. return $core.withContext(function($ctx1) {
  42634. self._interpreterError();
  42635. return self;
  42636. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  42637. },
  42638. args: [],
  42639. source: "currySelf\x0a\x09self interpreterError",
  42640. referencedClasses: [],
  42641. messageSends: ["interpreterError"]
  42642. }),
  42643. $globals.AIBlockClosure);
  42644. $core.addMethod(
  42645. $core.method({
  42646. selector: "initializeWithContext:node:",
  42647. protocol: "initialization",
  42648. fn: function (aContext,aNode){
  42649. var self=this;
  42650. self["@node"]=aNode;
  42651. self["@outerContext"]=aContext;
  42652. return self;
  42653. },
  42654. args: ["aContext", "aNode"],
  42655. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  42656. referencedClasses: [],
  42657. messageSends: []
  42658. }),
  42659. $globals.AIBlockClosure);
  42660. $core.addMethod(
  42661. $core.method({
  42662. selector: "interpreterError",
  42663. protocol: "error handling",
  42664. fn: function (){
  42665. var self=this;
  42666. return $core.withContext(function($ctx1) {
  42667. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  42668. return self;
  42669. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  42670. },
  42671. args: [],
  42672. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  42673. referencedClasses: ["ASTInterpreterError"],
  42674. messageSends: ["signal:"]
  42675. }),
  42676. $globals.AIBlockClosure);
  42677. $core.addMethod(
  42678. $core.method({
  42679. selector: "numArgs",
  42680. protocol: "accessing",
  42681. fn: function (){
  42682. var self=this;
  42683. return $core.withContext(function($ctx1) {
  42684. return $recv($recv(self["@node"])._temps())._size();
  42685. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  42686. },
  42687. args: [],
  42688. source: "numArgs\x0a\x09^ node temps size",
  42689. referencedClasses: [],
  42690. messageSends: ["size", "temps"]
  42691. }),
  42692. $globals.AIBlockClosure);
  42693. $core.addMethod(
  42694. $core.method({
  42695. selector: "value",
  42696. protocol: "evaluating",
  42697. fn: function (){
  42698. var self=this;
  42699. return $core.withContext(function($ctx1) {
  42700. return self._valueWithPossibleArguments_([]);
  42701. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  42702. },
  42703. args: [],
  42704. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  42705. referencedClasses: [],
  42706. messageSends: ["valueWithPossibleArguments:"]
  42707. }),
  42708. $globals.AIBlockClosure);
  42709. $core.addMethod(
  42710. $core.method({
  42711. selector: "value:",
  42712. protocol: "evaluating",
  42713. fn: function (anArgument){
  42714. var self=this;
  42715. return $core.withContext(function($ctx1) {
  42716. return self._valueWithPossibleArguments_([anArgument]);
  42717. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  42718. },
  42719. args: ["anArgument"],
  42720. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  42721. referencedClasses: [],
  42722. messageSends: ["valueWithPossibleArguments:"]
  42723. }),
  42724. $globals.AIBlockClosure);
  42725. $core.addMethod(
  42726. $core.method({
  42727. selector: "value:value:",
  42728. protocol: "evaluating",
  42729. fn: function (firstArgument,secondArgument){
  42730. var self=this;
  42731. return $core.withContext(function($ctx1) {
  42732. return self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  42733. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  42734. },
  42735. args: ["firstArgument", "secondArgument"],
  42736. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  42737. referencedClasses: [],
  42738. messageSends: ["valueWithPossibleArguments:"]
  42739. }),
  42740. $globals.AIBlockClosure);
  42741. $core.addMethod(
  42742. $core.method({
  42743. selector: "value:value:value:",
  42744. protocol: "evaluating",
  42745. fn: function (firstArgument,secondArgument,thirdArgument){
  42746. var self=this;
  42747. return $core.withContext(function($ctx1) {
  42748. return self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  42749. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  42750. },
  42751. args: ["firstArgument", "secondArgument", "thirdArgument"],
  42752. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  42753. referencedClasses: [],
  42754. messageSends: ["valueWithPossibleArguments:"]
  42755. }),
  42756. $globals.AIBlockClosure);
  42757. $core.addMethod(
  42758. $core.method({
  42759. selector: "valueWithPossibleArguments:",
  42760. protocol: "evaluating",
  42761. fn: function (aCollection){
  42762. var self=this;
  42763. var context,sequenceNode;
  42764. return $core.withContext(function($ctx1) {
  42765. var $1,$2,$3;
  42766. context=$recv(self["@outerContext"])._newInnerContext();
  42767. $1=$recv($recv($recv(self["@node"])._dagChildren())._first())._copy();
  42768. $recv($1)._parent_(nil);
  42769. sequenceNode=$recv($1)._yourself();
  42770. $recv($recv(sequenceNode)._temps())._do_((function(each){
  42771. return $core.withContext(function($ctx2) {
  42772. return $recv(context)._defineLocal_(each);
  42773. $ctx2.sendIdx["defineLocal:"]=1;
  42774. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42775. }));
  42776. $recv($recv(self["@node"])._parameters())._withIndexDo_((function(each,index){
  42777. return $core.withContext(function($ctx2) {
  42778. $recv(context)._defineLocal_(each);
  42779. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  42780. return nil;
  42781. })));
  42782. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  42783. }));
  42784. $2=$recv(context)._interpreter();
  42785. $ctx1.sendIdx["interpreter"]=1;
  42786. $recv($2)._node_(sequenceNode);
  42787. $recv($2)._enterNode();
  42788. $recv($2)._proceed();
  42789. $3=$recv(self["@outerContext"])._interpreter();
  42790. $ctx1.sendIdx["interpreter"]=2;
  42791. $recv($3)._setNonLocalReturnFromContext_(context);
  42792. return $recv($recv(context)._interpreter())._pop();
  42793. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  42794. },
  42795. args: ["aCollection"],
  42796. 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",
  42797. referencedClasses: [],
  42798. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  42799. }),
  42800. $globals.AIBlockClosure);
  42801. $core.addMethod(
  42802. $core.method({
  42803. selector: "forContext:node:",
  42804. protocol: "instance creation",
  42805. fn: function (aContext,aNode){
  42806. var self=this;
  42807. return $core.withContext(function($ctx1) {
  42808. var $1;
  42809. $1=self._new();
  42810. $recv($1)._initializeWithContext_node_(aContext,aNode);
  42811. return $recv($1)._yourself();
  42812. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.klass)});
  42813. },
  42814. args: ["aContext", "aNode"],
  42815. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  42816. referencedClasses: [],
  42817. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  42818. }),
  42819. $globals.AIBlockClosure.klass);
  42820. $core.addClass("AIContext", $globals.MethodContext, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  42821. $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)";
  42822. $core.addMethod(
  42823. $core.method({
  42824. selector: "arguments",
  42825. protocol: "interpreting",
  42826. fn: function (){
  42827. var self=this;
  42828. return $core.withContext(function($ctx1) {
  42829. return $recv($recv(self._ast())._arguments())._collect_((function(each){
  42830. return $core.withContext(function($ctx2) {
  42831. return self._localAt_ifAbsent_(each,(function(){
  42832. return $core.withContext(function($ctx3) {
  42833. return self._error_("Argument not in context");
  42834. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42835. }));
  42836. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42837. }));
  42838. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  42839. },
  42840. args: [],
  42841. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  42842. referencedClasses: [],
  42843. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  42844. }),
  42845. $globals.AIContext);
  42846. $core.addMethod(
  42847. $core.method({
  42848. selector: "ast",
  42849. protocol: "interpreting",
  42850. fn: function (){
  42851. var self=this;
  42852. return $core.withContext(function($ctx1) {
  42853. var $1,$2,$3,$receiver;
  42854. $1=self._isBlockContext();
  42855. if($core.assert($1)){
  42856. $2=self._outerContext();
  42857. if(($receiver = $2) == null || $receiver.isNil){
  42858. return $2;
  42859. } else {
  42860. var context;
  42861. context=$receiver;
  42862. return $recv(context)._ast();
  42863. }
  42864. }
  42865. $3=self["@ast"];
  42866. if(($receiver = $3) == null || $receiver.isNil){
  42867. self._initializeAST();
  42868. } else {
  42869. $3;
  42870. }
  42871. return self["@ast"];
  42872. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  42873. },
  42874. args: [],
  42875. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  42876. referencedClasses: [],
  42877. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  42878. }),
  42879. $globals.AIContext);
  42880. $core.addMethod(
  42881. $core.method({
  42882. selector: "basicLocalAt:",
  42883. protocol: "private",
  42884. fn: function (aString){
  42885. var self=this;
  42886. return $core.withContext(function($ctx1) {
  42887. return $recv(self._locals())._at_(aString);
  42888. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  42889. },
  42890. args: ["aString"],
  42891. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  42892. referencedClasses: [],
  42893. messageSends: ["at:", "locals"]
  42894. }),
  42895. $globals.AIContext);
  42896. $core.addMethod(
  42897. $core.method({
  42898. selector: "basicLocalAt:put:",
  42899. protocol: "private",
  42900. fn: function (aString,anObject){
  42901. var self=this;
  42902. return $core.withContext(function($ctx1) {
  42903. $recv(self._locals())._at_put_(aString,anObject);
  42904. return self;
  42905. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  42906. },
  42907. args: ["aString", "anObject"],
  42908. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  42909. referencedClasses: [],
  42910. messageSends: ["at:put:", "locals"]
  42911. }),
  42912. $globals.AIContext);
  42913. $core.addMethod(
  42914. $core.method({
  42915. selector: "basicReceiver",
  42916. protocol: "interpreting",
  42917. fn: function (){
  42918. var self=this;
  42919. return $core.withContext(function($ctx1) {
  42920. return self._localAt_("self");
  42921. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  42922. },
  42923. args: [],
  42924. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  42925. referencedClasses: [],
  42926. messageSends: ["localAt:"]
  42927. }),
  42928. $globals.AIContext);
  42929. $core.addMethod(
  42930. $core.method({
  42931. selector: "defineLocal:",
  42932. protocol: "accessing",
  42933. fn: function (aString){
  42934. var self=this;
  42935. return $core.withContext(function($ctx1) {
  42936. $recv(self._locals())._at_put_(aString,nil);
  42937. return self;
  42938. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  42939. },
  42940. args: ["aString"],
  42941. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  42942. referencedClasses: [],
  42943. messageSends: ["at:put:", "locals"]
  42944. }),
  42945. $globals.AIContext);
  42946. $core.addMethod(
  42947. $core.method({
  42948. selector: "evaluate:on:",
  42949. protocol: "evaluating",
  42950. fn: function (aString,anEvaluator){
  42951. var self=this;
  42952. return $core.withContext(function($ctx1) {
  42953. return $recv(anEvaluator)._evaluate_context_(aString,self);
  42954. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  42955. },
  42956. args: ["aString", "anEvaluator"],
  42957. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  42958. referencedClasses: [],
  42959. messageSends: ["evaluate:context:"]
  42960. }),
  42961. $globals.AIContext);
  42962. $core.addMethod(
  42963. $core.method({
  42964. selector: "evaluateNode:",
  42965. protocol: "evaluating",
  42966. fn: function (aNode){
  42967. var self=this;
  42968. return $core.withContext(function($ctx1) {
  42969. var $1;
  42970. $1=$recv($globals.ASTInterpreter)._new();
  42971. $recv($1)._context_(self);
  42972. $recv($1)._node_(aNode);
  42973. $recv($1)._enterNode();
  42974. $recv($1)._proceed();
  42975. return $recv($1)._result();
  42976. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  42977. },
  42978. args: ["aNode"],
  42979. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  42980. referencedClasses: ["ASTInterpreter"],
  42981. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  42982. }),
  42983. $globals.AIContext);
  42984. $core.addMethod(
  42985. $core.method({
  42986. selector: "evaluatedSelector",
  42987. protocol: "accessing",
  42988. fn: function (){
  42989. var self=this;
  42990. return self["@evaluatedSelector"];
  42991. },
  42992. args: [],
  42993. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  42994. referencedClasses: [],
  42995. messageSends: []
  42996. }),
  42997. $globals.AIContext);
  42998. $core.addMethod(
  42999. $core.method({
  43000. selector: "evaluatedSelector:",
  43001. protocol: "accessing",
  43002. fn: function (aString){
  43003. var self=this;
  43004. self["@evaluatedSelector"]=aString;
  43005. return self;
  43006. },
  43007. args: ["aString"],
  43008. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  43009. referencedClasses: [],
  43010. messageSends: []
  43011. }),
  43012. $globals.AIContext);
  43013. $core.addMethod(
  43014. $core.method({
  43015. selector: "index",
  43016. protocol: "accessing",
  43017. fn: function (){
  43018. var self=this;
  43019. return $core.withContext(function($ctx1) {
  43020. var $1,$receiver;
  43021. $1=self["@index"];
  43022. if(($receiver = $1) == null || $receiver.isNil){
  43023. return (0);
  43024. } else {
  43025. return $1;
  43026. }
  43027. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  43028. },
  43029. args: [],
  43030. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  43031. referencedClasses: [],
  43032. messageSends: ["ifNil:"]
  43033. }),
  43034. $globals.AIContext);
  43035. $core.addMethod(
  43036. $core.method({
  43037. selector: "index:",
  43038. protocol: "accessing",
  43039. fn: function (anInteger){
  43040. var self=this;
  43041. self["@index"]=anInteger;
  43042. return self;
  43043. },
  43044. args: ["anInteger"],
  43045. source: "index: anInteger\x0a\x09index := anInteger",
  43046. referencedClasses: [],
  43047. messageSends: []
  43048. }),
  43049. $globals.AIContext);
  43050. $core.addMethod(
  43051. $core.method({
  43052. selector: "initializeAST",
  43053. protocol: "initialization",
  43054. fn: function (){
  43055. var self=this;
  43056. return $core.withContext(function($ctx1) {
  43057. var $1;
  43058. $1=self._method();
  43059. $ctx1.sendIdx["method"]=1;
  43060. self["@ast"]=$recv($1)._ast();
  43061. $recv($recv($globals.SemanticAnalyzer)._on_($recv(self._method())._methodClass()))._visit_(self["@ast"]);
  43062. return self;
  43063. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  43064. },
  43065. args: [],
  43066. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  43067. referencedClasses: ["SemanticAnalyzer"],
  43068. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  43069. }),
  43070. $globals.AIContext);
  43071. $core.addMethod(
  43072. $core.method({
  43073. selector: "initializeFromMethodContext:",
  43074. protocol: "initialization",
  43075. fn: function (aMethodContext){
  43076. var self=this;
  43077. return $core.withContext(function($ctx1) {
  43078. var $1,$2,$3,$receiver;
  43079. self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  43080. self._index_($recv(aMethodContext)._index());
  43081. self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  43082. self._receiver_($recv(aMethodContext)._receiver());
  43083. self._supercall_($recv(aMethodContext)._supercall());
  43084. self._selector_($recv(aMethodContext)._selector());
  43085. $1=$recv(aMethodContext)._outerContext();
  43086. $ctx1.sendIdx["outerContext"]=1;
  43087. if(($receiver = $1) == null || $receiver.isNil){
  43088. $1;
  43089. } else {
  43090. var outer;
  43091. outer=$receiver;
  43092. $2=$recv(outer)._methodContext();
  43093. if(($receiver = $2) == null || $receiver.isNil){
  43094. $2;
  43095. } else {
  43096. self._outerContext_($recv(self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  43097. }
  43098. $3=$recv(aMethodContext)._locals();
  43099. $ctx1.sendIdx["locals"]=1;
  43100. $recv($3)._keysAndValuesDo_((function(key,value){
  43101. return $core.withContext(function($ctx2) {
  43102. return $recv(self._locals())._at_put_(key,value);
  43103. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  43104. }));
  43105. }
  43106. return self;
  43107. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  43108. },
  43109. args: ["aMethodContext"],
  43110. 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 ] ]",
  43111. referencedClasses: [],
  43112. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  43113. }),
  43114. $globals.AIContext);
  43115. $core.addMethod(
  43116. $core.method({
  43117. selector: "initializeInterpreter",
  43118. protocol: "initialization",
  43119. fn: function (){
  43120. var self=this;
  43121. return $core.withContext(function($ctx1) {
  43122. var $1,$2,$receiver;
  43123. $1=$recv($globals.ASTInterpreter)._new();
  43124. $recv($1)._context_(self);
  43125. self["@interpreter"]=$recv($1)._yourself();
  43126. $2=self._innerContext();
  43127. if(($receiver = $2) == null || $receiver.isNil){
  43128. $2;
  43129. } else {
  43130. self._setupInterpreter_(self["@interpreter"]);
  43131. }
  43132. return self;
  43133. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  43134. },
  43135. args: [],
  43136. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  43137. referencedClasses: ["ASTInterpreter"],
  43138. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  43139. }),
  43140. $globals.AIContext);
  43141. $core.addMethod(
  43142. $core.method({
  43143. selector: "initializeLocals",
  43144. protocol: "initialization",
  43145. fn: function (){
  43146. var self=this;
  43147. return $core.withContext(function($ctx1) {
  43148. self["@locals"]=$recv($globals.Dictionary)._new();
  43149. $recv(self["@locals"])._at_put_("thisContext",self);
  43150. return self;
  43151. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  43152. },
  43153. args: [],
  43154. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  43155. referencedClasses: ["Dictionary"],
  43156. messageSends: ["new", "at:put:"]
  43157. }),
  43158. $globals.AIContext);
  43159. $core.addMethod(
  43160. $core.method({
  43161. selector: "innerContext",
  43162. protocol: "accessing",
  43163. fn: function (){
  43164. var self=this;
  43165. return self["@innerContext"];
  43166. },
  43167. args: [],
  43168. source: "innerContext\x0a\x09^ innerContext",
  43169. referencedClasses: [],
  43170. messageSends: []
  43171. }),
  43172. $globals.AIContext);
  43173. $core.addMethod(
  43174. $core.method({
  43175. selector: "innerContext:",
  43176. protocol: "accessing",
  43177. fn: function (anAIContext){
  43178. var self=this;
  43179. self["@innerContext"]=anAIContext;
  43180. return self;
  43181. },
  43182. args: ["anAIContext"],
  43183. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  43184. referencedClasses: [],
  43185. messageSends: []
  43186. }),
  43187. $globals.AIContext);
  43188. $core.addMethod(
  43189. $core.method({
  43190. selector: "interpreter",
  43191. protocol: "interpreting",
  43192. fn: function (){
  43193. var self=this;
  43194. return $core.withContext(function($ctx1) {
  43195. var $1,$receiver;
  43196. $1=self["@interpreter"];
  43197. if(($receiver = $1) == null || $receiver.isNil){
  43198. self._initializeInterpreter();
  43199. } else {
  43200. $1;
  43201. }
  43202. return self["@interpreter"];
  43203. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  43204. },
  43205. args: [],
  43206. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  43207. referencedClasses: [],
  43208. messageSends: ["ifNil:", "initializeInterpreter"]
  43209. }),
  43210. $globals.AIContext);
  43211. $core.addMethod(
  43212. $core.method({
  43213. selector: "interpreter:",
  43214. protocol: "interpreting",
  43215. fn: function (anInterpreter){
  43216. var self=this;
  43217. self["@interpreter"]=anInterpreter;
  43218. return self;
  43219. },
  43220. args: ["anInterpreter"],
  43221. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  43222. referencedClasses: [],
  43223. messageSends: []
  43224. }),
  43225. $globals.AIContext);
  43226. $core.addMethod(
  43227. $core.method({
  43228. selector: "isTopContext",
  43229. protocol: "testing",
  43230. fn: function (){
  43231. var self=this;
  43232. return $core.withContext(function($ctx1) {
  43233. return $recv(self._innerContext())._isNil();
  43234. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  43235. },
  43236. args: [],
  43237. source: "isTopContext\x0a\x09^ self innerContext isNil",
  43238. referencedClasses: [],
  43239. messageSends: ["isNil", "innerContext"]
  43240. }),
  43241. $globals.AIContext);
  43242. $core.addMethod(
  43243. $core.method({
  43244. selector: "localAt:",
  43245. protocol: "accessing",
  43246. fn: function (aString){
  43247. var self=this;
  43248. var context;
  43249. return $core.withContext(function($ctx1) {
  43250. context=self._lookupContextForLocal_(aString);
  43251. return $recv(context)._basicLocalAt_(aString);
  43252. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  43253. },
  43254. args: ["aString"],
  43255. 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",
  43256. referencedClasses: [],
  43257. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  43258. }),
  43259. $globals.AIContext);
  43260. $core.addMethod(
  43261. $core.method({
  43262. selector: "localAt:ifAbsent:",
  43263. protocol: "accessing",
  43264. fn: function (aString,aBlock){
  43265. var self=this;
  43266. var context;
  43267. return $core.withContext(function($ctx1) {
  43268. var $early={};
  43269. try {
  43270. context=self._lookupContextForLocal_ifNone_(aString,(function(){
  43271. return $core.withContext(function($ctx2) {
  43272. throw $early=[$recv(aBlock)._value()];
  43273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43274. }));
  43275. return $recv(context)._basicLocalAt_(aString);
  43276. }
  43277. catch(e) {if(e===$early)return e[0]; throw e}
  43278. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  43279. },
  43280. args: ["aString", "aBlock"],
  43281. 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",
  43282. referencedClasses: [],
  43283. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  43284. }),
  43285. $globals.AIContext);
  43286. $core.addMethod(
  43287. $core.method({
  43288. selector: "localAt:put:",
  43289. protocol: "accessing",
  43290. fn: function (aString,anObject){
  43291. var self=this;
  43292. var context;
  43293. return $core.withContext(function($ctx1) {
  43294. context=self._lookupContextForLocal_(aString);
  43295. $recv(context)._basicLocalAt_put_(aString,anObject);
  43296. return self;
  43297. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  43298. },
  43299. args: ["aString", "anObject"],
  43300. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  43301. referencedClasses: [],
  43302. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  43303. }),
  43304. $globals.AIContext);
  43305. $core.addMethod(
  43306. $core.method({
  43307. selector: "locals",
  43308. protocol: "accessing",
  43309. fn: function (){
  43310. var self=this;
  43311. return $core.withContext(function($ctx1) {
  43312. var $1,$receiver;
  43313. $1=self["@locals"];
  43314. if(($receiver = $1) == null || $receiver.isNil){
  43315. self._initializeLocals();
  43316. } else {
  43317. $1;
  43318. }
  43319. return self["@locals"];
  43320. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  43321. },
  43322. args: [],
  43323. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  43324. referencedClasses: [],
  43325. messageSends: ["ifNil:", "initializeLocals"]
  43326. }),
  43327. $globals.AIContext);
  43328. $core.addMethod(
  43329. $core.method({
  43330. selector: "lookupContextForLocal:",
  43331. protocol: "private",
  43332. fn: function (aString){
  43333. var self=this;
  43334. return $core.withContext(function($ctx1) {
  43335. return self._lookupContextForLocal_ifNone_(aString,(function(){
  43336. return $core.withContext(function($ctx2) {
  43337. return self._variableNotFound();
  43338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43339. }));
  43340. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  43341. },
  43342. args: ["aString"],
  43343. 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 ]",
  43344. referencedClasses: [],
  43345. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  43346. }),
  43347. $globals.AIContext);
  43348. $core.addMethod(
  43349. $core.method({
  43350. selector: "lookupContextForLocal:ifNone:",
  43351. protocol: "private",
  43352. fn: function (aString,aBlock){
  43353. var self=this;
  43354. return $core.withContext(function($ctx1) {
  43355. var $1;
  43356. return $recv(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  43357. return self;
  43358. }),(function(){
  43359. return $core.withContext(function($ctx2) {
  43360. $1=self._outerContext();
  43361. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  43362. return $core.withContext(function($ctx3) {
  43363. return $recv(context)._lookupContextForLocal_(aString);
  43364. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  43365. }));
  43366. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43367. }));
  43368. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  43369. },
  43370. args: ["aString", "aBlock"],
  43371. 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 ] ]",
  43372. referencedClasses: [],
  43373. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  43374. }),
  43375. $globals.AIContext);
  43376. $core.addMethod(
  43377. $core.method({
  43378. selector: "newInnerContext",
  43379. protocol: "factory",
  43380. fn: function (){
  43381. var self=this;
  43382. return $core.withContext(function($ctx1) {
  43383. var $1;
  43384. $1=$recv(self._class())._new();
  43385. $recv($1)._outerContext_(self);
  43386. return $recv($1)._yourself();
  43387. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  43388. },
  43389. args: [],
  43390. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  43391. referencedClasses: [],
  43392. messageSends: ["outerContext:", "new", "class", "yourself"]
  43393. }),
  43394. $globals.AIContext);
  43395. $core.addMethod(
  43396. $core.method({
  43397. selector: "outerContext",
  43398. protocol: "accessing",
  43399. fn: function (){
  43400. var self=this;
  43401. return self["@outerContext"];
  43402. },
  43403. args: [],
  43404. source: "outerContext\x0a\x09^ outerContext",
  43405. referencedClasses: [],
  43406. messageSends: []
  43407. }),
  43408. $globals.AIContext);
  43409. $core.addMethod(
  43410. $core.method({
  43411. selector: "outerContext:",
  43412. protocol: "accessing",
  43413. fn: function (anAIContext){
  43414. var self=this;
  43415. return $core.withContext(function($ctx1) {
  43416. var $1,$receiver;
  43417. self["@outerContext"]=anAIContext;
  43418. $1=self["@outerContext"];
  43419. if(($receiver = $1) == null || $receiver.isNil){
  43420. $1;
  43421. } else {
  43422. var context;
  43423. context=$receiver;
  43424. $recv(context)._innerContext_(self);
  43425. }
  43426. return self;
  43427. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  43428. },
  43429. args: ["anAIContext"],
  43430. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  43431. referencedClasses: [],
  43432. messageSends: ["ifNotNil:", "innerContext:"]
  43433. }),
  43434. $globals.AIContext);
  43435. $core.addMethod(
  43436. $core.method({
  43437. selector: "receiver:",
  43438. protocol: "interpreting",
  43439. fn: function (anObject){
  43440. var self=this;
  43441. return $core.withContext(function($ctx1) {
  43442. $recv(self._locals())._at_put_("self",anObject);
  43443. return self;
  43444. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  43445. },
  43446. args: ["anObject"],
  43447. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  43448. referencedClasses: [],
  43449. messageSends: ["at:put:", "locals"]
  43450. }),
  43451. $globals.AIContext);
  43452. $core.addMethod(
  43453. $core.method({
  43454. selector: "selector",
  43455. protocol: "accessing",
  43456. fn: function (){
  43457. var self=this;
  43458. return self["@selector"];
  43459. },
  43460. args: [],
  43461. source: "selector\x0a\x09^ selector",
  43462. referencedClasses: [],
  43463. messageSends: []
  43464. }),
  43465. $globals.AIContext);
  43466. $core.addMethod(
  43467. $core.method({
  43468. selector: "selector:",
  43469. protocol: "accessing",
  43470. fn: function (aString){
  43471. var self=this;
  43472. self["@selector"]=aString;
  43473. return self;
  43474. },
  43475. args: ["aString"],
  43476. source: "selector: aString\x0a\x09selector := aString",
  43477. referencedClasses: [],
  43478. messageSends: []
  43479. }),
  43480. $globals.AIContext);
  43481. $core.addMethod(
  43482. $core.method({
  43483. selector: "sendIndexAt:",
  43484. protocol: "accessing",
  43485. fn: function (aString){
  43486. var self=this;
  43487. return $core.withContext(function($ctx1) {
  43488. return $recv(self._sendIndexes())._at_ifAbsent_(aString,(function(){
  43489. return (0);
  43490. }));
  43491. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  43492. },
  43493. args: ["aString"],
  43494. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  43495. referencedClasses: [],
  43496. messageSends: ["at:ifAbsent:", "sendIndexes"]
  43497. }),
  43498. $globals.AIContext);
  43499. $core.addMethod(
  43500. $core.method({
  43501. selector: "sendIndexes",
  43502. protocol: "accessing",
  43503. fn: function (){
  43504. var self=this;
  43505. return $core.withContext(function($ctx1) {
  43506. var $1,$receiver;
  43507. $1=self["@sendIndexes"];
  43508. if(($receiver = $1) == null || $receiver.isNil){
  43509. return $recv($globals.Dictionary)._new();
  43510. } else {
  43511. return $1;
  43512. }
  43513. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  43514. },
  43515. args: [],
  43516. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  43517. referencedClasses: ["Dictionary"],
  43518. messageSends: ["ifNil:", "new"]
  43519. }),
  43520. $globals.AIContext);
  43521. $core.addMethod(
  43522. $core.method({
  43523. selector: "sendIndexes:",
  43524. protocol: "accessing",
  43525. fn: function (aDictionary){
  43526. var self=this;
  43527. self["@sendIndexes"]=aDictionary;
  43528. return self;
  43529. },
  43530. args: ["aDictionary"],
  43531. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  43532. referencedClasses: [],
  43533. messageSends: []
  43534. }),
  43535. $globals.AIContext);
  43536. $core.addMethod(
  43537. $core.method({
  43538. selector: "setupInterpreter:",
  43539. protocol: "interpreting",
  43540. fn: function (anInterpreter){
  43541. var self=this;
  43542. var currentNode;
  43543. return $core.withContext(function($ctx1) {
  43544. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  43545. $1=$recv($globals.ASTPCNodeVisitor)._new();
  43546. $2=self._evaluatedSelector();
  43547. $ctx1.sendIdx["evaluatedSelector"]=1;
  43548. $recv($1)._selector_($2);
  43549. $recv($1)._index_(self._sendIndexAt_(self._evaluatedSelector()));
  43550. $3=self._ast();
  43551. $ctx1.sendIdx["ast"]=1;
  43552. $recv($1)._visit_($3);
  43553. currentNode=$recv($1)._currentNode();
  43554. $4=$recv(self._ast())._sequenceNode();
  43555. if(($receiver = $4) == null || $receiver.isNil){
  43556. $4;
  43557. } else {
  43558. var sequence;
  43559. sequence=$receiver;
  43560. $recv($recv(sequence)._temps())._do_((function(each){
  43561. return $core.withContext(function($ctx2) {
  43562. return self._defineLocal_(each);
  43563. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43564. }));
  43565. $ctx1.sendIdx["do:"]=1;
  43566. }
  43567. $recv(anInterpreter)._node_(currentNode);
  43568. $7=self._innerContext();
  43569. $ctx1.sendIdx["innerContext"]=1;
  43570. $6=$recv($7)._arguments();
  43571. $5=$recv($6)._reversed();
  43572. $recv($5)._do_((function(each){
  43573. return $core.withContext(function($ctx2) {
  43574. return $recv(anInterpreter)._push_(each);
  43575. $ctx2.sendIdx["push:"]=1;
  43576. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  43577. }));
  43578. $recv(anInterpreter)._push_($recv(self._innerContext())._receiver());
  43579. return self;
  43580. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  43581. },
  43582. args: ["anInterpreter"],
  43583. 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)",
  43584. referencedClasses: ["ASTPCNodeVisitor"],
  43585. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  43586. }),
  43587. $globals.AIContext);
  43588. $core.addMethod(
  43589. $core.method({
  43590. selector: "supercall",
  43591. protocol: "interpreting",
  43592. fn: function (){
  43593. var self=this;
  43594. return $core.withContext(function($ctx1) {
  43595. var $1,$receiver;
  43596. $1=self["@supercall"];
  43597. if(($receiver = $1) == null || $receiver.isNil){
  43598. return false;
  43599. } else {
  43600. return $1;
  43601. }
  43602. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  43603. },
  43604. args: [],
  43605. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  43606. referencedClasses: [],
  43607. messageSends: ["ifNil:"]
  43608. }),
  43609. $globals.AIContext);
  43610. $core.addMethod(
  43611. $core.method({
  43612. selector: "supercall:",
  43613. protocol: "interpreting",
  43614. fn: function (aBoolean){
  43615. var self=this;
  43616. self["@supercall"]=aBoolean;
  43617. return self;
  43618. },
  43619. args: ["aBoolean"],
  43620. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  43621. referencedClasses: [],
  43622. messageSends: []
  43623. }),
  43624. $globals.AIContext);
  43625. $core.addMethod(
  43626. $core.method({
  43627. selector: "variableNotFound",
  43628. protocol: "error handling",
  43629. fn: function (){
  43630. var self=this;
  43631. return $core.withContext(function($ctx1) {
  43632. self._error_("Variable missing");
  43633. return self;
  43634. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  43635. },
  43636. args: [],
  43637. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  43638. referencedClasses: [],
  43639. messageSends: ["error:"]
  43640. }),
  43641. $globals.AIContext);
  43642. $core.addMethod(
  43643. $core.method({
  43644. selector: "fromMethodContext:",
  43645. protocol: "instance creation",
  43646. fn: function (aMethodContext){
  43647. var self=this;
  43648. return $core.withContext(function($ctx1) {
  43649. var $1;
  43650. $1=self._new();
  43651. $recv($1)._initializeFromMethodContext_(aMethodContext);
  43652. return $recv($1)._yourself();
  43653. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.klass)});
  43654. },
  43655. args: ["aMethodContext"],
  43656. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  43657. referencedClasses: [],
  43658. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  43659. }),
  43660. $globals.AIContext.klass);
  43661. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  43662. $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.";
  43663. $core.addMethod(
  43664. $core.method({
  43665. selector: "context",
  43666. protocol: "accessing",
  43667. fn: function (){
  43668. var self=this;
  43669. return self["@context"];
  43670. },
  43671. args: [],
  43672. source: "context\x0a\x09^ context",
  43673. referencedClasses: [],
  43674. messageSends: []
  43675. }),
  43676. $globals.AISemanticAnalyzer);
  43677. $core.addMethod(
  43678. $core.method({
  43679. selector: "context:",
  43680. protocol: "accessing",
  43681. fn: function (anAIContext){
  43682. var self=this;
  43683. self["@context"]=anAIContext;
  43684. return self;
  43685. },
  43686. args: ["anAIContext"],
  43687. source: "context: anAIContext\x0a\x09context := anAIContext",
  43688. referencedClasses: [],
  43689. messageSends: []
  43690. }),
  43691. $globals.AISemanticAnalyzer);
  43692. $core.addMethod(
  43693. $core.method({
  43694. selector: "visitVariableNode:",
  43695. protocol: "visiting",
  43696. fn: function (aNode){
  43697. var self=this;
  43698. return $core.withContext(function($ctx1) {
  43699. var $1;
  43700. var $early={};
  43701. try {
  43702. $recv(self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  43703. return $core.withContext(function($ctx2) {
  43704. $1=(
  43705. $ctx2.supercall = true,
  43706. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($recv(self), [aNode]));
  43707. $ctx2.supercall = false;
  43708. throw $early=[$1];
  43709. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43710. }));
  43711. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  43712. return self;
  43713. }
  43714. catch(e) {if(e===$early)return e[0]; throw e}
  43715. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  43716. },
  43717. args: ["aNode"],
  43718. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  43719. referencedClasses: ["ASTContextVar"],
  43720. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  43721. }),
  43722. $globals.AISemanticAnalyzer);
  43723. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  43724. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  43725. $core.addMethod(
  43726. $core.method({
  43727. selector: "context",
  43728. protocol: "accessing",
  43729. fn: function (){
  43730. var self=this;
  43731. return self["@context"];
  43732. },
  43733. args: [],
  43734. source: "context\x0a\x09^ context",
  43735. referencedClasses: [],
  43736. messageSends: []
  43737. }),
  43738. $globals.ASTContextVar);
  43739. $core.addMethod(
  43740. $core.method({
  43741. selector: "context:",
  43742. protocol: "accessing",
  43743. fn: function (anObject){
  43744. var self=this;
  43745. self["@context"]=anObject;
  43746. return self;
  43747. },
  43748. args: ["anObject"],
  43749. source: "context: anObject\x0a\x09context := anObject",
  43750. referencedClasses: [],
  43751. messageSends: []
  43752. }),
  43753. $globals.ASTContextVar);
  43754. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  43755. $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.";
  43756. $core.addMethod(
  43757. $core.method({
  43758. selector: "atEnd",
  43759. protocol: "testing",
  43760. fn: function (){
  43761. var self=this;
  43762. return $core.withContext(function($ctx1) {
  43763. var $1,$receiver;
  43764. $1=self._context();
  43765. $ctx1.sendIdx["context"]=1;
  43766. if(($receiver = $1) == null || $receiver.isNil){
  43767. return true;
  43768. } else {
  43769. $1;
  43770. }
  43771. return $recv($recv(self._interpreter())._atEnd())._and_((function(){
  43772. return $core.withContext(function($ctx2) {
  43773. return $recv(self._context())._isTopContext();
  43774. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43775. }));
  43776. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  43777. },
  43778. args: [],
  43779. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  43780. referencedClasses: [],
  43781. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  43782. }),
  43783. $globals.ASTDebugger);
  43784. $core.addMethod(
  43785. $core.method({
  43786. selector: "context",
  43787. protocol: "accessing",
  43788. fn: function (){
  43789. var self=this;
  43790. return self["@context"];
  43791. },
  43792. args: [],
  43793. source: "context\x0a\x09^ context",
  43794. referencedClasses: [],
  43795. messageSends: []
  43796. }),
  43797. $globals.ASTDebugger);
  43798. $core.addMethod(
  43799. $core.method({
  43800. selector: "context:",
  43801. protocol: "accessing",
  43802. fn: function (aContext){
  43803. var self=this;
  43804. self["@context"]=aContext;
  43805. return self;
  43806. },
  43807. args: ["aContext"],
  43808. source: "context: aContext\x0a\x09context := aContext",
  43809. referencedClasses: [],
  43810. messageSends: []
  43811. }),
  43812. $globals.ASTDebugger);
  43813. $core.addMethod(
  43814. $core.method({
  43815. selector: "flushInnerContexts",
  43816. protocol: "actions",
  43817. fn: function (){
  43818. var self=this;
  43819. return $core.withContext(function($ctx1) {
  43820. var $1,$receiver;
  43821. $1=self._context();
  43822. if(($receiver = $1) == null || $receiver.isNil){
  43823. $1;
  43824. } else {
  43825. var cxt;
  43826. cxt=$receiver;
  43827. $recv(cxt)._innerContext_(nil);
  43828. }
  43829. return self;
  43830. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  43831. },
  43832. args: [],
  43833. 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 ]",
  43834. referencedClasses: [],
  43835. messageSends: ["ifNotNil:", "context", "innerContext:"]
  43836. }),
  43837. $globals.ASTDebugger);
  43838. $core.addMethod(
  43839. $core.method({
  43840. selector: "interpreter",
  43841. protocol: "accessing",
  43842. fn: function (){
  43843. var self=this;
  43844. return $core.withContext(function($ctx1) {
  43845. var $1,$receiver;
  43846. $1=self._context();
  43847. if(($receiver = $1) == null || $receiver.isNil){
  43848. return $1;
  43849. } else {
  43850. var ctx;
  43851. ctx=$receiver;
  43852. return $recv(ctx)._interpreter();
  43853. }
  43854. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  43855. },
  43856. args: [],
  43857. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  43858. referencedClasses: [],
  43859. messageSends: ["ifNotNil:", "context", "interpreter"]
  43860. }),
  43861. $globals.ASTDebugger);
  43862. $core.addMethod(
  43863. $core.method({
  43864. selector: "method",
  43865. protocol: "accessing",
  43866. fn: function (){
  43867. var self=this;
  43868. return $core.withContext(function($ctx1) {
  43869. return $recv(self._context())._method();
  43870. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  43871. },
  43872. args: [],
  43873. source: "method\x0a\x09^ self context method",
  43874. referencedClasses: [],
  43875. messageSends: ["method", "context"]
  43876. }),
  43877. $globals.ASTDebugger);
  43878. $core.addMethod(
  43879. $core.method({
  43880. selector: "node",
  43881. protocol: "accessing",
  43882. fn: function (){
  43883. var self=this;
  43884. return $core.withContext(function($ctx1) {
  43885. var $1,$receiver;
  43886. $1=self._interpreter();
  43887. $ctx1.sendIdx["interpreter"]=1;
  43888. if(($receiver = $1) == null || $receiver.isNil){
  43889. return $1;
  43890. } else {
  43891. return $recv(self._interpreter())._node();
  43892. }
  43893. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  43894. },
  43895. args: [],
  43896. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  43897. referencedClasses: [],
  43898. messageSends: ["ifNotNil:", "interpreter", "node"]
  43899. }),
  43900. $globals.ASTDebugger);
  43901. $core.addMethod(
  43902. $core.method({
  43903. selector: "onStep",
  43904. protocol: "private",
  43905. fn: function (){
  43906. var self=this;
  43907. return $core.withContext(function($ctx1) {
  43908. var $1,$3,$2,$4,$6,$5,$receiver;
  43909. $1=self._interpreter();
  43910. $ctx1.sendIdx["interpreter"]=1;
  43911. self["@result"]=$recv($1)._result();
  43912. $3=self._interpreter();
  43913. $ctx1.sendIdx["interpreter"]=2;
  43914. $2=$recv($3)._atEnd();
  43915. $ctx1.sendIdx["atEnd"]=1;
  43916. if($core.assert($2)){
  43917. $4=$recv(self._context())._outerContext();
  43918. if(($receiver = $4) == null || $receiver.isNil){
  43919. $4;
  43920. } else {
  43921. var outerContext;
  43922. outerContext=$receiver;
  43923. self._context_(outerContext);
  43924. }
  43925. $6=self._interpreter();
  43926. $ctx1.sendIdx["interpreter"]=3;
  43927. $5=$recv($6)._atEnd();
  43928. if(!$core.assert($5)){
  43929. $recv(self._interpreter())._skip();
  43930. }
  43931. }
  43932. self._flushInnerContexts();
  43933. return self;
  43934. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  43935. },
  43936. args: [],
  43937. 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",
  43938. referencedClasses: [],
  43939. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  43940. }),
  43941. $globals.ASTDebugger);
  43942. $core.addMethod(
  43943. $core.method({
  43944. selector: "proceed",
  43945. protocol: "stepping",
  43946. fn: function (){
  43947. var self=this;
  43948. return $core.withContext(function($ctx1) {
  43949. $recv((function(){
  43950. return $core.withContext(function($ctx2) {
  43951. return self._atEnd();
  43952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43953. }))._whileFalse_((function(){
  43954. return $core.withContext(function($ctx2) {
  43955. return self._stepOver();
  43956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43957. }));
  43958. return self;
  43959. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  43960. },
  43961. args: [],
  43962. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  43963. referencedClasses: [],
  43964. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  43965. }),
  43966. $globals.ASTDebugger);
  43967. $core.addMethod(
  43968. $core.method({
  43969. selector: "restart",
  43970. protocol: "stepping",
  43971. fn: function (){
  43972. var self=this;
  43973. return $core.withContext(function($ctx1) {
  43974. $recv(self._interpreter())._restart();
  43975. self._flushInnerContexts();
  43976. return self;
  43977. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  43978. },
  43979. args: [],
  43980. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  43981. referencedClasses: [],
  43982. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  43983. }),
  43984. $globals.ASTDebugger);
  43985. $core.addMethod(
  43986. $core.method({
  43987. selector: "result",
  43988. protocol: "accessing",
  43989. fn: function (){
  43990. var self=this;
  43991. return self["@result"];
  43992. },
  43993. args: [],
  43994. source: "result\x0a\x09^ result",
  43995. referencedClasses: [],
  43996. messageSends: []
  43997. }),
  43998. $globals.ASTDebugger);
  43999. $core.addMethod(
  44000. $core.method({
  44001. selector: "stepInto",
  44002. protocol: "stepping",
  44003. fn: function (){
  44004. var self=this;
  44005. return $core.withContext(function($ctx1) {
  44006. self._shouldBeImplemented();
  44007. return self;
  44008. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  44009. },
  44010. args: [],
  44011. source: "stepInto\x0a\x09self shouldBeImplemented",
  44012. referencedClasses: [],
  44013. messageSends: ["shouldBeImplemented"]
  44014. }),
  44015. $globals.ASTDebugger);
  44016. $core.addMethod(
  44017. $core.method({
  44018. selector: "stepOver",
  44019. protocol: "stepping",
  44020. fn: function (){
  44021. var self=this;
  44022. return $core.withContext(function($ctx1) {
  44023. var $1,$2;
  44024. $1=$recv(self._context())._isTopContext();
  44025. if($core.assert($1)){
  44026. $recv(self._interpreter())._stepOver();
  44027. } else {
  44028. $2=self._interpreter();
  44029. $ctx1.sendIdx["interpreter"]=1;
  44030. $recv($2)._skip();
  44031. }
  44032. self._onStep();
  44033. return self;
  44034. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  44035. },
  44036. args: [],
  44037. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  44038. referencedClasses: [],
  44039. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  44040. }),
  44041. $globals.ASTDebugger);
  44042. $core.addMethod(
  44043. $core.method({
  44044. selector: "context:",
  44045. protocol: "instance creation",
  44046. fn: function (aContext){
  44047. var self=this;
  44048. return $core.withContext(function($ctx1) {
  44049. var $1;
  44050. $1=self._new();
  44051. $recv($1)._context_(aContext);
  44052. return $recv($1)._yourself();
  44053. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.klass)});
  44054. },
  44055. args: ["aContext"],
  44056. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  44057. referencedClasses: [],
  44058. messageSends: ["context:", "new", "yourself"]
  44059. }),
  44060. $globals.ASTDebugger.klass);
  44061. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  44062. $core.addMethod(
  44063. $core.method({
  44064. selector: "interpreter",
  44065. protocol: "accessing",
  44066. fn: function (){
  44067. var self=this;
  44068. return self["@interpreter"];
  44069. },
  44070. args: [],
  44071. source: "interpreter\x0a\x09^ interpreter",
  44072. referencedClasses: [],
  44073. messageSends: []
  44074. }),
  44075. $globals.ASTEnterNode);
  44076. $core.addMethod(
  44077. $core.method({
  44078. selector: "interpreter:",
  44079. protocol: "accessing",
  44080. fn: function (anObject){
  44081. var self=this;
  44082. self["@interpreter"]=anObject;
  44083. return self;
  44084. },
  44085. args: ["anObject"],
  44086. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  44087. referencedClasses: [],
  44088. messageSends: []
  44089. }),
  44090. $globals.ASTEnterNode);
  44091. $core.addMethod(
  44092. $core.method({
  44093. selector: "visitBlockNode:",
  44094. protocol: "visiting",
  44095. fn: function (aNode){
  44096. var self=this;
  44097. return aNode;
  44098. },
  44099. args: ["aNode"],
  44100. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  44101. referencedClasses: [],
  44102. messageSends: []
  44103. }),
  44104. $globals.ASTEnterNode);
  44105. $core.addMethod(
  44106. $core.method({
  44107. selector: "visitDagNode:",
  44108. protocol: "visiting",
  44109. fn: function (aNode){
  44110. var self=this;
  44111. return $core.withContext(function($ctx1) {
  44112. var $early={};
  44113. try {
  44114. $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  44115. throw $early=[aNode];
  44116. }),(function(nodes){
  44117. return $core.withContext(function($ctx2) {
  44118. throw $early=[self._visit_($recv(nodes)._first())];
  44119. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  44120. }));
  44121. return self;
  44122. }
  44123. catch(e) {if(e===$early)return e[0]; throw e}
  44124. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
  44125. },
  44126. args: ["aNode"],
  44127. source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  44128. referencedClasses: [],
  44129. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  44130. }),
  44131. $globals.ASTEnterNode);
  44132. $core.addMethod(
  44133. $core.method({
  44134. selector: "visitSequenceNode:",
  44135. protocol: "visiting",
  44136. fn: function (aNode){
  44137. var self=this;
  44138. return $core.withContext(function($ctx1) {
  44139. var $1;
  44140. $recv($recv(aNode)._temps())._do_((function(each){
  44141. return $core.withContext(function($ctx2) {
  44142. return $recv($recv(self._interpreter())._context())._defineLocal_(each);
  44143. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44144. }));
  44145. $1=(
  44146. $ctx1.supercall = true,
  44147. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  44148. $ctx1.supercall = false;
  44149. return $1;
  44150. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  44151. },
  44152. args: ["aNode"],
  44153. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  44154. referencedClasses: [],
  44155. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  44156. }),
  44157. $globals.ASTEnterNode);
  44158. $core.addMethod(
  44159. $core.method({
  44160. selector: "on:",
  44161. protocol: "instance creation",
  44162. fn: function (anInterpreter){
  44163. var self=this;
  44164. return $core.withContext(function($ctx1) {
  44165. var $1;
  44166. $1=self._new();
  44167. $recv($1)._interpreter_(anInterpreter);
  44168. return $recv($1)._yourself();
  44169. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.klass)});
  44170. },
  44171. args: ["anInterpreter"],
  44172. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  44173. referencedClasses: [],
  44174. messageSends: ["interpreter:", "new", "yourself"]
  44175. }),
  44176. $globals.ASTEnterNode.klass);
  44177. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  44178. $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";
  44179. $core.addMethod(
  44180. $core.method({
  44181. selector: "assign:to:",
  44182. protocol: "private",
  44183. fn: function (aNode,anObject){
  44184. var self=this;
  44185. return $core.withContext(function($ctx1) {
  44186. var $1,$3,$2,$4;
  44187. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  44188. if($core.assert($1)){
  44189. $3=self._context();
  44190. $ctx1.sendIdx["context"]=1;
  44191. $2=$recv($3)._receiver();
  44192. $4=$recv(aNode)._value();
  44193. $ctx1.sendIdx["value"]=1;
  44194. $recv($2)._instVarAt_put_($4,anObject);
  44195. } else {
  44196. $recv(self._context())._localAt_put_($recv(aNode)._value(),anObject);
  44197. }
  44198. return self;
  44199. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  44200. },
  44201. args: ["aNode", "anObject"],
  44202. 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 ]",
  44203. referencedClasses: [],
  44204. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  44205. }),
  44206. $globals.ASTInterpreter);
  44207. $core.addMethod(
  44208. $core.method({
  44209. selector: "atEnd",
  44210. protocol: "testing",
  44211. fn: function (){
  44212. var self=this;
  44213. return $core.withContext(function($ctx1) {
  44214. var $1;
  44215. $1=self["@forceAtEnd"];
  44216. if($core.assert($1)){
  44217. return true;
  44218. }
  44219. return $recv(self._hasReturned())._or_((function(){
  44220. return $core.withContext(function($ctx2) {
  44221. return $recv(self._node())._isNil();
  44222. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44223. }));
  44224. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  44225. },
  44226. args: [],
  44227. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  44228. referencedClasses: [],
  44229. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  44230. }),
  44231. $globals.ASTInterpreter);
  44232. $core.addMethod(
  44233. $core.method({
  44234. selector: "context",
  44235. protocol: "accessing",
  44236. fn: function (){
  44237. var self=this;
  44238. return self["@context"];
  44239. },
  44240. args: [],
  44241. source: "context\x0a\x09^ context",
  44242. referencedClasses: [],
  44243. messageSends: []
  44244. }),
  44245. $globals.ASTInterpreter);
  44246. $core.addMethod(
  44247. $core.method({
  44248. selector: "context:",
  44249. protocol: "accessing",
  44250. fn: function (aContext){
  44251. var self=this;
  44252. self["@context"]=aContext;
  44253. return self;
  44254. },
  44255. args: ["aContext"],
  44256. source: "context: aContext\x0a\x09context := aContext",
  44257. referencedClasses: [],
  44258. messageSends: []
  44259. }),
  44260. $globals.ASTInterpreter);
  44261. $core.addMethod(
  44262. $core.method({
  44263. selector: "enterNode",
  44264. protocol: "interpreting",
  44265. fn: function (){
  44266. var self=this;
  44267. return $core.withContext(function($ctx1) {
  44268. self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_(self._node()));
  44269. return self;
  44270. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  44271. },
  44272. args: [],
  44273. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  44274. referencedClasses: ["ASTEnterNode"],
  44275. messageSends: ["node:", "visit:", "on:", "node"]
  44276. }),
  44277. $globals.ASTInterpreter);
  44278. $core.addMethod(
  44279. $core.method({
  44280. selector: "eval:",
  44281. protocol: "private",
  44282. fn: function (aString){
  44283. var self=this;
  44284. var source,function_;
  44285. return $core.withContext(function($ctx1) {
  44286. var $3,$2,$1;
  44287. source=$recv($globals.String)._streamContents_((function(str){
  44288. return $core.withContext(function($ctx2) {
  44289. $recv(str)._nextPutAll_("0,(function(");
  44290. $ctx2.sendIdx["nextPutAll:"]=1;
  44291. $3=self._context();
  44292. $ctx2.sendIdx["context"]=1;
  44293. $2=$recv($3)._locals();
  44294. $ctx2.sendIdx["locals"]=1;
  44295. $1=$recv($2)._keys();
  44296. $recv($1)._do_separatedBy_((function(each){
  44297. return $core.withContext(function($ctx3) {
  44298. return $recv(str)._nextPutAll_(each);
  44299. $ctx3.sendIdx["nextPutAll:"]=2;
  44300. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  44301. }),(function(){
  44302. return $core.withContext(function($ctx3) {
  44303. return $recv(str)._nextPutAll_(",");
  44304. $ctx3.sendIdx["nextPutAll:"]=3;
  44305. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  44306. }));
  44307. $recv(str)._nextPutAll_("){ return (function() {");
  44308. $ctx2.sendIdx["nextPutAll:"]=4;
  44309. $recv(str)._nextPutAll_(aString);
  44310. $ctx2.sendIdx["nextPutAll:"]=5;
  44311. return $recv(str)._nextPutAll_("})()})");
  44312. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  44313. }));
  44314. function_=$recv($recv($globals.Compiler)._new())._eval_(source);
  44315. return $recv(function_)._valueWithPossibleArguments_($recv($recv(self._context())._locals())._values());
  44316. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  44317. },
  44318. args: ["aString"],
  44319. 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 new eval: source.\x0a\x09\x0a\x09^ function valueWithPossibleArguments: self context locals values",
  44320. referencedClasses: ["String", "Compiler"],
  44321. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]
  44322. }),
  44323. $globals.ASTInterpreter);
  44324. $core.addMethod(
  44325. $core.method({
  44326. selector: "hasReturned",
  44327. protocol: "testing",
  44328. fn: function (){
  44329. var self=this;
  44330. return $core.withContext(function($ctx1) {
  44331. var $1,$receiver;
  44332. $1=self["@returned"];
  44333. if(($receiver = $1) == null || $receiver.isNil){
  44334. return false;
  44335. } else {
  44336. return $1;
  44337. }
  44338. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  44339. },
  44340. args: [],
  44341. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  44342. referencedClasses: [],
  44343. messageSends: ["ifNil:"]
  44344. }),
  44345. $globals.ASTInterpreter);
  44346. $core.addMethod(
  44347. $core.method({
  44348. selector: "initialize",
  44349. protocol: "initialization",
  44350. fn: function (){
  44351. var self=this;
  44352. return $core.withContext(function($ctx1) {
  44353. (
  44354. $ctx1.supercall = true,
  44355. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  44356. $ctx1.supercall = false;
  44357. self["@forceAtEnd"]=false;
  44358. return self;
  44359. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  44360. },
  44361. args: [],
  44362. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  44363. referencedClasses: [],
  44364. messageSends: ["initialize"]
  44365. }),
  44366. $globals.ASTInterpreter);
  44367. $core.addMethod(
  44368. $core.method({
  44369. selector: "interpret",
  44370. protocol: "interpreting",
  44371. fn: function (){
  44372. var self=this;
  44373. return $core.withContext(function($ctx1) {
  44374. self._visit_(self._node());
  44375. return self;
  44376. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  44377. },
  44378. args: [],
  44379. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  44380. referencedClasses: [],
  44381. messageSends: ["visit:", "node"]
  44382. }),
  44383. $globals.ASTInterpreter);
  44384. $core.addMethod(
  44385. $core.method({
  44386. selector: "messageFromSendNode:arguments:",
  44387. protocol: "private",
  44388. fn: function (aSendNode,aCollection){
  44389. var self=this;
  44390. return $core.withContext(function($ctx1) {
  44391. var $1;
  44392. $1=$recv($globals.Message)._new();
  44393. $recv($1)._selector_($recv(aSendNode)._selector());
  44394. $recv($1)._arguments_(aCollection);
  44395. return $recv($1)._yourself();
  44396. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  44397. },
  44398. args: ["aSendNode", "aCollection"],
  44399. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  44400. referencedClasses: ["Message"],
  44401. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  44402. }),
  44403. $globals.ASTInterpreter);
  44404. $core.addMethod(
  44405. $core.method({
  44406. selector: "messageNotUnderstood:receiver:",
  44407. protocol: "private",
  44408. fn: function (aMessage,anObject){
  44409. var self=this;
  44410. return $core.withContext(function($ctx1) {
  44411. var $1;
  44412. $1=$recv($globals.MessageNotUnderstood)._new();
  44413. $recv($1)._message_(aMessage);
  44414. $recv($1)._receiver_(anObject);
  44415. $recv($1)._signal();
  44416. return self;
  44417. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  44418. },
  44419. args: ["aMessage", "anObject"],
  44420. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  44421. referencedClasses: ["MessageNotUnderstood"],
  44422. messageSends: ["message:", "new", "receiver:", "signal"]
  44423. }),
  44424. $globals.ASTInterpreter);
  44425. $core.addMethod(
  44426. $core.method({
  44427. selector: "next",
  44428. protocol: "interpreting",
  44429. fn: function (){
  44430. var self=this;
  44431. var nd,nextNode;
  44432. return $core.withContext(function($ctx1) {
  44433. var $1,$2,$receiver;
  44434. nd=self._node();
  44435. $1=$recv(nd)._parent();
  44436. if(($receiver = $1) == null || $receiver.isNil){
  44437. nextNode=$1;
  44438. } else {
  44439. var parent;
  44440. parent=$receiver;
  44441. $2=$recv(parent)._nextSiblingNode_(nd);
  44442. if(($receiver = $2) == null || $receiver.isNil){
  44443. nextNode=parent;
  44444. } else {
  44445. var sibling;
  44446. sibling=$receiver;
  44447. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  44448. }
  44449. }
  44450. self._node_(nextNode);
  44451. return self;
  44452. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  44453. },
  44454. args: [],
  44455. 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",
  44456. referencedClasses: ["ASTEnterNode"],
  44457. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  44458. }),
  44459. $globals.ASTInterpreter);
  44460. $core.addMethod(
  44461. $core.method({
  44462. selector: "node",
  44463. protocol: "accessing",
  44464. fn: function (){
  44465. var self=this;
  44466. return self["@node"];
  44467. },
  44468. args: [],
  44469. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  44470. referencedClasses: [],
  44471. messageSends: []
  44472. }),
  44473. $globals.ASTInterpreter);
  44474. $core.addMethod(
  44475. $core.method({
  44476. selector: "node:",
  44477. protocol: "accessing",
  44478. fn: function (aNode){
  44479. var self=this;
  44480. self["@node"]=aNode;
  44481. return self;
  44482. },
  44483. args: ["aNode"],
  44484. source: "node: aNode\x0a\x09node := aNode",
  44485. referencedClasses: [],
  44486. messageSends: []
  44487. }),
  44488. $globals.ASTInterpreter);
  44489. $core.addMethod(
  44490. $core.method({
  44491. selector: "peek",
  44492. protocol: "stack",
  44493. fn: function (){
  44494. var self=this;
  44495. return $core.withContext(function($ctx1) {
  44496. var $1;
  44497. var $early={};
  44498. try {
  44499. $1=self._stack();
  44500. $ctx1.sendIdx["stack"]=1;
  44501. $recv($1)._ifEmpty_((function(){
  44502. throw $early=[nil];
  44503. }));
  44504. return $recv(self._stack())._last();
  44505. }
  44506. catch(e) {if(e===$early)return e[0]; throw e}
  44507. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  44508. },
  44509. args: [],
  44510. 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",
  44511. referencedClasses: [],
  44512. messageSends: ["ifEmpty:", "stack", "last"]
  44513. }),
  44514. $globals.ASTInterpreter);
  44515. $core.addMethod(
  44516. $core.method({
  44517. selector: "pop",
  44518. protocol: "stack",
  44519. fn: function (){
  44520. var self=this;
  44521. var peekedValue;
  44522. return $core.withContext(function($ctx1) {
  44523. peekedValue=self._peek();
  44524. $recv(self._stack())._removeLast();
  44525. return peekedValue;
  44526. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  44527. },
  44528. args: [],
  44529. 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",
  44530. referencedClasses: [],
  44531. messageSends: ["peek", "removeLast", "stack"]
  44532. }),
  44533. $globals.ASTInterpreter);
  44534. $core.addMethod(
  44535. $core.method({
  44536. selector: "proceed",
  44537. protocol: "interpreting",
  44538. fn: function (){
  44539. var self=this;
  44540. return $core.withContext(function($ctx1) {
  44541. $recv((function(){
  44542. return $core.withContext(function($ctx2) {
  44543. return self._atEnd();
  44544. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44545. }))._whileFalse_((function(){
  44546. return $core.withContext(function($ctx2) {
  44547. return self._step();
  44548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44549. }));
  44550. return self;
  44551. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  44552. },
  44553. args: [],
  44554. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  44555. referencedClasses: [],
  44556. messageSends: ["whileFalse:", "atEnd", "step"]
  44557. }),
  44558. $globals.ASTInterpreter);
  44559. $core.addMethod(
  44560. $core.method({
  44561. selector: "push:",
  44562. protocol: "stack",
  44563. fn: function (anObject){
  44564. var self=this;
  44565. return $core.withContext(function($ctx1) {
  44566. return $recv(self._stack())._add_(anObject);
  44567. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  44568. },
  44569. args: ["anObject"],
  44570. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  44571. referencedClasses: [],
  44572. messageSends: ["add:", "stack"]
  44573. }),
  44574. $globals.ASTInterpreter);
  44575. $core.addMethod(
  44576. $core.method({
  44577. selector: "restart",
  44578. protocol: "interpreting",
  44579. fn: function (){
  44580. var self=this;
  44581. return $core.withContext(function($ctx1) {
  44582. self._node_($recv(self._context())._ast());
  44583. self._enterNode();
  44584. return self;
  44585. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  44586. },
  44587. args: [],
  44588. source: "restart\x0a\x09self node: self context ast; enterNode",
  44589. referencedClasses: [],
  44590. messageSends: ["node:", "ast", "context", "enterNode"]
  44591. }),
  44592. $globals.ASTInterpreter);
  44593. $core.addMethod(
  44594. $core.method({
  44595. selector: "result",
  44596. protocol: "accessing",
  44597. fn: function (){
  44598. var self=this;
  44599. return $core.withContext(function($ctx1) {
  44600. var $1;
  44601. $1=self._hasReturned();
  44602. if($core.assert($1)){
  44603. return self._returnValue();
  44604. } else {
  44605. return $recv(self._context())._receiver();
  44606. }
  44607. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  44608. },
  44609. args: [],
  44610. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  44611. referencedClasses: [],
  44612. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  44613. }),
  44614. $globals.ASTInterpreter);
  44615. $core.addMethod(
  44616. $core.method({
  44617. selector: "returnValue",
  44618. protocol: "accessing",
  44619. fn: function (){
  44620. var self=this;
  44621. return self["@returnValue"];
  44622. },
  44623. args: [],
  44624. source: "returnValue\x0a\x09^ returnValue",
  44625. referencedClasses: [],
  44626. messageSends: []
  44627. }),
  44628. $globals.ASTInterpreter);
  44629. $core.addMethod(
  44630. $core.method({
  44631. selector: "returnValue:",
  44632. protocol: "accessing",
  44633. fn: function (anObject){
  44634. var self=this;
  44635. self["@returnValue"]=anObject;
  44636. return self;
  44637. },
  44638. args: ["anObject"],
  44639. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  44640. referencedClasses: [],
  44641. messageSends: []
  44642. }),
  44643. $globals.ASTInterpreter);
  44644. $core.addMethod(
  44645. $core.method({
  44646. selector: "sendMessage:to:superSend:",
  44647. protocol: "private",
  44648. fn: function (aMessage,anObject,aBoolean){
  44649. var self=this;
  44650. var method;
  44651. return $core.withContext(function($ctx1) {
  44652. var $2,$1,$3,$receiver;
  44653. var $early={};
  44654. try {
  44655. if(!$core.assert(aBoolean)){
  44656. return $recv(aMessage)._sendTo_(anObject);
  44657. }
  44658. $2=$recv(anObject)._class();
  44659. $ctx1.sendIdx["class"]=1;
  44660. $1=$recv($2)._superclass();
  44661. $ctx1.sendIdx["superclass"]=1;
  44662. if(($receiver = $1) == null || $receiver.isNil){
  44663. $3=self._messageNotUnderstood_receiver_(aMessage,anObject);
  44664. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  44665. return $3;
  44666. } else {
  44667. $1;
  44668. }
  44669. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  44670. return $core.withContext(function($ctx2) {
  44671. throw $early=[self._messageNotUnderstood_receiver_(aMessage,anObject)];
  44672. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44673. }));
  44674. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  44675. }
  44676. catch(e) {if(e===$early)return e[0]; throw e}
  44677. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  44678. },
  44679. args: ["aMessage", "anObject", "aBoolean"],
  44680. 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",
  44681. referencedClasses: [],
  44682. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  44683. }),
  44684. $globals.ASTInterpreter);
  44685. $core.addMethod(
  44686. $core.method({
  44687. selector: "setNonLocalReturnFromContext:",
  44688. protocol: "interpreting",
  44689. fn: function (aContext){
  44690. var self=this;
  44691. return $core.withContext(function($ctx1) {
  44692. var $2,$1;
  44693. $2=$recv(aContext)._interpreter();
  44694. $ctx1.sendIdx["interpreter"]=1;
  44695. $1=$recv($2)._hasReturned();
  44696. if($core.assert($1)){
  44697. self["@returned"]=true;
  44698. self["@returned"];
  44699. self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  44700. }
  44701. return self;
  44702. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  44703. },
  44704. args: ["aContext"],
  44705. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  44706. referencedClasses: [],
  44707. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  44708. }),
  44709. $globals.ASTInterpreter);
  44710. $core.addMethod(
  44711. $core.method({
  44712. selector: "skip",
  44713. protocol: "interpreting",
  44714. fn: function (){
  44715. var self=this;
  44716. return $core.withContext(function($ctx1) {
  44717. self._next();
  44718. return self;
  44719. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  44720. },
  44721. args: [],
  44722. source: "skip\x0a\x09self next",
  44723. referencedClasses: [],
  44724. messageSends: ["next"]
  44725. }),
  44726. $globals.ASTInterpreter);
  44727. $core.addMethod(
  44728. $core.method({
  44729. selector: "stack",
  44730. protocol: "accessing",
  44731. fn: function (){
  44732. var self=this;
  44733. return $core.withContext(function($ctx1) {
  44734. var $1,$receiver;
  44735. $1=self["@stack"];
  44736. if(($receiver = $1) == null || $receiver.isNil){
  44737. self["@stack"]=$recv($globals.OrderedCollection)._new();
  44738. return self["@stack"];
  44739. } else {
  44740. return $1;
  44741. }
  44742. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  44743. },
  44744. args: [],
  44745. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  44746. referencedClasses: ["OrderedCollection"],
  44747. messageSends: ["ifNil:", "new"]
  44748. }),
  44749. $globals.ASTInterpreter);
  44750. $core.addMethod(
  44751. $core.method({
  44752. selector: "step",
  44753. protocol: "interpreting",
  44754. fn: function (){
  44755. var self=this;
  44756. return $core.withContext(function($ctx1) {
  44757. self._interpret();
  44758. self._next();
  44759. return self;
  44760. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  44761. },
  44762. args: [],
  44763. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  44764. referencedClasses: [],
  44765. messageSends: ["interpret", "next"]
  44766. }),
  44767. $globals.ASTInterpreter);
  44768. $core.addMethod(
  44769. $core.method({
  44770. selector: "stepOver",
  44771. protocol: "interpreting",
  44772. fn: function (){
  44773. var self=this;
  44774. return $core.withContext(function($ctx1) {
  44775. var $2,$1;
  44776. self._step();
  44777. $ctx1.sendIdx["step"]=1;
  44778. $recv((function(){
  44779. return $core.withContext(function($ctx2) {
  44780. $2=self._node();
  44781. $ctx2.sendIdx["node"]=1;
  44782. $1=$recv($2)._isNil();
  44783. return $recv($1)._or_((function(){
  44784. return $core.withContext(function($ctx3) {
  44785. return $recv(self._node())._isSteppingNode();
  44786. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44787. }));
  44788. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44789. }))._whileFalse_((function(){
  44790. return $core.withContext(function($ctx2) {
  44791. return self._step();
  44792. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44793. }));
  44794. return self;
  44795. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  44796. },
  44797. args: [],
  44798. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  44799. referencedClasses: [],
  44800. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  44801. }),
  44802. $globals.ASTInterpreter);
  44803. $core.addMethod(
  44804. $core.method({
  44805. selector: "visit:",
  44806. protocol: "visiting",
  44807. fn: function (aNode){
  44808. var self=this;
  44809. return $core.withContext(function($ctx1) {
  44810. var $1;
  44811. $1=self._hasReturned();
  44812. if(!$core.assert($1)){
  44813. (
  44814. $ctx1.supercall = true,
  44815. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($recv(self), [aNode]));
  44816. $ctx1.supercall = false;
  44817. }
  44818. return self;
  44819. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  44820. },
  44821. args: ["aNode"],
  44822. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  44823. referencedClasses: [],
  44824. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  44825. }),
  44826. $globals.ASTInterpreter);
  44827. $core.addMethod(
  44828. $core.method({
  44829. selector: "visitAssignmentNode:",
  44830. protocol: "visiting",
  44831. fn: function (aNode){
  44832. var self=this;
  44833. var poppedValue;
  44834. return $core.withContext(function($ctx1) {
  44835. poppedValue=self._pop();
  44836. $ctx1.sendIdx["pop"]=1;
  44837. self._pop();
  44838. self._push_(poppedValue);
  44839. self._assign_to_($recv(aNode)._left(),poppedValue);
  44840. return self;
  44841. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  44842. },
  44843. args: ["aNode"],
  44844. 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",
  44845. referencedClasses: [],
  44846. messageSends: ["pop", "push:", "assign:to:", "left"]
  44847. }),
  44848. $globals.ASTInterpreter);
  44849. $core.addMethod(
  44850. $core.method({
  44851. selector: "visitBlockNode:",
  44852. protocol: "visiting",
  44853. fn: function (aNode){
  44854. var self=this;
  44855. var block;
  44856. return $core.withContext(function($ctx1) {
  44857. block=$recv($globals.AIBlockClosure)._forContext_node_(self._context(),aNode);
  44858. self._push_(block);
  44859. return self;
  44860. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  44861. },
  44862. args: ["aNode"],
  44863. 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",
  44864. referencedClasses: ["AIBlockClosure"],
  44865. messageSends: ["forContext:node:", "context", "push:"]
  44866. }),
  44867. $globals.ASTInterpreter);
  44868. $core.addMethod(
  44869. $core.method({
  44870. selector: "visitBlockSequenceNode:",
  44871. protocol: "visiting",
  44872. fn: function (aNode){
  44873. var self=this;
  44874. return $core.withContext(function($ctx1) {
  44875. (
  44876. $ctx1.supercall = true,
  44877. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($recv(self), [aNode]));
  44878. $ctx1.supercall = false;
  44879. self["@forceAtEnd"]=true;
  44880. return self;
  44881. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44882. },
  44883. args: ["aNode"],
  44884. 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",
  44885. referencedClasses: [],
  44886. messageSends: ["visitBlockSequenceNode:"]
  44887. }),
  44888. $globals.ASTInterpreter);
  44889. $core.addMethod(
  44890. $core.method({
  44891. selector: "visitDagNode:",
  44892. protocol: "visiting",
  44893. fn: function (aNode){
  44894. var self=this;
  44895. return self;
  44896. },
  44897. args: ["aNode"],
  44898. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  44899. referencedClasses: [],
  44900. messageSends: []
  44901. }),
  44902. $globals.ASTInterpreter);
  44903. $core.addMethod(
  44904. $core.method({
  44905. selector: "visitDynamicArrayNode:",
  44906. protocol: "visiting",
  44907. fn: function (aNode){
  44908. var self=this;
  44909. var array;
  44910. return $core.withContext(function($ctx1) {
  44911. array=[];
  44912. $recv($recv(aNode)._dagChildren())._do_((function(each){
  44913. return $core.withContext(function($ctx2) {
  44914. return $recv(array)._addFirst_(self._pop());
  44915. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44916. }));
  44917. self._push_(array);
  44918. return self;
  44919. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  44920. },
  44921. args: ["aNode"],
  44922. 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",
  44923. referencedClasses: [],
  44924. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  44925. }),
  44926. $globals.ASTInterpreter);
  44927. $core.addMethod(
  44928. $core.method({
  44929. selector: "visitDynamicDictionaryNode:",
  44930. protocol: "visiting",
  44931. fn: function (aNode){
  44932. var self=this;
  44933. var keyValueList;
  44934. return $core.withContext(function($ctx1) {
  44935. keyValueList=$recv($globals.OrderedCollection)._new();
  44936. $recv($recv(aNode)._dagChildren())._do_((function(each){
  44937. return $core.withContext(function($ctx2) {
  44938. return $recv(keyValueList)._add_(self._pop());
  44939. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44940. }));
  44941. self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  44942. return self;
  44943. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  44944. },
  44945. args: ["aNode"],
  44946. 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)",
  44947. referencedClasses: ["OrderedCollection", "HashedCollection"],
  44948. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  44949. }),
  44950. $globals.ASTInterpreter);
  44951. $core.addMethod(
  44952. $core.method({
  44953. selector: "visitJSStatementNode:",
  44954. protocol: "visiting",
  44955. fn: function (aNode){
  44956. var self=this;
  44957. return $core.withContext(function($ctx1) {
  44958. self["@returned"]=true;
  44959. self._returnValue_(self._eval_($recv(aNode)._source()));
  44960. return self;
  44961. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44962. },
  44963. args: ["aNode"],
  44964. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  44965. referencedClasses: [],
  44966. messageSends: ["returnValue:", "eval:", "source"]
  44967. }),
  44968. $globals.ASTInterpreter);
  44969. $core.addMethod(
  44970. $core.method({
  44971. selector: "visitReturnNode:",
  44972. protocol: "visiting",
  44973. fn: function (aNode){
  44974. var self=this;
  44975. return $core.withContext(function($ctx1) {
  44976. self["@returned"]=true;
  44977. self._returnValue_(self._pop());
  44978. return self;
  44979. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44980. },
  44981. args: ["aNode"],
  44982. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  44983. referencedClasses: [],
  44984. messageSends: ["returnValue:", "pop"]
  44985. }),
  44986. $globals.ASTInterpreter);
  44987. $core.addMethod(
  44988. $core.method({
  44989. selector: "visitSendNode:",
  44990. protocol: "visiting",
  44991. fn: function (aNode){
  44992. var self=this;
  44993. var receiver,args,message,result;
  44994. return $core.withContext(function($ctx1) {
  44995. var $1;
  44996. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  44997. return $core.withContext(function($ctx2) {
  44998. return self._pop();
  44999. $ctx2.sendIdx["pop"]=1;
  45000. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45001. }));
  45002. receiver=self._peek();
  45003. message=self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  45004. result=self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  45005. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  45006. return $core.withContext(function($ctx2) {
  45007. return $recv($recv(aNode)._isLastChild())._not();
  45008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45009. }));
  45010. if(!$core.assert($1)){
  45011. self._pop();
  45012. self._push_(result);
  45013. }
  45014. return self;
  45015. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  45016. },
  45017. args: ["aNode"],
  45018. 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 ]",
  45019. referencedClasses: [],
  45020. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  45021. }),
  45022. $globals.ASTInterpreter);
  45023. $core.addMethod(
  45024. $core.method({
  45025. selector: "visitValueNode:",
  45026. protocol: "visiting",
  45027. fn: function (aNode){
  45028. var self=this;
  45029. return $core.withContext(function($ctx1) {
  45030. self._push_($recv(aNode)._value());
  45031. return self;
  45032. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  45033. },
  45034. args: ["aNode"],
  45035. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  45036. referencedClasses: [],
  45037. messageSends: ["push:", "value"]
  45038. }),
  45039. $globals.ASTInterpreter);
  45040. $core.addMethod(
  45041. $core.method({
  45042. selector: "visitVariableNode:",
  45043. protocol: "visiting",
  45044. fn: function (aNode){
  45045. var self=this;
  45046. return $core.withContext(function($ctx1) {
  45047. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  45048. $2=$recv(aNode)._binding();
  45049. $ctx1.sendIdx["binding"]=1;
  45050. $1=$recv($2)._isUnknownVar();
  45051. if($core.assert($1)){
  45052. $5=$recv($globals.Platform)._globals();
  45053. $ctx1.sendIdx["globals"]=1;
  45054. $6=$recv(aNode)._value();
  45055. $ctx1.sendIdx["value"]=1;
  45056. $4=$recv($5)._at_ifAbsent_($6,(function(){
  45057. return $core.withContext(function($ctx2) {
  45058. return self._error_("Unknown variable");
  45059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45060. }));
  45061. $ctx1.sendIdx["at:ifAbsent:"]=1;
  45062. $3=self._push_($4);
  45063. $ctx1.sendIdx["push:"]=1;
  45064. return $3;
  45065. }
  45066. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  45067. if($core.assert($8)){
  45068. $10=self._context();
  45069. $ctx1.sendIdx["context"]=1;
  45070. $9=$recv($10)._receiver();
  45071. $11=$recv(aNode)._value();
  45072. $ctx1.sendIdx["value"]=2;
  45073. $7=$recv($9)._instVarAt_($11);
  45074. } else {
  45075. $12=self._context();
  45076. $13=$recv(aNode)._value();
  45077. $ctx1.sendIdx["value"]=3;
  45078. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  45079. return $core.withContext(function($ctx2) {
  45080. $15=$recv(aNode)._value();
  45081. $ctx2.sendIdx["value"]=4;
  45082. $14=$recv($15)._isCapitalized();
  45083. if($core.assert($14)){
  45084. $16=$recv($globals.Smalltalk)._globals();
  45085. $ctx2.sendIdx["globals"]=2;
  45086. $17=$recv(aNode)._value();
  45087. $ctx2.sendIdx["value"]=5;
  45088. return $recv($16)._at_ifAbsent_($17,(function(){
  45089. return $core.withContext(function($ctx3) {
  45090. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  45091. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  45092. }));
  45093. }
  45094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  45095. }));
  45096. }
  45097. self._push_($7);
  45098. return self;
  45099. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  45100. },
  45101. args: ["aNode"],
  45102. 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 ] ] ] ])",
  45103. referencedClasses: ["Platform", "Smalltalk"],
  45104. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  45105. }),
  45106. $globals.ASTInterpreter);
  45107. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  45108. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  45109. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  45110. $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`";
  45111. $core.addMethod(
  45112. $core.method({
  45113. selector: "currentNode",
  45114. protocol: "accessing",
  45115. fn: function (){
  45116. var self=this;
  45117. return self["@currentNode"];
  45118. },
  45119. args: [],
  45120. source: "currentNode\x0a\x09^ currentNode",
  45121. referencedClasses: [],
  45122. messageSends: []
  45123. }),
  45124. $globals.ASTPCNodeVisitor);
  45125. $core.addMethod(
  45126. $core.method({
  45127. selector: "increaseTrackedIndex",
  45128. protocol: "accessing",
  45129. fn: function (){
  45130. var self=this;
  45131. return $core.withContext(function($ctx1) {
  45132. self["@trackedIndex"]=$recv(self._trackedIndex()).__plus((1));
  45133. return self;
  45134. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
  45135. },
  45136. args: [],
  45137. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  45138. referencedClasses: [],
  45139. messageSends: ["+", "trackedIndex"]
  45140. }),
  45141. $globals.ASTPCNodeVisitor);
  45142. $core.addMethod(
  45143. $core.method({
  45144. selector: "index",
  45145. protocol: "accessing",
  45146. fn: function (){
  45147. var self=this;
  45148. return self["@index"];
  45149. },
  45150. args: [],
  45151. source: "index\x0a\x09^ index",
  45152. referencedClasses: [],
  45153. messageSends: []
  45154. }),
  45155. $globals.ASTPCNodeVisitor);
  45156. $core.addMethod(
  45157. $core.method({
  45158. selector: "index:",
  45159. protocol: "accessing",
  45160. fn: function (aNumber){
  45161. var self=this;
  45162. self["@index"]=aNumber;
  45163. return self;
  45164. },
  45165. args: ["aNumber"],
  45166. source: "index: aNumber\x0a\x09index := aNumber",
  45167. referencedClasses: [],
  45168. messageSends: []
  45169. }),
  45170. $globals.ASTPCNodeVisitor);
  45171. $core.addMethod(
  45172. $core.method({
  45173. selector: "selector",
  45174. protocol: "accessing",
  45175. fn: function (){
  45176. var self=this;
  45177. return self["@selector"];
  45178. },
  45179. args: [],
  45180. source: "selector\x0a\x09^ selector",
  45181. referencedClasses: [],
  45182. messageSends: []
  45183. }),
  45184. $globals.ASTPCNodeVisitor);
  45185. $core.addMethod(
  45186. $core.method({
  45187. selector: "selector:",
  45188. protocol: "accessing",
  45189. fn: function (aString){
  45190. var self=this;
  45191. self["@selector"]=aString;
  45192. return self;
  45193. },
  45194. args: ["aString"],
  45195. source: "selector: aString\x0a\x09selector := aString",
  45196. referencedClasses: [],
  45197. messageSends: []
  45198. }),
  45199. $globals.ASTPCNodeVisitor);
  45200. $core.addMethod(
  45201. $core.method({
  45202. selector: "trackedIndex",
  45203. protocol: "accessing",
  45204. fn: function (){
  45205. var self=this;
  45206. return $core.withContext(function($ctx1) {
  45207. var $1,$receiver;
  45208. $1=self["@trackedIndex"];
  45209. if(($receiver = $1) == null || $receiver.isNil){
  45210. self["@trackedIndex"]=(0);
  45211. return self["@trackedIndex"];
  45212. } else {
  45213. return $1;
  45214. }
  45215. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
  45216. },
  45217. args: [],
  45218. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  45219. referencedClasses: [],
  45220. messageSends: ["ifNil:"]
  45221. }),
  45222. $globals.ASTPCNodeVisitor);
  45223. $core.addMethod(
  45224. $core.method({
  45225. selector: "visitJSStatementNode:",
  45226. protocol: "visiting",
  45227. fn: function (aNode){
  45228. var self=this;
  45229. self["@currentNode"]=aNode;
  45230. return self;
  45231. },
  45232. args: ["aNode"],
  45233. 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",
  45234. referencedClasses: [],
  45235. messageSends: []
  45236. }),
  45237. $globals.ASTPCNodeVisitor);
  45238. $core.addMethod(
  45239. $core.method({
  45240. selector: "visitSendNode:",
  45241. protocol: "visiting",
  45242. fn: function (aNode){
  45243. var self=this;
  45244. return $core.withContext(function($ctx1) {
  45245. var $2,$1,$3;
  45246. (
  45247. $ctx1.supercall = true,
  45248. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  45249. $ctx1.supercall = false;
  45250. $2=self._selector();
  45251. $ctx1.sendIdx["selector"]=1;
  45252. $1=$recv($2).__eq($recv(aNode)._selector());
  45253. $ctx1.sendIdx["="]=1;
  45254. if($core.assert($1)){
  45255. $3=$recv(self._trackedIndex()).__eq(self._index());
  45256. if($core.assert($3)){
  45257. self["@currentNode"]=aNode;
  45258. self["@currentNode"];
  45259. }
  45260. self._increaseTrackedIndex();
  45261. }
  45262. return self;
  45263. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
  45264. },
  45265. args: ["aNode"],
  45266. 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 ]",
  45267. referencedClasses: [],
  45268. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  45269. }),
  45270. $globals.ASTPCNodeVisitor);
  45271. $core.addMethod(
  45272. $core.method({
  45273. selector: "isLastChild",
  45274. protocol: "*Compiler-Interpreter",
  45275. fn: function (){
  45276. var self=this;
  45277. return $core.withContext(function($ctx1) {
  45278. return $recv($recv($recv(self._parent())._dagChildren())._last()).__eq(self);
  45279. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
  45280. },
  45281. args: [],
  45282. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  45283. referencedClasses: [],
  45284. messageSends: ["=", "last", "dagChildren", "parent"]
  45285. }),
  45286. $globals.ASTNode);
  45287. $core.addMethod(
  45288. $core.method({
  45289. selector: "isSteppingNode",
  45290. protocol: "*Compiler-Interpreter",
  45291. fn: function (){
  45292. var self=this;
  45293. return false;
  45294. },
  45295. args: [],
  45296. source: "isSteppingNode\x0a\x09^ false",
  45297. referencedClasses: [],
  45298. messageSends: []
  45299. }),
  45300. $globals.ASTNode);
  45301. $core.addMethod(
  45302. $core.method({
  45303. selector: "nextSiblingNode:",
  45304. protocol: "*Compiler-Interpreter",
  45305. fn: function (aNode){
  45306. var self=this;
  45307. return $core.withContext(function($ctx1) {
  45308. var $1;
  45309. var $early={};
  45310. try {
  45311. $1=self._dagChildren();
  45312. $ctx1.sendIdx["dagChildren"]=1;
  45313. return $recv($1)._at_ifAbsent_($recv($recv(self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  45314. throw $early=[nil];
  45315. }));
  45316. }
  45317. catch(e) {if(e===$early)return e[0]; throw e}
  45318. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
  45319. },
  45320. args: ["aNode"],
  45321. 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 ]",
  45322. referencedClasses: [],
  45323. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  45324. }),
  45325. $globals.ASTNode);
  45326. $core.addMethod(
  45327. $core.method({
  45328. selector: "isSteppingNode",
  45329. protocol: "*Compiler-Interpreter",
  45330. fn: function (){
  45331. var self=this;
  45332. return true;
  45333. },
  45334. args: [],
  45335. source: "isSteppingNode\x0a\x09^ true",
  45336. referencedClasses: [],
  45337. messageSends: []
  45338. }),
  45339. $globals.AssignmentNode);
  45340. $core.addMethod(
  45341. $core.method({
  45342. selector: "isSteppingNode",
  45343. protocol: "*Compiler-Interpreter",
  45344. fn: function (){
  45345. var self=this;
  45346. return true;
  45347. },
  45348. args: [],
  45349. source: "isSteppingNode\x0a\x09^ true",
  45350. referencedClasses: [],
  45351. messageSends: []
  45352. }),
  45353. $globals.BlockNode);
  45354. $core.addMethod(
  45355. $core.method({
  45356. selector: "nextSiblingNode:",
  45357. protocol: "*Compiler-Interpreter",
  45358. fn: function (aNode){
  45359. var self=this;
  45360. return nil;
  45361. },
  45362. args: ["aNode"],
  45363. 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",
  45364. referencedClasses: [],
  45365. messageSends: []
  45366. }),
  45367. $globals.BlockNode);
  45368. $core.addMethod(
  45369. $core.method({
  45370. selector: "isSteppingNode",
  45371. protocol: "*Compiler-Interpreter",
  45372. fn: function (){
  45373. var self=this;
  45374. return true;
  45375. },
  45376. args: [],
  45377. source: "isSteppingNode\x0a\x09^ true",
  45378. referencedClasses: [],
  45379. messageSends: []
  45380. }),
  45381. $globals.DynamicArrayNode);
  45382. $core.addMethod(
  45383. $core.method({
  45384. selector: "isSteppingNode",
  45385. protocol: "*Compiler-Interpreter",
  45386. fn: function (){
  45387. var self=this;
  45388. return true;
  45389. },
  45390. args: [],
  45391. source: "isSteppingNode\x0a\x09^ true",
  45392. referencedClasses: [],
  45393. messageSends: []
  45394. }),
  45395. $globals.DynamicDictionaryNode);
  45396. $core.addMethod(
  45397. $core.method({
  45398. selector: "isSteppingNode",
  45399. protocol: "*Compiler-Interpreter",
  45400. fn: function (){
  45401. var self=this;
  45402. return true;
  45403. },
  45404. args: [],
  45405. source: "isSteppingNode\x0a\x09^ true",
  45406. referencedClasses: [],
  45407. messageSends: []
  45408. }),
  45409. $globals.JSStatementNode);
  45410. $core.addMethod(
  45411. $core.method({
  45412. selector: "isCascadeSendNode",
  45413. protocol: "*Compiler-Interpreter",
  45414. fn: function (){
  45415. var self=this;
  45416. return $core.withContext(function($ctx1) {
  45417. return $recv(self._parent())._isCascadeNode();
  45418. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  45419. },
  45420. args: [],
  45421. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  45422. referencedClasses: [],
  45423. messageSends: ["isCascadeNode", "parent"]
  45424. }),
  45425. $globals.SendNode);
  45426. $core.addMethod(
  45427. $core.method({
  45428. selector: "isSteppingNode",
  45429. protocol: "*Compiler-Interpreter",
  45430. fn: function (){
  45431. var self=this;
  45432. return true;
  45433. },
  45434. args: [],
  45435. source: "isSteppingNode\x0a\x09^ true",
  45436. referencedClasses: [],
  45437. messageSends: []
  45438. }),
  45439. $globals.SendNode);
  45440. });
  45441. define('amber/lang',[
  45442. './deploy',
  45443. './compatibility', // pre-fetch, dep of ./boot
  45444. './boot', // pre-fetch, dep of ./helpers
  45445. './helpers', // pre-fetch, dep of ./deploy
  45446. './parser',
  45447. // --- packages for the Amber reflection begin here ---
  45448. 'amber_core/Platform-ImportExport',
  45449. 'amber_core/Compiler-Core',
  45450. 'amber_core/Compiler-AST',
  45451. 'amber_core/Compiler-Semantic',
  45452. 'amber_core/Compiler-IR',
  45453. 'amber_core/Compiler-Inlining',
  45454. 'amber_core/Compiler-Interpreter'
  45455. // --- packages for the Amber reflection end here ---
  45456. ], function (amber) {
  45457. return amber;
  45458. });
  45459. define('amber_core/Platform-DOM',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  45460. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  45461. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  45462. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  45463. $core.addPackage("Platform-DOM");
  45464. $core.packages["Platform-DOM"].innerEval = function (expr) { return eval(expr); };
  45465. $core.packages["Platform-DOM"].transport = {"type":"amd","amdNamespace":"amber_core"};
  45466. $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM");
  45467. $core.addMethod(
  45468. $core.method({
  45469. selector: "isDomNode:",
  45470. protocol: "testing",
  45471. fn: function (anObject){
  45472. var self=this;
  45473. return $core.withContext(function($ctx1) {
  45474. return anObject.nodeType > 0 &&
  45475. Object.prototype.toString.call(anObject) !== "[object Object]";
  45476. return self;
  45477. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject},$globals.PlatformDom.klass)});
  45478. },
  45479. args: ["anObject"],
  45480. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  45481. referencedClasses: [],
  45482. messageSends: []
  45483. }),
  45484. $globals.PlatformDom.klass);
  45485. $core.addMethod(
  45486. $core.method({
  45487. selector: "isFeasible",
  45488. protocol: "testing",
  45489. fn: function (){
  45490. var self=this;
  45491. return $core.withContext(function($ctx1) {
  45492. if (typeof document === "undefined") return false;
  45493. try {
  45494. var d = document.createElement("div"),
  45495. f = document.createDocumentFragment(),
  45496. t = document.createTextNode("Hello, Amber!");
  45497. f.appendChild(t);
  45498. d.insertBefore(f, null);
  45499. return d.innerHTML === "Hello, Amber!";
  45500. } catch (e) {
  45501. return false;
  45502. };
  45503. return self;
  45504. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.PlatformDom.klass)});
  45505. },
  45506. args: [],
  45507. 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'>",
  45508. referencedClasses: [],
  45509. messageSends: []
  45510. }),
  45511. $globals.PlatformDom.klass);
  45512. $core.addMethod(
  45513. $core.method({
  45514. selector: "newCustomEvent:detail:",
  45515. protocol: "creation",
  45516. fn: function (aString,anObject){
  45517. var self=this;
  45518. return $core.withContext(function($ctx1) {
  45519. return new CustomEvent(aString, {detail: anObject});
  45520. return self;
  45521. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject},$globals.PlatformDom.klass)});
  45522. },
  45523. args: ["aString", "anObject"],
  45524. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  45525. referencedClasses: [],
  45526. messageSends: []
  45527. }),
  45528. $globals.PlatformDom.klass);
  45529. $core.addMethod(
  45530. $core.method({
  45531. selector: "toArray:",
  45532. protocol: "converting",
  45533. fn: function (aDomList){
  45534. var self=this;
  45535. return $core.withContext(function($ctx1) {
  45536. return Array.prototype.slice.call(aDomList);
  45537. return self;
  45538. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList},$globals.PlatformDom.klass)});
  45539. },
  45540. args: ["aDomList"],
  45541. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  45542. referencedClasses: [],
  45543. messageSends: []
  45544. }),
  45545. $globals.PlatformDom.klass);
  45546. $core.addMethod(
  45547. $core.method({
  45548. selector: "asDomNode",
  45549. protocol: "*Platform-DOM",
  45550. fn: function (){
  45551. var self=this;
  45552. return $core.withContext(function($ctx1) {
  45553. return $recv(document)._createTextNode_(self._asString());
  45554. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.CharacterArray)});
  45555. },
  45556. args: [],
  45557. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  45558. referencedClasses: [],
  45559. messageSends: ["createTextNode:", "asString"]
  45560. }),
  45561. $globals.CharacterArray);
  45562. $core.addMethod(
  45563. $core.method({
  45564. selector: "asDomNode",
  45565. protocol: "*Platform-DOM",
  45566. fn: function (){
  45567. var self=this;
  45568. var fragment;
  45569. return $core.withContext(function($ctx1) {
  45570. fragment=$recv(document)._createDocumentFragment();
  45571. self._do_((function(each){
  45572. return $core.withContext(function($ctx2) {
  45573. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  45574. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45575. }));
  45576. return fragment;
  45577. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment},$globals.Collection)});
  45578. },
  45579. args: [],
  45580. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  45581. referencedClasses: [],
  45582. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  45583. }),
  45584. $globals.Collection);
  45585. $core.addMethod(
  45586. $core.method({
  45587. selector: "asDomNode",
  45588. protocol: "*Platform-DOM",
  45589. fn: function (){
  45590. var self=this;
  45591. return $core.withContext(function($ctx1) {
  45592. var $1,$2;
  45593. $1=$recv($globals.PlatformDom)._isDomNode_(self["@jsObject"]);
  45594. if($core.assert($1)){
  45595. return self["@jsObject"];
  45596. } else {
  45597. $2=(
  45598. $ctx1.supercall = true,
  45599. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($recv(self), []));
  45600. $ctx1.supercall = false;
  45601. return $2;
  45602. }
  45603. return self;
  45604. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.JSObjectProxy)});
  45605. },
  45606. args: [],
  45607. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  45608. referencedClasses: ["PlatformDom"],
  45609. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  45610. }),
  45611. $globals.JSObjectProxy);
  45612. $core.addMethod(
  45613. $core.method({
  45614. selector: "htmlTextContent",
  45615. protocol: "*Platform-DOM",
  45616. fn: function (){
  45617. var self=this;
  45618. return $core.withContext(function($ctx1) {
  45619. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  45620. return self;
  45621. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{},$globals.String)});
  45622. },
  45623. args: [],
  45624. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  45625. referencedClasses: [],
  45626. messageSends: []
  45627. }),
  45628. $globals.String);
  45629. });
  45630. 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";
  45631. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  45632. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  45633. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  45634. $core.addPackage("SUnit");
  45635. $core.packages["SUnit"].innerEval = function (expr) { return eval(expr); };
  45636. $core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  45637. $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
  45638. $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.";
  45639. $core.addMethod(
  45640. $core.method({
  45641. selector: "result",
  45642. protocol: "accessing",
  45643. fn: function (){
  45644. var self=this;
  45645. return self["@result"];
  45646. },
  45647. args: [],
  45648. source: "result\x0a\x09^ result",
  45649. referencedClasses: [],
  45650. messageSends: []
  45651. }),
  45652. $globals.ResultAnnouncement);
  45653. $core.addMethod(
  45654. $core.method({
  45655. selector: "result:",
  45656. protocol: "accessing",
  45657. fn: function (aTestResult){
  45658. var self=this;
  45659. self["@result"]=aTestResult;
  45660. return self;
  45661. },
  45662. args: ["aTestResult"],
  45663. source: "result: aTestResult\x0a\x09result := aTestResult",
  45664. referencedClasses: [],
  45665. messageSends: []
  45666. }),
  45667. $globals.ResultAnnouncement);
  45668. $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
  45669. $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.";
  45670. $core.addMethod(
  45671. $core.method({
  45672. selector: "assert:",
  45673. protocol: "testing",
  45674. fn: function (aBoolean){
  45675. var self=this;
  45676. return $core.withContext(function($ctx1) {
  45677. self._assert_description_(aBoolean,"Assertion failed");
  45678. return self;
  45679. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  45680. },
  45681. args: ["aBoolean"],
  45682. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  45683. referencedClasses: [],
  45684. messageSends: ["assert:description:"]
  45685. }),
  45686. $globals.TestCase);
  45687. $core.addMethod(
  45688. $core.method({
  45689. selector: "assert:description:",
  45690. protocol: "testing",
  45691. fn: function (aBoolean,aString){
  45692. var self=this;
  45693. return $core.withContext(function($ctx1) {
  45694. if(!$core.assert(aBoolean)){
  45695. self._signalFailure_(aString);
  45696. }
  45697. return self;
  45698. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  45699. },
  45700. args: ["aBoolean", "aString"],
  45701. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  45702. referencedClasses: [],
  45703. messageSends: ["ifFalse:", "signalFailure:"]
  45704. }),
  45705. $globals.TestCase);
  45706. $core.addMethod(
  45707. $core.method({
  45708. selector: "assert:equals:",
  45709. protocol: "testing",
  45710. fn: function (actual,expected){
  45711. var self=this;
  45712. return $core.withContext(function($ctx1) {
  45713. var $1,$5,$4,$3,$2;
  45714. $1=$recv(actual).__eq(expected);
  45715. $5=$recv(expected)._printString();
  45716. $ctx1.sendIdx["printString"]=1;
  45717. $4="Expected: ".__comma($5);
  45718. $3=$recv($4).__comma(" but was: ");
  45719. $ctx1.sendIdx[","]=2;
  45720. $2=$recv($3).__comma($recv(actual)._printString());
  45721. $ctx1.sendIdx[","]=1;
  45722. return self._assert_description_($1,$2);
  45723. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  45724. },
  45725. args: ["actual", "expected"],
  45726. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  45727. referencedClasses: [],
  45728. messageSends: ["assert:description:", "=", ",", "printString"]
  45729. }),
  45730. $globals.TestCase);
  45731. $core.addMethod(
  45732. $core.method({
  45733. selector: "async:",
  45734. protocol: "async",
  45735. fn: function (aBlock){
  45736. var self=this;
  45737. var c;
  45738. return $core.withContext(function($ctx1) {
  45739. var $1;
  45740. self._errorIfNotAsync_("#async");
  45741. c=self["@context"];
  45742. return (function(){
  45743. return $core.withContext(function($ctx2) {
  45744. $1=self._isAsync();
  45745. if($core.assert($1)){
  45746. return $recv(c)._execute_(aBlock);
  45747. }
  45748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45749. });
  45750. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  45751. },
  45752. args: ["aBlock"],
  45753. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  45754. referencedClasses: [],
  45755. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  45756. }),
  45757. $globals.TestCase);
  45758. $core.addMethod(
  45759. $core.method({
  45760. selector: "context:",
  45761. protocol: "accessing",
  45762. fn: function (aRunningTestContext){
  45763. var self=this;
  45764. self["@context"]=aRunningTestContext;
  45765. return self;
  45766. },
  45767. args: ["aRunningTestContext"],
  45768. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  45769. referencedClasses: [],
  45770. messageSends: []
  45771. }),
  45772. $globals.TestCase);
  45773. $core.addMethod(
  45774. $core.method({
  45775. selector: "deny:",
  45776. protocol: "testing",
  45777. fn: function (aBoolean){
  45778. var self=this;
  45779. return $core.withContext(function($ctx1) {
  45780. self._assert_($recv(aBoolean)._not());
  45781. return self;
  45782. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  45783. },
  45784. args: ["aBoolean"],
  45785. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  45786. referencedClasses: [],
  45787. messageSends: ["assert:", "not"]
  45788. }),
  45789. $globals.TestCase);
  45790. $core.addMethod(
  45791. $core.method({
  45792. selector: "errorIfNotAsync:",
  45793. protocol: "error handling",
  45794. fn: function (aString){
  45795. var self=this;
  45796. return $core.withContext(function($ctx1) {
  45797. var $1;
  45798. $1=self._isAsync();
  45799. if(!$core.assert($1)){
  45800. self._error_($recv(aString).__comma(" used without prior #timeout:"));
  45801. }
  45802. return self;
  45803. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  45804. },
  45805. args: ["aString"],
  45806. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  45807. referencedClasses: [],
  45808. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  45809. }),
  45810. $globals.TestCase);
  45811. $core.addMethod(
  45812. $core.method({
  45813. selector: "finished",
  45814. protocol: "async",
  45815. fn: function (){
  45816. var self=this;
  45817. return $core.withContext(function($ctx1) {
  45818. self._errorIfNotAsync_("#finished");
  45819. self["@asyncTimeout"]=nil;
  45820. return self;
  45821. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  45822. },
  45823. args: [],
  45824. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  45825. referencedClasses: [],
  45826. messageSends: ["errorIfNotAsync:"]
  45827. }),
  45828. $globals.TestCase);
  45829. $core.addMethod(
  45830. $core.method({
  45831. selector: "isAsync",
  45832. protocol: "testing",
  45833. fn: function (){
  45834. var self=this;
  45835. return $core.withContext(function($ctx1) {
  45836. return $recv(self["@asyncTimeout"])._notNil();
  45837. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  45838. },
  45839. args: [],
  45840. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  45841. referencedClasses: [],
  45842. messageSends: ["notNil"]
  45843. }),
  45844. $globals.TestCase);
  45845. $core.addMethod(
  45846. $core.method({
  45847. selector: "performTest",
  45848. protocol: "running",
  45849. fn: function (){
  45850. var self=this;
  45851. return $core.withContext(function($ctx1) {
  45852. self["@asyncTimeout"]=nil;
  45853. self._perform_(self._selector());
  45854. return self;
  45855. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  45856. },
  45857. args: [],
  45858. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  45859. referencedClasses: [],
  45860. messageSends: ["perform:", "selector"]
  45861. }),
  45862. $globals.TestCase);
  45863. $core.addMethod(
  45864. $core.method({
  45865. selector: "runCase",
  45866. protocol: "running",
  45867. fn: function (){
  45868. var self=this;
  45869. return $core.withContext(function($ctx1) {
  45870. $recv($recv($globals.TestContext)._testCase_(self))._start();
  45871. return self;
  45872. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  45873. },
  45874. args: [],
  45875. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  45876. referencedClasses: ["TestContext"],
  45877. messageSends: ["start", "testCase:"]
  45878. }),
  45879. $globals.TestCase);
  45880. $core.addMethod(
  45881. $core.method({
  45882. selector: "selector",
  45883. protocol: "accessing",
  45884. fn: function (){
  45885. var self=this;
  45886. return self["@testSelector"];
  45887. },
  45888. args: [],
  45889. source: "selector\x0a\x09^ testSelector",
  45890. referencedClasses: [],
  45891. messageSends: []
  45892. }),
  45893. $globals.TestCase);
  45894. $core.addMethod(
  45895. $core.method({
  45896. selector: "setTestSelector:",
  45897. protocol: "accessing",
  45898. fn: function (aSelector){
  45899. var self=this;
  45900. self["@testSelector"]=aSelector;
  45901. return self;
  45902. },
  45903. args: ["aSelector"],
  45904. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  45905. referencedClasses: [],
  45906. messageSends: []
  45907. }),
  45908. $globals.TestCase);
  45909. $core.addMethod(
  45910. $core.method({
  45911. selector: "setUp",
  45912. protocol: "running",
  45913. fn: function (){
  45914. var self=this;
  45915. return self;
  45916. },
  45917. args: [],
  45918. source: "setUp",
  45919. referencedClasses: [],
  45920. messageSends: []
  45921. }),
  45922. $globals.TestCase);
  45923. $core.addMethod(
  45924. $core.method({
  45925. selector: "should:",
  45926. protocol: "testing",
  45927. fn: function (aBlock){
  45928. var self=this;
  45929. return $core.withContext(function($ctx1) {
  45930. self._assert_($recv(aBlock)._value());
  45931. return self;
  45932. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  45933. },
  45934. args: ["aBlock"],
  45935. source: "should: aBlock\x0a\x09self assert: aBlock value",
  45936. referencedClasses: [],
  45937. messageSends: ["assert:", "value"]
  45938. }),
  45939. $globals.TestCase);
  45940. $core.addMethod(
  45941. $core.method({
  45942. selector: "should:raise:",
  45943. protocol: "testing",
  45944. fn: function (aBlock,anExceptionClass){
  45945. var self=this;
  45946. return $core.withContext(function($ctx1) {
  45947. self._assert_($recv((function(){
  45948. return $core.withContext(function($ctx2) {
  45949. $recv(aBlock)._value();
  45950. return false;
  45951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45952. }))._on_do_(anExceptionClass,(function(ex){
  45953. return true;
  45954. })));
  45955. return self;
  45956. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  45957. },
  45958. args: ["aBlock", "anExceptionClass"],
  45959. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  45960. referencedClasses: [],
  45961. messageSends: ["assert:", "on:do:", "value"]
  45962. }),
  45963. $globals.TestCase);
  45964. $core.addMethod(
  45965. $core.method({
  45966. selector: "shouldnt:raise:",
  45967. protocol: "testing",
  45968. fn: function (aBlock,anExceptionClass){
  45969. var self=this;
  45970. return $core.withContext(function($ctx1) {
  45971. self._assert_($recv((function(){
  45972. return $core.withContext(function($ctx2) {
  45973. $recv(aBlock)._value();
  45974. return true;
  45975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45976. }))._on_do_(anExceptionClass,(function(ex){
  45977. return false;
  45978. })));
  45979. return self;
  45980. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  45981. },
  45982. args: ["aBlock", "anExceptionClass"],
  45983. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  45984. referencedClasses: [],
  45985. messageSends: ["assert:", "on:do:", "value"]
  45986. }),
  45987. $globals.TestCase);
  45988. $core.addMethod(
  45989. $core.method({
  45990. selector: "signalFailure:",
  45991. protocol: "private",
  45992. fn: function (aString){
  45993. var self=this;
  45994. return $core.withContext(function($ctx1) {
  45995. var $1;
  45996. $1=$recv($globals.TestFailure)._new();
  45997. $recv($1)._messageText_(aString);
  45998. $recv($1)._signal();
  45999. return self;
  46000. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  46001. },
  46002. args: ["aString"],
  46003. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  46004. referencedClasses: ["TestFailure"],
  46005. messageSends: ["messageText:", "new", "signal"]
  46006. }),
  46007. $globals.TestCase);
  46008. $core.addMethod(
  46009. $core.method({
  46010. selector: "tearDown",
  46011. protocol: "running",
  46012. fn: function (){
  46013. var self=this;
  46014. return self;
  46015. },
  46016. args: [],
  46017. source: "tearDown",
  46018. referencedClasses: [],
  46019. messageSends: []
  46020. }),
  46021. $globals.TestCase);
  46022. $core.addMethod(
  46023. $core.method({
  46024. selector: "timeout:",
  46025. protocol: "async",
  46026. fn: function (aNumber){
  46027. var self=this;
  46028. return $core.withContext(function($ctx1) {
  46029. var $1,$receiver;
  46030. $1=self["@asyncTimeout"];
  46031. if(($receiver = $1) == null || $receiver.isNil){
  46032. $1;
  46033. } else {
  46034. $recv(self["@asyncTimeout"])._clearTimeout();
  46035. }
  46036. self["@asyncTimeout"]=(0);
  46037. self["@asyncTimeout"]=$recv(self._async_((function(){
  46038. return $core.withContext(function($ctx2) {
  46039. return self._assert_description_(false,"SUnit grace time exhausted");
  46040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46041. })))._valueWithTimeout_(aNumber);
  46042. return self;
  46043. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  46044. },
  46045. args: ["aNumber"],
  46046. 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",
  46047. referencedClasses: [],
  46048. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  46049. }),
  46050. $globals.TestCase);
  46051. $core.addMethod(
  46052. $core.method({
  46053. selector: "allTestSelectors",
  46054. protocol: "accessing",
  46055. fn: function (){
  46056. var self=this;
  46057. var selectors;
  46058. return $core.withContext(function($ctx1) {
  46059. var $1;
  46060. selectors=self._testSelectors();
  46061. $1=self._shouldInheritSelectors();
  46062. if($core.assert($1)){
  46063. $recv(selectors)._addAll_($recv(self._superclass())._allTestSelectors());
  46064. }
  46065. return selectors;
  46066. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.klass)});
  46067. },
  46068. args: [],
  46069. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  46070. referencedClasses: [],
  46071. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  46072. }),
  46073. $globals.TestCase.klass);
  46074. $core.addMethod(
  46075. $core.method({
  46076. selector: "buildSuite",
  46077. protocol: "accessing",
  46078. fn: function (){
  46079. var self=this;
  46080. return $core.withContext(function($ctx1) {
  46081. return $recv(self._allTestSelectors())._collect_((function(each){
  46082. return $core.withContext(function($ctx2) {
  46083. return self._selector_(each);
  46084. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46085. }));
  46086. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.klass)});
  46087. },
  46088. args: [],
  46089. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  46090. referencedClasses: [],
  46091. messageSends: ["collect:", "allTestSelectors", "selector:"]
  46092. }),
  46093. $globals.TestCase.klass);
  46094. $core.addMethod(
  46095. $core.method({
  46096. selector: "classTag",
  46097. protocol: "accessing",
  46098. fn: function (){
  46099. var self=this;
  46100. return "test";
  46101. },
  46102. args: [],
  46103. 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'",
  46104. referencedClasses: [],
  46105. messageSends: []
  46106. }),
  46107. $globals.TestCase.klass);
  46108. $core.addMethod(
  46109. $core.method({
  46110. selector: "isAbstract",
  46111. protocol: "testing",
  46112. fn: function (){
  46113. var self=this;
  46114. return $core.withContext(function($ctx1) {
  46115. return $recv(self._name()).__eq("TestCase");
  46116. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.klass)});
  46117. },
  46118. args: [],
  46119. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  46120. referencedClasses: [],
  46121. messageSends: ["=", "name"]
  46122. }),
  46123. $globals.TestCase.klass);
  46124. $core.addMethod(
  46125. $core.method({
  46126. selector: "isTestClass",
  46127. protocol: "testing",
  46128. fn: function (){
  46129. var self=this;
  46130. return $core.withContext(function($ctx1) {
  46131. return $recv(self._isAbstract())._not();
  46132. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.TestCase.klass)});
  46133. },
  46134. args: [],
  46135. source: "isTestClass\x0a\x09^ self isAbstract not",
  46136. referencedClasses: [],
  46137. messageSends: ["not", "isAbstract"]
  46138. }),
  46139. $globals.TestCase.klass);
  46140. $core.addMethod(
  46141. $core.method({
  46142. selector: "lookupHierarchyRoot",
  46143. protocol: "accessing",
  46144. fn: function (){
  46145. var self=this;
  46146. return $globals.TestCase;
  46147. },
  46148. args: [],
  46149. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  46150. referencedClasses: ["TestCase"],
  46151. messageSends: []
  46152. }),
  46153. $globals.TestCase.klass);
  46154. $core.addMethod(
  46155. $core.method({
  46156. selector: "selector:",
  46157. protocol: "accessing",
  46158. fn: function (aSelector){
  46159. var self=this;
  46160. return $core.withContext(function($ctx1) {
  46161. var $1;
  46162. $1=self._new();
  46163. $recv($1)._setTestSelector_(aSelector);
  46164. return $recv($1)._yourself();
  46165. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.klass)});
  46166. },
  46167. args: ["aSelector"],
  46168. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  46169. referencedClasses: [],
  46170. messageSends: ["setTestSelector:", "new", "yourself"]
  46171. }),
  46172. $globals.TestCase.klass);
  46173. $core.addMethod(
  46174. $core.method({
  46175. selector: "shouldInheritSelectors",
  46176. protocol: "testing",
  46177. fn: function (){
  46178. var self=this;
  46179. return $core.withContext(function($ctx1) {
  46180. return self.__tild_eq(self._lookupHierarchyRoot());
  46181. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.klass)});
  46182. },
  46183. args: [],
  46184. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  46185. referencedClasses: [],
  46186. messageSends: ["~=", "lookupHierarchyRoot"]
  46187. }),
  46188. $globals.TestCase.klass);
  46189. $core.addMethod(
  46190. $core.method({
  46191. selector: "testSelectors",
  46192. protocol: "accessing",
  46193. fn: function (){
  46194. var self=this;
  46195. return $core.withContext(function($ctx1) {
  46196. return $recv($recv(self._methodDictionary())._keys())._select_((function(each){
  46197. return $core.withContext(function($ctx2) {
  46198. return $recv(each)._match_("^test");
  46199. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46200. }));
  46201. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.klass)});
  46202. },
  46203. args: [],
  46204. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  46205. referencedClasses: [],
  46206. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  46207. }),
  46208. $globals.TestCase.klass);
  46209. $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
  46210. $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).";
  46211. $core.addMethod(
  46212. $core.method({
  46213. selector: "execute:",
  46214. protocol: "running",
  46215. fn: function (aBlock){
  46216. var self=this;
  46217. var failed;
  46218. return $core.withContext(function($ctx1) {
  46219. var $1,$2;
  46220. $recv(self["@testCase"])._context_(self);
  46221. $ctx1.sendIdx["context:"]=1;
  46222. $recv((function(){
  46223. return $core.withContext(function($ctx2) {
  46224. failed=true;
  46225. failed;
  46226. $recv(aBlock)._value();
  46227. failed=false;
  46228. return failed;
  46229. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46230. }))._ensure_((function(){
  46231. return $core.withContext(function($ctx2) {
  46232. $recv(self["@testCase"])._context_(nil);
  46233. $1=$recv(failed)._and_((function(){
  46234. return $core.withContext(function($ctx3) {
  46235. return $recv(self["@testCase"])._isAsync();
  46236. $ctx3.sendIdx["isAsync"]=1;
  46237. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  46238. }));
  46239. if($core.assert($1)){
  46240. $recv(self["@testCase"])._finished();
  46241. }
  46242. $2=$recv(self["@testCase"])._isAsync();
  46243. if(!$core.assert($2)){
  46244. return $recv(self["@testCase"])._tearDown();
  46245. }
  46246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46247. }));
  46248. return self;
  46249. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  46250. },
  46251. args: ["aBlock"],
  46252. 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 ] ]",
  46253. referencedClasses: [],
  46254. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  46255. }),
  46256. $globals.TestContext);
  46257. $core.addMethod(
  46258. $core.method({
  46259. selector: "start",
  46260. protocol: "running",
  46261. fn: function (){
  46262. var self=this;
  46263. return $core.withContext(function($ctx1) {
  46264. self._execute_((function(){
  46265. return $core.withContext(function($ctx2) {
  46266. $recv(self["@testCase"])._setUp();
  46267. return $recv(self["@testCase"])._performTest();
  46268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46269. }));
  46270. return self;
  46271. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  46272. },
  46273. args: [],
  46274. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  46275. referencedClasses: [],
  46276. messageSends: ["execute:", "setUp", "performTest"]
  46277. }),
  46278. $globals.TestContext);
  46279. $core.addMethod(
  46280. $core.method({
  46281. selector: "testCase:",
  46282. protocol: "accessing",
  46283. fn: function (aTestCase){
  46284. var self=this;
  46285. self["@testCase"]=aTestCase;
  46286. return self;
  46287. },
  46288. args: ["aTestCase"],
  46289. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  46290. referencedClasses: [],
  46291. messageSends: []
  46292. }),
  46293. $globals.TestContext);
  46294. $core.addMethod(
  46295. $core.method({
  46296. selector: "testCase:",
  46297. protocol: "instance creation",
  46298. fn: function (aTestCase){
  46299. var self=this;
  46300. return $core.withContext(function($ctx1) {
  46301. var $1;
  46302. $1=self._new();
  46303. $recv($1)._testCase_(aTestCase);
  46304. return $recv($1)._yourself();
  46305. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.klass)});
  46306. },
  46307. args: ["aTestCase"],
  46308. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  46309. referencedClasses: [],
  46310. messageSends: ["testCase:", "new", "yourself"]
  46311. }),
  46312. $globals.TestContext.klass);
  46313. $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  46314. $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`.";
  46315. $core.addMethod(
  46316. $core.method({
  46317. selector: "execute:",
  46318. protocol: "running",
  46319. fn: function (aBlock){
  46320. var self=this;
  46321. return $core.withContext(function($ctx1) {
  46322. var $1;
  46323. $recv((function(){
  46324. return $core.withContext(function($ctx2) {
  46325. return self._withErrorReporting_((function(){
  46326. return $core.withContext(function($ctx3) {
  46327. return (
  46328. $ctx3.supercall = true,
  46329. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($recv(self), [aBlock]));
  46330. $ctx3.supercall = false;
  46331. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46332. }));
  46333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46334. }))._ensure_((function(){
  46335. return $core.withContext(function($ctx2) {
  46336. $1=$recv(self["@testCase"])._isAsync();
  46337. if(!$core.assert($1)){
  46338. $recv(self["@result"])._increaseRuns();
  46339. return $recv(self["@finished"])._value();
  46340. }
  46341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46342. }));
  46343. return self;
  46344. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  46345. },
  46346. args: ["aBlock"],
  46347. 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 ] ]",
  46348. referencedClasses: [],
  46349. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  46350. }),
  46351. $globals.ReportingTestContext);
  46352. $core.addMethod(
  46353. $core.method({
  46354. selector: "finished:",
  46355. protocol: "accessing",
  46356. fn: function (aBlock){
  46357. var self=this;
  46358. self["@finished"]=aBlock;
  46359. return self;
  46360. },
  46361. args: ["aBlock"],
  46362. source: "finished: aBlock\x0a\x09finished := aBlock",
  46363. referencedClasses: [],
  46364. messageSends: []
  46365. }),
  46366. $globals.ReportingTestContext);
  46367. $core.addMethod(
  46368. $core.method({
  46369. selector: "result:",
  46370. protocol: "accessing",
  46371. fn: function (aTestResult){
  46372. var self=this;
  46373. self["@result"]=aTestResult;
  46374. return self;
  46375. },
  46376. args: ["aTestResult"],
  46377. source: "result: aTestResult\x0a\x09result := aTestResult",
  46378. referencedClasses: [],
  46379. messageSends: []
  46380. }),
  46381. $globals.ReportingTestContext);
  46382. $core.addMethod(
  46383. $core.method({
  46384. selector: "withErrorReporting:",
  46385. protocol: "private",
  46386. fn: function (aBlock){
  46387. var self=this;
  46388. return $core.withContext(function($ctx1) {
  46389. $recv((function(){
  46390. return $core.withContext(function($ctx2) {
  46391. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  46392. return $core.withContext(function($ctx3) {
  46393. return $recv(self["@result"])._addFailure_(self["@testCase"]);
  46394. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  46395. }));
  46396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46397. }))._on_do_($globals.Error,(function(ex){
  46398. return $core.withContext(function($ctx2) {
  46399. return $recv(self["@result"])._addError_(self["@testCase"]);
  46400. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  46401. }));
  46402. $ctx1.sendIdx["on:do:"]=1;
  46403. return self;
  46404. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  46405. },
  46406. args: ["aBlock"],
  46407. 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 ]",
  46408. referencedClasses: ["TestFailure", "Error"],
  46409. messageSends: ["on:do:", "addFailure:", "addError:"]
  46410. }),
  46411. $globals.ReportingTestContext);
  46412. $core.addMethod(
  46413. $core.method({
  46414. selector: "testCase:result:finished:",
  46415. protocol: "instance creation",
  46416. fn: function (aTestCase,aTestResult,aBlock){
  46417. var self=this;
  46418. return $core.withContext(function($ctx1) {
  46419. var $1;
  46420. $1=(
  46421. $ctx1.supercall = true,
  46422. ($globals.ReportingTestContext.klass.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($recv(self), [aTestCase]));
  46423. $ctx1.supercall = false;
  46424. $recv($1)._result_(aTestResult);
  46425. $recv($1)._finished_(aBlock);
  46426. return $recv($1)._yourself();
  46427. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.klass)});
  46428. },
  46429. args: ["aTestCase", "aTestResult", "aBlock"],
  46430. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  46431. referencedClasses: [],
  46432. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  46433. }),
  46434. $globals.ReportingTestContext.klass);
  46435. $core.addClass("TestFailure", $globals.Error, [], "SUnit");
  46436. $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.";
  46437. $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
  46438. $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";
  46439. $core.addMethod(
  46440. $core.method({
  46441. selector: "addError:",
  46442. protocol: "accessing",
  46443. fn: function (anError){
  46444. var self=this;
  46445. return $core.withContext(function($ctx1) {
  46446. $recv(self._errors())._add_(anError);
  46447. return self;
  46448. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  46449. },
  46450. args: ["anError"],
  46451. source: "addError: anError\x0a\x09self errors add: anError",
  46452. referencedClasses: [],
  46453. messageSends: ["add:", "errors"]
  46454. }),
  46455. $globals.TestResult);
  46456. $core.addMethod(
  46457. $core.method({
  46458. selector: "addFailure:",
  46459. protocol: "accessing",
  46460. fn: function (aFailure){
  46461. var self=this;
  46462. return $core.withContext(function($ctx1) {
  46463. $recv(self._failures())._add_(aFailure);
  46464. return self;
  46465. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  46466. },
  46467. args: ["aFailure"],
  46468. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  46469. referencedClasses: [],
  46470. messageSends: ["add:", "failures"]
  46471. }),
  46472. $globals.TestResult);
  46473. $core.addMethod(
  46474. $core.method({
  46475. selector: "errors",
  46476. protocol: "accessing",
  46477. fn: function (){
  46478. var self=this;
  46479. return self["@errors"];
  46480. },
  46481. args: [],
  46482. source: "errors\x0a\x09^ errors",
  46483. referencedClasses: [],
  46484. messageSends: []
  46485. }),
  46486. $globals.TestResult);
  46487. $core.addMethod(
  46488. $core.method({
  46489. selector: "failures",
  46490. protocol: "accessing",
  46491. fn: function (){
  46492. var self=this;
  46493. return self["@failures"];
  46494. },
  46495. args: [],
  46496. source: "failures\x0a\x09^ failures",
  46497. referencedClasses: [],
  46498. messageSends: []
  46499. }),
  46500. $globals.TestResult);
  46501. $core.addMethod(
  46502. $core.method({
  46503. selector: "increaseRuns",
  46504. protocol: "accessing",
  46505. fn: function (){
  46506. var self=this;
  46507. return $core.withContext(function($ctx1) {
  46508. self["@runs"]=$recv(self["@runs"]).__plus((1));
  46509. return self;
  46510. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  46511. },
  46512. args: [],
  46513. source: "increaseRuns\x0a\x09runs := runs + 1",
  46514. referencedClasses: [],
  46515. messageSends: ["+"]
  46516. }),
  46517. $globals.TestResult);
  46518. $core.addMethod(
  46519. $core.method({
  46520. selector: "initialize",
  46521. protocol: "initialization",
  46522. fn: function (){
  46523. var self=this;
  46524. return $core.withContext(function($ctx1) {
  46525. (
  46526. $ctx1.supercall = true,
  46527. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  46528. $ctx1.supercall = false;
  46529. self["@timestamp"]=$recv($globals.Date)._now();
  46530. self["@runs"]=(0);
  46531. self["@errors"]=$recv($globals.Array)._new();
  46532. $ctx1.sendIdx["new"]=1;
  46533. self["@failures"]=$recv($globals.Array)._new();
  46534. self["@total"]=(0);
  46535. return self;
  46536. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  46537. },
  46538. args: [],
  46539. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  46540. referencedClasses: ["Date", "Array"],
  46541. messageSends: ["initialize", "now", "new"]
  46542. }),
  46543. $globals.TestResult);
  46544. $core.addMethod(
  46545. $core.method({
  46546. selector: "nextRunDo:",
  46547. protocol: "running",
  46548. fn: function (aBlock){
  46549. var self=this;
  46550. return $core.withContext(function($ctx1) {
  46551. var $2,$1;
  46552. $2=self._runs();
  46553. $ctx1.sendIdx["runs"]=1;
  46554. $1=$recv($2).__eq_eq(self._total());
  46555. if(!$core.assert($1)){
  46556. return $recv(aBlock)._value_($recv(self._runs()).__plus((1)));
  46557. }
  46558. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  46559. },
  46560. args: ["aBlock"],
  46561. 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 ]",
  46562. referencedClasses: [],
  46563. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  46564. }),
  46565. $globals.TestResult);
  46566. $core.addMethod(
  46567. $core.method({
  46568. selector: "runCase:",
  46569. protocol: "running",
  46570. fn: function (aTestCase){
  46571. var self=this;
  46572. return $core.withContext(function($ctx1) {
  46573. $recv((function(){
  46574. return $core.withContext(function($ctx2) {
  46575. return $recv((function(){
  46576. return $core.withContext(function($ctx3) {
  46577. self._increaseRuns();
  46578. return $recv(aTestCase)._runCase();
  46579. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46580. }))._on_do_($globals.TestFailure,(function(ex){
  46581. return $core.withContext(function($ctx3) {
  46582. return self._addFailure_(aTestCase);
  46583. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  46584. }));
  46585. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46586. }))._on_do_($globals.Error,(function(ex){
  46587. return $core.withContext(function($ctx2) {
  46588. return self._addError_(aTestCase);
  46589. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  46590. }));
  46591. $ctx1.sendIdx["on:do:"]=1;
  46592. return self;
  46593. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  46594. },
  46595. args: ["aTestCase"],
  46596. 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 ]",
  46597. referencedClasses: ["TestFailure", "Error"],
  46598. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  46599. }),
  46600. $globals.TestResult);
  46601. $core.addMethod(
  46602. $core.method({
  46603. selector: "runs",
  46604. protocol: "accessing",
  46605. fn: function (){
  46606. var self=this;
  46607. return self["@runs"];
  46608. },
  46609. args: [],
  46610. source: "runs\x0a\x09^ runs",
  46611. referencedClasses: [],
  46612. messageSends: []
  46613. }),
  46614. $globals.TestResult);
  46615. $core.addMethod(
  46616. $core.method({
  46617. selector: "status",
  46618. protocol: "accessing",
  46619. fn: function (){
  46620. var self=this;
  46621. return $core.withContext(function($ctx1) {
  46622. var $1;
  46623. $1=$recv(self._errors())._ifNotEmpty_ifEmpty_((function(){
  46624. return "error";
  46625. }),(function(){
  46626. return $core.withContext(function($ctx2) {
  46627. return $recv(self._failures())._ifNotEmpty_ifEmpty_((function(){
  46628. return "failure";
  46629. }),(function(){
  46630. return "success";
  46631. }));
  46632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46633. }));
  46634. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  46635. return $1;
  46636. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  46637. },
  46638. args: [],
  46639. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  46640. referencedClasses: [],
  46641. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  46642. }),
  46643. $globals.TestResult);
  46644. $core.addMethod(
  46645. $core.method({
  46646. selector: "timestamp",
  46647. protocol: "accessing",
  46648. fn: function (){
  46649. var self=this;
  46650. return self["@timestamp"];
  46651. },
  46652. args: [],
  46653. source: "timestamp\x0a\x09^ timestamp",
  46654. referencedClasses: [],
  46655. messageSends: []
  46656. }),
  46657. $globals.TestResult);
  46658. $core.addMethod(
  46659. $core.method({
  46660. selector: "total",
  46661. protocol: "accessing",
  46662. fn: function (){
  46663. var self=this;
  46664. return self["@total"];
  46665. },
  46666. args: [],
  46667. source: "total\x0a\x09^ total",
  46668. referencedClasses: [],
  46669. messageSends: []
  46670. }),
  46671. $globals.TestResult);
  46672. $core.addMethod(
  46673. $core.method({
  46674. selector: "total:",
  46675. protocol: "accessing",
  46676. fn: function (aNumber){
  46677. var self=this;
  46678. self["@total"]=aNumber;
  46679. return self;
  46680. },
  46681. args: ["aNumber"],
  46682. source: "total: aNumber\x0a\x09total := aNumber",
  46683. referencedClasses: [],
  46684. messageSends: []
  46685. }),
  46686. $globals.TestResult);
  46687. $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
  46688. $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`.";
  46689. $core.addMethod(
  46690. $core.method({
  46691. selector: "announcer",
  46692. protocol: "accessing",
  46693. fn: function (){
  46694. var self=this;
  46695. return self["@announcer"];
  46696. },
  46697. args: [],
  46698. source: "announcer\x0a\x09^ announcer",
  46699. referencedClasses: [],
  46700. messageSends: []
  46701. }),
  46702. $globals.TestSuiteRunner);
  46703. $core.addMethod(
  46704. $core.method({
  46705. selector: "contextOf:",
  46706. protocol: "private",
  46707. fn: function (anInteger){
  46708. var self=this;
  46709. return $core.withContext(function($ctx1) {
  46710. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv(self["@suite"])._at_(anInteger),self["@result"],(function(){
  46711. return $core.withContext(function($ctx2) {
  46712. return self._resume();
  46713. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46714. }));
  46715. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  46716. },
  46717. args: ["anInteger"],
  46718. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  46719. referencedClasses: ["ReportingTestContext"],
  46720. messageSends: ["testCase:result:finished:", "at:", "resume"]
  46721. }),
  46722. $globals.TestSuiteRunner);
  46723. $core.addMethod(
  46724. $core.method({
  46725. selector: "initialize",
  46726. protocol: "initialization",
  46727. fn: function (){
  46728. var self=this;
  46729. return $core.withContext(function($ctx1) {
  46730. var $1;
  46731. (
  46732. $ctx1.supercall = true,
  46733. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  46734. $ctx1.supercall = false;
  46735. self["@announcer"]=$recv($globals.Announcer)._new();
  46736. $ctx1.sendIdx["new"]=1;
  46737. self["@result"]=$recv($globals.TestResult)._new();
  46738. self["@runNextTest"]=(function(){
  46739. var runs;
  46740. return $core.withContext(function($ctx2) {
  46741. runs=$recv(self["@result"])._runs();
  46742. runs;
  46743. $1=$recv(runs).__lt($recv(self["@result"])._total());
  46744. if($core.assert($1)){
  46745. return $recv(self._contextOf_($recv(runs).__plus((1))))._start();
  46746. }
  46747. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  46748. });
  46749. return self;
  46750. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  46751. },
  46752. args: [],
  46753. 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 ] ].",
  46754. referencedClasses: ["Announcer", "TestResult"],
  46755. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  46756. }),
  46757. $globals.TestSuiteRunner);
  46758. $core.addMethod(
  46759. $core.method({
  46760. selector: "result",
  46761. protocol: "accessing",
  46762. fn: function (){
  46763. var self=this;
  46764. return self["@result"];
  46765. },
  46766. args: [],
  46767. source: "result\x0a\x09^ result",
  46768. referencedClasses: [],
  46769. messageSends: []
  46770. }),
  46771. $globals.TestSuiteRunner);
  46772. $core.addMethod(
  46773. $core.method({
  46774. selector: "resume",
  46775. protocol: "actions",
  46776. fn: function (){
  46777. var self=this;
  46778. return $core.withContext(function($ctx1) {
  46779. $recv(self["@runNextTest"])._fork();
  46780. $recv(self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_(self["@result"]));
  46781. return self;
  46782. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  46783. },
  46784. args: [],
  46785. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  46786. referencedClasses: ["ResultAnnouncement"],
  46787. messageSends: ["fork", "announce:", "result:", "new"]
  46788. }),
  46789. $globals.TestSuiteRunner);
  46790. $core.addMethod(
  46791. $core.method({
  46792. selector: "run",
  46793. protocol: "actions",
  46794. fn: function (){
  46795. var self=this;
  46796. return $core.withContext(function($ctx1) {
  46797. $recv(self["@result"])._total_($recv(self["@suite"])._size());
  46798. self._resume();
  46799. return self;
  46800. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  46801. },
  46802. args: [],
  46803. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  46804. referencedClasses: [],
  46805. messageSends: ["total:", "size", "resume"]
  46806. }),
  46807. $globals.TestSuiteRunner);
  46808. $core.addMethod(
  46809. $core.method({
  46810. selector: "suite:",
  46811. protocol: "accessing",
  46812. fn: function (aCollection){
  46813. var self=this;
  46814. self["@suite"]=aCollection;
  46815. return self;
  46816. },
  46817. args: ["aCollection"],
  46818. source: "suite: aCollection\x0a\x09suite := aCollection",
  46819. referencedClasses: [],
  46820. messageSends: []
  46821. }),
  46822. $globals.TestSuiteRunner);
  46823. $core.addMethod(
  46824. $core.method({
  46825. selector: "new",
  46826. protocol: "instance creation",
  46827. fn: function (){
  46828. var self=this;
  46829. return $core.withContext(function($ctx1) {
  46830. self._shouldNotImplement();
  46831. return self;
  46832. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.klass)});
  46833. },
  46834. args: [],
  46835. source: "new\x0a\x09self shouldNotImplement",
  46836. referencedClasses: [],
  46837. messageSends: ["shouldNotImplement"]
  46838. }),
  46839. $globals.TestSuiteRunner.klass);
  46840. $core.addMethod(
  46841. $core.method({
  46842. selector: "on:",
  46843. protocol: "instance creation",
  46844. fn: function (aCollection){
  46845. var self=this;
  46846. return $core.withContext(function($ctx1) {
  46847. var $1;
  46848. $1=(
  46849. $ctx1.supercall = true,
  46850. ($globals.TestSuiteRunner.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  46851. $ctx1.supercall = false;
  46852. return $recv($1)._suite_(aCollection);
  46853. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.klass)});
  46854. },
  46855. args: ["aCollection"],
  46856. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  46857. referencedClasses: [],
  46858. messageSends: ["suite:", "new"]
  46859. }),
  46860. $globals.TestSuiteRunner.klass);
  46861. $core.addMethod(
  46862. $core.method({
  46863. selector: "isTestClass",
  46864. protocol: "*SUnit",
  46865. fn: function (){
  46866. var self=this;
  46867. return false;
  46868. },
  46869. args: [],
  46870. source: "isTestClass\x0a\x09^ false",
  46871. referencedClasses: [],
  46872. messageSends: []
  46873. }),
  46874. $globals.BehaviorBody);
  46875. $core.addMethod(
  46876. $core.method({
  46877. selector: "isTestPackage",
  46878. protocol: "*SUnit",
  46879. fn: function (){
  46880. var self=this;
  46881. return $core.withContext(function($ctx1) {
  46882. return $recv(self._classes())._anySatisfy_((function(each){
  46883. return $core.withContext(function($ctx2) {
  46884. return $recv(each)._isTestClass();
  46885. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46886. }));
  46887. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  46888. },
  46889. args: [],
  46890. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  46891. referencedClasses: [],
  46892. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  46893. }),
  46894. $globals.Package);
  46895. });
  46896. define('amber_core/Compiler-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  46897. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  46898. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  46899. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  46900. $core.addPackage("Compiler-Tests");
  46901. $core.packages["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  46902. $core.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46903. $core.addClass("ASTParsingTest", $globals.TestCase, [], "Compiler-Tests");
  46904. $core.addMethod(
  46905. $core.method({
  46906. selector: "analyze:forClass:",
  46907. protocol: "convenience",
  46908. fn: function (aNode,aClass){
  46909. var self=this;
  46910. return $core.withContext(function($ctx1) {
  46911. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  46912. return aNode;
  46913. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
  46914. },
  46915. args: ["aNode", "aClass"],
  46916. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  46917. referencedClasses: ["SemanticAnalyzer"],
  46918. messageSends: ["visit:", "on:"]
  46919. }),
  46920. $globals.ASTParsingTest);
  46921. $core.addMethod(
  46922. $core.method({
  46923. selector: "parse:",
  46924. protocol: "parsing",
  46925. fn: function (aString){
  46926. var self=this;
  46927. return $core.withContext(function($ctx1) {
  46928. return $recv($globals.Smalltalk)._parse_(aString);
  46929. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
  46930. },
  46931. args: ["aString"],
  46932. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  46933. referencedClasses: ["Smalltalk"],
  46934. messageSends: ["parse:"]
  46935. }),
  46936. $globals.ASTParsingTest);
  46937. $core.addMethod(
  46938. $core.method({
  46939. selector: "parse:forClass:",
  46940. protocol: "parsing",
  46941. fn: function (aString,aClass){
  46942. var self=this;
  46943. return $core.withContext(function($ctx1) {
  46944. return self._analyze_forClass_(self._parse_(aString),aClass);
  46945. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  46946. },
  46947. args: ["aString", "aClass"],
  46948. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  46949. referencedClasses: [],
  46950. messageSends: ["analyze:forClass:", "parse:"]
  46951. }),
  46952. $globals.ASTParsingTest);
  46953. $core.addClass("ASTPCNodeVisitorTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  46954. $core.addMethod(
  46955. $core.method({
  46956. selector: "astPCNodeVisitor",
  46957. protocol: "factory",
  46958. fn: function (){
  46959. var self=this;
  46960. return $core.withContext(function($ctx1) {
  46961. var $1;
  46962. $1=$recv($globals.ASTPCNodeVisitor)._new();
  46963. $recv($1)._index_((0));
  46964. return $recv($1)._yourself();
  46965. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  46966. },
  46967. args: [],
  46968. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  46969. referencedClasses: ["ASTPCNodeVisitor"],
  46970. messageSends: ["index:", "new", "yourself"]
  46971. }),
  46972. $globals.ASTPCNodeVisitorTest);
  46973. $core.addMethod(
  46974. $core.method({
  46975. selector: "astPCNodeVisitorForSelector:",
  46976. protocol: "factory",
  46977. fn: function (aString){
  46978. var self=this;
  46979. return $core.withContext(function($ctx1) {
  46980. var $1;
  46981. $1=$recv($globals.ASTPCNodeVisitor)._new();
  46982. $recv($1)._selector_(aString);
  46983. $recv($1)._index_((0));
  46984. return $recv($1)._yourself();
  46985. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  46986. },
  46987. args: ["aString"],
  46988. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  46989. referencedClasses: ["ASTPCNodeVisitor"],
  46990. messageSends: ["selector:", "new", "index:", "yourself"]
  46991. }),
  46992. $globals.ASTPCNodeVisitorTest);
  46993. $core.addMethod(
  46994. $core.method({
  46995. selector: "testJSStatementNode",
  46996. protocol: "tests",
  46997. fn: function (){
  46998. var self=this;
  46999. var ast,visitor;
  47000. return $core.withContext(function($ctx1) {
  47001. var $3,$2,$1;
  47002. ast=self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  47003. $3=self._astPCNodeVisitor();
  47004. $recv($3)._visit_(ast);
  47005. $2=$recv($3)._currentNode();
  47006. $1=$recv($2)._isJSStatementNode();
  47007. self._assert_($1);
  47008. return self;
  47009. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  47010. },
  47011. args: [],
  47012. 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",
  47013. referencedClasses: ["Object"],
  47014. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  47015. }),
  47016. $globals.ASTPCNodeVisitorTest);
  47017. $core.addMethod(
  47018. $core.method({
  47019. selector: "testLegacyJSStatementNode",
  47020. protocol: "tests",
  47021. fn: function (){
  47022. var self=this;
  47023. var ast,visitor;
  47024. return $core.withContext(function($ctx1) {
  47025. var $3,$2,$1;
  47026. ast=self._parse_forClass_("foo <consolee.log(1)>",$globals.Object);
  47027. $3=self._astPCNodeVisitor();
  47028. $recv($3)._visit_(ast);
  47029. $2=$recv($3)._currentNode();
  47030. $1=$recv($2)._isJSStatementNode();
  47031. self._assert_($1);
  47032. return self;
  47033. }, function($ctx1) {$ctx1.fill(self,"testLegacyJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  47034. },
  47035. args: [],
  47036. source: "testLegacyJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <consolee.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  47037. referencedClasses: ["Object"],
  47038. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  47039. }),
  47040. $globals.ASTPCNodeVisitorTest);
  47041. $core.addMethod(
  47042. $core.method({
  47043. selector: "testMessageSend",
  47044. protocol: "tests",
  47045. fn: function (){
  47046. var self=this;
  47047. var ast;
  47048. return $core.withContext(function($ctx1) {
  47049. var $3,$2,$1;
  47050. ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  47051. $3=self._astPCNodeVisitorForSelector_("yourself");
  47052. $recv($3)._visit_(ast);
  47053. $2=$recv($3)._currentNode();
  47054. $1=$recv($2)._selector();
  47055. self._assert_equals_($1,"yourself");
  47056. return self;
  47057. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  47058. },
  47059. args: [],
  47060. 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'",
  47061. referencedClasses: ["Object"],
  47062. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  47063. }),
  47064. $globals.ASTPCNodeVisitorTest);
  47065. $core.addMethod(
  47066. $core.method({
  47067. selector: "testMessageSendWithBlocks",
  47068. protocol: "tests",
  47069. fn: function (){
  47070. var self=this;
  47071. var ast;
  47072. return $core.withContext(function($ctx1) {
  47073. var $3,$2,$1;
  47074. ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  47075. $3=self._astPCNodeVisitorForSelector_("yourself");
  47076. $recv($3)._visit_(ast);
  47077. $2=$recv($3)._currentNode();
  47078. $1=$recv($2)._selector();
  47079. self._assert_equals_($1,"yourself");
  47080. return self;
  47081. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  47082. },
  47083. args: [],
  47084. 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'",
  47085. referencedClasses: ["Object"],
  47086. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  47087. }),
  47088. $globals.ASTPCNodeVisitorTest);
  47089. $core.addMethod(
  47090. $core.method({
  47091. selector: "testMessageSendWithInlining",
  47092. protocol: "tests",
  47093. fn: function (){
  47094. var self=this;
  47095. var ast;
  47096. return $core.withContext(function($ctx1) {
  47097. var $3,$4,$2,$1,$7,$6,$5;
  47098. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  47099. $ctx1.sendIdx["parse:forClass:"]=1;
  47100. $3=self._astPCNodeVisitorForSelector_("yourself");
  47101. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  47102. $recv($3)._visit_(ast);
  47103. $ctx1.sendIdx["visit:"]=1;
  47104. $4=$recv($3)._currentNode();
  47105. $ctx1.sendIdx["currentNode"]=1;
  47106. $2=$4;
  47107. $1=$recv($2)._selector();
  47108. $ctx1.sendIdx["selector"]=1;
  47109. self._assert_equals_($1,"yourself");
  47110. $ctx1.sendIdx["assert:equals:"]=1;
  47111. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  47112. $7=self._astPCNodeVisitorForSelector_("asBoolean");
  47113. $recv($7)._visit_(ast);
  47114. $6=$recv($7)._currentNode();
  47115. $5=$recv($6)._selector();
  47116. self._assert_equals_($5,"asBoolean");
  47117. return self;
  47118. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  47119. },
  47120. args: [],
  47121. 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'",
  47122. referencedClasses: ["Object"],
  47123. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  47124. }),
  47125. $globals.ASTPCNodeVisitorTest);
  47126. $core.addMethod(
  47127. $core.method({
  47128. selector: "testNoMessageSend",
  47129. protocol: "tests",
  47130. fn: function (){
  47131. var self=this;
  47132. var ast;
  47133. return $core.withContext(function($ctx1) {
  47134. var $3,$2,$1;
  47135. ast=self._parse_forClass_("foo ^ self",$globals.Object);
  47136. $3=self._astPCNodeVisitor();
  47137. $recv($3)._visit_(ast);
  47138. $2=$recv($3)._currentNode();
  47139. $1=$recv($2)._isNil();
  47140. self._assert_($1);
  47141. return self;
  47142. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  47143. },
  47144. args: [],
  47145. 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",
  47146. referencedClasses: ["Object"],
  47147. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  47148. }),
  47149. $globals.ASTPCNodeVisitorTest);
  47150. $core.addClass("ASTPositionTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  47151. $core.addMethod(
  47152. $core.method({
  47153. selector: "testNodeAtPosition",
  47154. protocol: "tests",
  47155. fn: function (){
  47156. var self=this;
  47157. var node;
  47158. return $core.withContext(function($ctx1) {
  47159. var $3,$4,$2,$1,$7,$8,$6,$5;
  47160. node=self._parse_("yourself\x0a\x09^ self");
  47161. $ctx1.sendIdx["parse:"]=1;
  47162. $3=node;
  47163. $4=(2).__at((4));
  47164. $ctx1.sendIdx["@"]=1;
  47165. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  47166. return nil;
  47167. }));
  47168. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  47169. $1=$recv($2)._source();
  47170. self._assert_equals_($1,"self");
  47171. $ctx1.sendIdx["assert:equals:"]=1;
  47172. node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  47173. $ctx1.sendIdx["parse:"]=2;
  47174. $7=node;
  47175. $8=(2).__at((7));
  47176. $ctx1.sendIdx["@"]=2;
  47177. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  47178. return nil;
  47179. }));
  47180. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  47181. $5=$recv($6)._selector();
  47182. $ctx1.sendIdx["selector"]=1;
  47183. self._assert_equals_($5,"ifTrue:");
  47184. $ctx1.sendIdx["assert:equals:"]=2;
  47185. node=self._parse_("foo\x0a\x09self foo; bar; baz");
  47186. self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  47187. return nil;
  47188. })))._selector(),"foo");
  47189. return self;
  47190. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  47191. },
  47192. args: [],
  47193. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  47194. referencedClasses: [],
  47195. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  47196. }),
  47197. $globals.ASTPositionTest);
  47198. $core.addClass("CodeGeneratorTest", $globals.ASTParsingTest, ["receiver"], "Compiler-Tests");
  47199. $core.addMethod(
  47200. $core.method({
  47201. selector: "codeGeneratorClass",
  47202. protocol: "accessing",
  47203. fn: function (){
  47204. var self=this;
  47205. return $globals.CodeGenerator;
  47206. },
  47207. args: [],
  47208. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  47209. referencedClasses: ["CodeGenerator"],
  47210. messageSends: []
  47211. }),
  47212. $globals.CodeGeneratorTest);
  47213. $core.addMethod(
  47214. $core.method({
  47215. selector: "compiler",
  47216. protocol: "factory",
  47217. fn: function (){
  47218. var self=this;
  47219. return $core.withContext(function($ctx1) {
  47220. var $1;
  47221. $1=$recv($globals.Compiler)._new();
  47222. $recv($1)._codeGeneratorClass_(self._codeGeneratorClass());
  47223. return $recv($1)._yourself();
  47224. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  47225. },
  47226. args: [],
  47227. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  47228. referencedClasses: ["Compiler"],
  47229. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  47230. }),
  47231. $globals.CodeGeneratorTest);
  47232. $core.addMethod(
  47233. $core.method({
  47234. selector: "setUp",
  47235. protocol: "initialization",
  47236. fn: function (){
  47237. var self=this;
  47238. return $core.withContext(function($ctx1) {
  47239. self["@receiver"]=$recv($globals.DoIt)._new();
  47240. return self;
  47241. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  47242. },
  47243. args: [],
  47244. source: "setUp\x0a\x09receiver := DoIt new",
  47245. referencedClasses: ["DoIt"],
  47246. messageSends: ["new"]
  47247. }),
  47248. $globals.CodeGeneratorTest);
  47249. $core.addMethod(
  47250. $core.method({
  47251. selector: "should:receiver:raise:",
  47252. protocol: "testing",
  47253. fn: function (aString,anObject,anErrorClass){
  47254. var self=this;
  47255. var method,result;
  47256. return $core.withContext(function($ctx1) {
  47257. var $1,$2,$3,$receiver;
  47258. self["@receiver"]=anObject;
  47259. $recv((function(){
  47260. return $core.withContext(function($ctx2) {
  47261. return self._should_raise_((function(){
  47262. return $core.withContext(function($ctx3) {
  47263. $1=self._compiler();
  47264. $2=$recv(anObject)._class();
  47265. $ctx3.sendIdx["class"]=1;
  47266. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  47267. method;
  47268. return $recv(self["@receiver"])._perform_($recv(method)._selector());
  47269. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47270. }),anErrorClass);
  47271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47272. }))._ensure_((function(){
  47273. return $core.withContext(function($ctx2) {
  47274. $3=method;
  47275. if(($receiver = $3) == null || $receiver.isNil){
  47276. return $3;
  47277. } else {
  47278. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  47279. }
  47280. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47281. }));
  47282. return self;
  47283. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  47284. },
  47285. args: ["aString", "anObject", "anErrorClass"],
  47286. 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 ] ]",
  47287. referencedClasses: [],
  47288. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  47289. }),
  47290. $globals.CodeGeneratorTest);
  47291. $core.addMethod(
  47292. $core.method({
  47293. selector: "should:receiver:return:",
  47294. protocol: "testing",
  47295. fn: function (aString,anObject,aResult){
  47296. var self=this;
  47297. var method,result;
  47298. return $core.withContext(function($ctx1) {
  47299. var $1,$2;
  47300. self["@receiver"]=anObject;
  47301. $1=self._compiler();
  47302. $2=$recv(anObject)._class();
  47303. $ctx1.sendIdx["class"]=1;
  47304. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  47305. result=$recv(self["@receiver"])._perform_($recv(method)._selector());
  47306. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  47307. self._assert_equals_(aResult,result);
  47308. return self;
  47309. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  47310. },
  47311. args: ["aString", "anObject", "aResult"],
  47312. 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",
  47313. referencedClasses: [],
  47314. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  47315. }),
  47316. $globals.CodeGeneratorTest);
  47317. $core.addMethod(
  47318. $core.method({
  47319. selector: "should:return:",
  47320. protocol: "testing",
  47321. fn: function (aString,anObject){
  47322. var self=this;
  47323. return $core.withContext(function($ctx1) {
  47324. return self._should_receiver_return_(aString,self["@receiver"],anObject);
  47325. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  47326. },
  47327. args: ["aString", "anObject"],
  47328. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  47329. referencedClasses: [],
  47330. messageSends: ["should:receiver:return:"]
  47331. }),
  47332. $globals.CodeGeneratorTest);
  47333. $core.addMethod(
  47334. $core.method({
  47335. selector: "tearDown",
  47336. protocol: "initialization",
  47337. fn: function (){
  47338. var self=this;
  47339. return self;
  47340. },
  47341. args: [],
  47342. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  47343. referencedClasses: [],
  47344. messageSends: []
  47345. }),
  47346. $globals.CodeGeneratorTest);
  47347. $core.addMethod(
  47348. $core.method({
  47349. selector: "testAssignment",
  47350. protocol: "tests",
  47351. fn: function (){
  47352. var self=this;
  47353. return $core.withContext(function($ctx1) {
  47354. self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  47355. $ctx1.sendIdx["should:return:"]=1;
  47356. self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  47357. $ctx1.sendIdx["should:return:"]=2;
  47358. self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  47359. return self;
  47360. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  47361. },
  47362. args: [],
  47363. 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",
  47364. referencedClasses: [],
  47365. messageSends: ["should:return:"]
  47366. }),
  47367. $globals.CodeGeneratorTest);
  47368. $core.addMethod(
  47369. $core.method({
  47370. selector: "testBackslashSelectors",
  47371. protocol: "tests",
  47372. fn: function (){
  47373. var self=this;
  47374. return $core.withContext(function($ctx1) {
  47375. self._should_return_("\x5c arg ^ 4",(4));
  47376. $ctx1.sendIdx["should:return:"]=1;
  47377. self._should_return_("\x5c\x5c arg ^ 42",(42));
  47378. return self;
  47379. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  47380. },
  47381. args: [],
  47382. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  47383. referencedClasses: [],
  47384. messageSends: ["should:return:"]
  47385. }),
  47386. $globals.CodeGeneratorTest);
  47387. $core.addMethod(
  47388. $core.method({
  47389. selector: "testBlockReturn",
  47390. protocol: "tests",
  47391. fn: function (){
  47392. var self=this;
  47393. return $core.withContext(function($ctx1) {
  47394. self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  47395. $ctx1.sendIdx["should:return:"]=1;
  47396. self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  47397. $ctx1.sendIdx["should:return:"]=2;
  47398. self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  47399. return self;
  47400. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  47401. },
  47402. args: [],
  47403. 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).",
  47404. referencedClasses: [],
  47405. messageSends: ["should:return:"]
  47406. }),
  47407. $globals.CodeGeneratorTest);
  47408. $core.addMethod(
  47409. $core.method({
  47410. selector: "testCascades",
  47411. protocol: "tests",
  47412. fn: function (){
  47413. var self=this;
  47414. return $core.withContext(function($ctx1) {
  47415. self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  47416. return self;
  47417. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  47418. },
  47419. args: [],
  47420. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  47421. referencedClasses: [],
  47422. messageSends: ["should:return:"]
  47423. }),
  47424. $globals.CodeGeneratorTest);
  47425. $core.addMethod(
  47426. $core.method({
  47427. selector: "testCascadesInDynamicArray",
  47428. protocol: "tests",
  47429. fn: function (){
  47430. var self=this;
  47431. return $core.withContext(function($ctx1) {
  47432. self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  47433. return self;
  47434. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  47435. },
  47436. args: [],
  47437. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  47438. referencedClasses: [],
  47439. messageSends: ["should:return:"]
  47440. }),
  47441. $globals.CodeGeneratorTest);
  47442. $core.addMethod(
  47443. $core.method({
  47444. selector: "testCascadesInDynamicDictioary",
  47445. protocol: "tests",
  47446. fn: function (){
  47447. var self=this;
  47448. return $core.withContext(function($ctx1) {
  47449. self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  47450. return self;
  47451. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  47452. },
  47453. args: [],
  47454. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  47455. referencedClasses: [],
  47456. messageSends: ["should:return:"]
  47457. }),
  47458. $globals.CodeGeneratorTest);
  47459. $core.addMethod(
  47460. $core.method({
  47461. selector: "testCascadesInSend",
  47462. protocol: "tests",
  47463. fn: function (){
  47464. var self=this;
  47465. return $core.withContext(function($ctx1) {
  47466. self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  47467. return self;
  47468. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  47469. },
  47470. args: [],
  47471. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  47472. referencedClasses: [],
  47473. messageSends: ["should:return:"]
  47474. }),
  47475. $globals.CodeGeneratorTest);
  47476. $core.addMethod(
  47477. $core.method({
  47478. selector: "testCascadesWithInlining",
  47479. protocol: "tests",
  47480. fn: function (){
  47481. var self=this;
  47482. return $core.withContext(function($ctx1) {
  47483. self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  47484. $ctx1.sendIdx["should:return:"]=1;
  47485. self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  47486. return self;
  47487. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  47488. },
  47489. args: [],
  47490. 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",
  47491. referencedClasses: [],
  47492. messageSends: ["should:return:"]
  47493. }),
  47494. $globals.CodeGeneratorTest);
  47495. $core.addMethod(
  47496. $core.method({
  47497. selector: "testDynamicArrayElementsOrdered",
  47498. protocol: "tests",
  47499. fn: function (){
  47500. var self=this;
  47501. return $core.withContext(function($ctx1) {
  47502. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  47503. $ctx1.sendIdx["should:return:"]=1;
  47504. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  47505. return self;
  47506. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  47507. },
  47508. args: [],
  47509. 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).",
  47510. referencedClasses: [],
  47511. messageSends: ["should:return:"]
  47512. }),
  47513. $globals.CodeGeneratorTest);
  47514. $core.addMethod(
  47515. $core.method({
  47516. selector: "testDynamicDictionaryElementsOrdered",
  47517. protocol: "tests",
  47518. fn: function (){
  47519. var self=this;
  47520. return $core.withContext(function($ctx1) {
  47521. 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)]));
  47522. return self;
  47523. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  47524. },
  47525. args: [],
  47526. 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}.",
  47527. referencedClasses: [],
  47528. messageSends: ["should:return:"]
  47529. }),
  47530. $globals.CodeGeneratorTest);
  47531. $core.addMethod(
  47532. $core.method({
  47533. selector: "testDynamicDictionaryWithMoreArrows",
  47534. protocol: "tests",
  47535. fn: function (){
  47536. var self=this;
  47537. return $core.withContext(function($ctx1) {
  47538. var $2,$1;
  47539. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  47540. $ctx1.sendIdx["->"]=1;
  47541. $1=$recv($globals.HashedCollection)._with_($2);
  47542. self._should_return_("foo ^ #{1->2->3}",$1);
  47543. return self;
  47544. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  47545. },
  47546. args: [],
  47547. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  47548. referencedClasses: ["HashedCollection"],
  47549. messageSends: ["should:return:", "with:", "->"]
  47550. }),
  47551. $globals.CodeGeneratorTest);
  47552. $core.addMethod(
  47553. $core.method({
  47554. selector: "testGlobalVar",
  47555. protocol: "tests",
  47556. fn: function (){
  47557. var self=this;
  47558. return $core.withContext(function($ctx1) {
  47559. self._should_return_("foo ^ eval class",$globals.BlockClosure);
  47560. $ctx1.sendIdx["should:return:"]=1;
  47561. self._should_return_("foo ^ Math cos: 0",(1));
  47562. $ctx1.sendIdx["should:return:"]=2;
  47563. self._should_return_("foo ^ NonExistingVar",nil);
  47564. return self;
  47565. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  47566. },
  47567. args: [],
  47568. 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",
  47569. referencedClasses: ["BlockClosure"],
  47570. messageSends: ["should:return:"]
  47571. }),
  47572. $globals.CodeGeneratorTest);
  47573. $core.addMethod(
  47574. $core.method({
  47575. selector: "testInnerTemporalDependentElementsOrdered",
  47576. protocol: "tests",
  47577. fn: function (){
  47578. var self=this;
  47579. return $core.withContext(function($ctx1) {
  47580. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  47581. $2="foo".__minus_gt($globals.Array);
  47582. $ctx1.sendIdx["->"]=1;
  47583. $3="bar".__minus_gt((2));
  47584. $ctx1.sendIdx["->"]=2;
  47585. $1=[$2,$3];
  47586. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  47587. $ctx1.sendIdx["should:return:"]=1;
  47588. $5="foo".__minus_gt($globals.Array);
  47589. $ctx1.sendIdx["->"]=3;
  47590. $6="bar".__minus_gt((2));
  47591. $ctx1.sendIdx["->"]=4;
  47592. $4=[$5,$6];
  47593. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  47594. $ctx1.sendIdx["should:return:"]=2;
  47595. $8="foo".__minus_gt((1));
  47596. $ctx1.sendIdx["->"]=5;
  47597. $9="bar".__minus_gt((2));
  47598. $ctx1.sendIdx["->"]=6;
  47599. $7=[$8,$9];
  47600. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  47601. $ctx1.sendIdx["should:return:"]=3;
  47602. $11="foo".__minus_gt((1));
  47603. $ctx1.sendIdx["->"]=7;
  47604. $10=[$11,"bar".__minus_gt((2))];
  47605. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  47606. $ctx1.sendIdx["should:return:"]=4;
  47607. 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)]));
  47608. return self;
  47609. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  47610. },
  47611. args: [],
  47612. 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}.",
  47613. referencedClasses: ["Array"],
  47614. messageSends: ["should:return:", "->"]
  47615. }),
  47616. $globals.CodeGeneratorTest);
  47617. $core.addMethod(
  47618. $core.method({
  47619. selector: "testJSStatement",
  47620. protocol: "tests",
  47621. fn: function (){
  47622. var self=this;
  47623. return $core.withContext(function($ctx1) {
  47624. self._should_return_("foo <return 2+3>",(5));
  47625. return self;
  47626. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
  47627. },
  47628. args: [],
  47629. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  47630. referencedClasses: [],
  47631. messageSends: ["should:return:"]
  47632. }),
  47633. $globals.CodeGeneratorTest);
  47634. $core.addMethod(
  47635. $core.method({
  47636. selector: "testLexicalScope",
  47637. protocol: "tests",
  47638. fn: function (){
  47639. var self=this;
  47640. return $core.withContext(function($ctx1) {
  47641. self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  47642. return self;
  47643. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  47644. },
  47645. args: [],
  47646. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  47647. referencedClasses: [],
  47648. messageSends: ["should:return:"]
  47649. }),
  47650. $globals.CodeGeneratorTest);
  47651. $core.addMethod(
  47652. $core.method({
  47653. selector: "testLiterals",
  47654. protocol: "tests",
  47655. fn: function (){
  47656. var self=this;
  47657. return $core.withContext(function($ctx1) {
  47658. self._should_return_("foo ^ 1",(1));
  47659. $ctx1.sendIdx["should:return:"]=1;
  47660. self._should_return_("foo ^ 'hello'","hello");
  47661. $ctx1.sendIdx["should:return:"]=2;
  47662. self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  47663. $ctx1.sendIdx["should:return:"]=3;
  47664. self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  47665. $ctx1.sendIdx["should:return:"]=4;
  47666. self._should_return_("foo ^ true",true);
  47667. $ctx1.sendIdx["should:return:"]=5;
  47668. self._should_return_("foo ^ false",false);
  47669. $ctx1.sendIdx["should:return:"]=6;
  47670. self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  47671. $ctx1.sendIdx["should:return:"]=7;
  47672. self._should_return_("foo ^ #hello","hello");
  47673. $ctx1.sendIdx["should:return:"]=8;
  47674. self._should_return_("foo ^ $h","h");
  47675. $ctx1.sendIdx["should:return:"]=9;
  47676. self._should_return_("foo ^ -123.456",(-123.456));
  47677. $ctx1.sendIdx["should:return:"]=10;
  47678. self._should_return_("foo ^ -2.5e4",(-25000));
  47679. return self;
  47680. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  47681. },
  47682. args: [],
  47683. 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.",
  47684. referencedClasses: [],
  47685. messageSends: ["should:return:"]
  47686. }),
  47687. $globals.CodeGeneratorTest);
  47688. $core.addMethod(
  47689. $core.method({
  47690. selector: "testLocalReturn",
  47691. protocol: "tests",
  47692. fn: function (){
  47693. var self=this;
  47694. return $core.withContext(function($ctx1) {
  47695. self._should_return_("foo ^ 1",(1));
  47696. $ctx1.sendIdx["should:return:"]=1;
  47697. self._should_return_("foo ^ 1 + 1",(2));
  47698. $ctx1.sendIdx["should:return:"]=2;
  47699. self._should_return_("foo ",self["@receiver"]);
  47700. $ctx1.sendIdx["should:return:"]=3;
  47701. self._should_return_("foo self asString",self["@receiver"]);
  47702. $ctx1.sendIdx["should:return:"]=4;
  47703. self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  47704. return self;
  47705. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  47706. },
  47707. args: [],
  47708. 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",
  47709. referencedClasses: [],
  47710. messageSends: ["should:return:"]
  47711. }),
  47712. $globals.CodeGeneratorTest);
  47713. $core.addMethod(
  47714. $core.method({
  47715. selector: "testMessageSends",
  47716. protocol: "tests",
  47717. fn: function (){
  47718. var self=this;
  47719. return $core.withContext(function($ctx1) {
  47720. self._should_return_("foo ^ 1 asString","1");
  47721. $ctx1.sendIdx["should:return:"]=1;
  47722. self._should_return_("foo ^ 1 + 1",(2));
  47723. $ctx1.sendIdx["should:return:"]=2;
  47724. self._should_return_("foo ^ 1 + 2 * 3",(9));
  47725. $ctx1.sendIdx["should:return:"]=3;
  47726. self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  47727. $ctx1.sendIdx["should:return:"]=4;
  47728. self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  47729. return self;
  47730. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  47731. },
  47732. args: [],
  47733. 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)",
  47734. referencedClasses: [],
  47735. messageSends: ["should:return:"]
  47736. }),
  47737. $globals.CodeGeneratorTest);
  47738. $core.addMethod(
  47739. $core.method({
  47740. selector: "testMistypedPragmaJSStatement",
  47741. protocol: "tests",
  47742. fn: function (){
  47743. var self=this;
  47744. return $core.withContext(function($ctx1) {
  47745. self._should_receiver_raise_("foo < inlineJS: 'return 'foo'' >",self["@receiver"],$globals.ParseError);
  47746. return self;
  47747. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  47748. },
  47749. args: [],
  47750. source: "testMistypedPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return ''foo'''' >' receiver: receiver raise: ParseError",
  47751. referencedClasses: ["ParseError"],
  47752. messageSends: ["should:receiver:raise:"]
  47753. }),
  47754. $globals.CodeGeneratorTest);
  47755. $core.addMethod(
  47756. $core.method({
  47757. selector: "testMultipleSequences",
  47758. protocol: "tests",
  47759. fn: function (){
  47760. var self=this;
  47761. return $core.withContext(function($ctx1) {
  47762. self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  47763. return self;
  47764. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  47765. },
  47766. args: [],
  47767. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  47768. referencedClasses: [],
  47769. messageSends: ["should:return:"]
  47770. }),
  47771. $globals.CodeGeneratorTest);
  47772. $core.addMethod(
  47773. $core.method({
  47774. selector: "testMutableLiterals",
  47775. protocol: "tests",
  47776. fn: function (){
  47777. var self=this;
  47778. return $core.withContext(function($ctx1) {
  47779. self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  47780. return self;
  47781. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  47782. },
  47783. args: [],
  47784. 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)",
  47785. referencedClasses: [],
  47786. messageSends: ["should:return:"]
  47787. }),
  47788. $globals.CodeGeneratorTest);
  47789. $core.addMethod(
  47790. $core.method({
  47791. selector: "testNestedIfTrue",
  47792. protocol: "tests",
  47793. fn: function (){
  47794. var self=this;
  47795. return $core.withContext(function($ctx1) {
  47796. self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  47797. $ctx1.sendIdx["should:return:"]=1;
  47798. self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  47799. $ctx1.sendIdx["should:return:"]=2;
  47800. self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  47801. $ctx1.sendIdx["should:return:"]=3;
  47802. self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  47803. return self;
  47804. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  47805. },
  47806. args: [],
  47807. 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.",
  47808. referencedClasses: [],
  47809. messageSends: ["should:return:"]
  47810. }),
  47811. $globals.CodeGeneratorTest);
  47812. $core.addMethod(
  47813. $core.method({
  47814. selector: "testNestedSends",
  47815. protocol: "tests",
  47816. fn: function (){
  47817. var self=this;
  47818. return $core.withContext(function($ctx1) {
  47819. 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());
  47820. return self;
  47821. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  47822. },
  47823. args: [],
  47824. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  47825. referencedClasses: ["Point"],
  47826. messageSends: ["should:return:", "asString", "x:y:", "@"]
  47827. }),
  47828. $globals.CodeGeneratorTest);
  47829. $core.addMethod(
  47830. $core.method({
  47831. selector: "testNonLocalReturn",
  47832. protocol: "tests",
  47833. fn: function (){
  47834. var self=this;
  47835. return $core.withContext(function($ctx1) {
  47836. self._should_return_("foo [ ^ 1 ] value",(1));
  47837. $ctx1.sendIdx["should:return:"]=1;
  47838. self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  47839. $ctx1.sendIdx["should:return:"]=2;
  47840. self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  47841. $ctx1.sendIdx["should:return:"]=3;
  47842. self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  47843. return self;
  47844. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  47845. },
  47846. args: [],
  47847. 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",
  47848. referencedClasses: [],
  47849. messageSends: ["should:return:"]
  47850. }),
  47851. $globals.CodeGeneratorTest);
  47852. $core.addMethod(
  47853. $core.method({
  47854. selector: "testPascalCaseGlobal",
  47855. protocol: "tests",
  47856. fn: function (){
  47857. var self=this;
  47858. return $core.withContext(function($ctx1) {
  47859. self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  47860. $ctx1.sendIdx["should:return:"]=1;
  47861. self._should_return_("foo ^NonExistent",nil);
  47862. return self;
  47863. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  47864. },
  47865. args: [],
  47866. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  47867. referencedClasses: ["Smalltalk"],
  47868. messageSends: ["should:return:", "at:", "globals"]
  47869. }),
  47870. $globals.CodeGeneratorTest);
  47871. $core.addMethod(
  47872. $core.method({
  47873. selector: "testPragmaJSStatement",
  47874. protocol: "tests",
  47875. fn: function (){
  47876. var self=this;
  47877. return $core.withContext(function($ctx1) {
  47878. self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  47879. return self;
  47880. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  47881. },
  47882. args: [],
  47883. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  47884. referencedClasses: [],
  47885. messageSends: ["should:return:"]
  47886. }),
  47887. $globals.CodeGeneratorTest);
  47888. $core.addMethod(
  47889. $core.method({
  47890. selector: "testRootSuperSend",
  47891. protocol: "tests",
  47892. fn: function (){
  47893. var self=this;
  47894. return $core.withContext(function($ctx1) {
  47895. self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  47896. return self;
  47897. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  47898. },
  47899. args: [],
  47900. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  47901. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  47902. messageSends: ["should:receiver:raise:", "new"]
  47903. }),
  47904. $globals.CodeGeneratorTest);
  47905. $core.addMethod(
  47906. $core.method({
  47907. selector: "testSendReceiverAndArgumentsOrdered",
  47908. protocol: "tests",
  47909. fn: function (){
  47910. var self=this;
  47911. return $core.withContext(function($ctx1) {
  47912. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  47913. $ctx1.sendIdx["should:return:"]=1;
  47914. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  47915. return self;
  47916. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  47917. },
  47918. args: [],
  47919. 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}.",
  47920. referencedClasses: ["Array"],
  47921. messageSends: ["should:return:"]
  47922. }),
  47923. $globals.CodeGeneratorTest);
  47924. $core.addMethod(
  47925. $core.method({
  47926. selector: "testSuperSend",
  47927. protocol: "tests",
  47928. fn: function (){
  47929. var self=this;
  47930. return $core.withContext(function($ctx1) {
  47931. self._should_receiver_return_("foo ^ super isBoolean",true,false);
  47932. return self;
  47933. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  47934. },
  47935. args: [],
  47936. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  47937. referencedClasses: [],
  47938. messageSends: ["should:receiver:return:"]
  47939. }),
  47940. $globals.CodeGeneratorTest);
  47941. $core.addMethod(
  47942. $core.method({
  47943. selector: "testTempVariables",
  47944. protocol: "tests",
  47945. fn: function (){
  47946. var self=this;
  47947. return $core.withContext(function($ctx1) {
  47948. self._should_return_("foo | a | ^ a",nil);
  47949. $ctx1.sendIdx["should:return:"]=1;
  47950. self._should_return_("foo | AVariable | ^ AVariable",nil);
  47951. $ctx1.sendIdx["should:return:"]=2;
  47952. self._should_return_("foo | a b c | ^ c",nil);
  47953. $ctx1.sendIdx["should:return:"]=3;
  47954. self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  47955. $ctx1.sendIdx["should:return:"]=4;
  47956. self._should_return_("foo | a | a:= 1. ^ a",(1));
  47957. $ctx1.sendIdx["should:return:"]=5;
  47958. self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  47959. return self;
  47960. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  47961. },
  47962. args: [],
  47963. 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.",
  47964. referencedClasses: [],
  47965. messageSends: ["should:return:"]
  47966. }),
  47967. $globals.CodeGeneratorTest);
  47968. $core.addMethod(
  47969. $core.method({
  47970. selector: "testThisContext",
  47971. protocol: "tests",
  47972. fn: function (){
  47973. var self=this;
  47974. return $core.withContext(function($ctx1) {
  47975. self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  47976. return self;
  47977. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  47978. },
  47979. args: [],
  47980. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  47981. referencedClasses: [],
  47982. messageSends: ["should:return:"]
  47983. }),
  47984. $globals.CodeGeneratorTest);
  47985. $core.addMethod(
  47986. $core.method({
  47987. selector: "testifFalse",
  47988. protocol: "tests",
  47989. fn: function (){
  47990. var self=this;
  47991. return $core.withContext(function($ctx1) {
  47992. self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  47993. $ctx1.sendIdx["should:return:"]=1;
  47994. self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  47995. $ctx1.sendIdx["should:return:"]=2;
  47996. self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  47997. $ctx1.sendIdx["should:return:"]=3;
  47998. self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  47999. return self;
  48000. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  48001. },
  48002. args: [],
  48003. 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.",
  48004. referencedClasses: [],
  48005. messageSends: ["should:return:"]
  48006. }),
  48007. $globals.CodeGeneratorTest);
  48008. $core.addMethod(
  48009. $core.method({
  48010. selector: "testifFalseIfTrue",
  48011. protocol: "tests",
  48012. fn: function (){
  48013. var self=this;
  48014. return $core.withContext(function($ctx1) {
  48015. self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  48016. $ctx1.sendIdx["should:return:"]=1;
  48017. self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  48018. $ctx1.sendIdx["should:return:"]=2;
  48019. self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  48020. $ctx1.sendIdx["should:return:"]=3;
  48021. self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  48022. return self;
  48023. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  48024. },
  48025. args: [],
  48026. 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.",
  48027. referencedClasses: [],
  48028. messageSends: ["should:return:"]
  48029. }),
  48030. $globals.CodeGeneratorTest);
  48031. $core.addMethod(
  48032. $core.method({
  48033. selector: "testifNil",
  48034. protocol: "tests",
  48035. fn: function (){
  48036. var self=this;
  48037. return $core.withContext(function($ctx1) {
  48038. self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  48039. $ctx1.sendIdx["should:return:"]=1;
  48040. self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  48041. $ctx1.sendIdx["should:return:"]=2;
  48042. self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  48043. $ctx1.sendIdx["should:return:"]=3;
  48044. self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  48045. return self;
  48046. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  48047. },
  48048. args: [],
  48049. 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.",
  48050. referencedClasses: [],
  48051. messageSends: ["should:return:"]
  48052. }),
  48053. $globals.CodeGeneratorTest);
  48054. $core.addMethod(
  48055. $core.method({
  48056. selector: "testifNilIfNotNil",
  48057. protocol: "tests",
  48058. fn: function (){
  48059. var self=this;
  48060. return $core.withContext(function($ctx1) {
  48061. self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  48062. $ctx1.sendIdx["should:return:"]=1;
  48063. self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  48064. $ctx1.sendIdx["should:return:"]=2;
  48065. self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  48066. $ctx1.sendIdx["should:return:"]=3;
  48067. self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  48068. return self;
  48069. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  48070. },
  48071. args: [],
  48072. 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.",
  48073. referencedClasses: [],
  48074. messageSends: ["should:return:"]
  48075. }),
  48076. $globals.CodeGeneratorTest);
  48077. $core.addMethod(
  48078. $core.method({
  48079. selector: "testifNotNil",
  48080. protocol: "tests",
  48081. fn: function (){
  48082. var self=this;
  48083. return $core.withContext(function($ctx1) {
  48084. self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  48085. $ctx1.sendIdx["should:return:"]=1;
  48086. self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  48087. $ctx1.sendIdx["should:return:"]=2;
  48088. self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  48089. $ctx1.sendIdx["should:return:"]=3;
  48090. self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  48091. return self;
  48092. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  48093. },
  48094. args: [],
  48095. 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.",
  48096. referencedClasses: [],
  48097. messageSends: ["should:return:"]
  48098. }),
  48099. $globals.CodeGeneratorTest);
  48100. $core.addMethod(
  48101. $core.method({
  48102. selector: "testifNotNilWithArgument",
  48103. protocol: "tests",
  48104. fn: function (){
  48105. var self=this;
  48106. return $core.withContext(function($ctx1) {
  48107. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  48108. $ctx1.sendIdx["should:return:"]=1;
  48109. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  48110. $ctx1.sendIdx["should:return:"]=2;
  48111. self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  48112. $ctx1.sendIdx["should:return:"]=3;
  48113. self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  48114. $ctx1.sendIdx["should:return:"]=4;
  48115. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  48116. $ctx1.sendIdx["should:return:"]=5;
  48117. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  48118. return self;
  48119. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  48120. },
  48121. args: [],
  48122. 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",
  48123. referencedClasses: [],
  48124. messageSends: ["should:return:"]
  48125. }),
  48126. $globals.CodeGeneratorTest);
  48127. $core.addMethod(
  48128. $core.method({
  48129. selector: "testifTrue",
  48130. protocol: "tests",
  48131. fn: function (){
  48132. var self=this;
  48133. return $core.withContext(function($ctx1) {
  48134. self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  48135. $ctx1.sendIdx["should:return:"]=1;
  48136. self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  48137. $ctx1.sendIdx["should:return:"]=2;
  48138. self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  48139. $ctx1.sendIdx["should:return:"]=3;
  48140. self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  48141. return self;
  48142. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  48143. },
  48144. args: [],
  48145. 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.",
  48146. referencedClasses: [],
  48147. messageSends: ["should:return:"]
  48148. }),
  48149. $globals.CodeGeneratorTest);
  48150. $core.addMethod(
  48151. $core.method({
  48152. selector: "testifTrueIfFalse",
  48153. protocol: "tests",
  48154. fn: function (){
  48155. var self=this;
  48156. return $core.withContext(function($ctx1) {
  48157. self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  48158. $ctx1.sendIdx["should:return:"]=1;
  48159. self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  48160. $ctx1.sendIdx["should:return:"]=2;
  48161. self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  48162. $ctx1.sendIdx["should:return:"]=3;
  48163. self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  48164. return self;
  48165. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  48166. },
  48167. args: [],
  48168. 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.",
  48169. referencedClasses: [],
  48170. messageSends: ["should:return:"]
  48171. }),
  48172. $globals.CodeGeneratorTest);
  48173. $core.addClass("ASTInterpreterTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  48174. $core.addMethod(
  48175. $core.method({
  48176. selector: "analyze:forClass:",
  48177. protocol: "parsing",
  48178. fn: function (aNode,aClass){
  48179. var self=this;
  48180. return $core.withContext(function($ctx1) {
  48181. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  48182. return aNode;
  48183. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
  48184. },
  48185. args: ["aNode", "aClass"],
  48186. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  48187. referencedClasses: ["SemanticAnalyzer"],
  48188. messageSends: ["visit:", "on:"]
  48189. }),
  48190. $globals.ASTInterpreterTest);
  48191. $core.addMethod(
  48192. $core.method({
  48193. selector: "interpret:receiver:withArguments:",
  48194. protocol: "private",
  48195. fn: function (aString,anObject,aDictionary){
  48196. var self=this;
  48197. var ctx,ast,interpreter;
  48198. return $core.withContext(function($ctx1) {
  48199. var $1,$2,$3,$receiver;
  48200. interpreter=$recv($globals.ASTInterpreter)._new();
  48201. $ctx1.sendIdx["new"]=1;
  48202. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  48203. $1=$recv($globals.AIContext)._new();
  48204. $recv($1)._receiver_(anObject);
  48205. $recv($1)._interpreter_(interpreter);
  48206. ctx=$recv($1)._yourself();
  48207. $2=$recv(ast)._sequenceNode();
  48208. if(($receiver = $2) == null || $receiver.isNil){
  48209. $2;
  48210. } else {
  48211. var sequence;
  48212. sequence=$receiver;
  48213. $recv($recv(sequence)._temps())._do_((function(each){
  48214. return $core.withContext(function($ctx2) {
  48215. return $recv(ctx)._defineLocal_(each);
  48216. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48217. }));
  48218. }
  48219. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  48220. return $core.withContext(function($ctx2) {
  48221. return $recv(ctx)._localAt_put_(key,value);
  48222. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  48223. }));
  48224. $3=interpreter;
  48225. $recv($3)._context_(ctx);
  48226. $recv($3)._node_(ast);
  48227. $recv($3)._enterNode();
  48228. $recv($3)._proceed();
  48229. return $recv($3)._result();
  48230. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  48231. },
  48232. args: ["aString", "anObject", "aDictionary"],
  48233. 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",
  48234. referencedClasses: ["ASTInterpreter", "AIContext"],
  48235. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  48236. }),
  48237. $globals.ASTInterpreterTest);
  48238. $core.addMethod(
  48239. $core.method({
  48240. selector: "parse:",
  48241. protocol: "parsing",
  48242. fn: function (aString){
  48243. var self=this;
  48244. return $core.withContext(function($ctx1) {
  48245. return $recv($globals.Smalltalk)._parse_(aString);
  48246. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
  48247. },
  48248. args: ["aString"],
  48249. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  48250. referencedClasses: ["Smalltalk"],
  48251. messageSends: ["parse:"]
  48252. }),
  48253. $globals.ASTInterpreterTest);
  48254. $core.addMethod(
  48255. $core.method({
  48256. selector: "parse:forClass:",
  48257. protocol: "parsing",
  48258. fn: function (aString,aClass){
  48259. var self=this;
  48260. return $core.withContext(function($ctx1) {
  48261. return self._analyze_forClass_(self._parse_(aString),aClass);
  48262. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
  48263. },
  48264. args: ["aString", "aClass"],
  48265. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  48266. referencedClasses: [],
  48267. messageSends: ["analyze:forClass:", "parse:"]
  48268. }),
  48269. $globals.ASTInterpreterTest);
  48270. $core.addMethod(
  48271. $core.method({
  48272. selector: "should:receiver:return:",
  48273. protocol: "testing",
  48274. fn: function (aString,anObject,aResult){
  48275. var self=this;
  48276. return $core.withContext(function($ctx1) {
  48277. self["@receiver"]=anObject;
  48278. return self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  48279. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  48280. },
  48281. args: ["aString", "anObject", "aResult"],
  48282. 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",
  48283. referencedClasses: [],
  48284. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  48285. }),
  48286. $globals.ASTInterpreterTest);
  48287. $core.addClass("ASTDebuggerTest", $globals.ASTInterpreterTest, [], "Compiler-Tests");
  48288. $core.addMethod(
  48289. $core.method({
  48290. selector: "interpret:receiver:withArguments:",
  48291. protocol: "private",
  48292. fn: function (aString,anObject,aDictionary){
  48293. var self=this;
  48294. var ctx,ast,debugger_;
  48295. return $core.withContext(function($ctx1) {
  48296. var $1,$2,$3,$4,$5,$receiver;
  48297. $1=$recv($globals.AIContext)._new();
  48298. $ctx1.sendIdx["new"]=1;
  48299. $recv($1)._receiver_(anObject);
  48300. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  48301. ctx=$recv($1)._yourself();
  48302. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  48303. $2=$recv(ast)._sequenceNode();
  48304. if(($receiver = $2) == null || $receiver.isNil){
  48305. $2;
  48306. } else {
  48307. var sequence;
  48308. sequence=$receiver;
  48309. $recv($recv(sequence)._temps())._do_((function(each){
  48310. return $core.withContext(function($ctx2) {
  48311. return $recv(ctx)._defineLocal_(each);
  48312. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48313. }));
  48314. }
  48315. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  48316. return $core.withContext(function($ctx2) {
  48317. return $recv(ctx)._localAt_put_(key,value);
  48318. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  48319. }));
  48320. $3=$recv(ctx)._interpreter();
  48321. $ctx1.sendIdx["interpreter"]=1;
  48322. $recv($3)._context_(ctx);
  48323. $ctx1.sendIdx["context:"]=1;
  48324. $4=$recv(ctx)._interpreter();
  48325. $recv($4)._node_(ast);
  48326. $recv($4)._enterNode();
  48327. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  48328. $5=debugger_;
  48329. $recv($5)._proceed();
  48330. return $recv($5)._result();
  48331. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  48332. },
  48333. args: ["aString", "anObject", "aDictionary"],
  48334. 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",
  48335. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  48336. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  48337. }),
  48338. $globals.ASTDebuggerTest);
  48339. $core.addClass("InliningCodeGeneratorTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  48340. $core.addMethod(
  48341. $core.method({
  48342. selector: "codeGeneratorClass",
  48343. protocol: "accessing",
  48344. fn: function (){
  48345. var self=this;
  48346. return $globals.InliningCodeGenerator;
  48347. },
  48348. args: [],
  48349. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  48350. referencedClasses: ["InliningCodeGenerator"],
  48351. messageSends: []
  48352. }),
  48353. $globals.InliningCodeGeneratorTest);
  48354. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  48355. $core.addMethod(
  48356. $core.method({
  48357. selector: "testClassRefVar",
  48358. protocol: "tests",
  48359. fn: function (){
  48360. var self=this;
  48361. var node;
  48362. return $core.withContext(function($ctx1) {
  48363. var $1,$2;
  48364. $1=$recv($globals.VariableNode)._new();
  48365. $ctx1.sendIdx["new"]=1;
  48366. $recv($1)._value_("Object");
  48367. node=$recv($1)._yourself();
  48368. $2=$recv($globals.SemanticAnalyzer)._new();
  48369. $ctx1.sendIdx["new"]=2;
  48370. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  48371. $recv($2)._visit_(node);
  48372. self._assert_($recv($recv(node)._binding())._isClassRefVar());
  48373. return self;
  48374. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  48375. },
  48376. args: [],
  48377. 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",
  48378. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  48379. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  48380. }),
  48381. $globals.ScopeVarTest);
  48382. $core.addMethod(
  48383. $core.method({
  48384. selector: "testInstanceVar",
  48385. protocol: "tests",
  48386. fn: function (){
  48387. var self=this;
  48388. var node,scope;
  48389. return $core.withContext(function($ctx1) {
  48390. var $1;
  48391. $1=$recv($globals.VariableNode)._new();
  48392. $ctx1.sendIdx["new"]=1;
  48393. $recv($1)._value_("bzzz");
  48394. node=$recv($1)._yourself();
  48395. scope=$recv($globals.MethodLexicalScope)._new();
  48396. $recv(scope)._addIVar_("bzzz");
  48397. self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  48398. return self;
  48399. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  48400. },
  48401. args: [],
  48402. 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",
  48403. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  48404. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  48405. }),
  48406. $globals.ScopeVarTest);
  48407. $core.addMethod(
  48408. $core.method({
  48409. selector: "testPseudoVar",
  48410. protocol: "tests",
  48411. fn: function (){
  48412. var self=this;
  48413. var node,pseudoVars;
  48414. return $core.withContext(function($ctx1) {
  48415. var $1;
  48416. pseudoVars=["self", "super", "true", "false", "nil"];
  48417. $recv(pseudoVars)._do_((function(each){
  48418. return $core.withContext(function($ctx2) {
  48419. $1=$recv($globals.VariableNode)._new();
  48420. $ctx2.sendIdx["new"]=1;
  48421. $recv($1)._value_(each);
  48422. node=$recv($1)._yourself();
  48423. node;
  48424. return self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  48425. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48426. }));
  48427. return self;
  48428. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  48429. },
  48430. args: [],
  48431. 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]",
  48432. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  48433. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  48434. }),
  48435. $globals.ScopeVarTest);
  48436. $core.addMethod(
  48437. $core.method({
  48438. selector: "testTempVar",
  48439. protocol: "tests",
  48440. fn: function (){
  48441. var self=this;
  48442. var node,scope;
  48443. return $core.withContext(function($ctx1) {
  48444. var $1;
  48445. $1=$recv($globals.VariableNode)._new();
  48446. $ctx1.sendIdx["new"]=1;
  48447. $recv($1)._value_("bzzz");
  48448. node=$recv($1)._yourself();
  48449. scope=$recv($globals.MethodLexicalScope)._new();
  48450. $recv(scope)._addTemp_("bzzz");
  48451. self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  48452. return self;
  48453. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  48454. },
  48455. args: [],
  48456. 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",
  48457. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  48458. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  48459. }),
  48460. $globals.ScopeVarTest);
  48461. $core.addMethod(
  48462. $core.method({
  48463. selector: "testUnknownVar",
  48464. protocol: "tests",
  48465. fn: function (){
  48466. var self=this;
  48467. var node;
  48468. return $core.withContext(function($ctx1) {
  48469. var $1;
  48470. $1=$recv($globals.VariableNode)._new();
  48471. $ctx1.sendIdx["new"]=1;
  48472. $recv($1)._value_("bzzz");
  48473. node=$recv($1)._yourself();
  48474. self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  48475. return self;
  48476. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  48477. },
  48478. args: [],
  48479. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  48480. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  48481. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  48482. }),
  48483. $globals.ScopeVarTest);
  48484. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  48485. $core.addMethod(
  48486. $core.method({
  48487. selector: "setUp",
  48488. protocol: "running",
  48489. fn: function (){
  48490. var self=this;
  48491. return $core.withContext(function($ctx1) {
  48492. self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  48493. return self;
  48494. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  48495. },
  48496. args: [],
  48497. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  48498. referencedClasses: ["SemanticAnalyzer", "Object"],
  48499. messageSends: ["on:"]
  48500. }),
  48501. $globals.SemanticAnalyzerTest);
  48502. $core.addMethod(
  48503. $core.method({
  48504. selector: "testAssignment",
  48505. protocol: "tests",
  48506. fn: function (){
  48507. var self=this;
  48508. var src,ast;
  48509. return $core.withContext(function($ctx1) {
  48510. src="foo self := 1";
  48511. ast=$recv($globals.Smalltalk)._parse_(src);
  48512. self._should_raise_((function(){
  48513. return $core.withContext(function($ctx2) {
  48514. return $recv(self["@analyzer"])._visit_(ast);
  48515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48516. }),$globals.InvalidAssignmentError);
  48517. return self;
  48518. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48519. },
  48520. args: [],
  48521. 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",
  48522. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  48523. messageSends: ["parse:", "should:raise:", "visit:"]
  48524. }),
  48525. $globals.SemanticAnalyzerTest);
  48526. $core.addMethod(
  48527. $core.method({
  48528. selector: "testNonLocalReturn",
  48529. protocol: "tests",
  48530. fn: function (){
  48531. var self=this;
  48532. var src,ast;
  48533. return $core.withContext(function($ctx1) {
  48534. src="foo | a | a + 1. ^ a";
  48535. ast=$recv($globals.Smalltalk)._parse_(src);
  48536. $recv(self["@analyzer"])._visit_(ast);
  48537. self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  48538. return self;
  48539. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48540. },
  48541. args: [],
  48542. 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",
  48543. referencedClasses: ["Smalltalk"],
  48544. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  48545. }),
  48546. $globals.SemanticAnalyzerTest);
  48547. $core.addMethod(
  48548. $core.method({
  48549. selector: "testNonLocalReturn2",
  48550. protocol: "tests",
  48551. fn: function (){
  48552. var self=this;
  48553. var src,ast;
  48554. return $core.withContext(function($ctx1) {
  48555. src="foo | a | a + 1. [ [ ^ a] ]";
  48556. ast=$recv($globals.Smalltalk)._parse_(src);
  48557. $recv(self["@analyzer"])._visit_(ast);
  48558. self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  48559. return self;
  48560. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48561. },
  48562. args: [],
  48563. 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",
  48564. referencedClasses: ["Smalltalk"],
  48565. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  48566. }),
  48567. $globals.SemanticAnalyzerTest);
  48568. $core.addMethod(
  48569. $core.method({
  48570. selector: "testScope",
  48571. protocol: "tests",
  48572. fn: function (){
  48573. var self=this;
  48574. var src,ast;
  48575. return $core.withContext(function($ctx1) {
  48576. var $4,$3,$2,$1;
  48577. src="foo | a | a + 1. [ | b | b := a ]";
  48578. ast=$recv($globals.Smalltalk)._parse_(src);
  48579. $recv(self["@analyzer"])._visit_(ast);
  48580. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  48581. $ctx1.sendIdx["dagChildren"]=1;
  48582. $3=$recv($4)._last();
  48583. $2=$recv($3)._scope();
  48584. $ctx1.sendIdx["scope"]=1;
  48585. $1=$recv($2).__eq_eq($recv(ast)._scope());
  48586. self._deny_($1);
  48587. return self;
  48588. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48589. },
  48590. args: [],
  48591. 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.",
  48592. referencedClasses: ["Smalltalk"],
  48593. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  48594. }),
  48595. $globals.SemanticAnalyzerTest);
  48596. $core.addMethod(
  48597. $core.method({
  48598. selector: "testScope2",
  48599. protocol: "tests",
  48600. fn: function (){
  48601. var self=this;
  48602. var src,ast;
  48603. return $core.withContext(function($ctx1) {
  48604. var $8,$7,$6,$5,$4,$3,$2,$1;
  48605. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  48606. ast=$recv($globals.Smalltalk)._parse_(src);
  48607. $recv(self["@analyzer"])._visit_(ast);
  48608. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  48609. $ctx1.sendIdx["dagChildren"]=3;
  48610. $7=$recv($8)._last();
  48611. $6=$recv($7)._dagChildren();
  48612. $ctx1.sendIdx["dagChildren"]=2;
  48613. $5=$recv($6)._first();
  48614. $ctx1.sendIdx["first"]=2;
  48615. $4=$recv($5)._dagChildren();
  48616. $ctx1.sendIdx["dagChildren"]=1;
  48617. $3=$recv($4)._first();
  48618. $ctx1.sendIdx["first"]=1;
  48619. $2=$recv($3)._scope();
  48620. $ctx1.sendIdx["scope"]=1;
  48621. $1=$recv($2).__eq_eq($recv(ast)._scope());
  48622. self._deny_($1);
  48623. return self;
  48624. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48625. },
  48626. args: [],
  48627. 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.",
  48628. referencedClasses: ["Smalltalk"],
  48629. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  48630. }),
  48631. $globals.SemanticAnalyzerTest);
  48632. $core.addMethod(
  48633. $core.method({
  48634. selector: "testScopeLevel",
  48635. protocol: "tests",
  48636. fn: function (){
  48637. var self=this;
  48638. var src,ast;
  48639. return $core.withContext(function($ctx1) {
  48640. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  48641. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  48642. ast=$recv($globals.Smalltalk)._parse_(src);
  48643. $recv(self["@analyzer"])._visit_(ast);
  48644. $2=$recv(ast)._scope();
  48645. $ctx1.sendIdx["scope"]=1;
  48646. $1=$recv($2)._scopeLevel();
  48647. $ctx1.sendIdx["scopeLevel"]=1;
  48648. self._assert_equals_($1,(1));
  48649. $ctx1.sendIdx["assert:equals:"]=1;
  48650. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  48651. $ctx1.sendIdx["dagChildren"]=3;
  48652. $9=$recv($10)._last();
  48653. $8=$recv($9)._dagChildren();
  48654. $ctx1.sendIdx["dagChildren"]=2;
  48655. $7=$recv($8)._first();
  48656. $ctx1.sendIdx["first"]=2;
  48657. $6=$recv($7)._dagChildren();
  48658. $ctx1.sendIdx["dagChildren"]=1;
  48659. $5=$recv($6)._first();
  48660. $ctx1.sendIdx["first"]=1;
  48661. $4=$recv($5)._scope();
  48662. $3=$recv($4)._scopeLevel();
  48663. self._assert_equals_($3,(3));
  48664. return self;
  48665. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48666. },
  48667. args: [],
  48668. 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",
  48669. referencedClasses: ["Smalltalk"],
  48670. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  48671. }),
  48672. $globals.SemanticAnalyzerTest);
  48673. $core.addMethod(
  48674. $core.method({
  48675. selector: "testUnknownVariables",
  48676. protocol: "tests",
  48677. fn: function (){
  48678. var self=this;
  48679. var src,ast;
  48680. return $core.withContext(function($ctx1) {
  48681. src="foo | a | b + a";
  48682. ast=$recv($globals.Smalltalk)._parse_(src);
  48683. self._should_raise_((function(){
  48684. return $core.withContext(function($ctx2) {
  48685. return $recv(self["@analyzer"])._visit_(ast);
  48686. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48687. }),$globals.UnknownVariableError);
  48688. return self;
  48689. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48690. },
  48691. args: [],
  48692. 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",
  48693. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  48694. messageSends: ["parse:", "should:raise:", "visit:"]
  48695. }),
  48696. $globals.SemanticAnalyzerTest);
  48697. $core.addMethod(
  48698. $core.method({
  48699. selector: "testUnknownVariablesWithScope",
  48700. protocol: "tests",
  48701. fn: function (){
  48702. var self=this;
  48703. var src,ast;
  48704. return $core.withContext(function($ctx1) {
  48705. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  48706. ast=$recv($globals.Smalltalk)._parse_(src);
  48707. self._should_raise_((function(){
  48708. return $core.withContext(function($ctx2) {
  48709. return $recv(self["@analyzer"])._visit_(ast);
  48710. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48711. }),$globals.UnknownVariableError);
  48712. return self;
  48713. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48714. },
  48715. args: [],
  48716. 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",
  48717. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  48718. messageSends: ["parse:", "should:raise:", "visit:"]
  48719. }),
  48720. $globals.SemanticAnalyzerTest);
  48721. $core.addMethod(
  48722. $core.method({
  48723. selector: "testVariableShadowing",
  48724. protocol: "tests",
  48725. fn: function (){
  48726. var self=this;
  48727. var src,ast;
  48728. return $core.withContext(function($ctx1) {
  48729. src="foo | a | a + 1";
  48730. ast=$recv($globals.Smalltalk)._parse_(src);
  48731. $recv(self["@analyzer"])._visit_(ast);
  48732. return self;
  48733. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48734. },
  48735. args: [],
  48736. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  48737. referencedClasses: ["Smalltalk"],
  48738. messageSends: ["parse:", "visit:"]
  48739. }),
  48740. $globals.SemanticAnalyzerTest);
  48741. $core.addMethod(
  48742. $core.method({
  48743. selector: "testVariableShadowing2",
  48744. protocol: "tests",
  48745. fn: function (){
  48746. var self=this;
  48747. var src,ast;
  48748. return $core.withContext(function($ctx1) {
  48749. src="foo | a | a + 1. [ | a | a := 2 ]";
  48750. ast=$recv($globals.Smalltalk)._parse_(src);
  48751. self._should_raise_((function(){
  48752. return $core.withContext(function($ctx2) {
  48753. return $recv(self["@analyzer"])._visit_(ast);
  48754. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48755. }),$globals.ShadowingVariableError);
  48756. return self;
  48757. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48758. },
  48759. args: [],
  48760. 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",
  48761. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  48762. messageSends: ["parse:", "should:raise:", "visit:"]
  48763. }),
  48764. $globals.SemanticAnalyzerTest);
  48765. $core.addMethod(
  48766. $core.method({
  48767. selector: "testVariableShadowing3",
  48768. protocol: "tests",
  48769. fn: function (){
  48770. var self=this;
  48771. var src,ast;
  48772. return $core.withContext(function($ctx1) {
  48773. src="foo | a | a + 1. [ | b | b := 2 ]";
  48774. ast=$recv($globals.Smalltalk)._parse_(src);
  48775. $recv(self["@analyzer"])._visit_(ast);
  48776. return self;
  48777. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48778. },
  48779. args: [],
  48780. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  48781. referencedClasses: ["Smalltalk"],
  48782. messageSends: ["parse:", "visit:"]
  48783. }),
  48784. $globals.SemanticAnalyzerTest);
  48785. $core.addMethod(
  48786. $core.method({
  48787. selector: "testVariableShadowing4",
  48788. protocol: "tests",
  48789. fn: function (){
  48790. var self=this;
  48791. var src,ast;
  48792. return $core.withContext(function($ctx1) {
  48793. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  48794. ast=$recv($globals.Smalltalk)._parse_(src);
  48795. $recv(self["@analyzer"])._visit_(ast);
  48796. return self;
  48797. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48798. },
  48799. args: [],
  48800. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  48801. referencedClasses: ["Smalltalk"],
  48802. messageSends: ["parse:", "visit:"]
  48803. }),
  48804. $globals.SemanticAnalyzerTest);
  48805. $core.addMethod(
  48806. $core.method({
  48807. selector: "testVariableShadowing5",
  48808. protocol: "tests",
  48809. fn: function (){
  48810. var self=this;
  48811. var src,ast;
  48812. return $core.withContext(function($ctx1) {
  48813. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  48814. ast=$recv($globals.Smalltalk)._parse_(src);
  48815. self._should_raise_((function(){
  48816. return $core.withContext(function($ctx2) {
  48817. return $recv(self["@analyzer"])._visit_(ast);
  48818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48819. }),$globals.ShadowingVariableError);
  48820. return self;
  48821. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48822. },
  48823. args: [],
  48824. 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",
  48825. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  48826. messageSends: ["parse:", "should:raise:", "visit:"]
  48827. }),
  48828. $globals.SemanticAnalyzerTest);
  48829. $core.addMethod(
  48830. $core.method({
  48831. selector: "testVariablesLookup",
  48832. protocol: "tests",
  48833. fn: function (){
  48834. var self=this;
  48835. var src,ast;
  48836. return $core.withContext(function($ctx1) {
  48837. 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;
  48838. src="foo | a | a + 1. [ | b | b := a ]";
  48839. ast=$recv($globals.Smalltalk)._parse_(src);
  48840. $recv(self["@analyzer"])._visit_(ast);
  48841. $7=$recv(ast)._dagChildren();
  48842. $ctx1.sendIdx["dagChildren"]=2;
  48843. $6=$recv($7)._first();
  48844. $ctx1.sendIdx["first"]=2;
  48845. $5=$recv($6)._dagChildren();
  48846. $ctx1.sendIdx["dagChildren"]=1;
  48847. $4=$recv($5)._first();
  48848. $ctx1.sendIdx["first"]=1;
  48849. $3=$recv($4)._receiver();
  48850. $ctx1.sendIdx["receiver"]=1;
  48851. $2=$recv($3)._binding();
  48852. $ctx1.sendIdx["binding"]=1;
  48853. $1=$recv($2)._isTempVar();
  48854. $ctx1.sendIdx["isTempVar"]=1;
  48855. self._assert_($1);
  48856. $ctx1.sendIdx["assert:"]=1;
  48857. $15=$recv(ast)._dagChildren();
  48858. $ctx1.sendIdx["dagChildren"]=4;
  48859. $14=$recv($15)._first();
  48860. $ctx1.sendIdx["first"]=4;
  48861. $13=$recv($14)._dagChildren();
  48862. $ctx1.sendIdx["dagChildren"]=3;
  48863. $12=$recv($13)._first();
  48864. $ctx1.sendIdx["first"]=3;
  48865. $11=$recv($12)._receiver();
  48866. $10=$recv($11)._binding();
  48867. $ctx1.sendIdx["binding"]=2;
  48868. $9=$recv($10)._scope();
  48869. $ctx1.sendIdx["scope"]=1;
  48870. $16=$recv(ast)._scope();
  48871. $ctx1.sendIdx["scope"]=2;
  48872. $8=$recv($9).__eq_eq($16);
  48873. $ctx1.sendIdx["=="]=1;
  48874. self._assert_($8);
  48875. $ctx1.sendIdx["assert:"]=2;
  48876. $27=$recv(ast)._dagChildren();
  48877. $ctx1.sendIdx["dagChildren"]=8;
  48878. $26=$recv($27)._first();
  48879. $ctx1.sendIdx["first"]=7;
  48880. $25=$recv($26)._dagChildren();
  48881. $ctx1.sendIdx["dagChildren"]=7;
  48882. $24=$recv($25)._last();
  48883. $ctx1.sendIdx["last"]=1;
  48884. $23=$recv($24)._dagChildren();
  48885. $ctx1.sendIdx["dagChildren"]=6;
  48886. $22=$recv($23)._first();
  48887. $ctx1.sendIdx["first"]=6;
  48888. $21=$recv($22)._dagChildren();
  48889. $ctx1.sendIdx["dagChildren"]=5;
  48890. $20=$recv($21)._first();
  48891. $ctx1.sendIdx["first"]=5;
  48892. $19=$recv($20)._left();
  48893. $ctx1.sendIdx["left"]=1;
  48894. $18=$recv($19)._binding();
  48895. $ctx1.sendIdx["binding"]=3;
  48896. $17=$recv($18)._isTempVar();
  48897. self._assert_($17);
  48898. $ctx1.sendIdx["assert:"]=3;
  48899. $39=$recv(ast)._dagChildren();
  48900. $ctx1.sendIdx["dagChildren"]=12;
  48901. $38=$recv($39)._first();
  48902. $ctx1.sendIdx["first"]=10;
  48903. $37=$recv($38)._dagChildren();
  48904. $ctx1.sendIdx["dagChildren"]=11;
  48905. $36=$recv($37)._last();
  48906. $ctx1.sendIdx["last"]=2;
  48907. $35=$recv($36)._dagChildren();
  48908. $ctx1.sendIdx["dagChildren"]=10;
  48909. $34=$recv($35)._first();
  48910. $ctx1.sendIdx["first"]=9;
  48911. $33=$recv($34)._dagChildren();
  48912. $ctx1.sendIdx["dagChildren"]=9;
  48913. $32=$recv($33)._first();
  48914. $ctx1.sendIdx["first"]=8;
  48915. $31=$recv($32)._left();
  48916. $30=$recv($31)._binding();
  48917. $29=$recv($30)._scope();
  48918. $ctx1.sendIdx["scope"]=3;
  48919. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  48920. $ctx1.sendIdx["dagChildren"]=13;
  48921. $41=$recv($42)._last();
  48922. $40=$recv($41)._scope();
  48923. $28=$recv($29).__eq_eq($40);
  48924. self._assert_($28);
  48925. return self;
  48926. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48927. },
  48928. args: [],
  48929. 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.",
  48930. referencedClasses: ["Smalltalk"],
  48931. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  48932. }),
  48933. $globals.SemanticAnalyzerTest);
  48934. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  48935. $core.addMethod(
  48936. $core.method({
  48937. selector: "setUp",
  48938. protocol: "running",
  48939. fn: function (){
  48940. var self=this;
  48941. return $core.withContext(function($ctx1) {
  48942. var $1,$3,$4,$2;
  48943. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  48944. $3=$recv($globals.AIContext)._new();
  48945. $recv($3)._defineLocal_("local");
  48946. $recv($3)._localAt_put_("local",(3));
  48947. $4=$recv($3)._yourself();
  48948. $ctx1.sendIdx["yourself"]=1;
  48949. $2=$4;
  48950. $recv($1)._context_($2);
  48951. self["@analyzer"]=$recv($1)._yourself();
  48952. return self;
  48953. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  48954. },
  48955. args: [],
  48956. 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",
  48957. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  48958. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  48959. }),
  48960. $globals.AISemanticAnalyzerTest);
  48961. $core.addMethod(
  48962. $core.method({
  48963. selector: "testContextVariables",
  48964. protocol: "tests",
  48965. fn: function (){
  48966. var self=this;
  48967. var src,ast;
  48968. return $core.withContext(function($ctx1) {
  48969. src="foo | a | local + a";
  48970. ast=$recv($globals.Smalltalk)._parse_(src);
  48971. self._shouldnt_raise_((function(){
  48972. return $core.withContext(function($ctx2) {
  48973. return $recv(self["@analyzer"])._visit_(ast);
  48974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48975. }),$globals.UnknownVariableError);
  48976. return self;
  48977. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  48978. },
  48979. args: [],
  48980. 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",
  48981. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  48982. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  48983. }),
  48984. $globals.AISemanticAnalyzerTest);
  48985. });
  48986. define('amber_core/Kernel-Tests',["amber/boot", "amber_core/Kernel-Objects", "amber_core/SUnit"], function($boot){"use strict";
  48987. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  48988. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  48989. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  48990. $core.addPackage("Kernel-Tests");
  48991. $core.packages["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  48992. $core.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  48993. $core.addClass("AnnouncementSubscriptionTest", $globals.TestCase, [], "Kernel-Tests");
  48994. $core.addMethod(
  48995. $core.method({
  48996. selector: "testAddExtensionMethod",
  48997. protocol: "tests",
  48998. fn: function (){
  48999. var self=this;
  49000. var method,dirty;
  49001. return $core.withContext(function($ctx1) {
  49002. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  49003. $2=self._class();
  49004. $ctx1.sendIdx["class"]=1;
  49005. $1=$recv($2)._package();
  49006. $ctx1.sendIdx["package"]=1;
  49007. dirty=$recv($1)._isDirty();
  49008. $ctx1.sendIdx["isDirty"]=1;
  49009. $4=self._class();
  49010. $ctx1.sendIdx["class"]=2;
  49011. $3=$recv($4)._package();
  49012. $ctx1.sendIdx["package"]=2;
  49013. $recv($3)._beClean();
  49014. $5=self._class();
  49015. $ctx1.sendIdx["class"]=3;
  49016. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  49017. $8=self._class();
  49018. $ctx1.sendIdx["class"]=4;
  49019. $7=$recv($8)._package();
  49020. $ctx1.sendIdx["package"]=3;
  49021. $6=$recv($7)._isDirty();
  49022. self._deny_($6);
  49023. $9=self._class();
  49024. $ctx1.sendIdx["class"]=5;
  49025. $recv($9)._removeCompiledMethod_(method);
  49026. $10=dirty;
  49027. if($core.assert($10)){
  49028. $recv($recv(self._class())._package())._beDirty();
  49029. }
  49030. return self;
  49031. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  49032. },
  49033. args: [],
  49034. 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 ]",
  49035. referencedClasses: [],
  49036. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  49037. }),
  49038. $globals.AnnouncementSubscriptionTest);
  49039. $core.addMethod(
  49040. $core.method({
  49041. selector: "testHandlesAnnouncement",
  49042. protocol: "tests",
  49043. fn: function (){
  49044. var self=this;
  49045. var subscription,announcementClass1,announcementClass2,classBuilder;
  49046. return $core.withContext(function($ctx1) {
  49047. var $1,$2;
  49048. classBuilder=$recv($globals.ClassBuilder)._new();
  49049. $ctx1.sendIdx["new"]=1;
  49050. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  49051. subscription=$recv($recv($globals.AnnouncementSubscription)._new())._announcementClass_($globals.SystemAnnouncement);
  49052. $1=$recv(subscription)._handlesAnnouncement_($globals.SystemAnnouncement);
  49053. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  49054. self._assert_equals_($1,true);
  49055. $ctx1.sendIdx["assert:equals:"]=1;
  49056. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  49057. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  49058. self._assert_equals_($2,true);
  49059. $ctx1.sendIdx["assert:equals:"]=2;
  49060. self._assert_equals_($recv(subscription)._handlesAnnouncement_($globals.Object),false);
  49061. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  49062. return self;
  49063. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  49064. },
  49065. args: [],
  49066. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  49067. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  49068. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  49069. }),
  49070. $globals.AnnouncementSubscriptionTest);
  49071. $core.addClass("AnnouncerTest", $globals.TestCase, [], "Kernel-Tests");
  49072. $core.addMethod(
  49073. $core.method({
  49074. selector: "testOnDo",
  49075. protocol: "tests",
  49076. fn: function (){
  49077. var self=this;
  49078. var counter,announcer;
  49079. return $core.withContext(function($ctx1) {
  49080. var $1,$2;
  49081. counter=(0);
  49082. announcer=$recv($globals.Announcer)._new();
  49083. $ctx1.sendIdx["new"]=1;
  49084. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  49085. return $core.withContext(function($ctx2) {
  49086. counter=$recv(counter).__plus((1));
  49087. return counter;
  49088. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49089. }));
  49090. $1=announcer;
  49091. $2=$recv($globals.SystemAnnouncement)._new();
  49092. $ctx1.sendIdx["new"]=2;
  49093. $recv($1)._announce_($2);
  49094. $ctx1.sendIdx["announce:"]=1;
  49095. self._assert_equals_(counter,(1));
  49096. $ctx1.sendIdx["assert:equals:"]=1;
  49097. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  49098. self._assert_equals_(counter,(2));
  49099. return self;
  49100. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  49101. },
  49102. args: [],
  49103. 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.",
  49104. referencedClasses: ["Announcer", "SystemAnnouncement"],
  49105. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  49106. }),
  49107. $globals.AnnouncerTest);
  49108. $core.addMethod(
  49109. $core.method({
  49110. selector: "testOnDoFor",
  49111. protocol: "tests",
  49112. fn: function (){
  49113. var self=this;
  49114. var counter,announcer;
  49115. return $core.withContext(function($ctx1) {
  49116. var $1,$2,$3,$4;
  49117. counter=(0);
  49118. announcer=$recv($globals.Announcer)._new();
  49119. $ctx1.sendIdx["new"]=1;
  49120. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  49121. return $core.withContext(function($ctx2) {
  49122. counter=$recv(counter).__plus((1));
  49123. return counter;
  49124. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49125. }),self);
  49126. $1=announcer;
  49127. $2=$recv($globals.SystemAnnouncement)._new();
  49128. $ctx1.sendIdx["new"]=2;
  49129. $recv($1)._announce_($2);
  49130. $ctx1.sendIdx["announce:"]=1;
  49131. self._assert_equals_(counter,(1));
  49132. $ctx1.sendIdx["assert:equals:"]=1;
  49133. $3=announcer;
  49134. $4=$recv($globals.SystemAnnouncement)._new();
  49135. $ctx1.sendIdx["new"]=3;
  49136. $recv($3)._announce_($4);
  49137. $ctx1.sendIdx["announce:"]=2;
  49138. self._assert_equals_(counter,(2));
  49139. $ctx1.sendIdx["assert:equals:"]=2;
  49140. $recv(announcer)._unsubscribe_(self);
  49141. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  49142. self._assert_equals_(counter,(2));
  49143. return self;
  49144. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  49145. },
  49146. args: [],
  49147. 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.",
  49148. referencedClasses: ["Announcer", "SystemAnnouncement"],
  49149. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  49150. }),
  49151. $globals.AnnouncerTest);
  49152. $core.addMethod(
  49153. $core.method({
  49154. selector: "testOnDoOnce",
  49155. protocol: "tests",
  49156. fn: function (){
  49157. var self=this;
  49158. var counter,announcer;
  49159. return $core.withContext(function($ctx1) {
  49160. var $1,$2;
  49161. counter=(0);
  49162. announcer=$recv($globals.Announcer)._new();
  49163. $ctx1.sendIdx["new"]=1;
  49164. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  49165. return $core.withContext(function($ctx2) {
  49166. counter=$recv(counter).__plus((1));
  49167. return counter;
  49168. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49169. }));
  49170. $1=announcer;
  49171. $2=$recv($globals.SystemAnnouncement)._new();
  49172. $ctx1.sendIdx["new"]=2;
  49173. $recv($1)._announce_($2);
  49174. $ctx1.sendIdx["announce:"]=1;
  49175. self._assert_equals_(counter,(1));
  49176. $ctx1.sendIdx["assert:equals:"]=1;
  49177. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  49178. self._assert_equals_(counter,(1));
  49179. return self;
  49180. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  49181. },
  49182. args: [],
  49183. 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.",
  49184. referencedClasses: ["Announcer", "SystemAnnouncement"],
  49185. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  49186. }),
  49187. $globals.AnnouncerTest);
  49188. $core.addClass("BlockClosureTest", $globals.TestCase, [], "Kernel-Tests");
  49189. $core.addMethod(
  49190. $core.method({
  49191. selector: "localReturnOnDoCatch",
  49192. protocol: "fixture",
  49193. fn: function (){
  49194. var self=this;
  49195. return $core.withContext(function($ctx1) {
  49196. var $early={};
  49197. try {
  49198. $recv((function(){
  49199. throw $early=[(2)];
  49200. }))._on_do_($globals.Error,(function(){
  49201. }));
  49202. return (3);
  49203. }
  49204. catch(e) {if(e===$early)return e[0]; throw e}
  49205. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  49206. },
  49207. args: [],
  49208. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  49209. referencedClasses: ["Error"],
  49210. messageSends: ["on:do:"]
  49211. }),
  49212. $globals.BlockClosureTest);
  49213. $core.addMethod(
  49214. $core.method({
  49215. selector: "localReturnOnDoMiss",
  49216. protocol: "fixture",
  49217. fn: function (){
  49218. var self=this;
  49219. return $core.withContext(function($ctx1) {
  49220. var $early={};
  49221. try {
  49222. $recv((function(){
  49223. throw $early=[(2)];
  49224. }))._on_do_($globals.Class,(function(){
  49225. }));
  49226. return (3);
  49227. }
  49228. catch(e) {if(e===$early)return e[0]; throw e}
  49229. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  49230. },
  49231. args: [],
  49232. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  49233. referencedClasses: ["Class"],
  49234. messageSends: ["on:do:"]
  49235. }),
  49236. $globals.BlockClosureTest);
  49237. $core.addMethod(
  49238. $core.method({
  49239. selector: "testCanClearInterval",
  49240. protocol: "tests",
  49241. fn: function (){
  49242. var self=this;
  49243. return $core.withContext(function($ctx1) {
  49244. self._shouldnt_raise_((function(){
  49245. return $core.withContext(function($ctx2) {
  49246. return $recv($recv((function(){
  49247. return $core.withContext(function($ctx3) {
  49248. return $recv($recv($globals.Error)._new())._signal();
  49249. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49250. }))._valueWithInterval_((0)))._clearInterval();
  49251. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49252. }),$globals.Error);
  49253. return self;
  49254. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  49255. },
  49256. args: [],
  49257. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  49258. referencedClasses: ["Error"],
  49259. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  49260. }),
  49261. $globals.BlockClosureTest);
  49262. $core.addMethod(
  49263. $core.method({
  49264. selector: "testCanClearTimeout",
  49265. protocol: "tests",
  49266. fn: function (){
  49267. var self=this;
  49268. return $core.withContext(function($ctx1) {
  49269. self._shouldnt_raise_((function(){
  49270. return $core.withContext(function($ctx2) {
  49271. return $recv($recv((function(){
  49272. return $core.withContext(function($ctx3) {
  49273. return $recv($recv($globals.Error)._new())._signal();
  49274. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49275. }))._valueWithTimeout_((0)))._clearTimeout();
  49276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49277. }),$globals.Error);
  49278. return self;
  49279. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  49280. },
  49281. args: [],
  49282. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  49283. referencedClasses: ["Error"],
  49284. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  49285. }),
  49286. $globals.BlockClosureTest);
  49287. $core.addMethod(
  49288. $core.method({
  49289. selector: "testCompiledSource",
  49290. protocol: "tests",
  49291. fn: function (){
  49292. var self=this;
  49293. return $core.withContext(function($ctx1) {
  49294. self._assert_($recv($recv((function(){
  49295. return $core.withContext(function($ctx2) {
  49296. return (1).__plus((1));
  49297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49298. }))._compiledSource())._includesSubString_("function"));
  49299. return self;
  49300. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  49301. },
  49302. args: [],
  49303. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  49304. referencedClasses: [],
  49305. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  49306. }),
  49307. $globals.BlockClosureTest);
  49308. $core.addMethod(
  49309. $core.method({
  49310. selector: "testCurrySelf",
  49311. protocol: "tests",
  49312. fn: function (){
  49313. var self=this;
  49314. var curriedMethod,array;
  49315. return $core.withContext(function($ctx1) {
  49316. curriedMethod=$recv($recv((function(selfarg,x){
  49317. return $core.withContext(function($ctx2) {
  49318. return $recv(selfarg)._at_(x);
  49319. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  49320. }))._currySelf())._asCompiledMethod_("foo:");
  49321. array=[(3), (1), (4)];
  49322. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  49323. $recv((function(){
  49324. return $core.withContext(function($ctx2) {
  49325. return self._assert_equals_($recv(array)._foo_((2)),(1));
  49326. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49327. }))._ensure_((function(){
  49328. return $core.withContext(function($ctx2) {
  49329. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  49330. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49331. }));
  49332. return self;
  49333. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  49334. },
  49335. args: [],
  49336. 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 ]",
  49337. referencedClasses: ["ClassBuilder", "Array"],
  49338. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  49339. }),
  49340. $globals.BlockClosureTest);
  49341. $core.addMethod(
  49342. $core.method({
  49343. selector: "testEnsure",
  49344. protocol: "tests",
  49345. fn: function (){
  49346. var self=this;
  49347. return $core.withContext(function($ctx1) {
  49348. self._assert_equals_($recv((function(){
  49349. return (3);
  49350. }))._ensure_((function(){
  49351. return (4);
  49352. })),(3));
  49353. return self;
  49354. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  49355. },
  49356. args: [],
  49357. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  49358. referencedClasses: [],
  49359. messageSends: ["assert:equals:", "ensure:"]
  49360. }),
  49361. $globals.BlockClosureTest);
  49362. $core.addMethod(
  49363. $core.method({
  49364. selector: "testEnsureRaises",
  49365. protocol: "tests",
  49366. fn: function (){
  49367. var self=this;
  49368. return $core.withContext(function($ctx1) {
  49369. self._should_raise_((function(){
  49370. return $core.withContext(function($ctx2) {
  49371. return $recv((function(){
  49372. return $core.withContext(function($ctx3) {
  49373. return $recv($recv($globals.Error)._new())._signal();
  49374. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49375. }))._ensure_((function(){
  49376. return true;
  49377. }));
  49378. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49379. }),$globals.Error);
  49380. return self;
  49381. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  49382. },
  49383. args: [],
  49384. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  49385. referencedClasses: ["Error"],
  49386. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  49387. }),
  49388. $globals.BlockClosureTest);
  49389. $core.addMethod(
  49390. $core.method({
  49391. selector: "testExceptionSemantics",
  49392. protocol: "tests",
  49393. fn: function (){
  49394. var self=this;
  49395. return $core.withContext(function($ctx1) {
  49396. self._timeout_((100));
  49397. $recv(self._async_((function(){
  49398. return $core.withContext(function($ctx2) {
  49399. return $recv((function(){
  49400. return $core.withContext(function($ctx3) {
  49401. self._assert_(true);
  49402. $recv($globals.Error)._signal();
  49403. self._deny_(true);
  49404. return self._finished();
  49405. $ctx3.sendIdx["finished"]=1;
  49406. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49407. }))._on_do_($globals.Error,(function(ex){
  49408. return $core.withContext(function($ctx3) {
  49409. return self._finished();
  49410. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  49411. }));
  49412. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49413. })))._valueWithTimeout_((0));
  49414. return self;
  49415. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  49416. },
  49417. args: [],
  49418. 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",
  49419. referencedClasses: ["Error"],
  49420. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  49421. }),
  49422. $globals.BlockClosureTest);
  49423. $core.addMethod(
  49424. $core.method({
  49425. selector: "testLocalReturnOnDoCatch",
  49426. protocol: "tests",
  49427. fn: function (){
  49428. var self=this;
  49429. return $core.withContext(function($ctx1) {
  49430. self._assert_equals_(self._localReturnOnDoCatch(),(2));
  49431. return self;
  49432. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  49433. },
  49434. args: [],
  49435. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  49436. referencedClasses: [],
  49437. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  49438. }),
  49439. $globals.BlockClosureTest);
  49440. $core.addMethod(
  49441. $core.method({
  49442. selector: "testLocalReturnOnDoMiss",
  49443. protocol: "tests",
  49444. fn: function (){
  49445. var self=this;
  49446. return $core.withContext(function($ctx1) {
  49447. self._assert_equals_(self._localReturnOnDoMiss(),(2));
  49448. return self;
  49449. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  49450. },
  49451. args: [],
  49452. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  49453. referencedClasses: [],
  49454. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  49455. }),
  49456. $globals.BlockClosureTest);
  49457. $core.addMethod(
  49458. $core.method({
  49459. selector: "testNewWithValues",
  49460. protocol: "tests",
  49461. fn: function (){
  49462. var self=this;
  49463. return $core.withContext(function($ctx1) {
  49464. function TestConstructor(arg1, arg2, arg3) {}
  49465. TestConstructor.prototype.name = "theTestPrototype";
  49466. var wrappedConstructor = $recv(TestConstructor);
  49467. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  49468. self._assert_(result instanceof TestConstructor);
  49469. self._assert_equals_(result.name, "theTestPrototype");
  49470. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  49471. self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  49472. return self;
  49473. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  49474. },
  49475. args: [],
  49476. 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\x09self._assert_(result instanceof TestConstructor);\x0a\x09self._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\x09self._should_raise_(function () {wrappedConstructor._newWithValues_(\x22single argument\x22);}, $globals.Error);\x0a'>",
  49477. referencedClasses: [],
  49478. messageSends: []
  49479. }),
  49480. $globals.BlockClosureTest);
  49481. $core.addMethod(
  49482. $core.method({
  49483. selector: "testNumArgs",
  49484. protocol: "tests",
  49485. fn: function (){
  49486. var self=this;
  49487. return $core.withContext(function($ctx1) {
  49488. var $1;
  49489. $1=$recv((function(){
  49490. }))._numArgs();
  49491. $ctx1.sendIdx["numArgs"]=1;
  49492. self._assert_equals_($1,(0));
  49493. $ctx1.sendIdx["assert:equals:"]=1;
  49494. self._assert_equals_($recv((function(a,b){
  49495. }))._numArgs(),(2));
  49496. return self;
  49497. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  49498. },
  49499. args: [],
  49500. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  49501. referencedClasses: [],
  49502. messageSends: ["assert:equals:", "numArgs"]
  49503. }),
  49504. $globals.BlockClosureTest);
  49505. $core.addMethod(
  49506. $core.method({
  49507. selector: "testOnDo",
  49508. protocol: "tests",
  49509. fn: function (){
  49510. var self=this;
  49511. return $core.withContext(function($ctx1) {
  49512. self._assert_($recv((function(){
  49513. return $core.withContext(function($ctx2) {
  49514. return $recv($recv($globals.Error)._new())._signal();
  49515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49516. }))._on_do_($globals.Error,(function(ex){
  49517. return true;
  49518. })));
  49519. return self;
  49520. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  49521. },
  49522. args: [],
  49523. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  49524. referencedClasses: ["Error"],
  49525. messageSends: ["assert:", "on:do:", "signal", "new"]
  49526. }),
  49527. $globals.BlockClosureTest);
  49528. $core.addMethod(
  49529. $core.method({
  49530. selector: "testValue",
  49531. protocol: "tests",
  49532. fn: function (){
  49533. var self=this;
  49534. return $core.withContext(function($ctx1) {
  49535. var $1;
  49536. $1=$recv((function(){
  49537. return $core.withContext(function($ctx2) {
  49538. return (1).__plus((1));
  49539. $ctx2.sendIdx["+"]=1;
  49540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49541. }))._value();
  49542. $ctx1.sendIdx["value"]=1;
  49543. self._assert_equals_($1,(2));
  49544. $ctx1.sendIdx["assert:equals:"]=1;
  49545. self._assert_equals_($recv((function(x){
  49546. return $core.withContext(function($ctx2) {
  49547. return $recv(x).__plus((1));
  49548. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  49549. }))._value_((2)),(3));
  49550. $ctx1.sendIdx["assert:equals:"]=2;
  49551. self._assert_equals_($recv((function(x,y){
  49552. return $core.withContext(function($ctx2) {
  49553. return $recv(x).__star(y);
  49554. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  49555. }))._value_value_((2),(4)),(8));
  49556. $ctx1.sendIdx["assert:equals:"]=3;
  49557. self._assert_equals_($recv((function(a,b,c){
  49558. return (1);
  49559. }))._value(),(1));
  49560. return self;
  49561. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  49562. },
  49563. args: [],
  49564. 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",
  49565. referencedClasses: [],
  49566. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  49567. }),
  49568. $globals.BlockClosureTest);
  49569. $core.addMethod(
  49570. $core.method({
  49571. selector: "testValueWithPossibleArguments",
  49572. protocol: "tests",
  49573. fn: function (){
  49574. var self=this;
  49575. return $core.withContext(function($ctx1) {
  49576. var $1,$2;
  49577. $1=$recv((function(){
  49578. return (1);
  49579. }))._valueWithPossibleArguments_([(3), (4)]);
  49580. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  49581. self._assert_equals_($1,(1));
  49582. $ctx1.sendIdx["assert:equals:"]=1;
  49583. $2=$recv((function(a){
  49584. return $core.withContext(function($ctx2) {
  49585. return $recv(a).__plus((4));
  49586. $ctx2.sendIdx["+"]=1;
  49587. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  49588. }))._valueWithPossibleArguments_([(3), (4)]);
  49589. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  49590. self._assert_equals_($2,(7));
  49591. $ctx1.sendIdx["assert:equals:"]=2;
  49592. self._assert_equals_($recv((function(a,b){
  49593. return $core.withContext(function($ctx2) {
  49594. return $recv(a).__plus(b);
  49595. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  49596. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  49597. return self;
  49598. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  49599. },
  49600. args: [],
  49601. 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.",
  49602. referencedClasses: [],
  49603. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  49604. }),
  49605. $globals.BlockClosureTest);
  49606. $core.addMethod(
  49607. $core.method({
  49608. selector: "testWhileFalse",
  49609. protocol: "tests",
  49610. fn: function (){
  49611. var self=this;
  49612. var i;
  49613. return $core.withContext(function($ctx1) {
  49614. i=(0);
  49615. $recv((function(){
  49616. return $core.withContext(function($ctx2) {
  49617. return $recv(i).__gt((5));
  49618. $ctx2.sendIdx[">"]=1;
  49619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49620. }))._whileFalse_((function(){
  49621. return $core.withContext(function($ctx2) {
  49622. i=$recv(i).__plus((1));
  49623. $ctx2.sendIdx["+"]=1;
  49624. return i;
  49625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49626. }));
  49627. self._assert_equals_(i,(6));
  49628. $ctx1.sendIdx["assert:equals:"]=1;
  49629. i=(0);
  49630. $recv((function(){
  49631. return $core.withContext(function($ctx2) {
  49632. i=$recv(i).__plus((1));
  49633. i;
  49634. return $recv(i).__gt((5));
  49635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49636. }))._whileFalse();
  49637. self._assert_equals_(i,(6));
  49638. return self;
  49639. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  49640. },
  49641. args: [],
  49642. 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",
  49643. referencedClasses: [],
  49644. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  49645. }),
  49646. $globals.BlockClosureTest);
  49647. $core.addMethod(
  49648. $core.method({
  49649. selector: "testWhileTrue",
  49650. protocol: "tests",
  49651. fn: function (){
  49652. var self=this;
  49653. var i;
  49654. return $core.withContext(function($ctx1) {
  49655. i=(0);
  49656. $recv((function(){
  49657. return $core.withContext(function($ctx2) {
  49658. return $recv(i).__lt((5));
  49659. $ctx2.sendIdx["<"]=1;
  49660. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49661. }))._whileTrue_((function(){
  49662. return $core.withContext(function($ctx2) {
  49663. i=$recv(i).__plus((1));
  49664. $ctx2.sendIdx["+"]=1;
  49665. return i;
  49666. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49667. }));
  49668. self._assert_equals_(i,(5));
  49669. $ctx1.sendIdx["assert:equals:"]=1;
  49670. i=(0);
  49671. $recv((function(){
  49672. return $core.withContext(function($ctx2) {
  49673. i=$recv(i).__plus((1));
  49674. i;
  49675. return $recv(i).__lt((5));
  49676. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49677. }))._whileTrue();
  49678. self._assert_equals_(i,(5));
  49679. return self;
  49680. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  49681. },
  49682. args: [],
  49683. 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",
  49684. referencedClasses: [],
  49685. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  49686. }),
  49687. $globals.BlockClosureTest);
  49688. $core.addClass("BooleanTest", $globals.TestCase, [], "Kernel-Tests");
  49689. $core.addMethod(
  49690. $core.method({
  49691. selector: "testEquality",
  49692. protocol: "tests",
  49693. fn: function (){
  49694. var self=this;
  49695. return $core.withContext(function($ctx1) {
  49696. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  49697. $1=(0).__eq(false);
  49698. $ctx1.sendIdx["="]=1;
  49699. self._deny_($1);
  49700. $ctx1.sendIdx["deny:"]=1;
  49701. $2=false.__eq((0));
  49702. $ctx1.sendIdx["="]=2;
  49703. self._deny_($2);
  49704. $ctx1.sendIdx["deny:"]=2;
  49705. $3="".__eq(false);
  49706. $ctx1.sendIdx["="]=3;
  49707. self._deny_($3);
  49708. $ctx1.sendIdx["deny:"]=3;
  49709. $4=false.__eq("");
  49710. $ctx1.sendIdx["="]=4;
  49711. self._deny_($4);
  49712. $ctx1.sendIdx["deny:"]=4;
  49713. $5=true.__eq(true);
  49714. $ctx1.sendIdx["="]=5;
  49715. self._assert_($5);
  49716. $ctx1.sendIdx["assert:"]=1;
  49717. $6=false.__eq(true);
  49718. $ctx1.sendIdx["="]=6;
  49719. self._deny_($6);
  49720. $ctx1.sendIdx["deny:"]=5;
  49721. $7=true.__eq(false);
  49722. $ctx1.sendIdx["="]=7;
  49723. self._deny_($7);
  49724. $8=false.__eq(false);
  49725. $ctx1.sendIdx["="]=8;
  49726. self._assert_($8);
  49727. $ctx1.sendIdx["assert:"]=2;
  49728. $10=true._yourself();
  49729. $ctx1.sendIdx["yourself"]=1;
  49730. $9=$recv($10).__eq(true);
  49731. $ctx1.sendIdx["="]=9;
  49732. self._assert_($9);
  49733. $ctx1.sendIdx["assert:"]=3;
  49734. $12=true._yourself();
  49735. $ctx1.sendIdx["yourself"]=2;
  49736. $11=$recv($12).__eq(true._yourself());
  49737. self._assert_($11);
  49738. return self;
  49739. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  49740. },
  49741. args: [],
  49742. 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)",
  49743. referencedClasses: [],
  49744. messageSends: ["deny:", "=", "assert:", "yourself"]
  49745. }),
  49746. $globals.BooleanTest);
  49747. $core.addMethod(
  49748. $core.method({
  49749. selector: "testIdentity",
  49750. protocol: "tests",
  49751. fn: function (){
  49752. var self=this;
  49753. return $core.withContext(function($ctx1) {
  49754. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  49755. $1=(0).__eq_eq(false);
  49756. $ctx1.sendIdx["=="]=1;
  49757. self._deny_($1);
  49758. $ctx1.sendIdx["deny:"]=1;
  49759. $2=false.__eq_eq((0));
  49760. $ctx1.sendIdx["=="]=2;
  49761. self._deny_($2);
  49762. $ctx1.sendIdx["deny:"]=2;
  49763. $3="".__eq_eq(false);
  49764. $ctx1.sendIdx["=="]=3;
  49765. self._deny_($3);
  49766. $ctx1.sendIdx["deny:"]=3;
  49767. $4=false.__eq_eq("");
  49768. $ctx1.sendIdx["=="]=4;
  49769. self._deny_($4);
  49770. $ctx1.sendIdx["deny:"]=4;
  49771. $5=true.__eq_eq(true);
  49772. $ctx1.sendIdx["=="]=5;
  49773. self._assert_($5);
  49774. $ctx1.sendIdx["assert:"]=1;
  49775. $6=false.__eq_eq(true);
  49776. $ctx1.sendIdx["=="]=6;
  49777. self._deny_($6);
  49778. $ctx1.sendIdx["deny:"]=5;
  49779. $7=true.__eq_eq(false);
  49780. $ctx1.sendIdx["=="]=7;
  49781. self._deny_($7);
  49782. $8=false.__eq_eq(false);
  49783. $ctx1.sendIdx["=="]=8;
  49784. self._assert_($8);
  49785. $ctx1.sendIdx["assert:"]=2;
  49786. $10=true._yourself();
  49787. $ctx1.sendIdx["yourself"]=1;
  49788. $9=$recv($10).__eq_eq(true);
  49789. $ctx1.sendIdx["=="]=9;
  49790. self._assert_($9);
  49791. $ctx1.sendIdx["assert:"]=3;
  49792. $12=true._yourself();
  49793. $ctx1.sendIdx["yourself"]=2;
  49794. $11=$recv($12).__eq_eq(true._yourself());
  49795. self._assert_($11);
  49796. return self;
  49797. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  49798. },
  49799. args: [],
  49800. 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",
  49801. referencedClasses: [],
  49802. messageSends: ["deny:", "==", "assert:", "yourself"]
  49803. }),
  49804. $globals.BooleanTest);
  49805. $core.addMethod(
  49806. $core.method({
  49807. selector: "testIfTrueIfFalse",
  49808. protocol: "tests",
  49809. fn: function (){
  49810. var self=this;
  49811. return $core.withContext(function($ctx1) {
  49812. var $1,$2,$3,$4,$5,$6,$7,$8;
  49813. if($core.assert(true)){
  49814. $1="alternative block";
  49815. }
  49816. self._assert_equals_($1,"alternative block");
  49817. $ctx1.sendIdx["assert:equals:"]=1;
  49818. if(!$core.assert(true)){
  49819. $2="alternative block";
  49820. }
  49821. self._assert_equals_($2,nil);
  49822. $ctx1.sendIdx["assert:equals:"]=2;
  49823. if($core.assert(false)){
  49824. $3="alternative block";
  49825. }
  49826. self._assert_equals_($3,nil);
  49827. $ctx1.sendIdx["assert:equals:"]=3;
  49828. if(!$core.assert(false)){
  49829. $4="alternative block";
  49830. }
  49831. self._assert_equals_($4,"alternative block");
  49832. $ctx1.sendIdx["assert:equals:"]=4;
  49833. if($core.assert(false)){
  49834. $5="alternative block";
  49835. } else {
  49836. $5="alternative block2";
  49837. }
  49838. self._assert_equals_($5,"alternative block2");
  49839. $ctx1.sendIdx["assert:equals:"]=5;
  49840. if($core.assert(false)){
  49841. $6="alternative block2";
  49842. } else {
  49843. $6="alternative block";
  49844. }
  49845. self._assert_equals_($6,"alternative block");
  49846. $ctx1.sendIdx["assert:equals:"]=6;
  49847. if($core.assert(true)){
  49848. $7="alternative block";
  49849. } else {
  49850. $7="alternative block2";
  49851. }
  49852. self._assert_equals_($7,"alternative block");
  49853. $ctx1.sendIdx["assert:equals:"]=7;
  49854. if($core.assert(true)){
  49855. $8="alternative block2";
  49856. } else {
  49857. $8="alternative block";
  49858. }
  49859. self._assert_equals_($8,"alternative block2");
  49860. return self;
  49861. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  49862. },
  49863. args: [],
  49864. 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'.",
  49865. referencedClasses: [],
  49866. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  49867. }),
  49868. $globals.BooleanTest);
  49869. $core.addMethod(
  49870. $core.method({
  49871. selector: "testIfTrueIfFalseWithBoxing",
  49872. protocol: "tests",
  49873. fn: function (){
  49874. var self=this;
  49875. return $core.withContext(function($ctx1) {
  49876. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  49877. $2=true._yourself();
  49878. $ctx1.sendIdx["yourself"]=1;
  49879. if($core.assert($2)){
  49880. $1="alternative block";
  49881. }
  49882. self._assert_equals_($1,"alternative block");
  49883. $ctx1.sendIdx["assert:equals:"]=1;
  49884. $4=true._yourself();
  49885. $ctx1.sendIdx["yourself"]=2;
  49886. if(!$core.assert($4)){
  49887. $3="alternative block";
  49888. }
  49889. self._assert_equals_($3,nil);
  49890. $ctx1.sendIdx["assert:equals:"]=2;
  49891. $6=false._yourself();
  49892. $ctx1.sendIdx["yourself"]=3;
  49893. if($core.assert($6)){
  49894. $5="alternative block";
  49895. }
  49896. self._assert_equals_($5,nil);
  49897. $ctx1.sendIdx["assert:equals:"]=3;
  49898. $8=false._yourself();
  49899. $ctx1.sendIdx["yourself"]=4;
  49900. if(!$core.assert($8)){
  49901. $7="alternative block";
  49902. }
  49903. self._assert_equals_($7,"alternative block");
  49904. $ctx1.sendIdx["assert:equals:"]=4;
  49905. $10=false._yourself();
  49906. $ctx1.sendIdx["yourself"]=5;
  49907. if($core.assert($10)){
  49908. $9="alternative block";
  49909. } else {
  49910. $9="alternative block2";
  49911. }
  49912. self._assert_equals_($9,"alternative block2");
  49913. $ctx1.sendIdx["assert:equals:"]=5;
  49914. $12=false._yourself();
  49915. $ctx1.sendIdx["yourself"]=6;
  49916. if($core.assert($12)){
  49917. $11="alternative block2";
  49918. } else {
  49919. $11="alternative block";
  49920. }
  49921. self._assert_equals_($11,"alternative block");
  49922. $ctx1.sendIdx["assert:equals:"]=6;
  49923. $14=true._yourself();
  49924. $ctx1.sendIdx["yourself"]=7;
  49925. if($core.assert($14)){
  49926. $13="alternative block";
  49927. } else {
  49928. $13="alternative block2";
  49929. }
  49930. self._assert_equals_($13,"alternative block");
  49931. $ctx1.sendIdx["assert:equals:"]=7;
  49932. $16=true._yourself();
  49933. if($core.assert($16)){
  49934. $15="alternative block2";
  49935. } else {
  49936. $15="alternative block";
  49937. }
  49938. self._assert_equals_($15,"alternative block2");
  49939. return self;
  49940. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  49941. },
  49942. args: [],
  49943. 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'.",
  49944. referencedClasses: [],
  49945. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  49946. }),
  49947. $globals.BooleanTest);
  49948. $core.addMethod(
  49949. $core.method({
  49950. selector: "testLogic",
  49951. protocol: "tests",
  49952. fn: function (){
  49953. var self=this;
  49954. return $core.withContext(function($ctx1) {
  49955. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  49956. $1=true.__and(true);
  49957. $ctx1.sendIdx["&"]=1;
  49958. self._assert_($1);
  49959. $ctx1.sendIdx["assert:"]=1;
  49960. $2=true.__and(false);
  49961. $ctx1.sendIdx["&"]=2;
  49962. self._deny_($2);
  49963. $ctx1.sendIdx["deny:"]=1;
  49964. $3=false.__and(true);
  49965. $ctx1.sendIdx["&"]=3;
  49966. self._deny_($3);
  49967. $ctx1.sendIdx["deny:"]=2;
  49968. $5=false.__and(false);
  49969. $ctx1.sendIdx["&"]=4;
  49970. $4=self._deny_($5);
  49971. $ctx1.sendIdx["deny:"]=3;
  49972. $6=true.__or(true);
  49973. $ctx1.sendIdx["|"]=1;
  49974. self._assert_($6);
  49975. $ctx1.sendIdx["assert:"]=2;
  49976. $7=true.__or(false);
  49977. $ctx1.sendIdx["|"]=2;
  49978. self._assert_($7);
  49979. $ctx1.sendIdx["assert:"]=3;
  49980. $8=false.__or(true);
  49981. $ctx1.sendIdx["|"]=3;
  49982. self._assert_($8);
  49983. $ctx1.sendIdx["assert:"]=4;
  49984. $10=false.__or(false);
  49985. $ctx1.sendIdx["|"]=4;
  49986. $9=self._deny_($10);
  49987. $ctx1.sendIdx["deny:"]=4;
  49988. $12=(1).__gt((0));
  49989. $ctx1.sendIdx[">"]=1;
  49990. $11=true.__and($12);
  49991. $ctx1.sendIdx["&"]=5;
  49992. self._assert_($11);
  49993. $ctx1.sendIdx["assert:"]=5;
  49994. $14=(1).__gt((0));
  49995. $ctx1.sendIdx[">"]=2;
  49996. $13=$recv($14).__and(false);
  49997. $ctx1.sendIdx["&"]=6;
  49998. self._deny_($13);
  49999. $ctx1.sendIdx["deny:"]=5;
  50000. $16=(1).__gt((0));
  50001. $ctx1.sendIdx[">"]=3;
  50002. $17=(1).__gt((2));
  50003. $ctx1.sendIdx[">"]=4;
  50004. $15=$recv($16).__and($17);
  50005. self._deny_($15);
  50006. $19=(1).__gt((0));
  50007. $ctx1.sendIdx[">"]=5;
  50008. $18=false.__or($19);
  50009. $ctx1.sendIdx["|"]=5;
  50010. self._assert_($18);
  50011. $ctx1.sendIdx["assert:"]=6;
  50012. $21=(1).__gt((0));
  50013. $ctx1.sendIdx[">"]=6;
  50014. $20=$recv($21).__or(false);
  50015. $ctx1.sendIdx["|"]=6;
  50016. self._assert_($20);
  50017. $ctx1.sendIdx["assert:"]=7;
  50018. $23=(1).__gt((0));
  50019. $ctx1.sendIdx[">"]=7;
  50020. $22=$recv($23).__or((1).__gt((2)));
  50021. self._assert_($22);
  50022. return self;
  50023. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  50024. },
  50025. args: [],
  50026. 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))",
  50027. referencedClasses: [],
  50028. messageSends: ["assert:", "&", "deny:", "|", ">"]
  50029. }),
  50030. $globals.BooleanTest);
  50031. $core.addMethod(
  50032. $core.method({
  50033. selector: "testLogicKeywords",
  50034. protocol: "tests",
  50035. fn: function (){
  50036. var self=this;
  50037. return $core.withContext(function($ctx1) {
  50038. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  50039. $1=true._and_((function(){
  50040. return true;
  50041. }));
  50042. $ctx1.sendIdx["and:"]=1;
  50043. self._assert_($1);
  50044. $ctx1.sendIdx["assert:"]=1;
  50045. $2=true._and_((function(){
  50046. return false;
  50047. }));
  50048. $ctx1.sendIdx["and:"]=2;
  50049. self._deny_($2);
  50050. $ctx1.sendIdx["deny:"]=1;
  50051. $3=false._and_((function(){
  50052. return true;
  50053. }));
  50054. $ctx1.sendIdx["and:"]=3;
  50055. self._deny_($3);
  50056. $ctx1.sendIdx["deny:"]=2;
  50057. $5=false._and_((function(){
  50058. return false;
  50059. }));
  50060. $ctx1.sendIdx["and:"]=4;
  50061. $4=self._deny_($5);
  50062. $ctx1.sendIdx["deny:"]=3;
  50063. $6=true._or_((function(){
  50064. return true;
  50065. }));
  50066. $ctx1.sendIdx["or:"]=1;
  50067. self._assert_($6);
  50068. $ctx1.sendIdx["assert:"]=2;
  50069. $7=true._or_((function(){
  50070. return false;
  50071. }));
  50072. $ctx1.sendIdx["or:"]=2;
  50073. self._assert_($7);
  50074. $ctx1.sendIdx["assert:"]=3;
  50075. $8=false._or_((function(){
  50076. return true;
  50077. }));
  50078. $ctx1.sendIdx["or:"]=3;
  50079. self._assert_($8);
  50080. $ctx1.sendIdx["assert:"]=4;
  50081. $10=false._or_((function(){
  50082. return false;
  50083. }));
  50084. $ctx1.sendIdx["or:"]=4;
  50085. $9=self._deny_($10);
  50086. $ctx1.sendIdx["deny:"]=4;
  50087. $11=true._and_((function(){
  50088. return $core.withContext(function($ctx2) {
  50089. return (1).__gt((0));
  50090. $ctx2.sendIdx[">"]=1;
  50091. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  50092. }));
  50093. $ctx1.sendIdx["and:"]=5;
  50094. self._assert_($11);
  50095. $ctx1.sendIdx["assert:"]=5;
  50096. $13=(1).__gt((0));
  50097. $ctx1.sendIdx[">"]=2;
  50098. $12=$recv($13)._and_((function(){
  50099. return false;
  50100. }));
  50101. $ctx1.sendIdx["and:"]=6;
  50102. self._deny_($12);
  50103. $ctx1.sendIdx["deny:"]=5;
  50104. $15=(1).__gt((0));
  50105. $ctx1.sendIdx[">"]=3;
  50106. $14=$recv($15)._and_((function(){
  50107. return $core.withContext(function($ctx2) {
  50108. return (1).__gt((2));
  50109. $ctx2.sendIdx[">"]=4;
  50110. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  50111. }));
  50112. self._deny_($14);
  50113. $16=false._or_((function(){
  50114. return $core.withContext(function($ctx2) {
  50115. return (1).__gt((0));
  50116. $ctx2.sendIdx[">"]=5;
  50117. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  50118. }));
  50119. $ctx1.sendIdx["or:"]=5;
  50120. self._assert_($16);
  50121. $ctx1.sendIdx["assert:"]=6;
  50122. $18=(1).__gt((0));
  50123. $ctx1.sendIdx[">"]=6;
  50124. $17=$recv($18)._or_((function(){
  50125. return false;
  50126. }));
  50127. $ctx1.sendIdx["or:"]=6;
  50128. self._assert_($17);
  50129. $ctx1.sendIdx["assert:"]=7;
  50130. $20=(1).__gt((0));
  50131. $ctx1.sendIdx[">"]=7;
  50132. $19=$recv($20)._or_((function(){
  50133. return $core.withContext(function($ctx2) {
  50134. return (1).__gt((2));
  50135. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  50136. }));
  50137. self._assert_($19);
  50138. return self;
  50139. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  50140. },
  50141. args: [],
  50142. 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 ])",
  50143. referencedClasses: [],
  50144. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  50145. }),
  50146. $globals.BooleanTest);
  50147. $core.addMethod(
  50148. $core.method({
  50149. selector: "testNonBooleanError",
  50150. protocol: "tests",
  50151. fn: function (){
  50152. var self=this;
  50153. return $core.withContext(function($ctx1) {
  50154. self._should_raise_((function(){
  50155. return $core.withContext(function($ctx2) {
  50156. if($core.assert("")){
  50157. } else {
  50158. }
  50159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50160. }),$globals.NonBooleanReceiver);
  50161. return self;
  50162. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  50163. },
  50164. args: [],
  50165. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  50166. referencedClasses: ["NonBooleanReceiver"],
  50167. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  50168. }),
  50169. $globals.BooleanTest);
  50170. $core.addClass("ClassBuilderTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  50171. $core.addMethod(
  50172. $core.method({
  50173. selector: "setUp",
  50174. protocol: "running",
  50175. fn: function (){
  50176. var self=this;
  50177. return $core.withContext(function($ctx1) {
  50178. self["@builder"]=$recv($globals.ClassBuilder)._new();
  50179. return self;
  50180. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  50181. },
  50182. args: [],
  50183. source: "setUp\x0a\x09builder := ClassBuilder new",
  50184. referencedClasses: ["ClassBuilder"],
  50185. messageSends: ["new"]
  50186. }),
  50187. $globals.ClassBuilderTest);
  50188. $core.addMethod(
  50189. $core.method({
  50190. selector: "tearDown",
  50191. protocol: "running",
  50192. fn: function (){
  50193. var self=this;
  50194. return $core.withContext(function($ctx1) {
  50195. var $1,$receiver;
  50196. $1=self["@theClass"];
  50197. if(($receiver = $1) == null || $receiver.isNil){
  50198. $1;
  50199. } else {
  50200. $recv($globals.Smalltalk)._removeClass_(self["@theClass"]);
  50201. self["@theClass"]=nil;
  50202. self["@theClass"];
  50203. }
  50204. return self;
  50205. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  50206. },
  50207. args: [],
  50208. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  50209. referencedClasses: ["Smalltalk"],
  50210. messageSends: ["ifNotNil:", "removeClass:"]
  50211. }),
  50212. $globals.ClassBuilderTest);
  50213. $core.addMethod(
  50214. $core.method({
  50215. selector: "testClassCopy",
  50216. protocol: "tests",
  50217. fn: function (){
  50218. var self=this;
  50219. return $core.withContext(function($ctx1) {
  50220. var $2,$1,$4,$3,$6,$5,$8,$7;
  50221. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  50222. $2=$recv(self["@theClass"])._superclass();
  50223. $ctx1.sendIdx["superclass"]=1;
  50224. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  50225. $ctx1.sendIdx["=="]=1;
  50226. self._assert_($1);
  50227. $ctx1.sendIdx["assert:"]=1;
  50228. $4=$recv(self["@theClass"])._instanceVariableNames();
  50229. $ctx1.sendIdx["instanceVariableNames"]=1;
  50230. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  50231. $ctx1.sendIdx["=="]=2;
  50232. self._assert_($3);
  50233. $ctx1.sendIdx["assert:"]=2;
  50234. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  50235. $ctx1.sendIdx["assert:equals:"]=1;
  50236. $6=$recv(self["@theClass"])._package();
  50237. $ctx1.sendIdx["package"]=1;
  50238. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  50239. self._assert_($5);
  50240. $8=$recv(self["@theClass"])._methodDictionary();
  50241. $ctx1.sendIdx["methodDictionary"]=1;
  50242. $7=$recv($8)._keys();
  50243. $ctx1.sendIdx["keys"]=1;
  50244. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  50245. return self;
  50246. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  50247. },
  50248. args: [],
  50249. 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 methodDictionary keys equals: ObjectMock methodDictionary keys",
  50250. referencedClasses: ["ObjectMock"],
  50251. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]
  50252. }),
  50253. $globals.ClassBuilderTest);
  50254. $core.addMethod(
  50255. $core.method({
  50256. selector: "testClassMigration",
  50257. protocol: "tests",
  50258. fn: function (){
  50259. var self=this;
  50260. var instance,oldClass;
  50261. return $core.withContext(function($ctx1) {
  50262. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  50263. oldClass=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  50264. $2=$recv($globals.Smalltalk)._globals();
  50265. $ctx1.sendIdx["globals"]=1;
  50266. $1=$recv($2)._at_("ObjectMock2");
  50267. $ctx1.sendIdx["at:"]=1;
  50268. instance=$recv($1)._new();
  50269. $4=$recv($globals.Smalltalk)._globals();
  50270. $ctx1.sendIdx["globals"]=2;
  50271. $3=$recv($4)._at_("ObjectMock2");
  50272. $ctx1.sendIdx["at:"]=2;
  50273. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  50274. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  50275. $ctx1.sendIdx["=="]=1;
  50276. self._deny_($5);
  50277. $ctx1.sendIdx["deny:"]=1;
  50278. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  50279. $ctx1.sendIdx["=="]=2;
  50280. self._assert_($6);
  50281. $ctx1.sendIdx["assert:"]=1;
  50282. self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  50283. $ctx1.sendIdx["assert:"]=2;
  50284. $7=$recv($globals.ObjectMock2)._selectors();
  50285. $ctx1.sendIdx["selectors"]=1;
  50286. self._assert_equals_($7,$recv(oldClass)._selectors());
  50287. $ctx1.sendIdx["assert:equals:"]=1;
  50288. $8=$recv($globals.ObjectMock2)._comment();
  50289. $ctx1.sendIdx["comment"]=1;
  50290. self._assert_equals_($8,$recv(oldClass)._comment());
  50291. $ctx1.sendIdx["assert:equals:"]=2;
  50292. $9=$recv($recv($globals.ObjectMock2)._package())._name();
  50293. $ctx1.sendIdx["name"]=1;
  50294. self._assert_equals_($9,"Kernel-Tests");
  50295. $11=$recv(instance)._class();
  50296. $ctx1.sendIdx["class"]=1;
  50297. $10=$recv($11).__eq_eq($globals.ObjectMock2);
  50298. self._deny_($10);
  50299. self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  50300. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  50301. return self;
  50302. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  50303. },
  50304. args: [],
  50305. 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\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",
  50306. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  50307. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]
  50308. }),
  50309. $globals.ClassBuilderTest);
  50310. $core.addMethod(
  50311. $core.method({
  50312. selector: "testClassMigrationWithClassInstanceVariables",
  50313. protocol: "tests",
  50314. fn: function (){
  50315. var self=this;
  50316. return $core.withContext(function($ctx1) {
  50317. var $1;
  50318. $recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  50319. $1=$recv($globals.ObjectMock2)._class();
  50320. $ctx1.sendIdx["class"]=1;
  50321. $recv($1)._instanceVariableNames_("foo bar");
  50322. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  50323. self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  50324. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  50325. return self;
  50326. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  50327. },
  50328. args: [],
  50329. 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",
  50330. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  50331. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  50332. }),
  50333. $globals.ClassBuilderTest);
  50334. $core.addMethod(
  50335. $core.method({
  50336. selector: "testClassMigrationWithSubclasses",
  50337. protocol: "tests",
  50338. fn: function (){
  50339. var self=this;
  50340. return $core.withContext(function($ctx1) {
  50341. var $2,$1,$4,$3;
  50342. $recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  50343. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  50344. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  50345. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  50346. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  50347. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  50348. $2=$recv($globals.ObjectMock)._subclasses();
  50349. $ctx1.sendIdx["subclasses"]=1;
  50350. $1=$recv($2)._includes_($globals.ObjectMock2);
  50351. $ctx1.sendIdx["includes:"]=1;
  50352. self._assert_($1);
  50353. $ctx1.sendIdx["assert:"]=1;
  50354. $4=$recv($globals.ObjectMock2)._subclasses();
  50355. $ctx1.sendIdx["subclasses"]=2;
  50356. $3=$recv($4)._includes_($globals.ObjectMock3);
  50357. $ctx1.sendIdx["includes:"]=2;
  50358. self._assert_($3);
  50359. $ctx1.sendIdx["assert:"]=2;
  50360. self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  50361. $recv($recv($globals.ObjectMock)._allSubclasses())._reverseDo_((function(each){
  50362. return $core.withContext(function($ctx2) {
  50363. return $recv($globals.Smalltalk)._removeClass_(each);
  50364. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50365. }));
  50366. return self;
  50367. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  50368. },
  50369. args: [],
  50370. 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 ]",
  50371. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  50372. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "reverseDo:", "allSubclasses", "removeClass:"]
  50373. }),
  50374. $globals.ClassBuilderTest);
  50375. $core.addMethod(
  50376. $core.method({
  50377. selector: "testInstanceVariableNames",
  50378. protocol: "tests",
  50379. fn: function (){
  50380. var self=this;
  50381. return $core.withContext(function($ctx1) {
  50382. self._assert_equals_($recv(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  50383. return self;
  50384. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  50385. },
  50386. args: [],
  50387. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  50388. referencedClasses: [],
  50389. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  50390. }),
  50391. $globals.ClassBuilderTest);
  50392. $core.addClass("ClassTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  50393. $core.addMethod(
  50394. $core.method({
  50395. selector: "jsConstructor",
  50396. protocol: "running",
  50397. fn: function (){
  50398. var self=this;
  50399. return $core.withContext(function($ctx1) {
  50400. function Foo(){}
  50401. Foo.prototype.valueOf = function () {return 4;};
  50402. return Foo;
  50403. ;
  50404. return self;
  50405. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  50406. },
  50407. args: [],
  50408. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  50409. referencedClasses: [],
  50410. messageSends: []
  50411. }),
  50412. $globals.ClassTest);
  50413. $core.addMethod(
  50414. $core.method({
  50415. selector: "setUp",
  50416. protocol: "running",
  50417. fn: function (){
  50418. var self=this;
  50419. return $core.withContext(function($ctx1) {
  50420. self["@builder"]=$recv($globals.ClassBuilder)._new();
  50421. return self;
  50422. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  50423. },
  50424. args: [],
  50425. source: "setUp\x0a\x09builder := ClassBuilder new",
  50426. referencedClasses: ["ClassBuilder"],
  50427. messageSends: ["new"]
  50428. }),
  50429. $globals.ClassTest);
  50430. $core.addMethod(
  50431. $core.method({
  50432. selector: "tearDown",
  50433. protocol: "running",
  50434. fn: function (){
  50435. var self=this;
  50436. return $core.withContext(function($ctx1) {
  50437. var $1,$receiver;
  50438. $1=self["@theClass"];
  50439. if(($receiver = $1) == null || $receiver.isNil){
  50440. $1;
  50441. } else {
  50442. $recv($recv(self["@theClass"])._allSubclasses())._reverseDo_((function(each){
  50443. return $core.withContext(function($ctx2) {
  50444. return $recv($globals.Smalltalk)._removeClass_(each);
  50445. $ctx2.sendIdx["removeClass:"]=1;
  50446. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50447. }));
  50448. $recv($globals.Smalltalk)._removeClass_(self["@theClass"]);
  50449. self["@theClass"]=nil;
  50450. self["@theClass"];
  50451. }
  50452. return self;
  50453. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  50454. },
  50455. args: [],
  50456. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ].\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09theClass := nil ]",
  50457. referencedClasses: ["Smalltalk"],
  50458. messageSends: ["ifNotNil:", "reverseDo:", "allSubclasses", "removeClass:"]
  50459. }),
  50460. $globals.ClassTest);
  50461. $core.addMethod(
  50462. $core.method({
  50463. selector: "testAllSubclasses",
  50464. protocol: "tests",
  50465. fn: function (){
  50466. var self=this;
  50467. var subclasses,index;
  50468. return $core.withContext(function($ctx1) {
  50469. subclasses=$recv($globals.Object)._subclasses();
  50470. $ctx1.sendIdx["subclasses"]=1;
  50471. index=(1);
  50472. $recv((function(){
  50473. return $core.withContext(function($ctx2) {
  50474. return $recv(index).__gt($recv(subclasses)._size());
  50475. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50476. }))._whileFalse_((function(){
  50477. return $core.withContext(function($ctx2) {
  50478. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  50479. index=$recv(index).__plus((1));
  50480. return index;
  50481. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50482. }));
  50483. self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  50484. return self;
  50485. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  50486. },
  50487. args: [],
  50488. 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",
  50489. referencedClasses: ["Object"],
  50490. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  50491. }),
  50492. $globals.ClassTest);
  50493. $core.addMethod(
  50494. $core.method({
  50495. selector: "testMetaclassSubclasses",
  50496. protocol: "tests",
  50497. fn: function (){
  50498. var self=this;
  50499. var subclasses;
  50500. return $core.withContext(function($ctx1) {
  50501. var $4,$3,$2,$1;
  50502. $4=$recv($globals.Object)._class();
  50503. $ctx1.sendIdx["class"]=1;
  50504. $3=$recv($4)._instanceClass();
  50505. $2=$recv($3)._subclasses();
  50506. $ctx1.sendIdx["subclasses"]=1;
  50507. $1=$recv($2)._select_((function(each){
  50508. return $core.withContext(function($ctx2) {
  50509. return $recv($recv(each)._isMetaclass())._not();
  50510. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50511. }));
  50512. subclasses=$recv($1)._collect_((function(each){
  50513. return $core.withContext(function($ctx2) {
  50514. return $recv(each)._theMetaClass();
  50515. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50516. }));
  50517. self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  50518. return self;
  50519. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  50520. },
  50521. args: [],
  50522. 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",
  50523. referencedClasses: ["Object"],
  50524. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  50525. }),
  50526. $globals.ClassTest);
  50527. $core.addMethod(
  50528. $core.method({
  50529. selector: "testSetJavaScriptConstructor",
  50530. protocol: "tests",
  50531. fn: function (){
  50532. var self=this;
  50533. var instance;
  50534. return $core.withContext(function($ctx1) {
  50535. var $2,$1,$4,$3,$6,$5,$8,$7;
  50536. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  50537. $recv(self["@theClass"])._javascriptConstructor_(self._jsConstructor());
  50538. $2=$recv(self["@theClass"])._superclass();
  50539. $ctx1.sendIdx["superclass"]=1;
  50540. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  50541. $ctx1.sendIdx["=="]=1;
  50542. self._assert_($1);
  50543. $ctx1.sendIdx["assert:"]=1;
  50544. $4=$recv(self["@theClass"])._instanceVariableNames();
  50545. $ctx1.sendIdx["instanceVariableNames"]=1;
  50546. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  50547. $ctx1.sendIdx["=="]=2;
  50548. self._assert_($3);
  50549. $ctx1.sendIdx["assert:"]=2;
  50550. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  50551. $ctx1.sendIdx["assert:equals:"]=1;
  50552. $6=$recv(self["@theClass"])._package();
  50553. $ctx1.sendIdx["package"]=1;
  50554. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  50555. $ctx1.sendIdx["=="]=3;
  50556. self._assert_($5);
  50557. $ctx1.sendIdx["assert:"]=3;
  50558. $8=$recv(self["@theClass"])._methodDictionary();
  50559. $ctx1.sendIdx["methodDictionary"]=1;
  50560. $7=$recv($8)._keys();
  50561. $ctx1.sendIdx["keys"]=1;
  50562. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  50563. $ctx1.sendIdx["assert:equals:"]=2;
  50564. instance=$recv(self["@theClass"])._new();
  50565. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  50566. self._assert_equals_($recv(instance)._value(),(4));
  50567. $ctx1.sendIdx["assert:equals:"]=3;
  50568. self._shouldnt_raise_((function(){
  50569. return $core.withContext(function($ctx2) {
  50570. return $recv(instance)._foo_((9));
  50571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50572. }),$globals.Error);
  50573. self._assert_equals_($recv(instance)._foo(),(9));
  50574. return self;
  50575. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  50576. },
  50577. args: [],
  50578. 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",
  50579. referencedClasses: ["ObjectMock", "Error"],
  50580. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  50581. }),
  50582. $globals.ClassTest);
  50583. $core.addMethod(
  50584. $core.method({
  50585. selector: "testTrickySetJavaScriptConstructor",
  50586. protocol: "tests",
  50587. fn: function (){
  50588. var self=this;
  50589. var instance;
  50590. return $core.withContext(function($ctx1) {
  50591. var $2,$1,$4,$3,$6,$5,$8,$7;
  50592. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  50593. $recv(self["@theClass"])._javascriptConstructor_(self._trickyJsConstructor());
  50594. $2=$recv(self["@theClass"])._superclass();
  50595. $ctx1.sendIdx["superclass"]=1;
  50596. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  50597. $ctx1.sendIdx["=="]=1;
  50598. self._assert_($1);
  50599. $ctx1.sendIdx["assert:"]=1;
  50600. $4=$recv(self["@theClass"])._instanceVariableNames();
  50601. $ctx1.sendIdx["instanceVariableNames"]=1;
  50602. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  50603. $ctx1.sendIdx["=="]=2;
  50604. self._assert_($3);
  50605. $ctx1.sendIdx["assert:"]=2;
  50606. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  50607. $ctx1.sendIdx["assert:equals:"]=1;
  50608. $6=$recv(self["@theClass"])._package();
  50609. $ctx1.sendIdx["package"]=1;
  50610. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  50611. $ctx1.sendIdx["=="]=3;
  50612. self._assert_($5);
  50613. $ctx1.sendIdx["assert:"]=3;
  50614. $8=$recv(self["@theClass"])._methodDictionary();
  50615. $ctx1.sendIdx["methodDictionary"]=1;
  50616. $7=$recv($8)._keys();
  50617. $ctx1.sendIdx["keys"]=1;
  50618. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  50619. $ctx1.sendIdx["assert:equals:"]=2;
  50620. instance=$recv(self["@theClass"])._new();
  50621. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  50622. self._assert_equals_($recv(instance)._value(),(4));
  50623. $ctx1.sendIdx["assert:equals:"]=3;
  50624. self._shouldnt_raise_((function(){
  50625. return $core.withContext(function($ctx2) {
  50626. return $recv(instance)._foo_((9));
  50627. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50628. }),$globals.Error);
  50629. self._assert_equals_($recv(instance)._foo(),(9));
  50630. return self;
  50631. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  50632. },
  50633. args: [],
  50634. 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",
  50635. referencedClasses: ["ObjectMock", "Error"],
  50636. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  50637. }),
  50638. $globals.ClassTest);
  50639. $core.addMethod(
  50640. $core.method({
  50641. selector: "trickyJsConstructor",
  50642. protocol: "running",
  50643. fn: function (){
  50644. var self=this;
  50645. return $core.withContext(function($ctx1) {
  50646. function Foo(){}
  50647. Foo.prototype.valueOf = function () {return 4;};
  50648. Foo.prototype._foo = function () {return "bar";};
  50649. return Foo;
  50650. ;
  50651. return self;
  50652. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  50653. },
  50654. args: [],
  50655. 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'>",
  50656. referencedClasses: [],
  50657. messageSends: []
  50658. }),
  50659. $globals.ClassTest);
  50660. $core.addClass("CollectionTest", $globals.TestCase, ["sampleBlock"], "Kernel-Tests");
  50661. $core.addMethod(
  50662. $core.method({
  50663. selector: "assertSameContents:as:",
  50664. protocol: "convenience",
  50665. fn: function (aCollection,anotherCollection){
  50666. var self=this;
  50667. return $core.withContext(function($ctx1) {
  50668. var $2,$1,$4,$3;
  50669. $2=$recv(aCollection)._size();
  50670. $ctx1.sendIdx["size"]=1;
  50671. $1=$recv($2).__eq($recv(anotherCollection)._size());
  50672. $ctx1.sendIdx["="]=1;
  50673. self._assert_($1);
  50674. $ctx1.sendIdx["assert:"]=1;
  50675. $recv(aCollection)._do_((function(each){
  50676. return $core.withContext(function($ctx2) {
  50677. $4=$recv(aCollection)._occurrencesOf_(each);
  50678. $ctx2.sendIdx["occurrencesOf:"]=1;
  50679. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  50680. return self._assert_($3);
  50681. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50682. }));
  50683. return self;
  50684. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  50685. },
  50686. args: ["aCollection", "anotherCollection"],
  50687. 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)) ]",
  50688. referencedClasses: [],
  50689. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  50690. }),
  50691. $globals.CollectionTest);
  50692. $core.addMethod(
  50693. $core.method({
  50694. selector: "collection",
  50695. protocol: "fixture",
  50696. fn: function (){
  50697. var self=this;
  50698. return $core.withContext(function($ctx1) {
  50699. self._subclassResponsibility();
  50700. return self;
  50701. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  50702. },
  50703. args: [],
  50704. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  50705. referencedClasses: [],
  50706. messageSends: ["subclassResponsibility"]
  50707. }),
  50708. $globals.CollectionTest);
  50709. $core.addMethod(
  50710. $core.method({
  50711. selector: "collectionClass",
  50712. protocol: "fixture",
  50713. fn: function (){
  50714. var self=this;
  50715. return $core.withContext(function($ctx1) {
  50716. return $recv(self._class())._collectionClass();
  50717. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  50718. },
  50719. args: [],
  50720. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  50721. referencedClasses: [],
  50722. messageSends: ["collectionClass", "class"]
  50723. }),
  50724. $globals.CollectionTest);
  50725. $core.addMethod(
  50726. $core.method({
  50727. selector: "collectionOfPrintStrings",
  50728. protocol: "fixture",
  50729. fn: function (){
  50730. var self=this;
  50731. return $core.withContext(function($ctx1) {
  50732. self._subclassResponsibility();
  50733. return self;
  50734. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  50735. },
  50736. args: [],
  50737. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  50738. referencedClasses: [],
  50739. messageSends: ["subclassResponsibility"]
  50740. }),
  50741. $globals.CollectionTest);
  50742. $core.addMethod(
  50743. $core.method({
  50744. selector: "collectionSize",
  50745. protocol: "fixture",
  50746. fn: function (){
  50747. var self=this;
  50748. return $core.withContext(function($ctx1) {
  50749. self._subclassResponsibility();
  50750. return self;
  50751. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  50752. },
  50753. args: [],
  50754. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  50755. referencedClasses: [],
  50756. messageSends: ["subclassResponsibility"]
  50757. }),
  50758. $globals.CollectionTest);
  50759. $core.addMethod(
  50760. $core.method({
  50761. selector: "collectionWithDuplicates",
  50762. protocol: "fixture",
  50763. fn: function (){
  50764. var self=this;
  50765. return $core.withContext(function($ctx1) {
  50766. self._subclassResponsibility();
  50767. return self;
  50768. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  50769. },
  50770. args: [],
  50771. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  50772. referencedClasses: [],
  50773. messageSends: ["subclassResponsibility"]
  50774. }),
  50775. $globals.CollectionTest);
  50776. $core.addMethod(
  50777. $core.method({
  50778. selector: "collectionWithNewValue",
  50779. protocol: "fixture",
  50780. fn: function (){
  50781. var self=this;
  50782. return $core.withContext(function($ctx1) {
  50783. self._subclassResponsibility();
  50784. return self;
  50785. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  50786. },
  50787. args: [],
  50788. 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",
  50789. referencedClasses: [],
  50790. messageSends: ["subclassResponsibility"]
  50791. }),
  50792. $globals.CollectionTest);
  50793. $core.addMethod(
  50794. $core.method({
  50795. selector: "initialize",
  50796. protocol: "initialization",
  50797. fn: function (){
  50798. var self=this;
  50799. return $core.withContext(function($ctx1) {
  50800. (
  50801. $ctx1.supercall = true,
  50802. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  50803. $ctx1.supercall = false;
  50804. self["@sampleBlock"]=(function(){
  50805. });
  50806. return self;
  50807. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  50808. },
  50809. args: [],
  50810. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  50811. referencedClasses: [],
  50812. messageSends: ["initialize"]
  50813. }),
  50814. $globals.CollectionTest);
  50815. $core.addMethod(
  50816. $core.method({
  50817. selector: "isCollectionReadOnly",
  50818. protocol: "testing",
  50819. fn: function (){
  50820. var self=this;
  50821. return false;
  50822. },
  50823. args: [],
  50824. source: "isCollectionReadOnly\x0a\x09^ false",
  50825. referencedClasses: [],
  50826. messageSends: []
  50827. }),
  50828. $globals.CollectionTest);
  50829. $core.addMethod(
  50830. $core.method({
  50831. selector: "sampleNewValue",
  50832. protocol: "fixture",
  50833. fn: function (){
  50834. var self=this;
  50835. return "N";
  50836. },
  50837. args: [],
  50838. 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'",
  50839. referencedClasses: [],
  50840. messageSends: []
  50841. }),
  50842. $globals.CollectionTest);
  50843. $core.addMethod(
  50844. $core.method({
  50845. selector: "sampleNewValueAsCollection",
  50846. protocol: "fixture",
  50847. fn: function (){
  50848. var self=this;
  50849. return $core.withContext(function($ctx1) {
  50850. return $recv(self._collectionClass())._with_(self._sampleNewValue());
  50851. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  50852. },
  50853. args: [],
  50854. 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",
  50855. referencedClasses: [],
  50856. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  50857. }),
  50858. $globals.CollectionTest);
  50859. $core.addMethod(
  50860. $core.method({
  50861. selector: "testAddAll",
  50862. protocol: "tests",
  50863. fn: function (){
  50864. var self=this;
  50865. return $core.withContext(function($ctx1) {
  50866. 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;
  50867. $2=self._collection();
  50868. $ctx1.sendIdx["collection"]=1;
  50869. $4=self._collectionClass();
  50870. $ctx1.sendIdx["collectionClass"]=1;
  50871. $3=$recv($4)._new();
  50872. $ctx1.sendIdx["new"]=1;
  50873. $recv($2)._addAll_($3);
  50874. $ctx1.sendIdx["addAll:"]=1;
  50875. $5=$recv($2)._yourself();
  50876. $ctx1.sendIdx["yourself"]=1;
  50877. $1=$5;
  50878. $6=self._collection();
  50879. $ctx1.sendIdx["collection"]=2;
  50880. self._assert_equals_($1,$6);
  50881. $ctx1.sendIdx["assert:equals:"]=1;
  50882. $9=self._collectionClass();
  50883. $ctx1.sendIdx["collectionClass"]=2;
  50884. $8=$recv($9)._new();
  50885. $ctx1.sendIdx["new"]=2;
  50886. $10=self._collection();
  50887. $ctx1.sendIdx["collection"]=3;
  50888. $recv($8)._addAll_($10);
  50889. $ctx1.sendIdx["addAll:"]=2;
  50890. $11=$recv($8)._yourself();
  50891. $ctx1.sendIdx["yourself"]=2;
  50892. $7=$11;
  50893. $12=self._collection();
  50894. $ctx1.sendIdx["collection"]=4;
  50895. self._assert_equals_($7,$12);
  50896. $ctx1.sendIdx["assert:equals:"]=2;
  50897. $15=self._collectionClass();
  50898. $ctx1.sendIdx["collectionClass"]=3;
  50899. $14=$recv($15)._new();
  50900. $ctx1.sendIdx["new"]=3;
  50901. $17=self._collectionClass();
  50902. $ctx1.sendIdx["collectionClass"]=4;
  50903. $16=$recv($17)._new();
  50904. $ctx1.sendIdx["new"]=4;
  50905. $recv($14)._addAll_($16);
  50906. $ctx1.sendIdx["addAll:"]=3;
  50907. $18=$recv($14)._yourself();
  50908. $ctx1.sendIdx["yourself"]=3;
  50909. $13=$18;
  50910. self._assert_equals_($13,$recv(self._collectionClass())._new());
  50911. $ctx1.sendIdx["assert:equals:"]=3;
  50912. $20=self._collection();
  50913. $ctx1.sendIdx["collection"]=5;
  50914. $21=self._sampleNewValueAsCollection();
  50915. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  50916. $recv($20)._addAll_($21);
  50917. $ctx1.sendIdx["addAll:"]=4;
  50918. $22=$recv($20)._yourself();
  50919. $ctx1.sendIdx["yourself"]=4;
  50920. $19=$22;
  50921. $23=self._collectionWithNewValue();
  50922. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50923. self._assert_equals_($19,$23);
  50924. $25=self._sampleNewValueAsCollection();
  50925. $recv($25)._addAll_(self._collection());
  50926. $24=$recv($25)._yourself();
  50927. self._assertSameContents_as_($24,self._collectionWithNewValue());
  50928. return self;
  50929. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  50930. },
  50931. args: [],
  50932. 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",
  50933. referencedClasses: [],
  50934. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  50935. }),
  50936. $globals.CollectionTest);
  50937. $core.addMethod(
  50938. $core.method({
  50939. selector: "testAllSatisfy",
  50940. protocol: "tests",
  50941. fn: function (){
  50942. var self=this;
  50943. var collection,anyOne;
  50944. return $core.withContext(function($ctx1) {
  50945. var $1;
  50946. collection=self._collection();
  50947. anyOne=$recv(collection)._anyOne();
  50948. $1=$recv(collection)._allSatisfy_((function(each){
  50949. return $core.withContext(function($ctx2) {
  50950. return $recv(collection)._includes_(each);
  50951. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50952. }));
  50953. $ctx1.sendIdx["allSatisfy:"]=1;
  50954. self._assert_($1);
  50955. self._deny_($recv(collection)._allSatisfy_((function(each){
  50956. return $core.withContext(function($ctx2) {
  50957. return $recv(each).__tild_eq(anyOne);
  50958. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50959. })));
  50960. return self;
  50961. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  50962. },
  50963. args: [],
  50964. 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 ])",
  50965. referencedClasses: [],
  50966. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  50967. }),
  50968. $globals.CollectionTest);
  50969. $core.addMethod(
  50970. $core.method({
  50971. selector: "testAnyOne",
  50972. protocol: "tests",
  50973. fn: function (){
  50974. var self=this;
  50975. return $core.withContext(function($ctx1) {
  50976. var $2,$1;
  50977. self._should_raise_((function(){
  50978. return $core.withContext(function($ctx2) {
  50979. return $recv($recv(self._collectionClass())._new())._anyOne();
  50980. $ctx2.sendIdx["anyOne"]=1;
  50981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50982. }),$globals.Error);
  50983. $2=self._collection();
  50984. $ctx1.sendIdx["collection"]=1;
  50985. $1=$recv($2)._includes_($recv(self._collection())._anyOne());
  50986. self._assert_($1);
  50987. return self;
  50988. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  50989. },
  50990. args: [],
  50991. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  50992. referencedClasses: ["Error"],
  50993. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  50994. }),
  50995. $globals.CollectionTest);
  50996. $core.addMethod(
  50997. $core.method({
  50998. selector: "testAnySatisfy",
  50999. protocol: "tests",
  51000. fn: function (){
  51001. var self=this;
  51002. var anyOne;
  51003. return $core.withContext(function($ctx1) {
  51004. var $1,$3,$2;
  51005. $1=self._collection();
  51006. $ctx1.sendIdx["collection"]=1;
  51007. anyOne=$recv($1)._anyOne();
  51008. $3=self._collection();
  51009. $ctx1.sendIdx["collection"]=2;
  51010. $2=$recv($3)._anySatisfy_((function(each){
  51011. return $core.withContext(function($ctx2) {
  51012. return $recv(each).__eq(anyOne);
  51013. $ctx2.sendIdx["="]=1;
  51014. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51015. }));
  51016. $ctx1.sendIdx["anySatisfy:"]=1;
  51017. self._assert_($2);
  51018. self._deny_($recv(self._collection())._anySatisfy_((function(each){
  51019. return $core.withContext(function($ctx2) {
  51020. return $recv(each).__eq($recv($globals.Object)._new());
  51021. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  51022. })));
  51023. return self;
  51024. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  51025. },
  51026. args: [],
  51027. 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 ])",
  51028. referencedClasses: ["Object"],
  51029. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  51030. }),
  51031. $globals.CollectionTest);
  51032. $core.addMethod(
  51033. $core.method({
  51034. selector: "testAsArray",
  51035. protocol: "tests",
  51036. fn: function (){
  51037. var self=this;
  51038. return $core.withContext(function($ctx1) {
  51039. var $1;
  51040. $1=self._collection();
  51041. $ctx1.sendIdx["collection"]=1;
  51042. self._assertSameContents_as_($1,$recv(self._collection())._asArray());
  51043. return self;
  51044. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  51045. },
  51046. args: [],
  51047. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  51048. referencedClasses: [],
  51049. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  51050. }),
  51051. $globals.CollectionTest);
  51052. $core.addMethod(
  51053. $core.method({
  51054. selector: "testAsOrderedCollection",
  51055. protocol: "tests",
  51056. fn: function (){
  51057. var self=this;
  51058. return $core.withContext(function($ctx1) {
  51059. var $1;
  51060. $1=self._collection();
  51061. $ctx1.sendIdx["collection"]=1;
  51062. self._assertSameContents_as_($1,$recv(self._collection())._asOrderedCollection());
  51063. return self;
  51064. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  51065. },
  51066. args: [],
  51067. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  51068. referencedClasses: [],
  51069. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  51070. }),
  51071. $globals.CollectionTest);
  51072. $core.addMethod(
  51073. $core.method({
  51074. selector: "testAsSet",
  51075. protocol: "tests",
  51076. fn: function (){
  51077. var self=this;
  51078. var c,set;
  51079. return $core.withContext(function($ctx1) {
  51080. c=self._collectionWithDuplicates();
  51081. set=$recv(c)._asSet();
  51082. self._assert_equals_($recv(set)._size(),(6));
  51083. $recv(c)._do_((function(each){
  51084. return $core.withContext(function($ctx2) {
  51085. return self._assert_($recv(set)._includes_(each));
  51086. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51087. }));
  51088. return self;
  51089. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  51090. },
  51091. args: [],
  51092. 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) ]",
  51093. referencedClasses: [],
  51094. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  51095. }),
  51096. $globals.CollectionTest);
  51097. $core.addMethod(
  51098. $core.method({
  51099. selector: "testCollect",
  51100. protocol: "tests",
  51101. fn: function (){
  51102. var self=this;
  51103. return $core.withContext(function($ctx1) {
  51104. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  51105. $2=self._collection();
  51106. $ctx1.sendIdx["collection"]=1;
  51107. $1=$recv($2)._collect_((function(each){
  51108. return each;
  51109. }));
  51110. $ctx1.sendIdx["collect:"]=1;
  51111. $3=self._collection();
  51112. $ctx1.sendIdx["collection"]=2;
  51113. self._assert_equals_($1,$3);
  51114. $ctx1.sendIdx["assert:equals:"]=1;
  51115. $5=self._collectionWithNewValue();
  51116. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51117. $4=$recv($5)._collect_((function(each){
  51118. return each;
  51119. }));
  51120. $ctx1.sendIdx["collect:"]=2;
  51121. self._assert_equals_($4,self._collectionWithNewValue());
  51122. $ctx1.sendIdx["assert:equals:"]=2;
  51123. $8=self._collectionClass();
  51124. $ctx1.sendIdx["collectionClass"]=1;
  51125. $7=$recv($8)._new();
  51126. $ctx1.sendIdx["new"]=1;
  51127. $6=$recv($7)._collect_((function(each){
  51128. return $core.withContext(function($ctx2) {
  51129. return $recv(each)._printString();
  51130. $ctx2.sendIdx["printString"]=1;
  51131. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  51132. }));
  51133. $ctx1.sendIdx["collect:"]=3;
  51134. self._assert_equals_($6,$recv(self._collectionClass())._new());
  51135. $ctx1.sendIdx["assert:equals:"]=3;
  51136. $11=self._collection();
  51137. $ctx1.sendIdx["collection"]=3;
  51138. $10=$recv($11)._collect_((function(){
  51139. return $core.withContext(function($ctx2) {
  51140. return self._sampleNewValue();
  51141. $ctx2.sendIdx["sampleNewValue"]=1;
  51142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  51143. }));
  51144. $ctx1.sendIdx["collect:"]=4;
  51145. $9=$recv($10)._detect_((function(){
  51146. return true;
  51147. }));
  51148. self._assert_equals_($9,self._sampleNewValue());
  51149. $ctx1.sendIdx["assert:equals:"]=4;
  51150. self._assert_equals_($recv(self._collection())._collect_((function(each){
  51151. return $core.withContext(function($ctx2) {
  51152. return $recv(each)._printString();
  51153. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  51154. })),self._collectionOfPrintStrings());
  51155. return self;
  51156. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  51157. },
  51158. args: [],
  51159. 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",
  51160. referencedClasses: [],
  51161. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  51162. }),
  51163. $globals.CollectionTest);
  51164. $core.addMethod(
  51165. $core.method({
  51166. selector: "testComma",
  51167. protocol: "tests",
  51168. fn: function (){
  51169. var self=this;
  51170. return $core.withContext(function($ctx1) {
  51171. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  51172. $2=self._collection();
  51173. $ctx1.sendIdx["collection"]=1;
  51174. $4=self._collectionClass();
  51175. $ctx1.sendIdx["collectionClass"]=1;
  51176. $3=$recv($4)._new();
  51177. $ctx1.sendIdx["new"]=1;
  51178. $1=$recv($2).__comma($3);
  51179. $ctx1.sendIdx[","]=1;
  51180. $5=self._collection();
  51181. $ctx1.sendIdx["collection"]=2;
  51182. self._assert_equals_($1,$5);
  51183. $ctx1.sendIdx["assert:equals:"]=1;
  51184. $8=self._collectionClass();
  51185. $ctx1.sendIdx["collectionClass"]=2;
  51186. $7=$recv($8)._new();
  51187. $ctx1.sendIdx["new"]=2;
  51188. $9=self._collection();
  51189. $ctx1.sendIdx["collection"]=3;
  51190. $6=$recv($7).__comma($9);
  51191. $ctx1.sendIdx[","]=2;
  51192. $10=self._collection();
  51193. $ctx1.sendIdx["collection"]=4;
  51194. self._assert_equals_($6,$10);
  51195. $ctx1.sendIdx["assert:equals:"]=2;
  51196. $13=self._collectionClass();
  51197. $ctx1.sendIdx["collectionClass"]=3;
  51198. $12=$recv($13)._new();
  51199. $ctx1.sendIdx["new"]=3;
  51200. $15=self._collectionClass();
  51201. $ctx1.sendIdx["collectionClass"]=4;
  51202. $14=$recv($15)._new();
  51203. $ctx1.sendIdx["new"]=4;
  51204. $11=$recv($12).__comma($14);
  51205. $ctx1.sendIdx[","]=3;
  51206. self._assert_equals_($11,$recv(self._collectionClass())._new());
  51207. $ctx1.sendIdx["assert:equals:"]=3;
  51208. $17=self._collection();
  51209. $ctx1.sendIdx["collection"]=5;
  51210. $18=self._sampleNewValueAsCollection();
  51211. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  51212. $16=$recv($17).__comma($18);
  51213. $ctx1.sendIdx[","]=4;
  51214. $19=self._collectionWithNewValue();
  51215. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51216. self._assert_equals_($16,$19);
  51217. self._assertSameContents_as_($recv(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  51218. return self;
  51219. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  51220. },
  51221. args: [],
  51222. 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",
  51223. referencedClasses: [],
  51224. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  51225. }),
  51226. $globals.CollectionTest);
  51227. $core.addMethod(
  51228. $core.method({
  51229. selector: "testCopy",
  51230. protocol: "tests",
  51231. fn: function (){
  51232. var self=this;
  51233. return $core.withContext(function($ctx1) {
  51234. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  51235. $3=self._collectionClass();
  51236. $ctx1.sendIdx["collectionClass"]=1;
  51237. $2=$recv($3)._new();
  51238. $ctx1.sendIdx["new"]=1;
  51239. $1=$recv($2)._copy();
  51240. $ctx1.sendIdx["copy"]=1;
  51241. $5=self._collectionClass();
  51242. $ctx1.sendIdx["collectionClass"]=2;
  51243. $4=$recv($5)._new();
  51244. $ctx1.sendIdx["new"]=2;
  51245. self._assert_equals_($1,$4);
  51246. $ctx1.sendIdx["assert:equals:"]=1;
  51247. $7=self._collection();
  51248. $ctx1.sendIdx["collection"]=1;
  51249. $6=$recv($7)._copy();
  51250. $ctx1.sendIdx["copy"]=2;
  51251. $8=self._collection();
  51252. $ctx1.sendIdx["collection"]=2;
  51253. self._assert_equals_($6,$8);
  51254. $ctx1.sendIdx["assert:equals:"]=2;
  51255. $10=self._collectionWithNewValue();
  51256. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51257. $9=$recv($10)._copy();
  51258. $ctx1.sendIdx["copy"]=3;
  51259. $11=self._collectionWithNewValue();
  51260. $ctx1.sendIdx["collectionWithNewValue"]=2;
  51261. self._assert_equals_($9,$11);
  51262. $15=self._collectionClass();
  51263. $ctx1.sendIdx["collectionClass"]=3;
  51264. $14=$recv($15)._new();
  51265. $ctx1.sendIdx["new"]=3;
  51266. $13=$recv($14)._copy();
  51267. $ctx1.sendIdx["copy"]=4;
  51268. $16=self._collection();
  51269. $ctx1.sendIdx["collection"]=3;
  51270. $12=$recv($13).__eq($16);
  51271. $ctx1.sendIdx["="]=1;
  51272. self._deny_($12);
  51273. $ctx1.sendIdx["deny:"]=1;
  51274. $19=self._collection();
  51275. $ctx1.sendIdx["collection"]=4;
  51276. $18=$recv($19)._copy();
  51277. $ctx1.sendIdx["copy"]=5;
  51278. $17=$recv($18).__eq($recv(self._collectionClass())._new());
  51279. $ctx1.sendIdx["="]=2;
  51280. self._deny_($17);
  51281. $ctx1.sendIdx["deny:"]=2;
  51282. self._deny_($recv($recv(self._collection())._copy()).__eq(self._collectionWithNewValue()));
  51283. return self;
  51284. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  51285. },
  51286. args: [],
  51287. 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",
  51288. referencedClasses: [],
  51289. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  51290. }),
  51291. $globals.CollectionTest);
  51292. $core.addMethod(
  51293. $core.method({
  51294. selector: "testCopySeparates",
  51295. protocol: "tests",
  51296. fn: function (){
  51297. var self=this;
  51298. var original,copy;
  51299. return $core.withContext(function($ctx1) {
  51300. original=self._collection();
  51301. $ctx1.sendIdx["collection"]=1;
  51302. copy=$recv(original)._copy();
  51303. $recv(copy)._addAll_(self._sampleNewValueAsCollection());
  51304. self._assert_($recv(original).__eq(self._collection()));
  51305. return self;
  51306. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  51307. },
  51308. args: [],
  51309. 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",
  51310. referencedClasses: [],
  51311. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  51312. }),
  51313. $globals.CollectionTest);
  51314. $core.addMethod(
  51315. $core.method({
  51316. selector: "testDetect",
  51317. protocol: "tests",
  51318. fn: function (){
  51319. var self=this;
  51320. return $core.withContext(function($ctx1) {
  51321. var $1,$2,$3,$4,$6,$5,$7;
  51322. self._shouldnt_raise_((function(){
  51323. return $core.withContext(function($ctx2) {
  51324. $1=self._collection();
  51325. $ctx2.sendIdx["collection"]=1;
  51326. return $recv($1)._detect_((function(){
  51327. return true;
  51328. }));
  51329. $ctx2.sendIdx["detect:"]=1;
  51330. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51331. }),$globals.Error);
  51332. self._should_raise_((function(){
  51333. return $core.withContext(function($ctx2) {
  51334. $2=self._collection();
  51335. $ctx2.sendIdx["collection"]=2;
  51336. return $recv($2)._detect_((function(){
  51337. return false;
  51338. }));
  51339. $ctx2.sendIdx["detect:"]=2;
  51340. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51341. }),$globals.Error);
  51342. $ctx1.sendIdx["should:raise:"]=1;
  51343. $3=$recv(self._sampleNewValueAsCollection())._detect_((function(){
  51344. return true;
  51345. }));
  51346. $ctx1.sendIdx["detect:"]=3;
  51347. $4=self._sampleNewValue();
  51348. $ctx1.sendIdx["sampleNewValue"]=1;
  51349. self._assert_equals_($3,$4);
  51350. $ctx1.sendIdx["assert:equals:"]=1;
  51351. $5=$recv(self._collectionWithNewValue())._detect_((function(each){
  51352. return $core.withContext(function($ctx2) {
  51353. $6=self._sampleNewValue();
  51354. $ctx2.sendIdx["sampleNewValue"]=2;
  51355. return $recv(each).__eq($6);
  51356. $ctx2.sendIdx["="]=1;
  51357. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  51358. }));
  51359. $ctx1.sendIdx["detect:"]=4;
  51360. $7=self._sampleNewValue();
  51361. $ctx1.sendIdx["sampleNewValue"]=3;
  51362. self._assert_equals_($5,$7);
  51363. self._should_raise_((function(){
  51364. return $core.withContext(function($ctx2) {
  51365. return $recv(self._collection())._detect_((function(each){
  51366. return $core.withContext(function($ctx3) {
  51367. return $recv(each).__eq(self._sampleNewValue());
  51368. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  51369. }));
  51370. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  51371. }),$globals.Error);
  51372. return self;
  51373. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  51374. },
  51375. args: [],
  51376. 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",
  51377. referencedClasses: ["Error"],
  51378. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  51379. }),
  51380. $globals.CollectionTest);
  51381. $core.addMethod(
  51382. $core.method({
  51383. selector: "testDetectIfNone",
  51384. protocol: "tests",
  51385. fn: function (){
  51386. var self=this;
  51387. var sentinel;
  51388. return $core.withContext(function($ctx1) {
  51389. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  51390. sentinel=$recv($globals.Object)._new();
  51391. $3=self._collection();
  51392. $ctx1.sendIdx["collection"]=1;
  51393. $2=$recv($3)._detect_ifNone_((function(){
  51394. return true;
  51395. }),(function(){
  51396. return sentinel;
  51397. }));
  51398. $ctx1.sendIdx["detect:ifNone:"]=1;
  51399. $1=$recv($2).__tild_eq(sentinel);
  51400. self._assert_($1);
  51401. $5=self._collection();
  51402. $ctx1.sendIdx["collection"]=2;
  51403. $4=$recv($5)._detect_ifNone_((function(){
  51404. return false;
  51405. }),(function(){
  51406. return sentinel;
  51407. }));
  51408. $ctx1.sendIdx["detect:ifNone:"]=2;
  51409. self._assert_equals_($4,sentinel);
  51410. $ctx1.sendIdx["assert:equals:"]=1;
  51411. $6=$recv(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  51412. return true;
  51413. }),(function(){
  51414. return sentinel;
  51415. }));
  51416. $ctx1.sendIdx["detect:ifNone:"]=3;
  51417. $7=self._sampleNewValue();
  51418. $ctx1.sendIdx["sampleNewValue"]=1;
  51419. self._assert_equals_($6,$7);
  51420. $ctx1.sendIdx["assert:equals:"]=2;
  51421. $8=$recv(self._collectionWithNewValue())._detect_ifNone_((function(each){
  51422. return $core.withContext(function($ctx2) {
  51423. $9=self._sampleNewValue();
  51424. $ctx2.sendIdx["sampleNewValue"]=2;
  51425. return $recv(each).__eq($9);
  51426. $ctx2.sendIdx["="]=1;
  51427. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  51428. }),(function(){
  51429. return sentinel;
  51430. }));
  51431. $ctx1.sendIdx["detect:ifNone:"]=4;
  51432. $10=self._sampleNewValue();
  51433. $ctx1.sendIdx["sampleNewValue"]=3;
  51434. self._assert_equals_($8,$10);
  51435. $ctx1.sendIdx["assert:equals:"]=3;
  51436. self._assert_equals_($recv(self._collection())._detect_ifNone_((function(each){
  51437. return $core.withContext(function($ctx2) {
  51438. return $recv(each).__eq(self._sampleNewValue());
  51439. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  51440. }),(function(){
  51441. return sentinel;
  51442. })),sentinel);
  51443. return self;
  51444. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  51445. },
  51446. args: [],
  51447. 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",
  51448. referencedClasses: ["Object"],
  51449. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  51450. }),
  51451. $globals.CollectionTest);
  51452. $core.addMethod(
  51453. $core.method({
  51454. selector: "testDo",
  51455. protocol: "tests",
  51456. fn: function (){
  51457. var self=this;
  51458. var newCollection;
  51459. return $core.withContext(function($ctx1) {
  51460. var $1,$2;
  51461. newCollection=$recv($globals.OrderedCollection)._new();
  51462. $ctx1.sendIdx["new"]=1;
  51463. $1=self._collection();
  51464. $ctx1.sendIdx["collection"]=1;
  51465. $recv($1)._do_((function(each){
  51466. return $core.withContext(function($ctx2) {
  51467. return $recv(newCollection)._add_(each);
  51468. $ctx2.sendIdx["add:"]=1;
  51469. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51470. }));
  51471. $ctx1.sendIdx["do:"]=1;
  51472. self._assertSameContents_as_(self._collection(),newCollection);
  51473. $ctx1.sendIdx["assertSameContents:as:"]=1;
  51474. newCollection=$recv($globals.OrderedCollection)._new();
  51475. $2=self._collectionWithDuplicates();
  51476. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  51477. $recv($2)._do_((function(each){
  51478. return $core.withContext(function($ctx2) {
  51479. return $recv(newCollection)._add_(each);
  51480. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  51481. }));
  51482. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  51483. return self;
  51484. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  51485. },
  51486. args: [],
  51487. 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",
  51488. referencedClasses: ["OrderedCollection"],
  51489. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  51490. }),
  51491. $globals.CollectionTest);
  51492. $core.addMethod(
  51493. $core.method({
  51494. selector: "testEquality",
  51495. protocol: "tests",
  51496. fn: function (){
  51497. var self=this;
  51498. return $core.withContext(function($ctx1) {
  51499. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  51500. $2=self._collectionClass();
  51501. $ctx1.sendIdx["collectionClass"]=1;
  51502. $1=$recv($2)._new();
  51503. $ctx1.sendIdx["new"]=1;
  51504. $4=self._collectionClass();
  51505. $ctx1.sendIdx["collectionClass"]=2;
  51506. $3=$recv($4)._new();
  51507. $ctx1.sendIdx["new"]=2;
  51508. self._assert_equals_($1,$3);
  51509. $ctx1.sendIdx["assert:equals:"]=1;
  51510. $5=self._collection();
  51511. $ctx1.sendIdx["collection"]=1;
  51512. $6=self._collection();
  51513. $ctx1.sendIdx["collection"]=2;
  51514. self._assert_equals_($5,$6);
  51515. $ctx1.sendIdx["assert:equals:"]=2;
  51516. $7=self._collectionWithNewValue();
  51517. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51518. $8=self._collectionWithNewValue();
  51519. $ctx1.sendIdx["collectionWithNewValue"]=2;
  51520. self._assert_equals_($7,$8);
  51521. $11=self._collectionClass();
  51522. $ctx1.sendIdx["collectionClass"]=3;
  51523. $10=$recv($11)._new();
  51524. $ctx1.sendIdx["new"]=3;
  51525. $12=self._collection();
  51526. $ctx1.sendIdx["collection"]=3;
  51527. $9=$recv($10).__eq($12);
  51528. $ctx1.sendIdx["="]=1;
  51529. self._deny_($9);
  51530. $ctx1.sendIdx["deny:"]=1;
  51531. $14=self._collection();
  51532. $ctx1.sendIdx["collection"]=4;
  51533. $13=$recv($14).__eq($recv(self._collectionClass())._new());
  51534. $ctx1.sendIdx["="]=2;
  51535. self._deny_($13);
  51536. $ctx1.sendIdx["deny:"]=2;
  51537. self._deny_($recv(self._collection()).__eq(self._collectionWithNewValue()));
  51538. return self;
  51539. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  51540. },
  51541. args: [],
  51542. 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",
  51543. referencedClasses: [],
  51544. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  51545. }),
  51546. $globals.CollectionTest);
  51547. $core.addMethod(
  51548. $core.method({
  51549. selector: "testIfEmptyFamily",
  51550. protocol: "tests",
  51551. fn: function (){
  51552. var self=this;
  51553. return $core.withContext(function($ctx1) {
  51554. 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;
  51555. $3=self._collectionClass();
  51556. $ctx1.sendIdx["collectionClass"]=1;
  51557. $2=$recv($3)._new();
  51558. $ctx1.sendIdx["new"]=1;
  51559. $1=$recv($2)._ifEmpty_((function(){
  51560. return (42);
  51561. }));
  51562. $ctx1.sendIdx["ifEmpty:"]=1;
  51563. self._assert_equals_($1,(42));
  51564. $ctx1.sendIdx["assert:equals:"]=1;
  51565. $5=self._collection();
  51566. $ctx1.sendIdx["collection"]=1;
  51567. $4=$recv($5)._ifEmpty_((function(){
  51568. return (42);
  51569. }));
  51570. $6=self._collection();
  51571. $ctx1.sendIdx["collection"]=2;
  51572. self._assert_equals_($4,$6);
  51573. $ctx1.sendIdx["assert:equals:"]=2;
  51574. $9=self._collectionClass();
  51575. $ctx1.sendIdx["collectionClass"]=2;
  51576. $8=$recv($9)._new();
  51577. $ctx1.sendIdx["new"]=2;
  51578. $7=$recv($8)._ifNotEmpty_((function(){
  51579. return (42);
  51580. }));
  51581. $ctx1.sendIdx["ifNotEmpty:"]=1;
  51582. $11=self._collectionClass();
  51583. $ctx1.sendIdx["collectionClass"]=3;
  51584. $10=$recv($11)._new();
  51585. $ctx1.sendIdx["new"]=3;
  51586. self._assert_equals_($7,$10);
  51587. $ctx1.sendIdx["assert:equals:"]=3;
  51588. $13=self._collection();
  51589. $ctx1.sendIdx["collection"]=3;
  51590. $12=$recv($13)._ifNotEmpty_((function(){
  51591. return (42);
  51592. }));
  51593. $ctx1.sendIdx["ifNotEmpty:"]=2;
  51594. self._assert_equals_($12,(42));
  51595. $ctx1.sendIdx["assert:equals:"]=4;
  51596. $15=self._collection();
  51597. $ctx1.sendIdx["collection"]=4;
  51598. $14=$recv($15)._ifNotEmpty_((function(col){
  51599. return col;
  51600. }));
  51601. $16=self._collection();
  51602. $ctx1.sendIdx["collection"]=5;
  51603. self._assert_equals_($14,$16);
  51604. $ctx1.sendIdx["assert:equals:"]=5;
  51605. $19=self._collectionClass();
  51606. $ctx1.sendIdx["collectionClass"]=4;
  51607. $18=$recv($19)._new();
  51608. $ctx1.sendIdx["new"]=4;
  51609. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  51610. return (42);
  51611. }),(function(){
  51612. return (999);
  51613. }));
  51614. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  51615. self._assert_equals_($17,(42));
  51616. $ctx1.sendIdx["assert:equals:"]=6;
  51617. $21=self._collection();
  51618. $ctx1.sendIdx["collection"]=6;
  51619. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  51620. return (42);
  51621. }),(function(){
  51622. return (999);
  51623. }));
  51624. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  51625. self._assert_equals_($20,(999));
  51626. $ctx1.sendIdx["assert:equals:"]=7;
  51627. $23=self._collection();
  51628. $ctx1.sendIdx["collection"]=7;
  51629. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  51630. return (42);
  51631. }),(function(col){
  51632. return col;
  51633. }));
  51634. $24=self._collection();
  51635. $ctx1.sendIdx["collection"]=8;
  51636. self._assert_equals_($22,$24);
  51637. $ctx1.sendIdx["assert:equals:"]=8;
  51638. $25=$recv($recv(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  51639. return (42);
  51640. }),(function(){
  51641. return (999);
  51642. }));
  51643. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  51644. self._assert_equals_($25,(999));
  51645. $ctx1.sendIdx["assert:equals:"]=9;
  51646. $27=self._collection();
  51647. $ctx1.sendIdx["collection"]=9;
  51648. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  51649. return (42);
  51650. }),(function(){
  51651. return (999);
  51652. }));
  51653. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  51654. self._assert_equals_($26,(42));
  51655. $ctx1.sendIdx["assert:equals:"]=10;
  51656. $29=self._collection();
  51657. $ctx1.sendIdx["collection"]=10;
  51658. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  51659. return col;
  51660. }),(function(){
  51661. return (999);
  51662. }));
  51663. self._assert_equals_($28,self._collection());
  51664. return self;
  51665. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  51666. },
  51667. args: [],
  51668. 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.",
  51669. referencedClasses: [],
  51670. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  51671. }),
  51672. $globals.CollectionTest);
  51673. $core.addMethod(
  51674. $core.method({
  51675. selector: "testIsEmpty",
  51676. protocol: "tests",
  51677. fn: function (){
  51678. var self=this;
  51679. return $core.withContext(function($ctx1) {
  51680. var $1;
  51681. $1=$recv($recv(self._collectionClass())._new())._isEmpty();
  51682. $ctx1.sendIdx["isEmpty"]=1;
  51683. self._assert_($1);
  51684. self._deny_($recv(self._collection())._isEmpty());
  51685. return self;
  51686. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  51687. },
  51688. args: [],
  51689. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  51690. referencedClasses: [],
  51691. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  51692. }),
  51693. $globals.CollectionTest);
  51694. $core.addMethod(
  51695. $core.method({
  51696. selector: "testNoneSatisfy",
  51697. protocol: "tests",
  51698. fn: function (){
  51699. var self=this;
  51700. var anyOne;
  51701. return $core.withContext(function($ctx1) {
  51702. var $1,$3,$2;
  51703. $1=self._collection();
  51704. $ctx1.sendIdx["collection"]=1;
  51705. anyOne=$recv($1)._anyOne();
  51706. $3=self._collection();
  51707. $ctx1.sendIdx["collection"]=2;
  51708. $2=$recv($3)._noneSatisfy_((function(each){
  51709. return $core.withContext(function($ctx2) {
  51710. return $recv(each).__eq(anyOne);
  51711. $ctx2.sendIdx["="]=1;
  51712. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51713. }));
  51714. $ctx1.sendIdx["noneSatisfy:"]=1;
  51715. self._deny_($2);
  51716. self._assert_($recv(self._collection())._noneSatisfy_((function(each){
  51717. return $core.withContext(function($ctx2) {
  51718. return $recv(each).__eq($recv($globals.Object)._new());
  51719. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  51720. })));
  51721. return self;
  51722. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  51723. },
  51724. args: [],
  51725. 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 ])",
  51726. referencedClasses: ["Object"],
  51727. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  51728. }),
  51729. $globals.CollectionTest);
  51730. $core.addMethod(
  51731. $core.method({
  51732. selector: "testRemoveAll",
  51733. protocol: "tests",
  51734. fn: function (){
  51735. var self=this;
  51736. return $core.withContext(function($ctx1) {
  51737. var $2,$1;
  51738. $2=self._collection();
  51739. $recv($2)._removeAll();
  51740. $1=$recv($2)._yourself();
  51741. self._assert_equals_($1,$recv(self._collectionClass())._new());
  51742. return self;
  51743. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  51744. },
  51745. args: [],
  51746. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  51747. referencedClasses: [],
  51748. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  51749. }),
  51750. $globals.CollectionTest);
  51751. $core.addMethod(
  51752. $core.method({
  51753. selector: "testSelect",
  51754. protocol: "tests",
  51755. fn: function (){
  51756. var self=this;
  51757. return $core.withContext(function($ctx1) {
  51758. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  51759. $2=self._collection();
  51760. $ctx1.sendIdx["collection"]=1;
  51761. $1=$recv($2)._select_((function(){
  51762. return false;
  51763. }));
  51764. $ctx1.sendIdx["select:"]=1;
  51765. $4=self._collectionClass();
  51766. $ctx1.sendIdx["collectionClass"]=1;
  51767. $3=$recv($4)._new();
  51768. $ctx1.sendIdx["new"]=1;
  51769. self._assert_equals_($1,$3);
  51770. $ctx1.sendIdx["assert:equals:"]=1;
  51771. $6=self._collection();
  51772. $ctx1.sendIdx["collection"]=2;
  51773. $5=$recv($6)._select_((function(){
  51774. return true;
  51775. }));
  51776. $ctx1.sendIdx["select:"]=2;
  51777. $7=self._collection();
  51778. $ctx1.sendIdx["collection"]=3;
  51779. self._assert_equals_($5,$7);
  51780. $ctx1.sendIdx["assert:equals:"]=2;
  51781. $9=self._collectionWithNewValue();
  51782. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51783. $8=$recv($9)._select_((function(each){
  51784. return $core.withContext(function($ctx2) {
  51785. $10=self._sampleNewValue();
  51786. $ctx2.sendIdx["sampleNewValue"]=1;
  51787. return $recv(each).__eq($10);
  51788. $ctx2.sendIdx["="]=1;
  51789. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  51790. }));
  51791. $ctx1.sendIdx["select:"]=3;
  51792. self._assert_equals_($8,self._sampleNewValueAsCollection());
  51793. $ctx1.sendIdx["assert:equals:"]=3;
  51794. $12=self._collectionWithNewValue();
  51795. $ctx1.sendIdx["collectionWithNewValue"]=2;
  51796. $11=$recv($12)._select_((function(each){
  51797. return $core.withContext(function($ctx2) {
  51798. $13=self._sampleNewValue();
  51799. $ctx2.sendIdx["sampleNewValue"]=2;
  51800. return $recv(each).__tild_eq($13);
  51801. $ctx2.sendIdx["~="]=1;
  51802. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  51803. }));
  51804. $ctx1.sendIdx["select:"]=4;
  51805. $14=self._collection();
  51806. $ctx1.sendIdx["collection"]=4;
  51807. self._assert_equals_($11,$14);
  51808. $ctx1.sendIdx["assert:equals:"]=4;
  51809. $16=self._collection();
  51810. $ctx1.sendIdx["collection"]=5;
  51811. $15=$recv($16)._select_((function(each){
  51812. return $core.withContext(function($ctx2) {
  51813. $17=self._sampleNewValue();
  51814. $ctx2.sendIdx["sampleNewValue"]=3;
  51815. return $recv(each).__eq($17);
  51816. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  51817. }));
  51818. $ctx1.sendIdx["select:"]=5;
  51819. self._assert_equals_($15,$recv(self._collectionClass())._new());
  51820. $ctx1.sendIdx["assert:equals:"]=5;
  51821. self._assert_equals_($recv(self._collectionWithNewValue())._select_((function(each){
  51822. return $core.withContext(function($ctx2) {
  51823. return $recv(each).__tild_eq(self._sampleNewValue());
  51824. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  51825. })),self._collection());
  51826. return self;
  51827. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  51828. },
  51829. args: [],
  51830. 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",
  51831. referencedClasses: [],
  51832. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  51833. }),
  51834. $globals.CollectionTest);
  51835. $core.addMethod(
  51836. $core.method({
  51837. selector: "testSelectThenCollect",
  51838. protocol: "tests",
  51839. fn: function (){
  51840. var self=this;
  51841. return $core.withContext(function($ctx1) {
  51842. var $2,$1,$4,$3,$6,$5,$7,$9,$8;
  51843. $2=self._collection();
  51844. $ctx1.sendIdx["collection"]=1;
  51845. $1=$recv($2)._select_thenCollect_((function(){
  51846. return false;
  51847. }),"isString");
  51848. $ctx1.sendIdx["select:thenCollect:"]=1;
  51849. $4=self._collectionClass();
  51850. $ctx1.sendIdx["collectionClass"]=1;
  51851. $3=$recv($4)._new();
  51852. $ctx1.sendIdx["new"]=1;
  51853. self._assert_equals_($1,$3);
  51854. $ctx1.sendIdx["assert:equals:"]=1;
  51855. $6=self._collection();
  51856. $ctx1.sendIdx["collection"]=2;
  51857. $5=$recv($6)._select_thenCollect_((function(){
  51858. return true;
  51859. }),(function(x){
  51860. return x;
  51861. }));
  51862. $ctx1.sendIdx["select:thenCollect:"]=2;
  51863. $7=self._collection();
  51864. $ctx1.sendIdx["collection"]=3;
  51865. self._assert_equals_($5,$7);
  51866. $ctx1.sendIdx["assert:equals:"]=2;
  51867. $8=$recv(self._collection())._select_thenCollect_((function(each){
  51868. return $core.withContext(function($ctx2) {
  51869. $9=self._sampleNewValue();
  51870. $ctx2.sendIdx["sampleNewValue"]=1;
  51871. return $recv(each).__eq($9);
  51872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  51873. }),(function(x){
  51874. return x;
  51875. }));
  51876. $ctx1.sendIdx["select:thenCollect:"]=3;
  51877. self._assert_equals_($8,$recv(self._collectionClass())._new());
  51878. $ctx1.sendIdx["assert:equals:"]=3;
  51879. self._assert_equals_($recv(self._collectionWithNewValue())._select_thenCollect_((function(each){
  51880. return $core.withContext(function($ctx2) {
  51881. return $recv(each).__tild_eq(self._sampleNewValue());
  51882. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  51883. }),"printString"),self._collectionOfPrintStrings());
  51884. return self;
  51885. }, function($ctx1) {$ctx1.fill(self,"testSelectThenCollect",{},$globals.CollectionTest)});
  51886. },
  51887. args: [],
  51888. 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",
  51889. referencedClasses: [],
  51890. messageSends: ["assert:equals:", "select:thenCollect:", "collection", "new", "collectionClass", "=", "sampleNewValue", "collectionWithNewValue", "~=", "collectionOfPrintStrings"]
  51891. }),
  51892. $globals.CollectionTest);
  51893. $core.addMethod(
  51894. $core.method({
  51895. selector: "testSingle",
  51896. protocol: "tests",
  51897. fn: function (){
  51898. var self=this;
  51899. return $core.withContext(function($ctx1) {
  51900. self._should_raise_((function(){
  51901. return $core.withContext(function($ctx2) {
  51902. return $recv($recv(self._collectionClass())._new())._single();
  51903. $ctx2.sendIdx["single"]=1;
  51904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51905. }),$globals.Error);
  51906. $ctx1.sendIdx["should:raise:"]=1;
  51907. self._should_raise_((function(){
  51908. return $core.withContext(function($ctx2) {
  51909. return $recv(self._collection())._single();
  51910. $ctx2.sendIdx["single"]=2;
  51911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51912. }),$globals.Error);
  51913. self._assert_equals_($recv(self._sampleNewValueAsCollection())._single(),self._sampleNewValue());
  51914. return self;
  51915. }, function($ctx1) {$ctx1.fill(self,"testSingle",{},$globals.CollectionTest)});
  51916. },
  51917. args: [],
  51918. 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",
  51919. referencedClasses: ["Error"],
  51920. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  51921. }),
  51922. $globals.CollectionTest);
  51923. $core.addMethod(
  51924. $core.method({
  51925. selector: "testSize",
  51926. protocol: "tests",
  51927. fn: function (){
  51928. var self=this;
  51929. return $core.withContext(function($ctx1) {
  51930. var $1,$2;
  51931. $1=$recv($recv(self._collectionClass())._new())._size();
  51932. $ctx1.sendIdx["size"]=1;
  51933. self._assert_equals_($1,(0));
  51934. $ctx1.sendIdx["assert:equals:"]=1;
  51935. $2=$recv(self._sampleNewValueAsCollection())._size();
  51936. $ctx1.sendIdx["size"]=2;
  51937. self._assert_equals_($2,(1));
  51938. $ctx1.sendIdx["assert:equals:"]=2;
  51939. self._assert_equals_($recv(self._collection())._size(),self._collectionSize());
  51940. return self;
  51941. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  51942. },
  51943. args: [],
  51944. 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",
  51945. referencedClasses: [],
  51946. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  51947. }),
  51948. $globals.CollectionTest);
  51949. $core.addMethod(
  51950. $core.method({
  51951. selector: "collectionClass",
  51952. protocol: "fixture",
  51953. fn: function (){
  51954. var self=this;
  51955. return nil;
  51956. },
  51957. args: [],
  51958. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  51959. referencedClasses: [],
  51960. messageSends: []
  51961. }),
  51962. $globals.CollectionTest.klass);
  51963. $core.addMethod(
  51964. $core.method({
  51965. selector: "isAbstract",
  51966. protocol: "testing",
  51967. fn: function (){
  51968. var self=this;
  51969. return $core.withContext(function($ctx1) {
  51970. return $recv(self._collectionClass())._isNil();
  51971. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.klass)});
  51972. },
  51973. args: [],
  51974. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  51975. referencedClasses: [],
  51976. messageSends: ["isNil", "collectionClass"]
  51977. }),
  51978. $globals.CollectionTest.klass);
  51979. $core.addClass("IndexableCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  51980. $core.addMethod(
  51981. $core.method({
  51982. selector: "collectionWithNewValue",
  51983. protocol: "fixture",
  51984. fn: function (){
  51985. var self=this;
  51986. return $core.withContext(function($ctx1) {
  51987. self._subclassResponsibility();
  51988. return self;
  51989. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  51990. },
  51991. args: [],
  51992. 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",
  51993. referencedClasses: [],
  51994. messageSends: ["subclassResponsibility"]
  51995. }),
  51996. $globals.IndexableCollectionTest);
  51997. $core.addMethod(
  51998. $core.method({
  51999. selector: "sampleNewIndex",
  52000. protocol: "fixture",
  52001. fn: function (){
  52002. var self=this;
  52003. return $core.withContext(function($ctx1) {
  52004. self._subclassResponsibility();
  52005. return self;
  52006. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  52007. },
  52008. args: [],
  52009. 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",
  52010. referencedClasses: [],
  52011. messageSends: ["subclassResponsibility"]
  52012. }),
  52013. $globals.IndexableCollectionTest);
  52014. $core.addMethod(
  52015. $core.method({
  52016. selector: "sampleNonIndexesDo:",
  52017. protocol: "fixture",
  52018. fn: function (aBlock){
  52019. var self=this;
  52020. return $core.withContext(function($ctx1) {
  52021. self._subclassResponsibility();
  52022. return self;
  52023. }, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  52024. },
  52025. args: ["aBlock"],
  52026. source: "sampleNonIndexesDo: 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",
  52027. referencedClasses: [],
  52028. messageSends: ["subclassResponsibility"]
  52029. }),
  52030. $globals.IndexableCollectionTest);
  52031. $core.addMethod(
  52032. $core.method({
  52033. selector: "samplesDo:",
  52034. protocol: "fixture",
  52035. fn: function (aBlock){
  52036. var self=this;
  52037. return $core.withContext(function($ctx1) {
  52038. self._subclassResponsibility();
  52039. return self;
  52040. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  52041. },
  52042. args: ["aBlock"],
  52043. 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",
  52044. referencedClasses: [],
  52045. messageSends: ["subclassResponsibility"]
  52046. }),
  52047. $globals.IndexableCollectionTest);
  52048. $core.addMethod(
  52049. $core.method({
  52050. selector: "testAt",
  52051. protocol: "tests",
  52052. fn: function (){
  52053. var self=this;
  52054. return $core.withContext(function($ctx1) {
  52055. var $1;
  52056. self._nonIndexesDo_((function(each){
  52057. return $core.withContext(function($ctx2) {
  52058. return self._should_raise_((function(){
  52059. return $core.withContext(function($ctx3) {
  52060. $1=self._collection();
  52061. $ctx3.sendIdx["collection"]=1;
  52062. return $recv($1)._at_(each);
  52063. $ctx3.sendIdx["at:"]=1;
  52064. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  52065. }),$globals.Error);
  52066. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52067. }));
  52068. self._samplesDo_((function(index,value){
  52069. return $core.withContext(function($ctx2) {
  52070. return self._assert_equals_($recv(self._collection())._at_(index),value);
  52071. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  52072. }));
  52073. return self;
  52074. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  52075. },
  52076. args: [],
  52077. 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 ]",
  52078. referencedClasses: ["Error"],
  52079. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  52080. }),
  52081. $globals.IndexableCollectionTest);
  52082. $core.addMethod(
  52083. $core.method({
  52084. selector: "testAtIfAbsent",
  52085. protocol: "tests",
  52086. fn: function (){
  52087. var self=this;
  52088. return $core.withContext(function($ctx1) {
  52089. var $2,$1,$3;
  52090. self._nonIndexesDo_((function(each){
  52091. return $core.withContext(function($ctx2) {
  52092. $2=self._collection();
  52093. $ctx2.sendIdx["collection"]=1;
  52094. $1=$recv($2)._at_ifAbsent_(each,(function(){
  52095. return $core.withContext(function($ctx3) {
  52096. return self._sampleNewValue();
  52097. $ctx3.sendIdx["sampleNewValue"]=1;
  52098. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  52099. }));
  52100. $ctx2.sendIdx["at:ifAbsent:"]=1;
  52101. $3=self._sampleNewValue();
  52102. $ctx2.sendIdx["sampleNewValue"]=2;
  52103. return self._assert_equals_($1,$3);
  52104. $ctx2.sendIdx["assert:equals:"]=1;
  52105. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52106. }));
  52107. self._samplesDo_((function(index,value){
  52108. return $core.withContext(function($ctx2) {
  52109. return self._assert_equals_($recv(self._collection())._at_ifAbsent_(index,(function(){
  52110. return $core.withContext(function($ctx3) {
  52111. return self._sampleNewValue();
  52112. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  52113. })),value);
  52114. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  52115. }));
  52116. return self;
  52117. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  52118. },
  52119. args: [],
  52120. 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 ].",
  52121. referencedClasses: [],
  52122. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  52123. }),
  52124. $globals.IndexableCollectionTest);
  52125. $core.addMethod(
  52126. $core.method({
  52127. selector: "testAtIfAbsentPut",
  52128. protocol: "tests",
  52129. fn: function (){
  52130. var self=this;
  52131. var newCollection;
  52132. return $core.withContext(function($ctx1) {
  52133. var $1;
  52134. newCollection=self._collection();
  52135. $ctx1.sendIdx["collection"]=1;
  52136. self._samplesDo_((function(index,value){
  52137. return $core.withContext(function($ctx2) {
  52138. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  52139. return $core.withContext(function($ctx3) {
  52140. return self._sampleNewValue();
  52141. $ctx3.sendIdx["sampleNewValue"]=1;
  52142. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  52143. }));
  52144. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  52145. return self._assert_equals_($1,value);
  52146. $ctx2.sendIdx["assert:equals:"]=1;
  52147. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  52148. }));
  52149. self._assert_equals_(newCollection,self._collection());
  52150. $ctx1.sendIdx["assert:equals:"]=2;
  52151. self._assert_equals_($recv(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  52152. return $core.withContext(function($ctx2) {
  52153. return self._sampleNewValue();
  52154. $ctx2.sendIdx["sampleNewValue"]=2;
  52155. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  52156. })),self._sampleNewValue());
  52157. $ctx1.sendIdx["assert:equals:"]=3;
  52158. self._assert_equals_(newCollection,self._collectionWithNewValue());
  52159. return self;
  52160. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  52161. },
  52162. args: [],
  52163. 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",
  52164. referencedClasses: [],
  52165. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  52166. }),
  52167. $globals.IndexableCollectionTest);
  52168. $core.addMethod(
  52169. $core.method({
  52170. selector: "testAtIfPresent",
  52171. protocol: "tests",
  52172. fn: function (){
  52173. var self=this;
  52174. var visited,sentinel;
  52175. return $core.withContext(function($ctx1) {
  52176. var $2,$1,$4,$3;
  52177. sentinel=$recv($globals.Object)._new();
  52178. self._nonIndexesDo_((function(each){
  52179. return $core.withContext(function($ctx2) {
  52180. visited=nil;
  52181. visited;
  52182. $2=self._collection();
  52183. $ctx2.sendIdx["collection"]=1;
  52184. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  52185. visited=value1;
  52186. visited;
  52187. return sentinel;
  52188. }));
  52189. $ctx2.sendIdx["at:ifPresent:"]=1;
  52190. self._assert_equals_($1,nil);
  52191. $ctx2.sendIdx["assert:equals:"]=1;
  52192. return self._assert_($recv(visited)._isNil());
  52193. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52194. }));
  52195. self._samplesDo_((function(index,value){
  52196. return $core.withContext(function($ctx2) {
  52197. visited=nil;
  52198. visited;
  52199. $4=self._collection();
  52200. $ctx2.sendIdx["collection"]=2;
  52201. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  52202. visited=value2;
  52203. visited;
  52204. return sentinel;
  52205. }));
  52206. self._assert_equals_($3,sentinel);
  52207. $ctx2.sendIdx["assert:equals:"]=2;
  52208. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  52209. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  52210. }));
  52211. return self;
  52212. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  52213. },
  52214. args: [],
  52215. 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) ]",
  52216. referencedClasses: ["Object"],
  52217. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  52218. }),
  52219. $globals.IndexableCollectionTest);
  52220. $core.addMethod(
  52221. $core.method({
  52222. selector: "testAtIfPresentIfAbsent",
  52223. protocol: "tests",
  52224. fn: function (){
  52225. var self=this;
  52226. var visited,sentinel;
  52227. return $core.withContext(function($ctx1) {
  52228. var $2,$1,$3,$5,$4;
  52229. sentinel=$recv($globals.Object)._new();
  52230. self._nonIndexesDo_((function(each){
  52231. return $core.withContext(function($ctx2) {
  52232. visited=nil;
  52233. visited;
  52234. $2=self._collection();
  52235. $ctx2.sendIdx["collection"]=1;
  52236. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  52237. visited=value1;
  52238. visited;
  52239. return sentinel;
  52240. }),(function(){
  52241. return $core.withContext(function($ctx3) {
  52242. return self._sampleNewValue();
  52243. $ctx3.sendIdx["sampleNewValue"]=1;
  52244. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  52245. }));
  52246. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  52247. $3=self._sampleNewValue();
  52248. $ctx2.sendIdx["sampleNewValue"]=2;
  52249. self._assert_equals_($1,$3);
  52250. $ctx2.sendIdx["assert:equals:"]=1;
  52251. return self._assert_($recv(visited)._isNil());
  52252. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52253. }));
  52254. self._samplesDo_((function(index,value){
  52255. return $core.withContext(function($ctx2) {
  52256. visited=nil;
  52257. visited;
  52258. $5=self._collection();
  52259. $ctx2.sendIdx["collection"]=2;
  52260. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  52261. visited=value2;
  52262. visited;
  52263. return sentinel;
  52264. }),(function(){
  52265. return $core.withContext(function($ctx3) {
  52266. return self._sampleNewValue();
  52267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  52268. }));
  52269. self._assert_equals_($4,sentinel);
  52270. $ctx2.sendIdx["assert:equals:"]=2;
  52271. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  52272. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  52273. }));
  52274. return self;
  52275. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  52276. },
  52277. args: [],
  52278. 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) ]",
  52279. referencedClasses: ["Object"],
  52280. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  52281. }),
  52282. $globals.IndexableCollectionTest);
  52283. $core.addMethod(
  52284. $core.method({
  52285. selector: "testAtPut",
  52286. protocol: "tests",
  52287. fn: function (){
  52288. var self=this;
  52289. var newCollection;
  52290. return $core.withContext(function($ctx1) {
  52291. newCollection=self._collection();
  52292. $ctx1.sendIdx["collection"]=1;
  52293. self._samplesDo_((function(index,value){
  52294. return $core.withContext(function($ctx2) {
  52295. return $recv(newCollection)._at_put_(index,value);
  52296. $ctx2.sendIdx["at:put:"]=1;
  52297. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  52298. }));
  52299. self._assert_equals_(newCollection,self._collection());
  52300. $ctx1.sendIdx["assert:equals:"]=1;
  52301. $recv(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  52302. self._assert_equals_(newCollection,self._collectionWithNewValue());
  52303. return self;
  52304. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  52305. },
  52306. args: [],
  52307. 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",
  52308. referencedClasses: [],
  52309. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  52310. }),
  52311. $globals.IndexableCollectionTest);
  52312. $core.addMethod(
  52313. $core.method({
  52314. selector: "testIndexOf",
  52315. protocol: "tests",
  52316. fn: function (){
  52317. var self=this;
  52318. return $core.withContext(function($ctx1) {
  52319. var $1;
  52320. self._should_raise_((function(){
  52321. return $core.withContext(function($ctx2) {
  52322. $1=self._collection();
  52323. $ctx2.sendIdx["collection"]=1;
  52324. return $recv($1)._indexOf_(self._sampleNewValue());
  52325. $ctx2.sendIdx["indexOf:"]=1;
  52326. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52327. }),$globals.Error);
  52328. self._samplesDo_((function(index,value){
  52329. return $core.withContext(function($ctx2) {
  52330. return self._assert_equals_($recv(self._collection())._indexOf_(value),index);
  52331. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  52332. }));
  52333. return self;
  52334. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  52335. },
  52336. args: [],
  52337. 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 ]",
  52338. referencedClasses: ["Error"],
  52339. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  52340. }),
  52341. $globals.IndexableCollectionTest);
  52342. $core.addMethod(
  52343. $core.method({
  52344. selector: "testIndexOfWithNull",
  52345. protocol: "tests",
  52346. fn: function (){
  52347. var self=this;
  52348. var jsNull;
  52349. return $core.withContext(function($ctx1) {
  52350. var $2,$1;
  52351. jsNull=$recv($globals.JSON)._parse_("null");
  52352. self._samplesDo_((function(index,value){
  52353. return $core.withContext(function($ctx2) {
  52354. $2=self._collection();
  52355. $recv($2)._at_put_(index,jsNull);
  52356. $1=$recv($2)._indexOf_(jsNull);
  52357. return self._assert_equals_($1,index);
  52358. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  52359. }));
  52360. return self;
  52361. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  52362. },
  52363. args: [],
  52364. 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 ]",
  52365. referencedClasses: ["JSON"],
  52366. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  52367. }),
  52368. $globals.IndexableCollectionTest);
  52369. $core.addMethod(
  52370. $core.method({
  52371. selector: "testWithIndexDo",
  52372. protocol: "tests",
  52373. fn: function (){
  52374. var self=this;
  52375. var collection;
  52376. return $core.withContext(function($ctx1) {
  52377. collection=self._collection();
  52378. $ctx1.sendIdx["collection"]=1;
  52379. $recv(self._collection())._withIndexDo_((function(each,index){
  52380. return $core.withContext(function($ctx2) {
  52381. return self._assert_equals_($recv(collection)._at_(index),each);
  52382. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  52383. }));
  52384. return self;
  52385. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  52386. },
  52387. args: [],
  52388. 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 ]",
  52389. referencedClasses: [],
  52390. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  52391. }),
  52392. $globals.IndexableCollectionTest);
  52393. $core.addClass("AssociativeCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  52394. $core.addMethod(
  52395. $core.method({
  52396. selector: "collectionKeys",
  52397. protocol: "fixture",
  52398. fn: function (){
  52399. var self=this;
  52400. return $core.withContext(function($ctx1) {
  52401. self._subclassResponsibility();
  52402. return self;
  52403. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  52404. },
  52405. args: [],
  52406. source: "collectionKeys\x0a\x09self subclassResponsibility",
  52407. referencedClasses: [],
  52408. messageSends: ["subclassResponsibility"]
  52409. }),
  52410. $globals.AssociativeCollectionTest);
  52411. $core.addMethod(
  52412. $core.method({
  52413. selector: "collectionValues",
  52414. protocol: "fixture",
  52415. fn: function (){
  52416. var self=this;
  52417. return $core.withContext(function($ctx1) {
  52418. self._subclassResponsibility();
  52419. return self;
  52420. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  52421. },
  52422. args: [],
  52423. source: "collectionValues\x0a\x09self subclassResponsibility",
  52424. referencedClasses: [],
  52425. messageSends: ["subclassResponsibility"]
  52426. }),
  52427. $globals.AssociativeCollectionTest);
  52428. $core.addMethod(
  52429. $core.method({
  52430. selector: "nonIndexesDo:",
  52431. protocol: "fixture",
  52432. fn: function (aBlock){
  52433. var self=this;
  52434. return $core.withContext(function($ctx1) {
  52435. $recv(aBlock)._value_((5));
  52436. $ctx1.sendIdx["value:"]=1;
  52437. $recv(aBlock)._value_((function(){
  52438. }));
  52439. $ctx1.sendIdx["value:"]=2;
  52440. $recv(aBlock)._value_($recv($globals.Object)._new());
  52441. $ctx1.sendIdx["value:"]=3;
  52442. $recv(aBlock)._value_("z");
  52443. return self;
  52444. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  52445. },
  52446. args: ["aBlock"],
  52447. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  52448. referencedClasses: ["Object"],
  52449. messageSends: ["value:", "new"]
  52450. }),
  52451. $globals.AssociativeCollectionTest);
  52452. $core.addMethod(
  52453. $core.method({
  52454. selector: "sampleNewIndex",
  52455. protocol: "fixture",
  52456. fn: function (){
  52457. var self=this;
  52458. return "new";
  52459. },
  52460. args: [],
  52461. source: "sampleNewIndex\x0a\x09^ 'new'",
  52462. referencedClasses: [],
  52463. messageSends: []
  52464. }),
  52465. $globals.AssociativeCollectionTest);
  52466. $core.addMethod(
  52467. $core.method({
  52468. selector: "samplesDo:",
  52469. protocol: "fixture",
  52470. fn: function (aBlock){
  52471. var self=this;
  52472. return $core.withContext(function($ctx1) {
  52473. $recv(aBlock)._value_value_("a",(2));
  52474. return self;
  52475. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  52476. },
  52477. args: ["aBlock"],
  52478. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  52479. referencedClasses: [],
  52480. messageSends: ["value:value:"]
  52481. }),
  52482. $globals.AssociativeCollectionTest);
  52483. $core.addMethod(
  52484. $core.method({
  52485. selector: "testAddAll",
  52486. protocol: "tests",
  52487. fn: function (){
  52488. var self=this;
  52489. return $core.withContext(function($ctx1) {
  52490. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  52491. (
  52492. $ctx1.supercall = true,
  52493. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($recv(self), []));
  52494. $ctx1.supercall = false;
  52495. $2=self._collection();
  52496. $ctx1.sendIdx["collection"]=1;
  52497. $3=self._collection();
  52498. $ctx1.sendIdx["collection"]=2;
  52499. $recv($2)._addAll_($3);
  52500. $ctx1.sendIdx["addAll:"]=1;
  52501. $4=$recv($2)._yourself();
  52502. $ctx1.sendIdx["yourself"]=1;
  52503. $1=$4;
  52504. $5=self._collection();
  52505. $ctx1.sendIdx["collection"]=3;
  52506. self._assert_equals_($1,$5);
  52507. $ctx1.sendIdx["assert:equals:"]=1;
  52508. $7=self._collection();
  52509. $ctx1.sendIdx["collection"]=4;
  52510. $8=self._collectionWithNewValue();
  52511. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52512. $recv($7)._addAll_($8);
  52513. $ctx1.sendIdx["addAll:"]=2;
  52514. $9=$recv($7)._yourself();
  52515. $ctx1.sendIdx["yourself"]=2;
  52516. $6=$9;
  52517. $10=self._collectionWithNewValue();
  52518. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52519. self._assert_equals_($6,$10);
  52520. $ctx1.sendIdx["assert:equals:"]=2;
  52521. $12=self._collectionWithNewValue();
  52522. $ctx1.sendIdx["collectionWithNewValue"]=3;
  52523. $recv($12)._addAll_(self._collection());
  52524. $11=$recv($12)._yourself();
  52525. self._assert_equals_($11,self._collectionWithNewValue());
  52526. return self;
  52527. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  52528. },
  52529. args: [],
  52530. 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",
  52531. referencedClasses: [],
  52532. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  52533. }),
  52534. $globals.AssociativeCollectionTest);
  52535. $core.addMethod(
  52536. $core.method({
  52537. selector: "testAsDictionary",
  52538. protocol: "tests",
  52539. fn: function (){
  52540. var self=this;
  52541. return $core.withContext(function($ctx1) {
  52542. self._assert_($recv($recv($recv(self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  52543. return self;
  52544. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  52545. },
  52546. args: [],
  52547. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  52548. referencedClasses: ["Dictionary"],
  52549. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  52550. }),
  52551. $globals.AssociativeCollectionTest);
  52552. $core.addMethod(
  52553. $core.method({
  52554. selector: "testAsHashedCollection",
  52555. protocol: "tests",
  52556. fn: function (){
  52557. var self=this;
  52558. return $core.withContext(function($ctx1) {
  52559. self._assert_($recv($recv($recv(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  52560. return self;
  52561. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  52562. },
  52563. args: [],
  52564. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  52565. referencedClasses: ["HashedCollection"],
  52566. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  52567. }),
  52568. $globals.AssociativeCollectionTest);
  52569. $core.addMethod(
  52570. $core.method({
  52571. selector: "testComma",
  52572. protocol: "tests",
  52573. fn: function (){
  52574. var self=this;
  52575. return $core.withContext(function($ctx1) {
  52576. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  52577. (
  52578. $ctx1.supercall = true,
  52579. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($recv(self), []));
  52580. $ctx1.supercall = false;
  52581. $2=self._collection();
  52582. $ctx1.sendIdx["collection"]=1;
  52583. $3=self._collection();
  52584. $ctx1.sendIdx["collection"]=2;
  52585. $1=$recv($2).__comma($3);
  52586. $ctx1.sendIdx[","]=1;
  52587. $4=self._collection();
  52588. $ctx1.sendIdx["collection"]=3;
  52589. self._assert_equals_($1,$4);
  52590. $ctx1.sendIdx["assert:equals:"]=1;
  52591. $6=self._collection();
  52592. $ctx1.sendIdx["collection"]=4;
  52593. $7=self._collectionWithNewValue();
  52594. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52595. $5=$recv($6).__comma($7);
  52596. $ctx1.sendIdx[","]=2;
  52597. $8=self._collectionWithNewValue();
  52598. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52599. self._assert_equals_($5,$8);
  52600. $ctx1.sendIdx["assert:equals:"]=2;
  52601. $10=self._collectionWithNewValue();
  52602. $ctx1.sendIdx["collectionWithNewValue"]=3;
  52603. $9=$recv($10).__comma(self._collection());
  52604. self._assert_equals_($9,self._collectionWithNewValue());
  52605. return self;
  52606. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  52607. },
  52608. args: [],
  52609. 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",
  52610. referencedClasses: [],
  52611. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  52612. }),
  52613. $globals.AssociativeCollectionTest);
  52614. $core.addMethod(
  52615. $core.method({
  52616. selector: "testFrom",
  52617. protocol: "tests",
  52618. fn: function (){
  52619. var self=this;
  52620. var associations;
  52621. return $core.withContext(function($ctx1) {
  52622. var $1;
  52623. $1="a".__minus_gt((1));
  52624. $ctx1.sendIdx["->"]=1;
  52625. associations=[$1,"b".__minus_gt((2))];
  52626. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  52627. return self;
  52628. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  52629. },
  52630. args: [],
  52631. 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 }.",
  52632. referencedClasses: [],
  52633. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  52634. }),
  52635. $globals.AssociativeCollectionTest);
  52636. $core.addMethod(
  52637. $core.method({
  52638. selector: "testKeys",
  52639. protocol: "tests",
  52640. fn: function (){
  52641. var self=this;
  52642. return $core.withContext(function($ctx1) {
  52643. var $2,$1,$3,$4;
  52644. $2=$recv($recv(self._collectionClass())._new())._keys();
  52645. $ctx1.sendIdx["keys"]=1;
  52646. $1=$recv($2)._isEmpty();
  52647. self._assert_($1);
  52648. $3=$recv(self._collection())._keys();
  52649. $ctx1.sendIdx["keys"]=2;
  52650. $4=self._collectionKeys();
  52651. $ctx1.sendIdx["collectionKeys"]=1;
  52652. self._assertSameContents_as_($3,$4);
  52653. $ctx1.sendIdx["assertSameContents:as:"]=1;
  52654. self._assertSameContents_as_($recv(self._collectionWithNewValue())._keys(),$recv(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  52655. return self;
  52656. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  52657. },
  52658. args: [],
  52659. 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 }",
  52660. referencedClasses: [],
  52661. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  52662. }),
  52663. $globals.AssociativeCollectionTest);
  52664. $core.addMethod(
  52665. $core.method({
  52666. selector: "testNewFromPairs",
  52667. protocol: "tests",
  52668. fn: function (){
  52669. var self=this;
  52670. var flattenedAssociations;
  52671. return $core.withContext(function($ctx1) {
  52672. flattenedAssociations=["a",(1),"b",(2)];
  52673. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  52674. return self;
  52675. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  52676. },
  52677. args: [],
  52678. 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 }.",
  52679. referencedClasses: [],
  52680. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  52681. }),
  52682. $globals.AssociativeCollectionTest);
  52683. $core.addMethod(
  52684. $core.method({
  52685. selector: "testPrintString",
  52686. protocol: "tests",
  52687. fn: function (){
  52688. var self=this;
  52689. return $core.withContext(function($ctx1) {
  52690. var $3,$2,$1,$4;
  52691. $3=self._collectionClass();
  52692. $ctx1.sendIdx["collectionClass"]=1;
  52693. $2=$recv($3)._new();
  52694. $recv($2)._at_put_("firstname","James");
  52695. $ctx1.sendIdx["at:put:"]=1;
  52696. $recv($2)._at_put_("lastname","Bond");
  52697. $1=$recv($2)._printString();
  52698. $4=$recv("a ".__comma($recv(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  52699. $ctx1.sendIdx[","]=1;
  52700. self._assert_equals_($1,$4);
  52701. return self;
  52702. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  52703. },
  52704. args: [],
  52705. 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'')'",
  52706. referencedClasses: [],
  52707. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  52708. }),
  52709. $globals.AssociativeCollectionTest);
  52710. $core.addMethod(
  52711. $core.method({
  52712. selector: "testRemoveKey",
  52713. protocol: "tests",
  52714. fn: function (){
  52715. var self=this;
  52716. return $core.withContext(function($ctx1) {
  52717. var $1,$2,$3,$5,$6,$4,$8,$7;
  52718. self._nonIndexesDo_((function(each){
  52719. var collection;
  52720. return $core.withContext(function($ctx2) {
  52721. collection=self._collection();
  52722. $ctx2.sendIdx["collection"]=1;
  52723. collection;
  52724. self._should_raise_((function(){
  52725. return $core.withContext(function($ctx3) {
  52726. return $recv(collection)._removeKey_(each);
  52727. $ctx3.sendIdx["removeKey:"]=1;
  52728. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  52729. }),$globals.Error);
  52730. $1=collection;
  52731. $2=self._collection();
  52732. $ctx2.sendIdx["collection"]=2;
  52733. return self._assert_equals_($1,$2);
  52734. $ctx2.sendIdx["assert:equals:"]=1;
  52735. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  52736. }));
  52737. self._samplesDo_((function(index,value){
  52738. var collection;
  52739. return $core.withContext(function($ctx2) {
  52740. collection=self._collection();
  52741. $ctx2.sendIdx["collection"]=3;
  52742. collection;
  52743. $3=$recv(collection)._removeKey_(index);
  52744. $ctx2.sendIdx["removeKey:"]=2;
  52745. self._assert_equals_($3,value);
  52746. $ctx2.sendIdx["assert:equals:"]=2;
  52747. $5=collection;
  52748. $6=self._collection();
  52749. $ctx2.sendIdx["collection"]=4;
  52750. $4=$recv($5).__eq($6);
  52751. return self._deny_($4);
  52752. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  52753. }));
  52754. $8=self._collectionWithNewValue();
  52755. $recv($8)._removeKey_(self._sampleNewIndex());
  52756. $7=$recv($8)._yourself();
  52757. self._assert_equals_($7,self._collection());
  52758. return self;
  52759. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  52760. },
  52761. args: [],
  52762. 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",
  52763. referencedClasses: ["Error"],
  52764. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  52765. }),
  52766. $globals.AssociativeCollectionTest);
  52767. $core.addMethod(
  52768. $core.method({
  52769. selector: "testRemoveKeyIfAbsent",
  52770. protocol: "tests",
  52771. fn: function (){
  52772. var self=this;
  52773. return $core.withContext(function($ctx1) {
  52774. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  52775. self._nonIndexesDo_((function(each){
  52776. var collection;
  52777. return $core.withContext(function($ctx2) {
  52778. collection=self._collection();
  52779. $ctx2.sendIdx["collection"]=1;
  52780. collection;
  52781. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  52782. return $core.withContext(function($ctx3) {
  52783. return self._sampleNewValue();
  52784. $ctx3.sendIdx["sampleNewValue"]=1;
  52785. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  52786. }));
  52787. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  52788. $2=self._sampleNewValue();
  52789. $ctx2.sendIdx["sampleNewValue"]=2;
  52790. self._assert_equals_($1,$2);
  52791. $ctx2.sendIdx["assert:equals:"]=1;
  52792. $3=collection;
  52793. $4=self._collection();
  52794. $ctx2.sendIdx["collection"]=2;
  52795. return self._assert_equals_($3,$4);
  52796. $ctx2.sendIdx["assert:equals:"]=2;
  52797. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  52798. }));
  52799. self._samplesDo_((function(index,value){
  52800. var collection;
  52801. return $core.withContext(function($ctx2) {
  52802. collection=self._collection();
  52803. $ctx2.sendIdx["collection"]=3;
  52804. collection;
  52805. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  52806. return $core.withContext(function($ctx3) {
  52807. return self._sampleNewValue();
  52808. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  52809. }));
  52810. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  52811. self._assert_equals_($5,value);
  52812. $ctx2.sendIdx["assert:equals:"]=3;
  52813. $7=collection;
  52814. $8=self._collection();
  52815. $ctx2.sendIdx["collection"]=4;
  52816. $6=$recv($7).__eq($8);
  52817. return self._deny_($6);
  52818. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  52819. }));
  52820. $10=self._collectionWithNewValue();
  52821. $recv($10)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  52822. return $core.withContext(function($ctx2) {
  52823. return self._assert_(false);
  52824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  52825. }));
  52826. $9=$recv($10)._yourself();
  52827. self._assert_equals_($9,self._collection());
  52828. return self;
  52829. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  52830. },
  52831. args: [],
  52832. 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",
  52833. referencedClasses: [],
  52834. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  52835. }),
  52836. $globals.AssociativeCollectionTest);
  52837. $core.addMethod(
  52838. $core.method({
  52839. selector: "testValues",
  52840. protocol: "tests",
  52841. fn: function (){
  52842. var self=this;
  52843. return $core.withContext(function($ctx1) {
  52844. var $2,$1,$3,$4;
  52845. $2=$recv($recv(self._collectionClass())._new())._values();
  52846. $ctx1.sendIdx["values"]=1;
  52847. $1=$recv($2)._isEmpty();
  52848. self._assert_($1);
  52849. $3=$recv(self._collection())._values();
  52850. $ctx1.sendIdx["values"]=2;
  52851. $4=self._collectionValues();
  52852. $ctx1.sendIdx["collectionValues"]=1;
  52853. self._assertSameContents_as_($3,$4);
  52854. $ctx1.sendIdx["assertSameContents:as:"]=1;
  52855. self._assertSameContents_as_($recv(self._collectionWithNewValue())._values(),$recv(self._collectionValues()).__comma([self._sampleNewValue()]));
  52856. return self;
  52857. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  52858. },
  52859. args: [],
  52860. 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 }",
  52861. referencedClasses: [],
  52862. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  52863. }),
  52864. $globals.AssociativeCollectionTest);
  52865. $core.addClass("DictionaryTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  52866. $core.addMethod(
  52867. $core.method({
  52868. selector: "collection",
  52869. protocol: "fixture",
  52870. fn: function (){
  52871. var self=this;
  52872. return $core.withContext(function($ctx1) {
  52873. var $1;
  52874. $1=$recv($globals.Dictionary)._new();
  52875. $recv($1)._at_put_((1),(1));
  52876. $ctx1.sendIdx["at:put:"]=1;
  52877. $recv($1)._at_put_("a",(2));
  52878. $ctx1.sendIdx["at:put:"]=2;
  52879. $recv($1)._at_put_(true,(3));
  52880. $ctx1.sendIdx["at:put:"]=3;
  52881. $recv($1)._at_put_((1).__at((3)),(-4));
  52882. $ctx1.sendIdx["at:put:"]=4;
  52883. $recv($1)._at_put_(self["@sampleBlock"],(9));
  52884. return $recv($1)._yourself();
  52885. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  52886. },
  52887. args: [],
  52888. 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",
  52889. referencedClasses: ["Dictionary"],
  52890. messageSends: ["at:put:", "new", "@", "yourself"]
  52891. }),
  52892. $globals.DictionaryTest);
  52893. $core.addMethod(
  52894. $core.method({
  52895. selector: "collectionKeys",
  52896. protocol: "fixture",
  52897. fn: function (){
  52898. var self=this;
  52899. return $core.withContext(function($ctx1) {
  52900. return [(1),"a",true,(1).__at((3)),self["@sampleBlock"]];
  52901. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  52902. },
  52903. args: [],
  52904. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  52905. referencedClasses: [],
  52906. messageSends: ["@"]
  52907. }),
  52908. $globals.DictionaryTest);
  52909. $core.addMethod(
  52910. $core.method({
  52911. selector: "collectionOfPrintStrings",
  52912. protocol: "fixture",
  52913. fn: function (){
  52914. var self=this;
  52915. return $core.withContext(function($ctx1) {
  52916. var $1;
  52917. $1=$recv($globals.Dictionary)._new();
  52918. $recv($1)._at_put_((1),"1");
  52919. $ctx1.sendIdx["at:put:"]=1;
  52920. $recv($1)._at_put_("a","2");
  52921. $ctx1.sendIdx["at:put:"]=2;
  52922. $recv($1)._at_put_(true,"3");
  52923. $ctx1.sendIdx["at:put:"]=3;
  52924. $recv($1)._at_put_((1).__at((3)),"-4");
  52925. $ctx1.sendIdx["at:put:"]=4;
  52926. $recv($1)._at_put_(self["@sampleBlock"],"9");
  52927. return $recv($1)._yourself();
  52928. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  52929. },
  52930. args: [],
  52931. 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",
  52932. referencedClasses: ["Dictionary"],
  52933. messageSends: ["at:put:", "new", "@", "yourself"]
  52934. }),
  52935. $globals.DictionaryTest);
  52936. $core.addMethod(
  52937. $core.method({
  52938. selector: "collectionSize",
  52939. protocol: "fixture",
  52940. fn: function (){
  52941. var self=this;
  52942. return (5);
  52943. },
  52944. args: [],
  52945. source: "collectionSize\x0a\x09^ 5",
  52946. referencedClasses: [],
  52947. messageSends: []
  52948. }),
  52949. $globals.DictionaryTest);
  52950. $core.addMethod(
  52951. $core.method({
  52952. selector: "collectionValues",
  52953. protocol: "fixture",
  52954. fn: function (){
  52955. var self=this;
  52956. return [(1),(2),(3),(-4),(9)];
  52957. },
  52958. args: [],
  52959. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  52960. referencedClasses: [],
  52961. messageSends: []
  52962. }),
  52963. $globals.DictionaryTest);
  52964. $core.addMethod(
  52965. $core.method({
  52966. selector: "collectionWithDuplicates",
  52967. protocol: "fixture",
  52968. fn: function (){
  52969. var self=this;
  52970. return $core.withContext(function($ctx1) {
  52971. var $1;
  52972. $1=$recv($globals.Dictionary)._new();
  52973. $recv($1)._at_put_((1),(1));
  52974. $ctx1.sendIdx["at:put:"]=1;
  52975. $recv($1)._at_put_("a",(2));
  52976. $ctx1.sendIdx["at:put:"]=2;
  52977. $recv($1)._at_put_(true,(3));
  52978. $ctx1.sendIdx["at:put:"]=3;
  52979. $recv($1)._at_put_((4),(-4));
  52980. $ctx1.sendIdx["at:put:"]=4;
  52981. $recv($1)._at_put_(self["@sampleBlock"],(9));
  52982. $ctx1.sendIdx["at:put:"]=5;
  52983. $recv($1)._at_put_("b",(1));
  52984. $ctx1.sendIdx["at:put:"]=6;
  52985. $recv($1)._at_put_((3),(3));
  52986. $ctx1.sendIdx["at:put:"]=7;
  52987. $recv($1)._at_put_(false,(12));
  52988. return $recv($1)._yourself();
  52989. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  52990. },
  52991. args: [],
  52992. 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",
  52993. referencedClasses: ["Dictionary"],
  52994. messageSends: ["at:put:", "new", "yourself"]
  52995. }),
  52996. $globals.DictionaryTest);
  52997. $core.addMethod(
  52998. $core.method({
  52999. selector: "collectionWithNewValue",
  53000. protocol: "fixture",
  53001. fn: function (){
  53002. var self=this;
  53003. return $core.withContext(function($ctx1) {
  53004. var $1;
  53005. $1=$recv($globals.Dictionary)._new();
  53006. $recv($1)._at_put_((1),(1));
  53007. $ctx1.sendIdx["at:put:"]=1;
  53008. $recv($1)._at_put_("a",(2));
  53009. $ctx1.sendIdx["at:put:"]=2;
  53010. $recv($1)._at_put_(true,(3));
  53011. $ctx1.sendIdx["at:put:"]=3;
  53012. $recv($1)._at_put_((1).__at((3)),(-4));
  53013. $ctx1.sendIdx["at:put:"]=4;
  53014. $recv($1)._at_put_(self["@sampleBlock"],(9));
  53015. $ctx1.sendIdx["at:put:"]=5;
  53016. $recv($1)._at_put_("new","N");
  53017. return $recv($1)._yourself();
  53018. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  53019. },
  53020. args: [],
  53021. 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",
  53022. referencedClasses: ["Dictionary"],
  53023. messageSends: ["at:put:", "new", "@", "yourself"]
  53024. }),
  53025. $globals.DictionaryTest);
  53026. $core.addMethod(
  53027. $core.method({
  53028. selector: "sampleNewValueAsCollection",
  53029. protocol: "fixture",
  53030. fn: function (){
  53031. var self=this;
  53032. return $core.withContext(function($ctx1) {
  53033. var $1;
  53034. $1=$recv($globals.Dictionary)._new();
  53035. $recv($1)._at_put_("new","N");
  53036. return $recv($1)._yourself();
  53037. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  53038. },
  53039. args: [],
  53040. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  53041. referencedClasses: ["Dictionary"],
  53042. messageSends: ["at:put:", "new", "yourself"]
  53043. }),
  53044. $globals.DictionaryTest);
  53045. $core.addMethod(
  53046. $core.method({
  53047. selector: "samplesDo:",
  53048. protocol: "fixture",
  53049. fn: function (aBlock){
  53050. var self=this;
  53051. return $core.withContext(function($ctx1) {
  53052. (
  53053. $ctx1.supercall = true,
  53054. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  53055. $ctx1.supercall = false;
  53056. $recv(aBlock)._value_value_(true,(3));
  53057. $ctx1.sendIdx["value:value:"]=1;
  53058. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  53059. $ctx1.sendIdx["value:value:"]=2;
  53060. $recv(aBlock)._value_value_(self["@sampleBlock"],(9));
  53061. return self;
  53062. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  53063. },
  53064. args: ["aBlock"],
  53065. 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",
  53066. referencedClasses: [],
  53067. messageSends: ["samplesDo:", "value:value:", "@"]
  53068. }),
  53069. $globals.DictionaryTest);
  53070. $core.addMethod(
  53071. $core.method({
  53072. selector: "testAccessing",
  53073. protocol: "tests",
  53074. fn: function (){
  53075. var self=this;
  53076. var d;
  53077. return $core.withContext(function($ctx1) {
  53078. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  53079. d=$recv($globals.Dictionary)._new();
  53080. $recv(d)._at_put_("hello","world");
  53081. $ctx1.sendIdx["at:put:"]=1;
  53082. $1=$recv(d)._at_("hello");
  53083. $ctx1.sendIdx["at:"]=1;
  53084. self._assert_equals_($1,"world");
  53085. $ctx1.sendIdx["assert:equals:"]=1;
  53086. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  53087. return nil;
  53088. }));
  53089. $ctx1.sendIdx["at:ifAbsent:"]=1;
  53090. self._assert_equals_($2,"world");
  53091. $ctx1.sendIdx["assert:equals:"]=2;
  53092. self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  53093. return nil;
  53094. }))).__eq("world"));
  53095. $ctx1.sendIdx["deny:"]=1;
  53096. $3=$recv(d)._includesKey_("hello");
  53097. $ctx1.sendIdx["includesKey:"]=1;
  53098. self._assert_($3);
  53099. $ctx1.sendIdx["assert:"]=1;
  53100. $4=$recv(d)._includesKey_("foo");
  53101. $ctx1.sendIdx["includesKey:"]=2;
  53102. self._deny_($4);
  53103. $ctx1.sendIdx["deny:"]=2;
  53104. $recv(d)._at_put_((1),(2));
  53105. $ctx1.sendIdx["at:put:"]=2;
  53106. $5=$recv(d)._at_((1));
  53107. $ctx1.sendIdx["at:"]=2;
  53108. self._assert_equals_($5,(2));
  53109. $ctx1.sendIdx["assert:equals:"]=3;
  53110. $6=d;
  53111. $7=(1).__at((3));
  53112. $ctx1.sendIdx["@"]=1;
  53113. $recv($6)._at_put_($7,(3));
  53114. $9=d;
  53115. $10=(1).__at((3));
  53116. $ctx1.sendIdx["@"]=2;
  53117. $8=$recv($9)._at_($10);
  53118. self._assert_equals_($8,(3));
  53119. $12=d;
  53120. $13=(1).__at((3));
  53121. $ctx1.sendIdx["@"]=3;
  53122. $11=$recv($12)._includesKey_($13);
  53123. $ctx1.sendIdx["includesKey:"]=3;
  53124. self._assert_($11);
  53125. self._deny_($recv(d)._includesKey_((3).__at((1))));
  53126. return self;
  53127. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  53128. },
  53129. args: [],
  53130. 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)",
  53131. referencedClasses: ["Dictionary"],
  53132. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  53133. }),
  53134. $globals.DictionaryTest);
  53135. $core.addMethod(
  53136. $core.method({
  53137. selector: "testDynamicDictionaries",
  53138. protocol: "tests",
  53139. fn: function (){
  53140. var self=this;
  53141. return $core.withContext(function($ctx1) {
  53142. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  53143. return self;
  53144. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  53145. },
  53146. args: [],
  53147. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  53148. referencedClasses: ["Dictionary"],
  53149. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  53150. }),
  53151. $globals.DictionaryTest);
  53152. $core.addMethod(
  53153. $core.method({
  53154. selector: "collectionClass",
  53155. protocol: "fixture",
  53156. fn: function (){
  53157. var self=this;
  53158. return $globals.Dictionary;
  53159. },
  53160. args: [],
  53161. source: "collectionClass\x0a\x09^ Dictionary",
  53162. referencedClasses: ["Dictionary"],
  53163. messageSends: []
  53164. }),
  53165. $globals.DictionaryTest.klass);
  53166. $core.addClass("HashedCollectionTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  53167. $core.addMethod(
  53168. $core.method({
  53169. selector: "collection",
  53170. protocol: "fixture",
  53171. fn: function (){
  53172. var self=this;
  53173. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  53174. },
  53175. args: [],
  53176. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  53177. referencedClasses: [],
  53178. messageSends: []
  53179. }),
  53180. $globals.HashedCollectionTest);
  53181. $core.addMethod(
  53182. $core.method({
  53183. selector: "collectionKeys",
  53184. protocol: "fixture",
  53185. fn: function (){
  53186. var self=this;
  53187. return ["b","a","c","d"];
  53188. },
  53189. args: [],
  53190. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  53191. referencedClasses: [],
  53192. messageSends: []
  53193. }),
  53194. $globals.HashedCollectionTest);
  53195. $core.addMethod(
  53196. $core.method({
  53197. selector: "collectionOfPrintStrings",
  53198. protocol: "fixture",
  53199. fn: function (){
  53200. var self=this;
  53201. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  53202. },
  53203. args: [],
  53204. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  53205. referencedClasses: [],
  53206. messageSends: []
  53207. }),
  53208. $globals.HashedCollectionTest);
  53209. $core.addMethod(
  53210. $core.method({
  53211. selector: "collectionSize",
  53212. protocol: "fixture",
  53213. fn: function (){
  53214. var self=this;
  53215. return (4);
  53216. },
  53217. args: [],
  53218. source: "collectionSize\x0a\x09^ 4",
  53219. referencedClasses: [],
  53220. messageSends: []
  53221. }),
  53222. $globals.HashedCollectionTest);
  53223. $core.addMethod(
  53224. $core.method({
  53225. selector: "collectionValues",
  53226. protocol: "fixture",
  53227. fn: function (){
  53228. var self=this;
  53229. return [(1),(2),(3),(-4)];
  53230. },
  53231. args: [],
  53232. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  53233. referencedClasses: [],
  53234. messageSends: []
  53235. }),
  53236. $globals.HashedCollectionTest);
  53237. $core.addMethod(
  53238. $core.method({
  53239. selector: "collectionWithDuplicates",
  53240. protocol: "fixture",
  53241. fn: function (){
  53242. var self=this;
  53243. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  53244. },
  53245. args: [],
  53246. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  53247. referencedClasses: [],
  53248. messageSends: []
  53249. }),
  53250. $globals.HashedCollectionTest);
  53251. $core.addMethod(
  53252. $core.method({
  53253. selector: "collectionWithNewValue",
  53254. protocol: "fixture",
  53255. fn: function (){
  53256. var self=this;
  53257. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  53258. },
  53259. args: [],
  53260. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  53261. referencedClasses: [],
  53262. messageSends: []
  53263. }),
  53264. $globals.HashedCollectionTest);
  53265. $core.addMethod(
  53266. $core.method({
  53267. selector: "sampleNewValueAsCollection",
  53268. protocol: "fixture",
  53269. fn: function (){
  53270. var self=this;
  53271. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  53272. },
  53273. args: [],
  53274. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  53275. referencedClasses: [],
  53276. messageSends: []
  53277. }),
  53278. $globals.HashedCollectionTest);
  53279. $core.addMethod(
  53280. $core.method({
  53281. selector: "testDynamicDictionaries",
  53282. protocol: "tests",
  53283. fn: function (){
  53284. var self=this;
  53285. return $core.withContext(function($ctx1) {
  53286. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  53287. return self;
  53288. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  53289. },
  53290. args: [],
  53291. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  53292. referencedClasses: ["HashedCollection"],
  53293. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  53294. }),
  53295. $globals.HashedCollectionTest);
  53296. $core.addMethod(
  53297. $core.method({
  53298. selector: "collectionClass",
  53299. protocol: "fixture",
  53300. fn: function (){
  53301. var self=this;
  53302. return $globals.HashedCollection;
  53303. },
  53304. args: [],
  53305. source: "collectionClass\x0a\x09^ HashedCollection",
  53306. referencedClasses: ["HashedCollection"],
  53307. messageSends: []
  53308. }),
  53309. $globals.HashedCollectionTest.klass);
  53310. $core.addClass("SequenceableCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  53311. $core.addMethod(
  53312. $core.method({
  53313. selector: "collectionFirst",
  53314. protocol: "fixture",
  53315. fn: function (){
  53316. var self=this;
  53317. return $core.withContext(function($ctx1) {
  53318. self._subclassResponsibility();
  53319. return self;
  53320. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  53321. },
  53322. args: [],
  53323. source: "collectionFirst\x0a\x09self subclassResponsibility",
  53324. referencedClasses: [],
  53325. messageSends: ["subclassResponsibility"]
  53326. }),
  53327. $globals.SequenceableCollectionTest);
  53328. $core.addMethod(
  53329. $core.method({
  53330. selector: "collectionFirstTwo",
  53331. protocol: "fixture",
  53332. fn: function (){
  53333. var self=this;
  53334. return $core.withContext(function($ctx1) {
  53335. self._subclassResponsibility();
  53336. return self;
  53337. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  53338. },
  53339. args: [],
  53340. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  53341. referencedClasses: [],
  53342. messageSends: ["subclassResponsibility"]
  53343. }),
  53344. $globals.SequenceableCollectionTest);
  53345. $core.addMethod(
  53346. $core.method({
  53347. selector: "collectionLast",
  53348. protocol: "fixture",
  53349. fn: function (){
  53350. var self=this;
  53351. return $core.withContext(function($ctx1) {
  53352. self._subclassResponsibility();
  53353. return self;
  53354. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  53355. },
  53356. args: [],
  53357. source: "collectionLast\x0a\x09self subclassResponsibility",
  53358. referencedClasses: [],
  53359. messageSends: ["subclassResponsibility"]
  53360. }),
  53361. $globals.SequenceableCollectionTest);
  53362. $core.addMethod(
  53363. $core.method({
  53364. selector: "collectionLastTwo",
  53365. protocol: "fixture",
  53366. fn: function (){
  53367. var self=this;
  53368. return $core.withContext(function($ctx1) {
  53369. self._subclassResponsibility();
  53370. return self;
  53371. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  53372. },
  53373. args: [],
  53374. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  53375. referencedClasses: [],
  53376. messageSends: ["subclassResponsibility"]
  53377. }),
  53378. $globals.SequenceableCollectionTest);
  53379. $core.addMethod(
  53380. $core.method({
  53381. selector: "nonIndexesDo:",
  53382. protocol: "fixture",
  53383. fn: function (aBlock){
  53384. var self=this;
  53385. return $core.withContext(function($ctx1) {
  53386. $recv(aBlock)._value_((0));
  53387. $ctx1.sendIdx["value:"]=1;
  53388. $recv(aBlock)._value_($recv(self._collectionSize()).__plus((1)));
  53389. $ctx1.sendIdx["value:"]=2;
  53390. $recv(aBlock)._value_("z");
  53391. return self;
  53392. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  53393. },
  53394. args: ["aBlock"],
  53395. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  53396. referencedClasses: [],
  53397. messageSends: ["value:", "+", "collectionSize"]
  53398. }),
  53399. $globals.SequenceableCollectionTest);
  53400. $core.addMethod(
  53401. $core.method({
  53402. selector: "samplesDo:",
  53403. protocol: "fixture",
  53404. fn: function (aBlock){
  53405. var self=this;
  53406. return $core.withContext(function($ctx1) {
  53407. $recv(aBlock)._value_value_((1),self._collectionFirst());
  53408. $ctx1.sendIdx["value:value:"]=1;
  53409. $recv(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  53410. return self;
  53411. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  53412. },
  53413. args: ["aBlock"],
  53414. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  53415. referencedClasses: [],
  53416. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  53417. }),
  53418. $globals.SequenceableCollectionTest);
  53419. $core.addMethod(
  53420. $core.method({
  53421. selector: "testBeginsWith",
  53422. protocol: "tests",
  53423. fn: function (){
  53424. var self=this;
  53425. return $core.withContext(function($ctx1) {
  53426. var $2,$1,$4,$5,$3,$7,$6;
  53427. $2=self._collection();
  53428. $ctx1.sendIdx["collection"]=1;
  53429. $1=$recv($2)._beginsWith_($recv(self._collectionClass())._new());
  53430. $ctx1.sendIdx["beginsWith:"]=1;
  53431. self._assert_($1);
  53432. $ctx1.sendIdx["assert:"]=1;
  53433. $4=self._collection();
  53434. $ctx1.sendIdx["collection"]=2;
  53435. $5=self._collection();
  53436. $ctx1.sendIdx["collection"]=3;
  53437. $3=$recv($4)._beginsWith_($5);
  53438. $ctx1.sendIdx["beginsWith:"]=2;
  53439. self._assert_($3);
  53440. $ctx1.sendIdx["assert:"]=2;
  53441. $7=self._collection();
  53442. $ctx1.sendIdx["collection"]=4;
  53443. $6=$recv($7)._beginsWith_(self._collectionFirstTwo());
  53444. $ctx1.sendIdx["beginsWith:"]=3;
  53445. self._assert_($6);
  53446. self._deny_($recv(self._collection())._beginsWith_(self._collectionLastTwo()));
  53447. return self;
  53448. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  53449. },
  53450. args: [],
  53451. 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)",
  53452. referencedClasses: [],
  53453. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  53454. }),
  53455. $globals.SequenceableCollectionTest);
  53456. $core.addMethod(
  53457. $core.method({
  53458. selector: "testEndsWith",
  53459. protocol: "tests",
  53460. fn: function (){
  53461. var self=this;
  53462. return $core.withContext(function($ctx1) {
  53463. var $2,$1,$4,$5,$3,$7,$6;
  53464. $2=self._collection();
  53465. $ctx1.sendIdx["collection"]=1;
  53466. $1=$recv($2)._endsWith_($recv(self._collectionClass())._new());
  53467. $ctx1.sendIdx["endsWith:"]=1;
  53468. self._assert_($1);
  53469. $ctx1.sendIdx["assert:"]=1;
  53470. $4=self._collection();
  53471. $ctx1.sendIdx["collection"]=2;
  53472. $5=self._collection();
  53473. $ctx1.sendIdx["collection"]=3;
  53474. $3=$recv($4)._endsWith_($5);
  53475. $ctx1.sendIdx["endsWith:"]=2;
  53476. self._assert_($3);
  53477. $ctx1.sendIdx["assert:"]=2;
  53478. $7=self._collection();
  53479. $ctx1.sendIdx["collection"]=4;
  53480. $6=$recv($7)._endsWith_(self._collectionLastTwo());
  53481. $ctx1.sendIdx["endsWith:"]=3;
  53482. self._assert_($6);
  53483. self._deny_($recv(self._collection())._endsWith_(self._collectionFirstTwo()));
  53484. return self;
  53485. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  53486. },
  53487. args: [],
  53488. 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)",
  53489. referencedClasses: [],
  53490. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  53491. }),
  53492. $globals.SequenceableCollectionTest);
  53493. $core.addMethod(
  53494. $core.method({
  53495. selector: "testFirst",
  53496. protocol: "tests",
  53497. fn: function (){
  53498. var self=this;
  53499. return $core.withContext(function($ctx1) {
  53500. self._assert_equals_($recv(self._collection())._first(),self._collectionFirst());
  53501. return self;
  53502. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  53503. },
  53504. args: [],
  53505. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  53506. referencedClasses: [],
  53507. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  53508. }),
  53509. $globals.SequenceableCollectionTest);
  53510. $core.addMethod(
  53511. $core.method({
  53512. selector: "testFirstN",
  53513. protocol: "tests",
  53514. fn: function (){
  53515. var self=this;
  53516. return $core.withContext(function($ctx1) {
  53517. var $2,$1,$4,$3,$6,$5,$7;
  53518. $2=self._collection();
  53519. $ctx1.sendIdx["collection"]=1;
  53520. $1=$recv($2)._first_((2));
  53521. $ctx1.sendIdx["first:"]=1;
  53522. self._assert_equals_($1,self._collectionFirstTwo());
  53523. $ctx1.sendIdx["assert:equals:"]=1;
  53524. $4=self._collection();
  53525. $ctx1.sendIdx["collection"]=2;
  53526. $3=$recv($4)._first_((0));
  53527. $ctx1.sendIdx["first:"]=2;
  53528. self._assert_equals_($3,$recv(self._collectionClass())._new());
  53529. $ctx1.sendIdx["assert:equals:"]=2;
  53530. $6=self._collection();
  53531. $ctx1.sendIdx["collection"]=3;
  53532. $5=$recv($6)._first_(self._collectionSize());
  53533. $ctx1.sendIdx["first:"]=3;
  53534. $7=self._collection();
  53535. $ctx1.sendIdx["collection"]=4;
  53536. self._assert_equals_($5,$7);
  53537. self._should_raise_((function(){
  53538. return $core.withContext(function($ctx2) {
  53539. return $recv(self._collection())._first_((33));
  53540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53541. }),$globals.Error);
  53542. return self;
  53543. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  53544. },
  53545. args: [],
  53546. 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",
  53547. referencedClasses: ["Error"],
  53548. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  53549. }),
  53550. $globals.SequenceableCollectionTest);
  53551. $core.addMethod(
  53552. $core.method({
  53553. selector: "testFourth",
  53554. protocol: "tests",
  53555. fn: function (){
  53556. var self=this;
  53557. return $core.withContext(function($ctx1) {
  53558. var $2,$1;
  53559. $2=self._collection();
  53560. $ctx1.sendIdx["collection"]=1;
  53561. $1=$recv($2)._fourth();
  53562. self._assert_equals_($1,$recv(self._collection())._at_((4)));
  53563. return self;
  53564. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  53565. },
  53566. args: [],
  53567. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  53568. referencedClasses: [],
  53569. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  53570. }),
  53571. $globals.SequenceableCollectionTest);
  53572. $core.addMethod(
  53573. $core.method({
  53574. selector: "testIndexOfStartingAt",
  53575. protocol: "tests",
  53576. fn: function (){
  53577. var self=this;
  53578. var jsNull;
  53579. return $core.withContext(function($ctx1) {
  53580. var $2,$1,$4,$3;
  53581. jsNull=$recv($globals.JSON)._parse_("null");
  53582. self._samplesDo_((function(index,value){
  53583. return $core.withContext(function($ctx2) {
  53584. $2=self._collection();
  53585. $ctx2.sendIdx["collection"]=1;
  53586. $1=$recv($2)._indexOf_startingAt_(value,(1));
  53587. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  53588. self._assert_equals_($1,index);
  53589. $ctx2.sendIdx["assert:equals:"]=1;
  53590. $4=self._collection();
  53591. $ctx2.sendIdx["collection"]=2;
  53592. $3=$recv($4)._indexOf_startingAt_(value,index);
  53593. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  53594. self._assert_equals_($3,index);
  53595. $ctx2.sendIdx["assert:equals:"]=2;
  53596. return self._assert_equals_($recv(self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  53597. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53598. }));
  53599. return self;
  53600. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  53601. },
  53602. args: [],
  53603. 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 ]",
  53604. referencedClasses: ["JSON"],
  53605. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  53606. }),
  53607. $globals.SequenceableCollectionTest);
  53608. $core.addMethod(
  53609. $core.method({
  53610. selector: "testIndexOfStartingAtWithNull",
  53611. protocol: "tests",
  53612. fn: function (){
  53613. var self=this;
  53614. var jsNull;
  53615. return $core.withContext(function($ctx1) {
  53616. var $1,$2;
  53617. jsNull=$recv($globals.JSON)._parse_("null");
  53618. self._samplesDo_((function(index,value){
  53619. var collection;
  53620. return $core.withContext(function($ctx2) {
  53621. collection=self._collection();
  53622. collection;
  53623. $recv(collection)._at_put_(index,jsNull);
  53624. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  53625. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  53626. self._assert_equals_($1,index);
  53627. $ctx2.sendIdx["assert:equals:"]=1;
  53628. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  53629. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  53630. self._assert_equals_($2,index);
  53631. $ctx2.sendIdx["assert:equals:"]=2;
  53632. return self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  53633. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  53634. }));
  53635. return self;
  53636. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  53637. },
  53638. args: [],
  53639. 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 ]",
  53640. referencedClasses: ["JSON"],
  53641. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  53642. }),
  53643. $globals.SequenceableCollectionTest);
  53644. $core.addMethod(
  53645. $core.method({
  53646. selector: "testLast",
  53647. protocol: "tests",
  53648. fn: function (){
  53649. var self=this;
  53650. return $core.withContext(function($ctx1) {
  53651. self._assert_equals_($recv(self._collection())._last(),self._collectionLast());
  53652. return self;
  53653. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  53654. },
  53655. args: [],
  53656. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  53657. referencedClasses: [],
  53658. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  53659. }),
  53660. $globals.SequenceableCollectionTest);
  53661. $core.addMethod(
  53662. $core.method({
  53663. selector: "testLastN",
  53664. protocol: "tests",
  53665. fn: function (){
  53666. var self=this;
  53667. return $core.withContext(function($ctx1) {
  53668. var $2,$1,$4,$3,$6,$5,$7;
  53669. $2=self._collection();
  53670. $ctx1.sendIdx["collection"]=1;
  53671. $1=$recv($2)._last_((2));
  53672. $ctx1.sendIdx["last:"]=1;
  53673. self._assert_equals_($1,self._collectionLastTwo());
  53674. $ctx1.sendIdx["assert:equals:"]=1;
  53675. $4=self._collection();
  53676. $ctx1.sendIdx["collection"]=2;
  53677. $3=$recv($4)._last_((0));
  53678. $ctx1.sendIdx["last:"]=2;
  53679. self._assert_equals_($3,$recv(self._collectionClass())._new());
  53680. $ctx1.sendIdx["assert:equals:"]=2;
  53681. $6=self._collection();
  53682. $ctx1.sendIdx["collection"]=3;
  53683. $5=$recv($6)._last_(self._collectionSize());
  53684. $ctx1.sendIdx["last:"]=3;
  53685. $7=self._collection();
  53686. $ctx1.sendIdx["collection"]=4;
  53687. self._assert_equals_($5,$7);
  53688. self._should_raise_((function(){
  53689. return $core.withContext(function($ctx2) {
  53690. return $recv(self._collection())._last_((33));
  53691. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53692. }),$globals.Error);
  53693. return self;
  53694. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  53695. },
  53696. args: [],
  53697. 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",
  53698. referencedClasses: ["Error"],
  53699. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  53700. }),
  53701. $globals.SequenceableCollectionTest);
  53702. $core.addMethod(
  53703. $core.method({
  53704. selector: "testSecond",
  53705. protocol: "tests",
  53706. fn: function (){
  53707. var self=this;
  53708. return $core.withContext(function($ctx1) {
  53709. var $2,$1;
  53710. $2=self._collection();
  53711. $ctx1.sendIdx["collection"]=1;
  53712. $1=$recv($2)._second();
  53713. self._assert_equals_($1,$recv(self._collection())._at_((2)));
  53714. return self;
  53715. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  53716. },
  53717. args: [],
  53718. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  53719. referencedClasses: [],
  53720. messageSends: ["assert:equals:", "second", "collection", "at:"]
  53721. }),
  53722. $globals.SequenceableCollectionTest);
  53723. $core.addMethod(
  53724. $core.method({
  53725. selector: "testThird",
  53726. protocol: "tests",
  53727. fn: function (){
  53728. var self=this;
  53729. return $core.withContext(function($ctx1) {
  53730. var $2,$1;
  53731. $2=self._collection();
  53732. $ctx1.sendIdx["collection"]=1;
  53733. $1=$recv($2)._third();
  53734. self._assert_equals_($1,$recv(self._collection())._at_((3)));
  53735. return self;
  53736. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  53737. },
  53738. args: [],
  53739. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  53740. referencedClasses: [],
  53741. messageSends: ["assert:equals:", "third", "collection", "at:"]
  53742. }),
  53743. $globals.SequenceableCollectionTest);
  53744. $core.addClass("ArrayTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  53745. $core.addMethod(
  53746. $core.method({
  53747. selector: "collection",
  53748. protocol: "fixture",
  53749. fn: function (){
  53750. var self=this;
  53751. return [(1), (2), (3), (-4)];
  53752. },
  53753. args: [],
  53754. source: "collection\x0a\x09^ #(1 2 3 -4)",
  53755. referencedClasses: [],
  53756. messageSends: []
  53757. }),
  53758. $globals.ArrayTest);
  53759. $core.addMethod(
  53760. $core.method({
  53761. selector: "collectionFirst",
  53762. protocol: "fixture",
  53763. fn: function (){
  53764. var self=this;
  53765. return (1);
  53766. },
  53767. args: [],
  53768. source: "collectionFirst\x0a\x09^ 1",
  53769. referencedClasses: [],
  53770. messageSends: []
  53771. }),
  53772. $globals.ArrayTest);
  53773. $core.addMethod(
  53774. $core.method({
  53775. selector: "collectionFirstTwo",
  53776. protocol: "fixture",
  53777. fn: function (){
  53778. var self=this;
  53779. return [(1), (2)];
  53780. },
  53781. args: [],
  53782. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  53783. referencedClasses: [],
  53784. messageSends: []
  53785. }),
  53786. $globals.ArrayTest);
  53787. $core.addMethod(
  53788. $core.method({
  53789. selector: "collectionLast",
  53790. protocol: "fixture",
  53791. fn: function (){
  53792. var self=this;
  53793. return (-4);
  53794. },
  53795. args: [],
  53796. source: "collectionLast\x0a\x09^ -4",
  53797. referencedClasses: [],
  53798. messageSends: []
  53799. }),
  53800. $globals.ArrayTest);
  53801. $core.addMethod(
  53802. $core.method({
  53803. selector: "collectionLastTwo",
  53804. protocol: "fixture",
  53805. fn: function (){
  53806. var self=this;
  53807. return [(3), (-4)];
  53808. },
  53809. args: [],
  53810. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  53811. referencedClasses: [],
  53812. messageSends: []
  53813. }),
  53814. $globals.ArrayTest);
  53815. $core.addMethod(
  53816. $core.method({
  53817. selector: "collectionOfPrintStrings",
  53818. protocol: "fixture",
  53819. fn: function (){
  53820. var self=this;
  53821. return ["1", "2", "3", "-4"];
  53822. },
  53823. args: [],
  53824. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  53825. referencedClasses: [],
  53826. messageSends: []
  53827. }),
  53828. $globals.ArrayTest);
  53829. $core.addMethod(
  53830. $core.method({
  53831. selector: "collectionSize",
  53832. protocol: "fixture",
  53833. fn: function (){
  53834. var self=this;
  53835. return (4);
  53836. },
  53837. args: [],
  53838. source: "collectionSize\x0a\x09^ 4",
  53839. referencedClasses: [],
  53840. messageSends: []
  53841. }),
  53842. $globals.ArrayTest);
  53843. $core.addMethod(
  53844. $core.method({
  53845. selector: "collectionWithDuplicates",
  53846. protocol: "fixture",
  53847. fn: function (){
  53848. var self=this;
  53849. return ["a", "b", "c", (1), (2), (1), "a", []];
  53850. },
  53851. args: [],
  53852. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  53853. referencedClasses: [],
  53854. messageSends: []
  53855. }),
  53856. $globals.ArrayTest);
  53857. $core.addMethod(
  53858. $core.method({
  53859. selector: "collectionWithNewValue",
  53860. protocol: "fixture",
  53861. fn: function (){
  53862. var self=this;
  53863. return [(1), (2), (3), (-4), "N"];
  53864. },
  53865. args: [],
  53866. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  53867. referencedClasses: [],
  53868. messageSends: []
  53869. }),
  53870. $globals.ArrayTest);
  53871. $core.addMethod(
  53872. $core.method({
  53873. selector: "sampleNewIndex",
  53874. protocol: "fixture",
  53875. fn: function (){
  53876. var self=this;
  53877. return (5);
  53878. },
  53879. args: [],
  53880. source: "sampleNewIndex\x0a\x09^ 5",
  53881. referencedClasses: [],
  53882. messageSends: []
  53883. }),
  53884. $globals.ArrayTest);
  53885. $core.addMethod(
  53886. $core.method({
  53887. selector: "samplesDo:",
  53888. protocol: "fixture",
  53889. fn: function (aBlock){
  53890. var self=this;
  53891. return $core.withContext(function($ctx1) {
  53892. (
  53893. $ctx1.supercall = true,
  53894. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  53895. $ctx1.supercall = false;
  53896. $recv(aBlock)._value_value_((3),(3));
  53897. return self;
  53898. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  53899. },
  53900. args: ["aBlock"],
  53901. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  53902. referencedClasses: [],
  53903. messageSends: ["samplesDo:", "value:value:"]
  53904. }),
  53905. $globals.ArrayTest);
  53906. $core.addMethod(
  53907. $core.method({
  53908. selector: "testAdd",
  53909. protocol: "tests",
  53910. fn: function (){
  53911. var self=this;
  53912. var array;
  53913. return $core.withContext(function($ctx1) {
  53914. array=self._collection();
  53915. $recv(array)._add_((6));
  53916. self._assert_equals_($recv(array)._last(),(6));
  53917. return self;
  53918. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  53919. },
  53920. args: [],
  53921. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  53922. referencedClasses: [],
  53923. messageSends: ["collection", "add:", "assert:equals:", "last"]
  53924. }),
  53925. $globals.ArrayTest);
  53926. $core.addMethod(
  53927. $core.method({
  53928. selector: "testAddFirst",
  53929. protocol: "tests",
  53930. fn: function (){
  53931. var self=this;
  53932. return $core.withContext(function($ctx1) {
  53933. var $3,$2,$1;
  53934. $3=self._collection();
  53935. $recv($3)._addFirst_((0));
  53936. $2=$recv($3)._yourself();
  53937. $1=$recv($2)._first();
  53938. self._assert_equals_($1,(0));
  53939. return self;
  53940. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  53941. },
  53942. args: [],
  53943. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  53944. referencedClasses: [],
  53945. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  53946. }),
  53947. $globals.ArrayTest);
  53948. $core.addMethod(
  53949. $core.method({
  53950. selector: "testPrintString",
  53951. protocol: "tests",
  53952. fn: function (){
  53953. var self=this;
  53954. var array;
  53955. return $core.withContext(function($ctx1) {
  53956. var $1,$2,$3,$4,$5,$6,$7,$8;
  53957. array=$recv($globals.Array)._new();
  53958. $1=$recv(array)._printString();
  53959. $ctx1.sendIdx["printString"]=1;
  53960. self._assert_equals_($1,"an Array ()");
  53961. $ctx1.sendIdx["assert:equals:"]=1;
  53962. $2=array;
  53963. $recv($2)._add_((1));
  53964. $ctx1.sendIdx["add:"]=1;
  53965. $3=$recv($2)._add_((3));
  53966. $ctx1.sendIdx["add:"]=2;
  53967. $4=$recv(array)._printString();
  53968. $ctx1.sendIdx["printString"]=2;
  53969. self._assert_equals_($4,"an Array (1 3)");
  53970. $ctx1.sendIdx["assert:equals:"]=2;
  53971. $recv(array)._add_("foo");
  53972. $5=$recv(array)._printString();
  53973. $ctx1.sendIdx["printString"]=3;
  53974. self._assert_equals_($5,"an Array (1 3 'foo')");
  53975. $ctx1.sendIdx["assert:equals:"]=3;
  53976. $6=array;
  53977. $recv($6)._remove_((1));
  53978. $ctx1.sendIdx["remove:"]=1;
  53979. $recv($6)._remove_((3));
  53980. $7=$recv(array)._printString();
  53981. $ctx1.sendIdx["printString"]=4;
  53982. self._assert_equals_($7,"an Array ('foo')");
  53983. $ctx1.sendIdx["assert:equals:"]=4;
  53984. $recv(array)._addLast_((3));
  53985. $ctx1.sendIdx["addLast:"]=1;
  53986. $8=$recv(array)._printString();
  53987. $ctx1.sendIdx["printString"]=5;
  53988. self._assert_equals_($8,"an Array ('foo' 3)");
  53989. $ctx1.sendIdx["assert:equals:"]=5;
  53990. $recv(array)._addLast_((3));
  53991. self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  53992. return self;
  53993. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  53994. },
  53995. args: [],
  53996. 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)'.",
  53997. referencedClasses: ["Array"],
  53998. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  53999. }),
  54000. $globals.ArrayTest);
  54001. $core.addMethod(
  54002. $core.method({
  54003. selector: "testRemove",
  54004. protocol: "tests",
  54005. fn: function (){
  54006. var self=this;
  54007. var array;
  54008. return $core.withContext(function($ctx1) {
  54009. array=[(1), (2), (3), (4), (5)];
  54010. $recv(array)._remove_((3));
  54011. $ctx1.sendIdx["remove:"]=1;
  54012. self._assert_equals_(array,[(1), (2), (4), (5)]);
  54013. self._should_raise_((function(){
  54014. return $core.withContext(function($ctx2) {
  54015. return $recv(array)._remove_((3));
  54016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54017. }),$globals.Error);
  54018. return self;
  54019. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  54020. },
  54021. args: [],
  54022. 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",
  54023. referencedClasses: ["Error"],
  54024. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  54025. }),
  54026. $globals.ArrayTest);
  54027. $core.addMethod(
  54028. $core.method({
  54029. selector: "testRemoveFromTo",
  54030. protocol: "tests",
  54031. fn: function (){
  54032. var self=this;
  54033. return $core.withContext(function($ctx1) {
  54034. var $1,$2;
  54035. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  54036. $ctx1.sendIdx["removeFrom:to:"]=1;
  54037. self._assert_equals_($1,[(4)]);
  54038. $ctx1.sendIdx["assert:equals:"]=1;
  54039. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  54040. $ctx1.sendIdx["removeFrom:to:"]=2;
  54041. self._assert_equals_($2,[(1), (4)]);
  54042. $ctx1.sendIdx["assert:equals:"]=2;
  54043. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  54044. return self;
  54045. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  54046. },
  54047. args: [],
  54048. 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)",
  54049. referencedClasses: [],
  54050. messageSends: ["assert:equals:", "removeFrom:to:"]
  54051. }),
  54052. $globals.ArrayTest);
  54053. $core.addMethod(
  54054. $core.method({
  54055. selector: "testRemoveIndex",
  54056. protocol: "tests",
  54057. fn: function (){
  54058. var self=this;
  54059. return $core.withContext(function($ctx1) {
  54060. var $1,$2;
  54061. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  54062. $ctx1.sendIdx["removeIndex:"]=1;
  54063. self._assert_equals_($1,[(1), (3), (4)]);
  54064. $ctx1.sendIdx["assert:equals:"]=1;
  54065. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  54066. $ctx1.sendIdx["removeIndex:"]=2;
  54067. self._assert_equals_($2,[(2), (3), (4)]);
  54068. $ctx1.sendIdx["assert:equals:"]=2;
  54069. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  54070. return self;
  54071. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  54072. },
  54073. args: [],
  54074. 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: #()",
  54075. referencedClasses: [],
  54076. messageSends: ["assert:equals:", "removeIndex:"]
  54077. }),
  54078. $globals.ArrayTest);
  54079. $core.addMethod(
  54080. $core.method({
  54081. selector: "testRemoveLast",
  54082. protocol: "tests",
  54083. fn: function (){
  54084. var self=this;
  54085. var array;
  54086. return $core.withContext(function($ctx1) {
  54087. array=[(1), (2)];
  54088. $recv(array)._removeLast();
  54089. self._assert_equals_($recv(array)._last(),(1));
  54090. return self;
  54091. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  54092. },
  54093. args: [],
  54094. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  54095. referencedClasses: [],
  54096. messageSends: ["removeLast", "assert:equals:", "last"]
  54097. }),
  54098. $globals.ArrayTest);
  54099. $core.addMethod(
  54100. $core.method({
  54101. selector: "testReversed",
  54102. protocol: "tests",
  54103. fn: function (){
  54104. var self=this;
  54105. var array;
  54106. return $core.withContext(function($ctx1) {
  54107. array=[(5), (4), (3), (2), (1)];
  54108. self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  54109. return self;
  54110. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  54111. },
  54112. args: [],
  54113. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  54114. referencedClasses: [],
  54115. messageSends: ["assert:equals:", "reversed"]
  54116. }),
  54117. $globals.ArrayTest);
  54118. $core.addMethod(
  54119. $core.method({
  54120. selector: "testSort",
  54121. protocol: "tests",
  54122. fn: function (){
  54123. var self=this;
  54124. var array;
  54125. return $core.withContext(function($ctx1) {
  54126. array=[(10), (1), (5)];
  54127. $recv(array)._sort();
  54128. self._assert_equals_(array,[(1), (5), (10)]);
  54129. return self;
  54130. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  54131. },
  54132. args: [],
  54133. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  54134. referencedClasses: [],
  54135. messageSends: ["sort", "assert:equals:"]
  54136. }),
  54137. $globals.ArrayTest);
  54138. $core.addMethod(
  54139. $core.method({
  54140. selector: "collectionClass",
  54141. protocol: "fixture",
  54142. fn: function (){
  54143. var self=this;
  54144. return $globals.Array;
  54145. },
  54146. args: [],
  54147. source: "collectionClass\x0a\x09^ Array",
  54148. referencedClasses: ["Array"],
  54149. messageSends: []
  54150. }),
  54151. $globals.ArrayTest.klass);
  54152. $core.addClass("StringTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  54153. $core.addMethod(
  54154. $core.method({
  54155. selector: "collection",
  54156. protocol: "fixture",
  54157. fn: function (){
  54158. var self=this;
  54159. return "helLo";
  54160. },
  54161. args: [],
  54162. source: "collection\x0a\x09^ 'helLo'",
  54163. referencedClasses: [],
  54164. messageSends: []
  54165. }),
  54166. $globals.StringTest);
  54167. $core.addMethod(
  54168. $core.method({
  54169. selector: "collectionFirst",
  54170. protocol: "fixture",
  54171. fn: function (){
  54172. var self=this;
  54173. return "h";
  54174. },
  54175. args: [],
  54176. source: "collectionFirst\x0a\x09^ 'h'",
  54177. referencedClasses: [],
  54178. messageSends: []
  54179. }),
  54180. $globals.StringTest);
  54181. $core.addMethod(
  54182. $core.method({
  54183. selector: "collectionFirstTwo",
  54184. protocol: "fixture",
  54185. fn: function (){
  54186. var self=this;
  54187. return "he";
  54188. },
  54189. args: [],
  54190. source: "collectionFirstTwo\x0a\x09^ 'he'",
  54191. referencedClasses: [],
  54192. messageSends: []
  54193. }),
  54194. $globals.StringTest);
  54195. $core.addMethod(
  54196. $core.method({
  54197. selector: "collectionLast",
  54198. protocol: "fixture",
  54199. fn: function (){
  54200. var self=this;
  54201. return "o";
  54202. },
  54203. args: [],
  54204. source: "collectionLast\x0a\x09^ 'o'",
  54205. referencedClasses: [],
  54206. messageSends: []
  54207. }),
  54208. $globals.StringTest);
  54209. $core.addMethod(
  54210. $core.method({
  54211. selector: "collectionLastTwo",
  54212. protocol: "fixture",
  54213. fn: function (){
  54214. var self=this;
  54215. return "Lo";
  54216. },
  54217. args: [],
  54218. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  54219. referencedClasses: [],
  54220. messageSends: []
  54221. }),
  54222. $globals.StringTest);
  54223. $core.addMethod(
  54224. $core.method({
  54225. selector: "collectionOfPrintStrings",
  54226. protocol: "fixture",
  54227. fn: function (){
  54228. var self=this;
  54229. return "'h''e''l''L''o'";
  54230. },
  54231. args: [],
  54232. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  54233. referencedClasses: [],
  54234. messageSends: []
  54235. }),
  54236. $globals.StringTest);
  54237. $core.addMethod(
  54238. $core.method({
  54239. selector: "collectionSize",
  54240. protocol: "fixture",
  54241. fn: function (){
  54242. var self=this;
  54243. return (5);
  54244. },
  54245. args: [],
  54246. source: "collectionSize\x0a\x09^ 5",
  54247. referencedClasses: [],
  54248. messageSends: []
  54249. }),
  54250. $globals.StringTest);
  54251. $core.addMethod(
  54252. $core.method({
  54253. selector: "collectionWithDuplicates",
  54254. protocol: "fixture",
  54255. fn: function (){
  54256. var self=this;
  54257. return "abbaerten";
  54258. },
  54259. args: [],
  54260. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  54261. referencedClasses: [],
  54262. messageSends: []
  54263. }),
  54264. $globals.StringTest);
  54265. $core.addMethod(
  54266. $core.method({
  54267. selector: "collectionWithNewValue",
  54268. protocol: "fixture",
  54269. fn: function (){
  54270. var self=this;
  54271. return "helLoN";
  54272. },
  54273. args: [],
  54274. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  54275. referencedClasses: [],
  54276. messageSends: []
  54277. }),
  54278. $globals.StringTest);
  54279. $core.addMethod(
  54280. $core.method({
  54281. selector: "sampleNewValueAsCollection",
  54282. protocol: "fixture",
  54283. fn: function (){
  54284. var self=this;
  54285. return "N";
  54286. },
  54287. args: [],
  54288. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  54289. referencedClasses: [],
  54290. messageSends: []
  54291. }),
  54292. $globals.StringTest);
  54293. $core.addMethod(
  54294. $core.method({
  54295. selector: "samplesDo:",
  54296. protocol: "fixture",
  54297. fn: function (aBlock){
  54298. var self=this;
  54299. return $core.withContext(function($ctx1) {
  54300. (
  54301. $ctx1.supercall = true,
  54302. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  54303. $ctx1.supercall = false;
  54304. $recv(aBlock)._value_value_((3),"l");
  54305. return self;
  54306. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  54307. },
  54308. args: ["aBlock"],
  54309. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  54310. referencedClasses: [],
  54311. messageSends: ["samplesDo:", "value:value:"]
  54312. }),
  54313. $globals.StringTest);
  54314. $core.addMethod(
  54315. $core.method({
  54316. selector: "testAddAll",
  54317. protocol: "tests",
  54318. fn: function (){
  54319. var self=this;
  54320. return $core.withContext(function($ctx1) {
  54321. var $1;
  54322. self._should_raise_((function(){
  54323. return $core.withContext(function($ctx2) {
  54324. $1=self._collection();
  54325. $ctx2.sendIdx["collection"]=1;
  54326. return $recv($1)._addAll_(self._collection());
  54327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54328. }),$globals.Error);
  54329. return self;
  54330. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  54331. },
  54332. args: [],
  54333. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  54334. referencedClasses: ["Error"],
  54335. messageSends: ["should:raise:", "addAll:", "collection"]
  54336. }),
  54337. $globals.StringTest);
  54338. $core.addMethod(
  54339. $core.method({
  54340. selector: "testAddRemove",
  54341. protocol: "tests",
  54342. fn: function (){
  54343. var self=this;
  54344. return $core.withContext(function($ctx1) {
  54345. self._should_raise_((function(){
  54346. return $core.withContext(function($ctx2) {
  54347. return "hello"._add_("a");
  54348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54349. }),$globals.Error);
  54350. $ctx1.sendIdx["should:raise:"]=1;
  54351. self._should_raise_((function(){
  54352. return $core.withContext(function($ctx2) {
  54353. return "hello"._remove_("h");
  54354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54355. }),$globals.Error);
  54356. return self;
  54357. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  54358. },
  54359. args: [],
  54360. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  54361. referencedClasses: ["Error"],
  54362. messageSends: ["should:raise:", "add:", "remove:"]
  54363. }),
  54364. $globals.StringTest);
  54365. $core.addMethod(
  54366. $core.method({
  54367. selector: "testAsArray",
  54368. protocol: "tests",
  54369. fn: function (){
  54370. var self=this;
  54371. return $core.withContext(function($ctx1) {
  54372. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  54373. return self;
  54374. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  54375. },
  54376. args: [],
  54377. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  54378. referencedClasses: [],
  54379. messageSends: ["assert:equals:", "asArray"]
  54380. }),
  54381. $globals.StringTest);
  54382. $core.addMethod(
  54383. $core.method({
  54384. selector: "testAsLowerCase",
  54385. protocol: "tests",
  54386. fn: function (){
  54387. var self=this;
  54388. return $core.withContext(function($ctx1) {
  54389. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  54390. return self;
  54391. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  54392. },
  54393. args: [],
  54394. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  54395. referencedClasses: [],
  54396. messageSends: ["assert:equals:", "asLowercase"]
  54397. }),
  54398. $globals.StringTest);
  54399. $core.addMethod(
  54400. $core.method({
  54401. selector: "testAsNumber",
  54402. protocol: "tests",
  54403. fn: function (){
  54404. var self=this;
  54405. return $core.withContext(function($ctx1) {
  54406. var $1,$2;
  54407. $1="3"._asNumber();
  54408. $ctx1.sendIdx["asNumber"]=1;
  54409. self._assert_equals_($1,(3));
  54410. $ctx1.sendIdx["assert:equals:"]=1;
  54411. $2="-3"._asNumber();
  54412. $ctx1.sendIdx["asNumber"]=2;
  54413. self._assert_equals_($2,(-3));
  54414. $ctx1.sendIdx["assert:equals:"]=2;
  54415. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  54416. return self;
  54417. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  54418. },
  54419. args: [],
  54420. 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.",
  54421. referencedClasses: [],
  54422. messageSends: ["assert:equals:", "asNumber"]
  54423. }),
  54424. $globals.StringTest);
  54425. $core.addMethod(
  54426. $core.method({
  54427. selector: "testAsUpperCase",
  54428. protocol: "tests",
  54429. fn: function (){
  54430. var self=this;
  54431. return $core.withContext(function($ctx1) {
  54432. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  54433. return self;
  54434. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  54435. },
  54436. args: [],
  54437. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  54438. referencedClasses: [],
  54439. messageSends: ["assert:equals:", "asUppercase"]
  54440. }),
  54441. $globals.StringTest);
  54442. $core.addMethod(
  54443. $core.method({
  54444. selector: "testAsciiValue",
  54445. protocol: "tests",
  54446. fn: function (){
  54447. var self=this;
  54448. var characterA,characterU;
  54449. return $core.withContext(function($ctx1) {
  54450. var $1;
  54451. characterA="A";
  54452. characterU="U";
  54453. $1=$recv(characterA)._asciiValue();
  54454. $ctx1.sendIdx["asciiValue"]=1;
  54455. self._assert_equals_($1,(65));
  54456. $ctx1.sendIdx["assert:equals:"]=1;
  54457. self._assert_equals_($recv(characterU)._asciiValue(),(85));
  54458. return self;
  54459. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  54460. },
  54461. args: [],
  54462. 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",
  54463. referencedClasses: [],
  54464. messageSends: ["assert:equals:", "asciiValue"]
  54465. }),
  54466. $globals.StringTest);
  54467. $core.addMethod(
  54468. $core.method({
  54469. selector: "testAtIfAbsentPut",
  54470. protocol: "tests",
  54471. fn: function (){
  54472. var self=this;
  54473. return $core.withContext(function($ctx1) {
  54474. self._should_raise_((function(){
  54475. return $core.withContext(function($ctx2) {
  54476. return "hello"._at_ifAbsentPut_((6),(function(){
  54477. return "a";
  54478. }));
  54479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54480. }),$globals.Error);
  54481. return self;
  54482. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  54483. },
  54484. args: [],
  54485. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  54486. referencedClasses: ["Error"],
  54487. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  54488. }),
  54489. $globals.StringTest);
  54490. $core.addMethod(
  54491. $core.method({
  54492. selector: "testAtPut",
  54493. protocol: "tests",
  54494. fn: function (){
  54495. var self=this;
  54496. return $core.withContext(function($ctx1) {
  54497. self._should_raise_((function(){
  54498. return $core.withContext(function($ctx2) {
  54499. return "hello"._at_put_((1),"a");
  54500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54501. }),$globals.Error);
  54502. return self;
  54503. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  54504. },
  54505. args: [],
  54506. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  54507. referencedClasses: ["Error"],
  54508. messageSends: ["should:raise:", "at:put:"]
  54509. }),
  54510. $globals.StringTest);
  54511. $core.addMethod(
  54512. $core.method({
  54513. selector: "testCapitalized",
  54514. protocol: "tests",
  54515. fn: function (){
  54516. var self=this;
  54517. return $core.withContext(function($ctx1) {
  54518. var $1,$2,$3;
  54519. $1="test"._capitalized();
  54520. $ctx1.sendIdx["capitalized"]=1;
  54521. self._assert_equals_($1,"Test");
  54522. $ctx1.sendIdx["assert:equals:"]=1;
  54523. $2="Test"._capitalized();
  54524. $ctx1.sendIdx["capitalized"]=2;
  54525. self._assert_equals_($2,"Test");
  54526. $ctx1.sendIdx["assert:equals:"]=2;
  54527. self._assert_equals_(""._capitalized(),"");
  54528. $ctx1.sendIdx["assert:equals:"]=3;
  54529. $3="Test"._isCapitalized();
  54530. $ctx1.sendIdx["isCapitalized"]=1;
  54531. self._assert_equals_($3,true);
  54532. $ctx1.sendIdx["assert:equals:"]=4;
  54533. self._assert_equals_("test"._isCapitalized(),false);
  54534. return self;
  54535. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  54536. },
  54537. args: [],
  54538. 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.",
  54539. referencedClasses: [],
  54540. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  54541. }),
  54542. $globals.StringTest);
  54543. $core.addMethod(
  54544. $core.method({
  54545. selector: "testCharCodeAt",
  54546. protocol: "tests",
  54547. fn: function (){
  54548. var self=this;
  54549. return $core.withContext(function($ctx1) {
  54550. var $1,$2,$3,$4,$5;
  54551. $1="jackie"._charCodeAt_((1));
  54552. $ctx1.sendIdx["charCodeAt:"]=1;
  54553. self._assert_equals_($1,(106));
  54554. $ctx1.sendIdx["assert:equals:"]=1;
  54555. $2="jackie"._charCodeAt_((2));
  54556. $ctx1.sendIdx["charCodeAt:"]=2;
  54557. self._assert_equals_($2,(97));
  54558. $ctx1.sendIdx["assert:equals:"]=2;
  54559. $3="jackie"._charCodeAt_((3));
  54560. $ctx1.sendIdx["charCodeAt:"]=3;
  54561. self._assert_equals_($3,(99));
  54562. $ctx1.sendIdx["assert:equals:"]=3;
  54563. $4="jackie"._charCodeAt_((4));
  54564. $ctx1.sendIdx["charCodeAt:"]=4;
  54565. self._assert_equals_($4,(107));
  54566. $ctx1.sendIdx["assert:equals:"]=4;
  54567. $5="jackie"._charCodeAt_((5));
  54568. $ctx1.sendIdx["charCodeAt:"]=5;
  54569. self._assert_equals_($5,(105));
  54570. $ctx1.sendIdx["assert:equals:"]=5;
  54571. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  54572. return self;
  54573. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  54574. },
  54575. args: [],
  54576. 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",
  54577. referencedClasses: [],
  54578. messageSends: ["assert:equals:", "charCodeAt:"]
  54579. }),
  54580. $globals.StringTest);
  54581. $core.addMethod(
  54582. $core.method({
  54583. selector: "testCopyFromTo",
  54584. protocol: "tests",
  54585. fn: function (){
  54586. var self=this;
  54587. return $core.withContext(function($ctx1) {
  54588. var $1;
  54589. $1="jackie"._copyFrom_to_((1),(3));
  54590. $ctx1.sendIdx["copyFrom:to:"]=1;
  54591. self._assert_equals_($1,"jac");
  54592. $ctx1.sendIdx["assert:equals:"]=1;
  54593. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  54594. return self;
  54595. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  54596. },
  54597. args: [],
  54598. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  54599. referencedClasses: [],
  54600. messageSends: ["assert:equals:", "copyFrom:to:"]
  54601. }),
  54602. $globals.StringTest);
  54603. $core.addMethod(
  54604. $core.method({
  54605. selector: "testCopySeparates",
  54606. protocol: "tests",
  54607. fn: function (){
  54608. var self=this;
  54609. return $core.withContext(function($ctx1) {
  54610. var $3,$2,$1;
  54611. $3=self._collection();
  54612. $ctx1.sendIdx["collection"]=1;
  54613. $2=$recv($3)._copy();
  54614. $1=$recv($2).__eq_eq(self._collection());
  54615. self._assert_($1);
  54616. return self;
  54617. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  54618. },
  54619. args: [],
  54620. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  54621. referencedClasses: [],
  54622. messageSends: ["assert:", "==", "copy", "collection"]
  54623. }),
  54624. $globals.StringTest);
  54625. $core.addMethod(
  54626. $core.method({
  54627. selector: "testCopyWithoutAll",
  54628. protocol: "tests",
  54629. fn: function (){
  54630. var self=this;
  54631. return $core.withContext(function($ctx1) {
  54632. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  54633. return self;
  54634. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  54635. },
  54636. args: [],
  54637. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  54638. referencedClasses: [],
  54639. messageSends: ["assert:equals:", "copyWithoutAll:"]
  54640. }),
  54641. $globals.StringTest);
  54642. $core.addMethod(
  54643. $core.method({
  54644. selector: "testEquality",
  54645. protocol: "tests",
  54646. fn: function (){
  54647. var self=this;
  54648. return $core.withContext(function($ctx1) {
  54649. var $1,$2,$3;
  54650. self._assert_equals_("hello","hello");
  54651. $ctx1.sendIdx["assert:equals:"]=1;
  54652. $1="hello".__eq("world");
  54653. $ctx1.sendIdx["="]=1;
  54654. self._deny_($1);
  54655. $ctx1.sendIdx["deny:"]=1;
  54656. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  54657. })));
  54658. $ctx1.sendIdx["="]=2;
  54659. self._deny_($2);
  54660. $ctx1.sendIdx["deny:"]=2;
  54661. $3="hello"._yourself();
  54662. $ctx1.sendIdx["yourself"]=1;
  54663. self._assert_equals_("hello",$3);
  54664. $ctx1.sendIdx["assert:equals:"]=2;
  54665. self._assert_equals_("hello"._yourself(),"hello");
  54666. self._deny_("".__eq((0)));
  54667. return self;
  54668. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  54669. },
  54670. args: [],
  54671. 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",
  54672. referencedClasses: [],
  54673. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  54674. }),
  54675. $globals.StringTest);
  54676. $core.addMethod(
  54677. $core.method({
  54678. selector: "testIdentity",
  54679. protocol: "tests",
  54680. fn: function (){
  54681. var self=this;
  54682. return $core.withContext(function($ctx1) {
  54683. var $1,$2,$4,$3,$5;
  54684. $1="hello".__eq_eq("hello");
  54685. $ctx1.sendIdx["=="]=1;
  54686. self._assert_($1);
  54687. $ctx1.sendIdx["assert:"]=1;
  54688. $2="hello".__eq_eq("world");
  54689. $ctx1.sendIdx["=="]=2;
  54690. self._deny_($2);
  54691. $ctx1.sendIdx["deny:"]=1;
  54692. $4="hello"._yourself();
  54693. $ctx1.sendIdx["yourself"]=1;
  54694. $3="hello".__eq_eq($4);
  54695. $ctx1.sendIdx["=="]=3;
  54696. self._assert_($3);
  54697. $ctx1.sendIdx["assert:"]=2;
  54698. $5=$recv("hello"._yourself()).__eq_eq("hello");
  54699. $ctx1.sendIdx["=="]=4;
  54700. self._assert_($5);
  54701. self._deny_("".__eq_eq((0)));
  54702. return self;
  54703. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  54704. },
  54705. args: [],
  54706. 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",
  54707. referencedClasses: [],
  54708. messageSends: ["assert:", "==", "deny:", "yourself"]
  54709. }),
  54710. $globals.StringTest);
  54711. $core.addMethod(
  54712. $core.method({
  54713. selector: "testIncludesSubString",
  54714. protocol: "tests",
  54715. fn: function (){
  54716. var self=this;
  54717. return $core.withContext(function($ctx1) {
  54718. var $1;
  54719. $1="amber"._includesSubString_("ber");
  54720. $ctx1.sendIdx["includesSubString:"]=1;
  54721. self._assert_($1);
  54722. self._deny_("amber"._includesSubString_("zork"));
  54723. return self;
  54724. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  54725. },
  54726. args: [],
  54727. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  54728. referencedClasses: [],
  54729. messageSends: ["assert:", "includesSubString:", "deny:"]
  54730. }),
  54731. $globals.StringTest);
  54732. $core.addMethod(
  54733. $core.method({
  54734. selector: "testIndexOfStartingAtWithNull",
  54735. protocol: "tests",
  54736. fn: function (){
  54737. var self=this;
  54738. return self;
  54739. },
  54740. args: [],
  54741. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  54742. referencedClasses: [],
  54743. messageSends: []
  54744. }),
  54745. $globals.StringTest);
  54746. $core.addMethod(
  54747. $core.method({
  54748. selector: "testIndexOfWithNull",
  54749. protocol: "tests",
  54750. fn: function (){
  54751. var self=this;
  54752. return self;
  54753. },
  54754. args: [],
  54755. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  54756. referencedClasses: [],
  54757. messageSends: []
  54758. }),
  54759. $globals.StringTest);
  54760. $core.addMethod(
  54761. $core.method({
  54762. selector: "testIsVowel",
  54763. protocol: "tests",
  54764. fn: function (){
  54765. var self=this;
  54766. var vowel,consonant;
  54767. return $core.withContext(function($ctx1) {
  54768. var $1;
  54769. vowel="u";
  54770. consonant="z";
  54771. $1=$recv(vowel)._isVowel();
  54772. $ctx1.sendIdx["isVowel"]=1;
  54773. self._assert_equals_($1,true);
  54774. $ctx1.sendIdx["assert:equals:"]=1;
  54775. self._assert_equals_($recv(consonant)._isVowel(),false);
  54776. return self;
  54777. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  54778. },
  54779. args: [],
  54780. 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",
  54781. referencedClasses: [],
  54782. messageSends: ["assert:equals:", "isVowel"]
  54783. }),
  54784. $globals.StringTest);
  54785. $core.addMethod(
  54786. $core.method({
  54787. selector: "testJoin",
  54788. protocol: "tests",
  54789. fn: function (){
  54790. var self=this;
  54791. return $core.withContext(function($ctx1) {
  54792. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  54793. return self;
  54794. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  54795. },
  54796. args: [],
  54797. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  54798. referencedClasses: [],
  54799. messageSends: ["assert:equals:", "join:"]
  54800. }),
  54801. $globals.StringTest);
  54802. $core.addMethod(
  54803. $core.method({
  54804. selector: "testRemoveAll",
  54805. protocol: "tests",
  54806. fn: function (){
  54807. var self=this;
  54808. return $core.withContext(function($ctx1) {
  54809. self._should_raise_((function(){
  54810. return $core.withContext(function($ctx2) {
  54811. return $recv(self._collection())._removeAll();
  54812. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54813. }),$globals.Error);
  54814. return self;
  54815. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  54816. },
  54817. args: [],
  54818. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  54819. referencedClasses: ["Error"],
  54820. messageSends: ["should:raise:", "removeAll", "collection"]
  54821. }),
  54822. $globals.StringTest);
  54823. $core.addMethod(
  54824. $core.method({
  54825. selector: "testReversed",
  54826. protocol: "tests",
  54827. fn: function (){
  54828. var self=this;
  54829. return $core.withContext(function($ctx1) {
  54830. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  54831. return self;
  54832. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  54833. },
  54834. args: [],
  54835. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  54836. referencedClasses: [],
  54837. messageSends: ["assert:equals:", "reversed"]
  54838. }),
  54839. $globals.StringTest);
  54840. $core.addMethod(
  54841. $core.method({
  54842. selector: "testStreamContents",
  54843. protocol: "tests",
  54844. fn: function (){
  54845. var self=this;
  54846. return $core.withContext(function($ctx1) {
  54847. self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  54848. return $core.withContext(function($ctx2) {
  54849. $recv(aStream)._nextPutAll_("hello");
  54850. $ctx2.sendIdx["nextPutAll:"]=1;
  54851. $recv(aStream)._space();
  54852. return $recv(aStream)._nextPutAll_("world");
  54853. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  54854. })),"hello world");
  54855. return self;
  54856. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  54857. },
  54858. args: [],
  54859. 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'",
  54860. referencedClasses: ["String"],
  54861. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  54862. }),
  54863. $globals.StringTest);
  54864. $core.addMethod(
  54865. $core.method({
  54866. selector: "testSubStrings",
  54867. protocol: "tests",
  54868. fn: function (){
  54869. var self=this;
  54870. return $core.withContext(function($ctx1) {
  54871. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  54872. return self;
  54873. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  54874. },
  54875. args: [],
  54876. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  54877. referencedClasses: [],
  54878. messageSends: ["assert:equals:", "subStrings:"]
  54879. }),
  54880. $globals.StringTest);
  54881. $core.addMethod(
  54882. $core.method({
  54883. selector: "testTrim",
  54884. protocol: "tests",
  54885. fn: function (){
  54886. var self=this;
  54887. return $core.withContext(function($ctx1) {
  54888. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  54889. $ctx1.sendIdx["assert:equals:"]=1;
  54890. self._assert_equals_("jackie "._trimRight(),"jackie");
  54891. return self;
  54892. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  54893. },
  54894. args: [],
  54895. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  54896. referencedClasses: [],
  54897. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  54898. }),
  54899. $globals.StringTest);
  54900. $core.addMethod(
  54901. $core.method({
  54902. selector: "testValue",
  54903. protocol: "tests",
  54904. fn: function (){
  54905. var self=this;
  54906. return $core.withContext(function($ctx1) {
  54907. self._assert_equals_("asString"._value_((1)),"1");
  54908. $ctx1.sendIdx["assert:equals:"]=1;
  54909. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  54910. return self;
  54911. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  54912. },
  54913. args: [],
  54914. 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')",
  54915. referencedClasses: [],
  54916. messageSends: ["assert:equals:", "value:", "collect:"]
  54917. }),
  54918. $globals.StringTest);
  54919. $core.addMethod(
  54920. $core.method({
  54921. selector: "collectionClass",
  54922. protocol: "fixture",
  54923. fn: function (){
  54924. var self=this;
  54925. return $globals.String;
  54926. },
  54927. args: [],
  54928. source: "collectionClass\x0a\x09^ String",
  54929. referencedClasses: ["String"],
  54930. messageSends: []
  54931. }),
  54932. $globals.StringTest.klass);
  54933. $core.addClass("SetTest", $globals.CollectionTest, [], "Kernel-Tests");
  54934. $core.addMethod(
  54935. $core.method({
  54936. selector: "collection",
  54937. protocol: "fixture",
  54938. fn: function (){
  54939. var self=this;
  54940. return $core.withContext(function($ctx1) {
  54941. var $1;
  54942. $1=$recv($globals.Set)._new();
  54943. $recv($1)._add_($globals.Smalltalk);
  54944. $ctx1.sendIdx["add:"]=1;
  54945. $recv($1)._add_(nil);
  54946. $ctx1.sendIdx["add:"]=2;
  54947. $recv($1)._add_((3).__at((3)));
  54948. $ctx1.sendIdx["add:"]=3;
  54949. $recv($1)._add_(false);
  54950. $ctx1.sendIdx["add:"]=4;
  54951. $recv($1)._add_(self["@sampleBlock"]);
  54952. return $recv($1)._yourself();
  54953. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  54954. },
  54955. args: [],
  54956. 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",
  54957. referencedClasses: ["Set", "Smalltalk"],
  54958. messageSends: ["add:", "new", "@", "yourself"]
  54959. }),
  54960. $globals.SetTest);
  54961. $core.addMethod(
  54962. $core.method({
  54963. selector: "collectionOfPrintStrings",
  54964. protocol: "fixture",
  54965. fn: function (){
  54966. var self=this;
  54967. return $core.withContext(function($ctx1) {
  54968. var $1;
  54969. $1=$recv($globals.Set)._new();
  54970. $recv($1)._add_("a SmalltalkImage");
  54971. $ctx1.sendIdx["add:"]=1;
  54972. $recv($1)._add_("nil");
  54973. $ctx1.sendIdx["add:"]=2;
  54974. $recv($1)._add_("3@3");
  54975. $ctx1.sendIdx["add:"]=3;
  54976. $recv($1)._add_("false");
  54977. $ctx1.sendIdx["add:"]=4;
  54978. $recv($1)._add_("a BlockClosure");
  54979. return $recv($1)._yourself();
  54980. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  54981. },
  54982. args: [],
  54983. 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",
  54984. referencedClasses: ["Set"],
  54985. messageSends: ["add:", "new", "yourself"]
  54986. }),
  54987. $globals.SetTest);
  54988. $core.addMethod(
  54989. $core.method({
  54990. selector: "collectionSize",
  54991. protocol: "fixture",
  54992. fn: function (){
  54993. var self=this;
  54994. return (5);
  54995. },
  54996. args: [],
  54997. source: "collectionSize\x0a\x09^ 5",
  54998. referencedClasses: [],
  54999. messageSends: []
  55000. }),
  55001. $globals.SetTest);
  55002. $core.addMethod(
  55003. $core.method({
  55004. selector: "collectionWithDuplicates",
  55005. protocol: "fixture",
  55006. fn: function (){
  55007. var self=this;
  55008. return $core.withContext(function($ctx1) {
  55009. var $1;
  55010. $1=self._collection();
  55011. $recv($1)._add_((0));
  55012. return $recv($1)._yourself();
  55013. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  55014. },
  55015. args: [],
  55016. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  55017. referencedClasses: [],
  55018. messageSends: ["add:", "collection", "yourself"]
  55019. }),
  55020. $globals.SetTest);
  55021. $core.addMethod(
  55022. $core.method({
  55023. selector: "collectionWithNewValue",
  55024. protocol: "fixture",
  55025. fn: function (){
  55026. var self=this;
  55027. return $core.withContext(function($ctx1) {
  55028. var $1;
  55029. $1=$recv($globals.Set)._new();
  55030. $recv($1)._add_($globals.Smalltalk);
  55031. $ctx1.sendIdx["add:"]=1;
  55032. $recv($1)._add_(nil);
  55033. $ctx1.sendIdx["add:"]=2;
  55034. $recv($1)._add_((3).__at((3)));
  55035. $ctx1.sendIdx["add:"]=3;
  55036. $recv($1)._add_("N");
  55037. $ctx1.sendIdx["add:"]=4;
  55038. $recv($1)._add_(false);
  55039. $ctx1.sendIdx["add:"]=5;
  55040. $recv($1)._add_(self["@sampleBlock"]);
  55041. return $recv($1)._yourself();
  55042. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  55043. },
  55044. args: [],
  55045. 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",
  55046. referencedClasses: ["Set", "Smalltalk"],
  55047. messageSends: ["add:", "new", "@", "yourself"]
  55048. }),
  55049. $globals.SetTest);
  55050. $core.addMethod(
  55051. $core.method({
  55052. selector: "testAddAll",
  55053. protocol: "tests",
  55054. fn: function (){
  55055. var self=this;
  55056. return $core.withContext(function($ctx1) {
  55057. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  55058. (
  55059. $ctx1.supercall = true,
  55060. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($recv(self), []));
  55061. $ctx1.supercall = false;
  55062. $2=self._collection();
  55063. $ctx1.sendIdx["collection"]=1;
  55064. $3=self._collection();
  55065. $ctx1.sendIdx["collection"]=2;
  55066. $recv($2)._addAll_($3);
  55067. $ctx1.sendIdx["addAll:"]=1;
  55068. $4=$recv($2)._yourself();
  55069. $ctx1.sendIdx["yourself"]=1;
  55070. $1=$4;
  55071. $5=self._collection();
  55072. $ctx1.sendIdx["collection"]=3;
  55073. self._assert_equals_($1,$5);
  55074. $ctx1.sendIdx["assert:equals:"]=1;
  55075. $7=self._collection();
  55076. $ctx1.sendIdx["collection"]=4;
  55077. $8=self._collectionWithNewValue();
  55078. $ctx1.sendIdx["collectionWithNewValue"]=1;
  55079. $recv($7)._addAll_($8);
  55080. $ctx1.sendIdx["addAll:"]=2;
  55081. $9=$recv($7)._yourself();
  55082. $ctx1.sendIdx["yourself"]=2;
  55083. $6=$9;
  55084. $10=self._collectionWithNewValue();
  55085. $ctx1.sendIdx["collectionWithNewValue"]=2;
  55086. self._assert_equals_($6,$10);
  55087. $ctx1.sendIdx["assert:equals:"]=2;
  55088. $12=self._collectionWithNewValue();
  55089. $ctx1.sendIdx["collectionWithNewValue"]=3;
  55090. $recv($12)._addAll_(self._collection());
  55091. $11=$recv($12)._yourself();
  55092. self._assert_equals_($11,self._collectionWithNewValue());
  55093. return self;
  55094. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  55095. },
  55096. args: [],
  55097. 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",
  55098. referencedClasses: [],
  55099. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  55100. }),
  55101. $globals.SetTest);
  55102. $core.addMethod(
  55103. $core.method({
  55104. selector: "testAddRemove",
  55105. protocol: "tests",
  55106. fn: function (){
  55107. var self=this;
  55108. var set;
  55109. return $core.withContext(function($ctx1) {
  55110. var $1,$2;
  55111. set=$recv($globals.Set)._new();
  55112. self._assert_($recv(set)._isEmpty());
  55113. $ctx1.sendIdx["assert:"]=1;
  55114. $recv(set)._add_((3));
  55115. $ctx1.sendIdx["add:"]=1;
  55116. $1=$recv(set)._includes_((3));
  55117. $ctx1.sendIdx["includes:"]=1;
  55118. self._assert_($1);
  55119. $ctx1.sendIdx["assert:"]=2;
  55120. $recv(set)._add_((5));
  55121. $2=$recv(set)._includes_((5));
  55122. $ctx1.sendIdx["includes:"]=2;
  55123. self._assert_($2);
  55124. $recv(set)._remove_((3));
  55125. self._deny_($recv(set)._includes_((3)));
  55126. return self;
  55127. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  55128. },
  55129. args: [],
  55130. 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)",
  55131. referencedClasses: ["Set"],
  55132. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  55133. }),
  55134. $globals.SetTest);
  55135. $core.addMethod(
  55136. $core.method({
  55137. selector: "testAt",
  55138. protocol: "tests",
  55139. fn: function (){
  55140. var self=this;
  55141. return $core.withContext(function($ctx1) {
  55142. self._should_raise_((function(){
  55143. return $core.withContext(function($ctx2) {
  55144. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  55145. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55146. }),$globals.Error);
  55147. return self;
  55148. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  55149. },
  55150. args: [],
  55151. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  55152. referencedClasses: ["Set", "Error"],
  55153. messageSends: ["should:raise:", "at:put:", "new"]
  55154. }),
  55155. $globals.SetTest);
  55156. $core.addMethod(
  55157. $core.method({
  55158. selector: "testCollect",
  55159. protocol: "tests",
  55160. fn: function (){
  55161. var self=this;
  55162. return $core.withContext(function($ctx1) {
  55163. var $2,$1;
  55164. (
  55165. $ctx1.supercall = true,
  55166. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($recv(self), []));
  55167. $ctx1.supercall = false;
  55168. $2=[(5), (6), (8)]._asSet();
  55169. $ctx1.sendIdx["asSet"]=1;
  55170. $1=$recv($2)._collect_((function(x){
  55171. return $core.withContext(function($ctx2) {
  55172. return $recv(x).__backslash_backslash((3));
  55173. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55174. }));
  55175. self._assert_equals_($1,[(0), (2)]._asSet());
  55176. return self;
  55177. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  55178. },
  55179. args: [],
  55180. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  55181. referencedClasses: [],
  55182. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  55183. }),
  55184. $globals.SetTest);
  55185. $core.addMethod(
  55186. $core.method({
  55187. selector: "testComma",
  55188. protocol: "tests",
  55189. fn: function (){
  55190. var self=this;
  55191. return $core.withContext(function($ctx1) {
  55192. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  55193. (
  55194. $ctx1.supercall = true,
  55195. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($recv(self), []));
  55196. $ctx1.supercall = false;
  55197. $2=self._collection();
  55198. $ctx1.sendIdx["collection"]=1;
  55199. $3=self._collection();
  55200. $ctx1.sendIdx["collection"]=2;
  55201. $1=$recv($2).__comma($3);
  55202. $ctx1.sendIdx[","]=1;
  55203. $4=self._collection();
  55204. $ctx1.sendIdx["collection"]=3;
  55205. self._assert_equals_($1,$4);
  55206. $ctx1.sendIdx["assert:equals:"]=1;
  55207. $6=self._collection();
  55208. $ctx1.sendIdx["collection"]=4;
  55209. $7=self._collectionWithNewValue();
  55210. $ctx1.sendIdx["collectionWithNewValue"]=1;
  55211. $5=$recv($6).__comma($7);
  55212. $ctx1.sendIdx[","]=2;
  55213. $8=self._collectionWithNewValue();
  55214. $ctx1.sendIdx["collectionWithNewValue"]=2;
  55215. self._assert_equals_($5,$8);
  55216. $ctx1.sendIdx["assert:equals:"]=2;
  55217. $10=self._collectionWithNewValue();
  55218. $ctx1.sendIdx["collectionWithNewValue"]=3;
  55219. $9=$recv($10).__comma(self._collection());
  55220. self._assert_equals_($9,self._collectionWithNewValue());
  55221. return self;
  55222. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  55223. },
  55224. args: [],
  55225. 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",
  55226. referencedClasses: [],
  55227. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  55228. }),
  55229. $globals.SetTest);
  55230. $core.addMethod(
  55231. $core.method({
  55232. selector: "testComparing",
  55233. protocol: "tests",
  55234. fn: function (){
  55235. var self=this;
  55236. return $core.withContext(function($ctx1) {
  55237. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  55238. $1=[(0), (2)]._asSet();
  55239. $ctx1.sendIdx["asSet"]=1;
  55240. $2=[(0), (2)]._asSet();
  55241. $ctx1.sendIdx["asSet"]=2;
  55242. self._assert_equals_($1,$2);
  55243. $ctx1.sendIdx["assert:equals:"]=1;
  55244. $3=[(2), (0)]._asSet();
  55245. $ctx1.sendIdx["asSet"]=3;
  55246. $4=[(0), (2)]._asSet();
  55247. $ctx1.sendIdx["asSet"]=4;
  55248. self._assert_equals_($3,$4);
  55249. $6=[(0), (2), (3)]._asSet();
  55250. $ctx1.sendIdx["asSet"]=5;
  55251. $7=[(0), (2)]._asSet();
  55252. $ctx1.sendIdx["asSet"]=6;
  55253. $5=$recv($6).__eq($7);
  55254. $ctx1.sendIdx["="]=1;
  55255. self._deny_($5);
  55256. $ctx1.sendIdx["deny:"]=1;
  55257. $9=[(1), (2)]._asSet();
  55258. $ctx1.sendIdx["asSet"]=7;
  55259. $8=$recv($9).__eq([(0), (2)]._asSet());
  55260. self._deny_($8);
  55261. return self;
  55262. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  55263. },
  55264. args: [],
  55265. 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",
  55266. referencedClasses: [],
  55267. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  55268. }),
  55269. $globals.SetTest);
  55270. $core.addMethod(
  55271. $core.method({
  55272. selector: "testPrintString",
  55273. protocol: "tests",
  55274. fn: function (){
  55275. var self=this;
  55276. var set;
  55277. return $core.withContext(function($ctx1) {
  55278. var $1,$2,$3,$4,$5,$6,$7,$8;
  55279. set=$recv($globals.Set)._new();
  55280. $1=$recv(set)._printString();
  55281. $ctx1.sendIdx["printString"]=1;
  55282. self._assert_equals_($1,"a Set ()");
  55283. $ctx1.sendIdx["assert:equals:"]=1;
  55284. $2=set;
  55285. $recv($2)._add_((1));
  55286. $ctx1.sendIdx["add:"]=1;
  55287. $3=$recv($2)._add_((3));
  55288. $ctx1.sendIdx["add:"]=2;
  55289. $4=$recv(set)._printString();
  55290. $ctx1.sendIdx["printString"]=2;
  55291. self._assert_equals_($4,"a Set (1 3)");
  55292. $ctx1.sendIdx["assert:equals:"]=2;
  55293. $recv(set)._add_("foo");
  55294. $ctx1.sendIdx["add:"]=3;
  55295. $5=$recv(set)._printString();
  55296. $ctx1.sendIdx["printString"]=3;
  55297. self._assert_equals_($5,"a Set (1 3 'foo')");
  55298. $ctx1.sendIdx["assert:equals:"]=3;
  55299. $6=set;
  55300. $recv($6)._remove_((1));
  55301. $ctx1.sendIdx["remove:"]=1;
  55302. $recv($6)._remove_((3));
  55303. $7=$recv(set)._printString();
  55304. $ctx1.sendIdx["printString"]=4;
  55305. self._assert_equals_($7,"a Set ('foo')");
  55306. $ctx1.sendIdx["assert:equals:"]=4;
  55307. $recv(set)._add_((3));
  55308. $ctx1.sendIdx["add:"]=4;
  55309. $8=$recv(set)._printString();
  55310. $ctx1.sendIdx["printString"]=5;
  55311. self._assert_equals_($8,"a Set (3 'foo')");
  55312. $ctx1.sendIdx["assert:equals:"]=5;
  55313. $recv(set)._add_((3));
  55314. self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  55315. return self;
  55316. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  55317. },
  55318. args: [],
  55319. 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'')'",
  55320. referencedClasses: ["Set"],
  55321. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  55322. }),
  55323. $globals.SetTest);
  55324. $core.addMethod(
  55325. $core.method({
  55326. selector: "testUnboxedObjects",
  55327. protocol: "tests",
  55328. fn: function (){
  55329. var self=this;
  55330. return $core.withContext(function($ctx1) {
  55331. var $4,$3,$2,$1;
  55332. $4="foo"._yourself();
  55333. $ctx1.sendIdx["yourself"]=1;
  55334. $3=[$4,"foo"._yourself()];
  55335. $2=$recv($3)._asSet();
  55336. $1=$recv($2)._asArray();
  55337. self._assert_equals_($1,["foo"]);
  55338. return self;
  55339. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  55340. },
  55341. args: [],
  55342. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  55343. referencedClasses: [],
  55344. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  55345. }),
  55346. $globals.SetTest);
  55347. $core.addMethod(
  55348. $core.method({
  55349. selector: "testUnicity",
  55350. protocol: "tests",
  55351. fn: function (){
  55352. var self=this;
  55353. var set;
  55354. return $core.withContext(function($ctx1) {
  55355. var $1;
  55356. set=$recv($globals.Set)._new();
  55357. $recv(set)._add_((21));
  55358. $ctx1.sendIdx["add:"]=1;
  55359. $recv(set)._add_("hello");
  55360. $ctx1.sendIdx["add:"]=2;
  55361. $recv(set)._add_((21));
  55362. $ctx1.sendIdx["add:"]=3;
  55363. $1=$recv(set)._size();
  55364. $ctx1.sendIdx["size"]=1;
  55365. self._assert_equals_($1,(2));
  55366. $ctx1.sendIdx["assert:equals:"]=1;
  55367. $recv(set)._add_("hello");
  55368. self._assert_equals_($recv(set)._size(),(2));
  55369. $ctx1.sendIdx["assert:equals:"]=2;
  55370. self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  55371. return self;
  55372. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  55373. },
  55374. args: [],
  55375. 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')",
  55376. referencedClasses: ["Set"],
  55377. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  55378. }),
  55379. $globals.SetTest);
  55380. $core.addMethod(
  55381. $core.method({
  55382. selector: "collectionClass",
  55383. protocol: "fixture",
  55384. fn: function (){
  55385. var self=this;
  55386. return $globals.Set;
  55387. },
  55388. args: [],
  55389. source: "collectionClass\x0a\x09^ Set",
  55390. referencedClasses: ["Set"],
  55391. messageSends: []
  55392. }),
  55393. $globals.SetTest.klass);
  55394. $core.addClass("ConsoleTranscriptTest", $globals.TestCase, [], "Kernel-Tests");
  55395. $core.addMethod(
  55396. $core.method({
  55397. selector: "testShow",
  55398. protocol: "tests",
  55399. fn: function (){
  55400. var self=this;
  55401. var originalTranscript;
  55402. return $core.withContext(function($ctx1) {
  55403. originalTranscript=$recv($globals.Transcript)._current();
  55404. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  55405. $ctx1.sendIdx["register:"]=1;
  55406. self._shouldnt_raise_((function(){
  55407. return $core.withContext(function($ctx2) {
  55408. return $recv($globals.Transcript)._show_("Hello console!");
  55409. $ctx2.sendIdx["show:"]=1;
  55410. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55411. }),$globals.Error);
  55412. $ctx1.sendIdx["shouldnt:raise:"]=1;
  55413. self._shouldnt_raise_((function(){
  55414. return $core.withContext(function($ctx2) {
  55415. return $recv($globals.Transcript)._show_(console);
  55416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55417. }),$globals.Error);
  55418. $recv($globals.Transcript)._register_(originalTranscript);
  55419. return self;
  55420. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  55421. },
  55422. args: [],
  55423. 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.",
  55424. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  55425. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  55426. }),
  55427. $globals.ConsoleTranscriptTest);
  55428. $core.addClass("DateTest", $globals.TestCase, [], "Kernel-Tests");
  55429. $core.addMethod(
  55430. $core.method({
  55431. selector: "testEquality",
  55432. protocol: "tests",
  55433. fn: function (){
  55434. var self=this;
  55435. var now;
  55436. return $core.withContext(function($ctx1) {
  55437. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  55438. now=$recv($globals.Date)._new();
  55439. $1=$recv(now).__eq(now);
  55440. $ctx1.sendIdx["="]=1;
  55441. self._assert_($1);
  55442. $ctx1.sendIdx["assert:"]=1;
  55443. $3=now;
  55444. $4=$recv($globals.Date)._fromMilliseconds_((0));
  55445. $ctx1.sendIdx["fromMilliseconds:"]=1;
  55446. $2=$recv($3).__eq($4);
  55447. $ctx1.sendIdx["="]=2;
  55448. self._deny_($2);
  55449. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  55450. $ctx1.sendIdx["fromMilliseconds:"]=2;
  55451. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  55452. $ctx1.sendIdx["fromMilliseconds:"]=3;
  55453. $5=$recv($6).__eq($7);
  55454. $ctx1.sendIdx["="]=3;
  55455. self._assert_($5);
  55456. $ctx1.sendIdx["assert:"]=2;
  55457. $9=now;
  55458. $11=$recv(now)._asMilliseconds();
  55459. $ctx1.sendIdx["asMilliseconds"]=1;
  55460. $10=$recv($globals.Date)._fromMilliseconds_($11);
  55461. $ctx1.sendIdx["fromMilliseconds:"]=4;
  55462. $8=$recv($9).__eq($10);
  55463. $ctx1.sendIdx["="]=4;
  55464. self._assert_($8);
  55465. $ctx1.sendIdx["assert:"]=3;
  55466. self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  55467. return self;
  55468. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  55469. },
  55470. args: [],
  55471. 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",
  55472. referencedClasses: ["Date"],
  55473. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  55474. }),
  55475. $globals.DateTest);
  55476. $core.addMethod(
  55477. $core.method({
  55478. selector: "testIdentity",
  55479. protocol: "tests",
  55480. fn: function (){
  55481. var self=this;
  55482. var now;
  55483. return $core.withContext(function($ctx1) {
  55484. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  55485. now=$recv($globals.Date)._new();
  55486. $1=$recv(now).__eq_eq(now);
  55487. $ctx1.sendIdx["=="]=1;
  55488. self._assert_($1);
  55489. $3=now;
  55490. $4=$recv($globals.Date)._fromMilliseconds_((0));
  55491. $ctx1.sendIdx["fromMilliseconds:"]=1;
  55492. $2=$recv($3).__eq_eq($4);
  55493. $ctx1.sendIdx["=="]=2;
  55494. self._deny_($2);
  55495. $ctx1.sendIdx["deny:"]=1;
  55496. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  55497. $ctx1.sendIdx["fromMilliseconds:"]=2;
  55498. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  55499. $ctx1.sendIdx["fromMilliseconds:"]=3;
  55500. $5=$recv($6).__eq_eq($7);
  55501. $ctx1.sendIdx["=="]=3;
  55502. self._deny_($5);
  55503. $ctx1.sendIdx["deny:"]=2;
  55504. $9=now;
  55505. $11=$recv(now)._asMilliseconds();
  55506. $ctx1.sendIdx["asMilliseconds"]=1;
  55507. $10=$recv($globals.Date)._fromMilliseconds_($11);
  55508. $ctx1.sendIdx["fromMilliseconds:"]=4;
  55509. $8=$recv($9).__eq_eq($10);
  55510. $ctx1.sendIdx["=="]=4;
  55511. self._deny_($8);
  55512. $ctx1.sendIdx["deny:"]=3;
  55513. self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  55514. return self;
  55515. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  55516. },
  55517. args: [],
  55518. 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",
  55519. referencedClasses: ["Date"],
  55520. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  55521. }),
  55522. $globals.DateTest);
  55523. $core.addClass("JSObjectProxyTest", $globals.TestCase, [], "Kernel-Tests");
  55524. $core.addMethod(
  55525. $core.method({
  55526. selector: "jsNull",
  55527. protocol: "accessing",
  55528. fn: function (){
  55529. var self=this;
  55530. return $core.withContext(function($ctx1) {
  55531. return null;
  55532. return self;
  55533. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)});
  55534. },
  55535. args: [],
  55536. source: "jsNull\x0a\x09<inlineJS: 'return null'>",
  55537. referencedClasses: [],
  55538. messageSends: []
  55539. }),
  55540. $globals.JSObjectProxyTest);
  55541. $core.addMethod(
  55542. $core.method({
  55543. selector: "jsObject",
  55544. protocol: "accessing",
  55545. fn: function (){
  55546. var self=this;
  55547. return $core.withContext(function($ctx1) {
  55548. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  55549. return self;
  55550. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  55551. },
  55552. args: [],
  55553. 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}'>",
  55554. referencedClasses: [],
  55555. messageSends: []
  55556. }),
  55557. $globals.JSObjectProxyTest);
  55558. $core.addMethod(
  55559. $core.method({
  55560. selector: "jsUndefined",
  55561. protocol: "accessing",
  55562. fn: function (){
  55563. var self=this;
  55564. return $core.withContext(function($ctx1) {
  55565. return;
  55566. return self;
  55567. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  55568. },
  55569. args: [],
  55570. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  55571. referencedClasses: [],
  55572. messageSends: []
  55573. }),
  55574. $globals.JSObjectProxyTest);
  55575. $core.addMethod(
  55576. $core.method({
  55577. selector: "testAtIfAbsent",
  55578. protocol: "tests",
  55579. fn: function (){
  55580. var self=this;
  55581. var testObject;
  55582. return $core.withContext(function($ctx1) {
  55583. var $1,$2,$3;
  55584. testObject=self._jsObject();
  55585. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  55586. return "Property does not exist";
  55587. }));
  55588. $ctx1.sendIdx["at:ifAbsent:"]=1;
  55589. self._assert_equals_($1,"Property does not exist");
  55590. $ctx1.sendIdx["assert:equals:"]=1;
  55591. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  55592. return "Property does not exist";
  55593. }));
  55594. $ctx1.sendIdx["at:ifAbsent:"]=2;
  55595. self._assert_equals_($2,nil);
  55596. $ctx1.sendIdx["assert:equals:"]=2;
  55597. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  55598. return "Property does not exist";
  55599. }));
  55600. $ctx1.sendIdx["at:ifAbsent:"]=3;
  55601. self._assert_equals_($3,(1));
  55602. $ctx1.sendIdx["assert:equals:"]=3;
  55603. self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  55604. return "Property does not exist";
  55605. })),nil);
  55606. return self;
  55607. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  55608. },
  55609. args: [],
  55610. 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.",
  55611. referencedClasses: [],
  55612. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  55613. }),
  55614. $globals.JSObjectProxyTest);
  55615. $core.addMethod(
  55616. $core.method({
  55617. selector: "testAtIfPresent",
  55618. protocol: "tests",
  55619. fn: function (){
  55620. var self=this;
  55621. var testObject;
  55622. return $core.withContext(function($ctx1) {
  55623. var $2,$1,$4,$3,$6,$5;
  55624. testObject=self._jsObject();
  55625. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  55626. return $core.withContext(function($ctx2) {
  55627. $2=$recv(x)._asString();
  55628. $ctx2.sendIdx["asString"]=1;
  55629. return "hello ".__comma($2);
  55630. $ctx2.sendIdx[","]=1;
  55631. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55632. }));
  55633. $ctx1.sendIdx["at:ifPresent:"]=1;
  55634. self._assert_equals_($1,nil);
  55635. $ctx1.sendIdx["assert:equals:"]=1;
  55636. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  55637. return $core.withContext(function($ctx2) {
  55638. $4=$recv(x)._asString();
  55639. $ctx2.sendIdx["asString"]=2;
  55640. return "hello ".__comma($4);
  55641. $ctx2.sendIdx[","]=2;
  55642. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  55643. }));
  55644. $ctx1.sendIdx["at:ifPresent:"]=2;
  55645. self._assert_equals_($3,"hello nil");
  55646. $ctx1.sendIdx["assert:equals:"]=2;
  55647. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  55648. return $core.withContext(function($ctx2) {
  55649. $6=$recv(x)._asString();
  55650. $ctx2.sendIdx["asString"]=3;
  55651. return "hello ".__comma($6);
  55652. $ctx2.sendIdx[","]=3;
  55653. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  55654. }));
  55655. $ctx1.sendIdx["at:ifPresent:"]=3;
  55656. self._assert_equals_($5,"hello 1");
  55657. $ctx1.sendIdx["assert:equals:"]=3;
  55658. self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  55659. return $core.withContext(function($ctx2) {
  55660. return "hello ".__comma($recv(x)._asString());
  55661. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  55662. })),"hello nil");
  55663. return self;
  55664. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  55665. },
  55666. args: [],
  55667. 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'.",
  55668. referencedClasses: [],
  55669. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  55670. }),
  55671. $globals.JSObjectProxyTest);
  55672. $core.addMethod(
  55673. $core.method({
  55674. selector: "testAtIfPresentIfAbsent",
  55675. protocol: "tests",
  55676. fn: function (){
  55677. var self=this;
  55678. var testObject;
  55679. return $core.withContext(function($ctx1) {
  55680. var $2,$1,$4,$3,$6,$5;
  55681. testObject=self._jsObject();
  55682. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  55683. return $core.withContext(function($ctx2) {
  55684. $2=$recv(x)._asString();
  55685. $ctx2.sendIdx["asString"]=1;
  55686. return "hello ".__comma($2);
  55687. $ctx2.sendIdx[","]=1;
  55688. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55689. }),(function(){
  55690. return "not present";
  55691. }));
  55692. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  55693. self._assert_equals_($1,"not present");
  55694. $ctx1.sendIdx["assert:equals:"]=1;
  55695. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  55696. return $core.withContext(function($ctx2) {
  55697. $4=$recv(x)._asString();
  55698. $ctx2.sendIdx["asString"]=2;
  55699. return "hello ".__comma($4);
  55700. $ctx2.sendIdx[","]=2;
  55701. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  55702. }),(function(){
  55703. return "not present";
  55704. }));
  55705. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  55706. self._assert_equals_($3,"hello nil");
  55707. $ctx1.sendIdx["assert:equals:"]=2;
  55708. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  55709. return $core.withContext(function($ctx2) {
  55710. $6=$recv(x)._asString();
  55711. $ctx2.sendIdx["asString"]=3;
  55712. return "hello ".__comma($6);
  55713. $ctx2.sendIdx[","]=3;
  55714. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  55715. }),(function(){
  55716. return "not present";
  55717. }));
  55718. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  55719. self._assert_equals_($5,"hello 1");
  55720. $ctx1.sendIdx["assert:equals:"]=3;
  55721. self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  55722. return $core.withContext(function($ctx2) {
  55723. return "hello ".__comma($recv(x)._asString());
  55724. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  55725. }),(function(){
  55726. return "not present";
  55727. })),"hello nil");
  55728. return self;
  55729. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  55730. },
  55731. args: [],
  55732. 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'.",
  55733. referencedClasses: [],
  55734. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  55735. }),
  55736. $globals.JSObjectProxyTest);
  55737. $core.addMethod(
  55738. $core.method({
  55739. selector: "testAtPut",
  55740. protocol: "tests",
  55741. fn: function (){
  55742. var self=this;
  55743. var testObject;
  55744. return $core.withContext(function($ctx1) {
  55745. var $2,$1;
  55746. testObject=self._jsObject();
  55747. $2=$recv(testObject)._at_("abc");
  55748. $ctx1.sendIdx["at:"]=1;
  55749. $1=$recv($2).__tild_eq("xyz");
  55750. self._assert_($1);
  55751. self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  55752. $ctx1.sendIdx["assert:equals:"]=1;
  55753. self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  55754. return self;
  55755. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  55756. },
  55757. args: [],
  55758. 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'",
  55759. referencedClasses: [],
  55760. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  55761. }),
  55762. $globals.JSObjectProxyTest);
  55763. $core.addMethod(
  55764. $core.method({
  55765. selector: "testComparison",
  55766. protocol: "tests",
  55767. fn: function (){
  55768. var self=this;
  55769. return $core.withContext(function($ctx1) {
  55770. var $1,$2;
  55771. self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  55772. $1=$recv(console).__eq(console);
  55773. $ctx1.sendIdx["="]=1;
  55774. self._assert_($1);
  55775. $2=$recv(console).__eq($recv($globals.Object)._new());
  55776. $ctx1.sendIdx["="]=2;
  55777. self._deny_($2);
  55778. $ctx1.sendIdx["deny:"]=1;
  55779. self._deny_($recv(console).__eq(self._jsObject()));
  55780. return self;
  55781. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  55782. },
  55783. args: [],
  55784. 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",
  55785. referencedClasses: ["Object"],
  55786. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  55787. }),
  55788. $globals.JSObjectProxyTest);
  55789. $core.addMethod(
  55790. $core.method({
  55791. selector: "testDNU",
  55792. protocol: "tests",
  55793. fn: function (){
  55794. var self=this;
  55795. return $core.withContext(function($ctx1) {
  55796. self._should_raise_((function(){
  55797. return $core.withContext(function($ctx2) {
  55798. return $recv(self._jsObject())._foo();
  55799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55800. }),$globals.MessageNotUnderstood);
  55801. return self;
  55802. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  55803. },
  55804. args: [],
  55805. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  55806. referencedClasses: ["MessageNotUnderstood"],
  55807. messageSends: ["should:raise:", "foo", "jsObject"]
  55808. }),
  55809. $globals.JSObjectProxyTest);
  55810. $core.addMethod(
  55811. $core.method({
  55812. selector: "testDNURegression1057",
  55813. protocol: "tests",
  55814. fn: function (){
  55815. var self=this;
  55816. var jsObject;
  55817. return $core.withContext(function($ctx1) {
  55818. var $1;
  55819. jsObject=[];
  55820. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  55821. $ctx1.sendIdx["basicAt:put:"]=1;
  55822. $recv(jsObject)._basicAt_put_("foo",(3));
  55823. self._shouldnt_raise_((function(){
  55824. return $core.withContext(function($ctx2) {
  55825. return $recv(jsObject)._foo();
  55826. $ctx2.sendIdx["foo"]=1;
  55827. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55828. }),$globals.Error);
  55829. $ctx1.sendIdx["shouldnt:raise:"]=1;
  55830. $1=$recv(jsObject)._foo();
  55831. $ctx1.sendIdx["foo"]=2;
  55832. self._assert_equals_($1,(3));
  55833. $ctx1.sendIdx["assert:equals:"]=1;
  55834. self._shouldnt_raise_((function(){
  55835. return $core.withContext(function($ctx2) {
  55836. return $recv(jsObject)._foo_((4));
  55837. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55838. }),$globals.Error);
  55839. self._assert_equals_($recv(jsObject)._foo(),(4));
  55840. return self;
  55841. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  55842. },
  55843. args: [],
  55844. source: "testDNURegression1057\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'foo' put: 3.\x0a\x09self shouldnt: [ jsObject foo ] raise: Error.\x0a\x09self assert: jsObject foo equals: 3.\x0a\x09self shouldnt: [ jsObject foo: 4 ] raise: Error.\x0a\x09self assert: jsObject foo equals: 4",
  55845. referencedClasses: ["Error"],
  55846. messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"]
  55847. }),
  55848. $globals.JSObjectProxyTest);
  55849. $core.addMethod(
  55850. $core.method({
  55851. selector: "testDNURegression1059",
  55852. protocol: "tests",
  55853. fn: function (){
  55854. var self=this;
  55855. var jsObject;
  55856. return $core.withContext(function($ctx1) {
  55857. jsObject=[];
  55858. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  55859. $ctx1.sendIdx["basicAt:put:"]=1;
  55860. $recv(jsObject)._basicAt_put_("x",(3));
  55861. $ctx1.sendIdx["basicAt:put:"]=2;
  55862. $recv(jsObject)._basicAt_put_("x:",(function(){
  55863. return $core.withContext(function($ctx2) {
  55864. return self._error();
  55865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55866. }));
  55867. self._shouldnt_raise_((function(){
  55868. return $core.withContext(function($ctx2) {
  55869. return $recv(jsObject)._x_((4));
  55870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55871. }),$globals.Error);
  55872. self._assert_equals_($recv(jsObject)._x(),(4));
  55873. return self;
  55874. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  55875. },
  55876. args: [],
  55877. source: "testDNURegression1059\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: 3.\x0a\x09jsObject basicAt: 'x:' put: [ self error ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: jsObject x equals: 4",
  55878. referencedClasses: ["Error"],
  55879. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"]
  55880. }),
  55881. $globals.JSObjectProxyTest);
  55882. $core.addMethod(
  55883. $core.method({
  55884. selector: "testDNURegression1062",
  55885. protocol: "tests",
  55886. fn: function (){
  55887. var self=this;
  55888. var jsObject,stored;
  55889. return $core.withContext(function($ctx1) {
  55890. jsObject=[];
  55891. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  55892. $ctx1.sendIdx["basicAt:put:"]=1;
  55893. $recv(jsObject)._basicAt_put_("x",(function(v){
  55894. stored=v;
  55895. return stored;
  55896. }));
  55897. self._shouldnt_raise_((function(){
  55898. return $core.withContext(function($ctx2) {
  55899. return $recv(jsObject)._x_((4));
  55900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55901. }),$globals.Error);
  55902. self._assert_equals_(stored,(4));
  55903. return self;
  55904. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},$globals.JSObjectProxyTest)});
  55905. },
  55906. args: [],
  55907. source: "testDNURegression1062\x0a\x09| jsObject stored |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: [ :v | stored := v ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: stored equals: 4",
  55908. referencedClasses: ["Error"],
  55909. messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"]
  55910. }),
  55911. $globals.JSObjectProxyTest);
  55912. $core.addMethod(
  55913. $core.method({
  55914. selector: "testDNUWithAllowJavaScriptCalls",
  55915. protocol: "tests",
  55916. fn: function (){
  55917. var self=this;
  55918. var jsObject;
  55919. return $core.withContext(function($ctx1) {
  55920. jsObject=[];
  55921. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  55922. self._should_raise_((function(){
  55923. return $core.withContext(function($ctx2) {
  55924. return $recv(jsObject)._foo();
  55925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55926. }),$globals.MessageNotUnderstood);
  55927. return self;
  55928. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  55929. },
  55930. args: [],
  55931. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  55932. referencedClasses: ["MessageNotUnderstood"],
  55933. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  55934. }),
  55935. $globals.JSObjectProxyTest);
  55936. $core.addMethod(
  55937. $core.method({
  55938. selector: "testMessageSend",
  55939. protocol: "tests",
  55940. fn: function (){
  55941. var self=this;
  55942. return $core.withContext(function($ctx1) {
  55943. var $2,$1,$4,$3;
  55944. $2=self._jsObject();
  55945. $ctx1.sendIdx["jsObject"]=1;
  55946. $1=$recv($2)._a();
  55947. self._assert_equals_($1,(1));
  55948. $ctx1.sendIdx["assert:equals:"]=1;
  55949. $4=self._jsObject();
  55950. $ctx1.sendIdx["jsObject"]=2;
  55951. $3=$recv($4)._b();
  55952. self._assert_equals_($3,(2));
  55953. $ctx1.sendIdx["assert:equals:"]=2;
  55954. self._assert_equals_($recv(self._jsObject())._c_((3)),(3));
  55955. return self;
  55956. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  55957. },
  55958. args: [],
  55959. 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",
  55960. referencedClasses: [],
  55961. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  55962. }),
  55963. $globals.JSObjectProxyTest);
  55964. $core.addMethod(
  55965. $core.method({
  55966. selector: "testMethodWithArguments",
  55967. protocol: "tests",
  55968. fn: function (){
  55969. var self=this;
  55970. return $core.withContext(function($ctx1) {
  55971. self._assert_equals_($recv(self._jsObject())._c_((1)),(1));
  55972. return self;
  55973. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  55974. },
  55975. args: [],
  55976. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  55977. referencedClasses: [],
  55978. messageSends: ["assert:equals:", "c:", "jsObject"]
  55979. }),
  55980. $globals.JSObjectProxyTest);
  55981. $core.addMethod(
  55982. $core.method({
  55983. selector: "testPrinting",
  55984. protocol: "tests",
  55985. fn: function (){
  55986. var self=this;
  55987. return $core.withContext(function($ctx1) {
  55988. self._assert_equals_($recv(self._jsObject())._printString(),"[object Object]");
  55989. return self;
  55990. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  55991. },
  55992. args: [],
  55993. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  55994. referencedClasses: [],
  55995. messageSends: ["assert:equals:", "printString", "jsObject"]
  55996. }),
  55997. $globals.JSObjectProxyTest);
  55998. $core.addMethod(
  55999. $core.method({
  56000. selector: "testPropertyThatReturnsEmptyString",
  56001. protocol: "tests",
  56002. fn: function (){
  56003. var self=this;
  56004. var object;
  56005. return $core.withContext(function($ctx1) {
  56006. var $1;
  56007. object=self._jsObject();
  56008. $1=$recv(object)._d();
  56009. $ctx1.sendIdx["d"]=1;
  56010. self._assert_equals_($1,"");
  56011. $ctx1.sendIdx["assert:equals:"]=1;
  56012. $recv(object)._d_("hello");
  56013. self._assert_equals_($recv(object)._d(),"hello");
  56014. return self;
  56015. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  56016. },
  56017. args: [],
  56018. 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'",
  56019. referencedClasses: [],
  56020. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  56021. }),
  56022. $globals.JSObjectProxyTest);
  56023. $core.addMethod(
  56024. $core.method({
  56025. selector: "testPropertyThatReturnsUndefined",
  56026. protocol: "tests",
  56027. fn: function (){
  56028. var self=this;
  56029. var object;
  56030. return $core.withContext(function($ctx1) {
  56031. object=self._jsObject();
  56032. self._shouldnt_raise_((function(){
  56033. return $core.withContext(function($ctx2) {
  56034. return $recv(object)._e();
  56035. $ctx2.sendIdx["e"]=1;
  56036. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56037. }),$globals.MessageNotUnderstood);
  56038. self._assert_($recv($recv(object)._e())._isNil());
  56039. return self;
  56040. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  56041. },
  56042. args: [],
  56043. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  56044. referencedClasses: ["MessageNotUnderstood"],
  56045. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  56046. }),
  56047. $globals.JSObjectProxyTest);
  56048. $core.addMethod(
  56049. $core.method({
  56050. selector: "testSetPropertyWithFalsyValue",
  56051. protocol: "tests",
  56052. fn: function (){
  56053. var self=this;
  56054. var jsObject;
  56055. return $core.withContext(function($ctx1) {
  56056. var $1,$2,$3,$4,$5;
  56057. jsObject=self._jsObject();
  56058. $1=$recv(jsObject)._a();
  56059. $ctx1.sendIdx["a"]=1;
  56060. self._assert_equals_($1,(1));
  56061. $ctx1.sendIdx["assert:equals:"]=1;
  56062. $recv(jsObject)._a_(self._jsNull());
  56063. $ctx1.sendIdx["a:"]=1;
  56064. $2=$recv(jsObject)._a();
  56065. $ctx1.sendIdx["a"]=2;
  56066. self._assert_equals_($2,nil);
  56067. $ctx1.sendIdx["assert:equals:"]=2;
  56068. $recv(jsObject)._a_((0));
  56069. $ctx1.sendIdx["a:"]=2;
  56070. $3=$recv(jsObject)._a();
  56071. $ctx1.sendIdx["a"]=3;
  56072. self._assert_equals_($3,(0));
  56073. $ctx1.sendIdx["assert:equals:"]=3;
  56074. $recv(jsObject)._a_(self._jsUndefined());
  56075. $ctx1.sendIdx["a:"]=3;
  56076. $4=$recv(jsObject)._a();
  56077. $ctx1.sendIdx["a"]=4;
  56078. self._assert_equals_($4,nil);
  56079. $ctx1.sendIdx["assert:equals:"]=4;
  56080. $recv(jsObject)._a_("");
  56081. $ctx1.sendIdx["a:"]=4;
  56082. $5=$recv(jsObject)._a();
  56083. $ctx1.sendIdx["a"]=5;
  56084. self._assert_equals_($5,"");
  56085. $ctx1.sendIdx["assert:equals:"]=5;
  56086. $recv(jsObject)._a_(false);
  56087. self._assert_equals_($recv(jsObject)._a(),false);
  56088. return self;
  56089. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  56090. },
  56091. args: [],
  56092. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: self jsNull.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  56093. referencedClasses: [],
  56094. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  56095. }),
  56096. $globals.JSObjectProxyTest);
  56097. $core.addMethod(
  56098. $core.method({
  56099. selector: "testValue",
  56100. protocol: "tests",
  56101. fn: function (){
  56102. var self=this;
  56103. var testObject;
  56104. return $core.withContext(function($ctx1) {
  56105. testObject=self._jsObject();
  56106. $recv(testObject)._at_put_("value","aValue");
  56107. self._assert_equals_($recv(testObject)._value(),"aValue");
  56108. return self;
  56109. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  56110. },
  56111. args: [],
  56112. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  56113. referencedClasses: [],
  56114. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  56115. }),
  56116. $globals.JSObjectProxyTest);
  56117. $core.addMethod(
  56118. $core.method({
  56119. selector: "testYourself",
  56120. protocol: "tests",
  56121. fn: function (){
  56122. var self=this;
  56123. var object;
  56124. return $core.withContext(function($ctx1) {
  56125. var $1;
  56126. $1=self._jsObject();
  56127. $recv($1)._d_("test");
  56128. object=$recv($1)._yourself();
  56129. self._assert_equals_($recv(object)._d(),"test");
  56130. return self;
  56131. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  56132. },
  56133. args: [],
  56134. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  56135. referencedClasses: [],
  56136. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  56137. }),
  56138. $globals.JSObjectProxyTest);
  56139. $core.addClass("JavaScriptExceptionTest", $globals.TestCase, [], "Kernel-Tests");
  56140. $core.addMethod(
  56141. $core.method({
  56142. selector: "testCatchingException",
  56143. protocol: "tests",
  56144. fn: function (){
  56145. var self=this;
  56146. return $core.withContext(function($ctx1) {
  56147. $recv((function(){
  56148. return $core.withContext(function($ctx2) {
  56149. return self._throwException();
  56150. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56151. }))._on_do_($globals.Error,(function(error){
  56152. return $core.withContext(function($ctx2) {
  56153. return self._assert_($recv($recv(error)._exception()).__eq("test"));
  56154. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  56155. }));
  56156. return self;
  56157. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  56158. },
  56159. args: [],
  56160. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  56161. referencedClasses: ["Error"],
  56162. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  56163. }),
  56164. $globals.JavaScriptExceptionTest);
  56165. $core.addMethod(
  56166. $core.method({
  56167. selector: "testRaisingException",
  56168. protocol: "tests",
  56169. fn: function (){
  56170. var self=this;
  56171. return $core.withContext(function($ctx1) {
  56172. self._should_raise_((function(){
  56173. return $core.withContext(function($ctx2) {
  56174. return self._throwException();
  56175. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56176. }),$globals.JavaScriptException);
  56177. return self;
  56178. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  56179. },
  56180. args: [],
  56181. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  56182. referencedClasses: ["JavaScriptException"],
  56183. messageSends: ["should:raise:", "throwException"]
  56184. }),
  56185. $globals.JavaScriptExceptionTest);
  56186. $core.addMethod(
  56187. $core.method({
  56188. selector: "throwException",
  56189. protocol: "helpers",
  56190. fn: function (){
  56191. var self=this;
  56192. return $core.withContext(function($ctx1) {
  56193. throw "test";
  56194. return self;
  56195. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  56196. },
  56197. args: [],
  56198. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  56199. referencedClasses: [],
  56200. messageSends: []
  56201. }),
  56202. $globals.JavaScriptExceptionTest);
  56203. $core.addClass("MessageSendTest", $globals.TestCase, [], "Kernel-Tests");
  56204. $core.addMethod(
  56205. $core.method({
  56206. selector: "testValue",
  56207. protocol: "tests",
  56208. fn: function (){
  56209. var self=this;
  56210. var messageSend;
  56211. return $core.withContext(function($ctx1) {
  56212. var $1;
  56213. $1=$recv($globals.MessageSend)._new();
  56214. $ctx1.sendIdx["new"]=1;
  56215. $recv($1)._receiver_($recv($globals.Object)._new());
  56216. $recv($1)._selector_("asString");
  56217. messageSend=$recv($1)._yourself();
  56218. self._assert_equals_($recv(messageSend)._value(),"an Object");
  56219. return self;
  56220. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  56221. },
  56222. args: [],
  56223. 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'",
  56224. referencedClasses: ["MessageSend", "Object"],
  56225. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  56226. }),
  56227. $globals.MessageSendTest);
  56228. $core.addMethod(
  56229. $core.method({
  56230. selector: "testValueWithArguments",
  56231. protocol: "tests",
  56232. fn: function (){
  56233. var self=this;
  56234. var messageSend;
  56235. return $core.withContext(function($ctx1) {
  56236. var $1;
  56237. $1=$recv($globals.MessageSend)._new();
  56238. $recv($1)._receiver_((2));
  56239. $recv($1)._selector_("+");
  56240. messageSend=$recv($1)._yourself();
  56241. self._assert_equals_($recv(messageSend)._value_((3)),(5));
  56242. $ctx1.sendIdx["assert:equals:"]=1;
  56243. self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  56244. return self;
  56245. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  56246. },
  56247. args: [],
  56248. 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",
  56249. referencedClasses: ["MessageSend"],
  56250. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  56251. }),
  56252. $globals.MessageSendTest);
  56253. $core.addClass("MethodInheritanceTest", $globals.TestCase, ["receiverTop", "receiverMiddle", "receiverBottom", "method", "performBlock"], "Kernel-Tests");
  56254. $core.addMethod(
  56255. $core.method({
  56256. selector: "codeGeneratorClass",
  56257. protocol: "accessing",
  56258. fn: function (){
  56259. var self=this;
  56260. return $globals.CodeGenerator;
  56261. },
  56262. args: [],
  56263. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  56264. referencedClasses: ["CodeGenerator"],
  56265. messageSends: []
  56266. }),
  56267. $globals.MethodInheritanceTest);
  56268. $core.addMethod(
  56269. $core.method({
  56270. selector: "compiler",
  56271. protocol: "factory",
  56272. fn: function (){
  56273. var self=this;
  56274. return $core.withContext(function($ctx1) {
  56275. var $1;
  56276. $1=$recv($globals.Compiler)._new();
  56277. $recv($1)._codeGeneratorClass_(self._codeGeneratorClass());
  56278. return $recv($1)._yourself();
  56279. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  56280. },
  56281. args: [],
  56282. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  56283. referencedClasses: ["Compiler"],
  56284. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  56285. }),
  56286. $globals.MethodInheritanceTest);
  56287. $core.addMethod(
  56288. $core.method({
  56289. selector: "deinstallBottom",
  56290. protocol: "testing",
  56291. fn: function (){
  56292. var self=this;
  56293. return $core.withContext(function($ctx1) {
  56294. $recv(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  56295. return self;
  56296. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  56297. },
  56298. args: [],
  56299. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  56300. referencedClasses: [],
  56301. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  56302. }),
  56303. $globals.MethodInheritanceTest);
  56304. $core.addMethod(
  56305. $core.method({
  56306. selector: "deinstallMiddle",
  56307. protocol: "testing",
  56308. fn: function (){
  56309. var self=this;
  56310. return $core.withContext(function($ctx1) {
  56311. $recv(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  56312. return self;
  56313. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  56314. },
  56315. args: [],
  56316. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  56317. referencedClasses: [],
  56318. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  56319. }),
  56320. $globals.MethodInheritanceTest);
  56321. $core.addMethod(
  56322. $core.method({
  56323. selector: "deinstallTop",
  56324. protocol: "testing",
  56325. fn: function (){
  56326. var self=this;
  56327. return $core.withContext(function($ctx1) {
  56328. $recv(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  56329. return self;
  56330. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  56331. },
  56332. args: [],
  56333. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  56334. referencedClasses: [],
  56335. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  56336. }),
  56337. $globals.MethodInheritanceTest);
  56338. $core.addMethod(
  56339. $core.method({
  56340. selector: "installBottom:",
  56341. protocol: "testing",
  56342. fn: function (aString){
  56343. var self=this;
  56344. return $core.withContext(function($ctx1) {
  56345. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  56346. return self;
  56347. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  56348. },
  56349. args: ["aString"],
  56350. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  56351. referencedClasses: [],
  56352. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  56353. }),
  56354. $globals.MethodInheritanceTest);
  56355. $core.addMethod(
  56356. $core.method({
  56357. selector: "installMiddle:",
  56358. protocol: "testing",
  56359. fn: function (aString){
  56360. var self=this;
  56361. return $core.withContext(function($ctx1) {
  56362. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  56363. return self;
  56364. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  56365. },
  56366. args: ["aString"],
  56367. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  56368. referencedClasses: [],
  56369. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  56370. }),
  56371. $globals.MethodInheritanceTest);
  56372. $core.addMethod(
  56373. $core.method({
  56374. selector: "installTop:",
  56375. protocol: "testing",
  56376. fn: function (aString){
  56377. var self=this;
  56378. return $core.withContext(function($ctx1) {
  56379. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  56380. return self;
  56381. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  56382. },
  56383. args: ["aString"],
  56384. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  56385. referencedClasses: [],
  56386. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  56387. }),
  56388. $globals.MethodInheritanceTest);
  56389. $core.addMethod(
  56390. $core.method({
  56391. selector: "setUp",
  56392. protocol: "initialization",
  56393. fn: function (){
  56394. var self=this;
  56395. return $core.withContext(function($ctx1) {
  56396. self["@receiverTop"]=$recv(self._targetClassTop())._new();
  56397. $ctx1.sendIdx["new"]=1;
  56398. self["@receiverMiddle"]=$recv(self._targetClassMiddle())._new();
  56399. $ctx1.sendIdx["new"]=2;
  56400. self["@receiverBottom"]=$recv(self._targetClassBottom())._new();
  56401. self["@method"]=nil;
  56402. self["@performBlock"]=(function(){
  56403. return $core.withContext(function($ctx2) {
  56404. return self._error_("performBlock not initialized");
  56405. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56406. });
  56407. return self;
  56408. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  56409. },
  56410. args: [],
  56411. 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' ]",
  56412. referencedClasses: [],
  56413. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  56414. }),
  56415. $globals.MethodInheritanceTest);
  56416. $core.addMethod(
  56417. $core.method({
  56418. selector: "shouldMNU",
  56419. protocol: "testing",
  56420. fn: function (){
  56421. var self=this;
  56422. return $core.withContext(function($ctx1) {
  56423. self._shouldMNUTop();
  56424. self._shouldMNUMiddle();
  56425. self._shouldMNUBottom();
  56426. return self;
  56427. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  56428. },
  56429. args: [],
  56430. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  56431. referencedClasses: [],
  56432. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  56433. }),
  56434. $globals.MethodInheritanceTest);
  56435. $core.addMethod(
  56436. $core.method({
  56437. selector: "shouldMNUBottom",
  56438. protocol: "testing",
  56439. fn: function (){
  56440. var self=this;
  56441. return $core.withContext(function($ctx1) {
  56442. self._should_raise_((function(){
  56443. return $core.withContext(function($ctx2) {
  56444. return $recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  56445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56446. }),$globals.MessageNotUnderstood);
  56447. return self;
  56448. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  56449. },
  56450. args: [],
  56451. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  56452. referencedClasses: ["MessageNotUnderstood"],
  56453. messageSends: ["should:raise:", "value:"]
  56454. }),
  56455. $globals.MethodInheritanceTest);
  56456. $core.addMethod(
  56457. $core.method({
  56458. selector: "shouldMNUMiddle",
  56459. protocol: "testing",
  56460. fn: function (){
  56461. var self=this;
  56462. return $core.withContext(function($ctx1) {
  56463. self._should_raise_((function(){
  56464. return $core.withContext(function($ctx2) {
  56465. return $recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  56466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56467. }),$globals.MessageNotUnderstood);
  56468. return self;
  56469. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  56470. },
  56471. args: [],
  56472. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  56473. referencedClasses: ["MessageNotUnderstood"],
  56474. messageSends: ["should:raise:", "value:"]
  56475. }),
  56476. $globals.MethodInheritanceTest);
  56477. $core.addMethod(
  56478. $core.method({
  56479. selector: "shouldMNUTop",
  56480. protocol: "testing",
  56481. fn: function (){
  56482. var self=this;
  56483. return $core.withContext(function($ctx1) {
  56484. self._should_raise_((function(){
  56485. return $core.withContext(function($ctx2) {
  56486. return $recv(self["@performBlock"])._value_(self["@receiverTop"]);
  56487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56488. }),$globals.MessageNotUnderstood);
  56489. return self;
  56490. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  56491. },
  56492. args: [],
  56493. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  56494. referencedClasses: ["MessageNotUnderstood"],
  56495. messageSends: ["should:raise:", "value:"]
  56496. }),
  56497. $globals.MethodInheritanceTest);
  56498. $core.addMethod(
  56499. $core.method({
  56500. selector: "shouldReturn:",
  56501. protocol: "testing",
  56502. fn: function (anObject){
  56503. var self=this;
  56504. var result;
  56505. return $core.withContext(function($ctx1) {
  56506. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  56507. $ctx1.sendIdx["value:"]=1;
  56508. self._assert_equals_(["top",anObject],["top",result]);
  56509. $ctx1.sendIdx["assert:equals:"]=1;
  56510. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  56511. $ctx1.sendIdx["value:"]=2;
  56512. self._assert_equals_(["middle",anObject],["middle",result]);
  56513. $ctx1.sendIdx["assert:equals:"]=2;
  56514. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  56515. self._assert_equals_(["bottom",anObject],["bottom",result]);
  56516. return self;
  56517. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  56518. },
  56519. args: ["anObject"],
  56520. 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 }",
  56521. referencedClasses: [],
  56522. messageSends: ["value:", "assert:equals:"]
  56523. }),
  56524. $globals.MethodInheritanceTest);
  56525. $core.addMethod(
  56526. $core.method({
  56527. selector: "shouldReturn:and:and:",
  56528. protocol: "testing",
  56529. fn: function (anObject,anObject2,anObject3){
  56530. var self=this;
  56531. var result;
  56532. return $core.withContext(function($ctx1) {
  56533. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  56534. $ctx1.sendIdx["value:"]=1;
  56535. self._assert_equals_(["top",anObject],["top",result]);
  56536. $ctx1.sendIdx["assert:equals:"]=1;
  56537. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  56538. $ctx1.sendIdx["value:"]=2;
  56539. self._assert_equals_(["middle",anObject2],["middle",result]);
  56540. $ctx1.sendIdx["assert:equals:"]=2;
  56541. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  56542. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  56543. return self;
  56544. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  56545. },
  56546. args: ["anObject", "anObject2", "anObject3"],
  56547. 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 }",
  56548. referencedClasses: [],
  56549. messageSends: ["value:", "assert:equals:"]
  56550. }),
  56551. $globals.MethodInheritanceTest);
  56552. $core.addMethod(
  56553. $core.method({
  56554. selector: "targetClassBottom",
  56555. protocol: "accessing",
  56556. fn: function (){
  56557. var self=this;
  56558. return $globals.JavaScriptException;
  56559. },
  56560. args: [],
  56561. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  56562. referencedClasses: ["JavaScriptException"],
  56563. messageSends: []
  56564. }),
  56565. $globals.MethodInheritanceTest);
  56566. $core.addMethod(
  56567. $core.method({
  56568. selector: "targetClassMiddle",
  56569. protocol: "accessing",
  56570. fn: function (){
  56571. var self=this;
  56572. return $globals.Error;
  56573. },
  56574. args: [],
  56575. source: "targetClassMiddle\x0a\x09^ Error",
  56576. referencedClasses: ["Error"],
  56577. messageSends: []
  56578. }),
  56579. $globals.MethodInheritanceTest);
  56580. $core.addMethod(
  56581. $core.method({
  56582. selector: "targetClassTop",
  56583. protocol: "accessing",
  56584. fn: function (){
  56585. var self=this;
  56586. return $globals.Object;
  56587. },
  56588. args: [],
  56589. source: "targetClassTop\x0a\x09^ Object",
  56590. referencedClasses: ["Object"],
  56591. messageSends: []
  56592. }),
  56593. $globals.MethodInheritanceTest);
  56594. $core.addMethod(
  56595. $core.method({
  56596. selector: "tearDown",
  56597. protocol: "initialization",
  56598. fn: function (){
  56599. var self=this;
  56600. return $core.withContext(function($ctx1) {
  56601. $recv((function(){
  56602. return $core.withContext(function($ctx2) {
  56603. return self._deinstallTop();
  56604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56605. }))._on_do_($globals.Error,(function(){
  56606. }));
  56607. $ctx1.sendIdx["on:do:"]=1;
  56608. $recv((function(){
  56609. return $core.withContext(function($ctx2) {
  56610. return self._deinstallMiddle();
  56611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  56612. }))._on_do_($globals.Error,(function(){
  56613. }));
  56614. $ctx1.sendIdx["on:do:"]=2;
  56615. $recv((function(){
  56616. return $core.withContext(function($ctx2) {
  56617. return self._deinstallBottom();
  56618. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  56619. }))._on_do_($globals.Error,(function(){
  56620. }));
  56621. return self;
  56622. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  56623. },
  56624. args: [],
  56625. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  56626. referencedClasses: ["Error"],
  56627. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  56628. }),
  56629. $globals.MethodInheritanceTest);
  56630. $core.addMethod(
  56631. $core.method({
  56632. selector: "testMNU11",
  56633. protocol: "tests",
  56634. fn: function (){
  56635. var self=this;
  56636. return $core.withContext(function($ctx1) {
  56637. self["@performBlock"]=(function(x){
  56638. return $core.withContext(function($ctx2) {
  56639. return $recv(x)._foo();
  56640. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56641. });
  56642. self._shouldMNU();
  56643. $ctx1.sendIdx["shouldMNU"]=1;
  56644. self._installTop_("foo ^ false");
  56645. $ctx1.sendIdx["installTop:"]=1;
  56646. self._installTop_("foo ^ true");
  56647. self._deinstallTop();
  56648. self._shouldMNU();
  56649. return self;
  56650. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  56651. },
  56652. args: [],
  56653. 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",
  56654. referencedClasses: [],
  56655. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  56656. }),
  56657. $globals.MethodInheritanceTest);
  56658. $core.addMethod(
  56659. $core.method({
  56660. selector: "testMNU22",
  56661. protocol: "tests",
  56662. fn: function (){
  56663. var self=this;
  56664. return $core.withContext(function($ctx1) {
  56665. self["@performBlock"]=(function(x){
  56666. return $core.withContext(function($ctx2) {
  56667. return $recv(x)._foo();
  56668. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56669. });
  56670. self._shouldMNU();
  56671. $ctx1.sendIdx["shouldMNU"]=1;
  56672. self._installMiddle_("foo ^ false");
  56673. $ctx1.sendIdx["installMiddle:"]=1;
  56674. self._installMiddle_("foo ^ true");
  56675. self._deinstallMiddle();
  56676. self._shouldMNU();
  56677. return self;
  56678. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  56679. },
  56680. args: [],
  56681. 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",
  56682. referencedClasses: [],
  56683. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  56684. }),
  56685. $globals.MethodInheritanceTest);
  56686. $core.addMethod(
  56687. $core.method({
  56688. selector: "testReturns1",
  56689. protocol: "tests",
  56690. fn: function (){
  56691. var self=this;
  56692. return $core.withContext(function($ctx1) {
  56693. self["@performBlock"]=(function(x){
  56694. return $core.withContext(function($ctx2) {
  56695. return $recv(x)._foo();
  56696. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56697. });
  56698. self._installTop_("foo ^ false");
  56699. $ctx1.sendIdx["installTop:"]=1;
  56700. self._shouldReturn_(false);
  56701. $ctx1.sendIdx["shouldReturn:"]=1;
  56702. self._installTop_("foo ^ true");
  56703. self._shouldReturn_(true);
  56704. return self;
  56705. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  56706. },
  56707. args: [],
  56708. 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",
  56709. referencedClasses: [],
  56710. messageSends: ["foo", "installTop:", "shouldReturn:"]
  56711. }),
  56712. $globals.MethodInheritanceTest);
  56713. $core.addClass("NumberTest", $globals.TestCase, [], "Kernel-Tests");
  56714. $core.addMethod(
  56715. $core.method({
  56716. selector: "testAbs",
  56717. protocol: "tests",
  56718. fn: function (){
  56719. var self=this;
  56720. return $core.withContext(function($ctx1) {
  56721. var $1;
  56722. $1=(4)._abs();
  56723. $ctx1.sendIdx["abs"]=1;
  56724. self._assert_equals_($1,(4));
  56725. $ctx1.sendIdx["assert:equals:"]=1;
  56726. self._assert_equals_((-4)._abs(),(4));
  56727. return self;
  56728. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  56729. },
  56730. args: [],
  56731. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  56732. referencedClasses: [],
  56733. messageSends: ["assert:equals:", "abs"]
  56734. }),
  56735. $globals.NumberTest);
  56736. $core.addMethod(
  56737. $core.method({
  56738. selector: "testArithmetic",
  56739. protocol: "tests",
  56740. fn: function (){
  56741. var self=this;
  56742. return $core.withContext(function($ctx1) {
  56743. var $1,$2,$3,$5,$4;
  56744. $1=(1.5).__plus((1));
  56745. $ctx1.sendIdx["+"]=1;
  56746. self._assert_equals_($1,(2.5));
  56747. $ctx1.sendIdx["assert:equals:"]=1;
  56748. $2=(2).__minus((1));
  56749. $ctx1.sendIdx["-"]=1;
  56750. self._assert_equals_($2,(1));
  56751. $ctx1.sendIdx["assert:equals:"]=2;
  56752. self._assert_equals_((-2).__minus((1)),(-3));
  56753. $ctx1.sendIdx["assert:equals:"]=3;
  56754. self._assert_equals_((12).__slash((2)),(6));
  56755. $ctx1.sendIdx["assert:equals:"]=4;
  56756. $3=(3).__star((4));
  56757. $ctx1.sendIdx["*"]=1;
  56758. self._assert_equals_($3,(12));
  56759. $ctx1.sendIdx["assert:equals:"]=5;
  56760. self._assert_equals_((7).__slash_slash((2)),(3));
  56761. $ctx1.sendIdx["assert:equals:"]=6;
  56762. self._assert_equals_((7).__backslash_backslash((2)),(1));
  56763. $ctx1.sendIdx["assert:equals:"]=7;
  56764. $5=(1).__plus((2));
  56765. $ctx1.sendIdx["+"]=2;
  56766. $4=$recv($5).__star((3));
  56767. $ctx1.sendIdx["*"]=2;
  56768. self._assert_equals_($4,(9));
  56769. $ctx1.sendIdx["assert:equals:"]=8;
  56770. self._assert_equals_((1).__plus((2).__star((3))),(7));
  56771. return self;
  56772. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  56773. },
  56774. args: [],
  56775. 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",
  56776. referencedClasses: [],
  56777. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  56778. }),
  56779. $globals.NumberTest);
  56780. $core.addMethod(
  56781. $core.method({
  56782. selector: "testAsNumber",
  56783. protocol: "tests",
  56784. fn: function (){
  56785. var self=this;
  56786. return $core.withContext(function($ctx1) {
  56787. self._assert_equals_((3)._asNumber(),(3));
  56788. return self;
  56789. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  56790. },
  56791. args: [],
  56792. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  56793. referencedClasses: [],
  56794. messageSends: ["assert:equals:", "asNumber"]
  56795. }),
  56796. $globals.NumberTest);
  56797. $core.addMethod(
  56798. $core.method({
  56799. selector: "testCeiling",
  56800. protocol: "tests",
  56801. fn: function (){
  56802. var self=this;
  56803. return $core.withContext(function($ctx1) {
  56804. var $1,$2;
  56805. $1=(1.2)._ceiling();
  56806. $ctx1.sendIdx["ceiling"]=1;
  56807. self._assert_equals_($1,(2));
  56808. $ctx1.sendIdx["assert:equals:"]=1;
  56809. $2=(-1.2)._ceiling();
  56810. $ctx1.sendIdx["ceiling"]=2;
  56811. self._assert_equals_($2,(-1));
  56812. $ctx1.sendIdx["assert:equals:"]=2;
  56813. self._assert_equals_((1)._ceiling(),(1));
  56814. return self;
  56815. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  56816. },
  56817. args: [],
  56818. 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.",
  56819. referencedClasses: [],
  56820. messageSends: ["assert:equals:", "ceiling"]
  56821. }),
  56822. $globals.NumberTest);
  56823. $core.addMethod(
  56824. $core.method({
  56825. selector: "testComparison",
  56826. protocol: "tests",
  56827. fn: function (){
  56828. var self=this;
  56829. return $core.withContext(function($ctx1) {
  56830. var $1,$2,$3,$4;
  56831. $1=(3).__gt((2));
  56832. $ctx1.sendIdx[">"]=1;
  56833. self._assert_($1);
  56834. $ctx1.sendIdx["assert:"]=1;
  56835. $2=(2).__lt((3));
  56836. $ctx1.sendIdx["<"]=1;
  56837. self._assert_($2);
  56838. $ctx1.sendIdx["assert:"]=2;
  56839. self._deny_((3).__lt((2)));
  56840. $ctx1.sendIdx["deny:"]=1;
  56841. self._deny_((2).__gt((3)));
  56842. $3=(3).__gt_eq((3));
  56843. $ctx1.sendIdx[">="]=1;
  56844. self._assert_($3);
  56845. $ctx1.sendIdx["assert:"]=3;
  56846. self._assert_((3.1).__gt_eq((3)));
  56847. $ctx1.sendIdx["assert:"]=4;
  56848. $4=(3).__lt_eq((3));
  56849. $ctx1.sendIdx["<="]=1;
  56850. self._assert_($4);
  56851. $ctx1.sendIdx["assert:"]=5;
  56852. self._assert_((3).__lt_eq((3.1)));
  56853. return self;
  56854. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  56855. },
  56856. args: [],
  56857. 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",
  56858. referencedClasses: [],
  56859. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  56860. }),
  56861. $globals.NumberTest);
  56862. $core.addMethod(
  56863. $core.method({
  56864. selector: "testCopying",
  56865. protocol: "tests",
  56866. fn: function (){
  56867. var self=this;
  56868. return $core.withContext(function($ctx1) {
  56869. var $1;
  56870. $1=$recv((1)._copy()).__eq_eq((1));
  56871. $ctx1.sendIdx["=="]=1;
  56872. self._assert_($1);
  56873. $ctx1.sendIdx["assert:"]=1;
  56874. self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  56875. return self;
  56876. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  56877. },
  56878. args: [],
  56879. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  56880. referencedClasses: [],
  56881. messageSends: ["assert:", "==", "copy", "deepCopy"]
  56882. }),
  56883. $globals.NumberTest);
  56884. $core.addMethod(
  56885. $core.method({
  56886. selector: "testEquality",
  56887. protocol: "tests",
  56888. fn: function (){
  56889. var self=this;
  56890. return $core.withContext(function($ctx1) {
  56891. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  56892. $1=(1).__eq((1));
  56893. $ctx1.sendIdx["="]=1;
  56894. self._assert_($1);
  56895. $ctx1.sendIdx["assert:"]=1;
  56896. $2=(0).__eq((0));
  56897. $ctx1.sendIdx["="]=2;
  56898. self._assert_($2);
  56899. $ctx1.sendIdx["assert:"]=2;
  56900. $3=(1).__eq((0));
  56901. $ctx1.sendIdx["="]=3;
  56902. self._deny_($3);
  56903. $ctx1.sendIdx["deny:"]=1;
  56904. $5=(1)._yourself();
  56905. $ctx1.sendIdx["yourself"]=1;
  56906. $4=$recv($5).__eq((1));
  56907. $ctx1.sendIdx["="]=4;
  56908. self._assert_($4);
  56909. $ctx1.sendIdx["assert:"]=3;
  56910. $7=(1)._yourself();
  56911. $ctx1.sendIdx["yourself"]=2;
  56912. $6=(1).__eq($7);
  56913. $ctx1.sendIdx["="]=5;
  56914. self._assert_($6);
  56915. $ctx1.sendIdx["assert:"]=4;
  56916. $9=(1)._yourself();
  56917. $ctx1.sendIdx["yourself"]=3;
  56918. $8=$recv($9).__eq((1)._yourself());
  56919. $ctx1.sendIdx["="]=6;
  56920. self._assert_($8);
  56921. $10=(0).__eq(false);
  56922. $ctx1.sendIdx["="]=7;
  56923. self._deny_($10);
  56924. $ctx1.sendIdx["deny:"]=2;
  56925. $11=false.__eq((0));
  56926. $ctx1.sendIdx["="]=8;
  56927. self._deny_($11);
  56928. $ctx1.sendIdx["deny:"]=3;
  56929. $12="".__eq((0));
  56930. $ctx1.sendIdx["="]=9;
  56931. self._deny_($12);
  56932. $ctx1.sendIdx["deny:"]=4;
  56933. self._deny_((0).__eq(""));
  56934. return self;
  56935. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  56936. },
  56937. args: [],
  56938. 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 = ''",
  56939. referencedClasses: [],
  56940. messageSends: ["assert:", "=", "deny:", "yourself"]
  56941. }),
  56942. $globals.NumberTest);
  56943. $core.addMethod(
  56944. $core.method({
  56945. selector: "testFloor",
  56946. protocol: "tests",
  56947. fn: function (){
  56948. var self=this;
  56949. return $core.withContext(function($ctx1) {
  56950. var $1,$2;
  56951. $1=(1.2)._floor();
  56952. $ctx1.sendIdx["floor"]=1;
  56953. self._assert_equals_($1,(1));
  56954. $ctx1.sendIdx["assert:equals:"]=1;
  56955. $2=(-1.2)._floor();
  56956. $ctx1.sendIdx["floor"]=2;
  56957. self._assert_equals_($2,(-2));
  56958. $ctx1.sendIdx["assert:equals:"]=2;
  56959. self._assert_equals_((1)._floor(),(1));
  56960. return self;
  56961. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  56962. },
  56963. args: [],
  56964. 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.",
  56965. referencedClasses: [],
  56966. messageSends: ["assert:equals:", "floor"]
  56967. }),
  56968. $globals.NumberTest);
  56969. $core.addMethod(
  56970. $core.method({
  56971. selector: "testHexNumbers",
  56972. protocol: "tests",
  56973. fn: function (){
  56974. var self=this;
  56975. return $core.withContext(function($ctx1) {
  56976. var $1,$2,$3,$4,$5;
  56977. self._assert_equals_((9),(9));
  56978. $ctx1.sendIdx["assert:equals:"]=1;
  56979. $1=(10)._truncated();
  56980. $ctx1.sendIdx["truncated"]=1;
  56981. self._assert_equals_($1,(10));
  56982. $ctx1.sendIdx["assert:equals:"]=2;
  56983. $2=(11)._truncated();
  56984. $ctx1.sendIdx["truncated"]=2;
  56985. self._assert_equals_($2,(11));
  56986. $ctx1.sendIdx["assert:equals:"]=3;
  56987. $3=(12)._truncated();
  56988. $ctx1.sendIdx["truncated"]=3;
  56989. self._assert_equals_($3,(12));
  56990. $ctx1.sendIdx["assert:equals:"]=4;
  56991. $4=(13)._truncated();
  56992. $ctx1.sendIdx["truncated"]=4;
  56993. self._assert_equals_($4,(13));
  56994. $ctx1.sendIdx["assert:equals:"]=5;
  56995. $5=(14)._truncated();
  56996. $ctx1.sendIdx["truncated"]=5;
  56997. self._assert_equals_($5,(14));
  56998. $ctx1.sendIdx["assert:equals:"]=6;
  56999. self._assert_equals_((15)._truncated(),(15));
  57000. return self;
  57001. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  57002. },
  57003. args: [],
  57004. 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",
  57005. referencedClasses: [],
  57006. messageSends: ["assert:equals:", "truncated"]
  57007. }),
  57008. $globals.NumberTest);
  57009. $core.addMethod(
  57010. $core.method({
  57011. selector: "testIdentity",
  57012. protocol: "tests",
  57013. fn: function (){
  57014. var self=this;
  57015. return $core.withContext(function($ctx1) {
  57016. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  57017. $1=(1).__eq_eq((1));
  57018. $ctx1.sendIdx["=="]=1;
  57019. self._assert_($1);
  57020. $ctx1.sendIdx["assert:"]=1;
  57021. $2=(0).__eq_eq((0));
  57022. $ctx1.sendIdx["=="]=2;
  57023. self._assert_($2);
  57024. $ctx1.sendIdx["assert:"]=2;
  57025. $3=(1).__eq_eq((0));
  57026. $ctx1.sendIdx["=="]=3;
  57027. self._deny_($3);
  57028. $ctx1.sendIdx["deny:"]=1;
  57029. $5=(1)._yourself();
  57030. $ctx1.sendIdx["yourself"]=1;
  57031. $4=$recv($5).__eq_eq((1));
  57032. $ctx1.sendIdx["=="]=4;
  57033. self._assert_($4);
  57034. $ctx1.sendIdx["assert:"]=3;
  57035. $7=(1)._yourself();
  57036. $ctx1.sendIdx["yourself"]=2;
  57037. $6=(1).__eq_eq($7);
  57038. $ctx1.sendIdx["=="]=5;
  57039. self._assert_($6);
  57040. $ctx1.sendIdx["assert:"]=4;
  57041. $9=(1)._yourself();
  57042. $ctx1.sendIdx["yourself"]=3;
  57043. $8=$recv($9).__eq_eq((1)._yourself());
  57044. $ctx1.sendIdx["=="]=6;
  57045. self._assert_($8);
  57046. self._deny_((1).__eq_eq((2)));
  57047. return self;
  57048. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  57049. },
  57050. args: [],
  57051. 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",
  57052. referencedClasses: [],
  57053. messageSends: ["assert:", "==", "deny:", "yourself"]
  57054. }),
  57055. $globals.NumberTest);
  57056. $core.addMethod(
  57057. $core.method({
  57058. selector: "testInvalidHexNumbers",
  57059. protocol: "tests",
  57060. fn: function (){
  57061. var self=this;
  57062. return $core.withContext(function($ctx1) {
  57063. self._should_raise_((function(){
  57064. return $core.withContext(function($ctx2) {
  57065. return (16)._rG();
  57066. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57067. }),$globals.MessageNotUnderstood);
  57068. $ctx1.sendIdx["should:raise:"]=1;
  57069. self._should_raise_((function(){
  57070. return $core.withContext(function($ctx2) {
  57071. return (16)._rg();
  57072. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57073. }),$globals.MessageNotUnderstood);
  57074. $ctx1.sendIdx["should:raise:"]=2;
  57075. self._should_raise_((function(){
  57076. return $core.withContext(function($ctx2) {
  57077. return (16)._rH();
  57078. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  57079. }),$globals.MessageNotUnderstood);
  57080. $ctx1.sendIdx["should:raise:"]=3;
  57081. self._should_raise_((function(){
  57082. return $core.withContext(function($ctx2) {
  57083. return (16)._rh();
  57084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  57085. }),$globals.MessageNotUnderstood);
  57086. $ctx1.sendIdx["should:raise:"]=4;
  57087. self._should_raise_((function(){
  57088. return $core.withContext(function($ctx2) {
  57089. return (16)._rI();
  57090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  57091. }),$globals.MessageNotUnderstood);
  57092. $ctx1.sendIdx["should:raise:"]=5;
  57093. self._should_raise_((function(){
  57094. return $core.withContext(function($ctx2) {
  57095. return (16)._ri();
  57096. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  57097. }),$globals.MessageNotUnderstood);
  57098. $ctx1.sendIdx["should:raise:"]=6;
  57099. self._should_raise_((function(){
  57100. return $core.withContext(function($ctx2) {
  57101. return (16)._rJ();
  57102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  57103. }),$globals.MessageNotUnderstood);
  57104. $ctx1.sendIdx["should:raise:"]=7;
  57105. self._should_raise_((function(){
  57106. return $core.withContext(function($ctx2) {
  57107. return (16)._rj();
  57108. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  57109. }),$globals.MessageNotUnderstood);
  57110. $ctx1.sendIdx["should:raise:"]=8;
  57111. self._should_raise_((function(){
  57112. return $core.withContext(function($ctx2) {
  57113. return (16)._rK();
  57114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  57115. }),$globals.MessageNotUnderstood);
  57116. $ctx1.sendIdx["should:raise:"]=9;
  57117. self._should_raise_((function(){
  57118. return $core.withContext(function($ctx2) {
  57119. return (16)._rk();
  57120. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  57121. }),$globals.MessageNotUnderstood);
  57122. $ctx1.sendIdx["should:raise:"]=10;
  57123. self._should_raise_((function(){
  57124. return $core.withContext(function($ctx2) {
  57125. return (16)._rL();
  57126. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  57127. }),$globals.MessageNotUnderstood);
  57128. $ctx1.sendIdx["should:raise:"]=11;
  57129. self._should_raise_((function(){
  57130. return $core.withContext(function($ctx2) {
  57131. return (16)._rl();
  57132. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  57133. }),$globals.MessageNotUnderstood);
  57134. $ctx1.sendIdx["should:raise:"]=12;
  57135. self._should_raise_((function(){
  57136. return $core.withContext(function($ctx2) {
  57137. return (16)._rM();
  57138. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  57139. }),$globals.MessageNotUnderstood);
  57140. $ctx1.sendIdx["should:raise:"]=13;
  57141. self._should_raise_((function(){
  57142. return $core.withContext(function($ctx2) {
  57143. return (16)._rm();
  57144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  57145. }),$globals.MessageNotUnderstood);
  57146. $ctx1.sendIdx["should:raise:"]=14;
  57147. self._should_raise_((function(){
  57148. return $core.withContext(function($ctx2) {
  57149. return (16)._rN();
  57150. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  57151. }),$globals.MessageNotUnderstood);
  57152. $ctx1.sendIdx["should:raise:"]=15;
  57153. self._should_raise_((function(){
  57154. return $core.withContext(function($ctx2) {
  57155. return (16)._rn();
  57156. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  57157. }),$globals.MessageNotUnderstood);
  57158. $ctx1.sendIdx["should:raise:"]=16;
  57159. self._should_raise_((function(){
  57160. return $core.withContext(function($ctx2) {
  57161. return (16)._rO();
  57162. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  57163. }),$globals.MessageNotUnderstood);
  57164. $ctx1.sendIdx["should:raise:"]=17;
  57165. self._should_raise_((function(){
  57166. return $core.withContext(function($ctx2) {
  57167. return (16)._ro();
  57168. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  57169. }),$globals.MessageNotUnderstood);
  57170. $ctx1.sendIdx["should:raise:"]=18;
  57171. self._should_raise_((function(){
  57172. return $core.withContext(function($ctx2) {
  57173. return (16)._rP();
  57174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  57175. }),$globals.MessageNotUnderstood);
  57176. $ctx1.sendIdx["should:raise:"]=19;
  57177. self._should_raise_((function(){
  57178. return $core.withContext(function($ctx2) {
  57179. return (16)._rp();
  57180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  57181. }),$globals.MessageNotUnderstood);
  57182. $ctx1.sendIdx["should:raise:"]=20;
  57183. self._should_raise_((function(){
  57184. return $core.withContext(function($ctx2) {
  57185. return (16)._rQ();
  57186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  57187. }),$globals.MessageNotUnderstood);
  57188. $ctx1.sendIdx["should:raise:"]=21;
  57189. self._should_raise_((function(){
  57190. return $core.withContext(function($ctx2) {
  57191. return (16)._rq();
  57192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  57193. }),$globals.MessageNotUnderstood);
  57194. $ctx1.sendIdx["should:raise:"]=22;
  57195. self._should_raise_((function(){
  57196. return $core.withContext(function($ctx2) {
  57197. return (16)._rR();
  57198. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  57199. }),$globals.MessageNotUnderstood);
  57200. $ctx1.sendIdx["should:raise:"]=23;
  57201. self._should_raise_((function(){
  57202. return $core.withContext(function($ctx2) {
  57203. return (16)._rr();
  57204. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  57205. }),$globals.MessageNotUnderstood);
  57206. $ctx1.sendIdx["should:raise:"]=24;
  57207. self._should_raise_((function(){
  57208. return $core.withContext(function($ctx2) {
  57209. return (16)._rS();
  57210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  57211. }),$globals.MessageNotUnderstood);
  57212. $ctx1.sendIdx["should:raise:"]=25;
  57213. self._should_raise_((function(){
  57214. return $core.withContext(function($ctx2) {
  57215. return (16)._rs();
  57216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  57217. }),$globals.MessageNotUnderstood);
  57218. $ctx1.sendIdx["should:raise:"]=26;
  57219. self._should_raise_((function(){
  57220. return $core.withContext(function($ctx2) {
  57221. return (16)._rT();
  57222. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  57223. }),$globals.MessageNotUnderstood);
  57224. $ctx1.sendIdx["should:raise:"]=27;
  57225. self._should_raise_((function(){
  57226. return $core.withContext(function($ctx2) {
  57227. return (16)._rt();
  57228. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  57229. }),$globals.MessageNotUnderstood);
  57230. $ctx1.sendIdx["should:raise:"]=28;
  57231. self._should_raise_((function(){
  57232. return $core.withContext(function($ctx2) {
  57233. return (16)._rU();
  57234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  57235. }),$globals.MessageNotUnderstood);
  57236. $ctx1.sendIdx["should:raise:"]=29;
  57237. self._should_raise_((function(){
  57238. return $core.withContext(function($ctx2) {
  57239. return (16)._ru();
  57240. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  57241. }),$globals.MessageNotUnderstood);
  57242. $ctx1.sendIdx["should:raise:"]=30;
  57243. self._should_raise_((function(){
  57244. return $core.withContext(function($ctx2) {
  57245. return (16)._rV();
  57246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  57247. }),$globals.MessageNotUnderstood);
  57248. $ctx1.sendIdx["should:raise:"]=31;
  57249. self._should_raise_((function(){
  57250. return $core.withContext(function($ctx2) {
  57251. return (16)._rv();
  57252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  57253. }),$globals.MessageNotUnderstood);
  57254. $ctx1.sendIdx["should:raise:"]=32;
  57255. self._should_raise_((function(){
  57256. return $core.withContext(function($ctx2) {
  57257. return (16)._rW();
  57258. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  57259. }),$globals.MessageNotUnderstood);
  57260. $ctx1.sendIdx["should:raise:"]=33;
  57261. self._should_raise_((function(){
  57262. return $core.withContext(function($ctx2) {
  57263. return (16)._rw();
  57264. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  57265. }),$globals.MessageNotUnderstood);
  57266. $ctx1.sendIdx["should:raise:"]=34;
  57267. self._should_raise_((function(){
  57268. return $core.withContext(function($ctx2) {
  57269. return (16)._rX();
  57270. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  57271. }),$globals.MessageNotUnderstood);
  57272. $ctx1.sendIdx["should:raise:"]=35;
  57273. self._should_raise_((function(){
  57274. return $core.withContext(function($ctx2) {
  57275. return (16)._rx();
  57276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  57277. }),$globals.MessageNotUnderstood);
  57278. $ctx1.sendIdx["should:raise:"]=36;
  57279. self._should_raise_((function(){
  57280. return $core.withContext(function($ctx2) {
  57281. return (16)._rY();
  57282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  57283. }),$globals.MessageNotUnderstood);
  57284. $ctx1.sendIdx["should:raise:"]=37;
  57285. self._should_raise_((function(){
  57286. return $core.withContext(function($ctx2) {
  57287. return (16)._ry();
  57288. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  57289. }),$globals.MessageNotUnderstood);
  57290. $ctx1.sendIdx["should:raise:"]=38;
  57291. self._should_raise_((function(){
  57292. return $core.withContext(function($ctx2) {
  57293. return (16)._rZ();
  57294. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  57295. }),$globals.MessageNotUnderstood);
  57296. $ctx1.sendIdx["should:raise:"]=39;
  57297. self._should_raise_((function(){
  57298. return $core.withContext(function($ctx2) {
  57299. return (16)._rz();
  57300. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  57301. }),$globals.MessageNotUnderstood);
  57302. $ctx1.sendIdx["should:raise:"]=40;
  57303. self._should_raise_((function(){
  57304. return $core.withContext(function($ctx2) {
  57305. return (11259375)._Z();
  57306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  57307. }),$globals.MessageNotUnderstood);
  57308. return self;
  57309. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  57310. },
  57311. args: [],
  57312. 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.",
  57313. referencedClasses: ["MessageNotUnderstood"],
  57314. 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"]
  57315. }),
  57316. $globals.NumberTest);
  57317. $core.addMethod(
  57318. $core.method({
  57319. selector: "testLog",
  57320. protocol: "tests",
  57321. fn: function (){
  57322. var self=this;
  57323. return $core.withContext(function($ctx1) {
  57324. self._assert_equals_((10000)._log(),(4));
  57325. $ctx1.sendIdx["assert:equals:"]=1;
  57326. self._assert_equals_((512)._log_((2)),(9));
  57327. $ctx1.sendIdx["assert:equals:"]=2;
  57328. self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  57329. return self;
  57330. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  57331. },
  57332. args: [],
  57333. 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.",
  57334. referencedClasses: ["Number"],
  57335. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  57336. }),
  57337. $globals.NumberTest);
  57338. $core.addMethod(
  57339. $core.method({
  57340. selector: "testMinMax",
  57341. protocol: "tests",
  57342. fn: function (){
  57343. var self=this;
  57344. return $core.withContext(function($ctx1) {
  57345. self._assert_equals_((2)._max_((5)),(5));
  57346. $ctx1.sendIdx["assert:equals:"]=1;
  57347. self._assert_equals_((2)._min_((5)),(2));
  57348. return self;
  57349. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  57350. },
  57351. args: [],
  57352. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  57353. referencedClasses: [],
  57354. messageSends: ["assert:equals:", "max:", "min:"]
  57355. }),
  57356. $globals.NumberTest);
  57357. $core.addMethod(
  57358. $core.method({
  57359. selector: "testNegated",
  57360. protocol: "tests",
  57361. fn: function (){
  57362. var self=this;
  57363. return $core.withContext(function($ctx1) {
  57364. var $1;
  57365. $1=(3)._negated();
  57366. $ctx1.sendIdx["negated"]=1;
  57367. self._assert_equals_($1,(-3));
  57368. $ctx1.sendIdx["assert:equals:"]=1;
  57369. self._assert_equals_((-3)._negated(),(3));
  57370. return self;
  57371. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  57372. },
  57373. args: [],
  57374. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  57375. referencedClasses: [],
  57376. messageSends: ["assert:equals:", "negated"]
  57377. }),
  57378. $globals.NumberTest);
  57379. $core.addMethod(
  57380. $core.method({
  57381. selector: "testPrintShowingDecimalPlaces",
  57382. protocol: "tests",
  57383. fn: function (){
  57384. var self=this;
  57385. return $core.withContext(function($ctx1) {
  57386. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  57387. $1=(23)._printShowingDecimalPlaces_((2));
  57388. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  57389. self._assert_equals_($1,"23.00");
  57390. $ctx1.sendIdx["assert:equals:"]=1;
  57391. $2=(23.5698)._printShowingDecimalPlaces_((2));
  57392. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  57393. self._assert_equals_($2,"23.57");
  57394. $ctx1.sendIdx["assert:equals:"]=2;
  57395. $4=(234.567)._negated();
  57396. $ctx1.sendIdx["negated"]=1;
  57397. $3=$recv($4)._printShowingDecimalPlaces_((5));
  57398. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  57399. self._assert_equals_($3,"-234.56700");
  57400. $ctx1.sendIdx["assert:equals:"]=3;
  57401. $5=(23.4567)._printShowingDecimalPlaces_((0));
  57402. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  57403. self._assert_equals_($5,"23");
  57404. $ctx1.sendIdx["assert:equals:"]=4;
  57405. $6=(23.5567)._printShowingDecimalPlaces_((0));
  57406. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  57407. self._assert_equals_($6,"24");
  57408. $ctx1.sendIdx["assert:equals:"]=5;
  57409. $8=(23.4567)._negated();
  57410. $ctx1.sendIdx["negated"]=2;
  57411. $7=$recv($8)._printShowingDecimalPlaces_((0));
  57412. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  57413. self._assert_equals_($7,"-23");
  57414. $ctx1.sendIdx["assert:equals:"]=6;
  57415. $10=(23.5567)._negated();
  57416. $ctx1.sendIdx["negated"]=3;
  57417. $9=$recv($10)._printShowingDecimalPlaces_((0));
  57418. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  57419. self._assert_equals_($9,"-24");
  57420. $ctx1.sendIdx["assert:equals:"]=7;
  57421. $11=(100000000)._printShowingDecimalPlaces_((1));
  57422. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  57423. self._assert_equals_($11,"100000000.0");
  57424. $ctx1.sendIdx["assert:equals:"]=8;
  57425. $12=(0.98)._printShowingDecimalPlaces_((5));
  57426. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  57427. self._assert_equals_($12,"0.98000");
  57428. $ctx1.sendIdx["assert:equals:"]=9;
  57429. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  57430. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  57431. self._assert_equals_($13,"-0.98");
  57432. $ctx1.sendIdx["assert:equals:"]=10;
  57433. $14=(2.567)._printShowingDecimalPlaces_((2));
  57434. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  57435. self._assert_equals_($14,"2.57");
  57436. $ctx1.sendIdx["assert:equals:"]=11;
  57437. $15=(-2.567)._printShowingDecimalPlaces_((2));
  57438. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  57439. self._assert_equals_($15,"-2.57");
  57440. $ctx1.sendIdx["assert:equals:"]=12;
  57441. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  57442. return self;
  57443. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  57444. },
  57445. args: [],
  57446. 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'.",
  57447. referencedClasses: [],
  57448. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  57449. }),
  57450. $globals.NumberTest);
  57451. $core.addMethod(
  57452. $core.method({
  57453. selector: "testRaisedTo",
  57454. protocol: "tests",
  57455. fn: function (){
  57456. var self=this;
  57457. return $core.withContext(function($ctx1) {
  57458. var $1,$2,$3;
  57459. $1=(2)._raisedTo_((4));
  57460. $ctx1.sendIdx["raisedTo:"]=1;
  57461. self._assert_equals_($1,(16));
  57462. $ctx1.sendIdx["assert:equals:"]=1;
  57463. $2=(2)._raisedTo_((0));
  57464. $ctx1.sendIdx["raisedTo:"]=2;
  57465. self._assert_equals_($2,(1));
  57466. $ctx1.sendIdx["assert:equals:"]=2;
  57467. $3=(2)._raisedTo_((-3));
  57468. $ctx1.sendIdx["raisedTo:"]=3;
  57469. self._assert_equals_($3,(0.125));
  57470. $ctx1.sendIdx["assert:equals:"]=3;
  57471. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  57472. $ctx1.sendIdx["assert:equals:"]=4;
  57473. self._assert_equals_((2).__star_star((4)),(16));
  57474. return self;
  57475. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  57476. },
  57477. args: [],
  57478. 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.",
  57479. referencedClasses: [],
  57480. messageSends: ["assert:equals:", "raisedTo:", "**"]
  57481. }),
  57482. $globals.NumberTest);
  57483. $core.addMethod(
  57484. $core.method({
  57485. selector: "testRounded",
  57486. protocol: "tests",
  57487. fn: function (){
  57488. var self=this;
  57489. return $core.withContext(function($ctx1) {
  57490. var $1,$2;
  57491. $1=(3)._rounded();
  57492. $ctx1.sendIdx["rounded"]=1;
  57493. self._assert_equals_($1,(3));
  57494. $ctx1.sendIdx["assert:equals:"]=1;
  57495. $2=(3.212)._rounded();
  57496. $ctx1.sendIdx["rounded"]=2;
  57497. self._assert_equals_($2,(3));
  57498. $ctx1.sendIdx["assert:equals:"]=2;
  57499. self._assert_equals_((3.51)._rounded(),(4));
  57500. return self;
  57501. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  57502. },
  57503. args: [],
  57504. 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",
  57505. referencedClasses: [],
  57506. messageSends: ["assert:equals:", "rounded"]
  57507. }),
  57508. $globals.NumberTest);
  57509. $core.addMethod(
  57510. $core.method({
  57511. selector: "testSign",
  57512. protocol: "tests",
  57513. fn: function (){
  57514. var self=this;
  57515. return $core.withContext(function($ctx1) {
  57516. var $1,$2;
  57517. $1=(5)._sign();
  57518. $ctx1.sendIdx["sign"]=1;
  57519. self._assert_equals_($1,(1));
  57520. $ctx1.sendIdx["assert:equals:"]=1;
  57521. $2=(0)._sign();
  57522. $ctx1.sendIdx["sign"]=2;
  57523. self._assert_equals_($2,(0));
  57524. $ctx1.sendIdx["assert:equals:"]=2;
  57525. self._assert_equals_((-1.4)._sign(),(-1));
  57526. return self;
  57527. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  57528. },
  57529. args: [],
  57530. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  57531. referencedClasses: [],
  57532. messageSends: ["assert:equals:", "sign"]
  57533. }),
  57534. $globals.NumberTest);
  57535. $core.addMethod(
  57536. $core.method({
  57537. selector: "testSqrt",
  57538. protocol: "tests",
  57539. fn: function (){
  57540. var self=this;
  57541. return $core.withContext(function($ctx1) {
  57542. var $1;
  57543. $1=(4)._sqrt();
  57544. $ctx1.sendIdx["sqrt"]=1;
  57545. self._assert_equals_($1,(2));
  57546. $ctx1.sendIdx["assert:equals:"]=1;
  57547. self._assert_equals_((16)._sqrt(),(4));
  57548. return self;
  57549. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  57550. },
  57551. args: [],
  57552. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  57553. referencedClasses: [],
  57554. messageSends: ["assert:equals:", "sqrt"]
  57555. }),
  57556. $globals.NumberTest);
  57557. $core.addMethod(
  57558. $core.method({
  57559. selector: "testSquared",
  57560. protocol: "tests",
  57561. fn: function (){
  57562. var self=this;
  57563. return $core.withContext(function($ctx1) {
  57564. self._assert_equals_((4)._squared(),(16));
  57565. return self;
  57566. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  57567. },
  57568. args: [],
  57569. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  57570. referencedClasses: [],
  57571. messageSends: ["assert:equals:", "squared"]
  57572. }),
  57573. $globals.NumberTest);
  57574. $core.addMethod(
  57575. $core.method({
  57576. selector: "testTimesRepeat",
  57577. protocol: "tests",
  57578. fn: function (){
  57579. var self=this;
  57580. var i;
  57581. return $core.withContext(function($ctx1) {
  57582. i=(0);
  57583. (0)._timesRepeat_((function(){
  57584. return $core.withContext(function($ctx2) {
  57585. i=$recv(i).__plus((1));
  57586. $ctx2.sendIdx["+"]=1;
  57587. return i;
  57588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57589. }));
  57590. $ctx1.sendIdx["timesRepeat:"]=1;
  57591. self._assert_equals_(i,(0));
  57592. $ctx1.sendIdx["assert:equals:"]=1;
  57593. (5)._timesRepeat_((function(){
  57594. return $core.withContext(function($ctx2) {
  57595. i=$recv(i).__plus((1));
  57596. return i;
  57597. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57598. }));
  57599. self._assert_equals_(i,(5));
  57600. return self;
  57601. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  57602. },
  57603. args: [],
  57604. 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",
  57605. referencedClasses: [],
  57606. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  57607. }),
  57608. $globals.NumberTest);
  57609. $core.addMethod(
  57610. $core.method({
  57611. selector: "testTo",
  57612. protocol: "tests",
  57613. fn: function (){
  57614. var self=this;
  57615. return $core.withContext(function($ctx1) {
  57616. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  57617. return self;
  57618. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  57619. },
  57620. args: [],
  57621. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  57622. referencedClasses: [],
  57623. messageSends: ["assert:equals:", "to:"]
  57624. }),
  57625. $globals.NumberTest);
  57626. $core.addMethod(
  57627. $core.method({
  57628. selector: "testToBy",
  57629. protocol: "tests",
  57630. fn: function (){
  57631. var self=this;
  57632. return $core.withContext(function($ctx1) {
  57633. var $1;
  57634. $1=(0)._to_by_((6),(2));
  57635. $ctx1.sendIdx["to:by:"]=1;
  57636. self._assert_equals_($1,[(0), (2), (4), (6)]);
  57637. self._should_raise_((function(){
  57638. return $core.withContext(function($ctx2) {
  57639. return (1)._to_by_((4),(0));
  57640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57641. }),$globals.Error);
  57642. return self;
  57643. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  57644. },
  57645. args: [],
  57646. 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",
  57647. referencedClasses: ["Error"],
  57648. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  57649. }),
  57650. $globals.NumberTest);
  57651. $core.addMethod(
  57652. $core.method({
  57653. selector: "testTrigonometry",
  57654. protocol: "tests",
  57655. fn: function (){
  57656. var self=this;
  57657. return $core.withContext(function($ctx1) {
  57658. self._assert_equals_((0)._cos(),(1));
  57659. $ctx1.sendIdx["assert:equals:"]=1;
  57660. self._assert_equals_((0)._sin(),(0));
  57661. $ctx1.sendIdx["assert:equals:"]=2;
  57662. self._assert_equals_((0)._tan(),(0));
  57663. $ctx1.sendIdx["assert:equals:"]=3;
  57664. self._assert_equals_((1)._arcCos(),(0));
  57665. $ctx1.sendIdx["assert:equals:"]=4;
  57666. self._assert_equals_((0)._arcSin(),(0));
  57667. $ctx1.sendIdx["assert:equals:"]=5;
  57668. self._assert_equals_((0)._arcTan(),(0));
  57669. return self;
  57670. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  57671. },
  57672. args: [],
  57673. 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.",
  57674. referencedClasses: [],
  57675. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"]
  57676. }),
  57677. $globals.NumberTest);
  57678. $core.addMethod(
  57679. $core.method({
  57680. selector: "testTruncated",
  57681. protocol: "tests",
  57682. fn: function (){
  57683. var self=this;
  57684. return $core.withContext(function($ctx1) {
  57685. var $1,$2;
  57686. $1=(3)._truncated();
  57687. $ctx1.sendIdx["truncated"]=1;
  57688. self._assert_equals_($1,(3));
  57689. $ctx1.sendIdx["assert:equals:"]=1;
  57690. $2=(3.212)._truncated();
  57691. $ctx1.sendIdx["truncated"]=2;
  57692. self._assert_equals_($2,(3));
  57693. $ctx1.sendIdx["assert:equals:"]=2;
  57694. self._assert_equals_((3.51)._truncated(),(3));
  57695. return self;
  57696. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  57697. },
  57698. args: [],
  57699. 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",
  57700. referencedClasses: [],
  57701. messageSends: ["assert:equals:", "truncated"]
  57702. }),
  57703. $globals.NumberTest);
  57704. $core.addClass("ObjectMock", $globals.Object, ["foo", "bar"], "Kernel-Tests");
  57705. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  57706. $core.addMethod(
  57707. $core.method({
  57708. selector: "foo",
  57709. protocol: "not yet classified",
  57710. fn: function (){
  57711. var self=this;
  57712. return self["@foo"];
  57713. },
  57714. args: [],
  57715. source: "foo\x0a\x09^ foo",
  57716. referencedClasses: [],
  57717. messageSends: []
  57718. }),
  57719. $globals.ObjectMock);
  57720. $core.addMethod(
  57721. $core.method({
  57722. selector: "foo:",
  57723. protocol: "not yet classified",
  57724. fn: function (anObject){
  57725. var self=this;
  57726. self["@foo"]=anObject;
  57727. return self;
  57728. },
  57729. args: ["anObject"],
  57730. source: "foo: anObject\x0a\x09foo := anObject",
  57731. referencedClasses: [],
  57732. messageSends: []
  57733. }),
  57734. $globals.ObjectMock);
  57735. $core.addClass("ObjectTest", $globals.TestCase, [], "Kernel-Tests");
  57736. $core.addMethod(
  57737. $core.method({
  57738. selector: "notDefined",
  57739. protocol: "tests",
  57740. fn: function (){
  57741. var self=this;
  57742. return $core.withContext(function($ctx1) {
  57743. return void 0;;
  57744. return self;
  57745. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  57746. },
  57747. args: [],
  57748. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  57749. referencedClasses: [],
  57750. messageSends: []
  57751. }),
  57752. $globals.ObjectTest);
  57753. $core.addMethod(
  57754. $core.method({
  57755. selector: "testBasicAccess",
  57756. protocol: "tests",
  57757. fn: function (){
  57758. var self=this;
  57759. var o;
  57760. return $core.withContext(function($ctx1) {
  57761. var $1;
  57762. o=$recv($globals.Object)._new();
  57763. $recv(o)._basicAt_put_("a",(1));
  57764. $1=$recv(o)._basicAt_("a");
  57765. $ctx1.sendIdx["basicAt:"]=1;
  57766. self._assert_equals_($1,(1));
  57767. $ctx1.sendIdx["assert:equals:"]=1;
  57768. self._assert_equals_($recv(o)._basicAt_("b"),nil);
  57769. return self;
  57770. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  57771. },
  57772. args: [],
  57773. 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",
  57774. referencedClasses: ["Object"],
  57775. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  57776. }),
  57777. $globals.ObjectTest);
  57778. $core.addMethod(
  57779. $core.method({
  57780. selector: "testBasicPerform",
  57781. protocol: "tests",
  57782. fn: function (){
  57783. var self=this;
  57784. var o;
  57785. return $core.withContext(function($ctx1) {
  57786. o=$recv($globals.Object)._new();
  57787. $recv(o)._basicAt_put_("func",(function(){
  57788. return "hello";
  57789. }));
  57790. $ctx1.sendIdx["basicAt:put:"]=1;
  57791. $recv(o)._basicAt_put_("func2",(function(a){
  57792. return $core.withContext(function($ctx2) {
  57793. return $recv(a).__plus((1));
  57794. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  57795. }));
  57796. self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  57797. $ctx1.sendIdx["assert:equals:"]=1;
  57798. self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  57799. return self;
  57800. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  57801. },
  57802. args: [],
  57803. 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",
  57804. referencedClasses: ["Object"],
  57805. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  57806. }),
  57807. $globals.ObjectTest);
  57808. $core.addMethod(
  57809. $core.method({
  57810. selector: "testDNU",
  57811. protocol: "tests",
  57812. fn: function (){
  57813. var self=this;
  57814. return $core.withContext(function($ctx1) {
  57815. self._should_raise_((function(){
  57816. return $core.withContext(function($ctx2) {
  57817. return $recv($recv($globals.Object)._new())._foo();
  57818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57819. }),$globals.MessageNotUnderstood);
  57820. return self;
  57821. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  57822. },
  57823. args: [],
  57824. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  57825. referencedClasses: ["Object", "MessageNotUnderstood"],
  57826. messageSends: ["should:raise:", "foo", "new"]
  57827. }),
  57828. $globals.ObjectTest);
  57829. $core.addMethod(
  57830. $core.method({
  57831. selector: "testEquality",
  57832. protocol: "tests",
  57833. fn: function (){
  57834. var self=this;
  57835. var o;
  57836. return $core.withContext(function($ctx1) {
  57837. var $1,$2,$4,$3;
  57838. o=$recv($globals.Object)._new();
  57839. $ctx1.sendIdx["new"]=1;
  57840. $1=$recv(o).__eq($recv($globals.Object)._new());
  57841. $ctx1.sendIdx["="]=1;
  57842. self._deny_($1);
  57843. $2=$recv(o).__eq(o);
  57844. $ctx1.sendIdx["="]=2;
  57845. self._assert_($2);
  57846. $ctx1.sendIdx["assert:"]=1;
  57847. $4=$recv(o)._yourself();
  57848. $ctx1.sendIdx["yourself"]=1;
  57849. $3=$recv($4).__eq(o);
  57850. $ctx1.sendIdx["="]=3;
  57851. self._assert_($3);
  57852. $ctx1.sendIdx["assert:"]=2;
  57853. self._assert_($recv(o).__eq($recv(o)._yourself()));
  57854. return self;
  57855. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  57856. },
  57857. args: [],
  57858. 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)",
  57859. referencedClasses: ["Object"],
  57860. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  57861. }),
  57862. $globals.ObjectTest);
  57863. $core.addMethod(
  57864. $core.method({
  57865. selector: "testHalt",
  57866. protocol: "tests",
  57867. fn: function (){
  57868. var self=this;
  57869. return $core.withContext(function($ctx1) {
  57870. self._should_raise_((function(){
  57871. return $core.withContext(function($ctx2) {
  57872. return $recv($recv($globals.Object)._new())._halt();
  57873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57874. }),$globals.Error);
  57875. return self;
  57876. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  57877. },
  57878. args: [],
  57879. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  57880. referencedClasses: ["Object", "Error"],
  57881. messageSends: ["should:raise:", "halt", "new"]
  57882. }),
  57883. $globals.ObjectTest);
  57884. $core.addMethod(
  57885. $core.method({
  57886. selector: "testIdentity",
  57887. protocol: "tests",
  57888. fn: function (){
  57889. var self=this;
  57890. var o;
  57891. return $core.withContext(function($ctx1) {
  57892. var $1,$2,$4,$3;
  57893. o=$recv($globals.Object)._new();
  57894. $ctx1.sendIdx["new"]=1;
  57895. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  57896. $ctx1.sendIdx["=="]=1;
  57897. self._deny_($1);
  57898. $2=$recv(o).__eq_eq(o);
  57899. $ctx1.sendIdx["=="]=2;
  57900. self._assert_($2);
  57901. $ctx1.sendIdx["assert:"]=1;
  57902. $4=$recv(o)._yourself();
  57903. $ctx1.sendIdx["yourself"]=1;
  57904. $3=$recv($4).__eq_eq(o);
  57905. $ctx1.sendIdx["=="]=3;
  57906. self._assert_($3);
  57907. $ctx1.sendIdx["assert:"]=2;
  57908. self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  57909. return self;
  57910. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  57911. },
  57912. args: [],
  57913. 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",
  57914. referencedClasses: ["Object"],
  57915. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  57916. }),
  57917. $globals.ObjectTest);
  57918. $core.addMethod(
  57919. $core.method({
  57920. selector: "testIfNil",
  57921. protocol: "tests",
  57922. fn: function (){
  57923. var self=this;
  57924. return $core.withContext(function($ctx1) {
  57925. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  57926. $2=$recv($globals.Object)._new();
  57927. $ctx1.sendIdx["new"]=1;
  57928. $1=$recv($2)._isNil();
  57929. self._deny_($1);
  57930. $ctx1.sendIdx["deny:"]=1;
  57931. $5=$recv($globals.Object)._new();
  57932. $ctx1.sendIdx["new"]=2;
  57933. if(($receiver = $5) == null || $receiver.isNil){
  57934. $4=true;
  57935. } else {
  57936. $4=$5;
  57937. }
  57938. $3=$recv($4).__eq(true);
  57939. self._deny_($3);
  57940. $7=$recv($globals.Object)._new();
  57941. $ctx1.sendIdx["new"]=3;
  57942. if(($receiver = $7) == null || $receiver.isNil){
  57943. $6=$7;
  57944. } else {
  57945. $6=true;
  57946. }
  57947. self._assert_equals_($6,true);
  57948. $ctx1.sendIdx["assert:equals:"]=1;
  57949. $9=$recv($globals.Object)._new();
  57950. $ctx1.sendIdx["new"]=4;
  57951. if(($receiver = $9) == null || $receiver.isNil){
  57952. $8=false;
  57953. } else {
  57954. $8=true;
  57955. }
  57956. self._assert_equals_($8,true);
  57957. $ctx1.sendIdx["assert:equals:"]=2;
  57958. $11=$recv($globals.Object)._new();
  57959. if(($receiver = $11) == null || $receiver.isNil){
  57960. $10=false;
  57961. } else {
  57962. $10=true;
  57963. }
  57964. self._assert_equals_($10,true);
  57965. return self;
  57966. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  57967. },
  57968. args: [],
  57969. 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",
  57970. referencedClasses: ["Object"],
  57971. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  57972. }),
  57973. $globals.ObjectTest);
  57974. $core.addMethod(
  57975. $core.method({
  57976. selector: "testInstVars",
  57977. protocol: "tests",
  57978. fn: function (){
  57979. var self=this;
  57980. var o;
  57981. return $core.withContext(function($ctx1) {
  57982. var $1,$2;
  57983. o=$recv($globals.ObjectMock)._new();
  57984. $1=$recv(o)._instVarAt_("foo");
  57985. $ctx1.sendIdx["instVarAt:"]=1;
  57986. self._assert_equals_($1,nil);
  57987. $ctx1.sendIdx["assert:equals:"]=1;
  57988. $recv(o)._instVarAt_put_("foo",(1));
  57989. $2=$recv(o)._instVarAt_("foo");
  57990. $ctx1.sendIdx["instVarAt:"]=2;
  57991. self._assert_equals_($2,(1));
  57992. $ctx1.sendIdx["assert:equals:"]=2;
  57993. self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  57994. return self;
  57995. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  57996. },
  57997. args: [],
  57998. 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",
  57999. referencedClasses: ["ObjectMock"],
  58000. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  58001. }),
  58002. $globals.ObjectTest);
  58003. $core.addMethod(
  58004. $core.method({
  58005. selector: "testNilUndefined",
  58006. protocol: "tests",
  58007. fn: function (){
  58008. var self=this;
  58009. return $core.withContext(function($ctx1) {
  58010. self._assert_equals_(self._notDefined(),nil);
  58011. return self;
  58012. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  58013. },
  58014. args: [],
  58015. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  58016. referencedClasses: [],
  58017. messageSends: ["assert:equals:", "notDefined"]
  58018. }),
  58019. $globals.ObjectTest);
  58020. $core.addMethod(
  58021. $core.method({
  58022. selector: "testYourself",
  58023. protocol: "tests",
  58024. fn: function (){
  58025. var self=this;
  58026. var o;
  58027. return $core.withContext(function($ctx1) {
  58028. o=$recv($globals.ObjectMock)._new();
  58029. self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  58030. return self;
  58031. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  58032. },
  58033. args: [],
  58034. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  58035. referencedClasses: ["ObjectMock"],
  58036. messageSends: ["new", "assert:", "==", "yourself"]
  58037. }),
  58038. $globals.ObjectTest);
  58039. $core.addMethod(
  58040. $core.method({
  58041. selector: "testidentityHash",
  58042. protocol: "tests",
  58043. fn: function (){
  58044. var self=this;
  58045. var o1,o2;
  58046. return $core.withContext(function($ctx1) {
  58047. var $2,$3,$1,$5,$4;
  58048. o1=$recv($globals.Object)._new();
  58049. $ctx1.sendIdx["new"]=1;
  58050. o2=$recv($globals.Object)._new();
  58051. $2=$recv(o1)._identityHash();
  58052. $ctx1.sendIdx["identityHash"]=1;
  58053. $3=$recv(o1)._identityHash();
  58054. $ctx1.sendIdx["identityHash"]=2;
  58055. $1=$recv($2).__eq_eq($3);
  58056. $ctx1.sendIdx["=="]=1;
  58057. self._assert_($1);
  58058. $5=$recv(o1)._identityHash();
  58059. $ctx1.sendIdx["identityHash"]=3;
  58060. $4=$recv($5).__eq_eq($recv(o2)._identityHash());
  58061. self._deny_($4);
  58062. return self;
  58063. }, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},$globals.ObjectTest)});
  58064. },
  58065. args: [],
  58066. source: "testidentityHash\x0a\x09| o1 o2 |\x0a\x09\x0a\x09o1 := Object new.\x0a\x09o2 := Object new.\x0a\x0a\x09self assert: o1 identityHash == o1 identityHash.\x0a\x09self deny: o1 identityHash == o2 identityHash",
  58067. referencedClasses: ["Object"],
  58068. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]
  58069. }),
  58070. $globals.ObjectTest);
  58071. $core.addClass("PointTest", $globals.TestCase, [], "Kernel-Tests");
  58072. $core.addMethod(
  58073. $core.method({
  58074. selector: "testAccessing",
  58075. protocol: "tests",
  58076. fn: function (){
  58077. var self=this;
  58078. return $core.withContext(function($ctx1) {
  58079. var $2,$1,$3,$6,$5,$4;
  58080. $2=$recv($globals.Point)._x_y_((3),(4));
  58081. $ctx1.sendIdx["x:y:"]=1;
  58082. $1=$recv($2)._x();
  58083. $ctx1.sendIdx["x"]=1;
  58084. self._assert_equals_($1,(3));
  58085. $ctx1.sendIdx["assert:equals:"]=1;
  58086. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  58087. $ctx1.sendIdx["y"]=1;
  58088. self._assert_equals_($3,(4));
  58089. $ctx1.sendIdx["assert:equals:"]=2;
  58090. $6=$recv($globals.Point)._new();
  58091. $ctx1.sendIdx["new"]=1;
  58092. $5=$recv($6)._x_((3));
  58093. $4=$recv($5)._x();
  58094. self._assert_equals_($4,(3));
  58095. $ctx1.sendIdx["assert:equals:"]=3;
  58096. self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  58097. return self;
  58098. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  58099. },
  58100. args: [],
  58101. 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",
  58102. referencedClasses: ["Point"],
  58103. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  58104. }),
  58105. $globals.PointTest);
  58106. $core.addMethod(
  58107. $core.method({
  58108. selector: "testArithmetic",
  58109. protocol: "tests",
  58110. fn: function (){
  58111. var self=this;
  58112. return $core.withContext(function($ctx1) {
  58113. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  58114. $2=(3).__at((4));
  58115. $ctx1.sendIdx["@"]=1;
  58116. $3=(3).__at((4));
  58117. $ctx1.sendIdx["@"]=2;
  58118. $1=$recv($2).__star($3);
  58119. $4=$recv($globals.Point)._x_y_((9),(16));
  58120. $ctx1.sendIdx["x:y:"]=1;
  58121. self._assert_equals_($1,$4);
  58122. $ctx1.sendIdx["assert:equals:"]=1;
  58123. $6=(3).__at((4));
  58124. $ctx1.sendIdx["@"]=3;
  58125. $7=(3).__at((4));
  58126. $ctx1.sendIdx["@"]=4;
  58127. $5=$recv($6).__plus($7);
  58128. $8=$recv($globals.Point)._x_y_((6),(8));
  58129. $ctx1.sendIdx["x:y:"]=2;
  58130. self._assert_equals_($5,$8);
  58131. $ctx1.sendIdx["assert:equals:"]=2;
  58132. $10=(3).__at((4));
  58133. $ctx1.sendIdx["@"]=5;
  58134. $11=(3).__at((4));
  58135. $ctx1.sendIdx["@"]=6;
  58136. $9=$recv($10).__minus($11);
  58137. $12=$recv($globals.Point)._x_y_((0),(0));
  58138. $ctx1.sendIdx["x:y:"]=3;
  58139. self._assert_equals_($9,$12);
  58140. $ctx1.sendIdx["assert:equals:"]=3;
  58141. $14=(6).__at((8));
  58142. $ctx1.sendIdx["@"]=7;
  58143. $13=$recv($14).__slash((3).__at((4)));
  58144. self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  58145. return self;
  58146. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  58147. },
  58148. args: [],
  58149. 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)",
  58150. referencedClasses: ["Point"],
  58151. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  58152. }),
  58153. $globals.PointTest);
  58154. $core.addMethod(
  58155. $core.method({
  58156. selector: "testAt",
  58157. protocol: "tests",
  58158. fn: function (){
  58159. var self=this;
  58160. return $core.withContext(function($ctx1) {
  58161. self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  58162. return self;
  58163. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  58164. },
  58165. args: [],
  58166. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  58167. referencedClasses: ["Point"],
  58168. messageSends: ["assert:equals:", "@", "x:y:"]
  58169. }),
  58170. $globals.PointTest);
  58171. $core.addMethod(
  58172. $core.method({
  58173. selector: "testComparison",
  58174. protocol: "tests",
  58175. fn: function (){
  58176. var self=this;
  58177. return $core.withContext(function($ctx1) {
  58178. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  58179. $2=(3).__at((4));
  58180. $ctx1.sendIdx["@"]=1;
  58181. $3=(4).__at((5));
  58182. $ctx1.sendIdx["@"]=2;
  58183. $1=$recv($2).__lt($3);
  58184. $ctx1.sendIdx["<"]=1;
  58185. self._assert_($1);
  58186. $ctx1.sendIdx["assert:"]=1;
  58187. $5=(3).__at((4));
  58188. $ctx1.sendIdx["@"]=3;
  58189. $6=(4).__at((4));
  58190. $ctx1.sendIdx["@"]=4;
  58191. $4=$recv($5).__lt($6);
  58192. self._deny_($4);
  58193. $ctx1.sendIdx["deny:"]=1;
  58194. $8=(4).__at((5));
  58195. $ctx1.sendIdx["@"]=5;
  58196. $9=(4).__at((5));
  58197. $ctx1.sendIdx["@"]=6;
  58198. $7=$recv($8).__lt_eq($9);
  58199. $ctx1.sendIdx["<="]=1;
  58200. self._assert_($7);
  58201. $ctx1.sendIdx["assert:"]=2;
  58202. $11=(4).__at((5));
  58203. $ctx1.sendIdx["@"]=7;
  58204. $12=(3).__at((5));
  58205. $ctx1.sendIdx["@"]=8;
  58206. $10=$recv($11).__lt_eq($12);
  58207. self._deny_($10);
  58208. $ctx1.sendIdx["deny:"]=2;
  58209. $14=(5).__at((6));
  58210. $ctx1.sendIdx["@"]=9;
  58211. $15=(4).__at((5));
  58212. $ctx1.sendIdx["@"]=10;
  58213. $13=$recv($14).__gt($15);
  58214. $ctx1.sendIdx[">"]=1;
  58215. self._assert_($13);
  58216. $ctx1.sendIdx["assert:"]=3;
  58217. $17=(5).__at((6));
  58218. $ctx1.sendIdx["@"]=11;
  58219. $18=(6).__at((6));
  58220. $ctx1.sendIdx["@"]=12;
  58221. $16=$recv($17).__gt($18);
  58222. self._deny_($16);
  58223. $ctx1.sendIdx["deny:"]=3;
  58224. $20=(4).__at((5));
  58225. $ctx1.sendIdx["@"]=13;
  58226. $21=(4).__at((5));
  58227. $ctx1.sendIdx["@"]=14;
  58228. $19=$recv($20).__gt_eq($21);
  58229. $ctx1.sendIdx[">="]=1;
  58230. self._assert_($19);
  58231. $23=(4).__at((5));
  58232. $ctx1.sendIdx["@"]=15;
  58233. $22=$recv($23).__gt_eq((5).__at((5)));
  58234. self._deny_($22);
  58235. return self;
  58236. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  58237. },
  58238. args: [],
  58239. 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)",
  58240. referencedClasses: [],
  58241. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  58242. }),
  58243. $globals.PointTest);
  58244. $core.addMethod(
  58245. $core.method({
  58246. selector: "testEgality",
  58247. protocol: "tests",
  58248. fn: function (){
  58249. var self=this;
  58250. return $core.withContext(function($ctx1) {
  58251. var $2,$3,$1,$5,$4;
  58252. $2=(3).__at((4));
  58253. $ctx1.sendIdx["@"]=1;
  58254. $3=(3).__at((4));
  58255. $ctx1.sendIdx["@"]=2;
  58256. $1=$recv($2).__eq($3);
  58257. $ctx1.sendIdx["="]=1;
  58258. self._assert_($1);
  58259. $5=(3).__at((5));
  58260. $ctx1.sendIdx["@"]=3;
  58261. $4=$recv($5).__eq((3).__at((6)));
  58262. self._deny_($4);
  58263. return self;
  58264. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  58265. },
  58266. args: [],
  58267. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  58268. referencedClasses: [],
  58269. messageSends: ["assert:", "=", "@", "deny:"]
  58270. }),
  58271. $globals.PointTest);
  58272. $core.addMethod(
  58273. $core.method({
  58274. selector: "testNew",
  58275. protocol: "tests",
  58276. fn: function (){
  58277. var self=this;
  58278. return $core.withContext(function($ctx1) {
  58279. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  58280. $3=$recv($globals.Point)._new();
  58281. $ctx1.sendIdx["new"]=1;
  58282. $2=$recv($3)._x_((3));
  58283. $ctx1.sendIdx["x:"]=1;
  58284. $1=$recv($2)._y();
  58285. $ctx1.sendIdx["y"]=1;
  58286. self._assert_equals_($1,nil);
  58287. $ctx1.sendIdx["assert:equals:"]=1;
  58288. $7=$recv($globals.Point)._new();
  58289. $ctx1.sendIdx["new"]=2;
  58290. $6=$recv($7)._x_((3));
  58291. $5=$recv($6)._x();
  58292. $ctx1.sendIdx["x"]=1;
  58293. $4=$recv($5).__eq((0));
  58294. $ctx1.sendIdx["="]=1;
  58295. self._deny_($4);
  58296. $ctx1.sendIdx["deny:"]=1;
  58297. $10=$recv($globals.Point)._new();
  58298. $ctx1.sendIdx["new"]=3;
  58299. $9=$recv($10)._y_((4));
  58300. $ctx1.sendIdx["y:"]=1;
  58301. $8=$recv($9)._x();
  58302. self._assert_equals_($8,nil);
  58303. self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  58304. return self;
  58305. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  58306. },
  58307. args: [],
  58308. 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",
  58309. referencedClasses: ["Point"],
  58310. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  58311. }),
  58312. $globals.PointTest);
  58313. $core.addMethod(
  58314. $core.method({
  58315. selector: "testTranslateBy",
  58316. protocol: "tests",
  58317. fn: function (){
  58318. var self=this;
  58319. return $core.withContext(function($ctx1) {
  58320. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  58321. $2=(3).__at((3));
  58322. $ctx1.sendIdx["@"]=1;
  58323. $3=(0).__at((1));
  58324. $ctx1.sendIdx["@"]=2;
  58325. $1=$recv($2)._translateBy_($3);
  58326. $ctx1.sendIdx["translateBy:"]=1;
  58327. $4=(3).__at((4));
  58328. $ctx1.sendIdx["@"]=3;
  58329. self._assert_equals_($1,$4);
  58330. $ctx1.sendIdx["assert:equals:"]=1;
  58331. $6=(3).__at((3));
  58332. $ctx1.sendIdx["@"]=4;
  58333. $8=(1)._negated();
  58334. $ctx1.sendIdx["negated"]=1;
  58335. $7=(0).__at($8);
  58336. $ctx1.sendIdx["@"]=5;
  58337. $5=$recv($6)._translateBy_($7);
  58338. $ctx1.sendIdx["translateBy:"]=2;
  58339. $9=(3).__at((2));
  58340. $ctx1.sendIdx["@"]=6;
  58341. self._assert_equals_($5,$9);
  58342. $ctx1.sendIdx["assert:equals:"]=2;
  58343. $11=(3).__at((3));
  58344. $ctx1.sendIdx["@"]=7;
  58345. $12=(2).__at((3));
  58346. $ctx1.sendIdx["@"]=8;
  58347. $10=$recv($11)._translateBy_($12);
  58348. $ctx1.sendIdx["translateBy:"]=3;
  58349. $13=(5).__at((6));
  58350. $ctx1.sendIdx["@"]=9;
  58351. self._assert_equals_($10,$13);
  58352. $ctx1.sendIdx["assert:equals:"]=3;
  58353. $15=(3).__at((3));
  58354. $ctx1.sendIdx["@"]=10;
  58355. $16=$recv((3)._negated()).__at((0));
  58356. $ctx1.sendIdx["@"]=11;
  58357. $14=$recv($15)._translateBy_($16);
  58358. self._assert_equals_($14,(0).__at((3)));
  58359. return self;
  58360. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  58361. },
  58362. args: [],
  58363. 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.",
  58364. referencedClasses: [],
  58365. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  58366. }),
  58367. $globals.PointTest);
  58368. $core.addClass("QueueTest", $globals.TestCase, [], "Kernel-Tests");
  58369. $core.addMethod(
  58370. $core.method({
  58371. selector: "testNextIfAbsent",
  58372. protocol: "tests",
  58373. fn: function (){
  58374. var self=this;
  58375. var queue;
  58376. return $core.withContext(function($ctx1) {
  58377. var $2,$1;
  58378. queue=$recv($globals.Queue)._new();
  58379. $recv(queue)._nextPut_("index1");
  58380. $2=$recv(queue)._nextIfAbsent_("empty");
  58381. $ctx1.sendIdx["nextIfAbsent:"]=1;
  58382. $1=$recv($2).__eq("index1");
  58383. $ctx1.sendIdx["="]=1;
  58384. self._assert_($1);
  58385. self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  58386. return self;
  58387. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  58388. },
  58389. args: [],
  58390. 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'",
  58391. referencedClasses: ["Queue"],
  58392. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  58393. }),
  58394. $globals.QueueTest);
  58395. $core.addMethod(
  58396. $core.method({
  58397. selector: "testQueueNext",
  58398. protocol: "tests",
  58399. fn: function (){
  58400. var self=this;
  58401. var queue;
  58402. return $core.withContext(function($ctx1) {
  58403. var $1,$3,$2,$5,$4;
  58404. queue=$recv($globals.Queue)._new();
  58405. $1=queue;
  58406. $recv($1)._nextPut_("index1");
  58407. $ctx1.sendIdx["nextPut:"]=1;
  58408. $recv($1)._nextPut_("index2");
  58409. $3=$recv(queue)._next();
  58410. $ctx1.sendIdx["next"]=1;
  58411. $2=$recv($3).__eq("index1");
  58412. $ctx1.sendIdx["="]=1;
  58413. self._assert_($2);
  58414. $5=$recv(queue)._next();
  58415. $ctx1.sendIdx["next"]=2;
  58416. $4=$recv($5).__eq("index");
  58417. self._deny_($4);
  58418. self._should_raise_((function(){
  58419. return $core.withContext(function($ctx2) {
  58420. return $recv(queue)._next();
  58421. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58422. }),$globals.Error);
  58423. return self;
  58424. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  58425. },
  58426. args: [],
  58427. 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",
  58428. referencedClasses: ["Queue", "Error"],
  58429. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  58430. }),
  58431. $globals.QueueTest);
  58432. $core.addClass("RandomTest", $globals.TestCase, [], "Kernel-Tests");
  58433. $core.addMethod(
  58434. $core.method({
  58435. selector: "testAtRandomNumber",
  58436. protocol: "tests",
  58437. fn: function (){
  58438. var self=this;
  58439. var val;
  58440. return $core.withContext(function($ctx1) {
  58441. (100)._timesRepeat_((function(){
  58442. return $core.withContext(function($ctx2) {
  58443. val=(10)._atRandom();
  58444. val;
  58445. self._assert_($recv(val).__gt((0)));
  58446. $ctx2.sendIdx["assert:"]=1;
  58447. return self._assert_($recv(val).__lt((11)));
  58448. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58449. }));
  58450. return self;
  58451. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  58452. },
  58453. args: [],
  58454. 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]",
  58455. referencedClasses: [],
  58456. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  58457. }),
  58458. $globals.RandomTest);
  58459. $core.addMethod(
  58460. $core.method({
  58461. selector: "testAtRandomSequenceableCollection",
  58462. protocol: "tests",
  58463. fn: function (){
  58464. var self=this;
  58465. var val;
  58466. return $core.withContext(function($ctx1) {
  58467. var $3,$4,$2,$1;
  58468. (100)._timesRepeat_((function(){
  58469. return $core.withContext(function($ctx2) {
  58470. val="abc"._atRandom();
  58471. val;
  58472. $3=$recv(val).__eq("a");
  58473. $ctx2.sendIdx["="]=1;
  58474. $4=$recv(val).__eq("b");
  58475. $ctx2.sendIdx["="]=2;
  58476. $2=$recv($3).__or($4);
  58477. $1=$recv($2).__or($recv(val).__eq("c"));
  58478. $ctx2.sendIdx["|"]=1;
  58479. return self._assert_($1);
  58480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58481. }));
  58482. return self;
  58483. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  58484. },
  58485. args: [],
  58486. 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].",
  58487. referencedClasses: [],
  58488. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  58489. }),
  58490. $globals.RandomTest);
  58491. $core.addMethod(
  58492. $core.method({
  58493. selector: "textNext",
  58494. protocol: "tests",
  58495. fn: function (){
  58496. var self=this;
  58497. return $core.withContext(function($ctx1) {
  58498. var $1;
  58499. (10000)._timesRepeat_((function(){
  58500. var current,next;
  58501. return $core.withContext(function($ctx2) {
  58502. next=$recv($recv($globals.Random)._new())._next();
  58503. next;
  58504. self._assert_($recv(next).__gt_eq((0)));
  58505. $ctx2.sendIdx["assert:"]=1;
  58506. self._assert_($recv(next).__lt((1)));
  58507. $1=$recv(current).__eq(next);
  58508. $ctx2.sendIdx["="]=1;
  58509. self._deny_($1);
  58510. return $recv(next).__eq(current);
  58511. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  58512. }));
  58513. return self;
  58514. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  58515. },
  58516. args: [],
  58517. 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 ]",
  58518. referencedClasses: ["Random"],
  58519. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  58520. }),
  58521. $globals.RandomTest);
  58522. $core.addClass("StreamTest", $globals.TestCase, [], "Kernel-Tests");
  58523. $core.addMethod(
  58524. $core.method({
  58525. selector: "collectionClass",
  58526. protocol: "accessing",
  58527. fn: function (){
  58528. var self=this;
  58529. return $core.withContext(function($ctx1) {
  58530. return $recv(self._class())._collectionClass();
  58531. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  58532. },
  58533. args: [],
  58534. source: "collectionClass\x0a\x09^ self class collectionClass",
  58535. referencedClasses: [],
  58536. messageSends: ["collectionClass", "class"]
  58537. }),
  58538. $globals.StreamTest);
  58539. $core.addMethod(
  58540. $core.method({
  58541. selector: "newCollection",
  58542. protocol: "accessing",
  58543. fn: function (){
  58544. var self=this;
  58545. return $core.withContext(function($ctx1) {
  58546. return $recv(self._collectionClass())._new();
  58547. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  58548. },
  58549. args: [],
  58550. source: "newCollection\x0a\x09^ self collectionClass new",
  58551. referencedClasses: [],
  58552. messageSends: ["new", "collectionClass"]
  58553. }),
  58554. $globals.StreamTest);
  58555. $core.addMethod(
  58556. $core.method({
  58557. selector: "newStream",
  58558. protocol: "accessing",
  58559. fn: function (){
  58560. var self=this;
  58561. return $core.withContext(function($ctx1) {
  58562. return $recv($recv(self._collectionClass())._new())._stream();
  58563. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  58564. },
  58565. args: [],
  58566. source: "newStream\x0a\x09^ self collectionClass new stream",
  58567. referencedClasses: [],
  58568. messageSends: ["stream", "new", "collectionClass"]
  58569. }),
  58570. $globals.StreamTest);
  58571. $core.addMethod(
  58572. $core.method({
  58573. selector: "testAtStartAtEnd",
  58574. protocol: "tests",
  58575. fn: function (){
  58576. var self=this;
  58577. var stream;
  58578. return $core.withContext(function($ctx1) {
  58579. var $1,$2,$3,$4;
  58580. stream=self._newStream();
  58581. $1=$recv(stream)._atStart();
  58582. $ctx1.sendIdx["atStart"]=1;
  58583. self._assert_($1);
  58584. $ctx1.sendIdx["assert:"]=1;
  58585. $2=$recv(stream)._atEnd();
  58586. $ctx1.sendIdx["atEnd"]=1;
  58587. self._assert_($2);
  58588. $ctx1.sendIdx["assert:"]=2;
  58589. $recv(stream)._nextPutAll_(self._newCollection());
  58590. $3=$recv(stream)._atEnd();
  58591. $ctx1.sendIdx["atEnd"]=2;
  58592. self._assert_($3);
  58593. $4=$recv(stream)._atStart();
  58594. $ctx1.sendIdx["atStart"]=2;
  58595. self._deny_($4);
  58596. $ctx1.sendIdx["deny:"]=1;
  58597. $recv(stream)._position_((1));
  58598. self._deny_($recv(stream)._atEnd());
  58599. $ctx1.sendIdx["deny:"]=2;
  58600. self._deny_($recv(stream)._atStart());
  58601. return self;
  58602. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  58603. },
  58604. args: [],
  58605. 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",
  58606. referencedClasses: [],
  58607. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  58608. }),
  58609. $globals.StreamTest);
  58610. $core.addMethod(
  58611. $core.method({
  58612. selector: "testContents",
  58613. protocol: "tests",
  58614. fn: function (){
  58615. var self=this;
  58616. var stream;
  58617. return $core.withContext(function($ctx1) {
  58618. var $1,$2;
  58619. stream=self._newStream();
  58620. $1=stream;
  58621. $2=self._newCollection();
  58622. $ctx1.sendIdx["newCollection"]=1;
  58623. $recv($1)._nextPutAll_($2);
  58624. self._assert_equals_($recv(stream)._contents(),self._newCollection());
  58625. return self;
  58626. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  58627. },
  58628. args: [],
  58629. 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",
  58630. referencedClasses: [],
  58631. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  58632. }),
  58633. $globals.StreamTest);
  58634. $core.addMethod(
  58635. $core.method({
  58636. selector: "testIsEmpty",
  58637. protocol: "tests",
  58638. fn: function (){
  58639. var self=this;
  58640. var stream;
  58641. return $core.withContext(function($ctx1) {
  58642. var $1;
  58643. stream=self._newStream();
  58644. $1=$recv(stream)._isEmpty();
  58645. $ctx1.sendIdx["isEmpty"]=1;
  58646. self._assert_($1);
  58647. $recv(stream)._nextPutAll_(self._newCollection());
  58648. self._deny_($recv(stream)._isEmpty());
  58649. return self;
  58650. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  58651. },
  58652. args: [],
  58653. 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",
  58654. referencedClasses: [],
  58655. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  58656. }),
  58657. $globals.StreamTest);
  58658. $core.addMethod(
  58659. $core.method({
  58660. selector: "testPosition",
  58661. protocol: "tests",
  58662. fn: function (){
  58663. var self=this;
  58664. var collection,stream;
  58665. return $core.withContext(function($ctx1) {
  58666. var $1,$2,$3;
  58667. collection=self._newCollection();
  58668. stream=self._newStream();
  58669. $recv(stream)._nextPutAll_(collection);
  58670. $1=$recv(stream)._position();
  58671. $ctx1.sendIdx["position"]=1;
  58672. self._assert_equals_($1,$recv(collection)._size());
  58673. $ctx1.sendIdx["assert:equals:"]=1;
  58674. $recv(stream)._position_((0));
  58675. $2=$recv(stream)._position();
  58676. $ctx1.sendIdx["position"]=2;
  58677. self._assert_equals_($2,(0));
  58678. $ctx1.sendIdx["assert:equals:"]=2;
  58679. $recv(stream)._next();
  58680. $ctx1.sendIdx["next"]=1;
  58681. $3=$recv(stream)._position();
  58682. $ctx1.sendIdx["position"]=3;
  58683. self._assert_equals_($3,(1));
  58684. $ctx1.sendIdx["assert:equals:"]=3;
  58685. $recv(stream)._next();
  58686. self._assert_equals_($recv(stream)._position(),(2));
  58687. return self;
  58688. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  58689. },
  58690. args: [],
  58691. 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",
  58692. referencedClasses: [],
  58693. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  58694. }),
  58695. $globals.StreamTest);
  58696. $core.addMethod(
  58697. $core.method({
  58698. selector: "testReading",
  58699. protocol: "tests",
  58700. fn: function (){
  58701. var self=this;
  58702. var stream,collection;
  58703. return $core.withContext(function($ctx1) {
  58704. var $1,$2;
  58705. collection=self._newCollection();
  58706. stream=self._newStream();
  58707. $1=stream;
  58708. $recv($1)._nextPutAll_(collection);
  58709. $recv($1)._position_((0));
  58710. $recv(collection)._do_((function(each){
  58711. return $core.withContext(function($ctx2) {
  58712. $2=$recv(stream)._next();
  58713. $ctx2.sendIdx["next"]=1;
  58714. return self._assert_equals_($2,each);
  58715. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58716. }));
  58717. self._assert_($recv($recv(stream)._next())._isNil());
  58718. return self;
  58719. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  58720. },
  58721. args: [],
  58722. 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",
  58723. referencedClasses: [],
  58724. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  58725. }),
  58726. $globals.StreamTest);
  58727. $core.addMethod(
  58728. $core.method({
  58729. selector: "testStreamContents",
  58730. protocol: "tests",
  58731. fn: function (){
  58732. var self=this;
  58733. return self;
  58734. },
  58735. args: [],
  58736. source: "testStreamContents",
  58737. referencedClasses: [],
  58738. messageSends: []
  58739. }),
  58740. $globals.StreamTest);
  58741. $core.addMethod(
  58742. $core.method({
  58743. selector: "testWrite",
  58744. protocol: "tests",
  58745. fn: function (){
  58746. var self=this;
  58747. var stream,collection;
  58748. return $core.withContext(function($ctx1) {
  58749. collection=self._newCollection();
  58750. stream=self._newStream();
  58751. $recv(collection)._do_((function(each){
  58752. return $core.withContext(function($ctx2) {
  58753. return $recv(stream).__lt_lt(each);
  58754. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58755. }));
  58756. self._assert_equals_($recv(stream)._contents(),collection);
  58757. return self;
  58758. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  58759. },
  58760. args: [],
  58761. 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",
  58762. referencedClasses: [],
  58763. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  58764. }),
  58765. $globals.StreamTest);
  58766. $core.addMethod(
  58767. $core.method({
  58768. selector: "testWriting",
  58769. protocol: "tests",
  58770. fn: function (){
  58771. var self=this;
  58772. var stream,collection;
  58773. return $core.withContext(function($ctx1) {
  58774. var $1;
  58775. collection=self._newCollection();
  58776. stream=self._newStream();
  58777. $ctx1.sendIdx["newStream"]=1;
  58778. $recv(collection)._do_((function(each){
  58779. return $core.withContext(function($ctx2) {
  58780. return $recv(stream)._nextPut_(each);
  58781. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58782. }));
  58783. $1=$recv(stream)._contents();
  58784. $ctx1.sendIdx["contents"]=1;
  58785. self._assert_equals_($1,collection);
  58786. $ctx1.sendIdx["assert:equals:"]=1;
  58787. stream=self._newStream();
  58788. $recv(stream)._nextPutAll_(collection);
  58789. self._assert_equals_($recv(stream)._contents(),collection);
  58790. return self;
  58791. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  58792. },
  58793. args: [],
  58794. 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",
  58795. referencedClasses: [],
  58796. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  58797. }),
  58798. $globals.StreamTest);
  58799. $core.addMethod(
  58800. $core.method({
  58801. selector: "collectionClass",
  58802. protocol: "accessing",
  58803. fn: function (){
  58804. var self=this;
  58805. return nil;
  58806. },
  58807. args: [],
  58808. source: "collectionClass\x0a\x09^ nil",
  58809. referencedClasses: [],
  58810. messageSends: []
  58811. }),
  58812. $globals.StreamTest.klass);
  58813. $core.addMethod(
  58814. $core.method({
  58815. selector: "isAbstract",
  58816. protocol: "testing",
  58817. fn: function (){
  58818. var self=this;
  58819. return $core.withContext(function($ctx1) {
  58820. return $recv(self._collectionClass())._isNil();
  58821. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.klass)});
  58822. },
  58823. args: [],
  58824. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  58825. referencedClasses: [],
  58826. messageSends: ["isNil", "collectionClass"]
  58827. }),
  58828. $globals.StreamTest.klass);
  58829. $core.addClass("ArrayStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  58830. $core.addMethod(
  58831. $core.method({
  58832. selector: "newCollection",
  58833. protocol: "accessing",
  58834. fn: function (){
  58835. var self=this;
  58836. return $core.withContext(function($ctx1) {
  58837. return [true,(1),(3).__at((4)),"foo"];
  58838. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  58839. },
  58840. args: [],
  58841. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  58842. referencedClasses: [],
  58843. messageSends: ["@"]
  58844. }),
  58845. $globals.ArrayStreamTest);
  58846. $core.addMethod(
  58847. $core.method({
  58848. selector: "collectionClass",
  58849. protocol: "accessing",
  58850. fn: function (){
  58851. var self=this;
  58852. return $globals.Array;
  58853. },
  58854. args: [],
  58855. source: "collectionClass\x0a\x09^ Array",
  58856. referencedClasses: ["Array"],
  58857. messageSends: []
  58858. }),
  58859. $globals.ArrayStreamTest.klass);
  58860. $core.addClass("StringStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  58861. $core.addMethod(
  58862. $core.method({
  58863. selector: "newCollection",
  58864. protocol: "accessing",
  58865. fn: function (){
  58866. var self=this;
  58867. return "hello world";
  58868. },
  58869. args: [],
  58870. source: "newCollection\x0a\x09^ 'hello world'",
  58871. referencedClasses: [],
  58872. messageSends: []
  58873. }),
  58874. $globals.StringStreamTest);
  58875. $core.addMethod(
  58876. $core.method({
  58877. selector: "collectionClass",
  58878. protocol: "accessing",
  58879. fn: function (){
  58880. var self=this;
  58881. return $globals.String;
  58882. },
  58883. args: [],
  58884. source: "collectionClass\x0a\x09^ String",
  58885. referencedClasses: ["String"],
  58886. messageSends: []
  58887. }),
  58888. $globals.StringStreamTest.klass);
  58889. $core.addClass("UndefinedTest", $globals.TestCase, [], "Kernel-Tests");
  58890. $core.addMethod(
  58891. $core.method({
  58892. selector: "testCopying",
  58893. protocol: "tests",
  58894. fn: function (){
  58895. var self=this;
  58896. return $core.withContext(function($ctx1) {
  58897. self._assert_equals_(nil._copy(),nil);
  58898. return self;
  58899. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  58900. },
  58901. args: [],
  58902. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  58903. referencedClasses: [],
  58904. messageSends: ["assert:equals:", "copy"]
  58905. }),
  58906. $globals.UndefinedTest);
  58907. $core.addMethod(
  58908. $core.method({
  58909. selector: "testDeepCopy",
  58910. protocol: "tests",
  58911. fn: function (){
  58912. var self=this;
  58913. return $core.withContext(function($ctx1) {
  58914. self._assert_($recv(nil._deepCopy()).__eq(nil));
  58915. return self;
  58916. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  58917. },
  58918. args: [],
  58919. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  58920. referencedClasses: [],
  58921. messageSends: ["assert:", "=", "deepCopy"]
  58922. }),
  58923. $globals.UndefinedTest);
  58924. $core.addMethod(
  58925. $core.method({
  58926. selector: "testIfNil",
  58927. protocol: "tests",
  58928. fn: function (){
  58929. var self=this;
  58930. return $core.withContext(function($ctx1) {
  58931. var $1,$3,$2,$4,$6,$5,$receiver;
  58932. if(($receiver = nil) == null || $receiver.isNil){
  58933. $1=true;
  58934. } else {
  58935. $1=nil;
  58936. }
  58937. self._assert_equals_($1,true);
  58938. $ctx1.sendIdx["assert:equals:"]=1;
  58939. if(($receiver = nil) == null || $receiver.isNil){
  58940. $3=nil;
  58941. } else {
  58942. $3=true;
  58943. }
  58944. $2=$recv($3).__eq(true);
  58945. $ctx1.sendIdx["="]=1;
  58946. self._deny_($2);
  58947. $ctx1.sendIdx["deny:"]=1;
  58948. if(($receiver = nil) == null || $receiver.isNil){
  58949. $4=true;
  58950. } else {
  58951. $4=false;
  58952. }
  58953. self._assert_equals_($4,true);
  58954. if(($receiver = nil) == null || $receiver.isNil){
  58955. $6=false;
  58956. } else {
  58957. $6=true;
  58958. }
  58959. $5=$recv($6).__eq(true);
  58960. self._deny_($5);
  58961. return self;
  58962. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  58963. },
  58964. args: [],
  58965. 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",
  58966. referencedClasses: [],
  58967. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  58968. }),
  58969. $globals.UndefinedTest);
  58970. $core.addMethod(
  58971. $core.method({
  58972. selector: "testIsNil",
  58973. protocol: "tests",
  58974. fn: function (){
  58975. var self=this;
  58976. return $core.withContext(function($ctx1) {
  58977. self._assert_(nil._isNil());
  58978. self._deny_(nil._notNil());
  58979. return self;
  58980. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  58981. },
  58982. args: [],
  58983. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  58984. referencedClasses: [],
  58985. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  58986. }),
  58987. $globals.UndefinedTest);
  58988. });
  58989. define('amber_core/Platform-DOM-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  58990. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  58991. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  58992. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  58993. $core.addPackage("Platform-DOM-Tests");
  58994. $core.packages["Platform-DOM-Tests"].innerEval = function (expr) { return eval(expr); };
  58995. $core.packages["Platform-DOM-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  58996. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  58997. $core.addMethod(
  58998. $core.method({
  58999. selector: "testEntityConversion",
  59000. protocol: "testing",
  59001. fn: function (){
  59002. var self=this;
  59003. return $core.withContext(function($ctx1) {
  59004. var $1;
  59005. $1=$recv($globals.PlatformDom)._isFeasible();
  59006. if($core.assert($1)){
  59007. self._assert_equals_("&copy;"._htmlTextContent(),"©");
  59008. }
  59009. return self;
  59010. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{},$globals.PlatformDomTest)});
  59011. },
  59012. args: [],
  59013. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  59014. referencedClasses: ["PlatformDom"],
  59015. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  59016. }),
  59017. $globals.PlatformDomTest);
  59018. $core.addMethod(
  59019. $core.method({
  59020. selector: "testTextContentDoesNotRunScript",
  59021. protocol: "testing",
  59022. fn: function (){
  59023. var self=this;
  59024. return $core.withContext(function($ctx1) {
  59025. var $1;
  59026. $1=$recv($globals.PlatformDom)._isFeasible();
  59027. if($core.assert($1)){
  59028. self._shouldnt_raise_((function(){
  59029. return $core.withContext(function($ctx2) {
  59030. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  59031. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59032. }),$globals.Error);
  59033. }
  59034. return self;
  59035. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{},$globals.PlatformDomTest)});
  59036. },
  59037. args: [],
  59038. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  59039. referencedClasses: ["PlatformDom", "Error"],
  59040. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  59041. }),
  59042. $globals.PlatformDomTest);
  59043. });
  59044. define('amber_core/SUnit-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  59045. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  59046. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  59047. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  59048. $core.addPackage("SUnit-Tests");
  59049. $core.packages["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  59050. $core.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  59051. $core.addClass("ExampleSetTest", $globals.TestCase, ["empty", "full"], "SUnit-Tests");
  59052. $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.";
  59053. $core.addMethod(
  59054. $core.method({
  59055. selector: "setUp",
  59056. protocol: "running",
  59057. fn: function (){
  59058. var self=this;
  59059. return $core.withContext(function($ctx1) {
  59060. self["@empty"]=$recv($globals.Set)._new();
  59061. self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  59062. return self;
  59063. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  59064. },
  59065. args: [],
  59066. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  59067. referencedClasses: ["Set"],
  59068. messageSends: ["new", "with:with:"]
  59069. }),
  59070. $globals.ExampleSetTest);
  59071. $core.addMethod(
  59072. $core.method({
  59073. selector: "testAdd",
  59074. protocol: "tests",
  59075. fn: function (){
  59076. var self=this;
  59077. return $core.withContext(function($ctx1) {
  59078. $recv(self["@empty"])._add_((5));
  59079. self._assert_($recv(self["@empty"])._includes_((5)));
  59080. return self;
  59081. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  59082. },
  59083. args: [],
  59084. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  59085. referencedClasses: [],
  59086. messageSends: ["add:", "assert:", "includes:"]
  59087. }),
  59088. $globals.ExampleSetTest);
  59089. $core.addMethod(
  59090. $core.method({
  59091. selector: "testGrow",
  59092. protocol: "tests",
  59093. fn: function (){
  59094. var self=this;
  59095. return $core.withContext(function($ctx1) {
  59096. $recv(self["@empty"])._addAll_((1)._to_((100)));
  59097. self._assert_equals_($recv(self["@empty"])._size(),(100));
  59098. return self;
  59099. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  59100. },
  59101. args: [],
  59102. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  59103. referencedClasses: [],
  59104. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  59105. }),
  59106. $globals.ExampleSetTest);
  59107. $core.addMethod(
  59108. $core.method({
  59109. selector: "testIllegal",
  59110. protocol: "tests",
  59111. fn: function (){
  59112. var self=this;
  59113. return $core.withContext(function($ctx1) {
  59114. self._should_raise_((function(){
  59115. return $core.withContext(function($ctx2) {
  59116. return $recv(self["@empty"])._at_((5));
  59117. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59118. }),$globals.Error);
  59119. $ctx1.sendIdx["should:raise:"]=1;
  59120. self._should_raise_((function(){
  59121. return $core.withContext(function($ctx2) {
  59122. return $recv(self["@empty"])._at_put_((5),"abc");
  59123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59124. }),$globals.Error);
  59125. return self;
  59126. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  59127. },
  59128. args: [],
  59129. 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",
  59130. referencedClasses: ["Error"],
  59131. messageSends: ["should:raise:", "at:", "at:put:"]
  59132. }),
  59133. $globals.ExampleSetTest);
  59134. $core.addMethod(
  59135. $core.method({
  59136. selector: "testIncludes",
  59137. protocol: "tests",
  59138. fn: function (){
  59139. var self=this;
  59140. return $core.withContext(function($ctx1) {
  59141. var $1;
  59142. $1=$recv(self["@full"])._includes_((5));
  59143. $ctx1.sendIdx["includes:"]=1;
  59144. self._assert_($1);
  59145. $ctx1.sendIdx["assert:"]=1;
  59146. self._assert_($recv(self["@full"])._includes_("abc"));
  59147. return self;
  59148. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  59149. },
  59150. args: [],
  59151. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  59152. referencedClasses: [],
  59153. messageSends: ["assert:", "includes:"]
  59154. }),
  59155. $globals.ExampleSetTest);
  59156. $core.addMethod(
  59157. $core.method({
  59158. selector: "testOccurrences",
  59159. protocol: "tests",
  59160. fn: function (){
  59161. var self=this;
  59162. return $core.withContext(function($ctx1) {
  59163. var $1,$2;
  59164. $1=$recv(self["@empty"])._occurrencesOf_((0));
  59165. $ctx1.sendIdx["occurrencesOf:"]=1;
  59166. self._assert_equals_($1,(0));
  59167. $ctx1.sendIdx["assert:equals:"]=1;
  59168. $2=$recv(self["@full"])._occurrencesOf_((5));
  59169. $ctx1.sendIdx["occurrencesOf:"]=2;
  59170. self._assert_equals_($2,(1));
  59171. $ctx1.sendIdx["assert:equals:"]=2;
  59172. $recv(self["@full"])._add_((5));
  59173. self._assert_equals_($recv(self["@full"])._occurrencesOf_((5)),(1));
  59174. return self;
  59175. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  59176. },
  59177. args: [],
  59178. 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",
  59179. referencedClasses: [],
  59180. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  59181. }),
  59182. $globals.ExampleSetTest);
  59183. $core.addMethod(
  59184. $core.method({
  59185. selector: "testRemove",
  59186. protocol: "tests",
  59187. fn: function (){
  59188. var self=this;
  59189. return $core.withContext(function($ctx1) {
  59190. var $1;
  59191. $recv(self["@full"])._remove_((5));
  59192. $1=$recv(self["@full"])._includes_("abc");
  59193. $ctx1.sendIdx["includes:"]=1;
  59194. self._assert_($1);
  59195. self._deny_($recv(self["@full"])._includes_((5)));
  59196. return self;
  59197. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  59198. },
  59199. args: [],
  59200. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  59201. referencedClasses: [],
  59202. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  59203. }),
  59204. $globals.ExampleSetTest);
  59205. $core.addClass("SUnitAsyncTest", $globals.TestCase, ["flag"], "SUnit-Tests");
  59206. $core.addMethod(
  59207. $core.method({
  59208. selector: "fakeError",
  59209. protocol: "helpers",
  59210. fn: function (){
  59211. var self=this;
  59212. return $core.withContext(function($ctx1) {
  59213. self["@flag"]="bad";
  59214. self._timeout_((30));
  59215. self["@flag"]=$recv(self._async_((function(){
  59216. return $core.withContext(function($ctx2) {
  59217. self["@flag"]="ok";
  59218. self["@flag"];
  59219. return self._error_("Intentional");
  59220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59221. })))._valueWithTimeout_((20));
  59222. return self;
  59223. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  59224. },
  59225. args: [],
  59226. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  59227. referencedClasses: [],
  59228. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  59229. }),
  59230. $globals.SUnitAsyncTest);
  59231. $core.addMethod(
  59232. $core.method({
  59233. selector: "fakeErrorFailingInTearDown",
  59234. protocol: "helpers",
  59235. fn: function (){
  59236. var self=this;
  59237. return $core.withContext(function($ctx1) {
  59238. self["@flag"]="bad";
  59239. self._timeout_((30));
  59240. self["@flag"]=$recv(self._async_((function(){
  59241. return $core.withContext(function($ctx2) {
  59242. return self._error_("Intentional");
  59243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59244. })))._valueWithTimeout_((20));
  59245. return self;
  59246. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  59247. },
  59248. args: [],
  59249. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  59250. referencedClasses: [],
  59251. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  59252. }),
  59253. $globals.SUnitAsyncTest);
  59254. $core.addMethod(
  59255. $core.method({
  59256. selector: "fakeFailure",
  59257. protocol: "helpers",
  59258. fn: function (){
  59259. var self=this;
  59260. return $core.withContext(function($ctx1) {
  59261. self["@flag"]="bad";
  59262. self._timeout_((30));
  59263. self["@flag"]=$recv(self._async_((function(){
  59264. return $core.withContext(function($ctx2) {
  59265. self["@flag"]="ok";
  59266. self["@flag"];
  59267. return self._assert_(false);
  59268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59269. })))._valueWithTimeout_((20));
  59270. return self;
  59271. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  59272. },
  59273. args: [],
  59274. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  59275. referencedClasses: [],
  59276. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  59277. }),
  59278. $globals.SUnitAsyncTest);
  59279. $core.addMethod(
  59280. $core.method({
  59281. selector: "fakeMultipleTimeoutFailing",
  59282. protocol: "helpers",
  59283. fn: function (){
  59284. var self=this;
  59285. return $core.withContext(function($ctx1) {
  59286. var $1;
  59287. self._timeout_((100));
  59288. $ctx1.sendIdx["timeout:"]=1;
  59289. $1=self._async_((function(){
  59290. return $core.withContext(function($ctx2) {
  59291. self._timeout_((20));
  59292. return $recv(self._async_((function(){
  59293. return $core.withContext(function($ctx3) {
  59294. return self._finished();
  59295. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  59296. })))._valueWithTimeout_((30));
  59297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59298. }));
  59299. $ctx1.sendIdx["async:"]=1;
  59300. $recv($1)._valueWithTimeout_((20));
  59301. $ctx1.sendIdx["valueWithTimeout:"]=1;
  59302. return self;
  59303. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  59304. },
  59305. args: [],
  59306. 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",
  59307. referencedClasses: [],
  59308. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  59309. }),
  59310. $globals.SUnitAsyncTest);
  59311. $core.addMethod(
  59312. $core.method({
  59313. selector: "fakeMultipleTimeoutPassing",
  59314. protocol: "helpers",
  59315. fn: function (){
  59316. var self=this;
  59317. return $core.withContext(function($ctx1) {
  59318. var $1;
  59319. self._timeout_((20));
  59320. $ctx1.sendIdx["timeout:"]=1;
  59321. $1=self._async_((function(){
  59322. return $core.withContext(function($ctx2) {
  59323. self._timeout_((40));
  59324. return $recv(self._async_((function(){
  59325. return $core.withContext(function($ctx3) {
  59326. return self._finished();
  59327. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  59328. })))._valueWithTimeout_((20));
  59329. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59330. }));
  59331. $ctx1.sendIdx["async:"]=1;
  59332. $recv($1)._valueWithTimeout_((10));
  59333. $ctx1.sendIdx["valueWithTimeout:"]=1;
  59334. return self;
  59335. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  59336. },
  59337. args: [],
  59338. 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",
  59339. referencedClasses: [],
  59340. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  59341. }),
  59342. $globals.SUnitAsyncTest);
  59343. $core.addMethod(
  59344. $core.method({
  59345. selector: "fakeTimeout",
  59346. protocol: "helpers",
  59347. fn: function (){
  59348. var self=this;
  59349. return $core.withContext(function($ctx1) {
  59350. self._timeout_((10));
  59351. $recv(self._async_((function(){
  59352. return $core.withContext(function($ctx2) {
  59353. return self._finished();
  59354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59355. })))._valueWithTimeout_((20));
  59356. return self;
  59357. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  59358. },
  59359. args: [],
  59360. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  59361. referencedClasses: [],
  59362. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  59363. }),
  59364. $globals.SUnitAsyncTest);
  59365. $core.addMethod(
  59366. $core.method({
  59367. selector: "selectorSetOf:",
  59368. protocol: "private",
  59369. fn: function (aCollection){
  59370. var self=this;
  59371. return $core.withContext(function($ctx1) {
  59372. return $recv($recv(aCollection)._collect_((function(each){
  59373. return $core.withContext(function($ctx2) {
  59374. return $recv(each)._selector();
  59375. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59376. })))._asSet();
  59377. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  59378. },
  59379. args: ["aCollection"],
  59380. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  59381. referencedClasses: [],
  59382. messageSends: ["asSet", "collect:", "selector"]
  59383. }),
  59384. $globals.SUnitAsyncTest);
  59385. $core.addMethod(
  59386. $core.method({
  59387. selector: "setUp",
  59388. protocol: "running",
  59389. fn: function (){
  59390. var self=this;
  59391. self["@flag"]="ok";
  59392. return self;
  59393. },
  59394. args: [],
  59395. source: "setUp\x0a\x09flag := 'ok'",
  59396. referencedClasses: [],
  59397. messageSends: []
  59398. }),
  59399. $globals.SUnitAsyncTest);
  59400. $core.addMethod(
  59401. $core.method({
  59402. selector: "tearDown",
  59403. protocol: "running",
  59404. fn: function (){
  59405. var self=this;
  59406. return $core.withContext(function($ctx1) {
  59407. self._assert_equals_("ok",self["@flag"]);
  59408. return self;
  59409. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  59410. },
  59411. args: [],
  59412. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  59413. referencedClasses: [],
  59414. messageSends: ["assert:equals:"]
  59415. }),
  59416. $globals.SUnitAsyncTest);
  59417. $core.addMethod(
  59418. $core.method({
  59419. selector: "testAsyncErrorsAndFailures",
  59420. protocol: "tests",
  59421. fn: function (){
  59422. var self=this;
  59423. var suite,runner,result,assertBlock;
  59424. return $core.withContext(function($ctx1) {
  59425. var $1,$2,$3,$4;
  59426. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  59427. return $core.withContext(function($ctx2) {
  59428. return $recv(self._class())._selector_(each);
  59429. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59430. }));
  59431. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  59432. self._timeout_((200));
  59433. result=$recv(runner)._result();
  59434. $ctx1.sendIdx["result"]=1;
  59435. assertBlock=self._async_((function(){
  59436. return $core.withContext(function($ctx2) {
  59437. $1=self._selectorSetOf_($recv(result)._errors());
  59438. $ctx2.sendIdx["selectorSetOf:"]=1;
  59439. $2=["fakeError"]._asSet();
  59440. $ctx2.sendIdx["asSet"]=1;
  59441. self._assert_equals_($1,$2);
  59442. $ctx2.sendIdx["assert:equals:"]=1;
  59443. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  59444. return self._finished();
  59445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59446. }));
  59447. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  59448. return $core.withContext(function($ctx2) {
  59449. $3=$recv($recv(ann)._result()).__eq_eq(result);
  59450. if($core.assert($3)){
  59451. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  59452. return $recv($4)._ifTrue_(assertBlock);
  59453. }
  59454. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  59455. }));
  59456. $recv(runner)._run();
  59457. return self;
  59458. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  59459. },
  59460. args: [],
  59461. 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",
  59462. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  59463. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  59464. }),
  59465. $globals.SUnitAsyncTest);
  59466. $core.addMethod(
  59467. $core.method({
  59468. selector: "testAsyncNeedsTimeout",
  59469. protocol: "tests",
  59470. fn: function (){
  59471. var self=this;
  59472. return $core.withContext(function($ctx1) {
  59473. self._should_raise_((function(){
  59474. return $core.withContext(function($ctx2) {
  59475. return self._async_((function(){
  59476. }));
  59477. $ctx2.sendIdx["async:"]=1;
  59478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59479. }),$globals.Error);
  59480. self._timeout_((0));
  59481. self._shouldnt_raise_((function(){
  59482. return $core.withContext(function($ctx2) {
  59483. return self._async_((function(){
  59484. }));
  59485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59486. }),$globals.Error);
  59487. self._finished();
  59488. return self;
  59489. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  59490. },
  59491. args: [],
  59492. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  59493. referencedClasses: ["Error"],
  59494. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  59495. }),
  59496. $globals.SUnitAsyncTest);
  59497. $core.addMethod(
  59498. $core.method({
  59499. selector: "testFinishedNeedsTimeout",
  59500. protocol: "tests",
  59501. fn: function (){
  59502. var self=this;
  59503. return $core.withContext(function($ctx1) {
  59504. self._should_raise_((function(){
  59505. return $core.withContext(function($ctx2) {
  59506. return self._finished();
  59507. $ctx2.sendIdx["finished"]=1;
  59508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59509. }),$globals.Error);
  59510. self._timeout_((0));
  59511. self._shouldnt_raise_((function(){
  59512. return $core.withContext(function($ctx2) {
  59513. return self._finished();
  59514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59515. }),$globals.Error);
  59516. return self;
  59517. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  59518. },
  59519. args: [],
  59520. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  59521. referencedClasses: ["Error"],
  59522. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  59523. }),
  59524. $globals.SUnitAsyncTest);
  59525. $core.addMethod(
  59526. $core.method({
  59527. selector: "testIsAsyncReturnsCorrectValues",
  59528. protocol: "tests",
  59529. fn: function (){
  59530. var self=this;
  59531. return $core.withContext(function($ctx1) {
  59532. var $1,$2;
  59533. $1=self._isAsync();
  59534. $ctx1.sendIdx["isAsync"]=1;
  59535. self._deny_($1);
  59536. $ctx1.sendIdx["deny:"]=1;
  59537. self._timeout_((0));
  59538. $2=self._isAsync();
  59539. $ctx1.sendIdx["isAsync"]=2;
  59540. self._assert_($2);
  59541. self._finished();
  59542. self._deny_(self._isAsync());
  59543. return self;
  59544. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  59545. },
  59546. args: [],
  59547. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  59548. referencedClasses: [],
  59549. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  59550. }),
  59551. $globals.SUnitAsyncTest);
  59552. $core.addMethod(
  59553. $core.method({
  59554. selector: "testPass",
  59555. protocol: "tests",
  59556. fn: function (){
  59557. var self=this;
  59558. return $core.withContext(function($ctx1) {
  59559. self["@flag"]="bad";
  59560. self._timeout_((10));
  59561. self["@flag"]=$recv(self._async_((function(){
  59562. return $core.withContext(function($ctx2) {
  59563. self._assert_(true);
  59564. self._finished();
  59565. self["@flag"]="ok";
  59566. return self["@flag"];
  59567. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59568. })))._valueWithTimeout_((5));
  59569. return self;
  59570. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  59571. },
  59572. args: [],
  59573. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  59574. referencedClasses: [],
  59575. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  59576. }),
  59577. $globals.SUnitAsyncTest);
  59578. $core.addMethod(
  59579. $core.method({
  59580. selector: "testTimeouts",
  59581. protocol: "tests",
  59582. fn: function (){
  59583. var self=this;
  59584. var suite,runner,result,assertBlock;
  59585. return $core.withContext(function($ctx1) {
  59586. var $1,$2,$3;
  59587. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  59588. return $core.withContext(function($ctx2) {
  59589. return $recv(self._class())._selector_(each);
  59590. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59591. }));
  59592. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  59593. self._timeout_((200));
  59594. result=$recv(runner)._result();
  59595. $ctx1.sendIdx["result"]=1;
  59596. assertBlock=self._async_((function(){
  59597. return $core.withContext(function($ctx2) {
  59598. $1=self._selectorSetOf_($recv(result)._errors());
  59599. $ctx2.sendIdx["selectorSetOf:"]=1;
  59600. self._assert_equals_($1,$recv($globals.Set)._new());
  59601. $ctx2.sendIdx["assert:equals:"]=1;
  59602. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  59603. return self._finished();
  59604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59605. }));
  59606. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  59607. return $core.withContext(function($ctx2) {
  59608. $2=$recv($recv(ann)._result()).__eq_eq(result);
  59609. if($core.assert($2)){
  59610. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  59611. return $recv($3)._ifTrue_(assertBlock);
  59612. }
  59613. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  59614. }));
  59615. $recv(runner)._run();
  59616. return self;
  59617. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  59618. },
  59619. args: [],
  59620. 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",
  59621. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  59622. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  59623. }),
  59624. $globals.SUnitAsyncTest);
  59625. $core.addMethod(
  59626. $core.method({
  59627. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  59628. protocol: "tests",
  59629. fn: function (){
  59630. var self=this;
  59631. var x;
  59632. return $core.withContext(function($ctx1) {
  59633. var $1;
  59634. self["@flag"]="bad";
  59635. self._timeout_((10));
  59636. x=(0);
  59637. $1=self._async_((function(){
  59638. return $core.withContext(function($ctx2) {
  59639. self._finished();
  59640. $ctx2.sendIdx["finished"]=1;
  59641. self["@flag"]="ok";
  59642. self["@flag"];
  59643. x=$recv(x).__plus((1));
  59644. $ctx2.sendIdx["+"]=1;
  59645. x;
  59646. return self._assert_equals_(x,(1));
  59647. $ctx2.sendIdx["assert:equals:"]=1;
  59648. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59649. }));
  59650. $ctx1.sendIdx["async:"]=1;
  59651. self["@flag"]=$recv($1)._valueWithTimeout_((0));
  59652. $ctx1.sendIdx["valueWithTimeout:"]=1;
  59653. self["@flag"]=$recv(self._async_((function(){
  59654. return $core.withContext(function($ctx2) {
  59655. self._finished();
  59656. self["@flag"]="ok";
  59657. self["@flag"];
  59658. x=$recv(x).__plus((1));
  59659. x;
  59660. return self._assert_equals_(x,(1));
  59661. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59662. })))._valueWithTimeout_((0));
  59663. return self;
  59664. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  59665. },
  59666. args: [],
  59667. 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.",
  59668. referencedClasses: [],
  59669. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  59670. }),
  59671. $globals.SUnitAsyncTest);
  59672. });
  59673. define('amber/devel',[
  59674. './lang',
  59675. './compatibility', // pre-fetch, dep of ./boot
  59676. './kernel-fundamentals', // pre-fetch, dep of ./boot
  59677. './kernel-language', // pre-fetch, dep of ./boot
  59678. './boot', // pre-fetch, dep of ./helpers
  59679. './helpers', // pre-fetch, dep of ./deploy
  59680. './deploy', // pre-fetch, dep of ./lang
  59681. // --- packages of the development only Amber begin here ---
  59682. 'amber_core/Platform-DOM',
  59683. 'amber_core/SUnit',
  59684. 'amber_core/Compiler-Tests',
  59685. 'amber_core/Kernel-Tests',
  59686. 'amber_core/Platform-DOM-Tests',
  59687. 'amber_core/SUnit-Tests'
  59688. // --- packages of the development only Amber end here ---
  59689. ], function (amber) {
  59690. return amber;
  59691. });
  59692. define('amber_cli/AmberCli',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  59693. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  59694. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  59695. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  59696. $core.addPackage("AmberCli");
  59697. $core.packages["AmberCli"].innerEval = function (expr) { return eval(expr); };
  59698. $core.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  59699. $core.addClass("AmberCli", $globals.Object, [], "AmberCli");
  59700. $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.";
  59701. $core.addMethod(
  59702. $core.method({
  59703. selector: "commandLineSwitches",
  59704. protocol: "commandline",
  59705. fn: function (){
  59706. var self=this;
  59707. var switches;
  59708. return $core.withContext(function($ctx1) {
  59709. switches=$recv($recv(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  59710. return $core.withContext(function($ctx2) {
  59711. return $recv(each)._selector();
  59712. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59713. }));
  59714. $ctx1.sendIdx["collect:"]=1;
  59715. switches=$recv(switches)._select_((function(each){
  59716. return $core.withContext(function($ctx2) {
  59717. return $recv(each)._match_("^[^:]*:$");
  59718. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  59719. }));
  59720. switches=$recv(switches)._collect_((function(each){
  59721. return $core.withContext(function($ctx2) {
  59722. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  59723. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  59724. }));
  59725. return switches;
  59726. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.klass)});
  59727. },
  59728. args: [],
  59729. 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",
  59730. referencedClasses: [],
  59731. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  59732. }),
  59733. $globals.AmberCli.klass);
  59734. $core.addMethod(
  59735. $core.method({
  59736. selector: "config:",
  59737. protocol: "commands",
  59738. fn: function (args){
  59739. var self=this;
  59740. return $core.withContext(function($ctx1) {
  59741. $recv($recv($globals.Configurator)._new())._start();
  59742. return self;
  59743. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.klass)});
  59744. },
  59745. args: ["args"],
  59746. source: "config: args\x0a\x09Configurator new start",
  59747. referencedClasses: ["Configurator"],
  59748. messageSends: ["start", "new"]
  59749. }),
  59750. $globals.AmberCli.klass);
  59751. $core.addMethod(
  59752. $core.method({
  59753. selector: "handleArguments:",
  59754. protocol: "commandline",
  59755. fn: function (args){
  59756. var self=this;
  59757. var selector;
  59758. return $core.withContext(function($ctx1) {
  59759. var $1;
  59760. $1=$recv(args)._first();
  59761. $ctx1.sendIdx["first"]=1;
  59762. selector=self._selectorForCommandLineSwitch_($1);
  59763. $recv(args)._remove_($recv(args)._first());
  59764. self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  59765. return self;
  59766. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.klass)});
  59767. },
  59768. args: ["args"],
  59769. 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)",
  59770. referencedClasses: ["Array"],
  59771. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  59772. }),
  59773. $globals.AmberCli.klass);
  59774. $core.addMethod(
  59775. $core.method({
  59776. selector: "help:",
  59777. protocol: "commands",
  59778. fn: function (args){
  59779. var self=this;
  59780. return $core.withContext(function($ctx1) {
  59781. $recv($globals.Transcript)._show_("Available commands");
  59782. $recv(self._commandLineSwitches())._do_((function(each){
  59783. return $core.withContext(function($ctx2) {
  59784. return $recv(console)._log_(each);
  59785. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59786. }));
  59787. return self;
  59788. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.klass)});
  59789. },
  59790. args: ["args"],
  59791. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  59792. referencedClasses: ["Transcript"],
  59793. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  59794. }),
  59795. $globals.AmberCli.klass);
  59796. $core.addMethod(
  59797. $core.method({
  59798. selector: "init:",
  59799. protocol: "commands",
  59800. fn: function (args){
  59801. var self=this;
  59802. return $core.withContext(function($ctx1) {
  59803. $recv($recv($globals.Initer)._new())._start();
  59804. return self;
  59805. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.klass)});
  59806. },
  59807. args: ["args"],
  59808. source: "init: args\x0a\x09Initer new start",
  59809. referencedClasses: ["Initer"],
  59810. messageSends: ["start", "new"]
  59811. }),
  59812. $globals.AmberCli.klass);
  59813. $core.addMethod(
  59814. $core.method({
  59815. selector: "main",
  59816. protocol: "startup",
  59817. fn: function (){
  59818. var self=this;
  59819. var args,packageJSON;
  59820. return $core.withContext(function($ctx1) {
  59821. var $7,$6,$5,$4,$3,$2,$1;
  59822. var $early={};
  59823. try {
  59824. packageJSON=$recv(require)._value_("../package.json");
  59825. $7=$recv(packageJSON)._version();
  59826. $ctx1.sendIdx["version"]=1;
  59827. $6="Welcome to Amber CLI version ".__comma($7);
  59828. $5=$recv($6).__comma(" (Amber ");
  59829. $ctx1.sendIdx[","]=5;
  59830. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  59831. $ctx1.sendIdx[","]=4;
  59832. $3=$recv($4).__comma(", NodeJS ");
  59833. $ctx1.sendIdx[","]=3;
  59834. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  59835. $ctx1.sendIdx[","]=2;
  59836. $1=$recv($2).__comma(").");
  59837. $ctx1.sendIdx[","]=1;
  59838. $recv($globals.Transcript)._show_($1);
  59839. args=$recv(process)._argv();
  59840. $recv(args)._removeFrom_to_((1),(2));
  59841. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  59842. return $core.withContext(function($ctx2) {
  59843. return self._help_(nil);
  59844. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59845. }),(function(){
  59846. return $core.withContext(function($ctx2) {
  59847. throw $early=[self._handleArguments_(args)];
  59848. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59849. }));
  59850. return self;
  59851. }
  59852. catch(e) {if(e===$early)return e[0]; throw e}
  59853. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON},$globals.AmberCli.klass)});
  59854. },
  59855. args: [],
  59856. 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]",
  59857. referencedClasses: ["Transcript", "Smalltalk"],
  59858. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  59859. }),
  59860. $globals.AmberCli.klass);
  59861. $core.addMethod(
  59862. $core.method({
  59863. selector: "repl:",
  59864. protocol: "commands",
  59865. fn: function (args){
  59866. var self=this;
  59867. return $core.withContext(function($ctx1) {
  59868. return $recv($recv($globals.Repl)._new())._createInterface();
  59869. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.klass)});
  59870. },
  59871. args: ["args"],
  59872. source: "repl: args\x0a\x09^ Repl new createInterface",
  59873. referencedClasses: ["Repl"],
  59874. messageSends: ["createInterface", "new"]
  59875. }),
  59876. $globals.AmberCli.klass);
  59877. $core.addMethod(
  59878. $core.method({
  59879. selector: "selectorForCommandLineSwitch:",
  59880. protocol: "commandline",
  59881. fn: function (aSwitch){
  59882. var self=this;
  59883. var command,selector;
  59884. return $core.withContext(function($ctx1) {
  59885. var $1;
  59886. $1=$recv(self._commandLineSwitches())._includes_(aSwitch);
  59887. if($core.assert($1)){
  59888. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  59889. return $core.withContext(function($ctx2) {
  59890. return $recv($recv(each)._second())._asUppercase();
  59891. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  59892. }))).__comma(":");
  59893. selector;
  59894. } else {
  59895. selector="help:";
  59896. selector;
  59897. }
  59898. return selector;
  59899. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.klass)});
  59900. },
  59901. args: ["aSwitch"],
  59902. 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",
  59903. referencedClasses: [],
  59904. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  59905. }),
  59906. $globals.AmberCli.klass);
  59907. $core.addMethod(
  59908. $core.method({
  59909. selector: "serve:",
  59910. protocol: "commands",
  59911. fn: function (args){
  59912. var self=this;
  59913. return $core.withContext(function($ctx1) {
  59914. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  59915. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.klass)});
  59916. },
  59917. args: ["args"],
  59918. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  59919. referencedClasses: ["FileServer"],
  59920. messageSends: ["start", "createServerWithArguments:"]
  59921. }),
  59922. $globals.AmberCli.klass);
  59923. $core.addMethod(
  59924. $core.method({
  59925. selector: "version:",
  59926. protocol: "commands",
  59927. fn: function (arguments_){
  59928. var self=this;
  59929. return self;
  59930. },
  59931. args: ["arguments"],
  59932. source: "version: arguments",
  59933. referencedClasses: [],
  59934. messageSends: []
  59935. }),
  59936. $globals.AmberCli.klass);
  59937. $core.addClass("BaseFileManipulator", $globals.Object, ["path", "fs"], "AmberCli");
  59938. $core.addMethod(
  59939. $core.method({
  59940. selector: "dirname",
  59941. protocol: "private",
  59942. fn: function (){
  59943. var self=this;
  59944. return $core.withContext(function($ctx1) {
  59945. return __dirname;
  59946. return self;
  59947. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  59948. },
  59949. args: [],
  59950. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  59951. referencedClasses: [],
  59952. messageSends: []
  59953. }),
  59954. $globals.BaseFileManipulator);
  59955. $core.addMethod(
  59956. $core.method({
  59957. selector: "initialize",
  59958. protocol: "initialization",
  59959. fn: function (){
  59960. var self=this;
  59961. return $core.withContext(function($ctx1) {
  59962. (
  59963. $ctx1.supercall = true,
  59964. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  59965. $ctx1.supercall = false;
  59966. self["@path"]=$recv(require)._value_("path");
  59967. $ctx1.sendIdx["value:"]=1;
  59968. self["@fs"]=$recv(require)._value_("fs");
  59969. return self;
  59970. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  59971. },
  59972. args: [],
  59973. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  59974. referencedClasses: [],
  59975. messageSends: ["initialize", "value:"]
  59976. }),
  59977. $globals.BaseFileManipulator);
  59978. $core.addMethod(
  59979. $core.method({
  59980. selector: "rootDirname",
  59981. protocol: "private",
  59982. fn: function (){
  59983. var self=this;
  59984. return $core.withContext(function($ctx1) {
  59985. return $recv(self["@path"])._join_with_(self._dirname(),"..");
  59986. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  59987. },
  59988. args: [],
  59989. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  59990. referencedClasses: [],
  59991. messageSends: ["join:with:", "dirname"]
  59992. }),
  59993. $globals.BaseFileManipulator);
  59994. $core.addClass("Configurator", $globals.BaseFileManipulator, [], "AmberCli");
  59995. $core.addMethod(
  59996. $core.method({
  59997. selector: "initialize",
  59998. protocol: "initialization",
  59999. fn: function (){
  60000. var self=this;
  60001. return $core.withContext(function($ctx1) {
  60002. (
  60003. $ctx1.supercall = true,
  60004. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  60005. $ctx1.supercall = false;
  60006. return self;
  60007. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  60008. },
  60009. args: [],
  60010. source: "initialize\x0a\x09super initialize",
  60011. referencedClasses: [],
  60012. messageSends: ["initialize"]
  60013. }),
  60014. $globals.Configurator);
  60015. $core.addMethod(
  60016. $core.method({
  60017. selector: "start",
  60018. protocol: "action",
  60019. fn: function (){
  60020. var self=this;
  60021. return $core.withContext(function($ctx1) {
  60022. var $receiver;
  60023. self._writeConfigThenDo_((function(err){
  60024. return $core.withContext(function($ctx2) {
  60025. if(($receiver = err) == null || $receiver.isNil){
  60026. return $recv(process)._exit();
  60027. } else {
  60028. return $recv(process)._exit_((111));
  60029. }
  60030. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  60031. }));
  60032. return self;
  60033. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  60034. },
  60035. args: [],
  60036. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  60037. referencedClasses: [],
  60038. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  60039. }),
  60040. $globals.Configurator);
  60041. $core.addMethod(
  60042. $core.method({
  60043. selector: "writeConfigThenDo:",
  60044. protocol: "action",
  60045. fn: function (aBlock){
  60046. var self=this;
  60047. return $core.withContext(function($ctx1) {
  60048. $recv($recv($recv(require)._value_("amber-dev"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  60049. return self;
  60050. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  60051. },
  60052. args: ["aBlock"],
  60053. source: "writeConfigThenDo: aBlock\x0a\x09(require value: 'amber-dev') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  60054. referencedClasses: [],
  60055. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  60056. }),
  60057. $globals.Configurator);
  60058. $core.addClass("FileServer", $globals.BaseFileManipulator, ["http", "url", "host", "port", "basePath", "util", "username", "password", "fallbackPage"], "AmberCli");
  60059. $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.";
  60060. $core.addMethod(
  60061. $core.method({
  60062. selector: "base64Decode:",
  60063. protocol: "private",
  60064. fn: function (aString){
  60065. var self=this;
  60066. return $core.withContext(function($ctx1) {
  60067. return (new Buffer(aString, "base64").toString());
  60068. return self;
  60069. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  60070. },
  60071. args: ["aString"],
  60072. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  60073. referencedClasses: [],
  60074. messageSends: []
  60075. }),
  60076. $globals.FileServer);
  60077. $core.addMethod(
  60078. $core.method({
  60079. selector: "basePath",
  60080. protocol: "accessing",
  60081. fn: function (){
  60082. var self=this;
  60083. return $core.withContext(function($ctx1) {
  60084. var $1,$receiver;
  60085. $1=self["@basePath"];
  60086. if(($receiver = $1) == null || $receiver.isNil){
  60087. return $recv(self._class())._defaultBasePath();
  60088. } else {
  60089. return $1;
  60090. }
  60091. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  60092. },
  60093. args: [],
  60094. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  60095. referencedClasses: [],
  60096. messageSends: ["ifNil:", "defaultBasePath", "class"]
  60097. }),
  60098. $globals.FileServer);
  60099. $core.addMethod(
  60100. $core.method({
  60101. selector: "basePath:",
  60102. protocol: "accessing",
  60103. fn: function (aString){
  60104. var self=this;
  60105. return $core.withContext(function($ctx1) {
  60106. self["@basePath"]=aString;
  60107. self._validateBasePath();
  60108. return self;
  60109. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  60110. },
  60111. args: ["aString"],
  60112. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  60113. referencedClasses: [],
  60114. messageSends: ["validateBasePath"]
  60115. }),
  60116. $globals.FileServer);
  60117. $core.addMethod(
  60118. $core.method({
  60119. selector: "checkDirectoryLayout",
  60120. protocol: "initialization",
  60121. fn: function (){
  60122. var self=this;
  60123. return $core.withContext(function($ctx1) {
  60124. var $1;
  60125. $1=$recv(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
  60126. if(!$core.assert($1)){
  60127. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  60128. $ctx1.sendIdx["warn:"]=1;
  60129. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  60130. $ctx1.sendIdx["warn:"]=2;
  60131. $recv(console)._warn_(" You can also specify a page to be served by default,");
  60132. $ctx1.sendIdx["warn:"]=3;
  60133. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  60134. }
  60135. return self;
  60136. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  60137. },
  60138. args: [],
  60139. 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.'].",
  60140. referencedClasses: [],
  60141. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  60142. }),
  60143. $globals.FileServer);
  60144. $core.addMethod(
  60145. $core.method({
  60146. selector: "fallbackPage",
  60147. protocol: "accessing",
  60148. fn: function (){
  60149. var self=this;
  60150. return self["@fallbackPage"];
  60151. },
  60152. args: [],
  60153. source: "fallbackPage\x0a\x09^ fallbackPage",
  60154. referencedClasses: [],
  60155. messageSends: []
  60156. }),
  60157. $globals.FileServer);
  60158. $core.addMethod(
  60159. $core.method({
  60160. selector: "fallbackPage:",
  60161. protocol: "accessing",
  60162. fn: function (aString){
  60163. var self=this;
  60164. self["@fallbackPage"]=aString;
  60165. return self;
  60166. },
  60167. args: ["aString"],
  60168. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  60169. referencedClasses: [],
  60170. messageSends: []
  60171. }),
  60172. $globals.FileServer);
  60173. $core.addMethod(
  60174. $core.method({
  60175. selector: "handleGETRequest:respondTo:",
  60176. protocol: "request handling",
  60177. fn: function (aRequest,aResponse){
  60178. var self=this;
  60179. var uri,filename;
  60180. return $core.withContext(function($ctx1) {
  60181. var $1;
  60182. uri=$recv(self["@url"])._parse_($recv(aRequest)._url());
  60183. filename=$recv(self["@path"])._join_with_(self._basePath(),$recv(uri)._pathname());
  60184. $recv(self["@fs"])._exists_do_(filename,(function(aBoolean){
  60185. return $core.withContext(function($ctx2) {
  60186. if($core.assert(aBoolean)){
  60187. $1=$recv($recv(self["@fs"])._statSync_(filename))._isDirectory();
  60188. if($core.assert($1)){
  60189. return self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  60190. } else {
  60191. return self._respondFileNamed_to_(filename,aResponse);
  60192. }
  60193. } else {
  60194. return self._respondNotFoundTo_(aResponse);
  60195. }
  60196. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  60197. }));
  60198. return self;
  60199. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  60200. },
  60201. args: ["aRequest", "aResponse"],
  60202. 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]]]",
  60203. referencedClasses: [],
  60204. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  60205. }),
  60206. $globals.FileServer);
  60207. $core.addMethod(
  60208. $core.method({
  60209. selector: "handleOPTIONSRequest:respondTo:",
  60210. protocol: "request handling",
  60211. fn: function (aRequest,aResponse){
  60212. var self=this;
  60213. return $core.withContext(function($ctx1) {
  60214. $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)]));
  60215. $recv(aResponse)._end();
  60216. return self;
  60217. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  60218. },
  60219. args: ["aRequest", "aResponse"],
  60220. 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",
  60221. referencedClasses: [],
  60222. messageSends: ["writeHead:options:", "end"]
  60223. }),
  60224. $globals.FileServer);
  60225. $core.addMethod(
  60226. $core.method({
  60227. selector: "handlePUTRequest:respondTo:",
  60228. protocol: "request handling",
  60229. fn: function (aRequest,aResponse){
  60230. var self=this;
  60231. var file,stream;
  60232. return $core.withContext(function($ctx1) {
  60233. var $1,$2,$3,$4;
  60234. $1=self._isAuthenticated_(aRequest);
  60235. if(!$core.assert($1)){
  60236. self._respondAuthenticationRequiredTo_(aResponse);
  60237. return nil;
  60238. }
  60239. file=".".__comma($recv(aRequest)._url());
  60240. $ctx1.sendIdx[","]=1;
  60241. stream=$recv(self["@fs"])._createWriteStream_(file);
  60242. $recv(stream)._on_do_("error",(function(error){
  60243. return $core.withContext(function($ctx2) {
  60244. $2=console;
  60245. $3="Error creating WriteStream for file ".__comma(file);
  60246. $ctx2.sendIdx[","]=2;
  60247. $recv($2)._warn_($3);
  60248. $ctx2.sendIdx["warn:"]=1;
  60249. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  60250. $ctx2.sendIdx["warn:"]=2;
  60251. $recv(console)._warn_(" The exact error is: ".__comma(error));
  60252. return self._respondNotCreatedTo_(aResponse);
  60253. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  60254. }));
  60255. $ctx1.sendIdx["on:do:"]=1;
  60256. $recv(stream)._on_do_("close",(function(){
  60257. return $core.withContext(function($ctx2) {
  60258. return self._respondCreatedTo_(aResponse);
  60259. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  60260. }));
  60261. $ctx1.sendIdx["on:do:"]=2;
  60262. $recv(aRequest)._setEncoding_("utf8");
  60263. $recv(aRequest)._on_do_("data",(function(data){
  60264. return $core.withContext(function($ctx2) {
  60265. return $recv(stream)._write_(data);
  60266. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  60267. }));
  60268. $ctx1.sendIdx["on:do:"]=3;
  60269. $recv(aRequest)._on_do_("end",(function(){
  60270. return $core.withContext(function($ctx2) {
  60271. $4=$recv(stream)._writable();
  60272. if($core.assert($4)){
  60273. return $recv(stream)._end();
  60274. }
  60275. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  60276. }));
  60277. return self;
  60278. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  60279. },
  60280. args: ["aRequest", "aResponse"],
  60281. 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]]",
  60282. referencedClasses: [],
  60283. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  60284. }),
  60285. $globals.FileServer);
  60286. $core.addMethod(
  60287. $core.method({
  60288. selector: "handleRequest:respondTo:",
  60289. protocol: "request handling",
  60290. fn: function (aRequest,aResponse){
  60291. var self=this;
  60292. return $core.withContext(function($ctx1) {
  60293. var $2,$1,$4,$3,$5;
  60294. $2=$recv(aRequest)._method();
  60295. $ctx1.sendIdx["method"]=1;
  60296. $1=$recv($2).__eq("PUT");
  60297. $ctx1.sendIdx["="]=1;
  60298. if($core.assert($1)){
  60299. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  60300. }
  60301. $4=$recv(aRequest)._method();
  60302. $ctx1.sendIdx["method"]=2;
  60303. $3=$recv($4).__eq("GET");
  60304. $ctx1.sendIdx["="]=2;
  60305. if($core.assert($3)){
  60306. self._handleGETRequest_respondTo_(aRequest,aResponse);
  60307. }
  60308. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  60309. if($core.assert($5)){
  60310. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  60311. }
  60312. return self;
  60313. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  60314. },
  60315. args: ["aRequest", "aResponse"],
  60316. 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]",
  60317. referencedClasses: [],
  60318. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  60319. }),
  60320. $globals.FileServer);
  60321. $core.addMethod(
  60322. $core.method({
  60323. selector: "host",
  60324. protocol: "accessing",
  60325. fn: function (){
  60326. var self=this;
  60327. return self["@host"];
  60328. },
  60329. args: [],
  60330. source: "host\x0a\x09^ host",
  60331. referencedClasses: [],
  60332. messageSends: []
  60333. }),
  60334. $globals.FileServer);
  60335. $core.addMethod(
  60336. $core.method({
  60337. selector: "host:",
  60338. protocol: "accessing",
  60339. fn: function (hostname){
  60340. var self=this;
  60341. self["@host"]=hostname;
  60342. return self;
  60343. },
  60344. args: ["hostname"],
  60345. source: "host: hostname\x0a\x09host := hostname",
  60346. referencedClasses: [],
  60347. messageSends: []
  60348. }),
  60349. $globals.FileServer);
  60350. $core.addMethod(
  60351. $core.method({
  60352. selector: "initialize",
  60353. protocol: "initialization",
  60354. fn: function (){
  60355. var self=this;
  60356. return $core.withContext(function($ctx1) {
  60357. var $1;
  60358. (
  60359. $ctx1.supercall = true,
  60360. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  60361. $ctx1.supercall = false;
  60362. self["@http"]=self._require_("http");
  60363. $ctx1.sendIdx["require:"]=1;
  60364. self["@util"]=self._require_("util");
  60365. $ctx1.sendIdx["require:"]=2;
  60366. self["@url"]=self._require_("url");
  60367. $1=self._class();
  60368. $ctx1.sendIdx["class"]=1;
  60369. self["@host"]=$recv($1)._defaultHost();
  60370. self["@port"]=$recv(self._class())._defaultPort();
  60371. self["@username"]=nil;
  60372. self["@password"]=nil;
  60373. self["@fallbackPage"]=nil;
  60374. return self;
  60375. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  60376. },
  60377. args: [],
  60378. 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.",
  60379. referencedClasses: [],
  60380. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  60381. }),
  60382. $globals.FileServer);
  60383. $core.addMethod(
  60384. $core.method({
  60385. selector: "isAuthenticated:",
  60386. protocol: "private",
  60387. fn: function (aRequest){
  60388. var self=this;
  60389. var header,token,auth,parts;
  60390. return $core.withContext(function($ctx1) {
  60391. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  60392. var $early={};
  60393. try {
  60394. $2=$recv(self["@username"])._isNil();
  60395. $ctx1.sendIdx["isNil"]=1;
  60396. $1=$recv($2)._and_((function(){
  60397. return $core.withContext(function($ctx2) {
  60398. return $recv(self["@password"])._isNil();
  60399. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60400. }));
  60401. $ctx1.sendIdx["and:"]=1;
  60402. if($core.assert($1)){
  60403. return true;
  60404. }
  60405. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  60406. $ctx1.sendIdx["at:"]=1;
  60407. if(($receiver = $3) == null || $receiver.isNil){
  60408. header="";
  60409. } else {
  60410. header=$3;
  60411. }
  60412. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  60413. throw $early=[false];
  60414. }),(function(){
  60415. return $core.withContext(function($ctx2) {
  60416. $4=$recv(header)._tokenize_(" ");
  60417. $ctx2.sendIdx["tokenize:"]=1;
  60418. if(($receiver = $4) == null || $receiver.isNil){
  60419. token="";
  60420. } else {
  60421. token=$4;
  60422. }
  60423. token;
  60424. $5=$recv(token)._at_((2));
  60425. $ctx2.sendIdx["at:"]=2;
  60426. auth=self._base64Decode_($5);
  60427. auth;
  60428. parts=$recv(auth)._tokenize_(":");
  60429. parts;
  60430. $8=self["@username"];
  60431. $9=$recv(parts)._at_((1));
  60432. $ctx2.sendIdx["at:"]=3;
  60433. $7=$recv($8).__eq($9);
  60434. $ctx2.sendIdx["="]=1;
  60435. $6=$recv($7)._and_((function(){
  60436. return $core.withContext(function($ctx3) {
  60437. return $recv(self["@password"]).__eq($recv(parts)._at_((2)));
  60438. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  60439. }));
  60440. if($core.assert($6)){
  60441. throw $early=[true];
  60442. } else {
  60443. throw $early=[false];
  60444. }
  60445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  60446. }));
  60447. return self;
  60448. }
  60449. catch(e) {if(e===$early)return e[0]; throw e}
  60450. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  60451. },
  60452. args: ["aRequest"],
  60453. 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].",
  60454. referencedClasses: [],
  60455. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  60456. }),
  60457. $globals.FileServer);
  60458. $core.addMethod(
  60459. $core.method({
  60460. selector: "password:",
  60461. protocol: "accessing",
  60462. fn: function (aPassword){
  60463. var self=this;
  60464. self["@password"]=aPassword;
  60465. return self;
  60466. },
  60467. args: ["aPassword"],
  60468. source: "password: aPassword\x0a\x09password := aPassword.",
  60469. referencedClasses: [],
  60470. messageSends: []
  60471. }),
  60472. $globals.FileServer);
  60473. $core.addMethod(
  60474. $core.method({
  60475. selector: "port",
  60476. protocol: "accessing",
  60477. fn: function (){
  60478. var self=this;
  60479. return self["@port"];
  60480. },
  60481. args: [],
  60482. source: "port\x0a\x09^ port",
  60483. referencedClasses: [],
  60484. messageSends: []
  60485. }),
  60486. $globals.FileServer);
  60487. $core.addMethod(
  60488. $core.method({
  60489. selector: "port:",
  60490. protocol: "accessing",
  60491. fn: function (aNumber){
  60492. var self=this;
  60493. self["@port"]=aNumber;
  60494. return self;
  60495. },
  60496. args: ["aNumber"],
  60497. source: "port: aNumber\x0a\x09port := aNumber",
  60498. referencedClasses: [],
  60499. messageSends: []
  60500. }),
  60501. $globals.FileServer);
  60502. $core.addMethod(
  60503. $core.method({
  60504. selector: "require:",
  60505. protocol: "private",
  60506. fn: function (aModuleString){
  60507. var self=this;
  60508. return $core.withContext(function($ctx1) {
  60509. return $recv(require)._value_(aModuleString);
  60510. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  60511. },
  60512. args: ["aModuleString"],
  60513. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  60514. referencedClasses: [],
  60515. messageSends: ["value:"]
  60516. }),
  60517. $globals.FileServer);
  60518. $core.addMethod(
  60519. $core.method({
  60520. selector: "respondAuthenticationRequiredTo:",
  60521. protocol: "request handling",
  60522. fn: function (aResponse){
  60523. var self=this;
  60524. return $core.withContext(function($ctx1) {
  60525. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  60526. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  60527. $recv(aResponse)._end();
  60528. return self;
  60529. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  60530. },
  60531. args: ["aResponse"],
  60532. 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.",
  60533. referencedClasses: [],
  60534. messageSends: ["writeHead:options:", "write:", "end"]
  60535. }),
  60536. $globals.FileServer);
  60537. $core.addMethod(
  60538. $core.method({
  60539. selector: "respondCreatedTo:",
  60540. protocol: "request handling",
  60541. fn: function (aResponse){
  60542. var self=this;
  60543. return $core.withContext(function($ctx1) {
  60544. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  60545. $recv(aResponse)._end();
  60546. return self;
  60547. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  60548. },
  60549. args: ["aResponse"],
  60550. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  60551. referencedClasses: [],
  60552. messageSends: ["writeHead:options:", "end"]
  60553. }),
  60554. $globals.FileServer);
  60555. $core.addMethod(
  60556. $core.method({
  60557. selector: "respondDirectoryNamed:from:to:",
  60558. protocol: "request handling",
  60559. fn: function (aDirname,aUrl,aResponse){
  60560. var self=this;
  60561. return $core.withContext(function($ctx1) {
  60562. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  60563. $2=$recv(aUrl)._pathname();
  60564. $ctx1.sendIdx["pathname"]=1;
  60565. $1=$recv($2)._endsWith_("/");
  60566. if($core.assert($1)){
  60567. $3=$recv(aDirname).__comma("index.html");
  60568. $ctx1.sendIdx[","]=1;
  60569. self._respondFileNamed_to_($3,aResponse);
  60570. } else {
  60571. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  60572. $7=$recv(aUrl)._search();
  60573. if(($receiver = $7) == null || $receiver.isNil){
  60574. $6="";
  60575. } else {
  60576. $6=$7;
  60577. }
  60578. $4=$recv($5).__comma($6);
  60579. $ctx1.sendIdx[","]=2;
  60580. self._respondRedirect_to_($4,aResponse);
  60581. }
  60582. return self;
  60583. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  60584. },
  60585. args: ["aDirname", "aUrl", "aResponse"],
  60586. 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]",
  60587. referencedClasses: [],
  60588. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  60589. }),
  60590. $globals.FileServer);
  60591. $core.addMethod(
  60592. $core.method({
  60593. selector: "respondFileNamed:to:",
  60594. protocol: "request handling",
  60595. fn: function (aFilename,aResponse){
  60596. var self=this;
  60597. var type,filename;
  60598. return $core.withContext(function($ctx1) {
  60599. var $1,$2,$3,$4;
  60600. filename=aFilename;
  60601. $recv(self["@fs"])._readFile_do_(filename,(function(ex,file){
  60602. return $core.withContext(function($ctx2) {
  60603. $1=$recv(ex)._notNil();
  60604. if($core.assert($1)){
  60605. $2=console;
  60606. $3=$recv(filename).__comma(" does not exist");
  60607. $ctx2.sendIdx[","]=1;
  60608. $recv($2)._log_($3);
  60609. return self._respondNotFoundTo_(aResponse);
  60610. } else {
  60611. type=$recv(self._class())._mimeTypeFor_(filename);
  60612. type;
  60613. $4=$recv(type).__eq("application/javascript");
  60614. if($core.assert($4)){
  60615. type=$recv(type).__comma(";charset=utf-8");
  60616. type;
  60617. }
  60618. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  60619. $recv(aResponse)._write_encoding_(file,"binary");
  60620. return $recv(aResponse)._end();
  60621. }
  60622. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  60623. }));
  60624. return self;
  60625. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  60626. },
  60627. args: ["aFilename", "aResponse"],
  60628. 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]]",
  60629. referencedClasses: [],
  60630. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  60631. }),
  60632. $globals.FileServer);
  60633. $core.addMethod(
  60634. $core.method({
  60635. selector: "respondInternalErrorTo:",
  60636. protocol: "request handling",
  60637. fn: function (aResponse){
  60638. var self=this;
  60639. return $core.withContext(function($ctx1) {
  60640. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  60641. $recv(aResponse)._write_("500 Internal server error");
  60642. $recv(aResponse)._end();
  60643. return self;
  60644. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  60645. },
  60646. args: ["aResponse"],
  60647. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  60648. referencedClasses: [],
  60649. messageSends: ["writeHead:options:", "write:", "end"]
  60650. }),
  60651. $globals.FileServer);
  60652. $core.addMethod(
  60653. $core.method({
  60654. selector: "respondNotCreatedTo:",
  60655. protocol: "request handling",
  60656. fn: function (aResponse){
  60657. var self=this;
  60658. return $core.withContext(function($ctx1) {
  60659. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  60660. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  60661. $recv(aResponse)._end();
  60662. return self;
  60663. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  60664. },
  60665. args: ["aResponse"],
  60666. 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.",
  60667. referencedClasses: [],
  60668. messageSends: ["writeHead:options:", "write:", "end"]
  60669. }),
  60670. $globals.FileServer);
  60671. $core.addMethod(
  60672. $core.method({
  60673. selector: "respondNotFoundTo:",
  60674. protocol: "request handling",
  60675. fn: function (aResponse){
  60676. var self=this;
  60677. return $core.withContext(function($ctx1) {
  60678. var $2,$1;
  60679. $2=self._fallbackPage();
  60680. $ctx1.sendIdx["fallbackPage"]=1;
  60681. $1=$recv($2)._isNil();
  60682. if(!$core.assert($1)){
  60683. return self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  60684. }
  60685. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  60686. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  60687. $ctx1.sendIdx["write:"]=1;
  60688. $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>");
  60689. $ctx1.sendIdx["write:"]=2;
  60690. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  60691. $ctx1.sendIdx["write:"]=3;
  60692. $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>");
  60693. $ctx1.sendIdx["write:"]=4;
  60694. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  60695. $ctx1.sendIdx["write:"]=5;
  60696. $recv(aResponse)._write_("</ul></p></body></html>");
  60697. $recv(aResponse)._end();
  60698. return self;
  60699. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  60700. },
  60701. args: ["aResponse"],
  60702. 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",
  60703. referencedClasses: [],
  60704. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  60705. }),
  60706. $globals.FileServer);
  60707. $core.addMethod(
  60708. $core.method({
  60709. selector: "respondOKTo:",
  60710. protocol: "request handling",
  60711. fn: function (aResponse){
  60712. var self=this;
  60713. return $core.withContext(function($ctx1) {
  60714. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  60715. $recv(aResponse)._end();
  60716. return self;
  60717. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  60718. },
  60719. args: ["aResponse"],
  60720. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  60721. referencedClasses: [],
  60722. messageSends: ["writeHead:options:", "end"]
  60723. }),
  60724. $globals.FileServer);
  60725. $core.addMethod(
  60726. $core.method({
  60727. selector: "respondRedirect:to:",
  60728. protocol: "request handling",
  60729. fn: function (aString,aResponse){
  60730. var self=this;
  60731. return $core.withContext(function($ctx1) {
  60732. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  60733. $recv(aResponse)._end();
  60734. return self;
  60735. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  60736. },
  60737. args: ["aString", "aResponse"],
  60738. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  60739. referencedClasses: [],
  60740. messageSends: ["writeHead:options:", "end"]
  60741. }),
  60742. $globals.FileServer);
  60743. $core.addMethod(
  60744. $core.method({
  60745. selector: "start",
  60746. protocol: "starting",
  60747. fn: function (){
  60748. var self=this;
  60749. return $core.withContext(function($ctx1) {
  60750. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  60751. self._checkDirectoryLayout();
  60752. $1=$recv(self["@http"])._createServer_((function(request,response){
  60753. return $core.withContext(function($ctx2) {
  60754. return self._handleRequest_respondTo_(request,response);
  60755. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  60756. }));
  60757. $recv($1)._on_do_("error",(function(error){
  60758. return $core.withContext(function($ctx2) {
  60759. $2=console;
  60760. $3="Error starting server: ".__comma(error);
  60761. $ctx2.sendIdx[","]=1;
  60762. return $recv($2)._log_($3);
  60763. $ctx2.sendIdx["log:"]=1;
  60764. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  60765. }));
  60766. $ctx1.sendIdx["on:do:"]=1;
  60767. $recv($1)._on_do_("listening",(function(){
  60768. return $core.withContext(function($ctx2) {
  60769. $4=console;
  60770. $8=self._host();
  60771. $ctx2.sendIdx["host"]=1;
  60772. $7="Starting file server on http://".__comma($8);
  60773. $6=$recv($7).__comma(":");
  60774. $ctx2.sendIdx[","]=3;
  60775. $10=self._port();
  60776. $ctx2.sendIdx["port"]=1;
  60777. $9=$recv($10)._asString();
  60778. $5=$recv($6).__comma($9);
  60779. $ctx2.sendIdx[","]=2;
  60780. return $recv($4)._log_($5);
  60781. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  60782. }));
  60783. $recv($1)._listen_host_(self._port(),self._host());
  60784. return self;
  60785. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  60786. },
  60787. args: [],
  60788. 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.",
  60789. referencedClasses: [],
  60790. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  60791. }),
  60792. $globals.FileServer);
  60793. $core.addMethod(
  60794. $core.method({
  60795. selector: "startOn:",
  60796. protocol: "starting",
  60797. fn: function (aPort){
  60798. var self=this;
  60799. return $core.withContext(function($ctx1) {
  60800. self._port_(aPort);
  60801. self._start();
  60802. return self;
  60803. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  60804. },
  60805. args: ["aPort"],
  60806. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  60807. referencedClasses: [],
  60808. messageSends: ["port:", "start"]
  60809. }),
  60810. $globals.FileServer);
  60811. $core.addMethod(
  60812. $core.method({
  60813. selector: "username:",
  60814. protocol: "accessing",
  60815. fn: function (aUsername){
  60816. var self=this;
  60817. self["@username"]=aUsername;
  60818. return self;
  60819. },
  60820. args: ["aUsername"],
  60821. source: "username: aUsername\x0a\x09username := aUsername.",
  60822. referencedClasses: [],
  60823. messageSends: []
  60824. }),
  60825. $globals.FileServer);
  60826. $core.addMethod(
  60827. $core.method({
  60828. selector: "validateBasePath",
  60829. protocol: "private",
  60830. fn: function (){
  60831. var self=this;
  60832. return $core.withContext(function($ctx1) {
  60833. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  60834. $1=self["@fs"];
  60835. $2=self._basePath();
  60836. $ctx1.sendIdx["basePath"]=1;
  60837. $recv($1)._stat_then_($2,(function(err,stat){
  60838. return $core.withContext(function($ctx2) {
  60839. if(($receiver = err) == null || $receiver.isNil){
  60840. $3=$recv(stat)._isDirectory();
  60841. if(!$core.assert($3)){
  60842. $4=console;
  60843. $7=self._basePath();
  60844. $ctx2.sendIdx["basePath"]=2;
  60845. $6="Warning: --base-path parameter ".__comma($7);
  60846. $ctx2.sendIdx[","]=2;
  60847. $5=$recv($6).__comma(" is not a directory.");
  60848. $ctx2.sendIdx[","]=1;
  60849. return $recv($4)._warn_($5);
  60850. $ctx2.sendIdx["warn:"]=1;
  60851. }
  60852. } else {
  60853. $8=console;
  60854. $9=$recv("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
  60855. $ctx2.sendIdx[","]=3;
  60856. return $recv($8)._warn_($9);
  60857. }
  60858. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  60859. }));
  60860. return self;
  60861. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  60862. },
  60863. args: [],
  60864. 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.' ]].",
  60865. referencedClasses: [],
  60866. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  60867. }),
  60868. $globals.FileServer);
  60869. $core.addMethod(
  60870. $core.method({
  60871. selector: "withBasePath:",
  60872. protocol: "private",
  60873. fn: function (aBaseRelativePath){
  60874. var self=this;
  60875. return $core.withContext(function($ctx1) {
  60876. return $recv(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
  60877. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  60878. },
  60879. args: ["aBaseRelativePath"],
  60880. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  60881. referencedClasses: [],
  60882. messageSends: ["join:with:", "basePath"]
  60883. }),
  60884. $globals.FileServer);
  60885. $core.addMethod(
  60886. $core.method({
  60887. selector: "writeData:toFileNamed:",
  60888. protocol: "private",
  60889. fn: function (data,aFilename){
  60890. var self=this;
  60891. return $core.withContext(function($ctx1) {
  60892. $recv(console)._log_(aFilename);
  60893. return self;
  60894. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  60895. },
  60896. args: ["data", "aFilename"],
  60897. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  60898. referencedClasses: [],
  60899. messageSends: ["log:"]
  60900. }),
  60901. $globals.FileServer);
  60902. $globals.FileServer.klass.iVarNames = ["mimeTypes"];
  60903. $core.addMethod(
  60904. $core.method({
  60905. selector: "commandLineSwitches",
  60906. protocol: "accessing",
  60907. fn: function (){
  60908. var self=this;
  60909. var switches;
  60910. return $core.withContext(function($ctx1) {
  60911. switches=$recv(self._methodsInProtocol_("accessing"))._collect_((function(each){
  60912. return $core.withContext(function($ctx2) {
  60913. return $recv(each)._selector();
  60914. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60915. }));
  60916. $ctx1.sendIdx["collect:"]=1;
  60917. switches=$recv(switches)._select_((function(each){
  60918. return $core.withContext(function($ctx2) {
  60919. return $recv(each)._match_("^[^:]*:$");
  60920. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  60921. }));
  60922. switches=$recv(switches)._collect_((function(each){
  60923. return $core.withContext(function($ctx2) {
  60924. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  60925. $ctx2.sendIdx["replace:with:"]=1;
  60926. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  60927. }));
  60928. return switches;
  60929. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.klass)});
  60930. },
  60931. args: [],
  60932. 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",
  60933. referencedClasses: [],
  60934. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  60935. }),
  60936. $globals.FileServer.klass);
  60937. $core.addMethod(
  60938. $core.method({
  60939. selector: "createServerWithArguments:",
  60940. protocol: "initialization",
  60941. fn: function (options){
  60942. var self=this;
  60943. var server,popFront,front,optionName,optionValue,switches;
  60944. return $core.withContext(function($ctx1) {
  60945. var $1,$2,$3,$4,$5,$6,$7,$8;
  60946. var $early={};
  60947. try {
  60948. switches=self._commandLineSwitches();
  60949. server=self._new();
  60950. $recv(options)._ifEmpty_((function(){
  60951. throw $early=[server];
  60952. }));
  60953. $1=$recv($recv(options)._size())._even();
  60954. if(!$core.assert($1)){
  60955. $recv(console)._log_("Using default parameters.");
  60956. $ctx1.sendIdx["log:"]=1;
  60957. $2=console;
  60958. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  60959. $ctx1.sendIdx[","]=1;
  60960. $recv($2)._log_($3);
  60961. $ctx1.sendIdx["log:"]=2;
  60962. $4=console;
  60963. $5="Use any of the following ones: ".__comma(switches);
  60964. $ctx1.sendIdx[","]=2;
  60965. $recv($4)._log_($5);
  60966. $ctx1.sendIdx["log:"]=3;
  60967. return server;
  60968. }
  60969. popFront=(function(args){
  60970. return $core.withContext(function($ctx2) {
  60971. front=$recv(args)._first();
  60972. front;
  60973. $recv(args)._remove_(front);
  60974. return front;
  60975. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  60976. });
  60977. $recv((function(){
  60978. return $core.withContext(function($ctx2) {
  60979. return $recv(options)._notEmpty();
  60980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  60981. }))._whileTrue_((function(){
  60982. return $core.withContext(function($ctx2) {
  60983. optionName=$recv(popFront)._value_(options);
  60984. $ctx2.sendIdx["value:"]=1;
  60985. optionName;
  60986. optionValue=$recv(popFront)._value_(options);
  60987. optionValue;
  60988. $6=$recv(switches)._includes_(optionName);
  60989. if($core.assert($6)){
  60990. optionName=self._selectorForCommandLineSwitch_(optionName);
  60991. optionName;
  60992. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  60993. } else {
  60994. $7=console;
  60995. $8=$recv(optionName).__comma(" is not a valid commandline option");
  60996. $ctx2.sendIdx[","]=3;
  60997. $recv($7)._log_($8);
  60998. $ctx2.sendIdx["log:"]=4;
  60999. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  61000. }
  61001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  61002. }));
  61003. return server;
  61004. }
  61005. catch(e) {if(e===$early)return e[0]; throw e}
  61006. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.klass)});
  61007. },
  61008. args: ["options"],
  61009. 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.",
  61010. referencedClasses: ["Array"],
  61011. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  61012. }),
  61013. $globals.FileServer.klass);
  61014. $core.addMethod(
  61015. $core.method({
  61016. selector: "defaultBasePath",
  61017. protocol: "accessing",
  61018. fn: function (){
  61019. var self=this;
  61020. return "./";
  61021. },
  61022. args: [],
  61023. source: "defaultBasePath\x0a\x09^ './'",
  61024. referencedClasses: [],
  61025. messageSends: []
  61026. }),
  61027. $globals.FileServer.klass);
  61028. $core.addMethod(
  61029. $core.method({
  61030. selector: "defaultHost",
  61031. protocol: "accessing",
  61032. fn: function (){
  61033. var self=this;
  61034. return "127.0.0.1";
  61035. },
  61036. args: [],
  61037. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  61038. referencedClasses: [],
  61039. messageSends: []
  61040. }),
  61041. $globals.FileServer.klass);
  61042. $core.addMethod(
  61043. $core.method({
  61044. selector: "defaultMimeTypes",
  61045. protocol: "accessing",
  61046. fn: function (){
  61047. var self=this;
  61048. 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"]);
  61049. },
  61050. args: [],
  61051. 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}",
  61052. referencedClasses: [],
  61053. messageSends: []
  61054. }),
  61055. $globals.FileServer.klass);
  61056. $core.addMethod(
  61057. $core.method({
  61058. selector: "defaultPort",
  61059. protocol: "accessing",
  61060. fn: function (){
  61061. var self=this;
  61062. return (4000);
  61063. },
  61064. args: [],
  61065. source: "defaultPort\x0a\x09^ 4000",
  61066. referencedClasses: [],
  61067. messageSends: []
  61068. }),
  61069. $globals.FileServer.klass);
  61070. $core.addMethod(
  61071. $core.method({
  61072. selector: "main",
  61073. protocol: "initialization",
  61074. fn: function (){
  61075. var self=this;
  61076. var fileServer,args;
  61077. return $core.withContext(function($ctx1) {
  61078. var $1;
  61079. var $early={};
  61080. try {
  61081. args=$recv(process)._argv();
  61082. $recv(args)._removeFrom_to_((1),(3));
  61083. $recv(args)._detect_ifNone_((function(each){
  61084. return $core.withContext(function($ctx2) {
  61085. $1=$recv(each).__eq("--help");
  61086. if($core.assert($1)){
  61087. return $recv($globals.FileServer)._printHelp();
  61088. }
  61089. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61090. }),(function(){
  61091. return $core.withContext(function($ctx2) {
  61092. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  61093. fileServer;
  61094. throw $early=[$recv(fileServer)._start()];
  61095. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61096. }));
  61097. return self;
  61098. }
  61099. catch(e) {if(e===$early)return e[0]; throw e}
  61100. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.klass)});
  61101. },
  61102. args: [],
  61103. 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]",
  61104. referencedClasses: ["FileServer"],
  61105. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  61106. }),
  61107. $globals.FileServer.klass);
  61108. $core.addMethod(
  61109. $core.method({
  61110. selector: "mimeTypeFor:",
  61111. protocol: "accessing",
  61112. fn: function (aString){
  61113. var self=this;
  61114. return $core.withContext(function($ctx1) {
  61115. return $recv(self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  61116. return "text/plain";
  61117. }));
  61118. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.klass)});
  61119. },
  61120. args: ["aString"],
  61121. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  61122. referencedClasses: [],
  61123. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  61124. }),
  61125. $globals.FileServer.klass);
  61126. $core.addMethod(
  61127. $core.method({
  61128. selector: "mimeTypes",
  61129. protocol: "accessing",
  61130. fn: function (){
  61131. var self=this;
  61132. return $core.withContext(function($ctx1) {
  61133. var $1,$receiver;
  61134. $1=self["@mimeTypes"];
  61135. if(($receiver = $1) == null || $receiver.isNil){
  61136. self["@mimeTypes"]=self._defaultMimeTypes();
  61137. return self["@mimeTypes"];
  61138. } else {
  61139. return $1;
  61140. }
  61141. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.klass)});
  61142. },
  61143. args: [],
  61144. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  61145. referencedClasses: [],
  61146. messageSends: ["ifNil:", "defaultMimeTypes"]
  61147. }),
  61148. $globals.FileServer.klass);
  61149. $core.addMethod(
  61150. $core.method({
  61151. selector: "printHelp",
  61152. protocol: "accessing",
  61153. fn: function (){
  61154. var self=this;
  61155. return $core.withContext(function($ctx1) {
  61156. $recv(console)._log_("Available commandline options are:");
  61157. $ctx1.sendIdx["log:"]=1;
  61158. $recv(console)._log_("--help");
  61159. $ctx1.sendIdx["log:"]=2;
  61160. $recv(self._commandLineSwitches())._do_((function(each){
  61161. return $core.withContext(function($ctx2) {
  61162. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  61163. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61164. }));
  61165. return self;
  61166. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.klass)});
  61167. },
  61168. args: [],
  61169. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  61170. referencedClasses: [],
  61171. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  61172. }),
  61173. $globals.FileServer.klass);
  61174. $core.addMethod(
  61175. $core.method({
  61176. selector: "selectorForCommandLineSwitch:",
  61177. protocol: "accessing",
  61178. fn: function (aSwitch){
  61179. var self=this;
  61180. return $core.withContext(function($ctx1) {
  61181. var $1;
  61182. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  61183. return $core.withContext(function($ctx2) {
  61184. return $recv($recv(each)._second())._asUppercase();
  61185. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61186. }));
  61187. $ctx1.sendIdx["replace:with:"]=1;
  61188. return $recv($1).__comma(":");
  61189. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.klass)});
  61190. },
  61191. args: ["aSwitch"],
  61192. 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 ]), ':'",
  61193. referencedClasses: [],
  61194. messageSends: [",", "replace:with:", "asUppercase", "second"]
  61195. }),
  61196. $globals.FileServer.klass);
  61197. $core.addClass("Initer", $globals.BaseFileManipulator, ["childProcess", "nmPath"], "AmberCli");
  61198. $core.addMethod(
  61199. $core.method({
  61200. selector: "bowerInstallThenDo:",
  61201. protocol: "action",
  61202. fn: function (aBlock){
  61203. var self=this;
  61204. var child;
  61205. return $core.withContext(function($ctx1) {
  61206. var $1,$3,$2;
  61207. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("bower","bower"),["install"]);
  61208. $1=child;
  61209. $recv($1)._on_do_("error",aBlock);
  61210. $ctx1.sendIdx["on:do:"]=1;
  61211. $recv($1)._on_do_("close",(function(code){
  61212. return $core.withContext(function($ctx2) {
  61213. $3=$recv(code).__eq((0));
  61214. if($core.assert($3)){
  61215. $2=nil;
  61216. } else {
  61217. $2=code;
  61218. }
  61219. return $recv(aBlock)._value_($2);
  61220. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  61221. }));
  61222. return self;
  61223. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  61224. },
  61225. args: ["aBlock"],
  61226. source: "bowerInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'bower' named: 'bower')\x0a\x09\x09args: #('install').\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  61227. referencedClasses: [],
  61228. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  61229. }),
  61230. $globals.Initer);
  61231. $core.addMethod(
  61232. $core.method({
  61233. selector: "finishMessage",
  61234. protocol: "action",
  61235. fn: function (){
  61236. var self=this;
  61237. return $core.withContext(function($ctx1) {
  61238. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  61239. $recv((function(){
  61240. }))._valueWithTimeout_((600));
  61241. return self;
  61242. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  61243. },
  61244. args: [],
  61245. 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",
  61246. referencedClasses: ["String"],
  61247. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  61248. }),
  61249. $globals.Initer);
  61250. $core.addMethod(
  61251. $core.method({
  61252. selector: "gruntInitThenDo:",
  61253. protocol: "action",
  61254. fn: function (aBlock){
  61255. var self=this;
  61256. var child,sanitizedTemplatePath;
  61257. return $core.withContext(function($ctx1) {
  61258. var $1,$3,$2;
  61259. sanitizedTemplatePath=$recv($recv($recv(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  61260. $ctx1.sendIdx["replace:with:"]=1;
  61261. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  61262. $1=child;
  61263. $recv($1)._on_do_("error",aBlock);
  61264. $ctx1.sendIdx["on:do:"]=1;
  61265. $recv($1)._on_do_("close",(function(code){
  61266. return $core.withContext(function($ctx2) {
  61267. $3=$recv(code).__eq((0));
  61268. if($core.assert($3)){
  61269. $2=nil;
  61270. } else {
  61271. $2=code;
  61272. }
  61273. return $recv(aBlock)._value_($2);
  61274. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  61275. }));
  61276. return self;
  61277. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  61278. },
  61279. args: ["aBlock"],
  61280. source: "gruntInitThenDo: aBlock\x0a\x09| child sanitizedTemplatePath |\x0a\x09sanitizedTemplatePath := ((path join: nmPath with: 'grunt-init-amber')\x0a\x09\x09replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:'.\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-init' named: 'grunt-init')\x0a\x09\x09args: {sanitizedTemplatePath}.\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  61281. referencedClasses: [],
  61282. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  61283. }),
  61284. $globals.Initer);
  61285. $core.addMethod(
  61286. $core.method({
  61287. selector: "gruntThenDo:",
  61288. protocol: "action",
  61289. fn: function (aBlock){
  61290. var self=this;
  61291. var child;
  61292. return $core.withContext(function($ctx1) {
  61293. var $1,$3,$2;
  61294. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  61295. $1=child;
  61296. $recv($1)._on_do_("error",aBlock);
  61297. $ctx1.sendIdx["on:do:"]=1;
  61298. $recv($1)._on_do_("close",(function(code){
  61299. return $core.withContext(function($ctx2) {
  61300. $3=$recv(code).__eq((0));
  61301. if($core.assert($3)){
  61302. $2=nil;
  61303. } else {
  61304. $2=code;
  61305. }
  61306. return $recv(aBlock)._value_($2);
  61307. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  61308. }));
  61309. return self;
  61310. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  61311. },
  61312. args: ["aBlock"],
  61313. source: "gruntThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-cli' named: 'grunt')\x0a\x09\x09args: #('default' 'devel').\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  61314. referencedClasses: [],
  61315. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  61316. }),
  61317. $globals.Initer);
  61318. $core.addMethod(
  61319. $core.method({
  61320. selector: "initialize",
  61321. protocol: "initialization",
  61322. fn: function (){
  61323. var self=this;
  61324. return $core.withContext(function($ctx1) {
  61325. (
  61326. $ctx1.supercall = true,
  61327. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  61328. $ctx1.supercall = false;
  61329. self["@childProcess"]=$recv(require)._value_("child_process");
  61330. self["@nmPath"]=$recv(self["@path"])._join_with_(self._rootDirname(),"node_modules");
  61331. return self;
  61332. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  61333. },
  61334. args: [],
  61335. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  61336. referencedClasses: [],
  61337. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  61338. }),
  61339. $globals.Initer);
  61340. $core.addMethod(
  61341. $core.method({
  61342. selector: "npmInstallThenDo:",
  61343. protocol: "action",
  61344. fn: function (aBlock){
  61345. var self=this;
  61346. var child;
  61347. return $core.withContext(function($ctx1) {
  61348. var $1;
  61349. child=$recv(self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  61350. $1=$recv(child)._stdout();
  61351. $ctx1.sendIdx["stdout"]=1;
  61352. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  61353. return self;
  61354. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  61355. },
  61356. args: ["aBlock"],
  61357. source: "npmInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: 'npm install'\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
  61358. referencedClasses: [],
  61359. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  61360. }),
  61361. $globals.Initer);
  61362. $core.addMethod(
  61363. $core.method({
  61364. selector: "npmScriptForModule:named:",
  61365. protocol: "npm",
  61366. fn: function (aString,anotherString){
  61367. var self=this;
  61368. var modulePath,packageJson,binSection,scriptPath;
  61369. return $core.withContext(function($ctx1) {
  61370. var $1,$3,$4,$2,$5;
  61371. $1=self["@path"];
  61372. $3=$recv($globals.JSObjectProxy)._on_(require);
  61373. $4=$recv(aString).__comma("/package.json");
  61374. $ctx1.sendIdx[","]=1;
  61375. $2=$recv($3)._resolve_($4);
  61376. modulePath=$recv($1)._dirname_($2);
  61377. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  61378. binSection=$recv(packageJson)._at_("bin");
  61379. $ctx1.sendIdx["at:"]=1;
  61380. $5=$recv(binSection)._isString();
  61381. if($core.assert($5)){
  61382. scriptPath=binSection;
  61383. } else {
  61384. scriptPath=$recv(binSection)._at_(anotherString);
  61385. }
  61386. return $recv(self["@path"])._join_with_(modulePath,scriptPath);
  61387. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  61388. },
  61389. args: ["aString", "anotherString"],
  61390. source: "npmScriptForModule: aString named: anotherString\x0a\x09| modulePath packageJson binSection scriptPath |\x0a\x09modulePath := path dirname: (\x0a\x09\x09(JSObjectProxy on: require)\x0a\x09\x09\x09resolve: aString, '/package.json').\x0a\x09packageJson := Smalltalk readJSObject: (\x0a\x09\x09require value: aString, '/package.json').\x0a\x09binSection := packageJson at: 'bin'.\x0a\x09scriptPath := binSection isString\x0a\x09\x09ifTrue: [ binSection ]\x0a\x09\x09ifFalse: [ binSection at: anotherString ].\x0a\x09^ path join: modulePath with: scriptPath",
  61391. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  61392. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  61393. }),
  61394. $globals.Initer);
  61395. $core.addMethod(
  61396. $core.method({
  61397. selector: "start",
  61398. protocol: "action",
  61399. fn: function (){
  61400. var self=this;
  61401. return $core.withContext(function($ctx1) {
  61402. var $1,$2,$3,$4,$5,$6,$7,$receiver;
  61403. self._gruntInitThenDo_((function(error){
  61404. return $core.withContext(function($ctx2) {
  61405. if(($receiver = error) == null || $receiver.isNil){
  61406. return self._bowerInstallThenDo_((function(error2){
  61407. return $core.withContext(function($ctx3) {
  61408. if(($receiver = error2) == null || $receiver.isNil){
  61409. return self._npmInstallThenDo_((function(error3){
  61410. return $core.withContext(function($ctx4) {
  61411. if(($receiver = error3) == null || $receiver.isNil){
  61412. return self._gruntThenDo_((function(error4){
  61413. return $core.withContext(function($ctx5) {
  61414. if(($receiver = error4) == null || $receiver.isNil){
  61415. self._finishMessage();
  61416. return $recv(process)._exit();
  61417. } else {
  61418. $7=console;
  61419. $recv($7)._log_("grunt exec error:");
  61420. $ctx5.sendIdx["log:"]=7;
  61421. $recv($7)._log_(error4);
  61422. return $recv(process)._exit_((104));
  61423. }
  61424. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  61425. }));
  61426. } else {
  61427. $5=console;
  61428. $recv($5)._log_("npm install exec error:");
  61429. $ctx4.sendIdx["log:"]=5;
  61430. $6=$recv($5)._log_(error3);
  61431. $ctx4.sendIdx["log:"]=6;
  61432. $6;
  61433. return $recv(process)._exit_((103));
  61434. $ctx4.sendIdx["exit:"]=3;
  61435. }
  61436. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  61437. }));
  61438. } else {
  61439. $3=console;
  61440. $recv($3)._log_("bower install exec error:");
  61441. $ctx3.sendIdx["log:"]=3;
  61442. $4=$recv($3)._log_(error2);
  61443. $ctx3.sendIdx["log:"]=4;
  61444. $4;
  61445. return $recv(process)._exit_((102));
  61446. $ctx3.sendIdx["exit:"]=2;
  61447. }
  61448. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  61449. }));
  61450. } else {
  61451. $1=console;
  61452. $recv($1)._log_("grunt-init exec error:");
  61453. $ctx2.sendIdx["log:"]=1;
  61454. $2=$recv($1)._log_(error);
  61455. $ctx2.sendIdx["log:"]=2;
  61456. $2;
  61457. return $recv(process)._exit_((101));
  61458. $ctx2.sendIdx["exit:"]=1;
  61459. }
  61460. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  61461. }));
  61462. return self;
  61463. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  61464. },
  61465. args: [],
  61466. source: "start\x0a\x09self gruntInitThenDo: [ :error | error\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt-init exec error:'; log: error.\x0a\x09\x09process exit: 101 ]\x0a\x09ifNil: [\x0a\x0a\x09self bowerInstallThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'bower install exec error:'; log: error2.\x0a\x09\x09process exit: 102 ]\x0a\x09ifNil: [\x0a\x0a\x09self npmInstallThenDo: [ :error3 | error3\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm install exec error:'; log: error3.\x0a\x09\x09process exit: 103 ]\x0a\x09ifNil: [\x0a\x0a\x09self gruntThenDo: [ :error4 | error4\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt exec error:'; log: error4.\x0a\x09\x09process exit: 104 ]\x0a\x09ifNil: [\x0a\x0a\x09self finishMessage.\x0a\x09process exit ]]]]]]]]",
  61467. referencedClasses: [],
  61468. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  61469. }),
  61470. $globals.Initer);
  61471. $core.addClass("Repl", $globals.Object, ["readline", "interface", "util", "session", "resultCount", "commands"], "AmberCli");
  61472. $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.";
  61473. $core.addMethod(
  61474. $core.method({
  61475. selector: "addVariableNamed:to:",
  61476. protocol: "private",
  61477. fn: function (aString,anObject){
  61478. var self=this;
  61479. var newClass,newObject;
  61480. return $core.withContext(function($ctx1) {
  61481. newClass=self._subclass_withVariable_($recv(anObject)._class(),aString);
  61482. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  61483. newObject=$recv(newClass)._new();
  61484. self._setPreviousVariablesFor_from_(newObject,anObject);
  61485. return newObject;
  61486. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  61487. },
  61488. args: ["aString", "anObject"],
  61489. 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",
  61490. referencedClasses: [],
  61491. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  61492. }),
  61493. $globals.Repl);
  61494. $core.addMethod(
  61495. $core.method({
  61496. selector: "assignNewVariable:do:",
  61497. protocol: "private",
  61498. fn: function (buffer,aBlock){
  61499. var self=this;
  61500. return $core.withContext(function($ctx1) {
  61501. var $2,$3,$1,$receiver;
  61502. return self._parseAssignment_do_(buffer,(function(name,expr){
  61503. var varName,value;
  61504. return $core.withContext(function($ctx2) {
  61505. if(($receiver = name) == null || $receiver.isNil){
  61506. varName=self._nextResultName();
  61507. } else {
  61508. varName=name;
  61509. }
  61510. varName;
  61511. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  61512. self["@session"];
  61513. $recv((function(){
  61514. return $core.withContext(function($ctx3) {
  61515. $2=$recv(varName).__comma(" := ");
  61516. if(($receiver = expr) == null || $receiver.isNil){
  61517. $3=buffer;
  61518. } else {
  61519. $3=expr;
  61520. }
  61521. $1=$recv($2).__comma($3);
  61522. $ctx3.sendIdx[","]=1;
  61523. value=self._eval_on_($1,self["@session"]);
  61524. return value;
  61525. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  61526. }))._on_do_($globals.Error,(function(e){
  61527. return $core.withContext(function($ctx3) {
  61528. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  61529. value=nil;
  61530. return value;
  61531. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  61532. }));
  61533. return $recv(aBlock)._value_value_(varName,value);
  61534. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  61535. }));
  61536. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  61537. },
  61538. args: ["buffer", "aBlock"],
  61539. 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]",
  61540. referencedClasses: ["Error", "ConsoleErrorHandler"],
  61541. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  61542. }),
  61543. $globals.Repl);
  61544. $core.addMethod(
  61545. $core.method({
  61546. selector: "clearScreen",
  61547. protocol: "actions",
  61548. fn: function (){
  61549. var self=this;
  61550. var esc,cls;
  61551. return $core.withContext(function($ctx1) {
  61552. var $1;
  61553. esc=$recv($globals.String)._fromCharCode_((27));
  61554. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  61555. $ctx1.sendIdx[","]=2;
  61556. cls=$recv($1).__comma("[0;0f");
  61557. $ctx1.sendIdx[","]=1;
  61558. $recv($recv(process)._stdout())._write_(cls);
  61559. $recv(self["@interface"])._prompt();
  61560. return self;
  61561. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  61562. },
  61563. args: [],
  61564. 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",
  61565. referencedClasses: ["String"],
  61566. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  61567. }),
  61568. $globals.Repl);
  61569. $core.addMethod(
  61570. $core.method({
  61571. selector: "close",
  61572. protocol: "actions",
  61573. fn: function (){
  61574. var self=this;
  61575. return $core.withContext(function($ctx1) {
  61576. $recv($recv(process)._stdin())._destroy();
  61577. return self;
  61578. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  61579. },
  61580. args: [],
  61581. source: "close\x0a\x09process stdin destroy",
  61582. referencedClasses: [],
  61583. messageSends: ["destroy", "stdin"]
  61584. }),
  61585. $globals.Repl);
  61586. $core.addMethod(
  61587. $core.method({
  61588. selector: "commands",
  61589. protocol: "accessing",
  61590. fn: function (){
  61591. var self=this;
  61592. return self["@commands"];
  61593. },
  61594. args: [],
  61595. source: "commands\x0a\x09^ commands",
  61596. referencedClasses: [],
  61597. messageSends: []
  61598. }),
  61599. $globals.Repl);
  61600. $core.addMethod(
  61601. $core.method({
  61602. selector: "createInterface",
  61603. protocol: "actions",
  61604. fn: function (){
  61605. var self=this;
  61606. return $core.withContext(function($ctx1) {
  61607. self["@interface"]=$recv(self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  61608. $recv(self["@interface"])._on_do_("line",(function(buffer){
  61609. return $core.withContext(function($ctx2) {
  61610. return self._processLine_(buffer);
  61611. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  61612. }));
  61613. $ctx1.sendIdx["on:do:"]=1;
  61614. $recv(self["@interface"])._on_do_("close",(function(){
  61615. return $core.withContext(function($ctx2) {
  61616. return self._close();
  61617. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61618. }));
  61619. self._printWelcome();
  61620. self._setupHotkeys();
  61621. self._setPrompt();
  61622. $recv(self["@interface"])._prompt();
  61623. return self;
  61624. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  61625. },
  61626. args: [],
  61627. 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",
  61628. referencedClasses: [],
  61629. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  61630. }),
  61631. $globals.Repl);
  61632. $core.addMethod(
  61633. $core.method({
  61634. selector: "encapsulateVariable:withValue:in:",
  61635. protocol: "private",
  61636. fn: function (aString,anObject,aClass){
  61637. var self=this;
  61638. var compiler;
  61639. return $core.withContext(function($ctx1) {
  61640. var $1,$4,$3,$2,$5,$6;
  61641. compiler=$recv($globals.Compiler)._new();
  61642. $1=compiler;
  61643. $4=$recv(aString).__comma(": anObject ^ ");
  61644. $ctx1.sendIdx[","]=3;
  61645. $3=$recv($4).__comma(aString);
  61646. $ctx1.sendIdx[","]=2;
  61647. $2=$recv($3).__comma(" := anObject");
  61648. $ctx1.sendIdx[","]=1;
  61649. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  61650. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  61651. $5=compiler;
  61652. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  61653. $ctx1.sendIdx[","]=4;
  61654. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  61655. return self;
  61656. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  61657. },
  61658. args: ["aString", "anObject", "aClass"],
  61659. 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'.",
  61660. referencedClasses: ["Compiler"],
  61661. messageSends: ["new", "install:forClass:protocol:", ","]
  61662. }),
  61663. $globals.Repl);
  61664. $core.addMethod(
  61665. $core.method({
  61666. selector: "eval:",
  61667. protocol: "actions",
  61668. fn: function (buffer){
  61669. var self=this;
  61670. return $core.withContext(function($ctx1) {
  61671. return self._eval_on_(buffer,$recv($globals.DoIt)._new());
  61672. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  61673. },
  61674. args: ["buffer"],
  61675. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  61676. referencedClasses: ["DoIt"],
  61677. messageSends: ["eval:on:", "new"]
  61678. }),
  61679. $globals.Repl);
  61680. $core.addMethod(
  61681. $core.method({
  61682. selector: "eval:on:",
  61683. protocol: "actions",
  61684. fn: function (buffer,anObject){
  61685. var self=this;
  61686. var result;
  61687. return $core.withContext(function($ctx1) {
  61688. var $1;
  61689. $recv(buffer)._ifNotEmpty_((function(){
  61690. return $core.withContext(function($ctx2) {
  61691. return $recv((function(){
  61692. return $core.withContext(function($ctx3) {
  61693. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  61694. return result;
  61695. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61696. }))._tryCatch_((function(e){
  61697. return $core.withContext(function($ctx3) {
  61698. $1=$recv(e)._isSmalltalkError();
  61699. if($core.assert($1)){
  61700. return $recv(e)._resignal();
  61701. } else {
  61702. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  61703. }
  61704. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  61705. }));
  61706. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61707. }));
  61708. return result;
  61709. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  61710. },
  61711. args: ["buffer", "anObject"],
  61712. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer ifNotEmpty: [\x0a\x09\x09[result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09\x09tryCatch: [:e |\x0a\x09\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09\x09\x09ifTrue: [ e resignal ]\x0a\x09\x09\x09\x09\x09ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  61713. referencedClasses: ["Compiler"],
  61714. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  61715. }),
  61716. $globals.Repl);
  61717. $core.addMethod(
  61718. $core.method({
  61719. selector: "executeCommand:",
  61720. protocol: "private",
  61721. fn: function (aString){
  61722. var self=this;
  61723. return $core.withContext(function($ctx1) {
  61724. var $1;
  61725. var $early={};
  61726. try {
  61727. $recv(self._commands())._keysAndValuesDo_((function(names,cmd){
  61728. return $core.withContext(function($ctx2) {
  61729. $1=$recv(names)._includes_(aString);
  61730. if($core.assert($1)){
  61731. $recv(cmd)._value();
  61732. throw $early=[true];
  61733. }
  61734. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  61735. }));
  61736. return false;
  61737. }
  61738. catch(e) {if(e===$early)return e[0]; throw e}
  61739. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  61740. },
  61741. args: ["aString"],
  61742. 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",
  61743. referencedClasses: [],
  61744. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  61745. }),
  61746. $globals.Repl);
  61747. $core.addMethod(
  61748. $core.method({
  61749. selector: "initialize",
  61750. protocol: "initialization",
  61751. fn: function (){
  61752. var self=this;
  61753. return $core.withContext(function($ctx1) {
  61754. (
  61755. $ctx1.supercall = true,
  61756. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  61757. $ctx1.supercall = false;
  61758. self["@session"]=$recv($globals.DoIt)._new();
  61759. self["@readline"]=$recv(require)._value_("readline");
  61760. $ctx1.sendIdx["value:"]=1;
  61761. self["@util"]=$recv(require)._value_("util");
  61762. self._setupCommands();
  61763. return self;
  61764. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  61765. },
  61766. args: [],
  61767. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  61768. referencedClasses: ["DoIt"],
  61769. messageSends: ["initialize", "new", "value:", "setupCommands"]
  61770. }),
  61771. $globals.Repl);
  61772. $core.addMethod(
  61773. $core.method({
  61774. selector: "instanceVariableNamesFor:",
  61775. protocol: "private",
  61776. fn: function (aClass){
  61777. var self=this;
  61778. return $core.withContext(function($ctx1) {
  61779. var $1,$2,$receiver;
  61780. $1=$recv(aClass)._superclass();
  61781. $ctx1.sendIdx["superclass"]=1;
  61782. if(($receiver = $1) == null || $receiver.isNil){
  61783. return $recv(aClass)._instanceVariableNames();
  61784. } else {
  61785. $2=$recv(aClass)._instanceVariableNames();
  61786. $ctx1.sendIdx["instanceVariableNames"]=1;
  61787. return $recv($2)._copyWithAll_(self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  61788. }
  61789. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  61790. },
  61791. args: ["aClass"],
  61792. 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]",
  61793. referencedClasses: [],
  61794. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  61795. }),
  61796. $globals.Repl);
  61797. $core.addMethod(
  61798. $core.method({
  61799. selector: "isIdentifier:",
  61800. protocol: "private",
  61801. fn: function (aString){
  61802. var self=this;
  61803. return $core.withContext(function($ctx1) {
  61804. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  61805. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  61806. },
  61807. args: ["aString"],
  61808. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  61809. referencedClasses: [],
  61810. messageSends: ["match:", "asRegexp"]
  61811. }),
  61812. $globals.Repl);
  61813. $core.addMethod(
  61814. $core.method({
  61815. selector: "isVariableDefined:",
  61816. protocol: "private",
  61817. fn: function (aString){
  61818. var self=this;
  61819. return $core.withContext(function($ctx1) {
  61820. return $recv(self._instanceVariableNamesFor_($recv(self["@session"])._class()))._includes_(aString);
  61821. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  61822. },
  61823. args: ["aString"],
  61824. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  61825. referencedClasses: [],
  61826. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  61827. }),
  61828. $globals.Repl);
  61829. $core.addMethod(
  61830. $core.method({
  61831. selector: "nextResultName",
  61832. protocol: "private",
  61833. fn: function (){
  61834. var self=this;
  61835. return $core.withContext(function($ctx1) {
  61836. var $1,$receiver;
  61837. $1=self["@resultCount"];
  61838. if(($receiver = $1) == null || $receiver.isNil){
  61839. self["@resultCount"]=(1);
  61840. } else {
  61841. self["@resultCount"]=$recv(self["@resultCount"]).__plus((1));
  61842. }
  61843. return "res".__comma($recv(self["@resultCount"])._asString());
  61844. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  61845. },
  61846. args: [],
  61847. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  61848. referencedClasses: [],
  61849. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  61850. }),
  61851. $globals.Repl);
  61852. $core.addMethod(
  61853. $core.method({
  61854. selector: "onKeyPress:",
  61855. protocol: "private",
  61856. fn: function (key){
  61857. var self=this;
  61858. return $core.withContext(function($ctx1) {
  61859. var $1;
  61860. $1=$recv($recv(key)._ctrl())._and_((function(){
  61861. return $core.withContext(function($ctx2) {
  61862. return $recv($recv(key)._name()).__eq("l");
  61863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61864. }));
  61865. if($core.assert($1)){
  61866. self._clearScreen();
  61867. }
  61868. return self;
  61869. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  61870. },
  61871. args: ["key"],
  61872. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  61873. referencedClasses: [],
  61874. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  61875. }),
  61876. $globals.Repl);
  61877. $core.addMethod(
  61878. $core.method({
  61879. selector: "parseAssignment:do:",
  61880. protocol: "private",
  61881. fn: function (aString,aBlock){
  61882. var self=this;
  61883. var assignment;
  61884. return $core.withContext(function($ctx1) {
  61885. var $2,$1;
  61886. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  61887. return $core.withContext(function($ctx2) {
  61888. return $recv(s)._trimBoth();
  61889. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  61890. }));
  61891. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  61892. return $core.withContext(function($ctx2) {
  61893. $2=$recv(assignment)._first();
  61894. $ctx2.sendIdx["first"]=1;
  61895. return self._isIdentifier_($2);
  61896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61897. }));
  61898. if($core.assert($1)){
  61899. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  61900. $ctx1.sendIdx["value:value:"]=1;
  61901. } else {
  61902. return $recv(aBlock)._value_value_(nil,nil);
  61903. }
  61904. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  61905. },
  61906. args: ["aString", "aBlock"],
  61907. 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 ]",
  61908. referencedClasses: [],
  61909. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  61910. }),
  61911. $globals.Repl);
  61912. $core.addMethod(
  61913. $core.method({
  61914. selector: "presentResultNamed:withValue:",
  61915. protocol: "private",
  61916. fn: function (varName,value){
  61917. var self=this;
  61918. return $core.withContext(function($ctx1) {
  61919. var $3,$2,$1;
  61920. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  61921. $ctx1.sendIdx[","]=3;
  61922. $2=$recv($3).__comma(" = ");
  61923. $ctx1.sendIdx[","]=2;
  61924. $1=$recv($2).__comma($recv(value)._asString());
  61925. $ctx1.sendIdx[","]=1;
  61926. $recv($globals.Transcript)._show_($1);
  61927. $recv($globals.Transcript)._cr();
  61928. $recv(self["@interface"])._prompt();
  61929. return self;
  61930. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  61931. },
  61932. args: ["varName", "value"],
  61933. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  61934. referencedClasses: ["Transcript"],
  61935. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  61936. }),
  61937. $globals.Repl);
  61938. $core.addMethod(
  61939. $core.method({
  61940. selector: "printWelcome",
  61941. protocol: "actions",
  61942. fn: function (){
  61943. var self=this;
  61944. return $core.withContext(function($ctx1) {
  61945. $recv($globals.Transcript)._show_("Type :q to exit.");
  61946. $recv($globals.Transcript)._cr();
  61947. return self;
  61948. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  61949. },
  61950. args: [],
  61951. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  61952. referencedClasses: ["Transcript"],
  61953. messageSends: ["show:", "cr"]
  61954. }),
  61955. $globals.Repl);
  61956. $core.addMethod(
  61957. $core.method({
  61958. selector: "processLine:",
  61959. protocol: "private",
  61960. fn: function (buffer){
  61961. var self=this;
  61962. var show;
  61963. return $core.withContext(function($ctx1) {
  61964. var $1,$2;
  61965. show=(function(varName,value){
  61966. return $core.withContext(function($ctx2) {
  61967. return self._presentResultNamed_withValue_(varName,value);
  61968. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  61969. });
  61970. $1=self._executeCommand_(buffer);
  61971. if(!$core.assert($1)){
  61972. $2=self._isVariableDefined_(buffer);
  61973. if($core.assert($2)){
  61974. $recv(show)._value_value_(buffer,$recv(self["@session"])._perform_(buffer));
  61975. } else {
  61976. self._assignNewVariable_do_(buffer,show);
  61977. }
  61978. }
  61979. return self;
  61980. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  61981. },
  61982. args: ["buffer"],
  61983. 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]]",
  61984. referencedClasses: [],
  61985. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  61986. }),
  61987. $globals.Repl);
  61988. $core.addMethod(
  61989. $core.method({
  61990. selector: "prompt",
  61991. protocol: "accessing",
  61992. fn: function (){
  61993. var self=this;
  61994. return "amber >> ";
  61995. },
  61996. args: [],
  61997. source: "prompt\x0a\x09^ 'amber >> '",
  61998. referencedClasses: [],
  61999. messageSends: []
  62000. }),
  62001. $globals.Repl);
  62002. $core.addMethod(
  62003. $core.method({
  62004. selector: "setPreviousVariablesFor:from:",
  62005. protocol: "private",
  62006. fn: function (newObject,oldObject){
  62007. var self=this;
  62008. return $core.withContext(function($ctx1) {
  62009. $recv(self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  62010. return $core.withContext(function($ctx2) {
  62011. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  62012. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62013. }));
  62014. return self;
  62015. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  62016. },
  62017. args: ["newObject", "oldObject"],
  62018. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  62019. referencedClasses: [],
  62020. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  62021. }),
  62022. $globals.Repl);
  62023. $core.addMethod(
  62024. $core.method({
  62025. selector: "setPrompt",
  62026. protocol: "actions",
  62027. fn: function (){
  62028. var self=this;
  62029. return $core.withContext(function($ctx1) {
  62030. $recv(self["@interface"])._setPrompt_(self._prompt());
  62031. return self;
  62032. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  62033. },
  62034. args: [],
  62035. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  62036. referencedClasses: [],
  62037. messageSends: ["setPrompt:", "prompt"]
  62038. }),
  62039. $globals.Repl);
  62040. $core.addMethod(
  62041. $core.method({
  62042. selector: "setupCommands",
  62043. protocol: "initialization",
  62044. fn: function (){
  62045. var self=this;
  62046. return $core.withContext(function($ctx1) {
  62047. var $2,$1;
  62048. $2=$recv([":q"]).__minus_gt((function(){
  62049. return $core.withContext(function($ctx2) {
  62050. return $recv(process)._exit();
  62051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62052. }));
  62053. $ctx1.sendIdx["->"]=1;
  62054. $1=[$2,$recv([""]).__minus_gt((function(){
  62055. return $core.withContext(function($ctx2) {
  62056. return $recv(self["@interface"])._prompt();
  62057. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  62058. }))];
  62059. self["@commands"]=$recv($globals.Dictionary)._from_($1);
  62060. return self;
  62061. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  62062. },
  62063. args: [],
  62064. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  62065. referencedClasses: ["Dictionary"],
  62066. messageSends: ["from:", "->", "exit", "prompt"]
  62067. }),
  62068. $globals.Repl);
  62069. $core.addMethod(
  62070. $core.method({
  62071. selector: "setupHotkeys",
  62072. protocol: "initialization",
  62073. fn: function (){
  62074. var self=this;
  62075. return $core.withContext(function($ctx1) {
  62076. var $receiver;
  62077. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  62078. return $core.withContext(function($ctx2) {
  62079. if(($receiver = key) == null || $receiver.isNil){
  62080. return key;
  62081. } else {
  62082. return self._onKeyPress_(key);
  62083. }
  62084. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  62085. }));
  62086. return self;
  62087. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  62088. },
  62089. args: [],
  62090. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  62091. referencedClasses: [],
  62092. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  62093. }),
  62094. $globals.Repl);
  62095. $core.addMethod(
  62096. $core.method({
  62097. selector: "subclass:withVariable:",
  62098. protocol: "private",
  62099. fn: function (aClass,varName){
  62100. var self=this;
  62101. return $core.withContext(function($ctx1) {
  62102. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  62103. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  62104. },
  62105. args: ["aClass", "varName"],
  62106. 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'",
  62107. referencedClasses: ["ClassBuilder"],
  62108. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  62109. }),
  62110. $globals.Repl);
  62111. $core.addMethod(
  62112. $core.method({
  62113. selector: "subclassNameFor:",
  62114. protocol: "private",
  62115. fn: function (aClass){
  62116. var self=this;
  62117. return $core.withContext(function($ctx1) {
  62118. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  62119. $2=$recv(aClass)._name();
  62120. $ctx1.sendIdx["name"]=1;
  62121. $1=$recv($2)._matchesOf_("\x5cd+$");
  62122. $ctx1.sendIdx["matchesOf:"]=1;
  62123. if(($receiver = $1) == null || $receiver.isNil){
  62124. return $recv($recv(aClass)._name()).__comma("2");
  62125. } else {
  62126. var counter;
  62127. $6=$recv(aClass)._name();
  62128. $ctx1.sendIdx["name"]=2;
  62129. $5=$recv($6)._matchesOf_("\x5cd+$");
  62130. $4=$recv($5)._first();
  62131. $3=$recv($4)._asNumber();
  62132. counter=$recv($3).__plus((1));
  62133. counter;
  62134. $7=$recv(aClass)._name();
  62135. $ctx1.sendIdx["name"]=3;
  62136. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  62137. }
  62138. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  62139. },
  62140. args: ["aClass"],
  62141. 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'].",
  62142. referencedClasses: [],
  62143. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  62144. }),
  62145. $globals.Repl);
  62146. $core.addMethod(
  62147. $core.method({
  62148. selector: "main",
  62149. protocol: "initialization",
  62150. fn: function (){
  62151. var self=this;
  62152. return $core.withContext(function($ctx1) {
  62153. $recv(self._new())._createInterface();
  62154. return self;
  62155. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.klass)});
  62156. },
  62157. args: [],
  62158. source: "main\x0a\x09self new createInterface",
  62159. referencedClasses: [],
  62160. messageSends: ["createInterface", "new"]
  62161. }),
  62162. $globals.Repl.klass);
  62163. });
  62164. (function () {
  62165. define('app',["amber/devel", "amber_cli/AmberCli"], function (amber) {
  62166. amber.initialize().then(function () {
  62167. amber.globals.AmberCli._main();
  62168. });
  62169. });
  62170. }());
  62171. //jshint eqnull:true
  62172. define('amber/kernel-runtime',[],function () {
  62173. "use strict";
  62174. function defineMethod (klass, name, method) {
  62175. Object.defineProperty(klass.prototype, name, {
  62176. value: method,
  62177. enumerable: false, configurable: true, writable: true
  62178. });
  62179. }
  62180. DNUBrik.deps = ["selectors", "messageSend", "manipulation", "classes"];
  62181. function DNUBrik (brikz, st) {
  62182. var selectorsBrik = brikz.selectors;
  62183. var messageNotUnderstood = brikz.messageSend.messageNotUnderstood;
  62184. var installJSMethod = brikz.manipulation.installJSMethod;
  62185. var nilAsClass = brikz.classes.nilAsClass;
  62186. /* Method not implemented handlers */
  62187. function makeDnuHandler (pair, targetClasses) {
  62188. var jsSelector = pair.js;
  62189. var fn = createHandler(pair.st);
  62190. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  62191. targetClasses.forEach(function (target) {
  62192. installJSMethod(target.fn.prototype, jsSelector, fn);
  62193. });
  62194. }
  62195. this.makeDnuHandler = makeDnuHandler;
  62196. /* Dnu handler method */
  62197. function createHandler (stSelector) {
  62198. return function () {
  62199. return messageNotUnderstood(this, stSelector, arguments);
  62200. };
  62201. }
  62202. selectorsBrik.selectorPairs.forEach(function (pair) {
  62203. makeDnuHandler(pair, []);
  62204. });
  62205. }
  62206. function ManipulationBrik (brikz, st) {
  62207. function installJSMethod (obj, jsSelector, fn) {
  62208. Object.defineProperty(obj, jsSelector, {
  62209. value: fn,
  62210. enumerable: false, configurable: true, writable: true
  62211. });
  62212. }
  62213. function installMethod (method, klass) {
  62214. installJSMethod(klass.fn.prototype, method.jsSelector, method.fn);
  62215. }
  62216. this.installMethod = installMethod;
  62217. this.installJSMethod = installJSMethod;
  62218. }
  62219. RuntimeClassesBrik.deps = ["selectors", "dnu", "behaviors", "classes", "manipulation"];
  62220. function RuntimeClassesBrik (brikz, st) {
  62221. var selectors = brikz.selectors;
  62222. var classes = brikz.behaviors.classes;
  62223. var wireKlass = brikz.classes.wireKlass;
  62224. var installMethod = brikz.manipulation.installMethod;
  62225. var installJSMethod = brikz.manipulation.installJSMethod;
  62226. var detachedRootClasses = [];
  62227. function markClassDetachedRoot (klass) {
  62228. klass.detachedRoot = true;
  62229. detachedRootClasses = classes().filter(function (klass) {
  62230. return klass.detachedRoot;
  62231. });
  62232. }
  62233. this.detachedRootClasses = function () {
  62234. return detachedRootClasses;
  62235. };
  62236. /* Initialize a class in its class hierarchy. Handle both classes and
  62237. metaclasses. */
  62238. function initClassAndMetaclass (klass) {
  62239. initClass(klass);
  62240. if (klass.klass && !klass.meta) {
  62241. initClass(klass.klass);
  62242. }
  62243. }
  62244. classes().forEach(function (klass) {
  62245. if (!klass.trait) initClassAndMetaclass(klass);
  62246. });
  62247. st._classAdded = initClassAndMetaclass;
  62248. function initClass (klass) {
  62249. wireKlass(klass);
  62250. if (klass.detachedRoot) {
  62251. copySuperclass(klass);
  62252. }
  62253. installMethods(klass);
  62254. }
  62255. function copySuperclass (klass) {
  62256. var myproto = klass.fn.prototype,
  62257. superproto = klass.superclass.fn.prototype;
  62258. selectors.selectorPairs.forEach(function (selectorPair) {
  62259. var jsSelector = selectorPair.js;
  62260. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  62261. });
  62262. }
  62263. function installMethods (klass) {
  62264. var methods = klass.methods;
  62265. Object.keys(methods).forEach(function (selector) {
  62266. installMethod(methods[selector], klass);
  62267. });
  62268. }
  62269. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  62270. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  62271. markClassDetachedRoot(klass);
  62272. klass.fn = constructor;
  62273. initClass(klass);
  62274. };
  62275. }
  62276. FrameBindingBrik.deps = ["smalltalkGlobals", "runtimeClasses"];
  62277. function FrameBindingBrik (brikz, st) {
  62278. var globals = brikz.smalltalkGlobals.globals;
  62279. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  62280. setClassConstructor(globals.Number, Number);
  62281. setClassConstructor(globals.BlockClosure, Function);
  62282. setClassConstructor(globals.Boolean, Boolean);
  62283. setClassConstructor(globals.Date, Date);
  62284. setClassConstructor(globals.String, String);
  62285. setClassConstructor(globals.Array, Array);
  62286. setClassConstructor(globals.RegularExpression, RegExp);
  62287. setClassConstructor(globals.Error, Error);
  62288. setClassConstructor(globals.Promise, Promise);
  62289. this.__init__ = function () {
  62290. st.alias(globals.Array, "OrderedCollection");
  62291. st.alias(globals.Date, "Time");
  62292. }
  62293. }
  62294. RuntimeMethodsBrik.deps = ["manipulation", "dnu", "runtimeClasses"];
  62295. function RuntimeMethodsBrik (brikz, st) {
  62296. var installMethod = brikz.manipulation.installMethod;
  62297. var installJSMethod = brikz.manipulation.installJSMethod;
  62298. var makeDnuHandler = brikz.dnu.makeDnuHandler;
  62299. var detachedRootClasses = brikz.runtimeClasses.detachedRootClasses;
  62300. st._methodAdded = function (method, klass) {
  62301. installMethod(method, klass);
  62302. propagateMethodChange(klass, method, klass);
  62303. };
  62304. st._selectorsAdded = function (newSelectors) {
  62305. var targetClasses = detachedRootClasses();
  62306. newSelectors.forEach(function (pair) {
  62307. makeDnuHandler(pair, targetClasses);
  62308. });
  62309. };
  62310. st._methodRemoved = function (method, klass) {
  62311. delete klass.fn.prototype[method.jsSelector];
  62312. propagateMethodChange(klass, method, null);
  62313. };
  62314. function propagateMethodChange (klass, method, exclude) {
  62315. var selector = method.selector;
  62316. var jsSelector = method.jsSelector;
  62317. st.traverseClassTree(klass, function (subclass, sentinel) {
  62318. if (subclass != exclude) {
  62319. if (initMethodInClass(subclass, selector, jsSelector)) return sentinel;
  62320. }
  62321. });
  62322. }
  62323. function initMethodInClass (klass, selector, jsSelector) {
  62324. if (klass.methods[selector]) return true;
  62325. if (klass.detachedRoot) {
  62326. installJSMethod(klass.fn.prototype, jsSelector, klass.superclass.fn.prototype[jsSelector]);
  62327. }
  62328. }
  62329. }
  62330. PrimitivesBrik.deps = ["smalltalkGlobals"];
  62331. function PrimitivesBrik (brikz, st) {
  62332. var globals = brikz.smalltalkGlobals.globals;
  62333. var oid = 0;
  62334. /* Unique ID number generator */
  62335. st.nextId = function () {
  62336. oid += 1;
  62337. return oid;
  62338. };
  62339. /* Converts a JavaScript object to valid Smalltalk Object */
  62340. st.readJSObject = function (js) {
  62341. if (js == null)
  62342. return null;
  62343. var readObject = js.constructor === Object;
  62344. var readArray = js.constructor === Array;
  62345. var object = readObject ? globals.Dictionary._new() : readArray ? [] : js;
  62346. for (var i in js) {
  62347. if (readObject) {
  62348. object._at_put_(i, st.readJSObject(js[i]));
  62349. }
  62350. if (readArray) {
  62351. object[i] = st.readJSObject(js[i]);
  62352. }
  62353. }
  62354. return object;
  62355. };
  62356. /* Boolean assertion */
  62357. st.assert = function (shouldBeBoolean) {
  62358. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  62359. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  62360. shouldBeBoolean = shouldBeBoolean.valueOf();
  62361. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  62362. }
  62363. globals.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  62364. };
  62365. /* List of all reserved words in JavaScript. They may not be used as variables
  62366. in Smalltalk. */
  62367. // list of reserved JavaScript keywords as of
  62368. // http://es5.github.com/#x7.6.1.1
  62369. // and
  62370. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  62371. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  62372. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  62373. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  62374. 'try', 'typeof', 'var', 'void', 'while', 'with',
  62375. // Amber protected words: these should not be compiled as-is when in code
  62376. 'arguments',
  62377. // ES5: future use: http://es5.github.com/#x7.6.1.2
  62378. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  62379. // ES5: future use in strict mode
  62380. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  62381. 'public', 'static', 'yield'];
  62382. st.globalJsVariables = ['window', 'document', 'process', 'global'];
  62383. }
  62384. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  62385. function RuntimeBrik (brikz, st) {
  62386. var globals = brikz.smalltalkGlobals.globals;
  62387. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  62388. function SmalltalkMethodContext (home, setup) {
  62389. this.sendIdx = {};
  62390. this.homeContext = home;
  62391. this.setup = setup || function () {
  62392. };
  62393. this.supercall = false;
  62394. }
  62395. // Fallbacks
  62396. SmalltalkMethodContext.prototype.locals = {};
  62397. SmalltalkMethodContext.prototype.receiver = null;
  62398. SmalltalkMethodContext.prototype.selector = null;
  62399. SmalltalkMethodContext.prototype.lookupClass = null;
  62400. defineMethod(SmalltalkMethodContext, "fill", function (receiver, selector, locals, lookupClass) {
  62401. this.receiver = receiver;
  62402. this.selector = selector;
  62403. this.locals = locals || {};
  62404. this.lookupClass = lookupClass;
  62405. if (this.homeContext) {
  62406. this.homeContext.evaluatedSelector = selector;
  62407. }
  62408. });
  62409. defineMethod(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
  62410. this.locals = locals || {};
  62411. this.outerContext = ctx;
  62412. this.index = index || 0;
  62413. });
  62414. defineMethod(SmalltalkMethodContext, "init", function () {
  62415. var home = this.homeContext;
  62416. if (home) {
  62417. home.init();
  62418. }
  62419. this.setup(this);
  62420. });
  62421. defineMethod(SmalltalkMethodContext, "method", function () {
  62422. var method;
  62423. var lookup = this.lookupClass || this.receiver.klass;
  62424. while (!method && lookup) {
  62425. method = lookup.methods[st.js2st(this.selector)];
  62426. lookup = lookup.superclass;
  62427. }
  62428. return method;
  62429. });
  62430. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  62431. /* This is the current call context object.
  62432. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  62433. In JS code, use api.getThisContext() (see below).
  62434. */
  62435. var thisContext = null;
  62436. st.withContext = function (worker, setup) {
  62437. if (thisContext) {
  62438. return inContext(worker, setup);
  62439. } else {
  62440. return inContextWithErrorHandling(worker, setup);
  62441. }
  62442. };
  62443. /*
  62444. Runs worker function so that error handler is not set up
  62445. if there isn't one. This is accomplished by unconditional
  62446. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  62447. which then stops error handler setup (see st.withContext above).
  62448. The effect is, $core.seamless(fn)'s exceptions are not
  62449. handed into ST error handler and caller should process them.
  62450. */
  62451. st.seamless = function (worker) {
  62452. return inContext(worker, function (ctx) {
  62453. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  62454. });
  62455. };
  62456. function inContextWithErrorHandling (worker, setup) {
  62457. try {
  62458. return inContext(worker, setup);
  62459. } catch (error) {
  62460. handleError(error);
  62461. thisContext = null;
  62462. // Rethrow the error in any case.
  62463. error.amberHandled = true;
  62464. throw error;
  62465. }
  62466. }
  62467. function inContext (worker, setup) {
  62468. var oldContext = thisContext;
  62469. thisContext = new SmalltalkMethodContext(thisContext, setup);
  62470. var result = worker(thisContext);
  62471. thisContext = oldContext;
  62472. return result;
  62473. }
  62474. /* Wrap a JavaScript exception in a Smalltalk Exception.
  62475. In case of a RangeError, stub the stack after 100 contexts to
  62476. avoid another RangeError later when the stack is manipulated. */
  62477. function wrappedError (error) {
  62478. var errorWrapper = globals.JavaScriptException._on_(error);
  62479. // Add the error to the context, so it is visible in the stack
  62480. try {
  62481. errorWrapper._signal();
  62482. } catch (ex) {
  62483. }
  62484. var context = st.getThisContext();
  62485. if (isRangeError(error)) {
  62486. stubContextStack(context);
  62487. }
  62488. errorWrapper._context_(context);
  62489. return errorWrapper;
  62490. }
  62491. /* Stub the context stack after 100 contexts */
  62492. function stubContextStack (context) {
  62493. var currentContext = context;
  62494. var contexts = 0;
  62495. while (contexts < 100) {
  62496. if (currentContext) {
  62497. currentContext = currentContext.homeContext;
  62498. }
  62499. contexts++;
  62500. }
  62501. if (currentContext) {
  62502. currentContext.homeContext = undefined;
  62503. }
  62504. }
  62505. function isRangeError (error) {
  62506. return error instanceof RangeError;
  62507. }
  62508. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  62509. (See the Smalltalk class ErrorHandler and its subclasses */
  62510. function handleError (error) {
  62511. if (!error.smalltalkError) {
  62512. error = wrappedError(error);
  62513. }
  62514. globals.ErrorHandler._handleError_(error);
  62515. }
  62516. /* Handle thisContext pseudo variable */
  62517. st.getThisContext = function () {
  62518. if (thisContext) {
  62519. thisContext.init();
  62520. return thisContext;
  62521. } else {
  62522. return null;
  62523. }
  62524. };
  62525. }
  62526. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  62527. function MessageSendBrik (brikz, st) {
  62528. var globals = brikz.smalltalkGlobals.globals;
  62529. var nilAsReceiver = brikz.root.nilAsReceiver;
  62530. /* Send message programmatically. Used to implement #perform: & Co. */
  62531. st.send2 = function (receiver, selector, args, klass) {
  62532. var method, jsSelector = st.st2js(selector);
  62533. if (receiver == null) {
  62534. receiver = nilAsReceiver;
  62535. }
  62536. method = klass ? klass.fn.prototype[jsSelector] : receiver.klass && receiver[jsSelector];
  62537. if (method) {
  62538. return method.apply(receiver, args || []);
  62539. } else {
  62540. return messageNotUnderstood(receiver, selector, args);
  62541. }
  62542. };
  62543. function invokeDnuMethod (receiver, stSelector, args) {
  62544. return receiver._doesNotUnderstand_(
  62545. globals.Message._new()
  62546. ._selector_(stSelector)
  62547. ._arguments_([].slice.call(args))
  62548. );
  62549. }
  62550. function wrapJavaScript (o) {
  62551. return globals.JSObjectProxy._on_(o);
  62552. }
  62553. st.wrapJavaScript = wrapJavaScript;
  62554. /* Handles #dnu: *and* JavaScript method calls.
  62555. if the receiver has no klass, we consider it a JS object (outside of the
  62556. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  62557. function messageNotUnderstood (receiver, stSelector, args) {
  62558. if (receiver.klass != null && !receiver.allowJavaScriptCalls) {
  62559. return invokeDnuMethod(receiver, stSelector, args);
  62560. }
  62561. /* Call a method of a JS object, or answer a property if it exists.
  62562. Converts keyword-based selectors by using the first
  62563. keyword only, but keeping all message arguments.
  62564. Example:
  62565. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)"
  62566. Else try wrapping a JSObjectProxy around the receiver. */
  62567. var propertyName = st.st2prop(stSelector);
  62568. if (!(propertyName in receiver)) {
  62569. return invokeDnuMethod(wrapJavaScript(receiver), stSelector, args);
  62570. }
  62571. return accessJavaScript(receiver, propertyName, args);
  62572. }
  62573. /* If the object property is a function, then call it, except if it starts with
  62574. an uppercase character (we probably want to answer the function itself in this
  62575. case and send it #new from Amber).
  62576. */
  62577. function accessJavaScript (receiver, propertyName, args) {
  62578. var propertyValue = receiver[propertyName];
  62579. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  62580. return propertyValue.apply(receiver, args || []);
  62581. } else if (args.length > 0) {
  62582. receiver[propertyName] = args[0];
  62583. return receiver;
  62584. } else {
  62585. return propertyValue;
  62586. }
  62587. }
  62588. st.accessJavaScript = accessJavaScript;
  62589. this.messageNotUnderstood = messageNotUnderstood;
  62590. }
  62591. StartImageBrik.deps = ["frameBinding", "runtimeMethods", "runtime", "primitives"];
  62592. function StartImageBrik (brikz, st) {
  62593. this.__init__ = function () {
  62594. var classes = brikz.behaviors.classes;
  62595. classes().forEach(function (klass) {
  62596. klass._initialize();
  62597. });
  62598. };
  62599. this.__init__.once = true;
  62600. }
  62601. /* Making smalltalk that can run */
  62602. function configureWithRuntime (brikz) {
  62603. brikz.dnu = DNUBrik;
  62604. brikz.manipulation = ManipulationBrik;
  62605. brikz.runtimeClasses = RuntimeClassesBrik;
  62606. brikz.frameBinding = FrameBindingBrik;
  62607. brikz.runtimeMethods = RuntimeMethodsBrik;
  62608. brikz.messageSend = MessageSendBrik;
  62609. brikz.runtime = RuntimeBrik;
  62610. brikz.primitives = PrimitivesBrik;
  62611. brikz.startImage = StartImageBrik;
  62612. brikz.rebuild();
  62613. }
  62614. return configureWithRuntime;
  62615. });
  62616. // Depend on each module that is loaded lazily.
  62617. // Add to packager tasks as dependency,
  62618. // so the lazy-loaded modules are included.
  62619. define('amber/lazypack',['./kernel-runtime'], {});
  62620. require(["app"]);
  62621. });
  62622. define.require('__wrap__');
  62623. }((function amdefine(module, requireFn) {
  62624. 'use strict';
  62625. var defineCache = {},
  62626. loaderCache = {},
  62627. alreadyCalled = false,
  62628. path = require('path'),
  62629. makeRequire, stringRequire;
  62630. /**
  62631. * Trims the . and .. from an array of path segments.
  62632. * It will keep a leading path segment if a .. will become
  62633. * the first path segment, to help with module name lookups,
  62634. * which act like paths, but can be remapped. But the end result,
  62635. * all paths that use this function should look normalized.
  62636. * NOTE: this method MODIFIES the input array.
  62637. * @param {Array} ary the array of path segments.
  62638. */
  62639. function trimDots(ary) {
  62640. var i, part;
  62641. for (i = 0; ary[i]; i+= 1) {
  62642. part = ary[i];
  62643. if (part === '.') {
  62644. ary.splice(i, 1);
  62645. i -= 1;
  62646. } else if (part === '..') {
  62647. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  62648. //End of the line. Keep at least one non-dot
  62649. //path segment at the front so it can be mapped
  62650. //correctly to disk. Otherwise, there is likely
  62651. //no path mapping for a path starting with '..'.
  62652. //This can still fail, but catches the most reasonable
  62653. //uses of ..
  62654. break;
  62655. } else if (i > 0) {
  62656. ary.splice(i - 1, 2);
  62657. i -= 2;
  62658. }
  62659. }
  62660. }
  62661. }
  62662. function normalize(name, baseName) {
  62663. var baseParts;
  62664. //Adjust any relative paths.
  62665. if (name && name.charAt(0) === '.') {
  62666. //If have a base name, try to normalize against it,
  62667. //otherwise, assume it is a top-level require that will
  62668. //be relative to baseUrl in the end.
  62669. if (baseName) {
  62670. baseParts = baseName.split('/');
  62671. baseParts = baseParts.slice(0, baseParts.length - 1);
  62672. baseParts = baseParts.concat(name.split('/'));
  62673. trimDots(baseParts);
  62674. name = baseParts.join('/');
  62675. }
  62676. }
  62677. return name;
  62678. }
  62679. /**
  62680. * Create the normalize() function passed to a loader plugin's
  62681. * normalize method.
  62682. */
  62683. function makeNormalize(relName) {
  62684. return function (name) {
  62685. return normalize(name, relName);
  62686. };
  62687. }
  62688. function makeLoad(id) {
  62689. function load(value) {
  62690. loaderCache[id] = value;
  62691. }
  62692. load.fromText = function (id, text) {
  62693. //This one is difficult because the text can/probably uses
  62694. //define, and any relative paths and requires should be relative
  62695. //to that id was it would be found on disk. But this would require
  62696. //bootstrapping a module/require fairly deeply from node core.
  62697. //Not sure how best to go about that yet.
  62698. throw new Error('amdefine does not implement load.fromText');
  62699. };
  62700. return load;
  62701. }
  62702. makeRequire = function (systemRequire, exports, module, relId) {
  62703. function amdRequire(deps, callback) {
  62704. if (typeof deps === 'string') {
  62705. //Synchronous, single module require('')
  62706. return stringRequire(systemRequire, exports, module, deps, relId);
  62707. } else {
  62708. //Array of dependencies with a callback.
  62709. //Convert the dependencies to modules.
  62710. deps = deps.map(function (depName) {
  62711. return stringRequire(systemRequire, exports, module, depName, relId);
  62712. });
  62713. //Wait for next tick to call back the require call.
  62714. if (callback) {
  62715. process.nextTick(function () {
  62716. callback.apply(null, deps);
  62717. });
  62718. }
  62719. }
  62720. }
  62721. amdRequire.toUrl = function (filePath) {
  62722. if (filePath.indexOf('.') === 0) {
  62723. return normalize(filePath, path.dirname(module.filename));
  62724. } else {
  62725. return filePath;
  62726. }
  62727. };
  62728. return amdRequire;
  62729. };
  62730. //Favor explicit value, passed in if the module wants to support Node 0.4.
  62731. requireFn = requireFn || function req() {
  62732. return module.require.apply(module, arguments);
  62733. };
  62734. function runFactory(id, deps, factory) {
  62735. var r, e, m, result;
  62736. if (id) {
  62737. e = loaderCache[id] = {};
  62738. m = {
  62739. id: id,
  62740. uri: __filename,
  62741. exports: e
  62742. };
  62743. r = makeRequire(requireFn, e, m, id);
  62744. } else {
  62745. //Only support one define call per file
  62746. if (alreadyCalled) {
  62747. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  62748. }
  62749. alreadyCalled = true;
  62750. //Use the real variables from node
  62751. //Use module.exports for exports, since
  62752. //the exports in here is amdefine exports.
  62753. e = module.exports;
  62754. m = module;
  62755. r = makeRequire(requireFn, e, m, module.id);
  62756. }
  62757. //If there are dependencies, they are strings, so need
  62758. //to convert them to dependency values.
  62759. if (deps) {
  62760. deps = deps.map(function (depName) {
  62761. return r(depName);
  62762. });
  62763. }
  62764. //Call the factory with the right dependencies.
  62765. if (typeof factory === 'function') {
  62766. result = factory.apply(m.exports, deps);
  62767. } else {
  62768. result = factory;
  62769. }
  62770. if (result !== undefined) {
  62771. m.exports = result;
  62772. if (id) {
  62773. loaderCache[id] = m.exports;
  62774. }
  62775. }
  62776. }
  62777. stringRequire = function (systemRequire, exports, module, id, relId) {
  62778. //Split the ID by a ! so that
  62779. var index = id.indexOf('!'),
  62780. originalId = id,
  62781. prefix, plugin;
  62782. if (index === -1) {
  62783. id = normalize(id, relId);
  62784. //Straight module lookup. If it is one of the special dependencies,
  62785. //deal with it, otherwise, delegate to node.
  62786. if (id === 'require') {
  62787. return makeRequire(systemRequire, exports, module, relId);
  62788. } else if (id === 'exports') {
  62789. return exports;
  62790. } else if (id === 'module') {
  62791. return module;
  62792. } else if (loaderCache.hasOwnProperty(id)) {
  62793. return loaderCache[id];
  62794. } else if (defineCache[id]) {
  62795. runFactory.apply(null, defineCache[id]);
  62796. return loaderCache[id];
  62797. } else {
  62798. if(systemRequire) {
  62799. return systemRequire(originalId);
  62800. } else {
  62801. throw new Error('No module with ID: ' + id);
  62802. }
  62803. }
  62804. } else {
  62805. //There is a plugin in play.
  62806. prefix = id.substring(0, index);
  62807. id = id.substring(index + 1, id.length);
  62808. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  62809. if (plugin.normalize) {
  62810. id = plugin.normalize(id, makeNormalize(relId));
  62811. } else {
  62812. //Normalize the ID normally.
  62813. id = normalize(id, relId);
  62814. }
  62815. if (loaderCache[id]) {
  62816. return loaderCache[id];
  62817. } else {
  62818. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  62819. return loaderCache[id];
  62820. }
  62821. }
  62822. };
  62823. //Create a define function specific to the module asking for amdefine.
  62824. function define(id, deps, factory) {
  62825. if (Array.isArray(id)) {
  62826. factory = deps;
  62827. deps = id;
  62828. id = undefined;
  62829. } else if (typeof id !== 'string') {
  62830. factory = id;
  62831. id = deps = undefined;
  62832. }
  62833. if (deps && !Array.isArray(deps)) {
  62834. factory = deps;
  62835. deps = undefined;
  62836. }
  62837. if (!deps) {
  62838. deps = ['require', 'exports', 'module'];
  62839. }
  62840. //Set up properties for this module. If an ID, then use
  62841. //internal cache. If no ID, then use the external variables
  62842. //for this node module.
  62843. if (id) {
  62844. //Put the module in deep freeze until there is a
  62845. //require call for it.
  62846. defineCache[id] = [id, deps, factory];
  62847. } else {
  62848. runFactory(id, deps, factory);
  62849. }
  62850. }
  62851. //define.require, which has access to all the values in the
  62852. //cache. Useful for AMD modules that all have IDs in the file,
  62853. //but need to finally export a value to node based on one of those
  62854. //IDs.
  62855. define.require = function (id) {
  62856. if (loaderCache[id]) {
  62857. return loaderCache[id];
  62858. }
  62859. if (defineCache[id]) {
  62860. runFactory.apply(null, defineCache[id]);
  62861. return loaderCache[id];
  62862. }
  62863. };
  62864. define.amd = {};
  62865. return define;
  62866. }(module)), require));