amber-cli.js 2.4 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683696846968569686696876968869689696906969169692696936969469695696966969769698696996970069701697026970369704697056970669707697086970969710697116971269713697146971569716697176971869719697206972169722697236972469725697266972769728697296973069731697326973369734697356973669737697386973969740697416974269743697446974569746697476974869749697506975169752697536975469755697566975769758697596976069761697626976369764697656976669767697686976969770697716977269773697746977569776697776977869779697806978169782697836978469785697866978769788697896979069791697926979369794697956979669797697986979969800698016980269803698046980569806698076980869809698106981169812698136981469815698166981769818698196982069821698226982369824698256982669827698286982969830698316983269833698346983569836698376983869839698406984169842698436984469845698466984769848698496985069851698526985369854698556985669857698586985969860698616986269863698646986569866698676986869869698706987169872698736987469875698766987769878698796988069881698826988369884698856988669887698886988969890698916989269893698946989569896698976989869899699006990169902699036990469905699066990769908699096991069911699126991369914699156991669917699186991969920699216992269923699246992569926699276992869929699306993169932699336993469935699366993769938699396994069941699426994369944699456994669947699486994969950699516995269953699546995569956699576995869959699606996169962699636996469965699666996769968699696997069971699726997369974699756997669977699786997969980699816998269983699846998569986699876998869989699906999169992699936999469995699966999769998699997000070001700027000370004700057000670007700087000970010700117001270013700147001570016700177001870019700207002170022700237002470025700267002770028700297003070031700327003370034700357003670037700387003970040700417004270043700447004570046700477004870049700507005170052700537005470055700567005770058700597006070061700627006370064700657006670067700687006970070700717007270073700747007570076700777007870079700807008170082700837008470085700867008770088700897009070091700927009370094700957009670097700987009970100701017010270103701047010570106701077010870109701107011170112701137011470115701167011770118701197012070121701227012370124701257012670127701287012970130701317013270133701347013570136701377013870139701407014170142701437014470145701467014770148701497015070151701527015370154701557015670157701587015970160701617016270163701647016570166701677016870169701707017170172701737017470175701767017770178701797018070181701827018370184701857018670187701887018970190701917019270193701947019570196701977019870199702007020170202702037020470205702067020770208702097021070211702127021370214702157021670217702187021970220702217022270223702247022570226702277022870229702307023170232702337023470235702367023770238702397024070241702427024370244702457024670247702487024970250702517025270253702547025570256702577025870259702607026170262702637026470265702667026770268702697027070271702727027370274702757027670277702787027970280702817028270283702847028570286702877028870289702907029170292702937029470295702967029770298702997030070301703027030370304703057030670307703087030970310703117031270313703147031570316703177031870319703207032170322703237032470325703267032770328703297033070331703327033370334703357033670337703387033970340703417034270343703447034570346703477034870349703507035170352703537035470355703567035770358703597036070361703627036370364703657036670367703687036970370703717037270373703747037570376703777037870379703807038170382703837038470385703867038770388703897039070391703927039370394703957039670397703987039970400704017040270403704047040570406704077040870409704107041170412704137041470415704167041770418704197042070421704227042370424704257042670427704287042970430704317043270433704347043570436704377043870439704407044170442704437044470445704467044770448704497045070451704527045370454704557045670457704587045970460704617046270463704647046570466704677046870469704707047170472704737047470475704767047770478704797048070481704827048370484704857048670487704887048970490704917049270493704947049570496704977049870499705007050170502705037050470505705067050770508705097051070511705127051370514705157051670517705187051970520705217052270523705247052570526705277052870529705307053170532705337053470535705367053770538705397054070541705427054370544705457054670547705487054970550705517055270553705547055570556705577055870559705607056170562705637056470565705667056770568705697057070571705727057370574705757057670577705787057970580705817058270583705847058570586705877058870589705907059170592705937059470595705967059770598705997060070601706027060370604706057060670607706087060970610706117061270613706147061570616706177061870619706207062170622706237062470625706267062770628706297063070631706327063370634706357063670637706387063970640706417064270643706447064570646706477064870649706507065170652706537065470655706567065770658706597066070661706627066370664706657066670667706687066970670706717067270673706747067570676706777067870679706807068170682706837068470685706867068770688706897069070691706927069370694706957069670697706987069970700707017070270703707047070570706707077070870709707107071170712707137071470715707167071770718707197072070721707227072370724707257072670727707287072970730707317073270733707347073570736707377073870739707407074170742707437074470745707467074770748707497075070751707527075370754707557075670757707587075970760707617076270763707647076570766707677076870769707707077170772707737077470775707767077770778707797078070781707827078370784707857078670787707887078970790707917079270793707947079570796707977079870799708007080170802708037080470805708067080770808708097081070811708127081370814708157081670817708187081970820708217082270823708247082570826708277082870829708307083170832708337083470835708367083770838708397084070841708427084370844708457084670847708487084970850708517085270853708547085570856708577085870859708607086170862708637086470865708667086770868708697087070871708727087370874708757087670877708787087970880708817088270883708847088570886708877088870889708907089170892708937089470895708967089770898708997090070901709027090370904709057090670907709087090970910709117091270913709147091570916709177091870919709207092170922709237092470925709267092770928709297093070931709327093370934709357093670937709387093970940709417094270943709447094570946709477094870949709507095170952709537095470955709567095770958709597096070961709627096370964709657096670967709687096970970709717097270973709747097570976709777097870979709807098170982709837098470985709867098770988709897099070991709927099370994709957099670997709987099971000710017100271003710047100571006710077100871009710107101171012710137101471015710167101771018710197102071021710227102371024710257102671027710287102971030710317103271033710347103571036710377103871039710407104171042710437104471045710467104771048710497105071051710527105371054710557105671057710587105971060710617106271063710647106571066710677106871069710707107171072710737107471075710767107771078710797108071081710827108371084710857108671087710887108971090710917109271093710947109571096710977109871099711007110171102711037110471105711067110771108711097111071111711127111371114711157111671117711187111971120711217112271123711247112571126711277112871129711307113171132711337113471135711367113771138711397114071141711427114371144711457114671147711487114971150711517115271153711547115571156711577115871159711607116171162711637116471165711667116771168711697117071171711727117371174711757117671177711787117971180711817118271183711847118571186711877118871189711907119171192711937119471195711967119771198711997120071201712027120371204712057120671207712087120971210712117121271213712147121571216712177121871219712207122171222712237122471225712267122771228712297123071231712327123371234712357123671237712387123971240712417124271243712447124571246712477124871249712507125171252712537125471255712567125771258712597126071261712627126371264712657126671267712687126971270712717127271273712747127571276712777127871279712807128171282712837128471285712867128771288712897129071291712927129371294712957129671297712987129971300713017130271303713047130571306713077130871309713107131171312713137131471315713167131771318713197132071321713227132371324713257132671327713287132971330713317133271333713347133571336713377133871339713407134171342713437134471345713467134771348713497135071351713527135371354713557135671357713587135971360713617136271363713647136571366713677136871369713707137171372713737137471375713767137771378713797138071381713827138371384713857138671387713887138971390713917139271393713947139571396713977139871399714007140171402714037140471405714067140771408714097141071411714127141371414714157141671417714187141971420714217142271423714247142571426714277142871429714307143171432714337143471435714367143771438714397144071441714427144371444714457144671447714487144971450714517145271453714547145571456714577145871459714607146171462714637146471465714667146771468714697147071471714727147371474714757147671477714787147971480714817148271483714847148571486714877148871489714907149171492714937149471495714967149771498714997150071501715027150371504715057150671507715087150971510715117151271513715147151571516715177151871519715207152171522715237152471525715267152771528715297153071531715327153371534715357153671537715387153971540715417154271543715447154571546715477154871549715507155171552715537155471555715567155771558715597156071561715627156371564715657156671567715687156971570715717157271573715747157571576715777157871579715807158171582715837158471585715867158771588715897159071591715927159371594715957159671597715987159971600716017160271603716047160571606716077160871609716107161171612716137161471615716167161771618716197162071621716227162371624716257162671627716287162971630716317163271633716347163571636716377163871639716407164171642716437164471645716467164771648716497165071651716527165371654716557165671657716587165971660716617166271663716647166571666716677166871669716707167171672716737167471675716767167771678716797168071681716827168371684716857168671687716887168971690716917169271693716947169571696716977169871699717007170171702717037170471705717067170771708717097171071711717127171371714717157171671717717187171971720717217172271723717247172571726717277172871729717307173171732717337173471735717367173771738717397174071741717427174371744717457174671747717487174971750717517175271753717547175571756717577175871759717607176171762717637176471765717667176771768717697177071771717727177371774717757177671777717787177971780717817178271783717847178571786717877178871789717907179171792717937179471795717967179771798717997180071801718027180371804718057180671807718087180971810718117181271813718147181571816718177181871819718207182171822718237182471825718267182771828718297183071831718327183371834718357183671837718387183971840718417184271843718447184571846718477184871849718507185171852718537185471855718567185771858718597186071861718627186371864718657186671867718687186971870718717187271873718747187571876718777187871879718807188171882718837188471885718867188771888718897189071891718927189371894718957189671897718987189971900719017190271903719047190571906719077190871909719107191171912719137191471915719167191771918719197192071921719227192371924719257192671927719287192971930719317193271933719347193571936719377193871939719407194171942719437194471945719467194771948719497195071951719527195371954719557195671957719587195971960719617196271963719647196571966719677196871969719707197171972719737197471975719767197771978719797198071981719827198371984719857198671987719887198971990719917199271993719947199571996719977199871999720007200172002720037200472005720067200772008720097201072011720127201372014720157201672017720187201972020720217202272023720247202572026720277202872029720307203172032720337203472035720367203772038720397204072041720427204372044720457204672047720487204972050720517205272053720547205572056720577205872059720607206172062720637206472065720667206772068720697207072071720727207372074720757207672077720787207972080720817208272083720847208572086720877208872089720907209172092720937209472095720967209772098720997210072101721027210372104721057210672107721087210972110721117211272113721147211572116721177211872119721207212172122721237212472125721267212772128721297213072131721327213372134721357213672137721387213972140721417214272143721447214572146721477214872149721507215172152721537215472155721567215772158721597216072161721627216372164721657216672167721687216972170721717217272173721747217572176721777217872179721807218172182721837218472185721867218772188721897219072191721927219372194721957219672197721987219972200722017220272203722047220572206722077220872209722107221172212722137221472215722167221772218722197222072221722227222372224722257222672227722287222972230722317223272233722347223572236722377223872239722407224172242722437224472245722467224772248722497225072251722527225372254722557225672257722587225972260722617226272263722647226572266722677226872269722707227172272722737227472275722767227772278722797228072281722827228372284722857228672287722887228972290722917229272293722947229572296722977229872299723007230172302723037230472305723067230772308723097231072311723127231372314723157231672317723187231972320723217232272323723247232572326723277232872329723307233172332723337233472335723367233772338723397234072341723427234372344723457234672347723487234972350723517235272353723547235572356723577235872359723607236172362723637236472365723667236772368723697237072371723727237372374723757237672377723787237972380723817238272383723847238572386723877238872389723907239172392723937239472395723967239772398723997240072401724027240372404724057240672407724087240972410724117241272413724147241572416724177241872419724207242172422724237242472425724267242772428724297243072431724327243372434724357243672437724387243972440724417244272443724447244572446724477244872449724507245172452724537245472455724567245772458724597246072461724627246372464724657246672467724687246972470724717247272473724747247572476724777247872479724807248172482724837248472485724867248772488724897249072491724927249372494724957249672497724987249972500725017250272503725047250572506725077250872509725107251172512725137251472515725167251772518725197252072521725227252372524725257252672527725287252972530725317253272533725347253572536725377253872539725407254172542725437254472545725467254772548725497255072551725527255372554725557255672557725587255972560725617256272563725647256572566725677256872569725707257172572725737257472575725767257772578725797258072581725827258372584725857258672587725887258972590725917259272593725947259572596725977259872599726007260172602726037260472605726067260772608726097261072611726127261372614726157261672617726187261972620726217262272623726247262572626726277262872629726307263172632726337263472635726367263772638726397264072641726427264372644726457264672647726487264972650726517265272653726547265572656726577265872659726607266172662726637266472665726667266772668726697267072671726727267372674726757267672677726787267972680726817268272683726847268572686726877268872689726907269172692726937269472695726967269772698726997270072701727027270372704727057270672707727087270972710727117271272713727147271572716727177271872719727207272172722727237272472725727267272772728727297273072731727327273372734727357273672737727387273972740727417274272743727447274572746727477274872749727507275172752727537275472755727567275772758727597276072761727627276372764727657276672767727687276972770727717277272773727747277572776727777277872779727807278172782727837278472785727867278772788727897279072791727927279372794727957279672797727987279972800728017280272803728047280572806728077280872809728107281172812728137281472815728167281772818728197282072821728227282372824728257282672827728287282972830728317283272833728347283572836728377283872839728407284172842728437284472845728467284772848728497285072851728527285372854728557285672857728587285972860728617286272863728647286572866728677286872869728707287172872728737287472875728767287772878728797288072881728827288372884728857288672887728887288972890728917289272893728947289572896728977289872899729007290172902729037290472905729067290772908729097291072911729127291372914729157291672917729187291972920729217292272923729247292572926729277292872929729307293172932729337293472935729367293772938729397294072941729427294372944729457294672947729487294972950729517295272953729547295572956729577295872959729607296172962729637296472965729667296772968729697297072971729727297372974729757297672977729787297972980729817298272983729847298572986729877298872989729907299172992729937299472995729967299772998729997300073001730027300373004730057300673007730087300973010730117301273013730147301573016730177301873019730207302173022730237302473025730267302773028730297303073031730327303373034730357303673037730387303973040730417304273043730447304573046730477304873049730507305173052730537305473055730567305773058730597306073061730627306373064730657306673067730687306973070730717307273073730747307573076730777307873079730807308173082730837308473085730867308773088730897309073091730927309373094730957309673097730987309973100731017310273103731047310573106731077310873109731107311173112731137311473115731167311773118731197312073121731227312373124731257312673127731287312973130731317313273133731347313573136731377313873139731407314173142731437314473145731467314773148731497315073151731527315373154731557315673157731587315973160731617316273163731647316573166731677316873169731707317173172731737317473175731767317773178731797318073181731827318373184731857318673187731887318973190731917319273193731947319573196731977319873199732007320173202732037320473205732067320773208732097321073211732127321373214732157321673217732187321973220732217322273223732247322573226732277322873229732307323173232732337323473235732367323773238732397324073241732427324373244732457324673247732487324973250732517325273253732547325573256732577325873259732607326173262732637326473265732667326773268732697327073271732727327373274732757327673277732787327973280732817328273283732847328573286732877328873289732907329173292732937329473295732967329773298732997330073301733027330373304733057330673307733087330973310733117331273313733147331573316733177331873319733207332173322733237332473325733267332773328733297333073331733327333373334733357333673337733387333973340733417334273343733447334573346733477334873349733507335173352733537335473355733567335773358733597336073361733627336373364733657336673367733687336973370733717337273373733747337573376733777337873379733807338173382733837338473385733867338773388733897339073391733927339373394733957339673397733987339973400734017340273403734047340573406734077340873409734107341173412734137341473415734167341773418734197342073421734227342373424734257342673427734287342973430734317343273433734347343573436734377343873439734407344173442734437344473445734467344773448734497345073451734527345373454734557345673457734587345973460734617346273463734647346573466734677346873469734707347173472
  1. #!/usr/bin/env node
  2. (function(define, require){
  3. define(function (requirejs) {
  4. var module = void 0; // Bad UMDs workaround
  5. requirejs.resolve = require.resolve;
  6. require = requirejs;
  7. /*!
  8. * @overview es6-promise - a tiny implementation of Promises/A+.
  9. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  10. * @license Licensed under MIT license
  11. * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
  12. * @version v4.2.8+1e68dce6
  13. */
  14. (function (global, factory) {
  15. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  16. typeof define === 'function' && define.amd ? define('amber/es6-promise',factory) :
  17. (global.ES6Promise = factory());
  18. }(this, (function () { 'use strict';
  19. function objectOrFunction(x) {
  20. var type = typeof x;
  21. return x !== null && (type === 'object' || type === 'function');
  22. }
  23. function isFunction(x) {
  24. return typeof x === 'function';
  25. }
  26. var _isArray = void 0;
  27. if (Array.isArray) {
  28. _isArray = Array.isArray;
  29. } else {
  30. _isArray = function (x) {
  31. return Object.prototype.toString.call(x) === '[object Array]';
  32. };
  33. }
  34. var isArray = _isArray;
  35. var len = 0;
  36. var vertxNext = void 0;
  37. var customSchedulerFn = void 0;
  38. var asap = function asap(callback, arg) {
  39. queue[len] = callback;
  40. queue[len + 1] = arg;
  41. len += 2;
  42. if (len === 2) {
  43. // If len is 2, that means that we need to schedule an async flush.
  44. // If additional callbacks are queued before the queue is flushed, they
  45. // will be processed by this flush that we are scheduling.
  46. if (customSchedulerFn) {
  47. customSchedulerFn(flush);
  48. } else {
  49. scheduleFlush();
  50. }
  51. }
  52. };
  53. function setScheduler(scheduleFn) {
  54. customSchedulerFn = scheduleFn;
  55. }
  56. function setAsap(asapFn) {
  57. asap = asapFn;
  58. }
  59. var browserWindow = typeof window !== 'undefined' ? window : undefined;
  60. var browserGlobal = browserWindow || {};
  61. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  62. var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
  63. // test for web worker but not in IE10
  64. var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
  65. // node
  66. function useNextTick() {
  67. // node version 0.10.x displays a deprecation warning when nextTick is used recursively
  68. // see https://github.com/cujojs/when/issues/410 for details
  69. return function () {
  70. return process.nextTick(flush);
  71. };
  72. }
  73. // vertx
  74. function useVertxTimer() {
  75. if (typeof vertxNext !== 'undefined') {
  76. return function () {
  77. vertxNext(flush);
  78. };
  79. }
  80. return useSetTimeout();
  81. }
  82. function useMutationObserver() {
  83. var iterations = 0;
  84. var observer = new BrowserMutationObserver(flush);
  85. var node = document.createTextNode('');
  86. observer.observe(node, { characterData: true });
  87. return function () {
  88. node.data = iterations = ++iterations % 2;
  89. };
  90. }
  91. // web worker
  92. function useMessageChannel() {
  93. var channel = new MessageChannel();
  94. channel.port1.onmessage = flush;
  95. return function () {
  96. return channel.port2.postMessage(0);
  97. };
  98. }
  99. function useSetTimeout() {
  100. // Store setTimeout reference so es6-promise will be unaffected by
  101. // other code modifying setTimeout (like sinon.useFakeTimers())
  102. var globalSetTimeout = setTimeout;
  103. return function () {
  104. return globalSetTimeout(flush, 1);
  105. };
  106. }
  107. var queue = new Array(1000);
  108. function flush() {
  109. for (var i = 0; i < len; i += 2) {
  110. var callback = queue[i];
  111. var arg = queue[i + 1];
  112. callback(arg);
  113. queue[i] = undefined;
  114. queue[i + 1] = undefined;
  115. }
  116. len = 0;
  117. }
  118. function attemptVertx() {
  119. try {
  120. var vertx = Function('return this')().require('vertx');
  121. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  122. return useVertxTimer();
  123. } catch (e) {
  124. return useSetTimeout();
  125. }
  126. }
  127. var scheduleFlush = void 0;
  128. // Decide what async method to use to triggering processing of queued callbacks:
  129. if (isNode) {
  130. scheduleFlush = useNextTick();
  131. } else if (BrowserMutationObserver) {
  132. scheduleFlush = useMutationObserver();
  133. } else if (isWorker) {
  134. scheduleFlush = useMessageChannel();
  135. } else if (browserWindow === undefined && typeof require === 'function') {
  136. scheduleFlush = attemptVertx();
  137. } else {
  138. scheduleFlush = useSetTimeout();
  139. }
  140. function then(onFulfillment, onRejection) {
  141. var parent = this;
  142. var child = new this.constructor(noop);
  143. if (child[PROMISE_ID] === undefined) {
  144. makePromise(child);
  145. }
  146. var _state = parent._state;
  147. if (_state) {
  148. var callback = arguments[_state - 1];
  149. asap(function () {
  150. return invokeCallback(_state, child, callback, parent._result);
  151. });
  152. } else {
  153. subscribe(parent, child, onFulfillment, onRejection);
  154. }
  155. return child;
  156. }
  157. /**
  158. `Promise.resolve` returns a promise that will become resolved with the
  159. passed `value`. It is shorthand for the following:
  160. ```javascript
  161. let promise = new Promise(function(resolve, reject){
  162. resolve(1);
  163. });
  164. promise.then(function(value){
  165. // value === 1
  166. });
  167. ```
  168. Instead of writing the above, your code now simply becomes the following:
  169. ```javascript
  170. let promise = Promise.resolve(1);
  171. promise.then(function(value){
  172. // value === 1
  173. });
  174. ```
  175. @method resolve
  176. @static
  177. @param {Any} value value that the returned promise will be resolved with
  178. Useful for tooling.
  179. @return {Promise} a promise that will become fulfilled with the given
  180. `value`
  181. */
  182. function resolve$1(object) {
  183. /*jshint validthis:true */
  184. var Constructor = this;
  185. if (object && typeof object === 'object' && object.constructor === Constructor) {
  186. return object;
  187. }
  188. var promise = new Constructor(noop);
  189. resolve(promise, object);
  190. return promise;
  191. }
  192. var PROMISE_ID = Math.random().toString(36).substring(2);
  193. function noop() {}
  194. var PENDING = void 0;
  195. var FULFILLED = 1;
  196. var REJECTED = 2;
  197. function selfFulfillment() {
  198. return new TypeError("You cannot resolve a promise with itself");
  199. }
  200. function cannotReturnOwn() {
  201. return new TypeError('A promises callback cannot return that same promise.');
  202. }
  203. function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
  204. try {
  205. then$$1.call(value, fulfillmentHandler, rejectionHandler);
  206. } catch (e) {
  207. return e;
  208. }
  209. }
  210. function handleForeignThenable(promise, thenable, then$$1) {
  211. asap(function (promise) {
  212. var sealed = false;
  213. var error = tryThen(then$$1, thenable, function (value) {
  214. if (sealed) {
  215. return;
  216. }
  217. sealed = true;
  218. if (thenable !== value) {
  219. resolve(promise, value);
  220. } else {
  221. fulfill(promise, value);
  222. }
  223. }, function (reason) {
  224. if (sealed) {
  225. return;
  226. }
  227. sealed = true;
  228. reject(promise, reason);
  229. }, 'Settle: ' + (promise._label || ' unknown promise'));
  230. if (!sealed && error) {
  231. sealed = true;
  232. reject(promise, error);
  233. }
  234. }, promise);
  235. }
  236. function handleOwnThenable(promise, thenable) {
  237. if (thenable._state === FULFILLED) {
  238. fulfill(promise, thenable._result);
  239. } else if (thenable._state === REJECTED) {
  240. reject(promise, thenable._result);
  241. } else {
  242. subscribe(thenable, undefined, function (value) {
  243. return resolve(promise, value);
  244. }, function (reason) {
  245. return reject(promise, reason);
  246. });
  247. }
  248. }
  249. function handleMaybeThenable(promise, maybeThenable, then$$1) {
  250. if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {
  251. handleOwnThenable(promise, maybeThenable);
  252. } else {
  253. if (then$$1 === undefined) {
  254. fulfill(promise, maybeThenable);
  255. } else if (isFunction(then$$1)) {
  256. handleForeignThenable(promise, maybeThenable, then$$1);
  257. } else {
  258. fulfill(promise, maybeThenable);
  259. }
  260. }
  261. }
  262. function resolve(promise, value) {
  263. if (promise === value) {
  264. reject(promise, selfFulfillment());
  265. } else if (objectOrFunction(value)) {
  266. var then$$1 = void 0;
  267. try {
  268. then$$1 = value.then;
  269. } catch (error) {
  270. reject(promise, error);
  271. return;
  272. }
  273. handleMaybeThenable(promise, value, then$$1);
  274. } else {
  275. fulfill(promise, value);
  276. }
  277. }
  278. function publishRejection(promise) {
  279. if (promise._onerror) {
  280. promise._onerror(promise._result);
  281. }
  282. publish(promise);
  283. }
  284. function fulfill(promise, value) {
  285. if (promise._state !== PENDING) {
  286. return;
  287. }
  288. promise._result = value;
  289. promise._state = FULFILLED;
  290. if (promise._subscribers.length !== 0) {
  291. asap(publish, promise);
  292. }
  293. }
  294. function reject(promise, reason) {
  295. if (promise._state !== PENDING) {
  296. return;
  297. }
  298. promise._state = REJECTED;
  299. promise._result = reason;
  300. asap(publishRejection, promise);
  301. }
  302. function subscribe(parent, child, onFulfillment, onRejection) {
  303. var _subscribers = parent._subscribers;
  304. var length = _subscribers.length;
  305. parent._onerror = null;
  306. _subscribers[length] = child;
  307. _subscribers[length + FULFILLED] = onFulfillment;
  308. _subscribers[length + REJECTED] = onRejection;
  309. if (length === 0 && parent._state) {
  310. asap(publish, parent);
  311. }
  312. }
  313. function publish(promise) {
  314. var subscribers = promise._subscribers;
  315. var settled = promise._state;
  316. if (subscribers.length === 0) {
  317. return;
  318. }
  319. var child = void 0,
  320. callback = void 0,
  321. detail = promise._result;
  322. for (var i = 0; i < subscribers.length; i += 3) {
  323. child = subscribers[i];
  324. callback = subscribers[i + settled];
  325. if (child) {
  326. invokeCallback(settled, child, callback, detail);
  327. } else {
  328. callback(detail);
  329. }
  330. }
  331. promise._subscribers.length = 0;
  332. }
  333. function invokeCallback(settled, promise, callback, detail) {
  334. var hasCallback = isFunction(callback),
  335. value = void 0,
  336. error = void 0,
  337. succeeded = true;
  338. if (hasCallback) {
  339. try {
  340. value = callback(detail);
  341. } catch (e) {
  342. succeeded = false;
  343. error = e;
  344. }
  345. if (promise === value) {
  346. reject(promise, cannotReturnOwn());
  347. return;
  348. }
  349. } else {
  350. value = detail;
  351. }
  352. if (promise._state !== PENDING) {
  353. // noop
  354. } else if (hasCallback && succeeded) {
  355. resolve(promise, value);
  356. } else if (succeeded === false) {
  357. reject(promise, error);
  358. } else if (settled === FULFILLED) {
  359. fulfill(promise, value);
  360. } else if (settled === REJECTED) {
  361. reject(promise, value);
  362. }
  363. }
  364. function initializePromise(promise, resolver) {
  365. try {
  366. resolver(function resolvePromise(value) {
  367. resolve(promise, value);
  368. }, function rejectPromise(reason) {
  369. reject(promise, reason);
  370. });
  371. } catch (e) {
  372. reject(promise, e);
  373. }
  374. }
  375. var id = 0;
  376. function nextId() {
  377. return id++;
  378. }
  379. function makePromise(promise) {
  380. promise[PROMISE_ID] = id++;
  381. promise._state = undefined;
  382. promise._result = undefined;
  383. promise._subscribers = [];
  384. }
  385. function validationError() {
  386. return new Error('Array Methods must be provided an Array');
  387. }
  388. var Enumerator = function () {
  389. function Enumerator(Constructor, input) {
  390. this._instanceConstructor = Constructor;
  391. this.promise = new Constructor(noop);
  392. if (!this.promise[PROMISE_ID]) {
  393. makePromise(this.promise);
  394. }
  395. if (isArray(input)) {
  396. this.length = input.length;
  397. this._remaining = input.length;
  398. this._result = new Array(this.length);
  399. if (this.length === 0) {
  400. fulfill(this.promise, this._result);
  401. } else {
  402. this.length = this.length || 0;
  403. this._enumerate(input);
  404. if (this._remaining === 0) {
  405. fulfill(this.promise, this._result);
  406. }
  407. }
  408. } else {
  409. reject(this.promise, validationError());
  410. }
  411. }
  412. Enumerator.prototype._enumerate = function _enumerate(input) {
  413. for (var i = 0; this._state === PENDING && i < input.length; i++) {
  414. this._eachEntry(input[i], i);
  415. }
  416. };
  417. Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {
  418. var c = this._instanceConstructor;
  419. var resolve$$1 = c.resolve;
  420. if (resolve$$1 === resolve$1) {
  421. var _then = void 0;
  422. var error = void 0;
  423. var didError = false;
  424. try {
  425. _then = entry.then;
  426. } catch (e) {
  427. didError = true;
  428. error = e;
  429. }
  430. if (_then === then && entry._state !== PENDING) {
  431. this._settledAt(entry._state, i, entry._result);
  432. } else if (typeof _then !== 'function') {
  433. this._remaining--;
  434. this._result[i] = entry;
  435. } else if (c === Promise$1) {
  436. var promise = new c(noop);
  437. if (didError) {
  438. reject(promise, error);
  439. } else {
  440. handleMaybeThenable(promise, entry, _then);
  441. }
  442. this._willSettleAt(promise, i);
  443. } else {
  444. this._willSettleAt(new c(function (resolve$$1) {
  445. return resolve$$1(entry);
  446. }), i);
  447. }
  448. } else {
  449. this._willSettleAt(resolve$$1(entry), i);
  450. }
  451. };
  452. Enumerator.prototype._settledAt = function _settledAt(state, i, value) {
  453. var promise = this.promise;
  454. if (promise._state === PENDING) {
  455. this._remaining--;
  456. if (state === REJECTED) {
  457. reject(promise, value);
  458. } else {
  459. this._result[i] = value;
  460. }
  461. }
  462. if (this._remaining === 0) {
  463. fulfill(promise, this._result);
  464. }
  465. };
  466. Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {
  467. var enumerator = this;
  468. subscribe(promise, undefined, function (value) {
  469. return enumerator._settledAt(FULFILLED, i, value);
  470. }, function (reason) {
  471. return enumerator._settledAt(REJECTED, i, reason);
  472. });
  473. };
  474. return Enumerator;
  475. }();
  476. /**
  477. `Promise.all` accepts an array of promises, and returns a new promise which
  478. is fulfilled with an array of fulfillment values for the passed promises, or
  479. rejected with the reason of the first passed promise to be rejected. It casts all
  480. elements of the passed iterable to promises as it runs this algorithm.
  481. Example:
  482. ```javascript
  483. let promise1 = resolve(1);
  484. let promise2 = resolve(2);
  485. let promise3 = resolve(3);
  486. let promises = [ promise1, promise2, promise3 ];
  487. Promise.all(promises).then(function(array){
  488. // The array here would be [ 1, 2, 3 ];
  489. });
  490. ```
  491. If any of the `promises` given to `all` are rejected, the first promise
  492. that is rejected will be given as an argument to the returned promises's
  493. rejection handler. For example:
  494. Example:
  495. ```javascript
  496. let promise1 = resolve(1);
  497. let promise2 = reject(new Error("2"));
  498. let promise3 = reject(new Error("3"));
  499. let promises = [ promise1, promise2, promise3 ];
  500. Promise.all(promises).then(function(array){
  501. // Code here never runs because there are rejected promises!
  502. }, function(error) {
  503. // error.message === "2"
  504. });
  505. ```
  506. @method all
  507. @static
  508. @param {Array} entries array of promises
  509. @param {String} label optional string for labeling the promise.
  510. Useful for tooling.
  511. @return {Promise} promise that is fulfilled when all `promises` have been
  512. fulfilled, or rejected if any of them become rejected.
  513. @static
  514. */
  515. function all(entries) {
  516. return new Enumerator(this, entries).promise;
  517. }
  518. /**
  519. `Promise.race` returns a new promise which is settled in the same way as the
  520. first passed promise to settle.
  521. Example:
  522. ```javascript
  523. let promise1 = new Promise(function(resolve, reject){
  524. setTimeout(function(){
  525. resolve('promise 1');
  526. }, 200);
  527. });
  528. let promise2 = new Promise(function(resolve, reject){
  529. setTimeout(function(){
  530. resolve('promise 2');
  531. }, 100);
  532. });
  533. Promise.race([promise1, promise2]).then(function(result){
  534. // result === 'promise 2' because it was resolved before promise1
  535. // was resolved.
  536. });
  537. ```
  538. `Promise.race` is deterministic in that only the state of the first
  539. settled promise matters. For example, even if other promises given to the
  540. `promises` array argument are resolved, but the first settled promise has
  541. become rejected before the other promises became fulfilled, the returned
  542. promise will become rejected:
  543. ```javascript
  544. let promise1 = new Promise(function(resolve, reject){
  545. setTimeout(function(){
  546. resolve('promise 1');
  547. }, 200);
  548. });
  549. let promise2 = new Promise(function(resolve, reject){
  550. setTimeout(function(){
  551. reject(new Error('promise 2'));
  552. }, 100);
  553. });
  554. Promise.race([promise1, promise2]).then(function(result){
  555. // Code here never runs
  556. }, function(reason){
  557. // reason.message === 'promise 2' because promise 2 became rejected before
  558. // promise 1 became fulfilled
  559. });
  560. ```
  561. An example real-world use case is implementing timeouts:
  562. ```javascript
  563. Promise.race([ajax('foo.json'), timeout(5000)])
  564. ```
  565. @method race
  566. @static
  567. @param {Array} promises array of promises to observe
  568. Useful for tooling.
  569. @return {Promise} a promise which settles in the same way as the first passed
  570. promise to settle.
  571. */
  572. function race(entries) {
  573. /*jshint validthis:true */
  574. var Constructor = this;
  575. if (!isArray(entries)) {
  576. return new Constructor(function (_, reject) {
  577. return reject(new TypeError('You must pass an array to race.'));
  578. });
  579. } else {
  580. return new Constructor(function (resolve, reject) {
  581. var length = entries.length;
  582. for (var i = 0; i < length; i++) {
  583. Constructor.resolve(entries[i]).then(resolve, reject);
  584. }
  585. });
  586. }
  587. }
  588. /**
  589. `Promise.reject` returns a promise rejected with the passed `reason`.
  590. It is shorthand for the following:
  591. ```javascript
  592. let promise = new Promise(function(resolve, reject){
  593. reject(new Error('WHOOPS'));
  594. });
  595. promise.then(function(value){
  596. // Code here doesn't run because the promise is rejected!
  597. }, function(reason){
  598. // reason.message === 'WHOOPS'
  599. });
  600. ```
  601. Instead of writing the above, your code now simply becomes the following:
  602. ```javascript
  603. let promise = Promise.reject(new Error('WHOOPS'));
  604. promise.then(function(value){
  605. // Code here doesn't run because the promise is rejected!
  606. }, function(reason){
  607. // reason.message === 'WHOOPS'
  608. });
  609. ```
  610. @method reject
  611. @static
  612. @param {Any} reason value that the returned promise will be rejected with.
  613. Useful for tooling.
  614. @return {Promise} a promise rejected with the given `reason`.
  615. */
  616. function reject$1(reason) {
  617. /*jshint validthis:true */
  618. var Constructor = this;
  619. var promise = new Constructor(noop);
  620. reject(promise, reason);
  621. return promise;
  622. }
  623. function needsResolver() {
  624. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  625. }
  626. function needsNew() {
  627. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  628. }
  629. /**
  630. Promise objects represent the eventual result of an asynchronous operation. The
  631. primary way of interacting with a promise is through its `then` method, which
  632. registers callbacks to receive either a promise's eventual value or the reason
  633. why the promise cannot be fulfilled.
  634. Terminology
  635. -----------
  636. - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
  637. - `thenable` is an object or function that defines a `then` method.
  638. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
  639. - `exception` is a value that is thrown using the throw statement.
  640. - `reason` is a value that indicates why a promise was rejected.
  641. - `settled` the final resting state of a promise, fulfilled or rejected.
  642. A promise can be in one of three states: pending, fulfilled, or rejected.
  643. Promises that are fulfilled have a fulfillment value and are in the fulfilled
  644. state. Promises that are rejected have a rejection reason and are in the
  645. rejected state. A fulfillment value is never a thenable.
  646. Promises can also be said to *resolve* a value. If this value is also a
  647. promise, then the original promise's settled state will match the value's
  648. settled state. So a promise that *resolves* a promise that rejects will
  649. itself reject, and a promise that *resolves* a promise that fulfills will
  650. itself fulfill.
  651. Basic Usage:
  652. ------------
  653. ```js
  654. let promise = new Promise(function(resolve, reject) {
  655. // on success
  656. resolve(value);
  657. // on failure
  658. reject(reason);
  659. });
  660. promise.then(function(value) {
  661. // on fulfillment
  662. }, function(reason) {
  663. // on rejection
  664. });
  665. ```
  666. Advanced Usage:
  667. ---------------
  668. Promises shine when abstracting away asynchronous interactions such as
  669. `XMLHttpRequest`s.
  670. ```js
  671. function getJSON(url) {
  672. return new Promise(function(resolve, reject){
  673. let xhr = new XMLHttpRequest();
  674. xhr.open('GET', url);
  675. xhr.onreadystatechange = handler;
  676. xhr.responseType = 'json';
  677. xhr.setRequestHeader('Accept', 'application/json');
  678. xhr.send();
  679. function handler() {
  680. if (this.readyState === this.DONE) {
  681. if (this.status === 200) {
  682. resolve(this.response);
  683. } else {
  684. reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
  685. }
  686. }
  687. };
  688. });
  689. }
  690. getJSON('/posts.json').then(function(json) {
  691. // on fulfillment
  692. }, function(reason) {
  693. // on rejection
  694. });
  695. ```
  696. Unlike callbacks, promises are great composable primitives.
  697. ```js
  698. Promise.all([
  699. getJSON('/posts'),
  700. getJSON('/comments')
  701. ]).then(function(values){
  702. values[0] // => postsJSON
  703. values[1] // => commentsJSON
  704. return values;
  705. });
  706. ```
  707. @class Promise
  708. @param {Function} resolver
  709. Useful for tooling.
  710. @constructor
  711. */
  712. var Promise$1 = function () {
  713. function Promise(resolver) {
  714. this[PROMISE_ID] = nextId();
  715. this._result = this._state = undefined;
  716. this._subscribers = [];
  717. if (noop !== resolver) {
  718. typeof resolver !== 'function' && needsResolver();
  719. this instanceof Promise ? initializePromise(this, resolver) : needsNew();
  720. }
  721. }
  722. /**
  723. The primary way of interacting with a promise is through its `then` method,
  724. which registers callbacks to receive either a promise's eventual value or the
  725. reason why the promise cannot be fulfilled.
  726. ```js
  727. findUser().then(function(user){
  728. // user is available
  729. }, function(reason){
  730. // user is unavailable, and you are given the reason why
  731. });
  732. ```
  733. Chaining
  734. --------
  735. The return value of `then` is itself a promise. This second, 'downstream'
  736. promise is resolved with the return value of the first promise's fulfillment
  737. or rejection handler, or rejected if the handler throws an exception.
  738. ```js
  739. findUser().then(function (user) {
  740. return user.name;
  741. }, function (reason) {
  742. return 'default name';
  743. }).then(function (userName) {
  744. // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
  745. // will be `'default name'`
  746. });
  747. findUser().then(function (user) {
  748. throw new Error('Found user, but still unhappy');
  749. }, function (reason) {
  750. throw new Error('`findUser` rejected and we're unhappy');
  751. }).then(function (value) {
  752. // never reached
  753. }, function (reason) {
  754. // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
  755. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
  756. });
  757. ```
  758. If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  759. ```js
  760. findUser().then(function (user) {
  761. throw new PedagogicalException('Upstream error');
  762. }).then(function (value) {
  763. // never reached
  764. }).then(function (value) {
  765. // never reached
  766. }, function (reason) {
  767. // The `PedgagocialException` is propagated all the way down to here
  768. });
  769. ```
  770. Assimilation
  771. ------------
  772. Sometimes the value you want to propagate to a downstream promise can only be
  773. retrieved asynchronously. This can be achieved by returning a promise in the
  774. fulfillment or rejection handler. The downstream promise will then be pending
  775. until the returned promise is settled. This is called *assimilation*.
  776. ```js
  777. findUser().then(function (user) {
  778. return findCommentsByAuthor(user);
  779. }).then(function (comments) {
  780. // The user's comments are now available
  781. });
  782. ```
  783. If the assimliated promise rejects, then the downstream promise will also reject.
  784. ```js
  785. findUser().then(function (user) {
  786. return findCommentsByAuthor(user);
  787. }).then(function (comments) {
  788. // If `findCommentsByAuthor` fulfills, we'll have the value here
  789. }, function (reason) {
  790. // If `findCommentsByAuthor` rejects, we'll have the reason here
  791. });
  792. ```
  793. Simple Example
  794. --------------
  795. Synchronous Example
  796. ```javascript
  797. let result;
  798. try {
  799. result = findResult();
  800. // success
  801. } catch(reason) {
  802. // failure
  803. }
  804. ```
  805. Errback Example
  806. ```js
  807. findResult(function(result, err){
  808. if (err) {
  809. // failure
  810. } else {
  811. // success
  812. }
  813. });
  814. ```
  815. Promise Example;
  816. ```javascript
  817. findResult().then(function(result){
  818. // success
  819. }, function(reason){
  820. // failure
  821. });
  822. ```
  823. Advanced Example
  824. --------------
  825. Synchronous Example
  826. ```javascript
  827. let author, books;
  828. try {
  829. author = findAuthor();
  830. books = findBooksByAuthor(author);
  831. // success
  832. } catch(reason) {
  833. // failure
  834. }
  835. ```
  836. Errback Example
  837. ```js
  838. function foundBooks(books) {
  839. }
  840. function failure(reason) {
  841. }
  842. findAuthor(function(author, err){
  843. if (err) {
  844. failure(err);
  845. // failure
  846. } else {
  847. try {
  848. findBoooksByAuthor(author, function(books, err) {
  849. if (err) {
  850. failure(err);
  851. } else {
  852. try {
  853. foundBooks(books);
  854. } catch(reason) {
  855. failure(reason);
  856. }
  857. }
  858. });
  859. } catch(error) {
  860. failure(err);
  861. }
  862. // success
  863. }
  864. });
  865. ```
  866. Promise Example;
  867. ```javascript
  868. findAuthor().
  869. then(findBooksByAuthor).
  870. then(function(books){
  871. // found books
  872. }).catch(function(reason){
  873. // something went wrong
  874. });
  875. ```
  876. @method then
  877. @param {Function} onFulfilled
  878. @param {Function} onRejected
  879. Useful for tooling.
  880. @return {Promise}
  881. */
  882. /**
  883. `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
  884. as the catch block of a try/catch statement.
  885. ```js
  886. function findAuthor(){
  887. throw new Error('couldn't find that author');
  888. }
  889. // synchronous
  890. try {
  891. findAuthor();
  892. } catch(reason) {
  893. // something went wrong
  894. }
  895. // async with promises
  896. findAuthor().catch(function(reason){
  897. // something went wrong
  898. });
  899. ```
  900. @method catch
  901. @param {Function} onRejection
  902. Useful for tooling.
  903. @return {Promise}
  904. */
  905. Promise.prototype.catch = function _catch(onRejection) {
  906. return this.then(null, onRejection);
  907. };
  908. /**
  909. `finally` will be invoked regardless of the promise's fate just as native
  910. try/catch/finally behaves
  911. Synchronous example:
  912. ```js
  913. findAuthor() {
  914. if (Math.random() > 0.5) {
  915. throw new Error();
  916. }
  917. return new Author();
  918. }
  919. try {
  920. return findAuthor(); // succeed or fail
  921. } catch(error) {
  922. return findOtherAuther();
  923. } finally {
  924. // always runs
  925. // doesn't affect the return value
  926. }
  927. ```
  928. Asynchronous example:
  929. ```js
  930. findAuthor().catch(function(reason){
  931. return findOtherAuther();
  932. }).finally(function(){
  933. // author was either found, or not
  934. });
  935. ```
  936. @method finally
  937. @param {Function} callback
  938. @return {Promise}
  939. */
  940. Promise.prototype.finally = function _finally(callback) {
  941. var promise = this;
  942. var constructor = promise.constructor;
  943. if (isFunction(callback)) {
  944. return promise.then(function (value) {
  945. return constructor.resolve(callback()).then(function () {
  946. return value;
  947. });
  948. }, function (reason) {
  949. return constructor.resolve(callback()).then(function () {
  950. throw reason;
  951. });
  952. });
  953. }
  954. return promise.then(callback, callback);
  955. };
  956. return Promise;
  957. }();
  958. Promise$1.prototype.then = then;
  959. Promise$1.all = all;
  960. Promise$1.race = race;
  961. Promise$1.resolve = resolve$1;
  962. Promise$1.reject = reject$1;
  963. Promise$1._setScheduler = setScheduler;
  964. Promise$1._setAsap = setAsap;
  965. Promise$1._asap = asap;
  966. /*global self*/
  967. function polyfill() {
  968. var local = void 0;
  969. if (typeof global !== 'undefined') {
  970. local = global;
  971. } else if (typeof self !== 'undefined') {
  972. local = self;
  973. } else {
  974. try {
  975. local = Function('return this')();
  976. } catch (e) {
  977. throw new Error('polyfill failed because global object is unavailable in this environment');
  978. }
  979. }
  980. var P = local.Promise;
  981. if (P) {
  982. var promiseToString = null;
  983. try {
  984. promiseToString = Object.prototype.toString.call(P.resolve());
  985. } catch (e) {
  986. // silently ignored
  987. }
  988. if (promiseToString === '[object Promise]' && !P.cast) {
  989. return;
  990. }
  991. }
  992. local.Promise = Promise$1;
  993. }
  994. // Strange compat..
  995. Promise$1.polyfill = polyfill;
  996. Promise$1.Promise = Promise$1;
  997. return Promise$1;
  998. })));
  999. //# sourceMappingURL=es6-promise.map
  1000. ;
  1001. //jshint eqnull:true
  1002. define('amber/kernel-checks',[],function () {
  1003. "use strict";
  1004. function assert (fn) {
  1005. try {
  1006. if (fn()) return;
  1007. } catch (ex) {
  1008. throw new Error("Error:\n" + ex + "in assertion:\n" + fn);
  1009. }
  1010. throw new Error("Assertion failed:\n" + fn);
  1011. }
  1012. assert(function () {
  1013. return !("hasOwnProperty" in Object.create(null));
  1014. });
  1015. assert(function () {
  1016. return Object.getPrototypeOf(Object.create(null)) === null;
  1017. });
  1018. assert(function () {
  1019. var p = {};
  1020. return Object.getPrototypeOf(Object.create(p)) === p;
  1021. });
  1022. assert(function () {
  1023. var p = {x: 4, y: 5}, q = {x: 6};
  1024. var r = Object.setPrototypeOf(q, p);
  1025. return r === q &&
  1026. q.x === 6 &&
  1027. q.y === 5;
  1028. });
  1029. // assert(function () {
  1030. // return new Function("return this")().Object === Object;
  1031. // });
  1032. // assert(function () {
  1033. // return Object.create(new Function("return this")()).Object === Object;
  1034. // });
  1035. assert(function () {
  1036. return typeof global !== "undefined";
  1037. });
  1038. assert(function () {
  1039. return global.Object === Object;
  1040. });
  1041. assert(function () {
  1042. return Object.create(global).Object === Object;
  1043. });
  1044. assert(function () {
  1045. return (function () {
  1046. return this;
  1047. }).apply(void 0) === void 0;
  1048. });
  1049. assert(function () {
  1050. return (function () {
  1051. return this;
  1052. }).apply(null) === null;
  1053. });
  1054. assert(function () {
  1055. return (function () {
  1056. return this;
  1057. }).apply(3) === 3;
  1058. });
  1059. assert(function () {
  1060. return (function () {
  1061. return this;
  1062. }).apply("foo") === "foo";
  1063. });
  1064. assert(function () {
  1065. return (function () {
  1066. return this;
  1067. }).apply(true) === true;
  1068. });
  1069. assert(function () {
  1070. var o = Object.freeze({});
  1071. try {
  1072. o.foo = "bar";
  1073. } catch (ex) {
  1074. }
  1075. return o.foo == null;
  1076. });
  1077. assert(function () {
  1078. return typeof Promise === "function";
  1079. });
  1080. assert(function () {
  1081. return typeof Promise.resolve === "function";
  1082. });
  1083. assert(function () {
  1084. return typeof Promise.reject === "function";
  1085. });
  1086. assert(function () {
  1087. return typeof new Promise(function () {
  1088. }).then === "function";
  1089. });
  1090. });
  1091. define('amber/brikz',[], function () {
  1092. return function Brikz(api, apiKey, initKey, backupKey) {
  1093. "use strict";
  1094. //jshint eqnull:true
  1095. var backup = {};
  1096. apiKey = apiKey || 'exports';
  1097. initKey = initKey || '__init__';
  1098. backupKey = backupKey || 'backup';
  1099. function mixin(src, target, what) {
  1100. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  1101. if (src == null) {
  1102. target[keys[i]] = undefined;
  1103. } else {
  1104. var value = src[keys[i]];
  1105. if (typeof value !== "undefined") {
  1106. target[keys[i]] = value;
  1107. }
  1108. }
  1109. }
  1110. return target;
  1111. }
  1112. return function brikz() {
  1113. Object.keys(backup).forEach(function (key) {
  1114. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  1115. });
  1116. var oapi = mixin(api, {}),
  1117. order = [],
  1118. chk = {};
  1119. function ensure(key) {
  1120. var b = brikz[key],
  1121. bak = backup[key];
  1122. while (typeof b === "function") {
  1123. (b.deps || []).forEach(ensure);
  1124. b[backupKey] = bak;
  1125. mixin(null, api, api);
  1126. b = new b(brikz, api);
  1127. }
  1128. brikz[key] = b;
  1129. if (b && !chk[key]) {
  1130. chk[key] = true;
  1131. order.push(b);
  1132. }
  1133. if (b && !b[apiKey]) {
  1134. b[apiKey] = mixin(api, {});
  1135. }
  1136. }
  1137. Object.keys(brikz).forEach(ensure);
  1138. mixin(oapi, mixin(null, api, api));
  1139. order.forEach(function (brik) {
  1140. mixin(brik[apiKey] || {}, api);
  1141. });
  1142. order.forEach(function (brik) {
  1143. if (brik[initKey]) {
  1144. brik[initKey]();
  1145. if (brik[initKey].once) {
  1146. delete brik[initKey];
  1147. }
  1148. }
  1149. });
  1150. backup = mixin(brikz, {});
  1151. };
  1152. };
  1153. });
  1154. //jshint eqnull:true
  1155. define('amber/junk-drawer',[],function () {
  1156. "use strict";
  1157. function inherits (child, parent) {
  1158. child.prototype = Object.create(parent.prototype, {
  1159. constructor: {
  1160. value: child,
  1161. enumerable: false, configurable: true, writable: true
  1162. }
  1163. });
  1164. return child;
  1165. }
  1166. function installMethodOfJsObject (obj, name, fn) {
  1167. Object.defineProperty(obj, name, {
  1168. value: fn,
  1169. enumerable: false, configurable: true, writable: true
  1170. });
  1171. }
  1172. function noop () {
  1173. }
  1174. function declareJsMethod (obj, name) {
  1175. if (obj[name] == null) installMethodOfJsObject(obj, name, noop);
  1176. }
  1177. var table = {
  1178. ':': '_',
  1179. '&': '_and',
  1180. '|': '_or',
  1181. '+': '_plus',
  1182. '-': '_minus',
  1183. '*': '_star',
  1184. '/': '_slash',
  1185. '\\': '_backslash',
  1186. '~': '_tild',
  1187. '%': '_percent',
  1188. '>': '_gt',
  1189. '<': '_lt',
  1190. '=': '_eq',
  1191. ',': '_comma',
  1192. '@': '_at'
  1193. };
  1194. /* Convert a Smalltalk selector into a JS selector */
  1195. function st2js (string) {
  1196. return '_' + string
  1197. .replace(/[:&|+\-*/\\~%><=,@]/g, function (ch) {
  1198. return table[ch];
  1199. });
  1200. };
  1201. function js2st (selector) {
  1202. if (selector.match(/^__/)) {
  1203. return binaryJsToSt(selector);
  1204. } else {
  1205. return keywordJsToSt(selector);
  1206. }
  1207. }
  1208. function keywordJsToSt (selector) {
  1209. return selector.replace(/^_/, '').replace(/_/g, ':');
  1210. }
  1211. function binaryJsToSt (selector) {
  1212. return selector
  1213. .replace(/^_/, '')
  1214. .replace(/_and/g, '&')
  1215. .replace(/_or/g, '|')
  1216. .replace(/_plus/g, '+')
  1217. .replace(/_minus/g, '-')
  1218. .replace(/_star/g, '*')
  1219. .replace(/_slash/g, '/')
  1220. .replace(/_backslash/g, '\\')
  1221. .replace(/_tild/g, '~')
  1222. .replace(/_percent/g, '%')
  1223. .replace(/_gt/g, '>')
  1224. .replace(/_lt/g, '<')
  1225. .replace(/_eq/g, '=')
  1226. .replace(/_comma/g, ',')
  1227. .replace(/_at/g, '@');
  1228. }
  1229. function addElement (array, el) {
  1230. if (typeof el === 'undefined') {
  1231. return;
  1232. }
  1233. if (array.indexOf(el) === -1) {
  1234. array.push(el);
  1235. }
  1236. }
  1237. function removeElement (array, el) {
  1238. var i = array.indexOf(el);
  1239. if (i !== -1) {
  1240. array.splice(i, 1);
  1241. }
  1242. }
  1243. function extend (target, source) {
  1244. Object.keys(source).forEach(function (key) {
  1245. target[key] = source[key];
  1246. });
  1247. return target;
  1248. }
  1249. function extendWithMethods (target, source) {
  1250. Object.keys(source).forEach(function (key) {
  1251. installMethodOfJsObject(target, key, source[key]);
  1252. });
  1253. return target;
  1254. }
  1255. function deleteKeysFrom (keys, obj) {
  1256. keys.forEach(function (each) {
  1257. delete obj[each];
  1258. });
  1259. }
  1260. return {
  1261. deleteKeysFrom: deleteKeysFrom,
  1262. extendWithMethods: extendWithMethods,
  1263. extend: extend,
  1264. removeElement: removeElement,
  1265. addElement: addElement,
  1266. js2st: js2st,
  1267. st2js: st2js,
  1268. declareJsMethod: declareJsMethod,
  1269. installMethodOfJsObject: installMethodOfJsObject,
  1270. inherits: inherits
  1271. }
  1272. });
  1273. //jshint eqnull:true
  1274. define('amber/kernel-fundamentals',['./junk-drawer'], function ($goodies) {
  1275. "use strict";
  1276. var inherits = $goodies.inherits;
  1277. var declareJsMethod = $goodies.declareJsMethod;
  1278. var addElement = $goodies.addElement;
  1279. var removeElement = $goodies.removeElement;
  1280. function SelectorsBrik (brikz, st) {
  1281. var selectorSet = Object.create(null);
  1282. var selectors = this.selectors = [];
  1283. this.registerSelector = function (stSelector) {
  1284. if (selectorSet[stSelector]) return false;
  1285. selectors.push(stSelector);
  1286. return selectorSet[stSelector] = true;
  1287. };
  1288. st.allSelectors = function () {
  1289. return selectors;
  1290. };
  1291. }
  1292. function PackagesBrik (brikz, st) {
  1293. st.packageDescriptors = {};
  1294. /* Add a package load descriptor to the system */
  1295. st.addPackage = function (name, properties) {
  1296. if (!name) return null;
  1297. return st.packageDescriptors[name] = {properties: properties};
  1298. };
  1299. }
  1300. function FundamentalsFactory (globals, emit) {
  1301. var specialConstructors = Object.create(null);
  1302. function declareEvent (name) {
  1303. declareJsMethod(emit, name);
  1304. }
  1305. function RootBrik (brikz, st) {
  1306. /* Smalltalk foundational objects */
  1307. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1308. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1309. Detached roots (eg. wrapped JS classes like Number or Date)
  1310. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1311. function SmalltalkRoot () {
  1312. }
  1313. function SmalltalkProtoObject () {
  1314. }
  1315. function SmalltalkObject () {
  1316. }
  1317. specialConstructors.ProtoObject = inherits(SmalltalkProtoObject, SmalltalkRoot);
  1318. specialConstructors.Object = inherits(SmalltalkObject, SmalltalkProtoObject);
  1319. this.Root = SmalltalkRoot;
  1320. this.Object = SmalltalkObject;
  1321. }
  1322. BehavioralsBrik.deps = ["root"];
  1323. function BehavioralsBrik (brikz, st) {
  1324. /* Smalltalk classes and traits */
  1325. var traitsOrClasses = [];
  1326. this.buildTraitOrClass = function (builder) {
  1327. var traitOrClass = globals.hasOwnProperty(builder.name) && globals[builder.name];
  1328. if (traitOrClass) {
  1329. builder.updateExisting(traitOrClass);
  1330. return traitOrClass;
  1331. } else {
  1332. return addTraitOrClass(builder.make());
  1333. }
  1334. };
  1335. declareEvent("behavioralAdded");
  1336. function addTraitOrClass (traitOrClass) {
  1337. globals[traitOrClass.name] = traitOrClass;
  1338. addElement(traitsOrClasses, traitOrClass);
  1339. traitOrClass.added();
  1340. emit.behavioralAdded(traitOrClass);
  1341. return traitOrClass;
  1342. }
  1343. declareEvent("behavioralRemoved");
  1344. function removeTraitOrClass (traitOrClass) {
  1345. emit.behavioralRemoved(traitOrClass);
  1346. traitOrClass.removed();
  1347. removeElement(traitsOrClasses, traitOrClass);
  1348. delete globals[traitOrClass.name];
  1349. return traitOrClass;
  1350. }
  1351. this.removeTraitOrClass = removeTraitOrClass;
  1352. st.traitsOrClasses = this.traitsOrClasses = traitsOrClasses;
  1353. }
  1354. MethodsBrik.deps = ["selectors", "root"];
  1355. function MethodsBrik (brikz, st) {
  1356. var registerSelector = brikz.selectors.registerSelector;
  1357. var SmalltalkObject = brikz.root.Object;
  1358. function SmalltalkMethod () {
  1359. }
  1360. specialConstructors.CompiledMethod = inherits(SmalltalkMethod, SmalltalkObject);
  1361. /* Smalltalk method object. To add a method to a class,
  1362. use api.addMethod() */
  1363. st.method = function (spec, factory) {
  1364. var that = new SmalltalkMethod();
  1365. that.selector = spec.selector;
  1366. that.args = spec.args || [];
  1367. that.protocol = spec.protocol;
  1368. that.source = spec.source;
  1369. that.pragmas = spec.pragmas;
  1370. that.messageSends = spec.messageSends || [];
  1371. // TODO remove .referencedClasses, have .referencedGlobals
  1372. that.referencedClasses = spec.referencedClasses || [];
  1373. that.fn = spec.fn;
  1374. if (factory) that.instantiateFn = factory;
  1375. return that;
  1376. };
  1377. /* Add/remove a method to/from a class */
  1378. st.addMethod = function (method, traitOrBehavior) {
  1379. if (method.owner != null) {
  1380. throw new Error("addMethod: Method " + method.selector + " already bound to " + method.owner);
  1381. }
  1382. method.owner = traitOrBehavior;
  1383. registerNewSelectors(method);
  1384. traitOrBehavior.localMethods[method.selector] = method;
  1385. updateMethod(method.selector, traitOrBehavior);
  1386. };
  1387. declareEvent("selectorsAdded");
  1388. function registerNewSelectors (method) {
  1389. var newSelectors = [];
  1390. function selectorInUse (stSelector) {
  1391. if (registerSelector(stSelector)) {
  1392. newSelectors.push(stSelector);
  1393. }
  1394. }
  1395. selectorInUse(method.selector);
  1396. method.messageSends.forEach(selectorInUse);
  1397. emit.selectorsAdded(newSelectors);
  1398. }
  1399. st.removeMethod = function (method, traitOrBehavior) {
  1400. if (traitOrBehavior.localMethods[method.selector] !== method) return;
  1401. delete traitOrBehavior.localMethods[method.selector];
  1402. updateMethod(method.selector, traitOrBehavior);
  1403. };
  1404. this.setupMethods = function (traitOrBehavior) {
  1405. traitOrBehavior.localMethods = Object.create(null);
  1406. traitOrBehavior.methods = Object.create(null);
  1407. };
  1408. function setLocalMethods (traitOrBehavior, newLocalMethods) {
  1409. var oldLocalMethods = traitOrBehavior.localMethods;
  1410. traitOrBehavior.localMethods = newLocalMethods;
  1411. var selector;
  1412. for (selector in newLocalMethods) {
  1413. updateMethod(selector, traitOrBehavior);
  1414. }
  1415. for (selector in oldLocalMethods) {
  1416. updateMethod(selector, traitOrBehavior);
  1417. }
  1418. }
  1419. this.setLocalMethods = setLocalMethods;
  1420. declareEvent("methodReplaced");
  1421. function updateMethod (selector, traitOrBehavior) {
  1422. var oldMethod = traitOrBehavior.methods[selector],
  1423. newMethod = traitOrBehavior.localMethods[selector];
  1424. if (oldMethod == null && newMethod == null) {
  1425. console.warn("Removal of nonexistent method " + traitOrBehavior + " >> " + selector);
  1426. return;
  1427. }
  1428. if (newMethod === oldMethod) return;
  1429. if (newMethod != null) {
  1430. if (newMethod.methodClass && newMethod.methodClass !== traitOrBehavior) {
  1431. console.warn("Resetting methodClass of " + newMethod.methodClass.name + " >> " + selector + " to " + traitOrBehavior.name);
  1432. }
  1433. newMethod.methodClass = traitOrBehavior;
  1434. if (newMethod.instantiateFn) {
  1435. newMethod.fn = newMethod.instantiateFn(traitOrBehavior);
  1436. }
  1437. traitOrBehavior.methods[selector] = newMethod;
  1438. traitOrBehavior.methodAdded(newMethod);
  1439. } else {
  1440. delete traitOrBehavior.methods[selector];
  1441. traitOrBehavior.methodRemoved(oldMethod);
  1442. }
  1443. emit.methodReplaced(newMethod, oldMethod, traitOrBehavior);
  1444. }
  1445. this.updateMethod = updateMethod;
  1446. }
  1447. NilBrik.deps = ["root"];
  1448. function NilBrik (brikz, st) {
  1449. var SmalltalkObject = brikz.root.Object;
  1450. function SmalltalkNil () {
  1451. }
  1452. specialConstructors.UndefinedObject = inherits(SmalltalkNil, SmalltalkObject);
  1453. this.nilAsReceiver = new SmalltalkNil();
  1454. this.nilAsValue = this.nilAsReceiver; // TODO null
  1455. // Adds an `a$nil` property to the `nil` object. When sending
  1456. // nil objects from one environment to another, doing
  1457. // `anObject == nil` (in JavaScript) does not always answer
  1458. // true as the referenced nil object might come from the other
  1459. // environment.
  1460. Object.defineProperty(this.nilAsReceiver, 'a$nil', {
  1461. value: true,
  1462. enumerable: false, configurable: false, writable: false
  1463. });
  1464. }
  1465. /* Making smalltalk that has basic building blocks */
  1466. function configure (brikz) {
  1467. brikz.root = RootBrik;
  1468. brikz.nil = NilBrik;
  1469. brikz.selectors = SelectorsBrik;
  1470. brikz.packages = PackagesBrik;
  1471. brikz.behaviorals = BehavioralsBrik;
  1472. brikz.methods = MethodsBrik;
  1473. brikz();
  1474. }
  1475. return {configure: configure, specialConstructors: specialConstructors};
  1476. }
  1477. return FundamentalsFactory;
  1478. });
  1479. //jshint eqnull:true
  1480. define('amber/kernel-language',['./junk-drawer'], function ($goodies) {
  1481. "use strict";
  1482. var inherits = $goodies.inherits;
  1483. var declareJsMethod = $goodies.declareJsMethod;
  1484. var addElement = $goodies.addElement;
  1485. var removeElement = $goodies.removeElement;
  1486. var extend = $goodies.extend;
  1487. var deleteKeysFrom = $goodies.deleteKeysFrom;
  1488. MethodCompositionBrik.deps = ["methods"];
  1489. function MethodCompositionBrik (brikz, st) {
  1490. var setLocalMethods = brikz.methods.setLocalMethods;
  1491. var updateMethod = brikz.methods.updateMethod;
  1492. function aliased (selector, method) {
  1493. var result = st.method(method, method.instantiateFn);
  1494. if (method.selector !== selector) {
  1495. result.selector = selector;
  1496. result.source = '"Aliased as ' + selector + '"\n' + method.source;
  1497. }
  1498. result.owner = method.owner;
  1499. return result;
  1500. }
  1501. function fillTraitTransformation (traitTransformation, obj) {
  1502. // assert(Object.getOwnProperties(obj).length === 0)
  1503. var traitMethods = traitTransformation.trait.methods;
  1504. Object.keys(traitMethods).forEach(function (selector) {
  1505. obj[selector] = aliased(selector, traitMethods[selector]);
  1506. });
  1507. var traitAliases = traitTransformation.aliases;
  1508. if (traitAliases) {
  1509. Object.keys(traitAliases).forEach(function (aliasSelector) {
  1510. var aliasedMethod = traitMethods[traitAliases[aliasSelector]];
  1511. if (aliasedMethod) obj[aliasSelector] = aliased(aliasSelector, aliasedMethod);
  1512. // else delete obj[aliasSelector]; // semantically correct; optimized away
  1513. });
  1514. }
  1515. var traitExclusions = traitTransformation.exclusions;
  1516. if (traitExclusions) {
  1517. deleteKeysFrom(traitExclusions, obj);
  1518. }
  1519. return obj;
  1520. }
  1521. function buildCompositionChain (traitComposition) {
  1522. return traitComposition.reduce(function (soFar, each) {
  1523. return fillTraitTransformation(each, Object.create(soFar));
  1524. }, null);
  1525. }
  1526. st.setTraitComposition = function (traitComposition, traitOrBehavior) {
  1527. var oldLocalMethods = traitOrBehavior.localMethods,
  1528. newLocalMethodsTemplate = Object.create(buildCompositionChain(traitComposition));
  1529. setLocalMethods(traitOrBehavior, extend(newLocalMethodsTemplate, oldLocalMethods));
  1530. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  1531. removeElement(each.trait.traitUsers, traitOrBehavior);
  1532. });
  1533. traitOrBehavior.traitComposition = traitComposition && traitComposition.length ? traitComposition : null;
  1534. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  1535. addElement(each.trait.traitUsers, traitOrBehavior);
  1536. });
  1537. };
  1538. function aliasesOfSelector (selector, traitAliases) {
  1539. if (!traitAliases) return [selector];
  1540. var result = Object.keys(traitAliases).filter(function (aliasSelector) {
  1541. return traitAliases[aliasSelector] === selector
  1542. });
  1543. if (!traitAliases[selector]) result.push(selector);
  1544. return result;
  1545. }
  1546. function applyTraitMethodAddition (selector, method, traitTransformation, obj) {
  1547. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  1548. changes.forEach(function (aliasSelector) {
  1549. obj[aliasSelector] = aliased(aliasSelector, method);
  1550. });
  1551. var traitExclusions = traitTransformation.exclusions;
  1552. if (traitExclusions) {
  1553. deleteKeysFrom(traitExclusions, obj);
  1554. }
  1555. return changes;
  1556. }
  1557. function applyTraitMethodDeletion (selector, traitTransformation, obj) {
  1558. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  1559. deleteKeysFrom(changes, obj);
  1560. return changes;
  1561. }
  1562. function traitMethodChanged (selector, method, trait, traitOrBehavior) {
  1563. var traitComposition = traitOrBehavior.traitComposition,
  1564. chain = traitOrBehavior.localMethods,
  1565. changes = [];
  1566. for (var i = traitComposition.length - 1; i >= 0; --i) {
  1567. chain = Object.getPrototypeOf(chain);
  1568. var traitTransformation = traitComposition[i];
  1569. if (traitTransformation.trait !== trait) continue;
  1570. changes.push.apply(changes, method ?
  1571. applyTraitMethodAddition(selector, method, traitTransformation, chain) :
  1572. applyTraitMethodDeletion(selector, traitTransformation, chain));
  1573. }
  1574. // assert(chain === null);
  1575. changes.forEach(function (each) {
  1576. updateMethod(each, traitOrBehavior);
  1577. });
  1578. }
  1579. this.traitMethodChanged = traitMethodChanged;
  1580. }
  1581. function LanguageFactory (specialConstructors, emit) {
  1582. function declareEvent (name) {
  1583. declareJsMethod(emit, name);
  1584. }
  1585. TraitsBrik.deps = ["behaviorals", "methods", "composition", "root"];
  1586. function TraitsBrik (brikz, st) {
  1587. var SmalltalkObject = brikz.root.Object;
  1588. var setupMethods = brikz.methods.setupMethods;
  1589. var traitMethodChanged = brikz.composition.traitMethodChanged;
  1590. var buildTraitOrClass = brikz.behaviorals.buildTraitOrClass;
  1591. function SmalltalkTrait () {
  1592. }
  1593. specialConstructors.Trait = inherits(SmalltalkTrait, SmalltalkObject);
  1594. SmalltalkTrait.prototype.trait = true;
  1595. declareJsMethod(SmalltalkTrait.prototype, "toString");
  1596. declareJsMethod(SmalltalkTrait.prototype, "added");
  1597. declareJsMethod(SmalltalkTrait.prototype, "removed");
  1598. declareJsMethod(SmalltalkTrait.prototype, "methodAdded");
  1599. declareJsMethod(SmalltalkTrait.prototype, "methodRemoved");
  1600. SmalltalkTrait.prototype.toString = function () {
  1601. return 'Smalltalk Trait ' + this.name;
  1602. };
  1603. SmalltalkTrait.prototype.methodAdded = function (method) {
  1604. propagateMethodChange(this, method.selector, method);
  1605. };
  1606. SmalltalkTrait.prototype.methodRemoved = function (method) {
  1607. propagateMethodChange(this, method.selector, null);
  1608. };
  1609. function propagateMethodChange (trait, selector, method) {
  1610. trait.traitUsers.forEach(function (each) {
  1611. traitMethodChanged(selector, method, trait, each);
  1612. });
  1613. }
  1614. function traitBuilder (traitName, category) {
  1615. return {
  1616. name: traitName,
  1617. make: function () {
  1618. var that = new SmalltalkTrait();
  1619. that.name = traitName;
  1620. that.category = category;
  1621. that.traitUsers = [];
  1622. setupMethods(that);
  1623. return that;
  1624. },
  1625. updateExisting: function (trait) {
  1626. }
  1627. };
  1628. }
  1629. st.addTrait = function (className, category) {
  1630. return buildTraitOrClass(traitBuilder(className, category));
  1631. };
  1632. }
  1633. ClassModelBrik.deps = ["root", "nil"];
  1634. function ClassModelBrik (brikz, st) {
  1635. var SmalltalkRoot = brikz.root.Root;
  1636. var SmalltalkObject = brikz.root.Object;
  1637. var nilAsReceiver = brikz.nil.nilAsReceiver;
  1638. function SmalltalkBehavior () {
  1639. }
  1640. function SmalltalkClass () {
  1641. }
  1642. function SmalltalkMetaclass () {
  1643. }
  1644. this.newMetaclass = function () {
  1645. return new SmalltalkMetaclass();
  1646. };
  1647. specialConstructors.Behavior = inherits(SmalltalkBehavior, SmalltalkObject);
  1648. specialConstructors.Class = inherits(SmalltalkClass, SmalltalkBehavior);
  1649. specialConstructors.Metaclass = inherits(SmalltalkMetaclass, SmalltalkBehavior);
  1650. SmalltalkMetaclass.prototype.meta = true;
  1651. declareJsMethod(SmalltalkClass.prototype, "toString");
  1652. declareJsMethod(SmalltalkMetaclass.prototype, "toString");
  1653. declareJsMethod(SmalltalkClass.prototype, "added");
  1654. declareJsMethod(SmalltalkClass.prototype, "removed");
  1655. declareJsMethod(SmalltalkBehavior.prototype, "methodAdded");
  1656. declareJsMethod(SmalltalkBehavior.prototype, "methodRemoved");
  1657. SmalltalkClass.prototype.toString = function () {
  1658. return 'Smalltalk ' + this.name;
  1659. };
  1660. SmalltalkMetaclass.prototype.toString = function () {
  1661. return 'Smalltalk Metaclass ' + this.instanceClass.name;
  1662. };
  1663. declareEvent("classCreated");
  1664. SmalltalkClass.prototype.added = function () {
  1665. registerToSuperclass(this);
  1666. emit.classCreated(this);
  1667. };
  1668. SmalltalkClass.prototype.removed = function () {
  1669. unregisterFromSuperclass(this);
  1670. };
  1671. declareEvent("behaviorMethodAdded");
  1672. SmalltalkBehavior.prototype.methodAdded = function (method) {
  1673. emit.behaviorMethodAdded(method, this);
  1674. };
  1675. declareEvent("behaviorMethodRemoved");
  1676. SmalltalkBehavior.prototype.methodRemoved = function (method) {
  1677. emit.behaviorMethodRemoved(method, this);
  1678. };
  1679. // Fake root class of the system.
  1680. // Effective superclass of all classes created with `nil subclass: ...`.
  1681. var nilAsClass = this.nilAsClass = {
  1682. fn: SmalltalkRoot,
  1683. subclasses: [],
  1684. a$cls: {fn: SmalltalkClass}
  1685. };
  1686. this.bootstrapHierarchy = function (realClass) {
  1687. nilAsClass.a$cls = realClass;
  1688. nilAsClass.subclasses.forEach(function (each) {
  1689. each.a$cls.superclass = realClass;
  1690. registerToSuperclass(each.a$cls);
  1691. });
  1692. };
  1693. function registerToSuperclass (klass) {
  1694. addElement((klass.superclass || nilAsClass).subclasses, klass);
  1695. }
  1696. function unregisterFromSuperclass (klass) {
  1697. removeElement((klass.superclass || nilAsClass).subclasses, klass);
  1698. }
  1699. function metaSubclasses (metaclass) {
  1700. return metaclass.instanceClass.subclasses
  1701. .filter(function (each) {
  1702. return !each.meta;
  1703. })
  1704. .map(function (each) {
  1705. return each.a$cls;
  1706. });
  1707. }
  1708. st.metaSubclasses = metaSubclasses;
  1709. st.traverseClassTree = function (klass, fn) {
  1710. var queue = [klass], sentinel = {};
  1711. for (var i = 0; i < queue.length; ++i) {
  1712. var item = queue[i];
  1713. if (fn(item, sentinel) === sentinel) continue;
  1714. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  1715. queue.push.apply(queue, subclasses);
  1716. }
  1717. };
  1718. /**
  1719. * This function is used all over the compiled amber code.
  1720. * It takes any value (JavaScript or Smalltalk)
  1721. * and returns a proper Amber Smalltalk receiver.
  1722. *
  1723. * null or undefined -> nilAsReceiver,
  1724. * object having Smalltalk signature -> unchanged,
  1725. * otherwise wrapped foreign (JS) object
  1726. */
  1727. this.asReceiver = function (o) {
  1728. if (o == null) return nilAsReceiver;
  1729. else if (o.a$cls != null) return o;
  1730. else return st.wrapJavaScript(o);
  1731. };
  1732. // TODO remove, .iVarNames backward compatibility
  1733. this.__init__ = function () {
  1734. brikz.classConstruction.iVarNamesCompat(SmalltalkBehavior);
  1735. };
  1736. }
  1737. ClassConstructionBrik.deps = ["classModel", "behaviorals", "methods"];
  1738. function ClassConstructionBrik (brikz, st) {
  1739. var nilAsClass = brikz.classModel.nilAsClass;
  1740. var newMetaclass = brikz.classModel.newMetaclass;
  1741. var buildTraitOrClass = brikz.behaviorals.buildTraitOrClass;
  1742. var setupMethods = brikz.methods.setupMethods;
  1743. var removeTraitOrClass = brikz.behaviorals.removeTraitOrClass;
  1744. declareEvent("slotsChanged");
  1745. function setSlots (klass, slots) {
  1746. slots.forEach(function (name) {
  1747. if (!name.match(/^[a-zA-Z][a-zA-Z0-9]*$/))
  1748. throw new Error("Wrong identifier name: " + name);
  1749. });
  1750. klass.slots = slots;
  1751. emit.slotsChanged(klass);
  1752. }
  1753. st.setSlots = setSlots;
  1754. // TODO remove, .iVarNames backward compatibility
  1755. this.iVarNamesCompat = function (SmalltalkBehavior) {
  1756. Object.defineProperty(SmalltalkBehavior.prototype, "iVarNames", {
  1757. enumerable: true,
  1758. configurable: true,
  1759. get: function () {
  1760. return this.slots;
  1761. },
  1762. set: function (instanceVariableNames) {
  1763. setSlots(this, instanceVariableNames);
  1764. }
  1765. });
  1766. };
  1767. /* Smalltalk class creation. A class is an instance of an automatically
  1768. created metaclass object. Newly created classes (not their metaclass)
  1769. should be added to the system, see smalltalk.addClass().
  1770. Superclass linking is *not* handled here, see api.initialize() */
  1771. function classBuilder (className, superclass, category, fn) {
  1772. var logicalSuperclass = superclass;
  1773. if (superclass == null || superclass.a$nil) {
  1774. superclass = nilAsClass;
  1775. logicalSuperclass = null;
  1776. }
  1777. function klass () {
  1778. var that = metaclass().instanceClass;
  1779. that.superclass = logicalSuperclass;
  1780. that.fn = fn || inherits(function () {
  1781. }, superclass.fn);
  1782. that.slots = [];
  1783. that.name = className;
  1784. that.category = category;
  1785. that.subclasses = [];
  1786. setupMethods(that);
  1787. return that;
  1788. }
  1789. function metaclass () {
  1790. var that = newMetaclass();
  1791. that.superclass = superclass.a$cls;
  1792. that.fn = inherits(function () {
  1793. }, that.superclass.fn);
  1794. that.slots = [];
  1795. that.instanceClass = new that.fn();
  1796. wireKlass(that);
  1797. setupMethods(that);
  1798. return that;
  1799. }
  1800. return {
  1801. name: className,
  1802. make: klass,
  1803. updateExisting: function (klass) {
  1804. if (logicalSuperclass == null && klass.superclass != null || logicalSuperclass != null && klass.superclass !== logicalSuperclass || fn != null && fn !== klass.fn)
  1805. throw new Error("Incompatible change of class: " + klass.name);
  1806. }
  1807. };
  1808. }
  1809. function wireKlass (klass) {
  1810. Object.defineProperty(klass.fn.prototype, "a$cls", {
  1811. value: klass,
  1812. enumerable: false, configurable: true, writable: true
  1813. });
  1814. }
  1815. this.wireKlass = wireKlass;
  1816. /* Add a class to the system, creating a new one if needed.
  1817. A Package is lazily created if one with given name does not exist. */
  1818. st.addClass = function (className, superclass, category) {
  1819. // TODO remove, backward compatibility
  1820. if (arguments[3]) {
  1821. var added = st.addClass(className, superclass, arguments[3]);
  1822. setSlots(added, category);
  1823. return added;
  1824. }
  1825. // While subclassing nil is allowed, it might be an error, so
  1826. // warn about it.
  1827. if (typeof superclass === 'undefined' || superclass && superclass.a$nil) {
  1828. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  1829. }
  1830. return buildTraitOrClass(classBuilder(className, superclass, category, specialConstructors[className]));
  1831. };
  1832. st.removeClass = removeTraitOrClass;
  1833. }
  1834. /* Making smalltalk that can load */
  1835. function configure (brikz) {
  1836. brikz.traits = TraitsBrik;
  1837. brikz.composition = MethodCompositionBrik;
  1838. brikz.classModel = ClassModelBrik;
  1839. brikz.classConstruction = ClassConstructionBrik;
  1840. brikz();
  1841. }
  1842. return {configure: configure};
  1843. }
  1844. return LanguageFactory;
  1845. });
  1846. //jshint eqnull:true
  1847. define('amber/kernel-runtime',['./junk-drawer'], function ($goodies) {
  1848. "use strict";
  1849. var installMethodOfJsObject = $goodies.installMethodOfJsObject;
  1850. var declareJsMethod = $goodies.declareJsMethod;
  1851. var st2js = $goodies.st2js;
  1852. var js2st = $goodies.js2st;
  1853. var deleteKeysFrom = $goodies.deleteKeysFrom;
  1854. var extendWithMethods = $goodies.extendWithMethods;
  1855. function uninstallMethodOfJsObjectEx (obj, name) {
  1856. var attachments;
  1857. var old = Object.getOwnPropertyDescriptor(obj, name);
  1858. if (old != null && (old = old.value) != null) {
  1859. attachments = old.a$atx;
  1860. if (attachments != null) {
  1861. deleteKeysFrom(Object.keys(attachments), obj);
  1862. }
  1863. }
  1864. delete obj[name];
  1865. }
  1866. function installMethodOfJsObjectEx (obj, name, fn) {
  1867. uninstallMethodOfJsObjectEx(obj, name);
  1868. var attachments = fn.a$atx;
  1869. if (attachments != null) {
  1870. extendWithMethods(obj, attachments);
  1871. }
  1872. return installMethodOfJsObject(obj, name, fn);
  1873. }
  1874. function SelectorConversionBrik (brikz, st) {
  1875. var st2jsMemo = Object.create(null);
  1876. st.st2js = function (stSelector) {
  1877. return st2jsMemo[stSelector] || st2js(stSelector);
  1878. };
  1879. this.st2js = function (stSelector) {
  1880. return st2jsMemo[stSelector] || (st2jsMemo[stSelector] = st2js(stSelector));
  1881. };
  1882. /* Convert a string to a valid smalltalk selector.
  1883. if you modify the following functions, also change st2js
  1884. accordingly */
  1885. st.js2st = js2st;
  1886. st.st2prop = function (stSelector) {
  1887. var colonPosition = stSelector.indexOf(':');
  1888. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1889. };
  1890. }
  1891. function RuntimeFactory (globals, emit) {
  1892. RuntimeSelectorsBrik.deps = ["selectors", "selectorConversion", "classModel"];
  1893. function RuntimeSelectorsBrik (brikz, st) {
  1894. var selectors = brikz.selectors.selectors;
  1895. var nilAsClass = brikz.classModel.nilAsClass;
  1896. var st2js = brikz.selectorConversion.st2js;
  1897. var jsSelectors = this.jsSelectors = [];
  1898. /* Method not implemented handlers */
  1899. function installNewSelectors (newSelectors, targetClasses) {
  1900. newSelectors.forEach(function (selector) {
  1901. var jsSelector = st2js(selector);
  1902. jsSelectors.push(jsSelector);
  1903. var fn = createDnuHandler(selector);
  1904. installMethodOfJsObject(nilAsClass.fn.prototype, jsSelector, fn);
  1905. targetClasses.forEach(function (target) {
  1906. installMethodOfJsObject(target.fn.prototype, jsSelector, fn);
  1907. });
  1908. });
  1909. }
  1910. this.installNewSelectors = installNewSelectors;
  1911. /* Dnu handler method */
  1912. function createDnuHandler (stSelector) {
  1913. return function () {
  1914. return globals.Message._selector_arguments_notUnderstoodBy_(
  1915. stSelector, [].slice.call(arguments), this
  1916. );
  1917. };
  1918. }
  1919. installNewSelectors(selectors, []);
  1920. }
  1921. RuntimeClassesBrik.deps = ["runtimeSelectors", "behaviorals", "classConstruction", "runtimeMethods"];
  1922. function RuntimeClassesBrik (brikz, st) {
  1923. var jsSelectors = brikz.runtimeSelectors.jsSelectors;
  1924. var installNewSelectors = brikz.runtimeSelectors.installNewSelectors;
  1925. var installAmberMethodIntoAmberClass = brikz.runtimeMethods.installAmberMethodIntoAmberClass;
  1926. var traitsOrClasses = brikz.behaviorals.traitsOrClasses;
  1927. var wireKlass = brikz.classConstruction.wireKlass;
  1928. var detachedRootClasses = [];
  1929. function detachClass (klass) {
  1930. klass.detachedRoot = true;
  1931. detachedRootClasses = traitsOrClasses.filter(function (klass) {
  1932. return klass.detachedRoot;
  1933. });
  1934. initClass(klass);
  1935. }
  1936. st.detachClass = detachClass;
  1937. emit.selectorsAdded = function (newSelectors) {
  1938. installNewSelectors(newSelectors, detachedRootClasses);
  1939. };
  1940. /* Initialize a class in its class hierarchy. Handle both classes and
  1941. metaclasses. */
  1942. function initClassAndMetaclass (klass) {
  1943. initClass(klass);
  1944. initClass(klass.a$cls);
  1945. }
  1946. traitsOrClasses.forEach(function (traitOrClass) {
  1947. if (!traitOrClass.trait) initClassAndMetaclass(traitOrClass);
  1948. });
  1949. function installStHooks () {
  1950. emit.behavioralAdded = function (traitOrClass) {
  1951. traitOrClass._enterOrganization();
  1952. };
  1953. emit.behavioralRemoved = function (traitOrClass) {
  1954. traitOrClass._leaveOrganization();
  1955. };
  1956. }
  1957. this.installStHooks = installStHooks;
  1958. emit.classCreated = initClassAndMetaclass;
  1959. emit.slotsChanged = initClassSlots;
  1960. function initClass (klass) {
  1961. wireKlass(klass);
  1962. initClassMethods(klass);
  1963. initClassSlots(klass);
  1964. }
  1965. function initClassMethods (klass) {
  1966. if (klass.detachedRoot) {
  1967. copySuperclass(klass);
  1968. }
  1969. installMethods(klass);
  1970. }
  1971. function initClassSlots (klass) {
  1972. installIvarCompat(klass);
  1973. }
  1974. function copySuperclass (klass) {
  1975. var myproto = klass.fn.prototype,
  1976. superproto = klass.superclass.fn.prototype;
  1977. jsSelectors.forEach(function (jsSelector) {
  1978. installMethodOfJsObjectEx(myproto, jsSelector, superproto[jsSelector]);
  1979. });
  1980. }
  1981. function installMethods (klass) {
  1982. var methods = klass.methods;
  1983. Object.keys(methods).forEach(function (selector) {
  1984. installAmberMethodIntoAmberClass(methods[selector], klass);
  1985. });
  1986. }
  1987. // TODO remove, ["@foo"] backward compatibility
  1988. function installIvarCompat (klass) {
  1989. var ivars = klass.slots;
  1990. ivars.forEach(function (ivar) {
  1991. Object.defineProperty(klass.fn.prototype, "@" + ivar, {
  1992. get: function () {
  1993. return this[ivar];
  1994. },
  1995. set: function (value) {
  1996. return this[ivar] = value;
  1997. },
  1998. enumerable: false,
  1999. configurable: true
  2000. });
  2001. });
  2002. }
  2003. /* Create an alias for an existing class */
  2004. st.alias = function (traitOrClass, alias) {
  2005. globals[alias] = traitOrClass;
  2006. };
  2007. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  2008. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  2009. klass.fn = constructor;
  2010. detachClass(klass);
  2011. klass.subclasses.forEach(reprotoFn(constructor));
  2012. };
  2013. function reprotoFn (constructor) {
  2014. var prototype = constructor.prototype;
  2015. return function (subclass) {
  2016. Object.setPrototypeOf(subclass.fn.prototype, prototype);
  2017. };
  2018. }
  2019. }
  2020. FrameBindingBrik.deps = ["runtimeClasses"];
  2021. function FrameBindingBrik (brikz, st) {
  2022. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  2023. setClassConstructor(globals.Number, Number);
  2024. setClassConstructor(globals.BlockClosure, Function);
  2025. setClassConstructor(globals.Boolean, Boolean);
  2026. setClassConstructor(globals.Date, Date);
  2027. setClassConstructor(globals.String, String);
  2028. setClassConstructor(globals.Array, Array);
  2029. setClassConstructor(globals.RegularExpression, RegExp);
  2030. setClassConstructor(globals.Error, Error);
  2031. setClassConstructor(globals.Promise, Promise);
  2032. this.__init__ = function () {
  2033. st.alias(globals.Array, "OrderedCollection");
  2034. st.alias(globals.Date, "Time");
  2035. }
  2036. }
  2037. RuntimeMethodsBrik.deps = ["selectorConversion"];
  2038. function RuntimeMethodsBrik (brikz, st) {
  2039. var st2js = brikz.selectorConversion.st2js;
  2040. function installAmberMethodIntoAmberClass (method, klass) {
  2041. var jsSelector = method.jsSelector;
  2042. if (!jsSelector) {
  2043. jsSelector = method.jsSelector = st2js(method.selector);
  2044. }
  2045. return installMethodOfJsObjectEx(klass.fn.prototype, jsSelector, method.fn);
  2046. }
  2047. this.installAmberMethodIntoAmberClass = installAmberMethodIntoAmberClass;
  2048. emit.behaviorMethodAdded = function (method, klass) {
  2049. installAmberMethodIntoAmberClass(method, klass);
  2050. propagateMethodChange(klass, method, klass);
  2051. };
  2052. emit.behaviorMethodRemoved = function (method, klass) {
  2053. uninstallMethodOfJsObjectEx(klass.fn.prototype, method.jsSelector);
  2054. propagateMethodChange(klass, method, null);
  2055. };
  2056. function installStHooks () {
  2057. emit.methodReplaced = function (newMethod, oldMethod, traitOrBehavior) {
  2058. traitOrBehavior._methodOrganizationEnter_andLeave_(newMethod, oldMethod);
  2059. };
  2060. }
  2061. this.installStHooks = installStHooks;
  2062. function propagateMethodChange (klass, method, exclude) {
  2063. var selector = method.selector;
  2064. var jsSelector = method.jsSelector;
  2065. st.traverseClassTree(klass, function (subclass, sentinel) {
  2066. if (subclass === exclude) return;
  2067. if (subclass.methods[selector]) return sentinel;
  2068. if (subclass.detachedRoot) {
  2069. installMethodOfJsObjectEx(subclass.fn.prototype, jsSelector, subclass.superclass.fn.prototype[jsSelector]);
  2070. }
  2071. });
  2072. }
  2073. }
  2074. function PrimitivesBrik (brikz, st) {
  2075. /* Converts a JavaScript object to valid Smalltalk Object */
  2076. st.readJSObject = function (js) {
  2077. if (js == null) return null;
  2078. else if (Array.isArray(js)) return js.map(st.readJSObject);
  2079. else if (js.constructor !== Object) return js;
  2080. var pairs = [];
  2081. for (var i in js) {
  2082. pairs.push(i, st.readJSObject(js[i]));
  2083. }
  2084. return globals.Dictionary._newFromPairs_(pairs);
  2085. };
  2086. /* Boolean assertion */
  2087. st.assert = function (shouldBeBoolean) {
  2088. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  2089. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  2090. shouldBeBoolean = shouldBeBoolean.valueOf();
  2091. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  2092. }
  2093. globals.NonBooleanReceiver._signalOn_(shouldBeBoolean);
  2094. };
  2095. }
  2096. RuntimeBrik.deps = ["selectorConversion", "runtimeClasses"];
  2097. function RuntimeBrik (brikz, st) {
  2098. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  2099. function SmalltalkMethodContext (home, setup) {
  2100. // TODO lazy fill of .sendIdx
  2101. this.sendIdx = {};
  2102. // TODO very likely .senderContext, not .homeContext here
  2103. this.homeContext = home;
  2104. this.setup = setup;
  2105. }
  2106. // Fallbacks
  2107. SmalltalkMethodContext.prototype.supercall = false;
  2108. SmalltalkMethodContext.prototype.locals = Object.freeze({});
  2109. SmalltalkMethodContext.prototype.receiver = null;
  2110. SmalltalkMethodContext.prototype.selector = null;
  2111. SmalltalkMethodContext.prototype.outerContext = null;
  2112. SmalltalkMethodContext.prototype.index = 0;
  2113. declareJsMethod(SmalltalkMethodContext.prototype, "fill");
  2114. declareJsMethod(SmalltalkMethodContext.prototype, "fillBlock");
  2115. SmalltalkMethodContext.prototype.fill = function (receiver, selector, locals) {
  2116. this.receiver = receiver;
  2117. this.selector = selector;
  2118. if (locals != null) this.locals = locals;
  2119. if (this.homeContext) {
  2120. this.homeContext.evaluatedSelector = selector;
  2121. }
  2122. };
  2123. SmalltalkMethodContext.prototype.fillBlock = function (locals, ctx, index) {
  2124. if (locals != null) this.locals = locals;
  2125. this.outerContext = ctx;
  2126. if (index) this.index = index;
  2127. };
  2128. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  2129. /* This is the current call context object.
  2130. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  2131. In JS code, use api.getThisContext() (see below).
  2132. */
  2133. var thisContext = null;
  2134. function resultWithNoErrorHandling (worker) {
  2135. try {
  2136. return worker(thisContext);
  2137. } finally {
  2138. thisContext = null;
  2139. }
  2140. }
  2141. /*
  2142. Runs worker function so that error handler is not set up
  2143. if there isn't one. This is accomplished by unconditional
  2144. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  2145. which then stops error handler setup (see st.withContext above).
  2146. The effect is, $core.seamless(fn)'s exceptions are not
  2147. handed into ST error handler and caller should process them.
  2148. */
  2149. st.seamless = function (worker) {
  2150. var oldContext = thisContext;
  2151. thisContext = new SmalltalkMethodContext(thisContext, function (ctx) {
  2152. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  2153. });
  2154. var result = oldContext == null ? resultWithNoErrorHandling(worker) : worker(thisContext);
  2155. thisContext = oldContext;
  2156. return result;
  2157. };
  2158. function resultWithErrorHandling (worker) {
  2159. try {
  2160. return worker(thisContext);
  2161. } catch (error) {
  2162. globals.ErrorHandler._handleError_(error);
  2163. thisContext = null;
  2164. // Rethrow the error in any case.
  2165. throw error;
  2166. }
  2167. }
  2168. /*
  2169. Standard way to run within context.
  2170. Sets up error handler if entering first ST context in a stack.
  2171. */
  2172. st.withContext = function (worker, setup) {
  2173. var oldContext = thisContext;
  2174. thisContext = new SmalltalkMethodContext(thisContext, setup);
  2175. var result = oldContext == null ? resultWithErrorHandling(worker) : worker(thisContext);
  2176. thisContext = oldContext;
  2177. return result;
  2178. };
  2179. /* Handle thisContext pseudo variable */
  2180. st.getThisContext = function () {
  2181. if (!thisContext) return null;
  2182. for (var frame = thisContext; frame; frame = frame.outerContext || frame.homeContext) {
  2183. frame.setup(frame);
  2184. }
  2185. return thisContext;
  2186. };
  2187. }
  2188. MessageSendBrik.deps = ["selectorConversion"];
  2189. function MessageSendBrik (brikz, st) {
  2190. /* Send message programmatically. Used to implement #perform: & Co. */
  2191. st.send2 = function (self, selector, args, klass) {
  2192. var method = klass ? klass.fn.prototype[st.st2js(selector)] : self.a$cls && self[st.st2js(selector)];
  2193. return method != null ?
  2194. method.apply(self, args || []) :
  2195. globals.Message._selector_arguments_notUnderstoodBy_(
  2196. selector, [].slice.call(args), self.a$cls ? self : wrapJavaScript(self)
  2197. );
  2198. };
  2199. function wrapJavaScript (o) {
  2200. return globals.JSObjectProxy._on_(o);
  2201. }
  2202. st.wrapJavaScript = wrapJavaScript;
  2203. /* If the object property is a function, then call it, except if it starts with
  2204. an uppercase character (we probably want to answer the function itself in this
  2205. case and send it #new from Amber).
  2206. */
  2207. st.accessJavaScript = function (self, propertyName, args) {
  2208. var propertyValue = self[propertyName];
  2209. if (typeof propertyValue === "function" && !(args.length === 0 && /^[A-Z]/.test(propertyName)))
  2210. return propertyValue.apply(self, args);
  2211. switch (args.length) {
  2212. case 0:
  2213. return propertyValue;
  2214. case 1:
  2215. self[propertyName] = args[0];
  2216. return self;
  2217. default:
  2218. throw new Error("Cannot interpret " + propertyName + " with " + args.length + " arguments; field is a " + typeof propertyValue + ", not a function")
  2219. }
  2220. };
  2221. }
  2222. StartImageBrik.deps = ["runtimeClasses", "runtimeMethods"];
  2223. function StartImageBrik (brikz, st) {
  2224. this.run = function () {
  2225. brikz.runtimeClasses.installStHooks();
  2226. brikz.runtimeMethods.installStHooks();
  2227. return globals.AmberBootstrapInitialization._run();
  2228. };
  2229. }
  2230. /* Making smalltalk that can run */
  2231. function configure (brikz) {
  2232. brikz.runtimeSelectors = RuntimeSelectorsBrik;
  2233. brikz.runtimeClasses = RuntimeClassesBrik;
  2234. brikz.frameBinding = FrameBindingBrik;
  2235. brikz.runtimeMethods = RuntimeMethodsBrik;
  2236. brikz.messageSend = MessageSendBrik;
  2237. brikz.runtime = RuntimeBrik;
  2238. brikz.primitives = PrimitivesBrik;
  2239. brikz.selectorConversion = SelectorConversionBrik;
  2240. brikz.startImage = StartImageBrik;
  2241. brikz();
  2242. }
  2243. return {configure: configure};
  2244. }
  2245. return RuntimeFactory;
  2246. });
  2247. /* ====================================================================
  2248. |
  2249. | Amber Smalltalk
  2250. | http://amber-lang.net
  2251. |
  2252. ======================================================================
  2253. ======================================================================
  2254. |
  2255. | Copyright (c) 2010-2014
  2256. | Nicolas Petton <petton.nicolas@gmail.com>
  2257. |
  2258. | Copyright (c) 2012-2019
  2259. | The Amber team https://lolg.it/org/amber/members
  2260. | Amber contributors (see /CONTRIBUTORS)
  2261. |
  2262. | Amber is released under the MIT license
  2263. |
  2264. | Permission is hereby granted, free of charge, to any person obtaining
  2265. | a copy of this software and associated documentation files (the
  2266. | 'Software'), to deal in the Software without restriction, including
  2267. | without limitation the rights to use, copy, modify, merge, publish,
  2268. | distribute, sublicense, and/or sell copies of the Software, and to
  2269. | permit persons to whom the Software is furnished to do so, subject to
  2270. | the following conditions:
  2271. |
  2272. | The above copyright notice and this permission notice shall be
  2273. | included in all copies or substantial portions of the Software.
  2274. |
  2275. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  2276. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  2277. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  2278. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  2279. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  2280. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  2281. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  2282. |
  2283. ==================================================================== */
  2284. //jshint eqnull:true
  2285. define('amber/boot',[
  2286. 'require', './kernel-checks', './brikz', './kernel-fundamentals', './kernel-language'
  2287. ], function (require, _, Brikz, FundamentalsFactory, LanguageFactory) {
  2288. "use strict";
  2289. var globals = Object.create(global);
  2290. var emit = Object.create(null);
  2291. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  2292. require(['./kernel-runtime'], resolve, reject);
  2293. });
  2294. function SmalltalkInitBrik (brikz, st) {
  2295. var initialized = false;
  2296. globals.SmalltalkSettings = {};
  2297. /* Smalltalk initialization. Called on page load */
  2298. st.initialize = function () {
  2299. return runtimeLoadedPromise.then(function (RuntimeFactory) {
  2300. if (initialized) return;
  2301. brikz.classModel.bootstrapHierarchy(globals.Class);
  2302. RuntimeFactory(globals, emit).configure(brikz);
  2303. return Promise.resolve(brikz.startImage.run())
  2304. .then(function () {
  2305. initialized = true;
  2306. });
  2307. });
  2308. };
  2309. }
  2310. var api = {};
  2311. var brikz = Brikz(api);
  2312. var fundamentals = FundamentalsFactory(globals, emit);
  2313. fundamentals.configure(brikz);
  2314. LanguageFactory(fundamentals.specialConstructors, emit).configure(brikz);
  2315. brikz.stInit = SmalltalkInitBrik;
  2316. brikz();
  2317. // TODO deprecated, remove
  2318. Object.defineProperty(globals, "CharacterArray", {
  2319. enumerable: true,
  2320. configurable: true,
  2321. get: function () {
  2322. return this.String;
  2323. }
  2324. });
  2325. return {
  2326. api: api,
  2327. nilAsReceiver: brikz.nil.nilAsReceiver,
  2328. nilAsValue: brikz.nil.nilAsValue,
  2329. nilAsClass: brikz.classModel.nilAsClass,
  2330. globals: globals,
  2331. asReceiver: brikz.classModel.asReceiver
  2332. };
  2333. });
  2334. define('amber/helpers',["./boot", "./junk-drawer", "require"], function (boot, $goodies, require) {
  2335. var globals = boot.globals,
  2336. exports = {},
  2337. extend = $goodies.extend,
  2338. api = boot.api;
  2339. // API
  2340. exports.popupHelios = function () {
  2341. require(['helios/index'], function (helios) {
  2342. helios.popup();
  2343. }, function (err) {
  2344. window.alert("Error loading helios.\nIf not present, you can install it with 'npm install @ambers/helios --save-dev'.\nThe error follows:\n" + err);
  2345. });
  2346. };
  2347. Object.defineProperty(exports, "api", {
  2348. value: api,
  2349. enumerable: true, configurable: true, writable: false
  2350. });
  2351. Object.defineProperty(exports, "globals", {
  2352. value: globals,
  2353. enumerable: true, configurable: true, writable: false
  2354. });
  2355. Object.defineProperty(exports, "$nil", {
  2356. value: boot.nilAsReceiver,
  2357. enumerable: true, configurable: true, writable: false
  2358. });
  2359. Object.defineProperty(exports, "nil", {
  2360. value: boot.nilAsValue,
  2361. enumerable: true, configurable: true, writable: false
  2362. });
  2363. function settingsInLocalStorage () {
  2364. //jshint evil:true
  2365. var storage = 'localStorage' in global && global.localStorage;
  2366. if (storage) {
  2367. var fromStorage;
  2368. try {
  2369. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  2370. } catch (ex) {
  2371. // pass
  2372. }
  2373. extend(globals.SmalltalkSettings, fromStorage || {});
  2374. if (typeof window !== "undefined") {
  2375. window.addEventListener('beforeunload', function () {
  2376. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  2377. });
  2378. }
  2379. }
  2380. }
  2381. exports.initialize = function (options) {
  2382. return new Promise(function (resolve) {
  2383. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = "amber/core";
  2384. api.amdRequire = require; // TODO better
  2385. settingsInLocalStorage();
  2386. extend(globals.SmalltalkSettings, options || {});
  2387. resolve(api.initialize());
  2388. });
  2389. };
  2390. exports.loadPackages = function (modules) {
  2391. return new Promise(function (resolve, reject) {
  2392. require(modules, resolve, reject);
  2393. }).then(function () {
  2394. return globals.Smalltalk._postLoad();
  2395. });
  2396. };
  2397. exports.beClean = function () {
  2398. return globals.Smalltalk._beClean();
  2399. };
  2400. // Exports
  2401. return exports;
  2402. });
  2403. define('amber/core/Kernel-Helpers',["amber/boot", "require"], function($boot,requirejs){"use strict";
  2404. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2405. var $pkg = $core.addPackage("Kernel-Helpers");
  2406. $pkg.innerEval = function (expr) { return eval(expr); };
  2407. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  2408. $core.addTrait("TIsInGroup", "Kernel-Helpers");
  2409. $globals.TIsInGroup.comment="I contain all `isXxx` checking methods that check\x0aif receiver is part of some group of objects (`isBehavior` etc.)\x0a\x0aI should NOT contain tests for\x0ahaving a certain property (`isImmutable` etc.).";
  2410. $core.addMethod(
  2411. $core.method({
  2412. selector: "isBehavior",
  2413. protocol: "testing",
  2414. args: [],
  2415. source: "isBehavior\x0a\x09^ false",
  2416. referencedClasses: [],
  2417. pragmas: [],
  2418. messageSends: []
  2419. }, function ($methodClass){ return function (){
  2420. var self=this,$self=this;
  2421. return false;
  2422. }; }),
  2423. $globals.TIsInGroup);
  2424. $core.addMethod(
  2425. $core.method({
  2426. selector: "isBoolean",
  2427. protocol: "testing",
  2428. args: [],
  2429. source: "isBoolean\x0a\x09^ false",
  2430. referencedClasses: [],
  2431. pragmas: [],
  2432. messageSends: []
  2433. }, function ($methodClass){ return function (){
  2434. var self=this,$self=this;
  2435. return false;
  2436. }; }),
  2437. $globals.TIsInGroup);
  2438. $core.addMethod(
  2439. $core.method({
  2440. selector: "isClass",
  2441. protocol: "testing",
  2442. args: [],
  2443. source: "isClass\x0a\x09^ false",
  2444. referencedClasses: [],
  2445. pragmas: [],
  2446. messageSends: []
  2447. }, function ($methodClass){ return function (){
  2448. var self=this,$self=this;
  2449. return false;
  2450. }; }),
  2451. $globals.TIsInGroup);
  2452. $core.addMethod(
  2453. $core.method({
  2454. selector: "isCompiledMethod",
  2455. protocol: "testing",
  2456. args: [],
  2457. source: "isCompiledMethod\x0a\x09^ false",
  2458. referencedClasses: [],
  2459. pragmas: [],
  2460. messageSends: []
  2461. }, function ($methodClass){ return function (){
  2462. var self=this,$self=this;
  2463. return false;
  2464. }; }),
  2465. $globals.TIsInGroup);
  2466. $core.addMethod(
  2467. $core.method({
  2468. selector: "isError",
  2469. protocol: "testing",
  2470. args: [],
  2471. source: "isError\x0a\x09^ false",
  2472. referencedClasses: [],
  2473. pragmas: [],
  2474. messageSends: []
  2475. }, function ($methodClass){ return function (){
  2476. var self=this,$self=this;
  2477. return false;
  2478. }; }),
  2479. $globals.TIsInGroup);
  2480. $core.addMethod(
  2481. $core.method({
  2482. selector: "isMetaclass",
  2483. protocol: "testing",
  2484. args: [],
  2485. source: "isMetaclass\x0a\x09^ false",
  2486. referencedClasses: [],
  2487. pragmas: [],
  2488. messageSends: []
  2489. }, function ($methodClass){ return function (){
  2490. var self=this,$self=this;
  2491. return false;
  2492. }; }),
  2493. $globals.TIsInGroup);
  2494. $core.addMethod(
  2495. $core.method({
  2496. selector: "isNumber",
  2497. protocol: "testing",
  2498. args: [],
  2499. source: "isNumber\x0a\x09^ false",
  2500. referencedClasses: [],
  2501. pragmas: [],
  2502. messageSends: []
  2503. }, function ($methodClass){ return function (){
  2504. var self=this,$self=this;
  2505. return false;
  2506. }; }),
  2507. $globals.TIsInGroup);
  2508. $core.addMethod(
  2509. $core.method({
  2510. selector: "isPackage",
  2511. protocol: "testing",
  2512. args: [],
  2513. source: "isPackage\x0a\x09^ false",
  2514. referencedClasses: [],
  2515. pragmas: [],
  2516. messageSends: []
  2517. }, function ($methodClass){ return function (){
  2518. var self=this,$self=this;
  2519. return false;
  2520. }; }),
  2521. $globals.TIsInGroup);
  2522. $core.addMethod(
  2523. $core.method({
  2524. selector: "isString",
  2525. protocol: "testing",
  2526. args: [],
  2527. source: "isString\x0a\x09^ false",
  2528. referencedClasses: [],
  2529. pragmas: [],
  2530. messageSends: []
  2531. }, function ($methodClass){ return function (){
  2532. var self=this,$self=this;
  2533. return false;
  2534. }; }),
  2535. $globals.TIsInGroup);
  2536. $core.addMethod(
  2537. $core.method({
  2538. selector: "isSymbol",
  2539. protocol: "testing",
  2540. args: [],
  2541. source: "isSymbol\x0a\x09^ false",
  2542. referencedClasses: [],
  2543. pragmas: [],
  2544. messageSends: []
  2545. }, function ($methodClass){ return function (){
  2546. var self=this,$self=this;
  2547. return false;
  2548. }; }),
  2549. $globals.TIsInGroup);
  2550. $core.addTrait("TSubclassable", "Kernel-Helpers");
  2551. $core.addMethod(
  2552. $core.method({
  2553. selector: "subclass:",
  2554. protocol: "class creation",
  2555. args: ["aString"],
  2556. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString slots: #() package: nil",
  2557. referencedClasses: [],
  2558. pragmas: [],
  2559. messageSends: ["subclass:slots:package:"]
  2560. }, function ($methodClass){ return function (aString){
  2561. var self=this,$self=this;
  2562. return $core.withContext(function($ctx1) {
  2563. return $self._subclass_slots_package_(aString,[],nil);
  2564. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString})});
  2565. }; }),
  2566. $globals.TSubclassable);
  2567. $core.addMethod(
  2568. $core.method({
  2569. selector: "subclass:instanceVariableNames:",
  2570. protocol: "class creation",
  2571. args: ["aString", "anotherString"],
  2572. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  2573. referencedClasses: [],
  2574. pragmas: [],
  2575. messageSends: ["subclass:instanceVariableNames:package:"]
  2576. }, function ($methodClass){ return function (aString,anotherString){
  2577. var self=this,$self=this;
  2578. return $core.withContext(function($ctx1) {
  2579. return $self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  2580. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString})});
  2581. }; }),
  2582. $globals.TSubclassable);
  2583. $core.addMethod(
  2584. $core.method({
  2585. selector: "subclass:instanceVariableNames:category:",
  2586. protocol: "class creation",
  2587. args: ["aString", "aString2", "aString3"],
  2588. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2589. referencedClasses: [],
  2590. pragmas: [],
  2591. messageSends: ["subclass:instanceVariableNames:package:"]
  2592. }, function ($methodClass){ return function (aString,aString2,aString3){
  2593. var self=this,$self=this;
  2594. return $core.withContext(function($ctx1) {
  2595. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2596. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3})});
  2597. }; }),
  2598. $globals.TSubclassable);
  2599. $core.addMethod(
  2600. $core.method({
  2601. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2602. protocol: "class creation",
  2603. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  2604. 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",
  2605. referencedClasses: [],
  2606. pragmas: [],
  2607. messageSends: ["subclass:instanceVariableNames:package:"]
  2608. }, function ($methodClass){ return function (aString,aString2,classVars,pools,aString3){
  2609. var self=this,$self=this;
  2610. return $core.withContext(function($ctx1) {
  2611. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2612. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3})});
  2613. }; }),
  2614. $globals.TSubclassable);
  2615. $core.addMethod(
  2616. $core.method({
  2617. selector: "subclass:instanceVariableNames:package:",
  2618. protocol: "class creation",
  2619. args: ["aString", "aString2", "aString3"],
  2620. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString slots: aString2 instanceVariablesStringAsSlotList package: aString3",
  2621. referencedClasses: [],
  2622. pragmas: [],
  2623. messageSends: ["subclass:slots:package:", "instanceVariablesStringAsSlotList"]
  2624. }, function ($methodClass){ return function (aString,aString2,aString3){
  2625. var self=this,$self=this;
  2626. return $core.withContext(function($ctx1) {
  2627. return $self._subclass_slots_package_(aString,$recv(aString2)._instanceVariablesStringAsSlotList(),aString3);
  2628. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3})});
  2629. }; }),
  2630. $globals.TSubclassable);
  2631. $core.addMethod(
  2632. $core.method({
  2633. selector: "subclass:slots:",
  2634. protocol: "class creation",
  2635. args: ["aString", "aCollection"],
  2636. source: "subclass: aString slots: aCollection\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString slots: aCollection package: nil",
  2637. referencedClasses: [],
  2638. pragmas: [],
  2639. messageSends: ["subclass:slots:package:"]
  2640. }, function ($methodClass){ return function (aString,aCollection){
  2641. var self=this,$self=this;
  2642. return $core.withContext(function($ctx1) {
  2643. return $self._subclass_slots_package_(aString,aCollection,nil);
  2644. }, function($ctx1) {$ctx1.fill(self,"subclass:slots:",{aString:aString,aCollection:aCollection})});
  2645. }; }),
  2646. $globals.TSubclassable);
  2647. $core.addMethod(
  2648. $core.method({
  2649. selector: "subclass:slots:classVariables:package:",
  2650. protocol: "class creation",
  2651. args: ["aString", "aCollection", "anObject", "anotherString"],
  2652. source: "subclass: aString slots: aCollection classVariables: anObject package: anotherString\x0a\x09\x22Kept for file-in compatibility. ignores class variables.\x22\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString slots: aCollection package: anotherString",
  2653. referencedClasses: ["ClassBuilder"],
  2654. pragmas: [],
  2655. messageSends: ["superclass:subclass:slots:package:", "new"]
  2656. }, function ($methodClass){ return function (aString,aCollection,anObject,anotherString){
  2657. var self=this,$self=this;
  2658. return $core.withContext(function($ctx1) {
  2659. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_slots_package_(self,aString,aCollection,anotherString);
  2660. }, function($ctx1) {$ctx1.fill(self,"subclass:slots:classVariables:package:",{aString:aString,aCollection:aCollection,anObject:anObject,anotherString:anotherString})});
  2661. }; }),
  2662. $globals.TSubclassable);
  2663. $core.addMethod(
  2664. $core.method({
  2665. selector: "subclass:slots:classVariables:poolDictionaries:package:",
  2666. protocol: "class creation",
  2667. args: ["aString", "aCollection", "anObject", "anotherObject", "anotherString"],
  2668. source: "subclass: aString slots: aCollection classVariables: anObject poolDictionaries: anotherObject package: anotherString\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString slots: aCollection package: anotherString",
  2669. referencedClasses: ["ClassBuilder"],
  2670. pragmas: [],
  2671. messageSends: ["superclass:subclass:slots:package:", "new"]
  2672. }, function ($methodClass){ return function (aString,aCollection,anObject,anotherObject,anotherString){
  2673. var self=this,$self=this;
  2674. return $core.withContext(function($ctx1) {
  2675. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_slots_package_(self,aString,aCollection,anotherString);
  2676. }, function($ctx1) {$ctx1.fill(self,"subclass:slots:classVariables:poolDictionaries:package:",{aString:aString,aCollection:aCollection,anObject:anObject,anotherObject:anotherObject,anotherString:anotherString})});
  2677. }; }),
  2678. $globals.TSubclassable);
  2679. $core.addMethod(
  2680. $core.method({
  2681. selector: "subclass:slots:package:",
  2682. protocol: "class creation",
  2683. args: ["aString", "aCollection", "anotherString"],
  2684. source: "subclass: aString slots: aCollection package: anotherString\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString slots: aCollection package: anotherString",
  2685. referencedClasses: ["ClassBuilder"],
  2686. pragmas: [],
  2687. messageSends: ["superclass:subclass:slots:package:", "new"]
  2688. }, function ($methodClass){ return function (aString,aCollection,anotherString){
  2689. var self=this,$self=this;
  2690. return $core.withContext(function($ctx1) {
  2691. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_slots_package_(self,aString,aCollection,anotherString);
  2692. }, function($ctx1) {$ctx1.fill(self,"subclass:slots:package:",{aString:aString,aCollection:aCollection,anotherString:anotherString})});
  2693. }; }),
  2694. $globals.TSubclassable);
  2695. $core.addMethod(
  2696. $core.method({
  2697. selector: "subclass:uses:",
  2698. protocol: "class creation",
  2699. args: ["aString", "aTraitCompositionDescription"],
  2700. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription slots: #() package: nil",
  2701. referencedClasses: [],
  2702. pragmas: [],
  2703. messageSends: ["subclass:uses:slots:package:"]
  2704. }, function ($methodClass){ return function (aString,aTraitCompositionDescription){
  2705. var self=this,$self=this;
  2706. return $core.withContext(function($ctx1) {
  2707. return $self._subclass_uses_slots_package_(aString,aTraitCompositionDescription,[],nil);
  2708. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription})});
  2709. }; }),
  2710. $globals.TSubclassable);
  2711. $core.addMethod(
  2712. $core.method({
  2713. selector: "subclass:uses:instanceVariableNames:",
  2714. protocol: "class creation",
  2715. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  2716. 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",
  2717. referencedClasses: [],
  2718. pragmas: [],
  2719. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2720. }, function ($methodClass){ return function (aString,aTraitCompositionDescription,anotherString){
  2721. var self=this,$self=this;
  2722. return $core.withContext(function($ctx1) {
  2723. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  2724. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString})});
  2725. }; }),
  2726. $globals.TSubclassable);
  2727. $core.addMethod(
  2728. $core.method({
  2729. selector: "subclass:uses:instanceVariableNames:category:",
  2730. protocol: "class creation",
  2731. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2732. 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",
  2733. referencedClasses: [],
  2734. pragmas: [],
  2735. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2736. }, function ($methodClass){ return function (aString,aTraitCompositionDescription,aString2,aString3){
  2737. var self=this,$self=this;
  2738. return $core.withContext(function($ctx1) {
  2739. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2740. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3})});
  2741. }; }),
  2742. $globals.TSubclassable);
  2743. $core.addMethod(
  2744. $core.method({
  2745. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2746. protocol: "class creation",
  2747. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  2748. 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",
  2749. referencedClasses: [],
  2750. pragmas: [],
  2751. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2752. }, function ($methodClass){ return function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  2753. var self=this,$self=this;
  2754. return $core.withContext(function($ctx1) {
  2755. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2756. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3})});
  2757. }; }),
  2758. $globals.TSubclassable);
  2759. $core.addMethod(
  2760. $core.method({
  2761. selector: "subclass:uses:instanceVariableNames:package:",
  2762. protocol: "class creation",
  2763. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2764. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription slots: aString2 instanceVariablesStringAsSlotList package: aString3",
  2765. referencedClasses: [],
  2766. pragmas: [],
  2767. messageSends: ["subclass:uses:slots:package:", "instanceVariablesStringAsSlotList"]
  2768. }, function ($methodClass){ return function (aString,aTraitCompositionDescription,aString2,aString3){
  2769. var self=this,$self=this;
  2770. return $core.withContext(function($ctx1) {
  2771. return $self._subclass_uses_slots_package_(aString,aTraitCompositionDescription,$recv(aString2)._instanceVariablesStringAsSlotList(),aString3);
  2772. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3})});
  2773. }; }),
  2774. $globals.TSubclassable);
  2775. $core.addMethod(
  2776. $core.method({
  2777. selector: "subclass:uses:slots:",
  2778. protocol: "class creation",
  2779. args: ["aString", "aTraitCompositionDescription", "aCollection"],
  2780. source: "subclass: aString uses: aTraitCompositionDescription slots: aCollection\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription slots: aCollection package: nil",
  2781. referencedClasses: [],
  2782. pragmas: [],
  2783. messageSends: ["subclass:uses:slots:package:"]
  2784. }, function ($methodClass){ return function (aString,aTraitCompositionDescription,aCollection){
  2785. var self=this,$self=this;
  2786. return $core.withContext(function($ctx1) {
  2787. return $self._subclass_uses_slots_package_(aString,aTraitCompositionDescription,aCollection,nil);
  2788. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:slots:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection})});
  2789. }; }),
  2790. $globals.TSubclassable);
  2791. $core.addMethod(
  2792. $core.method({
  2793. selector: "subclass:uses:slots:package:",
  2794. protocol: "class creation",
  2795. args: ["aString", "aTraitCompositionDescription", "aCollection", "aString3"],
  2796. source: "subclass: aString uses: aTraitCompositionDescription slots: aCollection package: aString3\x0a\x09| cls |\x0a\x09cls := self subclass: aString slots: aCollection package: aString3.\x0a\x09cls setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ cls",
  2797. referencedClasses: [],
  2798. pragmas: [],
  2799. messageSends: ["subclass:slots:package:", "setTraitComposition:", "asTraitComposition"]
  2800. }, function ($methodClass){ return function (aString,aTraitCompositionDescription,aCollection,aString3){
  2801. var self=this,$self=this;
  2802. var cls;
  2803. return $core.withContext(function($ctx1) {
  2804. cls=$self._subclass_slots_package_(aString,aCollection,aString3);
  2805. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  2806. return cls;
  2807. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:slots:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,aString3:aString3,cls:cls})});
  2808. }; }),
  2809. $globals.TSubclassable);
  2810. });
  2811. define('amber/core/Kernel-Objects',["amber/boot", "require", "amber/core/Kernel-Helpers"], function($boot,requirejs){"use strict";
  2812. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2813. var $pkg = $core.addPackage("Kernel-Objects");
  2814. $pkg.innerEval = function (expr) { return eval(expr); };
  2815. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  2816. $core.addClass("ProtoObject", null, [], "Kernel-Objects");
  2817. $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.";
  2818. $core.addMethod(
  2819. $core.method({
  2820. selector: "=",
  2821. protocol: "comparing",
  2822. args: ["anObject"],
  2823. source: "= anObject\x0a\x09^ self == anObject",
  2824. referencedClasses: [],
  2825. pragmas: [],
  2826. messageSends: ["=="]
  2827. }, function ($methodClass){ return function (anObject){
  2828. var self=this,$self=this;
  2829. return $core.withContext(function($ctx1) {
  2830. return $self.__eq_eq(anObject);
  2831. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject})});
  2832. }; }),
  2833. $globals.ProtoObject);
  2834. $core.addMethod(
  2835. $core.method({
  2836. selector: "==",
  2837. protocol: "comparing",
  2838. args: ["anObject"],
  2839. source: "== anObject\x0a<inlineJS: 'return self === anObject'>",
  2840. referencedClasses: [],
  2841. pragmas: [["inlineJS:", ["return self === anObject"]]],
  2842. messageSends: []
  2843. }, function ($methodClass){ return function (anObject){
  2844. var self=this,$self=this;
  2845. return $core.withContext(function($ctx1) {
  2846. return self === anObject;
  2847. return self;
  2848. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject})});
  2849. }; }),
  2850. $globals.ProtoObject);
  2851. $core.addMethod(
  2852. $core.method({
  2853. selector: "asString",
  2854. protocol: "converting",
  2855. args: [],
  2856. source: "asString\x0a\x09^ self printString",
  2857. referencedClasses: [],
  2858. pragmas: [],
  2859. messageSends: ["printString"]
  2860. }, function ($methodClass){ return function (){
  2861. var self=this,$self=this;
  2862. return $core.withContext(function($ctx1) {
  2863. return $self._printString();
  2864. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  2865. }; }),
  2866. $globals.ProtoObject);
  2867. $core.addMethod(
  2868. $core.method({
  2869. selector: "class",
  2870. protocol: "accessing",
  2871. args: [],
  2872. source: "class\x0a\x09<inlineJS: 'return $self.a$cls'>",
  2873. referencedClasses: [],
  2874. pragmas: [["inlineJS:", ["return $self.a$cls"]]],
  2875. messageSends: []
  2876. }, function ($methodClass){ return function (){
  2877. var self=this,$self=this;
  2878. return $core.withContext(function($ctx1) {
  2879. return $self.a$cls;
  2880. return self;
  2881. }, function($ctx1) {$ctx1.fill(self,"class",{})});
  2882. }; }),
  2883. $globals.ProtoObject);
  2884. $core.addMethod(
  2885. $core.method({
  2886. selector: "doesNotUnderstand:",
  2887. protocol: "error handling",
  2888. args: ["aMessage"],
  2889. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  2890. referencedClasses: ["MessageNotUnderstood"],
  2891. pragmas: [],
  2892. messageSends: ["receiver:", "new", "message:", "signal"]
  2893. }, function ($methodClass){ return function (aMessage){
  2894. var self=this,$self=this;
  2895. return $core.withContext(function($ctx1) {
  2896. var $1;
  2897. $1=$recv($globals.MessageNotUnderstood)._new();
  2898. $recv($1)._receiver_(self);
  2899. $recv($1)._message_(aMessage);
  2900. $recv($1)._signal();
  2901. return self;
  2902. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage})});
  2903. }; }),
  2904. $globals.ProtoObject);
  2905. $core.addMethod(
  2906. $core.method({
  2907. selector: "evaluate:on:",
  2908. protocol: "evaluating",
  2909. args: ["aString", "anEvaluator"],
  2910. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  2911. referencedClasses: [],
  2912. pragmas: [],
  2913. messageSends: ["evaluate:receiver:"]
  2914. }, function ($methodClass){ return function (aString,anEvaluator){
  2915. var self=this,$self=this;
  2916. return $core.withContext(function($ctx1) {
  2917. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  2918. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator})});
  2919. }; }),
  2920. $globals.ProtoObject);
  2921. $core.addMethod(
  2922. $core.method({
  2923. selector: "identityHash",
  2924. protocol: "accessing",
  2925. args: [],
  2926. source: "identityHash\x0a\x09<inlineJS: '\x0a\x09\x09self._deprecatedAPI();\x0a\x09\x09var hash=self.identityHash;\x0a\x09\x09if (hash) return hash;\x0a\x09\x09hash=$core.nextId();\x0a\x09\x09Object.defineProperty(self, ''identityHash'', {value:hash});\x0a\x09\x09return hash;\x0a\x09'>",
  2927. referencedClasses: [],
  2928. pragmas: [["inlineJS:", ["\x0a\x09\x09self._deprecatedAPI();\x0a\x09\x09var hash=self.identityHash;\x0a\x09\x09if (hash) return hash;\x0a\x09\x09hash=$core.nextId();\x0a\x09\x09Object.defineProperty(self, 'identityHash', {value:hash});\x0a\x09\x09return hash;\x0a\x09"]]],
  2929. messageSends: []
  2930. }, function ($methodClass){ return function (){
  2931. var self=this,$self=this;
  2932. return $core.withContext(function($ctx1) {
  2933. self._deprecatedAPI();
  2934. var hash=self.identityHash;
  2935. if (hash) return hash;
  2936. hash=$core.nextId();
  2937. Object.defineProperty(self, 'identityHash', {value:hash});
  2938. return hash;
  2939. ;
  2940. return self;
  2941. }, function($ctx1) {$ctx1.fill(self,"identityHash",{})});
  2942. }; }),
  2943. $globals.ProtoObject);
  2944. $core.addMethod(
  2945. $core.method({
  2946. selector: "ifNil:",
  2947. protocol: "testing",
  2948. args: ["aBlock"],
  2949. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2950. referencedClasses: [],
  2951. pragmas: [],
  2952. messageSends: []
  2953. }, function ($methodClass){ return function (aBlock){
  2954. var self=this,$self=this;
  2955. return self;
  2956. }; }),
  2957. $globals.ProtoObject);
  2958. $core.addMethod(
  2959. $core.method({
  2960. selector: "ifNil:ifNotNil:",
  2961. protocol: "testing",
  2962. args: ["aBlock", "anotherBlock"],
  2963. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2964. referencedClasses: [],
  2965. pragmas: [],
  2966. messageSends: ["value:"]
  2967. }, function ($methodClass){ return function (aBlock,anotherBlock){
  2968. var self=this,$self=this;
  2969. return $core.withContext(function($ctx1) {
  2970. return $recv(anotherBlock)._value_(self);
  2971. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  2972. }; }),
  2973. $globals.ProtoObject);
  2974. $core.addMethod(
  2975. $core.method({
  2976. selector: "ifNotNil:",
  2977. protocol: "testing",
  2978. args: ["aBlock"],
  2979. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2980. referencedClasses: [],
  2981. pragmas: [],
  2982. messageSends: ["value:"]
  2983. }, function ($methodClass){ return function (aBlock){
  2984. var self=this,$self=this;
  2985. return $core.withContext(function($ctx1) {
  2986. return $recv(aBlock)._value_(self);
  2987. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock})});
  2988. }; }),
  2989. $globals.ProtoObject);
  2990. $core.addMethod(
  2991. $core.method({
  2992. selector: "ifNotNil:ifNil:",
  2993. protocol: "testing",
  2994. args: ["aBlock", "anotherBlock"],
  2995. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2996. referencedClasses: [],
  2997. pragmas: [],
  2998. messageSends: ["value:"]
  2999. }, function ($methodClass){ return function (aBlock,anotherBlock){
  3000. var self=this,$self=this;
  3001. return $core.withContext(function($ctx1) {
  3002. return $recv(aBlock)._value_(self);
  3003. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  3004. }; }),
  3005. $globals.ProtoObject);
  3006. $core.addMethod(
  3007. $core.method({
  3008. selector: "initialize",
  3009. protocol: "initialization",
  3010. args: [],
  3011. source: "initialize",
  3012. referencedClasses: [],
  3013. pragmas: [],
  3014. messageSends: []
  3015. }, function ($methodClass){ return function (){
  3016. var self=this,$self=this;
  3017. return self;
  3018. }; }),
  3019. $globals.ProtoObject);
  3020. $core.addMethod(
  3021. $core.method({
  3022. selector: "inspect",
  3023. protocol: "inspecting",
  3024. args: [],
  3025. source: "inspect\x0a\x09Inspector inspect: self",
  3026. referencedClasses: ["Inspector"],
  3027. pragmas: [],
  3028. messageSends: ["inspect:"]
  3029. }, function ($methodClass){ return function (){
  3030. var self=this,$self=this;
  3031. return $core.withContext(function($ctx1) {
  3032. $recv($globals.Inspector)._inspect_(self);
  3033. return self;
  3034. }, function($ctx1) {$ctx1.fill(self,"inspect",{})});
  3035. }; }),
  3036. $globals.ProtoObject);
  3037. $core.addMethod(
  3038. $core.method({
  3039. selector: "inspectOn:",
  3040. protocol: "inspecting",
  3041. args: ["anInspector"],
  3042. source: "inspectOn: anInspector",
  3043. referencedClasses: [],
  3044. pragmas: [],
  3045. messageSends: []
  3046. }, function ($methodClass){ return function (anInspector){
  3047. var self=this,$self=this;
  3048. return self;
  3049. }; }),
  3050. $globals.ProtoObject);
  3051. $core.addMethod(
  3052. $core.method({
  3053. selector: "instVarNamed:",
  3054. protocol: "accessing",
  3055. args: ["aString"],
  3056. source: "instVarNamed: aString\x0a\x09<inlineJS: 'return $self[aString]'>",
  3057. referencedClasses: [],
  3058. pragmas: [["inlineJS:", ["return $self[aString]"]]],
  3059. messageSends: []
  3060. }, function ($methodClass){ return function (aString){
  3061. var self=this,$self=this;
  3062. return $core.withContext(function($ctx1) {
  3063. return $self[aString];
  3064. return self;
  3065. }, function($ctx1) {$ctx1.fill(self,"instVarNamed:",{aString:aString})});
  3066. }; }),
  3067. $globals.ProtoObject);
  3068. $core.addMethod(
  3069. $core.method({
  3070. selector: "instVarNamed:put:",
  3071. protocol: "accessing",
  3072. args: ["aString", "anObject"],
  3073. source: "instVarNamed: aString put: anObject\x0a\x09<inlineJS: '$self[aString] = anObject'>",
  3074. referencedClasses: [],
  3075. pragmas: [["inlineJS:", ["$self[aString] = anObject"]]],
  3076. messageSends: []
  3077. }, function ($methodClass){ return function (aString,anObject){
  3078. var self=this,$self=this;
  3079. return $core.withContext(function($ctx1) {
  3080. $self[aString] = anObject;
  3081. return self;
  3082. }, function($ctx1) {$ctx1.fill(self,"instVarNamed:put:",{aString:aString,anObject:anObject})});
  3083. }; }),
  3084. $globals.ProtoObject);
  3085. $core.addMethod(
  3086. $core.method({
  3087. selector: "isKindOf:",
  3088. protocol: "testing",
  3089. args: ["aClass"],
  3090. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  3091. referencedClasses: [],
  3092. pragmas: [],
  3093. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  3094. }, function ($methodClass){ return function (aClass){
  3095. var self=this,$self=this;
  3096. return $core.withContext(function($ctx1) {
  3097. if($core.assert($self._isMemberOf_(aClass))){
  3098. return true;
  3099. } else {
  3100. return $recv($self._class())._inheritsFrom_(aClass);
  3101. }
  3102. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass})});
  3103. }; }),
  3104. $globals.ProtoObject);
  3105. $core.addMethod(
  3106. $core.method({
  3107. selector: "isNil",
  3108. protocol: "testing",
  3109. args: [],
  3110. source: "isNil\x0a\x09^ false",
  3111. referencedClasses: [],
  3112. pragmas: [],
  3113. messageSends: []
  3114. }, function ($methodClass){ return function (){
  3115. var self=this,$self=this;
  3116. return false;
  3117. }; }),
  3118. $globals.ProtoObject);
  3119. $core.addMethod(
  3120. $core.method({
  3121. selector: "notNil",
  3122. protocol: "testing",
  3123. args: [],
  3124. source: "notNil\x0a\x09^ true",
  3125. referencedClasses: [],
  3126. pragmas: [],
  3127. messageSends: []
  3128. }, function ($methodClass){ return function (){
  3129. var self=this,$self=this;
  3130. return true;
  3131. }; }),
  3132. $globals.ProtoObject);
  3133. $core.addMethod(
  3134. $core.method({
  3135. selector: "perform:",
  3136. protocol: "message handling",
  3137. args: ["aString"],
  3138. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  3139. referencedClasses: [],
  3140. pragmas: [],
  3141. messageSends: ["perform:withArguments:"]
  3142. }, function ($methodClass){ return function (aString){
  3143. var self=this,$self=this;
  3144. return $core.withContext(function($ctx1) {
  3145. return $self._perform_withArguments_(aString,[]);
  3146. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString})});
  3147. }; }),
  3148. $globals.ProtoObject);
  3149. $core.addMethod(
  3150. $core.method({
  3151. selector: "perform:withArguments:",
  3152. protocol: "message handling",
  3153. args: ["aString", "aCollection"],
  3154. source: "perform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return $core.send2(self, aString, aCollection)'>",
  3155. referencedClasses: [],
  3156. pragmas: [["inlineJS:", ["return $core.send2(self, aString, aCollection)"]]],
  3157. messageSends: []
  3158. }, function ($methodClass){ return function (aString,aCollection){
  3159. var self=this,$self=this;
  3160. return $core.withContext(function($ctx1) {
  3161. return $core.send2(self, aString, aCollection);
  3162. return self;
  3163. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection})});
  3164. }; }),
  3165. $globals.ProtoObject);
  3166. $core.addMethod(
  3167. $core.method({
  3168. selector: "printOn:",
  3169. protocol: "printing",
  3170. args: ["aStream"],
  3171. 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",
  3172. referencedClasses: [],
  3173. pragmas: [],
  3174. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  3175. }, function ($methodClass){ return function (aStream){
  3176. var self=this,$self=this;
  3177. return $core.withContext(function($ctx1) {
  3178. var $1;
  3179. if($core.assert($recv($recv([$recv([$self._class()
  3180. ,$ctx1.sendIdx["class"]=1
  3181. ][0])._name()
  3182. ,$ctx1.sendIdx["name"]=1
  3183. ][0])._first())._isVowel())){
  3184. $1="an ";
  3185. } else {
  3186. $1="a ";
  3187. }
  3188. [$recv(aStream)._nextPutAll_($1)
  3189. ,$ctx1.sendIdx["nextPutAll:"]=1
  3190. ][0];
  3191. $recv(aStream)._nextPutAll_($recv($self._class())._name());
  3192. return self;
  3193. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  3194. }; }),
  3195. $globals.ProtoObject);
  3196. $core.addMethod(
  3197. $core.method({
  3198. selector: "printString",
  3199. protocol: "printing",
  3200. args: [],
  3201. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  3202. referencedClasses: ["String"],
  3203. pragmas: [],
  3204. messageSends: ["streamContents:", "printOn:"]
  3205. }, function ($methodClass){ return function (){
  3206. var self=this,$self=this;
  3207. return $core.withContext(function($ctx1) {
  3208. return $recv($globals.String)._streamContents_((function(str){
  3209. return $core.withContext(function($ctx2) {
  3210. return $self._printOn_(str);
  3211. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3212. }));
  3213. }, function($ctx1) {$ctx1.fill(self,"printString",{})});
  3214. }; }),
  3215. $globals.ProtoObject);
  3216. $core.addMethod(
  3217. $core.method({
  3218. selector: "yourself",
  3219. protocol: "accessing",
  3220. args: [],
  3221. source: "yourself\x0a\x09^ self",
  3222. referencedClasses: [],
  3223. pragmas: [],
  3224. messageSends: []
  3225. }, function ($methodClass){ return function (){
  3226. var self=this,$self=this;
  3227. return self;
  3228. }; }),
  3229. $globals.ProtoObject);
  3230. $core.addMethod(
  3231. $core.method({
  3232. selector: "~=",
  3233. protocol: "comparing",
  3234. args: ["anObject"],
  3235. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  3236. referencedClasses: [],
  3237. pragmas: [],
  3238. messageSends: ["="]
  3239. }, function ($methodClass){ return function (anObject){
  3240. var self=this,$self=this;
  3241. return $core.withContext(function($ctx1) {
  3242. return [$recv($self.__eq(anObject)).__eq(false)
  3243. ,$ctx1.sendIdx["="]=1
  3244. ][0];
  3245. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject})});
  3246. }; }),
  3247. $globals.ProtoObject);
  3248. $core.addMethod(
  3249. $core.method({
  3250. selector: "~~",
  3251. protocol: "comparing",
  3252. args: ["anObject"],
  3253. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  3254. referencedClasses: [],
  3255. pragmas: [],
  3256. messageSends: ["=", "=="]
  3257. }, function ($methodClass){ return function (anObject){
  3258. var self=this,$self=this;
  3259. return $core.withContext(function($ctx1) {
  3260. return $recv($self.__eq_eq(anObject)).__eq(false);
  3261. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject})});
  3262. }; }),
  3263. $globals.ProtoObject);
  3264. $core.addMethod(
  3265. $core.method({
  3266. selector: "initialize",
  3267. protocol: "initialization",
  3268. args: [],
  3269. source: "initialize",
  3270. referencedClasses: [],
  3271. pragmas: [],
  3272. messageSends: []
  3273. }, function ($methodClass){ return function (){
  3274. var self=this,$self=this;
  3275. return self;
  3276. }; }),
  3277. $globals.ProtoObject.a$cls);
  3278. $core.addClass("Object", $globals.ProtoObject, [], "Kernel-Objects");
  3279. $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.";
  3280. $core.addMethod(
  3281. $core.method({
  3282. selector: "->",
  3283. protocol: "converting",
  3284. args: ["anObject"],
  3285. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  3286. referencedClasses: ["Association"],
  3287. pragmas: [],
  3288. messageSends: ["key:value:"]
  3289. }, function ($methodClass){ return function (anObject){
  3290. var self=this,$self=this;
  3291. return $core.withContext(function($ctx1) {
  3292. return $recv($globals.Association)._key_value_(self,anObject);
  3293. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject})});
  3294. }; }),
  3295. $globals.Object);
  3296. $core.addMethod(
  3297. $core.method({
  3298. selector: "asJSONString",
  3299. protocol: "converting",
  3300. args: [],
  3301. source: "asJSONString\x0a\x09^ JSON stringify: self asJavaScriptObject",
  3302. referencedClasses: ["JSON"],
  3303. pragmas: [],
  3304. messageSends: ["stringify:", "asJavaScriptObject"]
  3305. }, function ($methodClass){ return function (){
  3306. var self=this,$self=this;
  3307. return $core.withContext(function($ctx1) {
  3308. return $recv($globals.JSON)._stringify_($self._asJavaScriptObject());
  3309. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{})});
  3310. }; }),
  3311. $globals.Object);
  3312. $core.addMethod(
  3313. $core.method({
  3314. selector: "asJavaScriptObject",
  3315. protocol: "converting",
  3316. args: [],
  3317. source: "asJavaScriptObject\x0a\x09| variables |\x0a\x09variables := HashedCollection new.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarNamed: each) asJavaScriptObject ].\x0a\x09^ variables",
  3318. referencedClasses: ["HashedCollection"],
  3319. pragmas: [],
  3320. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJavaScriptObject", "instVarNamed:"]
  3321. }, function ($methodClass){ return function (){
  3322. var self=this,$self=this;
  3323. var variables;
  3324. return $core.withContext(function($ctx1) {
  3325. variables=$recv($globals.HashedCollection)._new();
  3326. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  3327. return $core.withContext(function($ctx2) {
  3328. return $recv(variables)._at_put_(each,$recv($self._instVarNamed_(each))._asJavaScriptObject());
  3329. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3330. }));
  3331. return variables;
  3332. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{variables:variables})});
  3333. }; }),
  3334. $globals.Object);
  3335. $core.addMethod(
  3336. $core.method({
  3337. selector: "asJavaScriptSource",
  3338. protocol: "converting",
  3339. args: [],
  3340. source: "asJavaScriptSource\x0a\x09^ self asString",
  3341. referencedClasses: [],
  3342. pragmas: [],
  3343. messageSends: ["asString"]
  3344. }, function ($methodClass){ return function (){
  3345. var self=this,$self=this;
  3346. return $core.withContext(function($ctx1) {
  3347. return $self._asString();
  3348. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  3349. }; }),
  3350. $globals.Object);
  3351. $core.addMethod(
  3352. $core.method({
  3353. selector: "basicAt:",
  3354. protocol: "accessing",
  3355. args: ["aString"],
  3356. source: "basicAt: aString\x0a\x09<inlineJS: 'return self[aString]'>",
  3357. referencedClasses: [],
  3358. pragmas: [["inlineJS:", ["return self[aString]"]]],
  3359. messageSends: []
  3360. }, function ($methodClass){ return function (aString){
  3361. var self=this,$self=this;
  3362. return $core.withContext(function($ctx1) {
  3363. return self[aString];
  3364. return self;
  3365. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString})});
  3366. }; }),
  3367. $globals.Object);
  3368. $core.addMethod(
  3369. $core.method({
  3370. selector: "basicAt:put:",
  3371. protocol: "accessing",
  3372. args: ["aString", "anObject"],
  3373. source: "basicAt: aString put: anObject\x0a\x09<inlineJS: 'return self[aString] = anObject'>",
  3374. referencedClasses: [],
  3375. pragmas: [["inlineJS:", ["return self[aString] = anObject"]]],
  3376. messageSends: []
  3377. }, function ($methodClass){ return function (aString,anObject){
  3378. var self=this,$self=this;
  3379. return $core.withContext(function($ctx1) {
  3380. return self[aString] = anObject;
  3381. return self;
  3382. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject})});
  3383. }; }),
  3384. $globals.Object);
  3385. $core.addMethod(
  3386. $core.method({
  3387. selector: "basicDelete:",
  3388. protocol: "accessing",
  3389. args: ["aString"],
  3390. source: "basicDelete: aString\x0a\x09<inlineJS: 'delete self[aString]; return aString'>",
  3391. referencedClasses: [],
  3392. pragmas: [["inlineJS:", ["delete self[aString]; return aString"]]],
  3393. messageSends: []
  3394. }, function ($methodClass){ return function (aString){
  3395. var self=this,$self=this;
  3396. return $core.withContext(function($ctx1) {
  3397. delete self[aString]; return aString;
  3398. return self;
  3399. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString})});
  3400. }; }),
  3401. $globals.Object);
  3402. $core.addMethod(
  3403. $core.method({
  3404. selector: "basicPerform:",
  3405. protocol: "message handling",
  3406. args: ["aString"],
  3407. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  3408. referencedClasses: [],
  3409. pragmas: [],
  3410. messageSends: ["basicPerform:withArguments:"]
  3411. }, function ($methodClass){ return function (aString){
  3412. var self=this,$self=this;
  3413. return $core.withContext(function($ctx1) {
  3414. return $self._basicPerform_withArguments_(aString,[]);
  3415. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString})});
  3416. }; }),
  3417. $globals.Object);
  3418. $core.addMethod(
  3419. $core.method({
  3420. selector: "basicPerform:withArguments:",
  3421. protocol: "message handling",
  3422. args: ["aString", "aCollection"],
  3423. source: "basicPerform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return self[aString].apply(self, aCollection);'>",
  3424. referencedClasses: [],
  3425. pragmas: [["inlineJS:", ["return self[aString].apply(self, aCollection);"]]],
  3426. messageSends: []
  3427. }, function ($methodClass){ return function (aString,aCollection){
  3428. var self=this,$self=this;
  3429. return $core.withContext(function($ctx1) {
  3430. return self[aString].apply(self, aCollection);;
  3431. return self;
  3432. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection})});
  3433. }; }),
  3434. $globals.Object);
  3435. $core.addMethod(
  3436. $core.method({
  3437. selector: "browse",
  3438. protocol: "browsing",
  3439. args: [],
  3440. source: "browse\x0a\x09Finder findClass: self class",
  3441. referencedClasses: ["Finder"],
  3442. pragmas: [],
  3443. messageSends: ["findClass:", "class"]
  3444. }, function ($methodClass){ return function (){
  3445. var self=this,$self=this;
  3446. return $core.withContext(function($ctx1) {
  3447. $recv($globals.Finder)._findClass_($self._class());
  3448. return self;
  3449. }, function($ctx1) {$ctx1.fill(self,"browse",{})});
  3450. }; }),
  3451. $globals.Object);
  3452. $core.addMethod(
  3453. $core.method({
  3454. selector: "copy",
  3455. protocol: "copying",
  3456. args: [],
  3457. source: "copy\x0a\x09^ self shallowCopy postCopy",
  3458. referencedClasses: [],
  3459. pragmas: [],
  3460. messageSends: ["postCopy", "shallowCopy"]
  3461. }, function ($methodClass){ return function (){
  3462. var self=this,$self=this;
  3463. return $core.withContext(function($ctx1) {
  3464. return $recv($self._shallowCopy())._postCopy();
  3465. }, function($ctx1) {$ctx1.fill(self,"copy",{})});
  3466. }; }),
  3467. $globals.Object);
  3468. $core.addMethod(
  3469. $core.method({
  3470. selector: "deepCopy",
  3471. protocol: "copying",
  3472. args: [],
  3473. source: "deepCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\x0a\x09\x09\x09copy[i] = $recv(self[i])._deepCopy();\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  3474. referencedClasses: [],
  3475. pragmas: [["inlineJS:", ["\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\x0a\x09\x09\x09copy[i] = $recv(self[i])._deepCopy();\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09"]]],
  3476. messageSends: []
  3477. }, function ($methodClass){ return function (){
  3478. var self=this,$self=this;
  3479. return $core.withContext(function($ctx1) {
  3480. var copy = self.a$cls._new();
  3481. Object.keys(self).forEach(function (i) {
  3482. copy[i] = $recv(self[i])._deepCopy();
  3483. });
  3484. return copy;
  3485. ;
  3486. return self;
  3487. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  3488. }; }),
  3489. $globals.Object);
  3490. $core.addMethod(
  3491. $core.method({
  3492. selector: "deprecatedAPI",
  3493. protocol: "error handling",
  3494. args: [],
  3495. 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, ')'.",
  3496. referencedClasses: [],
  3497. pragmas: [],
  3498. messageSends: ["warn:", ",", "asString", "home"]
  3499. }, function ($methodClass){ return function (){
  3500. var self=this,$self=this;
  3501. return $core.withContext(function($ctx1) {
  3502. $recv(console)._warn_([$recv([$recv($recv([$recv([$core.getThisContext()._home()
  3503. ,$ctx1.sendIdx["home"]=1
  3504. ][0])._asString()
  3505. ,$ctx1.sendIdx["asString"]=1
  3506. ][0]).__comma(" is deprecated! (in ")).__comma($recv([$recv($core.getThisContext()._home())._home()
  3507. ,$ctx1.sendIdx["home"]=2
  3508. ][0])._asString())
  3509. ,$ctx1.sendIdx[","]=2
  3510. ][0]).__comma(")")
  3511. ,$ctx1.sendIdx[","]=1
  3512. ][0]);
  3513. return self;
  3514. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{})});
  3515. }; }),
  3516. $globals.Object);
  3517. $core.addMethod(
  3518. $core.method({
  3519. selector: "deprecatedAPI:",
  3520. protocol: "error handling",
  3521. args: ["aString"],
  3522. 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",
  3523. referencedClasses: [],
  3524. pragmas: [],
  3525. messageSends: ["warn:", ",", "asString", "home"]
  3526. }, function ($methodClass){ return function (aString){
  3527. var self=this,$self=this;
  3528. return $core.withContext(function($ctx1) {
  3529. [$recv(console)._warn_([$recv([$recv($recv([$recv([$core.getThisContext()._home()
  3530. ,$ctx1.sendIdx["home"]=1
  3531. ][0])._asString()
  3532. ,$ctx1.sendIdx["asString"]=1
  3533. ][0]).__comma(" is deprecated! (in ")).__comma($recv([$recv($core.getThisContext()._home())._home()
  3534. ,$ctx1.sendIdx["home"]=2
  3535. ][0])._asString())
  3536. ,$ctx1.sendIdx[","]=2
  3537. ][0]).__comma(")")
  3538. ,$ctx1.sendIdx[","]=1
  3539. ][0])
  3540. ,$ctx1.sendIdx["warn:"]=1
  3541. ][0];
  3542. $recv(console)._warn_(aString);
  3543. return self;
  3544. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString})});
  3545. }; }),
  3546. $globals.Object);
  3547. $core.addMethod(
  3548. $core.method({
  3549. selector: "error:",
  3550. protocol: "error handling",
  3551. args: ["aString"],
  3552. source: "error: aString\x0a\x09Error signal: aString",
  3553. referencedClasses: ["Error"],
  3554. pragmas: [],
  3555. messageSends: ["signal:"]
  3556. }, function ($methodClass){ return function (aString){
  3557. var self=this,$self=this;
  3558. return $core.withContext(function($ctx1) {
  3559. $recv($globals.Error)._signal_(aString);
  3560. return self;
  3561. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString})});
  3562. }; }),
  3563. $globals.Object);
  3564. $core.addMethod(
  3565. $core.method({
  3566. selector: "halt",
  3567. protocol: "error handling",
  3568. args: [],
  3569. source: "halt\x0a\x09Halt signal",
  3570. referencedClasses: ["Halt"],
  3571. pragmas: [],
  3572. messageSends: ["signal"]
  3573. }, function ($methodClass){ return function (){
  3574. var self=this,$self=this;
  3575. return $core.withContext(function($ctx1) {
  3576. $recv($globals.Halt)._signal();
  3577. return self;
  3578. }, function($ctx1) {$ctx1.fill(self,"halt",{})});
  3579. }; }),
  3580. $globals.Object);
  3581. $core.addMethod(
  3582. $core.method({
  3583. selector: "in:",
  3584. protocol: "evaluating",
  3585. args: ["aValuable"],
  3586. source: "in: aValuable\x0a\x09^ aValuable value: self",
  3587. referencedClasses: [],
  3588. pragmas: [],
  3589. messageSends: ["value:"]
  3590. }, function ($methodClass){ return function (aValuable){
  3591. var self=this,$self=this;
  3592. return $core.withContext(function($ctx1) {
  3593. return $recv(aValuable)._value_(self);
  3594. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable})});
  3595. }; }),
  3596. $globals.Object);
  3597. $core.addMethod(
  3598. $core.method({
  3599. selector: "isImmutable",
  3600. protocol: "testing",
  3601. args: [],
  3602. source: "isImmutable\x0a\x09^ false",
  3603. referencedClasses: [],
  3604. pragmas: [],
  3605. messageSends: []
  3606. }, function ($methodClass){ return function (){
  3607. var self=this,$self=this;
  3608. return false;
  3609. }; }),
  3610. $globals.Object);
  3611. $core.addMethod(
  3612. $core.method({
  3613. selector: "isMemberOf:",
  3614. protocol: "testing",
  3615. args: ["aClass"],
  3616. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  3617. referencedClasses: [],
  3618. pragmas: [],
  3619. messageSends: ["=", "class"]
  3620. }, function ($methodClass){ return function (aClass){
  3621. var self=this,$self=this;
  3622. return $core.withContext(function($ctx1) {
  3623. return $recv($self._class()).__eq(aClass);
  3624. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass})});
  3625. }; }),
  3626. $globals.Object);
  3627. $core.addMethod(
  3628. $core.method({
  3629. selector: "isParseFailure",
  3630. protocol: "testing",
  3631. args: [],
  3632. source: "isParseFailure\x0a\x09^ false",
  3633. referencedClasses: [],
  3634. pragmas: [],
  3635. messageSends: []
  3636. }, function ($methodClass){ return function (){
  3637. var self=this,$self=this;
  3638. return false;
  3639. }; }),
  3640. $globals.Object);
  3641. $core.addMethod(
  3642. $core.method({
  3643. selector: "postCopy",
  3644. protocol: "copying",
  3645. args: [],
  3646. source: "postCopy",
  3647. referencedClasses: [],
  3648. pragmas: [],
  3649. messageSends: []
  3650. }, function ($methodClass){ return function (){
  3651. var self=this,$self=this;
  3652. return self;
  3653. }; }),
  3654. $globals.Object);
  3655. $core.addMethod(
  3656. $core.method({
  3657. selector: "putOn:",
  3658. protocol: "streaming",
  3659. args: ["aStream"],
  3660. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  3661. referencedClasses: [],
  3662. pragmas: [],
  3663. messageSends: ["nextPut:"]
  3664. }, function ($methodClass){ return function (aStream){
  3665. var self=this,$self=this;
  3666. return $core.withContext(function($ctx1) {
  3667. $recv(aStream)._nextPut_(self);
  3668. return self;
  3669. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  3670. }; }),
  3671. $globals.Object);
  3672. $core.addMethod(
  3673. $core.method({
  3674. selector: "respondsTo:",
  3675. protocol: "testing",
  3676. args: ["aSelector"],
  3677. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  3678. referencedClasses: [],
  3679. pragmas: [],
  3680. messageSends: ["canUnderstand:", "class"]
  3681. }, function ($methodClass){ return function (aSelector){
  3682. var self=this,$self=this;
  3683. return $core.withContext(function($ctx1) {
  3684. return $recv($self._class())._canUnderstand_(aSelector);
  3685. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector})});
  3686. }; }),
  3687. $globals.Object);
  3688. $core.addMethod(
  3689. $core.method({
  3690. selector: "shallowCopy",
  3691. protocol: "copying",
  3692. args: [],
  3693. source: "shallowCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function(i) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  3694. referencedClasses: [],
  3695. pragmas: [["inlineJS:", ["\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function(i) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09"]]],
  3696. messageSends: []
  3697. }, function ($methodClass){ return function (){
  3698. var self=this,$self=this;
  3699. return $core.withContext(function($ctx1) {
  3700. var copy = self.a$cls._new();
  3701. Object.keys(self).forEach(function(i) {
  3702. copy[i] = self[i];
  3703. });
  3704. return copy;
  3705. ;
  3706. return self;
  3707. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  3708. }; }),
  3709. $globals.Object);
  3710. $core.addMethod(
  3711. $core.method({
  3712. selector: "shouldNotImplement",
  3713. protocol: "error handling",
  3714. args: [],
  3715. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  3716. referencedClasses: [],
  3717. pragmas: [],
  3718. messageSends: ["error:", ",", "name", "class"]
  3719. }, function ($methodClass){ return function (){
  3720. var self=this,$self=this;
  3721. return $core.withContext(function($ctx1) {
  3722. $self._error_("This method should not be implemented in ".__comma($recv($self._class())._name()));
  3723. return self;
  3724. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{})});
  3725. }; }),
  3726. $globals.Object);
  3727. $core.addMethod(
  3728. $core.method({
  3729. selector: "size",
  3730. protocol: "accessing",
  3731. args: [],
  3732. source: "size\x0a\x09self error: 'Object not indexable'",
  3733. referencedClasses: [],
  3734. pragmas: [],
  3735. messageSends: ["error:"]
  3736. }, function ($methodClass){ return function (){
  3737. var self=this,$self=this;
  3738. return $core.withContext(function($ctx1) {
  3739. $self._error_("Object not indexable");
  3740. return self;
  3741. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  3742. }; }),
  3743. $globals.Object);
  3744. $core.addMethod(
  3745. $core.method({
  3746. selector: "subclassResponsibility",
  3747. protocol: "error handling",
  3748. args: [],
  3749. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  3750. referencedClasses: [],
  3751. pragmas: [],
  3752. messageSends: ["error:"]
  3753. }, function ($methodClass){ return function (){
  3754. var self=this,$self=this;
  3755. return $core.withContext(function($ctx1) {
  3756. $self._error_("This method is a responsibility of a subclass");
  3757. return self;
  3758. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{})});
  3759. }; }),
  3760. $globals.Object);
  3761. $core.addMethod(
  3762. $core.method({
  3763. selector: "value",
  3764. protocol: "evaluating",
  3765. args: [],
  3766. source: "value\x0a\x09<inlineJS: 'return self.valueOf()'>",
  3767. referencedClasses: [],
  3768. pragmas: [["inlineJS:", ["return self.valueOf()"]]],
  3769. messageSends: []
  3770. }, function ($methodClass){ return function (){
  3771. var self=this,$self=this;
  3772. return $core.withContext(function($ctx1) {
  3773. return self.valueOf();
  3774. return self;
  3775. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  3776. }; }),
  3777. $globals.Object);
  3778. $core.addMethod(
  3779. $core.method({
  3780. selector: "accessorProtocolWith:",
  3781. protocol: "helios",
  3782. args: ["aGenerator"],
  3783. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  3784. referencedClasses: [],
  3785. pragmas: [],
  3786. messageSends: ["accessorProtocolForObject"]
  3787. }, function ($methodClass){ return function (aGenerator){
  3788. var self=this,$self=this;
  3789. return $core.withContext(function($ctx1) {
  3790. $recv(aGenerator)._accessorProtocolForObject();
  3791. return self;
  3792. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator})});
  3793. }; }),
  3794. $globals.Object.a$cls);
  3795. $core.addMethod(
  3796. $core.method({
  3797. selector: "accessorsSourceCodesWith:",
  3798. protocol: "helios",
  3799. args: ["aGenerator"],
  3800. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  3801. referencedClasses: [],
  3802. pragmas: [],
  3803. messageSends: ["accessorsForObject"]
  3804. }, function ($methodClass){ return function (aGenerator){
  3805. var self=this,$self=this;
  3806. return $core.withContext(function($ctx1) {
  3807. $recv(aGenerator)._accessorsForObject();
  3808. return self;
  3809. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator})});
  3810. }; }),
  3811. $globals.Object.a$cls);
  3812. $core.addMethod(
  3813. $core.method({
  3814. selector: "initialize",
  3815. protocol: "initialization",
  3816. args: [],
  3817. source: "initialize\x0a\x09\x22no op\x22",
  3818. referencedClasses: [],
  3819. pragmas: [],
  3820. messageSends: []
  3821. }, function ($methodClass){ return function (){
  3822. var self=this,$self=this;
  3823. return self;
  3824. }; }),
  3825. $globals.Object.a$cls);
  3826. $core.addMethod(
  3827. $core.method({
  3828. selector: "initializeProtocolWith:",
  3829. protocol: "helios",
  3830. args: ["aGenerator"],
  3831. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  3832. referencedClasses: [],
  3833. pragmas: [],
  3834. messageSends: ["initializeProtocolForObject"]
  3835. }, function ($methodClass){ return function (aGenerator){
  3836. var self=this,$self=this;
  3837. return $core.withContext(function($ctx1) {
  3838. $recv(aGenerator)._initializeProtocolForObject();
  3839. return self;
  3840. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator})});
  3841. }; }),
  3842. $globals.Object.a$cls);
  3843. $core.addMethod(
  3844. $core.method({
  3845. selector: "initializeSourceCodesWith:",
  3846. protocol: "helios",
  3847. args: ["aGenerator"],
  3848. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  3849. referencedClasses: [],
  3850. pragmas: [],
  3851. messageSends: ["initializeForObject"]
  3852. }, function ($methodClass){ return function (aGenerator){
  3853. var self=this,$self=this;
  3854. return $core.withContext(function($ctx1) {
  3855. $recv(aGenerator)._initializeForObject();
  3856. return self;
  3857. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator})});
  3858. }; }),
  3859. $globals.Object.a$cls);
  3860. $core.addClass("Boolean", $globals.Object, [], "Kernel-Objects");
  3861. $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: [ ... ]";
  3862. $core.addMethod(
  3863. $core.method({
  3864. selector: "&",
  3865. protocol: "controlling",
  3866. args: ["aBoolean"],
  3867. 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'>",
  3868. referencedClasses: [],
  3869. pragmas: [["inlineJS:", ["\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09"]]],
  3870. messageSends: []
  3871. }, function ($methodClass){ return function (aBoolean){
  3872. var self=this,$self=this;
  3873. return $core.withContext(function($ctx1) {
  3874. if(self == true) {
  3875. return aBoolean;
  3876. } else {
  3877. return false;
  3878. }
  3879. ;
  3880. return self;
  3881. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean})});
  3882. }; }),
  3883. $globals.Boolean);
  3884. $core.addMethod(
  3885. $core.method({
  3886. selector: "==",
  3887. protocol: "comparing",
  3888. args: ["aBoolean"],
  3889. source: "== aBoolean\x0a<inlineJS: '\x0a\x09if (typeof aBoolean === \x22boolean\x22) return (self == true) === aBoolean;\x0a\x09else if (aBoolean != null && typeof aBoolean === \x22object\x22) return (self == true) === aBoolean.valueOf();\x0a\x09else return false;\x0a'>",
  3890. referencedClasses: [],
  3891. pragmas: [["inlineJS:", ["\x0a\x09if (typeof aBoolean === \x22boolean\x22) return (self == true) === aBoolean;\x0a\x09else if (aBoolean != null && typeof aBoolean === \x22object\x22) return (self == true) === aBoolean.valueOf();\x0a\x09else return false;"]]],
  3892. messageSends: []
  3893. }, function ($methodClass){ return function (aBoolean){
  3894. var self=this,$self=this;
  3895. return $core.withContext(function($ctx1) {
  3896. if (typeof aBoolean === "boolean") return (self == true) === aBoolean;
  3897. else if (aBoolean != null && typeof aBoolean === "object") return (self == true) === aBoolean.valueOf();
  3898. else return false;;
  3899. return self;
  3900. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean})});
  3901. }; }),
  3902. $globals.Boolean);
  3903. $core.addMethod(
  3904. $core.method({
  3905. selector: "and:",
  3906. protocol: "controlling",
  3907. args: ["aBlock"],
  3908. source: "and: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ false ]",
  3909. referencedClasses: [],
  3910. pragmas: [],
  3911. messageSends: ["ifTrue:ifFalse:", "value"]
  3912. }, function ($methodClass){ return function (aBlock){
  3913. var self=this,$self=this;
  3914. return $core.withContext(function($ctx1) {
  3915. if($core.assert(self)){
  3916. return $recv(aBlock)._value();
  3917. } else {
  3918. return false;
  3919. }
  3920. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock})});
  3921. }; }),
  3922. $globals.Boolean);
  3923. $core.addMethod(
  3924. $core.method({
  3925. selector: "asBit",
  3926. protocol: "converting",
  3927. args: [],
  3928. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3929. referencedClasses: [],
  3930. pragmas: [],
  3931. messageSends: ["ifTrue:ifFalse:"]
  3932. }, function ($methodClass){ return function (){
  3933. var self=this,$self=this;
  3934. return $core.withContext(function($ctx1) {
  3935. if($core.assert(self)){
  3936. return (1);
  3937. } else {
  3938. return (0);
  3939. }
  3940. }, function($ctx1) {$ctx1.fill(self,"asBit",{})});
  3941. }; }),
  3942. $globals.Boolean);
  3943. $core.addMethod(
  3944. $core.method({
  3945. selector: "asJavaScriptObject",
  3946. protocol: "converting",
  3947. args: [],
  3948. source: "asJavaScriptObject\x0a\x09^ self",
  3949. referencedClasses: [],
  3950. pragmas: [],
  3951. messageSends: []
  3952. }, function ($methodClass){ return function (){
  3953. var self=this,$self=this;
  3954. return self;
  3955. }; }),
  3956. $globals.Boolean);
  3957. $core.addMethod(
  3958. $core.method({
  3959. selector: "asString",
  3960. protocol: "converting",
  3961. args: [],
  3962. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3963. referencedClasses: [],
  3964. pragmas: [["inlineJS:", ["return self.toString()"]]],
  3965. messageSends: []
  3966. }, function ($methodClass){ return function (){
  3967. var self=this,$self=this;
  3968. return $core.withContext(function($ctx1) {
  3969. return self.toString();
  3970. return self;
  3971. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  3972. }; }),
  3973. $globals.Boolean);
  3974. $core.addMethod(
  3975. $core.method({
  3976. selector: "deepCopy",
  3977. protocol: "copying",
  3978. args: [],
  3979. source: "deepCopy\x0a\x09^ self",
  3980. referencedClasses: [],
  3981. pragmas: [],
  3982. messageSends: []
  3983. }, function ($methodClass){ return function (){
  3984. var self=this,$self=this;
  3985. return self;
  3986. }; }),
  3987. $globals.Boolean);
  3988. $core.addMethod(
  3989. $core.method({
  3990. selector: "ifFalse:",
  3991. protocol: "controlling",
  3992. args: ["aBlock"],
  3993. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3994. referencedClasses: [],
  3995. pragmas: [],
  3996. messageSends: ["ifTrue:ifFalse:"]
  3997. }, function ($methodClass){ return function (aBlock){
  3998. var self=this,$self=this;
  3999. return $core.withContext(function($ctx1) {
  4000. return $self._ifTrue_ifFalse_((function(){
  4001. }),aBlock);
  4002. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock})});
  4003. }; }),
  4004. $globals.Boolean);
  4005. $core.addMethod(
  4006. $core.method({
  4007. selector: "ifFalse:ifTrue:",
  4008. protocol: "controlling",
  4009. args: ["aBlock", "anotherBlock"],
  4010. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  4011. referencedClasses: [],
  4012. pragmas: [],
  4013. messageSends: ["ifTrue:ifFalse:"]
  4014. }, function ($methodClass){ return function (aBlock,anotherBlock){
  4015. var self=this,$self=this;
  4016. return $core.withContext(function($ctx1) {
  4017. return $self._ifTrue_ifFalse_(anotherBlock,aBlock);
  4018. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  4019. }; }),
  4020. $globals.Boolean);
  4021. $core.addMethod(
  4022. $core.method({
  4023. selector: "ifTrue:",
  4024. protocol: "controlling",
  4025. args: ["aBlock"],
  4026. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  4027. referencedClasses: [],
  4028. pragmas: [],
  4029. messageSends: ["ifTrue:ifFalse:"]
  4030. }, function ($methodClass){ return function (aBlock){
  4031. var self=this,$self=this;
  4032. return $core.withContext(function($ctx1) {
  4033. return $self._ifTrue_ifFalse_(aBlock,(function(){
  4034. }));
  4035. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock})});
  4036. }; }),
  4037. $globals.Boolean);
  4038. $core.addMethod(
  4039. $core.method({
  4040. selector: "ifTrue:ifFalse:",
  4041. protocol: "controlling",
  4042. args: ["aBlock", "anotherBlock"],
  4043. 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'>",
  4044. referencedClasses: [],
  4045. pragmas: [["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"]]],
  4046. messageSends: []
  4047. }, function ($methodClass){ return function (aBlock,anotherBlock){
  4048. var self=this,$self=this;
  4049. return $core.withContext(function($ctx1) {
  4050. if(self == true) {
  4051. return aBlock._value();
  4052. } else {
  4053. return anotherBlock._value();
  4054. }
  4055. ;
  4056. return self;
  4057. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  4058. }; }),
  4059. $globals.Boolean);
  4060. $core.addMethod(
  4061. $core.method({
  4062. selector: "isBoolean",
  4063. protocol: "testing",
  4064. args: [],
  4065. source: "isBoolean\x0a\x09^ true",
  4066. referencedClasses: [],
  4067. pragmas: [],
  4068. messageSends: []
  4069. }, function ($methodClass){ return function (){
  4070. var self=this,$self=this;
  4071. return true;
  4072. }; }),
  4073. $globals.Boolean);
  4074. $core.addMethod(
  4075. $core.method({
  4076. selector: "isImmutable",
  4077. protocol: "testing",
  4078. args: [],
  4079. source: "isImmutable\x0a\x09^ true",
  4080. referencedClasses: [],
  4081. pragmas: [],
  4082. messageSends: []
  4083. }, function ($methodClass){ return function (){
  4084. var self=this,$self=this;
  4085. return true;
  4086. }; }),
  4087. $globals.Boolean);
  4088. $core.addMethod(
  4089. $core.method({
  4090. selector: "not",
  4091. protocol: "controlling",
  4092. args: [],
  4093. source: "not\x0a\x09^ self = false",
  4094. referencedClasses: [],
  4095. pragmas: [],
  4096. messageSends: ["="]
  4097. }, function ($methodClass){ return function (){
  4098. var self=this,$self=this;
  4099. return $core.withContext(function($ctx1) {
  4100. return $self.__eq(false);
  4101. }, function($ctx1) {$ctx1.fill(self,"not",{})});
  4102. }; }),
  4103. $globals.Boolean);
  4104. $core.addMethod(
  4105. $core.method({
  4106. selector: "or:",
  4107. protocol: "controlling",
  4108. args: ["aBlock"],
  4109. source: "or: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: \x22aBlock\x22 [ aBlock value ]",
  4110. referencedClasses: [],
  4111. pragmas: [],
  4112. messageSends: ["ifTrue:ifFalse:", "value"]
  4113. }, function ($methodClass){ return function (aBlock){
  4114. var self=this,$self=this;
  4115. return $core.withContext(function($ctx1) {
  4116. if($core.assert(self)){
  4117. return true;
  4118. } else {
  4119. return $recv(aBlock)._value();
  4120. }
  4121. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock})});
  4122. }; }),
  4123. $globals.Boolean);
  4124. $core.addMethod(
  4125. $core.method({
  4126. selector: "printOn:",
  4127. protocol: "printing",
  4128. args: ["aStream"],
  4129. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4130. referencedClasses: [],
  4131. pragmas: [],
  4132. messageSends: ["nextPutAll:", "asString"]
  4133. }, function ($methodClass){ return function (aStream){
  4134. var self=this,$self=this;
  4135. return $core.withContext(function($ctx1) {
  4136. $recv(aStream)._nextPutAll_($self._asString());
  4137. return self;
  4138. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  4139. }; }),
  4140. $globals.Boolean);
  4141. $core.addMethod(
  4142. $core.method({
  4143. selector: "shallowCopy",
  4144. protocol: "copying",
  4145. args: [],
  4146. source: "shallowCopy\x0a\x09^ self",
  4147. referencedClasses: [],
  4148. pragmas: [],
  4149. messageSends: []
  4150. }, function ($methodClass){ return function (){
  4151. var self=this,$self=this;
  4152. return self;
  4153. }; }),
  4154. $globals.Boolean);
  4155. $core.addMethod(
  4156. $core.method({
  4157. selector: "|",
  4158. protocol: "controlling",
  4159. args: ["aBoolean"],
  4160. 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'>",
  4161. referencedClasses: [],
  4162. pragmas: [["inlineJS:", ["\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09"]]],
  4163. messageSends: []
  4164. }, function ($methodClass){ return function (aBoolean){
  4165. var self=this,$self=this;
  4166. return $core.withContext(function($ctx1) {
  4167. if(self == true) {
  4168. return true;
  4169. } else {
  4170. return aBoolean;
  4171. }
  4172. ;
  4173. return self;
  4174. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean})});
  4175. }; }),
  4176. $globals.Boolean);
  4177. $core.addClass("Date", $globals.Object, [], "Kernel-Objects");
  4178. $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.).";
  4179. $core.addMethod(
  4180. $core.method({
  4181. selector: "+",
  4182. protocol: "arithmetic",
  4183. args: ["aNumber"],
  4184. source: "+ aNumber\x0a\x09<inlineJS: 'return new Date($self.getTime() + aNumber)'>",
  4185. referencedClasses: [],
  4186. pragmas: [["inlineJS:", ["return new Date($self.getTime() + aNumber)"]]],
  4187. messageSends: []
  4188. }, function ($methodClass){ return function (aNumber){
  4189. var self=this,$self=this;
  4190. return $core.withContext(function($ctx1) {
  4191. return new Date($self.getTime() + aNumber);
  4192. return self;
  4193. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber})});
  4194. }; }),
  4195. $globals.Date);
  4196. $core.addMethod(
  4197. $core.method({
  4198. selector: "-",
  4199. protocol: "arithmetic",
  4200. args: ["aDate"],
  4201. source: "- aDate\x0a\x09<inlineJS: 'return self - aDate'>",
  4202. referencedClasses: [],
  4203. pragmas: [["inlineJS:", ["return self - aDate"]]],
  4204. messageSends: []
  4205. }, function ($methodClass){ return function (aDate){
  4206. var self=this,$self=this;
  4207. return $core.withContext(function($ctx1) {
  4208. return self - aDate;
  4209. return self;
  4210. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate})});
  4211. }; }),
  4212. $globals.Date);
  4213. $core.addMethod(
  4214. $core.method({
  4215. selector: "<",
  4216. protocol: "comparing",
  4217. args: ["aDate"],
  4218. source: "< aDate\x0a\x09<inlineJS: 'return self < aDate'>",
  4219. referencedClasses: [],
  4220. pragmas: [["inlineJS:", ["return self < aDate"]]],
  4221. messageSends: []
  4222. }, function ($methodClass){ return function (aDate){
  4223. var self=this,$self=this;
  4224. return $core.withContext(function($ctx1) {
  4225. return self < aDate;
  4226. return self;
  4227. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate})});
  4228. }; }),
  4229. $globals.Date);
  4230. $core.addMethod(
  4231. $core.method({
  4232. selector: "<=",
  4233. protocol: "comparing",
  4234. args: ["aDate"],
  4235. source: "<= aDate\x0a\x09<inlineJS: 'return self <= aDate'>",
  4236. referencedClasses: [],
  4237. pragmas: [["inlineJS:", ["return self <= aDate"]]],
  4238. messageSends: []
  4239. }, function ($methodClass){ return function (aDate){
  4240. var self=this,$self=this;
  4241. return $core.withContext(function($ctx1) {
  4242. return self <= aDate;
  4243. return self;
  4244. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate})});
  4245. }; }),
  4246. $globals.Date);
  4247. $core.addMethod(
  4248. $core.method({
  4249. selector: "=",
  4250. protocol: "comparing",
  4251. args: ["aDate"],
  4252. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  4253. referencedClasses: [],
  4254. pragmas: [],
  4255. messageSends: ["and:", "==", "class", "asMilliseconds"]
  4256. }, function ($methodClass){ return function (aDate){
  4257. var self=this,$self=this;
  4258. return $core.withContext(function($ctx1) {
  4259. return $recv([$recv([$recv(aDate)._class()
  4260. ,$ctx1.sendIdx["class"]=1
  4261. ][0]).__eq_eq($self._class())
  4262. ,$ctx1.sendIdx["=="]=1
  4263. ][0])._and_((function(){
  4264. return $core.withContext(function($ctx2) {
  4265. return $recv([$self._asMilliseconds()
  4266. ,$ctx2.sendIdx["asMilliseconds"]=1
  4267. ][0]).__eq_eq($recv(aDate)._asMilliseconds());
  4268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4269. }));
  4270. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate})});
  4271. }; }),
  4272. $globals.Date);
  4273. $core.addMethod(
  4274. $core.method({
  4275. selector: ">",
  4276. protocol: "comparing",
  4277. args: ["aDate"],
  4278. source: "> aDate\x0a\x09<inlineJS: 'return self > aDate'>",
  4279. referencedClasses: [],
  4280. pragmas: [["inlineJS:", ["return self > aDate"]]],
  4281. messageSends: []
  4282. }, function ($methodClass){ return function (aDate){
  4283. var self=this,$self=this;
  4284. return $core.withContext(function($ctx1) {
  4285. return self > aDate;
  4286. return self;
  4287. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate})});
  4288. }; }),
  4289. $globals.Date);
  4290. $core.addMethod(
  4291. $core.method({
  4292. selector: ">=",
  4293. protocol: "comparing",
  4294. args: ["aDate"],
  4295. source: ">= aDate\x0a\x09<inlineJS: 'return self >= aDate'>",
  4296. referencedClasses: [],
  4297. pragmas: [["inlineJS:", ["return self >= aDate"]]],
  4298. messageSends: []
  4299. }, function ($methodClass){ return function (aDate){
  4300. var self=this,$self=this;
  4301. return $core.withContext(function($ctx1) {
  4302. return self >= aDate;
  4303. return self;
  4304. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate})});
  4305. }; }),
  4306. $globals.Date);
  4307. $core.addMethod(
  4308. $core.method({
  4309. selector: "asDateString",
  4310. protocol: "converting",
  4311. args: [],
  4312. source: "asDateString\x0a\x09<inlineJS: 'return self.toDateString()'>",
  4313. referencedClasses: [],
  4314. pragmas: [["inlineJS:", ["return self.toDateString()"]]],
  4315. messageSends: []
  4316. }, function ($methodClass){ return function (){
  4317. var self=this,$self=this;
  4318. return $core.withContext(function($ctx1) {
  4319. return self.toDateString();
  4320. return self;
  4321. }, function($ctx1) {$ctx1.fill(self,"asDateString",{})});
  4322. }; }),
  4323. $globals.Date);
  4324. $core.addMethod(
  4325. $core.method({
  4326. selector: "asLocaleString",
  4327. protocol: "converting",
  4328. args: [],
  4329. source: "asLocaleString\x0a\x09<inlineJS: 'return self.toLocaleString()'>",
  4330. referencedClasses: [],
  4331. pragmas: [["inlineJS:", ["return self.toLocaleString()"]]],
  4332. messageSends: []
  4333. }, function ($methodClass){ return function (){
  4334. var self=this,$self=this;
  4335. return $core.withContext(function($ctx1) {
  4336. return self.toLocaleString();
  4337. return self;
  4338. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{})});
  4339. }; }),
  4340. $globals.Date);
  4341. $core.addMethod(
  4342. $core.method({
  4343. selector: "asMilliseconds",
  4344. protocol: "converting",
  4345. args: [],
  4346. source: "asMilliseconds\x0a\x09^ self time",
  4347. referencedClasses: [],
  4348. pragmas: [],
  4349. messageSends: ["time"]
  4350. }, function ($methodClass){ return function (){
  4351. var self=this,$self=this;
  4352. return $core.withContext(function($ctx1) {
  4353. return $self._time();
  4354. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{})});
  4355. }; }),
  4356. $globals.Date);
  4357. $core.addMethod(
  4358. $core.method({
  4359. selector: "asNumber",
  4360. protocol: "converting",
  4361. args: [],
  4362. source: "asNumber\x0a\x09^ self asMilliseconds",
  4363. referencedClasses: [],
  4364. pragmas: [],
  4365. messageSends: ["asMilliseconds"]
  4366. }, function ($methodClass){ return function (){
  4367. var self=this,$self=this;
  4368. return $core.withContext(function($ctx1) {
  4369. return $self._asMilliseconds();
  4370. }, function($ctx1) {$ctx1.fill(self,"asNumber",{})});
  4371. }; }),
  4372. $globals.Date);
  4373. $core.addMethod(
  4374. $core.method({
  4375. selector: "asString",
  4376. protocol: "converting",
  4377. args: [],
  4378. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  4379. referencedClasses: [],
  4380. pragmas: [["inlineJS:", ["return self.toString()"]]],
  4381. messageSends: []
  4382. }, function ($methodClass){ return function (){
  4383. var self=this,$self=this;
  4384. return $core.withContext(function($ctx1) {
  4385. return self.toString();
  4386. return self;
  4387. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  4388. }; }),
  4389. $globals.Date);
  4390. $core.addMethod(
  4391. $core.method({
  4392. selector: "asTimeString",
  4393. protocol: "converting",
  4394. args: [],
  4395. source: "asTimeString\x0a\x09<inlineJS: 'return self.toTimeString()'>",
  4396. referencedClasses: [],
  4397. pragmas: [["inlineJS:", ["return self.toTimeString()"]]],
  4398. messageSends: []
  4399. }, function ($methodClass){ return function (){
  4400. var self=this,$self=this;
  4401. return $core.withContext(function($ctx1) {
  4402. return self.toTimeString();
  4403. return self;
  4404. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{})});
  4405. }; }),
  4406. $globals.Date);
  4407. $core.addMethod(
  4408. $core.method({
  4409. selector: "day",
  4410. protocol: "accessing",
  4411. args: [],
  4412. source: "day\x0a\x09^ self dayOfWeek",
  4413. referencedClasses: [],
  4414. pragmas: [],
  4415. messageSends: ["dayOfWeek"]
  4416. }, function ($methodClass){ return function (){
  4417. var self=this,$self=this;
  4418. return $core.withContext(function($ctx1) {
  4419. return $self._dayOfWeek();
  4420. }, function($ctx1) {$ctx1.fill(self,"day",{})});
  4421. }; }),
  4422. $globals.Date);
  4423. $core.addMethod(
  4424. $core.method({
  4425. selector: "day:",
  4426. protocol: "accessing",
  4427. args: ["aNumber"],
  4428. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  4429. referencedClasses: [],
  4430. pragmas: [],
  4431. messageSends: ["dayOfWeek:"]
  4432. }, function ($methodClass){ return function (aNumber){
  4433. var self=this,$self=this;
  4434. return $core.withContext(function($ctx1) {
  4435. $self._dayOfWeek_(aNumber);
  4436. return self;
  4437. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber})});
  4438. }; }),
  4439. $globals.Date);
  4440. $core.addMethod(
  4441. $core.method({
  4442. selector: "dayOfMonth",
  4443. protocol: "accessing",
  4444. args: [],
  4445. source: "dayOfMonth\x0a\x09<inlineJS: 'return self.getDate()'>",
  4446. referencedClasses: [],
  4447. pragmas: [["inlineJS:", ["return self.getDate()"]]],
  4448. messageSends: []
  4449. }, function ($methodClass){ return function (){
  4450. var self=this,$self=this;
  4451. return $core.withContext(function($ctx1) {
  4452. return self.getDate();
  4453. return self;
  4454. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{})});
  4455. }; }),
  4456. $globals.Date);
  4457. $core.addMethod(
  4458. $core.method({
  4459. selector: "dayOfMonth:",
  4460. protocol: "accessing",
  4461. args: ["aNumber"],
  4462. source: "dayOfMonth: aNumber\x0a\x09<inlineJS: 'self.setDate(aNumber)'>",
  4463. referencedClasses: [],
  4464. pragmas: [["inlineJS:", ["self.setDate(aNumber)"]]],
  4465. messageSends: []
  4466. }, function ($methodClass){ return function (aNumber){
  4467. var self=this,$self=this;
  4468. return $core.withContext(function($ctx1) {
  4469. self.setDate(aNumber);
  4470. return self;
  4471. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber})});
  4472. }; }),
  4473. $globals.Date);
  4474. $core.addMethod(
  4475. $core.method({
  4476. selector: "dayOfWeek",
  4477. protocol: "accessing",
  4478. args: [],
  4479. source: "dayOfWeek\x0a\x09<inlineJS: 'return self.getDay() + 1'>",
  4480. referencedClasses: [],
  4481. pragmas: [["inlineJS:", ["return self.getDay() + 1"]]],
  4482. messageSends: []
  4483. }, function ($methodClass){ return function (){
  4484. var self=this,$self=this;
  4485. return $core.withContext(function($ctx1) {
  4486. return self.getDay() + 1;
  4487. return self;
  4488. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{})});
  4489. }; }),
  4490. $globals.Date);
  4491. $core.addMethod(
  4492. $core.method({
  4493. selector: "dayOfWeek:",
  4494. protocol: "accessing",
  4495. args: ["aNumber"],
  4496. source: "dayOfWeek: aNumber\x0a\x09<inlineJS: 'return self.setDay(aNumber - 1)'>",
  4497. referencedClasses: [],
  4498. pragmas: [["inlineJS:", ["return self.setDay(aNumber - 1)"]]],
  4499. messageSends: []
  4500. }, function ($methodClass){ return function (aNumber){
  4501. var self=this,$self=this;
  4502. return $core.withContext(function($ctx1) {
  4503. return self.setDay(aNumber - 1);
  4504. return self;
  4505. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber})});
  4506. }; }),
  4507. $globals.Date);
  4508. $core.addMethod(
  4509. $core.method({
  4510. selector: "hours",
  4511. protocol: "accessing",
  4512. args: [],
  4513. source: "hours\x0a\x09<inlineJS: 'return self.getHours()'>",
  4514. referencedClasses: [],
  4515. pragmas: [["inlineJS:", ["return self.getHours()"]]],
  4516. messageSends: []
  4517. }, function ($methodClass){ return function (){
  4518. var self=this,$self=this;
  4519. return $core.withContext(function($ctx1) {
  4520. return self.getHours();
  4521. return self;
  4522. }, function($ctx1) {$ctx1.fill(self,"hours",{})});
  4523. }; }),
  4524. $globals.Date);
  4525. $core.addMethod(
  4526. $core.method({
  4527. selector: "hours:",
  4528. protocol: "accessing",
  4529. args: ["aNumber"],
  4530. source: "hours: aNumber\x0a\x09<inlineJS: 'self.setHours(aNumber)'>",
  4531. referencedClasses: [],
  4532. pragmas: [["inlineJS:", ["self.setHours(aNumber)"]]],
  4533. messageSends: []
  4534. }, function ($methodClass){ return function (aNumber){
  4535. var self=this,$self=this;
  4536. return $core.withContext(function($ctx1) {
  4537. self.setHours(aNumber);
  4538. return self;
  4539. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber})});
  4540. }; }),
  4541. $globals.Date);
  4542. $core.addMethod(
  4543. $core.method({
  4544. selector: "milliseconds",
  4545. protocol: "accessing",
  4546. args: [],
  4547. source: "milliseconds\x0a\x09<inlineJS: 'return self.getMilliseconds()'>",
  4548. referencedClasses: [],
  4549. pragmas: [["inlineJS:", ["return self.getMilliseconds()"]]],
  4550. messageSends: []
  4551. }, function ($methodClass){ return function (){
  4552. var self=this,$self=this;
  4553. return $core.withContext(function($ctx1) {
  4554. return self.getMilliseconds();
  4555. return self;
  4556. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{})});
  4557. }; }),
  4558. $globals.Date);
  4559. $core.addMethod(
  4560. $core.method({
  4561. selector: "milliseconds:",
  4562. protocol: "accessing",
  4563. args: ["aNumber"],
  4564. source: "milliseconds: aNumber\x0a\x09<inlineJS: 'self.setMilliseconds(aNumber)'>",
  4565. referencedClasses: [],
  4566. pragmas: [["inlineJS:", ["self.setMilliseconds(aNumber)"]]],
  4567. messageSends: []
  4568. }, function ($methodClass){ return function (aNumber){
  4569. var self=this,$self=this;
  4570. return $core.withContext(function($ctx1) {
  4571. self.setMilliseconds(aNumber);
  4572. return self;
  4573. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber})});
  4574. }; }),
  4575. $globals.Date);
  4576. $core.addMethod(
  4577. $core.method({
  4578. selector: "minutes",
  4579. protocol: "accessing",
  4580. args: [],
  4581. source: "minutes\x0a\x09<inlineJS: 'return self.getMinutes()'>",
  4582. referencedClasses: [],
  4583. pragmas: [["inlineJS:", ["return self.getMinutes()"]]],
  4584. messageSends: []
  4585. }, function ($methodClass){ return function (){
  4586. var self=this,$self=this;
  4587. return $core.withContext(function($ctx1) {
  4588. return self.getMinutes();
  4589. return self;
  4590. }, function($ctx1) {$ctx1.fill(self,"minutes",{})});
  4591. }; }),
  4592. $globals.Date);
  4593. $core.addMethod(
  4594. $core.method({
  4595. selector: "minutes:",
  4596. protocol: "accessing",
  4597. args: ["aNumber"],
  4598. source: "minutes: aNumber\x0a\x09<inlineJS: 'self.setMinutes(aNumber)'>",
  4599. referencedClasses: [],
  4600. pragmas: [["inlineJS:", ["self.setMinutes(aNumber)"]]],
  4601. messageSends: []
  4602. }, function ($methodClass){ return function (aNumber){
  4603. var self=this,$self=this;
  4604. return $core.withContext(function($ctx1) {
  4605. self.setMinutes(aNumber);
  4606. return self;
  4607. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber})});
  4608. }; }),
  4609. $globals.Date);
  4610. $core.addMethod(
  4611. $core.method({
  4612. selector: "month",
  4613. protocol: "accessing",
  4614. args: [],
  4615. source: "month\x0a\x09<inlineJS: 'return self.getMonth() + 1'>",
  4616. referencedClasses: [],
  4617. pragmas: [["inlineJS:", ["return self.getMonth() + 1"]]],
  4618. messageSends: []
  4619. }, function ($methodClass){ return function (){
  4620. var self=this,$self=this;
  4621. return $core.withContext(function($ctx1) {
  4622. return self.getMonth() + 1;
  4623. return self;
  4624. }, function($ctx1) {$ctx1.fill(self,"month",{})});
  4625. }; }),
  4626. $globals.Date);
  4627. $core.addMethod(
  4628. $core.method({
  4629. selector: "month:",
  4630. protocol: "accessing",
  4631. args: ["aNumber"],
  4632. source: "month: aNumber\x0a\x09<inlineJS: 'self.setMonth(aNumber - 1)'>",
  4633. referencedClasses: [],
  4634. pragmas: [["inlineJS:", ["self.setMonth(aNumber - 1)"]]],
  4635. messageSends: []
  4636. }, function ($methodClass){ return function (aNumber){
  4637. var self=this,$self=this;
  4638. return $core.withContext(function($ctx1) {
  4639. self.setMonth(aNumber - 1);
  4640. return self;
  4641. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber})});
  4642. }; }),
  4643. $globals.Date);
  4644. $core.addMethod(
  4645. $core.method({
  4646. selector: "printOn:",
  4647. protocol: "printing",
  4648. args: ["aStream"],
  4649. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4650. referencedClasses: [],
  4651. pragmas: [],
  4652. messageSends: ["nextPutAll:", "asString"]
  4653. }, function ($methodClass){ return function (aStream){
  4654. var self=this,$self=this;
  4655. return $core.withContext(function($ctx1) {
  4656. $recv(aStream)._nextPutAll_($self._asString());
  4657. return self;
  4658. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  4659. }; }),
  4660. $globals.Date);
  4661. $core.addMethod(
  4662. $core.method({
  4663. selector: "seconds",
  4664. protocol: "accessing",
  4665. args: [],
  4666. source: "seconds\x0a\x09<inlineJS: 'return self.getSeconds()'>",
  4667. referencedClasses: [],
  4668. pragmas: [["inlineJS:", ["return self.getSeconds()"]]],
  4669. messageSends: []
  4670. }, function ($methodClass){ return function (){
  4671. var self=this,$self=this;
  4672. return $core.withContext(function($ctx1) {
  4673. return self.getSeconds();
  4674. return self;
  4675. }, function($ctx1) {$ctx1.fill(self,"seconds",{})});
  4676. }; }),
  4677. $globals.Date);
  4678. $core.addMethod(
  4679. $core.method({
  4680. selector: "seconds:",
  4681. protocol: "accessing",
  4682. args: ["aNumber"],
  4683. source: "seconds: aNumber\x0a\x09<inlineJS: 'self.setSeconds(aNumber)'>",
  4684. referencedClasses: [],
  4685. pragmas: [["inlineJS:", ["self.setSeconds(aNumber)"]]],
  4686. messageSends: []
  4687. }, function ($methodClass){ return function (aNumber){
  4688. var self=this,$self=this;
  4689. return $core.withContext(function($ctx1) {
  4690. self.setSeconds(aNumber);
  4691. return self;
  4692. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber})});
  4693. }; }),
  4694. $globals.Date);
  4695. $core.addMethod(
  4696. $core.method({
  4697. selector: "time",
  4698. protocol: "accessing",
  4699. args: [],
  4700. source: "time\x0a\x09<inlineJS: 'return self.getTime()'>",
  4701. referencedClasses: [],
  4702. pragmas: [["inlineJS:", ["return self.getTime()"]]],
  4703. messageSends: []
  4704. }, function ($methodClass){ return function (){
  4705. var self=this,$self=this;
  4706. return $core.withContext(function($ctx1) {
  4707. return self.getTime();
  4708. return self;
  4709. }, function($ctx1) {$ctx1.fill(self,"time",{})});
  4710. }; }),
  4711. $globals.Date);
  4712. $core.addMethod(
  4713. $core.method({
  4714. selector: "time:",
  4715. protocol: "accessing",
  4716. args: ["aNumber"],
  4717. source: "time: aNumber\x0a\x09<inlineJS: 'self.setTime(aNumber)'>",
  4718. referencedClasses: [],
  4719. pragmas: [["inlineJS:", ["self.setTime(aNumber)"]]],
  4720. messageSends: []
  4721. }, function ($methodClass){ return function (aNumber){
  4722. var self=this,$self=this;
  4723. return $core.withContext(function($ctx1) {
  4724. self.setTime(aNumber);
  4725. return self;
  4726. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber})});
  4727. }; }),
  4728. $globals.Date);
  4729. $core.addMethod(
  4730. $core.method({
  4731. selector: "year",
  4732. protocol: "accessing",
  4733. args: [],
  4734. source: "year\x0a\x09<inlineJS: 'return self.getFullYear()'>",
  4735. referencedClasses: [],
  4736. pragmas: [["inlineJS:", ["return self.getFullYear()"]]],
  4737. messageSends: []
  4738. }, function ($methodClass){ return function (){
  4739. var self=this,$self=this;
  4740. return $core.withContext(function($ctx1) {
  4741. return self.getFullYear();
  4742. return self;
  4743. }, function($ctx1) {$ctx1.fill(self,"year",{})});
  4744. }; }),
  4745. $globals.Date);
  4746. $core.addMethod(
  4747. $core.method({
  4748. selector: "year:",
  4749. protocol: "accessing",
  4750. args: ["aNumber"],
  4751. source: "year: aNumber\x0a\x09<inlineJS: 'self.setFullYear(aNumber)'>",
  4752. referencedClasses: [],
  4753. pragmas: [["inlineJS:", ["self.setFullYear(aNumber)"]]],
  4754. messageSends: []
  4755. }, function ($methodClass){ return function (aNumber){
  4756. var self=this,$self=this;
  4757. return $core.withContext(function($ctx1) {
  4758. self.setFullYear(aNumber);
  4759. return self;
  4760. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber})});
  4761. }; }),
  4762. $globals.Date);
  4763. $core.addMethod(
  4764. $core.method({
  4765. selector: "classTag",
  4766. protocol: "accessing",
  4767. args: [],
  4768. 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'",
  4769. referencedClasses: [],
  4770. pragmas: [],
  4771. messageSends: []
  4772. }, function ($methodClass){ return function (){
  4773. var self=this,$self=this;
  4774. return "magnitude";
  4775. }; }),
  4776. $globals.Date.a$cls);
  4777. $core.addMethod(
  4778. $core.method({
  4779. selector: "fromMilliseconds:",
  4780. protocol: "instance creation",
  4781. args: ["aNumber"],
  4782. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4783. referencedClasses: [],
  4784. pragmas: [],
  4785. messageSends: ["new:"]
  4786. }, function ($methodClass){ return function (aNumber){
  4787. var self=this,$self=this;
  4788. return $core.withContext(function($ctx1) {
  4789. return $self._new_(aNumber);
  4790. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber})});
  4791. }; }),
  4792. $globals.Date.a$cls);
  4793. $core.addMethod(
  4794. $core.method({
  4795. selector: "fromSeconds:",
  4796. protocol: "instance creation",
  4797. args: ["aNumber"],
  4798. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4799. referencedClasses: [],
  4800. pragmas: [],
  4801. messageSends: ["fromMilliseconds:", "*"]
  4802. }, function ($methodClass){ return function (aNumber){
  4803. var self=this,$self=this;
  4804. return $core.withContext(function($ctx1) {
  4805. return $self._fromMilliseconds_($recv(aNumber).__star((1000)));
  4806. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber})});
  4807. }; }),
  4808. $globals.Date.a$cls);
  4809. $core.addMethod(
  4810. $core.method({
  4811. selector: "fromString:",
  4812. protocol: "instance creation",
  4813. args: ["aString"],
  4814. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4815. referencedClasses: [],
  4816. pragmas: [],
  4817. messageSends: ["new:"]
  4818. }, function ($methodClass){ return function (aString){
  4819. var self=this,$self=this;
  4820. return $core.withContext(function($ctx1) {
  4821. return $self._new_(aString);
  4822. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  4823. }; }),
  4824. $globals.Date.a$cls);
  4825. $core.addMethod(
  4826. $core.method({
  4827. selector: "millisecondsToRun:",
  4828. protocol: "instance creation",
  4829. args: ["aBlock"],
  4830. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  4831. referencedClasses: ["Date"],
  4832. pragmas: [],
  4833. messageSends: ["now", "value", "-"]
  4834. }, function ($methodClass){ return function (aBlock){
  4835. var self=this,$self=this;
  4836. var t;
  4837. return $core.withContext(function($ctx1) {
  4838. t=[$recv($globals.Date)._now()
  4839. ,$ctx1.sendIdx["now"]=1
  4840. ][0];
  4841. $recv(aBlock)._value();
  4842. return $recv($recv($globals.Date)._now()).__minus(t);
  4843. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t})});
  4844. }; }),
  4845. $globals.Date.a$cls);
  4846. $core.addMethod(
  4847. $core.method({
  4848. selector: "new:",
  4849. protocol: "instance creation",
  4850. args: ["anObject"],
  4851. source: "new: anObject\x0a\x09<inlineJS: 'return new Date(anObject)'>",
  4852. referencedClasses: [],
  4853. pragmas: [["inlineJS:", ["return new Date(anObject)"]]],
  4854. messageSends: []
  4855. }, function ($methodClass){ return function (anObject){
  4856. var self=this,$self=this;
  4857. return $core.withContext(function($ctx1) {
  4858. return new Date(anObject);
  4859. return self;
  4860. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject})});
  4861. }; }),
  4862. $globals.Date.a$cls);
  4863. $core.addMethod(
  4864. $core.method({
  4865. selector: "now",
  4866. protocol: "instance creation",
  4867. args: [],
  4868. source: "now\x0a\x09^ self today",
  4869. referencedClasses: [],
  4870. pragmas: [],
  4871. messageSends: ["today"]
  4872. }, function ($methodClass){ return function (){
  4873. var self=this,$self=this;
  4874. return $core.withContext(function($ctx1) {
  4875. return $self._today();
  4876. }, function($ctx1) {$ctx1.fill(self,"now",{})});
  4877. }; }),
  4878. $globals.Date.a$cls);
  4879. $core.addMethod(
  4880. $core.method({
  4881. selector: "today",
  4882. protocol: "instance creation",
  4883. args: [],
  4884. source: "today\x0a\x09^ self new",
  4885. referencedClasses: [],
  4886. pragmas: [],
  4887. messageSends: ["new"]
  4888. }, function ($methodClass){ return function (){
  4889. var self=this,$self=this;
  4890. return $core.withContext(function($ctx1) {
  4891. return $self._new();
  4892. }, function($ctx1) {$ctx1.fill(self,"today",{})});
  4893. }; }),
  4894. $globals.Date.a$cls);
  4895. $core.addClass("Number", $globals.Object, [], "Kernel-Objects");
  4896. $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 ].";
  4897. $core.addMethod(
  4898. $core.method({
  4899. selector: "&",
  4900. protocol: "converting",
  4901. args: ["aNumber"],
  4902. source: "& aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  4903. referencedClasses: [],
  4904. pragmas: [["inlineJS:", ["return self & aNumber"]]],
  4905. messageSends: []
  4906. }, function ($methodClass){ return function (aNumber){
  4907. var self=this,$self=this;
  4908. return $core.withContext(function($ctx1) {
  4909. return self & aNumber;
  4910. return self;
  4911. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber})});
  4912. }; }),
  4913. $globals.Number);
  4914. $core.addMethod(
  4915. $core.method({
  4916. selector: "*",
  4917. protocol: "arithmetic",
  4918. args: ["aNumber"],
  4919. source: "* aNumber\x0a\x09<inlineJS: 'return self * aNumber'>",
  4920. referencedClasses: [],
  4921. pragmas: [["inlineJS:", ["return self * aNumber"]]],
  4922. messageSends: []
  4923. }, function ($methodClass){ return function (aNumber){
  4924. var self=this,$self=this;
  4925. return $core.withContext(function($ctx1) {
  4926. return self * aNumber;
  4927. return self;
  4928. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber})});
  4929. }; }),
  4930. $globals.Number);
  4931. $core.addMethod(
  4932. $core.method({
  4933. selector: "**",
  4934. protocol: "mathematical functions",
  4935. args: ["exponent"],
  4936. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4937. referencedClasses: [],
  4938. pragmas: [],
  4939. messageSends: ["raisedTo:"]
  4940. }, function ($methodClass){ return function (exponent){
  4941. var self=this,$self=this;
  4942. return $core.withContext(function($ctx1) {
  4943. return $self._raisedTo_(exponent);
  4944. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent})});
  4945. }; }),
  4946. $globals.Number);
  4947. $core.addMethod(
  4948. $core.method({
  4949. selector: "+",
  4950. protocol: "arithmetic",
  4951. args: ["aNumber"],
  4952. source: "+ aNumber\x0a\x09<inlineJS: 'return self + aNumber'>",
  4953. referencedClasses: [],
  4954. pragmas: [["inlineJS:", ["return self + aNumber"]]],
  4955. messageSends: []
  4956. }, function ($methodClass){ return function (aNumber){
  4957. var self=this,$self=this;
  4958. return $core.withContext(function($ctx1) {
  4959. return self + aNumber;
  4960. return self;
  4961. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber})});
  4962. }; }),
  4963. $globals.Number);
  4964. $core.addMethod(
  4965. $core.method({
  4966. selector: "-",
  4967. protocol: "arithmetic",
  4968. args: ["aNumber"],
  4969. source: "- aNumber\x0a\x09<inlineJS: 'return self - aNumber'>",
  4970. referencedClasses: [],
  4971. pragmas: [["inlineJS:", ["return self - aNumber"]]],
  4972. messageSends: []
  4973. }, function ($methodClass){ return function (aNumber){
  4974. var self=this,$self=this;
  4975. return $core.withContext(function($ctx1) {
  4976. return self - aNumber;
  4977. return self;
  4978. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber})});
  4979. }; }),
  4980. $globals.Number);
  4981. $core.addMethod(
  4982. $core.method({
  4983. selector: "/",
  4984. protocol: "arithmetic",
  4985. args: ["aNumber"],
  4986. source: "/ aNumber\x0a\x09<inlineJS: 'return self / aNumber'>",
  4987. referencedClasses: [],
  4988. pragmas: [["inlineJS:", ["return self / aNumber"]]],
  4989. messageSends: []
  4990. }, function ($methodClass){ return function (aNumber){
  4991. var self=this,$self=this;
  4992. return $core.withContext(function($ctx1) {
  4993. return self / aNumber;
  4994. return self;
  4995. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber})});
  4996. }; }),
  4997. $globals.Number);
  4998. $core.addMethod(
  4999. $core.method({
  5000. selector: "//",
  5001. protocol: "arithmetic",
  5002. args: ["aNumber"],
  5003. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  5004. referencedClasses: [],
  5005. pragmas: [],
  5006. messageSends: ["floor", "/"]
  5007. }, function ($methodClass){ return function (aNumber){
  5008. var self=this,$self=this;
  5009. return $core.withContext(function($ctx1) {
  5010. return $recv($self.__slash(aNumber))._floor();
  5011. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber})});
  5012. }; }),
  5013. $globals.Number);
  5014. $core.addMethod(
  5015. $core.method({
  5016. selector: "<",
  5017. protocol: "comparing",
  5018. args: ["aNumber"],
  5019. source: "< aNumber\x0a\x09<inlineJS: 'return self < aNumber'>",
  5020. referencedClasses: [],
  5021. pragmas: [["inlineJS:", ["return self < aNumber"]]],
  5022. messageSends: []
  5023. }, function ($methodClass){ return function (aNumber){
  5024. var self=this,$self=this;
  5025. return $core.withContext(function($ctx1) {
  5026. return self < aNumber;
  5027. return self;
  5028. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber})});
  5029. }; }),
  5030. $globals.Number);
  5031. $core.addMethod(
  5032. $core.method({
  5033. selector: "<=",
  5034. protocol: "comparing",
  5035. args: ["aNumber"],
  5036. source: "<= aNumber\x0a\x09<inlineJS: 'return self <= aNumber'>",
  5037. referencedClasses: [],
  5038. pragmas: [["inlineJS:", ["return self <= aNumber"]]],
  5039. messageSends: []
  5040. }, function ($methodClass){ return function (aNumber){
  5041. var self=this,$self=this;
  5042. return $core.withContext(function($ctx1) {
  5043. return self <= aNumber;
  5044. return self;
  5045. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber})});
  5046. }; }),
  5047. $globals.Number);
  5048. $core.addMethod(
  5049. $core.method({
  5050. selector: "==",
  5051. protocol: "comparing",
  5052. args: ["aNumber"],
  5053. 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'>",
  5054. referencedClasses: [],
  5055. pragmas: [["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;"]]],
  5056. messageSends: []
  5057. }, function ($methodClass){ return function (aNumber){
  5058. var self=this,$self=this;
  5059. return $core.withContext(function($ctx1) {
  5060. if (typeof aNumber === "number") return Number(self) === aNumber;
  5061. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  5062. else return false;;
  5063. return self;
  5064. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber})});
  5065. }; }),
  5066. $globals.Number);
  5067. $core.addMethod(
  5068. $core.method({
  5069. selector: ">",
  5070. protocol: "comparing",
  5071. args: ["aNumber"],
  5072. source: "> aNumber\x0a\x09<inlineJS: 'return self > aNumber'>",
  5073. referencedClasses: [],
  5074. pragmas: [["inlineJS:", ["return self > aNumber"]]],
  5075. messageSends: []
  5076. }, function ($methodClass){ return function (aNumber){
  5077. var self=this,$self=this;
  5078. return $core.withContext(function($ctx1) {
  5079. return self > aNumber;
  5080. return self;
  5081. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber})});
  5082. }; }),
  5083. $globals.Number);
  5084. $core.addMethod(
  5085. $core.method({
  5086. selector: ">=",
  5087. protocol: "comparing",
  5088. args: ["aNumber"],
  5089. source: ">= aNumber\x0a\x09<inlineJS: 'return self >= aNumber'>",
  5090. referencedClasses: [],
  5091. pragmas: [["inlineJS:", ["return self >= aNumber"]]],
  5092. messageSends: []
  5093. }, function ($methodClass){ return function (aNumber){
  5094. var self=this,$self=this;
  5095. return $core.withContext(function($ctx1) {
  5096. return self >= aNumber;
  5097. return self;
  5098. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber})});
  5099. }; }),
  5100. $globals.Number);
  5101. $core.addMethod(
  5102. $core.method({
  5103. selector: "@",
  5104. protocol: "converting",
  5105. args: ["aNumber"],
  5106. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  5107. referencedClasses: ["Point"],
  5108. pragmas: [],
  5109. messageSends: ["x:y:"]
  5110. }, function ($methodClass){ return function (aNumber){
  5111. var self=this,$self=this;
  5112. return $core.withContext(function($ctx1) {
  5113. return $recv($globals.Point)._x_y_(self,aNumber);
  5114. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber})});
  5115. }; }),
  5116. $globals.Number);
  5117. $core.addMethod(
  5118. $core.method({
  5119. selector: "\x5c\x5c",
  5120. protocol: "arithmetic",
  5121. args: ["aNumber"],
  5122. source: "\x5c\x5c aNumber\x0a\x09<inlineJS: 'return self % aNumber'>",
  5123. referencedClasses: [],
  5124. pragmas: [["inlineJS:", ["return self % aNumber"]]],
  5125. messageSends: []
  5126. }, function ($methodClass){ return function (aNumber){
  5127. var self=this,$self=this;
  5128. return $core.withContext(function($ctx1) {
  5129. return self % aNumber;
  5130. return self;
  5131. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber})});
  5132. }; }),
  5133. $globals.Number);
  5134. $core.addMethod(
  5135. $core.method({
  5136. selector: "abs",
  5137. protocol: "arithmetic",
  5138. args: [],
  5139. source: "abs\x0a\x09<inlineJS: 'return Math.abs(self);'>",
  5140. referencedClasses: [],
  5141. pragmas: [["inlineJS:", ["return Math.abs(self);"]]],
  5142. messageSends: []
  5143. }, function ($methodClass){ return function (){
  5144. var self=this,$self=this;
  5145. return $core.withContext(function($ctx1) {
  5146. return Math.abs(self);;
  5147. return self;
  5148. }, function($ctx1) {$ctx1.fill(self,"abs",{})});
  5149. }; }),
  5150. $globals.Number);
  5151. $core.addMethod(
  5152. $core.method({
  5153. selector: "arcCos",
  5154. protocol: "mathematical functions",
  5155. args: [],
  5156. source: "arcCos\x0a\x09<inlineJS: 'return Math.acos(self);'>",
  5157. referencedClasses: [],
  5158. pragmas: [["inlineJS:", ["return Math.acos(self);"]]],
  5159. messageSends: []
  5160. }, function ($methodClass){ return function (){
  5161. var self=this,$self=this;
  5162. return $core.withContext(function($ctx1) {
  5163. return Math.acos(self);;
  5164. return self;
  5165. }, function($ctx1) {$ctx1.fill(self,"arcCos",{})});
  5166. }; }),
  5167. $globals.Number);
  5168. $core.addMethod(
  5169. $core.method({
  5170. selector: "arcSin",
  5171. protocol: "mathematical functions",
  5172. args: [],
  5173. source: "arcSin\x0a\x09<inlineJS: 'return Math.asin(self);'>",
  5174. referencedClasses: [],
  5175. pragmas: [["inlineJS:", ["return Math.asin(self);"]]],
  5176. messageSends: []
  5177. }, function ($methodClass){ return function (){
  5178. var self=this,$self=this;
  5179. return $core.withContext(function($ctx1) {
  5180. return Math.asin(self);;
  5181. return self;
  5182. }, function($ctx1) {$ctx1.fill(self,"arcSin",{})});
  5183. }; }),
  5184. $globals.Number);
  5185. $core.addMethod(
  5186. $core.method({
  5187. selector: "arcTan",
  5188. protocol: "mathematical functions",
  5189. args: [],
  5190. source: "arcTan\x0a\x09<inlineJS: 'return Math.atan(self);'>",
  5191. referencedClasses: [],
  5192. pragmas: [["inlineJS:", ["return Math.atan(self);"]]],
  5193. messageSends: []
  5194. }, function ($methodClass){ return function (){
  5195. var self=this,$self=this;
  5196. return $core.withContext(function($ctx1) {
  5197. return Math.atan(self);;
  5198. return self;
  5199. }, function($ctx1) {$ctx1.fill(self,"arcTan",{})});
  5200. }; }),
  5201. $globals.Number);
  5202. $core.addMethod(
  5203. $core.method({
  5204. selector: "arcTan:",
  5205. protocol: "mathematical functions",
  5206. args: ["aNumber"],
  5207. source: "arcTan: aNumber\x0a\x09<inlineJS: 'return Math.atan2(self, aNumber);'>",
  5208. referencedClasses: [],
  5209. pragmas: [["inlineJS:", ["return Math.atan2(self, aNumber);"]]],
  5210. messageSends: []
  5211. }, function ($methodClass){ return function (aNumber){
  5212. var self=this,$self=this;
  5213. return $core.withContext(function($ctx1) {
  5214. return Math.atan2(self, aNumber);;
  5215. return self;
  5216. }, function($ctx1) {$ctx1.fill(self,"arcTan:",{aNumber:aNumber})});
  5217. }; }),
  5218. $globals.Number);
  5219. $core.addMethod(
  5220. $core.method({
  5221. selector: "asJavaScriptObject",
  5222. protocol: "converting",
  5223. args: [],
  5224. source: "asJavaScriptObject\x0a\x09^ self",
  5225. referencedClasses: [],
  5226. pragmas: [],
  5227. messageSends: []
  5228. }, function ($methodClass){ return function (){
  5229. var self=this,$self=this;
  5230. return self;
  5231. }; }),
  5232. $globals.Number);
  5233. $core.addMethod(
  5234. $core.method({
  5235. selector: "asJavaScriptSource",
  5236. protocol: "converting",
  5237. args: [],
  5238. source: "asJavaScriptSource\x0a\x09^ '(', self printString, ')'",
  5239. referencedClasses: [],
  5240. pragmas: [],
  5241. messageSends: [",", "printString"]
  5242. }, function ($methodClass){ return function (){
  5243. var self=this,$self=this;
  5244. return $core.withContext(function($ctx1) {
  5245. return [$recv("(".__comma($self._printString())).__comma(")")
  5246. ,$ctx1.sendIdx[","]=1
  5247. ][0];
  5248. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  5249. }; }),
  5250. $globals.Number);
  5251. $core.addMethod(
  5252. $core.method({
  5253. selector: "asNumber",
  5254. protocol: "converting",
  5255. args: [],
  5256. source: "asNumber\x0a\x09^ self",
  5257. referencedClasses: [],
  5258. pragmas: [],
  5259. messageSends: []
  5260. }, function ($methodClass){ return function (){
  5261. var self=this,$self=this;
  5262. return self;
  5263. }; }),
  5264. $globals.Number);
  5265. $core.addMethod(
  5266. $core.method({
  5267. selector: "asPoint",
  5268. protocol: "converting",
  5269. args: [],
  5270. source: "asPoint\x0a\x09^ Point x: self y: self",
  5271. referencedClasses: ["Point"],
  5272. pragmas: [],
  5273. messageSends: ["x:y:"]
  5274. }, function ($methodClass){ return function (){
  5275. var self=this,$self=this;
  5276. return $core.withContext(function($ctx1) {
  5277. return $recv($globals.Point)._x_y_(self,self);
  5278. }, function($ctx1) {$ctx1.fill(self,"asPoint",{})});
  5279. }; }),
  5280. $globals.Number);
  5281. $core.addMethod(
  5282. $core.method({
  5283. selector: "asString",
  5284. protocol: "converting",
  5285. args: [],
  5286. source: "asString\x0a\x09<inlineJS: 'return String(self)'>",
  5287. referencedClasses: [],
  5288. pragmas: [["inlineJS:", ["return String(self)"]]],
  5289. messageSends: []
  5290. }, function ($methodClass){ return function (){
  5291. var self=this,$self=this;
  5292. return $core.withContext(function($ctx1) {
  5293. return String(self);
  5294. return self;
  5295. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  5296. }; }),
  5297. $globals.Number);
  5298. $core.addMethod(
  5299. $core.method({
  5300. selector: "atRandom",
  5301. protocol: "converting",
  5302. args: [],
  5303. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  5304. referencedClasses: ["Random"],
  5305. pragmas: [],
  5306. messageSends: ["+", "truncated", "*", "next", "new"]
  5307. }, function ($methodClass){ return function (){
  5308. var self=this,$self=this;
  5309. return $core.withContext(function($ctx1) {
  5310. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  5311. }, function($ctx1) {$ctx1.fill(self,"atRandom",{})});
  5312. }; }),
  5313. $globals.Number);
  5314. $core.addMethod(
  5315. $core.method({
  5316. selector: "between:and:",
  5317. protocol: "testing",
  5318. args: ["min", "max"],
  5319. source: "between: min and: max\x0a ^ self >= min and: [ self <= max ]",
  5320. referencedClasses: [],
  5321. pragmas: [],
  5322. messageSends: ["and:", ">=", "<="]
  5323. }, function ($methodClass){ return function (min,max){
  5324. var self=this,$self=this;
  5325. return $core.withContext(function($ctx1) {
  5326. return $recv($self.__gt_eq(min))._and_((function(){
  5327. return $core.withContext(function($ctx2) {
  5328. return $self.__lt_eq(max);
  5329. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5330. }));
  5331. }, function($ctx1) {$ctx1.fill(self,"between:and:",{min:min,max:max})});
  5332. }; }),
  5333. $globals.Number);
  5334. $core.addMethod(
  5335. $core.method({
  5336. selector: "bitAnd:",
  5337. protocol: "converting",
  5338. args: ["aNumber"],
  5339. source: "bitAnd: aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  5340. referencedClasses: [],
  5341. pragmas: [["inlineJS:", ["return self & aNumber"]]],
  5342. messageSends: []
  5343. }, function ($methodClass){ return function (aNumber){
  5344. var self=this,$self=this;
  5345. return $core.withContext(function($ctx1) {
  5346. return self & aNumber;
  5347. return self;
  5348. }, function($ctx1) {$ctx1.fill(self,"bitAnd:",{aNumber:aNumber})});
  5349. }; }),
  5350. $globals.Number);
  5351. $core.addMethod(
  5352. $core.method({
  5353. selector: "bitNot",
  5354. protocol: "converting",
  5355. args: [],
  5356. source: "bitNot\x0a\x09<inlineJS: 'return ~self'>",
  5357. referencedClasses: [],
  5358. pragmas: [["inlineJS:", ["return ~self"]]],
  5359. messageSends: []
  5360. }, function ($methodClass){ return function (){
  5361. var self=this,$self=this;
  5362. return $core.withContext(function($ctx1) {
  5363. return ~self;
  5364. return self;
  5365. }, function($ctx1) {$ctx1.fill(self,"bitNot",{})});
  5366. }; }),
  5367. $globals.Number);
  5368. $core.addMethod(
  5369. $core.method({
  5370. selector: "bitOr:",
  5371. protocol: "converting",
  5372. args: ["aNumber"],
  5373. source: "bitOr: aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  5374. referencedClasses: [],
  5375. pragmas: [["inlineJS:", ["return self | aNumber"]]],
  5376. messageSends: []
  5377. }, function ($methodClass){ return function (aNumber){
  5378. var self=this,$self=this;
  5379. return $core.withContext(function($ctx1) {
  5380. return self | aNumber;
  5381. return self;
  5382. }, function($ctx1) {$ctx1.fill(self,"bitOr:",{aNumber:aNumber})});
  5383. }; }),
  5384. $globals.Number);
  5385. $core.addMethod(
  5386. $core.method({
  5387. selector: "bitXor:",
  5388. protocol: "converting",
  5389. args: ["aNumber"],
  5390. source: "bitXor: aNumber\x0a\x09<inlineJS: 'return self ^ aNumber'>",
  5391. referencedClasses: [],
  5392. pragmas: [["inlineJS:", ["return self ^ aNumber"]]],
  5393. messageSends: []
  5394. }, function ($methodClass){ return function (aNumber){
  5395. var self=this,$self=this;
  5396. return $core.withContext(function($ctx1) {
  5397. return self ^ aNumber;
  5398. return self;
  5399. }, function($ctx1) {$ctx1.fill(self,"bitXor:",{aNumber:aNumber})});
  5400. }; }),
  5401. $globals.Number);
  5402. $core.addMethod(
  5403. $core.method({
  5404. selector: "ceiling",
  5405. protocol: "converting",
  5406. args: [],
  5407. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  5408. referencedClasses: [],
  5409. pragmas: [["inlineJS:", ["return Math.ceil(self);"]]],
  5410. messageSends: []
  5411. }, function ($methodClass){ return function (){
  5412. var self=this,$self=this;
  5413. return $core.withContext(function($ctx1) {
  5414. return Math.ceil(self);;
  5415. return self;
  5416. }, function($ctx1) {$ctx1.fill(self,"ceiling",{})});
  5417. }; }),
  5418. $globals.Number);
  5419. $core.addMethod(
  5420. $core.method({
  5421. selector: "copy",
  5422. protocol: "copying",
  5423. args: [],
  5424. source: "copy\x0a\x09^ self",
  5425. referencedClasses: [],
  5426. pragmas: [],
  5427. messageSends: []
  5428. }, function ($methodClass){ return function (){
  5429. var self=this,$self=this;
  5430. return self;
  5431. }; }),
  5432. $globals.Number);
  5433. $core.addMethod(
  5434. $core.method({
  5435. selector: "cos",
  5436. protocol: "mathematical functions",
  5437. args: [],
  5438. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  5439. referencedClasses: [],
  5440. pragmas: [["inlineJS:", ["return Math.cos(self);"]]],
  5441. messageSends: []
  5442. }, function ($methodClass){ return function (){
  5443. var self=this,$self=this;
  5444. return $core.withContext(function($ctx1) {
  5445. return Math.cos(self);;
  5446. return self;
  5447. }, function($ctx1) {$ctx1.fill(self,"cos",{})});
  5448. }; }),
  5449. $globals.Number);
  5450. $core.addMethod(
  5451. $core.method({
  5452. selector: "deepCopy",
  5453. protocol: "copying",
  5454. args: [],
  5455. source: "deepCopy\x0a\x09^ self copy",
  5456. referencedClasses: [],
  5457. pragmas: [],
  5458. messageSends: ["copy"]
  5459. }, function ($methodClass){ return function (){
  5460. var self=this,$self=this;
  5461. return $core.withContext(function($ctx1) {
  5462. return $self._copy();
  5463. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  5464. }; }),
  5465. $globals.Number);
  5466. $core.addMethod(
  5467. $core.method({
  5468. selector: "degreesToRadians",
  5469. protocol: "converting",
  5470. args: [],
  5471. source: "degreesToRadians\x0a\x09^ self * Number radiansPerDegree",
  5472. referencedClasses: ["Number"],
  5473. pragmas: [],
  5474. messageSends: ["*", "radiansPerDegree"]
  5475. }, function ($methodClass){ return function (){
  5476. var self=this,$self=this;
  5477. return $core.withContext(function($ctx1) {
  5478. return $self.__star($recv($globals.Number)._radiansPerDegree());
  5479. }, function($ctx1) {$ctx1.fill(self,"degreesToRadians",{})});
  5480. }; }),
  5481. $globals.Number);
  5482. $core.addMethod(
  5483. $core.method({
  5484. selector: "even",
  5485. protocol: "testing",
  5486. args: [],
  5487. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  5488. referencedClasses: [],
  5489. pragmas: [],
  5490. messageSends: ["=", "\x5c\x5c"]
  5491. }, function ($methodClass){ return function (){
  5492. var self=this,$self=this;
  5493. return $core.withContext(function($ctx1) {
  5494. return (0).__eq($self.__backslash_backslash((2)));
  5495. }, function($ctx1) {$ctx1.fill(self,"even",{})});
  5496. }; }),
  5497. $globals.Number);
  5498. $core.addMethod(
  5499. $core.method({
  5500. selector: "floor",
  5501. protocol: "converting",
  5502. args: [],
  5503. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  5504. referencedClasses: [],
  5505. pragmas: [["inlineJS:", ["return Math.floor(self);"]]],
  5506. messageSends: []
  5507. }, function ($methodClass){ return function (){
  5508. var self=this,$self=this;
  5509. return $core.withContext(function($ctx1) {
  5510. return Math.floor(self);;
  5511. return self;
  5512. }, function($ctx1) {$ctx1.fill(self,"floor",{})});
  5513. }; }),
  5514. $globals.Number);
  5515. $core.addMethod(
  5516. $core.method({
  5517. selector: "isImmutable",
  5518. protocol: "testing",
  5519. args: [],
  5520. source: "isImmutable\x0a\x09^ true",
  5521. referencedClasses: [],
  5522. pragmas: [],
  5523. messageSends: []
  5524. }, function ($methodClass){ return function (){
  5525. var self=this,$self=this;
  5526. return true;
  5527. }; }),
  5528. $globals.Number);
  5529. $core.addMethod(
  5530. $core.method({
  5531. selector: "isNumber",
  5532. protocol: "testing",
  5533. args: [],
  5534. source: "isNumber\x0a\x09^ true",
  5535. referencedClasses: [],
  5536. pragmas: [],
  5537. messageSends: []
  5538. }, function ($methodClass){ return function (){
  5539. var self=this,$self=this;
  5540. return true;
  5541. }; }),
  5542. $globals.Number);
  5543. $core.addMethod(
  5544. $core.method({
  5545. selector: "isZero",
  5546. protocol: "testing",
  5547. args: [],
  5548. source: "isZero\x0a\x09^ self = 0",
  5549. referencedClasses: [],
  5550. pragmas: [],
  5551. messageSends: ["="]
  5552. }, function ($methodClass){ return function (){
  5553. var self=this,$self=this;
  5554. return $core.withContext(function($ctx1) {
  5555. return $self.__eq((0));
  5556. }, function($ctx1) {$ctx1.fill(self,"isZero",{})});
  5557. }; }),
  5558. $globals.Number);
  5559. $core.addMethod(
  5560. $core.method({
  5561. selector: "ln",
  5562. protocol: "mathematical functions",
  5563. args: [],
  5564. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  5565. referencedClasses: [],
  5566. pragmas: [["inlineJS:", ["return Math.log(self);"]]],
  5567. messageSends: []
  5568. }, function ($methodClass){ return function (){
  5569. var self=this,$self=this;
  5570. return $core.withContext(function($ctx1) {
  5571. return Math.log(self);;
  5572. return self;
  5573. }, function($ctx1) {$ctx1.fill(self,"ln",{})});
  5574. }; }),
  5575. $globals.Number);
  5576. $core.addMethod(
  5577. $core.method({
  5578. selector: "ln1p",
  5579. protocol: "mathematical functions",
  5580. args: [],
  5581. source: "ln1p\x0a\x09<inlineJS: 'return Math.log1p(self);'>",
  5582. referencedClasses: [],
  5583. pragmas: [["inlineJS:", ["return Math.log1p(self);"]]],
  5584. messageSends: []
  5585. }, function ($methodClass){ return function (){
  5586. var self=this,$self=this;
  5587. return $core.withContext(function($ctx1) {
  5588. return Math.log1p(self);;
  5589. return self;
  5590. }, function($ctx1) {$ctx1.fill(self,"ln1p",{})});
  5591. }; }),
  5592. $globals.Number);
  5593. $core.addMethod(
  5594. $core.method({
  5595. selector: "log",
  5596. protocol: "mathematical functions",
  5597. args: [],
  5598. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  5599. referencedClasses: [],
  5600. pragmas: [["inlineJS:", ["return Math.log(self) / Math.LN10;"]]],
  5601. messageSends: []
  5602. }, function ($methodClass){ return function (){
  5603. var self=this,$self=this;
  5604. return $core.withContext(function($ctx1) {
  5605. return Math.log(self) / Math.LN10;;
  5606. return self;
  5607. }, function($ctx1) {$ctx1.fill(self,"log",{})});
  5608. }; }),
  5609. $globals.Number);
  5610. $core.addMethod(
  5611. $core.method({
  5612. selector: "log:",
  5613. protocol: "mathematical functions",
  5614. args: ["aNumber"],
  5615. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  5616. referencedClasses: [],
  5617. pragmas: [["inlineJS:", ["return Math.log(self) / Math.log(aNumber);"]]],
  5618. messageSends: []
  5619. }, function ($methodClass){ return function (aNumber){
  5620. var self=this,$self=this;
  5621. return $core.withContext(function($ctx1) {
  5622. return Math.log(self) / Math.log(aNumber);;
  5623. return self;
  5624. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber})});
  5625. }; }),
  5626. $globals.Number);
  5627. $core.addMethod(
  5628. $core.method({
  5629. selector: "max:",
  5630. protocol: "arithmetic",
  5631. args: ["aNumber"],
  5632. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  5633. referencedClasses: [],
  5634. pragmas: [["inlineJS:", ["return Math.max(self, aNumber);"]]],
  5635. messageSends: []
  5636. }, function ($methodClass){ return function (aNumber){
  5637. var self=this,$self=this;
  5638. return $core.withContext(function($ctx1) {
  5639. return Math.max(self, aNumber);;
  5640. return self;
  5641. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber})});
  5642. }; }),
  5643. $globals.Number);
  5644. $core.addMethod(
  5645. $core.method({
  5646. selector: "min:",
  5647. protocol: "arithmetic",
  5648. args: ["aNumber"],
  5649. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  5650. referencedClasses: [],
  5651. pragmas: [["inlineJS:", ["return Math.min(self, aNumber);"]]],
  5652. messageSends: []
  5653. }, function ($methodClass){ return function (aNumber){
  5654. var self=this,$self=this;
  5655. return $core.withContext(function($ctx1) {
  5656. return Math.min(self, aNumber);;
  5657. return self;
  5658. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber})});
  5659. }; }),
  5660. $globals.Number);
  5661. $core.addMethod(
  5662. $core.method({
  5663. selector: "min:max:",
  5664. protocol: "arithmetic",
  5665. args: ["aMin", "aMax"],
  5666. source: "min: aMin max: aMax\x0a\x09^ (self min: aMin) max: aMax",
  5667. referencedClasses: [],
  5668. pragmas: [],
  5669. messageSends: ["max:", "min:"]
  5670. }, function ($methodClass){ return function (aMin,aMax){
  5671. var self=this,$self=this;
  5672. return $core.withContext(function($ctx1) {
  5673. return $recv($self._min_(aMin))._max_(aMax);
  5674. }, function($ctx1) {$ctx1.fill(self,"min:max:",{aMin:aMin,aMax:aMax})});
  5675. }; }),
  5676. $globals.Number);
  5677. $core.addMethod(
  5678. $core.method({
  5679. selector: "negated",
  5680. protocol: "arithmetic",
  5681. args: [],
  5682. source: "negated\x0a\x09^ 0 - self",
  5683. referencedClasses: [],
  5684. pragmas: [],
  5685. messageSends: ["-"]
  5686. }, function ($methodClass){ return function (){
  5687. var self=this,$self=this;
  5688. return $core.withContext(function($ctx1) {
  5689. return (0).__minus(self);
  5690. }, function($ctx1) {$ctx1.fill(self,"negated",{})});
  5691. }; }),
  5692. $globals.Number);
  5693. $core.addMethod(
  5694. $core.method({
  5695. selector: "negative",
  5696. protocol: "testing",
  5697. args: [],
  5698. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  5699. referencedClasses: [],
  5700. pragmas: [],
  5701. messageSends: ["<"]
  5702. }, function ($methodClass){ return function (){
  5703. var self=this,$self=this;
  5704. return $core.withContext(function($ctx1) {
  5705. return $self.__lt((0));
  5706. }, function($ctx1) {$ctx1.fill(self,"negative",{})});
  5707. }; }),
  5708. $globals.Number);
  5709. $core.addMethod(
  5710. $core.method({
  5711. selector: "odd",
  5712. protocol: "testing",
  5713. args: [],
  5714. source: "odd\x0a\x09^ self even not",
  5715. referencedClasses: [],
  5716. pragmas: [],
  5717. messageSends: ["not", "even"]
  5718. }, function ($methodClass){ return function (){
  5719. var self=this,$self=this;
  5720. return $core.withContext(function($ctx1) {
  5721. return $recv($self._even())._not();
  5722. }, function($ctx1) {$ctx1.fill(self,"odd",{})});
  5723. }; }),
  5724. $globals.Number);
  5725. $core.addMethod(
  5726. $core.method({
  5727. selector: "positive",
  5728. protocol: "testing",
  5729. args: [],
  5730. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  5731. referencedClasses: [],
  5732. pragmas: [],
  5733. messageSends: [">="]
  5734. }, function ($methodClass){ return function (){
  5735. var self=this,$self=this;
  5736. return $core.withContext(function($ctx1) {
  5737. return $self.__gt_eq((0));
  5738. }, function($ctx1) {$ctx1.fill(self,"positive",{})});
  5739. }; }),
  5740. $globals.Number);
  5741. $core.addMethod(
  5742. $core.method({
  5743. selector: "printOn:",
  5744. protocol: "printing",
  5745. args: ["aStream"],
  5746. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  5747. referencedClasses: [],
  5748. pragmas: [],
  5749. messageSends: ["nextPutAll:", "asString"]
  5750. }, function ($methodClass){ return function (aStream){
  5751. var self=this,$self=this;
  5752. return $core.withContext(function($ctx1) {
  5753. $recv(aStream)._nextPutAll_($self._asString());
  5754. return self;
  5755. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  5756. }; }),
  5757. $globals.Number);
  5758. $core.addMethod(
  5759. $core.method({
  5760. selector: "printShowingDecimalPlaces:",
  5761. protocol: "printing",
  5762. args: ["placesDesired"],
  5763. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  5764. referencedClasses: [],
  5765. pragmas: [["inlineJS:", ["return self.toFixed(placesDesired)"]]],
  5766. messageSends: []
  5767. }, function ($methodClass){ return function (placesDesired){
  5768. var self=this,$self=this;
  5769. return $core.withContext(function($ctx1) {
  5770. return self.toFixed(placesDesired);
  5771. return self;
  5772. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired})});
  5773. }; }),
  5774. $globals.Number);
  5775. $core.addMethod(
  5776. $core.method({
  5777. selector: "printStringBase:",
  5778. protocol: "converting",
  5779. args: ["aBase"],
  5780. source: "printStringBase: aBase\x0a\x09<inlineJS: 'return self.toString(aBase)'>",
  5781. referencedClasses: [],
  5782. pragmas: [["inlineJS:", ["return self.toString(aBase)"]]],
  5783. messageSends: []
  5784. }, function ($methodClass){ return function (aBase){
  5785. var self=this,$self=this;
  5786. return $core.withContext(function($ctx1) {
  5787. return self.toString(aBase);
  5788. return self;
  5789. }, function($ctx1) {$ctx1.fill(self,"printStringBase:",{aBase:aBase})});
  5790. }; }),
  5791. $globals.Number);
  5792. $core.addMethod(
  5793. $core.method({
  5794. selector: "radiansToDegrees",
  5795. protocol: "converting",
  5796. args: [],
  5797. source: "radiansToDegrees\x0a\x09^ self / Number radiansPerDegree",
  5798. referencedClasses: ["Number"],
  5799. pragmas: [],
  5800. messageSends: ["/", "radiansPerDegree"]
  5801. }, function ($methodClass){ return function (){
  5802. var self=this,$self=this;
  5803. return $core.withContext(function($ctx1) {
  5804. return $self.__slash($recv($globals.Number)._radiansPerDegree());
  5805. }, function($ctx1) {$ctx1.fill(self,"radiansToDegrees",{})});
  5806. }; }),
  5807. $globals.Number);
  5808. $core.addMethod(
  5809. $core.method({
  5810. selector: "raisedTo:",
  5811. protocol: "mathematical functions",
  5812. args: ["exponent"],
  5813. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  5814. referencedClasses: [],
  5815. pragmas: [["inlineJS:", ["return Math.pow(self, exponent);"]]],
  5816. messageSends: []
  5817. }, function ($methodClass){ return function (exponent){
  5818. var self=this,$self=this;
  5819. return $core.withContext(function($ctx1) {
  5820. return Math.pow(self, exponent);;
  5821. return self;
  5822. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent})});
  5823. }; }),
  5824. $globals.Number);
  5825. $core.addMethod(
  5826. $core.method({
  5827. selector: "rounded",
  5828. protocol: "converting",
  5829. args: [],
  5830. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  5831. referencedClasses: [],
  5832. pragmas: [["inlineJS:", ["return Math.round(self);"]]],
  5833. messageSends: []
  5834. }, function ($methodClass){ return function (){
  5835. var self=this,$self=this;
  5836. return $core.withContext(function($ctx1) {
  5837. return Math.round(self);;
  5838. return self;
  5839. }, function($ctx1) {$ctx1.fill(self,"rounded",{})});
  5840. }; }),
  5841. $globals.Number);
  5842. $core.addMethod(
  5843. $core.method({
  5844. selector: "sign",
  5845. protocol: "mathematical functions",
  5846. args: [],
  5847. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  5848. referencedClasses: [],
  5849. pragmas: [],
  5850. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  5851. }, function ($methodClass){ return function (){
  5852. var self=this,$self=this;
  5853. return $core.withContext(function($ctx1) {
  5854. if($core.assert($self._isZero())){
  5855. return (0);
  5856. }
  5857. if($core.assert($self._positive())){
  5858. return (1);
  5859. } else {
  5860. return (-1);
  5861. }
  5862. return self;
  5863. }, function($ctx1) {$ctx1.fill(self,"sign",{})});
  5864. }; }),
  5865. $globals.Number);
  5866. $core.addMethod(
  5867. $core.method({
  5868. selector: "sin",
  5869. protocol: "mathematical functions",
  5870. args: [],
  5871. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  5872. referencedClasses: [],
  5873. pragmas: [["inlineJS:", ["return Math.sin(self);"]]],
  5874. messageSends: []
  5875. }, function ($methodClass){ return function (){
  5876. var self=this,$self=this;
  5877. return $core.withContext(function($ctx1) {
  5878. return Math.sin(self);;
  5879. return self;
  5880. }, function($ctx1) {$ctx1.fill(self,"sin",{})});
  5881. }; }),
  5882. $globals.Number);
  5883. $core.addMethod(
  5884. $core.method({
  5885. selector: "sqrt",
  5886. protocol: "mathematical functions",
  5887. args: [],
  5888. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  5889. referencedClasses: [],
  5890. pragmas: [["inlineJS:", ["return Math.sqrt(self)"]]],
  5891. messageSends: []
  5892. }, function ($methodClass){ return function (){
  5893. var self=this,$self=this;
  5894. return $core.withContext(function($ctx1) {
  5895. return Math.sqrt(self);
  5896. return self;
  5897. }, function($ctx1) {$ctx1.fill(self,"sqrt",{})});
  5898. }; }),
  5899. $globals.Number);
  5900. $core.addMethod(
  5901. $core.method({
  5902. selector: "squared",
  5903. protocol: "mathematical functions",
  5904. args: [],
  5905. source: "squared\x0a\x09^ self * self",
  5906. referencedClasses: [],
  5907. pragmas: [],
  5908. messageSends: ["*"]
  5909. }, function ($methodClass){ return function (){
  5910. var self=this,$self=this;
  5911. return $core.withContext(function($ctx1) {
  5912. return $self.__star(self);
  5913. }, function($ctx1) {$ctx1.fill(self,"squared",{})});
  5914. }; }),
  5915. $globals.Number);
  5916. $core.addMethod(
  5917. $core.method({
  5918. selector: "tan",
  5919. protocol: "mathematical functions",
  5920. args: [],
  5921. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  5922. referencedClasses: [],
  5923. pragmas: [["inlineJS:", ["return Math.tan(self);"]]],
  5924. messageSends: []
  5925. }, function ($methodClass){ return function (){
  5926. var self=this,$self=this;
  5927. return $core.withContext(function($ctx1) {
  5928. return Math.tan(self);;
  5929. return self;
  5930. }, function($ctx1) {$ctx1.fill(self,"tan",{})});
  5931. }; }),
  5932. $globals.Number);
  5933. $core.addMethod(
  5934. $core.method({
  5935. selector: "timesRepeat:",
  5936. protocol: "enumerating",
  5937. args: ["aBlock"],
  5938. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  5939. referencedClasses: [],
  5940. pragmas: [],
  5941. messageSends: ["whileFalse:", ">", "value", "+"]
  5942. }, function ($methodClass){ return function (aBlock){
  5943. var self=this,$self=this;
  5944. var count;
  5945. return $core.withContext(function($ctx1) {
  5946. count=(1);
  5947. $recv((function(){
  5948. return $core.withContext(function($ctx2) {
  5949. return $recv(count).__gt(self);
  5950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5951. }))._whileFalse_((function(){
  5952. return $core.withContext(function($ctx2) {
  5953. $recv(aBlock)._value();
  5954. count=$recv(count).__plus((1));
  5955. return count;
  5956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5957. }));
  5958. return self;
  5959. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count})});
  5960. }; }),
  5961. $globals.Number);
  5962. $core.addMethod(
  5963. $core.method({
  5964. selector: "to:",
  5965. protocol: "converting",
  5966. args: ["aNumber"],
  5967. 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",
  5968. referencedClasses: ["Array"],
  5969. pragmas: [],
  5970. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  5971. }, function ($methodClass){ return function (aNumber){
  5972. var self=this,$self=this;
  5973. var array,first,last,count;
  5974. return $core.withContext(function($ctx1) {
  5975. first=[$self._truncated()
  5976. ,$ctx1.sendIdx["truncated"]=1
  5977. ][0];
  5978. last=[$recv($recv(aNumber)._truncated()).__plus((1))
  5979. ,$ctx1.sendIdx["+"]=1
  5980. ][0];
  5981. count=(1);
  5982. array=$recv($globals.Array)._new();
  5983. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  5984. return $core.withContext(function($ctx2) {
  5985. $recv(array)._at_put_(count,first);
  5986. count=[$recv(count).__plus((1))
  5987. ,$ctx2.sendIdx["+"]=2
  5988. ][0];
  5989. first=$recv(first).__plus((1));
  5990. return first;
  5991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5992. }));
  5993. return array;
  5994. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count})});
  5995. }; }),
  5996. $globals.Number);
  5997. $core.addMethod(
  5998. $core.method({
  5999. selector: "to:by:",
  6000. protocol: "converting",
  6001. args: ["stop", "step"],
  6002. 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",
  6003. referencedClasses: ["Array"],
  6004. pragmas: [],
  6005. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  6006. }, function ($methodClass){ return function (stop,step){
  6007. var self=this,$self=this;
  6008. var array,value,pos;
  6009. return $core.withContext(function($ctx1) {
  6010. value=self;
  6011. array=$recv($globals.Array)._new();
  6012. pos=(1);
  6013. if($core.assert($recv(step).__eq((0)))){
  6014. $self._error_("step must be non-zero");
  6015. }
  6016. if($core.assert($recv(step).__lt((0)))){
  6017. [$recv((function(){
  6018. return $core.withContext(function($ctx2) {
  6019. return $recv(value).__gt_eq(stop);
  6020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  6021. }))._whileTrue_((function(){
  6022. return $core.withContext(function($ctx2) {
  6023. [$recv(array)._at_put_(pos,value)
  6024. ,$ctx2.sendIdx["at:put:"]=1
  6025. ][0];
  6026. pos=[$recv(pos).__plus((1))
  6027. ,$ctx2.sendIdx["+"]=1
  6028. ][0];
  6029. value=[$recv(value).__plus(step)
  6030. ,$ctx2.sendIdx["+"]=2
  6031. ][0];
  6032. return value;
  6033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  6034. }))
  6035. ,$ctx1.sendIdx["whileTrue:"]=1
  6036. ][0];
  6037. } else {
  6038. $recv((function(){
  6039. return $core.withContext(function($ctx2) {
  6040. return $recv(value).__lt_eq(stop);
  6041. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  6042. }))._whileTrue_((function(){
  6043. return $core.withContext(function($ctx2) {
  6044. $recv(array)._at_put_(pos,value);
  6045. pos=[$recv(pos).__plus((1))
  6046. ,$ctx2.sendIdx["+"]=3
  6047. ][0];
  6048. value=$recv(value).__plus(step);
  6049. return value;
  6050. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6051. }));
  6052. }
  6053. return array;
  6054. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos})});
  6055. }; }),
  6056. $globals.Number);
  6057. $core.addMethod(
  6058. $core.method({
  6059. selector: "to:by:do:",
  6060. protocol: "enumerating",
  6061. args: ["stop", "step", "aBlock"],
  6062. 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 ]]",
  6063. referencedClasses: [],
  6064. pragmas: [],
  6065. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  6066. }, function ($methodClass){ return function (stop,step,aBlock){
  6067. var self=this,$self=this;
  6068. var value;
  6069. return $core.withContext(function($ctx1) {
  6070. value=self;
  6071. if($core.assert($recv(step).__eq((0)))){
  6072. $self._error_("step must be non-zero");
  6073. }
  6074. if($core.assert($recv(step).__lt((0)))){
  6075. [$recv((function(){
  6076. return $core.withContext(function($ctx2) {
  6077. return $recv(value).__gt_eq(stop);
  6078. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  6079. }))._whileTrue_((function(){
  6080. return $core.withContext(function($ctx2) {
  6081. [$recv(aBlock)._value_(value)
  6082. ,$ctx2.sendIdx["value:"]=1
  6083. ][0];
  6084. value=[$recv(value).__plus(step)
  6085. ,$ctx2.sendIdx["+"]=1
  6086. ][0];
  6087. return value;
  6088. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  6089. }))
  6090. ,$ctx1.sendIdx["whileTrue:"]=1
  6091. ][0];
  6092. } else {
  6093. $recv((function(){
  6094. return $core.withContext(function($ctx2) {
  6095. return $recv(value).__lt_eq(stop);
  6096. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  6097. }))._whileTrue_((function(){
  6098. return $core.withContext(function($ctx2) {
  6099. $recv(aBlock)._value_(value);
  6100. value=$recv(value).__plus(step);
  6101. return value;
  6102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6103. }));
  6104. }
  6105. return self;
  6106. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value})});
  6107. }; }),
  6108. $globals.Number);
  6109. $core.addMethod(
  6110. $core.method({
  6111. selector: "to:do:",
  6112. protocol: "enumerating",
  6113. args: ["stop", "aBlock"],
  6114. 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 ]",
  6115. referencedClasses: [],
  6116. pragmas: [],
  6117. messageSends: ["whileTrue:", "<=", "value:", "+"]
  6118. }, function ($methodClass){ return function (stop,aBlock){
  6119. var self=this,$self=this;
  6120. var nextValue;
  6121. return $core.withContext(function($ctx1) {
  6122. nextValue=self;
  6123. $recv((function(){
  6124. return $core.withContext(function($ctx2) {
  6125. return $recv(nextValue).__lt_eq(stop);
  6126. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6127. }))._whileTrue_((function(){
  6128. return $core.withContext(function($ctx2) {
  6129. $recv(aBlock)._value_(nextValue);
  6130. nextValue=$recv(nextValue).__plus((1));
  6131. return nextValue;
  6132. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6133. }));
  6134. return self;
  6135. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue})});
  6136. }; }),
  6137. $globals.Number);
  6138. $core.addMethod(
  6139. $core.method({
  6140. selector: "truncated",
  6141. protocol: "converting",
  6142. args: [],
  6143. 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'>",
  6144. referencedClasses: [],
  6145. pragmas: [["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"]]],
  6146. messageSends: []
  6147. }, function ($methodClass){ return function (){
  6148. var self=this,$self=this;
  6149. return $core.withContext(function($ctx1) {
  6150. if(self >= 0) {
  6151. return Math.floor(self);
  6152. } else {
  6153. return Math.floor(self * (-1)) * (-1);
  6154. };
  6155. ;
  6156. return self;
  6157. }, function($ctx1) {$ctx1.fill(self,"truncated",{})});
  6158. }; }),
  6159. $globals.Number);
  6160. $core.addMethod(
  6161. $core.method({
  6162. selector: "|",
  6163. protocol: "converting",
  6164. args: ["aNumber"],
  6165. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  6166. referencedClasses: [],
  6167. pragmas: [["inlineJS:", ["return self | aNumber"]]],
  6168. messageSends: []
  6169. }, function ($methodClass){ return function (aNumber){
  6170. var self=this,$self=this;
  6171. return $core.withContext(function($ctx1) {
  6172. return self | aNumber;
  6173. return self;
  6174. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber})});
  6175. }; }),
  6176. $globals.Number);
  6177. $core.addMethod(
  6178. $core.method({
  6179. selector: "classTag",
  6180. protocol: "accessing",
  6181. args: [],
  6182. 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'",
  6183. referencedClasses: [],
  6184. pragmas: [],
  6185. messageSends: []
  6186. }, function ($methodClass){ return function (){
  6187. var self=this,$self=this;
  6188. return "magnitude";
  6189. }; }),
  6190. $globals.Number.a$cls);
  6191. $core.addMethod(
  6192. $core.method({
  6193. selector: "e",
  6194. protocol: "instance creation",
  6195. args: [],
  6196. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  6197. referencedClasses: [],
  6198. pragmas: [["inlineJS:", ["return Math.E;"]]],
  6199. messageSends: []
  6200. }, function ($methodClass){ return function (){
  6201. var self=this,$self=this;
  6202. return $core.withContext(function($ctx1) {
  6203. return Math.E;;
  6204. return self;
  6205. }, function($ctx1) {$ctx1.fill(self,"e",{})});
  6206. }; }),
  6207. $globals.Number.a$cls);
  6208. $core.addMethod(
  6209. $core.method({
  6210. selector: "pi",
  6211. protocol: "instance creation",
  6212. args: [],
  6213. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  6214. referencedClasses: [],
  6215. pragmas: [["inlineJS:", ["return Math.PI"]]],
  6216. messageSends: []
  6217. }, function ($methodClass){ return function (){
  6218. var self=this,$self=this;
  6219. return $core.withContext(function($ctx1) {
  6220. return Math.PI;
  6221. return self;
  6222. }, function($ctx1) {$ctx1.fill(self,"pi",{})});
  6223. }; }),
  6224. $globals.Number.a$cls);
  6225. $core.addMethod(
  6226. $core.method({
  6227. selector: "radiansPerDegree",
  6228. protocol: "instance creation",
  6229. args: [],
  6230. source: "radiansPerDegree\x0a\x09^ (self pi) / 180",
  6231. referencedClasses: [],
  6232. pragmas: [],
  6233. messageSends: ["/", "pi"]
  6234. }, function ($methodClass){ return function (){
  6235. var self=this,$self=this;
  6236. return $core.withContext(function($ctx1) {
  6237. return $recv($self._pi()).__slash((180));
  6238. }, function($ctx1) {$ctx1.fill(self,"radiansPerDegree",{})});
  6239. }; }),
  6240. $globals.Number.a$cls);
  6241. $core.addClass("Point", $globals.Object, ["x", "y"], "Kernel-Objects");
  6242. $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";
  6243. $core.addMethod(
  6244. $core.method({
  6245. selector: "*",
  6246. protocol: "arithmetic",
  6247. args: ["aPoint"],
  6248. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  6249. referencedClasses: ["Point"],
  6250. pragmas: [],
  6251. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  6252. }, function ($methodClass){ return function (aPoint){
  6253. var self=this,$self=this;
  6254. return $core.withContext(function($ctx1) {
  6255. return $recv($globals.Point)._x_y_([$recv([$self._x()
  6256. ,$ctx1.sendIdx["x"]=1
  6257. ][0]).__star($recv([$recv(aPoint)._asPoint()
  6258. ,$ctx1.sendIdx["asPoint"]=1
  6259. ][0])._x())
  6260. ,$ctx1.sendIdx["*"]=1
  6261. ][0],$recv([$self._y()
  6262. ,$ctx1.sendIdx["y"]=1
  6263. ][0]).__star($recv($recv(aPoint)._asPoint())._y()));
  6264. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint})});
  6265. }; }),
  6266. $globals.Point);
  6267. $core.addMethod(
  6268. $core.method({
  6269. selector: "+",
  6270. protocol: "arithmetic",
  6271. args: ["aPoint"],
  6272. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  6273. referencedClasses: ["Point"],
  6274. pragmas: [],
  6275. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  6276. }, function ($methodClass){ return function (aPoint){
  6277. var self=this,$self=this;
  6278. return $core.withContext(function($ctx1) {
  6279. return $recv($globals.Point)._x_y_([$recv([$self._x()
  6280. ,$ctx1.sendIdx["x"]=1
  6281. ][0]).__plus($recv([$recv(aPoint)._asPoint()
  6282. ,$ctx1.sendIdx["asPoint"]=1
  6283. ][0])._x())
  6284. ,$ctx1.sendIdx["+"]=1
  6285. ][0],$recv([$self._y()
  6286. ,$ctx1.sendIdx["y"]=1
  6287. ][0]).__plus($recv($recv(aPoint)._asPoint())._y()));
  6288. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint})});
  6289. }; }),
  6290. $globals.Point);
  6291. $core.addMethod(
  6292. $core.method({
  6293. selector: "-",
  6294. protocol: "arithmetic",
  6295. args: ["aPoint"],
  6296. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  6297. referencedClasses: ["Point"],
  6298. pragmas: [],
  6299. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  6300. }, function ($methodClass){ return function (aPoint){
  6301. var self=this,$self=this;
  6302. return $core.withContext(function($ctx1) {
  6303. return $recv($globals.Point)._x_y_([$recv([$self._x()
  6304. ,$ctx1.sendIdx["x"]=1
  6305. ][0]).__minus($recv([$recv(aPoint)._asPoint()
  6306. ,$ctx1.sendIdx["asPoint"]=1
  6307. ][0])._x())
  6308. ,$ctx1.sendIdx["-"]=1
  6309. ][0],$recv([$self._y()
  6310. ,$ctx1.sendIdx["y"]=1
  6311. ][0]).__minus($recv($recv(aPoint)._asPoint())._y()));
  6312. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint})});
  6313. }; }),
  6314. $globals.Point);
  6315. $core.addMethod(
  6316. $core.method({
  6317. selector: "/",
  6318. protocol: "arithmetic",
  6319. args: ["aPoint"],
  6320. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  6321. referencedClasses: ["Point"],
  6322. pragmas: [],
  6323. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  6324. }, function ($methodClass){ return function (aPoint){
  6325. var self=this,$self=this;
  6326. return $core.withContext(function($ctx1) {
  6327. return $recv($globals.Point)._x_y_([$recv([$self._x()
  6328. ,$ctx1.sendIdx["x"]=1
  6329. ][0]).__slash($recv([$recv(aPoint)._asPoint()
  6330. ,$ctx1.sendIdx["asPoint"]=1
  6331. ][0])._x())
  6332. ,$ctx1.sendIdx["/"]=1
  6333. ][0],$recv([$self._y()
  6334. ,$ctx1.sendIdx["y"]=1
  6335. ][0]).__slash($recv($recv(aPoint)._asPoint())._y()));
  6336. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint})});
  6337. }; }),
  6338. $globals.Point);
  6339. $core.addMethod(
  6340. $core.method({
  6341. selector: "<",
  6342. protocol: "comparing",
  6343. args: ["aPoint"],
  6344. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  6345. referencedClasses: [],
  6346. pragmas: [],
  6347. messageSends: ["and:", "<", "x", "y"]
  6348. }, function ($methodClass){ return function (aPoint){
  6349. var self=this,$self=this;
  6350. return $core.withContext(function($ctx1) {
  6351. return $recv([$recv([$self._x()
  6352. ,$ctx1.sendIdx["x"]=1
  6353. ][0]).__lt($recv(aPoint)._x())
  6354. ,$ctx1.sendIdx["<"]=1
  6355. ][0])._and_((function(){
  6356. return $core.withContext(function($ctx2) {
  6357. return $recv([$self._y()
  6358. ,$ctx2.sendIdx["y"]=1
  6359. ][0]).__lt($recv(aPoint)._y());
  6360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6361. }));
  6362. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint})});
  6363. }; }),
  6364. $globals.Point);
  6365. $core.addMethod(
  6366. $core.method({
  6367. selector: "<=",
  6368. protocol: "comparing",
  6369. args: ["aPoint"],
  6370. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  6371. referencedClasses: [],
  6372. pragmas: [],
  6373. messageSends: ["and:", "<=", "x", "y"]
  6374. }, function ($methodClass){ return function (aPoint){
  6375. var self=this,$self=this;
  6376. return $core.withContext(function($ctx1) {
  6377. return $recv([$recv([$self._x()
  6378. ,$ctx1.sendIdx["x"]=1
  6379. ][0]).__lt_eq($recv(aPoint)._x())
  6380. ,$ctx1.sendIdx["<="]=1
  6381. ][0])._and_((function(){
  6382. return $core.withContext(function($ctx2) {
  6383. return $recv([$self._y()
  6384. ,$ctx2.sendIdx["y"]=1
  6385. ][0]).__lt_eq($recv(aPoint)._y());
  6386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6387. }));
  6388. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint})});
  6389. }; }),
  6390. $globals.Point);
  6391. $core.addMethod(
  6392. $core.method({
  6393. selector: "=",
  6394. protocol: "comparing",
  6395. args: ["aPoint"],
  6396. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  6397. referencedClasses: [],
  6398. pragmas: [],
  6399. messageSends: ["and:", "=", "class", "&", "x", "y"]
  6400. }, function ($methodClass){ return function (aPoint){
  6401. var self=this,$self=this;
  6402. return $core.withContext(function($ctx1) {
  6403. return $recv([$recv([$recv(aPoint)._class()
  6404. ,$ctx1.sendIdx["class"]=1
  6405. ][0]).__eq($self._class())
  6406. ,$ctx1.sendIdx["="]=1
  6407. ][0])._and_((function(){
  6408. return $core.withContext(function($ctx2) {
  6409. return $recv([$recv([$recv(aPoint)._x()
  6410. ,$ctx2.sendIdx["x"]=1
  6411. ][0]).__eq($self._x())
  6412. ,$ctx2.sendIdx["="]=2
  6413. ][0]).__and($recv([$recv(aPoint)._y()
  6414. ,$ctx2.sendIdx["y"]=1
  6415. ][0]).__eq($self._y()));
  6416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6417. }));
  6418. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint})});
  6419. }; }),
  6420. $globals.Point);
  6421. $core.addMethod(
  6422. $core.method({
  6423. selector: ">",
  6424. protocol: "comparing",
  6425. args: ["aPoint"],
  6426. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  6427. referencedClasses: [],
  6428. pragmas: [],
  6429. messageSends: ["and:", ">", "x", "y"]
  6430. }, function ($methodClass){ return function (aPoint){
  6431. var self=this,$self=this;
  6432. return $core.withContext(function($ctx1) {
  6433. return $recv([$recv([$self._x()
  6434. ,$ctx1.sendIdx["x"]=1
  6435. ][0]).__gt($recv(aPoint)._x())
  6436. ,$ctx1.sendIdx[">"]=1
  6437. ][0])._and_((function(){
  6438. return $core.withContext(function($ctx2) {
  6439. return $recv([$self._y()
  6440. ,$ctx2.sendIdx["y"]=1
  6441. ][0]).__gt($recv(aPoint)._y());
  6442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6443. }));
  6444. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint})});
  6445. }; }),
  6446. $globals.Point);
  6447. $core.addMethod(
  6448. $core.method({
  6449. selector: ">=",
  6450. protocol: "comparing",
  6451. args: ["aPoint"],
  6452. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  6453. referencedClasses: [],
  6454. pragmas: [],
  6455. messageSends: ["and:", ">=", "x", "y"]
  6456. }, function ($methodClass){ return function (aPoint){
  6457. var self=this,$self=this;
  6458. return $core.withContext(function($ctx1) {
  6459. return $recv([$recv([$self._x()
  6460. ,$ctx1.sendIdx["x"]=1
  6461. ][0]).__gt_eq($recv(aPoint)._x())
  6462. ,$ctx1.sendIdx[">="]=1
  6463. ][0])._and_((function(){
  6464. return $core.withContext(function($ctx2) {
  6465. return $recv([$self._y()
  6466. ,$ctx2.sendIdx["y"]=1
  6467. ][0]).__gt_eq($recv(aPoint)._y());
  6468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6469. }));
  6470. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint})});
  6471. }; }),
  6472. $globals.Point);
  6473. $core.addMethod(
  6474. $core.method({
  6475. selector: "angle",
  6476. protocol: "geometry",
  6477. args: [],
  6478. source: "angle\x0a\x09^ self y arcTan: self x",
  6479. referencedClasses: [],
  6480. pragmas: [],
  6481. messageSends: ["arcTan:", "y", "x"]
  6482. }, function ($methodClass){ return function (){
  6483. var self=this,$self=this;
  6484. return $core.withContext(function($ctx1) {
  6485. return $recv($self._y())._arcTan_($self._x());
  6486. }, function($ctx1) {$ctx1.fill(self,"angle",{})});
  6487. }; }),
  6488. $globals.Point);
  6489. $core.addMethod(
  6490. $core.method({
  6491. selector: "asPoint",
  6492. protocol: "converting",
  6493. args: [],
  6494. source: "asPoint\x0a\x09^ self",
  6495. referencedClasses: [],
  6496. pragmas: [],
  6497. messageSends: []
  6498. }, function ($methodClass){ return function (){
  6499. var self=this,$self=this;
  6500. return self;
  6501. }; }),
  6502. $globals.Point);
  6503. $core.addMethod(
  6504. $core.method({
  6505. selector: "corner:",
  6506. protocol: "rectangle creation",
  6507. args: ["aPoint"],
  6508. source: "corner: aPoint\x0a\x09^ Rectangle origin: self corner: aPoint",
  6509. referencedClasses: ["Rectangle"],
  6510. pragmas: [],
  6511. messageSends: ["origin:corner:"]
  6512. }, function ($methodClass){ return function (aPoint){
  6513. var self=this,$self=this;
  6514. return $core.withContext(function($ctx1) {
  6515. return $recv($globals.Rectangle)._origin_corner_(self,aPoint);
  6516. }, function($ctx1) {$ctx1.fill(self,"corner:",{aPoint:aPoint})});
  6517. }; }),
  6518. $globals.Point);
  6519. $core.addMethod(
  6520. $core.method({
  6521. selector: "dist:",
  6522. protocol: "transforming",
  6523. args: ["aPoint"],
  6524. 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",
  6525. referencedClasses: [],
  6526. pragmas: [],
  6527. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  6528. }, function ($methodClass){ return function (aPoint){
  6529. var self=this,$self=this;
  6530. var dx,dy;
  6531. return $core.withContext(function($ctx1) {
  6532. dx=[$recv($recv(aPoint)._x()).__minus($self.x)
  6533. ,$ctx1.sendIdx["-"]=1
  6534. ][0];
  6535. dy=$recv($recv(aPoint)._y()).__minus($self.y);
  6536. return $recv($recv([$recv(dx).__star(dx)
  6537. ,$ctx1.sendIdx["*"]=1
  6538. ][0]).__plus($recv(dy).__star(dy)))._sqrt();
  6539. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy})});
  6540. }; }),
  6541. $globals.Point);
  6542. $core.addMethod(
  6543. $core.method({
  6544. selector: "dotProduct:",
  6545. protocol: "point functions",
  6546. args: ["aPoint"],
  6547. source: "dotProduct: aPoint\x0a\x09^ (x * aPoint x) + (y * aPoint y)",
  6548. referencedClasses: [],
  6549. pragmas: [],
  6550. messageSends: ["+", "*", "x", "y"]
  6551. }, function ($methodClass){ return function (aPoint){
  6552. var self=this,$self=this;
  6553. return $core.withContext(function($ctx1) {
  6554. return $recv([$recv($self.x).__star($recv(aPoint)._x())
  6555. ,$ctx1.sendIdx["*"]=1
  6556. ][0]).__plus($recv($self.y).__star($recv(aPoint)._y()));
  6557. }, function($ctx1) {$ctx1.fill(self,"dotProduct:",{aPoint:aPoint})});
  6558. }; }),
  6559. $globals.Point);
  6560. $core.addMethod(
  6561. $core.method({
  6562. selector: "extent:",
  6563. protocol: "rectangle creation",
  6564. args: ["aPoint"],
  6565. source: "extent: aPoint\x0a\x09^ Rectangle origin: self extent: aPoint",
  6566. referencedClasses: ["Rectangle"],
  6567. pragmas: [],
  6568. messageSends: ["origin:extent:"]
  6569. }, function ($methodClass){ return function (aPoint){
  6570. var self=this,$self=this;
  6571. return $core.withContext(function($ctx1) {
  6572. return $recv($globals.Rectangle)._origin_extent_(self,aPoint);
  6573. }, function($ctx1) {$ctx1.fill(self,"extent:",{aPoint:aPoint})});
  6574. }; }),
  6575. $globals.Point);
  6576. $core.addMethod(
  6577. $core.method({
  6578. selector: "normal",
  6579. protocol: "point functions",
  6580. args: [],
  6581. source: "normal\x0a\x09\x22Answer a Point representing the unit vector rotated 90 deg clockwise. For the zero point return -1@0.\x22\x0a\x0a\x09| n d |\x0a\x09n := y negated @ x.\x0a\x09(d := (n x * n x + (n y * n y))) = 0\x0a\x09\x09 ifTrue: [ ^ -1 @0 ].\x0a\x09^ n / d sqrt",
  6582. referencedClasses: [],
  6583. pragmas: [],
  6584. messageSends: ["@", "negated", "ifTrue:", "=", "+", "*", "x", "y", "/", "sqrt"]
  6585. }, function ($methodClass){ return function (){
  6586. var self=this,$self=this;
  6587. var n,d;
  6588. return $core.withContext(function($ctx1) {
  6589. n=[$recv($recv($self.y)._negated()).__at($self.x)
  6590. ,$ctx1.sendIdx["@"]=1
  6591. ][0];
  6592. d=$recv([$recv([$recv(n)._x()
  6593. ,$ctx1.sendIdx["x"]=1
  6594. ][0]).__star($recv(n)._x())
  6595. ,$ctx1.sendIdx["*"]=1
  6596. ][0]).__plus($recv([$recv(n)._y()
  6597. ,$ctx1.sendIdx["y"]=1
  6598. ][0]).__star($recv(n)._y()));
  6599. if($core.assert($recv(d).__eq((0)))){
  6600. return (-1).__at((0));
  6601. }
  6602. return $recv(n).__slash($recv(d)._sqrt());
  6603. }, function($ctx1) {$ctx1.fill(self,"normal",{n:n,d:d})});
  6604. }; }),
  6605. $globals.Point);
  6606. $core.addMethod(
  6607. $core.method({
  6608. selector: "normalized",
  6609. protocol: "point functions",
  6610. args: [],
  6611. source: "normalized\x0a\x09| r |\x0a\x09r := self r.\x0a\x09\x0a\x09r = 0\x0a\x09\x09ifTrue: [ ^ Point x: 0 y: 0 ]\x0a\x09\x09ifFalse: [ ^ Point x: x / r y: y / r ]",
  6612. referencedClasses: ["Point"],
  6613. pragmas: [],
  6614. messageSends: ["r", "ifTrue:ifFalse:", "=", "x:y:", "/"]
  6615. }, function ($methodClass){ return function (){
  6616. var self=this,$self=this;
  6617. var r;
  6618. return $core.withContext(function($ctx1) {
  6619. r=$self._r();
  6620. if($core.assert($recv(r).__eq((0)))){
  6621. return [$recv($globals.Point)._x_y_((0),(0))
  6622. ,$ctx1.sendIdx["x:y:"]=1
  6623. ][0];
  6624. } else {
  6625. return $recv($globals.Point)._x_y_([$recv($self.x).__slash(r)
  6626. ,$ctx1.sendIdx["/"]=1
  6627. ][0],$recv($self.y).__slash(r));
  6628. }
  6629. return self;
  6630. }, function($ctx1) {$ctx1.fill(self,"normalized",{r:r})});
  6631. }; }),
  6632. $globals.Point);
  6633. $core.addMethod(
  6634. $core.method({
  6635. selector: "printOn:",
  6636. protocol: "printing",
  6637. args: ["aStream"],
  6638. 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",
  6639. referencedClasses: [],
  6640. pragmas: [],
  6641. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  6642. }, function ($methodClass){ return function (aStream){
  6643. var self=this,$self=this;
  6644. return $core.withContext(function($ctx1) {
  6645. [$recv($self.x)._printOn_(aStream)
  6646. ,$ctx1.sendIdx["printOn:"]=1
  6647. ][0];
  6648. $recv(aStream)._nextPutAll_("@");
  6649. if($core.assert($recv($recv($self.y)._notNil())._and_((function(){
  6650. return $core.withContext(function($ctx2) {
  6651. return $recv($self.y)._negative();
  6652. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6653. })))){
  6654. $recv(aStream)._space();
  6655. }
  6656. $recv($self.y)._printOn_(aStream);
  6657. return self;
  6658. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  6659. }; }),
  6660. $globals.Point);
  6661. $core.addMethod(
  6662. $core.method({
  6663. selector: "r",
  6664. protocol: "polar coordinates",
  6665. args: [],
  6666. source: "r\x0a\x09^ ((x * x) + (y * y)) sqrt",
  6667. referencedClasses: [],
  6668. pragmas: [],
  6669. messageSends: ["sqrt", "+", "*"]
  6670. }, function ($methodClass){ return function (){
  6671. var self=this,$self=this;
  6672. return $core.withContext(function($ctx1) {
  6673. return $recv($recv([$recv($self.x).__star($self.x)
  6674. ,$ctx1.sendIdx["*"]=1
  6675. ][0]).__plus($recv($self.y).__star($self.y)))._sqrt();
  6676. }, function($ctx1) {$ctx1.fill(self,"r",{})});
  6677. }; }),
  6678. $globals.Point);
  6679. $core.addMethod(
  6680. $core.method({
  6681. selector: "rectangle:",
  6682. protocol: "rectangle creation",
  6683. args: ["aPoint"],
  6684. source: "rectangle: aPoint\x0a\x09^ Rectangle point: self point: aPoint",
  6685. referencedClasses: ["Rectangle"],
  6686. pragmas: [],
  6687. messageSends: ["point:point:"]
  6688. }, function ($methodClass){ return function (aPoint){
  6689. var self=this,$self=this;
  6690. return $core.withContext(function($ctx1) {
  6691. return $recv($globals.Rectangle)._point_point_(self,aPoint);
  6692. }, function($ctx1) {$ctx1.fill(self,"rectangle:",{aPoint:aPoint})});
  6693. }; }),
  6694. $globals.Point);
  6695. $core.addMethod(
  6696. $core.method({
  6697. selector: "translateBy:",
  6698. protocol: "transforming",
  6699. args: ["delta"],
  6700. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  6701. referencedClasses: [],
  6702. pragmas: [],
  6703. messageSends: ["@", "+", "x", "y"]
  6704. }, function ($methodClass){ return function (delta){
  6705. var self=this,$self=this;
  6706. return $core.withContext(function($ctx1) {
  6707. return $recv([$recv($recv(delta)._x()).__plus($self.x)
  6708. ,$ctx1.sendIdx["+"]=1
  6709. ][0]).__at($recv($recv(delta)._y()).__plus($self.y));
  6710. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta})});
  6711. }; }),
  6712. $globals.Point);
  6713. $core.addMethod(
  6714. $core.method({
  6715. selector: "x",
  6716. protocol: "accessing",
  6717. args: [],
  6718. source: "x\x0a\x09^ x",
  6719. referencedClasses: [],
  6720. pragmas: [],
  6721. messageSends: []
  6722. }, function ($methodClass){ return function (){
  6723. var self=this,$self=this;
  6724. return $self.x;
  6725. }; }),
  6726. $globals.Point);
  6727. $core.addMethod(
  6728. $core.method({
  6729. selector: "x:",
  6730. protocol: "accessing",
  6731. args: ["aNumber"],
  6732. source: "x: aNumber\x0a\x09x := aNumber",
  6733. referencedClasses: [],
  6734. pragmas: [],
  6735. messageSends: []
  6736. }, function ($methodClass){ return function (aNumber){
  6737. var self=this,$self=this;
  6738. $self.x=aNumber;
  6739. return self;
  6740. }; }),
  6741. $globals.Point);
  6742. $core.addMethod(
  6743. $core.method({
  6744. selector: "y",
  6745. protocol: "accessing",
  6746. args: [],
  6747. source: "y\x0a\x09^ y",
  6748. referencedClasses: [],
  6749. pragmas: [],
  6750. messageSends: []
  6751. }, function ($methodClass){ return function (){
  6752. var self=this,$self=this;
  6753. return $self.y;
  6754. }; }),
  6755. $globals.Point);
  6756. $core.addMethod(
  6757. $core.method({
  6758. selector: "y:",
  6759. protocol: "accessing",
  6760. args: ["aNumber"],
  6761. source: "y: aNumber\x0a\x09y := aNumber",
  6762. referencedClasses: [],
  6763. pragmas: [],
  6764. messageSends: []
  6765. }, function ($methodClass){ return function (aNumber){
  6766. var self=this,$self=this;
  6767. $self.y=aNumber;
  6768. return self;
  6769. }; }),
  6770. $globals.Point);
  6771. $core.addMethod(
  6772. $core.method({
  6773. selector: "classTag",
  6774. protocol: "accessing",
  6775. args: [],
  6776. 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'",
  6777. referencedClasses: [],
  6778. pragmas: [],
  6779. messageSends: []
  6780. }, function ($methodClass){ return function (){
  6781. var self=this,$self=this;
  6782. return "magnitude";
  6783. }; }),
  6784. $globals.Point.a$cls);
  6785. $core.addMethod(
  6786. $core.method({
  6787. selector: "x:y:",
  6788. protocol: "instance creation",
  6789. args: ["aNumber", "anotherNumber"],
  6790. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  6791. referencedClasses: [],
  6792. pragmas: [],
  6793. messageSends: ["x:", "new", "y:", "yourself"]
  6794. }, function ($methodClass){ return function (aNumber,anotherNumber){
  6795. var self=this,$self=this;
  6796. return $core.withContext(function($ctx1) {
  6797. var $1;
  6798. $1=$self._new();
  6799. $recv($1)._x_(aNumber);
  6800. $recv($1)._y_(anotherNumber);
  6801. return $recv($1)._yourself();
  6802. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber})});
  6803. }; }),
  6804. $globals.Point.a$cls);
  6805. $core.addClass("Random", $globals.Object, [], "Kernel-Objects");
  6806. $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'`.";
  6807. $core.addMethod(
  6808. $core.method({
  6809. selector: "next",
  6810. protocol: "accessing",
  6811. args: [],
  6812. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  6813. referencedClasses: [],
  6814. pragmas: [["inlineJS:", ["return Math.random()"]]],
  6815. messageSends: []
  6816. }, function ($methodClass){ return function (){
  6817. var self=this,$self=this;
  6818. return $core.withContext(function($ctx1) {
  6819. return Math.random();
  6820. return self;
  6821. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  6822. }; }),
  6823. $globals.Random);
  6824. $core.addMethod(
  6825. $core.method({
  6826. selector: "next:",
  6827. protocol: "accessing",
  6828. args: ["anInteger"],
  6829. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  6830. referencedClasses: [],
  6831. pragmas: [],
  6832. messageSends: ["collect:", "to:", "next"]
  6833. }, function ($methodClass){ return function (anInteger){
  6834. var self=this,$self=this;
  6835. return $core.withContext(function($ctx1) {
  6836. return $recv((1)._to_(anInteger))._collect_((function(each){
  6837. return $core.withContext(function($ctx2) {
  6838. return $self._next();
  6839. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6840. }));
  6841. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger})});
  6842. }; }),
  6843. $globals.Random);
  6844. $core.addClass("Rectangle", $globals.Object, ["origin", "corner"], "Kernel-Objects");
  6845. $globals.Rectangle.comment="I represent a Rectangle defined by my two corners.\x0a\x0aThe simplest way to create an instance is using Point methods:\x0a\x0a 1@1 corner: 2@2\x0a\x0aWIll create a rectangle with 1@1 as the top left and 2@2 at the bottom right.\x0a\x0a 1@1 extent: 1@1\x0a\x0aWill create the same rectangle, defining an origin and a size instead of an origin and a corner.";
  6846. $core.addMethod(
  6847. $core.method({
  6848. selector: "=",
  6849. protocol: "testing",
  6850. args: ["aRectangle"],
  6851. source: "= aRectangle\x0a\x09^ origin = aRectangle origin and: [ corner = aRectangle corner ]",
  6852. referencedClasses: [],
  6853. pragmas: [],
  6854. messageSends: ["and:", "=", "origin", "corner"]
  6855. }, function ($methodClass){ return function (aRectangle){
  6856. var self=this,$self=this;
  6857. return $core.withContext(function($ctx1) {
  6858. return $recv([$recv($self.origin).__eq($recv(aRectangle)._origin())
  6859. ,$ctx1.sendIdx["="]=1
  6860. ][0])._and_((function(){
  6861. return $core.withContext(function($ctx2) {
  6862. return $recv($self.corner).__eq($recv(aRectangle)._corner());
  6863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6864. }));
  6865. }, function($ctx1) {$ctx1.fill(self,"=",{aRectangle:aRectangle})});
  6866. }; }),
  6867. $globals.Rectangle);
  6868. $core.addMethod(
  6869. $core.method({
  6870. selector: "containsPoint:",
  6871. protocol: "testing",
  6872. args: ["aPoint"],
  6873. source: "containsPoint: aPoint\x0a\x09^ origin <= aPoint and: [ corner >= aPoint ]",
  6874. referencedClasses: [],
  6875. pragmas: [],
  6876. messageSends: ["and:", "<=", ">="]
  6877. }, function ($methodClass){ return function (aPoint){
  6878. var self=this,$self=this;
  6879. return $core.withContext(function($ctx1) {
  6880. return $recv($recv($self.origin).__lt_eq(aPoint))._and_((function(){
  6881. return $core.withContext(function($ctx2) {
  6882. return $recv($self.corner).__gt_eq(aPoint);
  6883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6884. }));
  6885. }, function($ctx1) {$ctx1.fill(self,"containsPoint:",{aPoint:aPoint})});
  6886. }; }),
  6887. $globals.Rectangle);
  6888. $core.addMethod(
  6889. $core.method({
  6890. selector: "containsRect:",
  6891. protocol: "testing",
  6892. args: ["aRect"],
  6893. source: "containsRect: aRect\x0a\x09^ aRect origin >= origin and: [ aRect corner <= corner ]",
  6894. referencedClasses: [],
  6895. pragmas: [],
  6896. messageSends: ["and:", ">=", "origin", "<=", "corner"]
  6897. }, function ($methodClass){ return function (aRect){
  6898. var self=this,$self=this;
  6899. return $core.withContext(function($ctx1) {
  6900. return $recv($recv($recv(aRect)._origin()).__gt_eq($self.origin))._and_((function(){
  6901. return $core.withContext(function($ctx2) {
  6902. return $recv($recv(aRect)._corner()).__lt_eq($self.corner);
  6903. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6904. }));
  6905. }, function($ctx1) {$ctx1.fill(self,"containsRect:",{aRect:aRect})});
  6906. }; }),
  6907. $globals.Rectangle);
  6908. $core.addMethod(
  6909. $core.method({
  6910. selector: "corner",
  6911. protocol: "accessing",
  6912. args: [],
  6913. source: "corner\x0a\x09^ corner",
  6914. referencedClasses: [],
  6915. pragmas: [],
  6916. messageSends: []
  6917. }, function ($methodClass){ return function (){
  6918. var self=this,$self=this;
  6919. return $self.corner;
  6920. }; }),
  6921. $globals.Rectangle);
  6922. $core.addMethod(
  6923. $core.method({
  6924. selector: "origin",
  6925. protocol: "accessing",
  6926. args: [],
  6927. source: "origin\x0a\x09^ origin",
  6928. referencedClasses: [],
  6929. pragmas: [],
  6930. messageSends: []
  6931. }, function ($methodClass){ return function (){
  6932. var self=this,$self=this;
  6933. return $self.origin;
  6934. }; }),
  6935. $globals.Rectangle);
  6936. $core.addMethod(
  6937. $core.method({
  6938. selector: "printOn:",
  6939. protocol: "testing",
  6940. args: ["aStream"],
  6941. source: "printOn: aStream\x0a\x09origin printOn: aStream.\x0a\x09aStream nextPutAll: ' corner: '.\x0a\x09corner printOn: aStream.",
  6942. referencedClasses: [],
  6943. pragmas: [],
  6944. messageSends: ["printOn:", "nextPutAll:"]
  6945. }, function ($methodClass){ return function (aStream){
  6946. var self=this,$self=this;
  6947. return $core.withContext(function($ctx1) {
  6948. [$recv($self.origin)._printOn_(aStream)
  6949. ,$ctx1.sendIdx["printOn:"]=1
  6950. ][0];
  6951. $recv(aStream)._nextPutAll_(" corner: ");
  6952. $recv($self.corner)._printOn_(aStream);
  6953. return self;
  6954. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  6955. }; }),
  6956. $globals.Rectangle);
  6957. $core.addMethod(
  6958. $core.method({
  6959. selector: "setPoint:point:",
  6960. protocol: "private",
  6961. args: ["pt1", "pt2"],
  6962. source: "setPoint: pt1 point: pt2\x0a\x0a\x09origin := (pt1 x min: pt2 x)@(pt1 y min: pt2 y).\x0a\x09corner := (pt1 x max: pt2 x)@(pt1 y max: pt2 y).",
  6963. referencedClasses: [],
  6964. pragmas: [],
  6965. messageSends: ["@", "min:", "x", "y", "max:"]
  6966. }, function ($methodClass){ return function (pt1,pt2){
  6967. var self=this,$self=this;
  6968. return $core.withContext(function($ctx1) {
  6969. $self.origin=[$recv([$recv([$recv(pt1)._x()
  6970. ,$ctx1.sendIdx["x"]=1
  6971. ][0])._min_([$recv(pt2)._x()
  6972. ,$ctx1.sendIdx["x"]=2
  6973. ][0])
  6974. ,$ctx1.sendIdx["min:"]=1
  6975. ][0]).__at($recv([$recv(pt1)._y()
  6976. ,$ctx1.sendIdx["y"]=1
  6977. ][0])._min_([$recv(pt2)._y()
  6978. ,$ctx1.sendIdx["y"]=2
  6979. ][0]))
  6980. ,$ctx1.sendIdx["@"]=1
  6981. ][0];
  6982. $self.corner=$recv([$recv([$recv(pt1)._x()
  6983. ,$ctx1.sendIdx["x"]=3
  6984. ][0])._max_($recv(pt2)._x())
  6985. ,$ctx1.sendIdx["max:"]=1
  6986. ][0]).__at($recv([$recv(pt1)._y()
  6987. ,$ctx1.sendIdx["y"]=3
  6988. ][0])._max_($recv(pt2)._y()));
  6989. return self;
  6990. }, function($ctx1) {$ctx1.fill(self,"setPoint:point:",{pt1:pt1,pt2:pt2})});
  6991. }; }),
  6992. $globals.Rectangle);
  6993. $core.addMethod(
  6994. $core.method({
  6995. selector: "origin:corner:",
  6996. protocol: "instance creation",
  6997. args: ["anOrigin", "aCorner"],
  6998. source: "origin: anOrigin corner: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  6999. referencedClasses: [],
  7000. pragmas: [],
  7001. messageSends: ["setPoint:point:", "basicNew"]
  7002. }, function ($methodClass){ return function (anOrigin,aCorner){
  7003. var self=this,$self=this;
  7004. return $core.withContext(function($ctx1) {
  7005. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  7006. }, function($ctx1) {$ctx1.fill(self,"origin:corner:",{anOrigin:anOrigin,aCorner:aCorner})});
  7007. }; }),
  7008. $globals.Rectangle.a$cls);
  7009. $core.addMethod(
  7010. $core.method({
  7011. selector: "origin:extent:",
  7012. protocol: "instance creation",
  7013. args: ["anOrigin", "anExtent"],
  7014. source: "origin: anOrigin extent: anExtent\x0a\x09^ self basicNew setPoint: anOrigin point: anOrigin + anExtent.",
  7015. referencedClasses: [],
  7016. pragmas: [],
  7017. messageSends: ["setPoint:point:", "basicNew", "+"]
  7018. }, function ($methodClass){ return function (anOrigin,anExtent){
  7019. var self=this,$self=this;
  7020. return $core.withContext(function($ctx1) {
  7021. return $recv($self._basicNew())._setPoint_point_(anOrigin,$recv(anOrigin).__plus(anExtent));
  7022. }, function($ctx1) {$ctx1.fill(self,"origin:extent:",{anOrigin:anOrigin,anExtent:anExtent})});
  7023. }; }),
  7024. $globals.Rectangle.a$cls);
  7025. $core.addMethod(
  7026. $core.method({
  7027. selector: "point:point:",
  7028. protocol: "instance creation",
  7029. args: ["anOrigin", "aCorner"],
  7030. source: "point: anOrigin point: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  7031. referencedClasses: [],
  7032. pragmas: [],
  7033. messageSends: ["setPoint:point:", "basicNew"]
  7034. }, function ($methodClass){ return function (anOrigin,aCorner){
  7035. var self=this,$self=this;
  7036. return $core.withContext(function($ctx1) {
  7037. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  7038. }, function($ctx1) {$ctx1.fill(self,"point:point:",{anOrigin:anOrigin,aCorner:aCorner})});
  7039. }; }),
  7040. $globals.Rectangle.a$cls);
  7041. $core.addClass("UndefinedObject", $globals.Object, [], "Kernel-Objects");
  7042. $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`.";
  7043. $core.addMethod(
  7044. $core.method({
  7045. selector: "==",
  7046. protocol: "testing",
  7047. args: ["anObject"],
  7048. source: "== anObject\x0a\x09^ anObject isNil",
  7049. referencedClasses: [],
  7050. pragmas: [],
  7051. messageSends: ["isNil"]
  7052. }, function ($methodClass){ return function (anObject){
  7053. var self=this,$self=this;
  7054. return $core.withContext(function($ctx1) {
  7055. return $recv(anObject)._isNil();
  7056. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject})});
  7057. }; }),
  7058. $globals.UndefinedObject);
  7059. $core.addMethod(
  7060. $core.method({
  7061. selector: "asJavaScriptObject",
  7062. protocol: "converting",
  7063. args: [],
  7064. source: "asJavaScriptObject\x0a\x09^ null",
  7065. referencedClasses: [],
  7066. pragmas: [],
  7067. messageSends: []
  7068. }, function ($methodClass){ return function (){
  7069. var self=this,$self=this;
  7070. return null;
  7071. }; }),
  7072. $globals.UndefinedObject);
  7073. $core.addMethod(
  7074. $core.method({
  7075. selector: "deepCopy",
  7076. protocol: "copying",
  7077. args: [],
  7078. source: "deepCopy\x0a\x09^ self",
  7079. referencedClasses: [],
  7080. pragmas: [],
  7081. messageSends: []
  7082. }, function ($methodClass){ return function (){
  7083. var self=this,$self=this;
  7084. return self;
  7085. }; }),
  7086. $globals.UndefinedObject);
  7087. $core.addMethod(
  7088. $core.method({
  7089. selector: "identityHash",
  7090. protocol: "accessing",
  7091. args: [],
  7092. source: "identityHash\x0a\x09^ 'NIL'",
  7093. referencedClasses: [],
  7094. pragmas: [],
  7095. messageSends: []
  7096. }, function ($methodClass){ return function (){
  7097. var self=this,$self=this;
  7098. return "NIL";
  7099. }; }),
  7100. $globals.UndefinedObject);
  7101. $core.addMethod(
  7102. $core.method({
  7103. selector: "ifNil:",
  7104. protocol: "testing",
  7105. args: ["aBlock"],
  7106. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  7107. referencedClasses: [],
  7108. pragmas: [],
  7109. messageSends: ["ifNil:ifNotNil:"]
  7110. }, function ($methodClass){ return function (aBlock){
  7111. var self=this,$self=this;
  7112. return $core.withContext(function($ctx1) {
  7113. return $self._ifNil_ifNotNil_(aBlock,(function(){
  7114. }));
  7115. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock})});
  7116. }; }),
  7117. $globals.UndefinedObject);
  7118. $core.addMethod(
  7119. $core.method({
  7120. selector: "ifNil:ifNotNil:",
  7121. protocol: "testing",
  7122. args: ["aBlock", "anotherBlock"],
  7123. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  7124. referencedClasses: [],
  7125. pragmas: [],
  7126. messageSends: ["value"]
  7127. }, function ($methodClass){ return function (aBlock,anotherBlock){
  7128. var self=this,$self=this;
  7129. return $core.withContext(function($ctx1) {
  7130. return $recv(aBlock)._value();
  7131. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  7132. }; }),
  7133. $globals.UndefinedObject);
  7134. $core.addMethod(
  7135. $core.method({
  7136. selector: "ifNotNil:",
  7137. protocol: "testing",
  7138. args: ["aBlock"],
  7139. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  7140. referencedClasses: [],
  7141. pragmas: [],
  7142. messageSends: []
  7143. }, function ($methodClass){ return function (aBlock){
  7144. var self=this,$self=this;
  7145. return self;
  7146. }; }),
  7147. $globals.UndefinedObject);
  7148. $core.addMethod(
  7149. $core.method({
  7150. selector: "ifNotNil:ifNil:",
  7151. protocol: "testing",
  7152. args: ["aBlock", "anotherBlock"],
  7153. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  7154. referencedClasses: [],
  7155. pragmas: [],
  7156. messageSends: ["value"]
  7157. }, function ($methodClass){ return function (aBlock,anotherBlock){
  7158. var self=this,$self=this;
  7159. return $core.withContext(function($ctx1) {
  7160. return $recv(anotherBlock)._value();
  7161. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  7162. }; }),
  7163. $globals.UndefinedObject);
  7164. $core.addMethod(
  7165. $core.method({
  7166. selector: "isImmutable",
  7167. protocol: "testing",
  7168. args: [],
  7169. source: "isImmutable\x0a\x09^ true",
  7170. referencedClasses: [],
  7171. pragmas: [],
  7172. messageSends: []
  7173. }, function ($methodClass){ return function (){
  7174. var self=this,$self=this;
  7175. return true;
  7176. }; }),
  7177. $globals.UndefinedObject);
  7178. $core.addMethod(
  7179. $core.method({
  7180. selector: "isNil",
  7181. protocol: "testing",
  7182. args: [],
  7183. source: "isNil\x0a\x09^ true",
  7184. referencedClasses: [],
  7185. pragmas: [],
  7186. messageSends: []
  7187. }, function ($methodClass){ return function (){
  7188. var self=this,$self=this;
  7189. return true;
  7190. }; }),
  7191. $globals.UndefinedObject);
  7192. $core.addMethod(
  7193. $core.method({
  7194. selector: "notNil",
  7195. protocol: "testing",
  7196. args: [],
  7197. source: "notNil\x0a\x09^ false",
  7198. referencedClasses: [],
  7199. pragmas: [],
  7200. messageSends: []
  7201. }, function ($methodClass){ return function (){
  7202. var self=this,$self=this;
  7203. return false;
  7204. }; }),
  7205. $globals.UndefinedObject);
  7206. $core.addMethod(
  7207. $core.method({
  7208. selector: "printOn:",
  7209. protocol: "printing",
  7210. args: ["aStream"],
  7211. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  7212. referencedClasses: [],
  7213. pragmas: [],
  7214. messageSends: ["nextPutAll:"]
  7215. }, function ($methodClass){ return function (aStream){
  7216. var self=this,$self=this;
  7217. return $core.withContext(function($ctx1) {
  7218. $recv(aStream)._nextPutAll_("nil");
  7219. return self;
  7220. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7221. }; }),
  7222. $globals.UndefinedObject);
  7223. $core.addMethod(
  7224. $core.method({
  7225. selector: "shallowCopy",
  7226. protocol: "copying",
  7227. args: [],
  7228. source: "shallowCopy\x0a\x09^ self",
  7229. referencedClasses: [],
  7230. pragmas: [],
  7231. messageSends: []
  7232. }, function ($methodClass){ return function (){
  7233. var self=this,$self=this;
  7234. return self;
  7235. }; }),
  7236. $globals.UndefinedObject);
  7237. $core.addMethod(
  7238. $core.method({
  7239. selector: "value",
  7240. protocol: "evaluating",
  7241. args: [],
  7242. source: "value\x0a\x09<inlineJS: 'return null'>",
  7243. referencedClasses: [],
  7244. pragmas: [["inlineJS:", ["return null"]]],
  7245. messageSends: []
  7246. }, function ($methodClass){ return function (){
  7247. var self=this,$self=this;
  7248. return $core.withContext(function($ctx1) {
  7249. return null;
  7250. return self;
  7251. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  7252. }; }),
  7253. $globals.UndefinedObject);
  7254. $core.addMethod(
  7255. $core.method({
  7256. selector: "new",
  7257. protocol: "instance creation",
  7258. args: [],
  7259. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  7260. referencedClasses: [],
  7261. pragmas: [],
  7262. messageSends: ["error:"]
  7263. }, function ($methodClass){ return function (){
  7264. var self=this,$self=this;
  7265. return $core.withContext(function($ctx1) {
  7266. $self._error_("You cannot create new instances of UndefinedObject. Use nil");
  7267. return self;
  7268. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  7269. }; }),
  7270. $globals.UndefinedObject.a$cls);
  7271. $core.setTraitComposition([{trait: $globals.TIsInGroup}], $globals.Object);
  7272. $core.setTraitComposition([{trait: $globals.TSubclassable}], $globals.UndefinedObject);
  7273. });
  7274. define('amber/core/Kernel-Collections',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  7275. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  7276. var $pkg = $core.addPackage("Kernel-Collections");
  7277. $pkg.innerEval = function (expr) { return eval(expr); };
  7278. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  7279. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7280. $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:`";
  7281. $core.addMethod(
  7282. $core.method({
  7283. selector: "=",
  7284. protocol: "comparing",
  7285. args: ["anAssociation"],
  7286. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  7287. referencedClasses: [],
  7288. pragmas: [],
  7289. messageSends: ["and:", "=", "class", "key", "value"]
  7290. }, function ($methodClass){ return function (anAssociation){
  7291. var self=this,$self=this;
  7292. return $core.withContext(function($ctx1) {
  7293. return [$recv([$recv([$self._class()
  7294. ,$ctx1.sendIdx["class"]=1
  7295. ][0]).__eq($recv(anAssociation)._class())
  7296. ,$ctx1.sendIdx["="]=1
  7297. ][0])._and_((function(){
  7298. return $core.withContext(function($ctx2) {
  7299. return $recv([$recv([$self._key()
  7300. ,$ctx2.sendIdx["key"]=1
  7301. ][0]).__eq($recv(anAssociation)._key())
  7302. ,$ctx2.sendIdx["="]=2
  7303. ][0])._and_((function(){
  7304. return $core.withContext(function($ctx3) {
  7305. return $recv([$self._value()
  7306. ,$ctx3.sendIdx["value"]=1
  7307. ][0]).__eq($recv(anAssociation)._value());
  7308. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  7309. }));
  7310. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7311. }))
  7312. ,$ctx1.sendIdx["and:"]=1
  7313. ][0];
  7314. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation})});
  7315. }; }),
  7316. $globals.Association);
  7317. $core.addMethod(
  7318. $core.method({
  7319. selector: "key",
  7320. protocol: "accessing",
  7321. args: [],
  7322. source: "key\x0a\x09^ key",
  7323. referencedClasses: [],
  7324. pragmas: [],
  7325. messageSends: []
  7326. }, function ($methodClass){ return function (){
  7327. var self=this,$self=this;
  7328. return $self.key;
  7329. }; }),
  7330. $globals.Association);
  7331. $core.addMethod(
  7332. $core.method({
  7333. selector: "key:",
  7334. protocol: "accessing",
  7335. args: ["aKey"],
  7336. source: "key: aKey\x0a\x09key := aKey",
  7337. referencedClasses: [],
  7338. pragmas: [],
  7339. messageSends: []
  7340. }, function ($methodClass){ return function (aKey){
  7341. var self=this,$self=this;
  7342. $self.key=aKey;
  7343. return self;
  7344. }; }),
  7345. $globals.Association);
  7346. $core.addMethod(
  7347. $core.method({
  7348. selector: "printOn:",
  7349. protocol: "printing",
  7350. args: ["aStream"],
  7351. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  7352. referencedClasses: [],
  7353. pragmas: [],
  7354. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  7355. }, function ($methodClass){ return function (aStream){
  7356. var self=this,$self=this;
  7357. return $core.withContext(function($ctx1) {
  7358. [$recv($self._key())._printOn_(aStream)
  7359. ,$ctx1.sendIdx["printOn:"]=1
  7360. ][0];
  7361. $recv(aStream)._nextPutAll_(" -> ");
  7362. $recv($self._value())._printOn_(aStream);
  7363. return self;
  7364. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7365. }; }),
  7366. $globals.Association);
  7367. $core.addMethod(
  7368. $core.method({
  7369. selector: "value",
  7370. protocol: "accessing",
  7371. args: [],
  7372. source: "value\x0a\x09^ value",
  7373. referencedClasses: [],
  7374. pragmas: [],
  7375. messageSends: []
  7376. }, function ($methodClass){ return function (){
  7377. var self=this,$self=this;
  7378. return $self.value;
  7379. }; }),
  7380. $globals.Association);
  7381. $core.addMethod(
  7382. $core.method({
  7383. selector: "value:",
  7384. protocol: "accessing",
  7385. args: ["aValue"],
  7386. source: "value: aValue\x0a\x09value := aValue",
  7387. referencedClasses: [],
  7388. pragmas: [],
  7389. messageSends: []
  7390. }, function ($methodClass){ return function (aValue){
  7391. var self=this,$self=this;
  7392. $self.value=aValue;
  7393. return self;
  7394. }; }),
  7395. $globals.Association);
  7396. $core.addMethod(
  7397. $core.method({
  7398. selector: "key:value:",
  7399. protocol: "instance creation",
  7400. args: ["aKey", "aValue"],
  7401. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  7402. referencedClasses: [],
  7403. pragmas: [],
  7404. messageSends: ["key:", "new", "value:", "yourself"]
  7405. }, function ($methodClass){ return function (aKey,aValue){
  7406. var self=this,$self=this;
  7407. return $core.withContext(function($ctx1) {
  7408. var $1;
  7409. $1=$self._new();
  7410. $recv($1)._key_(aKey);
  7411. $recv($1)._value_(aValue);
  7412. return $recv($1)._yourself();
  7413. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue})});
  7414. }; }),
  7415. $globals.Association.a$cls);
  7416. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  7417. $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`.";
  7418. $core.addMethod(
  7419. $core.method({
  7420. selector: "bucketOfElement:",
  7421. protocol: "accessing",
  7422. args: ["anObject"],
  7423. 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'>",
  7424. referencedClasses: [],
  7425. pragmas: [["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"]]],
  7426. messageSends: []
  7427. }, function ($methodClass){ return function (anObject){
  7428. var self=this,$self=this;
  7429. return $core.withContext(function($ctx1) {
  7430. var hash = $self.hashBlock(anObject);
  7431. if (!hash) return null;
  7432. var buckets = $self.buckets,
  7433. bucket = buckets[hash];
  7434. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  7435. return bucket;
  7436. ;
  7437. return self;
  7438. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject})});
  7439. }; }),
  7440. $globals.BucketStore);
  7441. $core.addMethod(
  7442. $core.method({
  7443. selector: "do:",
  7444. protocol: "enumerating",
  7445. args: ["aBlock"],
  7446. 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'>",
  7447. referencedClasses: [],
  7448. pragmas: [["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"]]],
  7449. messageSends: []
  7450. }, function ($methodClass){ return function (aBlock){
  7451. var self=this,$self=this;
  7452. return $core.withContext(function($ctx1) {
  7453. var buckets = $self.buckets;
  7454. var keys = Object.keys(buckets);
  7455. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  7456. ;
  7457. return self;
  7458. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7459. }; }),
  7460. $globals.BucketStore);
  7461. $core.addMethod(
  7462. $core.method({
  7463. selector: "hashBlock:",
  7464. protocol: "accessing",
  7465. args: ["aBlock"],
  7466. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  7467. referencedClasses: [],
  7468. pragmas: [],
  7469. messageSends: []
  7470. }, function ($methodClass){ return function (aBlock){
  7471. var self=this,$self=this;
  7472. $self.hashBlock=aBlock;
  7473. return self;
  7474. }; }),
  7475. $globals.BucketStore);
  7476. $core.addMethod(
  7477. $core.method({
  7478. selector: "initialize",
  7479. protocol: "initialization",
  7480. args: [],
  7481. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  7482. referencedClasses: [],
  7483. pragmas: [],
  7484. messageSends: ["initialize", "removeAll"]
  7485. }, function ($methodClass){ return function (){
  7486. var self=this,$self=this;
  7487. return $core.withContext(function($ctx1) {
  7488. [(
  7489. $ctx1.supercall = true,
  7490. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  7491. ,$ctx1.supercall = false
  7492. ][0];
  7493. $self._removeAll();
  7494. return self;
  7495. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  7496. }; }),
  7497. $globals.BucketStore);
  7498. $core.addMethod(
  7499. $core.method({
  7500. selector: "newBucket",
  7501. protocol: "private",
  7502. args: [],
  7503. source: "newBucket\x0a\x09self subclassResponsibility",
  7504. referencedClasses: [],
  7505. pragmas: [],
  7506. messageSends: ["subclassResponsibility"]
  7507. }, function ($methodClass){ return function (){
  7508. var self=this,$self=this;
  7509. return $core.withContext(function($ctx1) {
  7510. $self._subclassResponsibility();
  7511. return self;
  7512. }, function($ctx1) {$ctx1.fill(self,"newBucket",{})});
  7513. }; }),
  7514. $globals.BucketStore);
  7515. $core.addMethod(
  7516. $core.method({
  7517. selector: "removeAll",
  7518. protocol: "adding/removing",
  7519. args: [],
  7520. source: "removeAll\x0a\x09<inlineJS: '$self.buckets = Object.create(null);'>",
  7521. referencedClasses: [],
  7522. pragmas: [["inlineJS:", ["$self.buckets = Object.create(null);"]]],
  7523. messageSends: []
  7524. }, function ($methodClass){ return function (){
  7525. var self=this,$self=this;
  7526. return $core.withContext(function($ctx1) {
  7527. $self.buckets = Object.create(null);;
  7528. return self;
  7529. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  7530. }; }),
  7531. $globals.BucketStore);
  7532. $core.addMethod(
  7533. $core.method({
  7534. selector: "hashBlock:",
  7535. protocol: "instance creation",
  7536. args: ["aBlock"],
  7537. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  7538. referencedClasses: [],
  7539. pragmas: [],
  7540. messageSends: ["hashBlock:", "new", "yourself"]
  7541. }, function ($methodClass){ return function (aBlock){
  7542. var self=this,$self=this;
  7543. return $core.withContext(function($ctx1) {
  7544. var $1;
  7545. $1=$self._new();
  7546. $recv($1)._hashBlock_(aBlock);
  7547. return $recv($1)._yourself();
  7548. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock})});
  7549. }; }),
  7550. $globals.BucketStore.a$cls);
  7551. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  7552. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  7553. $core.addMethod(
  7554. $core.method({
  7555. selector: "newBucket",
  7556. protocol: "private",
  7557. args: [],
  7558. source: "newBucket\x0a\x09^ #()",
  7559. referencedClasses: [],
  7560. pragmas: [],
  7561. messageSends: []
  7562. }, function ($methodClass){ return function (){
  7563. var self=this,$self=this;
  7564. return [];
  7565. }; }),
  7566. $globals.ArrayBucketStore);
  7567. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  7568. $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.";
  7569. $core.addMethod(
  7570. $core.method({
  7571. selector: ",",
  7572. protocol: "copying",
  7573. args: ["aCollection"],
  7574. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  7575. referencedClasses: [],
  7576. pragmas: [],
  7577. messageSends: ["addAll:", "copy", "yourself"]
  7578. }, function ($methodClass){ return function (aCollection){
  7579. var self=this,$self=this;
  7580. return $core.withContext(function($ctx1) {
  7581. var $1;
  7582. $1=$self._copy();
  7583. $recv($1)._addAll_(aCollection);
  7584. return $recv($1)._yourself();
  7585. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection})});
  7586. }; }),
  7587. $globals.Collection);
  7588. $core.addMethod(
  7589. $core.method({
  7590. selector: "add:",
  7591. protocol: "adding/removing",
  7592. args: ["anObject"],
  7593. source: "add: anObject\x0a\x09self subclassResponsibility",
  7594. referencedClasses: [],
  7595. pragmas: [],
  7596. messageSends: ["subclassResponsibility"]
  7597. }, function ($methodClass){ return function (anObject){
  7598. var self=this,$self=this;
  7599. return $core.withContext(function($ctx1) {
  7600. $self._subclassResponsibility();
  7601. return self;
  7602. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  7603. }; }),
  7604. $globals.Collection);
  7605. $core.addMethod(
  7606. $core.method({
  7607. selector: "addAll:",
  7608. protocol: "adding/removing",
  7609. args: ["aCollection"],
  7610. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  7611. referencedClasses: [],
  7612. pragmas: [],
  7613. messageSends: ["do:", "add:"]
  7614. }, function ($methodClass){ return function (aCollection){
  7615. var self=this,$self=this;
  7616. return $core.withContext(function($ctx1) {
  7617. $recv(aCollection)._do_((function(each){
  7618. return $core.withContext(function($ctx2) {
  7619. return $self._add_(each);
  7620. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7621. }));
  7622. return aCollection;
  7623. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  7624. }; }),
  7625. $globals.Collection);
  7626. $core.addMethod(
  7627. $core.method({
  7628. selector: "allSatisfy:",
  7629. protocol: "enumerating",
  7630. args: ["aBlock"],
  7631. 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",
  7632. referencedClasses: [],
  7633. pragmas: [],
  7634. messageSends: ["do:", "ifFalse:", "value:"]
  7635. }, function ($methodClass){ return function (aBlock){
  7636. var self=this,$self=this;
  7637. return $core.withContext(function($ctx1) {
  7638. var $early={};
  7639. try {
  7640. $self._do_((function(each){
  7641. return $core.withContext(function($ctx2) {
  7642. if(!$core.assert($recv(aBlock)._value_(each))){
  7643. throw $early=[false];
  7644. }
  7645. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7646. }));
  7647. return true;
  7648. }
  7649. catch(e) {if(e===$early)return e[0]; throw e}
  7650. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock})});
  7651. }; }),
  7652. $globals.Collection);
  7653. $core.addMethod(
  7654. $core.method({
  7655. selector: "anyOne",
  7656. protocol: "accessing",
  7657. args: [],
  7658. 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 ]",
  7659. referencedClasses: [],
  7660. pragmas: [],
  7661. messageSends: ["ifEmpty:", "error:", "do:"]
  7662. }, function ($methodClass){ return function (){
  7663. var self=this,$self=this;
  7664. return $core.withContext(function($ctx1) {
  7665. var $early={};
  7666. try {
  7667. $self._ifEmpty_((function(){
  7668. return $core.withContext(function($ctx2) {
  7669. return $self._error_("Collection is empty");
  7670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7671. }));
  7672. $self._do_((function(each){
  7673. throw $early=[each];
  7674. }));
  7675. return self;
  7676. }
  7677. catch(e) {if(e===$early)return e[0]; throw e}
  7678. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  7679. }; }),
  7680. $globals.Collection);
  7681. $core.addMethod(
  7682. $core.method({
  7683. selector: "anySatisfy:",
  7684. protocol: "enumerating",
  7685. args: ["aBlock"],
  7686. 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",
  7687. referencedClasses: [],
  7688. pragmas: [],
  7689. messageSends: ["do:", "ifTrue:", "value:"]
  7690. }, function ($methodClass){ return function (aBlock){
  7691. var self=this,$self=this;
  7692. return $core.withContext(function($ctx1) {
  7693. var $early={};
  7694. try {
  7695. $self._do_((function(each){
  7696. return $core.withContext(function($ctx2) {
  7697. if($core.assert($recv(aBlock)._value_(each))){
  7698. throw $early=[true];
  7699. }
  7700. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7701. }));
  7702. return false;
  7703. }
  7704. catch(e) {if(e===$early)return e[0]; throw e}
  7705. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock})});
  7706. }; }),
  7707. $globals.Collection);
  7708. $core.addMethod(
  7709. $core.method({
  7710. selector: "asArray",
  7711. protocol: "converting",
  7712. args: [],
  7713. source: "asArray\x0a\x09^ Array withAll: self",
  7714. referencedClasses: ["Array"],
  7715. pragmas: [],
  7716. messageSends: ["withAll:"]
  7717. }, function ($methodClass){ return function (){
  7718. var self=this,$self=this;
  7719. return $core.withContext(function($ctx1) {
  7720. return $recv($globals.Array)._withAll_(self);
  7721. }, function($ctx1) {$ctx1.fill(self,"asArray",{})});
  7722. }; }),
  7723. $globals.Collection);
  7724. $core.addMethod(
  7725. $core.method({
  7726. selector: "asJavaScriptObject",
  7727. protocol: "converting",
  7728. args: [],
  7729. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  7730. referencedClasses: [],
  7731. pragmas: [],
  7732. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  7733. }, function ($methodClass){ return function (){
  7734. var self=this,$self=this;
  7735. return $core.withContext(function($ctx1) {
  7736. return $recv($self._asArray())._collect_((function(each){
  7737. return $core.withContext(function($ctx2) {
  7738. return $recv(each)._asJavaScriptObject();
  7739. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7740. }));
  7741. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  7742. }; }),
  7743. $globals.Collection);
  7744. $core.addMethod(
  7745. $core.method({
  7746. selector: "asOrderedCollection",
  7747. protocol: "converting",
  7748. args: [],
  7749. source: "asOrderedCollection\x0a\x09^ self asArray",
  7750. referencedClasses: [],
  7751. pragmas: [],
  7752. messageSends: ["asArray"]
  7753. }, function ($methodClass){ return function (){
  7754. var self=this,$self=this;
  7755. return $core.withContext(function($ctx1) {
  7756. return $self._asArray();
  7757. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{})});
  7758. }; }),
  7759. $globals.Collection);
  7760. $core.addMethod(
  7761. $core.method({
  7762. selector: "asSet",
  7763. protocol: "converting",
  7764. args: [],
  7765. source: "asSet\x0a\x09^ Set withAll: self",
  7766. referencedClasses: ["Set"],
  7767. pragmas: [],
  7768. messageSends: ["withAll:"]
  7769. }, function ($methodClass){ return function (){
  7770. var self=this,$self=this;
  7771. return $core.withContext(function($ctx1) {
  7772. return $recv($globals.Set)._withAll_(self);
  7773. }, function($ctx1) {$ctx1.fill(self,"asSet",{})});
  7774. }; }),
  7775. $globals.Collection);
  7776. $core.addMethod(
  7777. $core.method({
  7778. selector: "collect:",
  7779. protocol: "enumerating",
  7780. args: ["aBlock"],
  7781. 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",
  7782. referencedClasses: [],
  7783. pragmas: [],
  7784. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  7785. }, function ($methodClass){ return function (aBlock){
  7786. var self=this,$self=this;
  7787. var stream;
  7788. return $core.withContext(function($ctx1) {
  7789. stream=$recv($recv($self._class())._new())._writeStream();
  7790. $self._do_((function(each){
  7791. return $core.withContext(function($ctx2) {
  7792. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  7793. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7794. }));
  7795. return $recv(stream)._contents();
  7796. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream})});
  7797. }; }),
  7798. $globals.Collection);
  7799. $core.addMethod(
  7800. $core.method({
  7801. selector: "copyEmpty",
  7802. protocol: "copying",
  7803. args: [],
  7804. source: "copyEmpty\x0a\x09^ self class new",
  7805. referencedClasses: [],
  7806. pragmas: [],
  7807. messageSends: ["new", "class"]
  7808. }, function ($methodClass){ return function (){
  7809. var self=this,$self=this;
  7810. return $core.withContext(function($ctx1) {
  7811. return $recv($self._class())._new();
  7812. }, function($ctx1) {$ctx1.fill(self,"copyEmpty",{})});
  7813. }; }),
  7814. $globals.Collection);
  7815. $core.addMethod(
  7816. $core.method({
  7817. selector: "copyWith:",
  7818. protocol: "copying",
  7819. args: ["anObject"],
  7820. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  7821. referencedClasses: [],
  7822. pragmas: [],
  7823. messageSends: ["add:", "copy", "yourself"]
  7824. }, function ($methodClass){ return function (anObject){
  7825. var self=this,$self=this;
  7826. return $core.withContext(function($ctx1) {
  7827. var $1;
  7828. $1=$self._copy();
  7829. $recv($1)._add_(anObject);
  7830. return $recv($1)._yourself();
  7831. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject})});
  7832. }; }),
  7833. $globals.Collection);
  7834. $core.addMethod(
  7835. $core.method({
  7836. selector: "copyWithAll:",
  7837. protocol: "copying",
  7838. args: ["aCollection"],
  7839. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  7840. referencedClasses: [],
  7841. pragmas: [],
  7842. messageSends: ["deprecatedAPI:", ","]
  7843. }, function ($methodClass){ return function (aCollection){
  7844. var self=this,$self=this;
  7845. return $core.withContext(function($ctx1) {
  7846. $self._deprecatedAPI_("Use #, instead.");
  7847. return $self.__comma(aCollection);
  7848. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection})});
  7849. }; }),
  7850. $globals.Collection);
  7851. $core.addMethod(
  7852. $core.method({
  7853. selector: "copyWithout:",
  7854. protocol: "copying",
  7855. args: ["anObject"],
  7856. 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 ]",
  7857. referencedClasses: [],
  7858. pragmas: [],
  7859. messageSends: ["reject:", "="]
  7860. }, function ($methodClass){ return function (anObject){
  7861. var self=this,$self=this;
  7862. return $core.withContext(function($ctx1) {
  7863. return $self._reject_((function(each){
  7864. return $core.withContext(function($ctx2) {
  7865. return $recv(each).__eq(anObject);
  7866. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7867. }));
  7868. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject})});
  7869. }; }),
  7870. $globals.Collection);
  7871. $core.addMethod(
  7872. $core.method({
  7873. selector: "copyWithoutAll:",
  7874. protocol: "copying",
  7875. args: ["aCollection"],
  7876. 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 ]",
  7877. referencedClasses: [],
  7878. pragmas: [],
  7879. messageSends: ["reject:", "includes:"]
  7880. }, function ($methodClass){ return function (aCollection){
  7881. var self=this,$self=this;
  7882. return $core.withContext(function($ctx1) {
  7883. return $self._reject_((function(each){
  7884. return $core.withContext(function($ctx2) {
  7885. return $recv(aCollection)._includes_(each);
  7886. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7887. }));
  7888. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection})});
  7889. }; }),
  7890. $globals.Collection);
  7891. $core.addMethod(
  7892. $core.method({
  7893. selector: "deepCopy",
  7894. protocol: "copying",
  7895. args: [],
  7896. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  7897. referencedClasses: [],
  7898. pragmas: [],
  7899. messageSends: ["collect:", "deepCopy"]
  7900. }, function ($methodClass){ return function (){
  7901. var self=this,$self=this;
  7902. return $core.withContext(function($ctx1) {
  7903. return $self._collect_((function(each){
  7904. return $core.withContext(function($ctx2) {
  7905. return $recv(each)._deepCopy();
  7906. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7907. }));
  7908. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  7909. }; }),
  7910. $globals.Collection);
  7911. $core.addMethod(
  7912. $core.method({
  7913. selector: "detect:",
  7914. protocol: "enumerating",
  7915. args: ["aBlock"],
  7916. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  7917. referencedClasses: [],
  7918. pragmas: [],
  7919. messageSends: ["detect:ifNone:", "errorNotFound"]
  7920. }, function ($methodClass){ return function (aBlock){
  7921. var self=this,$self=this;
  7922. return $core.withContext(function($ctx1) {
  7923. return $self._detect_ifNone_(aBlock,(function(){
  7924. return $core.withContext(function($ctx2) {
  7925. return $self._errorNotFound();
  7926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7927. }));
  7928. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock})});
  7929. }; }),
  7930. $globals.Collection);
  7931. $core.addMethod(
  7932. $core.method({
  7933. selector: "detect:ifNone:",
  7934. protocol: "enumerating",
  7935. args: ["aBlock", "anotherBlock"],
  7936. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  7937. referencedClasses: [],
  7938. pragmas: [],
  7939. messageSends: ["do:", "ifTrue:", "value:", "value"]
  7940. }, function ($methodClass){ return function (aBlock,anotherBlock){
  7941. var self=this,$self=this;
  7942. return $core.withContext(function($ctx1) {
  7943. var $early={};
  7944. try {
  7945. $self._do_((function(each){
  7946. return $core.withContext(function($ctx2) {
  7947. if($core.assert($recv(aBlock)._value_(each))){
  7948. throw $early=[each];
  7949. }
  7950. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7951. }));
  7952. return $recv(anotherBlock)._value();
  7953. }
  7954. catch(e) {if(e===$early)return e[0]; throw e}
  7955. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  7956. }; }),
  7957. $globals.Collection);
  7958. $core.addMethod(
  7959. $core.method({
  7960. selector: "do:",
  7961. protocol: "enumerating",
  7962. args: ["aBlock"],
  7963. source: "do: aBlock\x0a\x09self subclassResponsibility",
  7964. referencedClasses: [],
  7965. pragmas: [],
  7966. messageSends: ["subclassResponsibility"]
  7967. }, function ($methodClass){ return function (aBlock){
  7968. var self=this,$self=this;
  7969. return $core.withContext(function($ctx1) {
  7970. $self._subclassResponsibility();
  7971. return self;
  7972. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7973. }; }),
  7974. $globals.Collection);
  7975. $core.addMethod(
  7976. $core.method({
  7977. selector: "do:separatedBy:",
  7978. protocol: "enumerating",
  7979. args: ["aBlock", "anotherBlock"],
  7980. 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 ]",
  7981. referencedClasses: [],
  7982. pragmas: [],
  7983. messageSends: ["do:", "value", "value:"]
  7984. }, function ($methodClass){ return function (aBlock,anotherBlock){
  7985. var self=this,$self=this;
  7986. var actionBeforeElement;
  7987. return $core.withContext(function($ctx1) {
  7988. actionBeforeElement=(function(){
  7989. actionBeforeElement=anotherBlock;
  7990. return actionBeforeElement;
  7991. });
  7992. $self._do_((function(each){
  7993. return $core.withContext(function($ctx2) {
  7994. $recv(actionBeforeElement)._value();
  7995. return $recv(aBlock)._value_(each);
  7996. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7997. }));
  7998. return self;
  7999. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement})});
  8000. }; }),
  8001. $globals.Collection);
  8002. $core.addMethod(
  8003. $core.method({
  8004. selector: "errorNotFound",
  8005. protocol: "error handling",
  8006. args: [],
  8007. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  8008. referencedClasses: [],
  8009. pragmas: [],
  8010. messageSends: ["error:"]
  8011. }, function ($methodClass){ return function (){
  8012. var self=this,$self=this;
  8013. return $core.withContext(function($ctx1) {
  8014. $self._error_("Object is not in the collection");
  8015. return self;
  8016. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{})});
  8017. }; }),
  8018. $globals.Collection);
  8019. $core.addMethod(
  8020. $core.method({
  8021. selector: "ifEmpty:",
  8022. protocol: "testing",
  8023. args: ["aBlock"],
  8024. 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 ]",
  8025. referencedClasses: [],
  8026. pragmas: [],
  8027. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  8028. }, function ($methodClass){ return function (aBlock){
  8029. var self=this,$self=this;
  8030. return $core.withContext(function($ctx1) {
  8031. if($core.assert($self._isEmpty())){
  8032. return $recv(aBlock)._value();
  8033. } else {
  8034. return self;
  8035. }
  8036. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock})});
  8037. }; }),
  8038. $globals.Collection);
  8039. $core.addMethod(
  8040. $core.method({
  8041. selector: "ifEmpty:ifNotEmpty:",
  8042. protocol: "testing",
  8043. args: ["aBlock", "anotherBlock"],
  8044. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  8045. referencedClasses: [],
  8046. pragmas: [],
  8047. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  8048. }, function ($methodClass){ return function (aBlock,anotherBlock){
  8049. var self=this,$self=this;
  8050. return $core.withContext(function($ctx1) {
  8051. if($core.assert($self._isEmpty())){
  8052. return $recv(aBlock)._value();
  8053. } else {
  8054. return $recv(anotherBlock)._value_(self);
  8055. }
  8056. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  8057. }; }),
  8058. $globals.Collection);
  8059. $core.addMethod(
  8060. $core.method({
  8061. selector: "ifNotEmpty:",
  8062. protocol: "testing",
  8063. args: ["aBlock"],
  8064. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  8065. referencedClasses: [],
  8066. pragmas: [],
  8067. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  8068. }, function ($methodClass){ return function (aBlock){
  8069. var self=this,$self=this;
  8070. return $core.withContext(function($ctx1) {
  8071. if($core.assert($self._notEmpty())){
  8072. return $recv(aBlock)._value_(self);
  8073. } else {
  8074. return self;
  8075. }
  8076. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock})});
  8077. }; }),
  8078. $globals.Collection);
  8079. $core.addMethod(
  8080. $core.method({
  8081. selector: "ifNotEmpty:ifEmpty:",
  8082. protocol: "testing",
  8083. args: ["aBlock", "anotherBlock"],
  8084. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  8085. referencedClasses: [],
  8086. pragmas: [],
  8087. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  8088. }, function ($methodClass){ return function (aBlock,anotherBlock){
  8089. var self=this,$self=this;
  8090. return $core.withContext(function($ctx1) {
  8091. if($core.assert($self._notEmpty())){
  8092. return $recv(aBlock)._value_(self);
  8093. } else {
  8094. return $recv(anotherBlock)._value();
  8095. }
  8096. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  8097. }; }),
  8098. $globals.Collection);
  8099. $core.addMethod(
  8100. $core.method({
  8101. selector: "includes:",
  8102. protocol: "testing",
  8103. args: ["anObject"],
  8104. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  8105. referencedClasses: [],
  8106. pragmas: [],
  8107. messageSends: ["anySatisfy:", "="]
  8108. }, function ($methodClass){ return function (anObject){
  8109. var self=this,$self=this;
  8110. return $core.withContext(function($ctx1) {
  8111. return $self._anySatisfy_((function(each){
  8112. return $core.withContext(function($ctx2) {
  8113. return $recv(each).__eq(anObject);
  8114. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8115. }));
  8116. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  8117. }; }),
  8118. $globals.Collection);
  8119. $core.addMethod(
  8120. $core.method({
  8121. selector: "inject:into:",
  8122. protocol: "enumerating",
  8123. args: ["anObject", "aBlock"],
  8124. 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",
  8125. referencedClasses: [],
  8126. pragmas: [],
  8127. messageSends: ["do:", "value:value:"]
  8128. }, function ($methodClass){ return function (anObject,aBlock){
  8129. var self=this,$self=this;
  8130. var result;
  8131. return $core.withContext(function($ctx1) {
  8132. result=anObject;
  8133. $self._do_((function(each){
  8134. return $core.withContext(function($ctx2) {
  8135. result=$recv(aBlock)._value_value_(result,each);
  8136. return result;
  8137. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8138. }));
  8139. return result;
  8140. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result})});
  8141. }; }),
  8142. $globals.Collection);
  8143. $core.addMethod(
  8144. $core.method({
  8145. selector: "intersection:",
  8146. protocol: "enumerating",
  8147. args: ["aCollection"],
  8148. 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",
  8149. referencedClasses: ["Set"],
  8150. pragmas: [],
  8151. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  8152. }, function ($methodClass){ return function (aCollection){
  8153. var self=this,$self=this;
  8154. var set,outputSet;
  8155. return $core.withContext(function($ctx1) {
  8156. set=$self._asSet();
  8157. outputSet=$recv($globals.Set)._new();
  8158. $recv(aCollection)._do_((function(each){
  8159. return $core.withContext(function($ctx2) {
  8160. if($core.assert($recv([$recv(set)._includes_(each)
  8161. ,$ctx2.sendIdx["includes:"]=1
  8162. ][0])._and_((function(){
  8163. return $core.withContext(function($ctx3) {
  8164. return $recv($recv(outputSet)._includes_(each))._not();
  8165. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8166. })))){
  8167. return $recv(outputSet)._add_(each);
  8168. }
  8169. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8170. }));
  8171. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  8172. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet})});
  8173. }; }),
  8174. $globals.Collection);
  8175. $core.addMethod(
  8176. $core.method({
  8177. selector: "isEmpty",
  8178. protocol: "testing",
  8179. args: [],
  8180. source: "isEmpty\x0a\x09^ self size = 0",
  8181. referencedClasses: [],
  8182. pragmas: [],
  8183. messageSends: ["=", "size"]
  8184. }, function ($methodClass){ return function (){
  8185. var self=this,$self=this;
  8186. return $core.withContext(function($ctx1) {
  8187. return $recv($self._size()).__eq((0));
  8188. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  8189. }; }),
  8190. $globals.Collection);
  8191. $core.addMethod(
  8192. $core.method({
  8193. selector: "noneSatisfy:",
  8194. protocol: "enumerating",
  8195. args: ["aBlock"],
  8196. 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",
  8197. referencedClasses: [],
  8198. pragmas: [],
  8199. messageSends: ["do:", "ifTrue:", "value:"]
  8200. }, function ($methodClass){ return function (aBlock){
  8201. var self=this,$self=this;
  8202. return $core.withContext(function($ctx1) {
  8203. var $early={};
  8204. try {
  8205. $self._do_((function(item){
  8206. return $core.withContext(function($ctx2) {
  8207. if($core.assert($recv(aBlock)._value_(item))){
  8208. throw $early=[false];
  8209. }
  8210. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  8211. }));
  8212. return true;
  8213. }
  8214. catch(e) {if(e===$early)return e[0]; throw e}
  8215. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock})});
  8216. }; }),
  8217. $globals.Collection);
  8218. $core.addMethod(
  8219. $core.method({
  8220. selector: "notEmpty",
  8221. protocol: "testing",
  8222. args: [],
  8223. source: "notEmpty\x0a\x09^ self isEmpty not",
  8224. referencedClasses: [],
  8225. pragmas: [],
  8226. messageSends: ["not", "isEmpty"]
  8227. }, function ($methodClass){ return function (){
  8228. var self=this,$self=this;
  8229. return $core.withContext(function($ctx1) {
  8230. return $recv($self._isEmpty())._not();
  8231. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{})});
  8232. }; }),
  8233. $globals.Collection);
  8234. $core.addMethod(
  8235. $core.method({
  8236. selector: "occurrencesOf:",
  8237. protocol: "accessing",
  8238. args: ["anObject"],
  8239. 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",
  8240. referencedClasses: [],
  8241. pragmas: [],
  8242. messageSends: ["do:", "ifTrue:", "=", "+"]
  8243. }, function ($methodClass){ return function (anObject){
  8244. var self=this,$self=this;
  8245. var tally;
  8246. return $core.withContext(function($ctx1) {
  8247. tally=(0);
  8248. $self._do_((function(each){
  8249. return $core.withContext(function($ctx2) {
  8250. if($core.assert($recv(anObject).__eq(each))){
  8251. tally=$recv(tally).__plus((1));
  8252. return tally;
  8253. }
  8254. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8255. }));
  8256. return tally;
  8257. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally})});
  8258. }; }),
  8259. $globals.Collection);
  8260. $core.addMethod(
  8261. $core.method({
  8262. selector: "putOn:",
  8263. protocol: "streaming",
  8264. args: ["aStream"],
  8265. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  8266. referencedClasses: [],
  8267. pragmas: [],
  8268. messageSends: ["do:", "putOn:"]
  8269. }, function ($methodClass){ return function (aStream){
  8270. var self=this,$self=this;
  8271. return $core.withContext(function($ctx1) {
  8272. $self._do_((function(each){
  8273. return $core.withContext(function($ctx2) {
  8274. return $recv(each)._putOn_(aStream);
  8275. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8276. }));
  8277. return self;
  8278. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  8279. }; }),
  8280. $globals.Collection);
  8281. $core.addMethod(
  8282. $core.method({
  8283. selector: "reject:",
  8284. protocol: "enumerating",
  8285. args: ["aBlock"],
  8286. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  8287. referencedClasses: [],
  8288. pragmas: [],
  8289. messageSends: ["select:", "=", "value:"]
  8290. }, function ($methodClass){ return function (aBlock){
  8291. var self=this,$self=this;
  8292. return $core.withContext(function($ctx1) {
  8293. return $self._select_((function(each){
  8294. return $core.withContext(function($ctx2) {
  8295. return $recv($recv(aBlock)._value_(each)).__eq(false);
  8296. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8297. }));
  8298. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock})});
  8299. }; }),
  8300. $globals.Collection);
  8301. $core.addMethod(
  8302. $core.method({
  8303. selector: "remove:",
  8304. protocol: "adding/removing",
  8305. args: ["anObject"],
  8306. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  8307. referencedClasses: [],
  8308. pragmas: [],
  8309. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  8310. }, function ($methodClass){ return function (anObject){
  8311. var self=this,$self=this;
  8312. return $core.withContext(function($ctx1) {
  8313. return $self._remove_ifAbsent_(anObject,(function(){
  8314. return $core.withContext(function($ctx2) {
  8315. return $self._errorNotFound();
  8316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8317. }));
  8318. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  8319. }; }),
  8320. $globals.Collection);
  8321. $core.addMethod(
  8322. $core.method({
  8323. selector: "remove:ifAbsent:",
  8324. protocol: "adding/removing",
  8325. args: ["anObject", "aBlock"],
  8326. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  8327. referencedClasses: [],
  8328. pragmas: [],
  8329. messageSends: ["subclassResponsibility"]
  8330. }, function ($methodClass){ return function (anObject,aBlock){
  8331. var self=this,$self=this;
  8332. return $core.withContext(function($ctx1) {
  8333. $self._subclassResponsibility();
  8334. return self;
  8335. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  8336. }; }),
  8337. $globals.Collection);
  8338. $core.addMethod(
  8339. $core.method({
  8340. selector: "removeAll",
  8341. protocol: "adding/removing",
  8342. args: [],
  8343. source: "removeAll\x0a\x09self subclassResponsibility",
  8344. referencedClasses: [],
  8345. pragmas: [],
  8346. messageSends: ["subclassResponsibility"]
  8347. }, function ($methodClass){ return function (){
  8348. var self=this,$self=this;
  8349. return $core.withContext(function($ctx1) {
  8350. $self._subclassResponsibility();
  8351. return self;
  8352. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  8353. }; }),
  8354. $globals.Collection);
  8355. $core.addMethod(
  8356. $core.method({
  8357. selector: "select:",
  8358. protocol: "enumerating",
  8359. args: ["aBlock"],
  8360. 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",
  8361. referencedClasses: [],
  8362. pragmas: [],
  8363. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8364. }, function ($methodClass){ return function (aBlock){
  8365. var self=this,$self=this;
  8366. var stream;
  8367. return $core.withContext(function($ctx1) {
  8368. stream=$recv($recv($self._class())._new())._writeStream();
  8369. $self._do_((function(each){
  8370. return $core.withContext(function($ctx2) {
  8371. if($core.assert($recv(aBlock)._value_(each))){
  8372. return $recv(stream)._nextPut_(each);
  8373. }
  8374. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8375. }));
  8376. return $recv(stream)._contents();
  8377. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream})});
  8378. }; }),
  8379. $globals.Collection);
  8380. $core.addMethod(
  8381. $core.method({
  8382. selector: "select:thenCollect:",
  8383. protocol: "enumerating",
  8384. args: ["selectBlock", "collectBlock"],
  8385. 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",
  8386. referencedClasses: [],
  8387. pragmas: [],
  8388. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8389. }, function ($methodClass){ return function (selectBlock,collectBlock){
  8390. var self=this,$self=this;
  8391. var stream;
  8392. return $core.withContext(function($ctx1) {
  8393. stream=$recv($recv($self._class())._new())._writeStream();
  8394. $self._do_((function(each){
  8395. return $core.withContext(function($ctx2) {
  8396. if($core.assert([$recv(selectBlock)._value_(each)
  8397. ,$ctx2.sendIdx["value:"]=1
  8398. ][0])){
  8399. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  8400. }
  8401. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8402. }));
  8403. return $recv(stream)._contents();
  8404. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream})});
  8405. }; }),
  8406. $globals.Collection);
  8407. $core.addMethod(
  8408. $core.method({
  8409. selector: "shallowCopy",
  8410. protocol: "copying",
  8411. args: [],
  8412. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  8413. referencedClasses: [],
  8414. pragmas: [],
  8415. messageSends: ["collect:"]
  8416. }, function ($methodClass){ return function (){
  8417. var self=this,$self=this;
  8418. return $core.withContext(function($ctx1) {
  8419. return $self._collect_((function(each){
  8420. return each;
  8421. }));
  8422. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  8423. }; }),
  8424. $globals.Collection);
  8425. $core.addMethod(
  8426. $core.method({
  8427. selector: "shortenedPrintString",
  8428. protocol: "printing",
  8429. args: [],
  8430. source: "shortenedPrintString\x0a\x09^ self size <= 1\x0a\x09\x09ifTrue: [ self printString ]\x0a\x09\x09ifFalse: [ (self copyEmpty copyWith: self anyOne) printString, ' ... ', (self size - 1), ' more items' ]",
  8431. referencedClasses: [],
  8432. pragmas: [],
  8433. messageSends: ["ifTrue:ifFalse:", "<=", "size", "printString", ",", "copyWith:", "copyEmpty", "anyOne", "-"]
  8434. }, function ($methodClass){ return function (){
  8435. var self=this,$self=this;
  8436. return $core.withContext(function($ctx1) {
  8437. if($core.assert($recv([$self._size()
  8438. ,$ctx1.sendIdx["size"]=1
  8439. ][0]).__lt_eq((1)))){
  8440. return [$self._printString()
  8441. ,$ctx1.sendIdx["printString"]=1
  8442. ][0];
  8443. } else {
  8444. return [$recv([$recv($recv($recv($recv($self._copyEmpty())._copyWith_($self._anyOne()))._printString()).__comma(" ... ")).__comma($recv($self._size()).__minus((1)))
  8445. ,$ctx1.sendIdx[","]=2
  8446. ][0]).__comma(" more items")
  8447. ,$ctx1.sendIdx[","]=1
  8448. ][0];
  8449. }
  8450. }, function($ctx1) {$ctx1.fill(self,"shortenedPrintString",{})});
  8451. }; }),
  8452. $globals.Collection);
  8453. $core.addMethod(
  8454. $core.method({
  8455. selector: "single",
  8456. protocol: "accessing",
  8457. args: [],
  8458. 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",
  8459. referencedClasses: [],
  8460. pragmas: [],
  8461. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  8462. }, function ($methodClass){ return function (){
  8463. var self=this,$self=this;
  8464. return $core.withContext(function($ctx1) {
  8465. $self._ifEmpty_((function(){
  8466. return $core.withContext(function($ctx2) {
  8467. return [$self._error_("Collection is empty")
  8468. ,$ctx2.sendIdx["error:"]=1
  8469. ][0];
  8470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8471. }));
  8472. if($core.assert($recv($self._size()).__gt((1)))){
  8473. $self._error_("Collection holds more than one element");
  8474. }
  8475. return $self._anyOne();
  8476. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  8477. }; }),
  8478. $globals.Collection);
  8479. $core.addMethod(
  8480. $core.method({
  8481. selector: "size",
  8482. protocol: "accessing",
  8483. args: [],
  8484. source: "size\x0a\x09self subclassResponsibility",
  8485. referencedClasses: [],
  8486. pragmas: [],
  8487. messageSends: ["subclassResponsibility"]
  8488. }, function ($methodClass){ return function (){
  8489. var self=this,$self=this;
  8490. return $core.withContext(function($ctx1) {
  8491. $self._subclassResponsibility();
  8492. return self;
  8493. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  8494. }; }),
  8495. $globals.Collection);
  8496. $core.addMethod(
  8497. $core.method({
  8498. selector: "classTag",
  8499. protocol: "accessing",
  8500. args: [],
  8501. 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'",
  8502. referencedClasses: [],
  8503. pragmas: [],
  8504. messageSends: []
  8505. }, function ($methodClass){ return function (){
  8506. var self=this,$self=this;
  8507. return "collection";
  8508. }; }),
  8509. $globals.Collection.a$cls);
  8510. $core.addMethod(
  8511. $core.method({
  8512. selector: "new:",
  8513. protocol: "instance creation",
  8514. args: ["anInteger"],
  8515. source: "new: anInteger\x0a\x09^ self new",
  8516. referencedClasses: [],
  8517. pragmas: [],
  8518. messageSends: ["new"]
  8519. }, function ($methodClass){ return function (anInteger){
  8520. var self=this,$self=this;
  8521. return $core.withContext(function($ctx1) {
  8522. return $self._new();
  8523. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  8524. }; }),
  8525. $globals.Collection.a$cls);
  8526. $core.addMethod(
  8527. $core.method({
  8528. selector: "with:",
  8529. protocol: "instance creation",
  8530. args: ["anObject"],
  8531. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  8532. referencedClasses: [],
  8533. pragmas: [],
  8534. messageSends: ["add:", "new", "yourself"]
  8535. }, function ($methodClass){ return function (anObject){
  8536. var self=this,$self=this;
  8537. return $core.withContext(function($ctx1) {
  8538. var $1;
  8539. $1=$self._new();
  8540. $recv($1)._add_(anObject);
  8541. return $recv($1)._yourself();
  8542. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  8543. }; }),
  8544. $globals.Collection.a$cls);
  8545. $core.addMethod(
  8546. $core.method({
  8547. selector: "with:with:",
  8548. protocol: "instance creation",
  8549. args: ["anObject", "anotherObject"],
  8550. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  8551. referencedClasses: [],
  8552. pragmas: [],
  8553. messageSends: ["add:", "new", "yourself"]
  8554. }, function ($methodClass){ return function (anObject,anotherObject){
  8555. var self=this,$self=this;
  8556. return $core.withContext(function($ctx1) {
  8557. var $1;
  8558. $1=$self._new();
  8559. [$recv($1)._add_(anObject)
  8560. ,$ctx1.sendIdx["add:"]=1
  8561. ][0];
  8562. $recv($1)._add_(anotherObject);
  8563. return $recv($1)._yourself();
  8564. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject})});
  8565. }; }),
  8566. $globals.Collection.a$cls);
  8567. $core.addMethod(
  8568. $core.method({
  8569. selector: "with:with:with:",
  8570. protocol: "instance creation",
  8571. args: ["firstObject", "secondObject", "thirdObject"],
  8572. 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",
  8573. referencedClasses: [],
  8574. pragmas: [],
  8575. messageSends: ["add:", "new", "yourself"]
  8576. }, function ($methodClass){ return function (firstObject,secondObject,thirdObject){
  8577. var self=this,$self=this;
  8578. return $core.withContext(function($ctx1) {
  8579. var $1;
  8580. $1=$self._new();
  8581. [$recv($1)._add_(firstObject)
  8582. ,$ctx1.sendIdx["add:"]=1
  8583. ][0];
  8584. [$recv($1)._add_(secondObject)
  8585. ,$ctx1.sendIdx["add:"]=2
  8586. ][0];
  8587. $recv($1)._add_(thirdObject);
  8588. return $recv($1)._yourself();
  8589. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject})});
  8590. }; }),
  8591. $globals.Collection.a$cls);
  8592. $core.addMethod(
  8593. $core.method({
  8594. selector: "withAll:",
  8595. protocol: "instance creation",
  8596. args: ["aCollection"],
  8597. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  8598. referencedClasses: [],
  8599. pragmas: [],
  8600. messageSends: ["addAll:", "new", "yourself"]
  8601. }, function ($methodClass){ return function (aCollection){
  8602. var self=this,$self=this;
  8603. return $core.withContext(function($ctx1) {
  8604. var $1;
  8605. $1=$self._new();
  8606. $recv($1)._addAll_(aCollection);
  8607. return $recv($1)._yourself();
  8608. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection})});
  8609. }; }),
  8610. $globals.Collection.a$cls);
  8611. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  8612. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  8613. $core.addMethod(
  8614. $core.method({
  8615. selector: "=",
  8616. protocol: "comparing",
  8617. args: ["anAssocitativeCollection"],
  8618. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  8619. referencedClasses: [],
  8620. pragmas: [],
  8621. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  8622. }, function ($methodClass){ return function (anAssocitativeCollection){
  8623. var self=this,$self=this;
  8624. return $core.withContext(function($ctx1) {
  8625. if(!$core.assert([$recv([$self._class()
  8626. ,$ctx1.sendIdx["class"]=1
  8627. ][0]).__eq($recv(anAssocitativeCollection)._class())
  8628. ,$ctx1.sendIdx["="]=1
  8629. ][0])){
  8630. return false;
  8631. }
  8632. if(!$core.assert([$recv([$self._size()
  8633. ,$ctx1.sendIdx["size"]=1
  8634. ][0]).__eq($recv(anAssocitativeCollection)._size())
  8635. ,$ctx1.sendIdx["="]=2
  8636. ][0])){
  8637. return false;
  8638. }
  8639. return $recv([$self._associations()
  8640. ,$ctx1.sendIdx["associations"]=1
  8641. ][0]).__eq($recv(anAssocitativeCollection)._associations());
  8642. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection})});
  8643. }; }),
  8644. $globals.AssociativeCollection);
  8645. $core.addMethod(
  8646. $core.method({
  8647. selector: "add:",
  8648. protocol: "adding/removing",
  8649. args: ["anAssociation"],
  8650. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  8651. referencedClasses: [],
  8652. pragmas: [],
  8653. messageSends: ["at:put:", "key", "value"]
  8654. }, function ($methodClass){ return function (anAssociation){
  8655. var self=this,$self=this;
  8656. return $core.withContext(function($ctx1) {
  8657. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  8658. return self;
  8659. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation})});
  8660. }; }),
  8661. $globals.AssociativeCollection);
  8662. $core.addMethod(
  8663. $core.method({
  8664. selector: "addAll:",
  8665. protocol: "adding/removing",
  8666. args: ["anAssociativeCollection"],
  8667. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  8668. referencedClasses: [],
  8669. pragmas: [],
  8670. messageSends: ["addAll:", "associations"]
  8671. }, function ($methodClass){ return function (anAssociativeCollection){
  8672. var self=this,$self=this;
  8673. return $core.withContext(function($ctx1) {
  8674. [(
  8675. $ctx1.supercall = true,
  8676. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._addAll_.call($self,$recv(anAssociativeCollection)._associations()))
  8677. ,$ctx1.supercall = false
  8678. ][0];
  8679. return anAssociativeCollection;
  8680. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection})});
  8681. }; }),
  8682. $globals.AssociativeCollection);
  8683. $core.addMethod(
  8684. $core.method({
  8685. selector: "asDictionary",
  8686. protocol: "converting",
  8687. args: [],
  8688. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  8689. referencedClasses: ["Dictionary"],
  8690. pragmas: [],
  8691. messageSends: ["from:", "associations"]
  8692. }, function ($methodClass){ return function (){
  8693. var self=this,$self=this;
  8694. return $core.withContext(function($ctx1) {
  8695. return $recv($globals.Dictionary)._from_($self._associations());
  8696. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{})});
  8697. }; }),
  8698. $globals.AssociativeCollection);
  8699. $core.addMethod(
  8700. $core.method({
  8701. selector: "asHashedCollection",
  8702. protocol: "converting",
  8703. args: [],
  8704. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  8705. referencedClasses: ["HashedCollection"],
  8706. pragmas: [],
  8707. messageSends: ["from:", "associations"]
  8708. }, function ($methodClass){ return function (){
  8709. var self=this,$self=this;
  8710. return $core.withContext(function($ctx1) {
  8711. return $recv($globals.HashedCollection)._from_($self._associations());
  8712. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{})});
  8713. }; }),
  8714. $globals.AssociativeCollection);
  8715. $core.addMethod(
  8716. $core.method({
  8717. selector: "asJavaScriptObject",
  8718. protocol: "converting",
  8719. args: [],
  8720. 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",
  8721. referencedClasses: ["HashedCollection"],
  8722. pragmas: [],
  8723. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  8724. }, function ($methodClass){ return function (){
  8725. var self=this,$self=this;
  8726. var hash;
  8727. return $core.withContext(function($ctx1) {
  8728. hash=$recv($globals.HashedCollection)._new();
  8729. $self._keysAndValuesDo_((function(key,value){
  8730. return $core.withContext(function($ctx2) {
  8731. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  8732. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8733. }));
  8734. return hash;
  8735. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash})});
  8736. }; }),
  8737. $globals.AssociativeCollection);
  8738. $core.addMethod(
  8739. $core.method({
  8740. selector: "associations",
  8741. protocol: "accessing",
  8742. args: [],
  8743. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  8744. referencedClasses: [],
  8745. pragmas: [],
  8746. messageSends: ["associationsDo:", "add:"]
  8747. }, function ($methodClass){ return function (){
  8748. var self=this,$self=this;
  8749. var associations;
  8750. return $core.withContext(function($ctx1) {
  8751. associations=[];
  8752. $self._associationsDo_((function(each){
  8753. return $core.withContext(function($ctx2) {
  8754. return $recv(associations)._add_(each);
  8755. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8756. }));
  8757. return associations;
  8758. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations})});
  8759. }; }),
  8760. $globals.AssociativeCollection);
  8761. $core.addMethod(
  8762. $core.method({
  8763. selector: "associationsDo:",
  8764. protocol: "enumerating",
  8765. args: ["aBlock"],
  8766. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  8767. referencedClasses: ["Association"],
  8768. pragmas: [],
  8769. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  8770. }, function ($methodClass){ return function (aBlock){
  8771. var self=this,$self=this;
  8772. return $core.withContext(function($ctx1) {
  8773. $self._keysAndValuesDo_((function(key,value){
  8774. return $core.withContext(function($ctx2) {
  8775. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  8776. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8777. }));
  8778. return self;
  8779. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock})});
  8780. }; }),
  8781. $globals.AssociativeCollection);
  8782. $core.addMethod(
  8783. $core.method({
  8784. selector: "at:ifPresent:ifAbsent:",
  8785. protocol: "accessing",
  8786. args: ["aKey", "aBlock", "anotherBlock"],
  8787. 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 ]",
  8788. referencedClasses: [],
  8789. pragmas: [],
  8790. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  8791. }, function ($methodClass){ return function (aKey,aBlock,anotherBlock){
  8792. var self=this,$self=this;
  8793. return $core.withContext(function($ctx1) {
  8794. if($core.assert($self._includesKey_(aKey))){
  8795. return $recv(aBlock)._value_($self._at_(aKey));
  8796. } else {
  8797. return $recv(anotherBlock)._value();
  8798. }
  8799. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock})});
  8800. }; }),
  8801. $globals.AssociativeCollection);
  8802. $core.addMethod(
  8803. $core.method({
  8804. selector: "collect:",
  8805. protocol: "enumerating",
  8806. args: ["aBlock"],
  8807. 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",
  8808. referencedClasses: [],
  8809. pragmas: [],
  8810. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  8811. }, function ($methodClass){ return function (aBlock){
  8812. var self=this,$self=this;
  8813. var newDict;
  8814. return $core.withContext(function($ctx1) {
  8815. newDict=$recv($self._class())._new();
  8816. $self._keysAndValuesDo_((function(key,value){
  8817. return $core.withContext(function($ctx2) {
  8818. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  8819. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8820. }));
  8821. return newDict;
  8822. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict})});
  8823. }; }),
  8824. $globals.AssociativeCollection);
  8825. $core.addMethod(
  8826. $core.method({
  8827. selector: "deepCopy",
  8828. protocol: "copying",
  8829. args: [],
  8830. 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",
  8831. referencedClasses: [],
  8832. pragmas: [],
  8833. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  8834. }, function ($methodClass){ return function (){
  8835. var self=this,$self=this;
  8836. var copy;
  8837. return $core.withContext(function($ctx1) {
  8838. copy=$recv($self._class())._new();
  8839. $self._keysAndValuesDo_((function(key,value){
  8840. return $core.withContext(function($ctx2) {
  8841. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  8842. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8843. }));
  8844. return copy;
  8845. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy})});
  8846. }; }),
  8847. $globals.AssociativeCollection);
  8848. $core.addMethod(
  8849. $core.method({
  8850. selector: "detect:ifNone:",
  8851. protocol: "enumerating",
  8852. args: ["aBlock", "anotherBlock"],
  8853. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  8854. referencedClasses: [],
  8855. pragmas: [],
  8856. messageSends: ["detect:ifNone:", "values"]
  8857. }, function ($methodClass){ return function (aBlock,anotherBlock){
  8858. var self=this,$self=this;
  8859. return $core.withContext(function($ctx1) {
  8860. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  8861. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  8862. }; }),
  8863. $globals.AssociativeCollection);
  8864. $core.addMethod(
  8865. $core.method({
  8866. selector: "do:",
  8867. protocol: "enumerating",
  8868. args: ["aBlock"],
  8869. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  8870. referencedClasses: [],
  8871. pragmas: [],
  8872. messageSends: ["valuesDo:"]
  8873. }, function ($methodClass){ return function (aBlock){
  8874. var self=this,$self=this;
  8875. return $core.withContext(function($ctx1) {
  8876. $self._valuesDo_(aBlock);
  8877. return self;
  8878. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  8879. }; }),
  8880. $globals.AssociativeCollection);
  8881. $core.addMethod(
  8882. $core.method({
  8883. selector: "includes:",
  8884. protocol: "enumerating",
  8885. args: ["anObject"],
  8886. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  8887. referencedClasses: [],
  8888. pragmas: [],
  8889. messageSends: ["includes:", "values"]
  8890. }, function ($methodClass){ return function (anObject){
  8891. var self=this,$self=this;
  8892. return $core.withContext(function($ctx1) {
  8893. return $recv($self._values())._includes_(anObject);
  8894. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  8895. }; }),
  8896. $globals.AssociativeCollection);
  8897. $core.addMethod(
  8898. $core.method({
  8899. selector: "includesKey:",
  8900. protocol: "testing",
  8901. args: ["aKey"],
  8902. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  8903. referencedClasses: [],
  8904. pragmas: [],
  8905. messageSends: ["subclassResponsibility"]
  8906. }, function ($methodClass){ return function (aKey){
  8907. var self=this,$self=this;
  8908. return $core.withContext(function($ctx1) {
  8909. $self._subclassResponsibility();
  8910. return self;
  8911. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  8912. }; }),
  8913. $globals.AssociativeCollection);
  8914. $core.addMethod(
  8915. $core.method({
  8916. selector: "indexOf:ifAbsent:",
  8917. protocol: "accessing",
  8918. args: ["anObject", "aBlock"],
  8919. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  8920. referencedClasses: [],
  8921. pragmas: [],
  8922. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  8923. }, function ($methodClass){ return function (anObject,aBlock){
  8924. var self=this,$self=this;
  8925. return $core.withContext(function($ctx1) {
  8926. return $recv($self._keys())._detect_ifNone_((function(each){
  8927. return $core.withContext(function($ctx2) {
  8928. return $recv($self._at_(each)).__eq(anObject);
  8929. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8930. }),aBlock);
  8931. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  8932. }; }),
  8933. $globals.AssociativeCollection);
  8934. $core.addMethod(
  8935. $core.method({
  8936. selector: "keyAtValue:",
  8937. protocol: "accessing",
  8938. args: ["anObject"],
  8939. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  8940. referencedClasses: [],
  8941. pragmas: [],
  8942. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  8943. }, function ($methodClass){ return function (anObject){
  8944. var self=this,$self=this;
  8945. return $core.withContext(function($ctx1) {
  8946. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  8947. return $core.withContext(function($ctx2) {
  8948. return $self._errorNotFound();
  8949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8950. }));
  8951. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject})});
  8952. }; }),
  8953. $globals.AssociativeCollection);
  8954. $core.addMethod(
  8955. $core.method({
  8956. selector: "keyAtValue:ifAbsent:",
  8957. protocol: "accessing",
  8958. args: ["anObject", "aBlock"],
  8959. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  8960. referencedClasses: [],
  8961. pragmas: [],
  8962. messageSends: ["indexOf:ifAbsent:"]
  8963. }, function ($methodClass){ return function (anObject,aBlock){
  8964. var self=this,$self=this;
  8965. return $core.withContext(function($ctx1) {
  8966. return $self._indexOf_ifAbsent_(anObject,aBlock);
  8967. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  8968. }; }),
  8969. $globals.AssociativeCollection);
  8970. $core.addMethod(
  8971. $core.method({
  8972. selector: "keys",
  8973. protocol: "accessing",
  8974. args: [],
  8975. source: "keys\x0a\x09self subclassResponsibility",
  8976. referencedClasses: [],
  8977. pragmas: [],
  8978. messageSends: ["subclassResponsibility"]
  8979. }, function ($methodClass){ return function (){
  8980. var self=this,$self=this;
  8981. return $core.withContext(function($ctx1) {
  8982. $self._subclassResponsibility();
  8983. return self;
  8984. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  8985. }; }),
  8986. $globals.AssociativeCollection);
  8987. $core.addMethod(
  8988. $core.method({
  8989. selector: "keysAndValuesDo:",
  8990. protocol: "enumerating",
  8991. args: ["aBlock"],
  8992. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  8993. referencedClasses: [],
  8994. pragmas: [],
  8995. messageSends: ["keysDo:", "value:value:", "at:"]
  8996. }, function ($methodClass){ return function (aBlock){
  8997. var self=this,$self=this;
  8998. return $core.withContext(function($ctx1) {
  8999. $self._keysDo_((function(each){
  9000. return $core.withContext(function($ctx2) {
  9001. return $recv(aBlock)._value_value_(each,$self._at_(each));
  9002. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9003. }));
  9004. return self;
  9005. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  9006. }; }),
  9007. $globals.AssociativeCollection);
  9008. $core.addMethod(
  9009. $core.method({
  9010. selector: "keysDo:",
  9011. protocol: "enumerating",
  9012. args: ["aBlock"],
  9013. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  9014. referencedClasses: [],
  9015. pragmas: [],
  9016. messageSends: ["subclassResponsibility"]
  9017. }, function ($methodClass){ return function (aBlock){
  9018. var self=this,$self=this;
  9019. return $core.withContext(function($ctx1) {
  9020. $self._subclassResponsibility();
  9021. return self;
  9022. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  9023. }; }),
  9024. $globals.AssociativeCollection);
  9025. $core.addMethod(
  9026. $core.method({
  9027. selector: "printOn:",
  9028. protocol: "printing",
  9029. args: ["aStream"],
  9030. 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: ')'",
  9031. referencedClasses: [],
  9032. pragmas: [],
  9033. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  9034. }, function ($methodClass){ return function (aStream){
  9035. var self=this,$self=this;
  9036. return $core.withContext(function($ctx1) {
  9037. [(
  9038. $ctx1.supercall = true,
  9039. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  9040. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  9041. ][0];
  9042. [$recv(aStream)._nextPutAll_(" (")
  9043. ,$ctx1.sendIdx["nextPutAll:"]=1
  9044. ][0];
  9045. $recv($self._associations())._do_separatedBy_((function(each){
  9046. return $core.withContext(function($ctx2) {
  9047. return $recv(each)._printOn_(aStream);
  9048. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9049. }),(function(){
  9050. return $core.withContext(function($ctx2) {
  9051. return [$recv(aStream)._nextPutAll_(" , ")
  9052. ,$ctx2.sendIdx["nextPutAll:"]=2
  9053. ][0];
  9054. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9055. }));
  9056. $recv(aStream)._nextPutAll_(")");
  9057. return self;
  9058. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  9059. }; }),
  9060. $globals.AssociativeCollection);
  9061. $core.addMethod(
  9062. $core.method({
  9063. selector: "remove:ifAbsent:",
  9064. protocol: "adding/removing",
  9065. args: ["aKey", "aBlock"],
  9066. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  9067. referencedClasses: [],
  9068. pragmas: [],
  9069. messageSends: ["removeKey:ifAbsent:"]
  9070. }, function ($methodClass){ return function (aKey,aBlock){
  9071. var self=this,$self=this;
  9072. return $core.withContext(function($ctx1) {
  9073. return $self._removeKey_ifAbsent_(aKey,aBlock);
  9074. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  9075. }; }),
  9076. $globals.AssociativeCollection);
  9077. $core.addMethod(
  9078. $core.method({
  9079. selector: "removeAll",
  9080. protocol: "adding/removing",
  9081. args: [],
  9082. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  9083. referencedClasses: [],
  9084. pragmas: [],
  9085. messageSends: ["do:", "keys", "removeKey:"]
  9086. }, function ($methodClass){ return function (){
  9087. var self=this,$self=this;
  9088. return $core.withContext(function($ctx1) {
  9089. return $recv($self._keys())._do_((function(each){
  9090. return $core.withContext(function($ctx2) {
  9091. return $self._removeKey_(each);
  9092. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9093. }));
  9094. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  9095. }; }),
  9096. $globals.AssociativeCollection);
  9097. $core.addMethod(
  9098. $core.method({
  9099. selector: "removeKey:",
  9100. protocol: "adding/removing",
  9101. args: ["aKey"],
  9102. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  9103. referencedClasses: [],
  9104. pragmas: [],
  9105. messageSends: ["remove:"]
  9106. }, function ($methodClass){ return function (aKey){
  9107. var self=this,$self=this;
  9108. return $core.withContext(function($ctx1) {
  9109. return $self._remove_(aKey);
  9110. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey})});
  9111. }; }),
  9112. $globals.AssociativeCollection);
  9113. $core.addMethod(
  9114. $core.method({
  9115. selector: "removeKey:ifAbsent:",
  9116. protocol: "adding/removing",
  9117. args: ["aKey", "aBlock"],
  9118. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9119. referencedClasses: [],
  9120. pragmas: [],
  9121. messageSends: ["subclassResponsibility"]
  9122. }, function ($methodClass){ return function (aKey,aBlock){
  9123. var self=this,$self=this;
  9124. return $core.withContext(function($ctx1) {
  9125. $self._subclassResponsibility();
  9126. return self;
  9127. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  9128. }; }),
  9129. $globals.AssociativeCollection);
  9130. $core.addMethod(
  9131. $core.method({
  9132. selector: "select:",
  9133. protocol: "enumerating",
  9134. args: ["aBlock"],
  9135. 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",
  9136. referencedClasses: [],
  9137. pragmas: [],
  9138. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9139. }, function ($methodClass){ return function (aBlock){
  9140. var self=this,$self=this;
  9141. var newDict;
  9142. return $core.withContext(function($ctx1) {
  9143. newDict=$recv($self._class())._new();
  9144. $self._keysAndValuesDo_((function(key,value){
  9145. return $core.withContext(function($ctx2) {
  9146. if($core.assert($recv(aBlock)._value_(value))){
  9147. return $recv(newDict)._at_put_(key,value);
  9148. }
  9149. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9150. }));
  9151. return newDict;
  9152. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict})});
  9153. }; }),
  9154. $globals.AssociativeCollection);
  9155. $core.addMethod(
  9156. $core.method({
  9157. selector: "select:thenCollect:",
  9158. protocol: "enumerating",
  9159. args: ["selectBlock", "collectBlock"],
  9160. 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",
  9161. referencedClasses: [],
  9162. pragmas: [],
  9163. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9164. }, function ($methodClass){ return function (selectBlock,collectBlock){
  9165. var self=this,$self=this;
  9166. var newDict;
  9167. return $core.withContext(function($ctx1) {
  9168. newDict=$recv($self._class())._new();
  9169. $self._keysAndValuesDo_((function(key,value){
  9170. return $core.withContext(function($ctx2) {
  9171. if($core.assert([$recv(selectBlock)._value_(value)
  9172. ,$ctx2.sendIdx["value:"]=1
  9173. ][0])){
  9174. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  9175. }
  9176. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9177. }));
  9178. return newDict;
  9179. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict})});
  9180. }; }),
  9181. $globals.AssociativeCollection);
  9182. $core.addMethod(
  9183. $core.method({
  9184. selector: "shallowCopy",
  9185. protocol: "copying",
  9186. args: [],
  9187. 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",
  9188. referencedClasses: [],
  9189. pragmas: [],
  9190. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  9191. }, function ($methodClass){ return function (){
  9192. var self=this,$self=this;
  9193. var copy;
  9194. return $core.withContext(function($ctx1) {
  9195. copy=$recv($self._class())._new();
  9196. $self._keysAndValuesDo_((function(key,value){
  9197. return $core.withContext(function($ctx2) {
  9198. return $recv(copy)._at_put_(key,value);
  9199. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9200. }));
  9201. return copy;
  9202. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy})});
  9203. }; }),
  9204. $globals.AssociativeCollection);
  9205. $core.addMethod(
  9206. $core.method({
  9207. selector: "shortenedPrintString",
  9208. protocol: "printing",
  9209. args: [],
  9210. source: "shortenedPrintString\x0a\x09^ self size <= 1\x0a\x09\x09ifTrue: [ self printString ]\x0a\x09\x09ifFalse: [ | key | key := self keys anyOne. (self copyEmpty at: key put: (self at: key); yourself) printString, ' ... ', (self size - 1), ' more items' ]",
  9211. referencedClasses: [],
  9212. pragmas: [],
  9213. messageSends: ["ifTrue:ifFalse:", "<=", "size", "printString", "anyOne", "keys", ",", "at:put:", "copyEmpty", "at:", "yourself", "-"]
  9214. }, function ($methodClass){ return function (){
  9215. var self=this,$self=this;
  9216. return $core.withContext(function($ctx1) {
  9217. var $1;
  9218. if($core.assert($recv([$self._size()
  9219. ,$ctx1.sendIdx["size"]=1
  9220. ][0]).__lt_eq((1)))){
  9221. return [$self._printString()
  9222. ,$ctx1.sendIdx["printString"]=1
  9223. ][0];
  9224. } else {
  9225. var key;
  9226. key=$recv($self._keys())._anyOne();
  9227. $1=$self._copyEmpty();
  9228. $recv($1)._at_put_(key,$self._at_(key));
  9229. return [$recv([$recv($recv($recv($recv($1)._yourself())._printString()).__comma(" ... ")).__comma($recv($self._size()).__minus((1)))
  9230. ,$ctx1.sendIdx[","]=2
  9231. ][0]).__comma(" more items")
  9232. ,$ctx1.sendIdx[","]=1
  9233. ][0];
  9234. }
  9235. }, function($ctx1) {$ctx1.fill(self,"shortenedPrintString",{})});
  9236. }; }),
  9237. $globals.AssociativeCollection);
  9238. $core.addMethod(
  9239. $core.method({
  9240. selector: "size",
  9241. protocol: "accessing",
  9242. args: [],
  9243. source: "size\x0a\x09^ self keys size",
  9244. referencedClasses: [],
  9245. pragmas: [],
  9246. messageSends: ["size", "keys"]
  9247. }, function ($methodClass){ return function (){
  9248. var self=this,$self=this;
  9249. return $core.withContext(function($ctx1) {
  9250. return $recv($self._keys())._size();
  9251. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  9252. }; }),
  9253. $globals.AssociativeCollection);
  9254. $core.addMethod(
  9255. $core.method({
  9256. selector: "values",
  9257. protocol: "accessing",
  9258. args: [],
  9259. source: "values\x0a\x09self subclassResponsibility",
  9260. referencedClasses: [],
  9261. pragmas: [],
  9262. messageSends: ["subclassResponsibility"]
  9263. }, function ($methodClass){ return function (){
  9264. var self=this,$self=this;
  9265. return $core.withContext(function($ctx1) {
  9266. $self._subclassResponsibility();
  9267. return self;
  9268. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  9269. }; }),
  9270. $globals.AssociativeCollection);
  9271. $core.addMethod(
  9272. $core.method({
  9273. selector: "valuesDo:",
  9274. protocol: "enumerating",
  9275. args: ["aBlock"],
  9276. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  9277. referencedClasses: [],
  9278. pragmas: [],
  9279. messageSends: ["subclassResponsibility"]
  9280. }, function ($methodClass){ return function (aBlock){
  9281. var self=this,$self=this;
  9282. return $core.withContext(function($ctx1) {
  9283. $self._subclassResponsibility();
  9284. return self;
  9285. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  9286. }; }),
  9287. $globals.AssociativeCollection);
  9288. $core.addMethod(
  9289. $core.method({
  9290. selector: "withIndexDo:",
  9291. protocol: "enumerating",
  9292. args: ["aBlock"],
  9293. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  9294. referencedClasses: [],
  9295. pragmas: [],
  9296. messageSends: ["keysAndValuesDo:", "value:value:"]
  9297. }, function ($methodClass){ return function (aBlock){
  9298. var self=this,$self=this;
  9299. return $core.withContext(function($ctx1) {
  9300. $self._keysAndValuesDo_((function(key,value){
  9301. return $core.withContext(function($ctx2) {
  9302. return $recv(aBlock)._value_value_(value,key);
  9303. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9304. }));
  9305. return self;
  9306. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9307. }; }),
  9308. $globals.AssociativeCollection);
  9309. $core.addMethod(
  9310. $core.method({
  9311. selector: "from:",
  9312. protocol: "instance creation",
  9313. args: ["aCollection"],
  9314. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  9315. referencedClasses: [],
  9316. pragmas: [],
  9317. messageSends: ["new", "do:", "add:"]
  9318. }, function ($methodClass){ return function (aCollection){
  9319. var self=this,$self=this;
  9320. var newCollection;
  9321. return $core.withContext(function($ctx1) {
  9322. newCollection=$self._new();
  9323. $recv(aCollection)._do_((function(each){
  9324. return $core.withContext(function($ctx2) {
  9325. return $recv(newCollection)._add_(each);
  9326. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9327. }));
  9328. return newCollection;
  9329. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection})});
  9330. }; }),
  9331. $globals.AssociativeCollection.a$cls);
  9332. $core.addMethod(
  9333. $core.method({
  9334. selector: "fromPairs:",
  9335. protocol: "instance creation",
  9336. args: ["aCollection"],
  9337. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  9338. referencedClasses: [],
  9339. pragmas: [],
  9340. messageSends: ["from:"]
  9341. }, function ($methodClass){ return function (aCollection){
  9342. var self=this,$self=this;
  9343. return $core.withContext(function($ctx1) {
  9344. return $self._from_(aCollection);
  9345. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection})});
  9346. }; }),
  9347. $globals.AssociativeCollection.a$cls);
  9348. $core.addMethod(
  9349. $core.method({
  9350. selector: "newFromPairs:",
  9351. protocol: "instance creation",
  9352. args: ["aCollection"],
  9353. 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",
  9354. referencedClasses: [],
  9355. pragmas: [],
  9356. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  9357. }, function ($methodClass){ return function (aCollection){
  9358. var self=this,$self=this;
  9359. var newCollection;
  9360. return $core.withContext(function($ctx1) {
  9361. if(!$core.assert($recv([$recv(aCollection)._size()
  9362. ,$ctx1.sendIdx["size"]=1
  9363. ][0])._even())){
  9364. $self._error_("#newFromPairs only accepts arrays of an even length");
  9365. }
  9366. newCollection=$self._new();
  9367. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  9368. return $core.withContext(function($ctx2) {
  9369. return $recv(newCollection)._at_put_([$recv(aCollection)._at_(each)
  9370. ,$ctx2.sendIdx["at:"]=1
  9371. ][0],$recv(aCollection)._at_($recv(each).__plus((1))));
  9372. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  9373. }));
  9374. return newCollection;
  9375. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection})});
  9376. }; }),
  9377. $globals.AssociativeCollection.a$cls);
  9378. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  9379. $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.";
  9380. $core.addMethod(
  9381. $core.method({
  9382. selector: "at:ifAbsent:",
  9383. protocol: "accessing",
  9384. args: ["aKey", "aBlock"],
  9385. 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'>",
  9386. referencedClasses: [],
  9387. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self.values[index] : aBlock._value();\x0a\x09"]]],
  9388. messageSends: []
  9389. }, function ($methodClass){ return function (aKey,aBlock){
  9390. var self=this,$self=this;
  9391. return $core.withContext(function($ctx1) {
  9392. var index = $self._positionOfKey_(aKey);
  9393. return index >=0 ? $self.values[index] : aBlock._value();
  9394. ;
  9395. return self;
  9396. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  9397. }; }),
  9398. $globals.Dictionary);
  9399. $core.addMethod(
  9400. $core.method({
  9401. selector: "at:put:",
  9402. protocol: "accessing",
  9403. args: ["aKey", "aValue"],
  9404. 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'>",
  9405. referencedClasses: [],
  9406. pragmas: [["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"]]],
  9407. messageSends: []
  9408. }, function ($methodClass){ return function (aKey,aValue){
  9409. var self=this,$self=this;
  9410. return $core.withContext(function($ctx1) {
  9411. var index = $self._positionOfKey_(aKey);
  9412. if(index === -1) {
  9413. var keys = $self.keys;
  9414. index = keys.length;
  9415. keys.push(aKey);
  9416. }
  9417. return $self.values[index] = aValue;
  9418. ;
  9419. return self;
  9420. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  9421. }; }),
  9422. $globals.Dictionary);
  9423. $core.addMethod(
  9424. $core.method({
  9425. selector: "includesKey:",
  9426. protocol: "testing",
  9427. args: ["aKey"],
  9428. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  9429. referencedClasses: [],
  9430. pragmas: [["inlineJS:", ["return $self._positionOfKey_(aKey) >= 0;"]]],
  9431. messageSends: []
  9432. }, function ($methodClass){ return function (aKey){
  9433. var self=this,$self=this;
  9434. return $core.withContext(function($ctx1) {
  9435. return $self._positionOfKey_(aKey) >= 0;;
  9436. return self;
  9437. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  9438. }; }),
  9439. $globals.Dictionary);
  9440. $core.addMethod(
  9441. $core.method({
  9442. selector: "indexOf:ifAbsent:",
  9443. protocol: "accessing",
  9444. args: ["anObject", "aBlock"],
  9445. 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 ]",
  9446. referencedClasses: [],
  9447. pragmas: [],
  9448. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  9449. }, function ($methodClass){ return function (anObject,aBlock){
  9450. var self=this,$self=this;
  9451. var index;
  9452. return $core.withContext(function($ctx1) {
  9453. index=$recv($self.values)._indexOf_ifAbsent_(anObject,(function(){
  9454. return (0);
  9455. }));
  9456. if($core.assert($recv(index).__eq((0)))){
  9457. return $recv(aBlock)._value();
  9458. } else {
  9459. return $recv($self.keys)._at_(index);
  9460. }
  9461. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  9462. }; }),
  9463. $globals.Dictionary);
  9464. $core.addMethod(
  9465. $core.method({
  9466. selector: "initialize",
  9467. protocol: "initialization",
  9468. args: [],
  9469. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  9470. referencedClasses: [],
  9471. pragmas: [],
  9472. messageSends: ["initialize"]
  9473. }, function ($methodClass){ return function (){
  9474. var self=this,$self=this;
  9475. return $core.withContext(function($ctx1) {
  9476. [(
  9477. $ctx1.supercall = true,
  9478. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  9479. ,$ctx1.supercall = false
  9480. ][0];
  9481. $self.keys=[];
  9482. $self.values=[];
  9483. return self;
  9484. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  9485. }; }),
  9486. $globals.Dictionary);
  9487. $core.addMethod(
  9488. $core.method({
  9489. selector: "keys",
  9490. protocol: "accessing",
  9491. args: [],
  9492. source: "keys\x0a\x09^ keys copy",
  9493. referencedClasses: [],
  9494. pragmas: [],
  9495. messageSends: ["copy"]
  9496. }, function ($methodClass){ return function (){
  9497. var self=this,$self=this;
  9498. return $core.withContext(function($ctx1) {
  9499. return $recv($self.keys)._copy();
  9500. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  9501. }; }),
  9502. $globals.Dictionary);
  9503. $core.addMethod(
  9504. $core.method({
  9505. selector: "keysAndValuesDo:",
  9506. protocol: "enumerating",
  9507. args: ["aBlock"],
  9508. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  9509. referencedClasses: [],
  9510. pragmas: [],
  9511. messageSends: ["with:do:"]
  9512. }, function ($methodClass){ return function (aBlock){
  9513. var self=this,$self=this;
  9514. return $core.withContext(function($ctx1) {
  9515. return $recv($self.keys)._with_do_($self.values,aBlock);
  9516. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  9517. }; }),
  9518. $globals.Dictionary);
  9519. $core.addMethod(
  9520. $core.method({
  9521. selector: "keysDo:",
  9522. protocol: "enumerating",
  9523. args: ["aBlock"],
  9524. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  9525. referencedClasses: [],
  9526. pragmas: [],
  9527. messageSends: ["do:"]
  9528. }, function ($methodClass){ return function (aBlock){
  9529. var self=this,$self=this;
  9530. return $core.withContext(function($ctx1) {
  9531. return $recv($self.keys)._do_(aBlock);
  9532. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  9533. }; }),
  9534. $globals.Dictionary);
  9535. $core.addMethod(
  9536. $core.method({
  9537. selector: "positionOfKey:",
  9538. protocol: "private",
  9539. args: ["anObject"],
  9540. 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'>",
  9541. referencedClasses: [],
  9542. pragmas: [["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"]]],
  9543. messageSends: []
  9544. }, function ($methodClass){ return function (anObject){
  9545. var self=this,$self=this;
  9546. return $core.withContext(function($ctx1) {
  9547. var keys = $self.keys;
  9548. for(var i=0;i<keys.length;i++){
  9549. if(keys[i].__eq(anObject)) { return i;}
  9550. }
  9551. return -1;
  9552. ;
  9553. return self;
  9554. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject})});
  9555. }; }),
  9556. $globals.Dictionary);
  9557. $core.addMethod(
  9558. $core.method({
  9559. selector: "removeAll",
  9560. protocol: "adding/removing",
  9561. args: [],
  9562. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  9563. referencedClasses: [],
  9564. pragmas: [],
  9565. messageSends: ["removeAll"]
  9566. }, function ($methodClass){ return function (){
  9567. var self=this,$self=this;
  9568. return $core.withContext(function($ctx1) {
  9569. [$recv($self.keys)._removeAll()
  9570. ,$ctx1.sendIdx["removeAll"]=1
  9571. ][0];
  9572. $recv($self.values)._removeAll();
  9573. return self;
  9574. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  9575. }; }),
  9576. $globals.Dictionary);
  9577. $core.addMethod(
  9578. $core.method({
  9579. selector: "removeKey:ifAbsent:",
  9580. protocol: "adding/removing",
  9581. args: ["aKey", "aBlock"],
  9582. 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'>",
  9583. referencedClasses: [],
  9584. pragmas: [["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"]]],
  9585. messageSends: []
  9586. }, function ($methodClass){ return function (aKey,aBlock){
  9587. var self=this,$self=this;
  9588. return $core.withContext(function($ctx1) {
  9589. var index = $self._positionOfKey_(aKey);
  9590. if(index === -1) {
  9591. return aBlock._value()
  9592. } else {
  9593. var keys = $self.keys, values = $self.values;
  9594. var value = values[index], l = keys.length;
  9595. keys[index] = keys[l-1];
  9596. keys.pop();
  9597. values[index] = values[l-1];
  9598. values.pop();
  9599. return value;
  9600. }
  9601. ;
  9602. return self;
  9603. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  9604. }; }),
  9605. $globals.Dictionary);
  9606. $core.addMethod(
  9607. $core.method({
  9608. selector: "values",
  9609. protocol: "accessing",
  9610. args: [],
  9611. source: "values\x0a\x09^ values",
  9612. referencedClasses: [],
  9613. pragmas: [],
  9614. messageSends: []
  9615. }, function ($methodClass){ return function (){
  9616. var self=this,$self=this;
  9617. return $self.values;
  9618. }; }),
  9619. $globals.Dictionary);
  9620. $core.addMethod(
  9621. $core.method({
  9622. selector: "valuesDo:",
  9623. protocol: "enumerating",
  9624. args: ["aBlock"],
  9625. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  9626. referencedClasses: [],
  9627. pragmas: [],
  9628. messageSends: ["do:"]
  9629. }, function ($methodClass){ return function (aBlock){
  9630. var self=this,$self=this;
  9631. return $core.withContext(function($ctx1) {
  9632. return $recv($self.values)._do_(aBlock);
  9633. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  9634. }; }),
  9635. $globals.Dictionary);
  9636. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  9637. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  9638. $core.addMethod(
  9639. $core.method({
  9640. selector: "asJavaScriptSource",
  9641. protocol: "accessing",
  9642. args: [],
  9643. source: "asJavaScriptSource\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09str nextPut: '{'.\x0a\x09\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09\x09str nextPutAll: key asJavaScriptSource; nextPut: ':'; nextPutAll: value asJavaScriptSource; nextPut: ',' ].\x0a\x09\x09str skip: -1; nextPut: '}' ]",
  9644. referencedClasses: ["String"],
  9645. pragmas: [],
  9646. messageSends: ["streamContents:", "nextPut:", "keysAndValuesDo:", "nextPutAll:", "asJavaScriptSource", "skip:"]
  9647. }, function ($methodClass){ return function (){
  9648. var self=this,$self=this;
  9649. return $core.withContext(function($ctx1) {
  9650. return $recv($globals.String)._streamContents_((function(str){
  9651. return $core.withContext(function($ctx2) {
  9652. [$recv(str)._nextPut_("{")
  9653. ,$ctx2.sendIdx["nextPut:"]=1
  9654. ][0];
  9655. $self._keysAndValuesDo_((function(key,value){
  9656. return $core.withContext(function($ctx3) {
  9657. [$recv(str)._nextPutAll_([$recv(key)._asJavaScriptSource()
  9658. ,$ctx3.sendIdx["asJavaScriptSource"]=1
  9659. ][0])
  9660. ,$ctx3.sendIdx["nextPutAll:"]=1
  9661. ][0];
  9662. [$recv(str)._nextPut_(":")
  9663. ,$ctx3.sendIdx["nextPut:"]=2
  9664. ][0];
  9665. $recv(str)._nextPutAll_($recv(value)._asJavaScriptSource());
  9666. return [$recv(str)._nextPut_(",")
  9667. ,$ctx3.sendIdx["nextPut:"]=3
  9668. ][0];
  9669. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  9670. }));
  9671. $recv(str)._skip_((-1));
  9672. return $recv(str)._nextPut_("}");
  9673. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  9674. }));
  9675. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  9676. }; }),
  9677. $globals.HashedCollection);
  9678. $core.addMethod(
  9679. $core.method({
  9680. selector: "at:ifAbsent:",
  9681. protocol: "accessing",
  9682. args: ["aKey", "aBlock"],
  9683. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  9684. referencedClasses: [],
  9685. pragmas: [],
  9686. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  9687. }, function ($methodClass){ return function (aKey,aBlock){
  9688. var self=this,$self=this;
  9689. return $core.withContext(function($ctx1) {
  9690. if($core.assert($self._includesKey_(aKey))){
  9691. return $self._basicAt_(aKey);
  9692. } else {
  9693. return $recv(aBlock)._value();
  9694. }
  9695. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  9696. }; }),
  9697. $globals.HashedCollection);
  9698. $core.addMethod(
  9699. $core.method({
  9700. selector: "at:put:",
  9701. protocol: "accessing",
  9702. args: ["aKey", "aValue"],
  9703. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  9704. referencedClasses: [],
  9705. pragmas: [],
  9706. messageSends: ["basicAt:put:"]
  9707. }, function ($methodClass){ return function (aKey,aValue){
  9708. var self=this,$self=this;
  9709. return $core.withContext(function($ctx1) {
  9710. return $self._basicAt_put_(aKey,aValue);
  9711. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  9712. }; }),
  9713. $globals.HashedCollection);
  9714. $core.addMethod(
  9715. $core.method({
  9716. selector: "includesKey:",
  9717. protocol: "testing",
  9718. args: ["aKey"],
  9719. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  9720. referencedClasses: [],
  9721. pragmas: [["inlineJS:", ["return self.hasOwnProperty(aKey)"]]],
  9722. messageSends: []
  9723. }, function ($methodClass){ return function (aKey){
  9724. var self=this,$self=this;
  9725. return $core.withContext(function($ctx1) {
  9726. return self.hasOwnProperty(aKey);
  9727. return self;
  9728. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  9729. }; }),
  9730. $globals.HashedCollection);
  9731. $core.addMethod(
  9732. $core.method({
  9733. selector: "keys",
  9734. protocol: "accessing",
  9735. args: [],
  9736. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  9737. referencedClasses: [],
  9738. pragmas: [["inlineJS:", ["return Object.keys(self)"]]],
  9739. messageSends: []
  9740. }, function ($methodClass){ return function (){
  9741. var self=this,$self=this;
  9742. return $core.withContext(function($ctx1) {
  9743. return Object.keys(self);
  9744. return self;
  9745. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  9746. }; }),
  9747. $globals.HashedCollection);
  9748. $core.addMethod(
  9749. $core.method({
  9750. selector: "keysDo:",
  9751. protocol: "enumerating",
  9752. args: ["aBlock"],
  9753. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  9754. referencedClasses: [],
  9755. pragmas: [],
  9756. messageSends: ["do:", "keys"]
  9757. }, function ($methodClass){ return function (aBlock){
  9758. var self=this,$self=this;
  9759. return $core.withContext(function($ctx1) {
  9760. $recv($self._keys())._do_(aBlock);
  9761. return self;
  9762. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  9763. }; }),
  9764. $globals.HashedCollection);
  9765. $core.addMethod(
  9766. $core.method({
  9767. selector: "removeKey:ifAbsent:",
  9768. protocol: "adding/removing",
  9769. args: ["aKey", "aBlock"],
  9770. 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 ]",
  9771. referencedClasses: [],
  9772. pragmas: [],
  9773. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  9774. }, function ($methodClass){ return function (aKey,aBlock){
  9775. var self=this,$self=this;
  9776. return $core.withContext(function($ctx1) {
  9777. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  9778. return $core.withContext(function($ctx2) {
  9779. $self._basicDelete_(aKey);
  9780. return removed;
  9781. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  9782. }),(function(){
  9783. return $core.withContext(function($ctx2) {
  9784. return $recv(aBlock)._value();
  9785. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9786. }));
  9787. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  9788. }; }),
  9789. $globals.HashedCollection);
  9790. $core.addMethod(
  9791. $core.method({
  9792. selector: "values",
  9793. protocol: "accessing",
  9794. args: [],
  9795. 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'>",
  9796. referencedClasses: [],
  9797. pragmas: [["inlineJS:", ["\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09"]]],
  9798. messageSends: []
  9799. }, function ($methodClass){ return function (){
  9800. var self=this,$self=this;
  9801. return $core.withContext(function($ctx1) {
  9802. return $self._keys().map(function(key){
  9803. return $self._at_(key);
  9804. });
  9805. ;
  9806. return self;
  9807. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  9808. }; }),
  9809. $globals.HashedCollection);
  9810. $core.addMethod(
  9811. $core.method({
  9812. selector: "valuesDo:",
  9813. protocol: "enumerating",
  9814. args: ["aBlock"],
  9815. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  9816. referencedClasses: [],
  9817. pragmas: [],
  9818. messageSends: ["do:", "values"]
  9819. }, function ($methodClass){ return function (aBlock){
  9820. var self=this,$self=this;
  9821. return $core.withContext(function($ctx1) {
  9822. $recv($self._values())._do_(aBlock);
  9823. return self;
  9824. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  9825. }; }),
  9826. $globals.HashedCollection);
  9827. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  9828. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  9829. $core.addMethod(
  9830. $core.method({
  9831. selector: "=",
  9832. protocol: "comparing",
  9833. args: ["aCollection"],
  9834. 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",
  9835. referencedClasses: [],
  9836. pragmas: [],
  9837. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  9838. }, function ($methodClass){ return function (aCollection){
  9839. var self=this,$self=this;
  9840. return $core.withContext(function($ctx1) {
  9841. var $early={};
  9842. try {
  9843. if(!$core.assert($recv([$recv([$self._class()
  9844. ,$ctx1.sendIdx["class"]=1
  9845. ][0]).__eq($recv(aCollection)._class())
  9846. ,$ctx1.sendIdx["="]=1
  9847. ][0])._and_((function(){
  9848. return $core.withContext(function($ctx2) {
  9849. return [$recv([$self._size()
  9850. ,$ctx2.sendIdx["size"]=1
  9851. ][0]).__eq($recv(aCollection)._size())
  9852. ,$ctx2.sendIdx["="]=2
  9853. ][0];
  9854. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9855. })))){
  9856. return false;
  9857. }
  9858. $self._withIndexDo_((function(each,i){
  9859. return $core.withContext(function($ctx2) {
  9860. if(!$core.assert($recv($recv(aCollection)._at_(i)).__eq(each))){
  9861. throw $early=[false];
  9862. }
  9863. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  9864. }));
  9865. return true;
  9866. }
  9867. catch(e) {if(e===$early)return e[0]; throw e}
  9868. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  9869. }; }),
  9870. $globals.SequenceableCollection);
  9871. $core.addMethod(
  9872. $core.method({
  9873. selector: "addLast:",
  9874. protocol: "adding/removing",
  9875. args: ["anObject"],
  9876. source: "addLast: anObject\x0a\x09self add: anObject",
  9877. referencedClasses: [],
  9878. pragmas: [],
  9879. messageSends: ["add:"]
  9880. }, function ($methodClass){ return function (anObject){
  9881. var self=this,$self=this;
  9882. return $core.withContext(function($ctx1) {
  9883. $self._add_(anObject);
  9884. return self;
  9885. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject})});
  9886. }; }),
  9887. $globals.SequenceableCollection);
  9888. $core.addMethod(
  9889. $core.method({
  9890. selector: "allButFirst",
  9891. protocol: "accessing",
  9892. args: [],
  9893. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  9894. referencedClasses: [],
  9895. pragmas: [],
  9896. messageSends: ["copyFrom:to:", "size"]
  9897. }, function ($methodClass){ return function (){
  9898. var self=this,$self=this;
  9899. return $core.withContext(function($ctx1) {
  9900. return $self._copyFrom_to_((2),$self._size());
  9901. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{})});
  9902. }; }),
  9903. $globals.SequenceableCollection);
  9904. $core.addMethod(
  9905. $core.method({
  9906. selector: "allButLast",
  9907. protocol: "accessing",
  9908. args: [],
  9909. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  9910. referencedClasses: [],
  9911. pragmas: [],
  9912. messageSends: ["copyFrom:to:", "-", "size"]
  9913. }, function ($methodClass){ return function (){
  9914. var self=this,$self=this;
  9915. return $core.withContext(function($ctx1) {
  9916. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  9917. }, function($ctx1) {$ctx1.fill(self,"allButLast",{})});
  9918. }; }),
  9919. $globals.SequenceableCollection);
  9920. $core.addMethod(
  9921. $core.method({
  9922. selector: "anyOne",
  9923. protocol: "accessing",
  9924. args: [],
  9925. source: "anyOne\x0a\x09^ self at: 1",
  9926. referencedClasses: [],
  9927. pragmas: [],
  9928. messageSends: ["at:"]
  9929. }, function ($methodClass){ return function (){
  9930. var self=this,$self=this;
  9931. return $core.withContext(function($ctx1) {
  9932. return $self._at_((1));
  9933. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  9934. }; }),
  9935. $globals.SequenceableCollection);
  9936. $core.addMethod(
  9937. $core.method({
  9938. selector: "atRandom",
  9939. protocol: "accessing",
  9940. args: [],
  9941. source: "atRandom\x0a\x09^ self at: self size atRandom",
  9942. referencedClasses: [],
  9943. pragmas: [],
  9944. messageSends: ["at:", "atRandom", "size"]
  9945. }, function ($methodClass){ return function (){
  9946. var self=this,$self=this;
  9947. return $core.withContext(function($ctx1) {
  9948. return $self._at_($recv($self._size())._atRandom());
  9949. }, function($ctx1) {$ctx1.fill(self,"atRandom",{})});
  9950. }; }),
  9951. $globals.SequenceableCollection);
  9952. $core.addMethod(
  9953. $core.method({
  9954. selector: "beginsWith:",
  9955. protocol: "testing",
  9956. args: ["prefix"],
  9957. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  9958. referencedClasses: [],
  9959. pragmas: [],
  9960. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  9961. }, function ($methodClass){ return function (prefix){
  9962. var self=this,$self=this;
  9963. return $core.withContext(function($ctx1) {
  9964. if($core.assert($recv([$self._size()
  9965. ,$ctx1.sendIdx["size"]=1
  9966. ][0]).__lt([$recv(prefix)._size()
  9967. ,$ctx1.sendIdx["size"]=2
  9968. ][0]))){
  9969. return false;
  9970. }
  9971. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  9972. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix})});
  9973. }; }),
  9974. $globals.SequenceableCollection);
  9975. $core.addMethod(
  9976. $core.method({
  9977. selector: "copyFrom:to:",
  9978. protocol: "copying",
  9979. args: ["anIndex", "anotherIndex"],
  9980. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  9981. referencedClasses: [],
  9982. pragmas: [],
  9983. messageSends: ["subclassResponsibility"]
  9984. }, function ($methodClass){ return function (anIndex,anotherIndex){
  9985. var self=this,$self=this;
  9986. return $core.withContext(function($ctx1) {
  9987. $self._subclassResponsibility();
  9988. return self;
  9989. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  9990. }; }),
  9991. $globals.SequenceableCollection);
  9992. $core.addMethod(
  9993. $core.method({
  9994. selector: "copyWithFirst:",
  9995. protocol: "copying",
  9996. args: ["anObject"],
  9997. source: "copyWithFirst: anObject\x0a\x09^ (self class with: anObject) addAll: self; yourself",
  9998. referencedClasses: [],
  9999. pragmas: [],
  10000. messageSends: ["addAll:", "with:", "class", "yourself"]
  10001. }, function ($methodClass){ return function (anObject){
  10002. var self=this,$self=this;
  10003. return $core.withContext(function($ctx1) {
  10004. var $1;
  10005. $1=$recv($self._class())._with_(anObject);
  10006. $recv($1)._addAll_(self);
  10007. return $recv($1)._yourself();
  10008. }, function($ctx1) {$ctx1.fill(self,"copyWithFirst:",{anObject:anObject})});
  10009. }; }),
  10010. $globals.SequenceableCollection);
  10011. $core.addMethod(
  10012. $core.method({
  10013. selector: "endsWith:",
  10014. protocol: "testing",
  10015. args: ["suffix"],
  10016. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  10017. referencedClasses: [],
  10018. pragmas: [],
  10019. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  10020. }, function ($methodClass){ return function (suffix){
  10021. var self=this,$self=this;
  10022. return $core.withContext(function($ctx1) {
  10023. if($core.assert($recv([$self._size()
  10024. ,$ctx1.sendIdx["size"]=1
  10025. ][0]).__lt([$recv(suffix)._size()
  10026. ,$ctx1.sendIdx["size"]=2
  10027. ][0]))){
  10028. return false;
  10029. }
  10030. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  10031. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix})});
  10032. }; }),
  10033. $globals.SequenceableCollection);
  10034. $core.addMethod(
  10035. $core.method({
  10036. selector: "first",
  10037. protocol: "accessing",
  10038. args: [],
  10039. source: "first\x0a\x09^ self at: 1",
  10040. referencedClasses: [],
  10041. pragmas: [],
  10042. messageSends: ["at:"]
  10043. }, function ($methodClass){ return function (){
  10044. var self=this,$self=this;
  10045. return $core.withContext(function($ctx1) {
  10046. return $self._at_((1));
  10047. }, function($ctx1) {$ctx1.fill(self,"first",{})});
  10048. }; }),
  10049. $globals.SequenceableCollection);
  10050. $core.addMethod(
  10051. $core.method({
  10052. selector: "first:",
  10053. protocol: "accessing",
  10054. args: ["aNumber"],
  10055. 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",
  10056. referencedClasses: [],
  10057. pragmas: [],
  10058. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  10059. }, function ($methodClass){ return function (aNumber){
  10060. var self=this,$self=this;
  10061. return $core.withContext(function($ctx1) {
  10062. if($core.assert($recv($self._size()).__lt(aNumber))){
  10063. $self._error_("Invalid number of elements");
  10064. }
  10065. return $self._copyFrom_to_((1),aNumber);
  10066. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber})});
  10067. }; }),
  10068. $globals.SequenceableCollection);
  10069. $core.addMethod(
  10070. $core.method({
  10071. selector: "fourth",
  10072. protocol: "accessing",
  10073. args: [],
  10074. source: "fourth\x0a\x09^ self at: 4",
  10075. referencedClasses: [],
  10076. pragmas: [],
  10077. messageSends: ["at:"]
  10078. }, function ($methodClass){ return function (){
  10079. var self=this,$self=this;
  10080. return $core.withContext(function($ctx1) {
  10081. return $self._at_((4));
  10082. }, function($ctx1) {$ctx1.fill(self,"fourth",{})});
  10083. }; }),
  10084. $globals.SequenceableCollection);
  10085. $core.addMethod(
  10086. $core.method({
  10087. selector: "includes:",
  10088. protocol: "testing",
  10089. args: ["anObject"],
  10090. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  10091. referencedClasses: [],
  10092. pragmas: [],
  10093. messageSends: ["notNil", "indexOf:ifAbsent:"]
  10094. }, function ($methodClass){ return function (anObject){
  10095. var self=this,$self=this;
  10096. return $core.withContext(function($ctx1) {
  10097. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  10098. return nil;
  10099. })))._notNil();
  10100. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  10101. }; }),
  10102. $globals.SequenceableCollection);
  10103. $core.addMethod(
  10104. $core.method({
  10105. selector: "indexOf:startingAt:",
  10106. protocol: "accessing",
  10107. args: ["anObject", "start"],
  10108. 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 ]",
  10109. referencedClasses: [],
  10110. pragmas: [],
  10111. messageSends: ["indexOf:startingAt:ifAbsent:"]
  10112. }, function ($methodClass){ return function (anObject,start){
  10113. var self=this,$self=this;
  10114. return $core.withContext(function($ctx1) {
  10115. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  10116. return (0);
  10117. }));
  10118. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start})});
  10119. }; }),
  10120. $globals.SequenceableCollection);
  10121. $core.addMethod(
  10122. $core.method({
  10123. selector: "indexOf:startingAt:ifAbsent:",
  10124. protocol: "accessing",
  10125. args: ["anObject", "start", "aBlock"],
  10126. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  10127. referencedClasses: [],
  10128. pragmas: [],
  10129. messageSends: ["subclassResponsibility"]
  10130. }, function ($methodClass){ return function (anObject,start,aBlock){
  10131. var self=this,$self=this;
  10132. return $core.withContext(function($ctx1) {
  10133. $self._subclassResponsibility();
  10134. return self;
  10135. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  10136. }; }),
  10137. $globals.SequenceableCollection);
  10138. $core.addMethod(
  10139. $core.method({
  10140. selector: "last",
  10141. protocol: "accessing",
  10142. args: [],
  10143. source: "last\x0a\x09^ self at: self size",
  10144. referencedClasses: [],
  10145. pragmas: [],
  10146. messageSends: ["at:", "size"]
  10147. }, function ($methodClass){ return function (){
  10148. var self=this,$self=this;
  10149. return $core.withContext(function($ctx1) {
  10150. return $self._at_($self._size());
  10151. }, function($ctx1) {$ctx1.fill(self,"last",{})});
  10152. }; }),
  10153. $globals.SequenceableCollection);
  10154. $core.addMethod(
  10155. $core.method({
  10156. selector: "last:",
  10157. protocol: "accessing",
  10158. args: ["aNumber"],
  10159. 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",
  10160. referencedClasses: [],
  10161. pragmas: [],
  10162. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  10163. }, function ($methodClass){ return function (aNumber){
  10164. var self=this,$self=this;
  10165. return $core.withContext(function($ctx1) {
  10166. if($core.assert($recv([$self._size()
  10167. ,$ctx1.sendIdx["size"]=1
  10168. ][0]).__lt(aNumber))){
  10169. $self._error_("Invalid number of elements");
  10170. }
  10171. return $self._copyFrom_to_($recv($recv([$self._size()
  10172. ,$ctx1.sendIdx["size"]=2
  10173. ][0]).__minus(aNumber)).__plus((1)),$self._size());
  10174. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber})});
  10175. }; }),
  10176. $globals.SequenceableCollection);
  10177. $core.addMethod(
  10178. $core.method({
  10179. selector: "newStream",
  10180. protocol: "streaming",
  10181. args: [],
  10182. source: "newStream\x0a\x09^ self streamClass on: self",
  10183. referencedClasses: [],
  10184. pragmas: [],
  10185. messageSends: ["on:", "streamClass"]
  10186. }, function ($methodClass){ return function (){
  10187. var self=this,$self=this;
  10188. return $core.withContext(function($ctx1) {
  10189. return $recv($self._streamClass())._on_(self);
  10190. }, function($ctx1) {$ctx1.fill(self,"newStream",{})});
  10191. }; }),
  10192. $globals.SequenceableCollection);
  10193. $core.addMethod(
  10194. $core.method({
  10195. selector: "readStream",
  10196. protocol: "streaming",
  10197. args: [],
  10198. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10199. referencedClasses: [],
  10200. pragmas: [],
  10201. messageSends: ["stream"]
  10202. }, function ($methodClass){ return function (){
  10203. var self=this,$self=this;
  10204. return $core.withContext(function($ctx1) {
  10205. return $self._stream();
  10206. }, function($ctx1) {$ctx1.fill(self,"readStream",{})});
  10207. }; }),
  10208. $globals.SequenceableCollection);
  10209. $core.addMethod(
  10210. $core.method({
  10211. selector: "removeLast",
  10212. protocol: "adding/removing",
  10213. args: [],
  10214. source: "removeLast\x0a\x09^ self remove: self last",
  10215. referencedClasses: [],
  10216. pragmas: [],
  10217. messageSends: ["remove:", "last"]
  10218. }, function ($methodClass){ return function (){
  10219. var self=this,$self=this;
  10220. return $core.withContext(function($ctx1) {
  10221. return $self._remove_($self._last());
  10222. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  10223. }; }),
  10224. $globals.SequenceableCollection);
  10225. $core.addMethod(
  10226. $core.method({
  10227. selector: "reverseDo:",
  10228. protocol: "enumerating",
  10229. args: ["aBlock"],
  10230. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  10231. referencedClasses: [],
  10232. pragmas: [],
  10233. messageSends: ["do:", "reversed"]
  10234. }, function ($methodClass){ return function (aBlock){
  10235. var self=this,$self=this;
  10236. return $core.withContext(function($ctx1) {
  10237. $recv($self._reversed())._do_(aBlock);
  10238. return self;
  10239. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock})});
  10240. }; }),
  10241. $globals.SequenceableCollection);
  10242. $core.addMethod(
  10243. $core.method({
  10244. selector: "reversed",
  10245. protocol: "converting",
  10246. args: [],
  10247. source: "reversed\x0a\x09self subclassResponsibility",
  10248. referencedClasses: [],
  10249. pragmas: [],
  10250. messageSends: ["subclassResponsibility"]
  10251. }, function ($methodClass){ return function (){
  10252. var self=this,$self=this;
  10253. return $core.withContext(function($ctx1) {
  10254. $self._subclassResponsibility();
  10255. return self;
  10256. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  10257. }; }),
  10258. $globals.SequenceableCollection);
  10259. $core.addMethod(
  10260. $core.method({
  10261. selector: "second",
  10262. protocol: "accessing",
  10263. args: [],
  10264. source: "second\x0a\x09^ self at: 2",
  10265. referencedClasses: [],
  10266. pragmas: [],
  10267. messageSends: ["at:"]
  10268. }, function ($methodClass){ return function (){
  10269. var self=this,$self=this;
  10270. return $core.withContext(function($ctx1) {
  10271. return $self._at_((2));
  10272. }, function($ctx1) {$ctx1.fill(self,"second",{})});
  10273. }; }),
  10274. $globals.SequenceableCollection);
  10275. $core.addMethod(
  10276. $core.method({
  10277. selector: "stream",
  10278. protocol: "streaming",
  10279. args: [],
  10280. source: "stream\x0a\x09^ self newStream",
  10281. referencedClasses: [],
  10282. pragmas: [],
  10283. messageSends: ["newStream"]
  10284. }, function ($methodClass){ return function (){
  10285. var self=this,$self=this;
  10286. return $core.withContext(function($ctx1) {
  10287. return $self._newStream();
  10288. }, function($ctx1) {$ctx1.fill(self,"stream",{})});
  10289. }; }),
  10290. $globals.SequenceableCollection);
  10291. $core.addMethod(
  10292. $core.method({
  10293. selector: "streamClass",
  10294. protocol: "streaming",
  10295. args: [],
  10296. source: "streamClass\x0a\x09^ self class streamClass",
  10297. referencedClasses: [],
  10298. pragmas: [],
  10299. messageSends: ["streamClass", "class"]
  10300. }, function ($methodClass){ return function (){
  10301. var self=this,$self=this;
  10302. return $core.withContext(function($ctx1) {
  10303. return $recv($self._class())._streamClass();
  10304. }, function($ctx1) {$ctx1.fill(self,"streamClass",{})});
  10305. }; }),
  10306. $globals.SequenceableCollection);
  10307. $core.addMethod(
  10308. $core.method({
  10309. selector: "third",
  10310. protocol: "accessing",
  10311. args: [],
  10312. source: "third\x0a\x09^ self at: 3",
  10313. referencedClasses: [],
  10314. pragmas: [],
  10315. messageSends: ["at:"]
  10316. }, function ($methodClass){ return function (){
  10317. var self=this,$self=this;
  10318. return $core.withContext(function($ctx1) {
  10319. return $self._at_((3));
  10320. }, function($ctx1) {$ctx1.fill(self,"third",{})});
  10321. }; }),
  10322. $globals.SequenceableCollection);
  10323. $core.addMethod(
  10324. $core.method({
  10325. selector: "writeStream",
  10326. protocol: "streaming",
  10327. args: [],
  10328. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10329. referencedClasses: [],
  10330. pragmas: [],
  10331. messageSends: ["stream"]
  10332. }, function ($methodClass){ return function (){
  10333. var self=this,$self=this;
  10334. return $core.withContext(function($ctx1) {
  10335. return $self._stream();
  10336. }, function($ctx1) {$ctx1.fill(self,"writeStream",{})});
  10337. }; }),
  10338. $globals.SequenceableCollection);
  10339. $core.addMethod(
  10340. $core.method({
  10341. selector: "streamClass",
  10342. protocol: "accessing",
  10343. args: [],
  10344. source: "streamClass\x0a\x09\x09^ Stream",
  10345. referencedClasses: ["Stream"],
  10346. pragmas: [],
  10347. messageSends: []
  10348. }, function ($methodClass){ return function (){
  10349. var self=this,$self=this;
  10350. return $globals.Stream;
  10351. }; }),
  10352. $globals.SequenceableCollection.a$cls);
  10353. $core.addMethod(
  10354. $core.method({
  10355. selector: "streamContents:",
  10356. protocol: "streaming",
  10357. args: ["aBlock"],
  10358. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  10359. referencedClasses: [],
  10360. pragmas: [],
  10361. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  10362. }, function ($methodClass){ return function (aBlock){
  10363. var self=this,$self=this;
  10364. var stream;
  10365. return $core.withContext(function($ctx1) {
  10366. stream=$recv($self._streamClass())._on_($self._new());
  10367. $recv(aBlock)._value_(stream);
  10368. return $recv(stream)._contents();
  10369. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream})});
  10370. }; }),
  10371. $globals.SequenceableCollection.a$cls);
  10372. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  10373. $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`.";
  10374. $core.addMethod(
  10375. $core.method({
  10376. selector: "add:",
  10377. protocol: "adding/removing",
  10378. args: ["anObject"],
  10379. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  10380. referencedClasses: [],
  10381. pragmas: [["inlineJS:", ["self.push(anObject); return anObject;"]]],
  10382. messageSends: []
  10383. }, function ($methodClass){ return function (anObject){
  10384. var self=this,$self=this;
  10385. return $core.withContext(function($ctx1) {
  10386. self.push(anObject); return anObject;;
  10387. return self;
  10388. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  10389. }; }),
  10390. $globals.Array);
  10391. $core.addMethod(
  10392. $core.method({
  10393. selector: "addAll:",
  10394. protocol: "adding/removing",
  10395. args: ["aCollection"],
  10396. 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'>",
  10397. referencedClasses: [],
  10398. pragmas: [["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;"]]],
  10399. messageSends: []
  10400. }, function ($methodClass){ return function (aCollection){
  10401. var self=this,$self=this;
  10402. return $core.withContext(function($ctx1) {
  10403. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  10404. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  10405. return aCollection;;
  10406. return self;
  10407. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  10408. }; }),
  10409. $globals.Array);
  10410. $core.addMethod(
  10411. $core.method({
  10412. selector: "addFirst:",
  10413. protocol: "adding/removing",
  10414. args: ["anObject"],
  10415. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  10416. referencedClasses: [],
  10417. pragmas: [["inlineJS:", ["self.unshift(anObject); return anObject;"]]],
  10418. messageSends: []
  10419. }, function ($methodClass){ return function (anObject){
  10420. var self=this,$self=this;
  10421. return $core.withContext(function($ctx1) {
  10422. self.unshift(anObject); return anObject;;
  10423. return self;
  10424. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject})});
  10425. }; }),
  10426. $globals.Array);
  10427. $core.addMethod(
  10428. $core.method({
  10429. selector: "allIn:",
  10430. protocol: "enumerating",
  10431. args: ["aBlock"],
  10432. source: "allIn: aBlock\x0a\x09^ aBlock valueWithPossibleArguments:\x0a\x09\x09\x22collect to match #in: behaviour\x22\x0a\x09\x09(self collect: [ :each | each in: [ :x | x ] ])",
  10433. referencedClasses: [],
  10434. pragmas: [],
  10435. messageSends: ["valueWithPossibleArguments:", "collect:", "in:"]
  10436. }, function ($methodClass){ return function (aBlock){
  10437. var self=this,$self=this;
  10438. return $core.withContext(function($ctx1) {
  10439. return $recv(aBlock)._valueWithPossibleArguments_($self._collect_((function(each){
  10440. return $core.withContext(function($ctx2) {
  10441. return $recv(each)._in_((function(x){
  10442. return x;
  10443. }));
  10444. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10445. })));
  10446. }, function($ctx1) {$ctx1.fill(self,"allIn:",{aBlock:aBlock})});
  10447. }; }),
  10448. $globals.Array);
  10449. $core.addMethod(
  10450. $core.method({
  10451. selector: "asJavaScriptSource",
  10452. protocol: "converting",
  10453. args: [],
  10454. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  10455. referencedClasses: [],
  10456. pragmas: [],
  10457. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  10458. }, function ($methodClass){ return function (){
  10459. var self=this,$self=this;
  10460. return $core.withContext(function($ctx1) {
  10461. return [$recv("[".__comma($recv($self._collect_((function(each){
  10462. return $core.withContext(function($ctx2) {
  10463. return $recv(each)._asJavaScriptSource();
  10464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10465. })))._join_(", "))).__comma("]")
  10466. ,$ctx1.sendIdx[","]=1
  10467. ][0];
  10468. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  10469. }; }),
  10470. $globals.Array);
  10471. $core.addMethod(
  10472. $core.method({
  10473. selector: "at:put:",
  10474. protocol: "accessing",
  10475. args: ["anIndex", "anObject"],
  10476. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  10477. referencedClasses: [],
  10478. pragmas: [["inlineJS:", ["return self[anIndex - 1] = anObject"]]],
  10479. messageSends: []
  10480. }, function ($methodClass){ return function (anIndex,anObject){
  10481. var self=this,$self=this;
  10482. return $core.withContext(function($ctx1) {
  10483. return self[anIndex - 1] = anObject;
  10484. return self;
  10485. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  10486. }; }),
  10487. $globals.Array);
  10488. $core.addMethod(
  10489. $core.method({
  10490. selector: "collect:",
  10491. protocol: "enumerating",
  10492. args: ["aBlock"],
  10493. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  10494. referencedClasses: [],
  10495. pragmas: [["inlineJS:", ["return self.map(function(each) {return aBlock._value_(each)})"]]],
  10496. messageSends: []
  10497. }, function ($methodClass){ return function (aBlock){
  10498. var self=this,$self=this;
  10499. return $core.withContext(function($ctx1) {
  10500. return self.map(function(each) {return aBlock._value_(each)});
  10501. return self;
  10502. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock})});
  10503. }; }),
  10504. $globals.Array);
  10505. $core.addMethod(
  10506. $core.method({
  10507. selector: "copyFrom:to:",
  10508. protocol: "copying",
  10509. args: ["anIndex", "anotherIndex"],
  10510. 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'>",
  10511. referencedClasses: [],
  10512. pragmas: [["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}"]]],
  10513. messageSends: []
  10514. }, function ($methodClass){ return function (anIndex,anotherIndex){
  10515. var self=this,$self=this;
  10516. return $core.withContext(function($ctx1) {
  10517. if (anIndex >= 1 && anotherIndex <= self.length) {
  10518. return self.slice(anIndex - 1, anotherIndex);
  10519. } else {
  10520. self._at_(anIndex);
  10521. self._at_(self.length + 1);
  10522. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  10523. };
  10524. return self;
  10525. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  10526. }; }),
  10527. $globals.Array);
  10528. $core.addMethod(
  10529. $core.method({
  10530. selector: "join:",
  10531. protocol: "enumerating",
  10532. args: ["aString"],
  10533. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  10534. referencedClasses: [],
  10535. pragmas: [["inlineJS:", ["return self.join(aString)"]]],
  10536. messageSends: []
  10537. }, function ($methodClass){ return function (aString){
  10538. var self=this,$self=this;
  10539. return $core.withContext(function($ctx1) {
  10540. return self.join(aString);
  10541. return self;
  10542. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString})});
  10543. }; }),
  10544. $globals.Array);
  10545. $core.addMethod(
  10546. $core.method({
  10547. selector: "printOn:",
  10548. protocol: "printing",
  10549. args: ["aStream"],
  10550. 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: ')'",
  10551. referencedClasses: [],
  10552. pragmas: [],
  10553. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  10554. }, function ($methodClass){ return function (aStream){
  10555. var self=this,$self=this;
  10556. return $core.withContext(function($ctx1) {
  10557. [(
  10558. $ctx1.supercall = true,
  10559. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  10560. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  10561. ][0];
  10562. [$recv(aStream)._nextPutAll_(" (")
  10563. ,$ctx1.sendIdx["nextPutAll:"]=1
  10564. ][0];
  10565. $self._do_separatedBy_((function(each){
  10566. return $core.withContext(function($ctx2) {
  10567. return $recv(each)._printOn_(aStream);
  10568. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10569. }),(function(){
  10570. return $core.withContext(function($ctx2) {
  10571. return [$recv(aStream)._nextPutAll_(" ")
  10572. ,$ctx2.sendIdx["nextPutAll:"]=2
  10573. ][0];
  10574. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10575. }));
  10576. $recv(aStream)._nextPutAll_(")");
  10577. return self;
  10578. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  10579. }; }),
  10580. $globals.Array);
  10581. $core.addMethod(
  10582. $core.method({
  10583. selector: "remove:ifAbsent:",
  10584. protocol: "adding/removing",
  10585. args: ["anObject", "aBlock"],
  10586. 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 ]",
  10587. referencedClasses: [],
  10588. pragmas: [],
  10589. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  10590. }, function ($methodClass){ return function (anObject,aBlock){
  10591. var self=this,$self=this;
  10592. var index;
  10593. return $core.withContext(function($ctx1) {
  10594. index=$self._indexOf_ifAbsent_(anObject,(function(){
  10595. return (0);
  10596. }));
  10597. if($core.assert($recv(index).__eq((0)))){
  10598. return $recv(aBlock)._value();
  10599. } else {
  10600. $self._removeIndex_(index);
  10601. return anObject;
  10602. }
  10603. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  10604. }; }),
  10605. $globals.Array);
  10606. $core.addMethod(
  10607. $core.method({
  10608. selector: "removeAll",
  10609. protocol: "adding/removing",
  10610. args: [],
  10611. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  10612. referencedClasses: [],
  10613. pragmas: [["inlineJS:", ["self.length = 0"]]],
  10614. messageSends: []
  10615. }, function ($methodClass){ return function (){
  10616. var self=this,$self=this;
  10617. return $core.withContext(function($ctx1) {
  10618. self.length = 0;
  10619. return self;
  10620. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  10621. }; }),
  10622. $globals.Array);
  10623. $core.addMethod(
  10624. $core.method({
  10625. selector: "removeFrom:to:",
  10626. protocol: "adding/removing",
  10627. args: ["aNumber", "anotherNumber"],
  10628. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  10629. referencedClasses: [],
  10630. pragmas: [["inlineJS:", ["self.splice(aNumber -1, anotherNumber - aNumber + 1)"]]],
  10631. messageSends: []
  10632. }, function ($methodClass){ return function (aNumber,anotherNumber){
  10633. var self=this,$self=this;
  10634. return $core.withContext(function($ctx1) {
  10635. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  10636. return self;
  10637. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber})});
  10638. }; }),
  10639. $globals.Array);
  10640. $core.addMethod(
  10641. $core.method({
  10642. selector: "removeIndex:",
  10643. protocol: "adding/removing",
  10644. args: ["anInteger"],
  10645. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  10646. referencedClasses: [],
  10647. pragmas: [["inlineJS:", ["self.splice(anInteger - 1, 1)"]]],
  10648. messageSends: []
  10649. }, function ($methodClass){ return function (anInteger){
  10650. var self=this,$self=this;
  10651. return $core.withContext(function($ctx1) {
  10652. self.splice(anInteger - 1, 1);
  10653. return self;
  10654. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger})});
  10655. }; }),
  10656. $globals.Array);
  10657. $core.addMethod(
  10658. $core.method({
  10659. selector: "removeLast",
  10660. protocol: "adding/removing",
  10661. args: [],
  10662. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  10663. referencedClasses: [],
  10664. pragmas: [["inlineJS:", ["return self.pop();"]]],
  10665. messageSends: []
  10666. }, function ($methodClass){ return function (){
  10667. var self=this,$self=this;
  10668. return $core.withContext(function($ctx1) {
  10669. return self.pop();;
  10670. return self;
  10671. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  10672. }; }),
  10673. $globals.Array);
  10674. $core.addMethod(
  10675. $core.method({
  10676. selector: "reversed",
  10677. protocol: "converting",
  10678. args: [],
  10679. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  10680. referencedClasses: [],
  10681. pragmas: [["inlineJS:", ["return self.slice().reverse()"]]],
  10682. messageSends: []
  10683. }, function ($methodClass){ return function (){
  10684. var self=this,$self=this;
  10685. return $core.withContext(function($ctx1) {
  10686. return self.slice().reverse();
  10687. return self;
  10688. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  10689. }; }),
  10690. $globals.Array);
  10691. $core.addMethod(
  10692. $core.method({
  10693. selector: "select:",
  10694. protocol: "enumerating",
  10695. args: ["aBlock"],
  10696. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  10697. referencedClasses: [],
  10698. pragmas: [["inlineJS:", ["return self.filter(function(each) {return aBlock._value_(each)})"]]],
  10699. messageSends: []
  10700. }, function ($methodClass){ return function (aBlock){
  10701. var self=this,$self=this;
  10702. return $core.withContext(function($ctx1) {
  10703. return self.filter(function(each) {return aBlock._value_(each)});
  10704. return self;
  10705. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock})});
  10706. }; }),
  10707. $globals.Array);
  10708. $core.addMethod(
  10709. $core.method({
  10710. selector: "shallowCopy",
  10711. protocol: "copying",
  10712. args: [],
  10713. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  10714. referencedClasses: [],
  10715. pragmas: [["inlineJS:", ["return self.slice()"]]],
  10716. messageSends: []
  10717. }, function ($methodClass){ return function (){
  10718. var self=this,$self=this;
  10719. return $core.withContext(function($ctx1) {
  10720. return self.slice();
  10721. return self;
  10722. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  10723. }; }),
  10724. $globals.Array);
  10725. $core.addMethod(
  10726. $core.method({
  10727. selector: "sort",
  10728. protocol: "enumerating",
  10729. args: [],
  10730. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  10731. referencedClasses: [],
  10732. pragmas: [],
  10733. messageSends: ["sort:", "<"]
  10734. }, function ($methodClass){ return function (){
  10735. var self=this,$self=this;
  10736. return $core.withContext(function($ctx1) {
  10737. return $self._sort_((function(a,b){
  10738. return $core.withContext(function($ctx2) {
  10739. return $recv(a).__lt(b);
  10740. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  10741. }));
  10742. }, function($ctx1) {$ctx1.fill(self,"sort",{})});
  10743. }; }),
  10744. $globals.Array);
  10745. $core.addMethod(
  10746. $core.method({
  10747. selector: "sort:",
  10748. protocol: "enumerating",
  10749. args: ["aBlock"],
  10750. 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'>",
  10751. referencedClasses: [],
  10752. pragmas: [["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"]]],
  10753. messageSends: []
  10754. }, function ($methodClass){ return function (aBlock){
  10755. var self=this,$self=this;
  10756. return $core.withContext(function($ctx1) {
  10757. return self.sort(function(a, b) {
  10758. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  10759. })
  10760. ;
  10761. return self;
  10762. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock})});
  10763. }; }),
  10764. $globals.Array);
  10765. $core.addMethod(
  10766. $core.method({
  10767. selector: "sorted",
  10768. protocol: "enumerating",
  10769. args: [],
  10770. source: "sorted\x0a\x09^ self copy sort",
  10771. referencedClasses: [],
  10772. pragmas: [],
  10773. messageSends: ["sort", "copy"]
  10774. }, function ($methodClass){ return function (){
  10775. var self=this,$self=this;
  10776. return $core.withContext(function($ctx1) {
  10777. return $recv($self._copy())._sort();
  10778. }, function($ctx1) {$ctx1.fill(self,"sorted",{})});
  10779. }; }),
  10780. $globals.Array);
  10781. $core.addMethod(
  10782. $core.method({
  10783. selector: "sorted:",
  10784. protocol: "enumerating",
  10785. args: ["aBlock"],
  10786. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  10787. referencedClasses: [],
  10788. pragmas: [],
  10789. messageSends: ["sort:", "copy"]
  10790. }, function ($methodClass){ return function (aBlock){
  10791. var self=this,$self=this;
  10792. return $core.withContext(function($ctx1) {
  10793. return $recv($self._copy())._sort_(aBlock);
  10794. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock})});
  10795. }; }),
  10796. $globals.Array);
  10797. $core.addMethod(
  10798. $core.method({
  10799. selector: "new:",
  10800. protocol: "instance creation",
  10801. args: ["anInteger"],
  10802. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  10803. referencedClasses: [],
  10804. pragmas: [["inlineJS:", ["return new Array(anInteger)"]]],
  10805. messageSends: []
  10806. }, function ($methodClass){ return function (anInteger){
  10807. var self=this,$self=this;
  10808. return $core.withContext(function($ctx1) {
  10809. return new Array(anInteger);
  10810. return self;
  10811. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  10812. }; }),
  10813. $globals.Array.a$cls);
  10814. $core.addMethod(
  10815. $core.method({
  10816. selector: "with:",
  10817. protocol: "instance creation",
  10818. args: ["anObject"],
  10819. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  10820. referencedClasses: [],
  10821. pragmas: [],
  10822. messageSends: ["at:put:", "new:", "yourself"]
  10823. }, function ($methodClass){ return function (anObject){
  10824. var self=this,$self=this;
  10825. return $core.withContext(function($ctx1) {
  10826. var $1;
  10827. $1=$self._new_((1));
  10828. $recv($1)._at_put_((1),anObject);
  10829. return $recv($1)._yourself();
  10830. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  10831. }; }),
  10832. $globals.Array.a$cls);
  10833. $core.addMethod(
  10834. $core.method({
  10835. selector: "with:with:",
  10836. protocol: "instance creation",
  10837. args: ["anObject", "anObject2"],
  10838. 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",
  10839. referencedClasses: [],
  10840. pragmas: [],
  10841. messageSends: ["at:put:", "new:", "yourself"]
  10842. }, function ($methodClass){ return function (anObject,anObject2){
  10843. var self=this,$self=this;
  10844. return $core.withContext(function($ctx1) {
  10845. var $1;
  10846. $1=$self._new_((2));
  10847. [$recv($1)._at_put_((1),anObject)
  10848. ,$ctx1.sendIdx["at:put:"]=1
  10849. ][0];
  10850. $recv($1)._at_put_((2),anObject2);
  10851. return $recv($1)._yourself();
  10852. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2})});
  10853. }; }),
  10854. $globals.Array.a$cls);
  10855. $core.addMethod(
  10856. $core.method({
  10857. selector: "with:with:with:",
  10858. protocol: "instance creation",
  10859. args: ["anObject", "anObject2", "anObject3"],
  10860. 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",
  10861. referencedClasses: [],
  10862. pragmas: [],
  10863. messageSends: ["at:put:", "new:", "yourself"]
  10864. }, function ($methodClass){ return function (anObject,anObject2,anObject3){
  10865. var self=this,$self=this;
  10866. return $core.withContext(function($ctx1) {
  10867. var $1;
  10868. $1=$self._new_((3));
  10869. [$recv($1)._at_put_((1),anObject)
  10870. ,$ctx1.sendIdx["at:put:"]=1
  10871. ][0];
  10872. [$recv($1)._at_put_((2),anObject2)
  10873. ,$ctx1.sendIdx["at:put:"]=2
  10874. ][0];
  10875. $recv($1)._at_put_((3),anObject3);
  10876. return $recv($1)._yourself();
  10877. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  10878. }; }),
  10879. $globals.Array.a$cls);
  10880. $core.addMethod(
  10881. $core.method({
  10882. selector: "withAll:",
  10883. protocol: "instance creation",
  10884. args: ["aCollection"],
  10885. 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",
  10886. referencedClasses: [],
  10887. pragmas: [],
  10888. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  10889. }, function ($methodClass){ return function (aCollection){
  10890. var self=this,$self=this;
  10891. var instance,index;
  10892. return $core.withContext(function($ctx1) {
  10893. index=(1);
  10894. instance=$self._new_($recv(aCollection)._size());
  10895. $recv(aCollection)._do_((function(each){
  10896. return $core.withContext(function($ctx2) {
  10897. $recv(instance)._at_put_(index,each);
  10898. index=$recv(index).__plus((1));
  10899. return index;
  10900. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10901. }));
  10902. return instance;
  10903. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index})});
  10904. }; }),
  10905. $globals.Array.a$cls);
  10906. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  10907. $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 >> #,`";
  10908. $core.addMethod(
  10909. $core.method({
  10910. selector: ",",
  10911. protocol: "copying",
  10912. args: ["aString"],
  10913. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  10914. referencedClasses: [],
  10915. pragmas: [["inlineJS:", ["return String(self) + aString"]]],
  10916. messageSends: []
  10917. }, function ($methodClass){ return function (aString){
  10918. var self=this,$self=this;
  10919. return $core.withContext(function($ctx1) {
  10920. return String(self) + aString;
  10921. return self;
  10922. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString})});
  10923. }; }),
  10924. $globals.String);
  10925. $core.addMethod(
  10926. $core.method({
  10927. selector: "<",
  10928. protocol: "comparing",
  10929. args: ["aString"],
  10930. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  10931. referencedClasses: [],
  10932. pragmas: [["inlineJS:", ["return String(self) < aString._asString()"]]],
  10933. messageSends: []
  10934. }, function ($methodClass){ return function (aString){
  10935. var self=this,$self=this;
  10936. return $core.withContext(function($ctx1) {
  10937. return String(self) < aString._asString();
  10938. return self;
  10939. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString})});
  10940. }; }),
  10941. $globals.String);
  10942. $core.addMethod(
  10943. $core.method({
  10944. selector: "<=",
  10945. protocol: "comparing",
  10946. args: ["aString"],
  10947. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  10948. referencedClasses: [],
  10949. pragmas: [["inlineJS:", ["return String(self) <= aString._asString()"]]],
  10950. messageSends: []
  10951. }, function ($methodClass){ return function (aString){
  10952. var self=this,$self=this;
  10953. return $core.withContext(function($ctx1) {
  10954. return String(self) <= aString._asString();
  10955. return self;
  10956. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString})});
  10957. }; }),
  10958. $globals.String);
  10959. $core.addMethod(
  10960. $core.method({
  10961. selector: "=",
  10962. protocol: "comparing",
  10963. args: ["aString"],
  10964. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  10965. referencedClasses: [],
  10966. pragmas: [["inlineJS:", ["return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())"]]],
  10967. messageSends: []
  10968. }, function ($methodClass){ return function (aString){
  10969. var self=this,$self=this;
  10970. return $core.withContext(function($ctx1) {
  10971. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  10972. return self;
  10973. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString})});
  10974. }; }),
  10975. $globals.String);
  10976. $core.addMethod(
  10977. $core.method({
  10978. selector: "==",
  10979. protocol: "comparing",
  10980. args: ["aString"],
  10981. 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'>",
  10982. referencedClasses: [],
  10983. pragmas: [["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;"]]],
  10984. messageSends: []
  10985. }, function ($methodClass){ return function (aString){
  10986. var self=this,$self=this;
  10987. return $core.withContext(function($ctx1) {
  10988. if (typeof aString === "string") return String(self) === aString;
  10989. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  10990. else return false;;
  10991. return self;
  10992. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString})});
  10993. }; }),
  10994. $globals.String);
  10995. $core.addMethod(
  10996. $core.method({
  10997. selector: ">",
  10998. protocol: "comparing",
  10999. args: ["aString"],
  11000. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  11001. referencedClasses: [],
  11002. pragmas: [["inlineJS:", ["return String(self) > aString._asString()"]]],
  11003. messageSends: []
  11004. }, function ($methodClass){ return function (aString){
  11005. var self=this,$self=this;
  11006. return $core.withContext(function($ctx1) {
  11007. return String(self) > aString._asString();
  11008. return self;
  11009. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString})});
  11010. }; }),
  11011. $globals.String);
  11012. $core.addMethod(
  11013. $core.method({
  11014. selector: ">=",
  11015. protocol: "comparing",
  11016. args: ["aString"],
  11017. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  11018. referencedClasses: [],
  11019. pragmas: [["inlineJS:", ["return String(self) >= aString._asString()"]]],
  11020. messageSends: []
  11021. }, function ($methodClass){ return function (aString){
  11022. var self=this,$self=this;
  11023. return $core.withContext(function($ctx1) {
  11024. return String(self) >= aString._asString();
  11025. return self;
  11026. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString})});
  11027. }; }),
  11028. $globals.String);
  11029. $core.addMethod(
  11030. $core.method({
  11031. selector: "add:",
  11032. protocol: "adding/removing",
  11033. args: ["anObject"],
  11034. source: "add: anObject\x0a\x09self errorReadOnly",
  11035. referencedClasses: [],
  11036. pragmas: [],
  11037. messageSends: ["errorReadOnly"]
  11038. }, function ($methodClass){ return function (anObject){
  11039. var self=this,$self=this;
  11040. return $core.withContext(function($ctx1) {
  11041. $self._errorReadOnly();
  11042. return self;
  11043. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  11044. }; }),
  11045. $globals.String);
  11046. $core.addMethod(
  11047. $core.method({
  11048. selector: "asJavaScriptMethodName",
  11049. protocol: "converting",
  11050. args: [],
  11051. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  11052. referencedClasses: [],
  11053. pragmas: [["inlineJS:", ["return $core.st2js(self)"]]],
  11054. messageSends: []
  11055. }, function ($methodClass){ return function (){
  11056. var self=this,$self=this;
  11057. return $core.withContext(function($ctx1) {
  11058. return $core.st2js(self);
  11059. return self;
  11060. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{})});
  11061. }; }),
  11062. $globals.String);
  11063. $core.addMethod(
  11064. $core.method({
  11065. selector: "asJavaScriptObject",
  11066. protocol: "converting",
  11067. args: [],
  11068. source: "asJavaScriptObject\x0a\x09^ self",
  11069. referencedClasses: [],
  11070. pragmas: [],
  11071. messageSends: []
  11072. }, function ($methodClass){ return function (){
  11073. var self=this,$self=this;
  11074. return self;
  11075. }; }),
  11076. $globals.String);
  11077. $core.addMethod(
  11078. $core.method({
  11079. selector: "asJavaScriptSource",
  11080. protocol: "converting",
  11081. args: [],
  11082. 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'>",
  11083. referencedClasses: [],
  11084. pragmas: [["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"]]],
  11085. messageSends: []
  11086. }, function ($methodClass){ return function (){
  11087. var self=this,$self=this;
  11088. return $core.withContext(function($ctx1) {
  11089. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  11090. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  11091. else
  11092. return "\"" + self + "\"";
  11093. ;
  11094. return self;
  11095. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  11096. }; }),
  11097. $globals.String);
  11098. $core.addMethod(
  11099. $core.method({
  11100. selector: "asLowercase",
  11101. protocol: "converting",
  11102. args: [],
  11103. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  11104. referencedClasses: [],
  11105. pragmas: [["inlineJS:", ["return self.toLowerCase()"]]],
  11106. messageSends: []
  11107. }, function ($methodClass){ return function (){
  11108. var self=this,$self=this;
  11109. return $core.withContext(function($ctx1) {
  11110. return self.toLowerCase();
  11111. return self;
  11112. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{})});
  11113. }; }),
  11114. $globals.String);
  11115. $core.addMethod(
  11116. $core.method({
  11117. selector: "asMutator",
  11118. protocol: "converting",
  11119. args: [],
  11120. 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",
  11121. referencedClasses: [],
  11122. pragmas: [],
  11123. messageSends: ["ifFalse:", "=", "last", ","]
  11124. }, function ($methodClass){ return function (){
  11125. var self=this,$self=this;
  11126. return $core.withContext(function($ctx1) {
  11127. if(!$core.assert($recv($self._last()).__eq(":"))){
  11128. return $self.__comma(":");
  11129. }
  11130. return self;
  11131. }, function($ctx1) {$ctx1.fill(self,"asMutator",{})});
  11132. }; }),
  11133. $globals.String);
  11134. $core.addMethod(
  11135. $core.method({
  11136. selector: "asNumber",
  11137. protocol: "converting",
  11138. args: [],
  11139. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  11140. referencedClasses: [],
  11141. pragmas: [["inlineJS:", ["return Number(self)"]]],
  11142. messageSends: []
  11143. }, function ($methodClass){ return function (){
  11144. var self=this,$self=this;
  11145. return $core.withContext(function($ctx1) {
  11146. return Number(self);
  11147. return self;
  11148. }, function($ctx1) {$ctx1.fill(self,"asNumber",{})});
  11149. }; }),
  11150. $globals.String);
  11151. $core.addMethod(
  11152. $core.method({
  11153. selector: "asRegexp",
  11154. protocol: "converting",
  11155. args: [],
  11156. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  11157. referencedClasses: ["RegularExpression"],
  11158. pragmas: [],
  11159. messageSends: ["fromString:"]
  11160. }, function ($methodClass){ return function (){
  11161. var self=this,$self=this;
  11162. return $core.withContext(function($ctx1) {
  11163. return $recv($globals.RegularExpression)._fromString_(self);
  11164. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{})});
  11165. }; }),
  11166. $globals.String);
  11167. $core.addMethod(
  11168. $core.method({
  11169. selector: "asString",
  11170. protocol: "converting",
  11171. args: [],
  11172. source: "asString\x0a\x09^ self",
  11173. referencedClasses: [],
  11174. pragmas: [],
  11175. messageSends: []
  11176. }, function ($methodClass){ return function (){
  11177. var self=this,$self=this;
  11178. return self;
  11179. }; }),
  11180. $globals.String);
  11181. $core.addMethod(
  11182. $core.method({
  11183. selector: "asSymbol",
  11184. protocol: "converting",
  11185. args: [],
  11186. source: "asSymbol\x0a\x09^ self",
  11187. referencedClasses: [],
  11188. pragmas: [],
  11189. messageSends: []
  11190. }, function ($methodClass){ return function (){
  11191. var self=this,$self=this;
  11192. return self;
  11193. }; }),
  11194. $globals.String);
  11195. $core.addMethod(
  11196. $core.method({
  11197. selector: "asSymbolPrintOn:",
  11198. protocol: "printing",
  11199. args: ["aStream"],
  11200. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  11201. referencedClasses: [],
  11202. pragmas: [],
  11203. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  11204. }, function ($methodClass){ return function (aStream){
  11205. var self=this,$self=this;
  11206. return $core.withContext(function($ctx1) {
  11207. $recv(aStream)._nextPutAll_("#");
  11208. if($core.assert($recv($self._asString())._isSelector())){
  11209. $recv(aStream)._nextPut_(self);
  11210. } else {
  11211. $self._printOn_(aStream);
  11212. }
  11213. return self;
  11214. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream})});
  11215. }; }),
  11216. $globals.String);
  11217. $core.addMethod(
  11218. $core.method({
  11219. selector: "asUppercase",
  11220. protocol: "converting",
  11221. args: [],
  11222. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  11223. referencedClasses: [],
  11224. pragmas: [["inlineJS:", ["return self.toUpperCase()"]]],
  11225. messageSends: []
  11226. }, function ($methodClass){ return function (){
  11227. var self=this,$self=this;
  11228. return $core.withContext(function($ctx1) {
  11229. return self.toUpperCase();
  11230. return self;
  11231. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{})});
  11232. }; }),
  11233. $globals.String);
  11234. $core.addMethod(
  11235. $core.method({
  11236. selector: "asciiValue",
  11237. protocol: "accessing",
  11238. args: [],
  11239. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  11240. referencedClasses: [],
  11241. pragmas: [["inlineJS:", ["return self.charCodeAt(0);"]]],
  11242. messageSends: []
  11243. }, function ($methodClass){ return function (){
  11244. var self=this,$self=this;
  11245. return $core.withContext(function($ctx1) {
  11246. return self.charCodeAt(0);;
  11247. return self;
  11248. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{})});
  11249. }; }),
  11250. $globals.String);
  11251. $core.addMethod(
  11252. $core.method({
  11253. selector: "at:ifAbsent:",
  11254. protocol: "accessing",
  11255. args: ["anIndex", "aBlock"],
  11256. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  11257. referencedClasses: [],
  11258. pragmas: [["inlineJS:", ["return String(self)[anIndex - 1] || aBlock._value()"]]],
  11259. messageSends: []
  11260. }, function ($methodClass){ return function (anIndex,aBlock){
  11261. var self=this,$self=this;
  11262. return $core.withContext(function($ctx1) {
  11263. return String(self)[anIndex - 1] || aBlock._value();
  11264. return self;
  11265. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  11266. }; }),
  11267. $globals.String);
  11268. $core.addMethod(
  11269. $core.method({
  11270. selector: "at:ifPresent:ifAbsent:",
  11271. protocol: "accessing",
  11272. args: ["anIndex", "aBlock", "anotherBlock"],
  11273. 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'>",
  11274. referencedClasses: [],
  11275. pragmas: [["inlineJS:", ["\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09"]]],
  11276. messageSends: []
  11277. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  11278. var self=this,$self=this;
  11279. return $core.withContext(function($ctx1) {
  11280. var result = String(self)[anIndex - 1];
  11281. return result ? aBlock._value_(result) : anotherBlock._value();
  11282. ;
  11283. return self;
  11284. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  11285. }; }),
  11286. $globals.String);
  11287. $core.addMethod(
  11288. $core.method({
  11289. selector: "at:put:",
  11290. protocol: "accessing",
  11291. args: ["anIndex", "anObject"],
  11292. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  11293. referencedClasses: [],
  11294. pragmas: [],
  11295. messageSends: ["errorReadOnly"]
  11296. }, function ($methodClass){ return function (anIndex,anObject){
  11297. var self=this,$self=this;
  11298. return $core.withContext(function($ctx1) {
  11299. $self._errorReadOnly();
  11300. return self;
  11301. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  11302. }; }),
  11303. $globals.String);
  11304. $core.addMethod(
  11305. $core.method({
  11306. selector: "capitalized",
  11307. protocol: "converting",
  11308. args: [],
  11309. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  11310. referencedClasses: [],
  11311. pragmas: [],
  11312. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  11313. }, function ($methodClass){ return function (){
  11314. var self=this,$self=this;
  11315. return $core.withContext(function($ctx1) {
  11316. return $self._ifNotEmpty_((function(){
  11317. return $core.withContext(function($ctx2) {
  11318. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  11319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11320. }));
  11321. }, function($ctx1) {$ctx1.fill(self,"capitalized",{})});
  11322. }; }),
  11323. $globals.String);
  11324. $core.addMethod(
  11325. $core.method({
  11326. selector: "charCodeAt:",
  11327. protocol: "accessing",
  11328. args: ["anInteger"],
  11329. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  11330. referencedClasses: [],
  11331. pragmas: [["inlineJS:", ["return self.charCodeAt(anInteger - 1)"]]],
  11332. messageSends: []
  11333. }, function ($methodClass){ return function (anInteger){
  11334. var self=this,$self=this;
  11335. return $core.withContext(function($ctx1) {
  11336. return self.charCodeAt(anInteger - 1);
  11337. return self;
  11338. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger})});
  11339. }; }),
  11340. $globals.String);
  11341. $core.addMethod(
  11342. $core.method({
  11343. selector: "copyFrom:to:",
  11344. protocol: "copying",
  11345. args: ["anIndex", "anotherIndex"],
  11346. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  11347. referencedClasses: [],
  11348. pragmas: [["inlineJS:", ["return self.substring(anIndex - 1, anotherIndex)"]]],
  11349. messageSends: []
  11350. }, function ($methodClass){ return function (anIndex,anotherIndex){
  11351. var self=this,$self=this;
  11352. return $core.withContext(function($ctx1) {
  11353. return self.substring(anIndex - 1, anotherIndex);
  11354. return self;
  11355. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  11356. }; }),
  11357. $globals.String);
  11358. $core.addMethod(
  11359. $core.method({
  11360. selector: "copyWithFirst:",
  11361. protocol: "copying",
  11362. args: ["anObject"],
  11363. source: "copyWithFirst: anObject\x0a\x09(anObject isString and: [ anObject size = 1 ]) \x22character is one-char string in JS\x22\x0a\x09\x09ifFalse: [ self error: 'Cannot put ', anObject class name, ' in a String' ].\x0a\x09^ anObject, self",
  11364. referencedClasses: [],
  11365. pragmas: [],
  11366. messageSends: ["ifFalse:", "and:", "isString", "=", "size", "error:", ",", "name", "class"]
  11367. }, function ($methodClass){ return function (anObject){
  11368. var self=this,$self=this;
  11369. return $core.withContext(function($ctx1) {
  11370. if(!$core.assert($recv($recv(anObject)._isString())._and_((function(){
  11371. return $core.withContext(function($ctx2) {
  11372. return $recv($recv(anObject)._size()).__eq((1));
  11373. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11374. })))){
  11375. $self._error_([$recv(["Cannot put ".__comma($recv($recv(anObject)._class())._name())
  11376. ,$ctx1.sendIdx[","]=2
  11377. ][0]).__comma(" in a String")
  11378. ,$ctx1.sendIdx[","]=1
  11379. ][0]);
  11380. }
  11381. return $recv(anObject).__comma(self);
  11382. }, function($ctx1) {$ctx1.fill(self,"copyWithFirst:",{anObject:anObject})});
  11383. }; }),
  11384. $globals.String);
  11385. $core.addMethod(
  11386. $core.method({
  11387. selector: "crlfSanitized",
  11388. protocol: "converting",
  11389. args: [],
  11390. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  11391. referencedClasses: ["String"],
  11392. pragmas: [],
  11393. messageSends: ["join:", "lines", "lf"]
  11394. }, function ($methodClass){ return function (){
  11395. var self=this,$self=this;
  11396. return $core.withContext(function($ctx1) {
  11397. return $recv($self._lines())._join_($recv($globals.String)._lf());
  11398. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{})});
  11399. }; }),
  11400. $globals.String);
  11401. $core.addMethod(
  11402. $core.method({
  11403. selector: "deepCopy",
  11404. protocol: "copying",
  11405. args: [],
  11406. source: "deepCopy\x0a\x09^ self shallowCopy",
  11407. referencedClasses: [],
  11408. pragmas: [],
  11409. messageSends: ["shallowCopy"]
  11410. }, function ($methodClass){ return function (){
  11411. var self=this,$self=this;
  11412. return $core.withContext(function($ctx1) {
  11413. return $self._shallowCopy();
  11414. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  11415. }; }),
  11416. $globals.String);
  11417. $core.addMethod(
  11418. $core.method({
  11419. selector: "errorReadOnly",
  11420. protocol: "error handling",
  11421. args: [],
  11422. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  11423. referencedClasses: [],
  11424. pragmas: [],
  11425. messageSends: ["error:"]
  11426. }, function ($methodClass){ return function (){
  11427. var self=this,$self=this;
  11428. return $core.withContext(function($ctx1) {
  11429. $self._error_("Object is read-only");
  11430. return self;
  11431. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{})});
  11432. }; }),
  11433. $globals.String);
  11434. $core.addMethod(
  11435. $core.method({
  11436. selector: "escaped",
  11437. protocol: "converting",
  11438. args: [],
  11439. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  11440. referencedClasses: [],
  11441. pragmas: [["inlineJS:", ["return escape(self)"]]],
  11442. messageSends: []
  11443. }, function ($methodClass){ return function (){
  11444. var self=this,$self=this;
  11445. return $core.withContext(function($ctx1) {
  11446. return escape(self);
  11447. return self;
  11448. }, function($ctx1) {$ctx1.fill(self,"escaped",{})});
  11449. }; }),
  11450. $globals.String);
  11451. $core.addMethod(
  11452. $core.method({
  11453. selector: "includesSubString:",
  11454. protocol: "testing",
  11455. args: ["subString"],
  11456. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  11457. referencedClasses: [],
  11458. pragmas: [["inlineJS:", ["return self.indexOf(subString) != -1"]]],
  11459. messageSends: []
  11460. }, function ($methodClass){ return function (subString){
  11461. var self=this,$self=this;
  11462. return $core.withContext(function($ctx1) {
  11463. return self.indexOf(subString) != -1;
  11464. return self;
  11465. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString})});
  11466. }; }),
  11467. $globals.String);
  11468. $core.addMethod(
  11469. $core.method({
  11470. selector: "isCapitalized",
  11471. protocol: "testing",
  11472. args: [],
  11473. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  11474. referencedClasses: [],
  11475. pragmas: [],
  11476. messageSends: ["==", "asUppercase", "first"]
  11477. }, function ($methodClass){ return function (){
  11478. var self=this,$self=this;
  11479. return $core.withContext(function($ctx1) {
  11480. return $recv($recv([$self._first()
  11481. ,$ctx1.sendIdx["first"]=1
  11482. ][0])._asUppercase()).__eq_eq($self._first());
  11483. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{})});
  11484. }; }),
  11485. $globals.String);
  11486. $core.addMethod(
  11487. $core.method({
  11488. selector: "isImmutable",
  11489. protocol: "testing",
  11490. args: [],
  11491. source: "isImmutable\x0a\x09^ true",
  11492. referencedClasses: [],
  11493. pragmas: [],
  11494. messageSends: []
  11495. }, function ($methodClass){ return function (){
  11496. var self=this,$self=this;
  11497. return true;
  11498. }; }),
  11499. $globals.String);
  11500. $core.addMethod(
  11501. $core.method({
  11502. selector: "isSelector",
  11503. protocol: "testing",
  11504. args: [],
  11505. 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>",
  11506. referencedClasses: [],
  11507. pragmas: [["inlineJS:", ["return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)"]]],
  11508. messageSends: []
  11509. }, function ($methodClass){ return function (){
  11510. var self=this,$self=this;
  11511. return $core.withContext(function($ctx1) {
  11512. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  11513. return self;
  11514. }, function($ctx1) {$ctx1.fill(self,"isSelector",{})});
  11515. }; }),
  11516. $globals.String);
  11517. $core.addMethod(
  11518. $core.method({
  11519. selector: "isString",
  11520. protocol: "testing",
  11521. args: [],
  11522. source: "isString\x0a\x09^ true",
  11523. referencedClasses: [],
  11524. pragmas: [],
  11525. messageSends: []
  11526. }, function ($methodClass){ return function (){
  11527. var self=this,$self=this;
  11528. return true;
  11529. }; }),
  11530. $globals.String);
  11531. $core.addMethod(
  11532. $core.method({
  11533. selector: "isVowel",
  11534. protocol: "testing",
  11535. args: [],
  11536. 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 ]",
  11537. referencedClasses: [],
  11538. pragmas: [],
  11539. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  11540. }, function ($methodClass){ return function (){
  11541. var self=this,$self=this;
  11542. return $core.withContext(function($ctx1) {
  11543. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  11544. return $core.withContext(function($ctx2) {
  11545. return "aeiou"._includes_($self._asLowercase());
  11546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11547. }));
  11548. }, function($ctx1) {$ctx1.fill(self,"isVowel",{})});
  11549. }; }),
  11550. $globals.String);
  11551. $core.addMethod(
  11552. $core.method({
  11553. selector: "join:",
  11554. protocol: "split join",
  11555. args: ["aCollection"],
  11556. 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 ]]",
  11557. referencedClasses: ["String"],
  11558. pragmas: [],
  11559. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  11560. }, function ($methodClass){ return function (aCollection){
  11561. var self=this,$self=this;
  11562. return $core.withContext(function($ctx1) {
  11563. return $recv($globals.String)._streamContents_((function(stream){
  11564. return $core.withContext(function($ctx2) {
  11565. return $recv(aCollection)._do_separatedBy_((function(each){
  11566. return $core.withContext(function($ctx3) {
  11567. return [$recv(stream)._nextPutAll_($recv(each)._asString())
  11568. ,$ctx3.sendIdx["nextPutAll:"]=1
  11569. ][0];
  11570. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  11571. }),(function(){
  11572. return $core.withContext(function($ctx3) {
  11573. return $recv(stream)._nextPutAll_(self);
  11574. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11575. }));
  11576. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  11577. }));
  11578. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection})});
  11579. }; }),
  11580. $globals.String);
  11581. $core.addMethod(
  11582. $core.method({
  11583. selector: "lineIndicesDo:",
  11584. protocol: "split join",
  11585. args: ["aBlock"],
  11586. 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 ] ]]",
  11587. referencedClasses: ["String"],
  11588. pragmas: [],
  11589. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  11590. }, function ($methodClass){ return function (aBlock){
  11591. var self=this,$self=this;
  11592. var cr,lf,start,sz,nextLF,nextCR;
  11593. return $core.withContext(function($ctx1) {
  11594. var $early={};
  11595. try {
  11596. start=(1);
  11597. sz=$self._size();
  11598. cr=$recv($globals.String)._cr();
  11599. nextCR=[$self._indexOf_startingAt_(cr,(1))
  11600. ,$ctx1.sendIdx["indexOf:startingAt:"]=1
  11601. ][0];
  11602. lf=$recv($globals.String)._lf();
  11603. nextLF=[$self._indexOf_startingAt_(lf,(1))
  11604. ,$ctx1.sendIdx["indexOf:startingAt:"]=2
  11605. ][0];
  11606. $recv((function(){
  11607. return $core.withContext(function($ctx2) {
  11608. return $recv(start).__lt_eq(sz);
  11609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11610. }))._whileTrue_((function(){
  11611. return $core.withContext(function($ctx2) {
  11612. if($core.assert([$recv([$recv(nextLF).__eq((0))
  11613. ,$ctx2.sendIdx["="]=1
  11614. ][0])._and_((function(){
  11615. return $core.withContext(function($ctx3) {
  11616. return [$recv(nextCR).__eq((0))
  11617. ,$ctx3.sendIdx["="]=2
  11618. ][0];
  11619. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11620. }))
  11621. ,$ctx2.sendIdx["and:"]=1
  11622. ][0])){
  11623. [$recv(aBlock)._value_value_value_(start,sz,sz)
  11624. ,$ctx2.sendIdx["value:value:value:"]=1
  11625. ][0];
  11626. throw $early=[self];
  11627. }
  11628. if($core.assert($recv([$recv(nextCR).__eq((0))
  11629. ,$ctx2.sendIdx["="]=3
  11630. ][0])._or_((function(){
  11631. return $core.withContext(function($ctx3) {
  11632. return $recv([(0).__lt(nextLF)
  11633. ,$ctx3.sendIdx["<"]=1
  11634. ][0])._and_((function(){
  11635. return $core.withContext(function($ctx4) {
  11636. return $recv(nextLF).__lt(nextCR);
  11637. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  11638. }));
  11639. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  11640. })))){
  11641. [$recv(aBlock)._value_value_value_(start,[$recv(nextLF).__minus((1))
  11642. ,$ctx2.sendIdx["-"]=1
  11643. ][0],nextLF)
  11644. ,$ctx2.sendIdx["value:value:value:"]=2
  11645. ][0];
  11646. start=[(1).__plus(nextLF)
  11647. ,$ctx2.sendIdx["+"]=1
  11648. ][0];
  11649. nextLF=[$self._indexOf_startingAt_(lf,start)
  11650. ,$ctx2.sendIdx["indexOf:startingAt:"]=3
  11651. ][0];
  11652. return nextLF;
  11653. } else {
  11654. if($core.assert($recv([(1).__plus(nextCR)
  11655. ,$ctx2.sendIdx["+"]=2
  11656. ][0]).__eq(nextLF))){
  11657. [$recv(aBlock)._value_value_value_(start,[$recv(nextCR).__minus((1))
  11658. ,$ctx2.sendIdx["-"]=2
  11659. ][0],nextLF)
  11660. ,$ctx2.sendIdx["value:value:value:"]=3
  11661. ][0];
  11662. start=[(1).__plus(nextLF)
  11663. ,$ctx2.sendIdx["+"]=3
  11664. ][0];
  11665. nextCR=[$self._indexOf_startingAt_(cr,start)
  11666. ,$ctx2.sendIdx["indexOf:startingAt:"]=4
  11667. ][0];
  11668. nextLF=[$self._indexOf_startingAt_(lf,start)
  11669. ,$ctx2.sendIdx["indexOf:startingAt:"]=5
  11670. ][0];
  11671. return nextLF;
  11672. } else {
  11673. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  11674. start=(1).__plus(nextCR);
  11675. nextCR=$self._indexOf_startingAt_(cr,start);
  11676. return nextCR;
  11677. }
  11678. }
  11679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  11680. }));
  11681. return self;
  11682. }
  11683. catch(e) {if(e===$early)return e[0]; throw e}
  11684. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR})});
  11685. }; }),
  11686. $globals.String);
  11687. $core.addMethod(
  11688. $core.method({
  11689. selector: "lineNumber:",
  11690. protocol: "split join",
  11691. args: ["anIndex"],
  11692. 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",
  11693. referencedClasses: [],
  11694. pragmas: [],
  11695. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  11696. }, function ($methodClass){ return function (anIndex){
  11697. var self=this,$self=this;
  11698. var lineCount;
  11699. return $core.withContext(function($ctx1) {
  11700. var $early={};
  11701. try {
  11702. lineCount=(0);
  11703. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  11704. return $core.withContext(function($ctx2) {
  11705. lineCount=$recv(lineCount).__plus((1));
  11706. if($core.assert($recv(lineCount).__eq(anIndex))){
  11707. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  11708. }
  11709. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  11710. }));
  11711. return nil;
  11712. }
  11713. catch(e) {if(e===$early)return e[0]; throw e}
  11714. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount})});
  11715. }; }),
  11716. $globals.String);
  11717. $core.addMethod(
  11718. $core.method({
  11719. selector: "lines",
  11720. protocol: "split join",
  11721. args: [],
  11722. 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'>",
  11723. referencedClasses: [],
  11724. pragmas: [["inlineJS:", ["\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;"]]],
  11725. messageSends: []
  11726. }, function ($methodClass){ return function (){
  11727. var self=this,$self=this;
  11728. return $core.withContext(function($ctx1) {
  11729. var result = self.split(/\r\n|\r|\n/);
  11730. if (!result[result.length-1]) result.pop();
  11731. return result;;
  11732. return self;
  11733. }, function($ctx1) {$ctx1.fill(self,"lines",{})});
  11734. }; }),
  11735. $globals.String);
  11736. $core.addMethod(
  11737. $core.method({
  11738. selector: "linesDo:",
  11739. protocol: "split join",
  11740. args: ["aBlock"],
  11741. 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",
  11742. referencedClasses: [],
  11743. pragmas: [],
  11744. messageSends: ["do:", "lines"]
  11745. }, function ($methodClass){ return function (aBlock){
  11746. var self=this,$self=this;
  11747. return $core.withContext(function($ctx1) {
  11748. $recv($self._lines())._do_(aBlock);
  11749. return self;
  11750. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock})});
  11751. }; }),
  11752. $globals.String);
  11753. $core.addMethod(
  11754. $core.method({
  11755. selector: "match:",
  11756. protocol: "regular expressions",
  11757. args: ["aRegexp"],
  11758. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  11759. referencedClasses: [],
  11760. pragmas: [["inlineJS:", ["return self.search(aRegexp) != -1"]]],
  11761. messageSends: []
  11762. }, function ($methodClass){ return function (aRegexp){
  11763. var self=this,$self=this;
  11764. return $core.withContext(function($ctx1) {
  11765. return self.search(aRegexp) != -1;
  11766. return self;
  11767. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp})});
  11768. }; }),
  11769. $globals.String);
  11770. $core.addMethod(
  11771. $core.method({
  11772. selector: "matchesOf:",
  11773. protocol: "regular expressions",
  11774. args: ["aRegularExpression"],
  11775. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  11776. referencedClasses: [],
  11777. pragmas: [["inlineJS:", ["return self.match(aRegularExpression)"]]],
  11778. messageSends: []
  11779. }, function ($methodClass){ return function (aRegularExpression){
  11780. var self=this,$self=this;
  11781. return $core.withContext(function($ctx1) {
  11782. return self.match(aRegularExpression);
  11783. return self;
  11784. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression})});
  11785. }; }),
  11786. $globals.String);
  11787. $core.addMethod(
  11788. $core.method({
  11789. selector: "printNl",
  11790. protocol: "printing",
  11791. args: [],
  11792. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  11793. referencedClasses: [],
  11794. pragmas: [["inlineJS:", ["console.log(self)"]]],
  11795. messageSends: []
  11796. }, function ($methodClass){ return function (){
  11797. var self=this,$self=this;
  11798. return $core.withContext(function($ctx1) {
  11799. console.log(self);
  11800. return self;
  11801. }, function($ctx1) {$ctx1.fill(self,"printNl",{})});
  11802. }; }),
  11803. $globals.String);
  11804. $core.addMethod(
  11805. $core.method({
  11806. selector: "printOn:",
  11807. protocol: "printing",
  11808. args: ["aStream"],
  11809. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  11810. referencedClasses: [],
  11811. pragmas: [],
  11812. messageSends: ["nextPutAll:", "replace:with:"]
  11813. }, function ($methodClass){ return function (aStream){
  11814. var self=this,$self=this;
  11815. return $core.withContext(function($ctx1) {
  11816. [$recv(aStream)._nextPutAll_("'")
  11817. ,$ctx1.sendIdx["nextPutAll:"]=1
  11818. ][0];
  11819. [$recv(aStream)._nextPutAll_($self._replace_with_("'","''"))
  11820. ,$ctx1.sendIdx["nextPutAll:"]=2
  11821. ][0];
  11822. $recv(aStream)._nextPutAll_("'");
  11823. return self;
  11824. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  11825. }; }),
  11826. $globals.String);
  11827. $core.addMethod(
  11828. $core.method({
  11829. selector: "putOn:",
  11830. protocol: "streaming",
  11831. args: ["aStream"],
  11832. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  11833. referencedClasses: [],
  11834. pragmas: [],
  11835. messageSends: ["nextPutString:"]
  11836. }, function ($methodClass){ return function (aStream){
  11837. var self=this,$self=this;
  11838. return $core.withContext(function($ctx1) {
  11839. $recv(aStream)._nextPutString_(self);
  11840. return self;
  11841. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  11842. }; }),
  11843. $globals.String);
  11844. $core.addMethod(
  11845. $core.method({
  11846. selector: "remove:",
  11847. protocol: "adding/removing",
  11848. args: ["anObject"],
  11849. source: "remove: anObject\x0a\x09self errorReadOnly",
  11850. referencedClasses: [],
  11851. pragmas: [],
  11852. messageSends: ["errorReadOnly"]
  11853. }, function ($methodClass){ return function (anObject){
  11854. var self=this,$self=this;
  11855. return $core.withContext(function($ctx1) {
  11856. $self._errorReadOnly();
  11857. return self;
  11858. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  11859. }; }),
  11860. $globals.String);
  11861. $core.addMethod(
  11862. $core.method({
  11863. selector: "remove:ifAbsent:",
  11864. protocol: "adding/removing",
  11865. args: ["anObject", "aBlock"],
  11866. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  11867. referencedClasses: [],
  11868. pragmas: [],
  11869. messageSends: ["errorReadOnly"]
  11870. }, function ($methodClass){ return function (anObject,aBlock){
  11871. var self=this,$self=this;
  11872. return $core.withContext(function($ctx1) {
  11873. $self._errorReadOnly();
  11874. return self;
  11875. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  11876. }; }),
  11877. $globals.String);
  11878. $core.addMethod(
  11879. $core.method({
  11880. selector: "replace:with:",
  11881. protocol: "regular expressions",
  11882. args: ["aString", "anotherString"],
  11883. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  11884. referencedClasses: ["RegularExpression"],
  11885. pragmas: [],
  11886. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  11887. }, function ($methodClass){ return function (aString,anotherString){
  11888. var self=this,$self=this;
  11889. return $core.withContext(function($ctx1) {
  11890. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  11891. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString})});
  11892. }; }),
  11893. $globals.String);
  11894. $core.addMethod(
  11895. $core.method({
  11896. selector: "replaceRegexp:with:",
  11897. protocol: "regular expressions",
  11898. args: ["aRegexp", "aString"],
  11899. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  11900. referencedClasses: [],
  11901. pragmas: [["inlineJS:", ["return self.replace(aRegexp, aString)"]]],
  11902. messageSends: []
  11903. }, function ($methodClass){ return function (aRegexp,aString){
  11904. var self=this,$self=this;
  11905. return $core.withContext(function($ctx1) {
  11906. return self.replace(aRegexp, aString);
  11907. return self;
  11908. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString})});
  11909. }; }),
  11910. $globals.String);
  11911. $core.addMethod(
  11912. $core.method({
  11913. selector: "reversed",
  11914. protocol: "converting",
  11915. args: [],
  11916. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  11917. referencedClasses: [],
  11918. pragmas: [["inlineJS:", ["return self.split(\x22\x22).reverse().join(\x22\x22)"]]],
  11919. messageSends: []
  11920. }, function ($methodClass){ return function (){
  11921. var self=this,$self=this;
  11922. return $core.withContext(function($ctx1) {
  11923. return self.split("").reverse().join("");
  11924. return self;
  11925. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  11926. }; }),
  11927. $globals.String);
  11928. $core.addMethod(
  11929. $core.method({
  11930. selector: "shallowCopy",
  11931. protocol: "copying",
  11932. args: [],
  11933. source: "shallowCopy\x0a\x09^ self",
  11934. referencedClasses: [],
  11935. pragmas: [],
  11936. messageSends: []
  11937. }, function ($methodClass){ return function (){
  11938. var self=this,$self=this;
  11939. return self;
  11940. }; }),
  11941. $globals.String);
  11942. $core.addMethod(
  11943. $core.method({
  11944. selector: "shortenedPrintString",
  11945. protocol: "printing",
  11946. args: [],
  11947. source: "shortenedPrintString\x0a\x09^ self printString size > 30\x0a\x09\x09ifTrue: [ (self printString copyFrom: 1 to: 30), '...''' ]\x0a\x09\x09ifFalse: [ self printString ]",
  11948. referencedClasses: [],
  11949. pragmas: [],
  11950. messageSends: ["ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:"]
  11951. }, function ($methodClass){ return function (){
  11952. var self=this,$self=this;
  11953. return $core.withContext(function($ctx1) {
  11954. if($core.assert($recv($recv([$self._printString()
  11955. ,$ctx1.sendIdx["printString"]=1
  11956. ][0])._size()).__gt((30)))){
  11957. return $recv($recv([$self._printString()
  11958. ,$ctx1.sendIdx["printString"]=2
  11959. ][0])._copyFrom_to_((1),(30))).__comma("...'");
  11960. } else {
  11961. return $self._printString();
  11962. }
  11963. }, function($ctx1) {$ctx1.fill(self,"shortenedPrintString",{})});
  11964. }; }),
  11965. $globals.String);
  11966. $core.addMethod(
  11967. $core.method({
  11968. selector: "subStrings:",
  11969. protocol: "split join",
  11970. args: ["aString"],
  11971. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  11972. referencedClasses: [],
  11973. pragmas: [],
  11974. messageSends: ["tokenize:"]
  11975. }, function ($methodClass){ return function (aString){
  11976. var self=this,$self=this;
  11977. return $core.withContext(function($ctx1) {
  11978. return $self._tokenize_(aString);
  11979. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString})});
  11980. }; }),
  11981. $globals.String);
  11982. $core.addMethod(
  11983. $core.method({
  11984. selector: "symbolPrintString",
  11985. protocol: "printing",
  11986. args: [],
  11987. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  11988. referencedClasses: ["String"],
  11989. pragmas: [],
  11990. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  11991. }, function ($methodClass){ return function (){
  11992. var self=this,$self=this;
  11993. return $core.withContext(function($ctx1) {
  11994. return $recv($globals.String)._streamContents_((function(str){
  11995. return $core.withContext(function($ctx2) {
  11996. return $self._asSymbolPrintOn_(str);
  11997. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  11998. }));
  11999. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{})});
  12000. }; }),
  12001. $globals.String);
  12002. $core.addMethod(
  12003. $core.method({
  12004. selector: "tokenize:",
  12005. protocol: "split join",
  12006. args: ["aString"],
  12007. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  12008. referencedClasses: [],
  12009. pragmas: [["inlineJS:", ["return self.split(aString)"]]],
  12010. messageSends: []
  12011. }, function ($methodClass){ return function (aString){
  12012. var self=this,$self=this;
  12013. return $core.withContext(function($ctx1) {
  12014. return self.split(aString);
  12015. return self;
  12016. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString})});
  12017. }; }),
  12018. $globals.String);
  12019. $core.addMethod(
  12020. $core.method({
  12021. selector: "trimBoth",
  12022. protocol: "regular expressions",
  12023. args: [],
  12024. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  12025. referencedClasses: [],
  12026. pragmas: [],
  12027. messageSends: ["trimBoth:"]
  12028. }, function ($methodClass){ return function (){
  12029. var self=this,$self=this;
  12030. return $core.withContext(function($ctx1) {
  12031. return $self._trimBoth_("\x5cs");
  12032. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{})});
  12033. }; }),
  12034. $globals.String);
  12035. $core.addMethod(
  12036. $core.method({
  12037. selector: "trimBoth:",
  12038. protocol: "regular expressions",
  12039. args: ["separators"],
  12040. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  12041. referencedClasses: [],
  12042. pragmas: [],
  12043. messageSends: ["trimRight:", "trimLeft:"]
  12044. }, function ($methodClass){ return function (separators){
  12045. var self=this,$self=this;
  12046. return $core.withContext(function($ctx1) {
  12047. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  12048. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators})});
  12049. }; }),
  12050. $globals.String);
  12051. $core.addMethod(
  12052. $core.method({
  12053. selector: "trimLeft",
  12054. protocol: "regular expressions",
  12055. args: [],
  12056. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  12057. referencedClasses: [],
  12058. pragmas: [],
  12059. messageSends: ["trimLeft:"]
  12060. }, function ($methodClass){ return function (){
  12061. var self=this,$self=this;
  12062. return $core.withContext(function($ctx1) {
  12063. return $self._trimLeft_("\x5cs");
  12064. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{})});
  12065. }; }),
  12066. $globals.String);
  12067. $core.addMethod(
  12068. $core.method({
  12069. selector: "trimLeft:",
  12070. protocol: "regular expressions",
  12071. args: ["separators"],
  12072. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  12073. referencedClasses: ["RegularExpression"],
  12074. pragmas: [],
  12075. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12076. }, function ($methodClass){ return function (separators){
  12077. var self=this,$self=this;
  12078. return $core.withContext(function($ctx1) {
  12079. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_([$recv("^[".__comma(separators)).__comma("]+")
  12080. ,$ctx1.sendIdx[","]=1
  12081. ][0],"g"),"");
  12082. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators})});
  12083. }; }),
  12084. $globals.String);
  12085. $core.addMethod(
  12086. $core.method({
  12087. selector: "trimRight",
  12088. protocol: "regular expressions",
  12089. args: [],
  12090. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  12091. referencedClasses: [],
  12092. pragmas: [],
  12093. messageSends: ["trimRight:"]
  12094. }, function ($methodClass){ return function (){
  12095. var self=this,$self=this;
  12096. return $core.withContext(function($ctx1) {
  12097. return $self._trimRight_("\x5cs");
  12098. }, function($ctx1) {$ctx1.fill(self,"trimRight",{})});
  12099. }; }),
  12100. $globals.String);
  12101. $core.addMethod(
  12102. $core.method({
  12103. selector: "trimRight:",
  12104. protocol: "regular expressions",
  12105. args: ["separators"],
  12106. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  12107. referencedClasses: ["RegularExpression"],
  12108. pragmas: [],
  12109. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12110. }, function ($methodClass){ return function (separators){
  12111. var self=this,$self=this;
  12112. return $core.withContext(function($ctx1) {
  12113. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_([$recv("[".__comma(separators)).__comma("]+$")
  12114. ,$ctx1.sendIdx[","]=1
  12115. ][0],"g"),"");
  12116. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators})});
  12117. }; }),
  12118. $globals.String);
  12119. $core.addMethod(
  12120. $core.method({
  12121. selector: "unescaped",
  12122. protocol: "converting",
  12123. args: [],
  12124. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  12125. referencedClasses: [],
  12126. pragmas: [["inlineJS:", ["return unescape(self)"]]],
  12127. messageSends: []
  12128. }, function ($methodClass){ return function (){
  12129. var self=this,$self=this;
  12130. return $core.withContext(function($ctx1) {
  12131. return unescape(self);
  12132. return self;
  12133. }, function($ctx1) {$ctx1.fill(self,"unescaped",{})});
  12134. }; }),
  12135. $globals.String);
  12136. $core.addMethod(
  12137. $core.method({
  12138. selector: "uriComponentDecoded",
  12139. protocol: "converting",
  12140. args: [],
  12141. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  12142. referencedClasses: [],
  12143. pragmas: [["inlineJS:", ["return decodeURIComponent(self)"]]],
  12144. messageSends: []
  12145. }, function ($methodClass){ return function (){
  12146. var self=this,$self=this;
  12147. return $core.withContext(function($ctx1) {
  12148. return decodeURIComponent(self);
  12149. return self;
  12150. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{})});
  12151. }; }),
  12152. $globals.String);
  12153. $core.addMethod(
  12154. $core.method({
  12155. selector: "uriComponentEncoded",
  12156. protocol: "converting",
  12157. args: [],
  12158. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  12159. referencedClasses: [],
  12160. pragmas: [["inlineJS:", ["return encodeURIComponent(self)"]]],
  12161. messageSends: []
  12162. }, function ($methodClass){ return function (){
  12163. var self=this,$self=this;
  12164. return $core.withContext(function($ctx1) {
  12165. return encodeURIComponent(self);
  12166. return self;
  12167. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{})});
  12168. }; }),
  12169. $globals.String);
  12170. $core.addMethod(
  12171. $core.method({
  12172. selector: "uriDecoded",
  12173. protocol: "converting",
  12174. args: [],
  12175. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  12176. referencedClasses: [],
  12177. pragmas: [["inlineJS:", ["return decodeURI(self)"]]],
  12178. messageSends: []
  12179. }, function ($methodClass){ return function (){
  12180. var self=this,$self=this;
  12181. return $core.withContext(function($ctx1) {
  12182. return decodeURI(self);
  12183. return self;
  12184. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{})});
  12185. }; }),
  12186. $globals.String);
  12187. $core.addMethod(
  12188. $core.method({
  12189. selector: "uriEncoded",
  12190. protocol: "converting",
  12191. args: [],
  12192. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  12193. referencedClasses: [],
  12194. pragmas: [["inlineJS:", ["return encodeURI(self)"]]],
  12195. messageSends: []
  12196. }, function ($methodClass){ return function (){
  12197. var self=this,$self=this;
  12198. return $core.withContext(function($ctx1) {
  12199. return encodeURI(self);
  12200. return self;
  12201. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{})});
  12202. }; }),
  12203. $globals.String);
  12204. $core.addMethod(
  12205. $core.method({
  12206. selector: "value:",
  12207. protocol: "evaluating",
  12208. args: ["anObject"],
  12209. source: "value: anObject \x0a\x09^ anObject perform: self",
  12210. referencedClasses: [],
  12211. pragmas: [],
  12212. messageSends: ["perform:"]
  12213. }, function ($methodClass){ return function (anObject){
  12214. var self=this,$self=this;
  12215. return $core.withContext(function($ctx1) {
  12216. return $recv(anObject)._perform_(self);
  12217. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  12218. }; }),
  12219. $globals.String);
  12220. $core.addMethod(
  12221. $core.method({
  12222. selector: "cr",
  12223. protocol: "accessing",
  12224. args: [],
  12225. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  12226. referencedClasses: [],
  12227. pragmas: [["inlineJS:", ["return \x22\x5cr\x22"]]],
  12228. messageSends: []
  12229. }, function ($methodClass){ return function (){
  12230. var self=this,$self=this;
  12231. return $core.withContext(function($ctx1) {
  12232. return "\r";
  12233. return self;
  12234. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  12235. }; }),
  12236. $globals.String.a$cls);
  12237. $core.addMethod(
  12238. $core.method({
  12239. selector: "crlf",
  12240. protocol: "accessing",
  12241. args: [],
  12242. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  12243. referencedClasses: [],
  12244. pragmas: [["inlineJS:", ["return \x22\x5cr\x5cn\x22"]]],
  12245. messageSends: []
  12246. }, function ($methodClass){ return function (){
  12247. var self=this,$self=this;
  12248. return $core.withContext(function($ctx1) {
  12249. return "\r\n";
  12250. return self;
  12251. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  12252. }; }),
  12253. $globals.String.a$cls);
  12254. $core.addMethod(
  12255. $core.method({
  12256. selector: "esc",
  12257. protocol: "accessing",
  12258. args: [],
  12259. source: "esc\x0a\x09^ self fromCharCode: 27",
  12260. referencedClasses: [],
  12261. pragmas: [],
  12262. messageSends: ["fromCharCode:"]
  12263. }, function ($methodClass){ return function (){
  12264. var self=this,$self=this;
  12265. return $core.withContext(function($ctx1) {
  12266. return $self._fromCharCode_((27));
  12267. }, function($ctx1) {$ctx1.fill(self,"esc",{})});
  12268. }; }),
  12269. $globals.String.a$cls);
  12270. $core.addMethod(
  12271. $core.method({
  12272. selector: "fromCharCode:",
  12273. protocol: "instance creation",
  12274. args: ["anInteger"],
  12275. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  12276. referencedClasses: [],
  12277. pragmas: [["inlineJS:", ["return String.fromCharCode(anInteger)"]]],
  12278. messageSends: []
  12279. }, function ($methodClass){ return function (anInteger){
  12280. var self=this,$self=this;
  12281. return $core.withContext(function($ctx1) {
  12282. return String.fromCharCode(anInteger);
  12283. return self;
  12284. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger})});
  12285. }; }),
  12286. $globals.String.a$cls);
  12287. $core.addMethod(
  12288. $core.method({
  12289. selector: "fromString:",
  12290. protocol: "instance creation",
  12291. args: ["aString"],
  12292. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  12293. referencedClasses: [],
  12294. pragmas: [["inlineJS:", ["return String(aString)"]]],
  12295. messageSends: []
  12296. }, function ($methodClass){ return function (aString){
  12297. var self=this,$self=this;
  12298. return $core.withContext(function($ctx1) {
  12299. return String(aString);
  12300. return self;
  12301. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  12302. }; }),
  12303. $globals.String.a$cls);
  12304. $core.addMethod(
  12305. $core.method({
  12306. selector: "lf",
  12307. protocol: "accessing",
  12308. args: [],
  12309. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  12310. referencedClasses: [],
  12311. pragmas: [["inlineJS:", ["return \x22\x5cn\x22"]]],
  12312. messageSends: []
  12313. }, function ($methodClass){ return function (){
  12314. var self=this,$self=this;
  12315. return $core.withContext(function($ctx1) {
  12316. return "\n";
  12317. return self;
  12318. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  12319. }; }),
  12320. $globals.String.a$cls);
  12321. $core.addMethod(
  12322. $core.method({
  12323. selector: "random",
  12324. protocol: "random",
  12325. args: [],
  12326. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return ((10+22*Math.random())/32).toString(32).slice(2);'>",
  12327. referencedClasses: [],
  12328. pragmas: [["inlineJS:", ["return ((10+22*Math.random())/32).toString(32).slice(2);"]]],
  12329. messageSends: []
  12330. }, function ($methodClass){ return function (){
  12331. var self=this,$self=this;
  12332. return $core.withContext(function($ctx1) {
  12333. return ((10+22*Math.random())/32).toString(32).slice(2);;
  12334. return self;
  12335. }, function($ctx1) {$ctx1.fill(self,"random",{})});
  12336. }; }),
  12337. $globals.String.a$cls);
  12338. $core.addMethod(
  12339. $core.method({
  12340. selector: "randomNotIn:",
  12341. protocol: "random",
  12342. args: ["aString"],
  12343. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  12344. referencedClasses: [],
  12345. pragmas: [],
  12346. messageSends: ["whileTrue", "random", "includesSubString:"]
  12347. }, function ($methodClass){ return function (aString){
  12348. var self=this,$self=this;
  12349. var result;
  12350. return $core.withContext(function($ctx1) {
  12351. $recv((function(){
  12352. return $core.withContext(function($ctx2) {
  12353. result=$self._random();
  12354. return $recv(aString)._includesSubString_(result);
  12355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12356. }))._whileTrue();
  12357. return result;
  12358. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result})});
  12359. }; }),
  12360. $globals.String.a$cls);
  12361. $core.addMethod(
  12362. $core.method({
  12363. selector: "space",
  12364. protocol: "accessing",
  12365. args: [],
  12366. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  12367. referencedClasses: [],
  12368. pragmas: [["inlineJS:", ["return \x22 \x22"]]],
  12369. messageSends: []
  12370. }, function ($methodClass){ return function (){
  12371. var self=this,$self=this;
  12372. return $core.withContext(function($ctx1) {
  12373. return " ";
  12374. return self;
  12375. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  12376. }; }),
  12377. $globals.String.a$cls);
  12378. $core.addMethod(
  12379. $core.method({
  12380. selector: "streamClass",
  12381. protocol: "accessing",
  12382. args: [],
  12383. source: "streamClass\x0a\x09\x09^ StringStream",
  12384. referencedClasses: ["StringStream"],
  12385. pragmas: [],
  12386. messageSends: []
  12387. }, function ($methodClass){ return function (){
  12388. var self=this,$self=this;
  12389. return $globals.StringStream;
  12390. }; }),
  12391. $globals.String.a$cls);
  12392. $core.addMethod(
  12393. $core.method({
  12394. selector: "tab",
  12395. protocol: "accessing",
  12396. args: [],
  12397. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  12398. referencedClasses: [],
  12399. pragmas: [["inlineJS:", ["return \x22\x5ct\x22"]]],
  12400. messageSends: []
  12401. }, function ($methodClass){ return function (){
  12402. var self=this,$self=this;
  12403. return $core.withContext(function($ctx1) {
  12404. return "\t";
  12405. return self;
  12406. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  12407. }; }),
  12408. $globals.String.a$cls);
  12409. $core.addMethod(
  12410. $core.method({
  12411. selector: "value:",
  12412. protocol: "instance creation",
  12413. args: ["aUTFCharCode"],
  12414. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  12415. referencedClasses: [],
  12416. pragmas: [["inlineJS:", ["return String.fromCharCode(aUTFCharCode);"]]],
  12417. messageSends: []
  12418. }, function ($methodClass){ return function (aUTFCharCode){
  12419. var self=this,$self=this;
  12420. return $core.withContext(function($ctx1) {
  12421. return String.fromCharCode(aUTFCharCode);;
  12422. return self;
  12423. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode})});
  12424. }; }),
  12425. $globals.String.a$cls);
  12426. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  12427. $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`.";
  12428. $core.addMethod(
  12429. $core.method({
  12430. selector: "=",
  12431. protocol: "comparing",
  12432. args: ["aCollection"],
  12433. 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",
  12434. referencedClasses: [],
  12435. pragmas: [],
  12436. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  12437. }, function ($methodClass){ return function (aCollection){
  12438. var self=this,$self=this;
  12439. return $core.withContext(function($ctx1) {
  12440. var $early={};
  12441. try {
  12442. if(!$core.assert([$recv([$self._class()
  12443. ,$ctx1.sendIdx["class"]=1
  12444. ][0]).__eq($recv(aCollection)._class())
  12445. ,$ctx1.sendIdx["="]=1
  12446. ][0])){
  12447. return false;
  12448. }
  12449. if(!$core.assert($recv([$self._size()
  12450. ,$ctx1.sendIdx["size"]=1
  12451. ][0]).__eq($recv(aCollection)._size()))){
  12452. return false;
  12453. }
  12454. $self._do_((function(each){
  12455. return $core.withContext(function($ctx2) {
  12456. if(!$core.assert($recv(aCollection)._includes_(each))){
  12457. throw $early=[false];
  12458. }
  12459. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  12460. }));
  12461. return true;
  12462. }
  12463. catch(e) {if(e===$early)return e[0]; throw e}
  12464. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  12465. }; }),
  12466. $globals.Set);
  12467. $core.addMethod(
  12468. $core.method({
  12469. selector: "add:",
  12470. protocol: "adding/removing",
  12471. args: ["anObject"],
  12472. 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 ]",
  12473. referencedClasses: [],
  12474. pragmas: [],
  12475. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  12476. }, function ($methodClass){ return function (anObject){
  12477. var self=this,$self=this;
  12478. var bucket;
  12479. return $core.withContext(function($ctx1) {
  12480. var $1;
  12481. bucket=$self._bucketsOfElement_(anObject);
  12482. $1=$recv(bucket)._second();
  12483. if($1 == null || $1.a$nil){
  12484. var object,slowBucket;
  12485. object=[$recv(bucket)._first()
  12486. ,$ctx1.sendIdx["first"]=1
  12487. ][0];
  12488. slowBucket=$recv(bucket)._third();
  12489. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  12490. return $core.withContext(function($ctx2) {
  12491. $recv(slowBucket)._add_(object);
  12492. $self.size=$recv($self.size).__plus((1));
  12493. return $self.size;
  12494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12495. }));
  12496. return object;
  12497. } else {
  12498. var primitiveBucket;
  12499. primitiveBucket=$1;
  12500. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  12501. }
  12502. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket})});
  12503. }; }),
  12504. $globals.Set);
  12505. $core.addMethod(
  12506. $core.method({
  12507. selector: "add:in:",
  12508. protocol: "private",
  12509. args: ["anObject", "anotherObject"],
  12510. source: "add: anObject in: anotherObject\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) { return anObject; }\x0a\x09\x09$self.size++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09'>",
  12511. referencedClasses: [],
  12512. pragmas: [["inlineJS:", ["\x0a\x09\x09if (anObject in anotherObject.store) { return anObject; }\x0a\x09\x09$self.size++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09"]]],
  12513. messageSends: []
  12514. }, function ($methodClass){ return function (anObject,anotherObject){
  12515. var self=this,$self=this;
  12516. return $core.withContext(function($ctx1) {
  12517. if (anObject in anotherObject.store) { return anObject; }
  12518. $self.size++;
  12519. anotherObject.store[anObject] = true;
  12520. return anObject;
  12521. ;
  12522. return self;
  12523. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject})});
  12524. }; }),
  12525. $globals.Set);
  12526. $core.addMethod(
  12527. $core.method({
  12528. selector: "bucketsOfElement:",
  12529. protocol: "private",
  12530. args: ["anObject"],
  12531. source: "bucketsOfElement: anObject\x0a\x09\x22Find the appropriate bucket for `anObject`.\x0a\x09For optimization purposes, directly answer an array with: \x0a\x09- the object to be store\x0a\x09- the primitive bucket\x0a\x09- the slow bucket\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09// include nil to well-known objects under \x22boolean\x22 fastBucket\x0a\x09\x09if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];\x0a\x09\x09\x0a\x09\x09var prim = anObject.valueOf();\x0a\x09\x09if (typeof prim === \x22object\x22 || typeof prim === \x22function\x22 || !$self.fastBuckets[typeof prim]) {\x0a\x09\x09\x09var bucket = null;\x0a\x09\x09\x09$self.slowBucketStores.some(function (store) {\x0a\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09});\x0a\x09\x09\x09return [ anObject, null, bucket || $self.defaultBucket ];\x0a\x09\x09}\x0a\x09\x09return [ prim, $self.fastBuckets[typeof prim] ];\x0a\x09'>",
  12532. referencedClasses: [],
  12533. pragmas: [["inlineJS:", ["\x0a\x09\x09// include nil to well-known objects under \x22boolean\x22 fastBucket\x0a\x09\x09if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];\x0a\x09\x09\x0a\x09\x09var prim = anObject.valueOf();\x0a\x09\x09if (typeof prim === \x22object\x22 || typeof prim === \x22function\x22 || !$self.fastBuckets[typeof prim]) {\x0a\x09\x09\x09var bucket = null;\x0a\x09\x09\x09$self.slowBucketStores.some(function (store) {\x0a\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09});\x0a\x09\x09\x09return [ anObject, null, bucket || $self.defaultBucket ];\x0a\x09\x09}\x0a\x09\x09return [ prim, $self.fastBuckets[typeof prim] ];\x0a\x09"]]],
  12534. messageSends: []
  12535. }, function ($methodClass){ return function (anObject){
  12536. var self=this,$self=this;
  12537. return $core.withContext(function($ctx1) {
  12538. // include nil to well-known objects under "boolean" fastBucket
  12539. if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];
  12540. var prim = anObject.valueOf();
  12541. if (typeof prim === "object" || typeof prim === "function" || !$self.fastBuckets[typeof prim]) {
  12542. var bucket = null;
  12543. $self.slowBucketStores.some(function (store) {
  12544. return bucket = store._bucketOfElement_(anObject);
  12545. });
  12546. return [ anObject, null, bucket || $self.defaultBucket ];
  12547. }
  12548. return [ prim, $self.fastBuckets[typeof prim] ];
  12549. ;
  12550. return self;
  12551. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject})});
  12552. }; }),
  12553. $globals.Set);
  12554. $core.addMethod(
  12555. $core.method({
  12556. selector: "classNameOf:",
  12557. protocol: "private",
  12558. args: ["anObject"],
  12559. source: "classNameOf: anObject\x0a\x09\x22Answer the class name of `anObject`, or `undefined` \x0a\x09if `anObject` is not an Smalltalk object\x22\x0a\x09\x0a\x09<inlineJS: 'return anObject.a$cls != null && anObject.a$cls.name'>",
  12560. referencedClasses: [],
  12561. pragmas: [["inlineJS:", ["return anObject.a$cls != null && anObject.a$cls.name"]]],
  12562. messageSends: []
  12563. }, function ($methodClass){ return function (anObject){
  12564. var self=this,$self=this;
  12565. return $core.withContext(function($ctx1) {
  12566. return anObject.a$cls != null && anObject.a$cls.name;
  12567. return self;
  12568. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject})});
  12569. }; }),
  12570. $globals.Set);
  12571. $core.addMethod(
  12572. $core.method({
  12573. selector: "collect:",
  12574. protocol: "enumerating",
  12575. args: ["aBlock"],
  12576. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  12577. referencedClasses: [],
  12578. pragmas: [],
  12579. messageSends: ["new", "class", "do:", "add:", "value:"]
  12580. }, function ($methodClass){ return function (aBlock){
  12581. var self=this,$self=this;
  12582. var collection;
  12583. return $core.withContext(function($ctx1) {
  12584. collection=$recv($self._class())._new();
  12585. $self._do_((function(each){
  12586. return $core.withContext(function($ctx2) {
  12587. return $recv(collection)._add_($recv(aBlock)._value_(each));
  12588. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12589. }));
  12590. return collection;
  12591. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection})});
  12592. }; }),
  12593. $globals.Set);
  12594. $core.addMethod(
  12595. $core.method({
  12596. selector: "do:",
  12597. protocol: "enumerating",
  12598. args: ["aBlock"],
  12599. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var el, keys, i;\x0a\x09\x09el = $self.fastBuckets;\x0a\x09\x09keys = Object.keys(el);\x0a\x09\x09for (i = 0; i < keys.length; ++i) {\x0a\x09\x09\x09var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);\x0a\x09\x09\x09if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }\x0a\x09\x09\x09else { store._do_(aBlock); }\x0a\x09\x09}\x0a\x09\x09el = $self.slowBucketStores;\x0a\x09\x09for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }\x0a\x09\x09$self.defaultBucket._do_(aBlock);\x0a\x09'>",
  12600. referencedClasses: [],
  12601. pragmas: [["inlineJS:", ["\x0a\x09\x09var el, keys, i;\x0a\x09\x09el = $self.fastBuckets;\x0a\x09\x09keys = Object.keys(el);\x0a\x09\x09for (i = 0; i < keys.length; ++i) {\x0a\x09\x09\x09var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);\x0a\x09\x09\x09if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }\x0a\x09\x09\x09else { store._do_(aBlock); }\x0a\x09\x09}\x0a\x09\x09el = $self.slowBucketStores;\x0a\x09\x09for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }\x0a\x09\x09$self.defaultBucket._do_(aBlock);\x0a\x09"]]],
  12602. messageSends: []
  12603. }, function ($methodClass){ return function (aBlock){
  12604. var self=this,$self=this;
  12605. return $core.withContext(function($ctx1) {
  12606. var el, keys, i;
  12607. el = $self.fastBuckets;
  12608. keys = Object.keys(el);
  12609. for (i = 0; i < keys.length; ++i) {
  12610. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  12611. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  12612. else { store._do_(aBlock); }
  12613. }
  12614. el = $self.slowBucketStores;
  12615. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  12616. $self.defaultBucket._do_(aBlock);
  12617. ;
  12618. return self;
  12619. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  12620. }; }),
  12621. $globals.Set);
  12622. $core.addMethod(
  12623. $core.method({
  12624. selector: "includes:",
  12625. protocol: "testing",
  12626. args: ["anObject"],
  12627. 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 ]",
  12628. referencedClasses: [],
  12629. pragmas: [],
  12630. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  12631. }, function ($methodClass){ return function (anObject){
  12632. var self=this,$self=this;
  12633. var bucket;
  12634. return $core.withContext(function($ctx1) {
  12635. var $1;
  12636. bucket=$self._bucketsOfElement_(anObject);
  12637. $1=$recv(bucket)._second();
  12638. if($1 == null || $1.a$nil){
  12639. return $recv($recv(bucket)._third())._includes_([$recv(bucket)._first()
  12640. ,$ctx1.sendIdx["first"]=1
  12641. ][0]);
  12642. } else {
  12643. var primitiveBucket;
  12644. primitiveBucket=$1;
  12645. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  12646. }
  12647. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket})});
  12648. }; }),
  12649. $globals.Set);
  12650. $core.addMethod(
  12651. $core.method({
  12652. selector: "includes:in:",
  12653. protocol: "private",
  12654. args: ["anObject", "anotherObject"],
  12655. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  12656. referencedClasses: [],
  12657. pragmas: [["inlineJS:", ["return anObject in anotherObject.store"]]],
  12658. messageSends: []
  12659. }, function ($methodClass){ return function (anObject,anotherObject){
  12660. var self=this,$self=this;
  12661. return $core.withContext(function($ctx1) {
  12662. return anObject in anotherObject.store;
  12663. return self;
  12664. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject})});
  12665. }; }),
  12666. $globals.Set);
  12667. $core.addMethod(
  12668. $core.method({
  12669. selector: "initialize",
  12670. protocol: "initialization",
  12671. args: [],
  12672. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  12673. referencedClasses: [],
  12674. pragmas: [],
  12675. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  12676. }, function ($methodClass){ return function (){
  12677. var self=this,$self=this;
  12678. return $core.withContext(function($ctx1) {
  12679. [(
  12680. $ctx1.supercall = true,
  12681. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  12682. ,$ctx1.supercall = false
  12683. ][0];
  12684. $self.defaultBucket=[];
  12685. $self._initializeSlowBucketStores();
  12686. $self._removeAll();
  12687. return self;
  12688. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  12689. }; }),
  12690. $globals.Set);
  12691. $core.addMethod(
  12692. $core.method({
  12693. selector: "initializeSlowBucketStores",
  12694. protocol: "initialization",
  12695. args: [],
  12696. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  12697. referencedClasses: ["ArrayBucketStore"],
  12698. pragmas: [],
  12699. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  12700. }, function ($methodClass){ return function (){
  12701. var self=this,$self=this;
  12702. return $core.withContext(function($ctx1) {
  12703. $self.slowBucketStores=[[$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  12704. return $core.withContext(function($ctx2) {
  12705. return $self._classNameOf_(x);
  12706. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  12707. }))
  12708. ,$ctx1.sendIdx["hashBlock:"]=1
  12709. ][0],$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  12710. return $core.withContext(function($ctx2) {
  12711. return $self._jsConstructorNameOf_(x);
  12712. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  12713. }))];
  12714. return self;
  12715. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{})});
  12716. }; }),
  12717. $globals.Set);
  12718. $core.addMethod(
  12719. $core.method({
  12720. selector: "jsConstructorNameOf:",
  12721. protocol: "private",
  12722. args: ["anObject"],
  12723. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  12724. referencedClasses: [],
  12725. pragmas: [["inlineJS:", ["return anObject.constructor && anObject.constructor.name"]]],
  12726. messageSends: []
  12727. }, function ($methodClass){ return function (anObject){
  12728. var self=this,$self=this;
  12729. return $core.withContext(function($ctx1) {
  12730. return anObject.constructor && anObject.constructor.name;
  12731. return self;
  12732. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject})});
  12733. }; }),
  12734. $globals.Set);
  12735. $core.addMethod(
  12736. $core.method({
  12737. selector: "printOn:",
  12738. protocol: "printing",
  12739. args: ["aStream"],
  12740. 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: ')'",
  12741. referencedClasses: [],
  12742. pragmas: [],
  12743. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  12744. }, function ($methodClass){ return function (aStream){
  12745. var self=this,$self=this;
  12746. return $core.withContext(function($ctx1) {
  12747. [(
  12748. $ctx1.supercall = true,
  12749. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  12750. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  12751. ][0];
  12752. [$recv(aStream)._nextPutAll_(" (")
  12753. ,$ctx1.sendIdx["nextPutAll:"]=1
  12754. ][0];
  12755. $self._do_separatedBy_((function(each){
  12756. return $core.withContext(function($ctx2) {
  12757. return $recv(each)._printOn_(aStream);
  12758. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12759. }),(function(){
  12760. return $core.withContext(function($ctx2) {
  12761. return [$recv(aStream)._nextPutAll_(" ")
  12762. ,$ctx2.sendIdx["nextPutAll:"]=2
  12763. ][0];
  12764. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12765. }));
  12766. $recv(aStream)._nextPutAll_(")");
  12767. return self;
  12768. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  12769. }; }),
  12770. $globals.Set);
  12771. $core.addMethod(
  12772. $core.method({
  12773. selector: "remove:ifAbsent:",
  12774. protocol: "adding/removing",
  12775. args: ["anObject", "aBlock"],
  12776. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ | obj | obj := bucket first. bucket third remove: obj ifAbsent: [ ^aBlock value ]. size := size - 1. obj ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ifAbsent: aBlock ]",
  12777. referencedClasses: [],
  12778. pragmas: [],
  12779. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "remove:ifAbsent:", "third", "value", "-", "remove:in:ifAbsent:"]
  12780. }, function ($methodClass){ return function (anObject,aBlock){
  12781. var self=this,$self=this;
  12782. var bucket;
  12783. return $core.withContext(function($ctx1) {
  12784. var $1;
  12785. var $early={};
  12786. try {
  12787. bucket=$self._bucketsOfElement_(anObject);
  12788. $1=$recv(bucket)._second();
  12789. if($1 == null || $1.a$nil){
  12790. var obj;
  12791. obj=[$recv(bucket)._first()
  12792. ,$ctx1.sendIdx["first"]=1
  12793. ][0];
  12794. $recv($recv(bucket)._third())._remove_ifAbsent_(obj,(function(){
  12795. return $core.withContext(function($ctx2) {
  12796. throw $early=[$recv(aBlock)._value()];
  12797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12798. }));
  12799. $self.size=$recv($self.size).__minus((1));
  12800. return obj;
  12801. } else {
  12802. var primitiveBucket;
  12803. primitiveBucket=$1;
  12804. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  12805. }
  12806. }
  12807. catch(e) {if(e===$early)return e[0]; throw e}
  12808. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket})});
  12809. }; }),
  12810. $globals.Set);
  12811. $core.addMethod(
  12812. $core.method({
  12813. selector: "remove:in:ifAbsent:",
  12814. protocol: "private",
  12815. args: ["anObject", "anotherObject", "aBlock"],
  12816. source: "remove: anObject in: anotherObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) {\x0a\x09\x09\x09delete anotherObject.store[anObject];\x0a\x09\x09\x09$self.size--;\x0a\x09\x09\x09return anObject;\x0a\x09\x09} else {\x0a\x09\x09\x09return aBlock._value();\x0a\x09\x09}'>",
  12817. referencedClasses: [],
  12818. pragmas: [["inlineJS:", ["\x0a\x09\x09if (anObject in anotherObject.store) {\x0a\x09\x09\x09delete anotherObject.store[anObject];\x0a\x09\x09\x09$self.size--;\x0a\x09\x09\x09return anObject;\x0a\x09\x09} else {\x0a\x09\x09\x09return aBlock._value();\x0a\x09\x09}"]]],
  12819. messageSends: []
  12820. }, function ($methodClass){ return function (anObject,anotherObject,aBlock){
  12821. var self=this,$self=this;
  12822. return $core.withContext(function($ctx1) {
  12823. if (anObject in anotherObject.store) {
  12824. delete anotherObject.store[anObject];
  12825. $self.size--;
  12826. return anObject;
  12827. } else {
  12828. return aBlock._value();
  12829. };
  12830. return self;
  12831. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock})});
  12832. }; }),
  12833. $globals.Set);
  12834. $core.addMethod(
  12835. $core.method({
  12836. selector: "removeAll",
  12837. protocol: "adding/removing",
  12838. args: [],
  12839. source: "removeAll\x0a\x09<inlineJS: '\x0a\x09\x09$self.fastBuckets = {\x0a\x09\x09\x09\x22boolean\x22: { store: Object.create(null), fn: function (x) { return {\x22true\x22: true, \x22false\x22: false, \x22null\x22: null}[x]; } },\x0a\x09\x09\x09\x22number\x22: { store: Object.create(null), fn: Number },\x0a\x09\x09\x09\x22string\x22: { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09$self.slowBucketStores.forEach(function (x) { x._removeAll(); });\x0a\x09\x09$self.defaultBucket._removeAll();\x0a\x09\x09$self.size = 0;\x0a\x09'>",
  12840. referencedClasses: [],
  12841. pragmas: [["inlineJS:", ["\x0a\x09\x09$self.fastBuckets = {\x0a\x09\x09\x09\x22boolean\x22: { store: Object.create(null), fn: function (x) { return {\x22true\x22: true, \x22false\x22: false, \x22null\x22: null}[x]; } },\x0a\x09\x09\x09\x22number\x22: { store: Object.create(null), fn: Number },\x0a\x09\x09\x09\x22string\x22: { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09$self.slowBucketStores.forEach(function (x) { x._removeAll(); });\x0a\x09\x09$self.defaultBucket._removeAll();\x0a\x09\x09$self.size = 0;\x0a\x09"]]],
  12842. messageSends: []
  12843. }, function ($methodClass){ return function (){
  12844. var self=this,$self=this;
  12845. return $core.withContext(function($ctx1) {
  12846. $self.fastBuckets = {
  12847. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  12848. "number": { store: Object.create(null), fn: Number },
  12849. "string": { store: Object.create(null) }
  12850. };
  12851. $self.slowBucketStores.forEach(function (x) { x._removeAll(); });
  12852. $self.defaultBucket._removeAll();
  12853. $self.size = 0;
  12854. ;
  12855. return self;
  12856. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  12857. }; }),
  12858. $globals.Set);
  12859. $core.addMethod(
  12860. $core.method({
  12861. selector: "select:",
  12862. protocol: "enumerating",
  12863. args: ["aBlock"],
  12864. 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",
  12865. referencedClasses: [],
  12866. pragmas: [],
  12867. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  12868. }, function ($methodClass){ return function (aBlock){
  12869. var self=this,$self=this;
  12870. var collection;
  12871. return $core.withContext(function($ctx1) {
  12872. collection=$recv($self._class())._new();
  12873. $self._do_((function(each){
  12874. return $core.withContext(function($ctx2) {
  12875. if($core.assert($recv(aBlock)._value_(each))){
  12876. return $recv(collection)._add_(each);
  12877. }
  12878. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12879. }));
  12880. return collection;
  12881. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection})});
  12882. }; }),
  12883. $globals.Set);
  12884. $core.addMethod(
  12885. $core.method({
  12886. selector: "select:thenCollect:",
  12887. protocol: "enumerating",
  12888. args: ["selectBlock", "collectBlock"],
  12889. 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",
  12890. referencedClasses: [],
  12891. pragmas: [],
  12892. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  12893. }, function ($methodClass){ return function (selectBlock,collectBlock){
  12894. var self=this,$self=this;
  12895. var collection;
  12896. return $core.withContext(function($ctx1) {
  12897. collection=$recv($self._class())._new();
  12898. $self._do_((function(each){
  12899. return $core.withContext(function($ctx2) {
  12900. if($core.assert([$recv(selectBlock)._value_(each)
  12901. ,$ctx2.sendIdx["value:"]=1
  12902. ][0])){
  12903. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  12904. }
  12905. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12906. }));
  12907. return collection;
  12908. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection})});
  12909. }; }),
  12910. $globals.Set);
  12911. $core.addMethod(
  12912. $core.method({
  12913. selector: "size",
  12914. protocol: "accessing",
  12915. args: [],
  12916. source: "size\x0a\x09^ size",
  12917. referencedClasses: [],
  12918. pragmas: [],
  12919. messageSends: []
  12920. }, function ($methodClass){ return function (){
  12921. var self=this,$self=this;
  12922. return $self.size;
  12923. }; }),
  12924. $globals.Set);
  12925. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  12926. $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.";
  12927. $core.addMethod(
  12928. $core.method({
  12929. selector: "<<",
  12930. protocol: "writing",
  12931. args: ["anObject"],
  12932. source: "<< anObject\x0a\x09self write: anObject",
  12933. referencedClasses: [],
  12934. pragmas: [],
  12935. messageSends: ["write:"]
  12936. }, function ($methodClass){ return function (anObject){
  12937. var self=this,$self=this;
  12938. return $core.withContext(function($ctx1) {
  12939. $self._write_(anObject);
  12940. return self;
  12941. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject})});
  12942. }; }),
  12943. $globals.ProtoStream);
  12944. $core.addMethod(
  12945. $core.method({
  12946. selector: "atEnd",
  12947. protocol: "testing",
  12948. args: [],
  12949. source: "atEnd\x0a\x09self subclassResponsibility",
  12950. referencedClasses: [],
  12951. pragmas: [],
  12952. messageSends: ["subclassResponsibility"]
  12953. }, function ($methodClass){ return function (){
  12954. var self=this,$self=this;
  12955. return $core.withContext(function($ctx1) {
  12956. $self._subclassResponsibility();
  12957. return self;
  12958. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  12959. }; }),
  12960. $globals.ProtoStream);
  12961. $core.addMethod(
  12962. $core.method({
  12963. selector: "atStart",
  12964. protocol: "testing",
  12965. args: [],
  12966. source: "atStart\x0a\x09self subclassResponsibility",
  12967. referencedClasses: [],
  12968. pragmas: [],
  12969. messageSends: ["subclassResponsibility"]
  12970. }, function ($methodClass){ return function (){
  12971. var self=this,$self=this;
  12972. return $core.withContext(function($ctx1) {
  12973. $self._subclassResponsibility();
  12974. return self;
  12975. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  12976. }; }),
  12977. $globals.ProtoStream);
  12978. $core.addMethod(
  12979. $core.method({
  12980. selector: "contents",
  12981. protocol: "accessing",
  12982. args: [],
  12983. source: "contents\x0a\x09self subclassResponsibility",
  12984. referencedClasses: [],
  12985. pragmas: [],
  12986. messageSends: ["subclassResponsibility"]
  12987. }, function ($methodClass){ return function (){
  12988. var self=this,$self=this;
  12989. return $core.withContext(function($ctx1) {
  12990. $self._subclassResponsibility();
  12991. return self;
  12992. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  12993. }; }),
  12994. $globals.ProtoStream);
  12995. $core.addMethod(
  12996. $core.method({
  12997. selector: "do:",
  12998. protocol: "enumerating",
  12999. args: ["aBlock"],
  13000. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  13001. referencedClasses: [],
  13002. pragmas: [],
  13003. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  13004. }, function ($methodClass){ return function (aBlock){
  13005. var self=this,$self=this;
  13006. return $core.withContext(function($ctx1) {
  13007. $recv((function(){
  13008. return $core.withContext(function($ctx2) {
  13009. return $self._atEnd();
  13010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13011. }))._whileFalse_((function(){
  13012. return $core.withContext(function($ctx2) {
  13013. return $recv(aBlock)._value_($self._next());
  13014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13015. }));
  13016. return self;
  13017. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  13018. }; }),
  13019. $globals.ProtoStream);
  13020. $core.addMethod(
  13021. $core.method({
  13022. selector: "isEmpty",
  13023. protocol: "testing",
  13024. args: [],
  13025. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  13026. referencedClasses: [],
  13027. pragmas: [],
  13028. messageSends: ["and:", "atStart", "atEnd"]
  13029. }, function ($methodClass){ return function (){
  13030. var self=this,$self=this;
  13031. return $core.withContext(function($ctx1) {
  13032. return $recv($self._atStart())._and_((function(){
  13033. return $core.withContext(function($ctx2) {
  13034. return $self._atEnd();
  13035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13036. }));
  13037. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  13038. }; }),
  13039. $globals.ProtoStream);
  13040. $core.addMethod(
  13041. $core.method({
  13042. selector: "next",
  13043. protocol: "reading",
  13044. args: [],
  13045. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13046. referencedClasses: [],
  13047. pragmas: [],
  13048. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13049. }, function ($methodClass){ return function (){
  13050. var self=this,$self=this;
  13051. return $core.withContext(function($ctx1) {
  13052. if($core.assert($self._atEnd())){
  13053. return nil;
  13054. } else {
  13055. return $self._subclassResponsibility();
  13056. }
  13057. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  13058. }; }),
  13059. $globals.ProtoStream);
  13060. $core.addMethod(
  13061. $core.method({
  13062. selector: "nextPut:",
  13063. protocol: "writing",
  13064. args: ["anObject"],
  13065. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  13066. referencedClasses: [],
  13067. pragmas: [],
  13068. messageSends: ["subclassResponsibility"]
  13069. }, function ($methodClass){ return function (anObject){
  13070. var self=this,$self=this;
  13071. return $core.withContext(function($ctx1) {
  13072. $self._subclassResponsibility();
  13073. return self;
  13074. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  13075. }; }),
  13076. $globals.ProtoStream);
  13077. $core.addMethod(
  13078. $core.method({
  13079. selector: "nextPutAll:",
  13080. protocol: "writing",
  13081. args: ["aCollection"],
  13082. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  13083. referencedClasses: [],
  13084. pragmas: [],
  13085. messageSends: ["do:", "nextPut:"]
  13086. }, function ($methodClass){ return function (aCollection){
  13087. var self=this,$self=this;
  13088. return $core.withContext(function($ctx1) {
  13089. $recv(aCollection)._do_((function(each){
  13090. return $core.withContext(function($ctx2) {
  13091. return $self._nextPut_(each);
  13092. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13093. }));
  13094. return self;
  13095. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection})});
  13096. }; }),
  13097. $globals.ProtoStream);
  13098. $core.addMethod(
  13099. $core.method({
  13100. selector: "nextPutString:",
  13101. protocol: "writing",
  13102. args: ["aString"],
  13103. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  13104. referencedClasses: [],
  13105. pragmas: [],
  13106. messageSends: ["nextPut:"]
  13107. }, function ($methodClass){ return function (aString){
  13108. var self=this,$self=this;
  13109. return $core.withContext(function($ctx1) {
  13110. $self._nextPut_(aString);
  13111. return self;
  13112. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  13113. }; }),
  13114. $globals.ProtoStream);
  13115. $core.addMethod(
  13116. $core.method({
  13117. selector: "peek",
  13118. protocol: "reading",
  13119. args: [],
  13120. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13121. referencedClasses: [],
  13122. pragmas: [],
  13123. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13124. }, function ($methodClass){ return function (){
  13125. var self=this,$self=this;
  13126. return $core.withContext(function($ctx1) {
  13127. if($core.assert($self._atEnd())){
  13128. return nil;
  13129. } else {
  13130. return $self._subclassResponsibility();
  13131. }
  13132. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  13133. }; }),
  13134. $globals.ProtoStream);
  13135. $core.addMethod(
  13136. $core.method({
  13137. selector: "reset",
  13138. protocol: "actions",
  13139. args: [],
  13140. source: "reset\x0a\x09self subclassResponsibility",
  13141. referencedClasses: [],
  13142. pragmas: [],
  13143. messageSends: ["subclassResponsibility"]
  13144. }, function ($methodClass){ return function (){
  13145. var self=this,$self=this;
  13146. return $core.withContext(function($ctx1) {
  13147. $self._subclassResponsibility();
  13148. return self;
  13149. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  13150. }; }),
  13151. $globals.ProtoStream);
  13152. $core.addMethod(
  13153. $core.method({
  13154. selector: "resetContents",
  13155. protocol: "actions",
  13156. args: [],
  13157. source: "resetContents\x0a\x09self subclassResponsibility",
  13158. referencedClasses: [],
  13159. pragmas: [],
  13160. messageSends: ["subclassResponsibility"]
  13161. }, function ($methodClass){ return function (){
  13162. var self=this,$self=this;
  13163. return $core.withContext(function($ctx1) {
  13164. $self._subclassResponsibility();
  13165. return self;
  13166. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  13167. }; }),
  13168. $globals.ProtoStream);
  13169. $core.addMethod(
  13170. $core.method({
  13171. selector: "setToEnd",
  13172. protocol: "positioning",
  13173. args: [],
  13174. source: "setToEnd\x0a\x09self subclassResponsibility",
  13175. referencedClasses: [],
  13176. pragmas: [],
  13177. messageSends: ["subclassResponsibility"]
  13178. }, function ($methodClass){ return function (){
  13179. var self=this,$self=this;
  13180. return $core.withContext(function($ctx1) {
  13181. $self._subclassResponsibility();
  13182. return self;
  13183. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  13184. }; }),
  13185. $globals.ProtoStream);
  13186. $core.addMethod(
  13187. $core.method({
  13188. selector: "setToStart",
  13189. protocol: "positioning",
  13190. args: [],
  13191. source: "setToStart\x0a\x09self reset",
  13192. referencedClasses: [],
  13193. pragmas: [],
  13194. messageSends: ["reset"]
  13195. }, function ($methodClass){ return function (){
  13196. var self=this,$self=this;
  13197. return $core.withContext(function($ctx1) {
  13198. $self._reset();
  13199. return self;
  13200. }, function($ctx1) {$ctx1.fill(self,"setToStart",{})});
  13201. }; }),
  13202. $globals.ProtoStream);
  13203. $core.addMethod(
  13204. $core.method({
  13205. selector: "write:",
  13206. protocol: "writing",
  13207. args: ["anObject"],
  13208. source: "write: anObject\x0a\x09anObject putOn: self",
  13209. referencedClasses: [],
  13210. pragmas: [],
  13211. messageSends: ["putOn:"]
  13212. }, function ($methodClass){ return function (anObject){
  13213. var self=this,$self=this;
  13214. return $core.withContext(function($ctx1) {
  13215. $recv(anObject)._putOn_(self);
  13216. return self;
  13217. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject})});
  13218. }; }),
  13219. $globals.ProtoStream);
  13220. $core.addMethod(
  13221. $core.method({
  13222. selector: "on:",
  13223. protocol: "instance creation",
  13224. args: ["aCollection"],
  13225. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13226. referencedClasses: [],
  13227. pragmas: [],
  13228. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13229. }, function ($methodClass){ return function (aCollection){
  13230. var self=this,$self=this;
  13231. return $core.withContext(function($ctx1) {
  13232. var $1;
  13233. $1=$self._new();
  13234. $recv($1)._setCollection_(aCollection);
  13235. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13236. return $recv($1)._yourself();
  13237. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  13238. }; }),
  13239. $globals.ProtoStream.a$cls);
  13240. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  13241. $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.";
  13242. $core.addMethod(
  13243. $core.method({
  13244. selector: "atEnd",
  13245. protocol: "testing",
  13246. args: [],
  13247. source: "atEnd\x0a\x09^ self position = self size",
  13248. referencedClasses: [],
  13249. pragmas: [],
  13250. messageSends: ["=", "position", "size"]
  13251. }, function ($methodClass){ return function (){
  13252. var self=this,$self=this;
  13253. return $core.withContext(function($ctx1) {
  13254. return $recv($self._position()).__eq($self._size());
  13255. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  13256. }; }),
  13257. $globals.Stream);
  13258. $core.addMethod(
  13259. $core.method({
  13260. selector: "atStart",
  13261. protocol: "testing",
  13262. args: [],
  13263. source: "atStart\x0a\x09^ self position = 0",
  13264. referencedClasses: [],
  13265. pragmas: [],
  13266. messageSends: ["=", "position"]
  13267. }, function ($methodClass){ return function (){
  13268. var self=this,$self=this;
  13269. return $core.withContext(function($ctx1) {
  13270. return $recv($self._position()).__eq((0));
  13271. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  13272. }; }),
  13273. $globals.Stream);
  13274. $core.addMethod(
  13275. $core.method({
  13276. selector: "close",
  13277. protocol: "actions",
  13278. args: [],
  13279. source: "close",
  13280. referencedClasses: [],
  13281. pragmas: [],
  13282. messageSends: []
  13283. }, function ($methodClass){ return function (){
  13284. var self=this,$self=this;
  13285. return self;
  13286. }; }),
  13287. $globals.Stream);
  13288. $core.addMethod(
  13289. $core.method({
  13290. selector: "collection",
  13291. protocol: "accessing",
  13292. args: [],
  13293. source: "collection\x0a\x09^ collection",
  13294. referencedClasses: [],
  13295. pragmas: [],
  13296. messageSends: []
  13297. }, function ($methodClass){ return function (){
  13298. var self=this,$self=this;
  13299. return $self.collection;
  13300. }; }),
  13301. $globals.Stream);
  13302. $core.addMethod(
  13303. $core.method({
  13304. selector: "contents",
  13305. protocol: "accessing",
  13306. args: [],
  13307. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  13308. referencedClasses: [],
  13309. pragmas: [],
  13310. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  13311. }, function ($methodClass){ return function (){
  13312. var self=this,$self=this;
  13313. return $core.withContext(function($ctx1) {
  13314. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  13315. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  13316. }; }),
  13317. $globals.Stream);
  13318. $core.addMethod(
  13319. $core.method({
  13320. selector: "flush",
  13321. protocol: "actions",
  13322. args: [],
  13323. source: "flush",
  13324. referencedClasses: [],
  13325. pragmas: [],
  13326. messageSends: []
  13327. }, function ($methodClass){ return function (){
  13328. var self=this,$self=this;
  13329. return self;
  13330. }; }),
  13331. $globals.Stream);
  13332. $core.addMethod(
  13333. $core.method({
  13334. selector: "isEmpty",
  13335. protocol: "testing",
  13336. args: [],
  13337. source: "isEmpty\x0a\x09^ self size = 0",
  13338. referencedClasses: [],
  13339. pragmas: [],
  13340. messageSends: ["=", "size"]
  13341. }, function ($methodClass){ return function (){
  13342. var self=this,$self=this;
  13343. return $core.withContext(function($ctx1) {
  13344. return $recv($self._size()).__eq((0));
  13345. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  13346. }; }),
  13347. $globals.Stream);
  13348. $core.addMethod(
  13349. $core.method({
  13350. selector: "next",
  13351. protocol: "reading",
  13352. args: [],
  13353. 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 ]",
  13354. referencedClasses: [],
  13355. pragmas: [],
  13356. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  13357. }, function ($methodClass){ return function (){
  13358. var self=this,$self=this;
  13359. return $core.withContext(function($ctx1) {
  13360. if($core.assert($self._atEnd())){
  13361. return nil;
  13362. } else {
  13363. $self._position_($recv([$self._position()
  13364. ,$ctx1.sendIdx["position"]=1
  13365. ][0]).__plus((1)));
  13366. return $recv($self.collection)._at_($self._position());
  13367. }
  13368. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  13369. }; }),
  13370. $globals.Stream);
  13371. $core.addMethod(
  13372. $core.method({
  13373. selector: "next:",
  13374. protocol: "reading",
  13375. args: ["anInteger"],
  13376. 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",
  13377. referencedClasses: [],
  13378. pragmas: [],
  13379. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  13380. }, function ($methodClass){ return function (anInteger){
  13381. var self=this,$self=this;
  13382. var tempCollection;
  13383. return $core.withContext(function($ctx1) {
  13384. tempCollection=$recv($recv($self._collection())._class())._new();
  13385. $recv(anInteger)._timesRepeat_((function(){
  13386. return $core.withContext(function($ctx2) {
  13387. if(!$core.assert($self._atEnd())){
  13388. return $recv(tempCollection)._add_($self._next());
  13389. }
  13390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13391. }));
  13392. return tempCollection;
  13393. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  13394. }; }),
  13395. $globals.Stream);
  13396. $core.addMethod(
  13397. $core.method({
  13398. selector: "nextPut:",
  13399. protocol: "writing",
  13400. args: ["anObject"],
  13401. 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)",
  13402. referencedClasses: [],
  13403. pragmas: [],
  13404. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  13405. }, function ($methodClass){ return function (anObject){
  13406. var self=this,$self=this;
  13407. return $core.withContext(function($ctx1) {
  13408. $self._position_($recv([$self._position()
  13409. ,$ctx1.sendIdx["position"]=1
  13410. ][0]).__plus((1)));
  13411. $recv($self._collection())._at_put_([$self._position()
  13412. ,$ctx1.sendIdx["position"]=2
  13413. ][0],anObject);
  13414. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13415. return self;
  13416. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  13417. }; }),
  13418. $globals.Stream);
  13419. $core.addMethod(
  13420. $core.method({
  13421. selector: "peek",
  13422. protocol: "reading",
  13423. args: [],
  13424. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  13425. referencedClasses: [],
  13426. pragmas: [],
  13427. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  13428. }, function ($methodClass){ return function (){
  13429. var self=this,$self=this;
  13430. return $core.withContext(function($ctx1) {
  13431. if(!$core.assert($self._atEnd())){
  13432. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  13433. }
  13434. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  13435. }; }),
  13436. $globals.Stream);
  13437. $core.addMethod(
  13438. $core.method({
  13439. selector: "position",
  13440. protocol: "accessing",
  13441. args: [],
  13442. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  13443. referencedClasses: [],
  13444. pragmas: [],
  13445. messageSends: ["ifNil:"]
  13446. }, function ($methodClass){ return function (){
  13447. var self=this,$self=this;
  13448. return $core.withContext(function($ctx1) {
  13449. var $1;
  13450. $1=$self.position;
  13451. if($1 == null || $1.a$nil){
  13452. $self.position=(0);
  13453. return $self.position;
  13454. } else {
  13455. return $1;
  13456. }
  13457. }, function($ctx1) {$ctx1.fill(self,"position",{})});
  13458. }; }),
  13459. $globals.Stream);
  13460. $core.addMethod(
  13461. $core.method({
  13462. selector: "position:",
  13463. protocol: "accessing",
  13464. args: ["anInteger"],
  13465. source: "position: anInteger\x0a\x09position := anInteger",
  13466. referencedClasses: [],
  13467. pragmas: [],
  13468. messageSends: []
  13469. }, function ($methodClass){ return function (anInteger){
  13470. var self=this,$self=this;
  13471. $self.position=anInteger;
  13472. return self;
  13473. }; }),
  13474. $globals.Stream);
  13475. $core.addMethod(
  13476. $core.method({
  13477. selector: "reset",
  13478. protocol: "actions",
  13479. args: [],
  13480. source: "reset\x0a\x09self position: 0",
  13481. referencedClasses: [],
  13482. pragmas: [],
  13483. messageSends: ["position:"]
  13484. }, function ($methodClass){ return function (){
  13485. var self=this,$self=this;
  13486. return $core.withContext(function($ctx1) {
  13487. $self._position_((0));
  13488. return self;
  13489. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  13490. }; }),
  13491. $globals.Stream);
  13492. $core.addMethod(
  13493. $core.method({
  13494. selector: "resetContents",
  13495. protocol: "actions",
  13496. args: [],
  13497. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  13498. referencedClasses: [],
  13499. pragmas: [],
  13500. messageSends: ["reset", "setStreamSize:"]
  13501. }, function ($methodClass){ return function (){
  13502. var self=this,$self=this;
  13503. return $core.withContext(function($ctx1) {
  13504. $self._reset();
  13505. $self._setStreamSize_((0));
  13506. return self;
  13507. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  13508. }; }),
  13509. $globals.Stream);
  13510. $core.addMethod(
  13511. $core.method({
  13512. selector: "setCollection:",
  13513. protocol: "accessing",
  13514. args: ["aCollection"],
  13515. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  13516. referencedClasses: [],
  13517. pragmas: [],
  13518. messageSends: []
  13519. }, function ($methodClass){ return function (aCollection){
  13520. var self=this,$self=this;
  13521. $self.collection=aCollection;
  13522. return self;
  13523. }; }),
  13524. $globals.Stream);
  13525. $core.addMethod(
  13526. $core.method({
  13527. selector: "setStreamSize:",
  13528. protocol: "accessing",
  13529. args: ["anInteger"],
  13530. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  13531. referencedClasses: [],
  13532. pragmas: [],
  13533. messageSends: []
  13534. }, function ($methodClass){ return function (anInteger){
  13535. var self=this,$self=this;
  13536. $self.streamSize=anInteger;
  13537. return self;
  13538. }; }),
  13539. $globals.Stream);
  13540. $core.addMethod(
  13541. $core.method({
  13542. selector: "setToEnd",
  13543. protocol: "positioning",
  13544. args: [],
  13545. source: "setToEnd\x0a\x09self position: self size",
  13546. referencedClasses: [],
  13547. pragmas: [],
  13548. messageSends: ["position:", "size"]
  13549. }, function ($methodClass){ return function (){
  13550. var self=this,$self=this;
  13551. return $core.withContext(function($ctx1) {
  13552. $self._position_($self._size());
  13553. return self;
  13554. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  13555. }; }),
  13556. $globals.Stream);
  13557. $core.addMethod(
  13558. $core.method({
  13559. selector: "size",
  13560. protocol: "accessing",
  13561. args: [],
  13562. source: "size\x0a\x09^ self streamSize",
  13563. referencedClasses: [],
  13564. pragmas: [],
  13565. messageSends: ["streamSize"]
  13566. }, function ($methodClass){ return function (){
  13567. var self=this,$self=this;
  13568. return $core.withContext(function($ctx1) {
  13569. return $self._streamSize();
  13570. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  13571. }; }),
  13572. $globals.Stream);
  13573. $core.addMethod(
  13574. $core.method({
  13575. selector: "skip:",
  13576. protocol: "positioning",
  13577. args: ["anInteger"],
  13578. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  13579. referencedClasses: [],
  13580. pragmas: [],
  13581. messageSends: ["position:", "min:max:", "+", "position", "size"]
  13582. }, function ($methodClass){ return function (anInteger){
  13583. var self=this,$self=this;
  13584. return $core.withContext(function($ctx1) {
  13585. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  13586. return self;
  13587. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger})});
  13588. }; }),
  13589. $globals.Stream);
  13590. $core.addMethod(
  13591. $core.method({
  13592. selector: "streamSize",
  13593. protocol: "accessing",
  13594. args: [],
  13595. source: "streamSize\x0a\x09^ streamSize",
  13596. referencedClasses: [],
  13597. pragmas: [],
  13598. messageSends: []
  13599. }, function ($methodClass){ return function (){
  13600. var self=this,$self=this;
  13601. return $self.streamSize;
  13602. }; }),
  13603. $globals.Stream);
  13604. $core.addMethod(
  13605. $core.method({
  13606. selector: "on:",
  13607. protocol: "instance creation",
  13608. args: ["aCollection"],
  13609. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13610. referencedClasses: [],
  13611. pragmas: [],
  13612. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13613. }, function ($methodClass){ return function (aCollection){
  13614. var self=this,$self=this;
  13615. return $core.withContext(function($ctx1) {
  13616. var $1;
  13617. $1=$self._new();
  13618. $recv($1)._setCollection_(aCollection);
  13619. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13620. return $recv($1)._yourself();
  13621. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  13622. }; }),
  13623. $globals.Stream.a$cls);
  13624. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  13625. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  13626. $core.addMethod(
  13627. $core.method({
  13628. selector: "cr",
  13629. protocol: "writing",
  13630. args: [],
  13631. source: "cr\x0a\x09^ self nextPutAll: String cr",
  13632. referencedClasses: ["String"],
  13633. pragmas: [],
  13634. messageSends: ["nextPutAll:", "cr"]
  13635. }, function ($methodClass){ return function (){
  13636. var self=this,$self=this;
  13637. return $core.withContext(function($ctx1) {
  13638. return $self._nextPutAll_($recv($globals.String)._cr());
  13639. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  13640. }; }),
  13641. $globals.StringStream);
  13642. $core.addMethod(
  13643. $core.method({
  13644. selector: "crlf",
  13645. protocol: "writing",
  13646. args: [],
  13647. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  13648. referencedClasses: ["String"],
  13649. pragmas: [],
  13650. messageSends: ["nextPutAll:", "crlf"]
  13651. }, function ($methodClass){ return function (){
  13652. var self=this,$self=this;
  13653. return $core.withContext(function($ctx1) {
  13654. return $self._nextPutAll_($recv($globals.String)._crlf());
  13655. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  13656. }; }),
  13657. $globals.StringStream);
  13658. $core.addMethod(
  13659. $core.method({
  13660. selector: "lf",
  13661. protocol: "writing",
  13662. args: [],
  13663. source: "lf\x0a\x09^ self nextPutAll: String lf",
  13664. referencedClasses: ["String"],
  13665. pragmas: [],
  13666. messageSends: ["nextPutAll:", "lf"]
  13667. }, function ($methodClass){ return function (){
  13668. var self=this,$self=this;
  13669. return $core.withContext(function($ctx1) {
  13670. return $self._nextPutAll_($recv($globals.String)._lf());
  13671. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  13672. }; }),
  13673. $globals.StringStream);
  13674. $core.addMethod(
  13675. $core.method({
  13676. selector: "next:",
  13677. protocol: "reading",
  13678. args: ["anInteger"],
  13679. 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",
  13680. referencedClasses: [],
  13681. pragmas: [],
  13682. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  13683. }, function ($methodClass){ return function (anInteger){
  13684. var self=this,$self=this;
  13685. var tempCollection;
  13686. return $core.withContext(function($ctx1) {
  13687. tempCollection=$recv($recv($self._collection())._class())._new();
  13688. $recv(anInteger)._timesRepeat_((function(){
  13689. return $core.withContext(function($ctx2) {
  13690. if(!$core.assert($self._atEnd())){
  13691. tempCollection=$recv(tempCollection).__comma($self._next());
  13692. return tempCollection;
  13693. }
  13694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13695. }));
  13696. return tempCollection;
  13697. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  13698. }; }),
  13699. $globals.StringStream);
  13700. $core.addMethod(
  13701. $core.method({
  13702. selector: "nextPut:",
  13703. protocol: "writing",
  13704. args: ["aString"],
  13705. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  13706. referencedClasses: [],
  13707. pragmas: [],
  13708. messageSends: ["nextPutAll:"]
  13709. }, function ($methodClass){ return function (aString){
  13710. var self=this,$self=this;
  13711. return $core.withContext(function($ctx1) {
  13712. $self._nextPutAll_(aString);
  13713. return self;
  13714. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString})});
  13715. }; }),
  13716. $globals.StringStream);
  13717. $core.addMethod(
  13718. $core.method({
  13719. selector: "nextPutAll:",
  13720. protocol: "writing",
  13721. args: ["aString"],
  13722. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self position = self collection size 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)",
  13723. referencedClasses: [],
  13724. pragmas: [],
  13725. messageSends: ["ifTrue:ifFalse:", "=", "position", "size", "collection", "setCollection:", ",", "copyFrom:to:", "+", "position:", "setStreamSize:", "max:", "streamSize"]
  13726. }, function ($methodClass){ return function (aString){
  13727. var self=this,$self=this;
  13728. var pre,post;
  13729. return $core.withContext(function($ctx1) {
  13730. if($core.assert($recv([$self._position()
  13731. ,$ctx1.sendIdx["position"]=1
  13732. ][0]).__eq([$recv([$self._collection()
  13733. ,$ctx1.sendIdx["collection"]=1
  13734. ][0])._size()
  13735. ,$ctx1.sendIdx["size"]=1
  13736. ][0]))){
  13737. [$self._setCollection_([$recv([$self._collection()
  13738. ,$ctx1.sendIdx["collection"]=2
  13739. ][0]).__comma(aString)
  13740. ,$ctx1.sendIdx[","]=1
  13741. ][0])
  13742. ,$ctx1.sendIdx["setCollection:"]=1
  13743. ][0];
  13744. } else {
  13745. pre=[$recv([$self._collection()
  13746. ,$ctx1.sendIdx["collection"]=3
  13747. ][0])._copyFrom_to_((1),[$self._position()
  13748. ,$ctx1.sendIdx["position"]=2
  13749. ][0])
  13750. ,$ctx1.sendIdx["copyFrom:to:"]=1
  13751. ][0];
  13752. post=$recv([$self._collection()
  13753. ,$ctx1.sendIdx["collection"]=4
  13754. ][0])._copyFrom_to_([$recv([$recv([$self._position()
  13755. ,$ctx1.sendIdx["position"]=3
  13756. ][0]).__plus((1))
  13757. ,$ctx1.sendIdx["+"]=2
  13758. ][0]).__plus([$recv(aString)._size()
  13759. ,$ctx1.sendIdx["size"]=2
  13760. ][0])
  13761. ,$ctx1.sendIdx["+"]=1
  13762. ][0],[$recv($self._collection())._size()
  13763. ,$ctx1.sendIdx["size"]=3
  13764. ][0]);
  13765. $self._setCollection_([$recv($recv(pre).__comma(aString)).__comma(post)
  13766. ,$ctx1.sendIdx[","]=2
  13767. ][0]);
  13768. }
  13769. $self._position_($recv([$self._position()
  13770. ,$ctx1.sendIdx["position"]=4
  13771. ][0]).__plus($recv(aString)._size()));
  13772. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13773. return self;
  13774. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post})});
  13775. }; }),
  13776. $globals.StringStream);
  13777. $core.addMethod(
  13778. $core.method({
  13779. selector: "nextPutString:",
  13780. protocol: "writing",
  13781. args: ["aString"],
  13782. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  13783. referencedClasses: [],
  13784. pragmas: [],
  13785. messageSends: ["nextPutAll:"]
  13786. }, function ($methodClass){ return function (aString){
  13787. var self=this,$self=this;
  13788. return $core.withContext(function($ctx1) {
  13789. $self._nextPutAll_(aString);
  13790. return self;
  13791. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  13792. }; }),
  13793. $globals.StringStream);
  13794. $core.addMethod(
  13795. $core.method({
  13796. selector: "print:",
  13797. protocol: "writing",
  13798. args: ["anObject"],
  13799. source: "print: anObject\x0a\x09anObject printOn: self",
  13800. referencedClasses: [],
  13801. pragmas: [],
  13802. messageSends: ["printOn:"]
  13803. }, function ($methodClass){ return function (anObject){
  13804. var self=this,$self=this;
  13805. return $core.withContext(function($ctx1) {
  13806. $recv(anObject)._printOn_(self);
  13807. return self;
  13808. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject})});
  13809. }; }),
  13810. $globals.StringStream);
  13811. $core.addMethod(
  13812. $core.method({
  13813. selector: "printSymbol:",
  13814. protocol: "writing",
  13815. args: ["anObject"],
  13816. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  13817. referencedClasses: [],
  13818. pragmas: [],
  13819. messageSends: ["asSymbolPrintOn:"]
  13820. }, function ($methodClass){ return function (anObject){
  13821. var self=this,$self=this;
  13822. return $core.withContext(function($ctx1) {
  13823. $recv(anObject)._asSymbolPrintOn_(self);
  13824. return self;
  13825. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject})});
  13826. }; }),
  13827. $globals.StringStream);
  13828. $core.addMethod(
  13829. $core.method({
  13830. selector: "space",
  13831. protocol: "writing",
  13832. args: [],
  13833. source: "space\x0a\x09self nextPut: ' '",
  13834. referencedClasses: [],
  13835. pragmas: [],
  13836. messageSends: ["nextPut:"]
  13837. }, function ($methodClass){ return function (){
  13838. var self=this,$self=this;
  13839. return $core.withContext(function($ctx1) {
  13840. $self._nextPut_(" ");
  13841. return self;
  13842. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  13843. }; }),
  13844. $globals.StringStream);
  13845. $core.addMethod(
  13846. $core.method({
  13847. selector: "tab",
  13848. protocol: "writing",
  13849. args: [],
  13850. source: "tab\x0a\x09^ self nextPutAll: String tab",
  13851. referencedClasses: ["String"],
  13852. pragmas: [],
  13853. messageSends: ["nextPutAll:", "tab"]
  13854. }, function ($methodClass){ return function (){
  13855. var self=this,$self=this;
  13856. return $core.withContext(function($ctx1) {
  13857. return $self._nextPutAll_($recv($globals.String)._tab());
  13858. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  13859. }; }),
  13860. $globals.StringStream);
  13861. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  13862. $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.";
  13863. $core.addMethod(
  13864. $core.method({
  13865. selector: "initialize",
  13866. protocol: "initialization",
  13867. args: [],
  13868. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  13869. referencedClasses: ["OrderedCollection"],
  13870. pragmas: [],
  13871. messageSends: ["initialize", "new"]
  13872. }, function ($methodClass){ return function (){
  13873. var self=this,$self=this;
  13874. return $core.withContext(function($ctx1) {
  13875. [(
  13876. $ctx1.supercall = true,
  13877. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  13878. ,$ctx1.supercall = false
  13879. ][0];
  13880. $self.read=[$recv($globals.OrderedCollection)._new()
  13881. ,$ctx1.sendIdx["new"]=1
  13882. ][0];
  13883. $self.write=$recv($globals.OrderedCollection)._new();
  13884. $self.readIndex=(1);
  13885. return self;
  13886. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  13887. }; }),
  13888. $globals.Queue);
  13889. $core.addMethod(
  13890. $core.method({
  13891. selector: "next",
  13892. protocol: "accessing",
  13893. args: [],
  13894. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  13895. referencedClasses: [],
  13896. pragmas: [],
  13897. messageSends: ["nextIfAbsent:", "error:"]
  13898. }, function ($methodClass){ return function (){
  13899. var self=this,$self=this;
  13900. return $core.withContext(function($ctx1) {
  13901. return $self._nextIfAbsent_((function(){
  13902. return $core.withContext(function($ctx2) {
  13903. return $self._error_("Cannot read from empty Queue.");
  13904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13905. }));
  13906. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  13907. }; }),
  13908. $globals.Queue);
  13909. $core.addMethod(
  13910. $core.method({
  13911. selector: "nextIfAbsent:",
  13912. protocol: "accessing",
  13913. args: ["aBlock"],
  13914. 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",
  13915. referencedClasses: ["OrderedCollection"],
  13916. pragmas: [],
  13917. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  13918. }, function ($methodClass){ return function (aBlock){
  13919. var self=this,$self=this;
  13920. var result;
  13921. return $core.withContext(function($ctx1) {
  13922. var $early={};
  13923. try {
  13924. result=$recv($self.read)._at_ifAbsent_($self.readIndex,(function(){
  13925. return $core.withContext(function($ctx2) {
  13926. $recv($self.write)._ifEmpty_((function(){
  13927. return $core.withContext(function($ctx3) {
  13928. if($core.assert($recv($self.readIndex).__gt((1)))){
  13929. $self.read=[];
  13930. $self.readIndex=(1);
  13931. $self.readIndex;
  13932. }
  13933. throw $early=[$recv(aBlock)._value()];
  13934. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  13935. }));
  13936. $self.read=$self.write;
  13937. $self.readIndex=(1);
  13938. $self.write=$recv($globals.OrderedCollection)._new();
  13939. return $recv($self.read)._first();
  13940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13941. }));
  13942. $recv($self.read)._at_put_($self.readIndex,nil);
  13943. $self.readIndex=$recv($self.readIndex).__plus((1));
  13944. return result;
  13945. }
  13946. catch(e) {if(e===$early)return e[0]; throw e}
  13947. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result})});
  13948. }; }),
  13949. $globals.Queue);
  13950. $core.addMethod(
  13951. $core.method({
  13952. selector: "nextPut:",
  13953. protocol: "accessing",
  13954. args: ["anObject"],
  13955. source: "nextPut: anObject\x0a\x09write add: anObject",
  13956. referencedClasses: [],
  13957. pragmas: [],
  13958. messageSends: ["add:"]
  13959. }, function ($methodClass){ return function (anObject){
  13960. var self=this,$self=this;
  13961. return $core.withContext(function($ctx1) {
  13962. $recv($self.write)._add_(anObject);
  13963. return self;
  13964. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  13965. }; }),
  13966. $globals.Queue);
  13967. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  13968. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  13969. $core.addMethod(
  13970. $core.method({
  13971. selector: "compile:",
  13972. protocol: "evaluating",
  13973. args: ["aString"],
  13974. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  13975. referencedClasses: [],
  13976. pragmas: [["inlineJS:", ["return self.compile(aString)"]]],
  13977. messageSends: []
  13978. }, function ($methodClass){ return function (aString){
  13979. var self=this,$self=this;
  13980. return $core.withContext(function($ctx1) {
  13981. return self.compile(aString);
  13982. return self;
  13983. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString})});
  13984. }; }),
  13985. $globals.RegularExpression);
  13986. $core.addMethod(
  13987. $core.method({
  13988. selector: "exec:",
  13989. protocol: "evaluating",
  13990. args: ["aString"],
  13991. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  13992. referencedClasses: [],
  13993. pragmas: [["inlineJS:", ["return self.exec(aString) || nil"]]],
  13994. messageSends: []
  13995. }, function ($methodClass){ return function (aString){
  13996. var self=this,$self=this;
  13997. return $core.withContext(function($ctx1) {
  13998. return self.exec(aString) || nil;
  13999. return self;
  14000. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString})});
  14001. }; }),
  14002. $globals.RegularExpression);
  14003. $core.addMethod(
  14004. $core.method({
  14005. selector: "test:",
  14006. protocol: "evaluating",
  14007. args: ["aString"],
  14008. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  14009. referencedClasses: [],
  14010. pragmas: [["inlineJS:", ["return self.test(aString)"]]],
  14011. messageSends: []
  14012. }, function ($methodClass){ return function (aString){
  14013. var self=this,$self=this;
  14014. return $core.withContext(function($ctx1) {
  14015. return self.test(aString);
  14016. return self;
  14017. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString})});
  14018. }; }),
  14019. $globals.RegularExpression);
  14020. $core.addMethod(
  14021. $core.method({
  14022. selector: "fromString:",
  14023. protocol: "instance creation",
  14024. args: ["aString"],
  14025. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  14026. referencedClasses: [],
  14027. pragmas: [],
  14028. messageSends: ["fromString:flag:"]
  14029. }, function ($methodClass){ return function (aString){
  14030. var self=this,$self=this;
  14031. return $core.withContext(function($ctx1) {
  14032. return $self._fromString_flag_(aString,"");
  14033. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  14034. }; }),
  14035. $globals.RegularExpression.a$cls);
  14036. $core.addMethod(
  14037. $core.method({
  14038. selector: "fromString:flag:",
  14039. protocol: "instance creation",
  14040. args: ["aString", "anotherString"],
  14041. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  14042. referencedClasses: [],
  14043. pragmas: [["inlineJS:", ["return new RegExp(aString, anotherString)"]]],
  14044. messageSends: []
  14045. }, function ($methodClass){ return function (aString,anotherString){
  14046. var self=this,$self=this;
  14047. return $core.withContext(function($ctx1) {
  14048. return new RegExp(aString, anotherString);
  14049. return self;
  14050. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString})});
  14051. }; }),
  14052. $globals.RegularExpression.a$cls);
  14053. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  14054. $core.addMethod(
  14055. $core.method({
  14056. selector: "at:",
  14057. protocol: "accessing",
  14058. args: ["anIndex"],
  14059. 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 ]",
  14060. referencedClasses: [],
  14061. pragmas: [],
  14062. messageSends: ["at:ifAbsent:", "errorNotFound"]
  14063. }, function ($methodClass){ return function (anIndex){
  14064. var self=this,$self=this;
  14065. return $core.withContext(function($ctx1) {
  14066. return $self._at_ifAbsent_(anIndex,(function(){
  14067. return $core.withContext(function($ctx2) {
  14068. return $self._errorNotFound();
  14069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14070. }));
  14071. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex})});
  14072. }; }),
  14073. $globals.TKeyValueCollection);
  14074. $core.addMethod(
  14075. $core.method({
  14076. selector: "at:ifAbsent:",
  14077. protocol: "accessing",
  14078. args: ["anIndex", "aBlock"],
  14079. 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",
  14080. referencedClasses: [],
  14081. pragmas: [],
  14082. messageSends: ["subclassResponsibility"]
  14083. }, function ($methodClass){ return function (anIndex,aBlock){
  14084. var self=this,$self=this;
  14085. return $core.withContext(function($ctx1) {
  14086. $self._subclassResponsibility();
  14087. return self;
  14088. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  14089. }; }),
  14090. $globals.TKeyValueCollection);
  14091. $core.addMethod(
  14092. $core.method({
  14093. selector: "at:ifAbsentPut:",
  14094. protocol: "accessing",
  14095. args: ["aKey", "aBlock"],
  14096. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  14097. referencedClasses: [],
  14098. pragmas: [],
  14099. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  14100. }, function ($methodClass){ return function (aKey,aBlock){
  14101. var self=this,$self=this;
  14102. return $core.withContext(function($ctx1) {
  14103. return $self._at_ifAbsent_(aKey,(function(){
  14104. return $core.withContext(function($ctx2) {
  14105. return $self._at_put_(aKey,$recv(aBlock)._value());
  14106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14107. }));
  14108. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock})});
  14109. }; }),
  14110. $globals.TKeyValueCollection);
  14111. $core.addMethod(
  14112. $core.method({
  14113. selector: "at:ifPresent:",
  14114. protocol: "accessing",
  14115. args: ["anIndex", "aBlock"],
  14116. 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 ]",
  14117. referencedClasses: [],
  14118. pragmas: [],
  14119. messageSends: ["at:ifPresent:ifAbsent:"]
  14120. }, function ($methodClass){ return function (anIndex,aBlock){
  14121. var self=this,$self=this;
  14122. return $core.withContext(function($ctx1) {
  14123. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  14124. return nil;
  14125. }));
  14126. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock})});
  14127. }; }),
  14128. $globals.TKeyValueCollection);
  14129. $core.addMethod(
  14130. $core.method({
  14131. selector: "at:ifPresent:ifAbsent:",
  14132. protocol: "accessing",
  14133. args: ["anIndex", "aBlock", "anotherBlock"],
  14134. 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",
  14135. referencedClasses: [],
  14136. pragmas: [],
  14137. messageSends: ["subclassResponsibility"]
  14138. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  14139. var self=this,$self=this;
  14140. return $core.withContext(function($ctx1) {
  14141. $self._subclassResponsibility();
  14142. return self;
  14143. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  14144. }; }),
  14145. $globals.TKeyValueCollection);
  14146. $core.addMethod(
  14147. $core.method({
  14148. selector: "at:put:",
  14149. protocol: "accessing",
  14150. args: ["anIndex", "anObject"],
  14151. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  14152. referencedClasses: [],
  14153. pragmas: [],
  14154. messageSends: ["subclassResponsibility"]
  14155. }, function ($methodClass){ return function (anIndex,anObject){
  14156. var self=this,$self=this;
  14157. return $core.withContext(function($ctx1) {
  14158. $self._subclassResponsibility();
  14159. return self;
  14160. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  14161. }; }),
  14162. $globals.TKeyValueCollection);
  14163. $core.addMethod(
  14164. $core.method({
  14165. selector: "indexOf:",
  14166. protocol: "accessing",
  14167. args: ["anObject"],
  14168. 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 ]",
  14169. referencedClasses: [],
  14170. pragmas: [],
  14171. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  14172. }, function ($methodClass){ return function (anObject){
  14173. var self=this,$self=this;
  14174. return $core.withContext(function($ctx1) {
  14175. return $self._indexOf_ifAbsent_(anObject,(function(){
  14176. return $core.withContext(function($ctx2) {
  14177. return $self._errorNotFound();
  14178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14179. }));
  14180. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject})});
  14181. }; }),
  14182. $globals.TKeyValueCollection);
  14183. $core.addMethod(
  14184. $core.method({
  14185. selector: "indexOf:ifAbsent:",
  14186. protocol: "accessing",
  14187. args: ["anObject", "aBlock"],
  14188. 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",
  14189. referencedClasses: [],
  14190. pragmas: [],
  14191. messageSends: ["subclassResponsibility"]
  14192. }, function ($methodClass){ return function (anObject,aBlock){
  14193. var self=this,$self=this;
  14194. return $core.withContext(function($ctx1) {
  14195. $self._subclassResponsibility();
  14196. return self;
  14197. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  14198. }; }),
  14199. $globals.TKeyValueCollection);
  14200. $core.addMethod(
  14201. $core.method({
  14202. selector: "with:do:",
  14203. protocol: "enumerating",
  14204. args: ["anotherCollection", "aBlock"],
  14205. 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) ]",
  14206. referencedClasses: [],
  14207. pragmas: [],
  14208. messageSends: ["withIndexDo:", "value:value:", "at:"]
  14209. }, function ($methodClass){ return function (anotherCollection,aBlock){
  14210. var self=this,$self=this;
  14211. return $core.withContext(function($ctx1) {
  14212. $self._withIndexDo_((function(each,index){
  14213. return $core.withContext(function($ctx2) {
  14214. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  14215. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  14216. }));
  14217. return self;
  14218. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  14219. }; }),
  14220. $globals.TKeyValueCollection);
  14221. $core.addMethod(
  14222. $core.method({
  14223. selector: "withIndexDo:",
  14224. protocol: "enumerating",
  14225. args: ["aBlock"],
  14226. 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",
  14227. referencedClasses: [],
  14228. pragmas: [],
  14229. messageSends: ["subclassResponsibility"]
  14230. }, function ($methodClass){ return function (aBlock){
  14231. var self=this,$self=this;
  14232. return $core.withContext(function($ctx1) {
  14233. $self._subclassResponsibility();
  14234. return self;
  14235. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  14236. }; }),
  14237. $globals.TKeyValueCollection);
  14238. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  14239. $core.addMethod(
  14240. $core.method({
  14241. selector: "at:ifAbsent:",
  14242. protocol: "accessing",
  14243. args: ["anIndex", "aBlock"],
  14244. 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'>",
  14245. referencedClasses: [],
  14246. pragmas: [["inlineJS:", ["\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09"]]],
  14247. messageSends: []
  14248. }, function ($methodClass){ return function (anIndex,aBlock){
  14249. var self=this,$self=this;
  14250. return $core.withContext(function($ctx1) {
  14251. return anIndex >= 1 && anIndex <= self.length
  14252. ? self[anIndex - 1]
  14253. : aBlock._value()
  14254. ;
  14255. return self;
  14256. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  14257. }; }),
  14258. $globals.TNativeZeroBasedCollection);
  14259. $core.addMethod(
  14260. $core.method({
  14261. selector: "at:ifPresent:ifAbsent:",
  14262. protocol: "accessing",
  14263. args: ["anIndex", "aBlock", "anotherBlock"],
  14264. 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'>",
  14265. referencedClasses: [],
  14266. pragmas: [["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"]]],
  14267. messageSends: []
  14268. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  14269. var self=this,$self=this;
  14270. return $core.withContext(function($ctx1) {
  14271. return anIndex >= 1 && anIndex <= self.length
  14272. ? aBlock._value_(self[anIndex - 1])
  14273. : anotherBlock._value()
  14274. ;
  14275. return self;
  14276. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  14277. }; }),
  14278. $globals.TNativeZeroBasedCollection);
  14279. $core.addMethod(
  14280. $core.method({
  14281. selector: "detect:ifNone:",
  14282. protocol: "enumerating",
  14283. args: ["aBlock", "anotherBlock"],
  14284. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09'>",
  14285. referencedClasses: [],
  14286. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09"]]],
  14287. messageSends: []
  14288. }, function ($methodClass){ return function (aBlock,anotherBlock){
  14289. var self=this,$self=this;
  14290. return $core.withContext(function($ctx1) {
  14291. for(var i = 0; i < self.length; i++)
  14292. if(aBlock._value_(self[i]))
  14293. return self[i];
  14294. return anotherBlock._value();
  14295. ;
  14296. return self;
  14297. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  14298. }; }),
  14299. $globals.TNativeZeroBasedCollection);
  14300. $core.addMethod(
  14301. $core.method({
  14302. selector: "do:",
  14303. protocol: "enumerating",
  14304. args: ["aBlock"],
  14305. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09'>",
  14306. referencedClasses: [],
  14307. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09"]]],
  14308. messageSends: []
  14309. }, function ($methodClass){ return function (aBlock){
  14310. var self=this,$self=this;
  14311. return $core.withContext(function($ctx1) {
  14312. for(var i=0; i < self.length; i++) {
  14313. aBlock._value_(self[i]);
  14314. }
  14315. ;
  14316. return self;
  14317. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  14318. }; }),
  14319. $globals.TNativeZeroBasedCollection);
  14320. $core.addMethod(
  14321. $core.method({
  14322. selector: "indexOf:ifAbsent:",
  14323. protocol: "accessing",
  14324. args: ["anObject", "aBlock"],
  14325. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  14326. referencedClasses: [],
  14327. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09"]]],
  14328. messageSends: []
  14329. }, function ($methodClass){ return function (anObject,aBlock){
  14330. var self=this,$self=this;
  14331. return $core.withContext(function($ctx1) {
  14332. for(var i=0; i < self.length; i++) {
  14333. if($recv(self[i]).__eq(anObject)) {return i+1}
  14334. };
  14335. return aBlock._value();
  14336. ;
  14337. return self;
  14338. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  14339. }; }),
  14340. $globals.TNativeZeroBasedCollection);
  14341. $core.addMethod(
  14342. $core.method({
  14343. selector: "indexOf:startingAt:ifAbsent:",
  14344. protocol: "accessing",
  14345. args: ["anObject", "start", "aBlock"],
  14346. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  14347. referencedClasses: [],
  14348. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09"]]],
  14349. messageSends: []
  14350. }, function ($methodClass){ return function (anObject,start,aBlock){
  14351. var self=this,$self=this;
  14352. return $core.withContext(function($ctx1) {
  14353. for(var i=start - 1; i < self.length; i++){
  14354. if($recv(self[i]).__eq(anObject)) {return i+1}
  14355. }
  14356. return aBlock._value();
  14357. ;
  14358. return self;
  14359. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  14360. }; }),
  14361. $globals.TNativeZeroBasedCollection);
  14362. $core.addMethod(
  14363. $core.method({
  14364. selector: "single",
  14365. protocol: "accessing",
  14366. args: [],
  14367. 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'>",
  14368. referencedClasses: [],
  14369. pragmas: [["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];"]]],
  14370. messageSends: []
  14371. }, function ($methodClass){ return function (){
  14372. var self=this,$self=this;
  14373. return $core.withContext(function($ctx1) {
  14374. if (self.length == 0) throw new Error("Collection is empty");
  14375. if (self.length > 1) throw new Error("Collection holds more than one element.");
  14376. return self[0];;
  14377. return self;
  14378. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  14379. }; }),
  14380. $globals.TNativeZeroBasedCollection);
  14381. $core.addMethod(
  14382. $core.method({
  14383. selector: "size",
  14384. protocol: "accessing",
  14385. args: [],
  14386. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  14387. referencedClasses: [],
  14388. pragmas: [["inlineJS:", ["return self.length"]]],
  14389. messageSends: []
  14390. }, function ($methodClass){ return function (){
  14391. var self=this,$self=this;
  14392. return $core.withContext(function($ctx1) {
  14393. return self.length;
  14394. return self;
  14395. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  14396. }; }),
  14397. $globals.TNativeZeroBasedCollection);
  14398. $core.addMethod(
  14399. $core.method({
  14400. selector: "with:do:",
  14401. protocol: "enumerating",
  14402. args: ["anotherCollection", "aBlock"],
  14403. source: "with: anotherCollection do: aBlock\x0a\x09<inlineJS: '\x0a\x09 $recv(anotherCollection)._first_(0); // #guardSequenceableCollection\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09'>",
  14404. referencedClasses: [],
  14405. pragmas: [["inlineJS:", ["\x0a\x09 $recv(anotherCollection)._first_(0); // #guardSequenceableCollection\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09"]]],
  14406. messageSends: []
  14407. }, function ($methodClass){ return function (anotherCollection,aBlock){
  14408. var self=this,$self=this;
  14409. return $core.withContext(function($ctx1) {
  14410. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  14411. for(var i=0; i<self.length; i++) {
  14412. aBlock._value_value_(self[i], anotherCollection[i]);
  14413. }
  14414. ;
  14415. return self;
  14416. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  14417. }; }),
  14418. $globals.TNativeZeroBasedCollection);
  14419. $core.addMethod(
  14420. $core.method({
  14421. selector: "withIndexDo:",
  14422. protocol: "enumerating",
  14423. args: ["aBlock"],
  14424. source: "withIndexDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09'>",
  14425. referencedClasses: [],
  14426. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09"]]],
  14427. messageSends: []
  14428. }, function ($methodClass){ return function (aBlock){
  14429. var self=this,$self=this;
  14430. return $core.withContext(function($ctx1) {
  14431. for(var i=0; i < self.length; i++) {
  14432. aBlock._value_value_(self[i], i+1);
  14433. }
  14434. ;
  14435. return self;
  14436. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  14437. }; }),
  14438. $globals.TNativeZeroBasedCollection);
  14439. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  14440. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  14441. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  14442. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  14443. });
  14444. define('amber/core/Kernel-Classes',["amber/boot", "require", "amber/core/Kernel-Collections", "amber/core/Kernel-Helpers", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  14445. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  14446. var $pkg = $core.addPackage("Kernel-Classes");
  14447. $pkg.innerEval = function (expr) { return eval(expr); };
  14448. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  14449. $core.addClass("Behavior", $globals.Object, ["organization", "slots", "fn", "superclass"], "Kernel-Classes");
  14450. $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.";
  14451. $core.addMethod(
  14452. $core.method({
  14453. selector: "allInstanceVariableNames",
  14454. protocol: "accessing",
  14455. args: [],
  14456. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  14457. referencedClasses: [],
  14458. pragmas: [],
  14459. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  14460. }, function ($methodClass){ return function (){
  14461. var self=this,$self=this;
  14462. var result;
  14463. return $core.withContext(function($ctx1) {
  14464. var $1;
  14465. result=$recv($self._instanceVariableNames())._copy();
  14466. $1=[$self._superclass()
  14467. ,$ctx1.sendIdx["superclass"]=1
  14468. ][0];
  14469. if($1 == null || $1.a$nil){
  14470. $1;
  14471. } else {
  14472. $recv(result)._addAll_($recv($self._superclass())._allInstanceVariableNames());
  14473. }
  14474. return result;
  14475. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result})});
  14476. }; }),
  14477. $globals.Behavior);
  14478. $core.addMethod(
  14479. $core.method({
  14480. selector: "allSelectors",
  14481. protocol: "accessing",
  14482. args: [],
  14483. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  14484. referencedClasses: [],
  14485. pragmas: [],
  14486. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  14487. }, function ($methodClass){ return function (){
  14488. var self=this,$self=this;
  14489. return $core.withContext(function($ctx1) {
  14490. return $recv($self._allSuperclasses())._inject_into_([$self._selectors()
  14491. ,$ctx1.sendIdx["selectors"]=1
  14492. ][0],(function(acc,each){
  14493. return $core.withContext(function($ctx2) {
  14494. $recv(acc)._addAll_($recv(each)._selectors());
  14495. return $recv(acc)._yourself();
  14496. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  14497. }));
  14498. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{})});
  14499. }; }),
  14500. $globals.Behavior);
  14501. $core.addMethod(
  14502. $core.method({
  14503. selector: "allSubclasses",
  14504. protocol: "accessing",
  14505. args: [],
  14506. 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 ] ]",
  14507. referencedClasses: ["Array"],
  14508. pragmas: [],
  14509. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  14510. }, function ($methodClass){ return function (){
  14511. var self=this,$self=this;
  14512. return $core.withContext(function($ctx1) {
  14513. return $recv($globals.Array)._streamContents_((function(str){
  14514. return $core.withContext(function($ctx2) {
  14515. return $self._allSubclassesDo_((function(each){
  14516. return $core.withContext(function($ctx3) {
  14517. return $recv(str)._nextPut_(each);
  14518. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14519. }));
  14520. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  14521. }));
  14522. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{})});
  14523. }; }),
  14524. $globals.Behavior);
  14525. $core.addMethod(
  14526. $core.method({
  14527. selector: "allSubclassesDo:",
  14528. protocol: "enumerating",
  14529. args: ["aBlock"],
  14530. 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})'>",
  14531. referencedClasses: [],
  14532. pragmas: [["inlineJS:", ["$core.traverseClassTree(self, function(subclass) {\x0a\x09if (subclass !== self) aBlock._value_(subclass);\x0a})"]]],
  14533. messageSends: []
  14534. }, function ($methodClass){ return function (aBlock){
  14535. var self=this,$self=this;
  14536. return $core.withContext(function($ctx1) {
  14537. $core.traverseClassTree(self, function(subclass) {
  14538. if (subclass !== self) aBlock._value_(subclass);
  14539. });
  14540. return self;
  14541. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock})});
  14542. }; }),
  14543. $globals.Behavior);
  14544. $core.addMethod(
  14545. $core.method({
  14546. selector: "allSuperclasses",
  14547. protocol: "accessing",
  14548. args: [],
  14549. source: "allSuperclasses\x0a\x09\x0a\x09self superclass ifNil: [ ^ #() ].\x0a\x09\x0a\x09^ self superclass allSuperclasses copyWithFirst: self superclass",
  14550. referencedClasses: [],
  14551. pragmas: [],
  14552. messageSends: ["ifNil:", "superclass", "copyWithFirst:", "allSuperclasses"]
  14553. }, function ($methodClass){ return function (){
  14554. var self=this,$self=this;
  14555. return $core.withContext(function($ctx1) {
  14556. var $1;
  14557. $1=[$self._superclass()
  14558. ,$ctx1.sendIdx["superclass"]=1
  14559. ][0];
  14560. if($1 == null || $1.a$nil){
  14561. return [];
  14562. } else {
  14563. $1;
  14564. }
  14565. return $recv($recv([$self._superclass()
  14566. ,$ctx1.sendIdx["superclass"]=2
  14567. ][0])._allSuperclasses())._copyWithFirst_($self._superclass());
  14568. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{})});
  14569. }; }),
  14570. $globals.Behavior);
  14571. $core.addMethod(
  14572. $core.method({
  14573. selector: "alternateConstructorViaSelector:",
  14574. protocol: "instance creation",
  14575. args: ["aSelector"],
  14576. source: "alternateConstructorViaSelector: aSelector\x0a\x09^ BlockClosure\x0a\x09\x09javaScriptConstructorFor: self prototype\x0a\x09\x09initializingVia: (self >> aSelector) fn",
  14577. referencedClasses: ["BlockClosure"],
  14578. pragmas: [],
  14579. messageSends: ["javaScriptConstructorFor:initializingVia:", "prototype", "fn", ">>"]
  14580. }, function ($methodClass){ return function (aSelector){
  14581. var self=this,$self=this;
  14582. return $core.withContext(function($ctx1) {
  14583. return $recv($globals.BlockClosure)._javaScriptConstructorFor_initializingVia_($self._prototype(),$recv($self.__gt_gt(aSelector))._fn());
  14584. }, function($ctx1) {$ctx1.fill(self,"alternateConstructorViaSelector:",{aSelector:aSelector})});
  14585. }; }),
  14586. $globals.Behavior);
  14587. $core.addMethod(
  14588. $core.method({
  14589. selector: "applySuperConstructorOn:withArguments:",
  14590. protocol: "accessing",
  14591. args: ["anObject", "anArray"],
  14592. source: "applySuperConstructorOn: anObject withArguments: anArray\x0a\x09<inlineJS: '\x0a\x09\x09Object.getPrototypeOf($self.fn.prototype).constructor\x0a\x09\x09.apply(anObject, anArray)\x0a\x09'>",
  14593. referencedClasses: [],
  14594. pragmas: [["inlineJS:", ["\x0a\x09\x09Object.getPrototypeOf($self.fn.prototype).constructor\x0a\x09\x09.apply(anObject, anArray)\x0a\x09"]]],
  14595. messageSends: []
  14596. }, function ($methodClass){ return function (anObject,anArray){
  14597. var self=this,$self=this;
  14598. return $core.withContext(function($ctx1) {
  14599. Object.getPrototypeOf($self.fn.prototype).constructor
  14600. .apply(anObject, anArray)
  14601. ;
  14602. return self;
  14603. }, function($ctx1) {$ctx1.fill(self,"applySuperConstructorOn:withArguments:",{anObject:anObject,anArray:anArray})});
  14604. }; }),
  14605. $globals.Behavior);
  14606. $core.addMethod(
  14607. $core.method({
  14608. selector: "basicNew",
  14609. protocol: "instance creation",
  14610. args: [],
  14611. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  14612. referencedClasses: [],
  14613. pragmas: [["inlineJS:", ["return new self.fn()"]]],
  14614. messageSends: []
  14615. }, function ($methodClass){ return function (){
  14616. var self=this,$self=this;
  14617. return $core.withContext(function($ctx1) {
  14618. return new self.fn();
  14619. return self;
  14620. }, function($ctx1) {$ctx1.fill(self,"basicNew",{})});
  14621. }; }),
  14622. $globals.Behavior);
  14623. $core.addMethod(
  14624. $core.method({
  14625. selector: "basicOrganization",
  14626. protocol: "accessing",
  14627. args: [],
  14628. source: "basicOrganization\x0a\x09^ organization",
  14629. referencedClasses: [],
  14630. pragmas: [],
  14631. messageSends: []
  14632. }, function ($methodClass){ return function (){
  14633. var self=this,$self=this;
  14634. return $self.organization;
  14635. }; }),
  14636. $globals.Behavior);
  14637. $core.addMethod(
  14638. $core.method({
  14639. selector: "basicOrganization:",
  14640. protocol: "accessing",
  14641. args: ["aClassOrganizer"],
  14642. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  14643. referencedClasses: [],
  14644. pragmas: [],
  14645. messageSends: []
  14646. }, function ($methodClass){ return function (aClassOrganizer){
  14647. var self=this,$self=this;
  14648. $self.organization=aClassOrganizer;
  14649. return self;
  14650. }; }),
  14651. $globals.Behavior);
  14652. $core.addMethod(
  14653. $core.method({
  14654. selector: "beJavaScriptSubclassOf:",
  14655. protocol: "accessing",
  14656. args: ["aJavaScriptFunction"],
  14657. source: "beJavaScriptSubclassOf: aJavaScriptFunction\x0a\x09\x22Reparent the JS constructor's prototype to aJavaScriptFunction's one,\x0a\x09plus bookkeeping. That way I stay part of (simulated) Smalltalk hierarchy,\x0a\x09but my instances will physically be instanceof aJavaScriptFunction.\x22\x0a\x0a\x09self makeJavaScriptConstructorSubclassOf: aJavaScriptFunction.\x0a\x09Smalltalk core detachClass: self",
  14658. referencedClasses: ["Smalltalk"],
  14659. pragmas: [],
  14660. messageSends: ["makeJavaScriptConstructorSubclassOf:", "detachClass:", "core"]
  14661. }, function ($methodClass){ return function (aJavaScriptFunction){
  14662. var self=this,$self=this;
  14663. return $core.withContext(function($ctx1) {
  14664. $self._makeJavaScriptConstructorSubclassOf_(aJavaScriptFunction);
  14665. $recv($recv($globals.Smalltalk)._core())._detachClass_(self);
  14666. return self;
  14667. }, function($ctx1) {$ctx1.fill(self,"beJavaScriptSubclassOf:",{aJavaScriptFunction:aJavaScriptFunction})});
  14668. }; }),
  14669. $globals.Behavior);
  14670. $core.addMethod(
  14671. $core.method({
  14672. selector: "canUnderstand:",
  14673. protocol: "testing",
  14674. args: ["aSelector"],
  14675. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass ifNil: [ false ] ifNotNil: [ :superClass | superClass canUnderstand: aSelector ]]",
  14676. referencedClasses: [],
  14677. pragmas: [],
  14678. messageSends: ["or:", "includesSelector:", "asString", "ifNil:ifNotNil:", "superclass", "canUnderstand:"]
  14679. }, function ($methodClass){ return function (aSelector){
  14680. var self=this,$self=this;
  14681. return $core.withContext(function($ctx1) {
  14682. var $1;
  14683. return $recv($self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  14684. return $core.withContext(function($ctx2) {
  14685. $1=$self._superclass();
  14686. if($1 == null || $1.a$nil){
  14687. return false;
  14688. } else {
  14689. var superClass;
  14690. superClass=$1;
  14691. return $recv(superClass)._canUnderstand_(aSelector);
  14692. }
  14693. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14694. }));
  14695. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector})});
  14696. }; }),
  14697. $globals.Behavior);
  14698. $core.addMethod(
  14699. $core.method({
  14700. selector: "includesBehavior:",
  14701. protocol: "testing",
  14702. args: ["aClass"],
  14703. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  14704. referencedClasses: [],
  14705. pragmas: [],
  14706. messageSends: ["or:", "==", "inheritsFrom:"]
  14707. }, function ($methodClass){ return function (aClass){
  14708. var self=this,$self=this;
  14709. return $core.withContext(function($ctx1) {
  14710. return $recv($self.__eq_eq(aClass))._or_((function(){
  14711. return $core.withContext(function($ctx2) {
  14712. return $self._inheritsFrom_(aClass);
  14713. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14714. }));
  14715. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass})});
  14716. }; }),
  14717. $globals.Behavior);
  14718. $core.addMethod(
  14719. $core.method({
  14720. selector: "inheritsFrom:",
  14721. protocol: "testing",
  14722. args: ["aClass"],
  14723. source: "inheritsFrom: aClass\x0a\x09^ self superclass\x0a\x09\x09ifNil: [ false ]\x0a\x09\x09ifNotNil: [ :superClass | superClass includesBehavior: aClass ]",
  14724. referencedClasses: [],
  14725. pragmas: [],
  14726. messageSends: ["ifNil:ifNotNil:", "superclass", "includesBehavior:"]
  14727. }, function ($methodClass){ return function (aClass){
  14728. var self=this,$self=this;
  14729. return $core.withContext(function($ctx1) {
  14730. var $1;
  14731. $1=$self._superclass();
  14732. if($1 == null || $1.a$nil){
  14733. return false;
  14734. } else {
  14735. var superClass;
  14736. superClass=$1;
  14737. return $recv(superClass)._includesBehavior_(aClass);
  14738. }
  14739. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass})});
  14740. }; }),
  14741. $globals.Behavior);
  14742. $core.addMethod(
  14743. $core.method({
  14744. selector: "instanceVariableNames",
  14745. protocol: "accessing",
  14746. args: [],
  14747. source: "instanceVariableNames\x0a\x09^ slots",
  14748. referencedClasses: [],
  14749. pragmas: [],
  14750. messageSends: []
  14751. }, function ($methodClass){ return function (){
  14752. var self=this,$self=this;
  14753. return $self.slots;
  14754. }; }),
  14755. $globals.Behavior);
  14756. $core.addMethod(
  14757. $core.method({
  14758. selector: "isBehavior",
  14759. protocol: "testing",
  14760. args: [],
  14761. source: "isBehavior\x0a\x09^ true",
  14762. referencedClasses: [],
  14763. pragmas: [],
  14764. messageSends: []
  14765. }, function ($methodClass){ return function (){
  14766. var self=this,$self=this;
  14767. return true;
  14768. }; }),
  14769. $globals.Behavior);
  14770. $core.addMethod(
  14771. $core.method({
  14772. selector: "javaScriptConstructor",
  14773. protocol: "accessing",
  14774. args: [],
  14775. source: "javaScriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See kernel-language.js\x22\x0a\x09\x0a\x09^ fn",
  14776. referencedClasses: [],
  14777. pragmas: [],
  14778. messageSends: []
  14779. }, function ($methodClass){ return function (){
  14780. var self=this,$self=this;
  14781. return $self.fn;
  14782. }; }),
  14783. $globals.Behavior);
  14784. $core.addMethod(
  14785. $core.method({
  14786. selector: "javaScriptConstructor:",
  14787. protocol: "accessing",
  14788. args: ["aJavaScriptFunction"],
  14789. 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\x09Smalltalk core setClassConstructor: self to: aJavaScriptFunction",
  14790. referencedClasses: ["Smalltalk"],
  14791. pragmas: [],
  14792. messageSends: ["setClassConstructor:to:", "core"]
  14793. }, function ($methodClass){ return function (aJavaScriptFunction){
  14794. var self=this,$self=this;
  14795. return $core.withContext(function($ctx1) {
  14796. $recv($recv($globals.Smalltalk)._core())._setClassConstructor_to_(self,aJavaScriptFunction);
  14797. return self;
  14798. }, function($ctx1) {$ctx1.fill(self,"javaScriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction})});
  14799. }; }),
  14800. $globals.Behavior);
  14801. $core.addMethod(
  14802. $core.method({
  14803. selector: "javascriptConstructor",
  14804. protocol: "accessing",
  14805. args: [],
  14806. source: "javascriptConstructor\x0a\x09self deprecatedAPI: 'Use #javaScriptConstructor instead.'.\x0a\x09^ self javaScriptConstructor",
  14807. referencedClasses: [],
  14808. pragmas: [],
  14809. messageSends: ["deprecatedAPI:", "javaScriptConstructor"]
  14810. }, function ($methodClass){ return function (){
  14811. var self=this,$self=this;
  14812. return $core.withContext(function($ctx1) {
  14813. $self._deprecatedAPI_("Use #javaScriptConstructor instead.");
  14814. return $self._javaScriptConstructor();
  14815. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{})});
  14816. }; }),
  14817. $globals.Behavior);
  14818. $core.addMethod(
  14819. $core.method({
  14820. selector: "javascriptConstructor:",
  14821. protocol: "accessing",
  14822. args: ["aJavaScriptFunction"],
  14823. source: "javascriptConstructor: aJavaScriptFunction\x0a\x09self deprecatedAPI: 'Use #javaScriptConstructor: instead.'.\x0a\x09^ self javaScriptConstructor: aJavaScriptFunction",
  14824. referencedClasses: [],
  14825. pragmas: [],
  14826. messageSends: ["deprecatedAPI:", "javaScriptConstructor:"]
  14827. }, function ($methodClass){ return function (aJavaScriptFunction){
  14828. var self=this,$self=this;
  14829. return $core.withContext(function($ctx1) {
  14830. $self._deprecatedAPI_("Use #javaScriptConstructor: instead.");
  14831. return $self._javaScriptConstructor_(aJavaScriptFunction);
  14832. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction})});
  14833. }; }),
  14834. $globals.Behavior);
  14835. $core.addMethod(
  14836. $core.method({
  14837. selector: "lookupSelector:",
  14838. protocol: "accessing",
  14839. args: ["selector"],
  14840. 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",
  14841. referencedClasses: [],
  14842. pragmas: [],
  14843. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  14844. }, function ($methodClass){ return function (selector){
  14845. var self=this,$self=this;
  14846. var lookupClass;
  14847. return $core.withContext(function($ctx1) {
  14848. var $early={};
  14849. try {
  14850. lookupClass=self;
  14851. $recv((function(){
  14852. return $core.withContext(function($ctx2) {
  14853. return $recv(lookupClass).__eq(nil);
  14854. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14855. }))._whileFalse_((function(){
  14856. return $core.withContext(function($ctx2) {
  14857. if($core.assert($recv(lookupClass)._includesSelector_(selector))){
  14858. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  14859. }
  14860. lookupClass=$recv(lookupClass)._superclass();
  14861. return lookupClass;
  14862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14863. }));
  14864. return nil;
  14865. }
  14866. catch(e) {if(e===$early)return e[0]; throw e}
  14867. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass})});
  14868. }; }),
  14869. $globals.Behavior);
  14870. $core.addMethod(
  14871. $core.method({
  14872. selector: "makeJavaScriptConstructorSubclassOf:",
  14873. protocol: "private",
  14874. args: ["javaScriptClass"],
  14875. source: "makeJavaScriptConstructorSubclassOf: javaScriptClass\x0a\x09<inlineJS: '\x0a\x09\x09Object.setPrototypeOf($self.fn.prototype, javaScriptClass.prototype);\x0a\x09'>",
  14876. referencedClasses: [],
  14877. pragmas: [["inlineJS:", ["\x0a\x09\x09Object.setPrototypeOf($self.fn.prototype, javaScriptClass.prototype);\x0a\x09"]]],
  14878. messageSends: []
  14879. }, function ($methodClass){ return function (javaScriptClass){
  14880. var self=this,$self=this;
  14881. return $core.withContext(function($ctx1) {
  14882. Object.setPrototypeOf($self.fn.prototype, javaScriptClass.prototype);
  14883. ;
  14884. return self;
  14885. }, function($ctx1) {$ctx1.fill(self,"makeJavaScriptConstructorSubclassOf:",{javaScriptClass:javaScriptClass})});
  14886. }; }),
  14887. $globals.Behavior);
  14888. $core.addMethod(
  14889. $core.method({
  14890. selector: "new",
  14891. protocol: "instance creation",
  14892. args: [],
  14893. source: "new\x0a\x09^ self basicNew initialize",
  14894. referencedClasses: [],
  14895. pragmas: [],
  14896. messageSends: ["initialize", "basicNew"]
  14897. }, function ($methodClass){ return function (){
  14898. var self=this,$self=this;
  14899. return $core.withContext(function($ctx1) {
  14900. return $recv($self._basicNew())._initialize();
  14901. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  14902. }; }),
  14903. $globals.Behavior);
  14904. $core.addMethod(
  14905. $core.method({
  14906. selector: "prototype",
  14907. protocol: "accessing",
  14908. args: [],
  14909. source: "prototype\x0a\x09^ self javaScriptConstructor prototype",
  14910. referencedClasses: [],
  14911. pragmas: [],
  14912. messageSends: ["prototype", "javaScriptConstructor"]
  14913. }, function ($methodClass){ return function (){
  14914. var self=this,$self=this;
  14915. return $core.withContext(function($ctx1) {
  14916. return $recv($self._javaScriptConstructor())._prototype();
  14917. }, function($ctx1) {$ctx1.fill(self,"prototype",{})});
  14918. }; }),
  14919. $globals.Behavior);
  14920. $core.addMethod(
  14921. $core.method({
  14922. selector: "subclasses",
  14923. protocol: "accessing",
  14924. args: [],
  14925. source: "subclasses\x0a\x09self subclassResponsibility",
  14926. referencedClasses: [],
  14927. pragmas: [],
  14928. messageSends: ["subclassResponsibility"]
  14929. }, function ($methodClass){ return function (){
  14930. var self=this,$self=this;
  14931. return $core.withContext(function($ctx1) {
  14932. $self._subclassResponsibility();
  14933. return self;
  14934. }, function($ctx1) {$ctx1.fill(self,"subclasses",{})});
  14935. }; }),
  14936. $globals.Behavior);
  14937. $core.addMethod(
  14938. $core.method({
  14939. selector: "superPrototype",
  14940. protocol: "accessing",
  14941. args: [],
  14942. source: "superPrototype\x0a\x09<inlineJS: 'return Object.getPrototypeOf($self.fn.prototype)'>",
  14943. referencedClasses: [],
  14944. pragmas: [["inlineJS:", ["return Object.getPrototypeOf($self.fn.prototype)"]]],
  14945. messageSends: []
  14946. }, function ($methodClass){ return function (){
  14947. var self=this,$self=this;
  14948. return $core.withContext(function($ctx1) {
  14949. return Object.getPrototypeOf($self.fn.prototype);
  14950. return self;
  14951. }, function($ctx1) {$ctx1.fill(self,"superPrototype",{})});
  14952. }; }),
  14953. $globals.Behavior);
  14954. $core.addMethod(
  14955. $core.method({
  14956. selector: "superclass",
  14957. protocol: "accessing",
  14958. args: [],
  14959. source: "superclass\x0a\x09^ superclass",
  14960. referencedClasses: [],
  14961. pragmas: [],
  14962. messageSends: []
  14963. }, function ($methodClass){ return function (){
  14964. var self=this,$self=this;
  14965. return $self.superclass;
  14966. }; }),
  14967. $globals.Behavior);
  14968. $core.addMethod(
  14969. $core.method({
  14970. selector: "theMetaClass",
  14971. protocol: "accessing",
  14972. args: [],
  14973. source: "theMetaClass\x0a\x09self subclassResponsibility",
  14974. referencedClasses: [],
  14975. pragmas: [],
  14976. messageSends: ["subclassResponsibility"]
  14977. }, function ($methodClass){ return function (){
  14978. var self=this,$self=this;
  14979. return $core.withContext(function($ctx1) {
  14980. $self._subclassResponsibility();
  14981. return self;
  14982. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{})});
  14983. }; }),
  14984. $globals.Behavior);
  14985. $core.addMethod(
  14986. $core.method({
  14987. selector: "theNonMetaClass",
  14988. protocol: "accessing",
  14989. args: [],
  14990. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  14991. referencedClasses: [],
  14992. pragmas: [],
  14993. messageSends: ["subclassResponsibility"]
  14994. }, function ($methodClass){ return function (){
  14995. var self=this,$self=this;
  14996. return $core.withContext(function($ctx1) {
  14997. $self._subclassResponsibility();
  14998. return self;
  14999. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{})});
  15000. }; }),
  15001. $globals.Behavior);
  15002. $core.addMethod(
  15003. $core.method({
  15004. selector: "withAllSubclasses",
  15005. protocol: "accessing",
  15006. args: [],
  15007. source: "withAllSubclasses\x0a\x09^ self allSubclasses copyWithFirst: self",
  15008. referencedClasses: [],
  15009. pragmas: [],
  15010. messageSends: ["copyWithFirst:", "allSubclasses"]
  15011. }, function ($methodClass){ return function (){
  15012. var self=this,$self=this;
  15013. return $core.withContext(function($ctx1) {
  15014. return $recv($self._allSubclasses())._copyWithFirst_(self);
  15015. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{})});
  15016. }; }),
  15017. $globals.Behavior);
  15018. $core.addClass("Class", $globals.Behavior, ["package", "subclasses"], "Kernel-Classes");
  15019. $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.";
  15020. $core.addMethod(
  15021. $core.method({
  15022. selector: "basicPackage:",
  15023. protocol: "accessing",
  15024. args: ["aPackage"],
  15025. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  15026. referencedClasses: [],
  15027. pragmas: [],
  15028. messageSends: []
  15029. }, function ($methodClass){ return function (aPackage){
  15030. var self=this,$self=this;
  15031. $self.package=aPackage;
  15032. return self;
  15033. }; }),
  15034. $globals.Class);
  15035. $core.addMethod(
  15036. $core.method({
  15037. selector: "classTag",
  15038. protocol: "accessing",
  15039. args: [],
  15040. 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'",
  15041. referencedClasses: [],
  15042. pragmas: [],
  15043. messageSends: []
  15044. }, function ($methodClass){ return function (){
  15045. var self=this,$self=this;
  15046. return "class";
  15047. }; }),
  15048. $globals.Class);
  15049. $core.addMethod(
  15050. $core.method({
  15051. selector: "definition",
  15052. protocol: "accessing",
  15053. args: [],
  15054. 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: {'slots: {'. ('. ' join: (self instanceVariableNames collect: #symbolPrintString)). '}'}; lf;\x0a\x09\x09tab; write: 'package: '; print: self category ]",
  15055. referencedClasses: ["String"],
  15056. pragmas: [],
  15057. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "collect:", "instanceVariableNames", "category"]
  15058. }, function ($methodClass){ return function (){
  15059. var self=this,$self=this;
  15060. return $core.withContext(function($ctx1) {
  15061. return $recv($globals.String)._streamContents_((function(stream){
  15062. return $core.withContext(function($ctx2) {
  15063. [$recv(stream)._print_($self._superclass())
  15064. ,$ctx2.sendIdx["print:"]=1
  15065. ][0];
  15066. [$recv(stream)._write_(" subclass: ")
  15067. ,$ctx2.sendIdx["write:"]=1
  15068. ][0];
  15069. $recv(stream)._printSymbol_($self._name());
  15070. [$recv(stream)._lf()
  15071. ,$ctx2.sendIdx["lf"]=1
  15072. ][0];
  15073. [$recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  15074. return $core.withContext(function($ctx3) {
  15075. return [[$recv($globals.String)._tab()
  15076. ,$ctx3.sendIdx["tab"]=1
  15077. ][0],"uses: ",tcd,[$recv($globals.String)._lf()
  15078. ,$ctx3.sendIdx["lf"]=2
  15079. ][0]];
  15080. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  15081. })))
  15082. ,$ctx2.sendIdx["write:"]=2
  15083. ][0];
  15084. [$recv(stream)._tab()
  15085. ,$ctx2.sendIdx["tab"]=2
  15086. ][0];
  15087. [$recv(stream)._write_(["slots: {",". "._join_($recv($self._instanceVariableNames())._collect_("symbolPrintString")),"}"])
  15088. ,$ctx2.sendIdx["write:"]=3
  15089. ][0];
  15090. $recv(stream)._lf();
  15091. $recv(stream)._tab();
  15092. $recv(stream)._write_("package: ");
  15093. return $recv(stream)._print_($self._category());
  15094. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15095. }));
  15096. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  15097. }; }),
  15098. $globals.Class);
  15099. $core.addMethod(
  15100. $core.method({
  15101. selector: "includingPossibleMetaDo:",
  15102. protocol: "enumerating",
  15103. args: ["aBlock"],
  15104. source: "includingPossibleMetaDo: aBlock\x0a\x0a\x09aBlock value: self.\x0a\x09aBlock value: self theMetaClass",
  15105. referencedClasses: [],
  15106. pragmas: [],
  15107. messageSends: ["value:", "theMetaClass"]
  15108. }, function ($methodClass){ return function (aBlock){
  15109. var self=this,$self=this;
  15110. return $core.withContext(function($ctx1) {
  15111. [$recv(aBlock)._value_(self)
  15112. ,$ctx1.sendIdx["value:"]=1
  15113. ][0];
  15114. $recv(aBlock)._value_($self._theMetaClass());
  15115. return self;
  15116. }, function($ctx1) {$ctx1.fill(self,"includingPossibleMetaDo:",{aBlock:aBlock})});
  15117. }; }),
  15118. $globals.Class);
  15119. $core.addMethod(
  15120. $core.method({
  15121. selector: "isClass",
  15122. protocol: "testing",
  15123. args: [],
  15124. source: "isClass\x0a\x09^ true",
  15125. referencedClasses: [],
  15126. pragmas: [],
  15127. messageSends: []
  15128. }, function ($methodClass){ return function (){
  15129. var self=this,$self=this;
  15130. return true;
  15131. }; }),
  15132. $globals.Class);
  15133. $core.addMethod(
  15134. $core.method({
  15135. selector: "package",
  15136. protocol: "accessing",
  15137. args: [],
  15138. source: "package\x0a\x09^ package",
  15139. referencedClasses: [],
  15140. pragmas: [],
  15141. messageSends: []
  15142. }, function ($methodClass){ return function (){
  15143. var self=this,$self=this;
  15144. return $self.package;
  15145. }; }),
  15146. $globals.Class);
  15147. $core.addMethod(
  15148. $core.method({
  15149. selector: "provided",
  15150. protocol: "converting",
  15151. args: [],
  15152. source: "provided\x0a\x09\x22Returns JS proxy that allows to access 'static API', as in\x0a\x09 Number provided EPSILON\x0a\x09that forwards to (wrapped JS) constructor function.\x22\x0a\x09\x0a\x09^ self javaScriptConstructor provided",
  15153. referencedClasses: [],
  15154. pragmas: [],
  15155. messageSends: ["provided", "javaScriptConstructor"]
  15156. }, function ($methodClass){ return function (){
  15157. var self=this,$self=this;
  15158. return $core.withContext(function($ctx1) {
  15159. return $recv($self._javaScriptConstructor())._provided();
  15160. }, function($ctx1) {$ctx1.fill(self,"provided",{})});
  15161. }; }),
  15162. $globals.Class);
  15163. $core.addMethod(
  15164. $core.method({
  15165. selector: "rename:",
  15166. protocol: "accessing",
  15167. args: ["aString"],
  15168. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  15169. referencedClasses: ["ClassBuilder"],
  15170. pragmas: [],
  15171. messageSends: ["renameClass:to:", "new"]
  15172. }, function ($methodClass){ return function (aString){
  15173. var self=this,$self=this;
  15174. return $core.withContext(function($ctx1) {
  15175. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  15176. return self;
  15177. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString})});
  15178. }; }),
  15179. $globals.Class);
  15180. $core.addMethod(
  15181. $core.method({
  15182. selector: "subclasses",
  15183. protocol: "accessing",
  15184. args: [],
  15185. source: "subclasses\x0a\x09^ subclasses copy",
  15186. referencedClasses: [],
  15187. pragmas: [],
  15188. messageSends: ["copy"]
  15189. }, function ($methodClass){ return function (){
  15190. var self=this,$self=this;
  15191. return $core.withContext(function($ctx1) {
  15192. return $recv($self.subclasses)._copy();
  15193. }, function($ctx1) {$ctx1.fill(self,"subclasses",{})});
  15194. }; }),
  15195. $globals.Class);
  15196. $core.addMethod(
  15197. $core.method({
  15198. selector: "theMetaClass",
  15199. protocol: "accessing",
  15200. args: [],
  15201. source: "theMetaClass\x0a\x09^ self class",
  15202. referencedClasses: [],
  15203. pragmas: [],
  15204. messageSends: ["class"]
  15205. }, function ($methodClass){ return function (){
  15206. var self=this,$self=this;
  15207. return $core.withContext(function($ctx1) {
  15208. return $self._class();
  15209. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{})});
  15210. }; }),
  15211. $globals.Class);
  15212. $core.addClass("Metaclass", $globals.Behavior, ["instanceClass"], "Kernel-Classes");
  15213. $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.";
  15214. $core.addMethod(
  15215. $core.method({
  15216. selector: "asJavaScriptSource",
  15217. protocol: "converting",
  15218. args: [],
  15219. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.a$cls'",
  15220. referencedClasses: [],
  15221. pragmas: [],
  15222. messageSends: [",", "name", "instanceClass"]
  15223. }, function ($methodClass){ return function (){
  15224. var self=this,$self=this;
  15225. return $core.withContext(function($ctx1) {
  15226. return [$recv("$globals.".__comma($recv($self._instanceClass())._name())).__comma(".a$cls")
  15227. ,$ctx1.sendIdx[","]=1
  15228. ][0];
  15229. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  15230. }; }),
  15231. $globals.Metaclass);
  15232. $core.addMethod(
  15233. $core.method({
  15234. selector: "definition",
  15235. protocol: "accessing",
  15236. args: [],
  15237. 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: {'slots: {'. ('. ' join: (self instanceVariableNames collect: #symbolPrintString)). '}'} ]",
  15238. referencedClasses: ["String"],
  15239. pragmas: [],
  15240. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "collect:", "instanceVariableNames"]
  15241. }, function ($methodClass){ return function (){
  15242. var self=this,$self=this;
  15243. return $core.withContext(function($ctx1) {
  15244. return $recv($globals.String)._streamContents_((function(stream){
  15245. return $core.withContext(function($ctx2) {
  15246. $recv(stream)._print_(self);
  15247. [$recv(stream)._write_($recv($self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  15248. return " ";
  15249. }),(function(tcd){
  15250. return $core.withContext(function($ctx3) {
  15251. return [[$recv($globals.String)._lf()
  15252. ,$ctx3.sendIdx["lf"]=1
  15253. ][0],[$recv($globals.String)._tab()
  15254. ,$ctx3.sendIdx["tab"]=1
  15255. ][0],"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  15256. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  15257. })))
  15258. ,$ctx2.sendIdx["write:"]=1
  15259. ][0];
  15260. return $recv(stream)._write_(["slots: {",". "._join_($recv($self._instanceVariableNames())._collect_("symbolPrintString")),"}"]);
  15261. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15262. }));
  15263. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  15264. }; }),
  15265. $globals.Metaclass);
  15266. $core.addMethod(
  15267. $core.method({
  15268. selector: "instanceClass",
  15269. protocol: "accessing",
  15270. args: [],
  15271. source: "instanceClass\x0a\x09^ instanceClass",
  15272. referencedClasses: [],
  15273. pragmas: [],
  15274. messageSends: []
  15275. }, function ($methodClass){ return function (){
  15276. var self=this,$self=this;
  15277. return $self.instanceClass;
  15278. }; }),
  15279. $globals.Metaclass);
  15280. $core.addMethod(
  15281. $core.method({
  15282. selector: "instanceVariableNames:",
  15283. protocol: "accessing",
  15284. args: ["aString"],
  15285. source: "instanceVariableNames: aString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self slots: aString instanceVariablesStringAsSlotList",
  15286. referencedClasses: [],
  15287. pragmas: [],
  15288. messageSends: ["slots:", "instanceVariablesStringAsSlotList"]
  15289. }, function ($methodClass){ return function (aString){
  15290. var self=this,$self=this;
  15291. return $core.withContext(function($ctx1) {
  15292. return $self._slots_($recv(aString)._instanceVariablesStringAsSlotList());
  15293. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aString:aString})});
  15294. }; }),
  15295. $globals.Metaclass);
  15296. $core.addMethod(
  15297. $core.method({
  15298. selector: "isMetaclass",
  15299. protocol: "testing",
  15300. args: [],
  15301. source: "isMetaclass\x0a\x09^ true",
  15302. referencedClasses: [],
  15303. pragmas: [],
  15304. messageSends: []
  15305. }, function ($methodClass){ return function (){
  15306. var self=this,$self=this;
  15307. return true;
  15308. }; }),
  15309. $globals.Metaclass);
  15310. $core.addMethod(
  15311. $core.method({
  15312. selector: "name",
  15313. protocol: "accessing",
  15314. args: [],
  15315. source: "name\x0a\x09^ self instanceClass name, ' class'",
  15316. referencedClasses: [],
  15317. pragmas: [],
  15318. messageSends: [",", "name", "instanceClass"]
  15319. }, function ($methodClass){ return function (){
  15320. var self=this,$self=this;
  15321. return $core.withContext(function($ctx1) {
  15322. return $recv($recv($self._instanceClass())._name()).__comma(" class");
  15323. }, function($ctx1) {$ctx1.fill(self,"name",{})});
  15324. }; }),
  15325. $globals.Metaclass);
  15326. $core.addMethod(
  15327. $core.method({
  15328. selector: "package",
  15329. protocol: "accessing",
  15330. args: [],
  15331. source: "package\x0a\x09^ self instanceClass package",
  15332. referencedClasses: [],
  15333. pragmas: [],
  15334. messageSends: ["package", "instanceClass"]
  15335. }, function ($methodClass){ return function (){
  15336. var self=this,$self=this;
  15337. return $core.withContext(function($ctx1) {
  15338. return $recv($self._instanceClass())._package();
  15339. }, function($ctx1) {$ctx1.fill(self,"package",{})});
  15340. }; }),
  15341. $globals.Metaclass);
  15342. $core.addMethod(
  15343. $core.method({
  15344. selector: "slots:",
  15345. protocol: "accessing",
  15346. args: ["aCollection"],
  15347. source: "slots: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self slots: aCollection.\x0a\x09^ self",
  15348. referencedClasses: ["ClassBuilder"],
  15349. pragmas: [],
  15350. messageSends: ["class:slots:", "new"]
  15351. }, function ($methodClass){ return function (aCollection){
  15352. var self=this,$self=this;
  15353. return $core.withContext(function($ctx1) {
  15354. $recv($recv($globals.ClassBuilder)._new())._class_slots_(self,aCollection);
  15355. return self;
  15356. }, function($ctx1) {$ctx1.fill(self,"slots:",{aCollection:aCollection})});
  15357. }; }),
  15358. $globals.Metaclass);
  15359. $core.addMethod(
  15360. $core.method({
  15361. selector: "subclasses",
  15362. protocol: "accessing",
  15363. args: [],
  15364. source: "subclasses\x0a\x09^ Smalltalk core metaSubclasses: self",
  15365. referencedClasses: ["Smalltalk"],
  15366. pragmas: [],
  15367. messageSends: ["metaSubclasses:", "core"]
  15368. }, function ($methodClass){ return function (){
  15369. var self=this,$self=this;
  15370. return $core.withContext(function($ctx1) {
  15371. return $recv($recv($globals.Smalltalk)._core())._metaSubclasses_(self);
  15372. }, function($ctx1) {$ctx1.fill(self,"subclasses",{})});
  15373. }; }),
  15374. $globals.Metaclass);
  15375. $core.addMethod(
  15376. $core.method({
  15377. selector: "theMetaClass",
  15378. protocol: "accessing",
  15379. args: [],
  15380. source: "theMetaClass\x0a\x09^ self",
  15381. referencedClasses: [],
  15382. pragmas: [],
  15383. messageSends: []
  15384. }, function ($methodClass){ return function (){
  15385. var self=this,$self=this;
  15386. return self;
  15387. }; }),
  15388. $globals.Metaclass);
  15389. $core.addMethod(
  15390. $core.method({
  15391. selector: "theNonMetaClass",
  15392. protocol: "accessing",
  15393. args: [],
  15394. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  15395. referencedClasses: [],
  15396. pragmas: [],
  15397. messageSends: ["instanceClass"]
  15398. }, function ($methodClass){ return function (){
  15399. var self=this,$self=this;
  15400. return $core.withContext(function($ctx1) {
  15401. return $self._instanceClass();
  15402. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{})});
  15403. }; }),
  15404. $globals.Metaclass);
  15405. $core.addMethod(
  15406. $core.method({
  15407. selector: "uses:instanceVariableNames:",
  15408. protocol: "accessing",
  15409. args: ["aTraitCompositionDescription", "aString"],
  15410. source: "uses: aTraitCompositionDescription instanceVariableNames: aString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self uses: aTraitCompositionDescription slots: aString instanceVariablesStringAsSlotList",
  15411. referencedClasses: [],
  15412. pragmas: [],
  15413. messageSends: ["uses:slots:", "instanceVariablesStringAsSlotList"]
  15414. }, function ($methodClass){ return function (aTraitCompositionDescription,aString){
  15415. var self=this,$self=this;
  15416. return $core.withContext(function($ctx1) {
  15417. return $self._uses_slots_(aTraitCompositionDescription,$recv(aString)._instanceVariablesStringAsSlotList());
  15418. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aString:aString})});
  15419. }; }),
  15420. $globals.Metaclass);
  15421. $core.addMethod(
  15422. $core.method({
  15423. selector: "uses:slots:",
  15424. protocol: "accessing",
  15425. args: ["aTraitCompositionDescription", "aCollection"],
  15426. source: "uses: aTraitCompositionDescription slots: aCollection\x0a\x09self\x0a\x09\x09slots: aCollection;\x0a\x09\x09setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ self",
  15427. referencedClasses: [],
  15428. pragmas: [],
  15429. messageSends: ["slots:", "setTraitComposition:", "asTraitComposition"]
  15430. }, function ($methodClass){ return function (aTraitCompositionDescription,aCollection){
  15431. var self=this,$self=this;
  15432. return $core.withContext(function($ctx1) {
  15433. $self._slots_(aCollection);
  15434. $self._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15435. return self;
  15436. }, function($ctx1) {$ctx1.fill(self,"uses:slots:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection})});
  15437. }; }),
  15438. $globals.Metaclass);
  15439. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  15440. $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:`.";
  15441. $core.addMethod(
  15442. $core.method({
  15443. selector: "addSubclassOf:named:instanceVariableNames:package:",
  15444. protocol: "class definition",
  15445. args: ["aClass", "className", "aCollection", "packageName"],
  15446. source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass thePackage |\x0a\x09\x0a\x09theClass := Smalltalk globals at: className.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: thePackage.\x0a\x09\x09theClass superclass == aClass\x0a\x09\x09\x09ifFalse: [ ^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09^ (self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName) recompile; yourself",
  15447. referencedClasses: ["Smalltalk", "Package"],
  15448. pragmas: [],
  15449. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "basicAddSubclassOf:named:instanceVariableNames:package:", "yourself"]
  15450. }, function ($methodClass){ return function (aClass,className,aCollection,packageName){
  15451. var self=this,$self=this;
  15452. var theClass,thePackage;
  15453. return $core.withContext(function($ctx1) {
  15454. var $1,$2;
  15455. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15456. thePackage=$recv($globals.Package)._named_(packageName);
  15457. $1=theClass;
  15458. if($1 == null || $1.a$nil){
  15459. $1;
  15460. } else {
  15461. $recv(theClass)._package_(thePackage);
  15462. if(!$core.assert($recv($recv(theClass)._superclass()).__eq_eq(aClass))){
  15463. return $self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  15464. }
  15465. }
  15466. $2=$self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  15467. $recv($2)._recompile();
  15468. return $recv($2)._yourself();
  15469. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage})});
  15470. }; }),
  15471. $globals.ClassBuilder);
  15472. $core.addMethod(
  15473. $core.method({
  15474. selector: "addTraitNamed:package:",
  15475. protocol: "class definition",
  15476. args: ["traitName", "packageName"],
  15477. 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",
  15478. referencedClasses: ["Smalltalk", "Package"],
  15479. pragmas: [],
  15480. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  15481. }, function ($methodClass){ return function (traitName,packageName){
  15482. var self=this,$self=this;
  15483. var theTrait,thePackage;
  15484. return $core.withContext(function($ctx1) {
  15485. var $1,$2;
  15486. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  15487. thePackage=$recv($globals.Package)._named_(packageName);
  15488. $1=theTrait;
  15489. if($1 == null || $1.a$nil){
  15490. $1;
  15491. } else {
  15492. $2=theTrait;
  15493. $recv($2)._package_(thePackage);
  15494. $recv($2)._recompile();
  15495. return $recv($2)._yourself();
  15496. }
  15497. return $self._basicAddTraitNamed_package_(traitName,packageName);
  15498. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage})});
  15499. }; }),
  15500. $globals.ClassBuilder);
  15501. $core.addMethod(
  15502. $core.method({
  15503. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  15504. protocol: "private",
  15505. args: ["aClass", "aString", "aCollection", "packageName"],
  15506. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  15507. referencedClasses: [],
  15508. pragmas: [["inlineJS:", ["\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09"]]],
  15509. messageSends: []
  15510. }, function ($methodClass){ return function (aClass,aString,aCollection,packageName){
  15511. var self=this,$self=this;
  15512. return $core.withContext(function($ctx1) {
  15513. return $core.addClass(aString, aClass, aCollection, packageName);
  15514. ;
  15515. return self;
  15516. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName})});
  15517. }; }),
  15518. $globals.ClassBuilder);
  15519. $core.addMethod(
  15520. $core.method({
  15521. selector: "basicAddTraitNamed:package:",
  15522. protocol: "private",
  15523. args: ["aString", "anotherString"],
  15524. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  15525. referencedClasses: [],
  15526. pragmas: [["inlineJS:", ["return $core.addTrait(aString, anotherString)"]]],
  15527. messageSends: []
  15528. }, function ($methodClass){ return function (aString,anotherString){
  15529. var self=this,$self=this;
  15530. return $core.withContext(function($ctx1) {
  15531. return $core.addTrait(aString, anotherString);
  15532. return self;
  15533. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString})});
  15534. }; }),
  15535. $globals.ClassBuilder);
  15536. $core.addMethod(
  15537. $core.method({
  15538. selector: "basicClass:instanceVariables:",
  15539. protocol: "private",
  15540. args: ["aClass", "aCollection"],
  15541. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09Smalltalk core setSlots: aClass to: aCollection",
  15542. referencedClasses: ["Smalltalk"],
  15543. pragmas: [],
  15544. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "setSlots:to:", "core"]
  15545. }, function ($methodClass){ return function (aClass,aCollection){
  15546. var self=this,$self=this;
  15547. return $core.withContext(function($ctx1) {
  15548. if(!$core.assert($recv(aClass)._isMetaclass())){
  15549. $self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  15550. }
  15551. $recv($recv($globals.Smalltalk)._core())._setSlots_to_(aClass,aCollection);
  15552. return self;
  15553. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection})});
  15554. }; }),
  15555. $globals.ClassBuilder);
  15556. $core.addMethod(
  15557. $core.method({
  15558. selector: "basicRemoveClass:",
  15559. protocol: "private",
  15560. args: ["aClass"],
  15561. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  15562. referencedClasses: [],
  15563. pragmas: [["inlineJS:", ["$core.removeClass(aClass)"]]],
  15564. messageSends: []
  15565. }, function ($methodClass){ return function (aClass){
  15566. var self=this,$self=this;
  15567. return $core.withContext(function($ctx1) {
  15568. $core.removeClass(aClass);
  15569. return self;
  15570. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass})});
  15571. }; }),
  15572. $globals.ClassBuilder);
  15573. $core.addMethod(
  15574. $core.method({
  15575. selector: "basicRenameClass:to:",
  15576. protocol: "private",
  15577. args: ["aClass", "aString"],
  15578. source: "basicRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.name];\x0a\x09\x09aClass.name = aString;\x0a\x09'>",
  15579. referencedClasses: [],
  15580. pragmas: [["inlineJS:", ["\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.name];\x0a\x09\x09aClass.name = aString;\x0a\x09"]]],
  15581. messageSends: []
  15582. }, function ($methodClass){ return function (aClass,aString){
  15583. var self=this,$self=this;
  15584. return $core.withContext(function($ctx1) {
  15585. $globals[aString] = aClass;
  15586. delete $globals[aClass.name];
  15587. aClass.name = aString;
  15588. ;
  15589. return self;
  15590. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString})});
  15591. }; }),
  15592. $globals.ClassBuilder);
  15593. $core.addMethod(
  15594. $core.method({
  15595. selector: "basicSwapClassNames:with:",
  15596. protocol: "private",
  15597. args: ["aClass", "anotherClass"],
  15598. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<inlineJS: '\x0a\x09\x09var tmp = aClass.name;\x0a\x09\x09aClass.name = anotherClass.name;\x0a\x09\x09anotherClass.name = tmp;\x0a\x09'>",
  15599. referencedClasses: [],
  15600. pragmas: [["inlineJS:", ["\x0a\x09\x09var tmp = aClass.name;\x0a\x09\x09aClass.name = anotherClass.name;\x0a\x09\x09anotherClass.name = tmp;\x0a\x09"]]],
  15601. messageSends: []
  15602. }, function ($methodClass){ return function (aClass,anotherClass){
  15603. var self=this,$self=this;
  15604. return $core.withContext(function($ctx1) {
  15605. var tmp = aClass.name;
  15606. aClass.name = anotherClass.name;
  15607. anotherClass.name = tmp;
  15608. ;
  15609. return self;
  15610. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass})});
  15611. }; }),
  15612. $globals.ClassBuilder);
  15613. $core.addMethod(
  15614. $core.method({
  15615. selector: "class:slots:",
  15616. protocol: "class definition",
  15617. args: ["aClass", "aCollection"],
  15618. source: "class: aClass slots: aCollection\x0a\x09self basicClass: aClass instanceVariables: aCollection.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  15619. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  15620. pragmas: [],
  15621. messageSends: ["basicClass:instanceVariables:", "announce:", "current", "theClass:", "new", "yourself"]
  15622. }, function ($methodClass){ return function (aClass,aCollection){
  15623. var self=this,$self=this;
  15624. return $core.withContext(function($ctx1) {
  15625. var $1,$2;
  15626. $self._basicClass_instanceVariables_(aClass,aCollection);
  15627. $1=$recv($globals.SystemAnnouncer)._current();
  15628. $2=$recv($globals.ClassDefinitionChanged)._new();
  15629. $recv($2)._theClass_(aClass);
  15630. $recv($1)._announce_($recv($2)._yourself());
  15631. return self;
  15632. }, function($ctx1) {$ctx1.fill(self,"class:slots:",{aClass:aClass,aCollection:aCollection})});
  15633. }; }),
  15634. $globals.ClassBuilder);
  15635. $core.addMethod(
  15636. $core.method({
  15637. selector: "copyClass:named:",
  15638. protocol: "copying",
  15639. args: ["aClass", "className"],
  15640. 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",
  15641. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15642. pragmas: [],
  15643. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  15644. }, function ($methodClass){ return function (aClass,className){
  15645. var self=this,$self=this;
  15646. var newClass;
  15647. return $core.withContext(function($ctx1) {
  15648. var $1,$2;
  15649. newClass=$self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15650. $self._copyClass_to_(aClass,newClass);
  15651. $1=$recv($globals.SystemAnnouncer)._current();
  15652. $2=$recv($globals.ClassAdded)._new();
  15653. $recv($2)._theClass_(newClass);
  15654. $recv($1)._announce_($recv($2)._yourself());
  15655. return newClass;
  15656. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass})});
  15657. }; }),
  15658. $globals.ClassBuilder);
  15659. $core.addMethod(
  15660. $core.method({
  15661. selector: "copyClass:to:",
  15662. protocol: "copying",
  15663. args: ["aClass", "anotherClass"],
  15664. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09each origin = 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 origin = aClass class ifTrue: [\x0a\x09\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ] ].\x0a\x09anotherClass class setTraitComposition: aClass class traitComposition",
  15665. referencedClasses: ["Compiler"],
  15666. pragmas: [],
  15667. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "origin", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  15668. }, function ($methodClass){ return function (aClass,anotherClass){
  15669. var self=this,$self=this;
  15670. return $core.withContext(function($ctx1) {
  15671. $recv(anotherClass)._comment_($recv(aClass)._comment());
  15672. [$recv([$recv(aClass)._methodDictionary()
  15673. ,$ctx1.sendIdx["methodDictionary"]=1
  15674. ][0])._valuesDo_((function(each){
  15675. return $core.withContext(function($ctx2) {
  15676. if($core.assert([$recv([$recv(each)._origin()
  15677. ,$ctx2.sendIdx["origin"]=1
  15678. ][0]).__eq(aClass)
  15679. ,$ctx2.sendIdx["="]=1
  15680. ][0])){
  15681. return [$recv([$recv($globals.Compiler)._new()
  15682. ,$ctx2.sendIdx["new"]=1
  15683. ][0])._install_forClass_protocol_([$recv(each)._source()
  15684. ,$ctx2.sendIdx["source"]=1
  15685. ][0],anotherClass,[$recv(each)._protocol()
  15686. ,$ctx2.sendIdx["protocol"]=1
  15687. ][0])
  15688. ,$ctx2.sendIdx["install:forClass:protocol:"]=1
  15689. ][0];
  15690. }
  15691. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15692. }))
  15693. ,$ctx1.sendIdx["valuesDo:"]=1
  15694. ][0];
  15695. [$recv(anotherClass)._setTraitComposition_([$recv(aClass)._traitComposition()
  15696. ,$ctx1.sendIdx["traitComposition"]=1
  15697. ][0])
  15698. ,$ctx1.sendIdx["setTraitComposition:"]=1
  15699. ][0];
  15700. $self._basicClass_instanceVariables_([$recv(anotherClass)._class()
  15701. ,$ctx1.sendIdx["class"]=1
  15702. ][0],$recv([$recv(aClass)._class()
  15703. ,$ctx1.sendIdx["class"]=2
  15704. ][0])._instanceVariableNames());
  15705. $recv($recv([$recv(aClass)._class()
  15706. ,$ctx1.sendIdx["class"]=3
  15707. ][0])._methodDictionary())._valuesDo_((function(each){
  15708. return $core.withContext(function($ctx2) {
  15709. if($core.assert($recv($recv(each)._origin()).__eq([$recv(aClass)._class()
  15710. ,$ctx2.sendIdx["class"]=4
  15711. ][0]))){
  15712. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_($recv(each)._source(),[$recv(anotherClass)._class()
  15713. ,$ctx2.sendIdx["class"]=5
  15714. ][0],$recv(each)._protocol());
  15715. }
  15716. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15717. }));
  15718. $recv([$recv(anotherClass)._class()
  15719. ,$ctx1.sendIdx["class"]=6
  15720. ][0])._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  15721. return self;
  15722. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass})});
  15723. }; }),
  15724. $globals.ClassBuilder);
  15725. $core.addMethod(
  15726. $core.method({
  15727. selector: "migrateClass:superclass:",
  15728. protocol: "class migration",
  15729. args: ["aClass", "anotherClass"],
  15730. 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",
  15731. referencedClasses: [],
  15732. pragmas: [],
  15733. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  15734. }, function ($methodClass){ return function (aClass,anotherClass){
  15735. var self=this,$self=this;
  15736. return $core.withContext(function($ctx1) {
  15737. return $self._migrateClassNamed_superclass_instanceVariableNames_package_([$recv(aClass)._name()
  15738. ,$ctx1.sendIdx["name"]=1
  15739. ][0],anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15740. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass})});
  15741. }; }),
  15742. $globals.ClassBuilder);
  15743. $core.addMethod(
  15744. $core.method({
  15745. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  15746. protocol: "class migration",
  15747. args: ["className", "aClass", "aCollection", "packageName"],
  15748. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09\x09exception pass ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  15749. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  15750. pragmas: [],
  15751. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "pass", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  15752. }, function ($methodClass){ return function (className,aClass,aCollection,packageName){
  15753. var self=this,$self=this;
  15754. var oldClass,newClass,tmp;
  15755. return $core.withContext(function($ctx1) {
  15756. var $1,$2;
  15757. tmp="new*".__comma(className);
  15758. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15759. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  15760. [$self._basicSwapClassNames_with_(oldClass,newClass)
  15761. ,$ctx1.sendIdx["basicSwapClassNames:with:"]=1
  15762. ][0];
  15763. $recv((function(){
  15764. return $core.withContext(function($ctx2) {
  15765. return $self._copyClass_to_(oldClass,newClass);
  15766. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15767. }))._on_do_($globals.Error,(function(exception){
  15768. return $core.withContext(function($ctx2) {
  15769. $self._basicSwapClassNames_with_(oldClass,newClass);
  15770. [$self._basicRemoveClass_(newClass)
  15771. ,$ctx2.sendIdx["basicRemoveClass:"]=1
  15772. ][0];
  15773. return $recv(exception)._pass();
  15774. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  15775. }));
  15776. [$self._rawRenameClass_to_(oldClass,tmp)
  15777. ,$ctx1.sendIdx["rawRenameClass:to:"]=1
  15778. ][0];
  15779. $self._rawRenameClass_to_(newClass,className);
  15780. $recv($recv(oldClass)._subclasses())._do_((function(each){
  15781. return $core.withContext(function($ctx2) {
  15782. return $self._migrateClass_superclass_(each,newClass);
  15783. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15784. }));
  15785. $self._basicRemoveClass_(oldClass);
  15786. $1=$recv($globals.SystemAnnouncer)._current();
  15787. $2=$recv($globals.ClassMigrated)._new();
  15788. $recv($2)._theClass_(newClass);
  15789. $recv($2)._oldClass_(oldClass);
  15790. $recv($1)._announce_($recv($2)._yourself());
  15791. return newClass;
  15792. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp})});
  15793. }; }),
  15794. $globals.ClassBuilder);
  15795. $core.addMethod(
  15796. $core.method({
  15797. selector: "rawRenameClass:to:",
  15798. protocol: "private",
  15799. args: ["aClass", "aString"],
  15800. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  15801. referencedClasses: [],
  15802. pragmas: [["inlineJS:", ["\x0a\x09\x09$globals[aString] = aClass;\x0a\x09"]]],
  15803. messageSends: []
  15804. }, function ($methodClass){ return function (aClass,aString){
  15805. var self=this,$self=this;
  15806. return $core.withContext(function($ctx1) {
  15807. $globals[aString] = aClass;
  15808. ;
  15809. return self;
  15810. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString})});
  15811. }; }),
  15812. $globals.ClassBuilder);
  15813. $core.addMethod(
  15814. $core.method({
  15815. selector: "renameClass:to:",
  15816. protocol: "class migration",
  15817. args: ["aClass", "className"],
  15818. 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)",
  15819. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  15820. pragmas: [],
  15821. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  15822. }, function ($methodClass){ return function (aClass,className){
  15823. var self=this,$self=this;
  15824. return $core.withContext(function($ctx1) {
  15825. var $1,$2;
  15826. $self._basicRenameClass_to_(aClass,className);
  15827. $recv(aClass)._recompile();
  15828. $1=$recv($globals.SystemAnnouncer)._current();
  15829. $2=$recv($globals.ClassRenamed)._new();
  15830. $recv($2)._theClass_(aClass);
  15831. $recv($1)._announce_($recv($2)._yourself());
  15832. return self;
  15833. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className})});
  15834. }; }),
  15835. $globals.ClassBuilder);
  15836. $core.addMethod(
  15837. $core.method({
  15838. selector: "superclass:subclass:",
  15839. protocol: "class definition",
  15840. args: ["aClass", "className"],
  15841. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className slots: #() package: nil",
  15842. referencedClasses: [],
  15843. pragmas: [],
  15844. messageSends: ["superclass:subclass:slots:package:"]
  15845. }, function ($methodClass){ return function (aClass,className){
  15846. var self=this,$self=this;
  15847. return $core.withContext(function($ctx1) {
  15848. return $self._superclass_subclass_slots_package_(aClass,className,[],nil);
  15849. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className})});
  15850. }; }),
  15851. $globals.ClassBuilder);
  15852. $core.addMethod(
  15853. $core.method({
  15854. selector: "superclass:subclass:slots:package:",
  15855. protocol: "class definition",
  15856. args: ["aClass", "className", "aCollection", "packageName"],
  15857. source: "superclass: aClass subclass: className slots: aCollection package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: aCollection\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",
  15858. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15859. pragmas: [],
  15860. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  15861. }, function ($methodClass){ return function (aClass,className,aCollection,packageName){
  15862. var self=this,$self=this;
  15863. var newClass;
  15864. return $core.withContext(function($ctx1) {
  15865. var $1,$2,$3;
  15866. if(packageName == null || packageName.a$nil){
  15867. $1="unclassified";
  15868. } else {
  15869. $1=packageName;
  15870. }
  15871. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,$1);
  15872. $2=$recv($globals.SystemAnnouncer)._current();
  15873. $3=$recv($globals.ClassAdded)._new();
  15874. $recv($3)._theClass_(newClass);
  15875. $recv($2)._announce_($recv($3)._yourself());
  15876. return newClass;
  15877. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:slots:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,newClass:newClass})});
  15878. }; }),
  15879. $globals.ClassBuilder);
  15880. $core.addMethod(
  15881. $core.method({
  15882. selector: "sortClasses:",
  15883. protocol: "as yet unclassified",
  15884. args: ["aCollection"],
  15885. source: "sortClasses: aCollection\x0a\x09| root members |\x0a\x09root := {nil. {}}.\x0a\x09members := HashedCollection new.\x0a\x09aCollection do: [ :each | members at: each name put: {each. {}} ].\x0a\x09(aCollection asArray sorted: [ :a :b | a name <= b name ]) do: [ :each |\x0a\x09\x09| target |\x0a\x09\x09target := members\x0a\x09\x09\x09at: (each superclass ifNotNil: [ :superklass | superklass name ])\x0a\x09\x09\x09ifAbsent: [ root ].\x0a\x09\x09target second add: (members at: each name) ].\x0a\x09^ root second",
  15886. referencedClasses: ["HashedCollection"],
  15887. pragmas: [],
  15888. messageSends: ["new", "do:", "at:put:", "name", "sorted:", "asArray", "<=", "at:ifAbsent:", "ifNotNil:", "superclass", "add:", "second", "at:"]
  15889. }, function ($methodClass){ return function (aCollection){
  15890. var self=this,$self=this;
  15891. var root,members;
  15892. return $core.withContext(function($ctx1) {
  15893. var $1,$2,$3;
  15894. root=[nil,[]];
  15895. members=$recv($globals.HashedCollection)._new();
  15896. [$recv(aCollection)._do_((function(each){
  15897. return $core.withContext(function($ctx2) {
  15898. return $recv(members)._at_put_([$recv(each)._name()
  15899. ,$ctx2.sendIdx["name"]=1
  15900. ][0],[each,[]]);
  15901. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15902. }))
  15903. ,$ctx1.sendIdx["do:"]=1
  15904. ][0];
  15905. $recv($recv($recv(aCollection)._asArray())._sorted_((function(a,b){
  15906. return $core.withContext(function($ctx2) {
  15907. return $recv([$recv(a)._name()
  15908. ,$ctx2.sendIdx["name"]=2
  15909. ][0]).__lt_eq([$recv(b)._name()
  15910. ,$ctx2.sendIdx["name"]=3
  15911. ][0]);
  15912. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  15913. })))._do_((function(each){
  15914. var target;
  15915. return $core.withContext(function($ctx2) {
  15916. $1=members;
  15917. $2=$recv(each)._superclass();
  15918. if($2 == null || $2.a$nil){
  15919. $3=$2;
  15920. } else {
  15921. var superklass;
  15922. superklass=$2;
  15923. $3=[$recv(superklass)._name()
  15924. ,$ctx2.sendIdx["name"]=4
  15925. ][0];
  15926. }
  15927. target=$recv($1)._at_ifAbsent_($3,(function(){
  15928. return root;
  15929. }));
  15930. return $recv([$recv(target)._second()
  15931. ,$ctx2.sendIdx["second"]=1
  15932. ][0])._add_($recv(members)._at_($recv(each)._name()));
  15933. }, function($ctx2) {$ctx2.fillBlock({each:each,target:target},$ctx1,3)});
  15934. }));
  15935. return $recv(root)._second();
  15936. }, function($ctx1) {$ctx1.fill(self,"sortClasses:",{aCollection:aCollection,root:root,members:members})});
  15937. }; }),
  15938. $globals.ClassBuilder.a$cls);
  15939. $core.addTrait("TBehaviorDefaults", "Kernel-Classes");
  15940. $core.addMethod(
  15941. $core.method({
  15942. selector: "allInstanceVariableNames",
  15943. protocol: "accessing",
  15944. args: [],
  15945. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  15946. referencedClasses: [],
  15947. pragmas: [],
  15948. messageSends: []
  15949. }, function ($methodClass){ return function (){
  15950. var self=this,$self=this;
  15951. return [];
  15952. }; }),
  15953. $globals.TBehaviorDefaults);
  15954. $core.addMethod(
  15955. $core.method({
  15956. selector: "allSubclassesDo:",
  15957. protocol: "enumerating",
  15958. args: ["aBlock"],
  15959. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  15960. referencedClasses: [],
  15961. pragmas: [],
  15962. messageSends: []
  15963. }, function ($methodClass){ return function (aBlock){
  15964. var self=this,$self=this;
  15965. return self;
  15966. }; }),
  15967. $globals.TBehaviorDefaults);
  15968. $core.addMethod(
  15969. $core.method({
  15970. selector: "includingPossibleMetaDo:",
  15971. protocol: "enumerating",
  15972. args: ["aBlock"],
  15973. source: "includingPossibleMetaDo: aBlock\x0a\x09\x22Default for non-classes.\x22\x0a\x09aBlock value: self",
  15974. referencedClasses: [],
  15975. pragmas: [],
  15976. messageSends: ["value:"]
  15977. }, function ($methodClass){ return function (aBlock){
  15978. var self=this,$self=this;
  15979. return $core.withContext(function($ctx1) {
  15980. $recv(aBlock)._value_(self);
  15981. return self;
  15982. }, function($ctx1) {$ctx1.fill(self,"includingPossibleMetaDo:",{aBlock:aBlock})});
  15983. }; }),
  15984. $globals.TBehaviorDefaults);
  15985. $core.addMethod(
  15986. $core.method({
  15987. selector: "name",
  15988. protocol: "accessing",
  15989. args: [],
  15990. source: "name\x0a\x09^ nil",
  15991. referencedClasses: [],
  15992. pragmas: [],
  15993. messageSends: []
  15994. }, function ($methodClass){ return function (){
  15995. var self=this,$self=this;
  15996. return nil;
  15997. }; }),
  15998. $globals.TBehaviorDefaults);
  15999. $core.addMethod(
  16000. $core.method({
  16001. selector: "printOn:",
  16002. protocol: "printing",
  16003. args: ["aStream"],
  16004. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  16005. referencedClasses: [],
  16006. pragmas: [],
  16007. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  16008. }, function ($methodClass){ return function (aStream){
  16009. var self=this,$self=this;
  16010. return $core.withContext(function($ctx1) {
  16011. var $1;
  16012. $1=$self._name();
  16013. if($1 == null || $1.a$nil){
  16014. [(
  16015. $ctx1.supercall = true,
  16016. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  16017. ,$ctx1.supercall = false
  16018. ][0];
  16019. } else {
  16020. var name;
  16021. name=$1;
  16022. $recv(aStream)._nextPutAll_(name);
  16023. }
  16024. return self;
  16025. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  16026. }; }),
  16027. $globals.TBehaviorDefaults);
  16028. $core.addMethod(
  16029. $core.method({
  16030. selector: "superclass",
  16031. protocol: "accessing",
  16032. args: [],
  16033. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  16034. referencedClasses: [],
  16035. pragmas: [],
  16036. messageSends: []
  16037. }, function ($methodClass){ return function (){
  16038. var self=this,$self=this;
  16039. return nil;
  16040. }; }),
  16041. $globals.TBehaviorDefaults);
  16042. $core.addMethod(
  16043. $core.method({
  16044. selector: "traitUsers",
  16045. protocol: "accessing",
  16046. args: [],
  16047. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  16048. referencedClasses: [],
  16049. pragmas: [],
  16050. messageSends: []
  16051. }, function ($methodClass){ return function (){
  16052. var self=this,$self=this;
  16053. return [];
  16054. }; }),
  16055. $globals.TBehaviorDefaults);
  16056. $core.addTrait("TBehaviorProvider", "Kernel-Classes");
  16057. $globals.TBehaviorProvider.comment="I have method dictionary and organization.";
  16058. $core.addMethod(
  16059. $core.method({
  16060. selector: ">>",
  16061. protocol: "accessing",
  16062. args: ["aString"],
  16063. source: ">> aString\x0a\x09^ self methodAt: aString",
  16064. referencedClasses: [],
  16065. pragmas: [],
  16066. messageSends: ["methodAt:"]
  16067. }, function ($methodClass){ return function (aString){
  16068. var self=this,$self=this;
  16069. return $core.withContext(function($ctx1) {
  16070. return $self._methodAt_(aString);
  16071. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString})});
  16072. }; }),
  16073. $globals.TBehaviorProvider);
  16074. $core.addMethod(
  16075. $core.method({
  16076. selector: "addCompiledMethod:",
  16077. protocol: "compiling",
  16078. args: ["aMethod"],
  16079. source: "addCompiledMethod: aMethod\x0a\x09| oldMethod announcement |\x0a\x09\x0a\x09oldMethod := self methodDictionary\x0a\x09\x09at: aMethod selector\x0a\x09\x09ifAbsent: [ nil ].\x0a\x09\x0a\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09announcement := oldMethod\x0a\x09\x09ifNil: [\x0a\x09\x09\x09MethodAdded new\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ]\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09MethodModified new\x0a\x09\x09\x09\x09\x09oldMethod: oldMethod;\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ].\x0a\x09\x09\x09\x09\x09\x0a\x09\x09\x09\x09\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09\x09\x09announce: announcement",
  16080. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  16081. pragmas: [],
  16082. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  16083. }, function ($methodClass){ return function (aMethod){
  16084. var self=this,$self=this;
  16085. var oldMethod,announcement;
  16086. return $core.withContext(function($ctx1) {
  16087. var $1,$2,$3;
  16088. oldMethod=$recv($self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  16089. return nil;
  16090. }));
  16091. $self._basicAddCompiledMethod_(aMethod);
  16092. $1=oldMethod;
  16093. if($1 == null || $1.a$nil){
  16094. $2=[$recv($globals.MethodAdded)._new()
  16095. ,$ctx1.sendIdx["new"]=1
  16096. ][0];
  16097. [$recv($2)._method_(aMethod)
  16098. ,$ctx1.sendIdx["method:"]=1
  16099. ][0];
  16100. announcement=[$recv($2)._yourself()
  16101. ,$ctx1.sendIdx["yourself"]=1
  16102. ][0];
  16103. } else {
  16104. $3=$recv($globals.MethodModified)._new();
  16105. $recv($3)._oldMethod_(oldMethod);
  16106. $recv($3)._method_(aMethod);
  16107. announcement=$recv($3)._yourself();
  16108. }
  16109. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  16110. return self;
  16111. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement})});
  16112. }; }),
  16113. $globals.TBehaviorProvider);
  16114. $core.addMethod(
  16115. $core.method({
  16116. selector: "basicAddCompiledMethod:",
  16117. protocol: "private",
  16118. args: ["aMethod"],
  16119. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  16120. referencedClasses: [],
  16121. pragmas: [["inlineJS:", ["$core.addMethod(aMethod, self)"]]],
  16122. messageSends: []
  16123. }, function ($methodClass){ return function (aMethod){
  16124. var self=this,$self=this;
  16125. return $core.withContext(function($ctx1) {
  16126. $core.addMethod(aMethod, self);
  16127. return self;
  16128. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod})});
  16129. }; }),
  16130. $globals.TBehaviorProvider);
  16131. $core.addMethod(
  16132. $core.method({
  16133. selector: "basicRemoveCompiledMethod:",
  16134. protocol: "private",
  16135. args: ["aMethod"],
  16136. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  16137. referencedClasses: [],
  16138. pragmas: [["inlineJS:", ["$core.removeMethod(aMethod,self)"]]],
  16139. messageSends: []
  16140. }, function ($methodClass){ return function (aMethod){
  16141. var self=this,$self=this;
  16142. return $core.withContext(function($ctx1) {
  16143. $core.removeMethod(aMethod,self);
  16144. return self;
  16145. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod})});
  16146. }; }),
  16147. $globals.TBehaviorProvider);
  16148. $core.addMethod(
  16149. $core.method({
  16150. selector: "compile:protocol:",
  16151. protocol: "compiling",
  16152. args: ["aString", "anotherString"],
  16153. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  16154. referencedClasses: ["Compiler"],
  16155. pragmas: [],
  16156. messageSends: ["install:forClass:protocol:", "new"]
  16157. }, function ($methodClass){ return function (aString,anotherString){
  16158. var self=this,$self=this;
  16159. return $core.withContext(function($ctx1) {
  16160. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  16161. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString})});
  16162. }; }),
  16163. $globals.TBehaviorProvider);
  16164. $core.addMethod(
  16165. $core.method({
  16166. selector: "includesSelector:",
  16167. protocol: "testing",
  16168. args: ["aString"],
  16169. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  16170. referencedClasses: [],
  16171. pragmas: [],
  16172. messageSends: ["includesKey:", "methodDictionary"]
  16173. }, function ($methodClass){ return function (aString){
  16174. var self=this,$self=this;
  16175. return $core.withContext(function($ctx1) {
  16176. return $recv($self._methodDictionary())._includesKey_(aString);
  16177. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString})});
  16178. }; }),
  16179. $globals.TBehaviorProvider);
  16180. $core.addMethod(
  16181. $core.method({
  16182. selector: "methodAt:",
  16183. protocol: "accessing",
  16184. args: ["aString"],
  16185. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  16186. referencedClasses: [],
  16187. pragmas: [],
  16188. messageSends: ["at:", "methodDictionary"]
  16189. }, function ($methodClass){ return function (aString){
  16190. var self=this,$self=this;
  16191. return $core.withContext(function($ctx1) {
  16192. return $recv($self._methodDictionary())._at_(aString);
  16193. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString})});
  16194. }; }),
  16195. $globals.TBehaviorProvider);
  16196. $core.addMethod(
  16197. $core.method({
  16198. selector: "methodDictionary",
  16199. protocol: "accessing",
  16200. args: [],
  16201. 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'>",
  16202. referencedClasses: [],
  16203. pragmas: [["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"]]],
  16204. messageSends: []
  16205. }, function ($methodClass){ return function (){
  16206. var self=this,$self=this;
  16207. return $core.withContext(function($ctx1) {
  16208. var dict = $globals.HashedCollection._new();
  16209. var methods = self.methods;
  16210. Object.keys(methods).forEach(function(i) {
  16211. if(methods[i].selector) {
  16212. dict._at_put_(methods[i].selector, methods[i]);
  16213. }
  16214. });
  16215. return dict;
  16216. return self;
  16217. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{})});
  16218. }; }),
  16219. $globals.TBehaviorProvider);
  16220. $core.addMethod(
  16221. $core.method({
  16222. selector: "methodOrganizationEnter:andLeave:",
  16223. protocol: "accessing",
  16224. args: ["aMethod", "oldMethod"],
  16225. source: "methodOrganizationEnter: aMethod andLeave: oldMethod\x0a\x09aMethod ifNotNil: [\x0a\x09\x09self organization addElement: aMethod protocol ].\x0a\x09\x0a\x09oldMethod ifNotNil: [\x0a\x09\x09self removeProtocolIfEmpty: oldMethod protocol ]",
  16226. referencedClasses: [],
  16227. pragmas: [],
  16228. messageSends: ["ifNotNil:", "addElement:", "organization", "protocol", "removeProtocolIfEmpty:"]
  16229. }, function ($methodClass){ return function (aMethod,oldMethod){
  16230. var self=this,$self=this;
  16231. return $core.withContext(function($ctx1) {
  16232. if(aMethod == null || aMethod.a$nil){
  16233. aMethod;
  16234. } else {
  16235. $recv($self._organization())._addElement_([$recv(aMethod)._protocol()
  16236. ,$ctx1.sendIdx["protocol"]=1
  16237. ][0]);
  16238. }
  16239. if(oldMethod == null || oldMethod.a$nil){
  16240. oldMethod;
  16241. } else {
  16242. $self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  16243. }
  16244. return self;
  16245. }, function($ctx1) {$ctx1.fill(self,"methodOrganizationEnter:andLeave:",{aMethod:aMethod,oldMethod:oldMethod})});
  16246. }; }),
  16247. $globals.TBehaviorProvider);
  16248. $core.addMethod(
  16249. $core.method({
  16250. selector: "methodTemplate",
  16251. protocol: "accessing",
  16252. args: [],
  16253. 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' ]",
  16254. referencedClasses: ["String"],
  16255. pragmas: [],
  16256. messageSends: ["streamContents:", "write:", "lf", "tab"]
  16257. }, function ($methodClass){ return function (){
  16258. var self=this,$self=this;
  16259. return $core.withContext(function($ctx1) {
  16260. return $recv($globals.String)._streamContents_((function(stream){
  16261. return $core.withContext(function($ctx2) {
  16262. [$recv(stream)._write_("messageSelectorAndArgumentNames")
  16263. ,$ctx2.sendIdx["write:"]=1
  16264. ][0];
  16265. [$recv(stream)._lf()
  16266. ,$ctx2.sendIdx["lf"]=1
  16267. ][0];
  16268. [$recv(stream)._tab()
  16269. ,$ctx2.sendIdx["tab"]=1
  16270. ][0];
  16271. [$recv(stream)._write_("\x22comment stating purpose of message\x22")
  16272. ,$ctx2.sendIdx["write:"]=2
  16273. ][0];
  16274. [$recv(stream)._lf()
  16275. ,$ctx2.sendIdx["lf"]=2
  16276. ][0];
  16277. [$recv(stream)._lf()
  16278. ,$ctx2.sendIdx["lf"]=3
  16279. ][0];
  16280. [$recv(stream)._tab()
  16281. ,$ctx2.sendIdx["tab"]=2
  16282. ][0];
  16283. [$recv(stream)._write_("| temporary variable names |")
  16284. ,$ctx2.sendIdx["write:"]=3
  16285. ][0];
  16286. $recv(stream)._lf();
  16287. $recv(stream)._tab();
  16288. return $recv(stream)._write_("statements");
  16289. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16290. }));
  16291. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{})});
  16292. }; }),
  16293. $globals.TBehaviorProvider);
  16294. $core.addMethod(
  16295. $core.method({
  16296. selector: "methods",
  16297. protocol: "accessing",
  16298. args: [],
  16299. source: "methods\x0a\x09^ self methodDictionary values",
  16300. referencedClasses: [],
  16301. pragmas: [],
  16302. messageSends: ["values", "methodDictionary"]
  16303. }, function ($methodClass){ return function (){
  16304. var self=this,$self=this;
  16305. return $core.withContext(function($ctx1) {
  16306. return $recv($self._methodDictionary())._values();
  16307. }, function($ctx1) {$ctx1.fill(self,"methods",{})});
  16308. }; }),
  16309. $globals.TBehaviorProvider);
  16310. $core.addMethod(
  16311. $core.method({
  16312. selector: "methodsInProtocol:",
  16313. protocol: "accessing",
  16314. args: ["aString"],
  16315. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  16316. referencedClasses: [],
  16317. pragmas: [],
  16318. messageSends: ["select:", "methods", "=", "protocol"]
  16319. }, function ($methodClass){ return function (aString){
  16320. var self=this,$self=this;
  16321. return $core.withContext(function($ctx1) {
  16322. return $recv($self._methods())._select_((function(each){
  16323. return $core.withContext(function($ctx2) {
  16324. return $recv($recv(each)._protocol()).__eq(aString);
  16325. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16326. }));
  16327. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString})});
  16328. }; }),
  16329. $globals.TBehaviorProvider);
  16330. $core.addMethod(
  16331. $core.method({
  16332. selector: "organization",
  16333. protocol: "accessing",
  16334. args: [],
  16335. source: "organization\x0a\x09^ self basicOrganization ifNil: [\x0a\x09\x09self basicOrganization: (ClassOrganizer on: self).\x0a\x09\x09self basicOrganization ]",
  16336. referencedClasses: ["ClassOrganizer"],
  16337. pragmas: [],
  16338. messageSends: ["ifNil:", "basicOrganization", "basicOrganization:", "on:"]
  16339. }, function ($methodClass){ return function (){
  16340. var self=this,$self=this;
  16341. return $core.withContext(function($ctx1) {
  16342. var $1;
  16343. $1=[$self._basicOrganization()
  16344. ,$ctx1.sendIdx["basicOrganization"]=1
  16345. ][0];
  16346. if($1 == null || $1.a$nil){
  16347. $self._basicOrganization_($recv($globals.ClassOrganizer)._on_(self));
  16348. return $self._basicOrganization();
  16349. } else {
  16350. return $1;
  16351. }
  16352. }, function($ctx1) {$ctx1.fill(self,"organization",{})});
  16353. }; }),
  16354. $globals.TBehaviorProvider);
  16355. $core.addMethod(
  16356. $core.method({
  16357. selector: "ownMethods",
  16358. protocol: "accessing",
  16359. args: [],
  16360. 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 ]",
  16361. referencedClasses: ["OrderedCollection"],
  16362. pragmas: [],
  16363. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  16364. }, function ($methodClass){ return function (){
  16365. var self=this,$self=this;
  16366. return $core.withContext(function($ctx1) {
  16367. return $recv($recv($self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  16368. return $core.withContext(function($ctx2) {
  16369. return $recv(acc).__comma($self._ownMethodsInProtocol_(each));
  16370. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  16371. })))._sorted_((function(a,b){
  16372. return $core.withContext(function($ctx2) {
  16373. return $recv([$recv(a)._selector()
  16374. ,$ctx2.sendIdx["selector"]=1
  16375. ][0]).__lt_eq($recv(b)._selector());
  16376. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  16377. }));
  16378. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{})});
  16379. }; }),
  16380. $globals.TBehaviorProvider);
  16381. $core.addMethod(
  16382. $core.method({
  16383. selector: "ownMethodsInProtocol:",
  16384. protocol: "accessing",
  16385. args: ["aString"],
  16386. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each origin = self ]",
  16387. referencedClasses: [],
  16388. pragmas: [],
  16389. messageSends: ["select:", "methodsInProtocol:", "=", "origin"]
  16390. }, function ($methodClass){ return function (aString){
  16391. var self=this,$self=this;
  16392. return $core.withContext(function($ctx1) {
  16393. return $recv($self._methodsInProtocol_(aString))._select_((function(each){
  16394. return $core.withContext(function($ctx2) {
  16395. return $recv($recv(each)._origin()).__eq(self);
  16396. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16397. }));
  16398. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString})});
  16399. }; }),
  16400. $globals.TBehaviorProvider);
  16401. $core.addMethod(
  16402. $core.method({
  16403. selector: "ownProtocols",
  16404. protocol: "accessing",
  16405. args: [],
  16406. 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*' ]",
  16407. referencedClasses: [],
  16408. pragmas: [],
  16409. messageSends: ["reject:", "protocols", "match:"]
  16410. }, function ($methodClass){ return function (){
  16411. var self=this,$self=this;
  16412. return $core.withContext(function($ctx1) {
  16413. return $recv($self._protocols())._reject_((function(each){
  16414. return $core.withContext(function($ctx2) {
  16415. return $recv(each)._match_("^\x5c*");
  16416. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16417. }));
  16418. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{})});
  16419. }; }),
  16420. $globals.TBehaviorProvider);
  16421. $core.addMethod(
  16422. $core.method({
  16423. selector: "packageOfProtocol:",
  16424. protocol: "accessing",
  16425. args: ["aString"],
  16426. 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 ]",
  16427. referencedClasses: ["Package"],
  16428. pragmas: [],
  16429. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  16430. }, function ($methodClass){ return function (aString){
  16431. var self=this,$self=this;
  16432. return $core.withContext(function($ctx1) {
  16433. if(!$core.assert($recv(aString)._beginsWith_("*"))){
  16434. return $self._package();
  16435. }
  16436. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  16437. return nil;
  16438. }));
  16439. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString})});
  16440. }; }),
  16441. $globals.TBehaviorProvider);
  16442. $core.addMethod(
  16443. $core.method({
  16444. selector: "protocols",
  16445. protocol: "accessing",
  16446. args: [],
  16447. source: "protocols\x0a\x09^ self organization elements asArray sorted",
  16448. referencedClasses: [],
  16449. pragmas: [],
  16450. messageSends: ["sorted", "asArray", "elements", "organization"]
  16451. }, function ($methodClass){ return function (){
  16452. var self=this,$self=this;
  16453. return $core.withContext(function($ctx1) {
  16454. return $recv($recv($recv($self._organization())._elements())._asArray())._sorted();
  16455. }, function($ctx1) {$ctx1.fill(self,"protocols",{})});
  16456. }; }),
  16457. $globals.TBehaviorProvider);
  16458. $core.addMethod(
  16459. $core.method({
  16460. selector: "protocolsDo:",
  16461. protocol: "enumerating",
  16462. args: ["aBlock"],
  16463. 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) ]",
  16464. referencedClasses: ["HashedCollection", "Array"],
  16465. pragmas: [],
  16466. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  16467. }, function ($methodClass){ return function (aBlock){
  16468. var self=this,$self=this;
  16469. var methodsByProtocol;
  16470. return $core.withContext(function($ctx1) {
  16471. methodsByProtocol=[$recv($globals.HashedCollection)._new()
  16472. ,$ctx1.sendIdx["new"]=1
  16473. ][0];
  16474. $recv($self._methodDictionary())._valuesDo_((function(m){
  16475. return $core.withContext(function($ctx2) {
  16476. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  16477. return $core.withContext(function($ctx3) {
  16478. return $recv($globals.Array)._new();
  16479. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  16480. })))._add_(m);
  16481. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  16482. }));
  16483. $recv($self._protocols())._do_((function(protocol){
  16484. return $core.withContext(function($ctx2) {
  16485. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  16486. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  16487. }));
  16488. return self;
  16489. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol})});
  16490. }; }),
  16491. $globals.TBehaviorProvider);
  16492. $core.addMethod(
  16493. $core.method({
  16494. selector: "recompile",
  16495. protocol: "compiling",
  16496. args: [],
  16497. source: "recompile\x0a\x09^ Compiler new recompile: self",
  16498. referencedClasses: ["Compiler"],
  16499. pragmas: [],
  16500. messageSends: ["recompile:", "new"]
  16501. }, function ($methodClass){ return function (){
  16502. var self=this,$self=this;
  16503. return $core.withContext(function($ctx1) {
  16504. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  16505. }, function($ctx1) {$ctx1.fill(self,"recompile",{})});
  16506. }; }),
  16507. $globals.TBehaviorProvider);
  16508. $core.addMethod(
  16509. $core.method({
  16510. selector: "removeCompiledMethod:",
  16511. protocol: "compiling",
  16512. args: ["aMethod"],
  16513. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  16514. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  16515. pragmas: [],
  16516. messageSends: ["basicRemoveCompiledMethod:", "announce:", "current", "method:", "new", "yourself"]
  16517. }, function ($methodClass){ return function (aMethod){
  16518. var self=this,$self=this;
  16519. return $core.withContext(function($ctx1) {
  16520. var $1,$2;
  16521. $self._basicRemoveCompiledMethod_(aMethod);
  16522. $1=$recv($globals.SystemAnnouncer)._current();
  16523. $2=$recv($globals.MethodRemoved)._new();
  16524. $recv($2)._method_(aMethod);
  16525. $recv($1)._announce_($recv($2)._yourself());
  16526. return self;
  16527. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod})});
  16528. }; }),
  16529. $globals.TBehaviorProvider);
  16530. $core.addMethod(
  16531. $core.method({
  16532. selector: "removeProtocolIfEmpty:",
  16533. protocol: "accessing",
  16534. args: ["aString"],
  16535. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  16536. referencedClasses: [],
  16537. pragmas: [],
  16538. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  16539. }, function ($methodClass){ return function (aString){
  16540. var self=this,$self=this;
  16541. return $core.withContext(function($ctx1) {
  16542. $recv($self._methods())._detect_ifNone_((function(each){
  16543. return $core.withContext(function($ctx2) {
  16544. return $recv($recv(each)._protocol()).__eq(aString);
  16545. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16546. }),(function(){
  16547. return $core.withContext(function($ctx2) {
  16548. return $recv($self._organization())._removeElement_(aString);
  16549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16550. }));
  16551. return self;
  16552. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString})});
  16553. }; }),
  16554. $globals.TBehaviorProvider);
  16555. $core.addMethod(
  16556. $core.method({
  16557. selector: "selectors",
  16558. protocol: "accessing",
  16559. args: [],
  16560. source: "selectors\x0a\x09^ self methodDictionary keys",
  16561. referencedClasses: [],
  16562. pragmas: [],
  16563. messageSends: ["keys", "methodDictionary"]
  16564. }, function ($methodClass){ return function (){
  16565. var self=this,$self=this;
  16566. return $core.withContext(function($ctx1) {
  16567. return $recv($self._methodDictionary())._keys();
  16568. }, function($ctx1) {$ctx1.fill(self,"selectors",{})});
  16569. }; }),
  16570. $globals.TBehaviorProvider);
  16571. $core.addMethod(
  16572. $core.method({
  16573. selector: "setTraitComposition:",
  16574. protocol: "compiling",
  16575. args: ["aTraitComposition"],
  16576. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  16577. referencedClasses: [],
  16578. pragmas: [["inlineJS:", ["$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)"]]],
  16579. messageSends: []
  16580. }, function ($methodClass){ return function (aTraitComposition){
  16581. var self=this,$self=this;
  16582. return $core.withContext(function($ctx1) {
  16583. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  16584. return self;
  16585. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition})});
  16586. }; }),
  16587. $globals.TBehaviorProvider);
  16588. $core.addMethod(
  16589. $core.method({
  16590. selector: "traitComposition",
  16591. protocol: "accessing",
  16592. args: [],
  16593. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition')\x0a\x09\x09ifNil: [ #() ]\x0a\x09\x09ifNotNil: [ :aCollection | aCollection collect: [ :each | TraitTransformation fromJSON: each ] ]",
  16594. referencedClasses: ["TraitTransformation"],
  16595. pragmas: [],
  16596. messageSends: ["ifNil:ifNotNil:", "basicAt:", "collect:", "fromJSON:"]
  16597. }, function ($methodClass){ return function (){
  16598. var self=this,$self=this;
  16599. return $core.withContext(function($ctx1) {
  16600. var $1;
  16601. $1=$self._basicAt_("traitComposition");
  16602. if($1 == null || $1.a$nil){
  16603. return [];
  16604. } else {
  16605. var aCollection;
  16606. aCollection=$1;
  16607. return $recv(aCollection)._collect_((function(each){
  16608. return $core.withContext(function($ctx2) {
  16609. return $recv($globals.TraitTransformation)._fromJSON_(each);
  16610. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  16611. }));
  16612. }
  16613. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{})});
  16614. }; }),
  16615. $globals.TBehaviorProvider);
  16616. $core.addMethod(
  16617. $core.method({
  16618. selector: "traitCompositionDefinition",
  16619. protocol: "accessing",
  16620. args: [],
  16621. 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: '}' ] ]",
  16622. referencedClasses: ["String"],
  16623. pragmas: [],
  16624. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  16625. }, function ($methodClass){ return function (){
  16626. var self=this,$self=this;
  16627. return $core.withContext(function($ctx1) {
  16628. return $recv($self._traitComposition())._ifNotEmpty_((function(traitComposition){
  16629. return $core.withContext(function($ctx2) {
  16630. return $recv($globals.String)._streamContents_((function(str){
  16631. return $core.withContext(function($ctx3) {
  16632. [$recv(str)._write_("{")
  16633. ,$ctx3.sendIdx["write:"]=1
  16634. ][0];
  16635. $recv(traitComposition)._do_separatedBy_((function(each){
  16636. return $core.withContext(function($ctx4) {
  16637. return [$recv(str)._write_($recv(each)._definition())
  16638. ,$ctx4.sendIdx["write:"]=2
  16639. ][0];
  16640. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  16641. }),(function(){
  16642. return $core.withContext(function($ctx4) {
  16643. return [$recv(str)._write_(". ")
  16644. ,$ctx4.sendIdx["write:"]=3
  16645. ][0];
  16646. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  16647. }));
  16648. return $recv(str)._write_("}");
  16649. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  16650. }));
  16651. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  16652. }));
  16653. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{})});
  16654. }; }),
  16655. $globals.TBehaviorProvider);
  16656. $core.addTrait("TMasterBehavior", "Kernel-Classes");
  16657. $globals.TMasterBehavior.comment="I am the behavior on the instance-side of the browser.\x0a\x0aI define things like package, category, name, comment etc.\x0aas opposed to derived behaviors (metaclass, class trait, ...)\x0athat relate to me.";
  16658. $core.addMethod(
  16659. $core.method({
  16660. selector: "asJavaScriptSource",
  16661. protocol: "converting",
  16662. args: [],
  16663. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  16664. referencedClasses: [],
  16665. pragmas: [],
  16666. messageSends: [",", "name"]
  16667. }, function ($methodClass){ return function (){
  16668. var self=this,$self=this;
  16669. return $core.withContext(function($ctx1) {
  16670. return "$globals.".__comma($self._name());
  16671. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  16672. }; }),
  16673. $globals.TMasterBehavior);
  16674. $core.addMethod(
  16675. $core.method({
  16676. selector: "browse",
  16677. protocol: "browsing",
  16678. args: [],
  16679. source: "browse\x0a\x09Finder findClass: self",
  16680. referencedClasses: ["Finder"],
  16681. pragmas: [],
  16682. messageSends: ["findClass:"]
  16683. }, function ($methodClass){ return function (){
  16684. var self=this,$self=this;
  16685. return $core.withContext(function($ctx1) {
  16686. $recv($globals.Finder)._findClass_(self);
  16687. return self;
  16688. }, function($ctx1) {$ctx1.fill(self,"browse",{})});
  16689. }; }),
  16690. $globals.TMasterBehavior);
  16691. $core.addMethod(
  16692. $core.method({
  16693. selector: "category",
  16694. protocol: "accessing",
  16695. args: [],
  16696. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  16697. referencedClasses: [],
  16698. pragmas: [],
  16699. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  16700. }, function ($methodClass){ return function (){
  16701. var self=this,$self=this;
  16702. return $core.withContext(function($ctx1) {
  16703. var $1;
  16704. $1=[$self._package()
  16705. ,$ctx1.sendIdx["package"]=1
  16706. ][0];
  16707. if($1 == null || $1.a$nil){
  16708. return "Unclassified";
  16709. } else {
  16710. return $recv($self._package())._name();
  16711. }
  16712. }, function($ctx1) {$ctx1.fill(self,"category",{})});
  16713. }; }),
  16714. $globals.TMasterBehavior);
  16715. $core.addMethod(
  16716. $core.method({
  16717. selector: "classTag",
  16718. protocol: "accessing",
  16719. args: [],
  16720. source: "classTag\x0a\x09\x22Every master behavior should define a class tag.\x22\x0a\x09^ self subclassResponsibility",
  16721. referencedClasses: [],
  16722. pragmas: [],
  16723. messageSends: ["subclassResponsibility"]
  16724. }, function ($methodClass){ return function (){
  16725. var self=this,$self=this;
  16726. return $core.withContext(function($ctx1) {
  16727. return $self._subclassResponsibility();
  16728. }, function($ctx1) {$ctx1.fill(self,"classTag",{})});
  16729. }; }),
  16730. $globals.TMasterBehavior);
  16731. $core.addMethod(
  16732. $core.method({
  16733. selector: "comment",
  16734. protocol: "accessing",
  16735. args: [],
  16736. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  16737. referencedClasses: [],
  16738. pragmas: [],
  16739. messageSends: ["ifNil:", "basicAt:"]
  16740. }, function ($methodClass){ return function (){
  16741. var self=this,$self=this;
  16742. return $core.withContext(function($ctx1) {
  16743. var $1;
  16744. $1=$self._basicAt_("comment");
  16745. if($1 == null || $1.a$nil){
  16746. return "";
  16747. } else {
  16748. return $1;
  16749. }
  16750. }, function($ctx1) {$ctx1.fill(self,"comment",{})});
  16751. }; }),
  16752. $globals.TMasterBehavior);
  16753. $core.addMethod(
  16754. $core.method({
  16755. selector: "comment:",
  16756. protocol: "accessing",
  16757. args: ["aString"],
  16758. 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)",
  16759. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  16760. pragmas: [],
  16761. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  16762. }, function ($methodClass){ return function (aString){
  16763. var self=this,$self=this;
  16764. return $core.withContext(function($ctx1) {
  16765. var $1,$2;
  16766. $self._basicAt_put_("comment",aString);
  16767. $1=$recv($globals.SystemAnnouncer)._current();
  16768. $2=$recv($globals.ClassCommentChanged)._new();
  16769. $recv($2)._theClass_(self);
  16770. $recv($1)._announce_($recv($2)._yourself());
  16771. return self;
  16772. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString})});
  16773. }; }),
  16774. $globals.TMasterBehavior);
  16775. $core.addMethod(
  16776. $core.method({
  16777. selector: "definedMethods",
  16778. protocol: "accessing",
  16779. args: [],
  16780. source: "definedMethods\x0a\x09\x22Answers methods of me and derived 'meta' part if present\x22\x0a\x09| methods |\x0a\x09methods := self methods.\x0a\x09self theMetaClass\x0a\x09\x09ifNil: [ ^ methods ]\x0a\x09\x09ifNotNil: [ :meta | ^ methods, meta methods ]",
  16781. referencedClasses: [],
  16782. pragmas: [],
  16783. messageSends: ["methods", "ifNil:ifNotNil:", "theMetaClass", ","]
  16784. }, function ($methodClass){ return function (){
  16785. var self=this,$self=this;
  16786. var methods;
  16787. return $core.withContext(function($ctx1) {
  16788. var $1;
  16789. methods=[$self._methods()
  16790. ,$ctx1.sendIdx["methods"]=1
  16791. ][0];
  16792. $1=$self._theMetaClass();
  16793. if($1 == null || $1.a$nil){
  16794. return methods;
  16795. } else {
  16796. var meta;
  16797. meta=$1;
  16798. return $recv(methods).__comma($recv(meta)._methods());
  16799. }
  16800. return self;
  16801. }, function($ctx1) {$ctx1.fill(self,"definedMethods",{methods:methods})});
  16802. }; }),
  16803. $globals.TMasterBehavior);
  16804. $core.addMethod(
  16805. $core.method({
  16806. selector: "enterOrganization",
  16807. protocol: "accessing",
  16808. args: [],
  16809. source: "enterOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09(self basicAt: 'category')\x0a\x09\x09\x09ifNil: [ self basicPackage: nil ]\x0a\x09\x09\x09ifNotNil: [ :category |\x0a\x09\x09\x09\x09\x22Amber has 1-1 correspondence between cat and pkg, atm\x22\x0a\x09\x09\x09\x09self basicPackage: (Package named: category).\x0a\x09\x09\x09\x09self package organization addElement: self ] ]",
  16810. referencedClasses: ["Smalltalk", "Package"],
  16811. pragmas: [],
  16812. messageSends: ["ifNotNil:", "ifNil:ifNotNil:", "basicAt:", "basicPackage:", "named:", "addElement:", "organization", "package"]
  16813. }, function ($methodClass){ return function (){
  16814. var self=this,$self=this;
  16815. return $core.withContext(function($ctx1) {
  16816. var $1,$2;
  16817. $1=$globals.Smalltalk;
  16818. if($1 == null || $1.a$nil){
  16819. $1;
  16820. } else {
  16821. $2=$self._basicAt_("category");
  16822. if($2 == null || $2.a$nil){
  16823. [$self._basicPackage_(nil)
  16824. ,$ctx1.sendIdx["basicPackage:"]=1
  16825. ][0];
  16826. } else {
  16827. var category;
  16828. category=$2;
  16829. $self._basicPackage_($recv($globals.Package)._named_(category));
  16830. $recv($recv($self._package())._organization())._addElement_(self);
  16831. }
  16832. }
  16833. return self;
  16834. }, function($ctx1) {$ctx1.fill(self,"enterOrganization",{})});
  16835. }; }),
  16836. $globals.TMasterBehavior);
  16837. $core.addMethod(
  16838. $core.method({
  16839. selector: "leaveOrganization",
  16840. protocol: "accessing",
  16841. args: [],
  16842. source: "leaveOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09self package organization removeElement: self ]",
  16843. referencedClasses: ["Smalltalk"],
  16844. pragmas: [],
  16845. messageSends: ["ifNotNil:", "removeElement:", "organization", "package"]
  16846. }, function ($methodClass){ return function (){
  16847. var self=this,$self=this;
  16848. return $core.withContext(function($ctx1) {
  16849. var $1;
  16850. $1=$globals.Smalltalk;
  16851. if($1 == null || $1.a$nil){
  16852. $1;
  16853. } else {
  16854. $recv($recv($self._package())._organization())._removeElement_(self);
  16855. }
  16856. return self;
  16857. }, function($ctx1) {$ctx1.fill(self,"leaveOrganization",{})});
  16858. }; }),
  16859. $globals.TMasterBehavior);
  16860. $core.addMethod(
  16861. $core.method({
  16862. selector: "name",
  16863. protocol: "accessing",
  16864. args: [],
  16865. source: "name\x0a\x09<inlineJS: 'return self.name'>",
  16866. referencedClasses: [],
  16867. pragmas: [["inlineJS:", ["return self.name"]]],
  16868. messageSends: []
  16869. }, function ($methodClass){ return function (){
  16870. var self=this,$self=this;
  16871. return $core.withContext(function($ctx1) {
  16872. return self.name;
  16873. return self;
  16874. }, function($ctx1) {$ctx1.fill(self,"name",{})});
  16875. }; }),
  16876. $globals.TMasterBehavior);
  16877. $core.addMethod(
  16878. $core.method({
  16879. selector: "package:",
  16880. protocol: "accessing",
  16881. args: ["aPackage"],
  16882. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self\x0a\x09\x09leaveOrganization;\x0a\x09\x09basicAt: 'category' put: aPackage name;\x0a\x09\x09enterOrganization.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  16883. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  16884. pragmas: [],
  16885. messageSends: ["ifTrue:", "=", "package", "leaveOrganization", "basicAt:put:", "name", "enterOrganization", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  16886. }, function ($methodClass){ return function (aPackage){
  16887. var self=this,$self=this;
  16888. var oldPackage;
  16889. return $core.withContext(function($ctx1) {
  16890. var $1,$2;
  16891. if($core.assert($recv([$self._package()
  16892. ,$ctx1.sendIdx["package"]=1
  16893. ][0]).__eq(aPackage))){
  16894. return self;
  16895. }
  16896. oldPackage=$self._package();
  16897. $self._leaveOrganization();
  16898. $self._basicAt_put_("category",$recv(aPackage)._name());
  16899. $self._enterOrganization();
  16900. $1=$recv($globals.SystemAnnouncer)._current();
  16901. $2=$recv($globals.ClassMoved)._new();
  16902. $recv($2)._theClass_(self);
  16903. $recv($2)._oldPackage_(oldPackage);
  16904. $recv($1)._announce_($recv($2)._yourself());
  16905. return self;
  16906. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage})});
  16907. }; }),
  16908. $globals.TMasterBehavior);
  16909. $core.addMethod(
  16910. $core.method({
  16911. selector: "theNonMetaClass",
  16912. protocol: "accessing",
  16913. args: [],
  16914. source: "theNonMetaClass\x0a\x09^ self",
  16915. referencedClasses: [],
  16916. pragmas: [],
  16917. messageSends: []
  16918. }, function ($methodClass){ return function (){
  16919. var self=this,$self=this;
  16920. return self;
  16921. }; }),
  16922. $globals.TMasterBehavior);
  16923. $core.addClass("Trait", $globals.Object, ["organization", "package", "traitUsers"], "Kernel-Classes");
  16924. $core.addMethod(
  16925. $core.method({
  16926. selector: "-",
  16927. protocol: "composition",
  16928. args: ["anArray"],
  16929. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  16930. referencedClasses: [],
  16931. pragmas: [],
  16932. messageSends: ["-", "asTraitTransformation"]
  16933. }, function ($methodClass){ return function (anArray){
  16934. var self=this,$self=this;
  16935. return $core.withContext(function($ctx1) {
  16936. return $recv($self._asTraitTransformation()).__minus(anArray);
  16937. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray})});
  16938. }; }),
  16939. $globals.Trait);
  16940. $core.addMethod(
  16941. $core.method({
  16942. selector: "@",
  16943. protocol: "composition",
  16944. args: ["anArrayOfAssociations"],
  16945. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  16946. referencedClasses: [],
  16947. pragmas: [],
  16948. messageSends: ["@", "asTraitTransformation"]
  16949. }, function ($methodClass){ return function (anArrayOfAssociations){
  16950. var self=this,$self=this;
  16951. return $core.withContext(function($ctx1) {
  16952. return $recv($self._asTraitTransformation()).__at(anArrayOfAssociations);
  16953. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations})});
  16954. }; }),
  16955. $globals.Trait);
  16956. $core.addMethod(
  16957. $core.method({
  16958. selector: "asTraitComposition",
  16959. protocol: "converting",
  16960. args: [],
  16961. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  16962. referencedClasses: [],
  16963. pragmas: [],
  16964. messageSends: ["asTraitComposition", "asTraitTransformation"]
  16965. }, function ($methodClass){ return function (){
  16966. var self=this,$self=this;
  16967. return $core.withContext(function($ctx1) {
  16968. return $recv($self._asTraitTransformation())._asTraitComposition();
  16969. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{})});
  16970. }; }),
  16971. $globals.Trait);
  16972. $core.addMethod(
  16973. $core.method({
  16974. selector: "asTraitTransformation",
  16975. protocol: "converting",
  16976. args: [],
  16977. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  16978. referencedClasses: ["TraitTransformation"],
  16979. pragmas: [],
  16980. messageSends: ["on:"]
  16981. }, function ($methodClass){ return function (){
  16982. var self=this,$self=this;
  16983. return $core.withContext(function($ctx1) {
  16984. return $recv($globals.TraitTransformation)._on_(self);
  16985. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{})});
  16986. }; }),
  16987. $globals.Trait);
  16988. $core.addMethod(
  16989. $core.method({
  16990. selector: "basicOrganization",
  16991. protocol: "accessing",
  16992. args: [],
  16993. source: "basicOrganization\x0a\x09^ organization",
  16994. referencedClasses: [],
  16995. pragmas: [],
  16996. messageSends: []
  16997. }, function ($methodClass){ return function (){
  16998. var self=this,$self=this;
  16999. return $self.organization;
  17000. }; }),
  17001. $globals.Trait);
  17002. $core.addMethod(
  17003. $core.method({
  17004. selector: "basicOrganization:",
  17005. protocol: "accessing",
  17006. args: ["aClassOrganizer"],
  17007. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  17008. referencedClasses: [],
  17009. pragmas: [],
  17010. messageSends: []
  17011. }, function ($methodClass){ return function (aClassOrganizer){
  17012. var self=this,$self=this;
  17013. $self.organization=aClassOrganizer;
  17014. return self;
  17015. }; }),
  17016. $globals.Trait);
  17017. $core.addMethod(
  17018. $core.method({
  17019. selector: "basicPackage:",
  17020. protocol: "accessing",
  17021. args: ["aPackage"],
  17022. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  17023. referencedClasses: [],
  17024. pragmas: [],
  17025. messageSends: []
  17026. }, function ($methodClass){ return function (aPackage){
  17027. var self=this,$self=this;
  17028. $self.package=aPackage;
  17029. return self;
  17030. }; }),
  17031. $globals.Trait);
  17032. $core.addMethod(
  17033. $core.method({
  17034. selector: "classTag",
  17035. protocol: "accessing",
  17036. args: [],
  17037. source: "classTag\x0a\x09^ 'trait'",
  17038. referencedClasses: [],
  17039. pragmas: [],
  17040. messageSends: []
  17041. }, function ($methodClass){ return function (){
  17042. var self=this,$self=this;
  17043. return "trait";
  17044. }; }),
  17045. $globals.Trait);
  17046. $core.addMethod(
  17047. $core.method({
  17048. selector: "definition",
  17049. protocol: "accessing",
  17050. args: [],
  17051. 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 ]",
  17052. referencedClasses: ["String"],
  17053. pragmas: [],
  17054. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  17055. }, function ($methodClass){ return function (){
  17056. var self=this,$self=this;
  17057. return $core.withContext(function($ctx1) {
  17058. return $recv($globals.String)._streamContents_((function(stream){
  17059. return $core.withContext(function($ctx2) {
  17060. [$recv(stream)._write_("Trait named: ")
  17061. ,$ctx2.sendIdx["write:"]=1
  17062. ][0];
  17063. $recv(stream)._printSymbol_($self._name());
  17064. [$recv(stream)._lf()
  17065. ,$ctx2.sendIdx["lf"]=1
  17066. ][0];
  17067. [$recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  17068. return $core.withContext(function($ctx3) {
  17069. return [[$recv($globals.String)._tab()
  17070. ,$ctx3.sendIdx["tab"]=1
  17071. ][0],"uses: ",tcd,$recv($globals.String)._lf()];
  17072. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  17073. })))
  17074. ,$ctx2.sendIdx["write:"]=2
  17075. ][0];
  17076. $recv(stream)._tab();
  17077. $recv(stream)._write_("package: ");
  17078. return $recv(stream)._print_($self._category());
  17079. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  17080. }));
  17081. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  17082. }; }),
  17083. $globals.Trait);
  17084. $core.addMethod(
  17085. $core.method({
  17086. selector: "package",
  17087. protocol: "accessing",
  17088. args: [],
  17089. source: "package\x0a\x09^ package",
  17090. referencedClasses: [],
  17091. pragmas: [],
  17092. messageSends: []
  17093. }, function ($methodClass){ return function (){
  17094. var self=this,$self=this;
  17095. return $self.package;
  17096. }; }),
  17097. $globals.Trait);
  17098. $core.addMethod(
  17099. $core.method({
  17100. selector: "theMetaClass",
  17101. protocol: "accessing",
  17102. args: [],
  17103. source: "theMetaClass\x0a\x09^ nil",
  17104. referencedClasses: [],
  17105. pragmas: [],
  17106. messageSends: []
  17107. }, function ($methodClass){ return function (){
  17108. var self=this,$self=this;
  17109. return nil;
  17110. }; }),
  17111. $globals.Trait);
  17112. $core.addMethod(
  17113. $core.method({
  17114. selector: "traitUsers",
  17115. protocol: "accessing",
  17116. args: [],
  17117. source: "traitUsers\x0a\x09^ traitUsers copy",
  17118. referencedClasses: [],
  17119. pragmas: [],
  17120. messageSends: ["copy"]
  17121. }, function ($methodClass){ return function (){
  17122. var self=this,$self=this;
  17123. return $core.withContext(function($ctx1) {
  17124. return $recv($self.traitUsers)._copy();
  17125. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{})});
  17126. }; }),
  17127. $globals.Trait);
  17128. $core.addMethod(
  17129. $core.method({
  17130. selector: "named:package:",
  17131. protocol: "instance creation",
  17132. args: ["aString", "anotherString"],
  17133. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  17134. referencedClasses: ["ClassBuilder"],
  17135. pragmas: [],
  17136. messageSends: ["addTraitNamed:package:", "new"]
  17137. }, function ($methodClass){ return function (aString,anotherString){
  17138. var self=this,$self=this;
  17139. return $core.withContext(function($ctx1) {
  17140. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  17141. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString})});
  17142. }; }),
  17143. $globals.Trait.a$cls);
  17144. $core.addMethod(
  17145. $core.method({
  17146. selector: "named:uses:package:",
  17147. protocol: "instance creation",
  17148. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  17149. 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",
  17150. referencedClasses: [],
  17151. pragmas: [],
  17152. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  17153. }, function ($methodClass){ return function (aString,aTraitCompositionDescription,anotherString){
  17154. var self=this,$self=this;
  17155. var trait;
  17156. return $core.withContext(function($ctx1) {
  17157. trait=$self._named_package_(aString,anotherString);
  17158. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  17159. return trait;
  17160. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait})});
  17161. }; }),
  17162. $globals.Trait.a$cls);
  17163. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  17164. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  17165. $core.addMethod(
  17166. $core.method({
  17167. selector: "-",
  17168. protocol: "composition",
  17169. args: ["anArray"],
  17170. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  17171. referencedClasses: [],
  17172. pragmas: [],
  17173. messageSends: ["addExclusions:", "copy", "yourself"]
  17174. }, function ($methodClass){ return function (anArray){
  17175. var self=this,$self=this;
  17176. return $core.withContext(function($ctx1) {
  17177. var $1;
  17178. $1=$self._copy();
  17179. $recv($1)._addExclusions_(anArray);
  17180. return $recv($1)._yourself();
  17181. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray})});
  17182. }; }),
  17183. $globals.TraitTransformation);
  17184. $core.addMethod(
  17185. $core.method({
  17186. selector: "@",
  17187. protocol: "composition",
  17188. args: ["anArrayOfAssociations"],
  17189. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  17190. referencedClasses: [],
  17191. pragmas: [],
  17192. messageSends: ["addAliases:", "copy", "yourself"]
  17193. }, function ($methodClass){ return function (anArrayOfAssociations){
  17194. var self=this,$self=this;
  17195. return $core.withContext(function($ctx1) {
  17196. var $1;
  17197. $1=$self._copy();
  17198. $recv($1)._addAliases_(anArrayOfAssociations);
  17199. return $recv($1)._yourself();
  17200. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations})});
  17201. }; }),
  17202. $globals.TraitTransformation);
  17203. $core.addMethod(
  17204. $core.method({
  17205. selector: "addAliases:",
  17206. protocol: "accessing",
  17207. args: ["anArrayOfAssociations"],
  17208. 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",
  17209. referencedClasses: [],
  17210. pragmas: [],
  17211. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  17212. }, function ($methodClass){ return function (anArrayOfAssociations){
  17213. var self=this,$self=this;
  17214. return $core.withContext(function($ctx1) {
  17215. $recv(anArrayOfAssociations)._do_((function(each){
  17216. var key;
  17217. return $core.withContext(function($ctx2) {
  17218. key=$recv(each)._key();
  17219. return $recv($self.aliases)._at_ifPresent_ifAbsent_(key,(function(){
  17220. return $core.withContext(function($ctx3) {
  17221. return $self._error_("Cannot use same alias name twice.");
  17222. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17223. }),(function(){
  17224. return $core.withContext(function($ctx3) {
  17225. return $recv($self.aliases)._at_put_(key,$recv(each)._value());
  17226. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  17227. }));
  17228. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  17229. }));
  17230. return anArrayOfAssociations;
  17231. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations})});
  17232. }; }),
  17233. $globals.TraitTransformation);
  17234. $core.addMethod(
  17235. $core.method({
  17236. selector: "addExclusions:",
  17237. protocol: "accessing",
  17238. args: ["anArray"],
  17239. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  17240. referencedClasses: [],
  17241. pragmas: [],
  17242. messageSends: ["addAll:"]
  17243. }, function ($methodClass){ return function (anArray){
  17244. var self=this,$self=this;
  17245. return $core.withContext(function($ctx1) {
  17246. $recv($self.exclusions)._addAll_(anArray);
  17247. return anArray;
  17248. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray})});
  17249. }; }),
  17250. $globals.TraitTransformation);
  17251. $core.addMethod(
  17252. $core.method({
  17253. selector: "aliases",
  17254. protocol: "accessing",
  17255. args: [],
  17256. source: "aliases\x0a\x09^ aliases",
  17257. referencedClasses: [],
  17258. pragmas: [],
  17259. messageSends: []
  17260. }, function ($methodClass){ return function (){
  17261. var self=this,$self=this;
  17262. return $self.aliases;
  17263. }; }),
  17264. $globals.TraitTransformation);
  17265. $core.addMethod(
  17266. $core.method({
  17267. selector: "asJavaScriptObject",
  17268. protocol: "converting",
  17269. args: [],
  17270. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  17271. referencedClasses: [],
  17272. pragmas: [],
  17273. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  17274. }, function ($methodClass){ return function (){
  17275. var self=this,$self=this;
  17276. return $core.withContext(function($ctx1) {
  17277. return $globals.HashedCollection._newFromPairs_(["trait",$self._trait(),"aliases",$self._aliases(),"exclusions",$recv($recv($self._exclusions())._asArray())._sorted()]);
  17278. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  17279. }; }),
  17280. $globals.TraitTransformation);
  17281. $core.addMethod(
  17282. $core.method({
  17283. selector: "asJavaScriptSource",
  17284. protocol: "converting",
  17285. args: [],
  17286. 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'}' } ]",
  17287. referencedClasses: ["String"],
  17288. pragmas: [],
  17289. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  17290. }, function ($methodClass){ return function (){
  17291. var self=this,$self=this;
  17292. return $core.withContext(function($ctx1) {
  17293. return $recv($globals.String)._streamContents_((function(str){
  17294. return $core.withContext(function($ctx2) {
  17295. return $recv(str)._write_(["{trait: ",[$recv($self._trait())._asJavaScriptSource()
  17296. ,$ctx2.sendIdx["asJavaScriptSource"]=1
  17297. ][0],[$recv($self._aliases())._ifNotEmpty_((function(al){
  17298. return $core.withContext(function($ctx3) {
  17299. return [", aliases: ",$recv(al)._asJSONString()];
  17300. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17301. }))
  17302. ,$ctx2.sendIdx["ifNotEmpty:"]=1
  17303. ][0],$recv($self._exclusions())._ifNotEmpty_((function(ex){
  17304. return $core.withContext(function($ctx3) {
  17305. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  17306. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  17307. })),"}"]);
  17308. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17309. }));
  17310. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  17311. }; }),
  17312. $globals.TraitTransformation);
  17313. $core.addMethod(
  17314. $core.method({
  17315. selector: "asTraitComposition",
  17316. protocol: "converting",
  17317. args: [],
  17318. source: "asTraitComposition\x0a\x09^ { self }",
  17319. referencedClasses: [],
  17320. pragmas: [],
  17321. messageSends: []
  17322. }, function ($methodClass){ return function (){
  17323. var self=this,$self=this;
  17324. return [self];
  17325. }; }),
  17326. $globals.TraitTransformation);
  17327. $core.addMethod(
  17328. $core.method({
  17329. selector: "asTraitTransformation",
  17330. protocol: "converting",
  17331. args: [],
  17332. source: "asTraitTransformation\x0a\x09^ self",
  17333. referencedClasses: [],
  17334. pragmas: [],
  17335. messageSends: []
  17336. }, function ($methodClass){ return function (){
  17337. var self=this,$self=this;
  17338. return self;
  17339. }; }),
  17340. $globals.TraitTransformation);
  17341. $core.addMethod(
  17342. $core.method({
  17343. selector: "definition",
  17344. protocol: "accessing",
  17345. args: [],
  17346. 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: ')' ] ]",
  17347. referencedClasses: ["String"],
  17348. pragmas: [],
  17349. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  17350. }, function ($methodClass){ return function (){
  17351. var self=this,$self=this;
  17352. return $core.withContext(function($ctx1) {
  17353. return $recv($globals.String)._streamContents_((function(str){
  17354. return $core.withContext(function($ctx2) {
  17355. $recv(str)._print_($self._trait());
  17356. [$recv($self._aliases())._ifNotEmpty_((function(al){
  17357. return $core.withContext(function($ctx3) {
  17358. [$recv(str)._write_(" @ {")
  17359. ,$ctx3.sendIdx["write:"]=1
  17360. ][0];
  17361. [$recv($recv(al)._associations())._do_separatedBy_((function(each){
  17362. return $core.withContext(function($ctx4) {
  17363. [$recv(str)._printSymbol_($recv(each)._key())
  17364. ,$ctx4.sendIdx["printSymbol:"]=1
  17365. ][0];
  17366. [$recv(str)._write_(" -> ")
  17367. ,$ctx4.sendIdx["write:"]=2
  17368. ][0];
  17369. return $recv(str)._printSymbol_($recv(each)._value());
  17370. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  17371. }),(function(){
  17372. return $core.withContext(function($ctx4) {
  17373. return [$recv(str)._write_(". ")
  17374. ,$ctx4.sendIdx["write:"]=3
  17375. ][0];
  17376. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  17377. }))
  17378. ,$ctx3.sendIdx["do:separatedBy:"]=1
  17379. ][0];
  17380. return [$recv(str)._write_("}")
  17381. ,$ctx3.sendIdx["write:"]=4
  17382. ][0];
  17383. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17384. }))
  17385. ,$ctx2.sendIdx["ifNotEmpty:"]=1
  17386. ][0];
  17387. return $recv($self._exclusions())._ifNotEmpty_((function(ex){
  17388. return $core.withContext(function($ctx3) {
  17389. [$recv(str)._write_(" - #(")
  17390. ,$ctx3.sendIdx["write:"]=5
  17391. ][0];
  17392. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  17393. return $core.withContext(function($ctx4) {
  17394. return [$recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst())
  17395. ,$ctx4.sendIdx["write:"]=6
  17396. ][0];
  17397. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  17398. }),(function(){
  17399. return $core.withContext(function($ctx4) {
  17400. return $recv(str)._space();
  17401. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  17402. }));
  17403. return $recv(str)._write_(")");
  17404. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  17405. }));
  17406. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17407. }));
  17408. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  17409. }; }),
  17410. $globals.TraitTransformation);
  17411. $core.addMethod(
  17412. $core.method({
  17413. selector: "exclusions",
  17414. protocol: "accessing",
  17415. args: [],
  17416. source: "exclusions\x0a\x09^ exclusions",
  17417. referencedClasses: [],
  17418. pragmas: [],
  17419. messageSends: []
  17420. }, function ($methodClass){ return function (){
  17421. var self=this,$self=this;
  17422. return $self.exclusions;
  17423. }; }),
  17424. $globals.TraitTransformation);
  17425. $core.addMethod(
  17426. $core.method({
  17427. selector: "initialize",
  17428. protocol: "initialization",
  17429. args: [],
  17430. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  17431. referencedClasses: ["Set"],
  17432. pragmas: [],
  17433. messageSends: ["initialize", "new"]
  17434. }, function ($methodClass){ return function (){
  17435. var self=this,$self=this;
  17436. return $core.withContext(function($ctx1) {
  17437. [(
  17438. $ctx1.supercall = true,
  17439. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  17440. ,$ctx1.supercall = false
  17441. ][0];
  17442. $self.aliases=$globals.HashedCollection._newFromPairs_([]);
  17443. $self.exclusions=$recv($globals.Set)._new();
  17444. $self.trait=nil;
  17445. return self;
  17446. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  17447. }; }),
  17448. $globals.TraitTransformation);
  17449. $core.addMethod(
  17450. $core.method({
  17451. selector: "postCopy",
  17452. protocol: "copying",
  17453. args: [],
  17454. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  17455. referencedClasses: [],
  17456. pragmas: [],
  17457. messageSends: ["copy"]
  17458. }, function ($methodClass){ return function (){
  17459. var self=this,$self=this;
  17460. return $core.withContext(function($ctx1) {
  17461. $self.aliases=[$recv($self.aliases)._copy()
  17462. ,$ctx1.sendIdx["copy"]=1
  17463. ][0];
  17464. $self.exclusions=$recv($self.exclusions)._copy();
  17465. return self;
  17466. }, function($ctx1) {$ctx1.fill(self,"postCopy",{})});
  17467. }; }),
  17468. $globals.TraitTransformation);
  17469. $core.addMethod(
  17470. $core.method({
  17471. selector: "trait",
  17472. protocol: "accessing",
  17473. args: [],
  17474. source: "trait\x0a\x09^ trait",
  17475. referencedClasses: [],
  17476. pragmas: [],
  17477. messageSends: []
  17478. }, function ($methodClass){ return function (){
  17479. var self=this,$self=this;
  17480. return $self.trait;
  17481. }; }),
  17482. $globals.TraitTransformation);
  17483. $core.addMethod(
  17484. $core.method({
  17485. selector: "trait:",
  17486. protocol: "accessing",
  17487. args: ["anObject"],
  17488. source: "trait: anObject\x0a\x09trait := anObject",
  17489. referencedClasses: [],
  17490. pragmas: [],
  17491. messageSends: []
  17492. }, function ($methodClass){ return function (anObject){
  17493. var self=this,$self=this;
  17494. $self.trait=anObject;
  17495. return self;
  17496. }; }),
  17497. $globals.TraitTransformation);
  17498. $core.addMethod(
  17499. $core.method({
  17500. selector: "fromJSON:",
  17501. protocol: "instance creation",
  17502. args: ["aJSObject"],
  17503. 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",
  17504. referencedClasses: ["Smalltalk"],
  17505. pragmas: [],
  17506. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  17507. }, function ($methodClass){ return function (aJSObject){
  17508. var self=this,$self=this;
  17509. return $core.withContext(function($ctx1) {
  17510. var $1;
  17511. $1=[(
  17512. $ctx1.supercall = true,
  17513. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._new.call($self))
  17514. ,$ctx1.supercall = false
  17515. ][0];
  17516. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  17517. $recv($1)._addAliases_($recv($recv($globals.Smalltalk)._readJSObject_([$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  17518. return $globals.HashedCollection._newFromPairs_([]);
  17519. }))
  17520. ,$ctx1.sendIdx["at:ifAbsent:"]=1
  17521. ][0]))._associations());
  17522. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  17523. return [];
  17524. })));
  17525. return $recv($1)._yourself();
  17526. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject})});
  17527. }; }),
  17528. $globals.TraitTransformation.a$cls);
  17529. $core.addMethod(
  17530. $core.method({
  17531. selector: "on:",
  17532. protocol: "instance creation",
  17533. args: ["aTrait"],
  17534. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  17535. referencedClasses: [],
  17536. pragmas: [],
  17537. messageSends: ["trait:", "new", "yourself"]
  17538. }, function ($methodClass){ return function (aTrait){
  17539. var self=this,$self=this;
  17540. return $core.withContext(function($ctx1) {
  17541. var $1;
  17542. $1=[(
  17543. $ctx1.supercall = true,
  17544. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._new.call($self))
  17545. ,$ctx1.supercall = false
  17546. ][0];
  17547. $recv($1)._trait_(aTrait);
  17548. return $recv($1)._yourself();
  17549. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait})});
  17550. }; }),
  17551. $globals.TraitTransformation.a$cls);
  17552. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}], $globals.Behavior);
  17553. $core.setTraitComposition([{trait: $globals.TMasterBehavior}, {trait: $globals.TSubclassable}], $globals.Class);
  17554. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}, {trait: $globals.TMasterBehavior}], $globals.Trait);
  17555. $core.addMethod(
  17556. $core.method({
  17557. selector: "asTraitComposition",
  17558. protocol: "*Kernel-Classes",
  17559. args: [],
  17560. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  17561. referencedClasses: [],
  17562. pragmas: [],
  17563. messageSends: ["collect:", "asTraitTransformation"]
  17564. }, function ($methodClass){ return function (){
  17565. var self=this,$self=this;
  17566. return $core.withContext(function($ctx1) {
  17567. return $self._collect_((function(each){
  17568. return $core.withContext(function($ctx2) {
  17569. return $recv(each)._asTraitTransformation();
  17570. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17571. }));
  17572. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{})});
  17573. }; }),
  17574. $globals.Array);
  17575. $core.addMethod(
  17576. $core.method({
  17577. selector: "instanceVariablesStringAsSlotList",
  17578. protocol: "*Kernel-Classes",
  17579. args: [],
  17580. source: "instanceVariablesStringAsSlotList\x0a\x09^ (self tokenize: ' ') reject: [ :each | each isEmpty ]",
  17581. referencedClasses: [],
  17582. pragmas: [],
  17583. messageSends: ["reject:", "tokenize:", "isEmpty"]
  17584. }, function ($methodClass){ return function (){
  17585. var self=this,$self=this;
  17586. return $core.withContext(function($ctx1) {
  17587. return $recv($self._tokenize_(" "))._reject_((function(each){
  17588. return $core.withContext(function($ctx2) {
  17589. return $recv(each)._isEmpty();
  17590. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17591. }));
  17592. }, function($ctx1) {$ctx1.fill(self,"instanceVariablesStringAsSlotList",{})});
  17593. }; }),
  17594. $globals.String);
  17595. });
  17596. define('amber/core/Kernel-Methods',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  17597. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17598. var $pkg = $core.addPackage("Kernel-Methods");
  17599. $pkg.innerEval = function (expr) { return eval(expr); };
  17600. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  17601. $core.addClass("BlockClosure", $globals.Object, ["prototype", "length"], "Kernel-Methods");
  17602. $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 | ... ] `";
  17603. $core.addMethod(
  17604. $core.method({
  17605. selector: "applyTo:arguments:",
  17606. protocol: "evaluating",
  17607. args: ["anObject", "aCollection"],
  17608. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  17609. referencedClasses: [],
  17610. pragmas: [["inlineJS:", ["return self.apply(anObject, aCollection)"]]],
  17611. messageSends: []
  17612. }, function ($methodClass){ return function (anObject,aCollection){
  17613. var self=this,$self=this;
  17614. return $core.withContext(function($ctx1) {
  17615. return self.apply(anObject, aCollection);
  17616. return self;
  17617. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection})});
  17618. }; }),
  17619. $globals.BlockClosure);
  17620. $core.addMethod(
  17621. $core.method({
  17622. selector: "asCompiledMethod:",
  17623. protocol: "converting",
  17624. args: ["aString"],
  17625. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  17626. referencedClasses: [],
  17627. pragmas: [["inlineJS:", ["return $core.method({selector:aString, fn:self});"]]],
  17628. messageSends: []
  17629. }, function ($methodClass){ return function (aString){
  17630. var self=this,$self=this;
  17631. return $core.withContext(function($ctx1) {
  17632. return $core.method({selector:aString, fn:self});;
  17633. return self;
  17634. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString})});
  17635. }; }),
  17636. $globals.BlockClosure);
  17637. $core.addMethod(
  17638. $core.method({
  17639. selector: "asJavaScriptObject",
  17640. protocol: "converting",
  17641. args: [],
  17642. source: "asJavaScriptObject\x0a\x09^ self",
  17643. referencedClasses: [],
  17644. pragmas: [],
  17645. messageSends: []
  17646. }, function ($methodClass){ return function (){
  17647. var self=this,$self=this;
  17648. return self;
  17649. }; }),
  17650. $globals.BlockClosure);
  17651. $core.addMethod(
  17652. $core.method({
  17653. selector: "asJavaScriptSource",
  17654. protocol: "converting",
  17655. args: [],
  17656. source: "asJavaScriptSource\x0a\x09<inlineJS: 'return $self.toString();'>",
  17657. referencedClasses: [],
  17658. pragmas: [["inlineJS:", ["return $self.toString();"]]],
  17659. messageSends: []
  17660. }, function ($methodClass){ return function (){
  17661. var self=this,$self=this;
  17662. return $core.withContext(function($ctx1) {
  17663. return $self.toString();;
  17664. return self;
  17665. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  17666. }; }),
  17667. $globals.BlockClosure);
  17668. $core.addMethod(
  17669. $core.method({
  17670. selector: "compiledSource",
  17671. protocol: "accessing",
  17672. args: [],
  17673. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  17674. referencedClasses: [],
  17675. pragmas: [["inlineJS:", ["return self.toString()"]]],
  17676. messageSends: []
  17677. }, function ($methodClass){ return function (){
  17678. var self=this,$self=this;
  17679. return $core.withContext(function($ctx1) {
  17680. return self.toString();
  17681. return self;
  17682. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{})});
  17683. }; }),
  17684. $globals.BlockClosure);
  17685. $core.addMethod(
  17686. $core.method({
  17687. selector: "currySelf",
  17688. protocol: "converting",
  17689. args: [],
  17690. 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'>",
  17691. referencedClasses: [],
  17692. pragmas: [["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"]]],
  17693. messageSends: []
  17694. }, function ($methodClass){ return function (){
  17695. var self=this,$self=this;
  17696. return $core.withContext(function($ctx1) {
  17697. return function () {
  17698. var args = [ this ];
  17699. args.push.apply(args, arguments);
  17700. return self.apply(null, args);
  17701. }
  17702. ;
  17703. return self;
  17704. }, function($ctx1) {$ctx1.fill(self,"currySelf",{})});
  17705. }; }),
  17706. $globals.BlockClosure);
  17707. $core.addMethod(
  17708. $core.method({
  17709. selector: "ensure:",
  17710. protocol: "evaluating",
  17711. args: ["aBlock"],
  17712. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return $self._value()}finally{aBlock._value()}'>",
  17713. referencedClasses: [],
  17714. pragmas: [["inlineJS:", ["try{return $self._value()}finally{aBlock._value()}"]]],
  17715. messageSends: []
  17716. }, function ($methodClass){ return function (aBlock){
  17717. var self=this,$self=this;
  17718. return $core.withContext(function($ctx1) {
  17719. try{return $self._value()}finally{aBlock._value()};
  17720. return self;
  17721. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock})});
  17722. }; }),
  17723. $globals.BlockClosure);
  17724. $core.addMethod(
  17725. $core.method({
  17726. selector: "fork",
  17727. protocol: "timeout/interval",
  17728. args: [],
  17729. source: "fork\x0a\x09ForkPool default fork: self",
  17730. referencedClasses: ["ForkPool"],
  17731. pragmas: [],
  17732. messageSends: ["fork:", "default"]
  17733. }, function ($methodClass){ return function (){
  17734. var self=this,$self=this;
  17735. return $core.withContext(function($ctx1) {
  17736. $recv($recv($globals.ForkPool)._default())._fork_(self);
  17737. return self;
  17738. }, function($ctx1) {$ctx1.fill(self,"fork",{})});
  17739. }; }),
  17740. $globals.BlockClosure);
  17741. $core.addMethod(
  17742. $core.method({
  17743. selector: "new",
  17744. protocol: "evaluating",
  17745. args: [],
  17746. 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()'>",
  17747. referencedClasses: [],
  17748. pragmas: [["inlineJS:", ["return new self()"]]],
  17749. messageSends: []
  17750. }, function ($methodClass){ return function (){
  17751. var self=this,$self=this;
  17752. return $core.withContext(function($ctx1) {
  17753. return new self();
  17754. return self;
  17755. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  17756. }; }),
  17757. $globals.BlockClosure);
  17758. $core.addMethod(
  17759. $core.method({
  17760. selector: "newValue:",
  17761. protocol: "evaluating",
  17762. args: ["anObject"],
  17763. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  17764. referencedClasses: [],
  17765. pragmas: [],
  17766. messageSends: ["newWithValues:"]
  17767. }, function ($methodClass){ return function (anObject){
  17768. var self=this,$self=this;
  17769. return $core.withContext(function($ctx1) {
  17770. return $self._newWithValues_([anObject]);
  17771. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject})});
  17772. }; }),
  17773. $globals.BlockClosure);
  17774. $core.addMethod(
  17775. $core.method({
  17776. selector: "newValue:value:",
  17777. protocol: "evaluating",
  17778. args: ["anObject", "anObject2"],
  17779. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  17780. referencedClasses: [],
  17781. pragmas: [],
  17782. messageSends: ["newWithValues:"]
  17783. }, function ($methodClass){ return function (anObject,anObject2){
  17784. var self=this,$self=this;
  17785. return $core.withContext(function($ctx1) {
  17786. return $self._newWithValues_([anObject,anObject2]);
  17787. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2})});
  17788. }; }),
  17789. $globals.BlockClosure);
  17790. $core.addMethod(
  17791. $core.method({
  17792. selector: "newValue:value:value:",
  17793. protocol: "evaluating",
  17794. args: ["anObject", "anObject2", "anObject3"],
  17795. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  17796. referencedClasses: [],
  17797. pragmas: [],
  17798. messageSends: ["newWithValues:"]
  17799. }, function ($methodClass){ return function (anObject,anObject2,anObject3){
  17800. var self=this,$self=this;
  17801. return $core.withContext(function($ctx1) {
  17802. return $self._newWithValues_([anObject,anObject2,anObject3]);
  17803. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  17804. }; }),
  17805. $globals.BlockClosure);
  17806. $core.addMethod(
  17807. $core.method({
  17808. selector: "newWithValues:",
  17809. protocol: "evaluating",
  17810. args: ["aCollection"],
  17811. 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'>",
  17812. referencedClasses: [],
  17813. pragmas: [["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"]]],
  17814. messageSends: []
  17815. }, function ($methodClass){ return function (aCollection){
  17816. var self=this,$self=this;
  17817. return $core.withContext(function($ctx1) {
  17818. var object = Object.create(self.prototype);
  17819. var result = self.apply(object, aCollection);
  17820. return typeof result === "object" ? result : object;
  17821. ;
  17822. return self;
  17823. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection})});
  17824. }; }),
  17825. $globals.BlockClosure);
  17826. $core.addMethod(
  17827. $core.method({
  17828. selector: "numArgs",
  17829. protocol: "accessing",
  17830. args: [],
  17831. source: "numArgs\x0a\x09^ length",
  17832. referencedClasses: [],
  17833. pragmas: [],
  17834. messageSends: []
  17835. }, function ($methodClass){ return function (){
  17836. var self=this,$self=this;
  17837. return $self.length;
  17838. }; }),
  17839. $globals.BlockClosure);
  17840. $core.addMethod(
  17841. $core.method({
  17842. selector: "on:do:",
  17843. protocol: "error handling",
  17844. args: ["anErrorClass", "aBlock"],
  17845. source: "on: anErrorClass do: aBlock\x0a\x09^ Smalltalk try: self ifTrue: [ :err | err isKindOf: anErrorClass ] catch: aBlock",
  17846. referencedClasses: ["Smalltalk"],
  17847. pragmas: [],
  17848. messageSends: ["try:ifTrue:catch:", "isKindOf:"]
  17849. }, function ($methodClass){ return function (anErrorClass,aBlock){
  17850. var self=this,$self=this;
  17851. return $core.withContext(function($ctx1) {
  17852. return $recv($globals.Smalltalk)._try_ifTrue_catch_(self,(function(err){
  17853. return $core.withContext(function($ctx2) {
  17854. return $recv(err)._isKindOf_(anErrorClass);
  17855. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  17856. }),aBlock);
  17857. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock})});
  17858. }; }),
  17859. $globals.BlockClosure);
  17860. $core.addMethod(
  17861. $core.method({
  17862. selector: "prototype",
  17863. protocol: "accessing",
  17864. args: [],
  17865. source: "prototype\x0a\x09^ prototype",
  17866. referencedClasses: [],
  17867. pragmas: [],
  17868. messageSends: []
  17869. }, function ($methodClass){ return function (){
  17870. var self=this,$self=this;
  17871. return $self.prototype;
  17872. }; }),
  17873. $globals.BlockClosure);
  17874. $core.addMethod(
  17875. $core.method({
  17876. selector: "provided",
  17877. protocol: "converting",
  17878. args: [],
  17879. source: "provided\x0a\x09\x22Returns JS proxy that allows to access 'static API', as in\x0a\x09 require provided resolve: ...\x0a\x09or\x0a\x09 XMLHttpRequest provided DONE\x22\x0a\x09\x0a\x09^ JSObjectProxy on: self",
  17880. referencedClasses: ["JSObjectProxy"],
  17881. pragmas: [],
  17882. messageSends: ["on:"]
  17883. }, function ($methodClass){ return function (){
  17884. var self=this,$self=this;
  17885. return $core.withContext(function($ctx1) {
  17886. return $recv($globals.JSObjectProxy)._on_(self);
  17887. }, function($ctx1) {$ctx1.fill(self,"provided",{})});
  17888. }; }),
  17889. $globals.BlockClosure);
  17890. $core.addMethod(
  17891. $core.method({
  17892. selector: "receiver",
  17893. protocol: "accessing",
  17894. args: [],
  17895. source: "receiver\x0a\x09^ nil",
  17896. referencedClasses: [],
  17897. pragmas: [],
  17898. messageSends: []
  17899. }, function ($methodClass){ return function (){
  17900. var self=this,$self=this;
  17901. return nil;
  17902. }; }),
  17903. $globals.BlockClosure);
  17904. $core.addMethod(
  17905. $core.method({
  17906. selector: "timeToRun",
  17907. protocol: "evaluating",
  17908. args: [],
  17909. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  17910. referencedClasses: ["Date"],
  17911. pragmas: [],
  17912. messageSends: ["millisecondsToRun:"]
  17913. }, function ($methodClass){ return function (){
  17914. var self=this,$self=this;
  17915. return $core.withContext(function($ctx1) {
  17916. return $recv($globals.Date)._millisecondsToRun_(self);
  17917. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{})});
  17918. }; }),
  17919. $globals.BlockClosure);
  17920. $core.addMethod(
  17921. $core.method({
  17922. selector: "tryCatch:",
  17923. protocol: "error handling",
  17924. args: ["aBlock"],
  17925. 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'>",
  17926. referencedClasses: [],
  17927. pragmas: [["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"]]],
  17928. messageSends: []
  17929. }, function ($methodClass){ return function (aBlock){
  17930. var self=this,$self=this;
  17931. return $core.withContext(function($ctx1) {
  17932. try {
  17933. return $self._value();
  17934. } catch(error) {
  17935. // pass non-local returns undetected
  17936. if (Array.isArray(error) && error.length === 1) throw error;
  17937. return aBlock._value_(error);
  17938. }
  17939. ;
  17940. return self;
  17941. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock})});
  17942. }; }),
  17943. $globals.BlockClosure);
  17944. $core.addMethod(
  17945. $core.method({
  17946. selector: "tryIfTrue:catch:",
  17947. protocol: "error handling",
  17948. args: ["anotherBlock", "aBlock"],
  17949. source: "tryIfTrue: anotherBlock catch: 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\x09if (!anotherBlock._value_(error)) throw error;\x0a\x09\x09\x09return aBlock._value_(error);\x0a\x09\x09}\x0a\x09'>",
  17950. referencedClasses: [],
  17951. pragmas: [["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\x09if (!anotherBlock._value_(error)) throw error;\x0a\x09\x09\x09return aBlock._value_(error);\x0a\x09\x09}\x0a\x09"]]],
  17952. messageSends: []
  17953. }, function ($methodClass){ return function (anotherBlock,aBlock){
  17954. var self=this,$self=this;
  17955. return $core.withContext(function($ctx1) {
  17956. try {
  17957. return $self._value();
  17958. } catch(error) {
  17959. // pass non-local returns undetected
  17960. if (Array.isArray(error) && error.length === 1) throw error;
  17961. if (!anotherBlock._value_(error)) throw error;
  17962. return aBlock._value_(error);
  17963. }
  17964. ;
  17965. return self;
  17966. }, function($ctx1) {$ctx1.fill(self,"tryIfTrue:catch:",{anotherBlock:anotherBlock,aBlock:aBlock})});
  17967. }; }),
  17968. $globals.BlockClosure);
  17969. $core.addMethod(
  17970. $core.method({
  17971. selector: "value",
  17972. protocol: "evaluating",
  17973. args: [],
  17974. source: "value\x0a\x09<inlineJS: 'return self();'>",
  17975. referencedClasses: [],
  17976. pragmas: [["inlineJS:", ["return self();"]]],
  17977. messageSends: []
  17978. }, function ($methodClass){ return function (){
  17979. var self=this,$self=this;
  17980. return $core.withContext(function($ctx1) {
  17981. return self();;
  17982. return self;
  17983. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  17984. }; }),
  17985. $globals.BlockClosure);
  17986. $core.addMethod(
  17987. $core.method({
  17988. selector: "value:",
  17989. protocol: "evaluating",
  17990. args: ["anArg"],
  17991. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  17992. referencedClasses: [],
  17993. pragmas: [["inlineJS:", ["return self(anArg);"]]],
  17994. messageSends: []
  17995. }, function ($methodClass){ return function (anArg){
  17996. var self=this,$self=this;
  17997. return $core.withContext(function($ctx1) {
  17998. return self(anArg);;
  17999. return self;
  18000. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg})});
  18001. }; }),
  18002. $globals.BlockClosure);
  18003. $core.addMethod(
  18004. $core.method({
  18005. selector: "value:value:",
  18006. protocol: "evaluating",
  18007. args: ["firstArg", "secondArg"],
  18008. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  18009. referencedClasses: [],
  18010. pragmas: [["inlineJS:", ["return self(firstArg, secondArg);"]]],
  18011. messageSends: []
  18012. }, function ($methodClass){ return function (firstArg,secondArg){
  18013. var self=this,$self=this;
  18014. return $core.withContext(function($ctx1) {
  18015. return self(firstArg, secondArg);;
  18016. return self;
  18017. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg})});
  18018. }; }),
  18019. $globals.BlockClosure);
  18020. $core.addMethod(
  18021. $core.method({
  18022. selector: "value:value:value:",
  18023. protocol: "evaluating",
  18024. args: ["firstArg", "secondArg", "thirdArg"],
  18025. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  18026. referencedClasses: [],
  18027. pragmas: [["inlineJS:", ["return self(firstArg, secondArg, thirdArg);"]]],
  18028. messageSends: []
  18029. }, function ($methodClass){ return function (firstArg,secondArg,thirdArg){
  18030. var self=this,$self=this;
  18031. return $core.withContext(function($ctx1) {
  18032. return self(firstArg, secondArg, thirdArg);;
  18033. return self;
  18034. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg})});
  18035. }; }),
  18036. $globals.BlockClosure);
  18037. $core.addMethod(
  18038. $core.method({
  18039. selector: "valueWithInterval:",
  18040. protocol: "timeout/interval",
  18041. args: ["aNumber"],
  18042. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  18043. referencedClasses: [],
  18044. pragmas: [["inlineJS:", ["\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09"]]],
  18045. messageSends: []
  18046. }, function ($methodClass){ return function (aNumber){
  18047. var self=this,$self=this;
  18048. return $core.withContext(function($ctx1) {
  18049. var interval = setInterval(self, aNumber);
  18050. return $globals.Timeout._on_(interval);
  18051. ;
  18052. return self;
  18053. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber})});
  18054. }; }),
  18055. $globals.BlockClosure);
  18056. $core.addMethod(
  18057. $core.method({
  18058. selector: "valueWithPossibleArguments:",
  18059. protocol: "evaluating",
  18060. args: ["aCollection"],
  18061. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  18062. referencedClasses: [],
  18063. pragmas: [["inlineJS:", ["return self.apply(null, aCollection);"]]],
  18064. messageSends: []
  18065. }, function ($methodClass){ return function (aCollection){
  18066. var self=this,$self=this;
  18067. return $core.withContext(function($ctx1) {
  18068. return self.apply(null, aCollection);;
  18069. return self;
  18070. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection})});
  18071. }; }),
  18072. $globals.BlockClosure);
  18073. $core.addMethod(
  18074. $core.method({
  18075. selector: "valueWithTimeout:",
  18076. protocol: "timeout/interval",
  18077. args: ["aNumber"],
  18078. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  18079. referencedClasses: [],
  18080. pragmas: [["inlineJS:", ["\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09"]]],
  18081. messageSends: []
  18082. }, function ($methodClass){ return function (aNumber){
  18083. var self=this,$self=this;
  18084. return $core.withContext(function($ctx1) {
  18085. var timeout = setTimeout(self, aNumber);
  18086. return $globals.Timeout._on_(timeout);
  18087. ;
  18088. return self;
  18089. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber})});
  18090. }; }),
  18091. $globals.BlockClosure);
  18092. $core.addMethod(
  18093. $core.method({
  18094. selector: "whileFalse",
  18095. protocol: "controlling",
  18096. args: [],
  18097. source: "whileFalse\x0a\x09self whileFalse: []",
  18098. referencedClasses: [],
  18099. pragmas: [],
  18100. messageSends: ["whileFalse:"]
  18101. }, function ($methodClass){ return function (){
  18102. var self=this,$self=this;
  18103. return $core.withContext(function($ctx1) {
  18104. $self._whileFalse_((function(){
  18105. }));
  18106. return self;
  18107. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{})});
  18108. }; }),
  18109. $globals.BlockClosure);
  18110. $core.addMethod(
  18111. $core.method({
  18112. selector: "whileFalse:",
  18113. protocol: "controlling",
  18114. args: ["aBlock"],
  18115. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert($self._value())) {aBlock._value()}'>",
  18116. referencedClasses: [],
  18117. pragmas: [["inlineJS:", ["while(!$core.assert($self._value())) {aBlock._value()}"]]],
  18118. messageSends: []
  18119. }, function ($methodClass){ return function (aBlock){
  18120. var self=this,$self=this;
  18121. return $core.withContext(function($ctx1) {
  18122. while(!$core.assert($self._value())) {aBlock._value()};
  18123. return self;
  18124. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock})});
  18125. }; }),
  18126. $globals.BlockClosure);
  18127. $core.addMethod(
  18128. $core.method({
  18129. selector: "whileTrue",
  18130. protocol: "controlling",
  18131. args: [],
  18132. source: "whileTrue\x0a\x09self whileTrue: []",
  18133. referencedClasses: [],
  18134. pragmas: [],
  18135. messageSends: ["whileTrue:"]
  18136. }, function ($methodClass){ return function (){
  18137. var self=this,$self=this;
  18138. return $core.withContext(function($ctx1) {
  18139. $self._whileTrue_((function(){
  18140. }));
  18141. return self;
  18142. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{})});
  18143. }; }),
  18144. $globals.BlockClosure);
  18145. $core.addMethod(
  18146. $core.method({
  18147. selector: "whileTrue:",
  18148. protocol: "controlling",
  18149. args: ["aBlock"],
  18150. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert($self._value())) {aBlock._value()}'>",
  18151. referencedClasses: [],
  18152. pragmas: [["inlineJS:", ["while($core.assert($self._value())) {aBlock._value()}"]]],
  18153. messageSends: []
  18154. }, function ($methodClass){ return function (aBlock){
  18155. var self=this,$self=this;
  18156. return $core.withContext(function($ctx1) {
  18157. while($core.assert($self._value())) {aBlock._value()};
  18158. return self;
  18159. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock})});
  18160. }; }),
  18161. $globals.BlockClosure);
  18162. $core.addMethod(
  18163. $core.method({
  18164. selector: "javaScriptConstructorFor:initializingVia:",
  18165. protocol: "instance creation",
  18166. args: ["aPrototype", "aMethodBlock"],
  18167. source: "javaScriptConstructorFor: aPrototype initializingVia: aMethodBlock\x0a\x09<inlineJS: '\x0a\x09\x09function Ctr () {\x0a\x09\x09\x09aMethodBlock.apply(this, arguments);\x0a\x09\x09}\x0a\x09\x09Ctr.prototype = aPrototype;\x0a\x09\x09return Ctr;\x0a\x09'>",
  18168. referencedClasses: [],
  18169. pragmas: [["inlineJS:", ["\x0a\x09\x09function Ctr () {\x0a\x09\x09\x09aMethodBlock.apply(this, arguments);\x0a\x09\x09}\x0a\x09\x09Ctr.prototype = aPrototype;\x0a\x09\x09return Ctr;\x0a\x09"]]],
  18170. messageSends: []
  18171. }, function ($methodClass){ return function (aPrototype,aMethodBlock){
  18172. var self=this,$self=this;
  18173. return $core.withContext(function($ctx1) {
  18174. function Ctr () {
  18175. aMethodBlock.apply(this, arguments);
  18176. }
  18177. Ctr.prototype = aPrototype;
  18178. return Ctr;
  18179. ;
  18180. return self;
  18181. }, function($ctx1) {$ctx1.fill(self,"javaScriptConstructorFor:initializingVia:",{aPrototype:aPrototype,aMethodBlock:aMethodBlock})});
  18182. }; }),
  18183. $globals.BlockClosure.a$cls);
  18184. $core.addClass("CompiledMethod", $globals.Object, ["args", "instantiateFn", "fn", "messageSends", "pragmas", "owner", "methodClass", "protocol", "referencedClasses", "selector", "source"], "Kernel-Methods");
  18185. $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";
  18186. $core.addMethod(
  18187. $core.method({
  18188. selector: "arguments",
  18189. protocol: "accessing",
  18190. args: [],
  18191. source: "arguments\x0a\x09^ args ifNil: [ #() ]",
  18192. referencedClasses: [],
  18193. pragmas: [],
  18194. messageSends: ["ifNil:"]
  18195. }, function ($methodClass){ return function (){
  18196. var self=this,$self=this;
  18197. return $core.withContext(function($ctx1) {
  18198. var $1;
  18199. $1=$self.args;
  18200. if($1 == null || $1.a$nil){
  18201. return [];
  18202. } else {
  18203. return $1;
  18204. }
  18205. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  18206. }; }),
  18207. $globals.CompiledMethod);
  18208. $core.addMethod(
  18209. $core.method({
  18210. selector: "asString",
  18211. protocol: "converting",
  18212. args: [],
  18213. source: "asString\x0a\x09^ self asStringForClass: self methodClass",
  18214. referencedClasses: [],
  18215. pragmas: [],
  18216. messageSends: ["asStringForClass:", "methodClass"]
  18217. }, function ($methodClass){ return function (){
  18218. var self=this,$self=this;
  18219. return $core.withContext(function($ctx1) {
  18220. return $self._asStringForClass_($self._methodClass());
  18221. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  18222. }; }),
  18223. $globals.CompiledMethod);
  18224. $core.addMethod(
  18225. $core.method({
  18226. selector: "asStringForClass:",
  18227. protocol: "converting",
  18228. args: ["aClass"],
  18229. source: "asStringForClass: aClass\x0a\x09| result |\x0a\x09result := aClass name.\x0a\x09self methodClass = aClass \x0a\x09\x09ifFalse: [ result := result, ' (', (self methodClass ifNil: [ 'nil' ] ifNotNil: [ self methodClass name ]), ')'].\x0a\x09(self origin = aClass | (self origin = self methodClass)) \x0a\x09\x09ifFalse: [ result := result, ' /', (self origin ifNil: [ 'nil' ] ifNotNil: [ self origin name ]), '/'].\x0a\x09^ result, ' >> ', self selector symbolPrintString",
  18230. referencedClasses: [],
  18231. pragmas: [],
  18232. messageSends: ["name", "ifFalse:", "=", "methodClass", ",", "ifNil:ifNotNil:", "|", "origin", "symbolPrintString", "selector"]
  18233. }, function ($methodClass){ return function (aClass){
  18234. var self=this,$self=this;
  18235. var result;
  18236. return $core.withContext(function($ctx1) {
  18237. var $1,$2,$3,$4,$5,$6;
  18238. result=[$recv(aClass)._name()
  18239. ,$ctx1.sendIdx["name"]=1
  18240. ][0];
  18241. if(!$core.assert([$recv([$self._methodClass()
  18242. ,$ctx1.sendIdx["methodClass"]=1
  18243. ][0]).__eq(aClass)
  18244. ,$ctx1.sendIdx["="]=1
  18245. ][0])){
  18246. $1=[$recv(result).__comma(" (")
  18247. ,$ctx1.sendIdx[","]=3
  18248. ][0];
  18249. $2=[$self._methodClass()
  18250. ,$ctx1.sendIdx["methodClass"]=2
  18251. ][0];
  18252. if($2 == null || $2.a$nil){
  18253. $3="nil";
  18254. } else {
  18255. $3=[$recv([$self._methodClass()
  18256. ,$ctx1.sendIdx["methodClass"]=3
  18257. ][0])._name()
  18258. ,$ctx1.sendIdx["name"]=2
  18259. ][0];
  18260. }
  18261. result=[$recv([$recv($1).__comma($3)
  18262. ,$ctx1.sendIdx[","]=2
  18263. ][0]).__comma(")")
  18264. ,$ctx1.sendIdx[","]=1
  18265. ][0];
  18266. result;
  18267. }
  18268. if(!$core.assert($recv([$recv([$self._origin()
  18269. ,$ctx1.sendIdx["origin"]=1
  18270. ][0]).__eq(aClass)
  18271. ,$ctx1.sendIdx["="]=2
  18272. ][0]).__or($recv([$self._origin()
  18273. ,$ctx1.sendIdx["origin"]=2
  18274. ][0]).__eq($self._methodClass())))){
  18275. $4=[$recv(result).__comma(" /")
  18276. ,$ctx1.sendIdx[","]=6
  18277. ][0];
  18278. $5=[$self._origin()
  18279. ,$ctx1.sendIdx["origin"]=3
  18280. ][0];
  18281. if($5 == null || $5.a$nil){
  18282. $6="nil";
  18283. } else {
  18284. $6=$recv($self._origin())._name();
  18285. }
  18286. result=[$recv([$recv($4).__comma($6)
  18287. ,$ctx1.sendIdx[","]=5
  18288. ][0]).__comma("/")
  18289. ,$ctx1.sendIdx[","]=4
  18290. ][0];
  18291. result;
  18292. }
  18293. return [$recv($recv(result).__comma(" >> ")).__comma($recv($self._selector())._symbolPrintString())
  18294. ,$ctx1.sendIdx[","]=7
  18295. ][0];
  18296. }, function($ctx1) {$ctx1.fill(self,"asStringForClass:",{aClass:aClass,result:result})});
  18297. }; }),
  18298. $globals.CompiledMethod);
  18299. $core.addMethod(
  18300. $core.method({
  18301. selector: "basicPragmas",
  18302. protocol: "accessing",
  18303. args: [],
  18304. source: "basicPragmas\x0a\x09^ pragmas ifNil: [ #() ]",
  18305. referencedClasses: [],
  18306. pragmas: [],
  18307. messageSends: ["ifNil:"]
  18308. }, function ($methodClass){ return function (){
  18309. var self=this,$self=this;
  18310. return $core.withContext(function($ctx1) {
  18311. var $1;
  18312. $1=$self.pragmas;
  18313. if($1 == null || $1.a$nil){
  18314. return [];
  18315. } else {
  18316. return $1;
  18317. }
  18318. }, function($ctx1) {$ctx1.fill(self,"basicPragmas",{})});
  18319. }; }),
  18320. $globals.CompiledMethod);
  18321. $core.addMethod(
  18322. $core.method({
  18323. selector: "browse",
  18324. protocol: "browsing",
  18325. args: [],
  18326. source: "browse\x0a\x09Finder findMethod: self",
  18327. referencedClasses: ["Finder"],
  18328. pragmas: [],
  18329. messageSends: ["findMethod:"]
  18330. }, function ($methodClass){ return function (){
  18331. var self=this,$self=this;
  18332. return $core.withContext(function($ctx1) {
  18333. $recv($globals.Finder)._findMethod_(self);
  18334. return self;
  18335. }, function($ctx1) {$ctx1.fill(self,"browse",{})});
  18336. }; }),
  18337. $globals.CompiledMethod);
  18338. $core.addMethod(
  18339. $core.method({
  18340. selector: "category",
  18341. protocol: "accessing",
  18342. args: [],
  18343. source: "category\x0a\x09^ self protocol",
  18344. referencedClasses: [],
  18345. pragmas: [],
  18346. messageSends: ["protocol"]
  18347. }, function ($methodClass){ return function (){
  18348. var self=this,$self=this;
  18349. return $core.withContext(function($ctx1) {
  18350. return $self._protocol();
  18351. }, function($ctx1) {$ctx1.fill(self,"category",{})});
  18352. }; }),
  18353. $globals.CompiledMethod);
  18354. $core.addMethod(
  18355. $core.method({
  18356. selector: "defaultProtocol",
  18357. protocol: "defaults",
  18358. args: [],
  18359. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  18360. referencedClasses: [],
  18361. pragmas: [],
  18362. messageSends: []
  18363. }, function ($methodClass){ return function (){
  18364. var self=this,$self=this;
  18365. return "as yet unclassified";
  18366. }; }),
  18367. $globals.CompiledMethod);
  18368. $core.addMethod(
  18369. $core.method({
  18370. selector: "fn",
  18371. protocol: "accessing",
  18372. args: [],
  18373. source: "fn\x0a\x09^ fn",
  18374. referencedClasses: [],
  18375. pragmas: [],
  18376. messageSends: []
  18377. }, function ($methodClass){ return function (){
  18378. var self=this,$self=this;
  18379. return $self.fn;
  18380. }; }),
  18381. $globals.CompiledMethod);
  18382. $core.addMethod(
  18383. $core.method({
  18384. selector: "instantiateFn",
  18385. protocol: "accessing",
  18386. args: [],
  18387. source: "instantiateFn\x0a\x09^ instantiateFn",
  18388. referencedClasses: [],
  18389. pragmas: [],
  18390. messageSends: []
  18391. }, function ($methodClass){ return function (){
  18392. var self=this,$self=this;
  18393. return $self.instantiateFn;
  18394. }; }),
  18395. $globals.CompiledMethod);
  18396. $core.addMethod(
  18397. $core.method({
  18398. selector: "instantiateFn:",
  18399. protocol: "accessing",
  18400. args: ["anObject"],
  18401. source: "instantiateFn: anObject\x0a\x09instantiateFn := anObject",
  18402. referencedClasses: [],
  18403. pragmas: [],
  18404. messageSends: []
  18405. }, function ($methodClass){ return function (anObject){
  18406. var self=this,$self=this;
  18407. $self.instantiateFn=anObject;
  18408. return self;
  18409. }; }),
  18410. $globals.CompiledMethod);
  18411. $core.addMethod(
  18412. $core.method({
  18413. selector: "isCompiledMethod",
  18414. protocol: "testing",
  18415. args: [],
  18416. source: "isCompiledMethod\x0a\x09^ true",
  18417. referencedClasses: [],
  18418. pragmas: [],
  18419. messageSends: []
  18420. }, function ($methodClass){ return function (){
  18421. var self=this,$self=this;
  18422. return true;
  18423. }; }),
  18424. $globals.CompiledMethod);
  18425. $core.addMethod(
  18426. $core.method({
  18427. selector: "isOverridden",
  18428. protocol: "testing",
  18429. args: [],
  18430. source: "isOverridden\x0a self methodClass allSubclassesDo: [ :each |\x0a\x09 (each includesSelector: selector)\x0a \x09ifTrue: [ ^ true ] ].\x0a\x09^ false",
  18431. referencedClasses: [],
  18432. pragmas: [],
  18433. messageSends: ["allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  18434. }, function ($methodClass){ return function (){
  18435. var self=this,$self=this;
  18436. return $core.withContext(function($ctx1) {
  18437. var $early={};
  18438. try {
  18439. $recv($self._methodClass())._allSubclassesDo_((function(each){
  18440. return $core.withContext(function($ctx2) {
  18441. if($core.assert($recv(each)._includesSelector_($self.selector))){
  18442. throw $early=[true];
  18443. }
  18444. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18445. }));
  18446. return false;
  18447. }
  18448. catch(e) {if(e===$early)return e[0]; throw e}
  18449. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{})});
  18450. }; }),
  18451. $globals.CompiledMethod);
  18452. $core.addMethod(
  18453. $core.method({
  18454. selector: "isOverride",
  18455. protocol: "testing",
  18456. args: [],
  18457. 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",
  18458. referencedClasses: [],
  18459. pragmas: [],
  18460. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  18461. }, function ($methodClass){ return function (){
  18462. var self=this,$self=this;
  18463. var superclass;
  18464. return $core.withContext(function($ctx1) {
  18465. var $1;
  18466. superclass=[$recv([$self._methodClass()
  18467. ,$ctx1.sendIdx["methodClass"]=1
  18468. ][0])._superclass()
  18469. ,$ctx1.sendIdx["superclass"]=1
  18470. ][0];
  18471. $1=superclass;
  18472. if($1 == null || $1.a$nil){
  18473. return false;
  18474. } else {
  18475. $1;
  18476. }
  18477. return $recv($recv($recv($self._methodClass())._superclass())._lookupSelector_($self._selector()))._notNil();
  18478. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass})});
  18479. }; }),
  18480. $globals.CompiledMethod);
  18481. $core.addMethod(
  18482. $core.method({
  18483. selector: "messageSends",
  18484. protocol: "accessing",
  18485. args: [],
  18486. source: "messageSends\x0a\x09^ messageSends",
  18487. referencedClasses: [],
  18488. pragmas: [],
  18489. messageSends: []
  18490. }, function ($methodClass){ return function (){
  18491. var self=this,$self=this;
  18492. return $self.messageSends;
  18493. }; }),
  18494. $globals.CompiledMethod);
  18495. $core.addMethod(
  18496. $core.method({
  18497. selector: "methodClass",
  18498. protocol: "accessing",
  18499. args: [],
  18500. source: "methodClass\x0a\x09^ methodClass",
  18501. referencedClasses: [],
  18502. pragmas: [],
  18503. messageSends: []
  18504. }, function ($methodClass){ return function (){
  18505. var self=this,$self=this;
  18506. return $self.methodClass;
  18507. }; }),
  18508. $globals.CompiledMethod);
  18509. $core.addMethod(
  18510. $core.method({
  18511. selector: "origin",
  18512. protocol: "accessing",
  18513. args: [],
  18514. source: "origin\x0a\x09^ owner",
  18515. referencedClasses: [],
  18516. pragmas: [],
  18517. messageSends: []
  18518. }, function ($methodClass){ return function (){
  18519. var self=this,$self=this;
  18520. return $self.owner;
  18521. }; }),
  18522. $globals.CompiledMethod);
  18523. $core.addMethod(
  18524. $core.method({
  18525. selector: "package",
  18526. protocol: "accessing",
  18527. args: [],
  18528. 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 origin ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  18529. referencedClasses: [],
  18530. pragmas: [],
  18531. messageSends: ["ifNotNil:", "origin", "packageOfProtocol:", "protocol"]
  18532. }, function ($methodClass){ return function (){
  18533. var self=this,$self=this;
  18534. return $core.withContext(function($ctx1) {
  18535. var $1;
  18536. $1=$self._origin();
  18537. if($1 == null || $1.a$nil){
  18538. return $1;
  18539. } else {
  18540. var class_;
  18541. class_=$1;
  18542. return $recv(class_)._packageOfProtocol_($self._protocol());
  18543. }
  18544. }, function($ctx1) {$ctx1.fill(self,"package",{})});
  18545. }; }),
  18546. $globals.CompiledMethod);
  18547. $core.addMethod(
  18548. $core.method({
  18549. selector: "pragmas",
  18550. protocol: "accessing",
  18551. args: [],
  18552. source: "pragmas\x0a\x09^ self basicPragmas collect: [ :each | Message selector: each first arguments: each second ]",
  18553. referencedClasses: ["Message"],
  18554. pragmas: [],
  18555. messageSends: ["collect:", "basicPragmas", "selector:arguments:", "first", "second"]
  18556. }, function ($methodClass){ return function (){
  18557. var self=this,$self=this;
  18558. return $core.withContext(function($ctx1) {
  18559. return $recv($self._basicPragmas())._collect_((function(each){
  18560. return $core.withContext(function($ctx2) {
  18561. return $recv($globals.Message)._selector_arguments_($recv(each)._first(),$recv(each)._second());
  18562. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18563. }));
  18564. }, function($ctx1) {$ctx1.fill(self,"pragmas",{})});
  18565. }; }),
  18566. $globals.CompiledMethod);
  18567. $core.addMethod(
  18568. $core.method({
  18569. selector: "pragmas:",
  18570. protocol: "accessing",
  18571. args: ["anArrayOfMessages"],
  18572. source: "pragmas: anArrayOfMessages\x0a\x09pragmas := anArrayOfMessages collect: [ :each | { each selector. each arguments } ]",
  18573. referencedClasses: [],
  18574. pragmas: [],
  18575. messageSends: ["collect:", "selector", "arguments"]
  18576. }, function ($methodClass){ return function (anArrayOfMessages){
  18577. var self=this,$self=this;
  18578. return $core.withContext(function($ctx1) {
  18579. $self.pragmas=$recv(anArrayOfMessages)._collect_((function(each){
  18580. return $core.withContext(function($ctx2) {
  18581. return [$recv(each)._selector(),$recv(each)._arguments()];
  18582. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18583. }));
  18584. return self;
  18585. }, function($ctx1) {$ctx1.fill(self,"pragmas:",{anArrayOfMessages:anArrayOfMessages})});
  18586. }; }),
  18587. $globals.CompiledMethod);
  18588. $core.addMethod(
  18589. $core.method({
  18590. selector: "protocol",
  18591. protocol: "accessing",
  18592. args: [],
  18593. source: "protocol\x0a\x09^ protocol ifNil: [ self defaultProtocol ]",
  18594. referencedClasses: [],
  18595. pragmas: [],
  18596. messageSends: ["ifNil:", "defaultProtocol"]
  18597. }, function ($methodClass){ return function (){
  18598. var self=this,$self=this;
  18599. return $core.withContext(function($ctx1) {
  18600. var $1;
  18601. $1=$self.protocol;
  18602. if($1 == null || $1.a$nil){
  18603. return $self._defaultProtocol();
  18604. } else {
  18605. return $1;
  18606. }
  18607. }, function($ctx1) {$ctx1.fill(self,"protocol",{})});
  18608. }; }),
  18609. $globals.CompiledMethod);
  18610. $core.addMethod(
  18611. $core.method({
  18612. selector: "protocol:",
  18613. protocol: "accessing",
  18614. args: ["aString"],
  18615. source: "protocol: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09protocol := aString.\x0a\x0a\x09oldProtocol ifNotNil: [\x0a\x09\x09SystemAnnouncer current announce: (MethodMoved new\x0a\x09\x09\x09method: self;\x0a\x09\x09\x09oldProtocol: oldProtocol;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09self origin ifNotNil: [ :origin |\x0a\x09\x09origin organization addElement: aString.\x0a\x09\x09origin removeProtocolIfEmpty: oldProtocol ]",
  18616. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  18617. pragmas: [],
  18618. messageSends: ["protocol", "ifNotNil:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "origin", "addElement:", "organization", "removeProtocolIfEmpty:"]
  18619. }, function ($methodClass){ return function (aString){
  18620. var self=this,$self=this;
  18621. var oldProtocol;
  18622. return $core.withContext(function($ctx1) {
  18623. var $1,$2,$3,$4;
  18624. oldProtocol=$self._protocol();
  18625. $self.protocol=aString;
  18626. $1=oldProtocol;
  18627. if($1 == null || $1.a$nil){
  18628. $1;
  18629. } else {
  18630. $2=$recv($globals.SystemAnnouncer)._current();
  18631. $3=$recv($globals.MethodMoved)._new();
  18632. $recv($3)._method_(self);
  18633. $recv($3)._oldProtocol_(oldProtocol);
  18634. $recv($2)._announce_($recv($3)._yourself());
  18635. }
  18636. $4=$self._origin();
  18637. if($4 == null || $4.a$nil){
  18638. $4;
  18639. } else {
  18640. var origin;
  18641. origin=$4;
  18642. $recv($recv(origin)._organization())._addElement_(aString);
  18643. $recv(origin)._removeProtocolIfEmpty_(oldProtocol);
  18644. }
  18645. return self;
  18646. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol})});
  18647. }; }),
  18648. $globals.CompiledMethod);
  18649. $core.addMethod(
  18650. $core.method({
  18651. selector: "referencedClasses",
  18652. protocol: "accessing",
  18653. args: [],
  18654. source: "referencedClasses\x0a\x09^ referencedClasses",
  18655. referencedClasses: [],
  18656. pragmas: [],
  18657. messageSends: []
  18658. }, function ($methodClass){ return function (){
  18659. var self=this,$self=this;
  18660. return $self.referencedClasses;
  18661. }; }),
  18662. $globals.CompiledMethod);
  18663. $core.addMethod(
  18664. $core.method({
  18665. selector: "selector",
  18666. protocol: "accessing",
  18667. args: [],
  18668. source: "selector\x0a\x09^ selector",
  18669. referencedClasses: [],
  18670. pragmas: [],
  18671. messageSends: []
  18672. }, function ($methodClass){ return function (){
  18673. var self=this,$self=this;
  18674. return $self.selector;
  18675. }; }),
  18676. $globals.CompiledMethod);
  18677. $core.addMethod(
  18678. $core.method({
  18679. selector: "selector:",
  18680. protocol: "accessing",
  18681. args: ["aString"],
  18682. source: "selector: aString\x0a\x09selector := aString",
  18683. referencedClasses: [],
  18684. pragmas: [],
  18685. messageSends: []
  18686. }, function ($methodClass){ return function (aString){
  18687. var self=this,$self=this;
  18688. $self.selector=aString;
  18689. return self;
  18690. }; }),
  18691. $globals.CompiledMethod);
  18692. $core.addMethod(
  18693. $core.method({
  18694. selector: "sendTo:arguments:",
  18695. protocol: "evaluating",
  18696. args: ["anObject", "aCollection"],
  18697. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  18698. referencedClasses: [],
  18699. pragmas: [],
  18700. messageSends: ["applyTo:arguments:", "fn"]
  18701. }, function ($methodClass){ return function (anObject,aCollection){
  18702. var self=this,$self=this;
  18703. return $core.withContext(function($ctx1) {
  18704. return $recv($self._fn())._applyTo_arguments_(anObject,aCollection);
  18705. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection})});
  18706. }; }),
  18707. $globals.CompiledMethod);
  18708. $core.addMethod(
  18709. $core.method({
  18710. selector: "source",
  18711. protocol: "accessing",
  18712. args: [],
  18713. source: "source\x0a\x09^ source ifNil: [ '' ]",
  18714. referencedClasses: [],
  18715. pragmas: [],
  18716. messageSends: ["ifNil:"]
  18717. }, function ($methodClass){ return function (){
  18718. var self=this,$self=this;
  18719. return $core.withContext(function($ctx1) {
  18720. var $1;
  18721. $1=$self.source;
  18722. if($1 == null || $1.a$nil){
  18723. return "";
  18724. } else {
  18725. return $1;
  18726. }
  18727. }, function($ctx1) {$ctx1.fill(self,"source",{})});
  18728. }; }),
  18729. $globals.CompiledMethod);
  18730. $core.addMethod(
  18731. $core.method({
  18732. selector: "source:",
  18733. protocol: "accessing",
  18734. args: ["aString"],
  18735. source: "source: aString\x0a\x09source := aString",
  18736. referencedClasses: [],
  18737. pragmas: [],
  18738. messageSends: []
  18739. }, function ($methodClass){ return function (aString){
  18740. var self=this,$self=this;
  18741. $self.source=aString;
  18742. return self;
  18743. }; }),
  18744. $globals.CompiledMethod);
  18745. $core.addClass("ForkPool", $globals.Object, ["poolSize", "maxPoolSize", "queue", "worker"], "Kernel-Methods");
  18746. $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`";
  18747. $core.addMethod(
  18748. $core.method({
  18749. selector: "addWorker",
  18750. protocol: "private",
  18751. args: [],
  18752. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  18753. referencedClasses: [],
  18754. pragmas: [],
  18755. messageSends: ["valueWithTimeout:", "+"]
  18756. }, function ($methodClass){ return function (){
  18757. var self=this,$self=this;
  18758. return $core.withContext(function($ctx1) {
  18759. $recv($self.worker)._valueWithTimeout_((0));
  18760. $self.poolSize=$recv($self.poolSize).__plus((1));
  18761. return self;
  18762. }, function($ctx1) {$ctx1.fill(self,"addWorker",{})});
  18763. }; }),
  18764. $globals.ForkPool);
  18765. $core.addMethod(
  18766. $core.method({
  18767. selector: "defaultMaxPoolSize",
  18768. protocol: "defaults",
  18769. args: [],
  18770. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  18771. referencedClasses: [],
  18772. pragmas: [],
  18773. messageSends: ["defaultMaxPoolSize", "class"]
  18774. }, function ($methodClass){ return function (){
  18775. var self=this,$self=this;
  18776. return $core.withContext(function($ctx1) {
  18777. return $recv($self._class())._defaultMaxPoolSize();
  18778. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{})});
  18779. }; }),
  18780. $globals.ForkPool);
  18781. $core.addMethod(
  18782. $core.method({
  18783. selector: "fork:",
  18784. protocol: "actions",
  18785. args: ["aBlock"],
  18786. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  18787. referencedClasses: [],
  18788. pragmas: [],
  18789. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  18790. }, function ($methodClass){ return function (aBlock){
  18791. var self=this,$self=this;
  18792. return $core.withContext(function($ctx1) {
  18793. if($core.assert($recv($self.poolSize).__lt($self._maxPoolSize()))){
  18794. $self._addWorker();
  18795. }
  18796. $recv($self.queue)._nextPut_(aBlock);
  18797. return self;
  18798. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock})});
  18799. }; }),
  18800. $globals.ForkPool);
  18801. $core.addMethod(
  18802. $core.method({
  18803. selector: "initialize",
  18804. protocol: "initialization",
  18805. args: [],
  18806. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  18807. referencedClasses: ["Queue"],
  18808. pragmas: [],
  18809. messageSends: ["initialize", "new", "makeWorker"]
  18810. }, function ($methodClass){ return function (){
  18811. var self=this,$self=this;
  18812. return $core.withContext(function($ctx1) {
  18813. [(
  18814. $ctx1.supercall = true,
  18815. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  18816. ,$ctx1.supercall = false
  18817. ][0];
  18818. $self.poolSize=(0);
  18819. $self.queue=$recv($globals.Queue)._new();
  18820. $self.worker=$self._makeWorker();
  18821. return self;
  18822. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  18823. }; }),
  18824. $globals.ForkPool);
  18825. $core.addMethod(
  18826. $core.method({
  18827. selector: "makeWorker",
  18828. protocol: "initialization",
  18829. args: [],
  18830. 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 ] ]]",
  18831. referencedClasses: ["Object"],
  18832. pragmas: [],
  18833. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  18834. }, function ($methodClass){ return function (){
  18835. var self=this,$self=this;
  18836. var sentinel;
  18837. return $core.withContext(function($ctx1) {
  18838. sentinel=$recv($globals.Object)._new();
  18839. return (function(){
  18840. var block;
  18841. return $core.withContext(function($ctx2) {
  18842. $self.poolSize=$recv($self.poolSize).__minus((1));
  18843. block=$recv($self.queue)._nextIfAbsent_((function(){
  18844. return sentinel;
  18845. }));
  18846. if(!$core.assert($recv(block).__eq_eq(sentinel))){
  18847. return $recv((function(){
  18848. return $core.withContext(function($ctx3) {
  18849. return $recv(block)._value();
  18850. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  18851. }))._ensure_((function(){
  18852. return $core.withContext(function($ctx3) {
  18853. return $self._addWorker();
  18854. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  18855. }));
  18856. }
  18857. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  18858. });
  18859. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel})});
  18860. }; }),
  18861. $globals.ForkPool);
  18862. $core.addMethod(
  18863. $core.method({
  18864. selector: "maxPoolSize",
  18865. protocol: "accessing",
  18866. args: [],
  18867. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  18868. referencedClasses: [],
  18869. pragmas: [],
  18870. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  18871. }, function ($methodClass){ return function (){
  18872. var self=this,$self=this;
  18873. return $core.withContext(function($ctx1) {
  18874. var $1;
  18875. $1=$self.maxPoolSize;
  18876. if($1 == null || $1.a$nil){
  18877. return $self._defaultMaxPoolSize();
  18878. } else {
  18879. return $1;
  18880. }
  18881. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{})});
  18882. }; }),
  18883. $globals.ForkPool);
  18884. $core.addMethod(
  18885. $core.method({
  18886. selector: "maxPoolSize:",
  18887. protocol: "accessing",
  18888. args: ["anInteger"],
  18889. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  18890. referencedClasses: [],
  18891. pragmas: [],
  18892. messageSends: []
  18893. }, function ($methodClass){ return function (anInteger){
  18894. var self=this,$self=this;
  18895. $self.maxPoolSize=anInteger;
  18896. return self;
  18897. }; }),
  18898. $globals.ForkPool);
  18899. $core.setSlots($globals.ForkPool.a$cls, ["default"]);
  18900. $core.addMethod(
  18901. $core.method({
  18902. selector: "default",
  18903. protocol: "accessing",
  18904. args: [],
  18905. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  18906. referencedClasses: [],
  18907. pragmas: [],
  18908. messageSends: ["ifNil:", "new"]
  18909. }, function ($methodClass){ return function (){
  18910. var self=this,$self=this;
  18911. return $core.withContext(function($ctx1) {
  18912. var $1;
  18913. $1=$self.default;
  18914. if($1 == null || $1.a$nil){
  18915. $self.default=$self._new();
  18916. return $self.default;
  18917. } else {
  18918. return $1;
  18919. }
  18920. }, function($ctx1) {$ctx1.fill(self,"default",{})});
  18921. }; }),
  18922. $globals.ForkPool.a$cls);
  18923. $core.addMethod(
  18924. $core.method({
  18925. selector: "defaultMaxPoolSize",
  18926. protocol: "accessing",
  18927. args: [],
  18928. source: "defaultMaxPoolSize\x0a\x09^ 100",
  18929. referencedClasses: [],
  18930. pragmas: [],
  18931. messageSends: []
  18932. }, function ($methodClass){ return function (){
  18933. var self=this,$self=this;
  18934. return (100);
  18935. }; }),
  18936. $globals.ForkPool.a$cls);
  18937. $core.addMethod(
  18938. $core.method({
  18939. selector: "resetDefault",
  18940. protocol: "accessing",
  18941. args: [],
  18942. source: "resetDefault\x0a\x09default := nil",
  18943. referencedClasses: [],
  18944. pragmas: [],
  18945. messageSends: []
  18946. }, function ($methodClass){ return function (){
  18947. var self=this,$self=this;
  18948. $self.default=nil;
  18949. return self;
  18950. }; }),
  18951. $globals.ForkPool.a$cls);
  18952. $core.addClass("Message", $globals.Object, ["selector", "arguments"], "Kernel-Methods");
  18953. $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.";
  18954. $core.addMethod(
  18955. $core.method({
  18956. selector: "arguments",
  18957. protocol: "accessing",
  18958. args: [],
  18959. source: "arguments\x0a\x09^ arguments",
  18960. referencedClasses: [],
  18961. pragmas: [],
  18962. messageSends: []
  18963. }, function ($methodClass){ return function (){
  18964. var self=this,$self=this;
  18965. return $self.arguments;
  18966. }; }),
  18967. $globals.Message);
  18968. $core.addMethod(
  18969. $core.method({
  18970. selector: "arguments:",
  18971. protocol: "accessing",
  18972. args: ["anArray"],
  18973. source: "arguments: anArray\x0a\x09arguments := anArray",
  18974. referencedClasses: [],
  18975. pragmas: [],
  18976. messageSends: []
  18977. }, function ($methodClass){ return function (anArray){
  18978. var self=this,$self=this;
  18979. $self.arguments=anArray;
  18980. return self;
  18981. }; }),
  18982. $globals.Message);
  18983. $core.addMethod(
  18984. $core.method({
  18985. selector: "printOn:",
  18986. protocol: "printing",
  18987. args: ["aStream"],
  18988. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  18989. referencedClasses: [],
  18990. pragmas: [],
  18991. messageSends: ["printOn:", "nextPutAll:", "selector"]
  18992. }, function ($methodClass){ return function (aStream){
  18993. var self=this,$self=this;
  18994. return $core.withContext(function($ctx1) {
  18995. [(
  18996. $ctx1.supercall = true,
  18997. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  18998. ,$ctx1.supercall = false
  18999. ][0];
  19000. [$recv(aStream)._nextPutAll_("(")
  19001. ,$ctx1.sendIdx["nextPutAll:"]=1
  19002. ][0];
  19003. [$recv(aStream)._nextPutAll_($self._selector())
  19004. ,$ctx1.sendIdx["nextPutAll:"]=2
  19005. ][0];
  19006. $recv(aStream)._nextPutAll_(")");
  19007. return self;
  19008. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  19009. }; }),
  19010. $globals.Message);
  19011. $core.addMethod(
  19012. $core.method({
  19013. selector: "selector",
  19014. protocol: "accessing",
  19015. args: [],
  19016. source: "selector\x0a\x09^ selector",
  19017. referencedClasses: [],
  19018. pragmas: [],
  19019. messageSends: []
  19020. }, function ($methodClass){ return function (){
  19021. var self=this,$self=this;
  19022. return $self.selector;
  19023. }; }),
  19024. $globals.Message);
  19025. $core.addMethod(
  19026. $core.method({
  19027. selector: "selector:",
  19028. protocol: "accessing",
  19029. args: ["aString"],
  19030. source: "selector: aString\x0a\x09selector := aString",
  19031. referencedClasses: [],
  19032. pragmas: [],
  19033. messageSends: []
  19034. }, function ($methodClass){ return function (aString){
  19035. var self=this,$self=this;
  19036. $self.selector=aString;
  19037. return self;
  19038. }; }),
  19039. $globals.Message);
  19040. $core.addMethod(
  19041. $core.method({
  19042. selector: "sendTo:",
  19043. protocol: "actions",
  19044. args: ["anObject"],
  19045. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  19046. referencedClasses: [],
  19047. pragmas: [],
  19048. messageSends: ["perform:withArguments:", "selector", "arguments"]
  19049. }, function ($methodClass){ return function (anObject){
  19050. var self=this,$self=this;
  19051. return $core.withContext(function($ctx1) {
  19052. return $recv(anObject)._perform_withArguments_($self._selector(),$self._arguments());
  19053. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject})});
  19054. }; }),
  19055. $globals.Message);
  19056. $core.addMethod(
  19057. $core.method({
  19058. selector: "selector:arguments:",
  19059. protocol: "instance creation",
  19060. args: ["aString", "anArray"],
  19061. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  19062. referencedClasses: [],
  19063. pragmas: [],
  19064. messageSends: ["selector:", "new", "arguments:", "yourself"]
  19065. }, function ($methodClass){ return function (aString,anArray){
  19066. var self=this,$self=this;
  19067. return $core.withContext(function($ctx1) {
  19068. var $1;
  19069. $1=$self._new();
  19070. $recv($1)._selector_(aString);
  19071. $recv($1)._arguments_(anArray);
  19072. return $recv($1)._yourself();
  19073. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray})});
  19074. }; }),
  19075. $globals.Message.a$cls);
  19076. $core.addMethod(
  19077. $core.method({
  19078. selector: "selector:arguments:notUnderstoodBy:",
  19079. protocol: "dnu handling",
  19080. args: ["aString", "anArray", "anObject"],
  19081. source: "selector: aString arguments: anArray notUnderstoodBy: anObject\x0a\x09\x22Creates the message and passes it to #doesNotUnderstand:.\x0a\x09Used by kernel to handle MNU.\x22\x0a\x09^ anObject doesNotUnderstand:\x0a\x09\x09(self selector: aString arguments: anArray)",
  19082. referencedClasses: [],
  19083. pragmas: [],
  19084. messageSends: ["doesNotUnderstand:", "selector:arguments:"]
  19085. }, function ($methodClass){ return function (aString,anArray,anObject){
  19086. var self=this,$self=this;
  19087. return $core.withContext(function($ctx1) {
  19088. return $recv(anObject)._doesNotUnderstand_($self._selector_arguments_(aString,anArray));
  19089. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:notUnderstoodBy:",{aString:aString,anArray:anArray,anObject:anObject})});
  19090. }; }),
  19091. $globals.Message.a$cls);
  19092. $core.addClass("MessageSend", $globals.Object, ["receiver", "message"], "Kernel-Methods");
  19093. $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.";
  19094. $core.addMethod(
  19095. $core.method({
  19096. selector: "arguments",
  19097. protocol: "accessing",
  19098. args: [],
  19099. source: "arguments\x0a\x09^ message arguments",
  19100. referencedClasses: [],
  19101. pragmas: [],
  19102. messageSends: ["arguments"]
  19103. }, function ($methodClass){ return function (){
  19104. var self=this,$self=this;
  19105. return $core.withContext(function($ctx1) {
  19106. return $recv($self.message)._arguments();
  19107. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  19108. }; }),
  19109. $globals.MessageSend);
  19110. $core.addMethod(
  19111. $core.method({
  19112. selector: "arguments:",
  19113. protocol: "accessing",
  19114. args: ["anArray"],
  19115. source: "arguments: anArray\x0a\x09message arguments: anArray",
  19116. referencedClasses: [],
  19117. pragmas: [],
  19118. messageSends: ["arguments:"]
  19119. }, function ($methodClass){ return function (anArray){
  19120. var self=this,$self=this;
  19121. return $core.withContext(function($ctx1) {
  19122. $recv($self.message)._arguments_(anArray);
  19123. return self;
  19124. }, function($ctx1) {$ctx1.fill(self,"arguments:",{anArray:anArray})});
  19125. }; }),
  19126. $globals.MessageSend);
  19127. $core.addMethod(
  19128. $core.method({
  19129. selector: "initialize",
  19130. protocol: "initialization",
  19131. args: [],
  19132. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  19133. referencedClasses: ["Message"],
  19134. pragmas: [],
  19135. messageSends: ["initialize", "new"]
  19136. }, function ($methodClass){ return function (){
  19137. var self=this,$self=this;
  19138. return $core.withContext(function($ctx1) {
  19139. [(
  19140. $ctx1.supercall = true,
  19141. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  19142. ,$ctx1.supercall = false
  19143. ][0];
  19144. $self.message=$recv($globals.Message)._new();
  19145. return self;
  19146. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  19147. }; }),
  19148. $globals.MessageSend);
  19149. $core.addMethod(
  19150. $core.method({
  19151. selector: "printOn:",
  19152. protocol: "printing",
  19153. args: ["aStream"],
  19154. 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: ')'",
  19155. referencedClasses: [],
  19156. pragmas: [],
  19157. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  19158. }, function ($methodClass){ return function (aStream){
  19159. var self=this,$self=this;
  19160. return $core.withContext(function($ctx1) {
  19161. [(
  19162. $ctx1.supercall = true,
  19163. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  19164. ,$ctx1.supercall = false
  19165. ][0];
  19166. [$recv(aStream)._nextPutAll_("(")
  19167. ,$ctx1.sendIdx["nextPutAll:"]=1
  19168. ][0];
  19169. [$recv(aStream)._nextPutAll_($self._receiver())
  19170. ,$ctx1.sendIdx["nextPutAll:"]=2
  19171. ][0];
  19172. [$recv(aStream)._nextPutAll_(" >> ")
  19173. ,$ctx1.sendIdx["nextPutAll:"]=3
  19174. ][0];
  19175. [$recv(aStream)._nextPutAll_($self._selector())
  19176. ,$ctx1.sendIdx["nextPutAll:"]=4
  19177. ][0];
  19178. $recv(aStream)._nextPutAll_(")");
  19179. return self;
  19180. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  19181. }; }),
  19182. $globals.MessageSend);
  19183. $core.addMethod(
  19184. $core.method({
  19185. selector: "receiver",
  19186. protocol: "accessing",
  19187. args: [],
  19188. source: "receiver\x0a\x09^ receiver",
  19189. referencedClasses: [],
  19190. pragmas: [],
  19191. messageSends: []
  19192. }, function ($methodClass){ return function (){
  19193. var self=this,$self=this;
  19194. return $self.receiver;
  19195. }; }),
  19196. $globals.MessageSend);
  19197. $core.addMethod(
  19198. $core.method({
  19199. selector: "receiver:",
  19200. protocol: "accessing",
  19201. args: ["anObject"],
  19202. source: "receiver: anObject\x0a\x09receiver := anObject",
  19203. referencedClasses: [],
  19204. pragmas: [],
  19205. messageSends: []
  19206. }, function ($methodClass){ return function (anObject){
  19207. var self=this,$self=this;
  19208. $self.receiver=anObject;
  19209. return self;
  19210. }; }),
  19211. $globals.MessageSend);
  19212. $core.addMethod(
  19213. $core.method({
  19214. selector: "selector",
  19215. protocol: "accessing",
  19216. args: [],
  19217. source: "selector\x0a\x09^ message selector",
  19218. referencedClasses: [],
  19219. pragmas: [],
  19220. messageSends: ["selector"]
  19221. }, function ($methodClass){ return function (){
  19222. var self=this,$self=this;
  19223. return $core.withContext(function($ctx1) {
  19224. return $recv($self.message)._selector();
  19225. }, function($ctx1) {$ctx1.fill(self,"selector",{})});
  19226. }; }),
  19227. $globals.MessageSend);
  19228. $core.addMethod(
  19229. $core.method({
  19230. selector: "selector:",
  19231. protocol: "accessing",
  19232. args: ["aString"],
  19233. source: "selector: aString\x0a\x09message selector: aString",
  19234. referencedClasses: [],
  19235. pragmas: [],
  19236. messageSends: ["selector:"]
  19237. }, function ($methodClass){ return function (aString){
  19238. var self=this,$self=this;
  19239. return $core.withContext(function($ctx1) {
  19240. $recv($self.message)._selector_(aString);
  19241. return self;
  19242. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString})});
  19243. }; }),
  19244. $globals.MessageSend);
  19245. $core.addMethod(
  19246. $core.method({
  19247. selector: "value",
  19248. protocol: "evaluating",
  19249. args: [],
  19250. source: "value\x0a\x09^ message sendTo: self receiver",
  19251. referencedClasses: [],
  19252. pragmas: [],
  19253. messageSends: ["sendTo:", "receiver"]
  19254. }, function ($methodClass){ return function (){
  19255. var self=this,$self=this;
  19256. return $core.withContext(function($ctx1) {
  19257. return $recv($self.message)._sendTo_($self._receiver());
  19258. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  19259. }; }),
  19260. $globals.MessageSend);
  19261. $core.addMethod(
  19262. $core.method({
  19263. selector: "value:",
  19264. protocol: "evaluating",
  19265. args: ["anObject"],
  19266. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  19267. referencedClasses: [],
  19268. pragmas: [],
  19269. messageSends: ["arguments:", "sendTo:", "receiver"]
  19270. }, function ($methodClass){ return function (anObject){
  19271. var self=this,$self=this;
  19272. return $core.withContext(function($ctx1) {
  19273. var $1;
  19274. $1=$self.message;
  19275. $recv($1)._arguments_([anObject]);
  19276. return $recv($1)._sendTo_($self._receiver());
  19277. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  19278. }; }),
  19279. $globals.MessageSend);
  19280. $core.addMethod(
  19281. $core.method({
  19282. selector: "value:value:",
  19283. protocol: "evaluating",
  19284. args: ["firstArgument", "secondArgument"],
  19285. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  19286. referencedClasses: [],
  19287. pragmas: [],
  19288. messageSends: ["arguments:", "sendTo:", "receiver"]
  19289. }, function ($methodClass){ return function (firstArgument,secondArgument){
  19290. var self=this,$self=this;
  19291. return $core.withContext(function($ctx1) {
  19292. var $1;
  19293. $1=$self.message;
  19294. $recv($1)._arguments_([firstArgument,secondArgument]);
  19295. return $recv($1)._sendTo_($self._receiver());
  19296. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument})});
  19297. }; }),
  19298. $globals.MessageSend);
  19299. $core.addMethod(
  19300. $core.method({
  19301. selector: "value:value:value:",
  19302. protocol: "evaluating",
  19303. args: ["firstArgument", "secondArgument", "thirdArgument"],
  19304. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  19305. referencedClasses: [],
  19306. pragmas: [],
  19307. messageSends: ["arguments:", "sendTo:", "receiver"]
  19308. }, function ($methodClass){ return function (firstArgument,secondArgument,thirdArgument){
  19309. var self=this,$self=this;
  19310. return $core.withContext(function($ctx1) {
  19311. var $1;
  19312. $1=$self.message;
  19313. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  19314. return $recv($1)._sendTo_($self._receiver());
  19315. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument})});
  19316. }; }),
  19317. $globals.MessageSend);
  19318. $core.addMethod(
  19319. $core.method({
  19320. selector: "valueWithPossibleArguments:",
  19321. protocol: "evaluating",
  19322. args: ["anArray"],
  19323. source: "valueWithPossibleArguments: anArray\x0a\x09self arguments: anArray.\x0a\x09^ self value",
  19324. referencedClasses: [],
  19325. pragmas: [],
  19326. messageSends: ["arguments:", "value"]
  19327. }, function ($methodClass){ return function (anArray){
  19328. var self=this,$self=this;
  19329. return $core.withContext(function($ctx1) {
  19330. $self._arguments_(anArray);
  19331. return $self._value();
  19332. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{anArray:anArray})});
  19333. }; }),
  19334. $globals.MessageSend);
  19335. $core.addClass("MethodContext", $globals.Object, ["receiver", "evaluatedSelector", "homeContext", "index", "locals", "outerContext", "selector", "sendIdx", "supercall"], "Kernel-Methods");
  19336. $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`.";
  19337. $core.addMethod(
  19338. $core.method({
  19339. selector: "basicReceiver",
  19340. protocol: "accessing",
  19341. args: [],
  19342. source: "basicReceiver\x0a\x09^ receiver",
  19343. referencedClasses: [],
  19344. pragmas: [],
  19345. messageSends: []
  19346. }, function ($methodClass){ return function (){
  19347. var self=this,$self=this;
  19348. return $self.receiver;
  19349. }; }),
  19350. $globals.MethodContext);
  19351. $core.addMethod(
  19352. $core.method({
  19353. selector: "evaluatedSelector",
  19354. protocol: "accessing",
  19355. args: [],
  19356. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  19357. referencedClasses: [],
  19358. pragmas: [],
  19359. messageSends: []
  19360. }, function ($methodClass){ return function (){
  19361. var self=this,$self=this;
  19362. return $self.evaluatedSelector;
  19363. }; }),
  19364. $globals.MethodContext);
  19365. $core.addMethod(
  19366. $core.method({
  19367. selector: "home",
  19368. protocol: "accessing",
  19369. args: [],
  19370. source: "home\x0a\x09^ homeContext",
  19371. referencedClasses: [],
  19372. pragmas: [],
  19373. messageSends: []
  19374. }, function ($methodClass){ return function (){
  19375. var self=this,$self=this;
  19376. return $self.homeContext;
  19377. }; }),
  19378. $globals.MethodContext);
  19379. $core.addMethod(
  19380. $core.method({
  19381. selector: "index",
  19382. protocol: "accessing",
  19383. args: [],
  19384. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  19385. referencedClasses: [],
  19386. pragmas: [],
  19387. messageSends: ["ifNil:"]
  19388. }, function ($methodClass){ return function (){
  19389. var self=this,$self=this;
  19390. return $core.withContext(function($ctx1) {
  19391. var $1;
  19392. $1=$self.index;
  19393. if($1 == null || $1.a$nil){
  19394. return (0);
  19395. } else {
  19396. return $1;
  19397. }
  19398. }, function($ctx1) {$ctx1.fill(self,"index",{})});
  19399. }; }),
  19400. $globals.MethodContext);
  19401. $core.addMethod(
  19402. $core.method({
  19403. selector: "locals",
  19404. protocol: "accessing",
  19405. args: [],
  19406. source: "locals\x0a\x09^ locals",
  19407. referencedClasses: [],
  19408. pragmas: [],
  19409. messageSends: []
  19410. }, function ($methodClass){ return function (){
  19411. var self=this,$self=this;
  19412. return $self.locals;
  19413. }; }),
  19414. $globals.MethodContext);
  19415. $core.addMethod(
  19416. $core.method({
  19417. selector: "outerContext",
  19418. protocol: "accessing",
  19419. args: [],
  19420. source: "outerContext\x0a\x09^ outerContext ifNil: [ self home ]",
  19421. referencedClasses: [],
  19422. pragmas: [],
  19423. messageSends: ["ifNil:", "home"]
  19424. }, function ($methodClass){ return function (){
  19425. var self=this,$self=this;
  19426. return $core.withContext(function($ctx1) {
  19427. var $1;
  19428. $1=$self.outerContext;
  19429. if($1 == null || $1.a$nil){
  19430. return $self._home();
  19431. } else {
  19432. return $1;
  19433. }
  19434. }, function($ctx1) {$ctx1.fill(self,"outerContext",{})});
  19435. }; }),
  19436. $globals.MethodContext);
  19437. $core.addMethod(
  19438. $core.method({
  19439. selector: "selector",
  19440. protocol: "accessing",
  19441. args: [],
  19442. source: "selector\x0a\x09^ selector ifNotNil: [ Smalltalk core js2st: selector ]",
  19443. referencedClasses: ["Smalltalk"],
  19444. pragmas: [],
  19445. messageSends: ["ifNotNil:", "js2st:", "core"]
  19446. }, function ($methodClass){ return function (){
  19447. var self=this,$self=this;
  19448. return $core.withContext(function($ctx1) {
  19449. var $1;
  19450. $1=$self.selector;
  19451. if($1 == null || $1.a$nil){
  19452. return $1;
  19453. } else {
  19454. return $recv($recv($globals.Smalltalk)._core())._js2st_($self.selector);
  19455. }
  19456. }, function($ctx1) {$ctx1.fill(self,"selector",{})});
  19457. }; }),
  19458. $globals.MethodContext);
  19459. $core.addMethod(
  19460. $core.method({
  19461. selector: "sendIndexes",
  19462. protocol: "accessing",
  19463. args: [],
  19464. source: "sendIndexes\x0a\x09^ sendIdx",
  19465. referencedClasses: [],
  19466. pragmas: [],
  19467. messageSends: []
  19468. }, function ($methodClass){ return function (){
  19469. var self=this,$self=this;
  19470. return $self.sendIdx;
  19471. }; }),
  19472. $globals.MethodContext);
  19473. $core.addMethod(
  19474. $core.method({
  19475. selector: "supercall",
  19476. protocol: "accessing",
  19477. args: [],
  19478. source: "supercall\x0a\x09^ supercall = true",
  19479. referencedClasses: [],
  19480. pragmas: [],
  19481. messageSends: ["="]
  19482. }, function ($methodClass){ return function (){
  19483. var self=this,$self=this;
  19484. return $core.withContext(function($ctx1) {
  19485. return $recv($self.supercall).__eq(true);
  19486. }, function($ctx1) {$ctx1.fill(self,"supercall",{})});
  19487. }; }),
  19488. $globals.MethodContext);
  19489. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  19490. $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' ]";
  19491. $core.addMethod(
  19492. $core.method({
  19493. selector: "constructorNamed:",
  19494. protocol: "instance creation",
  19495. args: ["aString"],
  19496. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19497. referencedClasses: [],
  19498. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09"]]],
  19499. messageSends: []
  19500. }, function ($methodClass){ return function (aString){
  19501. var self=this,$self=this;
  19502. return $core.withContext(function($ctx1) {
  19503. var nativeFunc=$globals.Platform._globals()[aString];
  19504. return new nativeFunc();
  19505. ;
  19506. return self;
  19507. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString})});
  19508. }; }),
  19509. $globals.NativeFunction.a$cls);
  19510. $core.addMethod(
  19511. $core.method({
  19512. selector: "constructorNamed:value:",
  19513. protocol: "instance creation",
  19514. args: ["aString", "anObject"],
  19515. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19516. referencedClasses: [],
  19517. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09"]]],
  19518. messageSends: []
  19519. }, function ($methodClass){ return function (aString,anObject){
  19520. var self=this,$self=this;
  19521. return $core.withContext(function($ctx1) {
  19522. var nativeFunc=$globals.Platform._globals()[aString];
  19523. return new nativeFunc(anObject);
  19524. ;
  19525. return self;
  19526. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject})});
  19527. }; }),
  19528. $globals.NativeFunction.a$cls);
  19529. $core.addMethod(
  19530. $core.method({
  19531. selector: "constructorNamed:value:value:",
  19532. protocol: "instance creation",
  19533. args: ["aString", "anObject", "anObject2"],
  19534. source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19535. referencedClasses: [],
  19536. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09"]]],
  19537. messageSends: []
  19538. }, function ($methodClass){ return function (aString,anObject,anObject2){
  19539. var self=this,$self=this;
  19540. return $core.withContext(function($ctx1) {
  19541. var nativeFunc=$globals.Platform._globals()[aString];
  19542. return new nativeFunc(anObject,anObject2);
  19543. ;
  19544. return self;
  19545. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2})});
  19546. }; }),
  19547. $globals.NativeFunction.a$cls);
  19548. $core.addMethod(
  19549. $core.method({
  19550. selector: "constructorNamed:value:value:value:",
  19551. protocol: "instance creation",
  19552. args: ["aString", "anObject", "anObject2", "anObject3"],
  19553. source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19554. referencedClasses: [],
  19555. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
  19556. messageSends: []
  19557. }, function ($methodClass){ return function (aString,anObject,anObject2,anObject3){
  19558. var self=this,$self=this;
  19559. return $core.withContext(function($ctx1) {
  19560. var nativeFunc=$globals.Platform._globals()[aString];
  19561. return new nativeFunc(anObject,anObject2, anObject3);
  19562. ;
  19563. return self;
  19564. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  19565. }; }),
  19566. $globals.NativeFunction.a$cls);
  19567. $core.addMethod(
  19568. $core.method({
  19569. selector: "constructorOf:",
  19570. protocol: "instance creation",
  19571. args: ["nativeFunc"],
  19572. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19573. referencedClasses: [],
  19574. pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc();\x0a\x09"]]],
  19575. messageSends: []
  19576. }, function ($methodClass){ return function (nativeFunc){
  19577. var self=this,$self=this;
  19578. return $core.withContext(function($ctx1) {
  19579. return new nativeFunc();
  19580. ;
  19581. return self;
  19582. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc})});
  19583. }; }),
  19584. $globals.NativeFunction.a$cls);
  19585. $core.addMethod(
  19586. $core.method({
  19587. selector: "constructorOf:value:",
  19588. protocol: "instance creation",
  19589. args: ["nativeFunc", "anObject"],
  19590. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19591. referencedClasses: [],
  19592. pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09"]]],
  19593. messageSends: []
  19594. }, function ($methodClass){ return function (nativeFunc,anObject){
  19595. var self=this,$self=this;
  19596. return $core.withContext(function($ctx1) {
  19597. return new nativeFunc(anObject);
  19598. ;
  19599. return self;
  19600. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject})});
  19601. }; }),
  19602. $globals.NativeFunction.a$cls);
  19603. $core.addMethod(
  19604. $core.method({
  19605. selector: "constructorOf:value:value:",
  19606. protocol: "instance creation",
  19607. args: ["nativeFunc", "anObject", "anObject2"],
  19608. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19609. referencedClasses: [],
  19610. pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09"]]],
  19611. messageSends: []
  19612. }, function ($methodClass){ return function (nativeFunc,anObject,anObject2){
  19613. var self=this,$self=this;
  19614. return $core.withContext(function($ctx1) {
  19615. return new nativeFunc(anObject,anObject2);
  19616. ;
  19617. return self;
  19618. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2})});
  19619. }; }),
  19620. $globals.NativeFunction.a$cls);
  19621. $core.addMethod(
  19622. $core.method({
  19623. selector: "constructorOf:value:value:value:",
  19624. protocol: "instance creation",
  19625. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19626. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19627. referencedClasses: [],
  19628. pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
  19629. messageSends: []
  19630. }, function ($methodClass){ return function (nativeFunc,anObject,anObject2,anObject3){
  19631. var self=this,$self=this;
  19632. return $core.withContext(function($ctx1) {
  19633. return new nativeFunc(anObject,anObject2, anObject3);
  19634. ;
  19635. return self;
  19636. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  19637. }; }),
  19638. $globals.NativeFunction.a$cls);
  19639. $core.addMethod(
  19640. $core.method({
  19641. selector: "exists:",
  19642. protocol: "testing",
  19643. args: ["aString"],
  19644. source: "exists: aString\x0a\x09^ Platform includesGlobal: aString",
  19645. referencedClasses: ["Platform"],
  19646. pragmas: [],
  19647. messageSends: ["includesGlobal:"]
  19648. }, function ($methodClass){ return function (aString){
  19649. var self=this,$self=this;
  19650. return $core.withContext(function($ctx1) {
  19651. return $recv($globals.Platform)._includesGlobal_(aString);
  19652. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString})});
  19653. }; }),
  19654. $globals.NativeFunction.a$cls);
  19655. $core.addMethod(
  19656. $core.method({
  19657. selector: "functionNamed:",
  19658. protocol: "function calling",
  19659. args: ["aString"],
  19660. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19661. referencedClasses: [],
  19662. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09"]]],
  19663. messageSends: []
  19664. }, function ($methodClass){ return function (aString){
  19665. var self=this,$self=this;
  19666. return $core.withContext(function($ctx1) {
  19667. var nativeFunc=$globals.Platform._globals[aString];
  19668. return nativeFunc();
  19669. ;
  19670. return self;
  19671. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString})});
  19672. }; }),
  19673. $globals.NativeFunction.a$cls);
  19674. $core.addMethod(
  19675. $core.method({
  19676. selector: "functionNamed:value:",
  19677. protocol: "function calling",
  19678. args: ["aString", "anObject"],
  19679. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19680. referencedClasses: [],
  19681. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09"]]],
  19682. messageSends: []
  19683. }, function ($methodClass){ return function (aString,anObject){
  19684. var self=this,$self=this;
  19685. return $core.withContext(function($ctx1) {
  19686. var nativeFunc=$globals.Platform._globals()[aString];
  19687. return nativeFunc(anObject);
  19688. ;
  19689. return self;
  19690. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject})});
  19691. }; }),
  19692. $globals.NativeFunction.a$cls);
  19693. $core.addMethod(
  19694. $core.method({
  19695. selector: "functionNamed:value:value:",
  19696. protocol: "function calling",
  19697. args: ["aString", "anObject", "anObject2"],
  19698. source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19699. referencedClasses: [],
  19700. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09"]]],
  19701. messageSends: []
  19702. }, function ($methodClass){ return function (aString,anObject,anObject2){
  19703. var self=this,$self=this;
  19704. return $core.withContext(function($ctx1) {
  19705. var nativeFunc=$globals.Platform._globals()[aString];
  19706. return nativeFunc(anObject,anObject2);
  19707. ;
  19708. return self;
  19709. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2})});
  19710. }; }),
  19711. $globals.NativeFunction.a$cls);
  19712. $core.addMethod(
  19713. $core.method({
  19714. selector: "functionNamed:value:value:value:",
  19715. protocol: "function calling",
  19716. args: ["aString", "anObject", "anObject2", "anObject3"],
  19717. source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19718. referencedClasses: [],
  19719. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
  19720. messageSends: []
  19721. }, function ($methodClass){ return function (aString,anObject,anObject2,anObject3){
  19722. var self=this,$self=this;
  19723. return $core.withContext(function($ctx1) {
  19724. var nativeFunc=$globals.Platform._globals()[aString];
  19725. return nativeFunc(anObject,anObject2, anObject3);
  19726. ;
  19727. return self;
  19728. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  19729. }; }),
  19730. $globals.NativeFunction.a$cls);
  19731. $core.addMethod(
  19732. $core.method({
  19733. selector: "functionNamed:valueWithArgs:",
  19734. protocol: "function calling",
  19735. args: ["aString", "args"],
  19736. source: "functionNamed: aString valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19737. referencedClasses: [],
  19738. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09"]]],
  19739. messageSends: []
  19740. }, function ($methodClass){ return function (aString,args){
  19741. var self=this,$self=this;
  19742. return $core.withContext(function($ctx1) {
  19743. var nativeFunc=$globals.Platform._globals()[aString];
  19744. return Function.prototype.apply.call(nativeFunc, null, args);
  19745. ;
  19746. return self;
  19747. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args})});
  19748. }; }),
  19749. $globals.NativeFunction.a$cls);
  19750. $core.addMethod(
  19751. $core.method({
  19752. selector: "functionOf:",
  19753. protocol: "function calling",
  19754. args: ["nativeFunc"],
  19755. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19756. referencedClasses: [],
  19757. pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc();\x0a\x09"]]],
  19758. messageSends: []
  19759. }, function ($methodClass){ return function (nativeFunc){
  19760. var self=this,$self=this;
  19761. return $core.withContext(function($ctx1) {
  19762. return nativeFunc();
  19763. ;
  19764. return self;
  19765. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc})});
  19766. }; }),
  19767. $globals.NativeFunction.a$cls);
  19768. $core.addMethod(
  19769. $core.method({
  19770. selector: "functionOf:value:",
  19771. protocol: "function calling",
  19772. args: ["nativeFunc", "anObject"],
  19773. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19774. referencedClasses: [],
  19775. pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc(anObject);\x0a\x09"]]],
  19776. messageSends: []
  19777. }, function ($methodClass){ return function (nativeFunc,anObject){
  19778. var self=this,$self=this;
  19779. return $core.withContext(function($ctx1) {
  19780. return nativeFunc(anObject);
  19781. ;
  19782. return self;
  19783. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject})});
  19784. }; }),
  19785. $globals.NativeFunction.a$cls);
  19786. $core.addMethod(
  19787. $core.method({
  19788. selector: "functionOf:value:value:",
  19789. protocol: "function calling",
  19790. args: ["nativeFunc", "anObject", "anObject2"],
  19791. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19792. referencedClasses: [],
  19793. pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09"]]],
  19794. messageSends: []
  19795. }, function ($methodClass){ return function (nativeFunc,anObject,anObject2){
  19796. var self=this,$self=this;
  19797. return $core.withContext(function($ctx1) {
  19798. return nativeFunc(anObject,anObject2);
  19799. ;
  19800. return self;
  19801. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2})});
  19802. }; }),
  19803. $globals.NativeFunction.a$cls);
  19804. $core.addMethod(
  19805. $core.method({
  19806. selector: "functionOf:value:value:value:",
  19807. protocol: "function calling",
  19808. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19809. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19810. referencedClasses: [],
  19811. pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
  19812. messageSends: []
  19813. }, function ($methodClass){ return function (nativeFunc,anObject,anObject2,anObject3){
  19814. var self=this,$self=this;
  19815. return $core.withContext(function($ctx1) {
  19816. return nativeFunc(anObject,anObject2, anObject3);
  19817. ;
  19818. return self;
  19819. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  19820. }; }),
  19821. $globals.NativeFunction.a$cls);
  19822. $core.addMethod(
  19823. $core.method({
  19824. selector: "functionOf:valueWithArgs:",
  19825. protocol: "function calling",
  19826. args: ["nativeFunc", "args"],
  19827. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19828. referencedClasses: [],
  19829. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09"]]],
  19830. messageSends: []
  19831. }, function ($methodClass){ return function (nativeFunc,args){
  19832. var self=this,$self=this;
  19833. return $core.withContext(function($ctx1) {
  19834. return Function.prototype.apply.call(nativeFunc, null, args);
  19835. ;
  19836. return self;
  19837. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args})});
  19838. }; }),
  19839. $globals.NativeFunction.a$cls);
  19840. $core.addMethod(
  19841. $core.method({
  19842. selector: "isNativeFunction:",
  19843. protocol: "testing",
  19844. args: ["anObject"],
  19845. source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
  19846. referencedClasses: [],
  19847. pragmas: [["inlineJS:", ["return typeof anObject === \x22function\x22"]]],
  19848. messageSends: []
  19849. }, function ($methodClass){ return function (anObject){
  19850. var self=this,$self=this;
  19851. return $core.withContext(function($ctx1) {
  19852. return typeof anObject === "function";
  19853. return self;
  19854. }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject})});
  19855. }; }),
  19856. $globals.NativeFunction.a$cls);
  19857. $core.addMethod(
  19858. $core.method({
  19859. selector: "methodOf:this:",
  19860. protocol: "method calling",
  19861. args: ["nativeFunc", "thisObject"],
  19862. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  19863. referencedClasses: [],
  19864. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09"]]],
  19865. messageSends: []
  19866. }, function ($methodClass){ return function (nativeFunc,thisObject){
  19867. var self=this,$self=this;
  19868. return $core.withContext(function($ctx1) {
  19869. return Function.prototype.call.call(nativeFunc, thisObject);
  19870. ;
  19871. return self;
  19872. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject})});
  19873. }; }),
  19874. $globals.NativeFunction.a$cls);
  19875. $core.addMethod(
  19876. $core.method({
  19877. selector: "methodOf:this:value:",
  19878. protocol: "method calling",
  19879. args: ["nativeFunc", "thisObject", "anObject"],
  19880. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  19881. referencedClasses: [],
  19882. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09"]]],
  19883. messageSends: []
  19884. }, function ($methodClass){ return function (nativeFunc,thisObject,anObject){
  19885. var self=this,$self=this;
  19886. return $core.withContext(function($ctx1) {
  19887. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  19888. ;
  19889. return self;
  19890. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject})});
  19891. }; }),
  19892. $globals.NativeFunction.a$cls);
  19893. $core.addMethod(
  19894. $core.method({
  19895. selector: "methodOf:this:value:value:",
  19896. protocol: "method calling",
  19897. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  19898. 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'>",
  19899. referencedClasses: [],
  19900. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09"]]],
  19901. messageSends: []
  19902. }, function ($methodClass){ return function (nativeFunc,thisObject,anObject,anObject2){
  19903. var self=this,$self=this;
  19904. return $core.withContext(function($ctx1) {
  19905. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  19906. ;
  19907. return self;
  19908. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2})});
  19909. }; }),
  19910. $globals.NativeFunction.a$cls);
  19911. $core.addMethod(
  19912. $core.method({
  19913. selector: "methodOf:this:value:value:value:",
  19914. protocol: "method calling",
  19915. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  19916. 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'>",
  19917. referencedClasses: [],
  19918. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);\x0a\x09"]]],
  19919. messageSends: []
  19920. }, function ($methodClass){ return function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  19921. var self=this,$self=this;
  19922. return $core.withContext(function($ctx1) {
  19923. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  19924. ;
  19925. return self;
  19926. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  19927. }; }),
  19928. $globals.NativeFunction.a$cls);
  19929. $core.addMethod(
  19930. $core.method({
  19931. selector: "methodOf:this:valueWithArgs:",
  19932. protocol: "method calling",
  19933. args: ["nativeFunc", "thisObject", "args"],
  19934. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  19935. referencedClasses: [],
  19936. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09"]]],
  19937. messageSends: []
  19938. }, function ($methodClass){ return function (nativeFunc,thisObject,args){
  19939. var self=this,$self=this;
  19940. return $core.withContext(function($ctx1) {
  19941. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  19942. ;
  19943. return self;
  19944. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args})});
  19945. }; }),
  19946. $globals.NativeFunction.a$cls);
  19947. $core.addTrait("TMethodContext", "Kernel-Methods");
  19948. $core.addMethod(
  19949. $core.method({
  19950. selector: "asString",
  19951. protocol: "converting",
  19952. args: [],
  19953. source: "asString\x0a\x09^ self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ self method\x0a\x09\x09\x09ifNotNil: [ :method | method asStringForClass: self receiver class ]\x0a\x09\x09\x09ifNil: [ 'missing method ', self selector symbolPrintString ] ]",
  19954. referencedClasses: [],
  19955. pragmas: [],
  19956. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "ifNotNil:ifNil:", "method", "asStringForClass:", "class", "receiver", "symbolPrintString", "selector"]
  19957. }, function ($methodClass){ return function (){
  19958. var self=this,$self=this;
  19959. return $core.withContext(function($ctx1) {
  19960. var $1;
  19961. if($core.assert($self._isBlockContext())){
  19962. return [$recv(["a block (in ".__comma($recv($self._methodContext())._asString())
  19963. ,$ctx1.sendIdx[","]=2
  19964. ][0]).__comma(")")
  19965. ,$ctx1.sendIdx[","]=1
  19966. ][0];
  19967. } else {
  19968. $1=$self._method();
  19969. if($1 == null || $1.a$nil){
  19970. return "missing method ".__comma($recv($self._selector())._symbolPrintString());
  19971. } else {
  19972. var method;
  19973. method=$1;
  19974. return $recv(method)._asStringForClass_($recv($self._receiver())._class());
  19975. }
  19976. }
  19977. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  19978. }; }),
  19979. $globals.TMethodContext);
  19980. $core.addMethod(
  19981. $core.method({
  19982. selector: "basicReceiver",
  19983. protocol: "accessing",
  19984. args: [],
  19985. source: "basicReceiver\x0a\x09self subclassResponsibility",
  19986. referencedClasses: [],
  19987. pragmas: [],
  19988. messageSends: ["subclassResponsibility"]
  19989. }, function ($methodClass){ return function (){
  19990. var self=this,$self=this;
  19991. return $core.withContext(function($ctx1) {
  19992. $self._subclassResponsibility();
  19993. return self;
  19994. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{})});
  19995. }; }),
  19996. $globals.TMethodContext);
  19997. $core.addMethod(
  19998. $core.method({
  19999. selector: "findContextSuchThat:",
  20000. protocol: "accessing",
  20001. args: ["testBlock"],
  20002. 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",
  20003. referencedClasses: [],
  20004. pragmas: [],
  20005. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  20006. }, function ($methodClass){ return function (testBlock){
  20007. var self=this,$self=this;
  20008. var context;
  20009. return $core.withContext(function($ctx1) {
  20010. var $early={};
  20011. try {
  20012. context=self;
  20013. $recv((function(){
  20014. return $core.withContext(function($ctx2) {
  20015. return $recv(context)._isNil();
  20016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20017. }))._whileFalse_((function(){
  20018. return $core.withContext(function($ctx2) {
  20019. if($core.assert($recv(testBlock)._value_(context))){
  20020. throw $early=[context];
  20021. }
  20022. context=$recv(context)._outerContext();
  20023. return context;
  20024. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  20025. }));
  20026. return nil;
  20027. }
  20028. catch(e) {if(e===$early)return e[0]; throw e}
  20029. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context})});
  20030. }; }),
  20031. $globals.TMethodContext);
  20032. $core.addMethod(
  20033. $core.method({
  20034. selector: "home",
  20035. protocol: "accessing",
  20036. args: [],
  20037. source: "home\x0a\x09self subclassResponsibility",
  20038. referencedClasses: [],
  20039. pragmas: [],
  20040. messageSends: ["subclassResponsibility"]
  20041. }, function ($methodClass){ return function (){
  20042. var self=this,$self=this;
  20043. return $core.withContext(function($ctx1) {
  20044. $self._subclassResponsibility();
  20045. return self;
  20046. }, function($ctx1) {$ctx1.fill(self,"home",{})});
  20047. }; }),
  20048. $globals.TMethodContext);
  20049. $core.addMethod(
  20050. $core.method({
  20051. selector: "index",
  20052. protocol: "accessing",
  20053. args: [],
  20054. source: "index\x0a\x09self subclassResponsibility",
  20055. referencedClasses: [],
  20056. pragmas: [],
  20057. messageSends: ["subclassResponsibility"]
  20058. }, function ($methodClass){ return function (){
  20059. var self=this,$self=this;
  20060. return $core.withContext(function($ctx1) {
  20061. $self._subclassResponsibility();
  20062. return self;
  20063. }, function($ctx1) {$ctx1.fill(self,"index",{})});
  20064. }; }),
  20065. $globals.TMethodContext);
  20066. $core.addMethod(
  20067. $core.method({
  20068. selector: "isBlockContext",
  20069. protocol: "testing",
  20070. args: [],
  20071. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  20072. referencedClasses: [],
  20073. pragmas: [],
  20074. messageSends: ["isNil", "selector"]
  20075. }, function ($methodClass){ return function (){
  20076. var self=this,$self=this;
  20077. return $core.withContext(function($ctx1) {
  20078. return $recv($self._selector())._isNil();
  20079. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{})});
  20080. }; }),
  20081. $globals.TMethodContext);
  20082. $core.addMethod(
  20083. $core.method({
  20084. selector: "locals",
  20085. protocol: "accessing",
  20086. args: [],
  20087. source: "locals\x0a\x09self subclassResponsibility",
  20088. referencedClasses: [],
  20089. pragmas: [],
  20090. messageSends: ["subclassResponsibility"]
  20091. }, function ($methodClass){ return function (){
  20092. var self=this,$self=this;
  20093. return $core.withContext(function($ctx1) {
  20094. $self._subclassResponsibility();
  20095. return self;
  20096. }, function($ctx1) {$ctx1.fill(self,"locals",{})});
  20097. }; }),
  20098. $globals.TMethodContext);
  20099. $core.addMethod(
  20100. $core.method({
  20101. selector: "method",
  20102. protocol: "accessing",
  20103. args: [],
  20104. 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 ]",
  20105. referencedClasses: [],
  20106. pragmas: [],
  20107. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  20108. }, function ($methodClass){ return function (){
  20109. var self=this,$self=this;
  20110. var method,lookupClass,receiverClass,supercall;
  20111. return $core.withContext(function($ctx1) {
  20112. var $1,$2;
  20113. $1=[$self._methodContext()
  20114. ,$ctx1.sendIdx["methodContext"]=1
  20115. ][0];
  20116. if($1 == null || $1.a$nil){
  20117. return nil;
  20118. } else {
  20119. $1;
  20120. }
  20121. receiverClass=$recv($recv([$self._methodContext()
  20122. ,$ctx1.sendIdx["methodContext"]=2
  20123. ][0])._receiver())._class();
  20124. method=[$recv(receiverClass)._lookupSelector_([$recv([$self._methodContext()
  20125. ,$ctx1.sendIdx["methodContext"]=3
  20126. ][0])._selector()
  20127. ,$ctx1.sendIdx["selector"]=1
  20128. ][0])
  20129. ,$ctx1.sendIdx["lookupSelector:"]=1
  20130. ][0];
  20131. $2=$self._outerContext();
  20132. if($2 == null || $2.a$nil){
  20133. supercall=false;
  20134. } else {
  20135. var outer;
  20136. outer=$2;
  20137. supercall=$recv(outer)._supercall();
  20138. }
  20139. if($core.assert(supercall)){
  20140. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
  20141. } else {
  20142. return method;
  20143. }
  20144. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall})});
  20145. }; }),
  20146. $globals.TMethodContext);
  20147. $core.addMethod(
  20148. $core.method({
  20149. selector: "methodContext",
  20150. protocol: "accessing",
  20151. args: [],
  20152. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  20153. referencedClasses: [],
  20154. pragmas: [],
  20155. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  20156. }, function ($methodClass){ return function (){
  20157. var self=this,$self=this;
  20158. return $core.withContext(function($ctx1) {
  20159. var $1;
  20160. if(!$core.assert($self._isBlockContext())){
  20161. return self;
  20162. }
  20163. $1=$self._outerContext();
  20164. if($1 == null || $1.a$nil){
  20165. return $1;
  20166. } else {
  20167. var outer;
  20168. outer=$1;
  20169. return $recv(outer)._methodContext();
  20170. }
  20171. }, function($ctx1) {$ctx1.fill(self,"methodContext",{})});
  20172. }; }),
  20173. $globals.TMethodContext);
  20174. $core.addMethod(
  20175. $core.method({
  20176. selector: "outerContext",
  20177. protocol: "accessing",
  20178. args: [],
  20179. source: "outerContext\x0a\x09self subclassResponsibility",
  20180. referencedClasses: [],
  20181. pragmas: [],
  20182. messageSends: ["subclassResponsibility"]
  20183. }, function ($methodClass){ return function (){
  20184. var self=this,$self=this;
  20185. return $core.withContext(function($ctx1) {
  20186. $self._subclassResponsibility();
  20187. return self;
  20188. }, function($ctx1) {$ctx1.fill(self,"outerContext",{})});
  20189. }; }),
  20190. $globals.TMethodContext);
  20191. $core.addMethod(
  20192. $core.method({
  20193. selector: "printOn:",
  20194. protocol: "printing",
  20195. args: ["aStream"],
  20196. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  20197. referencedClasses: [],
  20198. pragmas: [],
  20199. messageSends: ["printOn:", "nextPutAll:", "asString"]
  20200. }, function ($methodClass){ return function (aStream){
  20201. var self=this,$self=this;
  20202. return $core.withContext(function($ctx1) {
  20203. [(
  20204. $ctx1.supercall = true,
  20205. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  20206. ,$ctx1.supercall = false
  20207. ][0];
  20208. [$recv(aStream)._nextPutAll_("(")
  20209. ,$ctx1.sendIdx["nextPutAll:"]=1
  20210. ][0];
  20211. [$recv(aStream)._nextPutAll_($self._asString())
  20212. ,$ctx1.sendIdx["nextPutAll:"]=2
  20213. ][0];
  20214. $recv(aStream)._nextPutAll_(")");
  20215. return self;
  20216. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  20217. }; }),
  20218. $globals.TMethodContext);
  20219. $core.addMethod(
  20220. $core.method({
  20221. selector: "receiver",
  20222. protocol: "accessing",
  20223. args: [],
  20224. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  20225. referencedClasses: [],
  20226. pragmas: [],
  20227. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  20228. }, function ($methodClass){ return function (){
  20229. var self=this,$self=this;
  20230. return $core.withContext(function($ctx1) {
  20231. if($core.assert($recv($self._isBlockContext())._and_((function(){
  20232. return $core.withContext(function($ctx2) {
  20233. return $recv([$self._outerContext()
  20234. ,$ctx2.sendIdx["outerContext"]=1
  20235. ][0])._notNil();
  20236. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20237. })))){
  20238. return $recv($self._outerContext())._receiver();
  20239. } else {
  20240. return $self._basicReceiver();
  20241. }
  20242. }, function($ctx1) {$ctx1.fill(self,"receiver",{})});
  20243. }; }),
  20244. $globals.TMethodContext);
  20245. $core.addMethod(
  20246. $core.method({
  20247. selector: "selector",
  20248. protocol: "accessing",
  20249. args: [],
  20250. source: "selector\x0a\x09self subclassResponsibility",
  20251. referencedClasses: [],
  20252. pragmas: [],
  20253. messageSends: ["subclassResponsibility"]
  20254. }, function ($methodClass){ return function (){
  20255. var self=this,$self=this;
  20256. return $core.withContext(function($ctx1) {
  20257. $self._subclassResponsibility();
  20258. return self;
  20259. }, function($ctx1) {$ctx1.fill(self,"selector",{})});
  20260. }; }),
  20261. $globals.TMethodContext);
  20262. $core.addMethod(
  20263. $core.method({
  20264. selector: "sendIndexes",
  20265. protocol: "accessing",
  20266. args: [],
  20267. source: "sendIndexes\x0a\x09self subclassResponsibility",
  20268. referencedClasses: [],
  20269. pragmas: [],
  20270. messageSends: ["subclassResponsibility"]
  20271. }, function ($methodClass){ return function (){
  20272. var self=this,$self=this;
  20273. return $core.withContext(function($ctx1) {
  20274. $self._subclassResponsibility();
  20275. return self;
  20276. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{})});
  20277. }; }),
  20278. $globals.TMethodContext);
  20279. $core.addMethod(
  20280. $core.method({
  20281. selector: "supercall",
  20282. protocol: "accessing",
  20283. args: [],
  20284. source: "supercall\x0a\x09self subclassResponsibility",
  20285. referencedClasses: [],
  20286. pragmas: [],
  20287. messageSends: ["subclassResponsibility"]
  20288. }, function ($methodClass){ return function (){
  20289. var self=this,$self=this;
  20290. return $core.withContext(function($ctx1) {
  20291. $self._subclassResponsibility();
  20292. return self;
  20293. }, function($ctx1) {$ctx1.fill(self,"supercall",{})});
  20294. }; }),
  20295. $globals.TMethodContext);
  20296. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  20297. $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.";
  20298. $core.addMethod(
  20299. $core.method({
  20300. selector: "clearInterval",
  20301. protocol: "timeout/interval",
  20302. args: [],
  20303. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self.rawTimeout;\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  20304. referencedClasses: [],
  20305. pragmas: [["inlineJS:", ["\x0a\x09\x09var interval = $self.rawTimeout;\x0a\x09\x09clearInterval(interval);\x0a\x09"]]],
  20306. messageSends: []
  20307. }, function ($methodClass){ return function (){
  20308. var self=this,$self=this;
  20309. return $core.withContext(function($ctx1) {
  20310. var interval = $self.rawTimeout;
  20311. clearInterval(interval);
  20312. ;
  20313. return self;
  20314. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{})});
  20315. }; }),
  20316. $globals.Timeout);
  20317. $core.addMethod(
  20318. $core.method({
  20319. selector: "clearTimeout",
  20320. protocol: "timeout/interval",
  20321. args: [],
  20322. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self.rawTimeout;\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  20323. referencedClasses: [],
  20324. pragmas: [["inlineJS:", ["\x0a\x09\x09var timeout = $self.rawTimeout;\x0a\x09\x09clearTimeout(timeout);\x0a\x09"]]],
  20325. messageSends: []
  20326. }, function ($methodClass){ return function (){
  20327. var self=this,$self=this;
  20328. return $core.withContext(function($ctx1) {
  20329. var timeout = $self.rawTimeout;
  20330. clearTimeout(timeout);
  20331. ;
  20332. return self;
  20333. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{})});
  20334. }; }),
  20335. $globals.Timeout);
  20336. $core.addMethod(
  20337. $core.method({
  20338. selector: "rawTimeout:",
  20339. protocol: "accessing",
  20340. args: ["anObject"],
  20341. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  20342. referencedClasses: [],
  20343. pragmas: [],
  20344. messageSends: []
  20345. }, function ($methodClass){ return function (anObject){
  20346. var self=this,$self=this;
  20347. $self.rawTimeout=anObject;
  20348. return self;
  20349. }; }),
  20350. $globals.Timeout);
  20351. $core.addMethod(
  20352. $core.method({
  20353. selector: "on:",
  20354. protocol: "instance creation",
  20355. args: ["anObject"],
  20356. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  20357. referencedClasses: [],
  20358. pragmas: [],
  20359. messageSends: ["rawTimeout:", "new", "yourself"]
  20360. }, function ($methodClass){ return function (anObject){
  20361. var self=this,$self=this;
  20362. return $core.withContext(function($ctx1) {
  20363. var $1;
  20364. $1=$self._new();
  20365. $recv($1)._rawTimeout_(anObject);
  20366. return $recv($1)._yourself();
  20367. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject})});
  20368. }; }),
  20369. $globals.Timeout.a$cls);
  20370. $core.setTraitComposition([{trait: $globals.TMethodContext}], $globals.MethodContext);
  20371. });
  20372. define('amber/core/Kernel-Dag',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  20373. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20374. var $pkg = $core.addPackage("Kernel-Dag");
  20375. $pkg.innerEval = function (expr) { return eval(expr); };
  20376. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  20377. $core.addClass("AbstractDagVisitor", $globals.Object, [], "Kernel-Dag");
  20378. $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:`.";
  20379. $core.addMethod(
  20380. $core.method({
  20381. selector: "value:",
  20382. protocol: "evaluating",
  20383. args: ["anObject"],
  20384. source: "value: anObject\x0a\x09^ self visit: anObject",
  20385. referencedClasses: [],
  20386. pragmas: [],
  20387. messageSends: ["visit:"]
  20388. }, function ($methodClass){ return function (anObject){
  20389. var self=this,$self=this;
  20390. return $core.withContext(function($ctx1) {
  20391. return $self._visit_(anObject);
  20392. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  20393. }; }),
  20394. $globals.AbstractDagVisitor);
  20395. $core.addMethod(
  20396. $core.method({
  20397. selector: "visit:",
  20398. protocol: "visiting",
  20399. args: ["aNode"],
  20400. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  20401. referencedClasses: [],
  20402. pragmas: [],
  20403. messageSends: ["acceptDagVisitor:"]
  20404. }, function ($methodClass){ return function (aNode){
  20405. var self=this,$self=this;
  20406. return $core.withContext(function($ctx1) {
  20407. return $recv(aNode)._acceptDagVisitor_(self);
  20408. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode})});
  20409. }; }),
  20410. $globals.AbstractDagVisitor);
  20411. $core.addMethod(
  20412. $core.method({
  20413. selector: "visitAll:",
  20414. protocol: "visiting",
  20415. args: ["aCollection"],
  20416. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  20417. referencedClasses: [],
  20418. pragmas: [],
  20419. messageSends: ["collect:", "visit:"]
  20420. }, function ($methodClass){ return function (aCollection){
  20421. var self=this,$self=this;
  20422. return $core.withContext(function($ctx1) {
  20423. return $recv(aCollection)._collect_((function(each){
  20424. return $core.withContext(function($ctx2) {
  20425. return $self._visit_(each);
  20426. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20427. }));
  20428. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection})});
  20429. }; }),
  20430. $globals.AbstractDagVisitor);
  20431. $core.addMethod(
  20432. $core.method({
  20433. selector: "visitAllChildren:",
  20434. protocol: "visiting",
  20435. args: ["aDagNode"],
  20436. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  20437. referencedClasses: [],
  20438. pragmas: [],
  20439. messageSends: ["visitAll:", "dagChildren"]
  20440. }, function ($methodClass){ return function (aDagNode){
  20441. var self=this,$self=this;
  20442. return $core.withContext(function($ctx1) {
  20443. return $self._visitAll_($recv(aDagNode)._dagChildren());
  20444. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode})});
  20445. }; }),
  20446. $globals.AbstractDagVisitor);
  20447. $core.addMethod(
  20448. $core.method({
  20449. selector: "visitDagNode:",
  20450. protocol: "visiting",
  20451. args: ["aNode"],
  20452. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  20453. referencedClasses: [],
  20454. pragmas: [],
  20455. messageSends: ["subclassResponsibility"]
  20456. }, function ($methodClass){ return function (aNode){
  20457. var self=this,$self=this;
  20458. return $core.withContext(function($ctx1) {
  20459. $self._subclassResponsibility();
  20460. return self;
  20461. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode})});
  20462. }; }),
  20463. $globals.AbstractDagVisitor);
  20464. $core.addMethod(
  20465. $core.method({
  20466. selector: "visitDagNodeVariantRedux:",
  20467. protocol: "visiting",
  20468. args: ["aNode"],
  20469. 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 = newChildren\x0a\x09\x09ifTrue: [ ^ aNode ]\x0a\x09\x09ifFalse: [ ^ aNode copy dagChildren: newChildren; yourself ]",
  20470. referencedClasses: [],
  20471. pragmas: [],
  20472. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:ifFalse:", "=", "dagChildren:", "copy", "yourself"]
  20473. }, function ($methodClass){ return function (aNode){
  20474. var self=this,$self=this;
  20475. var newChildren,oldChildren;
  20476. return $core.withContext(function($ctx1) {
  20477. var $1;
  20478. oldChildren=$recv(aNode)._dagChildren();
  20479. newChildren=$self._visitAllChildren_(aNode);
  20480. if($core.assert($recv(oldChildren).__eq(newChildren))){
  20481. return aNode;
  20482. } else {
  20483. $1=$recv(aNode)._copy();
  20484. $recv($1)._dagChildren_(newChildren);
  20485. return $recv($1)._yourself();
  20486. }
  20487. return self;
  20488. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren})});
  20489. }; }),
  20490. $globals.AbstractDagVisitor);
  20491. $core.addMethod(
  20492. $core.method({
  20493. selector: "visitDagNodeVariantSimple:",
  20494. protocol: "visiting",
  20495. args: ["aNode"],
  20496. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  20497. referencedClasses: [],
  20498. pragmas: [],
  20499. messageSends: ["visitAllChildren:"]
  20500. }, function ($methodClass){ return function (aNode){
  20501. var self=this,$self=this;
  20502. return $core.withContext(function($ctx1) {
  20503. $self._visitAllChildren_(aNode);
  20504. return aNode;
  20505. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode})});
  20506. }; }),
  20507. $globals.AbstractDagVisitor);
  20508. $core.addClass("PathDagVisitor", $globals.AbstractDagVisitor, ["path"], "Kernel-Dag");
  20509. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  20510. $core.addMethod(
  20511. $core.method({
  20512. selector: "initialize",
  20513. protocol: "initialization",
  20514. args: [],
  20515. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  20516. referencedClasses: [],
  20517. pragmas: [],
  20518. messageSends: ["initialize"]
  20519. }, function ($methodClass){ return function (){
  20520. var self=this,$self=this;
  20521. return $core.withContext(function($ctx1) {
  20522. [(
  20523. $ctx1.supercall = true,
  20524. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  20525. ,$ctx1.supercall = false
  20526. ][0];
  20527. $self.path=[];
  20528. return self;
  20529. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  20530. }; }),
  20531. $globals.PathDagVisitor);
  20532. $core.addMethod(
  20533. $core.method({
  20534. selector: "path",
  20535. protocol: "accessing",
  20536. args: [],
  20537. source: "path\x0a\x09^ path",
  20538. referencedClasses: [],
  20539. pragmas: [],
  20540. messageSends: []
  20541. }, function ($methodClass){ return function (){
  20542. var self=this,$self=this;
  20543. return $self.path;
  20544. }; }),
  20545. $globals.PathDagVisitor);
  20546. $core.addMethod(
  20547. $core.method({
  20548. selector: "visit:",
  20549. protocol: "visiting",
  20550. args: ["aNode"],
  20551. 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",
  20552. referencedClasses: [],
  20553. pragmas: [],
  20554. messageSends: ["ensure:", ",", "visit:"]
  20555. }, function ($methodClass){ return function (aNode){
  20556. var self=this,$self=this;
  20557. var oldPath,result;
  20558. return $core.withContext(function($ctx1) {
  20559. result=aNode;
  20560. oldPath=$self.path;
  20561. $recv((function(){
  20562. return $core.withContext(function($ctx2) {
  20563. $self.path=$recv($self.path).__comma([aNode]);
  20564. result=[(
  20565. $ctx2.supercall = true,
  20566. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visit_.call($self,aNode))
  20567. ,$ctx2.supercall = false
  20568. ][0];
  20569. return result;
  20570. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20571. }))._ensure_((function(){
  20572. $self.path=oldPath;
  20573. return $self.path;
  20574. }));
  20575. return result;
  20576. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result})});
  20577. }; }),
  20578. $globals.PathDagVisitor);
  20579. $core.addMethod(
  20580. $core.method({
  20581. selector: "visitDagNodeVariantRedux:",
  20582. protocol: "visiting",
  20583. args: ["aNode"],
  20584. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  20585. referencedClasses: [],
  20586. pragmas: [],
  20587. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  20588. }, function ($methodClass){ return function (aNode){
  20589. var self=this,$self=this;
  20590. var newNode;
  20591. return $core.withContext(function($ctx1) {
  20592. newNode=[(
  20593. $ctx1.supercall = true,
  20594. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.call($self,aNode))
  20595. ,$ctx1.supercall = false
  20596. ][0];
  20597. if(!$core.assert($recv(aNode).__eq_eq(newNode))){
  20598. $recv($self.path)._at_put_($recv($self.path)._size(),newNode);
  20599. }
  20600. return newNode;
  20601. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode})});
  20602. }; }),
  20603. $globals.PathDagVisitor);
  20604. $core.addClass("DagNode", $globals.Object, [], "Kernel-Dag");
  20605. $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).";
  20606. $core.addMethod(
  20607. $core.method({
  20608. selector: "acceptDagVisitor:",
  20609. protocol: "visiting",
  20610. args: ["aVisitor"],
  20611. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  20612. referencedClasses: [],
  20613. pragmas: [],
  20614. messageSends: ["visitDagNode:"]
  20615. }, function ($methodClass){ return function (aVisitor){
  20616. var self=this,$self=this;
  20617. return $core.withContext(function($ctx1) {
  20618. return $recv(aVisitor)._visitDagNode_(self);
  20619. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  20620. }; }),
  20621. $globals.DagNode);
  20622. $core.addMethod(
  20623. $core.method({
  20624. selector: "allDagChildren",
  20625. protocol: "accessing",
  20626. args: [],
  20627. 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",
  20628. referencedClasses: [],
  20629. pragmas: [],
  20630. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  20631. }, function ($methodClass){ return function (){
  20632. var self=this,$self=this;
  20633. var allNodes;
  20634. return $core.withContext(function($ctx1) {
  20635. allNodes=$recv([$self._dagChildren()
  20636. ,$ctx1.sendIdx["dagChildren"]=1
  20637. ][0])._asSet();
  20638. $recv($self._dagChildren())._do_((function(each){
  20639. return $core.withContext(function($ctx2) {
  20640. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  20641. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20642. }));
  20643. return allNodes;
  20644. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes})});
  20645. }; }),
  20646. $globals.DagNode);
  20647. $core.addMethod(
  20648. $core.method({
  20649. selector: "dagChildren",
  20650. protocol: "accessing",
  20651. args: [],
  20652. source: "dagChildren\x0a\x09self subclassResponsibility",
  20653. referencedClasses: [],
  20654. pragmas: [],
  20655. messageSends: ["subclassResponsibility"]
  20656. }, function ($methodClass){ return function (){
  20657. var self=this,$self=this;
  20658. return $core.withContext(function($ctx1) {
  20659. $self._subclassResponsibility();
  20660. return self;
  20661. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{})});
  20662. }; }),
  20663. $globals.DagNode);
  20664. $core.addMethod(
  20665. $core.method({
  20666. selector: "dagChildren:",
  20667. protocol: "accessing",
  20668. args: ["aCollection"],
  20669. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  20670. referencedClasses: [],
  20671. pragmas: [],
  20672. messageSends: ["subclassResponsibility"]
  20673. }, function ($methodClass){ return function (aCollection){
  20674. var self=this,$self=this;
  20675. return $core.withContext(function($ctx1) {
  20676. $self._subclassResponsibility();
  20677. return self;
  20678. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection})});
  20679. }; }),
  20680. $globals.DagNode);
  20681. $core.addMethod(
  20682. $core.method({
  20683. selector: "isDagNode",
  20684. protocol: "testing",
  20685. args: [],
  20686. source: "isDagNode\x0a\x09^ true",
  20687. referencedClasses: [],
  20688. pragmas: [],
  20689. messageSends: []
  20690. }, function ($methodClass){ return function (){
  20691. var self=this,$self=this;
  20692. return true;
  20693. }; }),
  20694. $globals.DagNode);
  20695. $core.addClass("DagParentNode", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20696. $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.";
  20697. $core.addMethod(
  20698. $core.method({
  20699. selector: "addDagChild:",
  20700. protocol: "accessing",
  20701. args: ["aDagNode"],
  20702. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  20703. referencedClasses: [],
  20704. pragmas: [],
  20705. messageSends: ["add:", "dagChildren"]
  20706. }, function ($methodClass){ return function (aDagNode){
  20707. var self=this,$self=this;
  20708. return $core.withContext(function($ctx1) {
  20709. $recv($self._dagChildren())._add_(aDagNode);
  20710. return self;
  20711. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode})});
  20712. }; }),
  20713. $globals.DagParentNode);
  20714. $core.addMethod(
  20715. $core.method({
  20716. selector: "dagChildren",
  20717. protocol: "accessing",
  20718. args: [],
  20719. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  20720. referencedClasses: ["Array"],
  20721. pragmas: [],
  20722. messageSends: ["ifNil:", "new"]
  20723. }, function ($methodClass){ return function (){
  20724. var self=this,$self=this;
  20725. return $core.withContext(function($ctx1) {
  20726. var $1;
  20727. $1=$self.nodes;
  20728. if($1 == null || $1.a$nil){
  20729. $self.nodes=$recv($globals.Array)._new();
  20730. return $self.nodes;
  20731. } else {
  20732. return $1;
  20733. }
  20734. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{})});
  20735. }; }),
  20736. $globals.DagParentNode);
  20737. $core.addMethod(
  20738. $core.method({
  20739. selector: "dagChildren:",
  20740. protocol: "accessing",
  20741. args: ["aCollection"],
  20742. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  20743. referencedClasses: [],
  20744. pragmas: [],
  20745. messageSends: []
  20746. }, function ($methodClass){ return function (aCollection){
  20747. var self=this,$self=this;
  20748. $self.nodes=aCollection;
  20749. return self;
  20750. }; }),
  20751. $globals.DagParentNode);
  20752. $core.addClass("DagSink", $globals.DagNode, [], "Kernel-Dag");
  20753. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  20754. $core.addTrait("TDagSink", "Kernel-Dag");
  20755. $core.addMethod(
  20756. $core.method({
  20757. selector: "dagChildren",
  20758. protocol: "accessing",
  20759. args: [],
  20760. source: "dagChildren\x0a\x09^ #()",
  20761. referencedClasses: [],
  20762. pragmas: [],
  20763. messageSends: []
  20764. }, function ($methodClass){ return function (){
  20765. var self=this,$self=this;
  20766. return [];
  20767. }; }),
  20768. $globals.TDagSink);
  20769. $core.addMethod(
  20770. $core.method({
  20771. selector: "dagChildren:",
  20772. protocol: "accessing",
  20773. args: ["aCollection"],
  20774. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  20775. referencedClasses: [],
  20776. pragmas: [],
  20777. messageSends: ["ifNotEmpty:", "error:"]
  20778. }, function ($methodClass){ return function (aCollection){
  20779. var self=this,$self=this;
  20780. return $core.withContext(function($ctx1) {
  20781. $recv(aCollection)._ifNotEmpty_((function(){
  20782. return $core.withContext(function($ctx2) {
  20783. return $self._error_("A DagSink cannot have children.");
  20784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20785. }));
  20786. return self;
  20787. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection})});
  20788. }; }),
  20789. $globals.TDagSink);
  20790. $core.addTrait("TDerivedDagChildren", "Kernel-Dag");
  20791. $core.addMethod(
  20792. $core.method({
  20793. selector: "addDagChild:",
  20794. protocol: "accessing",
  20795. args: ["aDagNode"],
  20796. source: "addDagChild: aDagNode\x0a\x09self error: 'Cannot add child for a TDerivedChildren.'",
  20797. referencedClasses: [],
  20798. pragmas: [],
  20799. messageSends: ["error:"]
  20800. }, function ($methodClass){ return function (aDagNode){
  20801. var self=this,$self=this;
  20802. return $core.withContext(function($ctx1) {
  20803. $self._error_("Cannot add child for a TDerivedChildren.");
  20804. return self;
  20805. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode})});
  20806. }; }),
  20807. $globals.TDerivedDagChildren);
  20808. $core.addMethod(
  20809. $core.method({
  20810. selector: "dagChildren",
  20811. protocol: "accessing",
  20812. args: [],
  20813. source: "dagChildren\x0a\x09self subclassResponsibility",
  20814. referencedClasses: [],
  20815. pragmas: [],
  20816. messageSends: ["subclassResponsibility"]
  20817. }, function ($methodClass){ return function (){
  20818. var self=this,$self=this;
  20819. return $core.withContext(function($ctx1) {
  20820. $self._subclassResponsibility();
  20821. return self;
  20822. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{})});
  20823. }; }),
  20824. $globals.TDerivedDagChildren);
  20825. $core.addMethod(
  20826. $core.method({
  20827. selector: "dagChildren:",
  20828. protocol: "accessing",
  20829. args: ["aCollection"],
  20830. source: "dagChildren: aCollection\x0a\x09self error: 'Cannot set children of a TDerivedChildren.'",
  20831. referencedClasses: [],
  20832. pragmas: [],
  20833. messageSends: ["error:"]
  20834. }, function ($methodClass){ return function (aCollection){
  20835. var self=this,$self=this;
  20836. return $core.withContext(function($ctx1) {
  20837. $self._error_("Cannot set children of a TDerivedChildren.");
  20838. return self;
  20839. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection})});
  20840. }; }),
  20841. $globals.TDerivedDagChildren);
  20842. $core.addTrait("TSingleDagChild", "Kernel-Dag");
  20843. $core.addMethod(
  20844. $core.method({
  20845. selector: "dagChild",
  20846. protocol: "accessing",
  20847. args: [],
  20848. source: "dagChild\x0a\x09self subclassResponsibility",
  20849. referencedClasses: [],
  20850. pragmas: [],
  20851. messageSends: ["subclassResponsibility"]
  20852. }, function ($methodClass){ return function (){
  20853. var self=this,$self=this;
  20854. return $core.withContext(function($ctx1) {
  20855. $self._subclassResponsibility();
  20856. return self;
  20857. }, function($ctx1) {$ctx1.fill(self,"dagChild",{})});
  20858. }; }),
  20859. $globals.TSingleDagChild);
  20860. $core.addMethod(
  20861. $core.method({
  20862. selector: "dagChildren",
  20863. protocol: "accessing",
  20864. args: [],
  20865. source: "dagChildren\x0a\x09^ { self dagChild }",
  20866. referencedClasses: [],
  20867. pragmas: [],
  20868. messageSends: ["dagChild"]
  20869. }, function ($methodClass){ return function (){
  20870. var self=this,$self=this;
  20871. return $core.withContext(function($ctx1) {
  20872. return [$self._dagChild()];
  20873. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{})});
  20874. }; }),
  20875. $globals.TSingleDagChild);
  20876. $core.setTraitComposition([{trait: $globals.TDerivedDagChildren}], $globals.TDagSink);
  20877. $core.setTraitComposition([{trait: $globals.TDerivedDagChildren}], $globals.TSingleDagChild);
  20878. $core.setTraitComposition([{trait: $globals.TDagSink}], $globals.DagSink);
  20879. $core.addMethod(
  20880. $core.method({
  20881. selector: "isDagNode",
  20882. protocol: "*Kernel-Dag",
  20883. args: [],
  20884. source: "isDagNode\x0a\x09^ false",
  20885. referencedClasses: [],
  20886. pragmas: [],
  20887. messageSends: []
  20888. }, function ($methodClass){ return function (){
  20889. var self=this,$self=this;
  20890. return false;
  20891. }; }),
  20892. $globals.Object);
  20893. });
  20894. define('amber/core/Kernel-Promises',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  20895. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20896. var $pkg = $core.addPackage("Kernel-Promises");
  20897. $pkg.innerEval = function (expr) { return eval(expr); };
  20898. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  20899. $core.addClass("Promise", $globals.Object, [], "Kernel-Promises");
  20900. $core.addMethod(
  20901. $core.method({
  20902. selector: "all:",
  20903. protocol: "composites",
  20904. args: ["aCollection"],
  20905. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  20906. referencedClasses: [],
  20907. pragmas: [["inlineJS:", ["return Promise.all($recv(aCollection)._asArray())"]]],
  20908. messageSends: []
  20909. }, function ($methodClass){ return function (aCollection){
  20910. var self=this,$self=this;
  20911. return $core.withContext(function($ctx1) {
  20912. return Promise.all($recv(aCollection)._asArray());
  20913. return self;
  20914. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection})});
  20915. }; }),
  20916. $globals.Promise.a$cls);
  20917. $core.addMethod(
  20918. $core.method({
  20919. selector: "any:",
  20920. protocol: "composites",
  20921. args: ["aCollection"],
  20922. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  20923. referencedClasses: [],
  20924. pragmas: [["inlineJS:", ["return Promise.race($recv(aCollection)._asArray())"]]],
  20925. messageSends: []
  20926. }, function ($methodClass){ return function (aCollection){
  20927. var self=this,$self=this;
  20928. return $core.withContext(function($ctx1) {
  20929. return Promise.race($recv(aCollection)._asArray());
  20930. return self;
  20931. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection})});
  20932. }; }),
  20933. $globals.Promise.a$cls);
  20934. $core.addMethod(
  20935. $core.method({
  20936. selector: "forBlock:",
  20937. protocol: "instance creation",
  20938. args: ["aBlock"],
  20939. 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",
  20940. referencedClasses: [],
  20941. pragmas: [],
  20942. messageSends: ["then:", "new"]
  20943. }, function ($methodClass){ return function (aBlock){
  20944. var self=this,$self=this;
  20945. return $core.withContext(function($ctx1) {
  20946. return $recv($self._new())._then_(aBlock);
  20947. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock})});
  20948. }; }),
  20949. $globals.Promise.a$cls);
  20950. $core.addMethod(
  20951. $core.method({
  20952. selector: "new",
  20953. protocol: "instance creation",
  20954. args: [],
  20955. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  20956. referencedClasses: [],
  20957. pragmas: [["inlineJS:", ["return Promise.resolve()"]]],
  20958. messageSends: []
  20959. }, function ($methodClass){ return function (){
  20960. var self=this,$self=this;
  20961. return $core.withContext(function($ctx1) {
  20962. return Promise.resolve();
  20963. return self;
  20964. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  20965. }; }),
  20966. $globals.Promise.a$cls);
  20967. $core.addMethod(
  20968. $core.method({
  20969. selector: "new:",
  20970. protocol: "instance creation",
  20971. args: ["aBlock"],
  20972. source: "new: aBlock\x0a\x22Returns a Promise that is eventually resolved or rejected.\x0aPass a block that is called with one argument, model.\x0aYou should call model value: ... to resolve the promise\x0aand model signal: ... to reject the promise.\x0aIf error happens during run of the block,\x0apromise is rejected with that error as well.\x22\x0a<inlineJS: 'return new Promise(function (resolve, reject) {\x0a var model = {value: resolve, signal: reject};\x0a aBlock._value_(model);\x0a})'>",
  20973. referencedClasses: [],
  20974. pragmas: [["inlineJS:", ["return new Promise(function (resolve, reject) {\x0a var model = {value: resolve, signal: reject};\x0a aBlock._value_(model);\x0a})"]]],
  20975. messageSends: []
  20976. }, function ($methodClass){ return function (aBlock){
  20977. var self=this,$self=this;
  20978. return $core.withContext(function($ctx1) {
  20979. return new Promise(function (resolve, reject) {
  20980. var model = {value: resolve, signal: reject};
  20981. aBlock._value_(model);
  20982. });
  20983. return self;
  20984. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock})});
  20985. }; }),
  20986. $globals.Promise.a$cls);
  20987. $core.addMethod(
  20988. $core.method({
  20989. selector: "signal:",
  20990. protocol: "instance creation",
  20991. args: ["anObject"],
  20992. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  20993. referencedClasses: [],
  20994. pragmas: [["inlineJS:", ["return $recv(anObject)._in_(function (x) {return Promise.reject(x)})"]]],
  20995. messageSends: []
  20996. }, function ($methodClass){ return function (anObject){
  20997. var self=this,$self=this;
  20998. return $core.withContext(function($ctx1) {
  20999. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  21000. return self;
  21001. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject})});
  21002. }; }),
  21003. $globals.Promise.a$cls);
  21004. $core.addMethod(
  21005. $core.method({
  21006. selector: "value:",
  21007. protocol: "instance creation",
  21008. args: ["anObject"],
  21009. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  21010. referencedClasses: [],
  21011. pragmas: [["inlineJS:", ["return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})"]]],
  21012. messageSends: []
  21013. }, function ($methodClass){ return function (anObject){
  21014. var self=this,$self=this;
  21015. return $core.withContext(function($ctx1) {
  21016. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  21017. return self;
  21018. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  21019. }; }),
  21020. $globals.Promise.a$cls);
  21021. $core.addTrait("TThenable", "Kernel-Promises");
  21022. $core.addMethod(
  21023. $core.method({
  21024. selector: "catch:",
  21025. protocol: "promises",
  21026. args: ["aBlock"],
  21027. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  21028. referencedClasses: [],
  21029. pragmas: [["inlineJS:", ["return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})"]]],
  21030. messageSends: []
  21031. }, function ($methodClass){ return function (aBlock){
  21032. var self=this,$self=this;
  21033. return $core.withContext(function($ctx1) {
  21034. return self.then(null, function (err) {return $core.seamless(function () {
  21035. return aBlock._value_(err);
  21036. })});
  21037. return self;
  21038. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock})});
  21039. }; }),
  21040. $globals.TThenable);
  21041. $core.addMethod(
  21042. $core.method({
  21043. selector: "on:do:",
  21044. protocol: "promises",
  21045. args: ["aClass", "aBlock"],
  21046. 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})})'>",
  21047. referencedClasses: [],
  21048. pragmas: [["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})})"]]],
  21049. messageSends: []
  21050. }, function ($methodClass){ return function (aClass,aBlock){
  21051. var self=this,$self=this;
  21052. return $core.withContext(function($ctx1) {
  21053. return self.then(null, function (err) {return $core.seamless(function () {
  21054. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  21055. else throw err;
  21056. })});
  21057. return self;
  21058. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock})});
  21059. }; }),
  21060. $globals.TThenable);
  21061. $core.addMethod(
  21062. $core.method({
  21063. selector: "on:do:catch:",
  21064. protocol: "promises",
  21065. args: ["aClass", "aBlock", "anotherBlock"],
  21066. source: "on: aClass do: aBlock catch: anotherBlock\x0a\x09^ (self on: aClass do: aBlock) catch: anotherBlock",
  21067. referencedClasses: [],
  21068. pragmas: [],
  21069. messageSends: ["catch:", "on:do:"]
  21070. }, function ($methodClass){ return function (aClass,aBlock,anotherBlock){
  21071. var self=this,$self=this;
  21072. return $core.withContext(function($ctx1) {
  21073. return $recv($self._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21074. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock})});
  21075. }; }),
  21076. $globals.TThenable);
  21077. $core.addMethod(
  21078. $core.method({
  21079. selector: "then:",
  21080. protocol: "promises",
  21081. args: ["aBlockOrArray"],
  21082. 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)'>",
  21083. referencedClasses: [],
  21084. pragmas: [["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)"]]],
  21085. messageSends: []
  21086. }, function ($methodClass){ return function (aBlockOrArray){
  21087. var self=this,$self=this;
  21088. return $core.withContext(function($ctx1) {
  21089. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  21090. return array.reduce(function (soFar, aBlock) {
  21091. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  21092. function (result) {return $core.seamless(function () {
  21093. if (Array.isArray(result)) {
  21094. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  21095. } else {
  21096. return aBlock._value_(result);
  21097. }
  21098. })} :
  21099. function (result) {return $core.seamless(function () {
  21100. return aBlock._value_(result);
  21101. })}
  21102. );
  21103. }, self);
  21104. return self;
  21105. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray})});
  21106. }; }),
  21107. $globals.TThenable);
  21108. $core.addMethod(
  21109. $core.method({
  21110. selector: "then:catch:",
  21111. protocol: "promises",
  21112. args: ["aBlockOrArray", "anotherBlock"],
  21113. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  21114. referencedClasses: [],
  21115. pragmas: [],
  21116. messageSends: ["catch:", "then:"]
  21117. }, function ($methodClass){ return function (aBlockOrArray,anotherBlock){
  21118. var self=this,$self=this;
  21119. return $core.withContext(function($ctx1) {
  21120. return $recv($self._then_(aBlockOrArray))._catch_(anotherBlock);
  21121. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock})});
  21122. }; }),
  21123. $globals.TThenable);
  21124. $core.addMethod(
  21125. $core.method({
  21126. selector: "then:on:do:",
  21127. protocol: "promises",
  21128. args: ["aBlockOrArray", "aClass", "aBlock"],
  21129. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  21130. referencedClasses: [],
  21131. pragmas: [],
  21132. messageSends: ["on:do:", "then:"]
  21133. }, function ($methodClass){ return function (aBlockOrArray,aClass,aBlock){
  21134. var self=this,$self=this;
  21135. return $core.withContext(function($ctx1) {
  21136. return $recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  21137. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock})});
  21138. }; }),
  21139. $globals.TThenable);
  21140. $core.addMethod(
  21141. $core.method({
  21142. selector: "then:on:do:catch:",
  21143. protocol: "promises",
  21144. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  21145. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  21146. referencedClasses: [],
  21147. pragmas: [],
  21148. messageSends: ["catch:", "on:do:", "then:"]
  21149. }, function ($methodClass){ return function (aBlockOrArray,aClass,aBlock,anotherBlock){
  21150. var self=this,$self=this;
  21151. return $core.withContext(function($ctx1) {
  21152. return $recv($recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21153. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock})});
  21154. }; }),
  21155. $globals.TThenable);
  21156. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.Promise);
  21157. });
  21158. define('amber/core/Kernel-Infrastructure',["amber/boot", "require", "amber/core/Kernel-Collections", "amber/core/Kernel-Helpers", "amber/core/Kernel-Objects", "amber/core/Kernel-Promises"], function($boot,requirejs){"use strict";
  21159. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21160. var $pkg = $core.addPackage("Kernel-Infrastructure");
  21161. $pkg.innerEval = function (expr) { return eval(expr); };
  21162. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  21163. $core.addClass("AmberBootstrapInitialization", $globals.Object, [], "Kernel-Infrastructure");
  21164. $core.addMethod(
  21165. $core.method({
  21166. selector: "organizeClasses",
  21167. protocol: "organization",
  21168. args: [],
  21169. source: "organizeClasses\x0a\x09Smalltalk classes do: [ :each | each enterOrganization ]",
  21170. referencedClasses: ["Smalltalk"],
  21171. pragmas: [],
  21172. messageSends: ["do:", "classes", "enterOrganization"]
  21173. }, function ($methodClass){ return function (){
  21174. var self=this,$self=this;
  21175. return $core.withContext(function($ctx1) {
  21176. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  21177. return $core.withContext(function($ctx2) {
  21178. return $recv(each)._enterOrganization();
  21179. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21180. }));
  21181. return self;
  21182. }, function($ctx1) {$ctx1.fill(self,"organizeClasses",{})});
  21183. }; }),
  21184. $globals.AmberBootstrapInitialization.a$cls);
  21185. $core.addMethod(
  21186. $core.method({
  21187. selector: "organizeMethods",
  21188. protocol: "organization",
  21189. args: [],
  21190. source: "organizeMethods\x0a\x09Smalltalk classes do: [ :eachClass |\x0a\x09\x09eachClass definedMethods do: [ :eachMethod |\x0a\x09\x09\x09eachMethod methodClass methodOrganizationEnter: eachMethod andLeave: nil ] ]",
  21191. referencedClasses: ["Smalltalk"],
  21192. pragmas: [],
  21193. messageSends: ["do:", "classes", "definedMethods", "methodOrganizationEnter:andLeave:", "methodClass"]
  21194. }, function ($methodClass){ return function (){
  21195. var self=this,$self=this;
  21196. return $core.withContext(function($ctx1) {
  21197. [$recv($recv($globals.Smalltalk)._classes())._do_((function(eachClass){
  21198. return $core.withContext(function($ctx2) {
  21199. return $recv($recv(eachClass)._definedMethods())._do_((function(eachMethod){
  21200. return $core.withContext(function($ctx3) {
  21201. return $recv($recv(eachMethod)._methodClass())._methodOrganizationEnter_andLeave_(eachMethod,nil);
  21202. }, function($ctx3) {$ctx3.fillBlock({eachMethod:eachMethod},$ctx2,2)});
  21203. }));
  21204. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  21205. }))
  21206. ,$ctx1.sendIdx["do:"]=1
  21207. ][0];
  21208. return self;
  21209. }, function($ctx1) {$ctx1.fill(self,"organizeMethods",{})});
  21210. }; }),
  21211. $globals.AmberBootstrapInitialization.a$cls);
  21212. $core.addMethod(
  21213. $core.method({
  21214. selector: "run",
  21215. protocol: "public api",
  21216. args: [],
  21217. source: "run\x0a\x09SmalltalkImage initialize.\x0a\x09self\x0a\x09\x09organizeClasses;\x0a\x09\x09organizeMethods.\x0a\x09^ Smalltalk postLoad",
  21218. referencedClasses: ["SmalltalkImage", "Smalltalk"],
  21219. pragmas: [],
  21220. messageSends: ["initialize", "organizeClasses", "organizeMethods", "postLoad"]
  21221. }, function ($methodClass){ return function (){
  21222. var self=this,$self=this;
  21223. return $core.withContext(function($ctx1) {
  21224. $recv($globals.SmalltalkImage)._initialize();
  21225. $self._organizeClasses();
  21226. $self._organizeMethods();
  21227. return $recv($globals.Smalltalk)._postLoad();
  21228. }, function($ctx1) {$ctx1.fill(self,"run",{})});
  21229. }; }),
  21230. $globals.AmberBootstrapInitialization.a$cls);
  21231. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  21232. $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`.";
  21233. $core.addMethod(
  21234. $core.method({
  21235. selector: "=",
  21236. protocol: "comparing",
  21237. args: ["anObject"],
  21238. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  21239. referencedClasses: ["JSObjectProxy"],
  21240. pragmas: [],
  21241. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  21242. }, function ($methodClass){ return function (anObject){
  21243. var self=this,$self=this;
  21244. return $core.withContext(function($ctx1) {
  21245. if(!$core.assert($recv([$recv(anObject)._class()
  21246. ,$ctx1.sendIdx["class"]=1
  21247. ][0]).__eq_eq($self._class()))){
  21248. return false;
  21249. }
  21250. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  21251. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject})});
  21252. }; }),
  21253. $globals.JSObjectProxy);
  21254. $core.addMethod(
  21255. $core.method({
  21256. selector: "asJavaScriptObject",
  21257. protocol: "converting",
  21258. args: [],
  21259. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  21260. referencedClasses: [],
  21261. pragmas: [],
  21262. messageSends: []
  21263. }, function ($methodClass){ return function (){
  21264. var self=this,$self=this;
  21265. return $self.jsObject;
  21266. }; }),
  21267. $globals.JSObjectProxy);
  21268. $core.addMethod(
  21269. $core.method({
  21270. selector: "at:",
  21271. protocol: "accessing",
  21272. args: ["aString"],
  21273. source: "at: aString\x0a\x09<inlineJS: 'return $self.jsObject[aString]'>",
  21274. referencedClasses: [],
  21275. pragmas: [["inlineJS:", ["return $self.jsObject[aString]"]]],
  21276. messageSends: []
  21277. }, function ($methodClass){ return function (aString){
  21278. var self=this,$self=this;
  21279. return $core.withContext(function($ctx1) {
  21280. return $self.jsObject[aString];
  21281. return self;
  21282. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString})});
  21283. }; }),
  21284. $globals.JSObjectProxy);
  21285. $core.addMethod(
  21286. $core.method({
  21287. selector: "at:ifAbsent:",
  21288. protocol: "accessing",
  21289. args: ["aString", "aBlock"],
  21290. 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'>",
  21291. referencedClasses: [],
  21292. pragmas: [["inlineJS:", ["\x0a\x09\x09var obj = $self.jsObject;\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09"]]],
  21293. messageSends: []
  21294. }, function ($methodClass){ return function (aString,aBlock){
  21295. var self=this,$self=this;
  21296. return $core.withContext(function($ctx1) {
  21297. var obj = $self.jsObject;
  21298. return aString in obj ? obj[aString] : aBlock._value();
  21299. ;
  21300. return self;
  21301. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock})});
  21302. }; }),
  21303. $globals.JSObjectProxy);
  21304. $core.addMethod(
  21305. $core.method({
  21306. selector: "at:ifPresent:",
  21307. protocol: "accessing",
  21308. args: ["aString", "aBlock"],
  21309. 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'>",
  21310. referencedClasses: [],
  21311. pragmas: [["inlineJS:", ["\x0a\x09\x09var obj = $self.jsObject;\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : nil;\x0a\x09"]]],
  21312. messageSends: []
  21313. }, function ($methodClass){ return function (aString,aBlock){
  21314. var self=this,$self=this;
  21315. return $core.withContext(function($ctx1) {
  21316. var obj = $self.jsObject;
  21317. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  21318. ;
  21319. return self;
  21320. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock})});
  21321. }; }),
  21322. $globals.JSObjectProxy);
  21323. $core.addMethod(
  21324. $core.method({
  21325. selector: "at:ifPresent:ifAbsent:",
  21326. protocol: "accessing",
  21327. args: ["aString", "aBlock", "anotherBlock"],
  21328. 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'>",
  21329. referencedClasses: [],
  21330. pragmas: [["inlineJS:", ["\x0a\x09\x09var obj = $self.jsObject;\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();\x0a\x09"]]],
  21331. messageSends: []
  21332. }, function ($methodClass){ return function (aString,aBlock,anotherBlock){
  21333. var self=this,$self=this;
  21334. return $core.withContext(function($ctx1) {
  21335. var obj = $self.jsObject;
  21336. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  21337. ;
  21338. return self;
  21339. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock})});
  21340. }; }),
  21341. $globals.JSObjectProxy);
  21342. $core.addMethod(
  21343. $core.method({
  21344. selector: "at:put:",
  21345. protocol: "accessing",
  21346. args: ["aString", "anObject"],
  21347. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return $self.jsObject[aString] = anObject'>",
  21348. referencedClasses: [],
  21349. pragmas: [["inlineJS:", ["return $self.jsObject[aString] = anObject"]]],
  21350. messageSends: []
  21351. }, function ($methodClass){ return function (aString,anObject){
  21352. var self=this,$self=this;
  21353. return $core.withContext(function($ctx1) {
  21354. return $self.jsObject[aString] = anObject;
  21355. return self;
  21356. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject})});
  21357. }; }),
  21358. $globals.JSObjectProxy);
  21359. $core.addMethod(
  21360. $core.method({
  21361. selector: "catch:",
  21362. protocol: "promises",
  21363. args: ["aBlock"],
  21364. source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]",
  21365. referencedClasses: ["NativeFunction", "TThenable"],
  21366. pragmas: [],
  21367. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"]
  21368. }, function ($methodClass){ return function (aBlock){
  21369. var self=this,$self=this;
  21370. return $core.withContext(function($ctx1) {
  21371. if($core.assert($recv($globals.NativeFunction)._isNativeFunction_($self._at_("then")))){
  21372. return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_($self.jsObject,[aBlock]);
  21373. } else {
  21374. return [(
  21375. $ctx1.supercall = true,
  21376. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._catch_.call($self,aBlock))
  21377. ,$ctx1.supercall = false
  21378. ][0];
  21379. }
  21380. return self;
  21381. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock})});
  21382. }; }),
  21383. $globals.JSObjectProxy);
  21384. $core.addMethod(
  21385. $core.method({
  21386. selector: "doesNotUnderstand:",
  21387. protocol: "proxy",
  21388. args: ["aMessage"],
  21389. 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 ]",
  21390. referencedClasses: ["JSObjectProxy"],
  21391. pragmas: [],
  21392. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  21393. }, function ($methodClass){ return function (aMessage){
  21394. var self=this,$self=this;
  21395. return $core.withContext(function($ctx1) {
  21396. var $1;
  21397. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  21398. if($1 == null || $1.a$nil){
  21399. return [(
  21400. $ctx1.supercall = true,
  21401. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.call($self,aMessage))
  21402. ,$ctx1.supercall = false
  21403. ][0];
  21404. } else {
  21405. var jsSelector;
  21406. jsSelector=$1;
  21407. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  21408. }
  21409. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage})});
  21410. }; }),
  21411. $globals.JSObjectProxy);
  21412. $core.addMethod(
  21413. $core.method({
  21414. selector: "in:",
  21415. protocol: "accessing",
  21416. args: ["aValuable"],
  21417. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  21418. referencedClasses: [],
  21419. pragmas: [],
  21420. messageSends: ["value:"]
  21421. }, function ($methodClass){ return function (aValuable){
  21422. var self=this,$self=this;
  21423. return $core.withContext(function($ctx1) {
  21424. return $recv(aValuable)._value_($self.jsObject);
  21425. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable})});
  21426. }; }),
  21427. $globals.JSObjectProxy);
  21428. $core.addMethod(
  21429. $core.method({
  21430. selector: "jsObject",
  21431. protocol: "accessing",
  21432. args: [],
  21433. source: "jsObject\x0a\x09^ jsObject",
  21434. referencedClasses: [],
  21435. pragmas: [],
  21436. messageSends: []
  21437. }, function ($methodClass){ return function (){
  21438. var self=this,$self=this;
  21439. return $self.jsObject;
  21440. }; }),
  21441. $globals.JSObjectProxy);
  21442. $core.addMethod(
  21443. $core.method({
  21444. selector: "keysAndValuesDo:",
  21445. protocol: "enumerating",
  21446. args: ["aBlock"],
  21447. 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'>",
  21448. referencedClasses: [],
  21449. pragmas: [["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"]]],
  21450. messageSends: []
  21451. }, function ($methodClass){ return function (aBlock){
  21452. var self=this,$self=this;
  21453. return $core.withContext(function($ctx1) {
  21454. var o = $self.jsObject;
  21455. for(var i in o) {
  21456. aBlock._value_value_(i, o[i]);
  21457. }
  21458. ;
  21459. return self;
  21460. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  21461. }; }),
  21462. $globals.JSObjectProxy);
  21463. $core.addMethod(
  21464. $core.method({
  21465. selector: "on:do:",
  21466. protocol: "promises",
  21467. args: ["aClass", "aBlock"],
  21468. source: "on: aClass do: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #on:do:) sendTo: jsObject arguments: {aClass. aBlock} ]\x0a\x09ifFalse: [ ^ super on: aClass do: aBlock ]",
  21469. referencedClasses: ["NativeFunction", "TThenable"],
  21470. pragmas: [],
  21471. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"]
  21472. }, function ($methodClass){ return function (aClass,aBlock){
  21473. var self=this,$self=this;
  21474. return $core.withContext(function($ctx1) {
  21475. if($core.assert($recv($globals.NativeFunction)._isNativeFunction_($self._at_("then")))){
  21476. return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_($self.jsObject,[aClass,aBlock]);
  21477. } else {
  21478. return [(
  21479. $ctx1.supercall = true,
  21480. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._on_do_.call($self,aClass,aBlock))
  21481. ,$ctx1.supercall = false
  21482. ][0];
  21483. }
  21484. return self;
  21485. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock})});
  21486. }; }),
  21487. $globals.JSObjectProxy);
  21488. $core.addMethod(
  21489. $core.method({
  21490. selector: "printOn:",
  21491. protocol: "printing",
  21492. args: ["aStream"],
  21493. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  21494. referencedClasses: [],
  21495. pragmas: [],
  21496. messageSends: ["nextPutAll:", "printString"]
  21497. }, function ($methodClass){ return function (aStream){
  21498. var self=this,$self=this;
  21499. return $core.withContext(function($ctx1) {
  21500. $recv(aStream)._nextPutAll_($self._printString());
  21501. return self;
  21502. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  21503. }; }),
  21504. $globals.JSObjectProxy);
  21505. $core.addMethod(
  21506. $core.method({
  21507. selector: "printString",
  21508. protocol: "printing",
  21509. args: [],
  21510. source: "printString\x0a\x09<inlineJS: '\x0a\x09\x09var js = $self.jsObject;\x0a\x09\x09return !js ? \x22<<malformed JS object proxy>>\x22 : js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09'>",
  21511. referencedClasses: [],
  21512. pragmas: [["inlineJS:", ["\x0a\x09\x09var js = $self.jsObject;\x0a\x09\x09return !js ? \x22<<malformed JS object proxy>>\x22 : js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09"]]],
  21513. messageSends: []
  21514. }, function ($methodClass){ return function (){
  21515. var self=this,$self=this;
  21516. return $core.withContext(function($ctx1) {
  21517. var js = $self.jsObject;
  21518. return !js ? "<<malformed JS object proxy>>" : js.toString
  21519. ? js.toString()
  21520. : Object.prototype.toString.call(js)
  21521. ;
  21522. return self;
  21523. }, function($ctx1) {$ctx1.fill(self,"printString",{})});
  21524. }; }),
  21525. $globals.JSObjectProxy);
  21526. $core.addMethod(
  21527. $core.method({
  21528. selector: "putOn:",
  21529. protocol: "streaming",
  21530. args: ["aStream"],
  21531. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  21532. referencedClasses: [],
  21533. pragmas: [],
  21534. messageSends: ["nextPutJSObject:"]
  21535. }, function ($methodClass){ return function (aStream){
  21536. var self=this,$self=this;
  21537. return $core.withContext(function($ctx1) {
  21538. $recv(aStream)._nextPutJSObject_($self.jsObject);
  21539. return self;
  21540. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  21541. }; }),
  21542. $globals.JSObjectProxy);
  21543. $core.addMethod(
  21544. $core.method({
  21545. selector: "removeKey:",
  21546. protocol: "accessing",
  21547. args: ["aString"],
  21548. source: "removeKey: aString\x0a\x09<inlineJS: 'delete $self.jsObject[aString]; return aString'>",
  21549. referencedClasses: [],
  21550. pragmas: [["inlineJS:", ["delete $self.jsObject[aString]; return aString"]]],
  21551. messageSends: []
  21552. }, function ($methodClass){ return function (aString){
  21553. var self=this,$self=this;
  21554. return $core.withContext(function($ctx1) {
  21555. delete $self.jsObject[aString]; return aString;
  21556. return self;
  21557. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aString:aString})});
  21558. }; }),
  21559. $globals.JSObjectProxy);
  21560. $core.addMethod(
  21561. $core.method({
  21562. selector: "then:",
  21563. protocol: "promises",
  21564. args: ["aBlockOrArray"],
  21565. source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]",
  21566. referencedClasses: ["NativeFunction", "TThenable"],
  21567. pragmas: [],
  21568. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"]
  21569. }, function ($methodClass){ return function (aBlockOrArray){
  21570. var self=this,$self=this;
  21571. return $core.withContext(function($ctx1) {
  21572. if($core.assert($recv($globals.NativeFunction)._isNativeFunction_($self._at_("then")))){
  21573. return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_($self.jsObject,[aBlockOrArray]);
  21574. } else {
  21575. return [(
  21576. $ctx1.supercall = true,
  21577. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._then_.call($self,aBlockOrArray))
  21578. ,$ctx1.supercall = false
  21579. ][0];
  21580. }
  21581. return self;
  21582. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray})});
  21583. }; }),
  21584. $globals.JSObjectProxy);
  21585. $core.addMethod(
  21586. $core.method({
  21587. selector: "addObjectVariablesTo:ofProxy:",
  21588. protocol: "proxy",
  21589. args: ["aDictionary", "aProxy"],
  21590. 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'>",
  21591. referencedClasses: [],
  21592. pragmas: [["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"]]],
  21593. messageSends: []
  21594. }, function ($methodClass){ return function (aDictionary,aProxy){
  21595. var self=this,$self=this;
  21596. return $core.withContext(function($ctx1) {
  21597. var jsObject = aProxy.jsObject;
  21598. for(var i in jsObject) {
  21599. aDictionary._at_put_(i, jsObject[i]);
  21600. }
  21601. ;
  21602. return self;
  21603. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy})});
  21604. }; }),
  21605. $globals.JSObjectProxy.a$cls);
  21606. $core.addMethod(
  21607. $core.method({
  21608. selector: "compareJSObjectOfProxy:withProxy:",
  21609. protocol: "proxy",
  21610. args: ["aProxy", "anotherProxy"],
  21611. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<inlineJS: '\x0a\x09var anotherJSObject = anotherProxy.a$cls ? anotherProxy.jsObject : anotherProxy;\x0a\x09return aProxy.jsObject === anotherJSObject\x0a'>",
  21612. referencedClasses: [],
  21613. pragmas: [["inlineJS:", ["\x0a\x09var anotherJSObject = anotherProxy.a$cls ? anotherProxy.jsObject : anotherProxy;\x0a\x09return aProxy.jsObject === anotherJSObject"]]],
  21614. messageSends: []
  21615. }, function ($methodClass){ return function (aProxy,anotherProxy){
  21616. var self=this,$self=this;
  21617. return $core.withContext(function($ctx1) {
  21618. var anotherJSObject = anotherProxy.a$cls ? anotherProxy.jsObject : anotherProxy;
  21619. return aProxy.jsObject === anotherJSObject;
  21620. return self;
  21621. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy})});
  21622. }; }),
  21623. $globals.JSObjectProxy.a$cls);
  21624. $core.addMethod(
  21625. $core.method({
  21626. selector: "forwardMessage:withArguments:ofProxy:",
  21627. protocol: "proxy",
  21628. args: ["aString", "anArray", "aProxy"],
  21629. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  21630. referencedClasses: [],
  21631. pragmas: [["inlineJS:", ["\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09"]]],
  21632. messageSends: []
  21633. }, function ($methodClass){ return function (aString,anArray,aProxy){
  21634. var self=this,$self=this;
  21635. return $core.withContext(function($ctx1) {
  21636. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  21637. ;
  21638. return self;
  21639. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy})});
  21640. }; }),
  21641. $globals.JSObjectProxy.a$cls);
  21642. $core.addMethod(
  21643. $core.method({
  21644. selector: "jsObject:ofProxy:",
  21645. protocol: "proxy",
  21646. args: ["aJSObject", "aProxy"],
  21647. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy.jsObject = aJSObject'>",
  21648. referencedClasses: [],
  21649. pragmas: [["inlineJS:", ["aProxy.jsObject = aJSObject"]]],
  21650. messageSends: []
  21651. }, function ($methodClass){ return function (aJSObject,aProxy){
  21652. var self=this,$self=this;
  21653. return $core.withContext(function($ctx1) {
  21654. aProxy.jsObject = aJSObject;
  21655. return self;
  21656. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy})});
  21657. }; }),
  21658. $globals.JSObjectProxy.a$cls);
  21659. $core.addMethod(
  21660. $core.method({
  21661. selector: "lookupProperty:ofProxy:",
  21662. protocol: "proxy",
  21663. args: ["aString", "aProxy"],
  21664. 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'>",
  21665. referencedClasses: [],
  21666. pragmas: [["inlineJS:", ["return aString in aProxy._jsObject() ? aString : nil"]]],
  21667. messageSends: []
  21668. }, function ($methodClass){ return function (aString,aProxy){
  21669. var self=this,$self=this;
  21670. return $core.withContext(function($ctx1) {
  21671. return aString in aProxy._jsObject() ? aString : nil;
  21672. return self;
  21673. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy})});
  21674. }; }),
  21675. $globals.JSObjectProxy.a$cls);
  21676. $core.addMethod(
  21677. $core.method({
  21678. selector: "null",
  21679. protocol: "accessing",
  21680. args: [],
  21681. source: "null\x0a\x09<inlineJS: 'return null'>",
  21682. referencedClasses: [],
  21683. pragmas: [["inlineJS:", ["return null"]]],
  21684. messageSends: []
  21685. }, function ($methodClass){ return function (){
  21686. var self=this,$self=this;
  21687. return $core.withContext(function($ctx1) {
  21688. return null;
  21689. return self;
  21690. }, function($ctx1) {$ctx1.fill(self,"null",{})});
  21691. }; }),
  21692. $globals.JSObjectProxy.a$cls);
  21693. $core.addMethod(
  21694. $core.method({
  21695. selector: "on:",
  21696. protocol: "instance creation",
  21697. args: ["aJSObject"],
  21698. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  21699. referencedClasses: [],
  21700. pragmas: [],
  21701. messageSends: ["new", "jsObject:ofProxy:"]
  21702. }, function ($methodClass){ return function (aJSObject){
  21703. var self=this,$self=this;
  21704. var instance;
  21705. return $core.withContext(function($ctx1) {
  21706. instance=$self._new();
  21707. $self._jsObject_ofProxy_(aJSObject,instance);
  21708. return instance;
  21709. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance})});
  21710. }; }),
  21711. $globals.JSObjectProxy.a$cls);
  21712. $core.addMethod(
  21713. $core.method({
  21714. selector: "undefined",
  21715. protocol: "accessing",
  21716. args: [],
  21717. source: "undefined\x0a\x09<inlineJS: 'return undefined'>",
  21718. referencedClasses: [],
  21719. pragmas: [["inlineJS:", ["return undefined"]]],
  21720. messageSends: []
  21721. }, function ($methodClass){ return function (){
  21722. var self=this,$self=this;
  21723. return $core.withContext(function($ctx1) {
  21724. return undefined;
  21725. return self;
  21726. }, function($ctx1) {$ctx1.fill(self,"undefined",{})});
  21727. }; }),
  21728. $globals.JSObjectProxy.a$cls);
  21729. $core.addClass("Organizer", $globals.Object, ["elements"], "Kernel-Infrastructure");
  21730. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  21731. $core.addMethod(
  21732. $core.method({
  21733. selector: "addElement:",
  21734. protocol: "accessing",
  21735. args: ["anObject"],
  21736. source: "addElement: anObject\x0a\x09self elements add: anObject",
  21737. referencedClasses: [],
  21738. pragmas: [],
  21739. messageSends: ["add:", "elements"]
  21740. }, function ($methodClass){ return function (anObject){
  21741. var self=this,$self=this;
  21742. return $core.withContext(function($ctx1) {
  21743. $recv($self._elements())._add_(anObject);
  21744. return self;
  21745. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject})});
  21746. }; }),
  21747. $globals.Organizer);
  21748. $core.addMethod(
  21749. $core.method({
  21750. selector: "elements",
  21751. protocol: "accessing",
  21752. args: [],
  21753. source: "elements\x0a\x09^ elements",
  21754. referencedClasses: [],
  21755. pragmas: [],
  21756. messageSends: []
  21757. }, function ($methodClass){ return function (){
  21758. var self=this,$self=this;
  21759. return $self.elements;
  21760. }; }),
  21761. $globals.Organizer);
  21762. $core.addMethod(
  21763. $core.method({
  21764. selector: "initialize",
  21765. protocol: "initialization",
  21766. args: [],
  21767. source: "initialize\x0a\x09super initialize.\x0a\x09elements := Set new",
  21768. referencedClasses: ["Set"],
  21769. pragmas: [],
  21770. messageSends: ["initialize", "new"]
  21771. }, function ($methodClass){ return function (){
  21772. var self=this,$self=this;
  21773. return $core.withContext(function($ctx1) {
  21774. [(
  21775. $ctx1.supercall = true,
  21776. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  21777. ,$ctx1.supercall = false
  21778. ][0];
  21779. $self.elements=$recv($globals.Set)._new();
  21780. return self;
  21781. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  21782. }; }),
  21783. $globals.Organizer);
  21784. $core.addMethod(
  21785. $core.method({
  21786. selector: "removeElement:",
  21787. protocol: "accessing",
  21788. args: ["anObject"],
  21789. source: "removeElement: anObject\x0a\x09self elements remove: anObject ifAbsent: []",
  21790. referencedClasses: [],
  21791. pragmas: [],
  21792. messageSends: ["remove:ifAbsent:", "elements"]
  21793. }, function ($methodClass){ return function (anObject){
  21794. var self=this,$self=this;
  21795. return $core.withContext(function($ctx1) {
  21796. $recv($self._elements())._remove_ifAbsent_(anObject,(function(){
  21797. }));
  21798. return self;
  21799. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject})});
  21800. }; }),
  21801. $globals.Organizer);
  21802. $core.addClass("ClassOrganizer", $globals.Organizer, ["traitOrBehavior"], "Kernel-Infrastructure");
  21803. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  21804. $core.addMethod(
  21805. $core.method({
  21806. selector: "addElement:",
  21807. protocol: "accessing",
  21808. args: ["aString"],
  21809. 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)",
  21810. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  21811. pragmas: [],
  21812. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  21813. }, function ($methodClass){ return function (aString){
  21814. var self=this,$self=this;
  21815. return $core.withContext(function($ctx1) {
  21816. var $1,$2;
  21817. [(
  21818. $ctx1.supercall = true,
  21819. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._addElement_.call($self,aString))
  21820. ,$ctx1.supercall = false
  21821. ][0];
  21822. $1=$recv($globals.SystemAnnouncer)._current();
  21823. $2=$recv($globals.ProtocolAdded)._new();
  21824. $recv($2)._protocol_(aString);
  21825. $recv($2)._theClass_($self._theClass());
  21826. $recv($1)._announce_($recv($2)._yourself());
  21827. return self;
  21828. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString})});
  21829. }; }),
  21830. $globals.ClassOrganizer);
  21831. $core.addMethod(
  21832. $core.method({
  21833. selector: "removeElement:",
  21834. protocol: "accessing",
  21835. args: ["aString"],
  21836. 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)",
  21837. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  21838. pragmas: [],
  21839. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  21840. }, function ($methodClass){ return function (aString){
  21841. var self=this,$self=this;
  21842. return $core.withContext(function($ctx1) {
  21843. var $1,$2;
  21844. [(
  21845. $ctx1.supercall = true,
  21846. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._removeElement_.call($self,aString))
  21847. ,$ctx1.supercall = false
  21848. ][0];
  21849. $1=$recv($globals.SystemAnnouncer)._current();
  21850. $2=$recv($globals.ProtocolRemoved)._new();
  21851. $recv($2)._protocol_(aString);
  21852. $recv($2)._theClass_($self._theClass());
  21853. $recv($1)._announce_($recv($2)._yourself());
  21854. return self;
  21855. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString})});
  21856. }; }),
  21857. $globals.ClassOrganizer);
  21858. $core.addMethod(
  21859. $core.method({
  21860. selector: "theClass",
  21861. protocol: "accessing",
  21862. args: [],
  21863. source: "theClass\x0a\x09^ traitOrBehavior",
  21864. referencedClasses: [],
  21865. pragmas: [],
  21866. messageSends: []
  21867. }, function ($methodClass){ return function (){
  21868. var self=this,$self=this;
  21869. return $self.traitOrBehavior;
  21870. }; }),
  21871. $globals.ClassOrganizer);
  21872. $core.addMethod(
  21873. $core.method({
  21874. selector: "theClass:",
  21875. protocol: "accessing",
  21876. args: ["aClass"],
  21877. source: "theClass: aClass\x0a\x09traitOrBehavior := aClass",
  21878. referencedClasses: [],
  21879. pragmas: [],
  21880. messageSends: []
  21881. }, function ($methodClass){ return function (aClass){
  21882. var self=this,$self=this;
  21883. $self.traitOrBehavior=aClass;
  21884. return self;
  21885. }; }),
  21886. $globals.ClassOrganizer);
  21887. $core.addMethod(
  21888. $core.method({
  21889. selector: "on:",
  21890. protocol: "instance creation",
  21891. args: ["aClass"],
  21892. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  21893. referencedClasses: [],
  21894. pragmas: [],
  21895. messageSends: ["theClass:", "new", "yourself"]
  21896. }, function ($methodClass){ return function (aClass){
  21897. var self=this,$self=this;
  21898. return $core.withContext(function($ctx1) {
  21899. var $1;
  21900. $1=$self._new();
  21901. $recv($1)._theClass_(aClass);
  21902. return $recv($1)._yourself();
  21903. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass})});
  21904. }; }),
  21905. $globals.ClassOrganizer.a$cls);
  21906. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  21907. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  21908. $core.addClass("Package", $globals.Object, ["evalBlock", "basicTransport", "name", "transport", "imports", "dirty", "organization", "isReady"], "Kernel-Infrastructure");
  21909. $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'";
  21910. $core.addMethod(
  21911. $core.method({
  21912. selector: "basicTransport",
  21913. protocol: "private",
  21914. args: [],
  21915. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09^ basicTransport",
  21916. referencedClasses: [],
  21917. pragmas: [],
  21918. messageSends: []
  21919. }, function ($methodClass){ return function (){
  21920. var self=this,$self=this;
  21921. return $self.basicTransport;
  21922. }; }),
  21923. $globals.Package);
  21924. $core.addMethod(
  21925. $core.method({
  21926. selector: "beClean",
  21927. protocol: "accessing",
  21928. args: [],
  21929. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  21930. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  21931. pragmas: [],
  21932. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  21933. }, function ($methodClass){ return function (){
  21934. var self=this,$self=this;
  21935. return $core.withContext(function($ctx1) {
  21936. var $1,$2;
  21937. $self.dirty=false;
  21938. $1=$recv($globals.SystemAnnouncer)._current();
  21939. $2=$recv($globals.PackageClean)._new();
  21940. $recv($2)._package_(self);
  21941. $recv($1)._announce_($recv($2)._yourself());
  21942. return self;
  21943. }, function($ctx1) {$ctx1.fill(self,"beClean",{})});
  21944. }; }),
  21945. $globals.Package);
  21946. $core.addMethod(
  21947. $core.method({
  21948. selector: "beDirty",
  21949. protocol: "accessing",
  21950. args: [],
  21951. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  21952. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  21953. pragmas: [],
  21954. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  21955. }, function ($methodClass){ return function (){
  21956. var self=this,$self=this;
  21957. return $core.withContext(function($ctx1) {
  21958. var $1,$2;
  21959. $self.dirty=true;
  21960. $1=$recv($globals.SystemAnnouncer)._current();
  21961. $2=$recv($globals.PackageDirty)._new();
  21962. $recv($2)._package_(self);
  21963. $recv($1)._announce_($recv($2)._yourself());
  21964. return self;
  21965. }, function($ctx1) {$ctx1.fill(self,"beDirty",{})});
  21966. }; }),
  21967. $globals.Package);
  21968. $core.addMethod(
  21969. $core.method({
  21970. selector: "classTemplate",
  21971. protocol: "accessing",
  21972. args: [],
  21973. 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 ]",
  21974. referencedClasses: ["String"],
  21975. pragmas: [],
  21976. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  21977. }, function ($methodClass){ return function (){
  21978. var self=this,$self=this;
  21979. return $core.withContext(function($ctx1) {
  21980. return $recv($globals.String)._streamContents_((function(stream){
  21981. return $core.withContext(function($ctx2) {
  21982. [$recv(stream)._write_("Object subclass: #NameOfSubclass")
  21983. ,$ctx2.sendIdx["write:"]=1
  21984. ][0];
  21985. [$recv(stream)._lf()
  21986. ,$ctx2.sendIdx["lf"]=1
  21987. ][0];
  21988. [$recv(stream)._tab()
  21989. ,$ctx2.sendIdx["tab"]=1
  21990. ][0];
  21991. [$recv(stream)._write_("instanceVariableNames: ''")
  21992. ,$ctx2.sendIdx["write:"]=2
  21993. ][0];
  21994. $recv(stream)._lf();
  21995. $recv(stream)._tab();
  21996. $recv(stream)._write_("package: ");
  21997. return $recv(stream)._print_($self._name());
  21998. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  21999. }));
  22000. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{})});
  22001. }; }),
  22002. $globals.Package);
  22003. $core.addMethod(
  22004. $core.method({
  22005. selector: "classes",
  22006. protocol: "classes",
  22007. args: [],
  22008. source: "classes\x0a\x09^ self organization elements copy",
  22009. referencedClasses: [],
  22010. pragmas: [],
  22011. messageSends: ["copy", "elements", "organization"]
  22012. }, function ($methodClass){ return function (){
  22013. var self=this,$self=this;
  22014. return $core.withContext(function($ctx1) {
  22015. return $recv($recv($self._organization())._elements())._copy();
  22016. }, function($ctx1) {$ctx1.fill(self,"classes",{})});
  22017. }; }),
  22018. $globals.Package);
  22019. $core.addMethod(
  22020. $core.method({
  22021. selector: "definition",
  22022. protocol: "accessing",
  22023. args: [],
  22024. 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. ')' } ]",
  22025. referencedClasses: ["String"],
  22026. pragmas: [],
  22027. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  22028. }, function ($methodClass){ return function (){
  22029. var self=this,$self=this;
  22030. return $core.withContext(function($ctx1) {
  22031. return $recv($globals.String)._streamContents_((function(stream){
  22032. return $core.withContext(function($ctx2) {
  22033. [$recv(stream)._write_([$recv($self._class())._name()
  22034. ,$ctx2.sendIdx["name"]=1
  22035. ][0])
  22036. ,$ctx2.sendIdx["write:"]=1
  22037. ][0];
  22038. [$recv(stream)._lf()
  22039. ,$ctx2.sendIdx["lf"]=1
  22040. ][0];
  22041. [$recv(stream)._tab()
  22042. ,$ctx2.sendIdx["tab"]=1
  22043. ][0];
  22044. [$recv(stream)._write_("named: ")
  22045. ,$ctx2.sendIdx["write:"]=2
  22046. ][0];
  22047. $recv(stream)._print_($self._name());
  22048. [$recv(stream)._lf()
  22049. ,$ctx2.sendIdx["lf"]=2
  22050. ][0];
  22051. [$recv(stream)._tab()
  22052. ,$ctx2.sendIdx["tab"]=2
  22053. ][0];
  22054. [$recv(stream)._write_(["imports: ",$self._importsDefinition()])
  22055. ,$ctx2.sendIdx["write:"]=3
  22056. ][0];
  22057. $recv(stream)._lf();
  22058. $recv(stream)._tab();
  22059. return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]);
  22060. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22061. }));
  22062. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  22063. }; }),
  22064. $globals.Package);
  22065. $core.addMethod(
  22066. $core.method({
  22067. selector: "eval:",
  22068. protocol: "evaluating",
  22069. args: ["aString"],
  22070. source: "eval: aString\x0a\x09^ evalBlock\x0a\x09\x09ifNotNil: [ evalBlock value: aString ]\x0a\x09\x09ifNil: [ Compiler eval: aString ]",
  22071. referencedClasses: ["Compiler"],
  22072. pragmas: [],
  22073. messageSends: ["ifNotNil:ifNil:", "value:", "eval:"]
  22074. }, function ($methodClass){ return function (aString){
  22075. var self=this,$self=this;
  22076. return $core.withContext(function($ctx1) {
  22077. var $1;
  22078. $1=$self.evalBlock;
  22079. if($1 == null || $1.a$nil){
  22080. return $recv($globals.Compiler)._eval_(aString);
  22081. } else {
  22082. return $recv($self.evalBlock)._value_(aString);
  22083. }
  22084. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString})});
  22085. }; }),
  22086. $globals.Package);
  22087. $core.addMethod(
  22088. $core.method({
  22089. selector: "evalBlock",
  22090. protocol: "accessing",
  22091. args: [],
  22092. source: "evalBlock\x0a\x09^ evalBlock",
  22093. referencedClasses: [],
  22094. pragmas: [],
  22095. messageSends: []
  22096. }, function ($methodClass){ return function (){
  22097. var self=this,$self=this;
  22098. return $self.evalBlock;
  22099. }; }),
  22100. $globals.Package);
  22101. $core.addMethod(
  22102. $core.method({
  22103. selector: "evalBlock:",
  22104. protocol: "accessing",
  22105. args: ["aBlock"],
  22106. source: "evalBlock: aBlock\x0a\x09evalBlock := aBlock",
  22107. referencedClasses: [],
  22108. pragmas: [],
  22109. messageSends: []
  22110. }, function ($methodClass){ return function (aBlock){
  22111. var self=this,$self=this;
  22112. $self.evalBlock=aBlock;
  22113. return self;
  22114. }; }),
  22115. $globals.Package);
  22116. $core.addMethod(
  22117. $core.method({
  22118. selector: "imports",
  22119. protocol: "accessing",
  22120. args: [],
  22121. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09self imports: #().\x0a\x09\x09imports ]",
  22122. referencedClasses: [],
  22123. pragmas: [],
  22124. messageSends: ["ifNil:", "imports:"]
  22125. }, function ($methodClass){ return function (){
  22126. var self=this,$self=this;
  22127. return $core.withContext(function($ctx1) {
  22128. var $1;
  22129. $1=$self.imports;
  22130. if($1 == null || $1.a$nil){
  22131. $self._imports_([]);
  22132. return $self.imports;
  22133. } else {
  22134. return $1;
  22135. }
  22136. }, function($ctx1) {$ctx1.fill(self,"imports",{})});
  22137. }; }),
  22138. $globals.Package);
  22139. $core.addMethod(
  22140. $core.method({
  22141. selector: "imports:",
  22142. protocol: "accessing",
  22143. args: ["anArray"],
  22144. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  22145. referencedClasses: [],
  22146. pragmas: [],
  22147. messageSends: ["validateImports:", "asSet"]
  22148. }, function ($methodClass){ return function (anArray){
  22149. var self=this,$self=this;
  22150. return $core.withContext(function($ctx1) {
  22151. $self._validateImports_(anArray);
  22152. $self.imports=$recv(anArray)._asSet();
  22153. return self;
  22154. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray})});
  22155. }; }),
  22156. $globals.Package);
  22157. $core.addMethod(
  22158. $core.method({
  22159. selector: "importsAsJson",
  22160. protocol: "converting",
  22161. args: [],
  22162. 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 ]]",
  22163. referencedClasses: [],
  22164. pragmas: [],
  22165. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  22166. }, function ($methodClass){ return function (){
  22167. var self=this,$self=this;
  22168. return $core.withContext(function($ctx1) {
  22169. return $recv($self._sortedImportsAsArray())._collect_((function(each){
  22170. return $core.withContext(function($ctx2) {
  22171. if($core.assert($recv(each)._isString())){
  22172. return each;
  22173. } else {
  22174. return [$recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value())
  22175. ,$ctx2.sendIdx[","]=1
  22176. ][0];
  22177. }
  22178. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22179. }));
  22180. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{})});
  22181. }; }),
  22182. $globals.Package);
  22183. $core.addMethod(
  22184. $core.method({
  22185. selector: "importsDefinition",
  22186. protocol: "accessing",
  22187. args: [],
  22188. 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: '}' ]",
  22189. referencedClasses: ["String"],
  22190. pragmas: [],
  22191. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  22192. }, function ($methodClass){ return function (){
  22193. var self=this,$self=this;
  22194. return $core.withContext(function($ctx1) {
  22195. return $recv($globals.String)._streamContents_((function(stream){
  22196. return $core.withContext(function($ctx2) {
  22197. [$recv(stream)._write_("{")
  22198. ,$ctx2.sendIdx["write:"]=1
  22199. ][0];
  22200. $recv($self._sortedImportsAsArray())._do_separatedBy_((function(each){
  22201. return $core.withContext(function($ctx3) {
  22202. return $recv(stream)._print_(each);
  22203. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  22204. }),(function(){
  22205. return $core.withContext(function($ctx3) {
  22206. return [$recv(stream)._write_(". ")
  22207. ,$ctx3.sendIdx["write:"]=2
  22208. ][0];
  22209. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  22210. }));
  22211. return $recv(stream)._write_("}");
  22212. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22213. }));
  22214. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{})});
  22215. }; }),
  22216. $globals.Package);
  22217. $core.addMethod(
  22218. $core.method({
  22219. selector: "importsFromJson:",
  22220. protocol: "converting",
  22221. args: ["anArray"],
  22222. 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 ]]",
  22223. referencedClasses: [],
  22224. pragmas: [],
  22225. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  22226. }, function ($methodClass){ return function (anArray){
  22227. var self=this,$self=this;
  22228. return $core.withContext(function($ctx1) {
  22229. return $recv(anArray)._collect_((function(each){
  22230. var split;
  22231. return $core.withContext(function($ctx2) {
  22232. split=$recv(each)._tokenize_("=");
  22233. if($core.assert($recv($recv(split)._size()).__eq((1)))){
  22234. return [$recv(split)._first()
  22235. ,$ctx2.sendIdx["first"]=1
  22236. ][0];
  22237. } else {
  22238. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  22239. }
  22240. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  22241. }));
  22242. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray})});
  22243. }; }),
  22244. $globals.Package);
  22245. $core.addMethod(
  22246. $core.method({
  22247. selector: "initialize",
  22248. protocol: "initialization",
  22249. args: [],
  22250. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09organization := PackageOrganizer new.\x0a\x09evalBlock := nil.\x0a\x09dirty := nil.\x0a\x09imports := nil.\x0a\x09isReady := Promise new.\x0a\x09transport := nil",
  22251. referencedClasses: ["PackageOrganizer", "Promise"],
  22252. pragmas: [],
  22253. messageSends: ["initialize", "new"]
  22254. }, function ($methodClass){ return function (){
  22255. var self=this,$self=this;
  22256. return $core.withContext(function($ctx1) {
  22257. [(
  22258. $ctx1.supercall = true,
  22259. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  22260. ,$ctx1.supercall = false
  22261. ][0];
  22262. $self.organization=[$recv($globals.PackageOrganizer)._new()
  22263. ,$ctx1.sendIdx["new"]=1
  22264. ][0];
  22265. $self.evalBlock=nil;
  22266. $self.dirty=nil;
  22267. $self.imports=nil;
  22268. $self.isReady=$recv($globals.Promise)._new();
  22269. $self.transport=nil;
  22270. return self;
  22271. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  22272. }; }),
  22273. $globals.Package);
  22274. $core.addMethod(
  22275. $core.method({
  22276. selector: "isDirty",
  22277. protocol: "testing",
  22278. args: [],
  22279. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  22280. referencedClasses: [],
  22281. pragmas: [],
  22282. messageSends: ["ifNil:"]
  22283. }, function ($methodClass){ return function (){
  22284. var self=this,$self=this;
  22285. return $core.withContext(function($ctx1) {
  22286. var $1;
  22287. $1=$self.dirty;
  22288. if($1 == null || $1.a$nil){
  22289. return false;
  22290. } else {
  22291. return $1;
  22292. }
  22293. }, function($ctx1) {$ctx1.fill(self,"isDirty",{})});
  22294. }; }),
  22295. $globals.Package);
  22296. $core.addMethod(
  22297. $core.method({
  22298. selector: "isPackage",
  22299. protocol: "testing",
  22300. args: [],
  22301. source: "isPackage\x0a\x09^ true",
  22302. referencedClasses: [],
  22303. pragmas: [],
  22304. messageSends: []
  22305. }, function ($methodClass){ return function (){
  22306. var self=this,$self=this;
  22307. return true;
  22308. }; }),
  22309. $globals.Package);
  22310. $core.addMethod(
  22311. $core.method({
  22312. selector: "isReady",
  22313. protocol: "accessing",
  22314. args: [],
  22315. source: "isReady\x0a\x09^ isReady",
  22316. referencedClasses: [],
  22317. pragmas: [],
  22318. messageSends: []
  22319. }, function ($methodClass){ return function (){
  22320. var self=this,$self=this;
  22321. return $self.isReady;
  22322. }; }),
  22323. $globals.Package);
  22324. $core.addMethod(
  22325. $core.method({
  22326. selector: "isReady:",
  22327. protocol: "accessing",
  22328. args: ["aPromise"],
  22329. source: "isReady: aPromise\x0a\x09isReady := aPromise",
  22330. referencedClasses: [],
  22331. pragmas: [],
  22332. messageSends: []
  22333. }, function ($methodClass){ return function (aPromise){
  22334. var self=this,$self=this;
  22335. $self.isReady=aPromise;
  22336. return self;
  22337. }; }),
  22338. $globals.Package);
  22339. $core.addMethod(
  22340. $core.method({
  22341. selector: "javaScriptDescriptor:",
  22342. protocol: "accessing",
  22343. args: ["anObject"],
  22344. source: "javaScriptDescriptor: anObject\x0a\x09| basicEval basicImports |\x0a\x0a\x09basicEval := anObject at: 'innerEval' ifAbsent: [ nil asJavaScriptObject ].\x0a\x09basicImports := anObject at: 'imports' ifAbsent: [ #() ].\x0a\x09basicTransport := anObject at: 'transport' ifAbsent: [].\x0a\x09anObject at: 'isReady' ifPresent: [ :aPromise | self isReady: aPromise ].\x0a\x0a\x09self\x0a\x09\x09evalBlock: basicEval;\x0a\x09\x09imports: (self importsFromJson: basicImports)",
  22345. referencedClasses: [],
  22346. pragmas: [],
  22347. messageSends: ["at:ifAbsent:", "asJavaScriptObject", "at:ifPresent:", "isReady:", "evalBlock:", "imports:", "importsFromJson:"]
  22348. }, function ($methodClass){ return function (anObject){
  22349. var self=this,$self=this;
  22350. var basicEval,basicImports;
  22351. return $core.withContext(function($ctx1) {
  22352. basicEval=[$recv(anObject)._at_ifAbsent_("innerEval",(function(){
  22353. return $core.withContext(function($ctx2) {
  22354. return $nil._asJavaScriptObject();
  22355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22356. }))
  22357. ,$ctx1.sendIdx["at:ifAbsent:"]=1
  22358. ][0];
  22359. basicImports=[$recv(anObject)._at_ifAbsent_("imports",(function(){
  22360. return [];
  22361. }))
  22362. ,$ctx1.sendIdx["at:ifAbsent:"]=2
  22363. ][0];
  22364. $self.basicTransport=$recv(anObject)._at_ifAbsent_("transport",(function(){
  22365. }));
  22366. $recv(anObject)._at_ifPresent_("isReady",(function(aPromise){
  22367. return $core.withContext(function($ctx2) {
  22368. return $self._isReady_(aPromise);
  22369. }, function($ctx2) {$ctx2.fillBlock({aPromise:aPromise},$ctx1,4)});
  22370. }));
  22371. $self._evalBlock_(basicEval);
  22372. $self._imports_($self._importsFromJson_(basicImports));
  22373. return self;
  22374. }, function($ctx1) {$ctx1.fill(self,"javaScriptDescriptor:",{anObject:anObject,basicEval:basicEval,basicImports:basicImports})});
  22375. }; }),
  22376. $globals.Package);
  22377. $core.addMethod(
  22378. $core.method({
  22379. selector: "loadDependencies",
  22380. protocol: "dependencies",
  22381. args: [],
  22382. 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",
  22383. referencedClasses: [],
  22384. pragmas: [],
  22385. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  22386. }, function ($methodClass){ return function (){
  22387. var self=this,$self=this;
  22388. var classes,packages;
  22389. return $core.withContext(function($ctx1) {
  22390. var $1;
  22391. classes=$self._loadDependencyClasses();
  22392. $1=$recv($recv(classes)._collect_((function(each){
  22393. return $core.withContext(function($ctx2) {
  22394. return $recv(each)._package();
  22395. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22396. })))._asSet();
  22397. $recv($1)._remove_ifAbsent_(self,(function(){
  22398. }));
  22399. return $recv($1)._yourself();
  22400. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages})});
  22401. }; }),
  22402. $globals.Package);
  22403. $core.addMethod(
  22404. $core.method({
  22405. selector: "loadDependencyClasses",
  22406. protocol: "dependencies",
  22407. args: [],
  22408. 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\x09({each. each theMetaClass} copyWithout: nil) anySatisfy: [ :any |\x0a\x09\x09\x09\x09(any protocols includes: starCategoryName) and: [\x0a\x09\x09\x09\x09\x09(any ownMethodsInProtocol: starCategoryName) notEmpty ]]]);\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",
  22409. referencedClasses: ["Smalltalk", "Array"],
  22410. pragmas: [],
  22411. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "anySatisfy:", "copyWithout:", "theMetaClass", "and:", "includes:", "protocols", "notEmpty", "ownMethodsInProtocol:", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  22412. }, function ($methodClass){ return function (){
  22413. var self=this,$self=this;
  22414. var starCategoryName;
  22415. return $core.withContext(function($ctx1) {
  22416. var $1;
  22417. starCategoryName="*".__comma($self._name());
  22418. $1=$recv([$recv([$self._classes()
  22419. ,$ctx1.sendIdx["classes"]=1
  22420. ][0])._collect_((function(each){
  22421. return $core.withContext(function($ctx2) {
  22422. return $recv(each)._superclass();
  22423. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22424. }))
  22425. ,$ctx1.sendIdx["collect:"]=1
  22426. ][0])._asSet();
  22427. [$recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  22428. return $core.withContext(function($ctx2) {
  22429. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._anySatisfy_((function(any){
  22430. return $core.withContext(function($ctx3) {
  22431. return $recv($recv($recv(any)._protocols())._includes_(starCategoryName))._and_((function(){
  22432. return $core.withContext(function($ctx4) {
  22433. return $recv($recv(any)._ownMethodsInProtocol_(starCategoryName))._notEmpty();
  22434. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  22435. }));
  22436. }, function($ctx3) {$ctx3.fillBlock({any:any},$ctx2,3)});
  22437. }));
  22438. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  22439. })))
  22440. ,$ctx1.sendIdx["addAll:"]=1
  22441. ][0];
  22442. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  22443. return $core.withContext(function($ctx2) {
  22444. return $recv($self._traitCompositions())._valuesDo_((function(each){
  22445. return $core.withContext(function($ctx3) {
  22446. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  22447. return $core.withContext(function($ctx4) {
  22448. return $recv(eachTT)._trait();
  22449. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  22450. })));
  22451. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  22452. }));
  22453. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  22454. })));
  22455. $recv($1)._remove_ifAbsent_(nil,(function(){
  22456. }));
  22457. return $recv($1)._yourself();
  22458. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName})});
  22459. }; }),
  22460. $globals.Package);
  22461. $core.addMethod(
  22462. $core.method({
  22463. selector: "name",
  22464. protocol: "accessing",
  22465. args: [],
  22466. source: "name\x0a\x09^ name",
  22467. referencedClasses: [],
  22468. pragmas: [],
  22469. messageSends: []
  22470. }, function ($methodClass){ return function (){
  22471. var self=this,$self=this;
  22472. return $self.name;
  22473. }; }),
  22474. $globals.Package);
  22475. $core.addMethod(
  22476. $core.method({
  22477. selector: "name:",
  22478. protocol: "accessing",
  22479. args: ["aString"],
  22480. source: "name: aString\x0a\x09name := aString",
  22481. referencedClasses: [],
  22482. pragmas: [],
  22483. messageSends: []
  22484. }, function ($methodClass){ return function (aString){
  22485. var self=this,$self=this;
  22486. $self.name=aString;
  22487. return self;
  22488. }; }),
  22489. $globals.Package);
  22490. $core.addMethod(
  22491. $core.method({
  22492. selector: "organization",
  22493. protocol: "accessing",
  22494. args: [],
  22495. source: "organization\x0a\x09^ organization",
  22496. referencedClasses: [],
  22497. pragmas: [],
  22498. messageSends: []
  22499. }, function ($methodClass){ return function (){
  22500. var self=this,$self=this;
  22501. return $self.organization;
  22502. }; }),
  22503. $globals.Package);
  22504. $core.addMethod(
  22505. $core.method({
  22506. selector: "printOn:",
  22507. protocol: "printing",
  22508. args: ["aStream"],
  22509. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  22510. referencedClasses: [],
  22511. pragmas: [],
  22512. messageSends: ["printOn:", "nextPutAll:", "name"]
  22513. }, function ($methodClass){ return function (aStream){
  22514. var self=this,$self=this;
  22515. return $core.withContext(function($ctx1) {
  22516. [(
  22517. $ctx1.supercall = true,
  22518. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  22519. ,$ctx1.supercall = false
  22520. ][0];
  22521. [$recv(aStream)._nextPutAll_(" (")
  22522. ,$ctx1.sendIdx["nextPutAll:"]=1
  22523. ][0];
  22524. [$recv(aStream)._nextPutAll_($self._name())
  22525. ,$ctx1.sendIdx["nextPutAll:"]=2
  22526. ][0];
  22527. $recv(aStream)._nextPutAll_(")");
  22528. return self;
  22529. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  22530. }; }),
  22531. $globals.Package);
  22532. $core.addMethod(
  22533. $core.method({
  22534. selector: "setupClasses",
  22535. protocol: "classes",
  22536. args: [],
  22537. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  22538. referencedClasses: [],
  22539. pragmas: [],
  22540. messageSends: ["do:", "classes", "initialize"]
  22541. }, function ($methodClass){ return function (){
  22542. var self=this,$self=this;
  22543. return $core.withContext(function($ctx1) {
  22544. $recv($self._classes())._do_((function(each){
  22545. return $core.withContext(function($ctx2) {
  22546. return $recv(each)._initialize();
  22547. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22548. }));
  22549. return self;
  22550. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{})});
  22551. }; }),
  22552. $globals.Package);
  22553. $core.addMethod(
  22554. $core.method({
  22555. selector: "sortedClasses",
  22556. protocol: "classes",
  22557. args: [],
  22558. 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",
  22559. referencedClasses: [],
  22560. pragmas: [],
  22561. messageSends: ["sortedClasses:", "class", "classes"]
  22562. }, function ($methodClass){ return function (){
  22563. var self=this,$self=this;
  22564. return $core.withContext(function($ctx1) {
  22565. return $recv($self._class())._sortedClasses_($self._classes());
  22566. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{})});
  22567. }; }),
  22568. $globals.Package);
  22569. $core.addMethod(
  22570. $core.method({
  22571. selector: "sortedImportsAsArray",
  22572. protocol: "private",
  22573. args: [],
  22574. 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 ]]]",
  22575. referencedClasses: [],
  22576. pragmas: [],
  22577. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  22578. }, function ($methodClass){ return function (){
  22579. var self=this,$self=this;
  22580. return $core.withContext(function($ctx1) {
  22581. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  22582. return $core.withContext(function($ctx2) {
  22583. return $recv($recv($recv([$recv(a)._isString()
  22584. ,$ctx2.sendIdx["isString"]=1
  22585. ][0])._not()).__and([$recv(b)._isString()
  22586. ,$ctx2.sendIdx["isString"]=2
  22587. ][0]))._or_((function(){
  22588. return $core.withContext(function($ctx3) {
  22589. return $recv($recv([$recv(a)._isString()
  22590. ,$ctx3.sendIdx["isString"]=3
  22591. ][0]).__eq($recv(b)._isString()))._and_((function(){
  22592. return $core.withContext(function($ctx4) {
  22593. return $recv([$recv(a)._value()
  22594. ,$ctx4.sendIdx["value"]=1
  22595. ][0]).__lt_eq($recv(b)._value());
  22596. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  22597. }));
  22598. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  22599. }));
  22600. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  22601. }));
  22602. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{})});
  22603. }; }),
  22604. $globals.Package);
  22605. $core.addMethod(
  22606. $core.method({
  22607. selector: "traitCompositions",
  22608. protocol: "dependencies",
  22609. args: [],
  22610. source: "traitCompositions\x0a\x09| traitCompositions |\x0a\x09traitCompositions := Dictionary new.\x0a\x09self classes do: [ :eachClass | eachClass includingPossibleMetaDo: [ :each |\x0a\x09\x09traitCompositions at: each put: each traitComposition ] ].\x0a\x09^ traitCompositions reject: [ :each | each isEmpty ]",
  22611. referencedClasses: ["Dictionary"],
  22612. pragmas: [],
  22613. messageSends: ["new", "do:", "classes", "includingPossibleMetaDo:", "at:put:", "traitComposition", "reject:", "isEmpty"]
  22614. }, function ($methodClass){ return function (){
  22615. var self=this,$self=this;
  22616. var traitCompositions;
  22617. return $core.withContext(function($ctx1) {
  22618. traitCompositions=$recv($globals.Dictionary)._new();
  22619. $recv($self._classes())._do_((function(eachClass){
  22620. return $core.withContext(function($ctx2) {
  22621. return $recv(eachClass)._includingPossibleMetaDo_((function(each){
  22622. return $core.withContext(function($ctx3) {
  22623. return $recv(traitCompositions)._at_put_(each,$recv(each)._traitComposition());
  22624. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  22625. }));
  22626. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  22627. }));
  22628. return $recv(traitCompositions)._reject_((function(each){
  22629. return $core.withContext(function($ctx2) {
  22630. return $recv(each)._isEmpty();
  22631. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  22632. }));
  22633. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions})});
  22634. }; }),
  22635. $globals.Package);
  22636. $core.addMethod(
  22637. $core.method({
  22638. selector: "transport",
  22639. protocol: "accessing",
  22640. args: [],
  22641. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09self transport: (PackageTransport fromJson: self basicTransport).\x0a\x09\x09transport ]",
  22642. referencedClasses: ["PackageTransport"],
  22643. pragmas: [],
  22644. messageSends: ["ifNil:", "transport:", "fromJson:", "basicTransport"]
  22645. }, function ($methodClass){ return function (){
  22646. var self=this,$self=this;
  22647. return $core.withContext(function($ctx1) {
  22648. var $1;
  22649. $1=$self.transport;
  22650. if($1 == null || $1.a$nil){
  22651. $self._transport_($recv($globals.PackageTransport)._fromJson_($self._basicTransport()));
  22652. return $self.transport;
  22653. } else {
  22654. return $1;
  22655. }
  22656. }, function($ctx1) {$ctx1.fill(self,"transport",{})});
  22657. }; }),
  22658. $globals.Package);
  22659. $core.addMethod(
  22660. $core.method({
  22661. selector: "transport:",
  22662. protocol: "accessing",
  22663. args: ["aPackageTransport"],
  22664. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  22665. referencedClasses: [],
  22666. pragmas: [],
  22667. messageSends: ["package:"]
  22668. }, function ($methodClass){ return function (aPackageTransport){
  22669. var self=this,$self=this;
  22670. return $core.withContext(function($ctx1) {
  22671. $self.transport=aPackageTransport;
  22672. $recv(aPackageTransport)._package_(self);
  22673. return self;
  22674. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport})});
  22675. }; }),
  22676. $globals.Package);
  22677. $core.addMethod(
  22678. $core.method({
  22679. selector: "validateImports:",
  22680. protocol: "validation",
  22681. args: ["aCollection"],
  22682. 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' ]]]",
  22683. referencedClasses: [],
  22684. pragmas: [],
  22685. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  22686. }, function ($methodClass){ return function (aCollection){
  22687. var self=this,$self=this;
  22688. return $core.withContext(function($ctx1) {
  22689. $recv(aCollection)._do_((function(import_){
  22690. return $core.withContext(function($ctx2) {
  22691. if(!$core.assert([$recv(import_)._isString()
  22692. ,$ctx2.sendIdx["isString"]=1
  22693. ][0])){
  22694. if(!$core.assert($recv(import_)._respondsTo_("key"))){
  22695. [$self._error_("Imports must be Strings or Associations")
  22696. ,$ctx2.sendIdx["error:"]=1
  22697. ][0];
  22698. }
  22699. if(!$core.assert($recv([$recv([$recv(import_)._key()
  22700. ,$ctx2.sendIdx["key"]=1
  22701. ][0])._isString()
  22702. ,$ctx2.sendIdx["isString"]=2
  22703. ][0]).__and($recv($recv(import_)._value())._isString()))){
  22704. [$self._error_("Key and value must be Strings")
  22705. ,$ctx2.sendIdx["error:"]=2
  22706. ][0];
  22707. }
  22708. if(!$core.assert($recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$"))){
  22709. return $self._error_("Keys must be identifiers");
  22710. }
  22711. }
  22712. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  22713. }));
  22714. return self;
  22715. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection})});
  22716. }; }),
  22717. $globals.Package);
  22718. $core.setSlots($globals.Package.a$cls, ["defaultCommitPathJs", "defaultCommitPathSt"]);
  22719. $core.addMethod(
  22720. $core.method({
  22721. selector: "named:",
  22722. protocol: "accessing",
  22723. args: ["aPackageName"],
  22724. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  22725. referencedClasses: ["Smalltalk"],
  22726. pragmas: [],
  22727. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  22728. }, function ($methodClass){ return function (aPackageName){
  22729. var self=this,$self=this;
  22730. return $core.withContext(function($ctx1) {
  22731. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  22732. return $core.withContext(function($ctx2) {
  22733. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  22734. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22735. }));
  22736. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName})});
  22737. }; }),
  22738. $globals.Package.a$cls);
  22739. $core.addMethod(
  22740. $core.method({
  22741. selector: "named:ifAbsent:",
  22742. protocol: "accessing",
  22743. args: ["aPackageName", "aBlock"],
  22744. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  22745. referencedClasses: ["Smalltalk"],
  22746. pragmas: [],
  22747. messageSends: ["packageAt:ifAbsent:"]
  22748. }, function ($methodClass){ return function (aPackageName,aBlock){
  22749. var self=this,$self=this;
  22750. return $core.withContext(function($ctx1) {
  22751. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  22752. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock})});
  22753. }; }),
  22754. $globals.Package.a$cls);
  22755. $core.addMethod(
  22756. $core.method({
  22757. selector: "named:imports:transport:",
  22758. protocol: "accessing",
  22759. args: ["aPackageName", "anArray", "aTransport"],
  22760. source: "named: aPackageName imports: anArray transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg imports: anArray.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  22761. referencedClasses: [],
  22762. pragmas: [],
  22763. messageSends: ["named:", "imports:", "transport:"]
  22764. }, function ($methodClass){ return function (aPackageName,anArray,aTransport){
  22765. var self=this,$self=this;
  22766. var pkg;
  22767. return $core.withContext(function($ctx1) {
  22768. pkg=$self._named_(aPackageName);
  22769. $recv(pkg)._imports_(anArray);
  22770. $recv(pkg)._transport_(aTransport);
  22771. return pkg;
  22772. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,pkg:pkg})});
  22773. }; }),
  22774. $globals.Package.a$cls);
  22775. $core.addMethod(
  22776. $core.method({
  22777. selector: "named:javaScriptDescriptor:",
  22778. protocol: "instance creation",
  22779. args: ["aString", "anObject"],
  22780. source: "named: aString javaScriptDescriptor: anObject\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := Smalltalk createPackage: aString.\x0a\x09pkg javaScriptDescriptor: anObject.\x0a\x09^ pkg",
  22781. referencedClasses: ["Smalltalk"],
  22782. pragmas: [],
  22783. messageSends: ["createPackage:", "javaScriptDescriptor:"]
  22784. }, function ($methodClass){ return function (aString,anObject){
  22785. var self=this,$self=this;
  22786. var pkg;
  22787. return $core.withContext(function($ctx1) {
  22788. pkg=$recv($globals.Smalltalk)._createPackage_(aString);
  22789. $recv(pkg)._javaScriptDescriptor_(anObject);
  22790. return pkg;
  22791. }, function($ctx1) {$ctx1.fill(self,"named:javaScriptDescriptor:",{aString:aString,anObject:anObject,pkg:pkg})});
  22792. }; }),
  22793. $globals.Package.a$cls);
  22794. $core.addMethod(
  22795. $core.method({
  22796. selector: "named:transport:",
  22797. protocol: "accessing",
  22798. args: ["aPackageName", "aTransport"],
  22799. source: "named: aPackageName transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  22800. referencedClasses: [],
  22801. pragmas: [],
  22802. messageSends: ["named:", "transport:"]
  22803. }, function ($methodClass){ return function (aPackageName,aTransport){
  22804. var self=this,$self=this;
  22805. var pkg;
  22806. return $core.withContext(function($ctx1) {
  22807. pkg=$self._named_(aPackageName);
  22808. $recv(pkg)._transport_(aTransport);
  22809. return pkg;
  22810. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,pkg:pkg})});
  22811. }; }),
  22812. $globals.Package.a$cls);
  22813. $core.addMethod(
  22814. $core.method({
  22815. selector: "new:",
  22816. protocol: "instance creation",
  22817. args: ["aString"],
  22818. source: "new: aString\x0a\x09^ Package new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  22819. referencedClasses: ["Package"],
  22820. pragmas: [],
  22821. messageSends: ["name:", "new", "yourself"]
  22822. }, function ($methodClass){ return function (aString){
  22823. var self=this,$self=this;
  22824. return $core.withContext(function($ctx1) {
  22825. var $1;
  22826. $1=$recv($globals.Package)._new();
  22827. $recv($1)._name_(aString);
  22828. return $recv($1)._yourself();
  22829. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString})});
  22830. }; }),
  22831. $globals.Package.a$cls);
  22832. $core.addMethod(
  22833. $core.method({
  22834. selector: "sortedClasses:",
  22835. protocol: "sorting",
  22836. args: ["classes"],
  22837. source: "sortedClasses: classes\x0a\x09^ Array streamContents: [ :stream | stream << (ClassBuilder sortClasses: classes) ]",
  22838. referencedClasses: ["Array", "ClassBuilder"],
  22839. pragmas: [],
  22840. messageSends: ["streamContents:", "<<", "sortClasses:"]
  22841. }, function ($methodClass){ return function (classes){
  22842. var self=this,$self=this;
  22843. return $core.withContext(function($ctx1) {
  22844. return $recv($globals.Array)._streamContents_((function(stream){
  22845. return $core.withContext(function($ctx2) {
  22846. return $recv(stream).__lt_lt($recv($globals.ClassBuilder)._sortClasses_(classes));
  22847. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22848. }));
  22849. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes})});
  22850. }; }),
  22851. $globals.Package.a$cls);
  22852. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  22853. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  22854. $core.addMethod(
  22855. $core.method({
  22856. selector: "announcer",
  22857. protocol: "accessing",
  22858. args: [],
  22859. source: "announcer\x0a\x09^ SystemAnnouncer current",
  22860. referencedClasses: ["SystemAnnouncer"],
  22861. pragmas: [],
  22862. messageSends: ["current"]
  22863. }, function ($methodClass){ return function (){
  22864. var self=this,$self=this;
  22865. return $core.withContext(function($ctx1) {
  22866. return $recv($globals.SystemAnnouncer)._current();
  22867. }, function($ctx1) {$ctx1.fill(self,"announcer",{})});
  22868. }; }),
  22869. $globals.PackageStateObserver);
  22870. $core.addMethod(
  22871. $core.method({
  22872. selector: "observeSystem",
  22873. protocol: "actions",
  22874. args: [],
  22875. 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",
  22876. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  22877. pragmas: [],
  22878. messageSends: ["on:send:to:", "announcer"]
  22879. }, function ($methodClass){ return function (){
  22880. var self=this,$self=this;
  22881. return $core.withContext(function($ctx1) {
  22882. var $1;
  22883. $1=$self._announcer();
  22884. [$recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self)
  22885. ,$ctx1.sendIdx["on:send:to:"]=1
  22886. ][0];
  22887. [$recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self)
  22888. ,$ctx1.sendIdx["on:send:to:"]=2
  22889. ][0];
  22890. [$recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self)
  22891. ,$ctx1.sendIdx["on:send:to:"]=3
  22892. ][0];
  22893. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  22894. return self;
  22895. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{})});
  22896. }; }),
  22897. $globals.PackageStateObserver);
  22898. $core.addMethod(
  22899. $core.method({
  22900. selector: "onClassModification:",
  22901. protocol: "reactions",
  22902. args: ["anAnnouncement"],
  22903. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  22904. referencedClasses: [],
  22905. pragmas: [],
  22906. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  22907. }, function ($methodClass){ return function (anAnnouncement){
  22908. var self=this,$self=this;
  22909. return $core.withContext(function($ctx1) {
  22910. var $1;
  22911. $1=$recv(anAnnouncement)._theClass();
  22912. if($1 == null || $1.a$nil){
  22913. $1;
  22914. } else {
  22915. var theClass;
  22916. theClass=$1;
  22917. $recv($recv(theClass)._package())._beDirty();
  22918. }
  22919. return self;
  22920. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement})});
  22921. }; }),
  22922. $globals.PackageStateObserver);
  22923. $core.addMethod(
  22924. $core.method({
  22925. selector: "onMethodModification:",
  22926. protocol: "reactions",
  22927. args: ["anAnnouncement"],
  22928. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  22929. referencedClasses: [],
  22930. pragmas: [],
  22931. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  22932. }, function ($methodClass){ return function (anAnnouncement){
  22933. var self=this,$self=this;
  22934. return $core.withContext(function($ctx1) {
  22935. var $1;
  22936. $1=$recv($recv(anAnnouncement)._method())._package();
  22937. if($1 == null || $1.a$nil){
  22938. $1;
  22939. } else {
  22940. var package_;
  22941. package_=$1;
  22942. $recv(package_)._beDirty();
  22943. }
  22944. return self;
  22945. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement})});
  22946. }; }),
  22947. $globals.PackageStateObserver);
  22948. $core.addMethod(
  22949. $core.method({
  22950. selector: "onPackageAdded:",
  22951. protocol: "reactions",
  22952. args: ["anAnnouncement"],
  22953. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  22954. referencedClasses: [],
  22955. pragmas: [],
  22956. messageSends: ["beDirty", "package"]
  22957. }, function ($methodClass){ return function (anAnnouncement){
  22958. var self=this,$self=this;
  22959. return $core.withContext(function($ctx1) {
  22960. $recv($recv(anAnnouncement)._package())._beDirty();
  22961. return self;
  22962. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement})});
  22963. }; }),
  22964. $globals.PackageStateObserver);
  22965. $core.addMethod(
  22966. $core.method({
  22967. selector: "onProtocolModification:",
  22968. protocol: "reactions",
  22969. args: ["anAnnouncement"],
  22970. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  22971. referencedClasses: [],
  22972. pragmas: [],
  22973. messageSends: ["ifNotNil:", "package", "beDirty"]
  22974. }, function ($methodClass){ return function (anAnnouncement){
  22975. var self=this,$self=this;
  22976. return $core.withContext(function($ctx1) {
  22977. var $1;
  22978. $1=$recv(anAnnouncement)._package();
  22979. if($1 == null || $1.a$nil){
  22980. $1;
  22981. } else {
  22982. var package_;
  22983. package_=$1;
  22984. $recv(package_)._beDirty();
  22985. }
  22986. return self;
  22987. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement})});
  22988. }; }),
  22989. $globals.PackageStateObserver);
  22990. $core.setSlots($globals.PackageStateObserver.a$cls, ["current"]);
  22991. $core.addMethod(
  22992. $core.method({
  22993. selector: "current",
  22994. protocol: "accessing",
  22995. args: [],
  22996. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  22997. referencedClasses: [],
  22998. pragmas: [],
  22999. messageSends: ["ifNil:", "new"]
  23000. }, function ($methodClass){ return function (){
  23001. var self=this,$self=this;
  23002. return $core.withContext(function($ctx1) {
  23003. var $1;
  23004. $1=$self.current;
  23005. if($1 == null || $1.a$nil){
  23006. $self.current=$self._new();
  23007. return $self.current;
  23008. } else {
  23009. return $1;
  23010. }
  23011. }, function($ctx1) {$ctx1.fill(self,"current",{})});
  23012. }; }),
  23013. $globals.PackageStateObserver.a$cls);
  23014. $core.addMethod(
  23015. $core.method({
  23016. selector: "initialize",
  23017. protocol: "initialization",
  23018. args: [],
  23019. source: "initialize\x0a\x09self current observeSystem",
  23020. referencedClasses: [],
  23021. pragmas: [],
  23022. messageSends: ["observeSystem", "current"]
  23023. }, function ($methodClass){ return function (){
  23024. var self=this,$self=this;
  23025. return $core.withContext(function($ctx1) {
  23026. $recv($self._current())._observeSystem();
  23027. return self;
  23028. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  23029. }; }),
  23030. $globals.PackageStateObserver.a$cls);
  23031. $core.addClass("Setting", $globals.Object, ["key", "defaultValue"], "Kernel-Infrastructure");
  23032. $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`";
  23033. $core.addMethod(
  23034. $core.method({
  23035. selector: "defaultValue",
  23036. protocol: "accessing",
  23037. args: [],
  23038. source: "defaultValue\x0a\x09^ defaultValue",
  23039. referencedClasses: [],
  23040. pragmas: [],
  23041. messageSends: []
  23042. }, function ($methodClass){ return function (){
  23043. var self=this,$self=this;
  23044. return $self.defaultValue;
  23045. }; }),
  23046. $globals.Setting);
  23047. $core.addMethod(
  23048. $core.method({
  23049. selector: "defaultValue:",
  23050. protocol: "accessing",
  23051. args: ["aStringifiableObject"],
  23052. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  23053. referencedClasses: [],
  23054. pragmas: [],
  23055. messageSends: []
  23056. }, function ($methodClass){ return function (aStringifiableObject){
  23057. var self=this,$self=this;
  23058. $self.defaultValue=aStringifiableObject;
  23059. return self;
  23060. }; }),
  23061. $globals.Setting);
  23062. $core.addMethod(
  23063. $core.method({
  23064. selector: "key",
  23065. protocol: "accessing",
  23066. args: [],
  23067. source: "key\x0a\x09^ key",
  23068. referencedClasses: [],
  23069. pragmas: [],
  23070. messageSends: []
  23071. }, function ($methodClass){ return function (){
  23072. var self=this,$self=this;
  23073. return $self.key;
  23074. }; }),
  23075. $globals.Setting);
  23076. $core.addMethod(
  23077. $core.method({
  23078. selector: "key:",
  23079. protocol: "accessing",
  23080. args: ["aString"],
  23081. source: "key: aString\x0a\x09key := aString",
  23082. referencedClasses: [],
  23083. pragmas: [],
  23084. messageSends: []
  23085. }, function ($methodClass){ return function (aString){
  23086. var self=this,$self=this;
  23087. $self.key=aString;
  23088. return self;
  23089. }; }),
  23090. $globals.Setting);
  23091. $core.addMethod(
  23092. $core.method({
  23093. selector: "value",
  23094. protocol: "accessing",
  23095. args: [],
  23096. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  23097. referencedClasses: ["Smalltalk"],
  23098. pragmas: [],
  23099. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  23100. }, function ($methodClass){ return function (){
  23101. var self=this,$self=this;
  23102. return $core.withContext(function($ctx1) {
  23103. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  23104. return $core.withContext(function($ctx2) {
  23105. return $self._defaultValue();
  23106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23107. }));
  23108. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  23109. }; }),
  23110. $globals.Setting);
  23111. $core.addMethod(
  23112. $core.method({
  23113. selector: "value:",
  23114. protocol: "accessing",
  23115. args: ["aStringifiableObject"],
  23116. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  23117. referencedClasses: ["Smalltalk"],
  23118. pragmas: [],
  23119. messageSends: ["at:put:", "settings", "key"]
  23120. }, function ($methodClass){ return function (aStringifiableObject){
  23121. var self=this,$self=this;
  23122. return $core.withContext(function($ctx1) {
  23123. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  23124. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject})});
  23125. }; }),
  23126. $globals.Setting);
  23127. $core.addMethod(
  23128. $core.method({
  23129. selector: "at:ifAbsent:",
  23130. protocol: "instance creation",
  23131. args: ["aString", "aDefaultValue"],
  23132. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  23133. referencedClasses: [],
  23134. pragmas: [],
  23135. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  23136. }, function ($methodClass){ return function (aString,aDefaultValue){
  23137. var self=this,$self=this;
  23138. return $core.withContext(function($ctx1) {
  23139. var $1;
  23140. $1=[(
  23141. $ctx1.supercall = true,
  23142. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._new.call($self))
  23143. ,$ctx1.supercall = false
  23144. ][0];
  23145. $recv($1)._key_(aString);
  23146. $recv($1)._defaultValue_(aDefaultValue);
  23147. return $recv($1)._yourself();
  23148. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue})});
  23149. }; }),
  23150. $globals.Setting.a$cls);
  23151. $core.addMethod(
  23152. $core.method({
  23153. selector: "new",
  23154. protocol: "instance creation",
  23155. args: [],
  23156. source: "new\x0a\x09self shouldNotImplement",
  23157. referencedClasses: [],
  23158. pragmas: [],
  23159. messageSends: ["shouldNotImplement"]
  23160. }, function ($methodClass){ return function (){
  23161. var self=this,$self=this;
  23162. return $core.withContext(function($ctx1) {
  23163. $self._shouldNotImplement();
  23164. return self;
  23165. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  23166. }; }),
  23167. $globals.Setting.a$cls);
  23168. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables", "packageDictionary"], "Kernel-Infrastructure");
  23169. $globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `$core` declared in `base/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with global variable `Smalltalk`.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#globals #at:` answers a specific global (usually, a class) or `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `base/parser.js` parser file in order to work.";
  23170. $core.addMethod(
  23171. $core.method({
  23172. selector: "addGlobalJsVariable:",
  23173. protocol: "globals",
  23174. args: ["aString"],
  23175. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  23176. referencedClasses: [],
  23177. pragmas: [],
  23178. messageSends: ["add:", "globalJsVariables"]
  23179. }, function ($methodClass){ return function (aString){
  23180. var self=this,$self=this;
  23181. return $core.withContext(function($ctx1) {
  23182. $recv($self._globalJsVariables())._add_(aString);
  23183. return self;
  23184. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString})});
  23185. }; }),
  23186. $globals.SmalltalkImage);
  23187. $core.addMethod(
  23188. $core.method({
  23189. selector: "adoptPackageDescriptors",
  23190. protocol: "private",
  23191. args: [],
  23192. source: "adoptPackageDescriptors\x0a\x09^ self tryAdoptPackageDescriptorsBeyond: Set new",
  23193. referencedClasses: ["Set"],
  23194. pragmas: [],
  23195. messageSends: ["tryAdoptPackageDescriptorsBeyond:", "new"]
  23196. }, function ($methodClass){ return function (){
  23197. var self=this,$self=this;
  23198. return $core.withContext(function($ctx1) {
  23199. return $self._tryAdoptPackageDescriptorsBeyond_($recv($globals.Set)._new());
  23200. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDescriptors",{})});
  23201. }; }),
  23202. $globals.SmalltalkImage);
  23203. $core.addMethod(
  23204. $core.method({
  23205. selector: "amdRequire",
  23206. protocol: "accessing amd",
  23207. args: [],
  23208. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  23209. referencedClasses: [],
  23210. pragmas: [],
  23211. messageSends: ["at:", "core"]
  23212. }, function ($methodClass){ return function (){
  23213. var self=this,$self=this;
  23214. return $core.withContext(function($ctx1) {
  23215. return $recv($self._core())._at_("amdRequire");
  23216. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{})});
  23217. }; }),
  23218. $globals.SmalltalkImage);
  23219. $core.addMethod(
  23220. $core.method({
  23221. selector: "asSmalltalkException:",
  23222. protocol: "error handling",
  23223. args: ["anObject"],
  23224. 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 isError: anObject)\x0a\x09\x09ifTrue: [ anObject ]\x0a\x09\x09ifFalse: [ JavaScriptException on: anObject ]",
  23225. referencedClasses: ["JavaScriptException"],
  23226. pragmas: [],
  23227. messageSends: ["ifTrue:ifFalse:", "isError:", "on:"]
  23228. }, function ($methodClass){ return function (anObject){
  23229. var self=this,$self=this;
  23230. return $core.withContext(function($ctx1) {
  23231. if($core.assert($self._isError_(anObject))){
  23232. return anObject;
  23233. } else {
  23234. return $recv($globals.JavaScriptException)._on_(anObject);
  23235. }
  23236. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject})});
  23237. }; }),
  23238. $globals.SmalltalkImage);
  23239. $core.addMethod(
  23240. $core.method({
  23241. selector: "basicCreatePackage:",
  23242. protocol: "private",
  23243. args: ["packageName"],
  23244. source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09^ self packageDictionary at: packageName ifAbsentPut: [ Package new: packageName ]",
  23245. referencedClasses: ["Package"],
  23246. pragmas: [],
  23247. messageSends: ["at:ifAbsentPut:", "packageDictionary", "new:"]
  23248. }, function ($methodClass){ return function (packageName){
  23249. var self=this,$self=this;
  23250. return $core.withContext(function($ctx1) {
  23251. return $recv($self._packageDictionary())._at_ifAbsentPut_(packageName,(function(){
  23252. return $core.withContext(function($ctx2) {
  23253. return $recv($globals.Package)._new_(packageName);
  23254. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23255. }));
  23256. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName})});
  23257. }; }),
  23258. $globals.SmalltalkImage);
  23259. $core.addMethod(
  23260. $core.method({
  23261. selector: "beClean",
  23262. protocol: "packages",
  23263. args: [],
  23264. source: "beClean\x0a\x09\x22Marks all packages clean.\x22\x0a\x0a\x09self packages do: #beClean",
  23265. referencedClasses: [],
  23266. pragmas: [],
  23267. messageSends: ["do:", "packages"]
  23268. }, function ($methodClass){ return function (){
  23269. var self=this,$self=this;
  23270. return $core.withContext(function($ctx1) {
  23271. $recv($self._packages())._do_("beClean");
  23272. return self;
  23273. }, function($ctx1) {$ctx1.fill(self,"beClean",{})});
  23274. }; }),
  23275. $globals.SmalltalkImage);
  23276. $core.addMethod(
  23277. $core.method({
  23278. selector: "cancelOptOut:",
  23279. protocol: "accessing",
  23280. args: ["anObject"],
  23281. source: "cancelOptOut: anObject\x0a\x09\x22A Smalltalk object has a 'a$cls' property.\x0a\x09If this property is shadowed for anObject by optOut:,\x0a\x09the object is treated as plain JS object.\x0a\x09This removes the shadow and anObject is Smalltalk object\x0a\x09again if it was before.\x22\x0a\x09\x0a\x09<inlineJS: 'delete anObject.a$cls;'>",
  23282. referencedClasses: [],
  23283. pragmas: [["inlineJS:", ["delete anObject.a$cls;"]]],
  23284. messageSends: []
  23285. }, function ($methodClass){ return function (anObject){
  23286. var self=this,$self=this;
  23287. return $core.withContext(function($ctx1) {
  23288. delete anObject.a$cls;;
  23289. return self;
  23290. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject})});
  23291. }; }),
  23292. $globals.SmalltalkImage);
  23293. $core.addMethod(
  23294. $core.method({
  23295. selector: "classes",
  23296. protocol: "classes",
  23297. args: [],
  23298. source: "classes\x0a\x09^ self core traitsOrClasses copy",
  23299. referencedClasses: [],
  23300. pragmas: [],
  23301. messageSends: ["copy", "traitsOrClasses", "core"]
  23302. }, function ($methodClass){ return function (){
  23303. var self=this,$self=this;
  23304. return $core.withContext(function($ctx1) {
  23305. return $recv($recv($self._core())._traitsOrClasses())._copy();
  23306. }, function($ctx1) {$ctx1.fill(self,"classes",{})});
  23307. }; }),
  23308. $globals.SmalltalkImage);
  23309. $core.addMethod(
  23310. $core.method({
  23311. selector: "core",
  23312. protocol: "accessing",
  23313. args: [],
  23314. source: "core\x0a\x09<inlineJS: 'return $core'>",
  23315. referencedClasses: [],
  23316. pragmas: [["inlineJS:", ["return $core"]]],
  23317. messageSends: []
  23318. }, function ($methodClass){ return function (){
  23319. var self=this,$self=this;
  23320. return $core.withContext(function($ctx1) {
  23321. return $core;
  23322. return self;
  23323. }, function($ctx1) {$ctx1.fill(self,"core",{})});
  23324. }; }),
  23325. $globals.SmalltalkImage);
  23326. $core.addMethod(
  23327. $core.method({
  23328. selector: "createPackage:",
  23329. protocol: "packages",
  23330. args: ["packageName"],
  23331. 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",
  23332. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  23333. pragmas: [],
  23334. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  23335. }, function ($methodClass){ return function (packageName){
  23336. var self=this,$self=this;
  23337. var package_,announcement;
  23338. return $core.withContext(function($ctx1) {
  23339. var $1;
  23340. package_=$self._basicCreatePackage_(packageName);
  23341. $1=$recv($globals.PackageAdded)._new();
  23342. $recv($1)._package_(package_);
  23343. announcement=$recv($1)._yourself();
  23344. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  23345. return package_;
  23346. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement})});
  23347. }; }),
  23348. $globals.SmalltalkImage);
  23349. $core.addMethod(
  23350. $core.method({
  23351. selector: "defaultAmdNamespace",
  23352. protocol: "accessing amd",
  23353. args: [],
  23354. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  23355. referencedClasses: [],
  23356. pragmas: [],
  23357. messageSends: ["settingValue"]
  23358. }, function ($methodClass){ return function (){
  23359. var self=this,$self=this;
  23360. return $core.withContext(function($ctx1) {
  23361. return "transport.defaultAmdNamespace"._settingValue();
  23362. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{})});
  23363. }; }),
  23364. $globals.SmalltalkImage);
  23365. $core.addMethod(
  23366. $core.method({
  23367. selector: "defaultAmdNamespace:",
  23368. protocol: "accessing amd",
  23369. args: ["aString"],
  23370. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  23371. referencedClasses: [],
  23372. pragmas: [],
  23373. messageSends: ["settingValue:"]
  23374. }, function ($methodClass){ return function (aString){
  23375. var self=this,$self=this;
  23376. return $core.withContext(function($ctx1) {
  23377. "transport.defaultAmdNamespace"._settingValue_(aString);
  23378. return self;
  23379. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString})});
  23380. }; }),
  23381. $globals.SmalltalkImage);
  23382. $core.addMethod(
  23383. $core.method({
  23384. selector: "deleteClass:",
  23385. protocol: "private",
  23386. args: ["aClass"],
  23387. 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)'>",
  23388. referencedClasses: [],
  23389. pragmas: [["inlineJS:", ["$core.removeClass(aClass)"]]],
  23390. messageSends: []
  23391. }, function ($methodClass){ return function (aClass){
  23392. var self=this,$self=this;
  23393. return $core.withContext(function($ctx1) {
  23394. $core.removeClass(aClass);
  23395. return self;
  23396. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass})});
  23397. }; }),
  23398. $globals.SmalltalkImage);
  23399. $core.addMethod(
  23400. $core.method({
  23401. selector: "deleteGlobalJsVariable:",
  23402. protocol: "globals",
  23403. args: ["aString"],
  23404. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  23405. referencedClasses: [],
  23406. pragmas: [],
  23407. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  23408. }, function ($methodClass){ return function (aString){
  23409. var self=this,$self=this;
  23410. return $core.withContext(function($ctx1) {
  23411. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  23412. }));
  23413. return self;
  23414. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString})});
  23415. }; }),
  23416. $globals.SmalltalkImage);
  23417. $core.addMethod(
  23418. $core.method({
  23419. selector: "existsJsGlobal:",
  23420. protocol: "testing",
  23421. args: ["aString"],
  23422. source: "existsJsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Platform >> includesGlobal: instead'.\x0a\x09^ Platform includesGlobal: aString",
  23423. referencedClasses: ["Platform"],
  23424. pragmas: [],
  23425. messageSends: ["deprecatedAPI:", "includesGlobal:"]
  23426. }, function ($methodClass){ return function (aString){
  23427. var self=this,$self=this;
  23428. return $core.withContext(function($ctx1) {
  23429. $self._deprecatedAPI_("Use Platform >> includesGlobal: instead");
  23430. return $recv($globals.Platform)._includesGlobal_(aString);
  23431. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString})});
  23432. }; }),
  23433. $globals.SmalltalkImage);
  23434. $core.addMethod(
  23435. $core.method({
  23436. selector: "globalJsVariables",
  23437. protocol: "globals",
  23438. args: [],
  23439. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global) ]",
  23440. referencedClasses: [],
  23441. pragmas: [],
  23442. messageSends: ["ifNil:"]
  23443. }, function ($methodClass){ return function (){
  23444. var self=this,$self=this;
  23445. return $core.withContext(function($ctx1) {
  23446. var $1;
  23447. $1=$self.globalJsVariables;
  23448. if($1 == null || $1.a$nil){
  23449. $self.globalJsVariables=["window", "document", "process", "global"];
  23450. return $self.globalJsVariables;
  23451. } else {
  23452. return $1;
  23453. }
  23454. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{})});
  23455. }; }),
  23456. $globals.SmalltalkImage);
  23457. $core.addMethod(
  23458. $core.method({
  23459. selector: "globals",
  23460. protocol: "accessing",
  23461. args: [],
  23462. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  23463. referencedClasses: [],
  23464. pragmas: [["inlineJS:", ["return $globals"]]],
  23465. messageSends: []
  23466. }, function ($methodClass){ return function (){
  23467. var self=this,$self=this;
  23468. return $core.withContext(function($ctx1) {
  23469. return $globals;
  23470. return self;
  23471. }, function($ctx1) {$ctx1.fill(self,"globals",{})});
  23472. }; }),
  23473. $globals.SmalltalkImage);
  23474. $core.addMethod(
  23475. $core.method({
  23476. selector: "isError:",
  23477. protocol: "testing",
  23478. args: ["anObject"],
  23479. source: "isError: anObject\x0a\x09^ (self isSmalltalkObject: anObject) and: [ anObject isError ]",
  23480. referencedClasses: [],
  23481. pragmas: [],
  23482. messageSends: ["and:", "isSmalltalkObject:", "isError"]
  23483. }, function ($methodClass){ return function (anObject){
  23484. var self=this,$self=this;
  23485. return $core.withContext(function($ctx1) {
  23486. return $recv($self._isSmalltalkObject_(anObject))._and_((function(){
  23487. return $core.withContext(function($ctx2) {
  23488. return $recv(anObject)._isError();
  23489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23490. }));
  23491. }, function($ctx1) {$ctx1.fill(self,"isError:",{anObject:anObject})});
  23492. }; }),
  23493. $globals.SmalltalkImage);
  23494. $core.addMethod(
  23495. $core.method({
  23496. selector: "isSmalltalkObject:",
  23497. protocol: "testing",
  23498. args: ["anObject"],
  23499. source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'a$cls' property.\x0a\x09Note that this may be unaccurate\x22\x0a\x09\x0a\x09<inlineJS: 'return anObject.a$cls != null'>",
  23500. referencedClasses: [],
  23501. pragmas: [["inlineJS:", ["return anObject.a$cls != null"]]],
  23502. messageSends: []
  23503. }, function ($methodClass){ return function (anObject){
  23504. var self=this,$self=this;
  23505. return $core.withContext(function($ctx1) {
  23506. return anObject.a$cls != null;
  23507. return self;
  23508. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject})});
  23509. }; }),
  23510. $globals.SmalltalkImage);
  23511. $core.addMethod(
  23512. $core.method({
  23513. selector: "optOut:",
  23514. protocol: "accessing",
  23515. args: ["anObject"],
  23516. source: "optOut: anObject\x0a\x09\x22A Smalltalk object has a 'a$cls' property.\x0a\x09This shadows the property for anObject.\x0a\x09The object is treated as plain JS object following this.\x22\x0a\x09\x0a\x09<inlineJS: 'anObject.a$cls = null'>",
  23517. referencedClasses: [],
  23518. pragmas: [["inlineJS:", ["anObject.a$cls = null"]]],
  23519. messageSends: []
  23520. }, function ($methodClass){ return function (anObject){
  23521. var self=this,$self=this;
  23522. return $core.withContext(function($ctx1) {
  23523. anObject.a$cls = null;
  23524. return self;
  23525. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject})});
  23526. }; }),
  23527. $globals.SmalltalkImage);
  23528. $core.addMethod(
  23529. $core.method({
  23530. selector: "packageAt:ifAbsent:",
  23531. protocol: "packages",
  23532. args: ["packageName", "aBlock"],
  23533. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  23534. referencedClasses: [],
  23535. pragmas: [],
  23536. messageSends: ["at:ifAbsent:", "packageDictionary"]
  23537. }, function ($methodClass){ return function (packageName,aBlock){
  23538. var self=this,$self=this;
  23539. return $core.withContext(function($ctx1) {
  23540. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  23541. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock})});
  23542. }; }),
  23543. $globals.SmalltalkImage);
  23544. $core.addMethod(
  23545. $core.method({
  23546. selector: "packageAt:ifPresent:",
  23547. protocol: "packages",
  23548. args: ["packageName", "aBlock"],
  23549. source: "packageAt: packageName ifPresent: aBlock\x0a\x09^ self packageDictionary at: packageName ifPresent: aBlock",
  23550. referencedClasses: [],
  23551. pragmas: [],
  23552. messageSends: ["at:ifPresent:", "packageDictionary"]
  23553. }, function ($methodClass){ return function (packageName,aBlock){
  23554. var self=this,$self=this;
  23555. return $core.withContext(function($ctx1) {
  23556. return $recv($self._packageDictionary())._at_ifPresent_(packageName,aBlock);
  23557. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifPresent:",{packageName:packageName,aBlock:aBlock})});
  23558. }; }),
  23559. $globals.SmalltalkImage);
  23560. $core.addMethod(
  23561. $core.method({
  23562. selector: "packageDictionary",
  23563. protocol: "packages",
  23564. args: [],
  23565. source: "packageDictionary\x0a\x09^ packageDictionary ifNil: [ packageDictionary := Dictionary new ]",
  23566. referencedClasses: ["Dictionary"],
  23567. pragmas: [],
  23568. messageSends: ["ifNil:", "new"]
  23569. }, function ($methodClass){ return function (){
  23570. var self=this,$self=this;
  23571. return $core.withContext(function($ctx1) {
  23572. var $1;
  23573. $1=$self.packageDictionary;
  23574. if($1 == null || $1.a$nil){
  23575. $self.packageDictionary=$recv($globals.Dictionary)._new();
  23576. return $self.packageDictionary;
  23577. } else {
  23578. return $1;
  23579. }
  23580. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{})});
  23581. }; }),
  23582. $globals.SmalltalkImage);
  23583. $core.addMethod(
  23584. $core.method({
  23585. selector: "packages",
  23586. protocol: "packages",
  23587. args: [],
  23588. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  23589. referencedClasses: [],
  23590. pragmas: [],
  23591. messageSends: ["copy", "values", "packageDictionary"]
  23592. }, function ($methodClass){ return function (){
  23593. var self=this,$self=this;
  23594. return $core.withContext(function($ctx1) {
  23595. return $recv($recv($self._packageDictionary())._values())._copy();
  23596. }, function($ctx1) {$ctx1.fill(self,"packages",{})});
  23597. }; }),
  23598. $globals.SmalltalkImage);
  23599. $core.addMethod(
  23600. $core.method({
  23601. selector: "parse:",
  23602. protocol: "accessing",
  23603. args: ["aString"],
  23604. source: "parse: aString\x0a\x09^ Compiler new parse: aString",
  23605. referencedClasses: ["Compiler"],
  23606. pragmas: [],
  23607. messageSends: ["parse:", "new"]
  23608. }, function ($methodClass){ return function (aString){
  23609. var self=this,$self=this;
  23610. return $core.withContext(function($ctx1) {
  23611. return $recv($recv($globals.Compiler)._new())._parse_(aString);
  23612. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString})});
  23613. }; }),
  23614. $globals.SmalltalkImage);
  23615. $core.addMethod(
  23616. $core.method({
  23617. selector: "postLoad",
  23618. protocol: "image",
  23619. args: [],
  23620. source: "postLoad\x0a\x09^ self adoptPackageDescriptors then: [ :pkgs |\x0a\x09\x09| classes |\x0a\x09\x09pkgs do: #beClean.\x0a\x09\x09classes := Smalltalk classes select:\x0a\x09\x09\x09[ :each | pkgs includes: each package ].\x0a\x09\x09classes do: [ :each |\x0a\x09\x09\x09each = self class ifFalse: [ each initialize ] ].\x0a\x09\x09self sweepPackageDescriptors: pkgs ]",
  23621. referencedClasses: ["Smalltalk"],
  23622. pragmas: [],
  23623. messageSends: ["then:", "adoptPackageDescriptors", "do:", "select:", "classes", "includes:", "package", "ifFalse:", "=", "class", "initialize", "sweepPackageDescriptors:"]
  23624. }, function ($methodClass){ return function (){
  23625. var self=this,$self=this;
  23626. return $core.withContext(function($ctx1) {
  23627. return $recv($self._adoptPackageDescriptors())._then_((function(pkgs){
  23628. var classes;
  23629. return $core.withContext(function($ctx2) {
  23630. [$recv(pkgs)._do_("beClean")
  23631. ,$ctx2.sendIdx["do:"]=1
  23632. ][0];
  23633. classes=$recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  23634. return $core.withContext(function($ctx3) {
  23635. return $recv(pkgs)._includes_($recv(each)._package());
  23636. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  23637. }));
  23638. $recv(classes)._do_((function(each){
  23639. return $core.withContext(function($ctx3) {
  23640. if(!$core.assert($recv(each).__eq($self._class()))){
  23641. return $recv(each)._initialize();
  23642. }
  23643. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  23644. }));
  23645. return $self._sweepPackageDescriptors_(pkgs);
  23646. }, function($ctx2) {$ctx2.fillBlock({pkgs:pkgs,classes:classes},$ctx1,1)});
  23647. }));
  23648. }, function($ctx1) {$ctx1.fill(self,"postLoad",{})});
  23649. }; }),
  23650. $globals.SmalltalkImage);
  23651. $core.addMethod(
  23652. $core.method({
  23653. selector: "pseudoVariableNames",
  23654. protocol: "accessing",
  23655. args: [],
  23656. source: "pseudoVariableNames\x0a\x09^ Compiler pseudoVariableNames",
  23657. referencedClasses: ["Compiler"],
  23658. pragmas: [],
  23659. messageSends: ["pseudoVariableNames"]
  23660. }, function ($methodClass){ return function (){
  23661. var self=this,$self=this;
  23662. return $core.withContext(function($ctx1) {
  23663. return $recv($globals.Compiler)._pseudoVariableNames();
  23664. }, function($ctx1) {$ctx1.fill(self,"pseudoVariableNames",{})});
  23665. }; }),
  23666. $globals.SmalltalkImage);
  23667. $core.addMethod(
  23668. $core.method({
  23669. selector: "readJSObject:",
  23670. protocol: "accessing",
  23671. args: ["anObject"],
  23672. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  23673. referencedClasses: [],
  23674. pragmas: [["inlineJS:", ["return $core.readJSObject(anObject)"]]],
  23675. messageSends: []
  23676. }, function ($methodClass){ return function (anObject){
  23677. var self=this,$self=this;
  23678. return $core.withContext(function($ctx1) {
  23679. return $core.readJSObject(anObject);
  23680. return self;
  23681. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject})});
  23682. }; }),
  23683. $globals.SmalltalkImage);
  23684. $core.addMethod(
  23685. $core.method({
  23686. selector: "removeClass:",
  23687. protocol: "classes",
  23688. args: ["aClass"],
  23689. 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 includingPossibleMetaDo: [ :each | each setTraitComposition: #() ].\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  23690. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  23691. pragmas: [],
  23692. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "includingPossibleMetaDo:", "setTraitComposition:", "announce:", "current", "theClass:", "new", "yourself"]
  23693. }, function ($methodClass){ return function (aClass){
  23694. var self=this,$self=this;
  23695. return $core.withContext(function($ctx1) {
  23696. var $1,$2;
  23697. if($core.assert($recv(aClass)._isMetaclass())){
  23698. [$self._error_([$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!")
  23699. ,$ctx1.sendIdx[","]=1
  23700. ][0])
  23701. ,$ctx1.sendIdx["error:"]=1
  23702. ][0];
  23703. }
  23704. $recv(aClass)._allSubclassesDo_((function(subclass){
  23705. return $core.withContext(function($ctx2) {
  23706. return [$self._error_([$recv([$recv([$recv(aClass)._name()
  23707. ,$ctx2.sendIdx["name"]=1
  23708. ][0]).__comma(" has a subclass: ")
  23709. ,$ctx2.sendIdx[","]=3
  23710. ][0]).__comma([$recv(subclass)._name()
  23711. ,$ctx2.sendIdx["name"]=2
  23712. ][0])
  23713. ,$ctx2.sendIdx[","]=2
  23714. ][0])
  23715. ,$ctx2.sendIdx["error:"]=2
  23716. ][0];
  23717. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  23718. }));
  23719. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  23720. return $core.withContext(function($ctx2) {
  23721. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  23722. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  23723. }));
  23724. $self._deleteClass_(aClass);
  23725. $recv(aClass)._includingPossibleMetaDo_((function(each){
  23726. return $core.withContext(function($ctx2) {
  23727. return $recv(each)._setTraitComposition_([]);
  23728. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  23729. }));
  23730. $1=$recv($globals.SystemAnnouncer)._current();
  23731. $2=$recv($globals.ClassRemoved)._new();
  23732. $recv($2)._theClass_(aClass);
  23733. $recv($1)._announce_($recv($2)._yourself());
  23734. return self;
  23735. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass})});
  23736. }; }),
  23737. $globals.SmalltalkImage);
  23738. $core.addMethod(
  23739. $core.method({
  23740. selector: "removePackage:",
  23741. protocol: "packages",
  23742. args: ["packageName"],
  23743. source: "removePackage: packageName\x0a\x09\x22Removes a package and all its classes.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09pkg classes do: [ :each |\x0a\x09\x09\x09self removeClass: each ].\x0a\x09self packageDictionary removeKey: packageName",
  23744. referencedClasses: [],
  23745. pragmas: [],
  23746. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  23747. }, function ($methodClass){ return function (packageName){
  23748. var self=this,$self=this;
  23749. var pkg;
  23750. return $core.withContext(function($ctx1) {
  23751. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  23752. return $core.withContext(function($ctx2) {
  23753. return $self._error_("Missing package: ".__comma(packageName));
  23754. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23755. }));
  23756. $recv($recv(pkg)._classes())._do_((function(each){
  23757. return $core.withContext(function($ctx2) {
  23758. return $self._removeClass_(each);
  23759. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  23760. }));
  23761. $recv($self._packageDictionary())._removeKey_(packageName);
  23762. return self;
  23763. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg})});
  23764. }; }),
  23765. $globals.SmalltalkImage);
  23766. $core.addMethod(
  23767. $core.method({
  23768. selector: "renamePackage:to:",
  23769. protocol: "packages",
  23770. args: ["packageName", "newName"],
  23771. source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09self packageAt: newName ifPresent: [ self error: 'Already exists a package called: ', newName ].\x0a\x09pkg name: newName; beDirty.\x0a\x09self packageDictionary\x0a\x09\x09at: newName put: pkg;\x0a\x09\x09removeKey: packageName",
  23772. referencedClasses: [],
  23773. pragmas: [],
  23774. messageSends: ["packageAt:ifAbsent:", "error:", ",", "packageAt:ifPresent:", "name:", "beDirty", "at:put:", "packageDictionary", "removeKey:"]
  23775. }, function ($methodClass){ return function (packageName,newName){
  23776. var self=this,$self=this;
  23777. var pkg;
  23778. return $core.withContext(function($ctx1) {
  23779. var $1,$2;
  23780. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  23781. return $core.withContext(function($ctx2) {
  23782. return [$self._error_(["Missing package: ".__comma(packageName)
  23783. ,$ctx2.sendIdx[","]=1
  23784. ][0])
  23785. ,$ctx2.sendIdx["error:"]=1
  23786. ][0];
  23787. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23788. }));
  23789. $self._packageAt_ifPresent_(newName,(function(){
  23790. return $core.withContext(function($ctx2) {
  23791. return $self._error_("Already exists a package called: ".__comma(newName));
  23792. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  23793. }));
  23794. $1=pkg;
  23795. $recv($1)._name_(newName);
  23796. $recv($1)._beDirty();
  23797. $2=$self._packageDictionary();
  23798. $recv($2)._at_put_(newName,pkg);
  23799. $recv($2)._removeKey_(packageName);
  23800. return self;
  23801. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg})});
  23802. }; }),
  23803. $globals.SmalltalkImage);
  23804. $core.addMethod(
  23805. $core.method({
  23806. selector: "reservedWords",
  23807. protocol: "accessing",
  23808. args: [],
  23809. source: "reservedWords\x0a\x09^ #(\x0a\x09\x09\x22http://www.ecma-international.org/ecma-262/6.0/#sec-keywords\x22\x0a\x09\x09break case catch class const continue debugger\x0a\x09\x09default delete do else export extends finally\x0a\x09\x09for function if import in instanceof new\x0a\x09\x09return super switch this throw try typeof\x0a\x09\x09var void while with yield\x0a\x09\x09\x22in strict mode\x22\x0a\x09\x09let static\x0a\x09\x09\x22Amber protected words: these should not be compiled as-is when in code\x22\x0a\x09\x09arguments\x0a\x09\x09\x22http://www.ecma-international.org/ecma-262/6.0/#sec-future-reserved-words\x22\x0a\x09\x09await enum\x0a\x09\x09\x22in strict mode\x22\x0a\x09\x09implements interface package private protected public\x0a\x09)",
  23810. referencedClasses: [],
  23811. pragmas: [],
  23812. messageSends: []
  23813. }, function ($methodClass){ return function (){
  23814. var self=this,$self=this;
  23815. return ["break", "case", "catch", "class", "const", "continue", "debugger", "default", "delete", "do", "else", "export", "extends", "finally", "for", "function", "if", "import", "in", "instanceof", "new", "return", "super", "switch", "this", "throw", "try", "typeof", "var", "void", "while", "with", "yield", "let", "static", "arguments", "await", "enum", "implements", "interface", "package", "private", "protected", "public"];
  23816. }; }),
  23817. $globals.SmalltalkImage);
  23818. $core.addMethod(
  23819. $core.method({
  23820. selector: "settings",
  23821. protocol: "accessing",
  23822. args: [],
  23823. source: "settings\x0a\x09^ SmalltalkSettings",
  23824. referencedClasses: ["SmalltalkSettings"],
  23825. pragmas: [],
  23826. messageSends: []
  23827. }, function ($methodClass){ return function (){
  23828. var self=this,$self=this;
  23829. return $globals.SmalltalkSettings;
  23830. }; }),
  23831. $globals.SmalltalkImage);
  23832. $core.addMethod(
  23833. $core.method({
  23834. selector: "sweepPackageDescriptors:",
  23835. protocol: "private",
  23836. args: ["pkgs"],
  23837. source: "sweepPackageDescriptors: pkgs\x0a\x09| pd |\x09\x0a\x09pd := self core packageDescriptors.\x0a\x09pkgs do: [ :each | pd removeKey: each name ]",
  23838. referencedClasses: [],
  23839. pragmas: [],
  23840. messageSends: ["packageDescriptors", "core", "do:", "removeKey:", "name"]
  23841. }, function ($methodClass){ return function (pkgs){
  23842. var self=this,$self=this;
  23843. var pd;
  23844. return $core.withContext(function($ctx1) {
  23845. pd=$recv($self._core())._packageDescriptors();
  23846. $recv(pkgs)._do_((function(each){
  23847. return $core.withContext(function($ctx2) {
  23848. return $recv(pd)._removeKey_($recv(each)._name());
  23849. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23850. }));
  23851. return self;
  23852. }, function($ctx1) {$ctx1.fill(self,"sweepPackageDescriptors:",{pkgs:pkgs,pd:pd})});
  23853. }; }),
  23854. $globals.SmalltalkImage);
  23855. $core.addMethod(
  23856. $core.method({
  23857. selector: "try:ifTrue:catch:",
  23858. protocol: "error handling",
  23859. args: ["actionBlock", "aBlock", "anotherBlock"],
  23860. source: "try: actionBlock ifTrue: aBlock catch: anotherBlock\x0a\x09\x22Similar to BlockClosure >> tryifTrue:catch:, but\x0a\x09converts all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09| smalltalkError |\x0a\x09^ actionBlock\x0a\x09\x09tryIfTrue: [ :error |\x0a\x09\x09\x09smalltalkError := self asSmalltalkException: error.\x0a\x09\x09\x09aBlock value: smalltalkError ]\x0a\x09\x09catch: [ anotherBlock value: smalltalkError ]",
  23861. referencedClasses: [],
  23862. pragmas: [],
  23863. messageSends: ["tryIfTrue:catch:", "asSmalltalkException:", "value:"]
  23864. }, function ($methodClass){ return function (actionBlock,aBlock,anotherBlock){
  23865. var self=this,$self=this;
  23866. var smalltalkError;
  23867. return $core.withContext(function($ctx1) {
  23868. return $recv(actionBlock)._tryIfTrue_catch_((function(error){
  23869. return $core.withContext(function($ctx2) {
  23870. smalltalkError=$self._asSmalltalkException_(error);
  23871. return [$recv(aBlock)._value_(smalltalkError)
  23872. ,$ctx2.sendIdx["value:"]=1
  23873. ][0];
  23874. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  23875. }),(function(){
  23876. return $core.withContext(function($ctx2) {
  23877. return $recv(anotherBlock)._value_(smalltalkError);
  23878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  23879. }));
  23880. }, function($ctx1) {$ctx1.fill(self,"try:ifTrue:catch:",{actionBlock:actionBlock,aBlock:aBlock,anotherBlock:anotherBlock,smalltalkError:smalltalkError})});
  23881. }; }),
  23882. $globals.SmalltalkImage);
  23883. $core.addMethod(
  23884. $core.method({
  23885. selector: "tryAdoptPackageDescriptorsBeyond:",
  23886. protocol: "private",
  23887. args: ["aSet"],
  23888. source: "tryAdoptPackageDescriptorsBeyond: aSet\x0a\x09| original |\x0a\x09original := aSet copy.\x0a\x09self core packageDescriptors keysAndValuesDo: [ :key :value |\x0a\x09\x09aSet add: (Package named: key javaScriptDescriptor: value) ].\x0a\x09^ (aSet allSatisfy: [ :each | original includes: each ])\x0a\x09\x09ifFalse: [ (Promise all: (aSet collect: #isReady)) then: [ self tryAdoptPackageDescriptorsBeyond: aSet ] ]\x0a\x09\x09ifTrue: [ Promise value: aSet ]",
  23889. referencedClasses: ["Package", "Promise"],
  23890. pragmas: [],
  23891. messageSends: ["copy", "keysAndValuesDo:", "packageDescriptors", "core", "add:", "named:javaScriptDescriptor:", "ifFalse:ifTrue:", "allSatisfy:", "includes:", "then:", "all:", "collect:", "tryAdoptPackageDescriptorsBeyond:", "value:"]
  23892. }, function ($methodClass){ return function (aSet){
  23893. var self=this,$self=this;
  23894. var original;
  23895. return $core.withContext(function($ctx1) {
  23896. original=$recv(aSet)._copy();
  23897. $recv($recv($self._core())._packageDescriptors())._keysAndValuesDo_((function(key,value){
  23898. return $core.withContext(function($ctx2) {
  23899. return $recv(aSet)._add_($recv($globals.Package)._named_javaScriptDescriptor_(key,value));
  23900. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23901. }));
  23902. if($core.assert($recv(aSet)._allSatisfy_((function(each){
  23903. return $core.withContext(function($ctx2) {
  23904. return $recv(original)._includes_(each);
  23905. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  23906. })))){
  23907. return $recv($globals.Promise)._value_(aSet);
  23908. } else {
  23909. return $recv($recv($globals.Promise)._all_($recv(aSet)._collect_("isReady")))._then_((function(){
  23910. return $core.withContext(function($ctx2) {
  23911. return $self._tryAdoptPackageDescriptorsBeyond_(aSet);
  23912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  23913. }));
  23914. }
  23915. }, function($ctx1) {$ctx1.fill(self,"tryAdoptPackageDescriptorsBeyond:",{aSet:aSet,original:original})});
  23916. }; }),
  23917. $globals.SmalltalkImage);
  23918. $core.addMethod(
  23919. $core.method({
  23920. selector: "version",
  23921. protocol: "accessing",
  23922. args: [],
  23923. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.25.4'",
  23924. referencedClasses: [],
  23925. pragmas: [],
  23926. messageSends: []
  23927. }, function ($methodClass){ return function (){
  23928. var self=this,$self=this;
  23929. return "0.25.4";
  23930. }; }),
  23931. $globals.SmalltalkImage);
  23932. $core.setSlots($globals.SmalltalkImage.a$cls, ["current"]);
  23933. $core.addMethod(
  23934. $core.method({
  23935. selector: "current",
  23936. protocol: "instance creation",
  23937. args: [],
  23938. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  23939. referencedClasses: [],
  23940. pragmas: [],
  23941. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  23942. }, function ($methodClass){ return function (){
  23943. var self=this,$self=this;
  23944. return $core.withContext(function($ctx1) {
  23945. var $1;
  23946. $1=$self.current;
  23947. if($1 == null || $1.a$nil){
  23948. $self.current=[(
  23949. $ctx1.supercall = true,
  23950. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._new.call($self))
  23951. ,$ctx1.supercall = false
  23952. ][0];
  23953. return $self.current;
  23954. } else {
  23955. $self._deprecatedAPI();
  23956. return $self.current;
  23957. }
  23958. }, function($ctx1) {$ctx1.fill(self,"current",{})});
  23959. }; }),
  23960. $globals.SmalltalkImage.a$cls);
  23961. $core.addMethod(
  23962. $core.method({
  23963. selector: "initialize",
  23964. protocol: "initialization",
  23965. args: [],
  23966. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  23967. referencedClasses: [],
  23968. pragmas: [],
  23969. messageSends: ["current", "at:put:", "globals"]
  23970. }, function ($methodClass){ return function (){
  23971. var self=this,$self=this;
  23972. var st;
  23973. return $core.withContext(function($ctx1) {
  23974. st=$self._current();
  23975. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  23976. return self;
  23977. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st})});
  23978. }; }),
  23979. $globals.SmalltalkImage.a$cls);
  23980. $core.addMethod(
  23981. $core.method({
  23982. selector: "new",
  23983. protocol: "instance creation",
  23984. args: [],
  23985. source: "new\x0a\x09self shouldNotImplement",
  23986. referencedClasses: [],
  23987. pragmas: [],
  23988. messageSends: ["shouldNotImplement"]
  23989. }, function ($methodClass){ return function (){
  23990. var self=this,$self=this;
  23991. return $core.withContext(function($ctx1) {
  23992. $self._shouldNotImplement();
  23993. return self;
  23994. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  23995. }; }),
  23996. $globals.SmalltalkImage.a$cls);
  23997. $core.setTraitComposition([{trait: $globals.TIsInGroup}, {trait: $globals.TThenable}], $globals.JSObjectProxy);
  23998. $core.addMethod(
  23999. $core.method({
  24000. selector: "nextPutJSObject:",
  24001. protocol: "*Kernel-Infrastructure",
  24002. args: ["aJSObject"],
  24003. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  24004. referencedClasses: [],
  24005. pragmas: [],
  24006. messageSends: ["nextPut:"]
  24007. }, function ($methodClass){ return function (aJSObject){
  24008. var self=this,$self=this;
  24009. return $core.withContext(function($ctx1) {
  24010. $self._nextPut_(aJSObject);
  24011. return self;
  24012. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject})});
  24013. }; }),
  24014. $globals.ProtoStream);
  24015. $core.addMethod(
  24016. $core.method({
  24017. selector: "asJavaScriptPropertyName",
  24018. protocol: "*Kernel-Infrastructure",
  24019. args: [],
  24020. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  24021. referencedClasses: [],
  24022. pragmas: [["inlineJS:", ["return $core.st2prop(self)"]]],
  24023. messageSends: []
  24024. }, function ($methodClass){ return function (){
  24025. var self=this,$self=this;
  24026. return $core.withContext(function($ctx1) {
  24027. return $core.st2prop(self);
  24028. return self;
  24029. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{})});
  24030. }; }),
  24031. $globals.String);
  24032. $core.addMethod(
  24033. $core.method({
  24034. selector: "asSetting",
  24035. protocol: "*Kernel-Infrastructure",
  24036. args: [],
  24037. 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",
  24038. referencedClasses: ["Setting"],
  24039. pragmas: [],
  24040. messageSends: ["at:ifAbsent:"]
  24041. }, function ($methodClass){ return function (){
  24042. var self=this,$self=this;
  24043. return $core.withContext(function($ctx1) {
  24044. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  24045. }, function($ctx1) {$ctx1.fill(self,"asSetting",{})});
  24046. }; }),
  24047. $globals.String);
  24048. $core.addMethod(
  24049. $core.method({
  24050. selector: "asSettingIfAbsent:",
  24051. protocol: "*Kernel-Infrastructure",
  24052. args: ["aDefaultValue"],
  24053. 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",
  24054. referencedClasses: ["Setting"],
  24055. pragmas: [],
  24056. messageSends: ["at:ifAbsent:"]
  24057. }, function ($methodClass){ return function (aDefaultValue){
  24058. var self=this,$self=this;
  24059. return $core.withContext(function($ctx1) {
  24060. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  24061. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue})});
  24062. }; }),
  24063. $globals.String);
  24064. $core.addMethod(
  24065. $core.method({
  24066. selector: "settingValue",
  24067. protocol: "*Kernel-Infrastructure",
  24068. args: [],
  24069. source: "settingValue\x0a\x09^ self asSetting value",
  24070. referencedClasses: [],
  24071. pragmas: [],
  24072. messageSends: ["value", "asSetting"]
  24073. }, function ($methodClass){ return function (){
  24074. var self=this,$self=this;
  24075. return $core.withContext(function($ctx1) {
  24076. return $recv($self._asSetting())._value();
  24077. }, function($ctx1) {$ctx1.fill(self,"settingValue",{})});
  24078. }; }),
  24079. $globals.String);
  24080. $core.addMethod(
  24081. $core.method({
  24082. selector: "settingValue:",
  24083. protocol: "*Kernel-Infrastructure",
  24084. args: ["aValue"],
  24085. 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",
  24086. referencedClasses: [],
  24087. pragmas: [],
  24088. messageSends: ["value:", "asSetting"]
  24089. }, function ($methodClass){ return function (aValue){
  24090. var self=this,$self=this;
  24091. return $core.withContext(function($ctx1) {
  24092. return $recv($self._asSetting())._value_(aValue);
  24093. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue})});
  24094. }; }),
  24095. $globals.String);
  24096. $core.addMethod(
  24097. $core.method({
  24098. selector: "settingValueIfAbsent:",
  24099. protocol: "*Kernel-Infrastructure",
  24100. args: ["aDefaultValue"],
  24101. 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",
  24102. referencedClasses: [],
  24103. pragmas: [],
  24104. messageSends: ["value", "asSettingIfAbsent:"]
  24105. }, function ($methodClass){ return function (aDefaultValue){
  24106. var self=this,$self=this;
  24107. return $core.withContext(function($ctx1) {
  24108. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  24109. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue})});
  24110. }; }),
  24111. $globals.String);
  24112. });
  24113. define('amber/core/Kernel-Exceptions',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  24114. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  24115. var $pkg = $core.addPackage("Kernel-Exceptions");
  24116. $pkg.innerEval = function (expr) { return eval(expr); };
  24117. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  24118. $core.addClass("Error", $globals.Object, ["message", "stack", "amberHandled", "context", "smalltalkError"], "Kernel-Exceptions");
  24119. $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.";
  24120. $core.addMethod(
  24121. $core.method({
  24122. selector: "basicSignal",
  24123. protocol: "private",
  24124. args: [],
  24125. source: "basicSignal\x0a\x09<inlineJS: 'throw self;'>",
  24126. referencedClasses: [],
  24127. pragmas: [["inlineJS:", ["throw self;"]]],
  24128. messageSends: []
  24129. }, function ($methodClass){ return function (){
  24130. var self=this,$self=this;
  24131. return $core.withContext(function($ctx1) {
  24132. throw self;;
  24133. return self;
  24134. }, function($ctx1) {$ctx1.fill(self,"basicSignal",{})});
  24135. }; }),
  24136. $globals.Error);
  24137. $core.addMethod(
  24138. $core.method({
  24139. selector: "beHandled",
  24140. protocol: "accessing",
  24141. args: [],
  24142. source: "beHandled\x0a\x09amberHandled := true",
  24143. referencedClasses: [],
  24144. pragmas: [],
  24145. messageSends: []
  24146. }, function ($methodClass){ return function (){
  24147. var self=this,$self=this;
  24148. $self.amberHandled=true;
  24149. return self;
  24150. }; }),
  24151. $globals.Error);
  24152. $core.addMethod(
  24153. $core.method({
  24154. selector: "beUnhandled",
  24155. protocol: "accessing",
  24156. args: [],
  24157. source: "beUnhandled\x0a\x09amberHandled := false",
  24158. referencedClasses: [],
  24159. pragmas: [],
  24160. messageSends: []
  24161. }, function ($methodClass){ return function (){
  24162. var self=this,$self=this;
  24163. $self.amberHandled=false;
  24164. return self;
  24165. }; }),
  24166. $globals.Error);
  24167. $core.addMethod(
  24168. $core.method({
  24169. selector: "context",
  24170. protocol: "accessing",
  24171. args: [],
  24172. source: "context\x0a\x09^ context",
  24173. referencedClasses: [],
  24174. pragmas: [],
  24175. messageSends: []
  24176. }, function ($methodClass){ return function (){
  24177. var self=this,$self=this;
  24178. return $self.context;
  24179. }; }),
  24180. $globals.Error);
  24181. $core.addMethod(
  24182. $core.method({
  24183. selector: "context:",
  24184. protocol: "accessing",
  24185. args: ["aMethodContext"],
  24186. source: "context: aMethodContext\x0a\x09context := aMethodContext",
  24187. referencedClasses: [],
  24188. pragmas: [],
  24189. messageSends: []
  24190. }, function ($methodClass){ return function (aMethodContext){
  24191. var self=this,$self=this;
  24192. $self.context=aMethodContext;
  24193. return self;
  24194. }; }),
  24195. $globals.Error);
  24196. $core.addMethod(
  24197. $core.method({
  24198. selector: "initialize",
  24199. protocol: "initialization",
  24200. args: [],
  24201. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  24202. referencedClasses: [],
  24203. pragmas: [],
  24204. messageSends: ["messageText:", ",", "name", "class"]
  24205. }, function ($methodClass){ return function (){
  24206. var self=this,$self=this;
  24207. return $core.withContext(function($ctx1) {
  24208. $self._messageText_("Errorclass: ".__comma($recv($self._class())._name()));
  24209. return self;
  24210. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  24211. }; }),
  24212. $globals.Error);
  24213. $core.addMethod(
  24214. $core.method({
  24215. selector: "isError",
  24216. protocol: "testing",
  24217. args: [],
  24218. source: "isError\x0a\x09^ true",
  24219. referencedClasses: [],
  24220. pragmas: [],
  24221. messageSends: []
  24222. }, function ($methodClass){ return function (){
  24223. var self=this,$self=this;
  24224. return true;
  24225. }; }),
  24226. $globals.Error);
  24227. $core.addMethod(
  24228. $core.method({
  24229. selector: "jsStack",
  24230. protocol: "accessing",
  24231. args: [],
  24232. source: "jsStack\x0a\x09^ stack",
  24233. referencedClasses: [],
  24234. pragmas: [],
  24235. messageSends: []
  24236. }, function ($methodClass){ return function (){
  24237. var self=this,$self=this;
  24238. return $self.stack;
  24239. }; }),
  24240. $globals.Error);
  24241. $core.addMethod(
  24242. $core.method({
  24243. selector: "messageText",
  24244. protocol: "accessing",
  24245. args: [],
  24246. source: "messageText\x0a\x09^ message",
  24247. referencedClasses: [],
  24248. pragmas: [],
  24249. messageSends: []
  24250. }, function ($methodClass){ return function (){
  24251. var self=this,$self=this;
  24252. return $self.message;
  24253. }; }),
  24254. $globals.Error);
  24255. $core.addMethod(
  24256. $core.method({
  24257. selector: "messageText:",
  24258. protocol: "accessing",
  24259. args: ["aString"],
  24260. source: "messageText: aString\x0a\x09message := aString",
  24261. referencedClasses: [],
  24262. pragmas: [],
  24263. messageSends: []
  24264. }, function ($methodClass){ return function (aString){
  24265. var self=this,$self=this;
  24266. $self.message=aString;
  24267. return self;
  24268. }; }),
  24269. $globals.Error);
  24270. $core.addMethod(
  24271. $core.method({
  24272. selector: "outer",
  24273. protocol: "signaling",
  24274. args: [],
  24275. source: "outer\x0a\x09\x22Pharo compatibility. Just sends #pass.\x22\x0a\x09\x0a\x09^ self pass",
  24276. referencedClasses: [],
  24277. pragmas: [],
  24278. messageSends: ["pass"]
  24279. }, function ($methodClass){ return function (){
  24280. var self=this,$self=this;
  24281. return $core.withContext(function($ctx1) {
  24282. return $self._pass();
  24283. }, function($ctx1) {$ctx1.fill(self,"outer",{})});
  24284. }; }),
  24285. $globals.Error);
  24286. $core.addMethod(
  24287. $core.method({
  24288. selector: "pass",
  24289. protocol: "signaling",
  24290. args: [],
  24291. source: "pass\x0a\x09\x22Let outer handler take care of this.\x22\x0a\x0a\x09self beUnhandled; basicSignal",
  24292. referencedClasses: [],
  24293. pragmas: [],
  24294. messageSends: ["beUnhandled", "basicSignal"]
  24295. }, function ($methodClass){ return function (){
  24296. var self=this,$self=this;
  24297. return $core.withContext(function($ctx1) {
  24298. $self._beUnhandled();
  24299. $self._basicSignal();
  24300. return self;
  24301. }, function($ctx1) {$ctx1.fill(self,"pass",{})});
  24302. }; }),
  24303. $globals.Error);
  24304. $core.addMethod(
  24305. $core.method({
  24306. selector: "resignal",
  24307. protocol: "signaling",
  24308. args: [],
  24309. source: "resignal\x0a\x09self deprecatedAPI: 'Use #pass.'.\x0a\x09^ self pass",
  24310. referencedClasses: [],
  24311. pragmas: [],
  24312. messageSends: ["deprecatedAPI:", "pass"]
  24313. }, function ($methodClass){ return function (){
  24314. var self=this,$self=this;
  24315. return $core.withContext(function($ctx1) {
  24316. $self._deprecatedAPI_("Use #pass.");
  24317. return $self._pass();
  24318. }, function($ctx1) {$ctx1.fill(self,"resignal",{})});
  24319. }; }),
  24320. $globals.Error);
  24321. $core.addMethod(
  24322. $core.method({
  24323. selector: "signal",
  24324. protocol: "signaling",
  24325. args: [],
  24326. source: "signal\x0a\x09self beUnhandled; context: thisContext; basicSignal",
  24327. referencedClasses: [],
  24328. pragmas: [],
  24329. messageSends: ["beUnhandled", "context:", "basicSignal"]
  24330. }, function ($methodClass){ return function (){
  24331. var self=this,$self=this;
  24332. return $core.withContext(function($ctx1) {
  24333. $self._beUnhandled();
  24334. $self._context_($core.getThisContext());
  24335. $self._basicSignal();
  24336. return self;
  24337. }, function($ctx1) {$ctx1.fill(self,"signal",{})});
  24338. }; }),
  24339. $globals.Error);
  24340. $core.addMethod(
  24341. $core.method({
  24342. selector: "signal:",
  24343. protocol: "signaling",
  24344. args: ["aString"],
  24345. source: "signal: aString\x0a\x09self messageText: aString; signal",
  24346. referencedClasses: [],
  24347. pragmas: [],
  24348. messageSends: ["messageText:", "signal"]
  24349. }, function ($methodClass){ return function (aString){
  24350. var self=this,$self=this;
  24351. return $core.withContext(function($ctx1) {
  24352. $self._messageText_(aString);
  24353. $self._signal();
  24354. return self;
  24355. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString})});
  24356. }; }),
  24357. $globals.Error);
  24358. $core.addMethod(
  24359. $core.method({
  24360. selector: "signalerContext",
  24361. protocol: "accessing",
  24362. args: [],
  24363. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  24364. referencedClasses: [],
  24365. pragmas: [],
  24366. messageSends: ["signalerContextFrom:", "context"]
  24367. }, function ($methodClass){ return function (){
  24368. var self=this,$self=this;
  24369. return $core.withContext(function($ctx1) {
  24370. return $self._signalerContextFrom_($self._context());
  24371. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{})});
  24372. }; }),
  24373. $globals.Error);
  24374. $core.addMethod(
  24375. $core.method({
  24376. selector: "signalerContextFrom:",
  24377. protocol: "accessing",
  24378. args: ["aContext"],
  24379. 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: [ :one |\x0a\x09\x09(one receiver == self \x0a\x09\x09or: [ one receiver == self class ]) not ]",
  24380. referencedClasses: [],
  24381. pragmas: [],
  24382. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  24383. }, function ($methodClass){ return function (aContext){
  24384. var self=this,$self=this;
  24385. return $core.withContext(function($ctx1) {
  24386. return $recv(aContext)._findContextSuchThat_((function(one){
  24387. return $core.withContext(function($ctx2) {
  24388. return $recv($recv([$recv([$recv(one)._receiver()
  24389. ,$ctx2.sendIdx["receiver"]=1
  24390. ][0]).__eq_eq(self)
  24391. ,$ctx2.sendIdx["=="]=1
  24392. ][0])._or_((function(){
  24393. return $core.withContext(function($ctx3) {
  24394. return $recv($recv(one)._receiver()).__eq_eq($self._class());
  24395. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  24396. })))._not();
  24397. }, function($ctx2) {$ctx2.fillBlock({one:one},$ctx1,1)});
  24398. }));
  24399. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext})});
  24400. }; }),
  24401. $globals.Error);
  24402. $core.addMethod(
  24403. $core.method({
  24404. selector: "wasHandled",
  24405. protocol: "testing",
  24406. args: [],
  24407. source: "wasHandled\x0a\x09^ amberHandled == true",
  24408. referencedClasses: [],
  24409. pragmas: [],
  24410. messageSends: ["=="]
  24411. }, function ($methodClass){ return function (){
  24412. var self=this,$self=this;
  24413. return $core.withContext(function($ctx1) {
  24414. return $recv($self.amberHandled).__eq_eq(true);
  24415. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{})});
  24416. }; }),
  24417. $globals.Error);
  24418. $core.addMethod(
  24419. $core.method({
  24420. selector: "classTag",
  24421. protocol: "accessing",
  24422. args: [],
  24423. 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'",
  24424. referencedClasses: [],
  24425. pragmas: [],
  24426. messageSends: []
  24427. }, function ($methodClass){ return function (){
  24428. var self=this,$self=this;
  24429. return "exception";
  24430. }; }),
  24431. $globals.Error.a$cls);
  24432. $core.addMethod(
  24433. $core.method({
  24434. selector: "signal",
  24435. protocol: "instance creation",
  24436. args: [],
  24437. source: "signal\x0a\x09^ self new signal",
  24438. referencedClasses: [],
  24439. pragmas: [],
  24440. messageSends: ["signal", "new"]
  24441. }, function ($methodClass){ return function (){
  24442. var self=this,$self=this;
  24443. return $core.withContext(function($ctx1) {
  24444. return $recv($self._new())._signal();
  24445. }, function($ctx1) {$ctx1.fill(self,"signal",{})});
  24446. }; }),
  24447. $globals.Error.a$cls);
  24448. $core.addMethod(
  24449. $core.method({
  24450. selector: "signal:",
  24451. protocol: "instance creation",
  24452. args: ["aString"],
  24453. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  24454. referencedClasses: [],
  24455. pragmas: [],
  24456. messageSends: ["signal:", "new"]
  24457. }, function ($methodClass){ return function (aString){
  24458. var self=this,$self=this;
  24459. return $core.withContext(function($ctx1) {
  24460. return $recv($self._new())._signal_(aString);
  24461. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString})});
  24462. }; }),
  24463. $globals.Error.a$cls);
  24464. $core.addClass("Halt", $globals.Error, [], "Kernel-Exceptions");
  24465. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  24466. $core.addMethod(
  24467. $core.method({
  24468. selector: "messageText",
  24469. protocol: "accessing",
  24470. args: [],
  24471. source: "messageText\x0a\x09^ 'Halt encountered'",
  24472. referencedClasses: [],
  24473. pragmas: [],
  24474. messageSends: []
  24475. }, function ($methodClass){ return function (){
  24476. var self=this,$self=this;
  24477. return "Halt encountered";
  24478. }; }),
  24479. $globals.Halt);
  24480. $core.addMethod(
  24481. $core.method({
  24482. selector: "signalerContextFrom:",
  24483. protocol: "accessing",
  24484. args: ["aContext"],
  24485. 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: [ :one |\x0a\x09\x09(one receiver == self \x0a\x09\x09or: [ (one receiver == self class) \x0a\x09\x09or: [ one method selector = #halt ]]) not ]",
  24486. referencedClasses: [],
  24487. pragmas: [],
  24488. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  24489. }, function ($methodClass){ return function (aContext){
  24490. var self=this,$self=this;
  24491. return $core.withContext(function($ctx1) {
  24492. return $recv(aContext)._findContextSuchThat_((function(one){
  24493. return $core.withContext(function($ctx2) {
  24494. return $recv([$recv([$recv([$recv(one)._receiver()
  24495. ,$ctx2.sendIdx["receiver"]=1
  24496. ][0]).__eq_eq(self)
  24497. ,$ctx2.sendIdx["=="]=1
  24498. ][0])._or_((function(){
  24499. return $core.withContext(function($ctx3) {
  24500. return $recv($recv($recv(one)._receiver()).__eq_eq($self._class()))._or_((function(){
  24501. return $core.withContext(function($ctx4) {
  24502. return $recv($recv($recv(one)._method())._selector()).__eq("halt");
  24503. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  24504. }));
  24505. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  24506. }))
  24507. ,$ctx2.sendIdx["or:"]=1
  24508. ][0])._not();
  24509. }, function($ctx2) {$ctx2.fillBlock({one:one},$ctx1,1)});
  24510. }));
  24511. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext})});
  24512. }; }),
  24513. $globals.Halt);
  24514. $core.addClass("JavaScriptException", $globals.Error, ["exception"], "Kernel-Exceptions");
  24515. $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:`";
  24516. $core.addMethod(
  24517. $core.method({
  24518. selector: "exception",
  24519. protocol: "accessing",
  24520. args: [],
  24521. source: "exception\x0a\x09^ exception",
  24522. referencedClasses: [],
  24523. pragmas: [],
  24524. messageSends: []
  24525. }, function ($methodClass){ return function (){
  24526. var self=this,$self=this;
  24527. return $self.exception;
  24528. }; }),
  24529. $globals.JavaScriptException);
  24530. $core.addMethod(
  24531. $core.method({
  24532. selector: "exception:",
  24533. protocol: "accessing",
  24534. args: ["anException"],
  24535. source: "exception: anException\x0a\x09exception := anException",
  24536. referencedClasses: [],
  24537. pragmas: [],
  24538. messageSends: []
  24539. }, function ($methodClass){ return function (anException){
  24540. var self=this,$self=this;
  24541. $self.exception=anException;
  24542. return self;
  24543. }; }),
  24544. $globals.JavaScriptException);
  24545. $core.addMethod(
  24546. $core.method({
  24547. selector: "messageText",
  24548. protocol: "accessing",
  24549. args: [],
  24550. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + $self.exception.toString()'>",
  24551. referencedClasses: [],
  24552. pragmas: [["inlineJS:", ["return \x22JavaScript exception: \x22 + $self.exception.toString()"]]],
  24553. messageSends: []
  24554. }, function ($methodClass){ return function (){
  24555. var self=this,$self=this;
  24556. return $core.withContext(function($ctx1) {
  24557. return "JavaScript exception: " + $self.exception.toString();
  24558. return self;
  24559. }, function($ctx1) {$ctx1.fill(self,"messageText",{})});
  24560. }; }),
  24561. $globals.JavaScriptException);
  24562. $core.addMethod(
  24563. $core.method({
  24564. selector: "on:",
  24565. protocol: "instance creation",
  24566. args: ["anException"],
  24567. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  24568. referencedClasses: [],
  24569. pragmas: [],
  24570. messageSends: ["exception:", "new", "yourself"]
  24571. }, function ($methodClass){ return function (anException){
  24572. var self=this,$self=this;
  24573. return $core.withContext(function($ctx1) {
  24574. var $1;
  24575. $1=$self._new();
  24576. $recv($1)._exception_(anException);
  24577. return $recv($1)._yourself();
  24578. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException})});
  24579. }; }),
  24580. $globals.JavaScriptException.a$cls);
  24581. $core.addMethod(
  24582. $core.method({
  24583. selector: "on:context:",
  24584. protocol: "instance creation",
  24585. args: ["anException", "aMethodContext"],
  24586. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  24587. referencedClasses: [],
  24588. pragmas: [],
  24589. messageSends: ["exception:", "new", "context:", "yourself"]
  24590. }, function ($methodClass){ return function (anException,aMethodContext){
  24591. var self=this,$self=this;
  24592. return $core.withContext(function($ctx1) {
  24593. var $1;
  24594. $1=$self._new();
  24595. $recv($1)._exception_(anException);
  24596. $recv($1)._context_(aMethodContext);
  24597. return $recv($1)._yourself();
  24598. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext})});
  24599. }; }),
  24600. $globals.JavaScriptException.a$cls);
  24601. $core.addClass("MessageNotUnderstood", $globals.Error, ["smalltalkMessage", "receiver"], "Kernel-Exceptions");
  24602. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  24603. $core.addMethod(
  24604. $core.method({
  24605. selector: "message",
  24606. protocol: "accessing",
  24607. args: [],
  24608. source: "message\x0a\x09^ smalltalkMessage",
  24609. referencedClasses: [],
  24610. pragmas: [],
  24611. messageSends: []
  24612. }, function ($methodClass){ return function (){
  24613. var self=this,$self=this;
  24614. return $self.smalltalkMessage;
  24615. }; }),
  24616. $globals.MessageNotUnderstood);
  24617. $core.addMethod(
  24618. $core.method({
  24619. selector: "message:",
  24620. protocol: "accessing",
  24621. args: ["aMessage"],
  24622. source: "message: aMessage\x0a\x09smalltalkMessage := aMessage",
  24623. referencedClasses: [],
  24624. pragmas: [],
  24625. messageSends: []
  24626. }, function ($methodClass){ return function (aMessage){
  24627. var self=this,$self=this;
  24628. $self.smalltalkMessage=aMessage;
  24629. return self;
  24630. }; }),
  24631. $globals.MessageNotUnderstood);
  24632. $core.addMethod(
  24633. $core.method({
  24634. selector: "messageText",
  24635. protocol: "accessing",
  24636. args: [],
  24637. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  24638. referencedClasses: [],
  24639. pragmas: [],
  24640. messageSends: [",", "asString", "receiver", "selector", "message"]
  24641. }, function ($methodClass){ return function (){
  24642. var self=this,$self=this;
  24643. return $core.withContext(function($ctx1) {
  24644. return [$recv($recv($recv($self._receiver())._asString()).__comma(" does not understand #")).__comma($recv($self._message())._selector())
  24645. ,$ctx1.sendIdx[","]=1
  24646. ][0];
  24647. }, function($ctx1) {$ctx1.fill(self,"messageText",{})});
  24648. }; }),
  24649. $globals.MessageNotUnderstood);
  24650. $core.addMethod(
  24651. $core.method({
  24652. selector: "receiver",
  24653. protocol: "accessing",
  24654. args: [],
  24655. source: "receiver\x0a\x09^ receiver",
  24656. referencedClasses: [],
  24657. pragmas: [],
  24658. messageSends: []
  24659. }, function ($methodClass){ return function (){
  24660. var self=this,$self=this;
  24661. return $self.receiver;
  24662. }; }),
  24663. $globals.MessageNotUnderstood);
  24664. $core.addMethod(
  24665. $core.method({
  24666. selector: "receiver:",
  24667. protocol: "accessing",
  24668. args: ["anObject"],
  24669. source: "receiver: anObject\x0a\x09receiver := anObject",
  24670. referencedClasses: [],
  24671. pragmas: [],
  24672. messageSends: []
  24673. }, function ($methodClass){ return function (anObject){
  24674. var self=this,$self=this;
  24675. $self.receiver=anObject;
  24676. return self;
  24677. }; }),
  24678. $globals.MessageNotUnderstood);
  24679. $core.addClass("NonBooleanReceiver", $globals.Error, ["object"], "Kernel-Exceptions");
  24680. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  24681. $core.addMethod(
  24682. $core.method({
  24683. selector: "object",
  24684. protocol: "accessing",
  24685. args: [],
  24686. source: "object\x0a\x09^ object",
  24687. referencedClasses: [],
  24688. pragmas: [],
  24689. messageSends: []
  24690. }, function ($methodClass){ return function (){
  24691. var self=this,$self=this;
  24692. return $self.object;
  24693. }; }),
  24694. $globals.NonBooleanReceiver);
  24695. $core.addMethod(
  24696. $core.method({
  24697. selector: "object:",
  24698. protocol: "accessing",
  24699. args: ["anObject"],
  24700. source: "object: anObject\x0a\x09object := anObject",
  24701. referencedClasses: [],
  24702. pragmas: [],
  24703. messageSends: []
  24704. }, function ($methodClass){ return function (anObject){
  24705. var self=this,$self=this;
  24706. $self.object=anObject;
  24707. return self;
  24708. }; }),
  24709. $globals.NonBooleanReceiver);
  24710. $core.addMethod(
  24711. $core.method({
  24712. selector: "signalOn:",
  24713. protocol: "instance creation",
  24714. args: ["anObject"],
  24715. source: "signalOn: anObject\x0a\x09^ self new\x0a\x09\x09object: anObject;\x0a\x09\x09signal",
  24716. referencedClasses: [],
  24717. pragmas: [],
  24718. messageSends: ["object:", "new", "signal"]
  24719. }, function ($methodClass){ return function (anObject){
  24720. var self=this,$self=this;
  24721. return $core.withContext(function($ctx1) {
  24722. var $1;
  24723. $1=$self._new();
  24724. $recv($1)._object_(anObject);
  24725. return $recv($1)._signal();
  24726. }, function($ctx1) {$ctx1.fill(self,"signalOn:",{anObject:anObject})});
  24727. }; }),
  24728. $globals.NonBooleanReceiver.a$cls);
  24729. });
  24730. define('amber/core/Kernel-Announcements',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  24731. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  24732. var $pkg = $core.addPackage("Kernel-Announcements");
  24733. $pkg.innerEval = function (expr) { return eval(expr); };
  24734. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  24735. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  24736. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  24737. $core.addMethod(
  24738. $core.method({
  24739. selector: "announcementClass",
  24740. protocol: "accessing",
  24741. args: [],
  24742. source: "announcementClass\x0a\x09^ announcementClass",
  24743. referencedClasses: [],
  24744. pragmas: [],
  24745. messageSends: []
  24746. }, function ($methodClass){ return function (){
  24747. var self=this,$self=this;
  24748. return $self.announcementClass;
  24749. }; }),
  24750. $globals.AnnouncementSubscription);
  24751. $core.addMethod(
  24752. $core.method({
  24753. selector: "announcementClass:",
  24754. protocol: "accessing",
  24755. args: ["aClass"],
  24756. source: "announcementClass: aClass\x0a\x09announcementClass := Smalltalk globals at: aClass name",
  24757. referencedClasses: ["Smalltalk"],
  24758. pragmas: [],
  24759. messageSends: ["at:", "globals", "name"]
  24760. }, function ($methodClass){ return function (aClass){
  24761. var self=this,$self=this;
  24762. return $core.withContext(function($ctx1) {
  24763. $self.announcementClass=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aClass)._name());
  24764. return self;
  24765. }, function($ctx1) {$ctx1.fill(self,"announcementClass:",{aClass:aClass})});
  24766. }; }),
  24767. $globals.AnnouncementSubscription);
  24768. $core.addMethod(
  24769. $core.method({
  24770. selector: "deliver:",
  24771. protocol: "announcing",
  24772. args: ["anAnnouncement"],
  24773. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  24774. referencedClasses: [],
  24775. pragmas: [],
  24776. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  24777. }, function ($methodClass){ return function (anAnnouncement){
  24778. var self=this,$self=this;
  24779. return $core.withContext(function($ctx1) {
  24780. if($core.assert($self._handlesAnnouncement_(anAnnouncement))){
  24781. $recv($self._valuable())._value_(anAnnouncement);
  24782. }
  24783. return self;
  24784. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement})});
  24785. }; }),
  24786. $globals.AnnouncementSubscription);
  24787. $core.addMethod(
  24788. $core.method({
  24789. selector: "handlesAnnouncement:",
  24790. protocol: "announcing",
  24791. args: ["anAnnouncement"],
  24792. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk globals at: anAnnouncement class name) includesBehavior: self announcementClass",
  24793. referencedClasses: ["Smalltalk"],
  24794. pragmas: [],
  24795. messageSends: ["includesBehavior:", "at:", "globals", "name", "class", "announcementClass"]
  24796. }, function ($methodClass){ return function (anAnnouncement){
  24797. var self=this,$self=this;
  24798. return $core.withContext(function($ctx1) {
  24799. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(anAnnouncement)._class())._name()))._includesBehavior_($self._announcementClass());
  24800. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement})});
  24801. }; }),
  24802. $globals.AnnouncementSubscription);
  24803. $core.addMethod(
  24804. $core.method({
  24805. selector: "receiver",
  24806. protocol: "accessing",
  24807. args: [],
  24808. source: "receiver\x0a\x09^ self valuable receiver",
  24809. referencedClasses: [],
  24810. pragmas: [],
  24811. messageSends: ["receiver", "valuable"]
  24812. }, function ($methodClass){ return function (){
  24813. var self=this,$self=this;
  24814. return $core.withContext(function($ctx1) {
  24815. return $recv($self._valuable())._receiver();
  24816. }, function($ctx1) {$ctx1.fill(self,"receiver",{})});
  24817. }; }),
  24818. $globals.AnnouncementSubscription);
  24819. $core.addMethod(
  24820. $core.method({
  24821. selector: "valuable",
  24822. protocol: "accessing",
  24823. args: [],
  24824. source: "valuable\x0a\x09^ valuable",
  24825. referencedClasses: [],
  24826. pragmas: [],
  24827. messageSends: []
  24828. }, function ($methodClass){ return function (){
  24829. var self=this,$self=this;
  24830. return $self.valuable;
  24831. }; }),
  24832. $globals.AnnouncementSubscription);
  24833. $core.addMethod(
  24834. $core.method({
  24835. selector: "valuable:",
  24836. protocol: "accessing",
  24837. args: ["aValuable"],
  24838. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  24839. referencedClasses: [],
  24840. pragmas: [],
  24841. messageSends: []
  24842. }, function ($methodClass){ return function (aValuable){
  24843. var self=this,$self=this;
  24844. $self.valuable=aValuable;
  24845. return self;
  24846. }; }),
  24847. $globals.AnnouncementSubscription);
  24848. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  24849. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  24850. $core.addMethod(
  24851. $core.method({
  24852. selector: "receiver",
  24853. protocol: "accessing",
  24854. args: [],
  24855. source: "receiver\x0a\x09^ receiver",
  24856. referencedClasses: [],
  24857. pragmas: [],
  24858. messageSends: []
  24859. }, function ($methodClass){ return function (){
  24860. var self=this,$self=this;
  24861. return $self.receiver;
  24862. }; }),
  24863. $globals.AnnouncementValuable);
  24864. $core.addMethod(
  24865. $core.method({
  24866. selector: "receiver:",
  24867. protocol: "accessing",
  24868. args: ["anObject"],
  24869. source: "receiver: anObject\x0a\x09receiver := anObject",
  24870. referencedClasses: [],
  24871. pragmas: [],
  24872. messageSends: []
  24873. }, function ($methodClass){ return function (anObject){
  24874. var self=this,$self=this;
  24875. $self.receiver=anObject;
  24876. return self;
  24877. }; }),
  24878. $globals.AnnouncementValuable);
  24879. $core.addMethod(
  24880. $core.method({
  24881. selector: "valuable",
  24882. protocol: "accessing",
  24883. args: [],
  24884. source: "valuable\x0a\x09^ valuable",
  24885. referencedClasses: [],
  24886. pragmas: [],
  24887. messageSends: []
  24888. }, function ($methodClass){ return function (){
  24889. var self=this,$self=this;
  24890. return $self.valuable;
  24891. }; }),
  24892. $globals.AnnouncementValuable);
  24893. $core.addMethod(
  24894. $core.method({
  24895. selector: "valuable:",
  24896. protocol: "accessing",
  24897. args: ["anObject"],
  24898. source: "valuable: anObject\x0a\x09valuable := anObject",
  24899. referencedClasses: [],
  24900. pragmas: [],
  24901. messageSends: []
  24902. }, function ($methodClass){ return function (anObject){
  24903. var self=this,$self=this;
  24904. $self.valuable=anObject;
  24905. return self;
  24906. }; }),
  24907. $globals.AnnouncementValuable);
  24908. $core.addMethod(
  24909. $core.method({
  24910. selector: "value",
  24911. protocol: "evaluating",
  24912. args: [],
  24913. source: "value\x0a\x09^ self valuable value",
  24914. referencedClasses: [],
  24915. pragmas: [],
  24916. messageSends: ["value", "valuable"]
  24917. }, function ($methodClass){ return function (){
  24918. var self=this,$self=this;
  24919. return $core.withContext(function($ctx1) {
  24920. return $recv($self._valuable())._value();
  24921. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  24922. }; }),
  24923. $globals.AnnouncementValuable);
  24924. $core.addMethod(
  24925. $core.method({
  24926. selector: "value:",
  24927. protocol: "evaluating",
  24928. args: ["anObject"],
  24929. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  24930. referencedClasses: [],
  24931. pragmas: [],
  24932. messageSends: ["value:", "valuable"]
  24933. }, function ($methodClass){ return function (anObject){
  24934. var self=this,$self=this;
  24935. return $core.withContext(function($ctx1) {
  24936. return $recv($self._valuable())._value_(anObject);
  24937. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  24938. }; }),
  24939. $globals.AnnouncementValuable);
  24940. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  24941. $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' ].";
  24942. $core.addMethod(
  24943. $core.method({
  24944. selector: "announce:",
  24945. protocol: "announcing",
  24946. args: ["anAnnouncement"],
  24947. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  24948. referencedClasses: [],
  24949. pragmas: [],
  24950. messageSends: ["do:", "deliver:"]
  24951. }, function ($methodClass){ return function (anAnnouncement){
  24952. var self=this,$self=this;
  24953. return $core.withContext(function($ctx1) {
  24954. $recv($self.subscriptions)._do_((function(each){
  24955. return $core.withContext(function($ctx2) {
  24956. return $recv(each)._deliver_(anAnnouncement);
  24957. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24958. }));
  24959. return self;
  24960. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement})});
  24961. }; }),
  24962. $globals.Announcer);
  24963. $core.addMethod(
  24964. $core.method({
  24965. selector: "initialize",
  24966. protocol: "initialization",
  24967. args: [],
  24968. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  24969. referencedClasses: ["OrderedCollection"],
  24970. pragmas: [],
  24971. messageSends: ["initialize", "new"]
  24972. }, function ($methodClass){ return function (){
  24973. var self=this,$self=this;
  24974. return $core.withContext(function($ctx1) {
  24975. [(
  24976. $ctx1.supercall = true,
  24977. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  24978. ,$ctx1.supercall = false
  24979. ][0];
  24980. $self.subscriptions=$recv($globals.OrderedCollection)._new();
  24981. return self;
  24982. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  24983. }; }),
  24984. $globals.Announcer);
  24985. $core.addMethod(
  24986. $core.method({
  24987. selector: "on:do:",
  24988. protocol: "subscribing",
  24989. args: ["aClass", "aBlock"],
  24990. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  24991. referencedClasses: [],
  24992. pragmas: [],
  24993. messageSends: ["on:do:for:"]
  24994. }, function ($methodClass){ return function (aClass,aBlock){
  24995. var self=this,$self=this;
  24996. return $core.withContext(function($ctx1) {
  24997. $self._on_do_for_(aClass,aBlock,nil);
  24998. return self;
  24999. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock})});
  25000. }; }),
  25001. $globals.Announcer);
  25002. $core.addMethod(
  25003. $core.method({
  25004. selector: "on:do:for:",
  25005. protocol: "subscribing",
  25006. args: ["aClass", "aBlock", "aReceiver"],
  25007. 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)",
  25008. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  25009. pragmas: [],
  25010. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  25011. }, function ($methodClass){ return function (aClass,aBlock,aReceiver){
  25012. var self=this,$self=this;
  25013. return $core.withContext(function($ctx1) {
  25014. var $1,$2,$3;
  25015. $1=$self.subscriptions;
  25016. $2=[$recv($globals.AnnouncementSubscription)._new()
  25017. ,$ctx1.sendIdx["new"]=1
  25018. ][0];
  25019. $3=$recv($globals.AnnouncementValuable)._new();
  25020. $recv($3)._valuable_(aBlock);
  25021. $recv($3)._receiver_(aReceiver);
  25022. [$recv($2)._valuable_([$recv($3)._yourself()
  25023. ,$ctx1.sendIdx["yourself"]=1
  25024. ][0])
  25025. ,$ctx1.sendIdx["valuable:"]=1
  25026. ][0];
  25027. $recv($2)._announcementClass_(aClass);
  25028. $recv($1)._add_($recv($2)._yourself());
  25029. return self;
  25030. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver})});
  25031. }; }),
  25032. $globals.Announcer);
  25033. $core.addMethod(
  25034. $core.method({
  25035. selector: "on:doOnce:",
  25036. protocol: "subscribing",
  25037. args: ["aClass", "aBlock"],
  25038. 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",
  25039. referencedClasses: ["AnnouncementSubscription"],
  25040. pragmas: [],
  25041. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  25042. }, function ($methodClass){ return function (aClass,aBlock){
  25043. var self=this,$self=this;
  25044. var subscription;
  25045. return $core.withContext(function($ctx1) {
  25046. var $1;
  25047. $1=$recv($globals.AnnouncementSubscription)._new();
  25048. $recv($1)._announcementClass_(aClass);
  25049. subscription=$recv($1)._yourself();
  25050. $recv(subscription)._valuable_((function(ann){
  25051. return $core.withContext(function($ctx2) {
  25052. $recv($self.subscriptions)._remove_(subscription);
  25053. return $recv(aBlock)._value_(ann);
  25054. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  25055. }));
  25056. $recv($self.subscriptions)._add_(subscription);
  25057. return self;
  25058. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription})});
  25059. }; }),
  25060. $globals.Announcer);
  25061. $core.addMethod(
  25062. $core.method({
  25063. selector: "on:send:to:",
  25064. protocol: "subscribing",
  25065. args: ["aClass", "aSelector", "anObject"],
  25066. 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)",
  25067. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  25068. pragmas: [],
  25069. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  25070. }, function ($methodClass){ return function (aClass,aSelector,anObject){
  25071. var self=this,$self=this;
  25072. return $core.withContext(function($ctx1) {
  25073. var $1,$2,$3;
  25074. $1=$self.subscriptions;
  25075. $2=[$recv($globals.AnnouncementSubscription)._new()
  25076. ,$ctx1.sendIdx["new"]=1
  25077. ][0];
  25078. $3=$recv($globals.MessageSend)._new();
  25079. $recv($3)._receiver_(anObject);
  25080. $recv($3)._selector_(aSelector);
  25081. $recv($2)._valuable_([$recv($3)._yourself()
  25082. ,$ctx1.sendIdx["yourself"]=1
  25083. ][0]);
  25084. $recv($2)._announcementClass_(aClass);
  25085. $recv($1)._add_($recv($2)._yourself());
  25086. return self;
  25087. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject})});
  25088. }; }),
  25089. $globals.Announcer);
  25090. $core.addMethod(
  25091. $core.method({
  25092. selector: "unsubscribe:",
  25093. protocol: "subscribing",
  25094. args: ["anObject"],
  25095. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  25096. referencedClasses: [],
  25097. pragmas: [],
  25098. messageSends: ["reject:", "=", "receiver"]
  25099. }, function ($methodClass){ return function (anObject){
  25100. var self=this,$self=this;
  25101. return $core.withContext(function($ctx1) {
  25102. $self.subscriptions=$recv($self.subscriptions)._reject_((function(each){
  25103. return $core.withContext(function($ctx2) {
  25104. return $recv($recv(each)._receiver()).__eq(anObject);
  25105. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25106. }));
  25107. return self;
  25108. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject})});
  25109. }; }),
  25110. $globals.Announcer);
  25111. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  25112. $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`";
  25113. $core.setSlots($globals.SystemAnnouncer.a$cls, ["current"]);
  25114. $core.addMethod(
  25115. $core.method({
  25116. selector: "current",
  25117. protocol: "accessing",
  25118. args: [],
  25119. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  25120. referencedClasses: [],
  25121. pragmas: [],
  25122. messageSends: ["ifNil:", "new"]
  25123. }, function ($methodClass){ return function (){
  25124. var self=this,$self=this;
  25125. return $core.withContext(function($ctx1) {
  25126. var $1;
  25127. $1=$self.current;
  25128. if($1 == null || $1.a$nil){
  25129. $self.current=[(
  25130. $ctx1.supercall = true,
  25131. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._new.call($self))
  25132. ,$ctx1.supercall = false
  25133. ][0];
  25134. return $self.current;
  25135. } else {
  25136. return $1;
  25137. }
  25138. }, function($ctx1) {$ctx1.fill(self,"current",{})});
  25139. }; }),
  25140. $globals.SystemAnnouncer.a$cls);
  25141. $core.addMethod(
  25142. $core.method({
  25143. selector: "new",
  25144. protocol: "instance creation",
  25145. args: [],
  25146. source: "new\x0a\x09self shouldNotImplement",
  25147. referencedClasses: [],
  25148. pragmas: [],
  25149. messageSends: ["shouldNotImplement"]
  25150. }, function ($methodClass){ return function (){
  25151. var self=this,$self=this;
  25152. return $core.withContext(function($ctx1) {
  25153. $self._shouldNotImplement();
  25154. return self;
  25155. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  25156. }; }),
  25157. $globals.SystemAnnouncer.a$cls);
  25158. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  25159. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  25160. $core.addMethod(
  25161. $core.method({
  25162. selector: "classTag",
  25163. protocol: "accessing",
  25164. args: [],
  25165. 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'",
  25166. referencedClasses: [],
  25167. pragmas: [],
  25168. messageSends: []
  25169. }, function ($methodClass){ return function (){
  25170. var self=this,$self=this;
  25171. return "announcement";
  25172. }; }),
  25173. $globals.SystemAnnouncement.a$cls);
  25174. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  25175. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  25176. $core.addMethod(
  25177. $core.method({
  25178. selector: "theClass",
  25179. protocol: "accessing",
  25180. args: [],
  25181. source: "theClass\x0a\x09^ theClass",
  25182. referencedClasses: [],
  25183. pragmas: [],
  25184. messageSends: []
  25185. }, function ($methodClass){ return function (){
  25186. var self=this,$self=this;
  25187. return $self.theClass;
  25188. }; }),
  25189. $globals.ClassAnnouncement);
  25190. $core.addMethod(
  25191. $core.method({
  25192. selector: "theClass:",
  25193. protocol: "accessing",
  25194. args: ["aClass"],
  25195. source: "theClass: aClass\x0a\x09theClass := aClass",
  25196. referencedClasses: [],
  25197. pragmas: [],
  25198. messageSends: []
  25199. }, function ($methodClass){ return function (aClass){
  25200. var self=this,$self=this;
  25201. $self.theClass=aClass;
  25202. return self;
  25203. }; }),
  25204. $globals.ClassAnnouncement);
  25205. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  25206. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  25207. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  25208. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  25209. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  25210. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  25211. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  25212. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  25213. $core.addMethod(
  25214. $core.method({
  25215. selector: "oldClass",
  25216. protocol: "accessing",
  25217. args: [],
  25218. source: "oldClass\x0a\x09^ oldClass",
  25219. referencedClasses: [],
  25220. pragmas: [],
  25221. messageSends: []
  25222. }, function ($methodClass){ return function (){
  25223. var self=this,$self=this;
  25224. return $self.oldClass;
  25225. }; }),
  25226. $globals.ClassMigrated);
  25227. $core.addMethod(
  25228. $core.method({
  25229. selector: "oldClass:",
  25230. protocol: "accessing",
  25231. args: ["aClass"],
  25232. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  25233. referencedClasses: [],
  25234. pragmas: [],
  25235. messageSends: []
  25236. }, function ($methodClass){ return function (aClass){
  25237. var self=this,$self=this;
  25238. $self.oldClass=aClass;
  25239. return self;
  25240. }; }),
  25241. $globals.ClassMigrated);
  25242. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  25243. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  25244. $core.addMethod(
  25245. $core.method({
  25246. selector: "oldPackage",
  25247. protocol: "accessing",
  25248. args: [],
  25249. source: "oldPackage\x0a\x09^ oldPackage",
  25250. referencedClasses: [],
  25251. pragmas: [],
  25252. messageSends: []
  25253. }, function ($methodClass){ return function (){
  25254. var self=this,$self=this;
  25255. return $self.oldPackage;
  25256. }; }),
  25257. $globals.ClassMoved);
  25258. $core.addMethod(
  25259. $core.method({
  25260. selector: "oldPackage:",
  25261. protocol: "accessing",
  25262. args: ["aPackage"],
  25263. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  25264. referencedClasses: [],
  25265. pragmas: [],
  25266. messageSends: []
  25267. }, function ($methodClass){ return function (aPackage){
  25268. var self=this,$self=this;
  25269. $self.oldPackage=aPackage;
  25270. return self;
  25271. }; }),
  25272. $globals.ClassMoved);
  25273. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  25274. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  25275. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  25276. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  25277. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  25278. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  25279. $core.addMethod(
  25280. $core.method({
  25281. selector: "method",
  25282. protocol: "accessing",
  25283. args: [],
  25284. source: "method\x0a\x09^ method",
  25285. referencedClasses: [],
  25286. pragmas: [],
  25287. messageSends: []
  25288. }, function ($methodClass){ return function (){
  25289. var self=this,$self=this;
  25290. return $self.method;
  25291. }; }),
  25292. $globals.MethodAnnouncement);
  25293. $core.addMethod(
  25294. $core.method({
  25295. selector: "method:",
  25296. protocol: "accessing",
  25297. args: ["aCompiledMethod"],
  25298. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  25299. referencedClasses: [],
  25300. pragmas: [],
  25301. messageSends: []
  25302. }, function ($methodClass){ return function (aCompiledMethod){
  25303. var self=this,$self=this;
  25304. $self.method=aCompiledMethod;
  25305. return self;
  25306. }; }),
  25307. $globals.MethodAnnouncement);
  25308. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  25309. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  25310. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  25311. $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.";
  25312. $core.addMethod(
  25313. $core.method({
  25314. selector: "oldMethod",
  25315. protocol: "accessing",
  25316. args: [],
  25317. source: "oldMethod\x0a\x09^ oldMethod",
  25318. referencedClasses: [],
  25319. pragmas: [],
  25320. messageSends: []
  25321. }, function ($methodClass){ return function (){
  25322. var self=this,$self=this;
  25323. return $self.oldMethod;
  25324. }; }),
  25325. $globals.MethodModified);
  25326. $core.addMethod(
  25327. $core.method({
  25328. selector: "oldMethod:",
  25329. protocol: "accessing",
  25330. args: ["aMethod"],
  25331. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  25332. referencedClasses: [],
  25333. pragmas: [],
  25334. messageSends: []
  25335. }, function ($methodClass){ return function (aMethod){
  25336. var self=this,$self=this;
  25337. $self.oldMethod=aMethod;
  25338. return self;
  25339. }; }),
  25340. $globals.MethodModified);
  25341. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  25342. $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.";
  25343. $core.addMethod(
  25344. $core.method({
  25345. selector: "oldProtocol",
  25346. protocol: "accessing",
  25347. args: [],
  25348. source: "oldProtocol\x0a\x09^ oldProtocol",
  25349. referencedClasses: [],
  25350. pragmas: [],
  25351. messageSends: []
  25352. }, function ($methodClass){ return function (){
  25353. var self=this,$self=this;
  25354. return $self.oldProtocol;
  25355. }; }),
  25356. $globals.MethodMoved);
  25357. $core.addMethod(
  25358. $core.method({
  25359. selector: "oldProtocol:",
  25360. protocol: "accessing",
  25361. args: ["aString"],
  25362. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  25363. referencedClasses: [],
  25364. pragmas: [],
  25365. messageSends: []
  25366. }, function ($methodClass){ return function (aString){
  25367. var self=this,$self=this;
  25368. $self.oldProtocol=aString;
  25369. return self;
  25370. }; }),
  25371. $globals.MethodMoved);
  25372. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  25373. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  25374. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  25375. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  25376. $core.addMethod(
  25377. $core.method({
  25378. selector: "package",
  25379. protocol: "accessing",
  25380. args: [],
  25381. source: "package\x0a\x09^ package",
  25382. referencedClasses: [],
  25383. pragmas: [],
  25384. messageSends: []
  25385. }, function ($methodClass){ return function (){
  25386. var self=this,$self=this;
  25387. return $self.package;
  25388. }; }),
  25389. $globals.PackageAnnouncement);
  25390. $core.addMethod(
  25391. $core.method({
  25392. selector: "package:",
  25393. protocol: "accessing",
  25394. args: ["aPackage"],
  25395. source: "package: aPackage\x0a\x09package := aPackage",
  25396. referencedClasses: [],
  25397. pragmas: [],
  25398. messageSends: []
  25399. }, function ($methodClass){ return function (aPackage){
  25400. var self=this,$self=this;
  25401. $self.package=aPackage;
  25402. return self;
  25403. }; }),
  25404. $globals.PackageAnnouncement);
  25405. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25406. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  25407. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25408. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  25409. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25410. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  25411. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25412. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  25413. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  25414. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  25415. $core.addMethod(
  25416. $core.method({
  25417. selector: "package",
  25418. protocol: "accessing",
  25419. args: [],
  25420. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  25421. referencedClasses: [],
  25422. pragmas: [],
  25423. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  25424. }, function ($methodClass){ return function (){
  25425. var self=this,$self=this;
  25426. return $core.withContext(function($ctx1) {
  25427. var $1;
  25428. $1=$self._theClass();
  25429. if($1 == null || $1.a$nil){
  25430. return $1;
  25431. } else {
  25432. var class_;
  25433. class_=$1;
  25434. return $recv(class_)._packageOfProtocol_($self._protocol());
  25435. }
  25436. }, function($ctx1) {$ctx1.fill(self,"package",{})});
  25437. }; }),
  25438. $globals.ProtocolAnnouncement);
  25439. $core.addMethod(
  25440. $core.method({
  25441. selector: "protocol",
  25442. protocol: "accessing",
  25443. args: [],
  25444. source: "protocol\x0a\x09^ protocol",
  25445. referencedClasses: [],
  25446. pragmas: [],
  25447. messageSends: []
  25448. }, function ($methodClass){ return function (){
  25449. var self=this,$self=this;
  25450. return $self.protocol;
  25451. }; }),
  25452. $globals.ProtocolAnnouncement);
  25453. $core.addMethod(
  25454. $core.method({
  25455. selector: "protocol:",
  25456. protocol: "accessing",
  25457. args: ["aString"],
  25458. source: "protocol: aString\x0a\x09protocol := aString",
  25459. referencedClasses: [],
  25460. pragmas: [],
  25461. messageSends: []
  25462. }, function ($methodClass){ return function (aString){
  25463. var self=this,$self=this;
  25464. $self.protocol=aString;
  25465. return self;
  25466. }; }),
  25467. $globals.ProtocolAnnouncement);
  25468. $core.addMethod(
  25469. $core.method({
  25470. selector: "theClass",
  25471. protocol: "accessing",
  25472. args: [],
  25473. source: "theClass\x0a\x09^ theClass",
  25474. referencedClasses: [],
  25475. pragmas: [],
  25476. messageSends: []
  25477. }, function ($methodClass){ return function (){
  25478. var self=this,$self=this;
  25479. return $self.theClass;
  25480. }; }),
  25481. $globals.ProtocolAnnouncement);
  25482. $core.addMethod(
  25483. $core.method({
  25484. selector: "theClass:",
  25485. protocol: "accessing",
  25486. args: ["aClass"],
  25487. source: "theClass: aClass\x0a\x09theClass := aClass",
  25488. referencedClasses: [],
  25489. pragmas: [],
  25490. messageSends: []
  25491. }, function ($methodClass){ return function (aClass){
  25492. var self=this,$self=this;
  25493. $self.theClass=aClass;
  25494. return self;
  25495. }; }),
  25496. $globals.ProtocolAnnouncement);
  25497. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25498. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  25499. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25500. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  25501. });
  25502. define('amber/core/Platform-Services',["amber/boot", "require", "amber/core/Kernel-Collections", "amber/core/Kernel-Infrastructure", "amber/core/Kernel-Methods", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  25503. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  25504. var $pkg = $core.addPackage("Platform-Services");
  25505. $pkg.innerEval = function (expr) { return eval(expr); };
  25506. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  25507. $core.addClass("ConsoleErrorHandler", $globals.Object, [], "Platform-Services");
  25508. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  25509. $core.addMethod(
  25510. $core.method({
  25511. selector: "handleError:",
  25512. protocol: "error handling",
  25513. args: ["anError"],
  25514. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  25515. referencedClasses: [],
  25516. pragmas: [],
  25517. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  25518. }, function ($methodClass){ return function (anError){
  25519. var self=this,$self=this;
  25520. return $core.withContext(function($ctx1) {
  25521. var $1;
  25522. $1=[$recv(anError)._context()
  25523. ,$ctx1.sendIdx["context"]=1
  25524. ][0];
  25525. if($1 == null || $1.a$nil){
  25526. $1;
  25527. } else {
  25528. $self._logErrorContext_($recv(anError)._context());
  25529. }
  25530. $self._logError_(anError);
  25531. return self;
  25532. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError})});
  25533. }; }),
  25534. $globals.ConsoleErrorHandler);
  25535. $core.addMethod(
  25536. $core.method({
  25537. selector: "log:",
  25538. protocol: "private",
  25539. args: ["aString"],
  25540. source: "log: aString\x0a\x09console log: aString",
  25541. referencedClasses: [],
  25542. pragmas: [],
  25543. messageSends: ["log:"]
  25544. }, function ($methodClass){ return function (aString){
  25545. var self=this,$self=this;
  25546. return $core.withContext(function($ctx1) {
  25547. $recv(console)._log_(aString);
  25548. return self;
  25549. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString})});
  25550. }; }),
  25551. $globals.ConsoleErrorHandler);
  25552. $core.addMethod(
  25553. $core.method({
  25554. selector: "logContext:",
  25555. protocol: "private",
  25556. args: ["aContext"],
  25557. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  25558. referencedClasses: [],
  25559. pragmas: [],
  25560. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  25561. }, function ($methodClass){ return function (aContext){
  25562. var self=this,$self=this;
  25563. return $core.withContext(function($ctx1) {
  25564. var $1;
  25565. $1=[$recv(aContext)._home()
  25566. ,$ctx1.sendIdx["home"]=1
  25567. ][0];
  25568. if($1 == null || $1.a$nil){
  25569. $1;
  25570. } else {
  25571. $self._logContext_($recv(aContext)._home());
  25572. }
  25573. $self._log_($recv(aContext)._asString());
  25574. return self;
  25575. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext})});
  25576. }; }),
  25577. $globals.ConsoleErrorHandler);
  25578. $core.addMethod(
  25579. $core.method({
  25580. selector: "logError:",
  25581. protocol: "private",
  25582. args: ["anError"],
  25583. source: "logError: anError\x0a\x09self log: anError messageText",
  25584. referencedClasses: [],
  25585. pragmas: [],
  25586. messageSends: ["log:", "messageText"]
  25587. }, function ($methodClass){ return function (anError){
  25588. var self=this,$self=this;
  25589. return $core.withContext(function($ctx1) {
  25590. $self._log_($recv(anError)._messageText());
  25591. return self;
  25592. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError})});
  25593. }; }),
  25594. $globals.ConsoleErrorHandler);
  25595. $core.addMethod(
  25596. $core.method({
  25597. selector: "logErrorContext:",
  25598. protocol: "private",
  25599. args: ["aContext"],
  25600. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  25601. referencedClasses: [],
  25602. pragmas: [],
  25603. messageSends: ["ifNotNil:", "home", "logContext:"]
  25604. }, function ($methodClass){ return function (aContext){
  25605. var self=this,$self=this;
  25606. return $core.withContext(function($ctx1) {
  25607. var $1;
  25608. if(aContext == null || aContext.a$nil){
  25609. aContext;
  25610. } else {
  25611. $1=[$recv(aContext)._home()
  25612. ,$ctx1.sendIdx["home"]=1
  25613. ][0];
  25614. if($1 == null || $1.a$nil){
  25615. $1;
  25616. } else {
  25617. $self._logContext_($recv(aContext)._home());
  25618. }
  25619. }
  25620. return self;
  25621. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext})});
  25622. }; }),
  25623. $globals.ConsoleErrorHandler);
  25624. $core.setSlots($globals.ConsoleErrorHandler.a$cls, ["current"]);
  25625. $core.addMethod(
  25626. $core.method({
  25627. selector: "initialize",
  25628. protocol: "initialization",
  25629. args: [],
  25630. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  25631. referencedClasses: ["ErrorHandler"],
  25632. pragmas: [],
  25633. messageSends: ["registerIfNone:", "new"]
  25634. }, function ($methodClass){ return function (){
  25635. var self=this,$self=this;
  25636. return $core.withContext(function($ctx1) {
  25637. $recv($globals.ErrorHandler)._registerIfNone_($self._new());
  25638. return self;
  25639. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  25640. }; }),
  25641. $globals.ConsoleErrorHandler.a$cls);
  25642. $core.addClass("ConsoleTranscript", $globals.Object, ["textarea"], "Platform-Services");
  25643. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  25644. $core.addMethod(
  25645. $core.method({
  25646. selector: "clear",
  25647. protocol: "printing",
  25648. args: [],
  25649. source: "clear\x0a\x09\x22no op\x22",
  25650. referencedClasses: [],
  25651. pragmas: [],
  25652. messageSends: []
  25653. }, function ($methodClass){ return function (){
  25654. var self=this,$self=this;
  25655. return self;
  25656. }; }),
  25657. $globals.ConsoleTranscript);
  25658. $core.addMethod(
  25659. $core.method({
  25660. selector: "cr",
  25661. protocol: "printing",
  25662. args: [],
  25663. source: "cr\x0a\x09\x22no op\x22",
  25664. referencedClasses: [],
  25665. pragmas: [],
  25666. messageSends: []
  25667. }, function ($methodClass){ return function (){
  25668. var self=this,$self=this;
  25669. return self;
  25670. }; }),
  25671. $globals.ConsoleTranscript);
  25672. $core.addMethod(
  25673. $core.method({
  25674. selector: "open",
  25675. protocol: "actions",
  25676. args: [],
  25677. source: "open",
  25678. referencedClasses: [],
  25679. pragmas: [],
  25680. messageSends: []
  25681. }, function ($methodClass){ return function (){
  25682. var self=this,$self=this;
  25683. return self;
  25684. }; }),
  25685. $globals.ConsoleTranscript);
  25686. $core.addMethod(
  25687. $core.method({
  25688. selector: "show:",
  25689. protocol: "printing",
  25690. args: ["anObject"],
  25691. 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()))'>",
  25692. referencedClasses: [],
  25693. pragmas: [["inlineJS:", ["console.log(String($recv(anObject)._asString()))"]]],
  25694. messageSends: []
  25695. }, function ($methodClass){ return function (anObject){
  25696. var self=this,$self=this;
  25697. return $core.withContext(function($ctx1) {
  25698. console.log(String($recv(anObject)._asString()));
  25699. return self;
  25700. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject})});
  25701. }; }),
  25702. $globals.ConsoleTranscript);
  25703. $core.addMethod(
  25704. $core.method({
  25705. selector: "initialize",
  25706. protocol: "initialization",
  25707. args: [],
  25708. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  25709. referencedClasses: ["Transcript"],
  25710. pragmas: [],
  25711. messageSends: ["registerIfNone:", "new"]
  25712. }, function ($methodClass){ return function (){
  25713. var self=this,$self=this;
  25714. return $core.withContext(function($ctx1) {
  25715. $recv($globals.Transcript)._registerIfNone_($self._new());
  25716. return self;
  25717. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  25718. }; }),
  25719. $globals.ConsoleTranscript.a$cls);
  25720. $core.addClass("Environment", $globals.Object, [], "Platform-Services");
  25721. $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.";
  25722. $core.addMethod(
  25723. $core.method({
  25724. selector: "addInstVarNamed:to:",
  25725. protocol: "compiling",
  25726. args: ["aString", "aClass"],
  25727. source: "addInstVarNamed: aString to: aClass\x0a\x09| newInstVars |\x0a\x09newInstVars := aClass instanceVariableNames copyWith: aString.\x0a\x0a\x09aClass isMetaclass\x0a\x09\x09ifTrue: [ self classBuilder\x0a\x09\x09\x09class: aClass slots: newInstVars ]\x0a\x09\x09ifFalse: [ self classBuilder\x0a\x09\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09\x09named: aClass name \x0a\x09\x09\x09instanceVariableNames: newInstVars\x0a\x09\x09\x09package: aClass package name ]",
  25728. referencedClasses: [],
  25729. pragmas: [],
  25730. messageSends: ["copyWith:", "instanceVariableNames", "ifTrue:ifFalse:", "isMetaclass", "class:slots:", "classBuilder", "addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "package"]
  25731. }, function ($methodClass){ return function (aString,aClass){
  25732. var self=this,$self=this;
  25733. var newInstVars;
  25734. return $core.withContext(function($ctx1) {
  25735. newInstVars=$recv($recv(aClass)._instanceVariableNames())._copyWith_(aString);
  25736. if($core.assert($recv(aClass)._isMetaclass())){
  25737. $recv([$self._classBuilder()
  25738. ,$ctx1.sendIdx["classBuilder"]=1
  25739. ][0])._class_slots_(aClass,newInstVars);
  25740. } else {
  25741. $recv($self._classBuilder())._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),[$recv(aClass)._name()
  25742. ,$ctx1.sendIdx["name"]=1
  25743. ][0],newInstVars,$recv($recv(aClass)._package())._name());
  25744. }
  25745. return self;
  25746. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass,newInstVars:newInstVars})});
  25747. }; }),
  25748. $globals.Environment);
  25749. $core.addMethod(
  25750. $core.method({
  25751. selector: "allSelectors",
  25752. protocol: "accessing",
  25753. args: [],
  25754. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  25755. referencedClasses: ["Smalltalk"],
  25756. pragmas: [],
  25757. messageSends: ["allSelectors", "core"]
  25758. }, function ($methodClass){ return function (){
  25759. var self=this,$self=this;
  25760. return $core.withContext(function($ctx1) {
  25761. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  25762. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{})});
  25763. }; }),
  25764. $globals.Environment);
  25765. $core.addMethod(
  25766. $core.method({
  25767. selector: "availableClassNames",
  25768. protocol: "accessing",
  25769. args: [],
  25770. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  25771. referencedClasses: ["Smalltalk"],
  25772. pragmas: [],
  25773. messageSends: ["collect:", "classes", "name"]
  25774. }, function ($methodClass){ return function (){
  25775. var self=this,$self=this;
  25776. return $core.withContext(function($ctx1) {
  25777. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  25778. return $core.withContext(function($ctx2) {
  25779. return $recv(each)._name();
  25780. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25781. }));
  25782. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{})});
  25783. }; }),
  25784. $globals.Environment);
  25785. $core.addMethod(
  25786. $core.method({
  25787. selector: "availablePackageNames",
  25788. protocol: "accessing",
  25789. args: [],
  25790. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  25791. referencedClasses: ["Smalltalk"],
  25792. pragmas: [],
  25793. messageSends: ["collect:", "packages", "name"]
  25794. }, function ($methodClass){ return function (){
  25795. var self=this,$self=this;
  25796. return $core.withContext(function($ctx1) {
  25797. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  25798. return $core.withContext(function($ctx2) {
  25799. return $recv(each)._name();
  25800. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25801. }));
  25802. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{})});
  25803. }; }),
  25804. $globals.Environment);
  25805. $core.addMethod(
  25806. $core.method({
  25807. selector: "availableProtocolsFor:",
  25808. protocol: "accessing",
  25809. args: ["aClass"],
  25810. 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",
  25811. referencedClasses: [],
  25812. pragmas: [],
  25813. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  25814. }, function ($methodClass){ return function (aClass){
  25815. var self=this,$self=this;
  25816. var protocols;
  25817. return $core.withContext(function($ctx1) {
  25818. var $1;
  25819. protocols=$recv(aClass)._protocols();
  25820. $1=[$recv(aClass)._superclass()
  25821. ,$ctx1.sendIdx["superclass"]=1
  25822. ][0];
  25823. if($1 == null || $1.a$nil){
  25824. $1;
  25825. } else {
  25826. $recv(protocols)._addAll_($self._availableProtocolsFor_($recv(aClass)._superclass()));
  25827. }
  25828. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  25829. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols})});
  25830. }; }),
  25831. $globals.Environment);
  25832. $core.addMethod(
  25833. $core.method({
  25834. selector: "classBuilder",
  25835. protocol: "accessing",
  25836. args: [],
  25837. source: "classBuilder\x0a\x09^ ClassBuilder new",
  25838. referencedClasses: ["ClassBuilder"],
  25839. pragmas: [],
  25840. messageSends: ["new"]
  25841. }, function ($methodClass){ return function (){
  25842. var self=this,$self=this;
  25843. return $core.withContext(function($ctx1) {
  25844. return $recv($globals.ClassBuilder)._new();
  25845. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{})});
  25846. }; }),
  25847. $globals.Environment);
  25848. $core.addMethod(
  25849. $core.method({
  25850. selector: "classNamed:",
  25851. protocol: "accessing",
  25852. args: ["aString"],
  25853. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  25854. referencedClasses: ["Smalltalk"],
  25855. pragmas: [],
  25856. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  25857. }, function ($methodClass){ return function (aString){
  25858. var self=this,$self=this;
  25859. return $core.withContext(function($ctx1) {
  25860. var $1;
  25861. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  25862. if($1 == null || $1.a$nil){
  25863. return $self._error_("Invalid class name");
  25864. } else {
  25865. return $1;
  25866. }
  25867. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString})});
  25868. }; }),
  25869. $globals.Environment);
  25870. $core.addMethod(
  25871. $core.method({
  25872. selector: "classes",
  25873. protocol: "accessing",
  25874. args: [],
  25875. source: "classes\x0a\x09^ Smalltalk classes",
  25876. referencedClasses: ["Smalltalk"],
  25877. pragmas: [],
  25878. messageSends: ["classes"]
  25879. }, function ($methodClass){ return function (){
  25880. var self=this,$self=this;
  25881. return $core.withContext(function($ctx1) {
  25882. return $recv($globals.Smalltalk)._classes();
  25883. }, function($ctx1) {$ctx1.fill(self,"classes",{})});
  25884. }; }),
  25885. $globals.Environment);
  25886. $core.addMethod(
  25887. $core.method({
  25888. selector: "commitPackage:onSuccess:onError:",
  25889. protocol: "actions",
  25890. args: ["aPackage", "aBlock", "anotherBlock"],
  25891. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  25892. referencedClasses: [],
  25893. pragmas: [],
  25894. messageSends: ["commitOnSuccess:onError:", "transport"]
  25895. }, function ($methodClass){ return function (aPackage,aBlock,anotherBlock){
  25896. var self=this,$self=this;
  25897. return $core.withContext(function($ctx1) {
  25898. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  25899. return self;
  25900. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock})});
  25901. }; }),
  25902. $globals.Environment);
  25903. $core.addMethod(
  25904. $core.method({
  25905. selector: "compileClassComment:for:",
  25906. protocol: "compiling",
  25907. args: ["aString", "aClass"],
  25908. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  25909. referencedClasses: [],
  25910. pragmas: [],
  25911. messageSends: ["comment:"]
  25912. }, function ($methodClass){ return function (aString,aClass){
  25913. var self=this,$self=this;
  25914. return $core.withContext(function($ctx1) {
  25915. $recv(aClass)._comment_(aString);
  25916. return self;
  25917. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass})});
  25918. }; }),
  25919. $globals.Environment);
  25920. $core.addMethod(
  25921. $core.method({
  25922. selector: "compileClassDefinition:",
  25923. protocol: "compiling",
  25924. args: ["aString"],
  25925. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  25926. referencedClasses: ["DoIt", "Error", "Terminal"],
  25927. pragmas: [],
  25928. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  25929. }, function ($methodClass){ return function (aString){
  25930. var self=this,$self=this;
  25931. return $core.withContext(function($ctx1) {
  25932. $recv((function(){
  25933. return $core.withContext(function($ctx2) {
  25934. return $self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  25935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  25936. }))._on_do_($globals.Error,(function(error){
  25937. return $core.withContext(function($ctx2) {
  25938. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  25939. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  25940. }));
  25941. return self;
  25942. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString})});
  25943. }; }),
  25944. $globals.Environment);
  25945. $core.addMethod(
  25946. $core.method({
  25947. selector: "compileMethod:for:protocol:",
  25948. protocol: "compiling",
  25949. args: ["sourceCode", "class", "protocol"],
  25950. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  25951. referencedClasses: [],
  25952. pragmas: [],
  25953. messageSends: ["compile:protocol:"]
  25954. }, function ($methodClass){ return function (sourceCode,class_,protocol){
  25955. var self=this,$self=this;
  25956. return $core.withContext(function($ctx1) {
  25957. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  25958. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol})});
  25959. }; }),
  25960. $globals.Environment);
  25961. $core.addMethod(
  25962. $core.method({
  25963. selector: "copyClass:to:",
  25964. protocol: "actions",
  25965. args: ["aClass", "aClassName"],
  25966. 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",
  25967. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25968. pragmas: [],
  25969. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  25970. }, function ($methodClass){ return function (aClass,aClassName){
  25971. var self=this,$self=this;
  25972. return $core.withContext(function($ctx1) {
  25973. var $1;
  25974. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25975. if($1 == null || $1.a$nil){
  25976. $1;
  25977. } else {
  25978. $self._error_([$recv("A class named ".__comma(aClassName)).__comma(" already exists")
  25979. ,$ctx1.sendIdx[","]=1
  25980. ][0]);
  25981. }
  25982. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  25983. return self;
  25984. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName})});
  25985. }; }),
  25986. $globals.Environment);
  25987. $core.addMethod(
  25988. $core.method({
  25989. selector: "doItReceiver",
  25990. protocol: "accessing",
  25991. args: [],
  25992. source: "doItReceiver\x0a\x09^ DoIt new",
  25993. referencedClasses: ["DoIt"],
  25994. pragmas: [],
  25995. messageSends: ["new"]
  25996. }, function ($methodClass){ return function (){
  25997. var self=this,$self=this;
  25998. return $core.withContext(function($ctx1) {
  25999. return $recv($globals.DoIt)._new();
  26000. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{})});
  26001. }; }),
  26002. $globals.Environment);
  26003. $core.addMethod(
  26004. $core.method({
  26005. selector: "evaluate:for:",
  26006. protocol: "evaluating",
  26007. args: ["aString", "anObject"],
  26008. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  26009. referencedClasses: ["Evaluator"],
  26010. pragmas: [],
  26011. messageSends: ["evaluate:for:"]
  26012. }, function ($methodClass){ return function (aString,anObject){
  26013. var self=this,$self=this;
  26014. return $core.withContext(function($ctx1) {
  26015. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  26016. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject})});
  26017. }; }),
  26018. $globals.Environment);
  26019. $core.addMethod(
  26020. $core.method({
  26021. selector: "evaluate:on:do:",
  26022. protocol: "error handling",
  26023. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  26024. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09^ aBlock on: (self classNamed: anErrorClass name) do: exceptionBlock",
  26025. referencedClasses: [],
  26026. pragmas: [],
  26027. messageSends: ["on:do:", "classNamed:", "name"]
  26028. }, function ($methodClass){ return function (aBlock,anErrorClass,exceptionBlock){
  26029. var self=this,$self=this;
  26030. return $core.withContext(function($ctx1) {
  26031. return $recv(aBlock)._on_do_($self._classNamed_($recv(anErrorClass)._name()),exceptionBlock);
  26032. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock})});
  26033. }; }),
  26034. $globals.Environment);
  26035. $core.addMethod(
  26036. $core.method({
  26037. selector: "inspect:",
  26038. protocol: "actions",
  26039. args: ["anObject"],
  26040. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  26041. referencedClasses: ["Inspector"],
  26042. pragmas: [],
  26043. messageSends: ["inspect:"]
  26044. }, function ($methodClass){ return function (anObject){
  26045. var self=this,$self=this;
  26046. return $core.withContext(function($ctx1) {
  26047. $recv($globals.Inspector)._inspect_(anObject);
  26048. return self;
  26049. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject})});
  26050. }; }),
  26051. $globals.Environment);
  26052. $core.addMethod(
  26053. $core.method({
  26054. selector: "moveClass:toPackage:",
  26055. protocol: "actions",
  26056. args: ["aClass", "aPackageName"],
  26057. 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",
  26058. referencedClasses: ["Package"],
  26059. pragmas: [],
  26060. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:", "recompile"]
  26061. }, function ($methodClass){ return function (aClass,aPackageName){
  26062. var self=this,$self=this;
  26063. var package_;
  26064. return $core.withContext(function($ctx1) {
  26065. var $1;
  26066. package_=$recv($globals.Package)._named_(aPackageName);
  26067. $1=package_;
  26068. if($1 == null || $1.a$nil){
  26069. $self._error_("Invalid package name");
  26070. } else {
  26071. $1;
  26072. }
  26073. if($core.assert($recv(package_).__eq_eq($recv(aClass)._package()))){
  26074. return self;
  26075. }
  26076. $recv(aClass)._package_(package_);
  26077. $recv(aClass)._recompile();
  26078. return self;
  26079. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_})});
  26080. }; }),
  26081. $globals.Environment);
  26082. $core.addMethod(
  26083. $core.method({
  26084. selector: "moveMethod:toClass:",
  26085. protocol: "actions",
  26086. args: ["aMethod", "aClassName"],
  26087. source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := self classNamed: aClassName.\x0a\x09destinationClass == aMethod origin ifTrue: [ ^ self ].\x0a\x09\x0a\x09aMethod origin isMetaclass ifTrue: [ \x0a\x09\x09destinationClass := destinationClass theMetaClass ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol.\x0a\x09aMethod origin \x0a\x09\x09removeCompiledMethod: aMethod",
  26088. referencedClasses: [],
  26089. pragmas: [],
  26090. messageSends: ["classNamed:", "ifTrue:", "==", "origin", "isMetaclass", "theMetaClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  26091. }, function ($methodClass){ return function (aMethod,aClassName){
  26092. var self=this,$self=this;
  26093. var destinationClass;
  26094. return $core.withContext(function($ctx1) {
  26095. destinationClass=$self._classNamed_(aClassName);
  26096. if($core.assert($recv(destinationClass).__eq_eq([$recv(aMethod)._origin()
  26097. ,$ctx1.sendIdx["origin"]=1
  26098. ][0]))){
  26099. return self;
  26100. }
  26101. if($core.assert($recv([$recv(aMethod)._origin()
  26102. ,$ctx1.sendIdx["origin"]=2
  26103. ][0])._isMetaclass())){
  26104. destinationClass=$recv(destinationClass)._theMetaClass();
  26105. destinationClass;
  26106. }
  26107. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  26108. $recv($recv(aMethod)._origin())._removeCompiledMethod_(aMethod);
  26109. return self;
  26110. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass})});
  26111. }; }),
  26112. $globals.Environment);
  26113. $core.addMethod(
  26114. $core.method({
  26115. selector: "moveMethod:toProtocol:",
  26116. protocol: "actions",
  26117. args: ["aMethod", "aProtocol"],
  26118. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol.\x0a\x0a\x09aMethod origin\x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol",
  26119. referencedClasses: [],
  26120. pragmas: [],
  26121. messageSends: ["protocol:", "compile:protocol:", "origin", "source", "protocol"]
  26122. }, function ($methodClass){ return function (aMethod,aProtocol){
  26123. var self=this,$self=this;
  26124. return $core.withContext(function($ctx1) {
  26125. $recv(aMethod)._protocol_(aProtocol);
  26126. $recv($recv(aMethod)._origin())._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  26127. return self;
  26128. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol})});
  26129. }; }),
  26130. $globals.Environment);
  26131. $core.addMethod(
  26132. $core.method({
  26133. selector: "packages",
  26134. protocol: "accessing",
  26135. args: [],
  26136. source: "packages\x0a\x09^ Smalltalk packages",
  26137. referencedClasses: ["Smalltalk"],
  26138. pragmas: [],
  26139. messageSends: ["packages"]
  26140. }, function ($methodClass){ return function (){
  26141. var self=this,$self=this;
  26142. return $core.withContext(function($ctx1) {
  26143. return $recv($globals.Smalltalk)._packages();
  26144. }, function($ctx1) {$ctx1.fill(self,"packages",{})});
  26145. }; }),
  26146. $globals.Environment);
  26147. $core.addMethod(
  26148. $core.method({
  26149. selector: "registerErrorHandler:",
  26150. protocol: "services",
  26151. args: ["anErrorHandler"],
  26152. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  26153. referencedClasses: ["ErrorHandler"],
  26154. pragmas: [],
  26155. messageSends: ["register:"]
  26156. }, function ($methodClass){ return function (anErrorHandler){
  26157. var self=this,$self=this;
  26158. return $core.withContext(function($ctx1) {
  26159. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  26160. return self;
  26161. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler})});
  26162. }; }),
  26163. $globals.Environment);
  26164. $core.addMethod(
  26165. $core.method({
  26166. selector: "registerFinder:",
  26167. protocol: "services",
  26168. args: ["aFinder"],
  26169. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  26170. referencedClasses: ["Finder"],
  26171. pragmas: [],
  26172. messageSends: ["register:"]
  26173. }, function ($methodClass){ return function (aFinder){
  26174. var self=this,$self=this;
  26175. return $core.withContext(function($ctx1) {
  26176. $recv($globals.Finder)._register_(aFinder);
  26177. return self;
  26178. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder})});
  26179. }; }),
  26180. $globals.Environment);
  26181. $core.addMethod(
  26182. $core.method({
  26183. selector: "registerInspector:",
  26184. protocol: "services",
  26185. args: ["anInspector"],
  26186. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  26187. referencedClasses: ["Inspector"],
  26188. pragmas: [],
  26189. messageSends: ["register:"]
  26190. }, function ($methodClass){ return function (anInspector){
  26191. var self=this,$self=this;
  26192. return $core.withContext(function($ctx1) {
  26193. $recv($globals.Inspector)._register_(anInspector);
  26194. return self;
  26195. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector})});
  26196. }; }),
  26197. $globals.Environment);
  26198. $core.addMethod(
  26199. $core.method({
  26200. selector: "registerProgressHandler:",
  26201. protocol: "services",
  26202. args: ["aProgressHandler"],
  26203. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  26204. referencedClasses: ["ProgressHandler"],
  26205. pragmas: [],
  26206. messageSends: ["register:"]
  26207. }, function ($methodClass){ return function (aProgressHandler){
  26208. var self=this,$self=this;
  26209. return $core.withContext(function($ctx1) {
  26210. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  26211. return self;
  26212. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler})});
  26213. }; }),
  26214. $globals.Environment);
  26215. $core.addMethod(
  26216. $core.method({
  26217. selector: "registerTranscript:",
  26218. protocol: "services",
  26219. args: ["aTranscript"],
  26220. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  26221. referencedClasses: ["Transcript"],
  26222. pragmas: [],
  26223. messageSends: ["register:"]
  26224. }, function ($methodClass){ return function (aTranscript){
  26225. var self=this,$self=this;
  26226. return $core.withContext(function($ctx1) {
  26227. $recv($globals.Transcript)._register_(aTranscript);
  26228. return self;
  26229. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript})});
  26230. }; }),
  26231. $globals.Environment);
  26232. $core.addMethod(
  26233. $core.method({
  26234. selector: "removeClass:",
  26235. protocol: "actions",
  26236. args: ["aClass"],
  26237. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  26238. referencedClasses: ["Smalltalk"],
  26239. pragmas: [],
  26240. messageSends: ["removeClass:"]
  26241. }, function ($methodClass){ return function (aClass){
  26242. var self=this,$self=this;
  26243. return $core.withContext(function($ctx1) {
  26244. $recv($globals.Smalltalk)._removeClass_(aClass);
  26245. return self;
  26246. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass})});
  26247. }; }),
  26248. $globals.Environment);
  26249. $core.addMethod(
  26250. $core.method({
  26251. selector: "removeMethod:",
  26252. protocol: "actions",
  26253. args: ["aMethod"],
  26254. source: "removeMethod: aMethod\x0a\x09aMethod origin removeCompiledMethod: aMethod",
  26255. referencedClasses: [],
  26256. pragmas: [],
  26257. messageSends: ["removeCompiledMethod:", "origin"]
  26258. }, function ($methodClass){ return function (aMethod){
  26259. var self=this,$self=this;
  26260. return $core.withContext(function($ctx1) {
  26261. $recv($recv(aMethod)._origin())._removeCompiledMethod_(aMethod);
  26262. return self;
  26263. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod})});
  26264. }; }),
  26265. $globals.Environment);
  26266. $core.addMethod(
  26267. $core.method({
  26268. selector: "removeProtocol:from:",
  26269. protocol: "actions",
  26270. args: ["aString", "aClass"],
  26271. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  26272. referencedClasses: [],
  26273. pragmas: [],
  26274. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  26275. }, function ($methodClass){ return function (aString,aClass){
  26276. var self=this,$self=this;
  26277. return $core.withContext(function($ctx1) {
  26278. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  26279. return $core.withContext(function($ctx2) {
  26280. return $recv(aClass)._removeCompiledMethod_(each);
  26281. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26282. }));
  26283. return self;
  26284. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass})});
  26285. }; }),
  26286. $globals.Environment);
  26287. $core.addMethod(
  26288. $core.method({
  26289. selector: "renameClass:to:",
  26290. protocol: "actions",
  26291. args: ["aClass", "aClassName"],
  26292. 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",
  26293. referencedClasses: ["Smalltalk", "ClassBuilder"],
  26294. pragmas: [],
  26295. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  26296. }, function ($methodClass){ return function (aClass,aClassName){
  26297. var self=this,$self=this;
  26298. return $core.withContext(function($ctx1) {
  26299. var $1;
  26300. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  26301. if($1 == null || $1.a$nil){
  26302. $1;
  26303. } else {
  26304. $self._error_([$recv("A class named ".__comma(aClassName)).__comma(" already exists")
  26305. ,$ctx1.sendIdx[","]=1
  26306. ][0]);
  26307. }
  26308. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  26309. return self;
  26310. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName})});
  26311. }; }),
  26312. $globals.Environment);
  26313. $core.addMethod(
  26314. $core.method({
  26315. selector: "renamePackage:to:",
  26316. protocol: "actions",
  26317. args: ["aPackageName", "aNewPackageName"],
  26318. source: "renamePackage: aPackageName to: aNewPackageName\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  26319. referencedClasses: ["Smalltalk"],
  26320. pragmas: [],
  26321. messageSends: ["renamePackage:to:"]
  26322. }, function ($methodClass){ return function (aPackageName,aNewPackageName){
  26323. var self=this,$self=this;
  26324. return $core.withContext(function($ctx1) {
  26325. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  26326. return self;
  26327. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName})});
  26328. }; }),
  26329. $globals.Environment);
  26330. $core.addMethod(
  26331. $core.method({
  26332. selector: "renameProtocol:to:in:",
  26333. protocol: "actions",
  26334. args: ["aString", "anotherString", "aClass"],
  26335. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  26336. referencedClasses: [],
  26337. pragmas: [],
  26338. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  26339. }, function ($methodClass){ return function (aString,anotherString,aClass){
  26340. var self=this,$self=this;
  26341. return $core.withContext(function($ctx1) {
  26342. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  26343. return $core.withContext(function($ctx2) {
  26344. return $recv(each)._protocol_(anotherString);
  26345. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26346. }));
  26347. return self;
  26348. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass})});
  26349. }; }),
  26350. $globals.Environment);
  26351. $core.addMethod(
  26352. $core.method({
  26353. selector: "setClassCommentOf:to:",
  26354. protocol: "actions",
  26355. args: ["aClass", "aString"],
  26356. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  26357. referencedClasses: [],
  26358. pragmas: [],
  26359. messageSends: ["comment:"]
  26360. }, function ($methodClass){ return function (aClass,aString){
  26361. var self=this,$self=this;
  26362. return $core.withContext(function($ctx1) {
  26363. $recv(aClass)._comment_(aString);
  26364. return self;
  26365. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString})});
  26366. }; }),
  26367. $globals.Environment);
  26368. $core.addMethod(
  26369. $core.method({
  26370. selector: "systemAnnouncer",
  26371. protocol: "accessing",
  26372. args: [],
  26373. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  26374. referencedClasses: ["Smalltalk"],
  26375. pragmas: [],
  26376. messageSends: ["current", "at:", "globals"]
  26377. }, function ($methodClass){ return function (){
  26378. var self=this,$self=this;
  26379. return $core.withContext(function($ctx1) {
  26380. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  26381. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{})});
  26382. }; }),
  26383. $globals.Environment);
  26384. $core.addClass("NullProgressHandler", $globals.Object, [], "Platform-Services");
  26385. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  26386. $core.addMethod(
  26387. $core.method({
  26388. selector: "do:on:displaying:",
  26389. protocol: "progress handling",
  26390. args: ["aBlock", "aCollection", "aString"],
  26391. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  26392. referencedClasses: [],
  26393. pragmas: [],
  26394. messageSends: ["do:"]
  26395. }, function ($methodClass){ return function (aBlock,aCollection,aString){
  26396. var self=this,$self=this;
  26397. return $core.withContext(function($ctx1) {
  26398. $recv(aCollection)._do_(aBlock);
  26399. return self;
  26400. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString})});
  26401. }; }),
  26402. $globals.NullProgressHandler);
  26403. $core.setSlots($globals.NullProgressHandler.a$cls, ["current"]);
  26404. $core.addMethod(
  26405. $core.method({
  26406. selector: "initialize",
  26407. protocol: "initialization",
  26408. args: [],
  26409. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  26410. referencedClasses: ["ProgressHandler"],
  26411. pragmas: [],
  26412. messageSends: ["registerIfNone:", "new"]
  26413. }, function ($methodClass){ return function (){
  26414. var self=this,$self=this;
  26415. return $core.withContext(function($ctx1) {
  26416. $recv($globals.ProgressHandler)._registerIfNone_($self._new());
  26417. return self;
  26418. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  26419. }; }),
  26420. $globals.NullProgressHandler.a$cls);
  26421. $core.addClass("Service", $globals.Object, [], "Platform-Services");
  26422. $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.";
  26423. $core.setSlots($globals.Service.a$cls, ["current"]);
  26424. $core.addMethod(
  26425. $core.method({
  26426. selector: "current",
  26427. protocol: "accessing",
  26428. args: [],
  26429. source: "current\x0a\x09^ current",
  26430. referencedClasses: [],
  26431. pragmas: [],
  26432. messageSends: []
  26433. }, function ($methodClass){ return function (){
  26434. var self=this,$self=this;
  26435. return $self.current;
  26436. }; }),
  26437. $globals.Service.a$cls);
  26438. $core.addMethod(
  26439. $core.method({
  26440. selector: "new",
  26441. protocol: "instance creation",
  26442. args: [],
  26443. source: "new\x0a\x09self shouldNotImplement",
  26444. referencedClasses: [],
  26445. pragmas: [],
  26446. messageSends: ["shouldNotImplement"]
  26447. }, function ($methodClass){ return function (){
  26448. var self=this,$self=this;
  26449. return $core.withContext(function($ctx1) {
  26450. $self._shouldNotImplement();
  26451. return self;
  26452. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  26453. }; }),
  26454. $globals.Service.a$cls);
  26455. $core.addMethod(
  26456. $core.method({
  26457. selector: "register:",
  26458. protocol: "registration",
  26459. args: ["anObject"],
  26460. source: "register: anObject\x0a\x09current := anObject",
  26461. referencedClasses: [],
  26462. pragmas: [],
  26463. messageSends: []
  26464. }, function ($methodClass){ return function (anObject){
  26465. var self=this,$self=this;
  26466. $self.current=anObject;
  26467. return self;
  26468. }; }),
  26469. $globals.Service.a$cls);
  26470. $core.addMethod(
  26471. $core.method({
  26472. selector: "registerIfNone:",
  26473. protocol: "registration",
  26474. args: ["anObject"],
  26475. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  26476. referencedClasses: [],
  26477. pragmas: [],
  26478. messageSends: ["ifNil:", "current", "register:"]
  26479. }, function ($methodClass){ return function (anObject){
  26480. var self=this,$self=this;
  26481. return $core.withContext(function($ctx1) {
  26482. var $1;
  26483. $1=$self._current();
  26484. if($1 == null || $1.a$nil){
  26485. $self._register_(anObject);
  26486. } else {
  26487. $1;
  26488. }
  26489. return self;
  26490. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject})});
  26491. }; }),
  26492. $globals.Service.a$cls);
  26493. $core.addClass("ErrorHandler", $globals.Service, [], "Platform-Services");
  26494. $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.";
  26495. $core.addMethod(
  26496. $core.method({
  26497. selector: "handleError:",
  26498. protocol: "error handling",
  26499. args: ["anError"],
  26500. source: "handleError: anError\x0a\x09| smalltalkError |\x0a\x09smalltalkError := Smalltalk asSmalltalkException: anError.\x0a\x09smalltalkError context ifNil: [ smalltalkError context: thisContext ].\x0a\x09self handleUnhandledError: smalltalkError",
  26501. referencedClasses: ["Smalltalk"],
  26502. pragmas: [],
  26503. messageSends: ["asSmalltalkException:", "ifNil:", "context", "context:", "handleUnhandledError:"]
  26504. }, function ($methodClass){ return function (anError){
  26505. var self=this,$self=this;
  26506. var smalltalkError;
  26507. return $core.withContext(function($ctx1) {
  26508. var $1;
  26509. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(anError);
  26510. $1=$recv(smalltalkError)._context();
  26511. if($1 == null || $1.a$nil){
  26512. $recv(smalltalkError)._context_($core.getThisContext());
  26513. } else {
  26514. $1;
  26515. }
  26516. $self._handleUnhandledError_(smalltalkError);
  26517. return self;
  26518. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError,smalltalkError:smalltalkError})});
  26519. }; }),
  26520. $globals.ErrorHandler.a$cls);
  26521. $core.addMethod(
  26522. $core.method({
  26523. selector: "handleUnhandledError:",
  26524. protocol: "error handling",
  26525. args: ["anError"],
  26526. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifFalse: [\x0a\x09\x09self current handleError: anError.\x0a\x09\x09anError beHandled ]",
  26527. referencedClasses: [],
  26528. pragmas: [],
  26529. messageSends: ["ifFalse:", "wasHandled", "handleError:", "current", "beHandled"]
  26530. }, function ($methodClass){ return function (anError){
  26531. var self=this,$self=this;
  26532. return $core.withContext(function($ctx1) {
  26533. if(!$core.assert($recv(anError)._wasHandled())){
  26534. $recv($self._current())._handleError_(anError);
  26535. $recv(anError)._beHandled();
  26536. }
  26537. return self;
  26538. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError})});
  26539. }; }),
  26540. $globals.ErrorHandler.a$cls);
  26541. $core.addClass("Finder", $globals.Service, [], "Platform-Services");
  26542. $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.";
  26543. $core.addMethod(
  26544. $core.method({
  26545. selector: "findClass:",
  26546. protocol: "finding",
  26547. args: ["aClass"],
  26548. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  26549. referencedClasses: [],
  26550. pragmas: [],
  26551. messageSends: ["findClass:", "current"]
  26552. }, function ($methodClass){ return function (aClass){
  26553. var self=this,$self=this;
  26554. return $core.withContext(function($ctx1) {
  26555. return $recv($self._current())._findClass_(aClass);
  26556. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass})});
  26557. }; }),
  26558. $globals.Finder.a$cls);
  26559. $core.addMethod(
  26560. $core.method({
  26561. selector: "findMethod:",
  26562. protocol: "finding",
  26563. args: ["aCompiledMethod"],
  26564. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  26565. referencedClasses: [],
  26566. pragmas: [],
  26567. messageSends: ["findMethod:", "current"]
  26568. }, function ($methodClass){ return function (aCompiledMethod){
  26569. var self=this,$self=this;
  26570. return $core.withContext(function($ctx1) {
  26571. return $recv($self._current())._findMethod_(aCompiledMethod);
  26572. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod})});
  26573. }; }),
  26574. $globals.Finder.a$cls);
  26575. $core.addMethod(
  26576. $core.method({
  26577. selector: "findString:",
  26578. protocol: "finding",
  26579. args: ["aString"],
  26580. source: "findString: aString\x0a\x09^ self current findString: aString",
  26581. referencedClasses: [],
  26582. pragmas: [],
  26583. messageSends: ["findString:", "current"]
  26584. }, function ($methodClass){ return function (aString){
  26585. var self=this,$self=this;
  26586. return $core.withContext(function($ctx1) {
  26587. return $recv($self._current())._findString_(aString);
  26588. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString})});
  26589. }; }),
  26590. $globals.Finder.a$cls);
  26591. $core.addClass("Inspector", $globals.Service, [], "Platform-Services");
  26592. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  26593. $core.addMethod(
  26594. $core.method({
  26595. selector: "inspect:",
  26596. protocol: "inspecting",
  26597. args: ["anObject"],
  26598. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  26599. referencedClasses: [],
  26600. pragmas: [],
  26601. messageSends: ["inspect:", "current"]
  26602. }, function ($methodClass){ return function (anObject){
  26603. var self=this,$self=this;
  26604. return $core.withContext(function($ctx1) {
  26605. return $recv($self._current())._inspect_(anObject);
  26606. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject})});
  26607. }; }),
  26608. $globals.Inspector.a$cls);
  26609. $core.addClass("Platform", $globals.Service, [], "Platform-Services");
  26610. $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";
  26611. $core.addMethod(
  26612. $core.method({
  26613. selector: "fetch:",
  26614. protocol: "accessing",
  26615. args: ["aStringOrObject"],
  26616. source: "fetch: aStringOrObject\x0a\x09^ self current fetch: aStringOrObject",
  26617. referencedClasses: [],
  26618. pragmas: [],
  26619. messageSends: ["fetch:", "current"]
  26620. }, function ($methodClass){ return function (aStringOrObject){
  26621. var self=this,$self=this;
  26622. return $core.withContext(function($ctx1) {
  26623. return $recv($self._current())._fetch_(aStringOrObject);
  26624. }, function($ctx1) {$ctx1.fill(self,"fetch:",{aStringOrObject:aStringOrObject})});
  26625. }; }),
  26626. $globals.Platform.a$cls);
  26627. $core.addMethod(
  26628. $core.method({
  26629. selector: "fetchUrl:options:",
  26630. protocol: "accessing",
  26631. args: ["aString", "anObject"],
  26632. source: "fetchUrl: aString options: anObject\x0a\x09^ self current fetchUrl: aString options: anObject",
  26633. referencedClasses: [],
  26634. pragmas: [],
  26635. messageSends: ["fetchUrl:options:", "current"]
  26636. }, function ($methodClass){ return function (aString,anObject){
  26637. var self=this,$self=this;
  26638. return $core.withContext(function($ctx1) {
  26639. return $recv($self._current())._fetchUrl_options_(aString,anObject);
  26640. }, function($ctx1) {$ctx1.fill(self,"fetchUrl:options:",{aString:aString,anObject:anObject})});
  26641. }; }),
  26642. $globals.Platform.a$cls);
  26643. $core.addMethod(
  26644. $core.method({
  26645. selector: "globals",
  26646. protocol: "accessing",
  26647. args: [],
  26648. source: "globals\x0a\x09^ self current globals",
  26649. referencedClasses: [],
  26650. pragmas: [],
  26651. messageSends: ["globals", "current"]
  26652. }, function ($methodClass){ return function (){
  26653. var self=this,$self=this;
  26654. return $core.withContext(function($ctx1) {
  26655. return $recv($self._current())._globals();
  26656. }, function($ctx1) {$ctx1.fill(self,"globals",{})});
  26657. }; }),
  26658. $globals.Platform.a$cls);
  26659. $core.addMethod(
  26660. $core.method({
  26661. selector: "includesGlobal:",
  26662. protocol: "testing",
  26663. args: ["aString"],
  26664. source: "includesGlobal: aString\x0a\x09^ self globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  26665. referencedClasses: [],
  26666. pragmas: [],
  26667. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  26668. }, function ($methodClass){ return function (aString){
  26669. var self=this,$self=this;
  26670. return $core.withContext(function($ctx1) {
  26671. return $recv($self._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  26672. return true;
  26673. }),(function(){
  26674. return false;
  26675. }));
  26676. }, function($ctx1) {$ctx1.fill(self,"includesGlobal:",{aString:aString})});
  26677. }; }),
  26678. $globals.Platform.a$cls);
  26679. $core.addMethod(
  26680. $core.method({
  26681. selector: "newXhr",
  26682. protocol: "accessing",
  26683. args: [],
  26684. source: "newXhr\x0a\x09^ self current newXhr",
  26685. referencedClasses: [],
  26686. pragmas: [],
  26687. messageSends: ["newXhr", "current"]
  26688. }, function ($methodClass){ return function (){
  26689. var self=this,$self=this;
  26690. return $core.withContext(function($ctx1) {
  26691. return $recv($self._current())._newXhr();
  26692. }, function($ctx1) {$ctx1.fill(self,"newXhr",{})});
  26693. }; }),
  26694. $globals.Platform.a$cls);
  26695. $core.addClass("ProgressHandler", $globals.Service, [], "Platform-Services");
  26696. $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`.";
  26697. $core.addMethod(
  26698. $core.method({
  26699. selector: "do:on:displaying:",
  26700. protocol: "progress handling",
  26701. args: ["aBlock", "aCollection", "aString"],
  26702. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  26703. referencedClasses: [],
  26704. pragmas: [],
  26705. messageSends: ["do:on:displaying:", "current"]
  26706. }, function ($methodClass){ return function (aBlock,aCollection,aString){
  26707. var self=this,$self=this;
  26708. return $core.withContext(function($ctx1) {
  26709. $recv($self._current())._do_on_displaying_(aBlock,aCollection,aString);
  26710. return self;
  26711. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString})});
  26712. }; }),
  26713. $globals.ProgressHandler.a$cls);
  26714. $core.addClass("Terminal", $globals.Service, [], "Platform-Services");
  26715. $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:'.";
  26716. $core.addMethod(
  26717. $core.method({
  26718. selector: "alert:",
  26719. protocol: "dialogs",
  26720. args: ["aString"],
  26721. source: "alert: aString\x0a\x09^ self current alert: aString",
  26722. referencedClasses: [],
  26723. pragmas: [],
  26724. messageSends: ["alert:", "current"]
  26725. }, function ($methodClass){ return function (aString){
  26726. var self=this,$self=this;
  26727. return $core.withContext(function($ctx1) {
  26728. return $recv($self._current())._alert_(aString);
  26729. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString})});
  26730. }; }),
  26731. $globals.Terminal.a$cls);
  26732. $core.addMethod(
  26733. $core.method({
  26734. selector: "confirm:",
  26735. protocol: "dialogs",
  26736. args: ["aString"],
  26737. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  26738. referencedClasses: [],
  26739. pragmas: [],
  26740. messageSends: ["confirm:", "current"]
  26741. }, function ($methodClass){ return function (aString){
  26742. var self=this,$self=this;
  26743. return $core.withContext(function($ctx1) {
  26744. return $recv($self._current())._confirm_(aString);
  26745. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString})});
  26746. }; }),
  26747. $globals.Terminal.a$cls);
  26748. $core.addMethod(
  26749. $core.method({
  26750. selector: "prompt:",
  26751. protocol: "dialogs",
  26752. args: ["aString"],
  26753. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  26754. referencedClasses: [],
  26755. pragmas: [],
  26756. messageSends: ["prompt:", "current"]
  26757. }, function ($methodClass){ return function (aString){
  26758. var self=this,$self=this;
  26759. return $core.withContext(function($ctx1) {
  26760. return $recv($self._current())._prompt_(aString);
  26761. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString})});
  26762. }; }),
  26763. $globals.Terminal.a$cls);
  26764. $core.addMethod(
  26765. $core.method({
  26766. selector: "prompt:default:",
  26767. protocol: "dialogs",
  26768. args: ["aString", "defaultString"],
  26769. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  26770. referencedClasses: [],
  26771. pragmas: [],
  26772. messageSends: ["prompt:default:", "current"]
  26773. }, function ($methodClass){ return function (aString,defaultString){
  26774. var self=this,$self=this;
  26775. return $core.withContext(function($ctx1) {
  26776. return $recv($self._current())._prompt_default_(aString,defaultString);
  26777. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString})});
  26778. }; }),
  26779. $globals.Terminal.a$cls);
  26780. $core.addClass("Transcript", $globals.Service, [], "Platform-Services");
  26781. $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.";
  26782. $core.addMethod(
  26783. $core.method({
  26784. selector: "clear",
  26785. protocol: "printing",
  26786. args: [],
  26787. source: "clear\x0a\x09self current clear",
  26788. referencedClasses: [],
  26789. pragmas: [],
  26790. messageSends: ["clear", "current"]
  26791. }, function ($methodClass){ return function (){
  26792. var self=this,$self=this;
  26793. return $core.withContext(function($ctx1) {
  26794. $recv($self._current())._clear();
  26795. return self;
  26796. }, function($ctx1) {$ctx1.fill(self,"clear",{})});
  26797. }; }),
  26798. $globals.Transcript.a$cls);
  26799. $core.addMethod(
  26800. $core.method({
  26801. selector: "cr",
  26802. protocol: "printing",
  26803. args: [],
  26804. source: "cr\x0a\x09self current show: String cr",
  26805. referencedClasses: ["String"],
  26806. pragmas: [],
  26807. messageSends: ["show:", "current", "cr"]
  26808. }, function ($methodClass){ return function (){
  26809. var self=this,$self=this;
  26810. return $core.withContext(function($ctx1) {
  26811. $recv($self._current())._show_($recv($globals.String)._cr());
  26812. return self;
  26813. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  26814. }; }),
  26815. $globals.Transcript.a$cls);
  26816. $core.addMethod(
  26817. $core.method({
  26818. selector: "inspect:",
  26819. protocol: "printing",
  26820. args: ["anObject"],
  26821. source: "inspect: anObject\x0a\x09self show: anObject",
  26822. referencedClasses: [],
  26823. pragmas: [],
  26824. messageSends: ["show:"]
  26825. }, function ($methodClass){ return function (anObject){
  26826. var self=this,$self=this;
  26827. return $core.withContext(function($ctx1) {
  26828. $self._show_(anObject);
  26829. return self;
  26830. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject})});
  26831. }; }),
  26832. $globals.Transcript.a$cls);
  26833. $core.addMethod(
  26834. $core.method({
  26835. selector: "open",
  26836. protocol: "instance creation",
  26837. args: [],
  26838. source: "open\x0a\x09self current open",
  26839. referencedClasses: [],
  26840. pragmas: [],
  26841. messageSends: ["open", "current"]
  26842. }, function ($methodClass){ return function (){
  26843. var self=this,$self=this;
  26844. return $core.withContext(function($ctx1) {
  26845. $recv($self._current())._open();
  26846. return self;
  26847. }, function($ctx1) {$ctx1.fill(self,"open",{})});
  26848. }; }),
  26849. $globals.Transcript.a$cls);
  26850. $core.addMethod(
  26851. $core.method({
  26852. selector: "show:",
  26853. protocol: "printing",
  26854. args: ["anObject"],
  26855. source: "show: anObject\x0a\x09self current show: anObject",
  26856. referencedClasses: [],
  26857. pragmas: [],
  26858. messageSends: ["show:", "current"]
  26859. }, function ($methodClass){ return function (anObject){
  26860. var self=this,$self=this;
  26861. return $core.withContext(function($ctx1) {
  26862. $recv($self._current())._show_(anObject);
  26863. return self;
  26864. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject})});
  26865. }; }),
  26866. $globals.Transcript.a$cls);
  26867. $core.addMethod(
  26868. $core.method({
  26869. selector: "inspectOn:",
  26870. protocol: "*Platform-Services",
  26871. args: ["anInspector"],
  26872. 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 shortenedPrintString;\x0a\x09\x09setVariables: variables",
  26873. referencedClasses: ["Dictionary"],
  26874. pragmas: [],
  26875. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "shortenedPrintString", "setVariables:"]
  26876. }, function ($methodClass){ return function (anInspector){
  26877. var self=this,$self=this;
  26878. var variables;
  26879. return $core.withContext(function($ctx1) {
  26880. variables=$recv($globals.Dictionary)._new();
  26881. [$recv(variables)._at_put_("#self",self)
  26882. ,$ctx1.sendIdx["at:put:"]=1
  26883. ][0];
  26884. [$recv(variables)._at_put_("#keys",$self._keys())
  26885. ,$ctx1.sendIdx["at:put:"]=2
  26886. ][0];
  26887. $self._keysAndValuesDo_((function(key,value){
  26888. return $core.withContext(function($ctx2) {
  26889. return $recv(variables)._at_put_(key,value);
  26890. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  26891. }));
  26892. $recv(anInspector)._setLabel_($self._shortenedPrintString());
  26893. $recv(anInspector)._setVariables_(variables);
  26894. return self;
  26895. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables})});
  26896. }; }),
  26897. $globals.AssociativeCollection);
  26898. $core.addMethod(
  26899. $core.method({
  26900. selector: "inspectOn:",
  26901. protocol: "*Platform-Services",
  26902. args: ["anInspector"],
  26903. 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 shortenedPrintString;\x0a\x09\x09setVariables: variables",
  26904. referencedClasses: ["Dictionary"],
  26905. pragmas: [],
  26906. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "shortenedPrintString", "setVariables:"]
  26907. }, function ($methodClass){ return function (anInspector){
  26908. var self=this,$self=this;
  26909. var variables;
  26910. return $core.withContext(function($ctx1) {
  26911. variables=$recv($globals.Dictionary)._new();
  26912. [$recv(variables)._at_put_("#self",self)
  26913. ,$ctx1.sendIdx["at:put:"]=1
  26914. ][0];
  26915. $self._withIndexDo_((function(each,i){
  26916. return $core.withContext(function($ctx2) {
  26917. return $recv(variables)._at_put_(i,each);
  26918. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  26919. }));
  26920. $recv(anInspector)._setLabel_($self._shortenedPrintString());
  26921. $recv(anInspector)._setVariables_(variables);
  26922. return self;
  26923. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables})});
  26924. }; }),
  26925. $globals.Collection);
  26926. $core.addMethod(
  26927. $core.method({
  26928. selector: "inspectOn:",
  26929. protocol: "*Platform-Services",
  26930. args: ["anInspector"],
  26931. 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",
  26932. referencedClasses: ["Dictionary"],
  26933. pragmas: [],
  26934. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  26935. }, function ($methodClass){ return function (anInspector){
  26936. var self=this,$self=this;
  26937. var variables;
  26938. return $core.withContext(function($ctx1) {
  26939. variables=$recv($globals.Dictionary)._new();
  26940. [$recv(variables)._at_put_("#self",self)
  26941. ,$ctx1.sendIdx["at:put:"]=1
  26942. ][0];
  26943. [$recv(variables)._at_put_("#year",$self._year())
  26944. ,$ctx1.sendIdx["at:put:"]=2
  26945. ][0];
  26946. [$recv(variables)._at_put_("#month",$self._month())
  26947. ,$ctx1.sendIdx["at:put:"]=3
  26948. ][0];
  26949. [$recv(variables)._at_put_("#day",$self._day())
  26950. ,$ctx1.sendIdx["at:put:"]=4
  26951. ][0];
  26952. [$recv(variables)._at_put_("#hours",$self._hours())
  26953. ,$ctx1.sendIdx["at:put:"]=5
  26954. ][0];
  26955. [$recv(variables)._at_put_("#minutes",$self._minutes())
  26956. ,$ctx1.sendIdx["at:put:"]=6
  26957. ][0];
  26958. [$recv(variables)._at_put_("#seconds",$self._seconds())
  26959. ,$ctx1.sendIdx["at:put:"]=7
  26960. ][0];
  26961. $recv(variables)._at_put_("#milliseconds",$self._milliseconds());
  26962. $recv(anInspector)._setLabel_($self._printString());
  26963. $recv(anInspector)._setVariables_(variables);
  26964. return self;
  26965. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables})});
  26966. }; }),
  26967. $globals.Date);
  26968. $core.addMethod(
  26969. $core.method({
  26970. selector: "inspectOn:",
  26971. protocol: "*Platform-Services",
  26972. args: ["anInspector"],
  26973. 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",
  26974. referencedClasses: ["Dictionary", "JSObjectProxy"],
  26975. pragmas: [],
  26976. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  26977. }, function ($methodClass){ return function (anInspector){
  26978. var self=this,$self=this;
  26979. var variables;
  26980. return $core.withContext(function($ctx1) {
  26981. variables=$recv($globals.Dictionary)._new();
  26982. $recv(variables)._at_put_("#self",$self._jsObject());
  26983. $recv(anInspector)._setLabel_($self._printString());
  26984. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  26985. $recv(anInspector)._setVariables_(variables);
  26986. return self;
  26987. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables})});
  26988. }; }),
  26989. $globals.JSObjectProxy);
  26990. $core.addMethod(
  26991. $core.method({
  26992. selector: "inspectOn:",
  26993. protocol: "*Platform-Services",
  26994. args: ["anInspector"],
  26995. 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 instVarNamed: each) ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  26996. referencedClasses: ["Dictionary"],
  26997. pragmas: [],
  26998. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarNamed:", "setLabel:", "printString", "setVariables:"]
  26999. }, function ($methodClass){ return function (anInspector){
  27000. var self=this,$self=this;
  27001. var variables;
  27002. return $core.withContext(function($ctx1) {
  27003. variables=$recv($globals.Dictionary)._new();
  27004. [$recv(variables)._at_put_("#self",self)
  27005. ,$ctx1.sendIdx["at:put:"]=1
  27006. ][0];
  27007. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  27008. return $core.withContext(function($ctx2) {
  27009. return $recv(variables)._at_put_(each,$self._instVarNamed_(each));
  27010. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27011. }));
  27012. $recv(anInspector)._setLabel_($self._printString());
  27013. $recv(anInspector)._setVariables_(variables);
  27014. return self;
  27015. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables})});
  27016. }; }),
  27017. $globals.Object);
  27018. $core.addMethod(
  27019. $core.method({
  27020. selector: "do:displayingProgress:",
  27021. protocol: "*Platform-Services",
  27022. args: ["aBlock", "aString"],
  27023. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  27024. referencedClasses: ["ProgressHandler"],
  27025. pragmas: [],
  27026. messageSends: ["do:on:displaying:"]
  27027. }, function ($methodClass){ return function (aBlock,aString){
  27028. var self=this,$self=this;
  27029. return $core.withContext(function($ctx1) {
  27030. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  27031. return self;
  27032. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString})});
  27033. }; }),
  27034. $globals.SequenceableCollection);
  27035. $core.addMethod(
  27036. $core.method({
  27037. selector: "inspectOn:",
  27038. protocol: "*Platform-Services",
  27039. args: ["anInspector"],
  27040. 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 shortenedPrintString;\x0a\x09\x09setVariables: variables",
  27041. referencedClasses: ["Dictionary"],
  27042. pragmas: [],
  27043. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "shortenedPrintString", "setVariables:"]
  27044. }, function ($methodClass){ return function (anInspector){
  27045. var self=this,$self=this;
  27046. var variables,i;
  27047. return $core.withContext(function($ctx1) {
  27048. variables=$recv($globals.Dictionary)._new();
  27049. [$recv(variables)._at_put_("#self",self)
  27050. ,$ctx1.sendIdx["at:put:"]=1
  27051. ][0];
  27052. i=(1);
  27053. $self._do_((function(each){
  27054. return $core.withContext(function($ctx2) {
  27055. $recv(variables)._at_put_(i,each);
  27056. i=$recv(i).__plus((1));
  27057. return i;
  27058. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27059. }));
  27060. $recv(anInspector)._setLabel_($self._shortenedPrintString());
  27061. $recv(anInspector)._setVariables_(variables);
  27062. return self;
  27063. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i})});
  27064. }; }),
  27065. $globals.Set);
  27066. $core.addMethod(
  27067. $core.method({
  27068. selector: "inspectOn:",
  27069. protocol: "*Platform-Services",
  27070. args: ["anInspector"],
  27071. 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 instVarNamed: each) ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  27072. referencedClasses: ["Dictionary"],
  27073. pragmas: [],
  27074. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarNamed:", "setLabel:", "printString", "setVariables:"]
  27075. }, function ($methodClass){ return function (anInspector){
  27076. var self=this,$self=this;
  27077. var variables;
  27078. return $core.withContext(function($ctx1) {
  27079. variables=$recv($globals.Dictionary)._new();
  27080. [$recv(variables)._at_put_("#self",self)
  27081. ,$ctx1.sendIdx["at:put:"]=1
  27082. ][0];
  27083. [$recv(variables)._at_put_("#home",$self._home())
  27084. ,$ctx1.sendIdx["at:put:"]=2
  27085. ][0];
  27086. [$recv(variables)._at_put_("#receiver",$self._receiver())
  27087. ,$ctx1.sendIdx["at:put:"]=3
  27088. ][0];
  27089. [$recv(variables)._at_put_("#selector",$self._selector())
  27090. ,$ctx1.sendIdx["at:put:"]=4
  27091. ][0];
  27092. [$recv(variables)._at_put_("#locals",$self._locals())
  27093. ,$ctx1.sendIdx["at:put:"]=5
  27094. ][0];
  27095. $recv($recv($self._class())._instanceVariableNames())._do_((function(each){
  27096. return $core.withContext(function($ctx2) {
  27097. return $recv(variables)._at_put_(each,$self._instVarNamed_(each));
  27098. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27099. }));
  27100. $recv(anInspector)._setLabel_($self._printString());
  27101. $recv(anInspector)._setVariables_(variables);
  27102. return self;
  27103. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables})});
  27104. }; }),
  27105. $globals.TMethodContext);
  27106. });
  27107. define('amber/deploy',[
  27108. './helpers',
  27109. './boot', // pre-fetch, dep of ./helpers
  27110. // --- packages of the core Amber begin here ---
  27111. 'amber/core/Kernel-Helpers',
  27112. 'amber/core/Kernel-Objects',
  27113. 'amber/core/Kernel-Classes',
  27114. 'amber/core/Kernel-Methods',
  27115. 'amber/core/Kernel-Collections',
  27116. 'amber/core/Kernel-Dag',
  27117. 'amber/core/Kernel-Infrastructure',
  27118. 'amber/core/Kernel-Promises',
  27119. 'amber/core/Kernel-Exceptions',
  27120. 'amber/core/Kernel-Announcements',
  27121. 'amber/core/Platform-Services',
  27122. // --- packages of the core Amber end here ---
  27123. ], function (amber) {
  27124. return amber;
  27125. });
  27126. /*
  27127. * Generated by PEG.js 0.10.0.
  27128. *
  27129. * http://pegjs.org/
  27130. */
  27131. define('amber/parser',["./boot"], function(__boot) {
  27132. "use strict";
  27133. function peg$subclass(child, parent) {
  27134. function ctor() { this.constructor = child; }
  27135. ctor.prototype = parent.prototype;
  27136. child.prototype = new ctor();
  27137. }
  27138. function peg$SyntaxError(message, expected, found, location) {
  27139. this.message = message;
  27140. this.expected = expected;
  27141. this.found = found;
  27142. this.location = location;
  27143. this.name = "SyntaxError";
  27144. if (typeof Error.captureStackTrace === "function") {
  27145. Error.captureStackTrace(this, peg$SyntaxError);
  27146. }
  27147. }
  27148. peg$subclass(peg$SyntaxError, Error);
  27149. peg$SyntaxError.buildMessage = function(expected, found) {
  27150. var DESCRIBE_EXPECTATION_FNS = {
  27151. literal: function(expectation) {
  27152. return "\"" + literalEscape(expectation.text) + "\"";
  27153. },
  27154. "class": function(expectation) {
  27155. var escapedParts = "",
  27156. i;
  27157. for (i = 0; i < expectation.parts.length; i++) {
  27158. escapedParts += expectation.parts[i] instanceof Array
  27159. ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1])
  27160. : classEscape(expectation.parts[i]);
  27161. }
  27162. return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
  27163. },
  27164. any: function(expectation) {
  27165. return "any character";
  27166. },
  27167. end: function(expectation) {
  27168. return "end of input";
  27169. },
  27170. other: function(expectation) {
  27171. return expectation.description;
  27172. }
  27173. };
  27174. function hex(ch) {
  27175. return ch.charCodeAt(0).toString(16).toUpperCase();
  27176. }
  27177. function literalEscape(s) {
  27178. return s
  27179. .replace(/\\/g, '\\\\')
  27180. .replace(/"/g, '\\"')
  27181. .replace(/\0/g, '\\0')
  27182. .replace(/\t/g, '\\t')
  27183. .replace(/\n/g, '\\n')
  27184. .replace(/\r/g, '\\r')
  27185. .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  27186. .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
  27187. }
  27188. function classEscape(s) {
  27189. return s
  27190. .replace(/\\/g, '\\\\')
  27191. .replace(/\]/g, '\\]')
  27192. .replace(/\^/g, '\\^')
  27193. .replace(/-/g, '\\-')
  27194. .replace(/\0/g, '\\0')
  27195. .replace(/\t/g, '\\t')
  27196. .replace(/\n/g, '\\n')
  27197. .replace(/\r/g, '\\r')
  27198. .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  27199. .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
  27200. }
  27201. function describeExpectation(expectation) {
  27202. return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
  27203. }
  27204. function describeExpected(expected) {
  27205. var descriptions = new Array(expected.length),
  27206. i, j;
  27207. for (i = 0; i < expected.length; i++) {
  27208. descriptions[i] = describeExpectation(expected[i]);
  27209. }
  27210. descriptions.sort();
  27211. if (descriptions.length > 0) {
  27212. for (i = 1, j = 1; i < descriptions.length; i++) {
  27213. if (descriptions[i - 1] !== descriptions[i]) {
  27214. descriptions[j] = descriptions[i];
  27215. j++;
  27216. }
  27217. }
  27218. descriptions.length = j;
  27219. }
  27220. switch (descriptions.length) {
  27221. case 1:
  27222. return descriptions[0];
  27223. case 2:
  27224. return descriptions[0] + " or " + descriptions[1];
  27225. default:
  27226. return descriptions.slice(0, -1).join(", ")
  27227. + ", or "
  27228. + descriptions[descriptions.length - 1];
  27229. }
  27230. }
  27231. function describeFound(found) {
  27232. return found ? "\"" + literalEscape(found) + "\"" : "end of input";
  27233. }
  27234. return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
  27235. };
  27236. function peg$parse(input, options) {
  27237. options = options !== void 0 ? options : {};
  27238. var peg$FAILED = {},
  27239. peg$startRuleFunctions = { start: peg$parsestart },
  27240. peg$startRuleFunction = peg$parsestart,
  27241. peg$c0 = /^[ \t\x0B\f\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF\n\r\u2028\u2029]/,
  27242. peg$c1 = peg$classExpectation([" ", "\t", "\x0B", "\f", "\xA0", "\u1680", ["\u2000", "\u200A"], "\u202F", "\u205F", "\u3000", "\uFEFF", "\n", "\r", "\u2028", "\u2029"], false, false),
  27243. peg$c2 = "\"",
  27244. peg$c3 = peg$literalExpectation("\"", false),
  27245. peg$c4 = /^[^"]/,
  27246. peg$c5 = peg$classExpectation(["\""], true, false),
  27247. peg$c6 = ".",
  27248. peg$c7 = peg$literalExpectation(".", false),
  27249. peg$c8 = /^[a-zA-Z]/,
  27250. peg$c9 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false),
  27251. peg$c10 = /^[a-zA-Z0-9]/,
  27252. peg$c11 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"]], false, false),
  27253. peg$c12 = ":",
  27254. peg$c13 = peg$literalExpectation(":", false),
  27255. peg$c14 = /^[A-Z]/,
  27256. peg$c15 = peg$classExpectation([["A", "Z"]], false, false),
  27257. peg$c16 = function(val) {
  27258. return newNode($globals.ValueNode)._value_(val);
  27259. },
  27260. peg$c17 = "'",
  27261. peg$c18 = peg$literalExpectation("'", false),
  27262. peg$c19 = "''",
  27263. peg$c20 = peg$literalExpectation("''", false),
  27264. peg$c21 = function() {return '\'';},
  27265. peg$c22 = /^[^']/,
  27266. peg$c23 = peg$classExpectation(["'"], true, false),
  27267. peg$c24 = function(val) {return val.join('');},
  27268. peg$c25 = "$",
  27269. peg$c26 = peg$literalExpectation("$", false),
  27270. peg$c27 = peg$anyExpectation(),
  27271. peg$c28 = function(char) {
  27272. return newNode($globals.ValueNode)._value_(char);
  27273. },
  27274. peg$c29 = "#",
  27275. peg$c30 = peg$literalExpectation("#", false),
  27276. peg$c31 = function(rest) {return rest;},
  27277. peg$c32 = "e",
  27278. peg$c33 = peg$literalExpectation("e", false),
  27279. peg$c34 = function(n) {return parseFloat(n);},
  27280. peg$c35 = "-",
  27281. peg$c36 = peg$literalExpectation("-", false),
  27282. peg$c37 = "16r",
  27283. peg$c38 = peg$literalExpectation("16r", false),
  27284. peg$c39 = /^[0-9a-fA-F]/,
  27285. peg$c40 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false),
  27286. peg$c41 = function(neg, num) {
  27287. return parseInt(((neg || '') + num), 16);
  27288. },
  27289. peg$c42 = /^[0-9]/,
  27290. peg$c43 = peg$classExpectation([["0", "9"]], false, false),
  27291. peg$c44 = function(n) {return parseFloat(n, 10);},
  27292. peg$c45 = function(n) {return parseInt(n, 10);},
  27293. peg$c46 = "#(",
  27294. peg$c47 = peg$literalExpectation("#(", false),
  27295. peg$c48 = ")",
  27296. peg$c49 = peg$literalExpectation(")", false),
  27297. peg$c50 = function(rest) {
  27298. return newNode($globals.ValueNode)._value_(rest);
  27299. },
  27300. peg$c51 = "(",
  27301. peg$c52 = peg$literalExpectation("(", false),
  27302. peg$c53 = function(lit) {return lit._value();},
  27303. peg$c54 = "{",
  27304. peg$c55 = peg$literalExpectation("{", false),
  27305. peg$c56 = "}",
  27306. peg$c57 = peg$literalExpectation("}", false),
  27307. peg$c58 = function(expressions) {
  27308. return newNode($globals.DynamicArrayNode)._dagChildren_(expressions || []);
  27309. },
  27310. peg$c59 = "#{",
  27311. peg$c60 = peg$literalExpectation("#{", false),
  27312. peg$c61 = function(expressions) {
  27313. return newNode($globals.DynamicDictionaryNode)._dagChildren_(expressions || []);
  27314. },
  27315. peg$c62 = "true",
  27316. peg$c63 = peg$literalExpectation("true", false),
  27317. peg$c64 = function() {return true;},
  27318. peg$c65 = "false",
  27319. peg$c66 = peg$literalExpectation("false", false),
  27320. peg$c67 = function() {return false;},
  27321. peg$c68 = "nil",
  27322. peg$c69 = peg$literalExpectation("nil", false),
  27323. peg$c70 = function() {return null;},
  27324. peg$c71 = function(identifier) {
  27325. return newNode($globals.VariableNode)._identifier_(identifier);
  27326. },
  27327. peg$c72 = /^[\\+*\/=><,@%~|&\-]/,
  27328. peg$c73 = peg$classExpectation(["\\", "+", "*", "/", "=", ">", "<", ",", "@", "%", "~", "|", "&", "-"], false, false),
  27329. peg$c74 = function(key, arg) {return {key:key, arg:arg};},
  27330. peg$c75 = function(pairs) {
  27331. var selector = '';
  27332. var params = [];
  27333. for(var i = 0; i < pairs.length; i++) {
  27334. selector += pairs[i].key;
  27335. params.push(pairs[i].arg);
  27336. }
  27337. return [selector, params];
  27338. },
  27339. peg$c76 = function(selector, arg) {
  27340. return [selector, [arg]];
  27341. },
  27342. peg$c77 = function(selector) {return [selector, []];},
  27343. peg$c78 = function(expression) {
  27344. return expression;
  27345. },
  27346. peg$c79 = function(first, others) {
  27347. return [first].concat(others);
  27348. },
  27349. peg$c80 = function(selector) {
  27350. return $globals.Message._selector_arguments_(selector, []);
  27351. },
  27352. peg$c81 = function(pairs) {
  27353. var selector = '';
  27354. var args = [];
  27355. for(var i = 0; i < pairs.length; i++) {
  27356. selector += pairs[i].key;
  27357. args.push(pairs[i].arg._value());
  27358. }
  27359. return $globals.Message._selector_arguments_(selector, args)
  27360. },
  27361. peg$c82 = "<",
  27362. peg$c83 = peg$literalExpectation("<", false),
  27363. peg$c84 = ">",
  27364. peg$c85 = peg$literalExpectation(">", false),
  27365. peg$c86 = function(message) {return message;},
  27366. peg$c87 = ":=",
  27367. peg$c88 = peg$literalExpectation(":=", false),
  27368. peg$c89 = function(variable, expression) {
  27369. return newNode($globals.AssignmentNode)._left_(variable)._right_(expression);
  27370. },
  27371. peg$c90 = "^",
  27372. peg$c91 = peg$literalExpectation("^", false),
  27373. peg$c92 = function(expression) {
  27374. return newNode($globals.ReturnNode)._expression_(expression);
  27375. },
  27376. peg$c93 = "|",
  27377. peg$c94 = peg$literalExpectation("|", false),
  27378. peg$c95 = function(variable) {return variable;},
  27379. peg$c96 = function(vars) {
  27380. return vars;
  27381. },
  27382. peg$c97 = function(param) {return param;},
  27383. peg$c98 = function(params) {
  27384. return params;
  27385. },
  27386. peg$c99 = function(ret) {return [ret];},
  27387. peg$c100 = function(exps, ret) {
  27388. var expressions = exps;
  27389. expressions.push(ret);
  27390. return expressions;
  27391. },
  27392. peg$c101 = function(expressions) {return expressions || [];},
  27393. peg$c102 = "[",
  27394. peg$c103 = peg$literalExpectation("[", false),
  27395. peg$c104 = "]",
  27396. peg$c105 = peg$literalExpectation("]", false),
  27397. peg$c106 = function(params, temps, statements) {
  27398. return newNode($globals.BlockNode)
  27399. ._parameters_(params || [])
  27400. ._sequenceNode_(newSequenceNode($globals.BlockSequenceNode, temps, statements));
  27401. },
  27402. peg$c107 = function(selector) {
  27403. return newNode($globals.SendNode)._selector_(selector);
  27404. },
  27405. peg$c108 = function(receiver, tail) {
  27406. return receiver._withTail_(tail);
  27407. },
  27408. peg$c109 = function(selector, arg) {
  27409. return newNode($globals.SendNode)._selector_(selector)._arguments_([arg]);
  27410. },
  27411. peg$c110 = function(unarys, binarys) { return unarys.concat(binarys); },
  27412. peg$c111 = function(pairs) {
  27413. var selector = '';
  27414. var args = [];
  27415. for(var i = 0; i < pairs.length; i++) {
  27416. selector += pairs[i].key;
  27417. args.push(pairs[i].arg);
  27418. }
  27419. return newNode($globals.SendNode)._selector_(selector)._arguments_(args);
  27420. },
  27421. peg$c112 = function(binarys, final) {
  27422. if (final) binarys.push(final);
  27423. return binarys;
  27424. },
  27425. peg$c113 = function(receiver, tail) {return tail.length > 0;},
  27426. peg$c114 = ";",
  27427. peg$c115 = peg$literalExpectation(";", false),
  27428. peg$c116 = function(receiver, tail, mess) {return mess;},
  27429. peg$c117 = function(receiver, tail, messages) {
  27430. messages.unshift(receiver._withTail_(tail));
  27431. return newNode($globals.CascadeNode)._dagChildren_(messages);
  27432. },
  27433. peg$c118 = function(pattern, aPragmas, temps, zPragmas, statements) {
  27434. return newNode($globals.MethodNode)
  27435. ._selector_(pattern[0])
  27436. ._arguments_(pattern[1])
  27437. ._pragmas_((aPragmas || []).concat(zPragmas || []))
  27438. ._sequenceNode_(newSequenceNode($globals.SequenceNode, temps, statements));
  27439. },
  27440. peg$c119 = function(receiver, tail) { return tail.length > 0 && tail[tail.length-1]._selector() === '->' },
  27441. peg$c120 = function(receiver, tail) {
  27442. var last = tail.pop();
  27443. return [receiver._withTail_(tail), last._arguments()[0]];
  27444. },
  27445. peg$c121 = function(first, others) {
  27446. return first.concat.apply(first, others);
  27447. },
  27448. peg$currPos = 0,
  27449. peg$savedPos = 0,
  27450. peg$posDetailsCache = [{ line: 1, column: 1 }],
  27451. peg$maxFailPos = 0,
  27452. peg$maxFailExpected = [],
  27453. peg$silentFails = 0,
  27454. peg$resultsCache = {},
  27455. peg$result;
  27456. if ("startRule" in options) {
  27457. if (!(options.startRule in peg$startRuleFunctions)) {
  27458. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  27459. }
  27460. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  27461. }
  27462. function text() {
  27463. return input.substring(peg$savedPos, peg$currPos);
  27464. }
  27465. function location() {
  27466. return peg$computeLocation(peg$savedPos, peg$currPos);
  27467. }
  27468. function expected(description, location) {
  27469. location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
  27470. throw peg$buildStructuredError(
  27471. [peg$otherExpectation(description)],
  27472. input.substring(peg$savedPos, peg$currPos),
  27473. location
  27474. );
  27475. }
  27476. function error(message, location) {
  27477. location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
  27478. throw peg$buildSimpleError(message, location);
  27479. }
  27480. function peg$literalExpectation(text, ignoreCase) {
  27481. return { type: "literal", text: text, ignoreCase: ignoreCase };
  27482. }
  27483. function peg$classExpectation(parts, inverted, ignoreCase) {
  27484. return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
  27485. }
  27486. function peg$anyExpectation() {
  27487. return { type: "any" };
  27488. }
  27489. function peg$endExpectation() {
  27490. return { type: "end" };
  27491. }
  27492. function peg$otherExpectation(description) {
  27493. return { type: "other", description: description };
  27494. }
  27495. function peg$computePosDetails(pos) {
  27496. var details = peg$posDetailsCache[pos], p;
  27497. if (details) {
  27498. return details;
  27499. } else {
  27500. p = pos - 1;
  27501. while (!peg$posDetailsCache[p]) {
  27502. p--;
  27503. }
  27504. details = peg$posDetailsCache[p];
  27505. details = {
  27506. line: details.line,
  27507. column: details.column
  27508. };
  27509. while (p < pos) {
  27510. if (input.charCodeAt(p) === 10) {
  27511. details.line++;
  27512. details.column = 1;
  27513. } else {
  27514. details.column++;
  27515. }
  27516. p++;
  27517. }
  27518. peg$posDetailsCache[pos] = details;
  27519. return details;
  27520. }
  27521. }
  27522. function peg$computeLocation(startPos, endPos) {
  27523. var startPosDetails = peg$computePosDetails(startPos),
  27524. endPosDetails = peg$computePosDetails(endPos);
  27525. return {
  27526. start: {
  27527. offset: startPos,
  27528. line: startPosDetails.line,
  27529. column: startPosDetails.column
  27530. },
  27531. end: {
  27532. offset: endPos,
  27533. line: endPosDetails.line,
  27534. column: endPosDetails.column
  27535. }
  27536. };
  27537. }
  27538. function peg$fail(expected) {
  27539. if (peg$currPos < peg$maxFailPos) { return; }
  27540. if (peg$currPos > peg$maxFailPos) {
  27541. peg$maxFailPos = peg$currPos;
  27542. peg$maxFailExpected = [];
  27543. }
  27544. peg$maxFailExpected.push(expected);
  27545. }
  27546. function peg$buildSimpleError(message, location) {
  27547. return new peg$SyntaxError(message, null, null, location);
  27548. }
  27549. function peg$buildStructuredError(expected, found, location) {
  27550. return new peg$SyntaxError(
  27551. peg$SyntaxError.buildMessage(expected, found),
  27552. expected,
  27553. found,
  27554. location
  27555. );
  27556. }
  27557. function peg$parsestart() {
  27558. var s0;
  27559. var key = peg$currPos * 65 + 0,
  27560. cached = peg$resultsCache[key];
  27561. if (cached) {
  27562. peg$currPos = cached.nextPos;
  27563. return cached.result;
  27564. }
  27565. s0 = peg$parsemethod();
  27566. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27567. return s0;
  27568. }
  27569. function peg$parseseparator() {
  27570. var s0, s1;
  27571. var key = peg$currPos * 65 + 1,
  27572. cached = peg$resultsCache[key];
  27573. if (cached) {
  27574. peg$currPos = cached.nextPos;
  27575. return cached.result;
  27576. }
  27577. s0 = [];
  27578. if (peg$c0.test(input.charAt(peg$currPos))) {
  27579. s1 = input.charAt(peg$currPos);
  27580. peg$currPos++;
  27581. } else {
  27582. s1 = peg$FAILED;
  27583. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27584. }
  27585. if (s1 !== peg$FAILED) {
  27586. while (s1 !== peg$FAILED) {
  27587. s0.push(s1);
  27588. if (peg$c0.test(input.charAt(peg$currPos))) {
  27589. s1 = input.charAt(peg$currPos);
  27590. peg$currPos++;
  27591. } else {
  27592. s1 = peg$FAILED;
  27593. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27594. }
  27595. }
  27596. } else {
  27597. s0 = peg$FAILED;
  27598. }
  27599. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27600. return s0;
  27601. }
  27602. function peg$parsecomments() {
  27603. var s0, s1, s2, s3, s4;
  27604. var key = peg$currPos * 65 + 2,
  27605. cached = peg$resultsCache[key];
  27606. if (cached) {
  27607. peg$currPos = cached.nextPos;
  27608. return cached.result;
  27609. }
  27610. s0 = [];
  27611. s1 = peg$currPos;
  27612. if (input.charCodeAt(peg$currPos) === 34) {
  27613. s2 = peg$c2;
  27614. peg$currPos++;
  27615. } else {
  27616. s2 = peg$FAILED;
  27617. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27618. }
  27619. if (s2 !== peg$FAILED) {
  27620. s3 = [];
  27621. if (peg$c4.test(input.charAt(peg$currPos))) {
  27622. s4 = input.charAt(peg$currPos);
  27623. peg$currPos++;
  27624. } else {
  27625. s4 = peg$FAILED;
  27626. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27627. }
  27628. while (s4 !== peg$FAILED) {
  27629. s3.push(s4);
  27630. if (peg$c4.test(input.charAt(peg$currPos))) {
  27631. s4 = input.charAt(peg$currPos);
  27632. peg$currPos++;
  27633. } else {
  27634. s4 = peg$FAILED;
  27635. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27636. }
  27637. }
  27638. if (s3 !== peg$FAILED) {
  27639. if (input.charCodeAt(peg$currPos) === 34) {
  27640. s4 = peg$c2;
  27641. peg$currPos++;
  27642. } else {
  27643. s4 = peg$FAILED;
  27644. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27645. }
  27646. if (s4 !== peg$FAILED) {
  27647. s2 = [s2, s3, s4];
  27648. s1 = s2;
  27649. } else {
  27650. peg$currPos = s1;
  27651. s1 = peg$FAILED;
  27652. }
  27653. } else {
  27654. peg$currPos = s1;
  27655. s1 = peg$FAILED;
  27656. }
  27657. } else {
  27658. peg$currPos = s1;
  27659. s1 = peg$FAILED;
  27660. }
  27661. if (s1 !== peg$FAILED) {
  27662. while (s1 !== peg$FAILED) {
  27663. s0.push(s1);
  27664. s1 = peg$currPos;
  27665. if (input.charCodeAt(peg$currPos) === 34) {
  27666. s2 = peg$c2;
  27667. peg$currPos++;
  27668. } else {
  27669. s2 = peg$FAILED;
  27670. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27671. }
  27672. if (s2 !== peg$FAILED) {
  27673. s3 = [];
  27674. if (peg$c4.test(input.charAt(peg$currPos))) {
  27675. s4 = input.charAt(peg$currPos);
  27676. peg$currPos++;
  27677. } else {
  27678. s4 = peg$FAILED;
  27679. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27680. }
  27681. while (s4 !== peg$FAILED) {
  27682. s3.push(s4);
  27683. if (peg$c4.test(input.charAt(peg$currPos))) {
  27684. s4 = input.charAt(peg$currPos);
  27685. peg$currPos++;
  27686. } else {
  27687. s4 = peg$FAILED;
  27688. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27689. }
  27690. }
  27691. if (s3 !== peg$FAILED) {
  27692. if (input.charCodeAt(peg$currPos) === 34) {
  27693. s4 = peg$c2;
  27694. peg$currPos++;
  27695. } else {
  27696. s4 = peg$FAILED;
  27697. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27698. }
  27699. if (s4 !== peg$FAILED) {
  27700. s2 = [s2, s3, s4];
  27701. s1 = s2;
  27702. } else {
  27703. peg$currPos = s1;
  27704. s1 = peg$FAILED;
  27705. }
  27706. } else {
  27707. peg$currPos = s1;
  27708. s1 = peg$FAILED;
  27709. }
  27710. } else {
  27711. peg$currPos = s1;
  27712. s1 = peg$FAILED;
  27713. }
  27714. }
  27715. } else {
  27716. s0 = peg$FAILED;
  27717. }
  27718. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27719. return s0;
  27720. }
  27721. function peg$parsews() {
  27722. var s0, s1;
  27723. var key = peg$currPos * 65 + 3,
  27724. cached = peg$resultsCache[key];
  27725. if (cached) {
  27726. peg$currPos = cached.nextPos;
  27727. return cached.result;
  27728. }
  27729. s0 = [];
  27730. s1 = peg$parseseparator();
  27731. if (s1 === peg$FAILED) {
  27732. s1 = peg$parsecomments();
  27733. }
  27734. while (s1 !== peg$FAILED) {
  27735. s0.push(s1);
  27736. s1 = peg$parseseparator();
  27737. if (s1 === peg$FAILED) {
  27738. s1 = peg$parsecomments();
  27739. }
  27740. }
  27741. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27742. return s0;
  27743. }
  27744. function peg$parsemaybeDotsWs() {
  27745. var s0, s1;
  27746. var key = peg$currPos * 65 + 4,
  27747. cached = peg$resultsCache[key];
  27748. if (cached) {
  27749. peg$currPos = cached.nextPos;
  27750. return cached.result;
  27751. }
  27752. s0 = [];
  27753. if (input.charCodeAt(peg$currPos) === 46) {
  27754. s1 = peg$c6;
  27755. peg$currPos++;
  27756. } else {
  27757. s1 = peg$FAILED;
  27758. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27759. }
  27760. if (s1 === peg$FAILED) {
  27761. s1 = peg$parseseparator();
  27762. if (s1 === peg$FAILED) {
  27763. s1 = peg$parsecomments();
  27764. }
  27765. }
  27766. while (s1 !== peg$FAILED) {
  27767. s0.push(s1);
  27768. if (input.charCodeAt(peg$currPos) === 46) {
  27769. s1 = peg$c6;
  27770. peg$currPos++;
  27771. } else {
  27772. s1 = peg$FAILED;
  27773. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27774. }
  27775. if (s1 === peg$FAILED) {
  27776. s1 = peg$parseseparator();
  27777. if (s1 === peg$FAILED) {
  27778. s1 = peg$parsecomments();
  27779. }
  27780. }
  27781. }
  27782. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27783. return s0;
  27784. }
  27785. function peg$parsesomeDotsWs() {
  27786. var s0, s1, s2, s3;
  27787. var key = peg$currPos * 65 + 5,
  27788. cached = peg$resultsCache[key];
  27789. if (cached) {
  27790. peg$currPos = cached.nextPos;
  27791. return cached.result;
  27792. }
  27793. s0 = peg$currPos;
  27794. s1 = peg$parsews();
  27795. if (s1 !== peg$FAILED) {
  27796. if (input.charCodeAt(peg$currPos) === 46) {
  27797. s2 = peg$c6;
  27798. peg$currPos++;
  27799. } else {
  27800. s2 = peg$FAILED;
  27801. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27802. }
  27803. if (s2 !== peg$FAILED) {
  27804. s3 = peg$parsemaybeDotsWs();
  27805. if (s3 !== peg$FAILED) {
  27806. s1 = [s1, s2, s3];
  27807. s0 = s1;
  27808. } else {
  27809. peg$currPos = s0;
  27810. s0 = peg$FAILED;
  27811. }
  27812. } else {
  27813. peg$currPos = s0;
  27814. s0 = peg$FAILED;
  27815. }
  27816. } else {
  27817. peg$currPos = s0;
  27818. s0 = peg$FAILED;
  27819. }
  27820. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27821. return s0;
  27822. }
  27823. function peg$parseidentifier() {
  27824. var s0, s1, s2, s3, s4;
  27825. var key = peg$currPos * 65 + 6,
  27826. cached = peg$resultsCache[key];
  27827. if (cached) {
  27828. peg$currPos = cached.nextPos;
  27829. return cached.result;
  27830. }
  27831. s0 = peg$currPos;
  27832. s1 = peg$currPos;
  27833. if (peg$c8.test(input.charAt(peg$currPos))) {
  27834. s2 = input.charAt(peg$currPos);
  27835. peg$currPos++;
  27836. } else {
  27837. s2 = peg$FAILED;
  27838. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  27839. }
  27840. if (s2 !== peg$FAILED) {
  27841. s3 = [];
  27842. if (peg$c10.test(input.charAt(peg$currPos))) {
  27843. s4 = input.charAt(peg$currPos);
  27844. peg$currPos++;
  27845. } else {
  27846. s4 = peg$FAILED;
  27847. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27848. }
  27849. while (s4 !== peg$FAILED) {
  27850. s3.push(s4);
  27851. if (peg$c10.test(input.charAt(peg$currPos))) {
  27852. s4 = input.charAt(peg$currPos);
  27853. peg$currPos++;
  27854. } else {
  27855. s4 = peg$FAILED;
  27856. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27857. }
  27858. }
  27859. if (s3 !== peg$FAILED) {
  27860. s2 = [s2, s3];
  27861. s1 = s2;
  27862. } else {
  27863. peg$currPos = s1;
  27864. s1 = peg$FAILED;
  27865. }
  27866. } else {
  27867. peg$currPos = s1;
  27868. s1 = peg$FAILED;
  27869. }
  27870. if (s1 !== peg$FAILED) {
  27871. s0 = input.substring(s0, peg$currPos);
  27872. } else {
  27873. s0 = s1;
  27874. }
  27875. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27876. return s0;
  27877. }
  27878. function peg$parsekeyword() {
  27879. var s0, s1, s2, s3;
  27880. var key = peg$currPos * 65 + 7,
  27881. cached = peg$resultsCache[key];
  27882. if (cached) {
  27883. peg$currPos = cached.nextPos;
  27884. return cached.result;
  27885. }
  27886. s0 = peg$currPos;
  27887. s1 = peg$currPos;
  27888. s2 = peg$parseidentifier();
  27889. if (s2 !== peg$FAILED) {
  27890. if (input.charCodeAt(peg$currPos) === 58) {
  27891. s3 = peg$c12;
  27892. peg$currPos++;
  27893. } else {
  27894. s3 = peg$FAILED;
  27895. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  27896. }
  27897. if (s3 !== peg$FAILED) {
  27898. s2 = [s2, s3];
  27899. s1 = s2;
  27900. } else {
  27901. peg$currPos = s1;
  27902. s1 = peg$FAILED;
  27903. }
  27904. } else {
  27905. peg$currPos = s1;
  27906. s1 = peg$FAILED;
  27907. }
  27908. if (s1 !== peg$FAILED) {
  27909. s0 = input.substring(s0, peg$currPos);
  27910. } else {
  27911. s0 = s1;
  27912. }
  27913. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27914. return s0;
  27915. }
  27916. function peg$parseclassName() {
  27917. var s0, s1, s2, s3, s4;
  27918. var key = peg$currPos * 65 + 8,
  27919. cached = peg$resultsCache[key];
  27920. if (cached) {
  27921. peg$currPos = cached.nextPos;
  27922. return cached.result;
  27923. }
  27924. s0 = peg$currPos;
  27925. s1 = peg$currPos;
  27926. if (peg$c14.test(input.charAt(peg$currPos))) {
  27927. s2 = input.charAt(peg$currPos);
  27928. peg$currPos++;
  27929. } else {
  27930. s2 = peg$FAILED;
  27931. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  27932. }
  27933. if (s2 !== peg$FAILED) {
  27934. s3 = [];
  27935. if (peg$c10.test(input.charAt(peg$currPos))) {
  27936. s4 = input.charAt(peg$currPos);
  27937. peg$currPos++;
  27938. } else {
  27939. s4 = peg$FAILED;
  27940. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27941. }
  27942. while (s4 !== peg$FAILED) {
  27943. s3.push(s4);
  27944. if (peg$c10.test(input.charAt(peg$currPos))) {
  27945. s4 = input.charAt(peg$currPos);
  27946. peg$currPos++;
  27947. } else {
  27948. s4 = peg$FAILED;
  27949. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27950. }
  27951. }
  27952. if (s3 !== peg$FAILED) {
  27953. s2 = [s2, s3];
  27954. s1 = s2;
  27955. } else {
  27956. peg$currPos = s1;
  27957. s1 = peg$FAILED;
  27958. }
  27959. } else {
  27960. peg$currPos = s1;
  27961. s1 = peg$FAILED;
  27962. }
  27963. if (s1 !== peg$FAILED) {
  27964. s0 = input.substring(s0, peg$currPos);
  27965. } else {
  27966. s0 = s1;
  27967. }
  27968. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27969. return s0;
  27970. }
  27971. function peg$parsestring() {
  27972. var s0, s1;
  27973. var key = peg$currPos * 65 + 9,
  27974. cached = peg$resultsCache[key];
  27975. if (cached) {
  27976. peg$currPos = cached.nextPos;
  27977. return cached.result;
  27978. }
  27979. s0 = peg$currPos;
  27980. s1 = peg$parserawString();
  27981. if (s1 !== peg$FAILED) {
  27982. peg$savedPos = s0;
  27983. s1 = peg$c16(s1);
  27984. }
  27985. s0 = s1;
  27986. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27987. return s0;
  27988. }
  27989. function peg$parserawString() {
  27990. var s0, s1, s2, s3, s4;
  27991. var key = peg$currPos * 65 + 10,
  27992. cached = peg$resultsCache[key];
  27993. if (cached) {
  27994. peg$currPos = cached.nextPos;
  27995. return cached.result;
  27996. }
  27997. s0 = peg$currPos;
  27998. if (input.charCodeAt(peg$currPos) === 39) {
  27999. s1 = peg$c17;
  28000. peg$currPos++;
  28001. } else {
  28002. s1 = peg$FAILED;
  28003. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  28004. }
  28005. if (s1 !== peg$FAILED) {
  28006. s2 = [];
  28007. s3 = peg$currPos;
  28008. if (input.substr(peg$currPos, 2) === peg$c19) {
  28009. s4 = peg$c19;
  28010. peg$currPos += 2;
  28011. } else {
  28012. s4 = peg$FAILED;
  28013. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  28014. }
  28015. if (s4 !== peg$FAILED) {
  28016. peg$savedPos = s3;
  28017. s4 = peg$c21();
  28018. }
  28019. s3 = s4;
  28020. if (s3 === peg$FAILED) {
  28021. if (peg$c22.test(input.charAt(peg$currPos))) {
  28022. s3 = input.charAt(peg$currPos);
  28023. peg$currPos++;
  28024. } else {
  28025. s3 = peg$FAILED;
  28026. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  28027. }
  28028. }
  28029. while (s3 !== peg$FAILED) {
  28030. s2.push(s3);
  28031. s3 = peg$currPos;
  28032. if (input.substr(peg$currPos, 2) === peg$c19) {
  28033. s4 = peg$c19;
  28034. peg$currPos += 2;
  28035. } else {
  28036. s4 = peg$FAILED;
  28037. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  28038. }
  28039. if (s4 !== peg$FAILED) {
  28040. peg$savedPos = s3;
  28041. s4 = peg$c21();
  28042. }
  28043. s3 = s4;
  28044. if (s3 === peg$FAILED) {
  28045. if (peg$c22.test(input.charAt(peg$currPos))) {
  28046. s3 = input.charAt(peg$currPos);
  28047. peg$currPos++;
  28048. } else {
  28049. s3 = peg$FAILED;
  28050. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  28051. }
  28052. }
  28053. }
  28054. if (s2 !== peg$FAILED) {
  28055. if (input.charCodeAt(peg$currPos) === 39) {
  28056. s3 = peg$c17;
  28057. peg$currPos++;
  28058. } else {
  28059. s3 = peg$FAILED;
  28060. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  28061. }
  28062. if (s3 !== peg$FAILED) {
  28063. peg$savedPos = s0;
  28064. s1 = peg$c24(s2);
  28065. s0 = s1;
  28066. } else {
  28067. peg$currPos = s0;
  28068. s0 = peg$FAILED;
  28069. }
  28070. } else {
  28071. peg$currPos = s0;
  28072. s0 = peg$FAILED;
  28073. }
  28074. } else {
  28075. peg$currPos = s0;
  28076. s0 = peg$FAILED;
  28077. }
  28078. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28079. return s0;
  28080. }
  28081. function peg$parsecharacter() {
  28082. var s0, s1, s2;
  28083. var key = peg$currPos * 65 + 11,
  28084. cached = peg$resultsCache[key];
  28085. if (cached) {
  28086. peg$currPos = cached.nextPos;
  28087. return cached.result;
  28088. }
  28089. s0 = peg$currPos;
  28090. if (input.charCodeAt(peg$currPos) === 36) {
  28091. s1 = peg$c25;
  28092. peg$currPos++;
  28093. } else {
  28094. s1 = peg$FAILED;
  28095. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  28096. }
  28097. if (s1 !== peg$FAILED) {
  28098. if (input.length > peg$currPos) {
  28099. s2 = input.charAt(peg$currPos);
  28100. peg$currPos++;
  28101. } else {
  28102. s2 = peg$FAILED;
  28103. if (peg$silentFails === 0) { peg$fail(peg$c27); }
  28104. }
  28105. if (s2 !== peg$FAILED) {
  28106. peg$savedPos = s0;
  28107. s1 = peg$c28(s2);
  28108. s0 = s1;
  28109. } else {
  28110. peg$currPos = s0;
  28111. s0 = peg$FAILED;
  28112. }
  28113. } else {
  28114. peg$currPos = s0;
  28115. s0 = peg$FAILED;
  28116. }
  28117. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28118. return s0;
  28119. }
  28120. function peg$parsesymbol() {
  28121. var s0, s1, s2;
  28122. var key = peg$currPos * 65 + 12,
  28123. cached = peg$resultsCache[key];
  28124. if (cached) {
  28125. peg$currPos = cached.nextPos;
  28126. return cached.result;
  28127. }
  28128. s0 = peg$currPos;
  28129. if (input.charCodeAt(peg$currPos) === 35) {
  28130. s1 = peg$c29;
  28131. peg$currPos++;
  28132. } else {
  28133. s1 = peg$FAILED;
  28134. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  28135. }
  28136. if (s1 !== peg$FAILED) {
  28137. s2 = peg$parsebareSymbol();
  28138. if (s2 !== peg$FAILED) {
  28139. peg$savedPos = s0;
  28140. s1 = peg$c31(s2);
  28141. s0 = s1;
  28142. } else {
  28143. peg$currPos = s0;
  28144. s0 = peg$FAILED;
  28145. }
  28146. } else {
  28147. peg$currPos = s0;
  28148. s0 = peg$FAILED;
  28149. }
  28150. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28151. return s0;
  28152. }
  28153. function peg$parsebareSymbol() {
  28154. var s0, s1, s2, s3;
  28155. var key = peg$currPos * 65 + 13,
  28156. cached = peg$resultsCache[key];
  28157. if (cached) {
  28158. peg$currPos = cached.nextPos;
  28159. return cached.result;
  28160. }
  28161. s0 = peg$currPos;
  28162. s1 = peg$currPos;
  28163. s2 = [];
  28164. s3 = peg$parsekeyword();
  28165. if (s3 !== peg$FAILED) {
  28166. while (s3 !== peg$FAILED) {
  28167. s2.push(s3);
  28168. s3 = peg$parsekeyword();
  28169. }
  28170. } else {
  28171. s2 = peg$FAILED;
  28172. }
  28173. if (s2 !== peg$FAILED) {
  28174. s1 = input.substring(s1, peg$currPos);
  28175. } else {
  28176. s1 = s2;
  28177. }
  28178. if (s1 === peg$FAILED) {
  28179. s1 = peg$parsebinarySelector();
  28180. if (s1 === peg$FAILED) {
  28181. s1 = peg$parseidentifier();
  28182. if (s1 === peg$FAILED) {
  28183. s1 = peg$parserawString();
  28184. }
  28185. }
  28186. }
  28187. if (s1 !== peg$FAILED) {
  28188. peg$savedPos = s0;
  28189. s1 = peg$c16(s1);
  28190. }
  28191. s0 = s1;
  28192. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28193. return s0;
  28194. }
  28195. function peg$parsenumber() {
  28196. var s0, s1;
  28197. var key = peg$currPos * 65 + 14,
  28198. cached = peg$resultsCache[key];
  28199. if (cached) {
  28200. peg$currPos = cached.nextPos;
  28201. return cached.result;
  28202. }
  28203. s0 = peg$currPos;
  28204. s1 = peg$parserawNumber();
  28205. if (s1 !== peg$FAILED) {
  28206. peg$savedPos = s0;
  28207. s1 = peg$c16(s1);
  28208. }
  28209. s0 = s1;
  28210. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28211. return s0;
  28212. }
  28213. function peg$parserawNumber() {
  28214. var s0;
  28215. var key = peg$currPos * 65 + 15,
  28216. cached = peg$resultsCache[key];
  28217. if (cached) {
  28218. peg$currPos = cached.nextPos;
  28219. return cached.result;
  28220. }
  28221. s0 = peg$parsenumberExp();
  28222. if (s0 === peg$FAILED) {
  28223. s0 = peg$parsehex();
  28224. if (s0 === peg$FAILED) {
  28225. s0 = peg$parsefloat();
  28226. if (s0 === peg$FAILED) {
  28227. s0 = peg$parseinteger();
  28228. }
  28229. }
  28230. }
  28231. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28232. return s0;
  28233. }
  28234. function peg$parsenumberExp() {
  28235. var s0, s1, s2, s3, s4, s5;
  28236. var key = peg$currPos * 65 + 16,
  28237. cached = peg$resultsCache[key];
  28238. if (cached) {
  28239. peg$currPos = cached.nextPos;
  28240. return cached.result;
  28241. }
  28242. s0 = peg$currPos;
  28243. s1 = peg$currPos;
  28244. s2 = peg$currPos;
  28245. s3 = peg$parsefloat();
  28246. if (s3 === peg$FAILED) {
  28247. s3 = peg$parseinteger();
  28248. }
  28249. if (s3 !== peg$FAILED) {
  28250. if (input.charCodeAt(peg$currPos) === 101) {
  28251. s4 = peg$c32;
  28252. peg$currPos++;
  28253. } else {
  28254. s4 = peg$FAILED;
  28255. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  28256. }
  28257. if (s4 !== peg$FAILED) {
  28258. s5 = peg$parseinteger();
  28259. if (s5 !== peg$FAILED) {
  28260. s3 = [s3, s4, s5];
  28261. s2 = s3;
  28262. } else {
  28263. peg$currPos = s2;
  28264. s2 = peg$FAILED;
  28265. }
  28266. } else {
  28267. peg$currPos = s2;
  28268. s2 = peg$FAILED;
  28269. }
  28270. } else {
  28271. peg$currPos = s2;
  28272. s2 = peg$FAILED;
  28273. }
  28274. if (s2 !== peg$FAILED) {
  28275. s1 = input.substring(s1, peg$currPos);
  28276. } else {
  28277. s1 = s2;
  28278. }
  28279. if (s1 !== peg$FAILED) {
  28280. peg$savedPos = s0;
  28281. s1 = peg$c34(s1);
  28282. }
  28283. s0 = s1;
  28284. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28285. return s0;
  28286. }
  28287. function peg$parsehex() {
  28288. var s0, s1, s2, s3, s4, s5;
  28289. var key = peg$currPos * 65 + 17,
  28290. cached = peg$resultsCache[key];
  28291. if (cached) {
  28292. peg$currPos = cached.nextPos;
  28293. return cached.result;
  28294. }
  28295. s0 = peg$currPos;
  28296. if (input.charCodeAt(peg$currPos) === 45) {
  28297. s1 = peg$c35;
  28298. peg$currPos++;
  28299. } else {
  28300. s1 = peg$FAILED;
  28301. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28302. }
  28303. if (s1 === peg$FAILED) {
  28304. s1 = null;
  28305. }
  28306. if (s1 !== peg$FAILED) {
  28307. if (input.substr(peg$currPos, 3) === peg$c37) {
  28308. s2 = peg$c37;
  28309. peg$currPos += 3;
  28310. } else {
  28311. s2 = peg$FAILED;
  28312. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  28313. }
  28314. if (s2 !== peg$FAILED) {
  28315. s3 = peg$currPos;
  28316. s4 = [];
  28317. if (peg$c39.test(input.charAt(peg$currPos))) {
  28318. s5 = input.charAt(peg$currPos);
  28319. peg$currPos++;
  28320. } else {
  28321. s5 = peg$FAILED;
  28322. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  28323. }
  28324. if (s5 !== peg$FAILED) {
  28325. while (s5 !== peg$FAILED) {
  28326. s4.push(s5);
  28327. if (peg$c39.test(input.charAt(peg$currPos))) {
  28328. s5 = input.charAt(peg$currPos);
  28329. peg$currPos++;
  28330. } else {
  28331. s5 = peg$FAILED;
  28332. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  28333. }
  28334. }
  28335. } else {
  28336. s4 = peg$FAILED;
  28337. }
  28338. if (s4 !== peg$FAILED) {
  28339. s3 = input.substring(s3, peg$currPos);
  28340. } else {
  28341. s3 = s4;
  28342. }
  28343. if (s3 !== peg$FAILED) {
  28344. peg$savedPos = s0;
  28345. s1 = peg$c41(s1, s3);
  28346. s0 = s1;
  28347. } else {
  28348. peg$currPos = s0;
  28349. s0 = peg$FAILED;
  28350. }
  28351. } else {
  28352. peg$currPos = s0;
  28353. s0 = peg$FAILED;
  28354. }
  28355. } else {
  28356. peg$currPos = s0;
  28357. s0 = peg$FAILED;
  28358. }
  28359. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28360. return s0;
  28361. }
  28362. function peg$parsefloat() {
  28363. var s0, s1, s2, s3, s4, s5, s6, s7;
  28364. var key = peg$currPos * 65 + 18,
  28365. cached = peg$resultsCache[key];
  28366. if (cached) {
  28367. peg$currPos = cached.nextPos;
  28368. return cached.result;
  28369. }
  28370. s0 = peg$currPos;
  28371. s1 = peg$currPos;
  28372. s2 = peg$currPos;
  28373. if (input.charCodeAt(peg$currPos) === 45) {
  28374. s3 = peg$c35;
  28375. peg$currPos++;
  28376. } else {
  28377. s3 = peg$FAILED;
  28378. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28379. }
  28380. if (s3 === peg$FAILED) {
  28381. s3 = null;
  28382. }
  28383. if (s3 !== peg$FAILED) {
  28384. s4 = [];
  28385. if (peg$c42.test(input.charAt(peg$currPos))) {
  28386. s5 = input.charAt(peg$currPos);
  28387. peg$currPos++;
  28388. } else {
  28389. s5 = peg$FAILED;
  28390. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28391. }
  28392. if (s5 !== peg$FAILED) {
  28393. while (s5 !== peg$FAILED) {
  28394. s4.push(s5);
  28395. if (peg$c42.test(input.charAt(peg$currPos))) {
  28396. s5 = input.charAt(peg$currPos);
  28397. peg$currPos++;
  28398. } else {
  28399. s5 = peg$FAILED;
  28400. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28401. }
  28402. }
  28403. } else {
  28404. s4 = peg$FAILED;
  28405. }
  28406. if (s4 !== peg$FAILED) {
  28407. if (input.charCodeAt(peg$currPos) === 46) {
  28408. s5 = peg$c6;
  28409. peg$currPos++;
  28410. } else {
  28411. s5 = peg$FAILED;
  28412. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  28413. }
  28414. if (s5 !== peg$FAILED) {
  28415. s6 = [];
  28416. if (peg$c42.test(input.charAt(peg$currPos))) {
  28417. s7 = input.charAt(peg$currPos);
  28418. peg$currPos++;
  28419. } else {
  28420. s7 = peg$FAILED;
  28421. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28422. }
  28423. if (s7 !== peg$FAILED) {
  28424. while (s7 !== peg$FAILED) {
  28425. s6.push(s7);
  28426. if (peg$c42.test(input.charAt(peg$currPos))) {
  28427. s7 = input.charAt(peg$currPos);
  28428. peg$currPos++;
  28429. } else {
  28430. s7 = peg$FAILED;
  28431. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28432. }
  28433. }
  28434. } else {
  28435. s6 = peg$FAILED;
  28436. }
  28437. if (s6 !== peg$FAILED) {
  28438. s3 = [s3, s4, s5, s6];
  28439. s2 = s3;
  28440. } else {
  28441. peg$currPos = s2;
  28442. s2 = peg$FAILED;
  28443. }
  28444. } else {
  28445. peg$currPos = s2;
  28446. s2 = peg$FAILED;
  28447. }
  28448. } else {
  28449. peg$currPos = s2;
  28450. s2 = peg$FAILED;
  28451. }
  28452. } else {
  28453. peg$currPos = s2;
  28454. s2 = peg$FAILED;
  28455. }
  28456. if (s2 !== peg$FAILED) {
  28457. s1 = input.substring(s1, peg$currPos);
  28458. } else {
  28459. s1 = s2;
  28460. }
  28461. if (s1 !== peg$FAILED) {
  28462. peg$savedPos = s0;
  28463. s1 = peg$c44(s1);
  28464. }
  28465. s0 = s1;
  28466. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28467. return s0;
  28468. }
  28469. function peg$parseinteger() {
  28470. var s0, s1, s2, s3, s4, s5;
  28471. var key = peg$currPos * 65 + 19,
  28472. cached = peg$resultsCache[key];
  28473. if (cached) {
  28474. peg$currPos = cached.nextPos;
  28475. return cached.result;
  28476. }
  28477. s0 = peg$currPos;
  28478. s1 = peg$currPos;
  28479. s2 = peg$currPos;
  28480. if (input.charCodeAt(peg$currPos) === 45) {
  28481. s3 = peg$c35;
  28482. peg$currPos++;
  28483. } else {
  28484. s3 = peg$FAILED;
  28485. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28486. }
  28487. if (s3 === peg$FAILED) {
  28488. s3 = null;
  28489. }
  28490. if (s3 !== peg$FAILED) {
  28491. s4 = [];
  28492. if (peg$c42.test(input.charAt(peg$currPos))) {
  28493. s5 = input.charAt(peg$currPos);
  28494. peg$currPos++;
  28495. } else {
  28496. s5 = peg$FAILED;
  28497. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28498. }
  28499. if (s5 !== peg$FAILED) {
  28500. while (s5 !== peg$FAILED) {
  28501. s4.push(s5);
  28502. if (peg$c42.test(input.charAt(peg$currPos))) {
  28503. s5 = input.charAt(peg$currPos);
  28504. peg$currPos++;
  28505. } else {
  28506. s5 = peg$FAILED;
  28507. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28508. }
  28509. }
  28510. } else {
  28511. s4 = peg$FAILED;
  28512. }
  28513. if (s4 !== peg$FAILED) {
  28514. s3 = [s3, s4];
  28515. s2 = s3;
  28516. } else {
  28517. peg$currPos = s2;
  28518. s2 = peg$FAILED;
  28519. }
  28520. } else {
  28521. peg$currPos = s2;
  28522. s2 = peg$FAILED;
  28523. }
  28524. if (s2 !== peg$FAILED) {
  28525. s1 = input.substring(s1, peg$currPos);
  28526. } else {
  28527. s1 = s2;
  28528. }
  28529. if (s1 !== peg$FAILED) {
  28530. peg$savedPos = s0;
  28531. s1 = peg$c45(s1);
  28532. }
  28533. s0 = s1;
  28534. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28535. return s0;
  28536. }
  28537. function peg$parseliteralArray() {
  28538. var s0, s1, s2, s3, s4;
  28539. var key = peg$currPos * 65 + 20,
  28540. cached = peg$resultsCache[key];
  28541. if (cached) {
  28542. peg$currPos = cached.nextPos;
  28543. return cached.result;
  28544. }
  28545. s0 = peg$currPos;
  28546. if (input.substr(peg$currPos, 2) === peg$c46) {
  28547. s1 = peg$c46;
  28548. peg$currPos += 2;
  28549. } else {
  28550. s1 = peg$FAILED;
  28551. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  28552. }
  28553. if (s1 !== peg$FAILED) {
  28554. s2 = peg$parsewsLiteralArrayContents();
  28555. if (s2 !== peg$FAILED) {
  28556. s3 = peg$parsews();
  28557. if (s3 !== peg$FAILED) {
  28558. if (input.charCodeAt(peg$currPos) === 41) {
  28559. s4 = peg$c48;
  28560. peg$currPos++;
  28561. } else {
  28562. s4 = peg$FAILED;
  28563. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28564. }
  28565. if (s4 !== peg$FAILED) {
  28566. peg$savedPos = s0;
  28567. s1 = peg$c50(s2);
  28568. s0 = s1;
  28569. } else {
  28570. peg$currPos = s0;
  28571. s0 = peg$FAILED;
  28572. }
  28573. } else {
  28574. peg$currPos = s0;
  28575. s0 = peg$FAILED;
  28576. }
  28577. } else {
  28578. peg$currPos = s0;
  28579. s0 = peg$FAILED;
  28580. }
  28581. } else {
  28582. peg$currPos = s0;
  28583. s0 = peg$FAILED;
  28584. }
  28585. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28586. return s0;
  28587. }
  28588. function peg$parsebareLiteralArray() {
  28589. var s0, s1, s2, s3, s4;
  28590. var key = peg$currPos * 65 + 21,
  28591. cached = peg$resultsCache[key];
  28592. if (cached) {
  28593. peg$currPos = cached.nextPos;
  28594. return cached.result;
  28595. }
  28596. s0 = peg$currPos;
  28597. if (input.charCodeAt(peg$currPos) === 40) {
  28598. s1 = peg$c51;
  28599. peg$currPos++;
  28600. } else {
  28601. s1 = peg$FAILED;
  28602. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  28603. }
  28604. if (s1 !== peg$FAILED) {
  28605. s2 = peg$parsewsLiteralArrayContents();
  28606. if (s2 !== peg$FAILED) {
  28607. s3 = peg$parsews();
  28608. if (s3 !== peg$FAILED) {
  28609. if (input.charCodeAt(peg$currPos) === 41) {
  28610. s4 = peg$c48;
  28611. peg$currPos++;
  28612. } else {
  28613. s4 = peg$FAILED;
  28614. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28615. }
  28616. if (s4 !== peg$FAILED) {
  28617. peg$savedPos = s0;
  28618. s1 = peg$c50(s2);
  28619. s0 = s1;
  28620. } else {
  28621. peg$currPos = s0;
  28622. s0 = peg$FAILED;
  28623. }
  28624. } else {
  28625. peg$currPos = s0;
  28626. s0 = peg$FAILED;
  28627. }
  28628. } else {
  28629. peg$currPos = s0;
  28630. s0 = peg$FAILED;
  28631. }
  28632. } else {
  28633. peg$currPos = s0;
  28634. s0 = peg$FAILED;
  28635. }
  28636. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28637. return s0;
  28638. }
  28639. function peg$parseliteralArrayElement() {
  28640. var s0;
  28641. var key = peg$currPos * 65 + 22,
  28642. cached = peg$resultsCache[key];
  28643. if (cached) {
  28644. peg$currPos = cached.nextPos;
  28645. return cached.result;
  28646. }
  28647. s0 = peg$parseparseTimeLiteral();
  28648. if (s0 === peg$FAILED) {
  28649. s0 = peg$parsebareLiteralArray();
  28650. if (s0 === peg$FAILED) {
  28651. s0 = peg$parsebareSymbol();
  28652. }
  28653. }
  28654. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28655. return s0;
  28656. }
  28657. function peg$parsewsLiteralArrayContents() {
  28658. var s0, s1, s2, s3;
  28659. var key = peg$currPos * 65 + 23,
  28660. cached = peg$resultsCache[key];
  28661. if (cached) {
  28662. peg$currPos = cached.nextPos;
  28663. return cached.result;
  28664. }
  28665. s0 = [];
  28666. s1 = peg$currPos;
  28667. s2 = peg$parsews();
  28668. if (s2 !== peg$FAILED) {
  28669. s3 = peg$parseliteralArrayElement();
  28670. if (s3 !== peg$FAILED) {
  28671. peg$savedPos = s1;
  28672. s2 = peg$c53(s3);
  28673. s1 = s2;
  28674. } else {
  28675. peg$currPos = s1;
  28676. s1 = peg$FAILED;
  28677. }
  28678. } else {
  28679. peg$currPos = s1;
  28680. s1 = peg$FAILED;
  28681. }
  28682. while (s1 !== peg$FAILED) {
  28683. s0.push(s1);
  28684. s1 = peg$currPos;
  28685. s2 = peg$parsews();
  28686. if (s2 !== peg$FAILED) {
  28687. s3 = peg$parseliteralArrayElement();
  28688. if (s3 !== peg$FAILED) {
  28689. peg$savedPos = s1;
  28690. s2 = peg$c53(s3);
  28691. s1 = s2;
  28692. } else {
  28693. peg$currPos = s1;
  28694. s1 = peg$FAILED;
  28695. }
  28696. } else {
  28697. peg$currPos = s1;
  28698. s1 = peg$FAILED;
  28699. }
  28700. }
  28701. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28702. return s0;
  28703. }
  28704. function peg$parsedynamicArray() {
  28705. var s0, s1, s2, s3, s4;
  28706. var key = peg$currPos * 65 + 24,
  28707. cached = peg$resultsCache[key];
  28708. if (cached) {
  28709. peg$currPos = cached.nextPos;
  28710. return cached.result;
  28711. }
  28712. s0 = peg$currPos;
  28713. if (input.charCodeAt(peg$currPos) === 123) {
  28714. s1 = peg$c54;
  28715. peg$currPos++;
  28716. } else {
  28717. s1 = peg$FAILED;
  28718. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  28719. }
  28720. if (s1 !== peg$FAILED) {
  28721. s2 = peg$parsewsExpressions();
  28722. if (s2 === peg$FAILED) {
  28723. s2 = null;
  28724. }
  28725. if (s2 !== peg$FAILED) {
  28726. s3 = peg$parsemaybeDotsWs();
  28727. if (s3 !== peg$FAILED) {
  28728. if (input.charCodeAt(peg$currPos) === 125) {
  28729. s4 = peg$c56;
  28730. peg$currPos++;
  28731. } else {
  28732. s4 = peg$FAILED;
  28733. if (peg$silentFails === 0) { peg$fail(peg$c57); }
  28734. }
  28735. if (s4 !== peg$FAILED) {
  28736. peg$savedPos = s0;
  28737. s1 = peg$c58(s2);
  28738. s0 = s1;
  28739. } else {
  28740. peg$currPos = s0;
  28741. s0 = peg$FAILED;
  28742. }
  28743. } else {
  28744. peg$currPos = s0;
  28745. s0 = peg$FAILED;
  28746. }
  28747. } else {
  28748. peg$currPos = s0;
  28749. s0 = peg$FAILED;
  28750. }
  28751. } else {
  28752. peg$currPos = s0;
  28753. s0 = peg$FAILED;
  28754. }
  28755. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28756. return s0;
  28757. }
  28758. function peg$parsedynamicDictionary() {
  28759. var s0, s1, s2, s3, s4;
  28760. var key = peg$currPos * 65 + 25,
  28761. cached = peg$resultsCache[key];
  28762. if (cached) {
  28763. peg$currPos = cached.nextPos;
  28764. return cached.result;
  28765. }
  28766. s0 = peg$currPos;
  28767. if (input.substr(peg$currPos, 2) === peg$c59) {
  28768. s1 = peg$c59;
  28769. peg$currPos += 2;
  28770. } else {
  28771. s1 = peg$FAILED;
  28772. if (peg$silentFails === 0) { peg$fail(peg$c60); }
  28773. }
  28774. if (s1 !== peg$FAILED) {
  28775. s2 = peg$parsewsAssociations();
  28776. if (s2 === peg$FAILED) {
  28777. s2 = null;
  28778. }
  28779. if (s2 !== peg$FAILED) {
  28780. s3 = peg$parsemaybeDotsWs();
  28781. if (s3 !== peg$FAILED) {
  28782. if (input.charCodeAt(peg$currPos) === 125) {
  28783. s4 = peg$c56;
  28784. peg$currPos++;
  28785. } else {
  28786. s4 = peg$FAILED;
  28787. if (peg$silentFails === 0) { peg$fail(peg$c57); }
  28788. }
  28789. if (s4 !== peg$FAILED) {
  28790. peg$savedPos = s0;
  28791. s1 = peg$c61(s2);
  28792. s0 = s1;
  28793. } else {
  28794. peg$currPos = s0;
  28795. s0 = peg$FAILED;
  28796. }
  28797. } else {
  28798. peg$currPos = s0;
  28799. s0 = peg$FAILED;
  28800. }
  28801. } else {
  28802. peg$currPos = s0;
  28803. s0 = peg$FAILED;
  28804. }
  28805. } else {
  28806. peg$currPos = s0;
  28807. s0 = peg$FAILED;
  28808. }
  28809. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28810. return s0;
  28811. }
  28812. function peg$parsepseudoVariable() {
  28813. var s0, s1, s2;
  28814. var key = peg$currPos * 65 + 26,
  28815. cached = peg$resultsCache[key];
  28816. if (cached) {
  28817. peg$currPos = cached.nextPos;
  28818. return cached.result;
  28819. }
  28820. s0 = peg$currPos;
  28821. s1 = peg$currPos;
  28822. if (input.substr(peg$currPos, 4) === peg$c62) {
  28823. s2 = peg$c62;
  28824. peg$currPos += 4;
  28825. } else {
  28826. s2 = peg$FAILED;
  28827. if (peg$silentFails === 0) { peg$fail(peg$c63); }
  28828. }
  28829. if (s2 !== peg$FAILED) {
  28830. peg$savedPos = s1;
  28831. s2 = peg$c64();
  28832. }
  28833. s1 = s2;
  28834. if (s1 === peg$FAILED) {
  28835. s1 = peg$currPos;
  28836. if (input.substr(peg$currPos, 5) === peg$c65) {
  28837. s2 = peg$c65;
  28838. peg$currPos += 5;
  28839. } else {
  28840. s2 = peg$FAILED;
  28841. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  28842. }
  28843. if (s2 !== peg$FAILED) {
  28844. peg$savedPos = s1;
  28845. s2 = peg$c67();
  28846. }
  28847. s1 = s2;
  28848. if (s1 === peg$FAILED) {
  28849. s1 = peg$currPos;
  28850. if (input.substr(peg$currPos, 3) === peg$c68) {
  28851. s2 = peg$c68;
  28852. peg$currPos += 3;
  28853. } else {
  28854. s2 = peg$FAILED;
  28855. if (peg$silentFails === 0) { peg$fail(peg$c69); }
  28856. }
  28857. if (s2 !== peg$FAILED) {
  28858. peg$savedPos = s1;
  28859. s2 = peg$c70();
  28860. }
  28861. s1 = s2;
  28862. }
  28863. }
  28864. if (s1 !== peg$FAILED) {
  28865. peg$savedPos = s0;
  28866. s1 = peg$c16(s1);
  28867. }
  28868. s0 = s1;
  28869. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28870. return s0;
  28871. }
  28872. function peg$parseparseTimeLiteral() {
  28873. var s0;
  28874. var key = peg$currPos * 65 + 27,
  28875. cached = peg$resultsCache[key];
  28876. if (cached) {
  28877. peg$currPos = cached.nextPos;
  28878. return cached.result;
  28879. }
  28880. s0 = peg$parsepseudoVariable();
  28881. if (s0 === peg$FAILED) {
  28882. s0 = peg$parsenumber();
  28883. if (s0 === peg$FAILED) {
  28884. s0 = peg$parseliteralArray();
  28885. if (s0 === peg$FAILED) {
  28886. s0 = peg$parsestring();
  28887. if (s0 === peg$FAILED) {
  28888. s0 = peg$parsesymbol();
  28889. if (s0 === peg$FAILED) {
  28890. s0 = peg$parsecharacter();
  28891. }
  28892. }
  28893. }
  28894. }
  28895. }
  28896. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28897. return s0;
  28898. }
  28899. function peg$parseruntimeLiteral() {
  28900. var s0;
  28901. var key = peg$currPos * 65 + 28,
  28902. cached = peg$resultsCache[key];
  28903. if (cached) {
  28904. peg$currPos = cached.nextPos;
  28905. return cached.result;
  28906. }
  28907. s0 = peg$parsedynamicDictionary();
  28908. if (s0 === peg$FAILED) {
  28909. s0 = peg$parsedynamicArray();
  28910. if (s0 === peg$FAILED) {
  28911. s0 = peg$parseblock();
  28912. }
  28913. }
  28914. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28915. return s0;
  28916. }
  28917. function peg$parseliteral() {
  28918. var s0;
  28919. var key = peg$currPos * 65 + 29,
  28920. cached = peg$resultsCache[key];
  28921. if (cached) {
  28922. peg$currPos = cached.nextPos;
  28923. return cached.result;
  28924. }
  28925. s0 = peg$parseruntimeLiteral();
  28926. if (s0 === peg$FAILED) {
  28927. s0 = peg$parseparseTimeLiteral();
  28928. }
  28929. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28930. return s0;
  28931. }
  28932. function peg$parsevariable() {
  28933. var s0, s1;
  28934. var key = peg$currPos * 65 + 30,
  28935. cached = peg$resultsCache[key];
  28936. if (cached) {
  28937. peg$currPos = cached.nextPos;
  28938. return cached.result;
  28939. }
  28940. s0 = peg$currPos;
  28941. s1 = peg$parseidentifier();
  28942. if (s1 !== peg$FAILED) {
  28943. peg$savedPos = s0;
  28944. s1 = peg$c71(s1);
  28945. }
  28946. s0 = s1;
  28947. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28948. return s0;
  28949. }
  28950. function peg$parsebinarySelector() {
  28951. var s0, s1, s2;
  28952. var key = peg$currPos * 65 + 31,
  28953. cached = peg$resultsCache[key];
  28954. if (cached) {
  28955. peg$currPos = cached.nextPos;
  28956. return cached.result;
  28957. }
  28958. s0 = peg$currPos;
  28959. s1 = [];
  28960. if (peg$c72.test(input.charAt(peg$currPos))) {
  28961. s2 = input.charAt(peg$currPos);
  28962. peg$currPos++;
  28963. } else {
  28964. s2 = peg$FAILED;
  28965. if (peg$silentFails === 0) { peg$fail(peg$c73); }
  28966. }
  28967. if (s2 !== peg$FAILED) {
  28968. while (s2 !== peg$FAILED) {
  28969. s1.push(s2);
  28970. if (peg$c72.test(input.charAt(peg$currPos))) {
  28971. s2 = input.charAt(peg$currPos);
  28972. peg$currPos++;
  28973. } else {
  28974. s2 = peg$FAILED;
  28975. if (peg$silentFails === 0) { peg$fail(peg$c73); }
  28976. }
  28977. }
  28978. } else {
  28979. s1 = peg$FAILED;
  28980. }
  28981. if (s1 !== peg$FAILED) {
  28982. s0 = input.substring(s0, peg$currPos);
  28983. } else {
  28984. s0 = s1;
  28985. }
  28986. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28987. return s0;
  28988. }
  28989. function peg$parsewsKeywordPattern() {
  28990. var s0, s1, s2, s3, s4, s5, s6;
  28991. var key = peg$currPos * 65 + 32,
  28992. cached = peg$resultsCache[key];
  28993. if (cached) {
  28994. peg$currPos = cached.nextPos;
  28995. return cached.result;
  28996. }
  28997. s0 = peg$currPos;
  28998. s1 = [];
  28999. s2 = peg$currPos;
  29000. s3 = peg$parsews();
  29001. if (s3 !== peg$FAILED) {
  29002. s4 = peg$parsekeyword();
  29003. if (s4 !== peg$FAILED) {
  29004. s5 = peg$parsews();
  29005. if (s5 !== peg$FAILED) {
  29006. s6 = peg$parseidentifier();
  29007. if (s6 !== peg$FAILED) {
  29008. peg$savedPos = s2;
  29009. s3 = peg$c74(s4, s6);
  29010. s2 = s3;
  29011. } else {
  29012. peg$currPos = s2;
  29013. s2 = peg$FAILED;
  29014. }
  29015. } else {
  29016. peg$currPos = s2;
  29017. s2 = peg$FAILED;
  29018. }
  29019. } else {
  29020. peg$currPos = s2;
  29021. s2 = peg$FAILED;
  29022. }
  29023. } else {
  29024. peg$currPos = s2;
  29025. s2 = peg$FAILED;
  29026. }
  29027. if (s2 !== peg$FAILED) {
  29028. while (s2 !== peg$FAILED) {
  29029. s1.push(s2);
  29030. s2 = peg$currPos;
  29031. s3 = peg$parsews();
  29032. if (s3 !== peg$FAILED) {
  29033. s4 = peg$parsekeyword();
  29034. if (s4 !== peg$FAILED) {
  29035. s5 = peg$parsews();
  29036. if (s5 !== peg$FAILED) {
  29037. s6 = peg$parseidentifier();
  29038. if (s6 !== peg$FAILED) {
  29039. peg$savedPos = s2;
  29040. s3 = peg$c74(s4, s6);
  29041. s2 = s3;
  29042. } else {
  29043. peg$currPos = s2;
  29044. s2 = peg$FAILED;
  29045. }
  29046. } else {
  29047. peg$currPos = s2;
  29048. s2 = peg$FAILED;
  29049. }
  29050. } else {
  29051. peg$currPos = s2;
  29052. s2 = peg$FAILED;
  29053. }
  29054. } else {
  29055. peg$currPos = s2;
  29056. s2 = peg$FAILED;
  29057. }
  29058. }
  29059. } else {
  29060. s1 = peg$FAILED;
  29061. }
  29062. if (s1 !== peg$FAILED) {
  29063. peg$savedPos = s0;
  29064. s1 = peg$c75(s1);
  29065. }
  29066. s0 = s1;
  29067. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29068. return s0;
  29069. }
  29070. function peg$parsewsBinaryPattern() {
  29071. var s0, s1, s2, s3, s4;
  29072. var key = peg$currPos * 65 + 33,
  29073. cached = peg$resultsCache[key];
  29074. if (cached) {
  29075. peg$currPos = cached.nextPos;
  29076. return cached.result;
  29077. }
  29078. s0 = peg$currPos;
  29079. s1 = peg$parsews();
  29080. if (s1 !== peg$FAILED) {
  29081. s2 = peg$parsebinarySelector();
  29082. if (s2 !== peg$FAILED) {
  29083. s3 = peg$parsews();
  29084. if (s3 !== peg$FAILED) {
  29085. s4 = peg$parseidentifier();
  29086. if (s4 !== peg$FAILED) {
  29087. peg$savedPos = s0;
  29088. s1 = peg$c76(s2, s4);
  29089. s0 = s1;
  29090. } else {
  29091. peg$currPos = s0;
  29092. s0 = peg$FAILED;
  29093. }
  29094. } else {
  29095. peg$currPos = s0;
  29096. s0 = peg$FAILED;
  29097. }
  29098. } else {
  29099. peg$currPos = s0;
  29100. s0 = peg$FAILED;
  29101. }
  29102. } else {
  29103. peg$currPos = s0;
  29104. s0 = peg$FAILED;
  29105. }
  29106. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29107. return s0;
  29108. }
  29109. function peg$parsewsUnaryPattern() {
  29110. var s0, s1, s2;
  29111. var key = peg$currPos * 65 + 34,
  29112. cached = peg$resultsCache[key];
  29113. if (cached) {
  29114. peg$currPos = cached.nextPos;
  29115. return cached.result;
  29116. }
  29117. s0 = peg$currPos;
  29118. s1 = peg$parsews();
  29119. if (s1 !== peg$FAILED) {
  29120. s2 = peg$parseidentifier();
  29121. if (s2 !== peg$FAILED) {
  29122. peg$savedPos = s0;
  29123. s1 = peg$c77(s2);
  29124. s0 = s1;
  29125. } else {
  29126. peg$currPos = s0;
  29127. s0 = peg$FAILED;
  29128. }
  29129. } else {
  29130. peg$currPos = s0;
  29131. s0 = peg$FAILED;
  29132. }
  29133. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29134. return s0;
  29135. }
  29136. function peg$parseexpression() {
  29137. var s0;
  29138. var key = peg$currPos * 65 + 35,
  29139. cached = peg$resultsCache[key];
  29140. if (cached) {
  29141. peg$currPos = cached.nextPos;
  29142. return cached.result;
  29143. }
  29144. s0 = peg$parseassignment();
  29145. if (s0 === peg$FAILED) {
  29146. s0 = peg$parsecascade();
  29147. if (s0 === peg$FAILED) {
  29148. s0 = peg$parsekeywordSend();
  29149. }
  29150. }
  29151. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29152. return s0;
  29153. }
  29154. function peg$parsewsExpressionsRest() {
  29155. var s0, s1, s2;
  29156. var key = peg$currPos * 65 + 36,
  29157. cached = peg$resultsCache[key];
  29158. if (cached) {
  29159. peg$currPos = cached.nextPos;
  29160. return cached.result;
  29161. }
  29162. s0 = peg$currPos;
  29163. s1 = peg$parsesomeDotsWs();
  29164. if (s1 !== peg$FAILED) {
  29165. s2 = peg$parseexpression();
  29166. if (s2 !== peg$FAILED) {
  29167. peg$savedPos = s0;
  29168. s1 = peg$c78(s2);
  29169. s0 = s1;
  29170. } else {
  29171. peg$currPos = s0;
  29172. s0 = peg$FAILED;
  29173. }
  29174. } else {
  29175. peg$currPos = s0;
  29176. s0 = peg$FAILED;
  29177. }
  29178. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29179. return s0;
  29180. }
  29181. function peg$parsewsExpressions() {
  29182. var s0, s1, s2, s3, s4;
  29183. var key = peg$currPos * 65 + 37,
  29184. cached = peg$resultsCache[key];
  29185. if (cached) {
  29186. peg$currPos = cached.nextPos;
  29187. return cached.result;
  29188. }
  29189. s0 = peg$currPos;
  29190. s1 = peg$parsemaybeDotsWs();
  29191. if (s1 !== peg$FAILED) {
  29192. s2 = peg$parseexpression();
  29193. if (s2 !== peg$FAILED) {
  29194. s3 = [];
  29195. s4 = peg$parsewsExpressionsRest();
  29196. while (s4 !== peg$FAILED) {
  29197. s3.push(s4);
  29198. s4 = peg$parsewsExpressionsRest();
  29199. }
  29200. if (s3 !== peg$FAILED) {
  29201. peg$savedPos = s0;
  29202. s1 = peg$c79(s2, s3);
  29203. s0 = s1;
  29204. } else {
  29205. peg$currPos = s0;
  29206. s0 = peg$FAILED;
  29207. }
  29208. } else {
  29209. peg$currPos = s0;
  29210. s0 = peg$FAILED;
  29211. }
  29212. } else {
  29213. peg$currPos = s0;
  29214. s0 = peg$FAILED;
  29215. }
  29216. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29217. return s0;
  29218. }
  29219. function peg$parsewsUnaryPragmaMessage() {
  29220. var s0, s1, s2, s3, s4;
  29221. var key = peg$currPos * 65 + 38,
  29222. cached = peg$resultsCache[key];
  29223. if (cached) {
  29224. peg$currPos = cached.nextPos;
  29225. return cached.result;
  29226. }
  29227. s0 = peg$currPos;
  29228. s1 = peg$parsews();
  29229. if (s1 !== peg$FAILED) {
  29230. s2 = peg$parseidentifier();
  29231. if (s2 !== peg$FAILED) {
  29232. s3 = peg$currPos;
  29233. peg$silentFails++;
  29234. if (input.charCodeAt(peg$currPos) === 58) {
  29235. s4 = peg$c12;
  29236. peg$currPos++;
  29237. } else {
  29238. s4 = peg$FAILED;
  29239. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29240. }
  29241. peg$silentFails--;
  29242. if (s4 === peg$FAILED) {
  29243. s3 = void 0;
  29244. } else {
  29245. peg$currPos = s3;
  29246. s3 = peg$FAILED;
  29247. }
  29248. if (s3 !== peg$FAILED) {
  29249. peg$savedPos = s0;
  29250. s1 = peg$c80(s2);
  29251. s0 = s1;
  29252. } else {
  29253. peg$currPos = s0;
  29254. s0 = peg$FAILED;
  29255. }
  29256. } else {
  29257. peg$currPos = s0;
  29258. s0 = peg$FAILED;
  29259. }
  29260. } else {
  29261. peg$currPos = s0;
  29262. s0 = peg$FAILED;
  29263. }
  29264. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29265. return s0;
  29266. }
  29267. function peg$parsewsKeywordPragmaMessage() {
  29268. var s0, s1, s2, s3, s4, s5, s6;
  29269. var key = peg$currPos * 65 + 39,
  29270. cached = peg$resultsCache[key];
  29271. if (cached) {
  29272. peg$currPos = cached.nextPos;
  29273. return cached.result;
  29274. }
  29275. s0 = peg$currPos;
  29276. s1 = [];
  29277. s2 = peg$currPos;
  29278. s3 = peg$parsews();
  29279. if (s3 !== peg$FAILED) {
  29280. s4 = peg$parsekeyword();
  29281. if (s4 !== peg$FAILED) {
  29282. s5 = peg$parsews();
  29283. if (s5 !== peg$FAILED) {
  29284. s6 = peg$parseparseTimeLiteral();
  29285. if (s6 !== peg$FAILED) {
  29286. peg$savedPos = s2;
  29287. s3 = peg$c74(s4, s6);
  29288. s2 = s3;
  29289. } else {
  29290. peg$currPos = s2;
  29291. s2 = peg$FAILED;
  29292. }
  29293. } else {
  29294. peg$currPos = s2;
  29295. s2 = peg$FAILED;
  29296. }
  29297. } else {
  29298. peg$currPos = s2;
  29299. s2 = peg$FAILED;
  29300. }
  29301. } else {
  29302. peg$currPos = s2;
  29303. s2 = peg$FAILED;
  29304. }
  29305. if (s2 !== peg$FAILED) {
  29306. while (s2 !== peg$FAILED) {
  29307. s1.push(s2);
  29308. s2 = peg$currPos;
  29309. s3 = peg$parsews();
  29310. if (s3 !== peg$FAILED) {
  29311. s4 = peg$parsekeyword();
  29312. if (s4 !== peg$FAILED) {
  29313. s5 = peg$parsews();
  29314. if (s5 !== peg$FAILED) {
  29315. s6 = peg$parseparseTimeLiteral();
  29316. if (s6 !== peg$FAILED) {
  29317. peg$savedPos = s2;
  29318. s3 = peg$c74(s4, s6);
  29319. s2 = s3;
  29320. } else {
  29321. peg$currPos = s2;
  29322. s2 = peg$FAILED;
  29323. }
  29324. } else {
  29325. peg$currPos = s2;
  29326. s2 = peg$FAILED;
  29327. }
  29328. } else {
  29329. peg$currPos = s2;
  29330. s2 = peg$FAILED;
  29331. }
  29332. } else {
  29333. peg$currPos = s2;
  29334. s2 = peg$FAILED;
  29335. }
  29336. }
  29337. } else {
  29338. s1 = peg$FAILED;
  29339. }
  29340. if (s1 !== peg$FAILED) {
  29341. peg$savedPos = s0;
  29342. s1 = peg$c81(s1);
  29343. }
  29344. s0 = s1;
  29345. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29346. return s0;
  29347. }
  29348. function peg$parsewsPragmaMessage() {
  29349. var s0;
  29350. var key = peg$currPos * 65 + 40,
  29351. cached = peg$resultsCache[key];
  29352. if (cached) {
  29353. peg$currPos = cached.nextPos;
  29354. return cached.result;
  29355. }
  29356. s0 = peg$parsewsUnaryPragmaMessage();
  29357. if (s0 === peg$FAILED) {
  29358. s0 = peg$parsewsKeywordPragmaMessage();
  29359. }
  29360. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29361. return s0;
  29362. }
  29363. function peg$parsewsPragmas() {
  29364. var s0, s1, s2, s3, s4, s5, s6;
  29365. var key = peg$currPos * 65 + 41,
  29366. cached = peg$resultsCache[key];
  29367. if (cached) {
  29368. peg$currPos = cached.nextPos;
  29369. return cached.result;
  29370. }
  29371. s0 = [];
  29372. s1 = peg$currPos;
  29373. s2 = peg$parsews();
  29374. if (s2 !== peg$FAILED) {
  29375. if (input.charCodeAt(peg$currPos) === 60) {
  29376. s3 = peg$c82;
  29377. peg$currPos++;
  29378. } else {
  29379. s3 = peg$FAILED;
  29380. if (peg$silentFails === 0) { peg$fail(peg$c83); }
  29381. }
  29382. if (s3 !== peg$FAILED) {
  29383. s4 = peg$parsewsPragmaMessage();
  29384. if (s4 !== peg$FAILED) {
  29385. s5 = peg$parsews();
  29386. if (s5 !== peg$FAILED) {
  29387. if (input.charCodeAt(peg$currPos) === 62) {
  29388. s6 = peg$c84;
  29389. peg$currPos++;
  29390. } else {
  29391. s6 = peg$FAILED;
  29392. if (peg$silentFails === 0) { peg$fail(peg$c85); }
  29393. }
  29394. if (s6 !== peg$FAILED) {
  29395. peg$savedPos = s1;
  29396. s2 = peg$c86(s4);
  29397. s1 = s2;
  29398. } else {
  29399. peg$currPos = s1;
  29400. s1 = peg$FAILED;
  29401. }
  29402. } else {
  29403. peg$currPos = s1;
  29404. s1 = peg$FAILED;
  29405. }
  29406. } else {
  29407. peg$currPos = s1;
  29408. s1 = peg$FAILED;
  29409. }
  29410. } else {
  29411. peg$currPos = s1;
  29412. s1 = peg$FAILED;
  29413. }
  29414. } else {
  29415. peg$currPos = s1;
  29416. s1 = peg$FAILED;
  29417. }
  29418. while (s1 !== peg$FAILED) {
  29419. s0.push(s1);
  29420. s1 = peg$currPos;
  29421. s2 = peg$parsews();
  29422. if (s2 !== peg$FAILED) {
  29423. if (input.charCodeAt(peg$currPos) === 60) {
  29424. s3 = peg$c82;
  29425. peg$currPos++;
  29426. } else {
  29427. s3 = peg$FAILED;
  29428. if (peg$silentFails === 0) { peg$fail(peg$c83); }
  29429. }
  29430. if (s3 !== peg$FAILED) {
  29431. s4 = peg$parsewsPragmaMessage();
  29432. if (s4 !== peg$FAILED) {
  29433. s5 = peg$parsews();
  29434. if (s5 !== peg$FAILED) {
  29435. if (input.charCodeAt(peg$currPos) === 62) {
  29436. s6 = peg$c84;
  29437. peg$currPos++;
  29438. } else {
  29439. s6 = peg$FAILED;
  29440. if (peg$silentFails === 0) { peg$fail(peg$c85); }
  29441. }
  29442. if (s6 !== peg$FAILED) {
  29443. peg$savedPos = s1;
  29444. s2 = peg$c86(s4);
  29445. s1 = s2;
  29446. } else {
  29447. peg$currPos = s1;
  29448. s1 = peg$FAILED;
  29449. }
  29450. } else {
  29451. peg$currPos = s1;
  29452. s1 = peg$FAILED;
  29453. }
  29454. } else {
  29455. peg$currPos = s1;
  29456. s1 = peg$FAILED;
  29457. }
  29458. } else {
  29459. peg$currPos = s1;
  29460. s1 = peg$FAILED;
  29461. }
  29462. } else {
  29463. peg$currPos = s1;
  29464. s1 = peg$FAILED;
  29465. }
  29466. }
  29467. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29468. return s0;
  29469. }
  29470. function peg$parseassignment() {
  29471. var s0, s1, s2, s3, s4, s5;
  29472. var key = peg$currPos * 65 + 42,
  29473. cached = peg$resultsCache[key];
  29474. if (cached) {
  29475. peg$currPos = cached.nextPos;
  29476. return cached.result;
  29477. }
  29478. s0 = peg$currPos;
  29479. s1 = peg$parsevariable();
  29480. if (s1 !== peg$FAILED) {
  29481. s2 = peg$parsews();
  29482. if (s2 !== peg$FAILED) {
  29483. if (input.substr(peg$currPos, 2) === peg$c87) {
  29484. s3 = peg$c87;
  29485. peg$currPos += 2;
  29486. } else {
  29487. s3 = peg$FAILED;
  29488. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  29489. }
  29490. if (s3 !== peg$FAILED) {
  29491. s4 = peg$parsews();
  29492. if (s4 !== peg$FAILED) {
  29493. s5 = peg$parseexpression();
  29494. if (s5 !== peg$FAILED) {
  29495. peg$savedPos = s0;
  29496. s1 = peg$c89(s1, s5);
  29497. s0 = s1;
  29498. } else {
  29499. peg$currPos = s0;
  29500. s0 = peg$FAILED;
  29501. }
  29502. } else {
  29503. peg$currPos = s0;
  29504. s0 = peg$FAILED;
  29505. }
  29506. } else {
  29507. peg$currPos = s0;
  29508. s0 = peg$FAILED;
  29509. }
  29510. } else {
  29511. peg$currPos = s0;
  29512. s0 = peg$FAILED;
  29513. }
  29514. } else {
  29515. peg$currPos = s0;
  29516. s0 = peg$FAILED;
  29517. }
  29518. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29519. return s0;
  29520. }
  29521. function peg$parseret() {
  29522. var s0, s1, s2, s3;
  29523. var key = peg$currPos * 65 + 43,
  29524. cached = peg$resultsCache[key];
  29525. if (cached) {
  29526. peg$currPos = cached.nextPos;
  29527. return cached.result;
  29528. }
  29529. s0 = peg$currPos;
  29530. if (input.charCodeAt(peg$currPos) === 94) {
  29531. s1 = peg$c90;
  29532. peg$currPos++;
  29533. } else {
  29534. s1 = peg$FAILED;
  29535. if (peg$silentFails === 0) { peg$fail(peg$c91); }
  29536. }
  29537. if (s1 !== peg$FAILED) {
  29538. s2 = peg$parsews();
  29539. if (s2 !== peg$FAILED) {
  29540. s3 = peg$parseexpression();
  29541. if (s3 !== peg$FAILED) {
  29542. peg$savedPos = s0;
  29543. s1 = peg$c92(s3);
  29544. s0 = s1;
  29545. } else {
  29546. peg$currPos = s0;
  29547. s0 = peg$FAILED;
  29548. }
  29549. } else {
  29550. peg$currPos = s0;
  29551. s0 = peg$FAILED;
  29552. }
  29553. } else {
  29554. peg$currPos = s0;
  29555. s0 = peg$FAILED;
  29556. }
  29557. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29558. return s0;
  29559. }
  29560. function peg$parsetemps() {
  29561. var s0, s1, s2, s3, s4, s5;
  29562. var key = peg$currPos * 65 + 44,
  29563. cached = peg$resultsCache[key];
  29564. if (cached) {
  29565. peg$currPos = cached.nextPos;
  29566. return cached.result;
  29567. }
  29568. s0 = peg$currPos;
  29569. if (input.charCodeAt(peg$currPos) === 124) {
  29570. s1 = peg$c93;
  29571. peg$currPos++;
  29572. } else {
  29573. s1 = peg$FAILED;
  29574. if (peg$silentFails === 0) { peg$fail(peg$c94); }
  29575. }
  29576. if (s1 !== peg$FAILED) {
  29577. s2 = [];
  29578. s3 = peg$currPos;
  29579. s4 = peg$parsews();
  29580. if (s4 !== peg$FAILED) {
  29581. s5 = peg$parseidentifier();
  29582. if (s5 !== peg$FAILED) {
  29583. peg$savedPos = s3;
  29584. s4 = peg$c95(s5);
  29585. s3 = s4;
  29586. } else {
  29587. peg$currPos = s3;
  29588. s3 = peg$FAILED;
  29589. }
  29590. } else {
  29591. peg$currPos = s3;
  29592. s3 = peg$FAILED;
  29593. }
  29594. while (s3 !== peg$FAILED) {
  29595. s2.push(s3);
  29596. s3 = peg$currPos;
  29597. s4 = peg$parsews();
  29598. if (s4 !== peg$FAILED) {
  29599. s5 = peg$parseidentifier();
  29600. if (s5 !== peg$FAILED) {
  29601. peg$savedPos = s3;
  29602. s4 = peg$c95(s5);
  29603. s3 = s4;
  29604. } else {
  29605. peg$currPos = s3;
  29606. s3 = peg$FAILED;
  29607. }
  29608. } else {
  29609. peg$currPos = s3;
  29610. s3 = peg$FAILED;
  29611. }
  29612. }
  29613. if (s2 !== peg$FAILED) {
  29614. s3 = peg$parsews();
  29615. if (s3 !== peg$FAILED) {
  29616. if (input.charCodeAt(peg$currPos) === 124) {
  29617. s4 = peg$c93;
  29618. peg$currPos++;
  29619. } else {
  29620. s4 = peg$FAILED;
  29621. if (peg$silentFails === 0) { peg$fail(peg$c94); }
  29622. }
  29623. if (s4 !== peg$FAILED) {
  29624. peg$savedPos = s0;
  29625. s1 = peg$c96(s2);
  29626. s0 = s1;
  29627. } else {
  29628. peg$currPos = s0;
  29629. s0 = peg$FAILED;
  29630. }
  29631. } else {
  29632. peg$currPos = s0;
  29633. s0 = peg$FAILED;
  29634. }
  29635. } else {
  29636. peg$currPos = s0;
  29637. s0 = peg$FAILED;
  29638. }
  29639. } else {
  29640. peg$currPos = s0;
  29641. s0 = peg$FAILED;
  29642. }
  29643. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29644. return s0;
  29645. }
  29646. function peg$parsewsBlockParamList() {
  29647. var s0, s1, s2, s3, s4, s5, s6;
  29648. var key = peg$currPos * 65 + 45,
  29649. cached = peg$resultsCache[key];
  29650. if (cached) {
  29651. peg$currPos = cached.nextPos;
  29652. return cached.result;
  29653. }
  29654. s0 = peg$currPos;
  29655. s1 = [];
  29656. s2 = peg$currPos;
  29657. s3 = peg$parsews();
  29658. if (s3 !== peg$FAILED) {
  29659. if (input.charCodeAt(peg$currPos) === 58) {
  29660. s4 = peg$c12;
  29661. peg$currPos++;
  29662. } else {
  29663. s4 = peg$FAILED;
  29664. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29665. }
  29666. if (s4 !== peg$FAILED) {
  29667. s5 = peg$parsews();
  29668. if (s5 !== peg$FAILED) {
  29669. s6 = peg$parseidentifier();
  29670. if (s6 !== peg$FAILED) {
  29671. peg$savedPos = s2;
  29672. s3 = peg$c97(s6);
  29673. s2 = s3;
  29674. } else {
  29675. peg$currPos = s2;
  29676. s2 = peg$FAILED;
  29677. }
  29678. } else {
  29679. peg$currPos = s2;
  29680. s2 = peg$FAILED;
  29681. }
  29682. } else {
  29683. peg$currPos = s2;
  29684. s2 = peg$FAILED;
  29685. }
  29686. } else {
  29687. peg$currPos = s2;
  29688. s2 = peg$FAILED;
  29689. }
  29690. if (s2 !== peg$FAILED) {
  29691. while (s2 !== peg$FAILED) {
  29692. s1.push(s2);
  29693. s2 = peg$currPos;
  29694. s3 = peg$parsews();
  29695. if (s3 !== peg$FAILED) {
  29696. if (input.charCodeAt(peg$currPos) === 58) {
  29697. s4 = peg$c12;
  29698. peg$currPos++;
  29699. } else {
  29700. s4 = peg$FAILED;
  29701. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29702. }
  29703. if (s4 !== peg$FAILED) {
  29704. s5 = peg$parsews();
  29705. if (s5 !== peg$FAILED) {
  29706. s6 = peg$parseidentifier();
  29707. if (s6 !== peg$FAILED) {
  29708. peg$savedPos = s2;
  29709. s3 = peg$c97(s6);
  29710. s2 = s3;
  29711. } else {
  29712. peg$currPos = s2;
  29713. s2 = peg$FAILED;
  29714. }
  29715. } else {
  29716. peg$currPos = s2;
  29717. s2 = peg$FAILED;
  29718. }
  29719. } else {
  29720. peg$currPos = s2;
  29721. s2 = peg$FAILED;
  29722. }
  29723. } else {
  29724. peg$currPos = s2;
  29725. s2 = peg$FAILED;
  29726. }
  29727. }
  29728. } else {
  29729. s1 = peg$FAILED;
  29730. }
  29731. if (s1 !== peg$FAILED) {
  29732. s2 = peg$parsews();
  29733. if (s2 !== peg$FAILED) {
  29734. if (input.charCodeAt(peg$currPos) === 124) {
  29735. s3 = peg$c93;
  29736. peg$currPos++;
  29737. } else {
  29738. s3 = peg$FAILED;
  29739. if (peg$silentFails === 0) { peg$fail(peg$c94); }
  29740. }
  29741. if (s3 !== peg$FAILED) {
  29742. peg$savedPos = s0;
  29743. s1 = peg$c98(s1);
  29744. s0 = s1;
  29745. } else {
  29746. peg$currPos = s0;
  29747. s0 = peg$FAILED;
  29748. }
  29749. } else {
  29750. peg$currPos = s0;
  29751. s0 = peg$FAILED;
  29752. }
  29753. } else {
  29754. peg$currPos = s0;
  29755. s0 = peg$FAILED;
  29756. }
  29757. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29758. return s0;
  29759. }
  29760. function peg$parsesubexpression() {
  29761. var s0, s1, s2, s3, s4, s5;
  29762. var key = peg$currPos * 65 + 46,
  29763. cached = peg$resultsCache[key];
  29764. if (cached) {
  29765. peg$currPos = cached.nextPos;
  29766. return cached.result;
  29767. }
  29768. s0 = peg$currPos;
  29769. if (input.charCodeAt(peg$currPos) === 40) {
  29770. s1 = peg$c51;
  29771. peg$currPos++;
  29772. } else {
  29773. s1 = peg$FAILED;
  29774. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  29775. }
  29776. if (s1 !== peg$FAILED) {
  29777. s2 = peg$parsews();
  29778. if (s2 !== peg$FAILED) {
  29779. s3 = peg$parseexpression();
  29780. if (s3 !== peg$FAILED) {
  29781. s4 = peg$parsews();
  29782. if (s4 !== peg$FAILED) {
  29783. if (input.charCodeAt(peg$currPos) === 41) {
  29784. s5 = peg$c48;
  29785. peg$currPos++;
  29786. } else {
  29787. s5 = peg$FAILED;
  29788. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  29789. }
  29790. if (s5 !== peg$FAILED) {
  29791. peg$savedPos = s0;
  29792. s1 = peg$c78(s3);
  29793. s0 = s1;
  29794. } else {
  29795. peg$currPos = s0;
  29796. s0 = peg$FAILED;
  29797. }
  29798. } else {
  29799. peg$currPos = s0;
  29800. s0 = peg$FAILED;
  29801. }
  29802. } else {
  29803. peg$currPos = s0;
  29804. s0 = peg$FAILED;
  29805. }
  29806. } else {
  29807. peg$currPos = s0;
  29808. s0 = peg$FAILED;
  29809. }
  29810. } else {
  29811. peg$currPos = s0;
  29812. s0 = peg$FAILED;
  29813. }
  29814. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29815. return s0;
  29816. }
  29817. function peg$parsewsStatements() {
  29818. var s0, s1, s2, s3;
  29819. var key = peg$currPos * 65 + 47,
  29820. cached = peg$resultsCache[key];
  29821. if (cached) {
  29822. peg$currPos = cached.nextPos;
  29823. return cached.result;
  29824. }
  29825. s0 = peg$currPos;
  29826. s1 = peg$parsemaybeDotsWs();
  29827. if (s1 !== peg$FAILED) {
  29828. s2 = peg$parseret();
  29829. if (s2 !== peg$FAILED) {
  29830. peg$savedPos = s0;
  29831. s1 = peg$c99(s2);
  29832. s0 = s1;
  29833. } else {
  29834. peg$currPos = s0;
  29835. s0 = peg$FAILED;
  29836. }
  29837. } else {
  29838. peg$currPos = s0;
  29839. s0 = peg$FAILED;
  29840. }
  29841. if (s0 === peg$FAILED) {
  29842. s0 = peg$currPos;
  29843. s1 = peg$parsewsExpressions();
  29844. if (s1 !== peg$FAILED) {
  29845. s2 = peg$parsesomeDotsWs();
  29846. if (s2 !== peg$FAILED) {
  29847. s3 = peg$parseret();
  29848. if (s3 !== peg$FAILED) {
  29849. peg$savedPos = s0;
  29850. s1 = peg$c100(s1, s3);
  29851. s0 = s1;
  29852. } else {
  29853. peg$currPos = s0;
  29854. s0 = peg$FAILED;
  29855. }
  29856. } else {
  29857. peg$currPos = s0;
  29858. s0 = peg$FAILED;
  29859. }
  29860. } else {
  29861. peg$currPos = s0;
  29862. s0 = peg$FAILED;
  29863. }
  29864. if (s0 === peg$FAILED) {
  29865. s0 = peg$currPos;
  29866. s1 = peg$parsewsExpressions();
  29867. if (s1 === peg$FAILED) {
  29868. s1 = null;
  29869. }
  29870. if (s1 !== peg$FAILED) {
  29871. peg$savedPos = s0;
  29872. s1 = peg$c101(s1);
  29873. }
  29874. s0 = s1;
  29875. }
  29876. }
  29877. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29878. return s0;
  29879. }
  29880. function peg$parseblock() {
  29881. var s0, s1, s2, s3, s4, s5, s6, s7;
  29882. var key = peg$currPos * 65 + 48,
  29883. cached = peg$resultsCache[key];
  29884. if (cached) {
  29885. peg$currPos = cached.nextPos;
  29886. return cached.result;
  29887. }
  29888. s0 = peg$currPos;
  29889. if (input.charCodeAt(peg$currPos) === 91) {
  29890. s1 = peg$c102;
  29891. peg$currPos++;
  29892. } else {
  29893. s1 = peg$FAILED;
  29894. if (peg$silentFails === 0) { peg$fail(peg$c103); }
  29895. }
  29896. if (s1 !== peg$FAILED) {
  29897. s2 = peg$parsewsBlockParamList();
  29898. if (s2 === peg$FAILED) {
  29899. s2 = null;
  29900. }
  29901. if (s2 !== peg$FAILED) {
  29902. s3 = peg$parsews();
  29903. if (s3 !== peg$FAILED) {
  29904. s4 = peg$parsetemps();
  29905. if (s4 === peg$FAILED) {
  29906. s4 = null;
  29907. }
  29908. if (s4 !== peg$FAILED) {
  29909. s5 = peg$parsewsStatements();
  29910. if (s5 === peg$FAILED) {
  29911. s5 = null;
  29912. }
  29913. if (s5 !== peg$FAILED) {
  29914. s6 = peg$parsemaybeDotsWs();
  29915. if (s6 !== peg$FAILED) {
  29916. if (input.charCodeAt(peg$currPos) === 93) {
  29917. s7 = peg$c104;
  29918. peg$currPos++;
  29919. } else {
  29920. s7 = peg$FAILED;
  29921. if (peg$silentFails === 0) { peg$fail(peg$c105); }
  29922. }
  29923. if (s7 !== peg$FAILED) {
  29924. peg$savedPos = s0;
  29925. s1 = peg$c106(s2, s4, s5);
  29926. s0 = s1;
  29927. } else {
  29928. peg$currPos = s0;
  29929. s0 = peg$FAILED;
  29930. }
  29931. } else {
  29932. peg$currPos = s0;
  29933. s0 = peg$FAILED;
  29934. }
  29935. } else {
  29936. peg$currPos = s0;
  29937. s0 = peg$FAILED;
  29938. }
  29939. } else {
  29940. peg$currPos = s0;
  29941. s0 = peg$FAILED;
  29942. }
  29943. } else {
  29944. peg$currPos = s0;
  29945. s0 = peg$FAILED;
  29946. }
  29947. } else {
  29948. peg$currPos = s0;
  29949. s0 = peg$FAILED;
  29950. }
  29951. } else {
  29952. peg$currPos = s0;
  29953. s0 = peg$FAILED;
  29954. }
  29955. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29956. return s0;
  29957. }
  29958. function peg$parseoperand() {
  29959. var s0;
  29960. var key = peg$currPos * 65 + 49,
  29961. cached = peg$resultsCache[key];
  29962. if (cached) {
  29963. peg$currPos = cached.nextPos;
  29964. return cached.result;
  29965. }
  29966. s0 = peg$parsevariable();
  29967. if (s0 === peg$FAILED) {
  29968. s0 = peg$parseliteral();
  29969. if (s0 === peg$FAILED) {
  29970. s0 = peg$parsesubexpression();
  29971. }
  29972. }
  29973. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29974. return s0;
  29975. }
  29976. function peg$parsewsUnaryMessage() {
  29977. var s0, s1, s2, s3, s4;
  29978. var key = peg$currPos * 65 + 50,
  29979. cached = peg$resultsCache[key];
  29980. if (cached) {
  29981. peg$currPos = cached.nextPos;
  29982. return cached.result;
  29983. }
  29984. s0 = peg$currPos;
  29985. s1 = peg$parsews();
  29986. if (s1 !== peg$FAILED) {
  29987. s2 = peg$parseidentifier();
  29988. if (s2 !== peg$FAILED) {
  29989. s3 = peg$currPos;
  29990. peg$silentFails++;
  29991. if (input.charCodeAt(peg$currPos) === 58) {
  29992. s4 = peg$c12;
  29993. peg$currPos++;
  29994. } else {
  29995. s4 = peg$FAILED;
  29996. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29997. }
  29998. peg$silentFails--;
  29999. if (s4 === peg$FAILED) {
  30000. s3 = void 0;
  30001. } else {
  30002. peg$currPos = s3;
  30003. s3 = peg$FAILED;
  30004. }
  30005. if (s3 !== peg$FAILED) {
  30006. peg$savedPos = s0;
  30007. s1 = peg$c107(s2);
  30008. s0 = s1;
  30009. } else {
  30010. peg$currPos = s0;
  30011. s0 = peg$FAILED;
  30012. }
  30013. } else {
  30014. peg$currPos = s0;
  30015. s0 = peg$FAILED;
  30016. }
  30017. } else {
  30018. peg$currPos = s0;
  30019. s0 = peg$FAILED;
  30020. }
  30021. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30022. return s0;
  30023. }
  30024. function peg$parsewsUnaryTail() {
  30025. var s0, s1;
  30026. var key = peg$currPos * 65 + 51,
  30027. cached = peg$resultsCache[key];
  30028. if (cached) {
  30029. peg$currPos = cached.nextPos;
  30030. return cached.result;
  30031. }
  30032. s0 = [];
  30033. s1 = peg$parsewsUnaryMessage();
  30034. while (s1 !== peg$FAILED) {
  30035. s0.push(s1);
  30036. s1 = peg$parsewsUnaryMessage();
  30037. }
  30038. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30039. return s0;
  30040. }
  30041. function peg$parseunarySend() {
  30042. var s0, s1, s2;
  30043. var key = peg$currPos * 65 + 52,
  30044. cached = peg$resultsCache[key];
  30045. if (cached) {
  30046. peg$currPos = cached.nextPos;
  30047. return cached.result;
  30048. }
  30049. s0 = peg$currPos;
  30050. s1 = peg$parseoperand();
  30051. if (s1 !== peg$FAILED) {
  30052. s2 = peg$parsewsUnaryTail();
  30053. if (s2 !== peg$FAILED) {
  30054. peg$savedPos = s0;
  30055. s1 = peg$c108(s1, s2);
  30056. s0 = s1;
  30057. } else {
  30058. peg$currPos = s0;
  30059. s0 = peg$FAILED;
  30060. }
  30061. } else {
  30062. peg$currPos = s0;
  30063. s0 = peg$FAILED;
  30064. }
  30065. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30066. return s0;
  30067. }
  30068. function peg$parsewsBinaryMessage() {
  30069. var s0, s1, s2, s3, s4;
  30070. var key = peg$currPos * 65 + 53,
  30071. cached = peg$resultsCache[key];
  30072. if (cached) {
  30073. peg$currPos = cached.nextPos;
  30074. return cached.result;
  30075. }
  30076. s0 = peg$currPos;
  30077. s1 = peg$parsews();
  30078. if (s1 !== peg$FAILED) {
  30079. s2 = peg$parsebinarySelector();
  30080. if (s2 !== peg$FAILED) {
  30081. s3 = peg$parsews();
  30082. if (s3 !== peg$FAILED) {
  30083. s4 = peg$parseunarySend();
  30084. if (s4 !== peg$FAILED) {
  30085. peg$savedPos = s0;
  30086. s1 = peg$c109(s2, s4);
  30087. s0 = s1;
  30088. } else {
  30089. peg$currPos = s0;
  30090. s0 = peg$FAILED;
  30091. }
  30092. } else {
  30093. peg$currPos = s0;
  30094. s0 = peg$FAILED;
  30095. }
  30096. } else {
  30097. peg$currPos = s0;
  30098. s0 = peg$FAILED;
  30099. }
  30100. } else {
  30101. peg$currPos = s0;
  30102. s0 = peg$FAILED;
  30103. }
  30104. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30105. return s0;
  30106. }
  30107. function peg$parsewsBinaryTail() {
  30108. var s0, s1, s2, s3;
  30109. var key = peg$currPos * 65 + 54,
  30110. cached = peg$resultsCache[key];
  30111. if (cached) {
  30112. peg$currPos = cached.nextPos;
  30113. return cached.result;
  30114. }
  30115. s0 = peg$currPos;
  30116. s1 = peg$parsewsUnaryTail();
  30117. if (s1 !== peg$FAILED) {
  30118. s2 = [];
  30119. s3 = peg$parsewsBinaryMessage();
  30120. while (s3 !== peg$FAILED) {
  30121. s2.push(s3);
  30122. s3 = peg$parsewsBinaryMessage();
  30123. }
  30124. if (s2 !== peg$FAILED) {
  30125. peg$savedPos = s0;
  30126. s1 = peg$c110(s1, s2);
  30127. s0 = s1;
  30128. } else {
  30129. peg$currPos = s0;
  30130. s0 = peg$FAILED;
  30131. }
  30132. } else {
  30133. peg$currPos = s0;
  30134. s0 = peg$FAILED;
  30135. }
  30136. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30137. return s0;
  30138. }
  30139. function peg$parsebinarySend() {
  30140. var s0, s1, s2;
  30141. var key = peg$currPos * 65 + 55,
  30142. cached = peg$resultsCache[key];
  30143. if (cached) {
  30144. peg$currPos = cached.nextPos;
  30145. return cached.result;
  30146. }
  30147. s0 = peg$currPos;
  30148. s1 = peg$parseoperand();
  30149. if (s1 !== peg$FAILED) {
  30150. s2 = peg$parsewsBinaryTail();
  30151. if (s2 !== peg$FAILED) {
  30152. peg$savedPos = s0;
  30153. s1 = peg$c108(s1, s2);
  30154. s0 = s1;
  30155. } else {
  30156. peg$currPos = s0;
  30157. s0 = peg$FAILED;
  30158. }
  30159. } else {
  30160. peg$currPos = s0;
  30161. s0 = peg$FAILED;
  30162. }
  30163. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30164. return s0;
  30165. }
  30166. function peg$parsewsKeywordMessage() {
  30167. var s0, s1, s2, s3, s4, s5, s6;
  30168. var key = peg$currPos * 65 + 56,
  30169. cached = peg$resultsCache[key];
  30170. if (cached) {
  30171. peg$currPos = cached.nextPos;
  30172. return cached.result;
  30173. }
  30174. s0 = peg$currPos;
  30175. s1 = [];
  30176. s2 = peg$currPos;
  30177. s3 = peg$parsews();
  30178. if (s3 !== peg$FAILED) {
  30179. s4 = peg$parsekeyword();
  30180. if (s4 !== peg$FAILED) {
  30181. s5 = peg$parsews();
  30182. if (s5 !== peg$FAILED) {
  30183. s6 = peg$parsebinarySend();
  30184. if (s6 !== peg$FAILED) {
  30185. peg$savedPos = s2;
  30186. s3 = peg$c74(s4, s6);
  30187. s2 = s3;
  30188. } else {
  30189. peg$currPos = s2;
  30190. s2 = peg$FAILED;
  30191. }
  30192. } else {
  30193. peg$currPos = s2;
  30194. s2 = peg$FAILED;
  30195. }
  30196. } else {
  30197. peg$currPos = s2;
  30198. s2 = peg$FAILED;
  30199. }
  30200. } else {
  30201. peg$currPos = s2;
  30202. s2 = peg$FAILED;
  30203. }
  30204. if (s2 !== peg$FAILED) {
  30205. while (s2 !== peg$FAILED) {
  30206. s1.push(s2);
  30207. s2 = peg$currPos;
  30208. s3 = peg$parsews();
  30209. if (s3 !== peg$FAILED) {
  30210. s4 = peg$parsekeyword();
  30211. if (s4 !== peg$FAILED) {
  30212. s5 = peg$parsews();
  30213. if (s5 !== peg$FAILED) {
  30214. s6 = peg$parsebinarySend();
  30215. if (s6 !== peg$FAILED) {
  30216. peg$savedPos = s2;
  30217. s3 = peg$c74(s4, s6);
  30218. s2 = s3;
  30219. } else {
  30220. peg$currPos = s2;
  30221. s2 = peg$FAILED;
  30222. }
  30223. } else {
  30224. peg$currPos = s2;
  30225. s2 = peg$FAILED;
  30226. }
  30227. } else {
  30228. peg$currPos = s2;
  30229. s2 = peg$FAILED;
  30230. }
  30231. } else {
  30232. peg$currPos = s2;
  30233. s2 = peg$FAILED;
  30234. }
  30235. }
  30236. } else {
  30237. s1 = peg$FAILED;
  30238. }
  30239. if (s1 !== peg$FAILED) {
  30240. peg$savedPos = s0;
  30241. s1 = peg$c111(s1);
  30242. }
  30243. s0 = s1;
  30244. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30245. return s0;
  30246. }
  30247. function peg$parsewsKeywordTail() {
  30248. var s0, s1, s2;
  30249. var key = peg$currPos * 65 + 57,
  30250. cached = peg$resultsCache[key];
  30251. if (cached) {
  30252. peg$currPos = cached.nextPos;
  30253. return cached.result;
  30254. }
  30255. s0 = peg$currPos;
  30256. s1 = peg$parsewsBinaryTail();
  30257. if (s1 !== peg$FAILED) {
  30258. s2 = peg$parsewsKeywordMessage();
  30259. if (s2 === peg$FAILED) {
  30260. s2 = null;
  30261. }
  30262. if (s2 !== peg$FAILED) {
  30263. peg$savedPos = s0;
  30264. s1 = peg$c112(s1, s2);
  30265. s0 = s1;
  30266. } else {
  30267. peg$currPos = s0;
  30268. s0 = peg$FAILED;
  30269. }
  30270. } else {
  30271. peg$currPos = s0;
  30272. s0 = peg$FAILED;
  30273. }
  30274. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30275. return s0;
  30276. }
  30277. function peg$parsekeywordSend() {
  30278. var s0, s1, s2;
  30279. var key = peg$currPos * 65 + 58,
  30280. cached = peg$resultsCache[key];
  30281. if (cached) {
  30282. peg$currPos = cached.nextPos;
  30283. return cached.result;
  30284. }
  30285. s0 = peg$currPos;
  30286. s1 = peg$parseoperand();
  30287. if (s1 !== peg$FAILED) {
  30288. s2 = peg$parsewsKeywordTail();
  30289. if (s2 !== peg$FAILED) {
  30290. peg$savedPos = s0;
  30291. s1 = peg$c108(s1, s2);
  30292. s0 = s1;
  30293. } else {
  30294. peg$currPos = s0;
  30295. s0 = peg$FAILED;
  30296. }
  30297. } else {
  30298. peg$currPos = s0;
  30299. s0 = peg$FAILED;
  30300. }
  30301. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30302. return s0;
  30303. }
  30304. function peg$parsewsMessage() {
  30305. var s0;
  30306. var key = peg$currPos * 65 + 59,
  30307. cached = peg$resultsCache[key];
  30308. if (cached) {
  30309. peg$currPos = cached.nextPos;
  30310. return cached.result;
  30311. }
  30312. s0 = peg$parsewsBinaryMessage();
  30313. if (s0 === peg$FAILED) {
  30314. s0 = peg$parsewsUnaryMessage();
  30315. if (s0 === peg$FAILED) {
  30316. s0 = peg$parsewsKeywordMessage();
  30317. }
  30318. }
  30319. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30320. return s0;
  30321. }
  30322. function peg$parsecascade() {
  30323. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  30324. var key = peg$currPos * 65 + 60,
  30325. cached = peg$resultsCache[key];
  30326. if (cached) {
  30327. peg$currPos = cached.nextPos;
  30328. return cached.result;
  30329. }
  30330. s0 = peg$currPos;
  30331. s1 = peg$parseoperand();
  30332. if (s1 !== peg$FAILED) {
  30333. s2 = peg$parsewsKeywordTail();
  30334. if (s2 !== peg$FAILED) {
  30335. peg$savedPos = peg$currPos;
  30336. s3 = peg$c113(s1, s2);
  30337. if (s3) {
  30338. s3 = void 0;
  30339. } else {
  30340. s3 = peg$FAILED;
  30341. }
  30342. if (s3 !== peg$FAILED) {
  30343. s4 = [];
  30344. s5 = peg$currPos;
  30345. s6 = peg$parsews();
  30346. if (s6 !== peg$FAILED) {
  30347. if (input.charCodeAt(peg$currPos) === 59) {
  30348. s7 = peg$c114;
  30349. peg$currPos++;
  30350. } else {
  30351. s7 = peg$FAILED;
  30352. if (peg$silentFails === 0) { peg$fail(peg$c115); }
  30353. }
  30354. if (s7 !== peg$FAILED) {
  30355. s8 = peg$parsewsMessage();
  30356. if (s8 !== peg$FAILED) {
  30357. peg$savedPos = s5;
  30358. s6 = peg$c116(s1, s2, s8);
  30359. s5 = s6;
  30360. } else {
  30361. peg$currPos = s5;
  30362. s5 = peg$FAILED;
  30363. }
  30364. } else {
  30365. peg$currPos = s5;
  30366. s5 = peg$FAILED;
  30367. }
  30368. } else {
  30369. peg$currPos = s5;
  30370. s5 = peg$FAILED;
  30371. }
  30372. if (s5 !== peg$FAILED) {
  30373. while (s5 !== peg$FAILED) {
  30374. s4.push(s5);
  30375. s5 = peg$currPos;
  30376. s6 = peg$parsews();
  30377. if (s6 !== peg$FAILED) {
  30378. if (input.charCodeAt(peg$currPos) === 59) {
  30379. s7 = peg$c114;
  30380. peg$currPos++;
  30381. } else {
  30382. s7 = peg$FAILED;
  30383. if (peg$silentFails === 0) { peg$fail(peg$c115); }
  30384. }
  30385. if (s7 !== peg$FAILED) {
  30386. s8 = peg$parsewsMessage();
  30387. if (s8 !== peg$FAILED) {
  30388. peg$savedPos = s5;
  30389. s6 = peg$c116(s1, s2, s8);
  30390. s5 = s6;
  30391. } else {
  30392. peg$currPos = s5;
  30393. s5 = peg$FAILED;
  30394. }
  30395. } else {
  30396. peg$currPos = s5;
  30397. s5 = peg$FAILED;
  30398. }
  30399. } else {
  30400. peg$currPos = s5;
  30401. s5 = peg$FAILED;
  30402. }
  30403. }
  30404. } else {
  30405. s4 = peg$FAILED;
  30406. }
  30407. if (s4 !== peg$FAILED) {
  30408. peg$savedPos = s0;
  30409. s1 = peg$c117(s1, s2, s4);
  30410. s0 = s1;
  30411. } else {
  30412. peg$currPos = s0;
  30413. s0 = peg$FAILED;
  30414. }
  30415. } else {
  30416. peg$currPos = s0;
  30417. s0 = peg$FAILED;
  30418. }
  30419. } else {
  30420. peg$currPos = s0;
  30421. s0 = peg$FAILED;
  30422. }
  30423. } else {
  30424. peg$currPos = s0;
  30425. s0 = peg$FAILED;
  30426. }
  30427. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30428. return s0;
  30429. }
  30430. function peg$parsemethod() {
  30431. var s0, s1, s2, s3, s4, s5, s6, s7;
  30432. var key = peg$currPos * 65 + 61,
  30433. cached = peg$resultsCache[key];
  30434. if (cached) {
  30435. peg$currPos = cached.nextPos;
  30436. return cached.result;
  30437. }
  30438. s0 = peg$currPos;
  30439. s1 = peg$parsewsKeywordPattern();
  30440. if (s1 === peg$FAILED) {
  30441. s1 = peg$parsewsBinaryPattern();
  30442. if (s1 === peg$FAILED) {
  30443. s1 = peg$parsewsUnaryPattern();
  30444. }
  30445. }
  30446. if (s1 !== peg$FAILED) {
  30447. s2 = peg$parsewsPragmas();
  30448. if (s2 === peg$FAILED) {
  30449. s2 = null;
  30450. }
  30451. if (s2 !== peg$FAILED) {
  30452. s3 = peg$parsews();
  30453. if (s3 !== peg$FAILED) {
  30454. s4 = peg$parsetemps();
  30455. if (s4 === peg$FAILED) {
  30456. s4 = null;
  30457. }
  30458. if (s4 !== peg$FAILED) {
  30459. s5 = peg$parsewsPragmas();
  30460. if (s5 === peg$FAILED) {
  30461. s5 = null;
  30462. }
  30463. if (s5 !== peg$FAILED) {
  30464. s6 = peg$parsewsStatements();
  30465. if (s6 === peg$FAILED) {
  30466. s6 = null;
  30467. }
  30468. if (s6 !== peg$FAILED) {
  30469. s7 = peg$parsemaybeDotsWs();
  30470. if (s7 !== peg$FAILED) {
  30471. peg$savedPos = s0;
  30472. s1 = peg$c118(s1, s2, s4, s5, s6);
  30473. s0 = s1;
  30474. } else {
  30475. peg$currPos = s0;
  30476. s0 = peg$FAILED;
  30477. }
  30478. } else {
  30479. peg$currPos = s0;
  30480. s0 = peg$FAILED;
  30481. }
  30482. } else {
  30483. peg$currPos = s0;
  30484. s0 = peg$FAILED;
  30485. }
  30486. } else {
  30487. peg$currPos = s0;
  30488. s0 = peg$FAILED;
  30489. }
  30490. } else {
  30491. peg$currPos = s0;
  30492. s0 = peg$FAILED;
  30493. }
  30494. } else {
  30495. peg$currPos = s0;
  30496. s0 = peg$FAILED;
  30497. }
  30498. } else {
  30499. peg$currPos = s0;
  30500. s0 = peg$FAILED;
  30501. }
  30502. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30503. return s0;
  30504. }
  30505. function peg$parseassociationSend() {
  30506. var s0, s1, s2, s3;
  30507. var key = peg$currPos * 65 + 62,
  30508. cached = peg$resultsCache[key];
  30509. if (cached) {
  30510. peg$currPos = cached.nextPos;
  30511. return cached.result;
  30512. }
  30513. s0 = peg$currPos;
  30514. s1 = peg$parseoperand();
  30515. if (s1 !== peg$FAILED) {
  30516. s2 = peg$parsewsBinaryTail();
  30517. if (s2 !== peg$FAILED) {
  30518. peg$savedPos = peg$currPos;
  30519. s3 = peg$c119(s1, s2);
  30520. if (s3) {
  30521. s3 = void 0;
  30522. } else {
  30523. s3 = peg$FAILED;
  30524. }
  30525. if (s3 !== peg$FAILED) {
  30526. peg$savedPos = s0;
  30527. s1 = peg$c120(s1, s2);
  30528. s0 = s1;
  30529. } else {
  30530. peg$currPos = s0;
  30531. s0 = peg$FAILED;
  30532. }
  30533. } else {
  30534. peg$currPos = s0;
  30535. s0 = peg$FAILED;
  30536. }
  30537. } else {
  30538. peg$currPos = s0;
  30539. s0 = peg$FAILED;
  30540. }
  30541. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30542. return s0;
  30543. }
  30544. function peg$parsewsAssociationsRest() {
  30545. var s0, s1, s2;
  30546. var key = peg$currPos * 65 + 63,
  30547. cached = peg$resultsCache[key];
  30548. if (cached) {
  30549. peg$currPos = cached.nextPos;
  30550. return cached.result;
  30551. }
  30552. s0 = peg$currPos;
  30553. s1 = peg$parsesomeDotsWs();
  30554. if (s1 !== peg$FAILED) {
  30555. s2 = peg$parseassociationSend();
  30556. if (s2 !== peg$FAILED) {
  30557. peg$savedPos = s0;
  30558. s1 = peg$c78(s2);
  30559. s0 = s1;
  30560. } else {
  30561. peg$currPos = s0;
  30562. s0 = peg$FAILED;
  30563. }
  30564. } else {
  30565. peg$currPos = s0;
  30566. s0 = peg$FAILED;
  30567. }
  30568. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30569. return s0;
  30570. }
  30571. function peg$parsewsAssociations() {
  30572. var s0, s1, s2, s3, s4;
  30573. var key = peg$currPos * 65 + 64,
  30574. cached = peg$resultsCache[key];
  30575. if (cached) {
  30576. peg$currPos = cached.nextPos;
  30577. return cached.result;
  30578. }
  30579. s0 = peg$currPos;
  30580. s1 = peg$parsemaybeDotsWs();
  30581. if (s1 !== peg$FAILED) {
  30582. s2 = peg$parseassociationSend();
  30583. if (s2 !== peg$FAILED) {
  30584. s3 = [];
  30585. s4 = peg$parsewsAssociationsRest();
  30586. while (s4 !== peg$FAILED) {
  30587. s3.push(s4);
  30588. s4 = peg$parsewsAssociationsRest();
  30589. }
  30590. if (s3 !== peg$FAILED) {
  30591. peg$savedPos = s0;
  30592. s1 = peg$c121(s2, s3);
  30593. s0 = s1;
  30594. } else {
  30595. peg$currPos = s0;
  30596. s0 = peg$FAILED;
  30597. }
  30598. } else {
  30599. peg$currPos = s0;
  30600. s0 = peg$FAILED;
  30601. }
  30602. } else {
  30603. peg$currPos = s0;
  30604. s0 = peg$FAILED;
  30605. }
  30606. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30607. return s0;
  30608. }
  30609. var $globals = __boot.globals;
  30610. function newNode(nodeClass) {
  30611. return nodeClass._new()._location_(location())._source_(text());
  30612. }
  30613. function newSequenceNode(nodeClass, temps, statements) {
  30614. return newNode(nodeClass)._temps_(temps || [])._dagChildren_(statements || []);
  30615. }
  30616. peg$result = peg$startRuleFunction();
  30617. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  30618. return peg$result;
  30619. } else {
  30620. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  30621. peg$fail(peg$endExpectation());
  30622. }
  30623. throw peg$buildStructuredError(
  30624. peg$maxFailExpected,
  30625. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  30626. peg$maxFailPos < input.length
  30627. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  30628. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  30629. );
  30630. }
  30631. }
  30632. return {
  30633. SyntaxError: peg$SyntaxError,
  30634. parse: peg$parse
  30635. };
  30636. });
  30637. define('amber/core/Platform-ImportExport',["amber/boot", "require", "amber/core/Kernel-Classes", "amber/core/Kernel-Exceptions", "amber/core/Kernel-Infrastructure", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  30638. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  30639. var $pkg = $core.addPackage("Platform-ImportExport");
  30640. $pkg.innerEval = function (expr) { return eval(expr); };
  30641. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  30642. $core.addClass("AbstractExporter", $globals.Object, [], "Platform-ImportExport");
  30643. $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.";
  30644. $core.addMethod(
  30645. $core.method({
  30646. selector: "exportPackage:on:",
  30647. protocol: "output",
  30648. args: ["aPackage", "aStream"],
  30649. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  30650. referencedClasses: [],
  30651. pragmas: [],
  30652. messageSends: ["subclassResponsibility"]
  30653. }, function ($methodClass){ return function (aPackage,aStream){
  30654. var self=this,$self=this;
  30655. return $core.withContext(function($ctx1) {
  30656. $self._subclassResponsibility();
  30657. return self;
  30658. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream})});
  30659. }; }),
  30660. $globals.AbstractExporter);
  30661. $core.addMethod(
  30662. $core.method({
  30663. selector: "extensionMethodsOfPackage:",
  30664. protocol: "accessing",
  30665. args: ["aPackage"],
  30666. source: "extensionMethodsOfPackage: aPackage\x0a\x09| result |\x0a\x09\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09(self extensionProtocolsOfPackage: aPackage) do: [ :each |\x0a\x09\x09result addAll: each ownMethods ].\x0a\x09\x09\x0a\x09^ result",
  30667. referencedClasses: ["OrderedCollection"],
  30668. pragmas: [],
  30669. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "ownMethods"]
  30670. }, function ($methodClass){ return function (aPackage){
  30671. var self=this,$self=this;
  30672. var result;
  30673. return $core.withContext(function($ctx1) {
  30674. result=$recv($globals.OrderedCollection)._new();
  30675. $recv($self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  30676. return $core.withContext(function($ctx2) {
  30677. return $recv(result)._addAll_($recv(each)._ownMethods());
  30678. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30679. }));
  30680. return result;
  30681. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result})});
  30682. }; }),
  30683. $globals.AbstractExporter);
  30684. $core.addMethod(
  30685. $core.method({
  30686. selector: "extensionProtocolsOfPackage:",
  30687. protocol: "accessing",
  30688. args: ["aPackage"],
  30689. 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\x09each includingPossibleMetaDo: [ :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",
  30690. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  30691. pragmas: [],
  30692. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "includingPossibleMetaDo:", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  30693. }, function ($methodClass){ return function (aPackage){
  30694. var self=this,$self=this;
  30695. var extensionName,result;
  30696. return $core.withContext(function($ctx1) {
  30697. extensionName="*".__comma([$recv(aPackage)._name()
  30698. ,$ctx1.sendIdx["name"]=1
  30699. ][0]);
  30700. result=$recv($globals.OrderedCollection)._new();
  30701. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  30702. return $core.withContext(function($ctx2) {
  30703. return $recv([$recv(a)._name()
  30704. ,$ctx2.sendIdx["name"]=2
  30705. ][0]).__lt($recv(b)._name());
  30706. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30707. })))._do_((function(each){
  30708. return $core.withContext(function($ctx2) {
  30709. return $recv(each)._includingPossibleMetaDo_((function(behavior){
  30710. return $core.withContext(function($ctx3) {
  30711. if($core.assert($recv($recv(behavior)._protocols())._includes_(extensionName))){
  30712. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  30713. }
  30714. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  30715. }));
  30716. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  30717. }));
  30718. return result;
  30719. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result})});
  30720. }; }),
  30721. $globals.AbstractExporter);
  30722. $core.addClass("ChunkExporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30723. $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.";
  30724. $core.addMethod(
  30725. $core.method({
  30726. selector: "chunkEscape:",
  30727. protocol: "convenience",
  30728. args: ["aString"],
  30729. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  30730. referencedClasses: [],
  30731. pragmas: [],
  30732. messageSends: ["trimBoth", "replace:with:"]
  30733. }, function ($methodClass){ return function (aString){
  30734. var self=this,$self=this;
  30735. return $core.withContext(function($ctx1) {
  30736. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  30737. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString})});
  30738. }; }),
  30739. $globals.ChunkExporter);
  30740. $core.addMethod(
  30741. $core.method({
  30742. selector: "exportBehavior:on:",
  30743. protocol: "output",
  30744. args: ["aBehavior", "aStream"],
  30745. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09self \x0a\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: aBehavior)\x0a\x09\x09on: aStream",
  30746. referencedClasses: [],
  30747. pragmas: [],
  30748. messageSends: ["exportBehaviorDefinitionTo:using:", "exportProtocols:on:", "ownMethodProtocolsOfClass:"]
  30749. }, function ($methodClass){ return function (aBehavior,aStream){
  30750. var self=this,$self=this;
  30751. return $core.withContext(function($ctx1) {
  30752. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30753. $self._exportProtocols_on_($self._ownMethodProtocolsOfClass_(aBehavior),aStream);
  30754. return self;
  30755. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream})});
  30756. }; }),
  30757. $globals.ChunkExporter);
  30758. $core.addMethod(
  30759. $core.method({
  30760. selector: "exportCategoryEpilogueOf:on:",
  30761. protocol: "output",
  30762. args: ["aCategory", "aStream"],
  30763. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30764. referencedClasses: [],
  30765. pragmas: [],
  30766. messageSends: ["write:", "lf"]
  30767. }, function ($methodClass){ return function (aCategory,aStream){
  30768. var self=this,$self=this;
  30769. return $core.withContext(function($ctx1) {
  30770. $recv(aStream)._write_(" !");
  30771. [$recv(aStream)._lf()
  30772. ,$ctx1.sendIdx["lf"]=1
  30773. ][0];
  30774. $recv(aStream)._lf();
  30775. return self;
  30776. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream})});
  30777. }; }),
  30778. $globals.ChunkExporter);
  30779. $core.addMethod(
  30780. $core.method({
  30781. selector: "exportCategoryPrologueOf:on:",
  30782. protocol: "output",
  30783. args: ["aCategory", "aStream"],
  30784. 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: '!'",
  30785. referencedClasses: [],
  30786. pragmas: [],
  30787. messageSends: ["write:", "print:", "theClass"]
  30788. }, function ($methodClass){ return function (aCategory,aStream){
  30789. var self=this,$self=this;
  30790. return $core.withContext(function($ctx1) {
  30791. [$recv(aStream)._write_("!")
  30792. ,$ctx1.sendIdx["write:"]=1
  30793. ][0];
  30794. [$recv(aStream)._print_($recv(aCategory)._theClass())
  30795. ,$ctx1.sendIdx["print:"]=1
  30796. ][0];
  30797. [$recv(aStream)._write_(" methodsFor: ")
  30798. ,$ctx1.sendIdx["write:"]=2
  30799. ][0];
  30800. $recv(aStream)._print_(aCategory);
  30801. $recv(aStream)._write_("!");
  30802. return self;
  30803. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream})});
  30804. }; }),
  30805. $globals.ChunkExporter);
  30806. $core.addMethod(
  30807. $core.method({
  30808. selector: "exportDefinitionOf:on:",
  30809. protocol: "output",
  30810. args: ["aClass", "aStream"],
  30811. 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: {'slots: {'. ('. ' join: (aClass instanceVariableNames collect: #symbolPrintString)). '}'};\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",
  30812. referencedClasses: [],
  30813. pragmas: [],
  30814. messageSends: ["print:", "superclass", "write:", "printSymbol:", "name", "lf", "tab", "join:", "collect:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30815. }, function ($methodClass){ return function (aClass,aStream){
  30816. var self=this,$self=this;
  30817. return $core.withContext(function($ctx1) {
  30818. [$recv(aStream)._print_($recv(aClass)._superclass())
  30819. ,$ctx1.sendIdx["print:"]=1
  30820. ][0];
  30821. [$recv(aStream)._write_(" subclass: ")
  30822. ,$ctx1.sendIdx["write:"]=1
  30823. ][0];
  30824. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30825. [$recv(aStream)._lf()
  30826. ,$ctx1.sendIdx["lf"]=1
  30827. ][0];
  30828. [$recv(aStream)._tab()
  30829. ,$ctx1.sendIdx["tab"]=1
  30830. ][0];
  30831. [$recv(aStream)._write_(["slots: {",". "._join_($recv($recv(aClass)._instanceVariableNames())._collect_("symbolPrintString")),"}"])
  30832. ,$ctx1.sendIdx["write:"]=2
  30833. ][0];
  30834. [$recv(aStream)._lf()
  30835. ,$ctx1.sendIdx["lf"]=2
  30836. ][0];
  30837. $recv(aStream)._tab();
  30838. [$recv(aStream)._write_("package: ")
  30839. ,$ctx1.sendIdx["write:"]=3
  30840. ][0];
  30841. [$recv(aStream)._print_($recv(aClass)._category())
  30842. ,$ctx1.sendIdx["print:"]=2
  30843. ][0];
  30844. [$recv(aStream)._write_("!")
  30845. ,$ctx1.sendIdx["write:"]=4
  30846. ][0];
  30847. [$recv(aStream)._lf()
  30848. ,$ctx1.sendIdx["lf"]=3
  30849. ][0];
  30850. $recv([$recv(aClass)._comment()
  30851. ,$ctx1.sendIdx["comment"]=1
  30852. ][0])._ifNotEmpty_((function(){
  30853. return $core.withContext(function($ctx2) {
  30854. [$recv(aStream)._write_("!")
  30855. ,$ctx2.sendIdx["write:"]=5
  30856. ][0];
  30857. $recv(aStream)._print_(aClass);
  30858. [$recv(aStream)._write_(" commentStamp!")
  30859. ,$ctx2.sendIdx["write:"]=6
  30860. ][0];
  30861. [$recv(aStream)._lf()
  30862. ,$ctx2.sendIdx["lf"]=4
  30863. ][0];
  30864. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30865. return [$recv(aStream)._lf()
  30866. ,$ctx2.sendIdx["lf"]=5
  30867. ][0];
  30868. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30869. }));
  30870. $recv(aStream)._lf();
  30871. return self;
  30872. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream})});
  30873. }; }),
  30874. $globals.ChunkExporter);
  30875. $core.addMethod(
  30876. $core.method({
  30877. selector: "exportMetaDefinitionOf:on:",
  30878. protocol: "output",
  30879. args: ["aClass", "aStream"],
  30880. 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: {'slots: {'. ('. ' join: (classIvars collect: #symbolPrintString)). '}!'}; lf; lf ]",
  30881. referencedClasses: [],
  30882. pragmas: [],
  30883. messageSends: ["instanceVariableNames", "class", "traitComposition", "ifTrue:", "notEmpty", "print:", "theMetaClass", "space", "write:", "join:", "collect:", "lf"]
  30884. }, function ($methodClass){ return function (aClass,aStream){
  30885. var self=this,$self=this;
  30886. var classIvars,classTraitComposition;
  30887. return $core.withContext(function($ctx1) {
  30888. classIvars=$recv([$recv(aClass)._class()
  30889. ,$ctx1.sendIdx["class"]=1
  30890. ][0])._instanceVariableNames();
  30891. classTraitComposition=$recv($recv(aClass)._class())._traitComposition();
  30892. if($core.assert($recv(classIvars)._notEmpty())){
  30893. $recv(aStream)._print_($recv(aClass)._theMetaClass());
  30894. $recv(aStream)._space();
  30895. $recv(aStream)._write_(["slots: {",". "._join_($recv(classIvars)._collect_("symbolPrintString")),"}!"]);
  30896. [$recv(aStream)._lf()
  30897. ,$ctx1.sendIdx["lf"]=1
  30898. ][0];
  30899. $recv(aStream)._lf();
  30900. }
  30901. return self;
  30902. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream,classIvars:classIvars,classTraitComposition:classTraitComposition})});
  30903. }; }),
  30904. $globals.ChunkExporter);
  30905. $core.addMethod(
  30906. $core.method({
  30907. selector: "exportMethod:on:",
  30908. protocol: "output",
  30909. args: ["aMethod", "aStream"],
  30910. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; write: (self chunkEscape: aMethod source); lf;\x0a\x09\x09write: '!'",
  30911. referencedClasses: [],
  30912. pragmas: [],
  30913. messageSends: ["lf", "write:", "chunkEscape:", "source"]
  30914. }, function ($methodClass){ return function (aMethod,aStream){
  30915. var self=this,$self=this;
  30916. return $core.withContext(function($ctx1) {
  30917. [$recv(aStream)._lf()
  30918. ,$ctx1.sendIdx["lf"]=1
  30919. ][0];
  30920. [$recv(aStream)._lf()
  30921. ,$ctx1.sendIdx["lf"]=2
  30922. ][0];
  30923. [$recv(aStream)._write_($self._chunkEscape_($recv(aMethod)._source()))
  30924. ,$ctx1.sendIdx["write:"]=1
  30925. ][0];
  30926. $recv(aStream)._lf();
  30927. $recv(aStream)._write_("!");
  30928. return self;
  30929. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream})});
  30930. }; }),
  30931. $globals.ChunkExporter);
  30932. $core.addMethod(
  30933. $core.method({
  30934. selector: "exportPackage:on:",
  30935. protocol: "output",
  30936. args: ["aPackage", "aStream"],
  30937. 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: [ :eachClass | eachClass includingPossibleMetaDo: [ :each |\x0a\x09\x09self exportBehavior: each on: aStream ] ].\x0a\x09\x0a\x09self exportPackageTraitCompositionsOf: aPackage on: aStream.\x0a\x0a\x09self \x0a\x09\x09exportProtocols: (self extensionProtocolsOfPackage: aPackage)\x0a\x09\x09on: aStream",
  30938. referencedClasses: [],
  30939. pragmas: [],
  30940. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "includingPossibleMetaDo:", "exportBehavior:on:", "exportPackageTraitCompositionsOf:on:", "exportProtocols:on:", "extensionProtocolsOfPackage:"]
  30941. }, function ($methodClass){ return function (aPackage,aStream){
  30942. var self=this,$self=this;
  30943. return $core.withContext(function($ctx1) {
  30944. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  30945. $self._exportPackageImportsOf_on_(aPackage,aStream);
  30946. $recv($recv(aPackage)._sortedClasses())._do_((function(eachClass){
  30947. return $core.withContext(function($ctx2) {
  30948. return $recv(eachClass)._includingPossibleMetaDo_((function(each){
  30949. return $core.withContext(function($ctx3) {
  30950. return $self._exportBehavior_on_(each,aStream);
  30951. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  30952. }));
  30953. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  30954. }));
  30955. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  30956. $self._exportProtocols_on_($self._extensionProtocolsOfPackage_(aPackage),aStream);
  30957. return self;
  30958. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream})});
  30959. }; }),
  30960. $globals.ChunkExporter);
  30961. $core.addMethod(
  30962. $core.method({
  30963. selector: "exportPackageDefinitionOf:on:",
  30964. protocol: "output",
  30965. args: ["aPackage", "aStream"],
  30966. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'Smalltalk createPackage: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: '!';\x0a\x09\x09lf",
  30967. referencedClasses: [],
  30968. pragmas: [],
  30969. messageSends: ["write:", "print:", "name", "lf"]
  30970. }, function ($methodClass){ return function (aPackage,aStream){
  30971. var self=this,$self=this;
  30972. return $core.withContext(function($ctx1) {
  30973. [$recv(aStream)._write_("Smalltalk createPackage: ")
  30974. ,$ctx1.sendIdx["write:"]=1
  30975. ][0];
  30976. $recv(aStream)._print_($recv(aPackage)._name());
  30977. $recv(aStream)._write_("!");
  30978. $recv(aStream)._lf();
  30979. return self;
  30980. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream})});
  30981. }; }),
  30982. $globals.ChunkExporter);
  30983. $core.addMethod(
  30984. $core.method({
  30985. selector: "exportPackageImportsOf:on:",
  30986. protocol: "output",
  30987. args: ["aPackage", "aStream"],
  30988. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage imports ifNotEmpty: [ :imports | aStream\x0a\x09\x09write: '(Smalltalk packageAt: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: ' ifAbsent: [ self error: ';\x0a\x09\x09print: 'Package not created: ', aPackage name;\x0a\x09\x09write: { ' ]) imports: '. self chunkEscape: aPackage importsDefinition. '!' };\x0a\x09\x09lf ]",
  30989. referencedClasses: [],
  30990. pragmas: [],
  30991. messageSends: ["ifNotEmpty:", "imports", "write:", "print:", "name", ",", "chunkEscape:", "importsDefinition", "lf"]
  30992. }, function ($methodClass){ return function (aPackage,aStream){
  30993. var self=this,$self=this;
  30994. return $core.withContext(function($ctx1) {
  30995. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  30996. return $core.withContext(function($ctx2) {
  30997. [$recv(aStream)._write_("(Smalltalk packageAt: ")
  30998. ,$ctx2.sendIdx["write:"]=1
  30999. ][0];
  31000. [$recv(aStream)._print_([$recv(aPackage)._name()
  31001. ,$ctx2.sendIdx["name"]=1
  31002. ][0])
  31003. ,$ctx2.sendIdx["print:"]=1
  31004. ][0];
  31005. [$recv(aStream)._write_(" ifAbsent: [ self error: ")
  31006. ,$ctx2.sendIdx["write:"]=2
  31007. ][0];
  31008. $recv(aStream)._print_("Package not created: ".__comma($recv(aPackage)._name()));
  31009. $recv(aStream)._write_([" ]) imports: ",$self._chunkEscape_($recv(aPackage)._importsDefinition()),"!"]);
  31010. return $recv(aStream)._lf();
  31011. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  31012. }));
  31013. return self;
  31014. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream})});
  31015. }; }),
  31016. $globals.ChunkExporter);
  31017. $core.addMethod(
  31018. $core.method({
  31019. selector: "exportPackageTraitCompositionsOf:on:",
  31020. protocol: "output",
  31021. args: ["aPackage", "aStream"],
  31022. 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 ]",
  31023. referencedClasses: [],
  31024. pragmas: [],
  31025. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "write:", "lf"]
  31026. }, function ($methodClass){ return function (aPackage,aStream){
  31027. var self=this,$self=this;
  31028. return $core.withContext(function($ctx1) {
  31029. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  31030. return $core.withContext(function($ctx2) {
  31031. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  31032. return $core.withContext(function($ctx3) {
  31033. return $self._exportTraitComposition_of_on_(value,key,aStream);
  31034. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  31035. }));
  31036. $recv(aStream)._write_("! !");
  31037. [$recv(aStream)._lf()
  31038. ,$ctx2.sendIdx["lf"]=1
  31039. ][0];
  31040. return $recv(aStream)._lf();
  31041. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  31042. }));
  31043. return self;
  31044. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream})});
  31045. }; }),
  31046. $globals.ChunkExporter);
  31047. $core.addMethod(
  31048. $core.method({
  31049. selector: "exportProtocol:on:",
  31050. protocol: "output",
  31051. args: ["aProtocol", "aStream"],
  31052. 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 ]",
  31053. referencedClasses: [],
  31054. pragmas: [],
  31055. messageSends: ["ifNotEmpty:", "ownMethods", "exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  31056. }, function ($methodClass){ return function (aProtocol,aStream){
  31057. var self=this,$self=this;
  31058. return $core.withContext(function($ctx1) {
  31059. $recv($recv(aProtocol)._ownMethods())._ifNotEmpty_((function(methods){
  31060. return $core.withContext(function($ctx2) {
  31061. $self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  31062. $recv(methods)._do_((function(method){
  31063. return $core.withContext(function($ctx3) {
  31064. return $self._exportMethod_on_(method,aStream);
  31065. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  31066. }));
  31067. return $self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  31068. }, function($ctx2) {$ctx2.fillBlock({methods:methods},$ctx1,1)});
  31069. }));
  31070. return self;
  31071. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream})});
  31072. }; }),
  31073. $globals.ChunkExporter);
  31074. $core.addMethod(
  31075. $core.method({
  31076. selector: "exportProtocolEpilogueOf:on:",
  31077. protocol: "output",
  31078. args: ["aProtocol", "aStream"],
  31079. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  31080. referencedClasses: [],
  31081. pragmas: [],
  31082. messageSends: ["write:", "lf"]
  31083. }, function ($methodClass){ return function (aProtocol,aStream){
  31084. var self=this,$self=this;
  31085. return $core.withContext(function($ctx1) {
  31086. $recv(aStream)._write_(" !");
  31087. [$recv(aStream)._lf()
  31088. ,$ctx1.sendIdx["lf"]=1
  31089. ][0];
  31090. $recv(aStream)._lf();
  31091. return self;
  31092. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream})});
  31093. }; }),
  31094. $globals.ChunkExporter);
  31095. $core.addMethod(
  31096. $core.method({
  31097. selector: "exportProtocolPrologueOf:on:",
  31098. protocol: "output",
  31099. args: ["aProtocol", "aStream"],
  31100. 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: '!'",
  31101. referencedClasses: [],
  31102. pragmas: [],
  31103. messageSends: ["write:", "print:", "theClass", "name"]
  31104. }, function ($methodClass){ return function (aProtocol,aStream){
  31105. var self=this,$self=this;
  31106. return $core.withContext(function($ctx1) {
  31107. [$recv(aStream)._write_("!")
  31108. ,$ctx1.sendIdx["write:"]=1
  31109. ][0];
  31110. [$recv(aStream)._print_($recv(aProtocol)._theClass())
  31111. ,$ctx1.sendIdx["print:"]=1
  31112. ][0];
  31113. [$recv(aStream)._write_(" methodsFor: ")
  31114. ,$ctx1.sendIdx["write:"]=2
  31115. ][0];
  31116. $recv(aStream)._print_($recv(aProtocol)._name());
  31117. $recv(aStream)._write_("!");
  31118. return self;
  31119. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream})});
  31120. }; }),
  31121. $globals.ChunkExporter);
  31122. $core.addMethod(
  31123. $core.method({
  31124. selector: "exportProtocols:on:",
  31125. protocol: "output",
  31126. args: ["aCollection", "aStream"],
  31127. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  31128. referencedClasses: [],
  31129. pragmas: [],
  31130. messageSends: ["do:", "exportProtocol:on:"]
  31131. }, function ($methodClass){ return function (aCollection,aStream){
  31132. var self=this,$self=this;
  31133. return $core.withContext(function($ctx1) {
  31134. $recv(aCollection)._do_((function(each){
  31135. return $core.withContext(function($ctx2) {
  31136. return $self._exportProtocol_on_(each,aStream);
  31137. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31138. }));
  31139. return self;
  31140. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream})});
  31141. }; }),
  31142. $globals.ChunkExporter);
  31143. $core.addMethod(
  31144. $core.method({
  31145. selector: "exportTraitComposition:of:on:",
  31146. protocol: "output",
  31147. args: ["aTraitComposition", "aBehavior", "aStream"],
  31148. 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",
  31149. referencedClasses: [],
  31150. pragmas: [],
  31151. messageSends: ["print:", "write:", "traitCompositionDefinition", "lf"]
  31152. }, function ($methodClass){ return function (aTraitComposition,aBehavior,aStream){
  31153. var self=this,$self=this;
  31154. return $core.withContext(function($ctx1) {
  31155. $recv(aStream)._print_(aBehavior);
  31156. [$recv(aStream)._write_(" setTraitComposition: ")
  31157. ,$ctx1.sendIdx["write:"]=1
  31158. ][0];
  31159. [$recv(aStream)._write_($recv(aBehavior)._traitCompositionDefinition())
  31160. ,$ctx1.sendIdx["write:"]=2
  31161. ][0];
  31162. $recv(aStream)._write_(" asTraitComposition!");
  31163. $recv(aStream)._lf();
  31164. return self;
  31165. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream})});
  31166. }; }),
  31167. $globals.ChunkExporter);
  31168. $core.addMethod(
  31169. $core.method({
  31170. selector: "exportTraitDefinitionOf:on:",
  31171. protocol: "output",
  31172. args: ["aClass", "aStream"],
  31173. 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",
  31174. referencedClasses: [],
  31175. pragmas: [],
  31176. messageSends: ["write:", "printSymbol:", "name", "lf", "tab", "print:", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  31177. }, function ($methodClass){ return function (aClass,aStream){
  31178. var self=this,$self=this;
  31179. return $core.withContext(function($ctx1) {
  31180. [$recv(aStream)._write_("Trait named: ")
  31181. ,$ctx1.sendIdx["write:"]=1
  31182. ][0];
  31183. $recv(aStream)._printSymbol_($recv(aClass)._name());
  31184. [$recv(aStream)._lf()
  31185. ,$ctx1.sendIdx["lf"]=1
  31186. ][0];
  31187. $recv(aStream)._tab();
  31188. [$recv(aStream)._write_("package: ")
  31189. ,$ctx1.sendIdx["write:"]=2
  31190. ][0];
  31191. [$recv(aStream)._print_($recv(aClass)._category())
  31192. ,$ctx1.sendIdx["print:"]=1
  31193. ][0];
  31194. [$recv(aStream)._write_("!")
  31195. ,$ctx1.sendIdx["write:"]=3
  31196. ][0];
  31197. [$recv(aStream)._lf()
  31198. ,$ctx1.sendIdx["lf"]=2
  31199. ][0];
  31200. $recv([$recv(aClass)._comment()
  31201. ,$ctx1.sendIdx["comment"]=1
  31202. ][0])._ifNotEmpty_((function(){
  31203. return $core.withContext(function($ctx2) {
  31204. [$recv(aStream)._write_("!")
  31205. ,$ctx2.sendIdx["write:"]=4
  31206. ][0];
  31207. $recv(aStream)._print_(aClass);
  31208. [$recv(aStream)._write_(" commentStamp!")
  31209. ,$ctx2.sendIdx["write:"]=5
  31210. ][0];
  31211. [$recv(aStream)._lf()
  31212. ,$ctx2.sendIdx["lf"]=3
  31213. ][0];
  31214. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  31215. return [$recv(aStream)._lf()
  31216. ,$ctx2.sendIdx["lf"]=4
  31217. ][0];
  31218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31219. }));
  31220. $recv(aStream)._lf();
  31221. return self;
  31222. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream})});
  31223. }; }),
  31224. $globals.ChunkExporter);
  31225. $core.addMethod(
  31226. $core.method({
  31227. selector: "extensionCategoriesOfPackage:",
  31228. protocol: "accessing",
  31229. args: ["aPackage"],
  31230. 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\x09each includingPossibleMetaDo: [ :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",
  31231. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  31232. pragmas: [],
  31233. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "includingPossibleMetaDo:", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  31234. }, function ($methodClass){ return function (aPackage){
  31235. var self=this,$self=this;
  31236. var name,map,result;
  31237. return $core.withContext(function($ctx1) {
  31238. name=$recv(aPackage)._name();
  31239. result=[$recv($globals.OrderedCollection)._new()
  31240. ,$ctx1.sendIdx["new"]=1
  31241. ][0];
  31242. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  31243. return $core.withContext(function($ctx2) {
  31244. return $recv(each)._includingPossibleMetaDo_((function(aClass){
  31245. return $core.withContext(function($ctx3) {
  31246. map=$recv($globals.Dictionary)._new();
  31247. $recv(aClass)._protocolsDo_((function(category,methods){
  31248. return $core.withContext(function($ctx4) {
  31249. if($core.assert($recv(category).__eq("*".__comma(name)))){
  31250. return $recv(map)._at_put_(category,methods);
  31251. }
  31252. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  31253. }));
  31254. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  31255. return $core.withContext(function($ctx4) {
  31256. return $recv(a).__lt_eq(b);
  31257. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  31258. })))._collect_((function(category){
  31259. return $core.withContext(function($ctx4) {
  31260. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  31261. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  31262. })));
  31263. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  31264. }));
  31265. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31266. }));
  31267. return result;
  31268. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result})});
  31269. }; }),
  31270. $globals.ChunkExporter);
  31271. $core.addMethod(
  31272. $core.method({
  31273. selector: "ownCategoriesOfClass:",
  31274. protocol: "accessing",
  31275. args: ["aClass"],
  31276. 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) ]",
  31277. referencedClasses: ["Dictionary", "MethodCategory"],
  31278. pragmas: [],
  31279. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  31280. }, function ($methodClass){ return function (aClass){
  31281. var self=this,$self=this;
  31282. var map;
  31283. return $core.withContext(function($ctx1) {
  31284. map=$recv($globals.Dictionary)._new();
  31285. $recv(aClass)._protocolsDo_((function(each,methods){
  31286. return $core.withContext(function($ctx2) {
  31287. if(!$core.assert($recv(each)._match_("^\x5c*"))){
  31288. return $recv(map)._at_put_(each,methods);
  31289. }
  31290. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  31291. }));
  31292. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  31293. return $core.withContext(function($ctx2) {
  31294. return $recv(a).__lt_eq(b);
  31295. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  31296. })))._collect_((function(each){
  31297. return $core.withContext(function($ctx2) {
  31298. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  31299. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  31300. }));
  31301. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map})});
  31302. }; }),
  31303. $globals.ChunkExporter);
  31304. $core.addMethod(
  31305. $core.method({
  31306. selector: "ownCategoriesOfMetaClass:",
  31307. protocol: "accessing",
  31308. args: ["aClass"],
  31309. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass theMetaClass",
  31310. referencedClasses: [],
  31311. pragmas: [],
  31312. messageSends: ["ownCategoriesOfClass:", "theMetaClass"]
  31313. }, function ($methodClass){ return function (aClass){
  31314. var self=this,$self=this;
  31315. return $core.withContext(function($ctx1) {
  31316. return $self._ownCategoriesOfClass_($recv(aClass)._theMetaClass());
  31317. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass})});
  31318. }; }),
  31319. $globals.ChunkExporter);
  31320. $core.addMethod(
  31321. $core.method({
  31322. selector: "ownMethodProtocolsOfClass:",
  31323. protocol: "accessing",
  31324. args: ["aClass"],
  31325. 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 ]",
  31326. referencedClasses: ["ExportMethodProtocol"],
  31327. pragmas: [],
  31328. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  31329. }, function ($methodClass){ return function (aClass){
  31330. var self=this,$self=this;
  31331. return $core.withContext(function($ctx1) {
  31332. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  31333. return $core.withContext(function($ctx2) {
  31334. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  31335. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31336. }));
  31337. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass})});
  31338. }; }),
  31339. $globals.ChunkExporter);
  31340. $core.addClass("Exporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  31341. $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.).";
  31342. $core.addMethod(
  31343. $core.method({
  31344. selector: "exportBehavior:on:",
  31345. protocol: "output",
  31346. args: ["aBehavior", "aStream"],
  31347. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09aBehavior ownMethods do: [ :method |\x0a\x09\x09self exportMethod: method on: aStream ]",
  31348. referencedClasses: [],
  31349. pragmas: [],
  31350. messageSends: ["exportBehaviorDefinitionTo:using:", "do:", "ownMethods", "exportMethod:on:"]
  31351. }, function ($methodClass){ return function (aBehavior,aStream){
  31352. var self=this,$self=this;
  31353. return $core.withContext(function($ctx1) {
  31354. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  31355. $recv($recv(aBehavior)._ownMethods())._do_((function(method){
  31356. return $core.withContext(function($ctx2) {
  31357. return $self._exportMethod_on_(method,aStream);
  31358. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  31359. }));
  31360. return self;
  31361. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream})});
  31362. }; }),
  31363. $globals.Exporter);
  31364. $core.addMethod(
  31365. $core.method({
  31366. selector: "exportDefinitionOf:on:",
  31367. protocol: "output",
  31368. args: ["aClass", "aStream"],
  31369. 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",
  31370. referencedClasses: [],
  31371. pragmas: [],
  31372. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "ifNil:ifNotNil:", "superclass", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  31373. }, function ($methodClass){ return function (aClass,aStream){
  31374. var self=this,$self=this;
  31375. return $core.withContext(function($ctx1) {
  31376. var $1,$2,$3;
  31377. [$recv(aStream)._lf()
  31378. ,$ctx1.sendIdx["lf"]=1
  31379. ][0];
  31380. $1=[$recv($recv(aClass)._name())._asJavaScriptSource()
  31381. ,$ctx1.sendIdx["asJavaScriptSource"]=1
  31382. ][0];
  31383. $2=$recv(aClass)._superclass();
  31384. if($2 == null || $2.a$nil){
  31385. $3="null";
  31386. } else {
  31387. var superclass;
  31388. superclass=$2;
  31389. $3=[$recv(superclass)._asJavaScriptSource()
  31390. ,$ctx1.sendIdx["asJavaScriptSource"]=2
  31391. ][0];
  31392. }
  31393. [$recv(aStream)._write_(["$core.addClass(",$1,", ",$3,", ",[$recv($recv(aClass)._instanceVariableNames())._asJavaScriptSource()
  31394. ,$ctx1.sendIdx["asJavaScriptSource"]=3
  31395. ][0],", ",[$recv($recv(aClass)._category())._asJavaScriptSource()
  31396. ,$ctx1.sendIdx["asJavaScriptSource"]=4
  31397. ][0],");"])
  31398. ,$ctx1.sendIdx["write:"]=1
  31399. ][0];
  31400. $recv([$recv(aClass)._comment()
  31401. ,$ctx1.sendIdx["comment"]=1
  31402. ][0])._ifNotEmpty_((function(){
  31403. return $core.withContext(function($ctx2) {
  31404. [$recv(aStream)._lf()
  31405. ,$ctx2.sendIdx["lf"]=2
  31406. ][0];
  31407. [$recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);")
  31408. ,$ctx2.sendIdx["write:"]=2
  31409. ][0];
  31410. [$recv(aStream)._lf()
  31411. ,$ctx2.sendIdx["lf"]=3
  31412. ][0];
  31413. [$recv(aStream)._write_([[$recv(aClass)._asJavaScriptSource()
  31414. ,$ctx2.sendIdx["asJavaScriptSource"]=5
  31415. ][0],".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"])
  31416. ,$ctx2.sendIdx["write:"]=3
  31417. ][0];
  31418. [$recv(aStream)._lf()
  31419. ,$ctx2.sendIdx["lf"]=4
  31420. ][0];
  31421. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31422. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  31423. }));
  31424. $recv(aStream)._lf();
  31425. return self;
  31426. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream})});
  31427. }; }),
  31428. $globals.Exporter);
  31429. $core.addMethod(
  31430. $core.method({
  31431. selector: "exportMetaDefinitionOf:on:",
  31432. protocol: "output",
  31433. args: ["aClass", "aStream"],
  31434. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass theMetaClass instanceVariableNames ifNotEmpty: [ :classIvars | aStream\x0a\x09\x09write: { '$core.setSlots('. aClass theMetaClass asJavaScriptSource. ', '. classIvars asJavaScriptSource. ');' };\x0a\x09\x09lf ]",
  31435. referencedClasses: [],
  31436. pragmas: [],
  31437. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "theMetaClass", "write:", "asJavaScriptSource"]
  31438. }, function ($methodClass){ return function (aClass,aStream){
  31439. var self=this,$self=this;
  31440. return $core.withContext(function($ctx1) {
  31441. [$recv(aStream)._lf()
  31442. ,$ctx1.sendIdx["lf"]=1
  31443. ][0];
  31444. $recv($recv([$recv(aClass)._theMetaClass()
  31445. ,$ctx1.sendIdx["theMetaClass"]=1
  31446. ][0])._instanceVariableNames())._ifNotEmpty_((function(classIvars){
  31447. return $core.withContext(function($ctx2) {
  31448. $recv(aStream)._write_(["$core.setSlots(",[$recv($recv(aClass)._theMetaClass())._asJavaScriptSource()
  31449. ,$ctx2.sendIdx["asJavaScriptSource"]=1
  31450. ][0],", ",$recv(classIvars)._asJavaScriptSource(),");"]);
  31451. return $recv(aStream)._lf();
  31452. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  31453. }));
  31454. return self;
  31455. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream})});
  31456. }; }),
  31457. $globals.Exporter);
  31458. $core.addMethod(
  31459. $core.method({
  31460. selector: "exportMethod:on:",
  31461. protocol: "output",
  31462. args: ["aMethod", "aStream"],
  31463. 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\x09aMethod instantiateFn ifNil: [ aStream write: { 'fn: '. aMethod fn compiledSource. ',' }; lf ].\x0a\x09aStream\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: { 'pragmas: '. aMethod basicPragmas asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'messageSends: '. aMethod messageSends asJavaScriptSource }; lf;\x0a\x09\x09write: '}'.\x0a\x09aMethod instantiateFn ifNotNil: [ :ifn | aStream write: { ', '. ifn compiledSource } ].\x0a\x09aStream\x0a\x09\x09write: '),'; lf;\x0a\x09\x09write: { aMethod origin asJavaScriptSource. ');' }; lf; lf",
  31464. referencedClasses: [],
  31465. pragmas: [],
  31466. messageSends: ["write:", "lf", "asJavaScriptSource", "selector", "protocol", "ifNil:", "instantiateFn", "compiledSource", "fn", "arguments", "source", "referencedClasses", "basicPragmas", "messageSends", "ifNotNil:", "origin"]
  31467. }, function ($methodClass){ return function (aMethod,aStream){
  31468. var self=this,$self=this;
  31469. return $core.withContext(function($ctx1) {
  31470. var $1,$2;
  31471. [$recv(aStream)._write_("$core.addMethod(")
  31472. ,$ctx1.sendIdx["write:"]=1
  31473. ][0];
  31474. [$recv(aStream)._lf()
  31475. ,$ctx1.sendIdx["lf"]=1
  31476. ][0];
  31477. [$recv(aStream)._write_("$core.method({")
  31478. ,$ctx1.sendIdx["write:"]=2
  31479. ][0];
  31480. [$recv(aStream)._lf()
  31481. ,$ctx1.sendIdx["lf"]=2
  31482. ][0];
  31483. [$recv(aStream)._write_(["selector: ",[$recv($recv(aMethod)._selector())._asJavaScriptSource()
  31484. ,$ctx1.sendIdx["asJavaScriptSource"]=1
  31485. ][0],","])
  31486. ,$ctx1.sendIdx["write:"]=3
  31487. ][0];
  31488. [$recv(aStream)._lf()
  31489. ,$ctx1.sendIdx["lf"]=3
  31490. ][0];
  31491. [$recv(aStream)._write_(["protocol: ",[$recv($recv(aMethod)._protocol())._asJavaScriptSource()
  31492. ,$ctx1.sendIdx["asJavaScriptSource"]=2
  31493. ][0],","])
  31494. ,$ctx1.sendIdx["write:"]=4
  31495. ][0];
  31496. [$recv(aStream)._lf()
  31497. ,$ctx1.sendIdx["lf"]=4
  31498. ][0];
  31499. $1=[$recv(aMethod)._instantiateFn()
  31500. ,$ctx1.sendIdx["instantiateFn"]=1
  31501. ][0];
  31502. if($1 == null || $1.a$nil){
  31503. [$recv(aStream)._write_(["fn: ",[$recv($recv(aMethod)._fn())._compiledSource()
  31504. ,$ctx1.sendIdx["compiledSource"]=1
  31505. ][0],","])
  31506. ,$ctx1.sendIdx["write:"]=5
  31507. ][0];
  31508. [$recv(aStream)._lf()
  31509. ,$ctx1.sendIdx["lf"]=5
  31510. ][0];
  31511. } else {
  31512. $1;
  31513. }
  31514. [$recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);")
  31515. ,$ctx1.sendIdx["write:"]=6
  31516. ][0];
  31517. [$recv(aStream)._lf()
  31518. ,$ctx1.sendIdx["lf"]=6
  31519. ][0];
  31520. [$recv(aStream)._write_(["args: ",[$recv($recv(aMethod)._arguments())._asJavaScriptSource()
  31521. ,$ctx1.sendIdx["asJavaScriptSource"]=3
  31522. ][0],","])
  31523. ,$ctx1.sendIdx["write:"]=7
  31524. ][0];
  31525. [$recv(aStream)._lf()
  31526. ,$ctx1.sendIdx["lf"]=7
  31527. ][0];
  31528. [$recv(aStream)._write_(["source: ",[$recv($recv(aMethod)._source())._asJavaScriptSource()
  31529. ,$ctx1.sendIdx["asJavaScriptSource"]=4
  31530. ][0],","])
  31531. ,$ctx1.sendIdx["write:"]=8
  31532. ][0];
  31533. [$recv(aStream)._lf()
  31534. ,$ctx1.sendIdx["lf"]=8
  31535. ][0];
  31536. [$recv(aStream)._write_(["referencedClasses: ",[$recv($recv(aMethod)._referencedClasses())._asJavaScriptSource()
  31537. ,$ctx1.sendIdx["asJavaScriptSource"]=5
  31538. ][0],","])
  31539. ,$ctx1.sendIdx["write:"]=9
  31540. ][0];
  31541. [$recv(aStream)._lf()
  31542. ,$ctx1.sendIdx["lf"]=9
  31543. ][0];
  31544. [$recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);")
  31545. ,$ctx1.sendIdx["write:"]=10
  31546. ][0];
  31547. [$recv(aStream)._lf()
  31548. ,$ctx1.sendIdx["lf"]=10
  31549. ][0];
  31550. [$recv(aStream)._write_(["pragmas: ",[$recv($recv(aMethod)._basicPragmas())._asJavaScriptSource()
  31551. ,$ctx1.sendIdx["asJavaScriptSource"]=6
  31552. ][0],","])
  31553. ,$ctx1.sendIdx["write:"]=11
  31554. ][0];
  31555. [$recv(aStream)._lf()
  31556. ,$ctx1.sendIdx["lf"]=11
  31557. ][0];
  31558. [$recv(aStream)._write_(["messageSends: ",[$recv($recv(aMethod)._messageSends())._asJavaScriptSource()
  31559. ,$ctx1.sendIdx["asJavaScriptSource"]=7
  31560. ][0]])
  31561. ,$ctx1.sendIdx["write:"]=12
  31562. ][0];
  31563. [$recv(aStream)._lf()
  31564. ,$ctx1.sendIdx["lf"]=12
  31565. ][0];
  31566. [$recv(aStream)._write_("}")
  31567. ,$ctx1.sendIdx["write:"]=13
  31568. ][0];
  31569. $2=$recv(aMethod)._instantiateFn();
  31570. if($2 == null || $2.a$nil){
  31571. $2;
  31572. } else {
  31573. var ifn;
  31574. ifn=$2;
  31575. [$recv(aStream)._write_([", ",$recv(ifn)._compiledSource()])
  31576. ,$ctx1.sendIdx["write:"]=14
  31577. ][0];
  31578. }
  31579. [$recv(aStream)._write_("),")
  31580. ,$ctx1.sendIdx["write:"]=15
  31581. ][0];
  31582. [$recv(aStream)._lf()
  31583. ,$ctx1.sendIdx["lf"]=13
  31584. ][0];
  31585. $recv(aStream)._write_([$recv($recv(aMethod)._origin())._asJavaScriptSource(),");"]);
  31586. [$recv(aStream)._lf()
  31587. ,$ctx1.sendIdx["lf"]=14
  31588. ][0];
  31589. $recv(aStream)._lf();
  31590. return self;
  31591. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream})});
  31592. }; }),
  31593. $globals.Exporter);
  31594. $core.addMethod(
  31595. $core.method({
  31596. selector: "exportPackage:on:",
  31597. protocol: "output",
  31598. args: ["aPackage", "aStream"],
  31599. 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: [ :eachClass | eachClass includingPossibleMetaDo: [ :each |\x0a\x09\x09self exportBehavior: each 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",
  31600. referencedClasses: [],
  31601. pragmas: [],
  31602. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "includingPossibleMetaDo:", "exportBehavior:on:", "exportPackageTraitCompositionsOf:on:", "extensionMethodsOfPackage:", "exportMethod:on:", "exportPackageEpilogueOf:on:"]
  31603. }, function ($methodClass){ return function (aPackage,aStream){
  31604. var self=this,$self=this;
  31605. return $core.withContext(function($ctx1) {
  31606. $self._exportPackagePrologueOf_on_(aPackage,aStream);
  31607. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  31608. $self._exportPackageContextOf_on_(aPackage,aStream);
  31609. $self._exportPackageImportsOf_on_(aPackage,aStream);
  31610. $self._exportPackageTransportOf_on_(aPackage,aStream);
  31611. [$recv($recv(aPackage)._sortedClasses())._do_((function(eachClass){
  31612. return $core.withContext(function($ctx2) {
  31613. return $recv(eachClass)._includingPossibleMetaDo_((function(each){
  31614. return $core.withContext(function($ctx3) {
  31615. return $self._exportBehavior_on_(each,aStream);
  31616. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  31617. }));
  31618. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  31619. }))
  31620. ,$ctx1.sendIdx["do:"]=1
  31621. ][0];
  31622. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  31623. $recv($self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  31624. return $core.withContext(function($ctx2) {
  31625. return $self._exportMethod_on_(each,aStream);
  31626. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  31627. }));
  31628. $self._exportPackageEpilogueOf_on_(aPackage,aStream);
  31629. return self;
  31630. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream})});
  31631. }; }),
  31632. $globals.Exporter);
  31633. $core.addMethod(
  31634. $core.method({
  31635. selector: "exportPackageBodyBlockPrologueOf:on:",
  31636. protocol: "output",
  31637. args: ["aPackage", "aStream"],
  31638. source: "exportPackageBodyBlockPrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;'; lf",
  31639. referencedClasses: [],
  31640. pragmas: [],
  31641. messageSends: ["write:", "lf"]
  31642. }, function ($methodClass){ return function (aPackage,aStream){
  31643. var self=this,$self=this;
  31644. return $core.withContext(function($ctx1) {
  31645. $recv(aStream)._write_("var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  31646. $recv(aStream)._lf();
  31647. return self;
  31648. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream})});
  31649. }; }),
  31650. $globals.Exporter);
  31651. $core.addMethod(
  31652. $core.method({
  31653. selector: "exportPackageContextOf:on:",
  31654. protocol: "output",
  31655. args: ["aPackage", "aStream"],
  31656. source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '$pkg.innerEval = function (expr) { return eval(expr); };';\x0a\x09\x09lf",
  31657. referencedClasses: [],
  31658. pragmas: [],
  31659. messageSends: ["write:", "lf"]
  31660. }, function ($methodClass){ return function (aPackage,aStream){
  31661. var self=this,$self=this;
  31662. return $core.withContext(function($ctx1) {
  31663. $recv(aStream)._write_("$pkg.innerEval = function (expr) { return eval(expr); };");
  31664. $recv(aStream)._lf();
  31665. return self;
  31666. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream})});
  31667. }; }),
  31668. $globals.Exporter);
  31669. $core.addMethod(
  31670. $core.method({
  31671. selector: "exportPackageDefinitionOf:on:",
  31672. protocol: "output",
  31673. args: ["aPackage", "aStream"],
  31674. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { 'var $pkg = $core.addPackage('. aPackage name asJavaScriptSource. ');' };\x0a\x09\x09lf",
  31675. referencedClasses: [],
  31676. pragmas: [],
  31677. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31678. }, function ($methodClass){ return function (aPackage,aStream){
  31679. var self=this,$self=this;
  31680. return $core.withContext(function($ctx1) {
  31681. $recv(aStream)._write_(["var $pkg = $core.addPackage(",$recv($recv(aPackage)._name())._asJavaScriptSource(),");"]);
  31682. $recv(aStream)._lf();
  31683. return self;
  31684. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream})});
  31685. }; }),
  31686. $globals.Exporter);
  31687. $core.addMethod(
  31688. $core.method({
  31689. selector: "exportPackageEpilogueOf:on:",
  31690. protocol: "output",
  31691. args: ["aPackage", "aStream"],
  31692. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31693. referencedClasses: [],
  31694. pragmas: [],
  31695. messageSends: ["subclassResponsibility"]
  31696. }, function ($methodClass){ return function (aPackage,aStream){
  31697. var self=this,$self=this;
  31698. return $core.withContext(function($ctx1) {
  31699. $self._subclassResponsibility();
  31700. return self;
  31701. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream})});
  31702. }; }),
  31703. $globals.Exporter);
  31704. $core.addMethod(
  31705. $core.method({
  31706. selector: "exportPackageImportsOf:on:",
  31707. protocol: "output",
  31708. args: ["aPackage", "aStream"],
  31709. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage importsAsJson ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09write: { '$pkg.imports = '. imports asJavaScriptSource. ';' };\x0a\x09\x09\x09lf ]",
  31710. referencedClasses: [],
  31711. pragmas: [],
  31712. messageSends: ["ifNotEmpty:", "importsAsJson", "write:", "asJavaScriptSource", "lf"]
  31713. }, function ($methodClass){ return function (aPackage,aStream){
  31714. var self=this,$self=this;
  31715. return $core.withContext(function($ctx1) {
  31716. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  31717. return $core.withContext(function($ctx2) {
  31718. $recv(aStream)._write_(["$pkg.imports = ",$recv(imports)._asJavaScriptSource(),";"]);
  31719. return $recv(aStream)._lf();
  31720. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  31721. }));
  31722. return self;
  31723. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream})});
  31724. }; }),
  31725. $globals.Exporter);
  31726. $core.addMethod(
  31727. $core.method({
  31728. selector: "exportPackagePrologueOf:on:",
  31729. protocol: "output",
  31730. args: ["aPackage", "aStream"],
  31731. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31732. referencedClasses: [],
  31733. pragmas: [],
  31734. messageSends: ["subclassResponsibility"]
  31735. }, function ($methodClass){ return function (aPackage,aStream){
  31736. var self=this,$self=this;
  31737. return $core.withContext(function($ctx1) {
  31738. $self._subclassResponsibility();
  31739. return self;
  31740. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream})});
  31741. }; }),
  31742. $globals.Exporter);
  31743. $core.addMethod(
  31744. $core.method({
  31745. selector: "exportPackageTraitCompositionsOf:on:",
  31746. protocol: "output",
  31747. args: ["aPackage", "aStream"],
  31748. 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 ]",
  31749. referencedClasses: [],
  31750. pragmas: [],
  31751. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "lf"]
  31752. }, function ($methodClass){ return function (aPackage,aStream){
  31753. var self=this,$self=this;
  31754. return $core.withContext(function($ctx1) {
  31755. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  31756. return $core.withContext(function($ctx2) {
  31757. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  31758. return $core.withContext(function($ctx3) {
  31759. return $self._exportTraitComposition_of_on_(value,key,aStream);
  31760. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  31761. }));
  31762. return $recv(aStream)._lf();
  31763. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  31764. }));
  31765. return self;
  31766. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream})});
  31767. }; }),
  31768. $globals.Exporter);
  31769. $core.addMethod(
  31770. $core.method({
  31771. selector: "exportPackageTransportOf:on:",
  31772. protocol: "output",
  31773. args: ["aPackage", "aStream"],
  31774. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { '$pkg.transport = '. aPackage transport asJSONString. ';' };\x0a\x09\x09lf",
  31775. referencedClasses: [],
  31776. pragmas: [],
  31777. messageSends: ["write:", "asJSONString", "transport", "lf"]
  31778. }, function ($methodClass){ return function (aPackage,aStream){
  31779. var self=this,$self=this;
  31780. return $core.withContext(function($ctx1) {
  31781. $recv(aStream)._write_(["$pkg.transport = ",$recv($recv(aPackage)._transport())._asJSONString(),";"]);
  31782. $recv(aStream)._lf();
  31783. return self;
  31784. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream})});
  31785. }; }),
  31786. $globals.Exporter);
  31787. $core.addMethod(
  31788. $core.method({
  31789. selector: "exportTraitComposition:of:on:",
  31790. protocol: "output",
  31791. args: ["aTraitComposition", "aBehavior", "aStream"],
  31792. 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",
  31793. referencedClasses: [],
  31794. pragmas: [],
  31795. messageSends: ["write:", "asJavaScriptSource", "lf"]
  31796. }, function ($methodClass){ return function (aTraitComposition,aBehavior,aStream){
  31797. var self=this,$self=this;
  31798. return $core.withContext(function($ctx1) {
  31799. $recv(aStream)._write_(["$core.setTraitComposition(",[$recv(aTraitComposition)._asJavaScriptSource()
  31800. ,$ctx1.sendIdx["asJavaScriptSource"]=1
  31801. ][0],", ",$recv(aBehavior)._asJavaScriptSource(),");"]);
  31802. $recv(aStream)._lf();
  31803. return self;
  31804. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream})});
  31805. }; }),
  31806. $globals.Exporter);
  31807. $core.addMethod(
  31808. $core.method({
  31809. selector: "exportTraitDefinitionOf:on:",
  31810. protocol: "output",
  31811. args: ["aClass", "aStream"],
  31812. 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",
  31813. referencedClasses: [],
  31814. pragmas: [],
  31815. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  31816. }, function ($methodClass){ return function (aClass,aStream){
  31817. var self=this,$self=this;
  31818. return $core.withContext(function($ctx1) {
  31819. [$recv(aStream)._lf()
  31820. ,$ctx1.sendIdx["lf"]=1
  31821. ][0];
  31822. [$recv(aStream)._write_(["$core.addTrait(",[$recv($recv(aClass)._name())._asJavaScriptSource()
  31823. ,$ctx1.sendIdx["asJavaScriptSource"]=1
  31824. ][0],", ",[$recv($recv(aClass)._category())._asJavaScriptSource()
  31825. ,$ctx1.sendIdx["asJavaScriptSource"]=2
  31826. ][0],");"])
  31827. ,$ctx1.sendIdx["write:"]=1
  31828. ][0];
  31829. $recv([$recv(aClass)._comment()
  31830. ,$ctx1.sendIdx["comment"]=1
  31831. ][0])._ifNotEmpty_((function(){
  31832. return $core.withContext(function($ctx2) {
  31833. [$recv(aStream)._lf()
  31834. ,$ctx2.sendIdx["lf"]=2
  31835. ][0];
  31836. [$recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);")
  31837. ,$ctx2.sendIdx["write:"]=2
  31838. ][0];
  31839. [$recv(aStream)._lf()
  31840. ,$ctx2.sendIdx["lf"]=3
  31841. ][0];
  31842. [$recv(aStream)._write_([[$recv(aClass)._asJavaScriptSource()
  31843. ,$ctx2.sendIdx["asJavaScriptSource"]=3
  31844. ][0],".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"])
  31845. ,$ctx2.sendIdx["write:"]=3
  31846. ][0];
  31847. [$recv(aStream)._lf()
  31848. ,$ctx2.sendIdx["lf"]=4
  31849. ][0];
  31850. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31851. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31852. }));
  31853. $recv(aStream)._lf();
  31854. return self;
  31855. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream})});
  31856. }; }),
  31857. $globals.Exporter);
  31858. $core.addMethod(
  31859. $core.method({
  31860. selector: "ownMethodsOfClass:",
  31861. protocol: "accessing",
  31862. args: ["aClass"],
  31863. 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*') ]",
  31864. referencedClasses: [],
  31865. pragmas: [],
  31866. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  31867. }, function ($methodClass){ return function (aClass){
  31868. var self=this,$self=this;
  31869. return $core.withContext(function($ctx1) {
  31870. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  31871. return $core.withContext(function($ctx2) {
  31872. return $recv([$recv(a)._selector()
  31873. ,$ctx2.sendIdx["selector"]=1
  31874. ][0]).__lt_eq($recv(b)._selector());
  31875. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31876. })))._reject_((function(each){
  31877. return $core.withContext(function($ctx2) {
  31878. return $recv($recv(each)._protocol())._match_("^\x5c*");
  31879. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31880. }));
  31881. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass})});
  31882. }; }),
  31883. $globals.Exporter);
  31884. $core.addMethod(
  31885. $core.method({
  31886. selector: "ownMethodsOfMetaClass:",
  31887. protocol: "accessing",
  31888. args: ["aClass"],
  31889. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass theMetaClass",
  31890. referencedClasses: [],
  31891. pragmas: [],
  31892. messageSends: ["ownMethodsOfClass:", "theMetaClass"]
  31893. }, function ($methodClass){ return function (aClass){
  31894. var self=this,$self=this;
  31895. return $core.withContext(function($ctx1) {
  31896. return $self._ownMethodsOfClass_($recv(aClass)._theMetaClass());
  31897. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass})});
  31898. }; }),
  31899. $globals.Exporter);
  31900. $core.addClass("AmdExporter", $globals.Exporter, ["namespace"], "Platform-ImportExport");
  31901. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  31902. $core.addMethod(
  31903. $core.method({
  31904. selector: "amdNamesOfPackages:",
  31905. protocol: "private",
  31906. args: ["anArray"],
  31907. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  31908. referencedClasses: [],
  31909. pragmas: [],
  31910. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  31911. }, function ($methodClass){ return function (anArray){
  31912. var self=this,$self=this;
  31913. return $core.withContext(function($ctx1) {
  31914. return $recv($recv(anArray)._select_((function(each){
  31915. return $core.withContext(function($ctx2) {
  31916. return $recv([$self._amdNamespaceOfPackage_(each)
  31917. ,$ctx2.sendIdx["amdNamespaceOfPackage:"]=1
  31918. ][0])._notNil();
  31919. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31920. })))._collect_((function(each){
  31921. return $core.withContext(function($ctx2) {
  31922. return [$recv($recv($self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name())
  31923. ,$ctx2.sendIdx[","]=1
  31924. ][0];
  31925. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31926. }));
  31927. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray})});
  31928. }; }),
  31929. $globals.AmdExporter);
  31930. $core.addMethod(
  31931. $core.method({
  31932. selector: "amdNamespaceOfPackage:",
  31933. protocol: "private",
  31934. args: ["aPackage"],
  31935. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  31936. referencedClasses: [],
  31937. pragmas: [],
  31938. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  31939. }, function ($methodClass){ return function (aPackage){
  31940. var self=this,$self=this;
  31941. return $core.withContext(function($ctx1) {
  31942. if($core.assert($recv($recv([$recv(aPackage)._transport()
  31943. ,$ctx1.sendIdx["transport"]=1
  31944. ][0])._type()).__eq("amd"))){
  31945. return $recv($recv(aPackage)._transport())._namespace();
  31946. } else {
  31947. return nil;
  31948. }
  31949. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage})});
  31950. }; }),
  31951. $globals.AmdExporter);
  31952. $core.addMethod(
  31953. $core.method({
  31954. selector: "exportPackageEpilogueOf:on:",
  31955. protocol: "output",
  31956. args: ["aPackage", "aStream"],
  31957. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '});';\x0a\x09\x09lf",
  31958. referencedClasses: [],
  31959. pragmas: [],
  31960. messageSends: ["write:", "lf"]
  31961. }, function ($methodClass){ return function (aPackage,aStream){
  31962. var self=this,$self=this;
  31963. return $core.withContext(function($ctx1) {
  31964. $recv(aStream)._write_("});");
  31965. $recv(aStream)._lf();
  31966. return self;
  31967. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream})});
  31968. }; }),
  31969. $globals.AmdExporter);
  31970. $core.addMethod(
  31971. $core.method({
  31972. selector: "exportPackageImportsOf:on:",
  31973. protocol: "output",
  31974. args: ["aPackage", "aStream"],
  31975. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09| importsForOutput pragmaStart pragmaEnd |\x0a\x09pragmaStart := '//>>excludeStart(\x22imports\x22, pragmas.excludeImports);', String lf.\x0a\x09pragmaEnd := '//>>excludeEnd(\x22imports\x22);', String lf.\x0a\x09super exportPackageImportsOf: aPackage on: aStream.\x0a\x09importsForOutput := self importsForOutput: aPackage.\x0a\x09importsForOutput value ifNotEmpty: [ :imports |\x0a\x09\x09| vars |\x0a\x09\x09aStream write: pragmaStart.\x0a\x09\x09vars := importsForOutput key.\x0a\x09\x09vars ifNotEmpty: [ aStream write: { 'var '. ',' join: vars. ';' }; lf ]. \x0a\x09\x09aStream\x0a\x09\x09\x09write: {\x0a\x09\x09\x09\x09'$pkg.isReady = new Promise(function (resolve, reject) { requirejs('.\x0a\x09\x09\x09\x09imports asJavaScriptSource.\x0a\x09\x09\x09\x09', function ('.\x0a\x09\x09\x09\x09',' join: ((1 to: vars size) collect: [ :each | '$', each asString ]).\x0a\x09\x09\x09\x09') {'.\x0a\x09\x09\x09\x09(1 to: vars size) collect: [ :each | (vars at: each), '=$', each asString, '; ' ].\x0a\x09\x09\x09\x09'resolve();}, reject); });' };\x0a\x09\x09\x09lf;\x0a\x09\x09\x09write: pragmaEnd ]",
  31976. referencedClasses: ["String"],
  31977. pragmas: [],
  31978. messageSends: [",", "lf", "exportPackageImportsOf:on:", "importsForOutput:", "ifNotEmpty:", "value", "write:", "key", "join:", "asJavaScriptSource", "collect:", "to:", "size", "asString", "at:"]
  31979. }, function ($methodClass){ return function (aPackage,aStream){
  31980. var self=this,$self=this;
  31981. var importsForOutput,pragmaStart,pragmaEnd;
  31982. return $core.withContext(function($ctx1) {
  31983. pragmaStart=["//>>excludeStart(\x22imports\x22, pragmas.excludeImports);".__comma([$recv($globals.String)._lf()
  31984. ,$ctx1.sendIdx["lf"]=1
  31985. ][0])
  31986. ,$ctx1.sendIdx[","]=1
  31987. ][0];
  31988. pragmaEnd=["//>>excludeEnd(\x22imports\x22);".__comma([$recv($globals.String)._lf()
  31989. ,$ctx1.sendIdx["lf"]=2
  31990. ][0])
  31991. ,$ctx1.sendIdx[","]=2
  31992. ][0];
  31993. [(
  31994. $ctx1.supercall = true,
  31995. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._exportPackageImportsOf_on_.call($self,aPackage,aStream))
  31996. ,$ctx1.supercall = false
  31997. ][0];
  31998. importsForOutput=$self._importsForOutput_(aPackage);
  31999. [$recv($recv(importsForOutput)._value())._ifNotEmpty_((function(imports){
  32000. var vars;
  32001. return $core.withContext(function($ctx2) {
  32002. [$recv(aStream)._write_(pragmaStart)
  32003. ,$ctx2.sendIdx["write:"]=1
  32004. ][0];
  32005. vars=$recv(importsForOutput)._key();
  32006. $recv(vars)._ifNotEmpty_((function(){
  32007. return $core.withContext(function($ctx3) {
  32008. [$recv(aStream)._write_(["var ",[","._join_(vars)
  32009. ,$ctx3.sendIdx["join:"]=1
  32010. ][0],";"])
  32011. ,$ctx3.sendIdx["write:"]=2
  32012. ][0];
  32013. return [$recv(aStream)._lf()
  32014. ,$ctx3.sendIdx["lf"]=3
  32015. ][0];
  32016. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32017. }));
  32018. [$recv(aStream)._write_(["$pkg.isReady = new Promise(function (resolve, reject) { requirejs(",$recv(imports)._asJavaScriptSource(),", function (",","._join_([$recv([(1)._to_([$recv(vars)._size()
  32019. ,$ctx2.sendIdx["size"]=1
  32020. ][0])
  32021. ,$ctx2.sendIdx["to:"]=1
  32022. ][0])._collect_((function(each){
  32023. return $core.withContext(function($ctx3) {
  32024. return ["$".__comma([$recv(each)._asString()
  32025. ,$ctx3.sendIdx["asString"]=1
  32026. ][0])
  32027. ,$ctx3.sendIdx[","]=3
  32028. ][0];
  32029. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  32030. }))
  32031. ,$ctx2.sendIdx["collect:"]=1
  32032. ][0]),") {",$recv((1)._to_($recv(vars)._size()))._collect_((function(each){
  32033. return $core.withContext(function($ctx3) {
  32034. return [$recv([$recv($recv($recv(vars)._at_(each)).__comma("=$")).__comma($recv(each)._asString())
  32035. ,$ctx3.sendIdx[","]=5
  32036. ][0]).__comma("; ")
  32037. ,$ctx3.sendIdx[","]=4
  32038. ][0];
  32039. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  32040. })),"resolve();}, reject); });"])
  32041. ,$ctx2.sendIdx["write:"]=3
  32042. ][0];
  32043. $recv(aStream)._lf();
  32044. return $recv(aStream)._write_(pragmaEnd);
  32045. }, function($ctx2) {$ctx2.fillBlock({imports:imports,vars:vars},$ctx1,1)});
  32046. }))
  32047. ,$ctx1.sendIdx["ifNotEmpty:"]=1
  32048. ][0];
  32049. return self;
  32050. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd})});
  32051. }; }),
  32052. $globals.AmdExporter);
  32053. $core.addMethod(
  32054. $core.method({
  32055. selector: "exportPackagePrologueOf:on:",
  32056. protocol: "output",
  32057. args: ["aPackage", "aStream"],
  32058. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09| loadDependencies pragmaStart pragmaEnd |\x0a\x09pragmaStart := '//>>excludeStart(\x22imports\x22, pragmas.excludeImports);', String lf.\x0a\x09pragmaEnd := '//>>excludeEnd(\x22imports\x22);', String lf.\x0a\x09loadDependencies := self amdNamesOfPackages: aPackage loadDependencies.\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'define('.\x0a\x09\x09\x09(#('amber/boot' 'require'), loadDependencies asArray sorted) asJavaScriptSource.\x0a\x09\x09\x09', function($boot,requirejs){\x22use strict\x22;' };\x0a\x09\x09lf.\x0a\x09self exportPackageBodyBlockPrologueOf: aPackage on: aStream",
  32059. referencedClasses: ["String"],
  32060. pragmas: [],
  32061. messageSends: [",", "lf", "amdNamesOfPackages:", "loadDependencies", "write:", "asJavaScriptSource", "sorted", "asArray", "exportPackageBodyBlockPrologueOf:on:"]
  32062. }, function ($methodClass){ return function (aPackage,aStream){
  32063. var self=this,$self=this;
  32064. var loadDependencies,pragmaStart,pragmaEnd;
  32065. return $core.withContext(function($ctx1) {
  32066. pragmaStart=["//>>excludeStart(\x22imports\x22, pragmas.excludeImports);".__comma([$recv($globals.String)._lf()
  32067. ,$ctx1.sendIdx["lf"]=1
  32068. ][0])
  32069. ,$ctx1.sendIdx[","]=1
  32070. ][0];
  32071. pragmaEnd=["//>>excludeEnd(\x22imports\x22);".__comma([$recv($globals.String)._lf()
  32072. ,$ctx1.sendIdx["lf"]=2
  32073. ][0])
  32074. ,$ctx1.sendIdx[","]=2
  32075. ][0];
  32076. loadDependencies=$self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  32077. $recv(aStream)._write_(["define(",$recv(["amber/boot", "require"].__comma($recv($recv(loadDependencies)._asArray())._sorted()))._asJavaScriptSource(),", function($boot,requirejs){\x22use strict\x22;"]);
  32078. $recv(aStream)._lf();
  32079. $self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  32080. return self;
  32081. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd})});
  32082. }; }),
  32083. $globals.AmdExporter);
  32084. $core.addMethod(
  32085. $core.method({
  32086. selector: "importsForOutput:",
  32087. protocol: "private",
  32088. args: ["aPackage"],
  32089. 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)",
  32090. referencedClasses: [],
  32091. pragmas: [],
  32092. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  32093. }, function ($methodClass){ return function (aPackage){
  32094. var self=this,$self=this;
  32095. var namedImports,anonImports,importVarNames;
  32096. return $core.withContext(function($ctx1) {
  32097. namedImports=[];
  32098. anonImports=[];
  32099. importVarNames=[];
  32100. $recv($recv(aPackage)._imports())._do_((function(each){
  32101. return $core.withContext(function($ctx2) {
  32102. if($core.assert($recv(each)._isString())){
  32103. return [$recv(anonImports)._add_(each)
  32104. ,$ctx2.sendIdx["add:"]=1
  32105. ][0];
  32106. } else {
  32107. [$recv(namedImports)._add_($recv(each)._value())
  32108. ,$ctx2.sendIdx["add:"]=2
  32109. ][0];
  32110. return $recv(importVarNames)._add_($recv(each)._key());
  32111. }
  32112. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32113. }));
  32114. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  32115. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames})});
  32116. }; }),
  32117. $globals.AmdExporter);
  32118. $core.addClass("ChunkParser", $globals.Object, ["stream", "last"], "Platform-ImportExport");
  32119. $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";
  32120. $core.addMethod(
  32121. $core.method({
  32122. selector: "last",
  32123. protocol: "accessing",
  32124. args: [],
  32125. source: "last\x0a\x09^ last",
  32126. referencedClasses: [],
  32127. pragmas: [],
  32128. messageSends: []
  32129. }, function ($methodClass){ return function (){
  32130. var self=this,$self=this;
  32131. return $self.last;
  32132. }; }),
  32133. $globals.ChunkParser);
  32134. $core.addMethod(
  32135. $core.method({
  32136. selector: "nextChunk",
  32137. protocol: "reading",
  32138. args: [],
  32139. 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",
  32140. referencedClasses: [],
  32141. pragmas: [],
  32142. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  32143. }, function ($methodClass){ return function (){
  32144. var self=this,$self=this;
  32145. var char,result,chunk;
  32146. return $core.withContext(function($ctx1) {
  32147. var $early={};
  32148. try {
  32149. result=""._writeStream();
  32150. $recv((function(){
  32151. return $core.withContext(function($ctx2) {
  32152. char=[$recv($self.stream)._next()
  32153. ,$ctx2.sendIdx["next"]=1
  32154. ][0];
  32155. return $recv(char)._notNil();
  32156. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32157. }))._whileTrue_((function(){
  32158. return $core.withContext(function($ctx2) {
  32159. if($core.assert([$recv(char).__eq("!")
  32160. ,$ctx2.sendIdx["="]=1
  32161. ][0])){
  32162. if($core.assert($recv($recv($self.stream)._peek()).__eq("!"))){
  32163. $recv($self.stream)._next();
  32164. } else {
  32165. $self.last=$recv($recv(result)._contents())._trimBoth();
  32166. throw $early=[$self.last];
  32167. }
  32168. }
  32169. return $recv(result)._nextPut_(char);
  32170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  32171. }));
  32172. $self.last=nil;
  32173. return $self.last;
  32174. }
  32175. catch(e) {if(e===$early)return e[0]; throw e}
  32176. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk})});
  32177. }; }),
  32178. $globals.ChunkParser);
  32179. $core.addMethod(
  32180. $core.method({
  32181. selector: "stream:",
  32182. protocol: "accessing",
  32183. args: ["aStream"],
  32184. source: "stream: aStream\x0a\x09stream := aStream",
  32185. referencedClasses: [],
  32186. pragmas: [],
  32187. messageSends: []
  32188. }, function ($methodClass){ return function (aStream){
  32189. var self=this,$self=this;
  32190. $self.stream=aStream;
  32191. return self;
  32192. }; }),
  32193. $globals.ChunkParser);
  32194. $core.addMethod(
  32195. $core.method({
  32196. selector: "on:",
  32197. protocol: "instance creation",
  32198. args: ["aStream"],
  32199. source: "on: aStream\x0a\x09^ self new stream: aStream",
  32200. referencedClasses: [],
  32201. pragmas: [],
  32202. messageSends: ["stream:", "new"]
  32203. }, function ($methodClass){ return function (aStream){
  32204. var self=this,$self=this;
  32205. return $core.withContext(function($ctx1) {
  32206. return $recv($self._new())._stream_(aStream);
  32207. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream})});
  32208. }; }),
  32209. $globals.ChunkParser.a$cls);
  32210. $core.addClass("ClassCommentReader", $globals.Object, ["class"], "Platform-ImportExport");
  32211. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  32212. $core.addMethod(
  32213. $core.method({
  32214. selector: "class:",
  32215. protocol: "accessing",
  32216. args: ["aClass"],
  32217. source: "class: aClass\x0a\x09class := aClass",
  32218. referencedClasses: [],
  32219. pragmas: [],
  32220. messageSends: []
  32221. }, function ($methodClass){ return function (aClass){
  32222. var self=this,$self=this;
  32223. $self.class=aClass;
  32224. return self;
  32225. }; }),
  32226. $globals.ClassCommentReader);
  32227. $core.addMethod(
  32228. $core.method({
  32229. selector: "initialize",
  32230. protocol: "initialization",
  32231. args: [],
  32232. source: "initialize\x0a\x09super initialize.",
  32233. referencedClasses: [],
  32234. pragmas: [],
  32235. messageSends: ["initialize"]
  32236. }, function ($methodClass){ return function (){
  32237. var self=this,$self=this;
  32238. return $core.withContext(function($ctx1) {
  32239. [(
  32240. $ctx1.supercall = true,
  32241. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  32242. ,$ctx1.supercall = false
  32243. ][0];
  32244. return self;
  32245. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  32246. }; }),
  32247. $globals.ClassCommentReader);
  32248. $core.addMethod(
  32249. $core.method({
  32250. selector: "scanFrom:",
  32251. protocol: "fileIn",
  32252. args: ["aChunkParser"],
  32253. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  32254. referencedClasses: [],
  32255. pragmas: [],
  32256. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  32257. }, function ($methodClass){ return function (aChunkParser){
  32258. var self=this,$self=this;
  32259. var chunk;
  32260. return $core.withContext(function($ctx1) {
  32261. chunk=$recv(aChunkParser)._nextChunk();
  32262. $recv(chunk)._ifNotEmpty_((function(){
  32263. return $core.withContext(function($ctx2) {
  32264. return $self._setComment_(chunk);
  32265. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32266. }));
  32267. return self;
  32268. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk})});
  32269. }; }),
  32270. $globals.ClassCommentReader);
  32271. $core.addMethod(
  32272. $core.method({
  32273. selector: "setComment:",
  32274. protocol: "private",
  32275. args: ["aString"],
  32276. source: "setComment: aString\x0a\x09class comment: aString",
  32277. referencedClasses: [],
  32278. pragmas: [],
  32279. messageSends: ["comment:"]
  32280. }, function ($methodClass){ return function (aString){
  32281. var self=this,$self=this;
  32282. return $core.withContext(function($ctx1) {
  32283. $recv($self.class)._comment_(aString);
  32284. return self;
  32285. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString})});
  32286. }; }),
  32287. $globals.ClassCommentReader);
  32288. $core.addClass("ClassProtocolReader", $globals.Object, ["class", "category"], "Platform-ImportExport");
  32289. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  32290. $core.addMethod(
  32291. $core.method({
  32292. selector: "class:category:",
  32293. protocol: "accessing",
  32294. args: ["aClass", "aString"],
  32295. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  32296. referencedClasses: [],
  32297. pragmas: [],
  32298. messageSends: []
  32299. }, function ($methodClass){ return function (aClass,aString){
  32300. var self=this,$self=this;
  32301. $self.class=aClass;
  32302. $self.category=aString;
  32303. return self;
  32304. }; }),
  32305. $globals.ClassProtocolReader);
  32306. $core.addMethod(
  32307. $core.method({
  32308. selector: "compileMethod:",
  32309. protocol: "private",
  32310. args: ["aString"],
  32311. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  32312. referencedClasses: ["Compiler"],
  32313. pragmas: [],
  32314. messageSends: ["install:forClass:protocol:", "new"]
  32315. }, function ($methodClass){ return function (aString){
  32316. var self=this,$self=this;
  32317. return $core.withContext(function($ctx1) {
  32318. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,$self.class,$self.category);
  32319. return self;
  32320. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString})});
  32321. }; }),
  32322. $globals.ClassProtocolReader);
  32323. $core.addMethod(
  32324. $core.method({
  32325. selector: "initialize",
  32326. protocol: "initialization",
  32327. args: [],
  32328. source: "initialize\x0a\x09super initialize.",
  32329. referencedClasses: [],
  32330. pragmas: [],
  32331. messageSends: ["initialize"]
  32332. }, function ($methodClass){ return function (){
  32333. var self=this,$self=this;
  32334. return $core.withContext(function($ctx1) {
  32335. [(
  32336. $ctx1.supercall = true,
  32337. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  32338. ,$ctx1.supercall = false
  32339. ][0];
  32340. return self;
  32341. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  32342. }; }),
  32343. $globals.ClassProtocolReader);
  32344. $core.addMethod(
  32345. $core.method({
  32346. selector: "scanFrom:",
  32347. protocol: "fileIn",
  32348. args: ["aChunkParser"],
  32349. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  32350. referencedClasses: [],
  32351. pragmas: [],
  32352. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  32353. }, function ($methodClass){ return function (aChunkParser){
  32354. var self=this,$self=this;
  32355. var chunk;
  32356. return $core.withContext(function($ctx1) {
  32357. $recv((function(){
  32358. return $core.withContext(function($ctx2) {
  32359. chunk=$recv(aChunkParser)._nextChunk();
  32360. return $recv(chunk)._isEmpty();
  32361. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32362. }))._whileFalse_((function(){
  32363. return $core.withContext(function($ctx2) {
  32364. return $self._compileMethod_(chunk);
  32365. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  32366. }));
  32367. return self;
  32368. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk})});
  32369. }; }),
  32370. $globals.ClassProtocolReader);
  32371. $core.addClass("ExportMethodProtocol", $globals.Object, ["name", "theClass"], "Platform-ImportExport");
  32372. $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.";
  32373. $core.addMethod(
  32374. $core.method({
  32375. selector: "methods",
  32376. protocol: "accessing",
  32377. args: [],
  32378. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  32379. referencedClasses: [],
  32380. pragmas: [],
  32381. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  32382. }, function ($methodClass){ return function (){
  32383. var self=this,$self=this;
  32384. return $core.withContext(function($ctx1) {
  32385. return $recv($recv($self._theClass())._methodsInProtocol_($self._name()))._sorted_((function(a,b){
  32386. return $core.withContext(function($ctx2) {
  32387. return $recv([$recv(a)._selector()
  32388. ,$ctx2.sendIdx["selector"]=1
  32389. ][0]).__lt_eq($recv(b)._selector());
  32390. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  32391. }));
  32392. }, function($ctx1) {$ctx1.fill(self,"methods",{})});
  32393. }; }),
  32394. $globals.ExportMethodProtocol);
  32395. $core.addMethod(
  32396. $core.method({
  32397. selector: "name",
  32398. protocol: "accessing",
  32399. args: [],
  32400. source: "name\x0a\x09^ name",
  32401. referencedClasses: [],
  32402. pragmas: [],
  32403. messageSends: []
  32404. }, function ($methodClass){ return function (){
  32405. var self=this,$self=this;
  32406. return $self.name;
  32407. }; }),
  32408. $globals.ExportMethodProtocol);
  32409. $core.addMethod(
  32410. $core.method({
  32411. selector: "name:",
  32412. protocol: "accessing",
  32413. args: ["aString"],
  32414. source: "name: aString\x0a\x09name := aString",
  32415. referencedClasses: [],
  32416. pragmas: [],
  32417. messageSends: []
  32418. }, function ($methodClass){ return function (aString){
  32419. var self=this,$self=this;
  32420. $self.name=aString;
  32421. return self;
  32422. }; }),
  32423. $globals.ExportMethodProtocol);
  32424. $core.addMethod(
  32425. $core.method({
  32426. selector: "ownMethods",
  32427. protocol: "accessing",
  32428. args: [],
  32429. source: "ownMethods\x0a\x09^ (self theClass ownMethodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  32430. referencedClasses: [],
  32431. pragmas: [],
  32432. messageSends: ["sorted:", "ownMethodsInProtocol:", "theClass", "name", "<=", "selector"]
  32433. }, function ($methodClass){ return function (){
  32434. var self=this,$self=this;
  32435. return $core.withContext(function($ctx1) {
  32436. return $recv($recv($self._theClass())._ownMethodsInProtocol_($self._name()))._sorted_((function(a,b){
  32437. return $core.withContext(function($ctx2) {
  32438. return $recv([$recv(a)._selector()
  32439. ,$ctx2.sendIdx["selector"]=1
  32440. ][0]).__lt_eq($recv(b)._selector());
  32441. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  32442. }));
  32443. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{})});
  32444. }; }),
  32445. $globals.ExportMethodProtocol);
  32446. $core.addMethod(
  32447. $core.method({
  32448. selector: "theClass",
  32449. protocol: "accessing",
  32450. args: [],
  32451. source: "theClass\x0a\x09^ theClass",
  32452. referencedClasses: [],
  32453. pragmas: [],
  32454. messageSends: []
  32455. }, function ($methodClass){ return function (){
  32456. var self=this,$self=this;
  32457. return $self.theClass;
  32458. }; }),
  32459. $globals.ExportMethodProtocol);
  32460. $core.addMethod(
  32461. $core.method({
  32462. selector: "theClass:",
  32463. protocol: "accessing",
  32464. args: ["aClass"],
  32465. source: "theClass: aClass\x0a\x09theClass := aClass",
  32466. referencedClasses: [],
  32467. pragmas: [],
  32468. messageSends: []
  32469. }, function ($methodClass){ return function (aClass){
  32470. var self=this,$self=this;
  32471. $self.theClass=aClass;
  32472. return self;
  32473. }; }),
  32474. $globals.ExportMethodProtocol);
  32475. $core.addMethod(
  32476. $core.method({
  32477. selector: "name:theClass:",
  32478. protocol: "instance creation",
  32479. args: ["aString", "aClass"],
  32480. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  32481. referencedClasses: [],
  32482. pragmas: [],
  32483. messageSends: ["name:", "new", "theClass:", "yourself"]
  32484. }, function ($methodClass){ return function (aString,aClass){
  32485. var self=this,$self=this;
  32486. return $core.withContext(function($ctx1) {
  32487. var $1;
  32488. $1=$self._new();
  32489. $recv($1)._name_(aString);
  32490. $recv($1)._theClass_(aClass);
  32491. return $recv($1)._yourself();
  32492. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass})});
  32493. }; }),
  32494. $globals.ExportMethodProtocol.a$cls);
  32495. $core.addClass("Importer", $globals.Object, ["lastSection", "lastChunk"], "Platform-ImportExport");
  32496. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  32497. $core.addMethod(
  32498. $core.method({
  32499. selector: "import:",
  32500. protocol: "fileIn",
  32501. args: ["aStream"],
  32502. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk\x0a\x09\x09\x09ifEmpty: [ lastEmpty := true ]\x0a\x09\x09\x09ifNotEmpty: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e pass ].",
  32503. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  32504. pragmas: [],
  32505. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "pass"]
  32506. }, function ($methodClass){ return function (aStream){
  32507. var self=this,$self=this;
  32508. var chunk,result,parser,lastEmpty;
  32509. return $core.withContext(function($ctx1) {
  32510. parser=$recv($globals.ChunkParser)._on_(aStream);
  32511. lastEmpty=false;
  32512. $self.lastSection="n/a, not started";
  32513. $self.lastChunk=nil;
  32514. $recv((function(){
  32515. return $core.withContext(function($ctx2) {
  32516. $recv((function(){
  32517. return $core.withContext(function($ctx3) {
  32518. chunk=$recv(parser)._nextChunk();
  32519. return $recv(chunk)._isNil();
  32520. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32521. }))._whileFalse_((function(){
  32522. return $core.withContext(function($ctx3) {
  32523. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  32524. lastEmpty=true;
  32525. return lastEmpty;
  32526. }),(function(){
  32527. return $core.withContext(function($ctx4) {
  32528. $self.lastSection=chunk;
  32529. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  32530. if($core.assert(lastEmpty)){
  32531. lastEmpty=false;
  32532. return $recv(result)._scanFrom_(parser);
  32533. }
  32534. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  32535. }));
  32536. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  32537. }));
  32538. $self.lastSection="n/a, finished";
  32539. return $self.lastSection;
  32540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32541. }))._on_do_($globals.Error,(function(e){
  32542. return $core.withContext(function($ctx2) {
  32543. $self.lastChunk=$recv(parser)._last();
  32544. return $recv(e)._pass();
  32545. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  32546. }));
  32547. return self;
  32548. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty})});
  32549. }; }),
  32550. $globals.Importer);
  32551. $core.addMethod(
  32552. $core.method({
  32553. selector: "lastChunk",
  32554. protocol: "accessing",
  32555. args: [],
  32556. source: "lastChunk\x0a\x09^ lastChunk",
  32557. referencedClasses: [],
  32558. pragmas: [],
  32559. messageSends: []
  32560. }, function ($methodClass){ return function (){
  32561. var self=this,$self=this;
  32562. return $self.lastChunk;
  32563. }; }),
  32564. $globals.Importer);
  32565. $core.addMethod(
  32566. $core.method({
  32567. selector: "lastSection",
  32568. protocol: "accessing",
  32569. args: [],
  32570. source: "lastSection\x0a\x09^ lastSection",
  32571. referencedClasses: [],
  32572. pragmas: [],
  32573. messageSends: []
  32574. }, function ($methodClass){ return function (){
  32575. var self=this,$self=this;
  32576. return $self.lastSection;
  32577. }; }),
  32578. $globals.Importer);
  32579. $core.addClass("PackageCommitError", $globals.Error, [], "Platform-ImportExport");
  32580. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  32581. $core.addClass("PackageHandler", $globals.Object, [], "Platform-ImportExport");
  32582. $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.";
  32583. $core.addMethod(
  32584. $core.method({
  32585. selector: "ajaxPutAt:data:onSuccess:onError:",
  32586. protocol: "private",
  32587. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  32588. 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",
  32589. referencedClasses: ["Platform"],
  32590. pragmas: [],
  32591. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  32592. }, function ($methodClass){ return function (aURL,aString,aBlock,anotherBlock){
  32593. var self=this,$self=this;
  32594. var xhr;
  32595. return $core.withContext(function($ctx1) {
  32596. xhr=$recv($globals.Platform)._newXhr();
  32597. $recv(xhr)._open_url_async_("PUT",aURL,true);
  32598. $recv(xhr)._onreadystatechange_((function(){
  32599. return $core.withContext(function($ctx2) {
  32600. if($core.assert($recv($recv(xhr)._readyState()).__eq((4)))){
  32601. return $recv($recv($recv([$recv(xhr)._status()
  32602. ,$ctx2.sendIdx["status"]=1
  32603. ][0]).__gt_eq((200)))._and_((function(){
  32604. return $core.withContext(function($ctx3) {
  32605. return $recv($recv(xhr)._status()).__lt((300));
  32606. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  32607. })))._ifTrue_ifFalse_(aBlock,anotherBlock);
  32608. }
  32609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32610. }));
  32611. $recv(xhr)._send_(aString);
  32612. return self;
  32613. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr})});
  32614. }; }),
  32615. $globals.PackageHandler);
  32616. $core.addMethod(
  32617. $core.method({
  32618. selector: "chunkContentsFor:",
  32619. protocol: "accessing",
  32620. args: ["aPackage"],
  32621. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  32622. referencedClasses: ["String"],
  32623. pragmas: [],
  32624. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  32625. }, function ($methodClass){ return function (aPackage){
  32626. var self=this,$self=this;
  32627. return $core.withContext(function($ctx1) {
  32628. return $recv($globals.String)._streamContents_((function(str){
  32629. return $core.withContext(function($ctx2) {
  32630. return $recv($self._chunkExporter())._exportPackage_on_(aPackage,str);
  32631. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32632. }));
  32633. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage})});
  32634. }; }),
  32635. $globals.PackageHandler);
  32636. $core.addMethod(
  32637. $core.method({
  32638. selector: "chunkExporter",
  32639. protocol: "factory",
  32640. args: [],
  32641. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  32642. referencedClasses: [],
  32643. pragmas: [],
  32644. messageSends: ["new", "chunkExporterClass"]
  32645. }, function ($methodClass){ return function (){
  32646. var self=this,$self=this;
  32647. return $core.withContext(function($ctx1) {
  32648. return $recv($self._chunkExporterClass())._new();
  32649. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{})});
  32650. }; }),
  32651. $globals.PackageHandler);
  32652. $core.addMethod(
  32653. $core.method({
  32654. selector: "chunkExporterClass",
  32655. protocol: "accessing",
  32656. args: [],
  32657. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  32658. referencedClasses: ["ChunkExporter"],
  32659. pragmas: [],
  32660. messageSends: []
  32661. }, function ($methodClass){ return function (){
  32662. var self=this,$self=this;
  32663. return $globals.ChunkExporter;
  32664. }; }),
  32665. $globals.PackageHandler);
  32666. $core.addMethod(
  32667. $core.method({
  32668. selector: "commit:",
  32669. protocol: "committing",
  32670. args: ["aPackage"],
  32671. 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 ]",
  32672. referencedClasses: ["PackageCommitError"],
  32673. pragmas: [],
  32674. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  32675. }, function ($methodClass){ return function (aPackage){
  32676. var self=this,$self=this;
  32677. return $core.withContext(function($ctx1) {
  32678. var $1;
  32679. $self._commit_onSuccess_onError_(aPackage,(function(){
  32680. }),(function(error){
  32681. return $core.withContext(function($ctx2) {
  32682. $1=$recv($globals.PackageCommitError)._new();
  32683. $recv($1)._messageText_([$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22")
  32684. ,$ctx2.sendIdx[","]=1
  32685. ][0]);
  32686. return $recv($1)._signal();
  32687. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  32688. }));
  32689. return self;
  32690. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage})});
  32691. }; }),
  32692. $globals.PackageHandler);
  32693. $core.addMethod(
  32694. $core.method({
  32695. selector: "commit:onSuccess:onError:",
  32696. protocol: "committing",
  32697. args: ["aPackage", "aBlock", "anotherBlock"],
  32698. 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",
  32699. referencedClasses: [],
  32700. pragmas: [],
  32701. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  32702. }, function ($methodClass){ return function (aPackage,aBlock,anotherBlock){
  32703. var self=this,$self=this;
  32704. return $core.withContext(function($ctx1) {
  32705. $self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  32706. return $core.withContext(function($ctx2) {
  32707. return $self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  32708. return $core.withContext(function($ctx3) {
  32709. $recv(aPackage)._beClean();
  32710. return $recv(aBlock)._value();
  32711. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32712. }),anotherBlock);
  32713. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32714. }),anotherBlock);
  32715. return self;
  32716. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock})});
  32717. }; }),
  32718. $globals.PackageHandler);
  32719. $core.addMethod(
  32720. $core.method({
  32721. selector: "commitJsFileFor:onSuccess:onError:",
  32722. protocol: "committing",
  32723. args: ["aPackage", "aBlock", "anotherBlock"],
  32724. 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",
  32725. referencedClasses: [],
  32726. pragmas: [],
  32727. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  32728. }, function ($methodClass){ return function (aPackage,aBlock,anotherBlock){
  32729. var self=this,$self=this;
  32730. return $core.withContext(function($ctx1) {
  32731. $self._ajaxPutAt_data_onSuccess_onError_([$recv([$recv($recv($self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name())
  32732. ,$ctx1.sendIdx[","]=2
  32733. ][0]).__comma(".js")
  32734. ,$ctx1.sendIdx[","]=1
  32735. ][0],$self._contentsFor_(aPackage),aBlock,anotherBlock);
  32736. return self;
  32737. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock})});
  32738. }; }),
  32739. $globals.PackageHandler);
  32740. $core.addMethod(
  32741. $core.method({
  32742. selector: "commitPathJsFor:",
  32743. protocol: "accessing",
  32744. args: ["aPackage"],
  32745. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  32746. referencedClasses: [],
  32747. pragmas: [],
  32748. messageSends: ["subclassResponsibility"]
  32749. }, function ($methodClass){ return function (aPackage){
  32750. var self=this,$self=this;
  32751. return $core.withContext(function($ctx1) {
  32752. $self._subclassResponsibility();
  32753. return self;
  32754. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage})});
  32755. }; }),
  32756. $globals.PackageHandler);
  32757. $core.addMethod(
  32758. $core.method({
  32759. selector: "commitPathStFor:",
  32760. protocol: "accessing",
  32761. args: ["aPackage"],
  32762. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  32763. referencedClasses: [],
  32764. pragmas: [],
  32765. messageSends: ["subclassResponsibility"]
  32766. }, function ($methodClass){ return function (aPackage){
  32767. var self=this,$self=this;
  32768. return $core.withContext(function($ctx1) {
  32769. $self._subclassResponsibility();
  32770. return self;
  32771. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage})});
  32772. }; }),
  32773. $globals.PackageHandler);
  32774. $core.addMethod(
  32775. $core.method({
  32776. selector: "commitStFileFor:onSuccess:onError:",
  32777. protocol: "committing",
  32778. args: ["aPackage", "aBlock", "anotherBlock"],
  32779. 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",
  32780. referencedClasses: [],
  32781. pragmas: [],
  32782. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  32783. }, function ($methodClass){ return function (aPackage,aBlock,anotherBlock){
  32784. var self=this,$self=this;
  32785. return $core.withContext(function($ctx1) {
  32786. $self._ajaxPutAt_data_onSuccess_onError_([$recv([$recv($recv($self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name())
  32787. ,$ctx1.sendIdx[","]=2
  32788. ][0]).__comma(".st")
  32789. ,$ctx1.sendIdx[","]=1
  32790. ][0],$self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  32791. return self;
  32792. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock})});
  32793. }; }),
  32794. $globals.PackageHandler);
  32795. $core.addMethod(
  32796. $core.method({
  32797. selector: "contentsFor:",
  32798. protocol: "accessing",
  32799. args: ["aPackage"],
  32800. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  32801. referencedClasses: ["String"],
  32802. pragmas: [],
  32803. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  32804. }, function ($methodClass){ return function (aPackage){
  32805. var self=this,$self=this;
  32806. return $core.withContext(function($ctx1) {
  32807. return $recv($globals.String)._streamContents_((function(str){
  32808. return $core.withContext(function($ctx2) {
  32809. return $recv($self._exporter())._exportPackage_on_(aPackage,str);
  32810. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32811. }));
  32812. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage})});
  32813. }; }),
  32814. $globals.PackageHandler);
  32815. $core.addMethod(
  32816. $core.method({
  32817. selector: "exporter",
  32818. protocol: "factory",
  32819. args: [],
  32820. source: "exporter\x0a\x09^ self exporterClass new",
  32821. referencedClasses: [],
  32822. pragmas: [],
  32823. messageSends: ["new", "exporterClass"]
  32824. }, function ($methodClass){ return function (){
  32825. var self=this,$self=this;
  32826. return $core.withContext(function($ctx1) {
  32827. return $recv($self._exporterClass())._new();
  32828. }, function($ctx1) {$ctx1.fill(self,"exporter",{})});
  32829. }; }),
  32830. $globals.PackageHandler);
  32831. $core.addMethod(
  32832. $core.method({
  32833. selector: "exporterClass",
  32834. protocol: "accessing",
  32835. args: [],
  32836. source: "exporterClass\x0a\x09self subclassResponsibility",
  32837. referencedClasses: [],
  32838. pragmas: [],
  32839. messageSends: ["subclassResponsibility"]
  32840. }, function ($methodClass){ return function (){
  32841. var self=this,$self=this;
  32842. return $core.withContext(function($ctx1) {
  32843. $self._subclassResponsibility();
  32844. return self;
  32845. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{})});
  32846. }; }),
  32847. $globals.PackageHandler);
  32848. $core.addMethod(
  32849. $core.method({
  32850. selector: "load:",
  32851. protocol: "loading",
  32852. args: ["aPackage"],
  32853. source: "load: aPackage\x0a\x09\x22Should return a TThenable\x22\x0a\x09self subclassResponsibility",
  32854. referencedClasses: [],
  32855. pragmas: [],
  32856. messageSends: ["subclassResponsibility"]
  32857. }, function ($methodClass){ return function (aPackage){
  32858. var self=this,$self=this;
  32859. return $core.withContext(function($ctx1) {
  32860. $self._subclassResponsibility();
  32861. return self;
  32862. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage})});
  32863. }; }),
  32864. $globals.PackageHandler);
  32865. $core.addMethod(
  32866. $core.method({
  32867. selector: "onCommitError:",
  32868. protocol: "error handling",
  32869. args: ["anError"],
  32870. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  32871. referencedClasses: ["PackageCommitError"],
  32872. pragmas: [],
  32873. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  32874. }, function ($methodClass){ return function (anError){
  32875. var self=this,$self=this;
  32876. return $core.withContext(function($ctx1) {
  32877. var $1;
  32878. $1=$recv($globals.PackageCommitError)._new();
  32879. $recv($1)._messageText_([$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22")
  32880. ,$ctx1.sendIdx[","]=1
  32881. ][0]);
  32882. $recv($1)._signal();
  32883. return self;
  32884. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError})});
  32885. }; }),
  32886. $globals.PackageHandler);
  32887. $core.addMethod(
  32888. $core.method({
  32889. selector: "setPath:forPackage:",
  32890. protocol: "accessing",
  32891. args: ["aString", "aPackage"],
  32892. source: "setPath: aString forPackage: aPackage\x0a\x09self subclassResponsibility",
  32893. referencedClasses: [],
  32894. pragmas: [],
  32895. messageSends: ["subclassResponsibility"]
  32896. }, function ($methodClass){ return function (aString,aPackage){
  32897. var self=this,$self=this;
  32898. return $core.withContext(function($ctx1) {
  32899. $self._subclassResponsibility();
  32900. return self;
  32901. }, function($ctx1) {$ctx1.fill(self,"setPath:forPackage:",{aString:aString,aPackage:aPackage})});
  32902. }; }),
  32903. $globals.PackageHandler);
  32904. $core.addClass("AmdPackageHandler", $globals.PackageHandler, [], "Platform-ImportExport");
  32905. $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.";
  32906. $core.addMethod(
  32907. $core.method({
  32908. selector: "commitPathJsFor:",
  32909. protocol: "accessing",
  32910. args: ["aPackage"],
  32911. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  32912. referencedClasses: [],
  32913. pragmas: [],
  32914. messageSends: ["toUrl:", "namespaceFor:"]
  32915. }, function ($methodClass){ return function (aPackage){
  32916. var self=this,$self=this;
  32917. return $core.withContext(function($ctx1) {
  32918. return $self._toUrl_($self._namespaceFor_(aPackage));
  32919. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage})});
  32920. }; }),
  32921. $globals.AmdPackageHandler);
  32922. $core.addMethod(
  32923. $core.method({
  32924. selector: "commitPathStFor:",
  32925. protocol: "accessing",
  32926. args: ["aPackage"],
  32927. 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 ]",
  32928. referencedClasses: [],
  32929. pragmas: [],
  32930. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  32931. }, function ($methodClass){ return function (aPackage){
  32932. var self=this,$self=this;
  32933. var path,pathWithout;
  32934. return $core.withContext(function($ctx1) {
  32935. path=$self._toUrl_([$recv($self._namespaceFor_(aPackage)).__comma("/_source")
  32936. ,$ctx1.sendIdx[","]=1
  32937. ][0]);
  32938. pathWithout=$self._commitPathJsFor_(aPackage);
  32939. if($core.assert($recv(path).__eq($recv(pathWithout).__comma("/_source")))){
  32940. return pathWithout;
  32941. } else {
  32942. return path;
  32943. }
  32944. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout})});
  32945. }; }),
  32946. $globals.AmdPackageHandler);
  32947. $core.addMethod(
  32948. $core.method({
  32949. selector: "exporterClass",
  32950. protocol: "accessing",
  32951. args: [],
  32952. source: "exporterClass\x0a\x09^ AmdExporter",
  32953. referencedClasses: ["AmdExporter"],
  32954. pragmas: [],
  32955. messageSends: []
  32956. }, function ($methodClass){ return function (){
  32957. var self=this,$self=this;
  32958. return $globals.AmdExporter;
  32959. }; }),
  32960. $globals.AmdPackageHandler);
  32961. $core.addMethod(
  32962. $core.method({
  32963. selector: "load:",
  32964. protocol: "loading",
  32965. args: ["aPackage"],
  32966. source: "load: aPackage\x0a\x09^ Promise new: [ :model |\x0a\x09\x09Smalltalk amdRequire\x0a\x09\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09\x09require\x0a\x09\x09\x09\x09\x09value: { (self namespaceFor: aPackage), '/', aPackage name }\x0a\x09\x09\x09\x09\x09value: [ :result | model value: result ]\x0a\x09\x09\x09\x09\x09value: [ :error | model signal: error ] ] ]",
  32967. referencedClasses: ["Promise", "Smalltalk"],
  32968. pragmas: [],
  32969. messageSends: ["new:", "ifNil:ifNotNil:", "amdRequire", "error:", "value:value:value:", ",", "namespaceFor:", "name", "value:", "signal:"]
  32970. }, function ($methodClass){ return function (aPackage){
  32971. var self=this,$self=this;
  32972. return $core.withContext(function($ctx1) {
  32973. var $1;
  32974. return $recv($globals.Promise)._new_((function(model){
  32975. return $core.withContext(function($ctx2) {
  32976. $1=$recv($globals.Smalltalk)._amdRequire();
  32977. if($1 == null || $1.a$nil){
  32978. return $self._error_("AMD loader not present");
  32979. } else {
  32980. var require;
  32981. require=$1;
  32982. return $recv(require)._value_value_value_([[$recv($recv($self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name())
  32983. ,$ctx2.sendIdx[","]=1
  32984. ][0]],(function(result){
  32985. return $core.withContext(function($ctx3) {
  32986. return $recv(model)._value_(result);
  32987. }, function($ctx3) {$ctx3.fillBlock({result:result},$ctx2,4)});
  32988. }),(function(error){
  32989. return $core.withContext(function($ctx3) {
  32990. return $recv(model)._signal_(error);
  32991. }, function($ctx3) {$ctx3.fillBlock({error:error},$ctx2,5)});
  32992. }));
  32993. }
  32994. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,1)});
  32995. }));
  32996. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage})});
  32997. }; }),
  32998. $globals.AmdPackageHandler);
  32999. $core.addMethod(
  33000. $core.method({
  33001. selector: "namespaceFor:",
  33002. protocol: "committing",
  33003. args: ["aPackage"],
  33004. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  33005. referencedClasses: [],
  33006. pragmas: [],
  33007. messageSends: ["namespace", "transport"]
  33008. }, function ($methodClass){ return function (aPackage){
  33009. var self=this,$self=this;
  33010. return $core.withContext(function($ctx1) {
  33011. return $recv($recv(aPackage)._transport())._namespace();
  33012. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage})});
  33013. }; }),
  33014. $globals.AmdPackageHandler);
  33015. $core.addMethod(
  33016. $core.method({
  33017. selector: "setPath:forPackage:",
  33018. protocol: "accessing",
  33019. args: ["aString", "aPackage"],
  33020. source: "setPath: aString forPackage: aPackage\x0a\x09\x22Set the path the the package's `namespace`\x22\x0a\x09\x0a\x09\x22Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x22\x0a\x09\x09\x09require provided config: #{\x0a\x09\x09\x09\x09'paths' -> #{\x0a\x09\x09\x09\x09\x09(self namespaceFor: aPackage) -> aString\x0a\x09\x09\x09\x09}\x0a\x09\x09\x09}\x0a\x09\x09\x22]\x22",
  33021. referencedClasses: [],
  33022. pragmas: [],
  33023. messageSends: ["config:", "provided", "namespaceFor:"]
  33024. }, function ($methodClass){ return function (aString,aPackage){
  33025. var self=this,$self=this;
  33026. return $core.withContext(function($ctx1) {
  33027. $recv($recv(require)._provided())._config_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([$self._namespaceFor_(aPackage),aString])]));
  33028. return self;
  33029. }, function($ctx1) {$ctx1.fill(self,"setPath:forPackage:",{aString:aString,aPackage:aPackage})});
  33030. }; }),
  33031. $globals.AmdPackageHandler);
  33032. $core.addMethod(
  33033. $core.method({
  33034. selector: "toUrl:",
  33035. protocol: "private",
  33036. args: ["aString"],
  33037. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | require provided toUrl: aString ]",
  33038. referencedClasses: ["Smalltalk"],
  33039. pragmas: [],
  33040. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "toUrl:", "provided"]
  33041. }, function ($methodClass){ return function (aString){
  33042. var self=this,$self=this;
  33043. return $core.withContext(function($ctx1) {
  33044. var $1;
  33045. $1=$recv($globals.Smalltalk)._amdRequire();
  33046. if($1 == null || $1.a$nil){
  33047. return $self._error_("AMD loader not present");
  33048. } else {
  33049. var require;
  33050. require=$1;
  33051. return $recv($recv(require)._provided())._toUrl_(aString);
  33052. }
  33053. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString})});
  33054. }; }),
  33055. $globals.AmdPackageHandler);
  33056. $core.addMethod(
  33057. $core.method({
  33058. selector: "defaultNamespace",
  33059. protocol: "commit paths",
  33060. args: [],
  33061. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  33062. referencedClasses: ["Smalltalk"],
  33063. pragmas: [],
  33064. messageSends: ["defaultAmdNamespace"]
  33065. }, function ($methodClass){ return function (){
  33066. var self=this,$self=this;
  33067. return $core.withContext(function($ctx1) {
  33068. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  33069. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{})});
  33070. }; }),
  33071. $globals.AmdPackageHandler.a$cls);
  33072. $core.addMethod(
  33073. $core.method({
  33074. selector: "defaultNamespace:",
  33075. protocol: "commit paths",
  33076. args: ["aString"],
  33077. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  33078. referencedClasses: ["Smalltalk"],
  33079. pragmas: [],
  33080. messageSends: ["defaultAmdNamespace:"]
  33081. }, function ($methodClass){ return function (aString){
  33082. var self=this,$self=this;
  33083. return $core.withContext(function($ctx1) {
  33084. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  33085. return self;
  33086. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString})});
  33087. }; }),
  33088. $globals.AmdPackageHandler.a$cls);
  33089. $core.addClass("PackageTransport", $globals.Object, ["package"], "Platform-ImportExport");
  33090. $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.";
  33091. $core.addMethod(
  33092. $core.method({
  33093. selector: "asJavaScriptObject",
  33094. protocol: "converting",
  33095. args: [],
  33096. source: "asJavaScriptObject\x0a\x09^ #{ 'type' -> self type }",
  33097. referencedClasses: [],
  33098. pragmas: [],
  33099. messageSends: ["type"]
  33100. }, function ($methodClass){ return function (){
  33101. var self=this,$self=this;
  33102. return $core.withContext(function($ctx1) {
  33103. return $globals.HashedCollection._newFromPairs_(["type",$self._type()]);
  33104. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  33105. }; }),
  33106. $globals.PackageTransport);
  33107. $core.addMethod(
  33108. $core.method({
  33109. selector: "commit",
  33110. protocol: "committing",
  33111. args: [],
  33112. source: "commit\x0a\x09self commitHandler commit: self package",
  33113. referencedClasses: [],
  33114. pragmas: [],
  33115. messageSends: ["commit:", "commitHandler", "package"]
  33116. }, function ($methodClass){ return function (){
  33117. var self=this,$self=this;
  33118. return $core.withContext(function($ctx1) {
  33119. $recv($self._commitHandler())._commit_($self._package());
  33120. return self;
  33121. }, function($ctx1) {$ctx1.fill(self,"commit",{})});
  33122. }; }),
  33123. $globals.PackageTransport);
  33124. $core.addMethod(
  33125. $core.method({
  33126. selector: "commitHandler",
  33127. protocol: "factory",
  33128. args: [],
  33129. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  33130. referencedClasses: [],
  33131. pragmas: [],
  33132. messageSends: ["new", "commitHandlerClass"]
  33133. }, function ($methodClass){ return function (){
  33134. var self=this,$self=this;
  33135. return $core.withContext(function($ctx1) {
  33136. return $recv($self._commitHandlerClass())._new();
  33137. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{})});
  33138. }; }),
  33139. $globals.PackageTransport);
  33140. $core.addMethod(
  33141. $core.method({
  33142. selector: "commitHandlerClass",
  33143. protocol: "accessing",
  33144. args: [],
  33145. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  33146. referencedClasses: [],
  33147. pragmas: [],
  33148. messageSends: ["subclassResponsibility"]
  33149. }, function ($methodClass){ return function (){
  33150. var self=this,$self=this;
  33151. return $core.withContext(function($ctx1) {
  33152. $self._subclassResponsibility();
  33153. return self;
  33154. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{})});
  33155. }; }),
  33156. $globals.PackageTransport);
  33157. $core.addMethod(
  33158. $core.method({
  33159. selector: "commitOnSuccess:onError:",
  33160. protocol: "committing",
  33161. args: ["aBlock", "anotherBlock"],
  33162. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  33163. referencedClasses: [],
  33164. pragmas: [],
  33165. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  33166. }, function ($methodClass){ return function (aBlock,anotherBlock){
  33167. var self=this,$self=this;
  33168. return $core.withContext(function($ctx1) {
  33169. $recv($self._commitHandler())._commit_onSuccess_onError_($self._package(),aBlock,anotherBlock);
  33170. return self;
  33171. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  33172. }; }),
  33173. $globals.PackageTransport);
  33174. $core.addMethod(
  33175. $core.method({
  33176. selector: "definition",
  33177. protocol: "accessing",
  33178. args: [],
  33179. source: "definition\x0a\x09^ ''",
  33180. referencedClasses: [],
  33181. pragmas: [],
  33182. messageSends: []
  33183. }, function ($methodClass){ return function (){
  33184. var self=this,$self=this;
  33185. return "";
  33186. }; }),
  33187. $globals.PackageTransport);
  33188. $core.addMethod(
  33189. $core.method({
  33190. selector: "load",
  33191. protocol: "loading",
  33192. args: [],
  33193. source: "load\x0a\x09^ (self commitHandler load: self package)\x0a\x09\x09then: [ Smalltalk postLoad ]",
  33194. referencedClasses: ["Smalltalk"],
  33195. pragmas: [],
  33196. messageSends: ["then:", "load:", "commitHandler", "package", "postLoad"]
  33197. }, function ($methodClass){ return function (){
  33198. var self=this,$self=this;
  33199. return $core.withContext(function($ctx1) {
  33200. return $recv($recv($self._commitHandler())._load_($self._package()))._then_((function(){
  33201. return $core.withContext(function($ctx2) {
  33202. return $recv($globals.Smalltalk)._postLoad();
  33203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33204. }));
  33205. }, function($ctx1) {$ctx1.fill(self,"load",{})});
  33206. }; }),
  33207. $globals.PackageTransport);
  33208. $core.addMethod(
  33209. $core.method({
  33210. selector: "package",
  33211. protocol: "accessing",
  33212. args: [],
  33213. source: "package\x0a\x09^ package",
  33214. referencedClasses: [],
  33215. pragmas: [],
  33216. messageSends: []
  33217. }, function ($methodClass){ return function (){
  33218. var self=this,$self=this;
  33219. return $self.package;
  33220. }; }),
  33221. $globals.PackageTransport);
  33222. $core.addMethod(
  33223. $core.method({
  33224. selector: "package:",
  33225. protocol: "accessing",
  33226. args: ["aPackage"],
  33227. source: "package: aPackage\x0a\x09package := aPackage",
  33228. referencedClasses: [],
  33229. pragmas: [],
  33230. messageSends: []
  33231. }, function ($methodClass){ return function (aPackage){
  33232. var self=this,$self=this;
  33233. $self.package=aPackage;
  33234. return self;
  33235. }; }),
  33236. $globals.PackageTransport);
  33237. $core.addMethod(
  33238. $core.method({
  33239. selector: "setPath:",
  33240. protocol: "actions",
  33241. args: ["aString"],
  33242. source: "setPath: aString\x0a\x09\x22Set the commit path for the package\x22\x0a\x0a\x09self commitHandler setPath: aString forPackage: package",
  33243. referencedClasses: [],
  33244. pragmas: [],
  33245. messageSends: ["setPath:forPackage:", "commitHandler"]
  33246. }, function ($methodClass){ return function (aString){
  33247. var self=this,$self=this;
  33248. return $core.withContext(function($ctx1) {
  33249. $recv($self._commitHandler())._setPath_forPackage_(aString,$self.package);
  33250. return self;
  33251. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString})});
  33252. }; }),
  33253. $globals.PackageTransport);
  33254. $core.addMethod(
  33255. $core.method({
  33256. selector: "setupFromJson:",
  33257. protocol: "initialization",
  33258. args: ["anObject"],
  33259. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  33260. referencedClasses: [],
  33261. pragmas: [],
  33262. messageSends: []
  33263. }, function ($methodClass){ return function (anObject){
  33264. var self=this,$self=this;
  33265. return self;
  33266. }; }),
  33267. $globals.PackageTransport);
  33268. $core.addMethod(
  33269. $core.method({
  33270. selector: "type",
  33271. protocol: "accessing",
  33272. args: [],
  33273. source: "type\x0a\x09^ self class type",
  33274. referencedClasses: [],
  33275. pragmas: [],
  33276. messageSends: ["type", "class"]
  33277. }, function ($methodClass){ return function (){
  33278. var self=this,$self=this;
  33279. return $core.withContext(function($ctx1) {
  33280. return $recv($self._class())._type();
  33281. }, function($ctx1) {$ctx1.fill(self,"type",{})});
  33282. }; }),
  33283. $globals.PackageTransport);
  33284. $core.setSlots($globals.PackageTransport.a$cls, ["registry"]);
  33285. $core.addMethod(
  33286. $core.method({
  33287. selector: "classRegisteredFor:",
  33288. protocol: "accessing",
  33289. args: ["aString"],
  33290. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  33291. referencedClasses: [],
  33292. pragmas: [],
  33293. messageSends: ["at:"]
  33294. }, function ($methodClass){ return function (aString){
  33295. var self=this,$self=this;
  33296. return $core.withContext(function($ctx1) {
  33297. return $recv($self.registry)._at_(aString);
  33298. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString})});
  33299. }; }),
  33300. $globals.PackageTransport.a$cls);
  33301. $core.addMethod(
  33302. $core.method({
  33303. selector: "defaultType",
  33304. protocol: "accessing",
  33305. args: [],
  33306. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  33307. referencedClasses: ["AmdPackageTransport"],
  33308. pragmas: [],
  33309. messageSends: ["type"]
  33310. }, function ($methodClass){ return function (){
  33311. var self=this,$self=this;
  33312. return $core.withContext(function($ctx1) {
  33313. return $recv($globals.AmdPackageTransport)._type();
  33314. }, function($ctx1) {$ctx1.fill(self,"defaultType",{})});
  33315. }; }),
  33316. $globals.PackageTransport.a$cls);
  33317. $core.addMethod(
  33318. $core.method({
  33319. selector: "for:",
  33320. protocol: "instance creation",
  33321. args: ["aString"],
  33322. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  33323. referencedClasses: [],
  33324. pragmas: [],
  33325. messageSends: ["new", "classRegisteredFor:"]
  33326. }, function ($methodClass){ return function (aString){
  33327. var self=this,$self=this;
  33328. return $core.withContext(function($ctx1) {
  33329. return $recv($self._classRegisteredFor_(aString))._new();
  33330. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString})});
  33331. }; }),
  33332. $globals.PackageTransport.a$cls);
  33333. $core.addMethod(
  33334. $core.method({
  33335. selector: "fromJson:",
  33336. protocol: "instance creation",
  33337. args: ["anObject"],
  33338. 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",
  33339. referencedClasses: [],
  33340. pragmas: [],
  33341. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  33342. }, function ($methodClass){ return function (anObject){
  33343. var self=this,$self=this;
  33344. return $core.withContext(function($ctx1) {
  33345. var $1;
  33346. if(anObject == null || anObject.a$nil){
  33347. return [$self._for_($self._defaultType())
  33348. ,$ctx1.sendIdx["for:"]=1
  33349. ][0];
  33350. } else {
  33351. anObject;
  33352. }
  33353. $1=$self._for_($recv(anObject)._type());
  33354. $recv($1)._setupFromJson_(anObject);
  33355. return $recv($1)._yourself();
  33356. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject})});
  33357. }; }),
  33358. $globals.PackageTransport.a$cls);
  33359. $core.addMethod(
  33360. $core.method({
  33361. selector: "initialize",
  33362. protocol: "initialization",
  33363. args: [],
  33364. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  33365. referencedClasses: ["PackageTransport"],
  33366. pragmas: [],
  33367. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  33368. }, function ($methodClass){ return function (){
  33369. var self=this,$self=this;
  33370. return $core.withContext(function($ctx1) {
  33371. [(
  33372. $ctx1.supercall = true,
  33373. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  33374. ,$ctx1.supercall = false
  33375. ][0];
  33376. if($core.assert($self.__eq_eq($globals.PackageTransport))){
  33377. $self.registry=$globals.HashedCollection._newFromPairs_([]);
  33378. $self.registry;
  33379. } else {
  33380. $self._register();
  33381. }
  33382. return self;
  33383. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  33384. }; }),
  33385. $globals.PackageTransport.a$cls);
  33386. $core.addMethod(
  33387. $core.method({
  33388. selector: "register",
  33389. protocol: "registration",
  33390. args: [],
  33391. source: "register\x0a\x09PackageTransport register: self",
  33392. referencedClasses: ["PackageTransport"],
  33393. pragmas: [],
  33394. messageSends: ["register:"]
  33395. }, function ($methodClass){ return function (){
  33396. var self=this,$self=this;
  33397. return $core.withContext(function($ctx1) {
  33398. $recv($globals.PackageTransport)._register_(self);
  33399. return self;
  33400. }, function($ctx1) {$ctx1.fill(self,"register",{})});
  33401. }; }),
  33402. $globals.PackageTransport.a$cls);
  33403. $core.addMethod(
  33404. $core.method({
  33405. selector: "register:",
  33406. protocol: "registration",
  33407. args: ["aClass"],
  33408. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  33409. referencedClasses: [],
  33410. pragmas: [],
  33411. messageSends: ["ifNotNil:", "type", "at:put:"]
  33412. }, function ($methodClass){ return function (aClass){
  33413. var self=this,$self=this;
  33414. return $core.withContext(function($ctx1) {
  33415. var $1;
  33416. $1=[$recv(aClass)._type()
  33417. ,$ctx1.sendIdx["type"]=1
  33418. ][0];
  33419. if($1 == null || $1.a$nil){
  33420. $1;
  33421. } else {
  33422. $recv($self.registry)._at_put_($recv(aClass)._type(),aClass);
  33423. }
  33424. return self;
  33425. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass})});
  33426. }; }),
  33427. $globals.PackageTransport.a$cls);
  33428. $core.addMethod(
  33429. $core.method({
  33430. selector: "type",
  33431. protocol: "accessing",
  33432. args: [],
  33433. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  33434. referencedClasses: [],
  33435. pragmas: [],
  33436. messageSends: []
  33437. }, function ($methodClass){ return function (){
  33438. var self=this,$self=this;
  33439. return nil;
  33440. }; }),
  33441. $globals.PackageTransport.a$cls);
  33442. $core.addClass("AmdPackageTransport", $globals.PackageTransport, ["namespace"], "Platform-ImportExport");
  33443. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  33444. $core.addMethod(
  33445. $core.method({
  33446. selector: "asJavaScriptObject",
  33447. protocol: "converting",
  33448. args: [],
  33449. source: "asJavaScriptObject\x0a\x09^ super asJavaScriptObject\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  33450. referencedClasses: [],
  33451. pragmas: [],
  33452. messageSends: ["at:put:", "asJavaScriptObject", "namespace", "yourself"]
  33453. }, function ($methodClass){ return function (){
  33454. var self=this,$self=this;
  33455. return $core.withContext(function($ctx1) {
  33456. var $1;
  33457. $1=[(
  33458. $ctx1.supercall = true,
  33459. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._asJavaScriptObject.call($self))
  33460. ,$ctx1.supercall = false
  33461. ][0];
  33462. $recv($1)._at_put_("amdNamespace",$self._namespace());
  33463. return $recv($1)._yourself();
  33464. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  33465. }; }),
  33466. $globals.AmdPackageTransport);
  33467. $core.addMethod(
  33468. $core.method({
  33469. selector: "commitHandlerClass",
  33470. protocol: "accessing",
  33471. args: [],
  33472. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  33473. referencedClasses: ["AmdPackageHandler"],
  33474. pragmas: [],
  33475. messageSends: []
  33476. }, function ($methodClass){ return function (){
  33477. var self=this,$self=this;
  33478. return $globals.AmdPackageHandler;
  33479. }; }),
  33480. $globals.AmdPackageTransport);
  33481. $core.addMethod(
  33482. $core.method({
  33483. selector: "defaultNamespace",
  33484. protocol: "defaults",
  33485. args: [],
  33486. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  33487. referencedClasses: ["Smalltalk"],
  33488. pragmas: [],
  33489. messageSends: ["defaultAmdNamespace"]
  33490. }, function ($methodClass){ return function (){
  33491. var self=this,$self=this;
  33492. return $core.withContext(function($ctx1) {
  33493. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  33494. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{})});
  33495. }; }),
  33496. $globals.AmdPackageTransport);
  33497. $core.addMethod(
  33498. $core.method({
  33499. selector: "definition",
  33500. protocol: "accessing",
  33501. args: [],
  33502. source: "definition\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: { self class name. ' namespace: ' }; print: self namespace ]",
  33503. referencedClasses: ["String"],
  33504. pragmas: [],
  33505. messageSends: ["streamContents:", "write:", "name", "class", "print:", "namespace"]
  33506. }, function ($methodClass){ return function (){
  33507. var self=this,$self=this;
  33508. return $core.withContext(function($ctx1) {
  33509. return $recv($globals.String)._streamContents_((function(stream){
  33510. return $core.withContext(function($ctx2) {
  33511. $recv(stream)._write_([$recv($self._class())._name()," namespace: "]);
  33512. return $recv(stream)._print_($self._namespace());
  33513. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  33514. }));
  33515. }, function($ctx1) {$ctx1.fill(self,"definition",{})});
  33516. }; }),
  33517. $globals.AmdPackageTransport);
  33518. $core.addMethod(
  33519. $core.method({
  33520. selector: "namespace",
  33521. protocol: "accessing",
  33522. args: [],
  33523. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  33524. referencedClasses: [],
  33525. pragmas: [],
  33526. messageSends: ["ifNil:", "defaultNamespace"]
  33527. }, function ($methodClass){ return function (){
  33528. var self=this,$self=this;
  33529. return $core.withContext(function($ctx1) {
  33530. var $1;
  33531. $1=$self.namespace;
  33532. if($1 == null || $1.a$nil){
  33533. return $self._defaultNamespace();
  33534. } else {
  33535. return $1;
  33536. }
  33537. }, function($ctx1) {$ctx1.fill(self,"namespace",{})});
  33538. }; }),
  33539. $globals.AmdPackageTransport);
  33540. $core.addMethod(
  33541. $core.method({
  33542. selector: "namespace:",
  33543. protocol: "accessing",
  33544. args: ["aString"],
  33545. source: "namespace: aString\x0a\x09namespace := aString",
  33546. referencedClasses: [],
  33547. pragmas: [],
  33548. messageSends: []
  33549. }, function ($methodClass){ return function (aString){
  33550. var self=this,$self=this;
  33551. $self.namespace=aString;
  33552. return self;
  33553. }; }),
  33554. $globals.AmdPackageTransport);
  33555. $core.addMethod(
  33556. $core.method({
  33557. selector: "printOn:",
  33558. protocol: "printing",
  33559. args: ["aStream"],
  33560. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  33561. referencedClasses: [],
  33562. pragmas: [],
  33563. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  33564. }, function ($methodClass){ return function (aStream){
  33565. var self=this,$self=this;
  33566. return $core.withContext(function($ctx1) {
  33567. [(
  33568. $ctx1.supercall = true,
  33569. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  33570. ,$ctx1.supercall = false
  33571. ][0];
  33572. [$recv(aStream)._nextPutAll_(" (AMD Namespace: ")
  33573. ,$ctx1.sendIdx["nextPutAll:"]=1
  33574. ][0];
  33575. [$recv(aStream)._nextPutAll_($self._namespace())
  33576. ,$ctx1.sendIdx["nextPutAll:"]=2
  33577. ][0];
  33578. $recv(aStream)._nextPutAll_(")");
  33579. return self;
  33580. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  33581. }; }),
  33582. $globals.AmdPackageTransport);
  33583. $core.addMethod(
  33584. $core.method({
  33585. selector: "setupFromJson:",
  33586. protocol: "initialization",
  33587. args: ["anObject"],
  33588. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  33589. referencedClasses: [],
  33590. pragmas: [],
  33591. messageSends: ["namespace:", "at:"]
  33592. }, function ($methodClass){ return function (anObject){
  33593. var self=this,$self=this;
  33594. return $core.withContext(function($ctx1) {
  33595. $self._namespace_($recv(anObject)._at_("amdNamespace"));
  33596. return self;
  33597. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject})});
  33598. }; }),
  33599. $globals.AmdPackageTransport);
  33600. $core.addMethod(
  33601. $core.method({
  33602. selector: "namespace:",
  33603. protocol: "instance creation",
  33604. args: ["aString"],
  33605. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  33606. referencedClasses: [],
  33607. pragmas: [],
  33608. messageSends: ["namespace:", "new", "yourself"]
  33609. }, function ($methodClass){ return function (aString){
  33610. var self=this,$self=this;
  33611. return $core.withContext(function($ctx1) {
  33612. var $1;
  33613. $1=$self._new();
  33614. $recv($1)._namespace_(aString);
  33615. return $recv($1)._yourself();
  33616. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString})});
  33617. }; }),
  33618. $globals.AmdPackageTransport.a$cls);
  33619. $core.addMethod(
  33620. $core.method({
  33621. selector: "type",
  33622. protocol: "accessing",
  33623. args: [],
  33624. source: "type\x0a\x09^ 'amd'",
  33625. referencedClasses: [],
  33626. pragmas: [],
  33627. messageSends: []
  33628. }, function ($methodClass){ return function (){
  33629. var self=this,$self=this;
  33630. return "amd";
  33631. }; }),
  33632. $globals.AmdPackageTransport.a$cls);
  33633. $core.addMethod(
  33634. $core.method({
  33635. selector: "exportBehaviorDefinitionTo:using:",
  33636. protocol: "*Platform-ImportExport",
  33637. args: ["aStream", "anExporter"],
  33638. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportDefinitionOf: self on: aStream",
  33639. referencedClasses: [],
  33640. pragmas: [],
  33641. messageSends: ["exportDefinitionOf:on:"]
  33642. }, function ($methodClass){ return function (aStream,anExporter){
  33643. var self=this,$self=this;
  33644. return $core.withContext(function($ctx1) {
  33645. $recv(anExporter)._exportDefinitionOf_on_(self,aStream);
  33646. return self;
  33647. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter})});
  33648. }; }),
  33649. $globals.Class);
  33650. $core.addMethod(
  33651. $core.method({
  33652. selector: "exportBehaviorDefinitionTo:using:",
  33653. protocol: "*Platform-ImportExport",
  33654. args: ["aStream", "anExporter"],
  33655. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportMetaDefinitionOf: self instanceClass on: aStream",
  33656. referencedClasses: [],
  33657. pragmas: [],
  33658. messageSends: ["exportMetaDefinitionOf:on:", "instanceClass"]
  33659. }, function ($methodClass){ return function (aStream,anExporter){
  33660. var self=this,$self=this;
  33661. return $core.withContext(function($ctx1) {
  33662. $recv(anExporter)._exportMetaDefinitionOf_on_($self._instanceClass(),aStream);
  33663. return self;
  33664. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter})});
  33665. }; }),
  33666. $globals.Metaclass);
  33667. $core.addMethod(
  33668. $core.method({
  33669. selector: "commit",
  33670. protocol: "*Platform-ImportExport",
  33671. args: [],
  33672. source: "commit\x0a\x09^ self transport commit",
  33673. referencedClasses: [],
  33674. pragmas: [],
  33675. messageSends: ["commit", "transport"]
  33676. }, function ($methodClass){ return function (){
  33677. var self=this,$self=this;
  33678. return $core.withContext(function($ctx1) {
  33679. return $recv($self._transport())._commit();
  33680. }, function($ctx1) {$ctx1.fill(self,"commit",{})});
  33681. }; }),
  33682. $globals.Package);
  33683. $core.addMethod(
  33684. $core.method({
  33685. selector: "load",
  33686. protocol: "*Platform-ImportExport",
  33687. args: [],
  33688. source: "load\x0a\x09^ self transport load",
  33689. referencedClasses: [],
  33690. pragmas: [],
  33691. messageSends: ["load", "transport"]
  33692. }, function ($methodClass){ return function (){
  33693. var self=this,$self=this;
  33694. return $core.withContext(function($ctx1) {
  33695. return $recv($self._transport())._load();
  33696. }, function($ctx1) {$ctx1.fill(self,"load",{})});
  33697. }; }),
  33698. $globals.Package);
  33699. $core.addMethod(
  33700. $core.method({
  33701. selector: "loadFromNamespace:",
  33702. protocol: "*Platform-ImportExport",
  33703. args: ["aString"],
  33704. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  33705. referencedClasses: [],
  33706. pragmas: [],
  33707. messageSends: ["namespace:", "transport", "load"]
  33708. }, function ($methodClass){ return function (aString){
  33709. var self=this,$self=this;
  33710. return $core.withContext(function($ctx1) {
  33711. var $1;
  33712. $1=$self._transport();
  33713. $recv($1)._namespace_(aString);
  33714. return $recv($1)._load();
  33715. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString})});
  33716. }; }),
  33717. $globals.Package);
  33718. $core.addMethod(
  33719. $core.method({
  33720. selector: "load:",
  33721. protocol: "*Platform-ImportExport",
  33722. args: ["aPackageName"],
  33723. source: "load: aPackageName\x0a\x09^ (self named: aPackageName) load",
  33724. referencedClasses: [],
  33725. pragmas: [],
  33726. messageSends: ["load", "named:"]
  33727. }, function ($methodClass){ return function (aPackageName){
  33728. var self=this,$self=this;
  33729. return $core.withContext(function($ctx1) {
  33730. return $recv($self._named_(aPackageName))._load();
  33731. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName})});
  33732. }; }),
  33733. $globals.Package.a$cls);
  33734. $core.addMethod(
  33735. $core.method({
  33736. selector: "load:fromNamespace:",
  33737. protocol: "*Platform-ImportExport",
  33738. args: ["aPackageName", "aString"],
  33739. source: "load: aPackageName fromNamespace: aString\x0a\x09^ (self named: aPackageName) loadFromNamespace: aString",
  33740. referencedClasses: [],
  33741. pragmas: [],
  33742. messageSends: ["loadFromNamespace:", "named:"]
  33743. }, function ($methodClass){ return function (aPackageName,aString){
  33744. var self=this,$self=this;
  33745. return $core.withContext(function($ctx1) {
  33746. return $recv($self._named_(aPackageName))._loadFromNamespace_(aString);
  33747. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString})});
  33748. }; }),
  33749. $globals.Package.a$cls);
  33750. $core.addMethod(
  33751. $core.method({
  33752. selector: "methodsFor:",
  33753. protocol: "*Platform-ImportExport",
  33754. args: ["aString"],
  33755. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  33756. referencedClasses: ["ClassProtocolReader"],
  33757. pragmas: [],
  33758. messageSends: ["class:category:", "new", "yourself"]
  33759. }, function ($methodClass){ return function (aString){
  33760. var self=this,$self=this;
  33761. return $core.withContext(function($ctx1) {
  33762. var $1;
  33763. $1=$recv($globals.ClassProtocolReader)._new();
  33764. $recv($1)._class_category_(self,aString);
  33765. return $recv($1)._yourself();
  33766. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString})});
  33767. }; }),
  33768. $globals.TBehaviorProvider);
  33769. $core.addMethod(
  33770. $core.method({
  33771. selector: "methodsFor:stamp:",
  33772. protocol: "*Platform-ImportExport",
  33773. args: ["aString", "aStamp"],
  33774. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  33775. referencedClasses: [],
  33776. pragmas: [],
  33777. messageSends: ["methodsFor:"]
  33778. }, function ($methodClass){ return function (aString,aStamp){
  33779. var self=this,$self=this;
  33780. return $core.withContext(function($ctx1) {
  33781. return $self._methodsFor_(aString);
  33782. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp})});
  33783. }; }),
  33784. $globals.TBehaviorProvider);
  33785. $core.addMethod(
  33786. $core.method({
  33787. selector: "commentStamp",
  33788. protocol: "*Platform-ImportExport",
  33789. args: [],
  33790. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  33791. referencedClasses: ["ClassCommentReader"],
  33792. pragmas: [],
  33793. messageSends: ["class:", "new", "yourself"]
  33794. }, function ($methodClass){ return function (){
  33795. var self=this,$self=this;
  33796. return $core.withContext(function($ctx1) {
  33797. var $1;
  33798. $1=$recv($globals.ClassCommentReader)._new();
  33799. $recv($1)._class_(self);
  33800. return $recv($1)._yourself();
  33801. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{})});
  33802. }; }),
  33803. $globals.TMasterBehavior);
  33804. $core.addMethod(
  33805. $core.method({
  33806. selector: "commentStamp:prior:",
  33807. protocol: "*Platform-ImportExport",
  33808. args: ["aStamp", "prior"],
  33809. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  33810. referencedClasses: [],
  33811. pragmas: [],
  33812. messageSends: ["commentStamp"]
  33813. }, function ($methodClass){ return function (aStamp,prior){
  33814. var self=this,$self=this;
  33815. return $core.withContext(function($ctx1) {
  33816. return $self._commentStamp();
  33817. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior})});
  33818. }; }),
  33819. $globals.TMasterBehavior);
  33820. $core.addMethod(
  33821. $core.method({
  33822. selector: "exportBehaviorDefinitionTo:using:",
  33823. protocol: "*Platform-ImportExport",
  33824. args: ["aStream", "anExporter"],
  33825. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportTraitDefinitionOf: self on: aStream",
  33826. referencedClasses: [],
  33827. pragmas: [],
  33828. messageSends: ["exportTraitDefinitionOf:on:"]
  33829. }, function ($methodClass){ return function (aStream,anExporter){
  33830. var self=this,$self=this;
  33831. return $core.withContext(function($ctx1) {
  33832. $recv(anExporter)._exportTraitDefinitionOf_on_(self,aStream);
  33833. return self;
  33834. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter})});
  33835. }; }),
  33836. $globals.Trait);
  33837. });
  33838. define('amber/core/Compiler-Core',["amber/boot", "require", "amber/core/Kernel-Collections", "amber/core/Kernel-Exceptions", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  33839. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  33840. var $pkg = $core.addPackage("Compiler-Core");
  33841. $pkg.innerEval = function (expr) { return eval(expr); };
  33842. $pkg.imports = ["smalltalkParser=amber/parser"];
  33843. var smalltalkParser;
  33844. $pkg.isReady = new Promise(function (resolve, reject) { requirejs(["amber/parser"], function ($1) {smalltalkParser=$1; resolve();}, reject); });
  33845. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  33846. $core.addClass("AbstractCodeGenerator", $globals.Object, ["currentClass", "currentPackage", "source"], "Compiler-Core");
  33847. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  33848. $core.addMethod(
  33849. $core.method({
  33850. selector: "compileNode:",
  33851. protocol: "compiling",
  33852. args: ["aNode"],
  33853. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  33854. referencedClasses: [],
  33855. pragmas: [],
  33856. messageSends: ["inject:into:", "transformers", "value:"]
  33857. }, function ($methodClass){ return function (aNode){
  33858. var self=this,$self=this;
  33859. return $core.withContext(function($ctx1) {
  33860. return $recv($self._transformers())._inject_into_(aNode,(function(input,transformer){
  33861. return $core.withContext(function($ctx2) {
  33862. return $recv(transformer)._value_(input);
  33863. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  33864. }));
  33865. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode})});
  33866. }; }),
  33867. $globals.AbstractCodeGenerator);
  33868. $core.addMethod(
  33869. $core.method({
  33870. selector: "currentClass",
  33871. protocol: "accessing",
  33872. args: [],
  33873. source: "currentClass\x0a\x09^ currentClass",
  33874. referencedClasses: [],
  33875. pragmas: [],
  33876. messageSends: []
  33877. }, function ($methodClass){ return function (){
  33878. var self=this,$self=this;
  33879. return $self.currentClass;
  33880. }; }),
  33881. $globals.AbstractCodeGenerator);
  33882. $core.addMethod(
  33883. $core.method({
  33884. selector: "currentClass:",
  33885. protocol: "accessing",
  33886. args: ["aClass"],
  33887. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  33888. referencedClasses: [],
  33889. pragmas: [],
  33890. messageSends: []
  33891. }, function ($methodClass){ return function (aClass){
  33892. var self=this,$self=this;
  33893. $self.currentClass=aClass;
  33894. return self;
  33895. }; }),
  33896. $globals.AbstractCodeGenerator);
  33897. $core.addMethod(
  33898. $core.method({
  33899. selector: "currentPackage",
  33900. protocol: "accessing",
  33901. args: [],
  33902. source: "currentPackage\x0a\x09^ currentPackage",
  33903. referencedClasses: [],
  33904. pragmas: [],
  33905. messageSends: []
  33906. }, function ($methodClass){ return function (){
  33907. var self=this,$self=this;
  33908. return $self.currentPackage;
  33909. }; }),
  33910. $globals.AbstractCodeGenerator);
  33911. $core.addMethod(
  33912. $core.method({
  33913. selector: "currentPackage:",
  33914. protocol: "accessing",
  33915. args: ["anObject"],
  33916. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  33917. referencedClasses: [],
  33918. pragmas: [],
  33919. messageSends: []
  33920. }, function ($methodClass){ return function (anObject){
  33921. var self=this,$self=this;
  33922. $self.currentPackage=anObject;
  33923. return self;
  33924. }; }),
  33925. $globals.AbstractCodeGenerator);
  33926. $core.addMethod(
  33927. $core.method({
  33928. selector: "pseudoVariables",
  33929. protocol: "accessing",
  33930. args: [],
  33931. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  33932. referencedClasses: ["Smalltalk"],
  33933. pragmas: [],
  33934. messageSends: ["pseudoVariableNames"]
  33935. }, function ($methodClass){ return function (){
  33936. var self=this,$self=this;
  33937. return $core.withContext(function($ctx1) {
  33938. return $recv($globals.Smalltalk)._pseudoVariableNames();
  33939. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{})});
  33940. }; }),
  33941. $globals.AbstractCodeGenerator);
  33942. $core.addMethod(
  33943. $core.method({
  33944. selector: "source",
  33945. protocol: "accessing",
  33946. args: [],
  33947. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33948. referencedClasses: [],
  33949. pragmas: [],
  33950. messageSends: ["ifNil:"]
  33951. }, function ($methodClass){ return function (){
  33952. var self=this,$self=this;
  33953. return $core.withContext(function($ctx1) {
  33954. var $1;
  33955. $1=$self.source;
  33956. if($1 == null || $1.a$nil){
  33957. return "";
  33958. } else {
  33959. return $1;
  33960. }
  33961. }, function($ctx1) {$ctx1.fill(self,"source",{})});
  33962. }; }),
  33963. $globals.AbstractCodeGenerator);
  33964. $core.addMethod(
  33965. $core.method({
  33966. selector: "source:",
  33967. protocol: "accessing",
  33968. args: ["aString"],
  33969. source: "source: aString\x0a\x09source := aString",
  33970. referencedClasses: [],
  33971. pragmas: [],
  33972. messageSends: []
  33973. }, function ($methodClass){ return function (aString){
  33974. var self=this,$self=this;
  33975. $self.source=aString;
  33976. return self;
  33977. }; }),
  33978. $globals.AbstractCodeGenerator);
  33979. $core.addMethod(
  33980. $core.method({
  33981. selector: "transformers",
  33982. protocol: "compiling",
  33983. args: [],
  33984. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  33985. referencedClasses: [],
  33986. pragmas: [],
  33987. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  33988. }, function ($methodClass){ return function (){
  33989. var self=this,$self=this;
  33990. var dict;
  33991. return $core.withContext(function($ctx1) {
  33992. dict=$self._transformersDictionary();
  33993. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  33994. return $core.withContext(function($ctx2) {
  33995. return $recv(dict)._at_(each);
  33996. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33997. }));
  33998. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict})});
  33999. }; }),
  34000. $globals.AbstractCodeGenerator);
  34001. $core.addMethod(
  34002. $core.method({
  34003. selector: "transformersDictionary",
  34004. protocol: "compiling",
  34005. args: [],
  34006. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  34007. referencedClasses: [],
  34008. pragmas: [],
  34009. messageSends: ["subclassResponsibility"]
  34010. }, function ($methodClass){ return function (){
  34011. var self=this,$self=this;
  34012. return $core.withContext(function($ctx1) {
  34013. $self._subclassResponsibility();
  34014. return self;
  34015. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{})});
  34016. }; }),
  34017. $globals.AbstractCodeGenerator);
  34018. $core.addClass("AstGenerator", $globals.AbstractCodeGenerator, ["transformersDictionary"], "Compiler-Core");
  34019. $globals.AstGenerator.comment="I am a very basic code generator.\x0aI generate semantically augmented abstract syntax tree,\x0aSome initial pragmas (eg. #inlineJS:) are applied to transform the tree.";
  34020. $core.addMethod(
  34021. $core.method({
  34022. selector: "semanticAnalyzer",
  34023. protocol: "compiling",
  34024. args: [],
  34025. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  34026. referencedClasses: ["SemanticAnalyzer"],
  34027. pragmas: [],
  34028. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  34029. }, function ($methodClass){ return function (){
  34030. var self=this,$self=this;
  34031. return $core.withContext(function($ctx1) {
  34032. var $1;
  34033. $1=$recv($globals.SemanticAnalyzer)._on_($self._currentClass());
  34034. $recv($1)._thePackage_($self._currentPackage());
  34035. return $recv($1)._yourself();
  34036. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{})});
  34037. }; }),
  34038. $globals.AstGenerator);
  34039. $core.addMethod(
  34040. $core.method({
  34041. selector: "semanticAstPragmator",
  34042. protocol: "compiling",
  34043. args: [],
  34044. source: "semanticAstPragmator\x0a\x09^ AstSemanticPragmator new",
  34045. referencedClasses: ["AstSemanticPragmator"],
  34046. pragmas: [],
  34047. messageSends: ["new"]
  34048. }, function ($methodClass){ return function (){
  34049. var self=this,$self=this;
  34050. return $core.withContext(function($ctx1) {
  34051. return $recv($globals.AstSemanticPragmator)._new();
  34052. }, function($ctx1) {$ctx1.fill(self,"semanticAstPragmator",{})});
  34053. }; }),
  34054. $globals.AstGenerator);
  34055. $core.addMethod(
  34056. $core.method({
  34057. selector: "transformersDictionary",
  34058. protocol: "compiling",
  34059. args: [],
  34060. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := Dictionary new\x0a\x09\x09at: '2000-semantic' put: self semanticAnalyzer;\x0a\x09\x09at: '2500-semanticPragmas' put: self semanticAstPragmator;\x0a\x09\x09yourself ]",
  34061. referencedClasses: ["Dictionary"],
  34062. pragmas: [],
  34063. messageSends: ["ifNil:", "at:put:", "new", "semanticAnalyzer", "semanticAstPragmator", "yourself"]
  34064. }, function ($methodClass){ return function (){
  34065. var self=this,$self=this;
  34066. return $core.withContext(function($ctx1) {
  34067. var $1,$2;
  34068. $1=$self.transformersDictionary;
  34069. if($1 == null || $1.a$nil){
  34070. $2=$recv($globals.Dictionary)._new();
  34071. [$recv($2)._at_put_("2000-semantic",$self._semanticAnalyzer())
  34072. ,$ctx1.sendIdx["at:put:"]=1
  34073. ][0];
  34074. $recv($2)._at_put_("2500-semanticPragmas",$self._semanticAstPragmator());
  34075. $self.transformersDictionary=$recv($2)._yourself();
  34076. return $self.transformersDictionary;
  34077. } else {
  34078. return $1;
  34079. }
  34080. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{})});
  34081. }; }),
  34082. $globals.AstGenerator);
  34083. $core.addClass("CodeGenerator", $globals.AstGenerator, [], "Compiler-Core");
  34084. $globals.CodeGenerator.comment="I am a basic code generator. I generate a valid JavaScript output, but do not perform any inlining.\x0aSee `InliningCodeGenerator` for an optimized JavaScript code generation.";
  34085. $core.addMethod(
  34086. $core.method({
  34087. selector: "irTranslator",
  34088. protocol: "compiling",
  34089. args: [],
  34090. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  34091. referencedClasses: [],
  34092. pragmas: [],
  34093. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  34094. }, function ($methodClass){ return function (){
  34095. var self=this,$self=this;
  34096. return $core.withContext(function($ctx1) {
  34097. var $1;
  34098. $1=$recv($self._irTranslatorClass())._new();
  34099. $recv($1)._currentClass_($self._currentClass());
  34100. return $recv($1)._yourself();
  34101. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{})});
  34102. }; }),
  34103. $globals.CodeGenerator);
  34104. $core.addMethod(
  34105. $core.method({
  34106. selector: "irTranslatorClass",
  34107. protocol: "compiling",
  34108. args: [],
  34109. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  34110. referencedClasses: ["IRJSTranslator"],
  34111. pragmas: [],
  34112. messageSends: []
  34113. }, function ($methodClass){ return function (){
  34114. var self=this,$self=this;
  34115. return $globals.IRJSTranslator;
  34116. }; }),
  34117. $globals.CodeGenerator);
  34118. $core.addMethod(
  34119. $core.method({
  34120. selector: "lateIRPragmator",
  34121. protocol: "compiling",
  34122. args: [],
  34123. source: "lateIRPragmator\x0a\x09^ IRLatePragmator new",
  34124. referencedClasses: ["IRLatePragmator"],
  34125. pragmas: [],
  34126. messageSends: ["new"]
  34127. }, function ($methodClass){ return function (){
  34128. var self=this,$self=this;
  34129. return $core.withContext(function($ctx1) {
  34130. return $recv($globals.IRLatePragmator)._new();
  34131. }, function($ctx1) {$ctx1.fill(self,"lateIRPragmator",{})});
  34132. }; }),
  34133. $globals.CodeGenerator);
  34134. $core.addMethod(
  34135. $core.method({
  34136. selector: "transformersDictionary",
  34137. protocol: "compiling",
  34138. args: [],
  34139. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := super transformersDictionary\x0a\x09\x09at: '5000-astToIr' put: self translator;\x0a\x09\x09at: '7000-irLatePragmas' put: self lateIRPragmator;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself ]",
  34140. referencedClasses: [],
  34141. pragmas: [],
  34142. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "translator", "lateIRPragmator", "irTranslator", "yourself"]
  34143. }, function ($methodClass){ return function (){
  34144. var self=this,$self=this;
  34145. return $core.withContext(function($ctx1) {
  34146. var $1,$2;
  34147. $1=$self.transformersDictionary;
  34148. if($1 == null || $1.a$nil){
  34149. $2=[(
  34150. $ctx1.supercall = true,
  34151. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.call($self))
  34152. ,$ctx1.supercall = false
  34153. ][0];
  34154. [$recv($2)._at_put_("5000-astToIr",$self._translator())
  34155. ,$ctx1.sendIdx["at:put:"]=1
  34156. ][0];
  34157. [$recv($2)._at_put_("7000-irLatePragmas",$self._lateIRPragmator())
  34158. ,$ctx1.sendIdx["at:put:"]=2
  34159. ][0];
  34160. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  34161. $self.transformersDictionary=$recv($2)._yourself();
  34162. return $self.transformersDictionary;
  34163. } else {
  34164. return $1;
  34165. }
  34166. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{})});
  34167. }; }),
  34168. $globals.CodeGenerator);
  34169. $core.addMethod(
  34170. $core.method({
  34171. selector: "translator",
  34172. protocol: "compiling",
  34173. args: [],
  34174. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  34175. referencedClasses: ["IRASTTranslator"],
  34176. pragmas: [],
  34177. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  34178. }, function ($methodClass){ return function (){
  34179. var self=this,$self=this;
  34180. return $core.withContext(function($ctx1) {
  34181. var $1;
  34182. $1=$recv($globals.IRASTTranslator)._new();
  34183. $recv($1)._source_($self._source());
  34184. $recv($1)._theClass_($self._currentClass());
  34185. return $recv($1)._yourself();
  34186. }, function($ctx1) {$ctx1.fill(self,"translator",{})});
  34187. }; }),
  34188. $globals.CodeGenerator);
  34189. $core.addClass("Compiler", $globals.Object, ["currentPackage", "codeGeneratorClass", "codeGenerator"], "Compiler-Core");
  34190. $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`";
  34191. $core.addMethod(
  34192. $core.method({
  34193. selector: "ast:forClass:protocol:",
  34194. protocol: "compiling",
  34195. args: ["aString", "aClass", "anotherString"],
  34196. source: "ast: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09codeGeneratorClass: AstGenerator;\x0a\x09\x09start: aString forClass: aClass protocol: anotherString;\x0a\x09\x09compileNode: (self parse: aString)",
  34197. referencedClasses: ["AstGenerator"],
  34198. pragmas: [],
  34199. messageSends: ["codeGeneratorClass:", "start:forClass:protocol:", "compileNode:", "parse:"]
  34200. }, function ($methodClass){ return function (aString,aClass,anotherString){
  34201. var self=this,$self=this;
  34202. return $core.withContext(function($ctx1) {
  34203. $self._codeGeneratorClass_($globals.AstGenerator);
  34204. $self._start_forClass_protocol_(aString,aClass,anotherString);
  34205. return $self._compileNode_($self._parse_(aString));
  34206. }, function($ctx1) {$ctx1.fill(self,"ast:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString})});
  34207. }; }),
  34208. $globals.Compiler);
  34209. $core.addMethod(
  34210. $core.method({
  34211. selector: "basicParse:",
  34212. protocol: "private",
  34213. args: ["aString"],
  34214. source: "basicParse: aString\x0a\x09^ smalltalkParser parse: aString",
  34215. referencedClasses: [],
  34216. pragmas: [],
  34217. messageSends: ["parse:"]
  34218. }, function ($methodClass){ return function (aString){
  34219. var self=this,$self=this;
  34220. return $core.withContext(function($ctx1) {
  34221. return $recv(smalltalkParser)._parse_(aString);
  34222. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString})});
  34223. }; }),
  34224. $globals.Compiler);
  34225. $core.addMethod(
  34226. $core.method({
  34227. selector: "cleanCodeGenerator",
  34228. protocol: "accessing",
  34229. args: [],
  34230. source: "cleanCodeGenerator\x0a\x09codeGenerator := nil",
  34231. referencedClasses: [],
  34232. pragmas: [],
  34233. messageSends: []
  34234. }, function ($methodClass){ return function (){
  34235. var self=this,$self=this;
  34236. $self.codeGenerator=nil;
  34237. return self;
  34238. }; }),
  34239. $globals.Compiler);
  34240. $core.addMethod(
  34241. $core.method({
  34242. selector: "codeGenerator",
  34243. protocol: "accessing",
  34244. args: [],
  34245. source: "codeGenerator\x0a\x09^ codeGenerator",
  34246. referencedClasses: [],
  34247. pragmas: [],
  34248. messageSends: []
  34249. }, function ($methodClass){ return function (){
  34250. var self=this,$self=this;
  34251. return $self.codeGenerator;
  34252. }; }),
  34253. $globals.Compiler);
  34254. $core.addMethod(
  34255. $core.method({
  34256. selector: "codeGenerator:",
  34257. protocol: "accessing",
  34258. args: ["anObject"],
  34259. source: "codeGenerator: anObject\x0a\x09codeGenerator := anObject",
  34260. referencedClasses: [],
  34261. pragmas: [],
  34262. messageSends: []
  34263. }, function ($methodClass){ return function (anObject){
  34264. var self=this,$self=this;
  34265. $self.codeGenerator=anObject;
  34266. return self;
  34267. }; }),
  34268. $globals.Compiler);
  34269. $core.addMethod(
  34270. $core.method({
  34271. selector: "codeGeneratorClass",
  34272. protocol: "accessing",
  34273. args: [],
  34274. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  34275. referencedClasses: ["InliningCodeGenerator"],
  34276. pragmas: [],
  34277. messageSends: ["ifNil:"]
  34278. }, function ($methodClass){ return function (){
  34279. var self=this,$self=this;
  34280. return $core.withContext(function($ctx1) {
  34281. var $1;
  34282. $1=$self.codeGeneratorClass;
  34283. if($1 == null || $1.a$nil){
  34284. return $globals.InliningCodeGenerator;
  34285. } else {
  34286. return $1;
  34287. }
  34288. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{})});
  34289. }; }),
  34290. $globals.Compiler);
  34291. $core.addMethod(
  34292. $core.method({
  34293. selector: "codeGeneratorClass:",
  34294. protocol: "accessing",
  34295. args: ["aClass"],
  34296. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  34297. referencedClasses: [],
  34298. pragmas: [],
  34299. messageSends: []
  34300. }, function ($methodClass){ return function (aClass){
  34301. var self=this,$self=this;
  34302. $self.codeGeneratorClass=aClass;
  34303. return self;
  34304. }; }),
  34305. $globals.Compiler);
  34306. $core.addMethod(
  34307. $core.method({
  34308. selector: "compile:forClass:protocol:",
  34309. protocol: "compiling",
  34310. args: ["aString", "aClass", "anotherString"],
  34311. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09| sanitizedSource compilationResult result pragmas closureFactory |\x0a\x09sanitizedSource := aString crlfSanitized.\x0a\x09compilationResult := self\x0a\x09\x09start: sanitizedSource forClass: aClass protocol: anotherString;\x0a\x09\x09compileNode: (self parse: sanitizedSource).\x0a\x09closureFactory := self\x0a\x09\x09eval: (self wrappedSourceOf: compilationResult)\x0a\x09\x09forPackage: self currentPackage.\x0a\x09result := Smalltalk core method: #{\x0a\x09\x09#selector -> compilationResult selector.\x0a\x09\x09#protocol -> anotherString.\x0a\x09\x09#source -> sanitizedSource.\x0a\x09\x09#messageSends -> compilationResult messageSends asArray.\x0a\x09\x09#args -> compilationResult arguments.\x0a\x09\x09#referencedClasses -> compilationResult classReferences asArray.\x0a\x09} withFactory: closureFactory.\x0a\x09result pragmas: compilationResult pragmas.\x0a\x09^ result",
  34312. referencedClasses: ["Smalltalk"],
  34313. pragmas: [],
  34314. messageSends: ["crlfSanitized", "start:forClass:protocol:", "compileNode:", "parse:", "eval:forPackage:", "wrappedSourceOf:", "currentPackage", "method:withFactory:", "core", "selector", "asArray", "messageSends", "arguments", "classReferences", "pragmas:", "pragmas"]
  34315. }, function ($methodClass){ return function (aString,aClass,anotherString){
  34316. var self=this,$self=this;
  34317. var sanitizedSource,compilationResult,result,pragmas,closureFactory;
  34318. return $core.withContext(function($ctx1) {
  34319. sanitizedSource=$recv(aString)._crlfSanitized();
  34320. $self._start_forClass_protocol_(sanitizedSource,aClass,anotherString);
  34321. compilationResult=$self._compileNode_($self._parse_(sanitizedSource));
  34322. closureFactory=$self._eval_forPackage_($self._wrappedSourceOf_(compilationResult),$self._currentPackage());
  34323. result=$recv($recv($globals.Smalltalk)._core())._method_withFactory_($globals.HashedCollection._newFromPairs_(["selector",$recv(compilationResult)._selector(),"protocol",anotherString,"source",sanitizedSource,"messageSends",[$recv($recv(compilationResult)._messageSends())._asArray()
  34324. ,$ctx1.sendIdx["asArray"]=1
  34325. ][0],"args",$recv(compilationResult)._arguments(),"referencedClasses",$recv($recv(compilationResult)._classReferences())._asArray()]),closureFactory);
  34326. $recv(result)._pragmas_($recv(compilationResult)._pragmas());
  34327. return result;
  34328. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString,sanitizedSource:sanitizedSource,compilationResult:compilationResult,result:result,pragmas:pragmas,closureFactory:closureFactory})});
  34329. }; }),
  34330. $globals.Compiler);
  34331. $core.addMethod(
  34332. $core.method({
  34333. selector: "compileNode:",
  34334. protocol: "compiling",
  34335. args: ["aNode"],
  34336. source: "compileNode: aNode\x0a | result |\x0a\x09result := self codeGenerator compileNode: aNode.\x0a\x09self cleanCodeGenerator.\x0a\x09^ result",
  34337. referencedClasses: [],
  34338. pragmas: [],
  34339. messageSends: ["compileNode:", "codeGenerator", "cleanCodeGenerator"]
  34340. }, function ($methodClass){ return function (aNode){
  34341. var self=this,$self=this;
  34342. var result;
  34343. return $core.withContext(function($ctx1) {
  34344. result=$recv($self._codeGenerator())._compileNode_(aNode);
  34345. $self._cleanCodeGenerator();
  34346. return result;
  34347. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,result:result})});
  34348. }; }),
  34349. $globals.Compiler);
  34350. $core.addMethod(
  34351. $core.method({
  34352. selector: "currentPackage",
  34353. protocol: "accessing",
  34354. args: [],
  34355. source: "currentPackage\x0a\x09^ currentPackage",
  34356. referencedClasses: [],
  34357. pragmas: [],
  34358. messageSends: []
  34359. }, function ($methodClass){ return function (){
  34360. var self=this,$self=this;
  34361. return $self.currentPackage;
  34362. }; }),
  34363. $globals.Compiler);
  34364. $core.addMethod(
  34365. $core.method({
  34366. selector: "currentPackage:",
  34367. protocol: "accessing",
  34368. args: ["anObject"],
  34369. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  34370. referencedClasses: [],
  34371. pragmas: [],
  34372. messageSends: []
  34373. }, function ($methodClass){ return function (anObject){
  34374. var self=this,$self=this;
  34375. $self.currentPackage=anObject;
  34376. return self;
  34377. }; }),
  34378. $globals.Compiler);
  34379. $core.addMethod(
  34380. $core.method({
  34381. selector: "error:",
  34382. protocol: "error handling",
  34383. args: ["aString"],
  34384. source: "error: aString\x0a\x09CompilerError signal: aString",
  34385. referencedClasses: ["CompilerError"],
  34386. pragmas: [],
  34387. messageSends: ["signal:"]
  34388. }, function ($methodClass){ return function (aString){
  34389. var self=this,$self=this;
  34390. return $core.withContext(function($ctx1) {
  34391. $recv($globals.CompilerError)._signal_(aString);
  34392. return self;
  34393. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString})});
  34394. }; }),
  34395. $globals.Compiler);
  34396. $core.addMethod(
  34397. $core.method({
  34398. selector: "eval:",
  34399. protocol: "compiling",
  34400. args: ["aString"],
  34401. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  34402. referencedClasses: [],
  34403. pragmas: [["inlineJS:", ["return eval(aString)"]]],
  34404. messageSends: []
  34405. }, function ($methodClass){ return function (aString){
  34406. var self=this,$self=this;
  34407. return $core.withContext(function($ctx1) {
  34408. return eval(aString);
  34409. return self;
  34410. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString})});
  34411. }; }),
  34412. $globals.Compiler);
  34413. $core.addMethod(
  34414. $core.method({
  34415. selector: "eval:forPackage:",
  34416. protocol: "compiling",
  34417. args: ["aString", "aPackage"],
  34418. source: "eval: aString forPackage: aPackage\x0a\x09^ aPackage\x0a\x09\x09ifNil: [ self eval: aString ]\x0a\x09\x09ifNotNil: [ aPackage eval: aString ]",
  34419. referencedClasses: [],
  34420. pragmas: [],
  34421. messageSends: ["ifNil:ifNotNil:", "eval:"]
  34422. }, function ($methodClass){ return function (aString,aPackage){
  34423. var self=this,$self=this;
  34424. return $core.withContext(function($ctx1) {
  34425. if(aPackage == null || aPackage.a$nil){
  34426. return [$self._eval_(aString)
  34427. ,$ctx1.sendIdx["eval:"]=1
  34428. ][0];
  34429. } else {
  34430. return $recv(aPackage)._eval_(aString);
  34431. }
  34432. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage})});
  34433. }; }),
  34434. $globals.Compiler);
  34435. $core.addMethod(
  34436. $core.method({
  34437. selector: "evaluateExpression:",
  34438. protocol: "compiling",
  34439. args: ["aString"],
  34440. 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",
  34441. referencedClasses: ["DoIt"],
  34442. pragmas: [],
  34443. messageSends: ["evaluateExpression:on:", "new"]
  34444. }, function ($methodClass){ return function (aString){
  34445. var self=this,$self=this;
  34446. return $core.withContext(function($ctx1) {
  34447. return $self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  34448. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString})});
  34449. }; }),
  34450. $globals.Compiler);
  34451. $core.addMethod(
  34452. $core.method({
  34453. selector: "evaluateExpression:on:",
  34454. protocol: "compiling",
  34455. args: ["aString", "anObject"],
  34456. 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\x0a\x09\x09install: (self sourceForExpression: aString)\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'.\x0a\x09result := anObject xxxDoIt.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09^ result",
  34457. referencedClasses: [],
  34458. pragmas: [],
  34459. messageSends: ["install:forClass:protocol:", "sourceForExpression:", "class", "xxxDoIt", "removeCompiledMethod:"]
  34460. }, function ($methodClass){ return function (aString,anObject){
  34461. var self=this,$self=this;
  34462. var result,method;
  34463. return $core.withContext(function($ctx1) {
  34464. method=$self._install_forClass_protocol_($self._sourceForExpression_(aString),[$recv(anObject)._class()
  34465. ,$ctx1.sendIdx["class"]=1
  34466. ][0],"**xxxDoIt");
  34467. result=$recv(anObject)._xxxDoIt();
  34468. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  34469. return result;
  34470. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method})});
  34471. }; }),
  34472. $globals.Compiler);
  34473. $core.addMethod(
  34474. $core.method({
  34475. selector: "install:forClass:protocol:",
  34476. protocol: "compiling",
  34477. args: ["aString", "aBehavior", "anotherString"],
  34478. source: "install: aString forClass: aBehavior protocol: anotherString\x0a\x09| compiledMethod |\x0a\x09compiledMethod := self compile: aString forClass: aBehavior protocol: anotherString.\x0a\x09aBehavior addCompiledMethod: compiledMethod.\x0a\x09^ compiledMethod",
  34479. referencedClasses: [],
  34480. pragmas: [],
  34481. messageSends: ["compile:forClass:protocol:", "addCompiledMethod:"]
  34482. }, function ($methodClass){ return function (aString,aBehavior,anotherString){
  34483. var self=this,$self=this;
  34484. var compiledMethod;
  34485. return $core.withContext(function($ctx1) {
  34486. compiledMethod=$self._compile_forClass_protocol_(aString,aBehavior,anotherString);
  34487. $recv(aBehavior)._addCompiledMethod_(compiledMethod);
  34488. return compiledMethod;
  34489. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod})});
  34490. }; }),
  34491. $globals.Compiler);
  34492. $core.addMethod(
  34493. $core.method({
  34494. selector: "parse:",
  34495. protocol: "compiling",
  34496. args: ["aString"],
  34497. 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",
  34498. referencedClasses: [],
  34499. pragmas: [],
  34500. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:"]
  34501. }, function ($methodClass){ return function (aString){
  34502. var self=this,$self=this;
  34503. var result;
  34504. return $core.withContext(function($ctx1) {
  34505. $recv((function(){
  34506. return $core.withContext(function($ctx2) {
  34507. result=$self._basicParse_(aString);
  34508. return result;
  34509. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34510. }))._tryCatch_((function(ex){
  34511. return $core.withContext(function($ctx2) {
  34512. return $recv($self._parseError_parsing_(ex,aString))._signal();
  34513. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  34514. }));
  34515. return result;
  34516. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result})});
  34517. }; }),
  34518. $globals.Compiler);
  34519. $core.addMethod(
  34520. $core.method({
  34521. selector: "parseError:parsing:",
  34522. protocol: "error handling",
  34523. args: ["anException", "aString"],
  34524. source: "parseError: anException parsing: aString\x0a\x09(anException basicAt: 'location')\x0a\x09\x09ifNil: [ ^ anException pass ]\x0a\x09\x09ifNotNil: [ :loc |\x0a\x09\x09\x09^ ParseError new \x0a\x09\x09\x09\x09messageText: \x0a\x09\x09\x09\x09\x09'Parse error on line ', loc start line ,\x0a\x09\x09\x09\x09\x09' column ' , loc start column ,\x0a\x09\x09\x09\x09\x09' : Unexpected character ', (anException basicAt: 'found');\x0a\x09\x09\x09\x09yourself ]",
  34525. referencedClasses: ["ParseError"],
  34526. pragmas: [],
  34527. messageSends: ["ifNil:ifNotNil:", "basicAt:", "pass", "messageText:", "new", ",", "line", "start", "column", "yourself"]
  34528. }, function ($methodClass){ return function (anException,aString){
  34529. var self=this,$self=this;
  34530. return $core.withContext(function($ctx1) {
  34531. var $1,$2;
  34532. $1=[$recv(anException)._basicAt_("location")
  34533. ,$ctx1.sendIdx["basicAt:"]=1
  34534. ][0];
  34535. if($1 == null || $1.a$nil){
  34536. return $recv(anException)._pass();
  34537. } else {
  34538. var loc;
  34539. loc=$1;
  34540. $2=$recv($globals.ParseError)._new();
  34541. $recv($2)._messageText_([$recv([$recv([$recv([$recv("Parse error on line ".__comma($recv([$recv(loc)._start()
  34542. ,$ctx1.sendIdx["start"]=1
  34543. ][0])._line())).__comma(" column ")
  34544. ,$ctx1.sendIdx[","]=4
  34545. ][0]).__comma($recv($recv(loc)._start())._column())
  34546. ,$ctx1.sendIdx[","]=3
  34547. ][0]).__comma(" : Unexpected character ")
  34548. ,$ctx1.sendIdx[","]=2
  34549. ][0]).__comma($recv(anException)._basicAt_("found"))
  34550. ,$ctx1.sendIdx[","]=1
  34551. ][0]);
  34552. return $recv($2)._yourself();
  34553. }
  34554. return self;
  34555. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString})});
  34556. }; }),
  34557. $globals.Compiler);
  34558. $core.addMethod(
  34559. $core.method({
  34560. selector: "parseExpression:",
  34561. protocol: "compiling",
  34562. args: ["aString"],
  34563. source: "parseExpression: aString\x0a\x09^ self parse: (self sourceForExpression: aString)",
  34564. referencedClasses: [],
  34565. pragmas: [],
  34566. messageSends: ["parse:", "sourceForExpression:"]
  34567. }, function ($methodClass){ return function (aString){
  34568. var self=this,$self=this;
  34569. return $core.withContext(function($ctx1) {
  34570. return $self._parse_($self._sourceForExpression_(aString));
  34571. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString})});
  34572. }; }),
  34573. $globals.Compiler);
  34574. $core.addMethod(
  34575. $core.method({
  34576. selector: "recompile:",
  34577. protocol: "compiling",
  34578. args: ["aClass"],
  34579. source: "recompile: aClass\x0a\x09aClass includingPossibleMetaDo: [ :eachSide |\x0a\x09\x09eachSide methodDictionary values\x0a\x09\x09\x09do: [ :each | each origin = eachSide ifTrue: [ \x0a\x09\x09\x09\x09self \x0a\x09\x09\x09\x09\x09install: each source \x0a\x09\x09\x09\x09\x09forClass: eachSide \x0a\x09\x09\x09\x09\x09protocol: each protocol ] ]\x0a\x09\x09\x09displayingProgress: 'Recompiling ', eachSide name ]",
  34580. referencedClasses: [],
  34581. pragmas: [],
  34582. messageSends: ["includingPossibleMetaDo:", "do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "origin", "install:forClass:protocol:", "source", "protocol", ",", "name"]
  34583. }, function ($methodClass){ return function (aClass){
  34584. var self=this,$self=this;
  34585. return $core.withContext(function($ctx1) {
  34586. $recv(aClass)._includingPossibleMetaDo_((function(eachSide){
  34587. return $core.withContext(function($ctx2) {
  34588. return $recv($recv($recv(eachSide)._methodDictionary())._values())._do_displayingProgress_((function(each){
  34589. return $core.withContext(function($ctx3) {
  34590. if($core.assert($recv($recv(each)._origin()).__eq(eachSide))){
  34591. return $self._install_forClass_protocol_($recv(each)._source(),eachSide,$recv(each)._protocol());
  34592. }
  34593. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  34594. }),"Recompiling ".__comma($recv(eachSide)._name()));
  34595. }, function($ctx2) {$ctx2.fillBlock({eachSide:eachSide},$ctx1,1)});
  34596. }));
  34597. return self;
  34598. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass})});
  34599. }; }),
  34600. $globals.Compiler);
  34601. $core.addMethod(
  34602. $core.method({
  34603. selector: "recompileAll",
  34604. protocol: "compiling",
  34605. args: [],
  34606. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  34607. referencedClasses: ["Smalltalk"],
  34608. pragmas: [],
  34609. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  34610. }, function ($methodClass){ return function (){
  34611. var self=this,$self=this;
  34612. return $core.withContext(function($ctx1) {
  34613. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  34614. return $core.withContext(function($ctx2) {
  34615. return $self._recompile_(each);
  34616. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34617. }),"Compiling all classes...");
  34618. return self;
  34619. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{})});
  34620. }; }),
  34621. $globals.Compiler);
  34622. $core.addMethod(
  34623. $core.method({
  34624. selector: "sourceForExpression:",
  34625. protocol: "compiling",
  34626. args: ["aString"],
  34627. source: "sourceForExpression: aString\x0a\x09^ 'xxxDoIt ^ [ ', aString, ' ] value'",
  34628. referencedClasses: [],
  34629. pragmas: [],
  34630. messageSends: [","]
  34631. }, function ($methodClass){ return function (aString){
  34632. var self=this,$self=this;
  34633. return $core.withContext(function($ctx1) {
  34634. return [$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value")
  34635. ,$ctx1.sendIdx[","]=1
  34636. ][0];
  34637. }, function($ctx1) {$ctx1.fill(self,"sourceForExpression:",{aString:aString})});
  34638. }; }),
  34639. $globals.Compiler);
  34640. $core.addMethod(
  34641. $core.method({
  34642. selector: "start:forClass:protocol:",
  34643. protocol: "compiling",
  34644. args: ["aString", "aClass", "anotherString"],
  34645. source: "start: aString forClass: aClass protocol: anotherString\x0a\x09| package |\x0a\x09package := aClass packageOfProtocol: anotherString.\x0a\x09self\x0a\x09\x09currentPackage: package;\x0a\x09\x09codeGenerator: (self codeGeneratorClass new\x0a\x09\x09\x09source: aString;\x0a\x09\x09\x09currentClass: aClass;\x0a\x09\x09\x09currentPackage: package;\x0a\x09\x09\x09yourself)",
  34646. referencedClasses: [],
  34647. pragmas: [],
  34648. messageSends: ["packageOfProtocol:", "currentPackage:", "codeGenerator:", "source:", "new", "codeGeneratorClass", "currentClass:", "yourself"]
  34649. }, function ($methodClass){ return function (aString,aClass,anotherString){
  34650. var self=this,$self=this;
  34651. var package_;
  34652. return $core.withContext(function($ctx1) {
  34653. var $1;
  34654. package_=$recv(aClass)._packageOfProtocol_(anotherString);
  34655. [$self._currentPackage_(package_)
  34656. ,$ctx1.sendIdx["currentPackage:"]=1
  34657. ][0];
  34658. $1=$recv($self._codeGeneratorClass())._new();
  34659. $recv($1)._source_(aString);
  34660. $recv($1)._currentClass_(aClass);
  34661. $recv($1)._currentPackage_(package_);
  34662. $self._codeGenerator_($recv($1)._yourself());
  34663. return self;
  34664. }, function($ctx1) {$ctx1.fill(self,"start:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString,package_:package_})});
  34665. }; }),
  34666. $globals.Compiler);
  34667. $core.addMethod(
  34668. $core.method({
  34669. selector: "transformerAt:put:",
  34670. protocol: "compiling",
  34671. args: ["aString", "anObject"],
  34672. source: "transformerAt: aString put: anObject\x0a\x09self codeGenerator transformersDictionary at: aString put: anObject",
  34673. referencedClasses: [],
  34674. pragmas: [],
  34675. messageSends: ["at:put:", "transformersDictionary", "codeGenerator"]
  34676. }, function ($methodClass){ return function (aString,anObject){
  34677. var self=this,$self=this;
  34678. return $core.withContext(function($ctx1) {
  34679. $recv($recv($self._codeGenerator())._transformersDictionary())._at_put_(aString,anObject);
  34680. return self;
  34681. }, function($ctx1) {$ctx1.fill(self,"transformerAt:put:",{aString:aString,anObject:anObject})});
  34682. }; }),
  34683. $globals.Compiler);
  34684. $core.addMethod(
  34685. $core.method({
  34686. selector: "wrappedSourceOf:",
  34687. protocol: "private",
  34688. args: ["anIRMethod"],
  34689. source: "wrappedSourceOf: anIRMethod\x0a\x09^ anIRMethod attachments\x0a\x09\x09ifEmpty: [\x0a\x09\x09\x09'(function ($methodClass){ return ',\x0a\x09\x09\x09anIRMethod compiledSource,\x0a\x09\x09\x09'; })' ]\x0a\x09\x09ifNotEmpty: [ :attachments |\x0a\x09\x09\x09'(function ($methodClass){ return Object.defineProperty(',\x0a\x09\x09\x09anIRMethod compiledSource,\x0a\x09\x09\x09',\x22a$atx\x22,{enumerable:false,configurable:true,writable:true,value:',\x0a\x09\x09\x09attachments asJavaScriptSource,\x0a\x09\x09\x09'}); })' ]",
  34690. referencedClasses: [],
  34691. pragmas: [],
  34692. messageSends: ["ifEmpty:ifNotEmpty:", "attachments", ",", "compiledSource", "asJavaScriptSource"]
  34693. }, function ($methodClass){ return function (anIRMethod){
  34694. var self=this,$self=this;
  34695. return $core.withContext(function($ctx1) {
  34696. return $recv($recv(anIRMethod)._attachments())._ifEmpty_ifNotEmpty_((function(){
  34697. return $core.withContext(function($ctx2) {
  34698. return [$recv(["(function ($methodClass){ return ".__comma([$recv(anIRMethod)._compiledSource()
  34699. ,$ctx2.sendIdx["compiledSource"]=1
  34700. ][0])
  34701. ,$ctx2.sendIdx[","]=2
  34702. ][0]).__comma("; })")
  34703. ,$ctx2.sendIdx[","]=1
  34704. ][0];
  34705. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34706. }),(function(attachments){
  34707. return $core.withContext(function($ctx2) {
  34708. return [$recv([$recv([$recv("(function ($methodClass){ return Object.defineProperty(".__comma($recv(anIRMethod)._compiledSource())).__comma(",\x22a$atx\x22,{enumerable:false,configurable:true,writable:true,value:")
  34709. ,$ctx2.sendIdx[","]=5
  34710. ][0]).__comma($recv(attachments)._asJavaScriptSource())
  34711. ,$ctx2.sendIdx[","]=4
  34712. ][0]).__comma("}); })")
  34713. ,$ctx2.sendIdx[","]=3
  34714. ][0];
  34715. }, function($ctx2) {$ctx2.fillBlock({attachments:attachments},$ctx1,2)});
  34716. }));
  34717. }, function($ctx1) {$ctx1.fill(self,"wrappedSourceOf:",{anIRMethod:anIRMethod})});
  34718. }; }),
  34719. $globals.Compiler);
  34720. $core.addMethod(
  34721. $core.method({
  34722. selector: "eval:",
  34723. protocol: "evaluating",
  34724. args: ["aString"],
  34725. source: "eval: aString\x0a\x09^ self new eval: aString",
  34726. referencedClasses: [],
  34727. pragmas: [],
  34728. messageSends: ["eval:", "new"]
  34729. }, function ($methodClass){ return function (aString){
  34730. var self=this,$self=this;
  34731. return $core.withContext(function($ctx1) {
  34732. return $recv($self._new())._eval_(aString);
  34733. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString})});
  34734. }; }),
  34735. $globals.Compiler.a$cls);
  34736. $core.addMethod(
  34737. $core.method({
  34738. selector: "initialize",
  34739. protocol: "initialization",
  34740. args: [],
  34741. source: "initialize\x0a\x09\x22TODO remove, backward compat\x22\x0a\x09Smalltalk globals at: #SmalltalkParser put: smalltalkParser",
  34742. referencedClasses: ["Smalltalk"],
  34743. pragmas: [],
  34744. messageSends: ["at:put:", "globals"]
  34745. }, function ($methodClass){ return function (){
  34746. var self=this,$self=this;
  34747. return $core.withContext(function($ctx1) {
  34748. $recv($recv($globals.Smalltalk)._globals())._at_put_("SmalltalkParser",smalltalkParser);
  34749. return self;
  34750. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  34751. }; }),
  34752. $globals.Compiler.a$cls);
  34753. $core.addMethod(
  34754. $core.method({
  34755. selector: "parse:",
  34756. protocol: "parsing",
  34757. args: ["aString"],
  34758. source: "parse: aString\x0a\x09^ self new parse: aString",
  34759. referencedClasses: [],
  34760. pragmas: [],
  34761. messageSends: ["parse:", "new"]
  34762. }, function ($methodClass){ return function (aString){
  34763. var self=this,$self=this;
  34764. return $core.withContext(function($ctx1) {
  34765. return $recv($self._new())._parse_(aString);
  34766. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString})});
  34767. }; }),
  34768. $globals.Compiler.a$cls);
  34769. $core.addMethod(
  34770. $core.method({
  34771. selector: "pseudoVariableNames",
  34772. protocol: "parsing",
  34773. args: [],
  34774. source: "pseudoVariableNames\x0a\x09^ PseudoVar dictionary keys asArray",
  34775. referencedClasses: ["PseudoVar"],
  34776. pragmas: [],
  34777. messageSends: ["asArray", "keys", "dictionary"]
  34778. }, function ($methodClass){ return function (){
  34779. var self=this,$self=this;
  34780. return $core.withContext(function($ctx1) {
  34781. return $recv($recv($recv($globals.PseudoVar)._dictionary())._keys())._asArray();
  34782. }, function($ctx1) {$ctx1.fill(self,"pseudoVariableNames",{})});
  34783. }; }),
  34784. $globals.Compiler.a$cls);
  34785. $core.addMethod(
  34786. $core.method({
  34787. selector: "recompile:",
  34788. protocol: "compiling",
  34789. args: ["aClass"],
  34790. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  34791. referencedClasses: [],
  34792. pragmas: [],
  34793. messageSends: ["recompile:", "new"]
  34794. }, function ($methodClass){ return function (aClass){
  34795. var self=this,$self=this;
  34796. return $core.withContext(function($ctx1) {
  34797. $recv($self._new())._recompile_(aClass);
  34798. return self;
  34799. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass})});
  34800. }; }),
  34801. $globals.Compiler.a$cls);
  34802. $core.addMethod(
  34803. $core.method({
  34804. selector: "recompileAll",
  34805. protocol: "compiling",
  34806. args: [],
  34807. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  34808. referencedClasses: ["Smalltalk"],
  34809. pragmas: [],
  34810. messageSends: ["do:", "classes", "recompile:"]
  34811. }, function ($methodClass){ return function (){
  34812. var self=this,$self=this;
  34813. return $core.withContext(function($ctx1) {
  34814. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  34815. return $core.withContext(function($ctx2) {
  34816. return $self._recompile_(each);
  34817. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34818. }));
  34819. return self;
  34820. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{})});
  34821. }; }),
  34822. $globals.Compiler.a$cls);
  34823. $core.addClass("DoIt", $globals.Object, [], "Compiler-Core");
  34824. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  34825. $core.addClass("Evaluator", $globals.Object, [], "Compiler-Core");
  34826. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  34827. $core.addMethod(
  34828. $core.method({
  34829. selector: "evaluate:for:",
  34830. protocol: "evaluating",
  34831. args: ["aString", "anObject"],
  34832. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  34833. referencedClasses: [],
  34834. pragmas: [],
  34835. messageSends: ["evaluate:on:"]
  34836. }, function ($methodClass){ return function (aString,anObject){
  34837. var self=this,$self=this;
  34838. return $core.withContext(function($ctx1) {
  34839. return $recv(anObject)._evaluate_on_(aString,self);
  34840. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject})});
  34841. }; }),
  34842. $globals.Evaluator);
  34843. $core.addMethod(
  34844. $core.method({
  34845. selector: "evaluate:receiver:",
  34846. protocol: "evaluating",
  34847. args: ["aString", "anObject"],
  34848. 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",
  34849. referencedClasses: ["Compiler", "Error", "Terminal"],
  34850. pragmas: [],
  34851. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  34852. }, function ($methodClass){ return function (aString,anObject){
  34853. var self=this,$self=this;
  34854. var compiler;
  34855. return $core.withContext(function($ctx1) {
  34856. var $early={};
  34857. try {
  34858. compiler=$recv($globals.Compiler)._new();
  34859. $recv((function(){
  34860. return $core.withContext(function($ctx2) {
  34861. return $recv(compiler)._parseExpression_(aString);
  34862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34863. }))._on_do_($globals.Error,(function(ex){
  34864. return $core.withContext(function($ctx2) {
  34865. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  34866. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  34867. }));
  34868. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  34869. }
  34870. catch(e) {if(e===$early)return e[0]; throw e}
  34871. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler})});
  34872. }; }),
  34873. $globals.Evaluator);
  34874. $core.addMethod(
  34875. $core.method({
  34876. selector: "evaluate:for:",
  34877. protocol: "instance creation",
  34878. args: ["aString", "anObject"],
  34879. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  34880. referencedClasses: [],
  34881. pragmas: [],
  34882. messageSends: ["evaluate:for:", "new"]
  34883. }, function ($methodClass){ return function (aString,anObject){
  34884. var self=this,$self=this;
  34885. return $core.withContext(function($ctx1) {
  34886. return $recv($self._new())._evaluate_for_(aString,anObject);
  34887. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject})});
  34888. }; }),
  34889. $globals.Evaluator.a$cls);
  34890. $core.addClass("ParseError", $globals.Error, [], "Compiler-Core");
  34891. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Compiler >> #parse:`";
  34892. $core.addTrait("TPragmator", "Compiler-Core");
  34893. $core.addMethod(
  34894. $core.method({
  34895. selector: "canProcessPragma:",
  34896. protocol: "pragma processing",
  34897. args: ["aMessage"],
  34898. source: "canProcessPragma: aMessage\x0a\x09^ self class includesSelector: aMessage selector",
  34899. referencedClasses: [],
  34900. pragmas: [],
  34901. messageSends: ["includesSelector:", "class", "selector"]
  34902. }, function ($methodClass){ return function (aMessage){
  34903. var self=this,$self=this;
  34904. return $core.withContext(function($ctx1) {
  34905. return $recv($self._class())._includesSelector_($recv(aMessage)._selector());
  34906. }, function($ctx1) {$ctx1.fill(self,"canProcessPragma:",{aMessage:aMessage})});
  34907. }; }),
  34908. $globals.TPragmator);
  34909. $core.addMethod(
  34910. $core.method({
  34911. selector: "processPragma:",
  34912. protocol: "pragma processing",
  34913. args: ["aMessage"],
  34914. source: "processPragma: aMessage\x0a\x09(self canProcessPragma: aMessage) ifTrue: [\x0a\x09\x09^ aMessage sendTo: self ]",
  34915. referencedClasses: [],
  34916. pragmas: [],
  34917. messageSends: ["ifTrue:", "canProcessPragma:", "sendTo:"]
  34918. }, function ($methodClass){ return function (aMessage){
  34919. var self=this,$self=this;
  34920. return $core.withContext(function($ctx1) {
  34921. if($core.assert($self._canProcessPragma_(aMessage))){
  34922. return $recv(aMessage)._sendTo_(self);
  34923. }
  34924. return self;
  34925. }, function($ctx1) {$ctx1.fill(self,"processPragma:",{aMessage:aMessage})});
  34926. }; }),
  34927. $globals.TPragmator);
  34928. $core.addMethod(
  34929. $core.method({
  34930. selector: "processPragmas:",
  34931. protocol: "pragma processing",
  34932. args: ["aCollection"],
  34933. source: "processPragmas: aCollection\x0a\x09aCollection do: [ :each | self processPragma: each ]",
  34934. referencedClasses: [],
  34935. pragmas: [],
  34936. messageSends: ["do:", "processPragma:"]
  34937. }, function ($methodClass){ return function (aCollection){
  34938. var self=this,$self=this;
  34939. return $core.withContext(function($ctx1) {
  34940. $recv(aCollection)._do_((function(each){
  34941. return $core.withContext(function($ctx2) {
  34942. return $self._processPragma_(each);
  34943. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34944. }));
  34945. return self;
  34946. }, function($ctx1) {$ctx1.fill(self,"processPragmas:",{aCollection:aCollection})});
  34947. }; }),
  34948. $globals.TPragmator);
  34949. $core.addMethod(
  34950. $core.method({
  34951. selector: "asVariableName",
  34952. protocol: "*Compiler-Core",
  34953. args: [],
  34954. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  34955. referencedClasses: ["Smalltalk"],
  34956. pragmas: [],
  34957. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  34958. }, function ($methodClass){ return function (){
  34959. var self=this,$self=this;
  34960. return $core.withContext(function($ctx1) {
  34961. if($core.assert($recv($recv($globals.Smalltalk)._reservedWords())._includes_(self))){
  34962. return $self.__comma("_");
  34963. } else {
  34964. return self;
  34965. }
  34966. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{})});
  34967. }; }),
  34968. $globals.String);
  34969. });
  34970. define('amber/core/Compiler-AST',["amber/boot", "require", "amber/core/Compiler-Core", "amber/core/Kernel-Dag", "amber/core/Kernel-Exceptions", "amber/core/Kernel-Methods", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  34971. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  34972. var $pkg = $core.addPackage("Compiler-AST");
  34973. $pkg.innerEval = function (expr) { return eval(expr); };
  34974. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  34975. $core.addClass("ASTNode", $globals.DagParentNode, ["parent", "position", "source"], "Compiler-AST");
  34976. $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.";
  34977. $core.addMethod(
  34978. $core.method({
  34979. selector: "inPosition:",
  34980. protocol: "testing",
  34981. args: ["aPoint"],
  34982. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  34983. referencedClasses: [],
  34984. pragmas: [],
  34985. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  34986. }, function ($methodClass){ return function (aPoint){
  34987. var self=this,$self=this;
  34988. return $core.withContext(function($ctx1) {
  34989. return $recv($recv($self._positionStart()).__lt_eq(aPoint))._and_((function(){
  34990. return $core.withContext(function($ctx2) {
  34991. return $recv($self._positionEnd()).__gt_eq(aPoint);
  34992. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34993. }));
  34994. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint})});
  34995. }; }),
  34996. $globals.ASTNode);
  34997. $core.addMethod(
  34998. $core.method({
  34999. selector: "isNavigationNode",
  35000. protocol: "testing",
  35001. args: [],
  35002. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  35003. referencedClasses: [],
  35004. pragmas: [],
  35005. messageSends: []
  35006. }, function ($methodClass){ return function (){
  35007. var self=this,$self=this;
  35008. return false;
  35009. }; }),
  35010. $globals.ASTNode);
  35011. $core.addMethod(
  35012. $core.method({
  35013. selector: "isReturnNode",
  35014. protocol: "testing",
  35015. args: [],
  35016. source: "isReturnNode\x0a\x09^ false",
  35017. referencedClasses: [],
  35018. pragmas: [],
  35019. messageSends: []
  35020. }, function ($methodClass){ return function (){
  35021. var self=this,$self=this;
  35022. return false;
  35023. }; }),
  35024. $globals.ASTNode);
  35025. $core.addMethod(
  35026. $core.method({
  35027. selector: "location:",
  35028. protocol: "accessing",
  35029. args: ["aLocation"],
  35030. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  35031. referencedClasses: [],
  35032. pragmas: [],
  35033. messageSends: ["position:", "@", "line", "start", "column"]
  35034. }, function ($methodClass){ return function (aLocation){
  35035. var self=this,$self=this;
  35036. return $core.withContext(function($ctx1) {
  35037. $self._position_($recv($recv([$recv(aLocation)._start()
  35038. ,$ctx1.sendIdx["start"]=1
  35039. ][0])._line()).__at($recv($recv(aLocation)._start())._column()));
  35040. return self;
  35041. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation})});
  35042. }; }),
  35043. $globals.ASTNode);
  35044. $core.addMethod(
  35045. $core.method({
  35046. selector: "navigationNodeAt:ifAbsent:",
  35047. protocol: "accessing",
  35048. args: ["aPoint", "aBlock"],
  35049. 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",
  35050. referencedClasses: [],
  35051. pragmas: [],
  35052. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  35053. }, function ($methodClass){ return function (aPoint,aBlock){
  35054. var self=this,$self=this;
  35055. var children;
  35056. return $core.withContext(function($ctx1) {
  35057. var $early={};
  35058. try {
  35059. children=$recv($self._allDagChildren())._select_((function(each){
  35060. return $core.withContext(function($ctx2) {
  35061. return $recv($recv(each)._isNavigationNode())._and_((function(){
  35062. return $core.withContext(function($ctx3) {
  35063. return $recv(each)._inPosition_(aPoint);
  35064. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  35065. }));
  35066. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35067. }));
  35068. $recv(children)._ifEmpty_((function(){
  35069. return $core.withContext(function($ctx2) {
  35070. throw $early=[$recv(aBlock)._value()];
  35071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  35072. }));
  35073. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  35074. return $core.withContext(function($ctx2) {
  35075. return $recv([$recv([$recv(a)._positionStart()
  35076. ,$ctx2.sendIdx["positionStart"]=1
  35077. ][0])._dist_(aPoint)
  35078. ,$ctx2.sendIdx["dist:"]=1
  35079. ][0]).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  35080. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  35081. })))._first();
  35082. }
  35083. catch(e) {if(e===$early)return e[0]; throw e}
  35084. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children})});
  35085. }; }),
  35086. $globals.ASTNode);
  35087. $core.addMethod(
  35088. $core.method({
  35089. selector: "parent",
  35090. protocol: "accessing",
  35091. args: [],
  35092. source: "parent\x0a\x09^ parent",
  35093. referencedClasses: [],
  35094. pragmas: [],
  35095. messageSends: []
  35096. }, function ($methodClass){ return function (){
  35097. var self=this,$self=this;
  35098. return $self.parent;
  35099. }; }),
  35100. $globals.ASTNode);
  35101. $core.addMethod(
  35102. $core.method({
  35103. selector: "parent:",
  35104. protocol: "accessing",
  35105. args: ["aNode"],
  35106. source: "parent: aNode\x0a\x09parent := aNode",
  35107. referencedClasses: [],
  35108. pragmas: [],
  35109. messageSends: []
  35110. }, function ($methodClass){ return function (aNode){
  35111. var self=this,$self=this;
  35112. $self.parent=aNode;
  35113. return self;
  35114. }; }),
  35115. $globals.ASTNode);
  35116. $core.addMethod(
  35117. $core.method({
  35118. selector: "position",
  35119. protocol: "accessing",
  35120. args: [],
  35121. 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 ] ]",
  35122. referencedClasses: [],
  35123. pragmas: [],
  35124. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  35125. }, function ($methodClass){ return function (){
  35126. var self=this,$self=this;
  35127. return $core.withContext(function($ctx1) {
  35128. var $1,$2;
  35129. $1=$self.position;
  35130. if($1 == null || $1.a$nil){
  35131. $2=$self._parent();
  35132. if($2 == null || $2.a$nil){
  35133. return $2;
  35134. } else {
  35135. var node;
  35136. node=$2;
  35137. return $recv(node)._position();
  35138. }
  35139. } else {
  35140. return $1;
  35141. }
  35142. }, function($ctx1) {$ctx1.fill(self,"position",{})});
  35143. }; }),
  35144. $globals.ASTNode);
  35145. $core.addMethod(
  35146. $core.method({
  35147. selector: "position:",
  35148. protocol: "accessing",
  35149. args: ["aPosition"],
  35150. source: "position: aPosition\x0a\x09position := aPosition",
  35151. referencedClasses: [],
  35152. pragmas: [],
  35153. messageSends: []
  35154. }, function ($methodClass){ return function (aPosition){
  35155. var self=this,$self=this;
  35156. $self.position=aPosition;
  35157. return self;
  35158. }; }),
  35159. $globals.ASTNode);
  35160. $core.addMethod(
  35161. $core.method({
  35162. selector: "positionEnd",
  35163. protocol: "accessing",
  35164. args: [],
  35165. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  35166. referencedClasses: [],
  35167. pragmas: [],
  35168. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  35169. }, function ($methodClass){ return function (){
  35170. var self=this,$self=this;
  35171. return $core.withContext(function($ctx1) {
  35172. return $recv($self._positionStart()).__plus($recv([$recv([$recv([$recv([$self._source()
  35173. ,$ctx1.sendIdx["source"]=1
  35174. ][0])._lines()
  35175. ,$ctx1.sendIdx["lines"]=1
  35176. ][0])._size()
  35177. ,$ctx1.sendIdx["size"]=1
  35178. ][0]).__minus((1))
  35179. ,$ctx1.sendIdx["-"]=1
  35180. ][0]).__at($recv($recv($recv($recv($self._source())._lines())._last())._size()).__minus((1))));
  35181. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{})});
  35182. }; }),
  35183. $globals.ASTNode);
  35184. $core.addMethod(
  35185. $core.method({
  35186. selector: "positionStart",
  35187. protocol: "accessing",
  35188. args: [],
  35189. source: "positionStart\x0a\x09^ self position",
  35190. referencedClasses: [],
  35191. pragmas: [],
  35192. messageSends: ["position"]
  35193. }, function ($methodClass){ return function (){
  35194. var self=this,$self=this;
  35195. return $core.withContext(function($ctx1) {
  35196. return $self._position();
  35197. }, function($ctx1) {$ctx1.fill(self,"positionStart",{})});
  35198. }; }),
  35199. $globals.ASTNode);
  35200. $core.addMethod(
  35201. $core.method({
  35202. selector: "size",
  35203. protocol: "accessing",
  35204. args: [],
  35205. source: "size\x0a\x09^ self source size",
  35206. referencedClasses: [],
  35207. pragmas: [],
  35208. messageSends: ["size", "source"]
  35209. }, function ($methodClass){ return function (){
  35210. var self=this,$self=this;
  35211. return $core.withContext(function($ctx1) {
  35212. return $recv($self._source())._size();
  35213. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  35214. }; }),
  35215. $globals.ASTNode);
  35216. $core.addMethod(
  35217. $core.method({
  35218. selector: "source",
  35219. protocol: "accessing",
  35220. args: [],
  35221. source: "source\x0a\x09^ source ifNil: [ '' ]",
  35222. referencedClasses: [],
  35223. pragmas: [],
  35224. messageSends: ["ifNil:"]
  35225. }, function ($methodClass){ return function (){
  35226. var self=this,$self=this;
  35227. return $core.withContext(function($ctx1) {
  35228. var $1;
  35229. $1=$self.source;
  35230. if($1 == null || $1.a$nil){
  35231. return "";
  35232. } else {
  35233. return $1;
  35234. }
  35235. }, function($ctx1) {$ctx1.fill(self,"source",{})});
  35236. }; }),
  35237. $globals.ASTNode);
  35238. $core.addMethod(
  35239. $core.method({
  35240. selector: "source:",
  35241. protocol: "accessing",
  35242. args: ["aString"],
  35243. source: "source: aString\x0a\x09source := aString",
  35244. referencedClasses: [],
  35245. pragmas: [],
  35246. messageSends: []
  35247. }, function ($methodClass){ return function (aString){
  35248. var self=this,$self=this;
  35249. $self.source=aString;
  35250. return self;
  35251. }; }),
  35252. $globals.ASTNode);
  35253. $core.addClass("ExpressionNode", $globals.ASTNode, ["shouldBeAliased"], "Compiler-AST");
  35254. $globals.ExpressionNode.comment="I am the abstract root class for expression nodes.";
  35255. $core.addMethod(
  35256. $core.method({
  35257. selector: "isIdempotent",
  35258. protocol: "testing",
  35259. args: [],
  35260. source: "isIdempotent\x0a\x09^ false",
  35261. referencedClasses: [],
  35262. pragmas: [],
  35263. messageSends: []
  35264. }, function ($methodClass){ return function (){
  35265. var self=this,$self=this;
  35266. return false;
  35267. }; }),
  35268. $globals.ExpressionNode);
  35269. $core.addMethod(
  35270. $core.method({
  35271. selector: "isImmutable",
  35272. protocol: "testing",
  35273. args: [],
  35274. source: "isImmutable\x0a\x09self deprecatedAPI: 'Use #isIdempotent instead.'.\x0a\x09^ self isIdempotent",
  35275. referencedClasses: [],
  35276. pragmas: [],
  35277. messageSends: ["deprecatedAPI:", "isIdempotent"]
  35278. }, function ($methodClass){ return function (){
  35279. var self=this,$self=this;
  35280. return $core.withContext(function($ctx1) {
  35281. $self._deprecatedAPI_("Use #isIdempotent instead.");
  35282. return $self._isIdempotent();
  35283. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{})});
  35284. }; }),
  35285. $globals.ExpressionNode);
  35286. $core.addMethod(
  35287. $core.method({
  35288. selector: "isSuper",
  35289. protocol: "testing",
  35290. args: [],
  35291. source: "isSuper\x0a\x09^ false",
  35292. referencedClasses: [],
  35293. pragmas: [],
  35294. messageSends: []
  35295. }, function ($methodClass){ return function (){
  35296. var self=this,$self=this;
  35297. return false;
  35298. }; }),
  35299. $globals.ExpressionNode);
  35300. $core.addMethod(
  35301. $core.method({
  35302. selector: "shouldBeAliased",
  35303. protocol: "accessing",
  35304. args: [],
  35305. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  35306. referencedClasses: [],
  35307. pragmas: [],
  35308. messageSends: ["ifNil:"]
  35309. }, function ($methodClass){ return function (){
  35310. var self=this,$self=this;
  35311. return $core.withContext(function($ctx1) {
  35312. var $1;
  35313. $1=$self.shouldBeAliased;
  35314. if($1 == null || $1.a$nil){
  35315. return false;
  35316. } else {
  35317. return $1;
  35318. }
  35319. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{})});
  35320. }; }),
  35321. $globals.ExpressionNode);
  35322. $core.addMethod(
  35323. $core.method({
  35324. selector: "shouldBeAliased:",
  35325. protocol: "accessing",
  35326. args: ["aBoolean"],
  35327. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  35328. referencedClasses: [],
  35329. pragmas: [],
  35330. messageSends: []
  35331. }, function ($methodClass){ return function (aBoolean){
  35332. var self=this,$self=this;
  35333. $self.shouldBeAliased=aBoolean;
  35334. return self;
  35335. }; }),
  35336. $globals.ExpressionNode);
  35337. $core.addMethod(
  35338. $core.method({
  35339. selector: "withTail:",
  35340. protocol: "building",
  35341. args: ["aCollection"],
  35342. 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 ]",
  35343. referencedClasses: ["SendNode"],
  35344. pragmas: [],
  35345. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  35346. }, function ($methodClass){ return function (aCollection){
  35347. var self=this,$self=this;
  35348. return $core.withContext(function($ctx1) {
  35349. var $1;
  35350. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  35351. return $core.withContext(function($ctx2) {
  35352. $1=$recv($globals.SendNode)._new();
  35353. $recv($1)._position_($recv(send)._position());
  35354. $recv($1)._source_($recv(send)._source());
  35355. $recv($1)._receiver_(receiver);
  35356. $recv($1)._selector_($recv(send)._selector());
  35357. $recv($1)._arguments_($recv(send)._arguments());
  35358. return $recv($1)._yourself();
  35359. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  35360. }));
  35361. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection})});
  35362. }; }),
  35363. $globals.ExpressionNode);
  35364. $core.addClass("AssignmentNode", $globals.ExpressionNode, ["left", "right"], "Compiler-AST");
  35365. $globals.AssignmentNode.comment="I represent an assignment node.";
  35366. $core.addMethod(
  35367. $core.method({
  35368. selector: "acceptDagVisitor:",
  35369. protocol: "visiting",
  35370. args: ["aVisitor"],
  35371. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  35372. referencedClasses: [],
  35373. pragmas: [],
  35374. messageSends: ["visitAssignmentNode:"]
  35375. }, function ($methodClass){ return function (aVisitor){
  35376. var self=this,$self=this;
  35377. return $core.withContext(function($ctx1) {
  35378. return $recv(aVisitor)._visitAssignmentNode_(self);
  35379. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  35380. }; }),
  35381. $globals.AssignmentNode);
  35382. $core.addMethod(
  35383. $core.method({
  35384. selector: "dagChildren",
  35385. protocol: "accessing",
  35386. args: [],
  35387. source: "dagChildren\x0a\x09^ { self left. self right }",
  35388. referencedClasses: [],
  35389. pragmas: [],
  35390. messageSends: ["left", "right"]
  35391. }, function ($methodClass){ return function (){
  35392. var self=this,$self=this;
  35393. return $core.withContext(function($ctx1) {
  35394. return [$self._left(),$self._right()];
  35395. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{})});
  35396. }; }),
  35397. $globals.AssignmentNode);
  35398. $core.addMethod(
  35399. $core.method({
  35400. selector: "left",
  35401. protocol: "accessing",
  35402. args: [],
  35403. source: "left\x0a\x09^ left",
  35404. referencedClasses: [],
  35405. pragmas: [],
  35406. messageSends: []
  35407. }, function ($methodClass){ return function (){
  35408. var self=this,$self=this;
  35409. return $self.left;
  35410. }; }),
  35411. $globals.AssignmentNode);
  35412. $core.addMethod(
  35413. $core.method({
  35414. selector: "left:",
  35415. protocol: "accessing",
  35416. args: ["aNode"],
  35417. source: "left: aNode\x0a\x09left := aNode",
  35418. referencedClasses: [],
  35419. pragmas: [],
  35420. messageSends: []
  35421. }, function ($methodClass){ return function (aNode){
  35422. var self=this,$self=this;
  35423. $self.left=aNode;
  35424. return self;
  35425. }; }),
  35426. $globals.AssignmentNode);
  35427. $core.addMethod(
  35428. $core.method({
  35429. selector: "right",
  35430. protocol: "accessing",
  35431. args: [],
  35432. source: "right\x0a\x09^ right",
  35433. referencedClasses: [],
  35434. pragmas: [],
  35435. messageSends: []
  35436. }, function ($methodClass){ return function (){
  35437. var self=this,$self=this;
  35438. return $self.right;
  35439. }; }),
  35440. $globals.AssignmentNode);
  35441. $core.addMethod(
  35442. $core.method({
  35443. selector: "right:",
  35444. protocol: "accessing",
  35445. args: ["aNode"],
  35446. source: "right: aNode\x0a\x09right := aNode",
  35447. referencedClasses: [],
  35448. pragmas: [],
  35449. messageSends: []
  35450. }, function ($methodClass){ return function (aNode){
  35451. var self=this,$self=this;
  35452. $self.right=aNode;
  35453. return self;
  35454. }; }),
  35455. $globals.AssignmentNode);
  35456. $core.addClass("BlockNode", $globals.ExpressionNode, ["parameters", "scope", "sequenceNode"], "Compiler-AST");
  35457. $globals.BlockNode.comment="I represent an block closure node.";
  35458. $core.addMethod(
  35459. $core.method({
  35460. selector: "acceptDagVisitor:",
  35461. protocol: "visiting",
  35462. args: ["aVisitor"],
  35463. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  35464. referencedClasses: [],
  35465. pragmas: [],
  35466. messageSends: ["visitBlockNode:"]
  35467. }, function ($methodClass){ return function (aVisitor){
  35468. var self=this,$self=this;
  35469. return $core.withContext(function($ctx1) {
  35470. return $recv(aVisitor)._visitBlockNode_(self);
  35471. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  35472. }; }),
  35473. $globals.BlockNode);
  35474. $core.addMethod(
  35475. $core.method({
  35476. selector: "dagChild",
  35477. protocol: "accessing",
  35478. args: [],
  35479. source: "dagChild\x0a\x09^ self sequenceNode",
  35480. referencedClasses: [],
  35481. pragmas: [],
  35482. messageSends: ["sequenceNode"]
  35483. }, function ($methodClass){ return function (){
  35484. var self=this,$self=this;
  35485. return $core.withContext(function($ctx1) {
  35486. return $self._sequenceNode();
  35487. }, function($ctx1) {$ctx1.fill(self,"dagChild",{})});
  35488. }; }),
  35489. $globals.BlockNode);
  35490. $core.addMethod(
  35491. $core.method({
  35492. selector: "parameters",
  35493. protocol: "accessing",
  35494. args: [],
  35495. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  35496. referencedClasses: ["Array"],
  35497. pragmas: [],
  35498. messageSends: ["ifNil:", "new"]
  35499. }, function ($methodClass){ return function (){
  35500. var self=this,$self=this;
  35501. return $core.withContext(function($ctx1) {
  35502. var $1;
  35503. $1=$self.parameters;
  35504. if($1 == null || $1.a$nil){
  35505. $self.parameters=$recv($globals.Array)._new();
  35506. return $self.parameters;
  35507. } else {
  35508. return $1;
  35509. }
  35510. }, function($ctx1) {$ctx1.fill(self,"parameters",{})});
  35511. }; }),
  35512. $globals.BlockNode);
  35513. $core.addMethod(
  35514. $core.method({
  35515. selector: "parameters:",
  35516. protocol: "accessing",
  35517. args: ["aCollection"],
  35518. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  35519. referencedClasses: [],
  35520. pragmas: [],
  35521. messageSends: []
  35522. }, function ($methodClass){ return function (aCollection){
  35523. var self=this,$self=this;
  35524. $self.parameters=aCollection;
  35525. return self;
  35526. }; }),
  35527. $globals.BlockNode);
  35528. $core.addMethod(
  35529. $core.method({
  35530. selector: "scope",
  35531. protocol: "accessing",
  35532. args: [],
  35533. source: "scope\x0a\x09^ scope",
  35534. referencedClasses: [],
  35535. pragmas: [],
  35536. messageSends: []
  35537. }, function ($methodClass){ return function (){
  35538. var self=this,$self=this;
  35539. return $self.scope;
  35540. }; }),
  35541. $globals.BlockNode);
  35542. $core.addMethod(
  35543. $core.method({
  35544. selector: "scope:",
  35545. protocol: "accessing",
  35546. args: ["aLexicalScope"],
  35547. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  35548. referencedClasses: [],
  35549. pragmas: [],
  35550. messageSends: []
  35551. }, function ($methodClass){ return function (aLexicalScope){
  35552. var self=this,$self=this;
  35553. $self.scope=aLexicalScope;
  35554. return self;
  35555. }; }),
  35556. $globals.BlockNode);
  35557. $core.addMethod(
  35558. $core.method({
  35559. selector: "sequenceNode",
  35560. protocol: "accessing",
  35561. args: [],
  35562. source: "sequenceNode\x0a\x09^ sequenceNode",
  35563. referencedClasses: [],
  35564. pragmas: [],
  35565. messageSends: []
  35566. }, function ($methodClass){ return function (){
  35567. var self=this,$self=this;
  35568. return $self.sequenceNode;
  35569. }; }),
  35570. $globals.BlockNode);
  35571. $core.addMethod(
  35572. $core.method({
  35573. selector: "sequenceNode:",
  35574. protocol: "accessing",
  35575. args: ["anObject"],
  35576. source: "sequenceNode: anObject\x0a\x09sequenceNode := anObject",
  35577. referencedClasses: [],
  35578. pragmas: [],
  35579. messageSends: []
  35580. }, function ($methodClass){ return function (anObject){
  35581. var self=this,$self=this;
  35582. $self.sequenceNode=anObject;
  35583. return self;
  35584. }; }),
  35585. $globals.BlockNode);
  35586. $core.addClass("CascadeNode", $globals.ExpressionNode, ["receiver"], "Compiler-AST");
  35587. $globals.CascadeNode.comment="I represent an cascade node.";
  35588. $core.addMethod(
  35589. $core.method({
  35590. selector: "acceptDagVisitor:",
  35591. protocol: "visiting",
  35592. args: ["aVisitor"],
  35593. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  35594. referencedClasses: [],
  35595. pragmas: [],
  35596. messageSends: ["visitCascadeNode:"]
  35597. }, function ($methodClass){ return function (aVisitor){
  35598. var self=this,$self=this;
  35599. return $core.withContext(function($ctx1) {
  35600. return $recv(aVisitor)._visitCascadeNode_(self);
  35601. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  35602. }; }),
  35603. $globals.CascadeNode);
  35604. $core.addMethod(
  35605. $core.method({
  35606. selector: "receiver",
  35607. protocol: "accessing",
  35608. args: [],
  35609. source: "receiver\x0a\x09^ receiver",
  35610. referencedClasses: [],
  35611. pragmas: [],
  35612. messageSends: []
  35613. }, function ($methodClass){ return function (){
  35614. var self=this,$self=this;
  35615. return $self.receiver;
  35616. }; }),
  35617. $globals.CascadeNode);
  35618. $core.addMethod(
  35619. $core.method({
  35620. selector: "receiver:",
  35621. protocol: "accessing",
  35622. args: ["aNode"],
  35623. source: "receiver: aNode\x0a\x09receiver := aNode",
  35624. referencedClasses: [],
  35625. pragmas: [],
  35626. messageSends: []
  35627. }, function ($methodClass){ return function (aNode){
  35628. var self=this,$self=this;
  35629. $self.receiver=aNode;
  35630. return self;
  35631. }; }),
  35632. $globals.CascadeNode);
  35633. $core.addClass("DynamicArrayNode", $globals.ExpressionNode, [], "Compiler-AST");
  35634. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  35635. $core.addMethod(
  35636. $core.method({
  35637. selector: "acceptDagVisitor:",
  35638. protocol: "visiting",
  35639. args: ["aVisitor"],
  35640. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  35641. referencedClasses: [],
  35642. pragmas: [],
  35643. messageSends: ["visitDynamicArrayNode:"]
  35644. }, function ($methodClass){ return function (aVisitor){
  35645. var self=this,$self=this;
  35646. return $core.withContext(function($ctx1) {
  35647. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  35648. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  35649. }; }),
  35650. $globals.DynamicArrayNode);
  35651. $core.addClass("DynamicDictionaryNode", $globals.ExpressionNode, [], "Compiler-AST");
  35652. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  35653. $core.addMethod(
  35654. $core.method({
  35655. selector: "acceptDagVisitor:",
  35656. protocol: "visiting",
  35657. args: ["aVisitor"],
  35658. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  35659. referencedClasses: [],
  35660. pragmas: [],
  35661. messageSends: ["visitDynamicDictionaryNode:"]
  35662. }, function ($methodClass){ return function (aVisitor){
  35663. var self=this,$self=this;
  35664. return $core.withContext(function($ctx1) {
  35665. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  35666. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  35667. }; }),
  35668. $globals.DynamicDictionaryNode);
  35669. $core.addClass("SendNode", $globals.ExpressionNode, ["selector", "arguments", "receiver", "index", "javaScriptSelector", "argumentSwitcher", "isSideEffect"], "Compiler-AST");
  35670. $globals.SendNode.comment="I represent an message send node.";
  35671. $core.addMethod(
  35672. $core.method({
  35673. selector: "acceptDagVisitor:",
  35674. protocol: "visiting",
  35675. args: ["aVisitor"],
  35676. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  35677. referencedClasses: [],
  35678. pragmas: [],
  35679. messageSends: ["visitSendNode:"]
  35680. }, function ($methodClass){ return function (aVisitor){
  35681. var self=this,$self=this;
  35682. return $core.withContext(function($ctx1) {
  35683. return $recv(aVisitor)._visitSendNode_(self);
  35684. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  35685. }; }),
  35686. $globals.SendNode);
  35687. $core.addMethod(
  35688. $core.method({
  35689. selector: "argumentSwitcher",
  35690. protocol: "accessing",
  35691. args: [],
  35692. source: "argumentSwitcher\x0a\x09^ argumentSwitcher",
  35693. referencedClasses: [],
  35694. pragmas: [],
  35695. messageSends: []
  35696. }, function ($methodClass){ return function (){
  35697. var self=this,$self=this;
  35698. return $self.argumentSwitcher;
  35699. }; }),
  35700. $globals.SendNode);
  35701. $core.addMethod(
  35702. $core.method({
  35703. selector: "argumentSwitcher:",
  35704. protocol: "accessing",
  35705. args: ["aJSFunction"],
  35706. source: "argumentSwitcher: aJSFunction\x0a\x09argumentSwitcher := aJSFunction",
  35707. referencedClasses: [],
  35708. pragmas: [],
  35709. messageSends: []
  35710. }, function ($methodClass){ return function (aJSFunction){
  35711. var self=this,$self=this;
  35712. $self.argumentSwitcher=aJSFunction;
  35713. return self;
  35714. }; }),
  35715. $globals.SendNode);
  35716. $core.addMethod(
  35717. $core.method({
  35718. selector: "arguments",
  35719. protocol: "accessing",
  35720. args: [],
  35721. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  35722. referencedClasses: [],
  35723. pragmas: [],
  35724. messageSends: ["ifNil:"]
  35725. }, function ($methodClass){ return function (){
  35726. var self=this,$self=this;
  35727. return $core.withContext(function($ctx1) {
  35728. var $1;
  35729. $1=$self.arguments;
  35730. if($1 == null || $1.a$nil){
  35731. $self.arguments=[];
  35732. return $self.arguments;
  35733. } else {
  35734. return $1;
  35735. }
  35736. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  35737. }; }),
  35738. $globals.SendNode);
  35739. $core.addMethod(
  35740. $core.method({
  35741. selector: "arguments:",
  35742. protocol: "accessing",
  35743. args: ["aCollection"],
  35744. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  35745. referencedClasses: [],
  35746. pragmas: [],
  35747. messageSends: []
  35748. }, function ($methodClass){ return function (aCollection){
  35749. var self=this,$self=this;
  35750. $self.arguments=aCollection;
  35751. return self;
  35752. }; }),
  35753. $globals.SendNode);
  35754. $core.addMethod(
  35755. $core.method({
  35756. selector: "beSideEffect",
  35757. protocol: "accessing",
  35758. args: [],
  35759. source: "beSideEffect\x0a\x09isSideEffect := true",
  35760. referencedClasses: [],
  35761. pragmas: [],
  35762. messageSends: []
  35763. }, function ($methodClass){ return function (){
  35764. var self=this,$self=this;
  35765. $self.isSideEffect=true;
  35766. return self;
  35767. }; }),
  35768. $globals.SendNode);
  35769. $core.addMethod(
  35770. $core.method({
  35771. selector: "dagChildren",
  35772. protocol: "accessing",
  35773. args: [],
  35774. source: "dagChildren\x0a\x09self receiver ifNil: [ ^ self arguments copy ].\x0a\x09\x0a\x09^ self arguments copyWithFirst: self receiver",
  35775. referencedClasses: [],
  35776. pragmas: [],
  35777. messageSends: ["ifNil:", "receiver", "copy", "arguments", "copyWithFirst:"]
  35778. }, function ($methodClass){ return function (){
  35779. var self=this,$self=this;
  35780. return $core.withContext(function($ctx1) {
  35781. var $1;
  35782. $1=[$self._receiver()
  35783. ,$ctx1.sendIdx["receiver"]=1
  35784. ][0];
  35785. if($1 == null || $1.a$nil){
  35786. return $recv([$self._arguments()
  35787. ,$ctx1.sendIdx["arguments"]=1
  35788. ][0])._copy();
  35789. } else {
  35790. $1;
  35791. }
  35792. return $recv($self._arguments())._copyWithFirst_($self._receiver());
  35793. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{})});
  35794. }; }),
  35795. $globals.SendNode);
  35796. $core.addMethod(
  35797. $core.method({
  35798. selector: "index",
  35799. protocol: "accessing",
  35800. args: [],
  35801. source: "index\x0a\x09^ index",
  35802. referencedClasses: [],
  35803. pragmas: [],
  35804. messageSends: []
  35805. }, function ($methodClass){ return function (){
  35806. var self=this,$self=this;
  35807. return $self.index;
  35808. }; }),
  35809. $globals.SendNode);
  35810. $core.addMethod(
  35811. $core.method({
  35812. selector: "index:",
  35813. protocol: "accessing",
  35814. args: ["anInteger"],
  35815. source: "index: anInteger\x0a\x09index := anInteger",
  35816. referencedClasses: [],
  35817. pragmas: [],
  35818. messageSends: []
  35819. }, function ($methodClass){ return function (anInteger){
  35820. var self=this,$self=this;
  35821. $self.index=anInteger;
  35822. return self;
  35823. }; }),
  35824. $globals.SendNode);
  35825. $core.addMethod(
  35826. $core.method({
  35827. selector: "isNavigationNode",
  35828. protocol: "testing",
  35829. args: [],
  35830. source: "isNavigationNode\x0a\x09^ true",
  35831. referencedClasses: [],
  35832. pragmas: [],
  35833. messageSends: []
  35834. }, function ($methodClass){ return function (){
  35835. var self=this,$self=this;
  35836. return true;
  35837. }; }),
  35838. $globals.SendNode);
  35839. $core.addMethod(
  35840. $core.method({
  35841. selector: "isSideEffect",
  35842. protocol: "accessing",
  35843. args: [],
  35844. source: "isSideEffect\x0a\x09^ isSideEffect ifNil: [ false ]",
  35845. referencedClasses: [],
  35846. pragmas: [],
  35847. messageSends: ["ifNil:"]
  35848. }, function ($methodClass){ return function (){
  35849. var self=this,$self=this;
  35850. return $core.withContext(function($ctx1) {
  35851. var $1;
  35852. $1=$self.isSideEffect;
  35853. if($1 == null || $1.a$nil){
  35854. return false;
  35855. } else {
  35856. return $1;
  35857. }
  35858. }, function($ctx1) {$ctx1.fill(self,"isSideEffect",{})});
  35859. }; }),
  35860. $globals.SendNode);
  35861. $core.addMethod(
  35862. $core.method({
  35863. selector: "javaScriptSelector",
  35864. protocol: "accessing",
  35865. args: [],
  35866. source: "javaScriptSelector\x0a\x09^ javaScriptSelector",
  35867. referencedClasses: [],
  35868. pragmas: [],
  35869. messageSends: []
  35870. }, function ($methodClass){ return function (){
  35871. var self=this,$self=this;
  35872. return $self.javaScriptSelector;
  35873. }; }),
  35874. $globals.SendNode);
  35875. $core.addMethod(
  35876. $core.method({
  35877. selector: "javaScriptSelector:",
  35878. protocol: "accessing",
  35879. args: ["aString"],
  35880. source: "javaScriptSelector: aString\x0a\x09javaScriptSelector := aString",
  35881. referencedClasses: [],
  35882. pragmas: [],
  35883. messageSends: []
  35884. }, function ($methodClass){ return function (aString){
  35885. var self=this,$self=this;
  35886. $self.javaScriptSelector=aString;
  35887. return self;
  35888. }; }),
  35889. $globals.SendNode);
  35890. $core.addMethod(
  35891. $core.method({
  35892. selector: "navigationLink",
  35893. protocol: "accessing",
  35894. args: [],
  35895. source: "navigationLink\x0a\x09^ self selector",
  35896. referencedClasses: [],
  35897. pragmas: [],
  35898. messageSends: ["selector"]
  35899. }, function ($methodClass){ return function (){
  35900. var self=this,$self=this;
  35901. return $core.withContext(function($ctx1) {
  35902. return $self._selector();
  35903. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{})});
  35904. }; }),
  35905. $globals.SendNode);
  35906. $core.addMethod(
  35907. $core.method({
  35908. selector: "receiver",
  35909. protocol: "accessing",
  35910. args: [],
  35911. source: "receiver\x0a\x09^ receiver",
  35912. referencedClasses: [],
  35913. pragmas: [],
  35914. messageSends: []
  35915. }, function ($methodClass){ return function (){
  35916. var self=this,$self=this;
  35917. return $self.receiver;
  35918. }; }),
  35919. $globals.SendNode);
  35920. $core.addMethod(
  35921. $core.method({
  35922. selector: "receiver:",
  35923. protocol: "accessing",
  35924. args: ["aNode"],
  35925. source: "receiver: aNode\x0a\x09receiver := aNode",
  35926. referencedClasses: [],
  35927. pragmas: [],
  35928. messageSends: []
  35929. }, function ($methodClass){ return function (aNode){
  35930. var self=this,$self=this;
  35931. $self.receiver=aNode;
  35932. return self;
  35933. }; }),
  35934. $globals.SendNode);
  35935. $core.addMethod(
  35936. $core.method({
  35937. selector: "selector",
  35938. protocol: "accessing",
  35939. args: [],
  35940. source: "selector\x0a\x09^ selector",
  35941. referencedClasses: [],
  35942. pragmas: [],
  35943. messageSends: []
  35944. }, function ($methodClass){ return function (){
  35945. var self=this,$self=this;
  35946. return $self.selector;
  35947. }; }),
  35948. $globals.SendNode);
  35949. $core.addMethod(
  35950. $core.method({
  35951. selector: "selector:",
  35952. protocol: "accessing",
  35953. args: ["aString"],
  35954. source: "selector: aString\x0a\x09selector := aString",
  35955. referencedClasses: [],
  35956. pragmas: [],
  35957. messageSends: []
  35958. }, function ($methodClass){ return function (aString){
  35959. var self=this,$self=this;
  35960. $self.selector=aString;
  35961. return self;
  35962. }; }),
  35963. $globals.SendNode);
  35964. $core.addMethod(
  35965. $core.method({
  35966. selector: "superSend",
  35967. protocol: "accessing",
  35968. args: [],
  35969. source: "superSend\x0a\x09^ self receiver ifNil: [ false ] ifNotNil: [ :recv | recv isSuper ]",
  35970. referencedClasses: [],
  35971. pragmas: [],
  35972. messageSends: ["ifNil:ifNotNil:", "receiver", "isSuper"]
  35973. }, function ($methodClass){ return function (){
  35974. var self=this,$self=this;
  35975. return $core.withContext(function($ctx1) {
  35976. var $1;
  35977. $1=$self._receiver();
  35978. if($1 == null || $1.a$nil){
  35979. return false;
  35980. } else {
  35981. var recv;
  35982. recv=$1;
  35983. return $recv(recv)._isSuper();
  35984. }
  35985. }, function($ctx1) {$ctx1.fill(self,"superSend",{})});
  35986. }; }),
  35987. $globals.SendNode);
  35988. $core.addClass("ValueNode", $globals.ExpressionNode, ["value"], "Compiler-AST");
  35989. $globals.ValueNode.comment="I represent a value node.";
  35990. $core.addMethod(
  35991. $core.method({
  35992. selector: "acceptDagVisitor:",
  35993. protocol: "visiting",
  35994. args: ["aVisitor"],
  35995. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  35996. referencedClasses: [],
  35997. pragmas: [],
  35998. messageSends: ["visitValueNode:"]
  35999. }, function ($methodClass){ return function (aVisitor){
  36000. var self=this,$self=this;
  36001. return $core.withContext(function($ctx1) {
  36002. return $recv(aVisitor)._visitValueNode_(self);
  36003. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36004. }; }),
  36005. $globals.ValueNode);
  36006. $core.addMethod(
  36007. $core.method({
  36008. selector: "isIdempotent",
  36009. protocol: "testing",
  36010. args: [],
  36011. source: "isIdempotent\x0a\x09^ self value isImmutable",
  36012. referencedClasses: [],
  36013. pragmas: [],
  36014. messageSends: ["isImmutable", "value"]
  36015. }, function ($methodClass){ return function (){
  36016. var self=this,$self=this;
  36017. return $core.withContext(function($ctx1) {
  36018. return $recv($self._value())._isImmutable();
  36019. }, function($ctx1) {$ctx1.fill(self,"isIdempotent",{})});
  36020. }; }),
  36021. $globals.ValueNode);
  36022. $core.addMethod(
  36023. $core.method({
  36024. selector: "value",
  36025. protocol: "accessing",
  36026. args: [],
  36027. source: "value\x0a\x09^ value",
  36028. referencedClasses: [],
  36029. pragmas: [],
  36030. messageSends: []
  36031. }, function ($methodClass){ return function (){
  36032. var self=this,$self=this;
  36033. return $self.value;
  36034. }; }),
  36035. $globals.ValueNode);
  36036. $core.addMethod(
  36037. $core.method({
  36038. selector: "value:",
  36039. protocol: "accessing",
  36040. args: ["anObject"],
  36041. source: "value: anObject\x0a\x09value := anObject",
  36042. referencedClasses: [],
  36043. pragmas: [],
  36044. messageSends: []
  36045. }, function ($methodClass){ return function (anObject){
  36046. var self=this,$self=this;
  36047. $self.value=anObject;
  36048. return self;
  36049. }; }),
  36050. $globals.ValueNode);
  36051. $core.addClass("VariableNode", $globals.ExpressionNode, ["identifier", "assigned", "binding"], "Compiler-AST");
  36052. $globals.VariableNode.comment="I represent an variable node.";
  36053. $core.addMethod(
  36054. $core.method({
  36055. selector: "acceptDagVisitor:",
  36056. protocol: "visiting",
  36057. args: ["aVisitor"],
  36058. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  36059. referencedClasses: [],
  36060. pragmas: [],
  36061. messageSends: ["visitVariableNode:"]
  36062. }, function ($methodClass){ return function (aVisitor){
  36063. var self=this,$self=this;
  36064. return $core.withContext(function($ctx1) {
  36065. return $recv(aVisitor)._visitVariableNode_(self);
  36066. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36067. }; }),
  36068. $globals.VariableNode);
  36069. $core.addMethod(
  36070. $core.method({
  36071. selector: "alias",
  36072. protocol: "accessing",
  36073. args: [],
  36074. source: "alias\x0a\x09^ self binding alias",
  36075. referencedClasses: [],
  36076. pragmas: [],
  36077. messageSends: ["alias", "binding"]
  36078. }, function ($methodClass){ return function (){
  36079. var self=this,$self=this;
  36080. return $core.withContext(function($ctx1) {
  36081. return $recv($self._binding())._alias();
  36082. }, function($ctx1) {$ctx1.fill(self,"alias",{})});
  36083. }; }),
  36084. $globals.VariableNode);
  36085. $core.addMethod(
  36086. $core.method({
  36087. selector: "assigned",
  36088. protocol: "accessing",
  36089. args: [],
  36090. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  36091. referencedClasses: [],
  36092. pragmas: [],
  36093. messageSends: ["ifNil:"]
  36094. }, function ($methodClass){ return function (){
  36095. var self=this,$self=this;
  36096. return $core.withContext(function($ctx1) {
  36097. var $1;
  36098. $1=$self.assigned;
  36099. if($1 == null || $1.a$nil){
  36100. return false;
  36101. } else {
  36102. return $1;
  36103. }
  36104. }, function($ctx1) {$ctx1.fill(self,"assigned",{})});
  36105. }; }),
  36106. $globals.VariableNode);
  36107. $core.addMethod(
  36108. $core.method({
  36109. selector: "assigned:",
  36110. protocol: "accessing",
  36111. args: ["aBoolean"],
  36112. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  36113. referencedClasses: [],
  36114. pragmas: [],
  36115. messageSends: []
  36116. }, function ($methodClass){ return function (aBoolean){
  36117. var self=this,$self=this;
  36118. $self.assigned=aBoolean;
  36119. return self;
  36120. }; }),
  36121. $globals.VariableNode);
  36122. $core.addMethod(
  36123. $core.method({
  36124. selector: "binding",
  36125. protocol: "accessing",
  36126. args: [],
  36127. source: "binding\x0a\x09^ binding",
  36128. referencedClasses: [],
  36129. pragmas: [],
  36130. messageSends: []
  36131. }, function ($methodClass){ return function (){
  36132. var self=this,$self=this;
  36133. return $self.binding;
  36134. }; }),
  36135. $globals.VariableNode);
  36136. $core.addMethod(
  36137. $core.method({
  36138. selector: "binding:",
  36139. protocol: "accessing",
  36140. args: ["aScopeVar"],
  36141. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  36142. referencedClasses: [],
  36143. pragmas: [],
  36144. messageSends: []
  36145. }, function ($methodClass){ return function (aScopeVar){
  36146. var self=this,$self=this;
  36147. $self.binding=aScopeVar;
  36148. return self;
  36149. }; }),
  36150. $globals.VariableNode);
  36151. $core.addMethod(
  36152. $core.method({
  36153. selector: "identifier",
  36154. protocol: "accessing",
  36155. args: [],
  36156. source: "identifier\x0a\x09^ identifier",
  36157. referencedClasses: [],
  36158. pragmas: [],
  36159. messageSends: []
  36160. }, function ($methodClass){ return function (){
  36161. var self=this,$self=this;
  36162. return $self.identifier;
  36163. }; }),
  36164. $globals.VariableNode);
  36165. $core.addMethod(
  36166. $core.method({
  36167. selector: "identifier:",
  36168. protocol: "accessing",
  36169. args: ["anObject"],
  36170. source: "identifier: anObject\x0a\x09identifier := anObject",
  36171. referencedClasses: [],
  36172. pragmas: [],
  36173. messageSends: []
  36174. }, function ($methodClass){ return function (anObject){
  36175. var self=this,$self=this;
  36176. $self.identifier=anObject;
  36177. return self;
  36178. }; }),
  36179. $globals.VariableNode);
  36180. $core.addMethod(
  36181. $core.method({
  36182. selector: "isAssignable",
  36183. protocol: "testing",
  36184. args: [],
  36185. source: "isAssignable\x0a\x09^ self binding isAssignable",
  36186. referencedClasses: [],
  36187. pragmas: [],
  36188. messageSends: ["isAssignable", "binding"]
  36189. }, function ($methodClass){ return function (){
  36190. var self=this,$self=this;
  36191. return $core.withContext(function($ctx1) {
  36192. return $recv($self._binding())._isAssignable();
  36193. }, function($ctx1) {$ctx1.fill(self,"isAssignable",{})});
  36194. }; }),
  36195. $globals.VariableNode);
  36196. $core.addMethod(
  36197. $core.method({
  36198. selector: "isIdempotent",
  36199. protocol: "testing",
  36200. args: [],
  36201. source: "isIdempotent\x0a\x09^ self binding isIdempotent",
  36202. referencedClasses: [],
  36203. pragmas: [],
  36204. messageSends: ["isIdempotent", "binding"]
  36205. }, function ($methodClass){ return function (){
  36206. var self=this,$self=this;
  36207. return $core.withContext(function($ctx1) {
  36208. return $recv($self._binding())._isIdempotent();
  36209. }, function($ctx1) {$ctx1.fill(self,"isIdempotent",{})});
  36210. }; }),
  36211. $globals.VariableNode);
  36212. $core.addMethod(
  36213. $core.method({
  36214. selector: "isImmutable",
  36215. protocol: "testing",
  36216. args: [],
  36217. source: "isImmutable\x0a\x09self deprecatedAPI: 'Use #isIdempotent / #isAssignable not instead.'.\x0a\x09^ self isIdempotent \x22to be consistent with super\x22",
  36218. referencedClasses: [],
  36219. pragmas: [],
  36220. messageSends: ["deprecatedAPI:", "isIdempotent"]
  36221. }, function ($methodClass){ return function (){
  36222. var self=this,$self=this;
  36223. return $core.withContext(function($ctx1) {
  36224. $self._deprecatedAPI_("Use #isIdempotent / #isAssignable not instead.");
  36225. return $self._isIdempotent();
  36226. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{})});
  36227. }; }),
  36228. $globals.VariableNode);
  36229. $core.addMethod(
  36230. $core.method({
  36231. selector: "isNavigationNode",
  36232. protocol: "testing",
  36233. args: [],
  36234. source: "isNavigationNode\x0a\x09^ true",
  36235. referencedClasses: [],
  36236. pragmas: [],
  36237. messageSends: []
  36238. }, function ($methodClass){ return function (){
  36239. var self=this,$self=this;
  36240. return true;
  36241. }; }),
  36242. $globals.VariableNode);
  36243. $core.addMethod(
  36244. $core.method({
  36245. selector: "isSuper",
  36246. protocol: "testing",
  36247. args: [],
  36248. source: "isSuper\x0a\x09^ self binding isSuper",
  36249. referencedClasses: [],
  36250. pragmas: [],
  36251. messageSends: ["isSuper", "binding"]
  36252. }, function ($methodClass){ return function (){
  36253. var self=this,$self=this;
  36254. return $core.withContext(function($ctx1) {
  36255. return $recv($self._binding())._isSuper();
  36256. }, function($ctx1) {$ctx1.fill(self,"isSuper",{})});
  36257. }; }),
  36258. $globals.VariableNode);
  36259. $core.addMethod(
  36260. $core.method({
  36261. selector: "navigationLink",
  36262. protocol: "accessing",
  36263. args: [],
  36264. source: "navigationLink\x0a\x09^ self identifier",
  36265. referencedClasses: [],
  36266. pragmas: [],
  36267. messageSends: ["identifier"]
  36268. }, function ($methodClass){ return function (){
  36269. var self=this,$self=this;
  36270. return $core.withContext(function($ctx1) {
  36271. return $self._identifier();
  36272. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{})});
  36273. }; }),
  36274. $globals.VariableNode);
  36275. $core.addMethod(
  36276. $core.method({
  36277. selector: "value",
  36278. protocol: "accessing",
  36279. args: [],
  36280. source: "value\x0a\x09self deprecatedAPI: 'Use #identifier instead.'.\x0a\x09^ self identifier",
  36281. referencedClasses: [],
  36282. pragmas: [],
  36283. messageSends: ["deprecatedAPI:", "identifier"]
  36284. }, function ($methodClass){ return function (){
  36285. var self=this,$self=this;
  36286. return $core.withContext(function($ctx1) {
  36287. $self._deprecatedAPI_("Use #identifier instead.");
  36288. return $self._identifier();
  36289. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  36290. }; }),
  36291. $globals.VariableNode);
  36292. $core.addMethod(
  36293. $core.method({
  36294. selector: "value:",
  36295. protocol: "accessing",
  36296. args: ["anObject"],
  36297. source: "value: anObject\x0a\x09self deprecatedAPI: 'Use #identifier: instead.'.\x0a\x09self identifier: anObject",
  36298. referencedClasses: [],
  36299. pragmas: [],
  36300. messageSends: ["deprecatedAPI:", "identifier:"]
  36301. }, function ($methodClass){ return function (anObject){
  36302. var self=this,$self=this;
  36303. return $core.withContext(function($ctx1) {
  36304. $self._deprecatedAPI_("Use #identifier: instead.");
  36305. $self._identifier_(anObject);
  36306. return self;
  36307. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  36308. }; }),
  36309. $globals.VariableNode);
  36310. $core.addClass("JSStatementNode", $globals.ASTNode, [], "Compiler-AST");
  36311. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  36312. $core.addMethod(
  36313. $core.method({
  36314. selector: "acceptDagVisitor:",
  36315. protocol: "visiting",
  36316. args: ["aVisitor"],
  36317. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  36318. referencedClasses: [],
  36319. pragmas: [],
  36320. messageSends: ["visitJSStatementNode:"]
  36321. }, function ($methodClass){ return function (aVisitor){
  36322. var self=this,$self=this;
  36323. return $core.withContext(function($ctx1) {
  36324. return $recv(aVisitor)._visitJSStatementNode_(self);
  36325. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36326. }; }),
  36327. $globals.JSStatementNode);
  36328. $core.addClass("MethodNode", $globals.ASTNode, ["selector", "arguments", "pragmas", "scope", "classReferences", "sendIndexes", "sequenceNode"], "Compiler-AST");
  36329. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  36330. $core.addMethod(
  36331. $core.method({
  36332. selector: "acceptDagVisitor:",
  36333. protocol: "visiting",
  36334. args: ["aVisitor"],
  36335. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  36336. referencedClasses: [],
  36337. pragmas: [],
  36338. messageSends: ["visitMethodNode:"]
  36339. }, function ($methodClass){ return function (aVisitor){
  36340. var self=this,$self=this;
  36341. return $core.withContext(function($ctx1) {
  36342. return $recv(aVisitor)._visitMethodNode_(self);
  36343. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36344. }; }),
  36345. $globals.MethodNode);
  36346. $core.addMethod(
  36347. $core.method({
  36348. selector: "arguments",
  36349. protocol: "accessing",
  36350. args: [],
  36351. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  36352. referencedClasses: [],
  36353. pragmas: [],
  36354. messageSends: ["ifNil:"]
  36355. }, function ($methodClass){ return function (){
  36356. var self=this,$self=this;
  36357. return $core.withContext(function($ctx1) {
  36358. var $1;
  36359. $1=$self.arguments;
  36360. if($1 == null || $1.a$nil){
  36361. return [];
  36362. } else {
  36363. return $1;
  36364. }
  36365. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  36366. }; }),
  36367. $globals.MethodNode);
  36368. $core.addMethod(
  36369. $core.method({
  36370. selector: "arguments:",
  36371. protocol: "accessing",
  36372. args: ["aCollection"],
  36373. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  36374. referencedClasses: [],
  36375. pragmas: [],
  36376. messageSends: []
  36377. }, function ($methodClass){ return function (aCollection){
  36378. var self=this,$self=this;
  36379. $self.arguments=aCollection;
  36380. return self;
  36381. }; }),
  36382. $globals.MethodNode);
  36383. $core.addMethod(
  36384. $core.method({
  36385. selector: "classReferences",
  36386. protocol: "accessing",
  36387. args: [],
  36388. source: "classReferences\x0a\x09^ classReferences",
  36389. referencedClasses: [],
  36390. pragmas: [],
  36391. messageSends: []
  36392. }, function ($methodClass){ return function (){
  36393. var self=this,$self=this;
  36394. return $self.classReferences;
  36395. }; }),
  36396. $globals.MethodNode);
  36397. $core.addMethod(
  36398. $core.method({
  36399. selector: "classReferences:",
  36400. protocol: "accessing",
  36401. args: ["aCollection"],
  36402. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  36403. referencedClasses: [],
  36404. pragmas: [],
  36405. messageSends: []
  36406. }, function ($methodClass){ return function (aCollection){
  36407. var self=this,$self=this;
  36408. $self.classReferences=aCollection;
  36409. return self;
  36410. }; }),
  36411. $globals.MethodNode);
  36412. $core.addMethod(
  36413. $core.method({
  36414. selector: "dagChild",
  36415. protocol: "accessing",
  36416. args: [],
  36417. source: "dagChild\x0a\x09^ self sequenceNode",
  36418. referencedClasses: [],
  36419. pragmas: [],
  36420. messageSends: ["sequenceNode"]
  36421. }, function ($methodClass){ return function (){
  36422. var self=this,$self=this;
  36423. return $core.withContext(function($ctx1) {
  36424. return $self._sequenceNode();
  36425. }, function($ctx1) {$ctx1.fill(self,"dagChild",{})});
  36426. }; }),
  36427. $globals.MethodNode);
  36428. $core.addMethod(
  36429. $core.method({
  36430. selector: "messageSends",
  36431. protocol: "accessing",
  36432. args: [],
  36433. source: "messageSends\x0a\x09^ self sendIndexes keys",
  36434. referencedClasses: [],
  36435. pragmas: [],
  36436. messageSends: ["keys", "sendIndexes"]
  36437. }, function ($methodClass){ return function (){
  36438. var self=this,$self=this;
  36439. return $core.withContext(function($ctx1) {
  36440. return $recv($self._sendIndexes())._keys();
  36441. }, function($ctx1) {$ctx1.fill(self,"messageSends",{})});
  36442. }; }),
  36443. $globals.MethodNode);
  36444. $core.addMethod(
  36445. $core.method({
  36446. selector: "method",
  36447. protocol: "accessing",
  36448. args: [],
  36449. source: "method\x0a\x09^ self",
  36450. referencedClasses: [],
  36451. pragmas: [],
  36452. messageSends: []
  36453. }, function ($methodClass){ return function (){
  36454. var self=this,$self=this;
  36455. return self;
  36456. }; }),
  36457. $globals.MethodNode);
  36458. $core.addMethod(
  36459. $core.method({
  36460. selector: "pragmas",
  36461. protocol: "accessing",
  36462. args: [],
  36463. source: "pragmas\x0a\x09^ pragmas ifNil: [ #() ]",
  36464. referencedClasses: [],
  36465. pragmas: [],
  36466. messageSends: ["ifNil:"]
  36467. }, function ($methodClass){ return function (){
  36468. var self=this,$self=this;
  36469. return $core.withContext(function($ctx1) {
  36470. var $1;
  36471. $1=$self.pragmas;
  36472. if($1 == null || $1.a$nil){
  36473. return [];
  36474. } else {
  36475. return $1;
  36476. }
  36477. }, function($ctx1) {$ctx1.fill(self,"pragmas",{})});
  36478. }; }),
  36479. $globals.MethodNode);
  36480. $core.addMethod(
  36481. $core.method({
  36482. selector: "pragmas:",
  36483. protocol: "accessing",
  36484. args: ["aCollection"],
  36485. source: "pragmas: aCollection\x0a\x09pragmas := aCollection",
  36486. referencedClasses: [],
  36487. pragmas: [],
  36488. messageSends: []
  36489. }, function ($methodClass){ return function (aCollection){
  36490. var self=this,$self=this;
  36491. $self.pragmas=aCollection;
  36492. return self;
  36493. }; }),
  36494. $globals.MethodNode);
  36495. $core.addMethod(
  36496. $core.method({
  36497. selector: "scope",
  36498. protocol: "accessing",
  36499. args: [],
  36500. source: "scope\x0a\x09^ scope",
  36501. referencedClasses: [],
  36502. pragmas: [],
  36503. messageSends: []
  36504. }, function ($methodClass){ return function (){
  36505. var self=this,$self=this;
  36506. return $self.scope;
  36507. }; }),
  36508. $globals.MethodNode);
  36509. $core.addMethod(
  36510. $core.method({
  36511. selector: "scope:",
  36512. protocol: "accessing",
  36513. args: ["aMethodScope"],
  36514. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  36515. referencedClasses: [],
  36516. pragmas: [],
  36517. messageSends: []
  36518. }, function ($methodClass){ return function (aMethodScope){
  36519. var self=this,$self=this;
  36520. $self.scope=aMethodScope;
  36521. return self;
  36522. }; }),
  36523. $globals.MethodNode);
  36524. $core.addMethod(
  36525. $core.method({
  36526. selector: "selector",
  36527. protocol: "accessing",
  36528. args: [],
  36529. source: "selector\x0a\x09^ selector",
  36530. referencedClasses: [],
  36531. pragmas: [],
  36532. messageSends: []
  36533. }, function ($methodClass){ return function (){
  36534. var self=this,$self=this;
  36535. return $self.selector;
  36536. }; }),
  36537. $globals.MethodNode);
  36538. $core.addMethod(
  36539. $core.method({
  36540. selector: "selector:",
  36541. protocol: "accessing",
  36542. args: ["aString"],
  36543. source: "selector: aString\x0a\x09selector := aString",
  36544. referencedClasses: [],
  36545. pragmas: [],
  36546. messageSends: []
  36547. }, function ($methodClass){ return function (aString){
  36548. var self=this,$self=this;
  36549. $self.selector=aString;
  36550. return self;
  36551. }; }),
  36552. $globals.MethodNode);
  36553. $core.addMethod(
  36554. $core.method({
  36555. selector: "sendIndexes",
  36556. protocol: "accessing",
  36557. args: [],
  36558. source: "sendIndexes\x0a\x09^ sendIndexes",
  36559. referencedClasses: [],
  36560. pragmas: [],
  36561. messageSends: []
  36562. }, function ($methodClass){ return function (){
  36563. var self=this,$self=this;
  36564. return $self.sendIndexes;
  36565. }; }),
  36566. $globals.MethodNode);
  36567. $core.addMethod(
  36568. $core.method({
  36569. selector: "sendIndexes:",
  36570. protocol: "accessing",
  36571. args: ["aDictionary"],
  36572. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  36573. referencedClasses: [],
  36574. pragmas: [],
  36575. messageSends: []
  36576. }, function ($methodClass){ return function (aDictionary){
  36577. var self=this,$self=this;
  36578. $self.sendIndexes=aDictionary;
  36579. return self;
  36580. }; }),
  36581. $globals.MethodNode);
  36582. $core.addMethod(
  36583. $core.method({
  36584. selector: "sequenceNode",
  36585. protocol: "accessing",
  36586. args: [],
  36587. source: "sequenceNode\x0a\x09^ sequenceNode",
  36588. referencedClasses: [],
  36589. pragmas: [],
  36590. messageSends: []
  36591. }, function ($methodClass){ return function (){
  36592. var self=this,$self=this;
  36593. return $self.sequenceNode;
  36594. }; }),
  36595. $globals.MethodNode);
  36596. $core.addMethod(
  36597. $core.method({
  36598. selector: "sequenceNode:",
  36599. protocol: "accessing",
  36600. args: ["aSequenceNode"],
  36601. source: "sequenceNode: aSequenceNode\x0a\x09sequenceNode := aSequenceNode",
  36602. referencedClasses: [],
  36603. pragmas: [],
  36604. messageSends: []
  36605. }, function ($methodClass){ return function (aSequenceNode){
  36606. var self=this,$self=this;
  36607. $self.sequenceNode=aSequenceNode;
  36608. return self;
  36609. }; }),
  36610. $globals.MethodNode);
  36611. $core.addClass("ReturnNode", $globals.ASTNode, ["scope", "expression"], "Compiler-AST");
  36612. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  36613. $core.addMethod(
  36614. $core.method({
  36615. selector: "acceptDagVisitor:",
  36616. protocol: "visiting",
  36617. args: ["aVisitor"],
  36618. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  36619. referencedClasses: [],
  36620. pragmas: [],
  36621. messageSends: ["visitReturnNode:"]
  36622. }, function ($methodClass){ return function (aVisitor){
  36623. var self=this,$self=this;
  36624. return $core.withContext(function($ctx1) {
  36625. return $recv(aVisitor)._visitReturnNode_(self);
  36626. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36627. }; }),
  36628. $globals.ReturnNode);
  36629. $core.addMethod(
  36630. $core.method({
  36631. selector: "dagChild",
  36632. protocol: "accessing",
  36633. args: [],
  36634. source: "dagChild\x0a\x09^ self expression",
  36635. referencedClasses: [],
  36636. pragmas: [],
  36637. messageSends: ["expression"]
  36638. }, function ($methodClass){ return function (){
  36639. var self=this,$self=this;
  36640. return $core.withContext(function($ctx1) {
  36641. return $self._expression();
  36642. }, function($ctx1) {$ctx1.fill(self,"dagChild",{})});
  36643. }; }),
  36644. $globals.ReturnNode);
  36645. $core.addMethod(
  36646. $core.method({
  36647. selector: "expression",
  36648. protocol: "accessing",
  36649. args: [],
  36650. source: "expression\x0a\x09^ expression ifNil: [ nodes first ]",
  36651. referencedClasses: [],
  36652. pragmas: [],
  36653. messageSends: ["ifNil:", "first"]
  36654. }, function ($methodClass){ return function (){
  36655. var self=this,$self=this;
  36656. return $core.withContext(function($ctx1) {
  36657. var $1;
  36658. $1=$self.expression;
  36659. if($1 == null || $1.a$nil){
  36660. return $recv($self.nodes)._first();
  36661. } else {
  36662. return $1;
  36663. }
  36664. }, function($ctx1) {$ctx1.fill(self,"expression",{})});
  36665. }; }),
  36666. $globals.ReturnNode);
  36667. $core.addMethod(
  36668. $core.method({
  36669. selector: "expression:",
  36670. protocol: "accessing",
  36671. args: ["anObject"],
  36672. source: "expression: anObject\x0a\x09expression := anObject",
  36673. referencedClasses: [],
  36674. pragmas: [],
  36675. messageSends: []
  36676. }, function ($methodClass){ return function (anObject){
  36677. var self=this,$self=this;
  36678. $self.expression=anObject;
  36679. return self;
  36680. }; }),
  36681. $globals.ReturnNode);
  36682. $core.addMethod(
  36683. $core.method({
  36684. selector: "isReturnNode",
  36685. protocol: "testing",
  36686. args: [],
  36687. source: "isReturnNode\x0a\x09^ true",
  36688. referencedClasses: [],
  36689. pragmas: [],
  36690. messageSends: []
  36691. }, function ($methodClass){ return function (){
  36692. var self=this,$self=this;
  36693. return true;
  36694. }; }),
  36695. $globals.ReturnNode);
  36696. $core.addMethod(
  36697. $core.method({
  36698. selector: "nonLocalReturn",
  36699. protocol: "testing",
  36700. args: [],
  36701. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  36702. referencedClasses: [],
  36703. pragmas: [],
  36704. messageSends: ["not", "isMethodScope", "scope"]
  36705. }, function ($methodClass){ return function (){
  36706. var self=this,$self=this;
  36707. return $core.withContext(function($ctx1) {
  36708. return $recv($recv($self._scope())._isMethodScope())._not();
  36709. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{})});
  36710. }; }),
  36711. $globals.ReturnNode);
  36712. $core.addMethod(
  36713. $core.method({
  36714. selector: "scope",
  36715. protocol: "accessing",
  36716. args: [],
  36717. source: "scope\x0a\x09^ scope",
  36718. referencedClasses: [],
  36719. pragmas: [],
  36720. messageSends: []
  36721. }, function ($methodClass){ return function (){
  36722. var self=this,$self=this;
  36723. return $self.scope;
  36724. }; }),
  36725. $globals.ReturnNode);
  36726. $core.addMethod(
  36727. $core.method({
  36728. selector: "scope:",
  36729. protocol: "accessing",
  36730. args: ["aLexicalScope"],
  36731. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  36732. referencedClasses: [],
  36733. pragmas: [],
  36734. messageSends: []
  36735. }, function ($methodClass){ return function (aLexicalScope){
  36736. var self=this,$self=this;
  36737. $self.scope=aLexicalScope;
  36738. return self;
  36739. }; }),
  36740. $globals.ReturnNode);
  36741. $core.addClass("SequenceNode", $globals.ASTNode, ["temps"], "Compiler-AST");
  36742. $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).";
  36743. $core.addMethod(
  36744. $core.method({
  36745. selector: "acceptDagVisitor:",
  36746. protocol: "visiting",
  36747. args: ["aVisitor"],
  36748. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  36749. referencedClasses: [],
  36750. pragmas: [],
  36751. messageSends: ["visitSequenceNode:"]
  36752. }, function ($methodClass){ return function (aVisitor){
  36753. var self=this,$self=this;
  36754. return $core.withContext(function($ctx1) {
  36755. return $recv(aVisitor)._visitSequenceNode_(self);
  36756. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36757. }; }),
  36758. $globals.SequenceNode);
  36759. $core.addMethod(
  36760. $core.method({
  36761. selector: "temps",
  36762. protocol: "accessing",
  36763. args: [],
  36764. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  36765. referencedClasses: [],
  36766. pragmas: [],
  36767. messageSends: ["ifNil:"]
  36768. }, function ($methodClass){ return function (){
  36769. var self=this,$self=this;
  36770. return $core.withContext(function($ctx1) {
  36771. var $1;
  36772. $1=$self.temps;
  36773. if($1 == null || $1.a$nil){
  36774. return [];
  36775. } else {
  36776. return $1;
  36777. }
  36778. }, function($ctx1) {$ctx1.fill(self,"temps",{})});
  36779. }; }),
  36780. $globals.SequenceNode);
  36781. $core.addMethod(
  36782. $core.method({
  36783. selector: "temps:",
  36784. protocol: "accessing",
  36785. args: ["aCollection"],
  36786. source: "temps: aCollection\x0a\x09temps := aCollection",
  36787. referencedClasses: [],
  36788. pragmas: [],
  36789. messageSends: []
  36790. }, function ($methodClass){ return function (aCollection){
  36791. var self=this,$self=this;
  36792. $self.temps=aCollection;
  36793. return self;
  36794. }; }),
  36795. $globals.SequenceNode);
  36796. $core.addClass("BlockSequenceNode", $globals.SequenceNode, [], "Compiler-AST");
  36797. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  36798. $core.addMethod(
  36799. $core.method({
  36800. selector: "acceptDagVisitor:",
  36801. protocol: "visiting",
  36802. args: ["aVisitor"],
  36803. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  36804. referencedClasses: [],
  36805. pragmas: [],
  36806. messageSends: ["visitBlockSequenceNode:"]
  36807. }, function ($methodClass){ return function (aVisitor){
  36808. var self=this,$self=this;
  36809. return $core.withContext(function($ctx1) {
  36810. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  36811. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  36812. }; }),
  36813. $globals.BlockSequenceNode);
  36814. $core.addClass("AstPragmator", $globals.Object, ["methodNode"], "Compiler-AST");
  36815. $globals.AstPragmator.comment="I am abstract superclass for pragma-processing transformer.\x0a\x0aMy subclasses should implement messages for each pragma\x0athey process. Pragma processing checks if a message is known\x0ato a class but not to its superclass. IOW, each and only those\x0apragmas are processed which are defined as methods in the subclass.\x0a\x0aThese messages can access sequence node in which\x0aa pragma occurred and its containing method node\x0aas `self sequenceNode` and `self methodNode`.\x0a\x0aSee `EarlyPragmator` for an example.";
  36816. $core.addMethod(
  36817. $core.method({
  36818. selector: "methodNode",
  36819. protocol: "accessing",
  36820. args: [],
  36821. source: "methodNode\x0a\x09^ methodNode",
  36822. referencedClasses: [],
  36823. pragmas: [],
  36824. messageSends: []
  36825. }, function ($methodClass){ return function (){
  36826. var self=this,$self=this;
  36827. return $self.methodNode;
  36828. }; }),
  36829. $globals.AstPragmator);
  36830. $core.addMethod(
  36831. $core.method({
  36832. selector: "methodNode:",
  36833. protocol: "accessing",
  36834. args: ["anObject"],
  36835. source: "methodNode: anObject\x0a\x09methodNode := anObject",
  36836. referencedClasses: [],
  36837. pragmas: [],
  36838. messageSends: []
  36839. }, function ($methodClass){ return function (anObject){
  36840. var self=this,$self=this;
  36841. $self.methodNode=anObject;
  36842. return self;
  36843. }; }),
  36844. $globals.AstPragmator);
  36845. $core.addMethod(
  36846. $core.method({
  36847. selector: "value:",
  36848. protocol: "visiting",
  36849. args: ["aMethodNode"],
  36850. source: "value: aMethodNode\x0a\x09self methodNode: aMethodNode.\x0a\x09self processPragmas: aMethodNode pragmas.\x0a\x09^ aMethodNode",
  36851. referencedClasses: [],
  36852. pragmas: [],
  36853. messageSends: ["methodNode:", "processPragmas:", "pragmas"]
  36854. }, function ($methodClass){ return function (aMethodNode){
  36855. var self=this,$self=this;
  36856. return $core.withContext(function($ctx1) {
  36857. $self._methodNode_(aMethodNode);
  36858. $self._processPragmas_($recv(aMethodNode)._pragmas());
  36859. return aMethodNode;
  36860. }, function($ctx1) {$ctx1.fill(self,"value:",{aMethodNode:aMethodNode})});
  36861. }; }),
  36862. $globals.AstPragmator);
  36863. $core.addClass("AstSemanticPragmator", $globals.AstPragmator, [], "Compiler-AST");
  36864. $core.addMethod(
  36865. $core.method({
  36866. selector: "inlineJS:",
  36867. protocol: "pragmas",
  36868. args: ["aString"],
  36869. source: "inlineJS: aString\x0a\x09self methodNode sequenceNode dagChildren ifNotEmpty: [\x0a\x09\x09CompilerError signal: 'There must be no other code or code generator pragma than a lone inlineJS:' ].\x0a\x09self methodNode sequenceNode addDagChild: (\x0a\x09\x09JSStatementNode new\x0a\x09\x09\x09source: aString;\x0a\x09\x09\x09yourself)",
  36870. referencedClasses: ["CompilerError", "JSStatementNode"],
  36871. pragmas: [],
  36872. messageSends: ["ifNotEmpty:", "dagChildren", "sequenceNode", "methodNode", "signal:", "addDagChild:", "source:", "new", "yourself"]
  36873. }, function ($methodClass){ return function (aString){
  36874. var self=this,$self=this;
  36875. return $core.withContext(function($ctx1) {
  36876. var $1,$2;
  36877. $recv($recv([$recv([$self._methodNode()
  36878. ,$ctx1.sendIdx["methodNode"]=1
  36879. ][0])._sequenceNode()
  36880. ,$ctx1.sendIdx["sequenceNode"]=1
  36881. ][0])._dagChildren())._ifNotEmpty_((function(){
  36882. return $core.withContext(function($ctx2) {
  36883. return $recv($globals.CompilerError)._signal_("There must be no other code or code generator pragma than a lone inlineJS:");
  36884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36885. }));
  36886. $1=$recv($self._methodNode())._sequenceNode();
  36887. $2=$recv($globals.JSStatementNode)._new();
  36888. $recv($2)._source_(aString);
  36889. $recv($1)._addDagChild_($recv($2)._yourself());
  36890. return self;
  36891. }, function($ctx1) {$ctx1.fill(self,"inlineJS:",{aString:aString})});
  36892. }; }),
  36893. $globals.AstSemanticPragmator);
  36894. $core.addClass("CompilerError", $globals.Error, [], "Compiler-AST");
  36895. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  36896. $core.addClass("ParentFakingPathDagVisitor", $globals.PathDagVisitor, ["setParentSelector"], "Compiler-AST");
  36897. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  36898. $core.addMethod(
  36899. $core.method({
  36900. selector: "visit:",
  36901. protocol: "visiting",
  36902. args: ["aNode"],
  36903. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  36904. referencedClasses: [],
  36905. pragmas: [],
  36906. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  36907. }, function ($methodClass){ return function (aNode){
  36908. var self=this,$self=this;
  36909. return $core.withContext(function($ctx1) {
  36910. $recv($self._path())._ifNotEmpty_((function(p){
  36911. return $core.withContext(function($ctx2) {
  36912. return $recv(aNode)._parent_($recv(p)._last());
  36913. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  36914. }));
  36915. return [(
  36916. $ctx1.supercall = true,
  36917. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visit_.call($self,aNode))
  36918. ,$ctx1.supercall = false
  36919. ][0];
  36920. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode})});
  36921. }; }),
  36922. $globals.ParentFakingPathDagVisitor);
  36923. $core.addClass("NodeVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-AST");
  36924. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  36925. $core.addMethod(
  36926. $core.method({
  36927. selector: "visitAssignmentNode:",
  36928. protocol: "visiting",
  36929. args: ["aNode"],
  36930. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36931. referencedClasses: [],
  36932. pragmas: [],
  36933. messageSends: ["visitDagNode:"]
  36934. }, function ($methodClass){ return function (aNode){
  36935. var self=this,$self=this;
  36936. return $core.withContext(function($ctx1) {
  36937. return $self._visitDagNode_(aNode);
  36938. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode})});
  36939. }; }),
  36940. $globals.NodeVisitor);
  36941. $core.addMethod(
  36942. $core.method({
  36943. selector: "visitBlockNode:",
  36944. protocol: "visiting",
  36945. args: ["aNode"],
  36946. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36947. referencedClasses: [],
  36948. pragmas: [],
  36949. messageSends: ["visitDagNode:"]
  36950. }, function ($methodClass){ return function (aNode){
  36951. var self=this,$self=this;
  36952. return $core.withContext(function($ctx1) {
  36953. return $self._visitDagNode_(aNode);
  36954. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode})});
  36955. }; }),
  36956. $globals.NodeVisitor);
  36957. $core.addMethod(
  36958. $core.method({
  36959. selector: "visitBlockSequenceNode:",
  36960. protocol: "visiting",
  36961. args: ["aNode"],
  36962. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  36963. referencedClasses: [],
  36964. pragmas: [],
  36965. messageSends: ["visitSequenceNode:"]
  36966. }, function ($methodClass){ return function (aNode){
  36967. var self=this,$self=this;
  36968. return $core.withContext(function($ctx1) {
  36969. return $self._visitSequenceNode_(aNode);
  36970. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode})});
  36971. }; }),
  36972. $globals.NodeVisitor);
  36973. $core.addMethod(
  36974. $core.method({
  36975. selector: "visitCascadeNode:",
  36976. protocol: "visiting",
  36977. args: ["aNode"],
  36978. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36979. referencedClasses: [],
  36980. pragmas: [],
  36981. messageSends: ["visitDagNode:"]
  36982. }, function ($methodClass){ return function (aNode){
  36983. var self=this,$self=this;
  36984. return $core.withContext(function($ctx1) {
  36985. return $self._visitDagNode_(aNode);
  36986. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode})});
  36987. }; }),
  36988. $globals.NodeVisitor);
  36989. $core.addMethod(
  36990. $core.method({
  36991. selector: "visitDagNode:",
  36992. protocol: "visiting",
  36993. args: ["aNode"],
  36994. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  36995. referencedClasses: [],
  36996. pragmas: [],
  36997. messageSends: ["visitDagNodeVariantSimple:"]
  36998. }, function ($methodClass){ return function (aNode){
  36999. var self=this,$self=this;
  37000. return $core.withContext(function($ctx1) {
  37001. return $self._visitDagNodeVariantSimple_(aNode);
  37002. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode})});
  37003. }; }),
  37004. $globals.NodeVisitor);
  37005. $core.addMethod(
  37006. $core.method({
  37007. selector: "visitDynamicArrayNode:",
  37008. protocol: "visiting",
  37009. args: ["aNode"],
  37010. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  37011. referencedClasses: [],
  37012. pragmas: [],
  37013. messageSends: ["visitDagNode:"]
  37014. }, function ($methodClass){ return function (aNode){
  37015. var self=this,$self=this;
  37016. return $core.withContext(function($ctx1) {
  37017. return $self._visitDagNode_(aNode);
  37018. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode})});
  37019. }; }),
  37020. $globals.NodeVisitor);
  37021. $core.addMethod(
  37022. $core.method({
  37023. selector: "visitDynamicDictionaryNode:",
  37024. protocol: "visiting",
  37025. args: ["aNode"],
  37026. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  37027. referencedClasses: [],
  37028. pragmas: [],
  37029. messageSends: ["visitDagNode:"]
  37030. }, function ($methodClass){ return function (aNode){
  37031. var self=this,$self=this;
  37032. return $core.withContext(function($ctx1) {
  37033. return $self._visitDagNode_(aNode);
  37034. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode})});
  37035. }; }),
  37036. $globals.NodeVisitor);
  37037. $core.addMethod(
  37038. $core.method({
  37039. selector: "visitJSStatementNode:",
  37040. protocol: "visiting",
  37041. args: ["aNode"],
  37042. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  37043. referencedClasses: [],
  37044. pragmas: [],
  37045. messageSends: ["visitDagNode:"]
  37046. }, function ($methodClass){ return function (aNode){
  37047. var self=this,$self=this;
  37048. return $core.withContext(function($ctx1) {
  37049. return $self._visitDagNode_(aNode);
  37050. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode})});
  37051. }; }),
  37052. $globals.NodeVisitor);
  37053. $core.addMethod(
  37054. $core.method({
  37055. selector: "visitMethodNode:",
  37056. protocol: "visiting",
  37057. args: ["aNode"],
  37058. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  37059. referencedClasses: [],
  37060. pragmas: [],
  37061. messageSends: ["visitDagNode:"]
  37062. }, function ($methodClass){ return function (aNode){
  37063. var self=this,$self=this;
  37064. return $core.withContext(function($ctx1) {
  37065. return $self._visitDagNode_(aNode);
  37066. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode})});
  37067. }; }),
  37068. $globals.NodeVisitor);
  37069. $core.addMethod(
  37070. $core.method({
  37071. selector: "visitReturnNode:",
  37072. protocol: "visiting",
  37073. args: ["aNode"],
  37074. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  37075. referencedClasses: [],
  37076. pragmas: [],
  37077. messageSends: ["visitDagNode:"]
  37078. }, function ($methodClass){ return function (aNode){
  37079. var self=this,$self=this;
  37080. return $core.withContext(function($ctx1) {
  37081. return $self._visitDagNode_(aNode);
  37082. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode})});
  37083. }; }),
  37084. $globals.NodeVisitor);
  37085. $core.addMethod(
  37086. $core.method({
  37087. selector: "visitSendNode:",
  37088. protocol: "visiting",
  37089. args: ["aNode"],
  37090. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  37091. referencedClasses: [],
  37092. pragmas: [],
  37093. messageSends: ["visitDagNode:"]
  37094. }, function ($methodClass){ return function (aNode){
  37095. var self=this,$self=this;
  37096. return $core.withContext(function($ctx1) {
  37097. return $self._visitDagNode_(aNode);
  37098. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode})});
  37099. }; }),
  37100. $globals.NodeVisitor);
  37101. $core.addMethod(
  37102. $core.method({
  37103. selector: "visitSequenceNode:",
  37104. protocol: "visiting",
  37105. args: ["aNode"],
  37106. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  37107. referencedClasses: [],
  37108. pragmas: [],
  37109. messageSends: ["visitDagNode:"]
  37110. }, function ($methodClass){ return function (aNode){
  37111. var self=this,$self=this;
  37112. return $core.withContext(function($ctx1) {
  37113. return $self._visitDagNode_(aNode);
  37114. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode})});
  37115. }; }),
  37116. $globals.NodeVisitor);
  37117. $core.addMethod(
  37118. $core.method({
  37119. selector: "visitValueNode:",
  37120. protocol: "visiting",
  37121. args: ["aNode"],
  37122. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  37123. referencedClasses: [],
  37124. pragmas: [],
  37125. messageSends: ["visitDagNode:"]
  37126. }, function ($methodClass){ return function (aNode){
  37127. var self=this,$self=this;
  37128. return $core.withContext(function($ctx1) {
  37129. return $self._visitDagNode_(aNode);
  37130. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode})});
  37131. }; }),
  37132. $globals.NodeVisitor);
  37133. $core.addMethod(
  37134. $core.method({
  37135. selector: "visitVariableNode:",
  37136. protocol: "visiting",
  37137. args: ["aNode"],
  37138. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  37139. referencedClasses: [],
  37140. pragmas: [],
  37141. messageSends: ["visitDagNode:"]
  37142. }, function ($methodClass){ return function (aNode){
  37143. var self=this,$self=this;
  37144. return $core.withContext(function($ctx1) {
  37145. return $self._visitDagNode_(aNode);
  37146. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode})});
  37147. }; }),
  37148. $globals.NodeVisitor);
  37149. $core.setTraitComposition([{trait: $globals.TDerivedDagChildren}], $globals.AssignmentNode);
  37150. $core.setTraitComposition([{trait: $globals.TSingleDagChild}], $globals.BlockNode);
  37151. $core.setTraitComposition([{trait: $globals.TDerivedDagChildren}], $globals.SendNode);
  37152. $core.setTraitComposition([{trait: $globals.TDagSink}], $globals.ValueNode);
  37153. $core.setTraitComposition([{trait: $globals.TDagSink}], $globals.VariableNode);
  37154. $core.setTraitComposition([{trait: $globals.TDagSink}], $globals.JSStatementNode);
  37155. $core.setTraitComposition([{trait: $globals.TSingleDagChild}], $globals.MethodNode);
  37156. $core.setTraitComposition([{trait: $globals.TSingleDagChild}], $globals.ReturnNode);
  37157. $core.setTraitComposition([{trait: $globals.TPragmator}], $globals.AstPragmator);
  37158. $core.addMethod(
  37159. $core.method({
  37160. selector: "ast",
  37161. protocol: "*Compiler-AST",
  37162. args: [],
  37163. source: "ast\x0a\x09self source ifEmpty: [ CompilerError signal: 'Method source is empty' ].\x0a\x09\x0a\x09^ Compiler new\x0a\x09\x09ast: self source\x0a\x09\x09forClass: self origin\x0a\x09\x09protocol: self protocol",
  37164. referencedClasses: ["CompilerError", "Compiler"],
  37165. pragmas: [],
  37166. messageSends: ["ifEmpty:", "source", "signal:", "ast:forClass:protocol:", "new", "origin", "protocol"]
  37167. }, function ($methodClass){ return function (){
  37168. var self=this,$self=this;
  37169. return $core.withContext(function($ctx1) {
  37170. $recv([$self._source()
  37171. ,$ctx1.sendIdx["source"]=1
  37172. ][0])._ifEmpty_((function(){
  37173. return $core.withContext(function($ctx2) {
  37174. return $recv($globals.CompilerError)._signal_("Method source is empty");
  37175. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37176. }));
  37177. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_($self._source(),$self._origin(),$self._protocol());
  37178. }, function($ctx1) {$ctx1.fill(self,"ast",{})});
  37179. }; }),
  37180. $globals.CompiledMethod);
  37181. });
  37182. define('amber/core/Compiler-Semantic',["amber/boot", "require", "amber/core/Compiler-AST", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  37183. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  37184. var $pkg = $core.addPackage("Compiler-Semantic");
  37185. $pkg.innerEval = function (expr) { return eval(expr); };
  37186. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  37187. $core.addClass("JSSuperSendVisitor", $globals.NodeVisitor, ["selector", "arguments", "property", "args"], "Compiler-Semantic");
  37188. $core.addMethod(
  37189. $core.method({
  37190. selector: "args",
  37191. protocol: "accessing",
  37192. args: [],
  37193. source: "args\x0a\x09^ args",
  37194. referencedClasses: [],
  37195. pragmas: [],
  37196. messageSends: []
  37197. }, function ($methodClass){ return function (){
  37198. var self=this,$self=this;
  37199. return $self.args;
  37200. }; }),
  37201. $globals.JSSuperSendVisitor);
  37202. $core.addMethod(
  37203. $core.method({
  37204. selector: "args:",
  37205. protocol: "accessing",
  37206. args: ["aCollection"],
  37207. source: "args: aCollection\x0a\x09args := aCollection",
  37208. referencedClasses: [],
  37209. pragmas: [],
  37210. messageSends: []
  37211. }, function ($methodClass){ return function (aCollection){
  37212. var self=this,$self=this;
  37213. $self.args=aCollection;
  37214. return self;
  37215. }; }),
  37216. $globals.JSSuperSendVisitor);
  37217. $core.addMethod(
  37218. $core.method({
  37219. selector: "arguments",
  37220. protocol: "accessing",
  37221. args: [],
  37222. source: "arguments\x0a\x09^ arguments",
  37223. referencedClasses: [],
  37224. pragmas: [],
  37225. messageSends: []
  37226. }, function ($methodClass){ return function (){
  37227. var self=this,$self=this;
  37228. return $self.arguments;
  37229. }; }),
  37230. $globals.JSSuperSendVisitor);
  37231. $core.addMethod(
  37232. $core.method({
  37233. selector: "arguments:",
  37234. protocol: "accessing",
  37235. args: ["aCollection"],
  37236. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  37237. referencedClasses: [],
  37238. pragmas: [],
  37239. messageSends: []
  37240. }, function ($methodClass){ return function (aCollection){
  37241. var self=this,$self=this;
  37242. $self.arguments=aCollection;
  37243. return self;
  37244. }; }),
  37245. $globals.JSSuperSendVisitor);
  37246. $core.addMethod(
  37247. $core.method({
  37248. selector: "property",
  37249. protocol: "accessing",
  37250. args: [],
  37251. source: "property\x0a\x09^ property",
  37252. referencedClasses: [],
  37253. pragmas: [],
  37254. messageSends: []
  37255. }, function ($methodClass){ return function (){
  37256. var self=this,$self=this;
  37257. return $self.property;
  37258. }; }),
  37259. $globals.JSSuperSendVisitor);
  37260. $core.addMethod(
  37261. $core.method({
  37262. selector: "property:",
  37263. protocol: "accessing",
  37264. args: ["anObject"],
  37265. source: "property: anObject\x0a\x09property := anObject",
  37266. referencedClasses: [],
  37267. pragmas: [],
  37268. messageSends: []
  37269. }, function ($methodClass){ return function (anObject){
  37270. var self=this,$self=this;
  37271. $self.property=anObject;
  37272. return self;
  37273. }; }),
  37274. $globals.JSSuperSendVisitor);
  37275. $core.addMethod(
  37276. $core.method({
  37277. selector: "selector",
  37278. protocol: "accessing",
  37279. args: [],
  37280. source: "selector\x0a\x09^ selector",
  37281. referencedClasses: [],
  37282. pragmas: [],
  37283. messageSends: []
  37284. }, function ($methodClass){ return function (){
  37285. var self=this,$self=this;
  37286. return $self.selector;
  37287. }; }),
  37288. $globals.JSSuperSendVisitor);
  37289. $core.addMethod(
  37290. $core.method({
  37291. selector: "selector:",
  37292. protocol: "accessing",
  37293. args: ["anObject"],
  37294. source: "selector: anObject\x0a\x09selector := anObject",
  37295. referencedClasses: [],
  37296. pragmas: [],
  37297. messageSends: []
  37298. }, function ($methodClass){ return function (anObject){
  37299. var self=this,$self=this;
  37300. $self.selector=anObject;
  37301. return self;
  37302. }; }),
  37303. $globals.JSSuperSendVisitor);
  37304. $core.addMethod(
  37305. $core.method({
  37306. selector: "switcherFrom:to:",
  37307. protocol: "accessing",
  37308. args: ["aCollection", "anotherCollection"],
  37309. source: "switcherFrom: aCollection to: anotherCollection\x0a\x09^ NativeFunction\x0a\x09\x09constructorNamed: #Function\x0a\x09\x09value: (',' join: aCollection)\x0a\x09\x09value: 'return [', (',' join: anotherCollection), ']'",
  37310. referencedClasses: ["NativeFunction"],
  37311. pragmas: [],
  37312. messageSends: ["constructorNamed:value:value:", "join:", ","]
  37313. }, function ($methodClass){ return function (aCollection,anotherCollection){
  37314. var self=this,$self=this;
  37315. return $core.withContext(function($ctx1) {
  37316. return $recv($globals.NativeFunction)._constructorNamed_value_value_("Function",[","._join_(aCollection)
  37317. ,$ctx1.sendIdx["join:"]=1
  37318. ][0],[$recv("return [".__comma(","._join_(anotherCollection))).__comma("]")
  37319. ,$ctx1.sendIdx[","]=1
  37320. ][0]);
  37321. }, function($ctx1) {$ctx1.fill(self,"switcherFrom:to:",{aCollection:aCollection,anotherCollection:anotherCollection})});
  37322. }; }),
  37323. $globals.JSSuperSendVisitor);
  37324. $core.addMethod(
  37325. $core.method({
  37326. selector: "visitMethodNode:",
  37327. protocol: "accessing",
  37328. args: ["aNode"],
  37329. source: "visitMethodNode: aNode\x0a\x09self selector: aNode selector.\x0a\x09self arguments: aNode arguments.\x0a\x09^ super visitMethodNode: aNode",
  37330. referencedClasses: [],
  37331. pragmas: [],
  37332. messageSends: ["selector:", "selector", "arguments:", "arguments", "visitMethodNode:"]
  37333. }, function ($methodClass){ return function (aNode){
  37334. var self=this,$self=this;
  37335. return $core.withContext(function($ctx1) {
  37336. $self._selector_($recv(aNode)._selector());
  37337. $self._arguments_($recv(aNode)._arguments());
  37338. return [(
  37339. $ctx1.supercall = true,
  37340. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.call($self,aNode))
  37341. ,$ctx1.supercall = false
  37342. ][0];
  37343. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode})});
  37344. }; }),
  37345. $globals.JSSuperSendVisitor);
  37346. $core.addMethod(
  37347. $core.method({
  37348. selector: "visitSendNode:",
  37349. protocol: "accessing",
  37350. args: ["aNode"],
  37351. source: "visitSendNode: aNode\x0a\x09| receiver |\x0a\x09receiver := aNode receiver.\x0a\x09receiver isSuper ifTrue: [\x0a\x09\x09aNode selector = self selector ifTrue: [\x0a\x09\x09\x09| old |\x0a\x09\x09\x09old := receiver binding.\x0a\x09\x09\x09receiver binding: (\x0a\x09\x09\x09\x09JavaScriptSuperVar new\x0a\x09\x09\x09\x09\x09scope: old scope;\x0a\x09\x09\x09\x09\x09name: old name;\x0a\x09\x09\x09\x09\x09yourself ).\x0a\x09\x09\x09self args ifNotNil: [ :myArgs |\x0a\x09\x09\x09\x09myArgs = self arguments ifFalse: [\x0a\x09\x09\x09\x09\x09aNode argumentSwitcher:\x0a\x09\x09\x09\x09\x09\x09(self switcherFrom: self arguments to: myArgs) ] ].\x0a\x09\x09\x09aNode javaScriptSelector: self property ] ].\x0a\x09^ super visitSendNode: aNode",
  37352. referencedClasses: ["JavaScriptSuperVar"],
  37353. pragmas: [],
  37354. messageSends: ["receiver", "ifTrue:", "isSuper", "=", "selector", "binding", "binding:", "scope:", "new", "scope", "name:", "name", "yourself", "ifNotNil:", "args", "ifFalse:", "arguments", "argumentSwitcher:", "switcherFrom:to:", "javaScriptSelector:", "property", "visitSendNode:"]
  37355. }, function ($methodClass){ return function (aNode){
  37356. var self=this,$self=this;
  37357. var receiver;
  37358. return $core.withContext(function($ctx1) {
  37359. var $1,$2,$3;
  37360. receiver=$recv(aNode)._receiver();
  37361. if($core.assert($recv(receiver)._isSuper())){
  37362. if($core.assert([$recv([$recv(aNode)._selector()
  37363. ,$ctx1.sendIdx["selector"]=1
  37364. ][0]).__eq($self._selector())
  37365. ,$ctx1.sendIdx["="]=1
  37366. ][0])){
  37367. var old;
  37368. old=$recv(receiver)._binding();
  37369. $1=receiver;
  37370. $2=$recv($globals.JavaScriptSuperVar)._new();
  37371. $recv($2)._scope_($recv(old)._scope());
  37372. $recv($2)._name_($recv(old)._name());
  37373. $recv($1)._binding_($recv($2)._yourself());
  37374. $3=$self._args();
  37375. if($3 == null || $3.a$nil){
  37376. $3;
  37377. } else {
  37378. var myArgs;
  37379. myArgs=$3;
  37380. if(!$core.assert($recv(myArgs).__eq([$self._arguments()
  37381. ,$ctx1.sendIdx["arguments"]=1
  37382. ][0]))){
  37383. $recv(aNode)._argumentSwitcher_($self._switcherFrom_to_($self._arguments(),myArgs));
  37384. }
  37385. }
  37386. $recv(aNode)._javaScriptSelector_($self._property());
  37387. }
  37388. }
  37389. return [(
  37390. $ctx1.supercall = true,
  37391. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.call($self,aNode))
  37392. ,$ctx1.supercall = false
  37393. ][0];
  37394. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver})});
  37395. }; }),
  37396. $globals.JSSuperSendVisitor);
  37397. $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic");
  37398. $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.";
  37399. $core.addMethod(
  37400. $core.method({
  37401. selector: "addArg:",
  37402. protocol: "adding",
  37403. args: ["aString"],
  37404. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  37405. referencedClasses: ["ArgVar"],
  37406. pragmas: [],
  37407. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  37408. }, function ($methodClass){ return function (aString){
  37409. var self=this,$self=this;
  37410. return $core.withContext(function($ctx1) {
  37411. $recv([$self._args()
  37412. ,$ctx1.sendIdx["args"]=1
  37413. ][0])._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  37414. $recv($recv($self._args())._at_(aString))._scope_(self);
  37415. return self;
  37416. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString})});
  37417. }; }),
  37418. $globals.LexicalScope);
  37419. $core.addMethod(
  37420. $core.method({
  37421. selector: "addTemp:",
  37422. protocol: "adding",
  37423. args: ["aString"],
  37424. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  37425. referencedClasses: ["TempVar"],
  37426. pragmas: [],
  37427. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  37428. }, function ($methodClass){ return function (aString){
  37429. var self=this,$self=this;
  37430. return $core.withContext(function($ctx1) {
  37431. $recv([$self._temps()
  37432. ,$ctx1.sendIdx["temps"]=1
  37433. ][0])._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  37434. $recv($recv($self._temps())._at_(aString))._scope_(self);
  37435. return self;
  37436. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString})});
  37437. }; }),
  37438. $globals.LexicalScope);
  37439. $core.addMethod(
  37440. $core.method({
  37441. selector: "alias",
  37442. protocol: "accessing",
  37443. args: [],
  37444. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  37445. referencedClasses: [],
  37446. pragmas: [],
  37447. messageSends: [",", "asString", "scopeLevel"]
  37448. }, function ($methodClass){ return function (){
  37449. var self=this,$self=this;
  37450. return $core.withContext(function($ctx1) {
  37451. return "$ctx".__comma($recv($self._scopeLevel())._asString());
  37452. }, function($ctx1) {$ctx1.fill(self,"alias",{})});
  37453. }; }),
  37454. $globals.LexicalScope);
  37455. $core.addMethod(
  37456. $core.method({
  37457. selector: "allVariableNames",
  37458. protocol: "accessing",
  37459. args: [],
  37460. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  37461. referencedClasses: [],
  37462. pragmas: [],
  37463. messageSends: [",", "keys", "args", "temps"]
  37464. }, function ($methodClass){ return function (){
  37465. var self=this,$self=this;
  37466. return $core.withContext(function($ctx1) {
  37467. return $recv([$recv($self._args())._keys()
  37468. ,$ctx1.sendIdx["keys"]=1
  37469. ][0]).__comma($recv($self._temps())._keys());
  37470. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{})});
  37471. }; }),
  37472. $globals.LexicalScope);
  37473. $core.addMethod(
  37474. $core.method({
  37475. selector: "args",
  37476. protocol: "accessing",
  37477. args: [],
  37478. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  37479. referencedClasses: ["Dictionary"],
  37480. pragmas: [],
  37481. messageSends: ["ifNil:", "new"]
  37482. }, function ($methodClass){ return function (){
  37483. var self=this,$self=this;
  37484. return $core.withContext(function($ctx1) {
  37485. var $1;
  37486. $1=$self.args;
  37487. if($1 == null || $1.a$nil){
  37488. $self.args=$recv($globals.Dictionary)._new();
  37489. return $self.args;
  37490. } else {
  37491. return $1;
  37492. }
  37493. }, function($ctx1) {$ctx1.fill(self,"args",{})});
  37494. }; }),
  37495. $globals.LexicalScope);
  37496. $core.addMethod(
  37497. $core.method({
  37498. selector: "bindingFor:",
  37499. protocol: "accessing",
  37500. args: ["aString"],
  37501. source: "bindingFor: aString\x0a\x09^ self pseudoVars at: aString ifAbsent: [\x0a\x09\x09self args at: aString ifAbsent: [\x0a\x09\x09\x09self temps at: aString ifAbsent: [ nil ]]]",
  37502. referencedClasses: [],
  37503. pragmas: [],
  37504. messageSends: ["at:ifAbsent:", "pseudoVars", "args", "temps"]
  37505. }, function ($methodClass){ return function (aString){
  37506. var self=this,$self=this;
  37507. return $core.withContext(function($ctx1) {
  37508. return [$recv($self._pseudoVars())._at_ifAbsent_(aString,(function(){
  37509. return $core.withContext(function($ctx2) {
  37510. return [$recv($self._args())._at_ifAbsent_(aString,(function(){
  37511. return $core.withContext(function($ctx3) {
  37512. return $recv($self._temps())._at_ifAbsent_(aString,(function(){
  37513. return nil;
  37514. }));
  37515. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  37516. }))
  37517. ,$ctx2.sendIdx["at:ifAbsent:"]=2
  37518. ][0];
  37519. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37520. }))
  37521. ,$ctx1.sendIdx["at:ifAbsent:"]=1
  37522. ][0];
  37523. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aString:aString})});
  37524. }; }),
  37525. $globals.LexicalScope);
  37526. $core.addMethod(
  37527. $core.method({
  37528. selector: "blockIndex",
  37529. protocol: "accessing",
  37530. args: [],
  37531. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  37532. referencedClasses: [],
  37533. pragmas: [],
  37534. messageSends: ["ifNil:"]
  37535. }, function ($methodClass){ return function (){
  37536. var self=this,$self=this;
  37537. return $core.withContext(function($ctx1) {
  37538. var $1;
  37539. $1=$self.blockIndex;
  37540. if($1 == null || $1.a$nil){
  37541. return (0);
  37542. } else {
  37543. return $1;
  37544. }
  37545. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{})});
  37546. }; }),
  37547. $globals.LexicalScope);
  37548. $core.addMethod(
  37549. $core.method({
  37550. selector: "blockIndex:",
  37551. protocol: "accessing",
  37552. args: ["anInteger"],
  37553. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  37554. referencedClasses: [],
  37555. pragmas: [],
  37556. messageSends: []
  37557. }, function ($methodClass){ return function (anInteger){
  37558. var self=this,$self=this;
  37559. $self.blockIndex=anInteger;
  37560. return self;
  37561. }; }),
  37562. $globals.LexicalScope);
  37563. $core.addMethod(
  37564. $core.method({
  37565. selector: "canFlattenNonLocalReturns",
  37566. protocol: "testing",
  37567. args: [],
  37568. source: "canFlattenNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canFlattenNonLocalReturns ]",
  37569. referencedClasses: [],
  37570. pragmas: [],
  37571. messageSends: ["and:", "isInlined", "canFlattenNonLocalReturns", "outerScope"]
  37572. }, function ($methodClass){ return function (){
  37573. var self=this,$self=this;
  37574. return $core.withContext(function($ctx1) {
  37575. return $recv($self._isInlined())._and_((function(){
  37576. return $core.withContext(function($ctx2) {
  37577. return $recv($self._outerScope())._canFlattenNonLocalReturns();
  37578. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37579. }));
  37580. }, function($ctx1) {$ctx1.fill(self,"canFlattenNonLocalReturns",{})});
  37581. }; }),
  37582. $globals.LexicalScope);
  37583. $core.addMethod(
  37584. $core.method({
  37585. selector: "instruction",
  37586. protocol: "accessing",
  37587. args: [],
  37588. source: "instruction\x0a\x09^ instruction",
  37589. referencedClasses: [],
  37590. pragmas: [],
  37591. messageSends: []
  37592. }, function ($methodClass){ return function (){
  37593. var self=this,$self=this;
  37594. return $self.instruction;
  37595. }; }),
  37596. $globals.LexicalScope);
  37597. $core.addMethod(
  37598. $core.method({
  37599. selector: "instruction:",
  37600. protocol: "accessing",
  37601. args: ["anIRInstruction"],
  37602. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  37603. referencedClasses: [],
  37604. pragmas: [],
  37605. messageSends: []
  37606. }, function ($methodClass){ return function (anIRInstruction){
  37607. var self=this,$self=this;
  37608. $self.instruction=anIRInstruction;
  37609. return self;
  37610. }; }),
  37611. $globals.LexicalScope);
  37612. $core.addMethod(
  37613. $core.method({
  37614. selector: "isBlockScope",
  37615. protocol: "testing",
  37616. args: [],
  37617. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  37618. referencedClasses: [],
  37619. pragmas: [],
  37620. messageSends: ["not", "isMethodScope"]
  37621. }, function ($methodClass){ return function (){
  37622. var self=this,$self=this;
  37623. return $core.withContext(function($ctx1) {
  37624. return $recv($self._isMethodScope())._not();
  37625. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{})});
  37626. }; }),
  37627. $globals.LexicalScope);
  37628. $core.addMethod(
  37629. $core.method({
  37630. selector: "isInlined",
  37631. protocol: "testing",
  37632. args: [],
  37633. source: "isInlined\x0a\x09^ self instruction ifNil: [ false ] ifNotNil: [ :instr | instr isInlined ]",
  37634. referencedClasses: [],
  37635. pragmas: [],
  37636. messageSends: ["ifNil:ifNotNil:", "instruction", "isInlined"]
  37637. }, function ($methodClass){ return function (){
  37638. var self=this,$self=this;
  37639. return $core.withContext(function($ctx1) {
  37640. var $1;
  37641. $1=$self._instruction();
  37642. if($1 == null || $1.a$nil){
  37643. return false;
  37644. } else {
  37645. var instr;
  37646. instr=$1;
  37647. return $recv(instr)._isInlined();
  37648. }
  37649. }, function($ctx1) {$ctx1.fill(self,"isInlined",{})});
  37650. }; }),
  37651. $globals.LexicalScope);
  37652. $core.addMethod(
  37653. $core.method({
  37654. selector: "isMethodScope",
  37655. protocol: "testing",
  37656. args: [],
  37657. source: "isMethodScope\x0a\x09^ false",
  37658. referencedClasses: [],
  37659. pragmas: [],
  37660. messageSends: []
  37661. }, function ($methodClass){ return function (){
  37662. var self=this,$self=this;
  37663. return false;
  37664. }; }),
  37665. $globals.LexicalScope);
  37666. $core.addMethod(
  37667. $core.method({
  37668. selector: "lookupVariable:",
  37669. protocol: "accessing",
  37670. args: ["aString"],
  37671. source: "lookupVariable: aString\x0a\x09| lookup |\x0a\x09lookup := (self bindingFor: aString).\x0a\x09lookup ifNil: [\x0a\x09\x09lookup := self outerScope ifNotNil: [\x0a\x09\x09\x09(self outerScope lookupVariable: aString) ]].\x0a\x09^ lookup",
  37672. referencedClasses: [],
  37673. pragmas: [],
  37674. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  37675. }, function ($methodClass){ return function (aString){
  37676. var self=this,$self=this;
  37677. var lookup;
  37678. return $core.withContext(function($ctx1) {
  37679. var $1,$2;
  37680. lookup=$self._bindingFor_(aString);
  37681. $1=lookup;
  37682. if($1 == null || $1.a$nil){
  37683. $2=[$self._outerScope()
  37684. ,$ctx1.sendIdx["outerScope"]=1
  37685. ][0];
  37686. if($2 == null || $2.a$nil){
  37687. lookup=$2;
  37688. } else {
  37689. lookup=$recv($self._outerScope())._lookupVariable_(aString);
  37690. }
  37691. lookup;
  37692. } else {
  37693. $1;
  37694. }
  37695. return lookup;
  37696. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aString:aString,lookup:lookup})});
  37697. }; }),
  37698. $globals.LexicalScope);
  37699. $core.addMethod(
  37700. $core.method({
  37701. selector: "methodScope",
  37702. protocol: "accessing",
  37703. args: [],
  37704. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  37705. referencedClasses: [],
  37706. pragmas: [],
  37707. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  37708. }, function ($methodClass){ return function (){
  37709. var self=this,$self=this;
  37710. return $core.withContext(function($ctx1) {
  37711. var $1;
  37712. $1=[$self._outerScope()
  37713. ,$ctx1.sendIdx["outerScope"]=1
  37714. ][0];
  37715. if($1 == null || $1.a$nil){
  37716. return $1;
  37717. } else {
  37718. return $recv($self._outerScope())._methodScope();
  37719. }
  37720. }, function($ctx1) {$ctx1.fill(self,"methodScope",{})});
  37721. }; }),
  37722. $globals.LexicalScope);
  37723. $core.addMethod(
  37724. $core.method({
  37725. selector: "node",
  37726. protocol: "accessing",
  37727. args: [],
  37728. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  37729. referencedClasses: [],
  37730. pragmas: [],
  37731. messageSends: []
  37732. }, function ($methodClass){ return function (){
  37733. var self=this,$self=this;
  37734. return $self.node;
  37735. }; }),
  37736. $globals.LexicalScope);
  37737. $core.addMethod(
  37738. $core.method({
  37739. selector: "node:",
  37740. protocol: "accessing",
  37741. args: ["aNode"],
  37742. source: "node: aNode\x0a\x09node := aNode",
  37743. referencedClasses: [],
  37744. pragmas: [],
  37745. messageSends: []
  37746. }, function ($methodClass){ return function (aNode){
  37747. var self=this,$self=this;
  37748. $self.node=aNode;
  37749. return self;
  37750. }; }),
  37751. $globals.LexicalScope);
  37752. $core.addMethod(
  37753. $core.method({
  37754. selector: "outerScope",
  37755. protocol: "accessing",
  37756. args: [],
  37757. source: "outerScope\x0a\x09^ outerScope",
  37758. referencedClasses: [],
  37759. pragmas: [],
  37760. messageSends: []
  37761. }, function ($methodClass){ return function (){
  37762. var self=this,$self=this;
  37763. return $self.outerScope;
  37764. }; }),
  37765. $globals.LexicalScope);
  37766. $core.addMethod(
  37767. $core.method({
  37768. selector: "outerScope:",
  37769. protocol: "accessing",
  37770. args: ["aLexicalScope"],
  37771. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  37772. referencedClasses: [],
  37773. pragmas: [],
  37774. messageSends: []
  37775. }, function ($methodClass){ return function (aLexicalScope){
  37776. var self=this,$self=this;
  37777. $self.outerScope=aLexicalScope;
  37778. return self;
  37779. }; }),
  37780. $globals.LexicalScope);
  37781. $core.addMethod(
  37782. $core.method({
  37783. selector: "pseudoVars",
  37784. protocol: "accessing",
  37785. args: [],
  37786. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  37787. referencedClasses: [],
  37788. pragmas: [],
  37789. messageSends: ["pseudoVars", "methodScope"]
  37790. }, function ($methodClass){ return function (){
  37791. var self=this,$self=this;
  37792. return $core.withContext(function($ctx1) {
  37793. return $recv($self._methodScope())._pseudoVars();
  37794. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{})});
  37795. }; }),
  37796. $globals.LexicalScope);
  37797. $core.addMethod(
  37798. $core.method({
  37799. selector: "scopeLevel",
  37800. protocol: "accessing",
  37801. args: [],
  37802. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  37803. referencedClasses: [],
  37804. pragmas: [],
  37805. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  37806. }, function ($methodClass){ return function (){
  37807. var self=this,$self=this;
  37808. return $core.withContext(function($ctx1) {
  37809. var $1;
  37810. $1=[$self._outerScope()
  37811. ,$ctx1.sendIdx["outerScope"]=1
  37812. ][0];
  37813. if($1 == null || $1.a$nil){
  37814. return (1);
  37815. } else {
  37816. $1;
  37817. }
  37818. if($core.assert($self._isInlined())){
  37819. return [$recv([$self._outerScope()
  37820. ,$ctx1.sendIdx["outerScope"]=2
  37821. ][0])._scopeLevel()
  37822. ,$ctx1.sendIdx["scopeLevel"]=1
  37823. ][0];
  37824. }
  37825. return $recv($recv($self._outerScope())._scopeLevel()).__plus((1));
  37826. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{})});
  37827. }; }),
  37828. $globals.LexicalScope);
  37829. $core.addMethod(
  37830. $core.method({
  37831. selector: "temps",
  37832. protocol: "accessing",
  37833. args: [],
  37834. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  37835. referencedClasses: ["Dictionary"],
  37836. pragmas: [],
  37837. messageSends: ["ifNil:", "new"]
  37838. }, function ($methodClass){ return function (){
  37839. var self=this,$self=this;
  37840. return $core.withContext(function($ctx1) {
  37841. var $1;
  37842. $1=$self.temps;
  37843. if($1 == null || $1.a$nil){
  37844. $self.temps=$recv($globals.Dictionary)._new();
  37845. return $self.temps;
  37846. } else {
  37847. return $1;
  37848. }
  37849. }, function($ctx1) {$ctx1.fill(self,"temps",{})});
  37850. }; }),
  37851. $globals.LexicalScope);
  37852. $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "localReturn", "nonLocalReturns"], "Compiler-Semantic");
  37853. $globals.MethodLexicalScope.comment="I represent a method scope.";
  37854. $core.addMethod(
  37855. $core.method({
  37856. selector: "addIVar:",
  37857. protocol: "adding",
  37858. args: ["aString"],
  37859. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  37860. referencedClasses: ["InstanceVar"],
  37861. pragmas: [],
  37862. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  37863. }, function ($methodClass){ return function (aString){
  37864. var self=this,$self=this;
  37865. return $core.withContext(function($ctx1) {
  37866. $recv([$self._iVars()
  37867. ,$ctx1.sendIdx["iVars"]=1
  37868. ][0])._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  37869. $recv($recv($self._iVars())._at_(aString))._scope_(self);
  37870. return self;
  37871. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString})});
  37872. }; }),
  37873. $globals.MethodLexicalScope);
  37874. $core.addMethod(
  37875. $core.method({
  37876. selector: "addNonLocalReturn:",
  37877. protocol: "adding",
  37878. args: ["aScope"],
  37879. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  37880. referencedClasses: [],
  37881. pragmas: [],
  37882. messageSends: ["add:", "nonLocalReturns"]
  37883. }, function ($methodClass){ return function (aScope){
  37884. var self=this,$self=this;
  37885. return $core.withContext(function($ctx1) {
  37886. $recv($self._nonLocalReturns())._add_(aScope);
  37887. return self;
  37888. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope})});
  37889. }; }),
  37890. $globals.MethodLexicalScope);
  37891. $core.addMethod(
  37892. $core.method({
  37893. selector: "allVariableNames",
  37894. protocol: "accessing",
  37895. args: [],
  37896. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  37897. referencedClasses: [],
  37898. pragmas: [],
  37899. messageSends: [",", "allVariableNames", "keys", "iVars"]
  37900. }, function ($methodClass){ return function (){
  37901. var self=this,$self=this;
  37902. return $core.withContext(function($ctx1) {
  37903. return $recv([(
  37904. $ctx1.supercall = true,
  37905. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.call($self))
  37906. ,$ctx1.supercall = false
  37907. ][0]).__comma($recv($self._iVars())._keys());
  37908. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{})});
  37909. }; }),
  37910. $globals.MethodLexicalScope);
  37911. $core.addMethod(
  37912. $core.method({
  37913. selector: "bindingFor:",
  37914. protocol: "accessing",
  37915. args: ["aString"],
  37916. source: "bindingFor: aString\x0a\x09^ (super bindingFor: aString) ifNil: [\x0a\x09\x09self iVars at: aString ifAbsent: [ nil ]]",
  37917. referencedClasses: [],
  37918. pragmas: [],
  37919. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars"]
  37920. }, function ($methodClass){ return function (aString){
  37921. var self=this,$self=this;
  37922. return $core.withContext(function($ctx1) {
  37923. var $1;
  37924. $1=[(
  37925. $ctx1.supercall = true,
  37926. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.call($self,aString))
  37927. ,$ctx1.supercall = false
  37928. ][0];
  37929. if($1 == null || $1.a$nil){
  37930. return $recv($self._iVars())._at_ifAbsent_(aString,(function(){
  37931. return nil;
  37932. }));
  37933. } else {
  37934. return $1;
  37935. }
  37936. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aString:aString})});
  37937. }; }),
  37938. $globals.MethodLexicalScope);
  37939. $core.addMethod(
  37940. $core.method({
  37941. selector: "canFlattenNonLocalReturns",
  37942. protocol: "testing",
  37943. args: [],
  37944. source: "canFlattenNonLocalReturns\x0a\x09^ true",
  37945. referencedClasses: [],
  37946. pragmas: [],
  37947. messageSends: []
  37948. }, function ($methodClass){ return function (){
  37949. var self=this,$self=this;
  37950. return true;
  37951. }; }),
  37952. $globals.MethodLexicalScope);
  37953. $core.addMethod(
  37954. $core.method({
  37955. selector: "hasLocalReturn",
  37956. protocol: "testing",
  37957. args: [],
  37958. source: "hasLocalReturn\x0a\x09^ self localReturn",
  37959. referencedClasses: [],
  37960. pragmas: [],
  37961. messageSends: ["localReturn"]
  37962. }, function ($methodClass){ return function (){
  37963. var self=this,$self=this;
  37964. return $core.withContext(function($ctx1) {
  37965. return $self._localReturn();
  37966. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{})});
  37967. }; }),
  37968. $globals.MethodLexicalScope);
  37969. $core.addMethod(
  37970. $core.method({
  37971. selector: "hasNonLocalReturn",
  37972. protocol: "testing",
  37973. args: [],
  37974. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  37975. referencedClasses: [],
  37976. pragmas: [],
  37977. messageSends: ["notEmpty", "nonLocalReturns"]
  37978. }, function ($methodClass){ return function (){
  37979. var self=this,$self=this;
  37980. return $core.withContext(function($ctx1) {
  37981. return $recv($self._nonLocalReturns())._notEmpty();
  37982. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{})});
  37983. }; }),
  37984. $globals.MethodLexicalScope);
  37985. $core.addMethod(
  37986. $core.method({
  37987. selector: "iVars",
  37988. protocol: "accessing",
  37989. args: [],
  37990. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  37991. referencedClasses: ["Dictionary"],
  37992. pragmas: [],
  37993. messageSends: ["ifNil:", "new"]
  37994. }, function ($methodClass){ return function (){
  37995. var self=this,$self=this;
  37996. return $core.withContext(function($ctx1) {
  37997. var $1;
  37998. $1=$self.iVars;
  37999. if($1 == null || $1.a$nil){
  38000. $self.iVars=$recv($globals.Dictionary)._new();
  38001. return $self.iVars;
  38002. } else {
  38003. return $1;
  38004. }
  38005. }, function($ctx1) {$ctx1.fill(self,"iVars",{})});
  38006. }; }),
  38007. $globals.MethodLexicalScope);
  38008. $core.addMethod(
  38009. $core.method({
  38010. selector: "isMethodScope",
  38011. protocol: "testing",
  38012. args: [],
  38013. source: "isMethodScope\x0a\x09^ true",
  38014. referencedClasses: [],
  38015. pragmas: [],
  38016. messageSends: []
  38017. }, function ($methodClass){ return function (){
  38018. var self=this,$self=this;
  38019. return true;
  38020. }; }),
  38021. $globals.MethodLexicalScope);
  38022. $core.addMethod(
  38023. $core.method({
  38024. selector: "localReturn",
  38025. protocol: "accessing",
  38026. args: [],
  38027. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  38028. referencedClasses: [],
  38029. pragmas: [],
  38030. messageSends: ["ifNil:"]
  38031. }, function ($methodClass){ return function (){
  38032. var self=this,$self=this;
  38033. return $core.withContext(function($ctx1) {
  38034. var $1;
  38035. $1=$self.localReturn;
  38036. if($1 == null || $1.a$nil){
  38037. return false;
  38038. } else {
  38039. return $1;
  38040. }
  38041. }, function($ctx1) {$ctx1.fill(self,"localReturn",{})});
  38042. }; }),
  38043. $globals.MethodLexicalScope);
  38044. $core.addMethod(
  38045. $core.method({
  38046. selector: "localReturn:",
  38047. protocol: "accessing",
  38048. args: ["aBoolean"],
  38049. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  38050. referencedClasses: [],
  38051. pragmas: [],
  38052. messageSends: []
  38053. }, function ($methodClass){ return function (aBoolean){
  38054. var self=this,$self=this;
  38055. $self.localReturn=aBoolean;
  38056. return self;
  38057. }; }),
  38058. $globals.MethodLexicalScope);
  38059. $core.addMethod(
  38060. $core.method({
  38061. selector: "methodScope",
  38062. protocol: "accessing",
  38063. args: [],
  38064. source: "methodScope\x0a\x09^ self",
  38065. referencedClasses: [],
  38066. pragmas: [],
  38067. messageSends: []
  38068. }, function ($methodClass){ return function (){
  38069. var self=this,$self=this;
  38070. return self;
  38071. }; }),
  38072. $globals.MethodLexicalScope);
  38073. $core.addMethod(
  38074. $core.method({
  38075. selector: "nonLocalReturns",
  38076. protocol: "accessing",
  38077. args: [],
  38078. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  38079. referencedClasses: ["OrderedCollection"],
  38080. pragmas: [],
  38081. messageSends: ["ifNil:", "new"]
  38082. }, function ($methodClass){ return function (){
  38083. var self=this,$self=this;
  38084. return $core.withContext(function($ctx1) {
  38085. var $1;
  38086. $1=$self.nonLocalReturns;
  38087. if($1 == null || $1.a$nil){
  38088. $self.nonLocalReturns=$recv($globals.OrderedCollection)._new();
  38089. return $self.nonLocalReturns;
  38090. } else {
  38091. return $1;
  38092. }
  38093. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{})});
  38094. }; }),
  38095. $globals.MethodLexicalScope);
  38096. $core.addMethod(
  38097. $core.method({
  38098. selector: "pseudoVars",
  38099. protocol: "accessing",
  38100. args: [],
  38101. source: "pseudoVars\x0a\x09pseudoVars ifNil: [\x0a\x09\x09pseudoVars := Dictionary new.\x0a\x09\x09PseudoVar dictionary keysAndValuesDo: [ :each :impl |\x0a\x09\x09\x09pseudoVars at: each put: ((impl on: each)\x0a\x09\x09\x09\x09scope: self methodScope;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x09^ pseudoVars",
  38102. referencedClasses: ["Dictionary", "PseudoVar"],
  38103. pragmas: [],
  38104. messageSends: ["ifNil:", "new", "keysAndValuesDo:", "dictionary", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  38105. }, function ($methodClass){ return function (){
  38106. var self=this,$self=this;
  38107. return $core.withContext(function($ctx1) {
  38108. var $1,$2,$3;
  38109. $1=$self.pseudoVars;
  38110. if($1 == null || $1.a$nil){
  38111. $self.pseudoVars=$recv($globals.Dictionary)._new();
  38112. $recv($recv($globals.PseudoVar)._dictionary())._keysAndValuesDo_((function(each,impl){
  38113. return $core.withContext(function($ctx2) {
  38114. $2=$self.pseudoVars;
  38115. $3=$recv(impl)._on_(each);
  38116. $recv($3)._scope_($self._methodScope());
  38117. return $recv($2)._at_put_(each,$recv($3)._yourself());
  38118. }, function($ctx2) {$ctx2.fillBlock({each:each,impl:impl},$ctx1,2)});
  38119. }));
  38120. } else {
  38121. $1;
  38122. }
  38123. return $self.pseudoVars;
  38124. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{})});
  38125. }; }),
  38126. $globals.MethodLexicalScope);
  38127. $core.addMethod(
  38128. $core.method({
  38129. selector: "removeNonLocalReturn:",
  38130. protocol: "adding",
  38131. args: ["aScope"],
  38132. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  38133. referencedClasses: [],
  38134. pragmas: [],
  38135. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  38136. }, function ($methodClass){ return function (aScope){
  38137. var self=this,$self=this;
  38138. return $core.withContext(function($ctx1) {
  38139. $recv($self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  38140. }));
  38141. return self;
  38142. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope})});
  38143. }; }),
  38144. $globals.MethodLexicalScope);
  38145. $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic");
  38146. $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.";
  38147. $core.addMethod(
  38148. $core.method({
  38149. selector: "alias",
  38150. protocol: "accessing",
  38151. args: [],
  38152. source: "alias\x0a\x09^ self name asVariableName",
  38153. referencedClasses: [],
  38154. pragmas: [],
  38155. messageSends: ["asVariableName", "name"]
  38156. }, function ($methodClass){ return function (){
  38157. var self=this,$self=this;
  38158. return $core.withContext(function($ctx1) {
  38159. return $recv($self._name())._asVariableName();
  38160. }, function($ctx1) {$ctx1.fill(self,"alias",{})});
  38161. }; }),
  38162. $globals.ScopeVar);
  38163. $core.addMethod(
  38164. $core.method({
  38165. selector: "isAssignable",
  38166. protocol: "testing",
  38167. args: [],
  38168. source: "isAssignable\x0a\x09^ false",
  38169. referencedClasses: [],
  38170. pragmas: [],
  38171. messageSends: []
  38172. }, function ($methodClass){ return function (){
  38173. var self=this,$self=this;
  38174. return false;
  38175. }; }),
  38176. $globals.ScopeVar);
  38177. $core.addMethod(
  38178. $core.method({
  38179. selector: "isIdempotent",
  38180. protocol: "testing",
  38181. args: [],
  38182. source: "isIdempotent\x0a\x09^ false",
  38183. referencedClasses: [],
  38184. pragmas: [],
  38185. messageSends: []
  38186. }, function ($methodClass){ return function (){
  38187. var self=this,$self=this;
  38188. return false;
  38189. }; }),
  38190. $globals.ScopeVar);
  38191. $core.addMethod(
  38192. $core.method({
  38193. selector: "isImmutable",
  38194. protocol: "testing",
  38195. args: [],
  38196. source: "isImmutable\x0a\x09self deprecatedAPI: 'Use #isIdempotent / #isAssignable not instead.'.\x0a\x09^ self isIdempotent",
  38197. referencedClasses: [],
  38198. pragmas: [],
  38199. messageSends: ["deprecatedAPI:", "isIdempotent"]
  38200. }, function ($methodClass){ return function (){
  38201. var self=this,$self=this;
  38202. return $core.withContext(function($ctx1) {
  38203. $self._deprecatedAPI_("Use #isIdempotent / #isAssignable not instead.");
  38204. return $self._isIdempotent();
  38205. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{})});
  38206. }; }),
  38207. $globals.ScopeVar);
  38208. $core.addMethod(
  38209. $core.method({
  38210. selector: "isSuper",
  38211. protocol: "testing",
  38212. args: [],
  38213. source: "isSuper\x0a\x09^ false",
  38214. referencedClasses: [],
  38215. pragmas: [],
  38216. messageSends: []
  38217. }, function ($methodClass){ return function (){
  38218. var self=this,$self=this;
  38219. return false;
  38220. }; }),
  38221. $globals.ScopeVar);
  38222. $core.addMethod(
  38223. $core.method({
  38224. selector: "name",
  38225. protocol: "accessing",
  38226. args: [],
  38227. source: "name\x0a\x09^ name",
  38228. referencedClasses: [],
  38229. pragmas: [],
  38230. messageSends: []
  38231. }, function ($methodClass){ return function (){
  38232. var self=this,$self=this;
  38233. return $self.name;
  38234. }; }),
  38235. $globals.ScopeVar);
  38236. $core.addMethod(
  38237. $core.method({
  38238. selector: "name:",
  38239. protocol: "accessing",
  38240. args: ["aString"],
  38241. source: "name: aString\x0a\x09name := aString",
  38242. referencedClasses: [],
  38243. pragmas: [],
  38244. messageSends: []
  38245. }, function ($methodClass){ return function (aString){
  38246. var self=this,$self=this;
  38247. $self.name=aString;
  38248. return self;
  38249. }; }),
  38250. $globals.ScopeVar);
  38251. $core.addMethod(
  38252. $core.method({
  38253. selector: "scope",
  38254. protocol: "accessing",
  38255. args: [],
  38256. source: "scope\x0a\x09^ scope",
  38257. referencedClasses: [],
  38258. pragmas: [],
  38259. messageSends: []
  38260. }, function ($methodClass){ return function (){
  38261. var self=this,$self=this;
  38262. return $self.scope;
  38263. }; }),
  38264. $globals.ScopeVar);
  38265. $core.addMethod(
  38266. $core.method({
  38267. selector: "scope:",
  38268. protocol: "accessing",
  38269. args: ["aScope"],
  38270. source: "scope: aScope\x0a\x09scope := aScope",
  38271. referencedClasses: [],
  38272. pragmas: [],
  38273. messageSends: []
  38274. }, function ($methodClass){ return function (aScope){
  38275. var self=this,$self=this;
  38276. $self.scope=aScope;
  38277. return self;
  38278. }; }),
  38279. $globals.ScopeVar);
  38280. $core.addMethod(
  38281. $core.method({
  38282. selector: "on:",
  38283. protocol: "instance creation",
  38284. args: ["aString"],
  38285. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  38286. referencedClasses: [],
  38287. pragmas: [],
  38288. messageSends: ["name:", "new", "yourself"]
  38289. }, function ($methodClass){ return function (aString){
  38290. var self=this,$self=this;
  38291. return $core.withContext(function($ctx1) {
  38292. var $1;
  38293. $1=$self._new();
  38294. $recv($1)._name_(aString);
  38295. return $recv($1)._yourself();
  38296. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString})});
  38297. }; }),
  38298. $globals.ScopeVar.a$cls);
  38299. $core.addClass("AliasVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38300. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  38301. $core.addMethod(
  38302. $core.method({
  38303. selector: "isAssignable",
  38304. protocol: "testing",
  38305. args: [],
  38306. source: "isAssignable\x0a\x09self error: 'Alias variable is internal, it should never appear in normal variable context.'",
  38307. referencedClasses: [],
  38308. pragmas: [],
  38309. messageSends: ["error:"]
  38310. }, function ($methodClass){ return function (){
  38311. var self=this,$self=this;
  38312. return $core.withContext(function($ctx1) {
  38313. $self._error_("Alias variable is internal, it should never appear in normal variable context.");
  38314. return self;
  38315. }, function($ctx1) {$ctx1.fill(self,"isAssignable",{})});
  38316. }; }),
  38317. $globals.AliasVar);
  38318. $core.addMethod(
  38319. $core.method({
  38320. selector: "isIdempotent",
  38321. protocol: "testing",
  38322. args: [],
  38323. source: "isIdempotent\x0a\x09^ true",
  38324. referencedClasses: [],
  38325. pragmas: [],
  38326. messageSends: []
  38327. }, function ($methodClass){ return function (){
  38328. var self=this,$self=this;
  38329. return true;
  38330. }; }),
  38331. $globals.AliasVar);
  38332. $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38333. $globals.ArgVar.comment="I am an argument of a method or block.";
  38334. $core.addMethod(
  38335. $core.method({
  38336. selector: "isIdempotent",
  38337. protocol: "testing",
  38338. args: [],
  38339. source: "isIdempotent\x0a\x09^ true",
  38340. referencedClasses: [],
  38341. pragmas: [],
  38342. messageSends: []
  38343. }, function ($methodClass){ return function (){
  38344. var self=this,$self=this;
  38345. return true;
  38346. }; }),
  38347. $globals.ArgVar);
  38348. $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38349. $globals.ClassRefVar.comment="I am an class reference variable";
  38350. $core.addMethod(
  38351. $core.method({
  38352. selector: "alias",
  38353. protocol: "accessing",
  38354. args: [],
  38355. source: "alias\x0a\x09^ '$globals.', self name",
  38356. referencedClasses: [],
  38357. pragmas: [],
  38358. messageSends: [",", "name"]
  38359. }, function ($methodClass){ return function (){
  38360. var self=this,$self=this;
  38361. return $core.withContext(function($ctx1) {
  38362. return "$globals.".__comma($self._name());
  38363. }, function($ctx1) {$ctx1.fill(self,"alias",{})});
  38364. }; }),
  38365. $globals.ClassRefVar);
  38366. $core.addClass("ExternallyKnownVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38367. $globals.ExternallyKnownVar.comment="I am a variable known externally (not in method scope).";
  38368. $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38369. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  38370. $core.addMethod(
  38371. $core.method({
  38372. selector: "alias",
  38373. protocol: "testing",
  38374. args: [],
  38375. source: "alias\x0a\x09^ '$self.', self name",
  38376. referencedClasses: [],
  38377. pragmas: [],
  38378. messageSends: [",", "name"]
  38379. }, function ($methodClass){ return function (){
  38380. var self=this,$self=this;
  38381. return $core.withContext(function($ctx1) {
  38382. return "$self.".__comma($self._name());
  38383. }, function($ctx1) {$ctx1.fill(self,"alias",{})});
  38384. }; }),
  38385. $globals.InstanceVar);
  38386. $core.addMethod(
  38387. $core.method({
  38388. selector: "isAssignable",
  38389. protocol: "testing",
  38390. args: [],
  38391. source: "isAssignable\x0a\x09^ true",
  38392. referencedClasses: [],
  38393. pragmas: [],
  38394. messageSends: []
  38395. }, function ($methodClass){ return function (){
  38396. var self=this,$self=this;
  38397. return true;
  38398. }; }),
  38399. $globals.InstanceVar);
  38400. $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38401. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  38402. $core.addMethod(
  38403. $core.method({
  38404. selector: "alias",
  38405. protocol: "accessing",
  38406. args: [],
  38407. source: "alias\x0a\x09^ self name",
  38408. referencedClasses: [],
  38409. pragmas: [],
  38410. messageSends: ["name"]
  38411. }, function ($methodClass){ return function (){
  38412. var self=this,$self=this;
  38413. return $core.withContext(function($ctx1) {
  38414. return $self._name();
  38415. }, function($ctx1) {$ctx1.fill(self,"alias",{})});
  38416. }; }),
  38417. $globals.PseudoVar);
  38418. $core.addMethod(
  38419. $core.method({
  38420. selector: "isIdempotent",
  38421. protocol: "testing",
  38422. args: [],
  38423. source: "isIdempotent\x0a\x09^ true",
  38424. referencedClasses: [],
  38425. pragmas: [],
  38426. messageSends: []
  38427. }, function ($methodClass){ return function (){
  38428. var self=this,$self=this;
  38429. return true;
  38430. }; }),
  38431. $globals.PseudoVar);
  38432. $core.setSlots($globals.PseudoVar.a$cls, ["dictionary", "receiverNames"]);
  38433. $core.addMethod(
  38434. $core.method({
  38435. selector: "dictionary",
  38436. protocol: "accessing",
  38437. args: [],
  38438. source: "dictionary\x0a\x09^ dictionary ifNil: [ dictionary := Dictionary new\x0a\x09\x09at: #self put: PseudoVar;\x0a\x09\x09at: #super put: SuperVar;\x0a\x09\x09at: #nil put: PseudoVar;\x0a\x09\x09at: #false put: PseudoVar;\x0a\x09\x09at: #true put: PseudoVar;\x0a\x09\x09at: #thisContext put: ThisContextVar;\x0a\x09\x09yourself ]",
  38439. referencedClasses: ["Dictionary", "PseudoVar", "SuperVar", "ThisContextVar"],
  38440. pragmas: [],
  38441. messageSends: ["ifNil:", "at:put:", "new", "yourself"]
  38442. }, function ($methodClass){ return function (){
  38443. var self=this,$self=this;
  38444. return $core.withContext(function($ctx1) {
  38445. var $1,$2;
  38446. $1=$self.dictionary;
  38447. if($1 == null || $1.a$nil){
  38448. $2=$recv($globals.Dictionary)._new();
  38449. [$recv($2)._at_put_("self",$globals.PseudoVar)
  38450. ,$ctx1.sendIdx["at:put:"]=1
  38451. ][0];
  38452. [$recv($2)._at_put_("super",$globals.SuperVar)
  38453. ,$ctx1.sendIdx["at:put:"]=2
  38454. ][0];
  38455. [$recv($2)._at_put_("nil",$globals.PseudoVar)
  38456. ,$ctx1.sendIdx["at:put:"]=3
  38457. ][0];
  38458. [$recv($2)._at_put_("false",$globals.PseudoVar)
  38459. ,$ctx1.sendIdx["at:put:"]=4
  38460. ][0];
  38461. [$recv($2)._at_put_("true",$globals.PseudoVar)
  38462. ,$ctx1.sendIdx["at:put:"]=5
  38463. ][0];
  38464. $recv($2)._at_put_("thisContext",$globals.ThisContextVar);
  38465. $self.dictionary=$recv($2)._yourself();
  38466. return $self.dictionary;
  38467. } else {
  38468. return $1;
  38469. }
  38470. }, function($ctx1) {$ctx1.fill(self,"dictionary",{})});
  38471. }; }),
  38472. $globals.PseudoVar.a$cls);
  38473. $core.addMethod(
  38474. $core.method({
  38475. selector: "receiverNames",
  38476. protocol: "accessing",
  38477. args: [],
  38478. source: "receiverNames\x0a\x09^ receiverNames ifNil: [ receiverNames := Dictionary new\x0a\x09\x09at: #self put: '$self';\x0a\x09\x09at: #super put: '$self';\x0a\x09\x09at: #nil put: '$nil';\x0a\x09\x09yourself ]",
  38479. referencedClasses: ["Dictionary"],
  38480. pragmas: [],
  38481. messageSends: ["ifNil:", "at:put:", "new", "yourself"]
  38482. }, function ($methodClass){ return function (){
  38483. var self=this,$self=this;
  38484. return $core.withContext(function($ctx1) {
  38485. var $1,$2;
  38486. $1=$self.receiverNames;
  38487. if($1 == null || $1.a$nil){
  38488. $2=$recv($globals.Dictionary)._new();
  38489. [$recv($2)._at_put_("self","$self")
  38490. ,$ctx1.sendIdx["at:put:"]=1
  38491. ][0];
  38492. [$recv($2)._at_put_("super","$self")
  38493. ,$ctx1.sendIdx["at:put:"]=2
  38494. ][0];
  38495. $recv($2)._at_put_("nil","$nil");
  38496. $self.receiverNames=$recv($2)._yourself();
  38497. return $self.receiverNames;
  38498. } else {
  38499. return $1;
  38500. }
  38501. }, function($ctx1) {$ctx1.fill(self,"receiverNames",{})});
  38502. }; }),
  38503. $globals.PseudoVar.a$cls);
  38504. $core.addClass("SuperVar", $globals.PseudoVar, [], "Compiler-Semantic");
  38505. $globals.SuperVar.comment="I am a 'super' pseudo variable.";
  38506. $core.addMethod(
  38507. $core.method({
  38508. selector: "isSuper",
  38509. protocol: "testing",
  38510. args: [],
  38511. source: "isSuper\x0a\x09^ true",
  38512. referencedClasses: [],
  38513. pragmas: [],
  38514. messageSends: []
  38515. }, function ($methodClass){ return function (){
  38516. var self=this,$self=this;
  38517. return true;
  38518. }; }),
  38519. $globals.SuperVar);
  38520. $core.addMethod(
  38521. $core.method({
  38522. selector: "lookupAsJavaScriptSource",
  38523. protocol: "accessing",
  38524. args: [],
  38525. source: "lookupAsJavaScriptSource\x0a\x09^ '($methodClass.superclass||$boot.nilAsClass).fn.prototype'",
  38526. referencedClasses: [],
  38527. pragmas: [],
  38528. messageSends: []
  38529. }, function ($methodClass){ return function (){
  38530. var self=this,$self=this;
  38531. return "($methodClass.superclass||$boot.nilAsClass).fn.prototype";
  38532. }; }),
  38533. $globals.SuperVar);
  38534. $core.addClass("JavaScriptSuperVar", $globals.SuperVar, [], "Compiler-Semantic");
  38535. $core.addMethod(
  38536. $core.method({
  38537. selector: "lookupAsJavaScriptSource",
  38538. protocol: "accessing",
  38539. args: [],
  38540. source: "lookupAsJavaScriptSource\x0a\x09^ 'Object.getPrototypeOf($methodClass.fn.prototype)'",
  38541. referencedClasses: [],
  38542. pragmas: [],
  38543. messageSends: []
  38544. }, function ($methodClass){ return function (){
  38545. var self=this,$self=this;
  38546. return "Object.getPrototypeOf($methodClass.fn.prototype)";
  38547. }; }),
  38548. $globals.JavaScriptSuperVar);
  38549. $core.addClass("ThisContextVar", $globals.PseudoVar, [], "Compiler-Semantic");
  38550. $globals.ThisContextVar.comment="I am a 'thisContext' pseudo variable.";
  38551. $core.addMethod(
  38552. $core.method({
  38553. selector: "alias",
  38554. protocol: "accessing",
  38555. args: [],
  38556. source: "alias\x0a\x09^ '$core.getThisContext()'",
  38557. referencedClasses: [],
  38558. pragmas: [],
  38559. messageSends: []
  38560. }, function ($methodClass){ return function (){
  38561. var self=this,$self=this;
  38562. return "$core.getThisContext()";
  38563. }; }),
  38564. $globals.ThisContextVar);
  38565. $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38566. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  38567. $core.addMethod(
  38568. $core.method({
  38569. selector: "isAssignable",
  38570. protocol: "testing",
  38571. args: [],
  38572. source: "isAssignable\x0a\x09^ true",
  38573. referencedClasses: [],
  38574. pragmas: [],
  38575. messageSends: []
  38576. }, function ($methodClass){ return function (){
  38577. var self=this,$self=this;
  38578. return true;
  38579. }; }),
  38580. $globals.TempVar);
  38581. $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic");
  38582. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  38583. $core.addMethod(
  38584. $core.method({
  38585. selector: "bindUnscopedVariable:",
  38586. protocol: "private",
  38587. args: ["aString"],
  38588. source: "bindUnscopedVariable: aString\x0a\x09aString isCapitalized ifTrue: [ \x22Capital letter variables might be globals.\x22\x0a\x09\x09self classReferences add: aString.\x0a\x09\x09^ ClassRefVar new name: aString; yourself ].\x0a\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((Smalltalk globalJsVariables includes: aString)\x0a\x09\x09or: [ self isVariableKnown: aString inPackage: self thePackage ]) ifTrue: [\x0a\x09\x09\x09^ ExternallyKnownVar new name: aString; yourself ].\x0a\x0a\x09self errorUnknownVariable: aString",
  38589. referencedClasses: ["ClassRefVar", "Smalltalk", "ExternallyKnownVar"],
  38590. pragmas: [],
  38591. messageSends: ["ifTrue:", "isCapitalized", "add:", "classReferences", "name:", "new", "yourself", "or:", "includes:", "globalJsVariables", "isVariableKnown:inPackage:", "thePackage", "errorUnknownVariable:"]
  38592. }, function ($methodClass){ return function (aString){
  38593. var self=this,$self=this;
  38594. return $core.withContext(function($ctx1) {
  38595. var $1,$2;
  38596. if($core.assert($recv(aString)._isCapitalized())){
  38597. $recv($self._classReferences())._add_(aString);
  38598. $1=[$recv($globals.ClassRefVar)._new()
  38599. ,$ctx1.sendIdx["new"]=1
  38600. ][0];
  38601. [$recv($1)._name_(aString)
  38602. ,$ctx1.sendIdx["name:"]=1
  38603. ][0];
  38604. return [$recv($1)._yourself()
  38605. ,$ctx1.sendIdx["yourself"]=1
  38606. ][0];
  38607. }
  38608. if($core.assert($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(aString))._or_((function(){
  38609. return $core.withContext(function($ctx2) {
  38610. return $self._isVariableKnown_inPackage_(aString,$self._thePackage());
  38611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38612. })))){
  38613. $2=$recv($globals.ExternallyKnownVar)._new();
  38614. $recv($2)._name_(aString);
  38615. return $recv($2)._yourself();
  38616. }
  38617. $self._errorUnknownVariable_(aString);
  38618. return self;
  38619. }, function($ctx1) {$ctx1.fill(self,"bindUnscopedVariable:",{aString:aString})});
  38620. }; }),
  38621. $globals.SemanticAnalyzer);
  38622. $core.addMethod(
  38623. $core.method({
  38624. selector: "classReferences",
  38625. protocol: "accessing",
  38626. args: [],
  38627. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  38628. referencedClasses: ["Set"],
  38629. pragmas: [],
  38630. messageSends: ["ifNil:", "new"]
  38631. }, function ($methodClass){ return function (){
  38632. var self=this,$self=this;
  38633. return $core.withContext(function($ctx1) {
  38634. var $1;
  38635. $1=$self.classReferences;
  38636. if($1 == null || $1.a$nil){
  38637. $self.classReferences=$recv($globals.Set)._new();
  38638. return $self.classReferences;
  38639. } else {
  38640. return $1;
  38641. }
  38642. }, function($ctx1) {$ctx1.fill(self,"classReferences",{})});
  38643. }; }),
  38644. $globals.SemanticAnalyzer);
  38645. $core.addMethod(
  38646. $core.method({
  38647. selector: "errorInvalidAssignment:",
  38648. protocol: "error handling",
  38649. args: ["aString"],
  38650. source: "errorInvalidAssignment: aString\x0a\x09InvalidAssignmentError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  38651. referencedClasses: ["InvalidAssignmentError"],
  38652. pragmas: [],
  38653. messageSends: ["variableName:", "new", "signal"]
  38654. }, function ($methodClass){ return function (aString){
  38655. var self=this,$self=this;
  38656. return $core.withContext(function($ctx1) {
  38657. var $1;
  38658. $1=$recv($globals.InvalidAssignmentError)._new();
  38659. $recv($1)._variableName_(aString);
  38660. $recv($1)._signal();
  38661. return self;
  38662. }, function($ctx1) {$ctx1.fill(self,"errorInvalidAssignment:",{aString:aString})});
  38663. }; }),
  38664. $globals.SemanticAnalyzer);
  38665. $core.addMethod(
  38666. $core.method({
  38667. selector: "errorShadowingVariable:",
  38668. protocol: "error handling",
  38669. args: ["aString"],
  38670. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  38671. referencedClasses: ["ShadowingVariableError"],
  38672. pragmas: [],
  38673. messageSends: ["variableName:", "new", "signal"]
  38674. }, function ($methodClass){ return function (aString){
  38675. var self=this,$self=this;
  38676. return $core.withContext(function($ctx1) {
  38677. var $1;
  38678. $1=$recv($globals.ShadowingVariableError)._new();
  38679. $recv($1)._variableName_(aString);
  38680. $recv($1)._signal();
  38681. return self;
  38682. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString})});
  38683. }; }),
  38684. $globals.SemanticAnalyzer);
  38685. $core.addMethod(
  38686. $core.method({
  38687. selector: "errorUnknownVariable:",
  38688. protocol: "error handling",
  38689. args: ["aString"],
  38690. source: "errorUnknownVariable: aString\x0a\x09UnknownVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  38691. referencedClasses: ["UnknownVariableError"],
  38692. pragmas: [],
  38693. messageSends: ["variableName:", "new", "signal"]
  38694. }, function ($methodClass){ return function (aString){
  38695. var self=this,$self=this;
  38696. return $core.withContext(function($ctx1) {
  38697. var $1;
  38698. $1=$recv($globals.UnknownVariableError)._new();
  38699. $recv($1)._variableName_(aString);
  38700. $recv($1)._signal();
  38701. return self;
  38702. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aString:aString})});
  38703. }; }),
  38704. $globals.SemanticAnalyzer);
  38705. $core.addMethod(
  38706. $core.method({
  38707. selector: "isVariableKnown:inPackage:",
  38708. protocol: "testing",
  38709. args: ["aString", "aPackage"],
  38710. source: "isVariableKnown: aString inPackage: aPackage\x0a\x09^ Compiler new\x0a\x09\x09eval: 'typeof(', aString, ')!== \x22undefined\x22||(function(){try{return(', aString, ',true)}catch(_){return false}})()'\x0a\x09\x09forPackage: aPackage",
  38711. referencedClasses: ["Compiler"],
  38712. pragmas: [],
  38713. messageSends: ["eval:forPackage:", "new", ","]
  38714. }, function ($methodClass){ return function (aString,aPackage){
  38715. var self=this,$self=this;
  38716. return $core.withContext(function($ctx1) {
  38717. return $recv($recv($globals.Compiler)._new())._eval_forPackage_([$recv([$recv([$recv("typeof(".__comma(aString)).__comma(")!== \x22undefined\x22||(function(){try{return(")
  38718. ,$ctx1.sendIdx[","]=3
  38719. ][0]).__comma(aString)
  38720. ,$ctx1.sendIdx[","]=2
  38721. ][0]).__comma(",true)}catch(_){return false}})()")
  38722. ,$ctx1.sendIdx[","]=1
  38723. ][0],aPackage);
  38724. }, function($ctx1) {$ctx1.fill(self,"isVariableKnown:inPackage:",{aString:aString,aPackage:aPackage})});
  38725. }; }),
  38726. $globals.SemanticAnalyzer);
  38727. $core.addMethod(
  38728. $core.method({
  38729. selector: "messageSends",
  38730. protocol: "accessing",
  38731. args: [],
  38732. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  38733. referencedClasses: ["Dictionary"],
  38734. pragmas: [],
  38735. messageSends: ["ifNil:", "new"]
  38736. }, function ($methodClass){ return function (){
  38737. var self=this,$self=this;
  38738. return $core.withContext(function($ctx1) {
  38739. var $1;
  38740. $1=$self.messageSends;
  38741. if($1 == null || $1.a$nil){
  38742. $self.messageSends=$recv($globals.Dictionary)._new();
  38743. return $self.messageSends;
  38744. } else {
  38745. return $1;
  38746. }
  38747. }, function($ctx1) {$ctx1.fill(self,"messageSends",{})});
  38748. }; }),
  38749. $globals.SemanticAnalyzer);
  38750. $core.addMethod(
  38751. $core.method({
  38752. selector: "newBlockScope",
  38753. protocol: "factory",
  38754. args: [],
  38755. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  38756. referencedClasses: ["LexicalScope"],
  38757. pragmas: [],
  38758. messageSends: ["newScopeOfClass:"]
  38759. }, function ($methodClass){ return function (){
  38760. var self=this,$self=this;
  38761. return $core.withContext(function($ctx1) {
  38762. return $self._newScopeOfClass_($globals.LexicalScope);
  38763. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{})});
  38764. }; }),
  38765. $globals.SemanticAnalyzer);
  38766. $core.addMethod(
  38767. $core.method({
  38768. selector: "newMethodScope",
  38769. protocol: "factory",
  38770. args: [],
  38771. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  38772. referencedClasses: ["MethodLexicalScope"],
  38773. pragmas: [],
  38774. messageSends: ["newScopeOfClass:"]
  38775. }, function ($methodClass){ return function (){
  38776. var self=this,$self=this;
  38777. return $core.withContext(function($ctx1) {
  38778. return $self._newScopeOfClass_($globals.MethodLexicalScope);
  38779. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{})});
  38780. }; }),
  38781. $globals.SemanticAnalyzer);
  38782. $core.addMethod(
  38783. $core.method({
  38784. selector: "newScopeOfClass:",
  38785. protocol: "factory",
  38786. args: ["aLexicalScopeClass"],
  38787. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  38788. referencedClasses: [],
  38789. pragmas: [],
  38790. messageSends: ["outerScope:", "new", "yourself"]
  38791. }, function ($methodClass){ return function (aLexicalScopeClass){
  38792. var self=this,$self=this;
  38793. return $core.withContext(function($ctx1) {
  38794. var $1;
  38795. $1=$recv(aLexicalScopeClass)._new();
  38796. $recv($1)._outerScope_($self.currentScope);
  38797. return $recv($1)._yourself();
  38798. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass})});
  38799. }; }),
  38800. $globals.SemanticAnalyzer);
  38801. $core.addMethod(
  38802. $core.method({
  38803. selector: "nextBlockIndex",
  38804. protocol: "private",
  38805. args: [],
  38806. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  38807. referencedClasses: [],
  38808. pragmas: [],
  38809. messageSends: ["ifNil:", "+"]
  38810. }, function ($methodClass){ return function (){
  38811. var self=this,$self=this;
  38812. return $core.withContext(function($ctx1) {
  38813. var $1;
  38814. $1=$self.blockIndex;
  38815. if($1 == null || $1.a$nil){
  38816. $self.blockIndex=(0);
  38817. $self.blockIndex;
  38818. } else {
  38819. $1;
  38820. }
  38821. $self.blockIndex=$recv($self.blockIndex).__plus((1));
  38822. return $self.blockIndex;
  38823. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{})});
  38824. }; }),
  38825. $globals.SemanticAnalyzer);
  38826. $core.addMethod(
  38827. $core.method({
  38828. selector: "popScope",
  38829. protocol: "scope",
  38830. args: [],
  38831. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  38832. referencedClasses: [],
  38833. pragmas: [],
  38834. messageSends: ["ifNotNil:", "outerScope"]
  38835. }, function ($methodClass){ return function (){
  38836. var self=this,$self=this;
  38837. return $core.withContext(function($ctx1) {
  38838. var $1;
  38839. $1=$self.currentScope;
  38840. if($1 == null || $1.a$nil){
  38841. $1;
  38842. } else {
  38843. $self.currentScope=$recv($self.currentScope)._outerScope();
  38844. $self.currentScope;
  38845. }
  38846. return self;
  38847. }, function($ctx1) {$ctx1.fill(self,"popScope",{})});
  38848. }; }),
  38849. $globals.SemanticAnalyzer);
  38850. $core.addMethod(
  38851. $core.method({
  38852. selector: "pushScope:",
  38853. protocol: "scope",
  38854. args: ["aScope"],
  38855. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  38856. referencedClasses: [],
  38857. pragmas: [],
  38858. messageSends: ["outerScope:"]
  38859. }, function ($methodClass){ return function (aScope){
  38860. var self=this,$self=this;
  38861. return $core.withContext(function($ctx1) {
  38862. $recv(aScope)._outerScope_($self.currentScope);
  38863. $self.currentScope=aScope;
  38864. return self;
  38865. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope})});
  38866. }; }),
  38867. $globals.SemanticAnalyzer);
  38868. $core.addMethod(
  38869. $core.method({
  38870. selector: "theClass",
  38871. protocol: "accessing",
  38872. args: [],
  38873. source: "theClass\x0a\x09^ theClass",
  38874. referencedClasses: [],
  38875. pragmas: [],
  38876. messageSends: []
  38877. }, function ($methodClass){ return function (){
  38878. var self=this,$self=this;
  38879. return $self.theClass;
  38880. }; }),
  38881. $globals.SemanticAnalyzer);
  38882. $core.addMethod(
  38883. $core.method({
  38884. selector: "theClass:",
  38885. protocol: "accessing",
  38886. args: ["aClass"],
  38887. source: "theClass: aClass\x0a\x09theClass := aClass",
  38888. referencedClasses: [],
  38889. pragmas: [],
  38890. messageSends: []
  38891. }, function ($methodClass){ return function (aClass){
  38892. var self=this,$self=this;
  38893. $self.theClass=aClass;
  38894. return self;
  38895. }; }),
  38896. $globals.SemanticAnalyzer);
  38897. $core.addMethod(
  38898. $core.method({
  38899. selector: "thePackage",
  38900. protocol: "accessing",
  38901. args: [],
  38902. source: "thePackage\x0a\x09^ thePackage",
  38903. referencedClasses: [],
  38904. pragmas: [],
  38905. messageSends: []
  38906. }, function ($methodClass){ return function (){
  38907. var self=this,$self=this;
  38908. return $self.thePackage;
  38909. }; }),
  38910. $globals.SemanticAnalyzer);
  38911. $core.addMethod(
  38912. $core.method({
  38913. selector: "thePackage:",
  38914. protocol: "accessing",
  38915. args: ["aPackage"],
  38916. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  38917. referencedClasses: [],
  38918. pragmas: [],
  38919. messageSends: []
  38920. }, function ($methodClass){ return function (aPackage){
  38921. var self=this,$self=this;
  38922. $self.thePackage=aPackage;
  38923. return self;
  38924. }; }),
  38925. $globals.SemanticAnalyzer);
  38926. $core.addMethod(
  38927. $core.method({
  38928. selector: "validateVariableScope:",
  38929. protocol: "scope",
  38930. args: ["aString"],
  38931. 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 ]",
  38932. referencedClasses: [],
  38933. pragmas: [],
  38934. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  38935. }, function ($methodClass){ return function (aString){
  38936. var self=this,$self=this;
  38937. return $core.withContext(function($ctx1) {
  38938. var $1;
  38939. $1=$recv($self.currentScope)._lookupVariable_(aString);
  38940. if($1 == null || $1.a$nil){
  38941. $1;
  38942. } else {
  38943. $self._errorShadowingVariable_(aString);
  38944. }
  38945. return self;
  38946. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString})});
  38947. }; }),
  38948. $globals.SemanticAnalyzer);
  38949. $core.addMethod(
  38950. $core.method({
  38951. selector: "visitAssignmentNode:",
  38952. protocol: "visiting",
  38953. args: ["aNode"],
  38954. source: "visitAssignmentNode: aNode\x0a\x09| lhs |\x0a\x09super visitAssignmentNode: aNode.\x0a\x09lhs := aNode left.\x0a\x09lhs isAssignable ifFalse: [ self errorInvalidAssignment: lhs identifier ].\x0a\x09lhs assigned: true",
  38955. referencedClasses: [],
  38956. pragmas: [],
  38957. messageSends: ["visitAssignmentNode:", "left", "ifFalse:", "isAssignable", "errorInvalidAssignment:", "identifier", "assigned:"]
  38958. }, function ($methodClass){ return function (aNode){
  38959. var self=this,$self=this;
  38960. var lhs;
  38961. return $core.withContext(function($ctx1) {
  38962. [(
  38963. $ctx1.supercall = true,
  38964. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.call($self,aNode))
  38965. ,$ctx1.supercall = false
  38966. ][0];
  38967. lhs=$recv(aNode)._left();
  38968. if(!$core.assert($recv(lhs)._isAssignable())){
  38969. $self._errorInvalidAssignment_($recv(lhs)._identifier());
  38970. }
  38971. $recv(lhs)._assigned_(true);
  38972. return self;
  38973. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,lhs:lhs})});
  38974. }; }),
  38975. $globals.SemanticAnalyzer);
  38976. $core.addMethod(
  38977. $core.method({
  38978. selector: "visitBlockNode:",
  38979. protocol: "visiting",
  38980. args: ["aNode"],
  38981. 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",
  38982. referencedClasses: [],
  38983. pragmas: [],
  38984. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  38985. }, function ($methodClass){ return function (aNode){
  38986. var self=this,$self=this;
  38987. return $core.withContext(function($ctx1) {
  38988. $self._pushScope_($self._newBlockScope());
  38989. $recv(aNode)._scope_($self.currentScope);
  38990. $recv($self.currentScope)._node_(aNode);
  38991. $recv($self.currentScope)._blockIndex_($self._nextBlockIndex());
  38992. $recv($recv(aNode)._parameters())._do_((function(each){
  38993. return $core.withContext(function($ctx2) {
  38994. $self._validateVariableScope_(each);
  38995. return $recv($self.currentScope)._addArg_(each);
  38996. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38997. }));
  38998. [(
  38999. $ctx1.supercall = true,
  39000. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.call($self,aNode))
  39001. ,$ctx1.supercall = false
  39002. ][0];
  39003. $self._popScope();
  39004. return self;
  39005. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode})});
  39006. }; }),
  39007. $globals.SemanticAnalyzer);
  39008. $core.addMethod(
  39009. $core.method({
  39010. selector: "visitCascadeNode:",
  39011. protocol: "visiting",
  39012. args: ["aNode"],
  39013. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09aNode dagChildren allButLast do: [ :each | each beSideEffect ].\x0a\x09super visitCascadeNode: aNode",
  39014. referencedClasses: [],
  39015. pragmas: [],
  39016. messageSends: ["receiver:", "receiver", "first", "dagChildren", "do:", "allButLast", "beSideEffect", "visitCascadeNode:"]
  39017. }, function ($methodClass){ return function (aNode){
  39018. var self=this,$self=this;
  39019. return $core.withContext(function($ctx1) {
  39020. $recv(aNode)._receiver_($recv($recv([$recv(aNode)._dagChildren()
  39021. ,$ctx1.sendIdx["dagChildren"]=1
  39022. ][0])._first())._receiver());
  39023. $recv($recv($recv(aNode)._dagChildren())._allButLast())._do_((function(each){
  39024. return $core.withContext(function($ctx2) {
  39025. return $recv(each)._beSideEffect();
  39026. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39027. }));
  39028. [(
  39029. $ctx1.supercall = true,
  39030. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.call($self,aNode))
  39031. ,$ctx1.supercall = false
  39032. ][0];
  39033. return self;
  39034. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode})});
  39035. }; }),
  39036. $globals.SemanticAnalyzer);
  39037. $core.addMethod(
  39038. $core.method({
  39039. selector: "visitMethodNode:",
  39040. protocol: "visiting",
  39041. args: ["aNode"],
  39042. 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",
  39043. referencedClasses: [],
  39044. pragmas: [],
  39045. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  39046. }, function ($methodClass){ return function (aNode){
  39047. var self=this,$self=this;
  39048. return $core.withContext(function($ctx1) {
  39049. $self._pushScope_($self._newMethodScope());
  39050. $recv(aNode)._scope_($self.currentScope);
  39051. $recv($self.currentScope)._node_(aNode);
  39052. [$recv($recv($self._theClass())._allInstanceVariableNames())._do_((function(each){
  39053. return $core.withContext(function($ctx2) {
  39054. return $recv($self.currentScope)._addIVar_(each);
  39055. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39056. }))
  39057. ,$ctx1.sendIdx["do:"]=1
  39058. ][0];
  39059. $recv($recv(aNode)._arguments())._do_((function(each){
  39060. return $core.withContext(function($ctx2) {
  39061. $self._validateVariableScope_(each);
  39062. return $recv($self.currentScope)._addArg_(each);
  39063. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39064. }));
  39065. [(
  39066. $ctx1.supercall = true,
  39067. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.call($self,aNode))
  39068. ,$ctx1.supercall = false
  39069. ][0];
  39070. $recv(aNode)._classReferences_($self._classReferences());
  39071. $recv(aNode)._sendIndexes_($self._messageSends());
  39072. $self._popScope();
  39073. return aNode;
  39074. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode})});
  39075. }; }),
  39076. $globals.SemanticAnalyzer);
  39077. $core.addMethod(
  39078. $core.method({
  39079. selector: "visitReturnNode:",
  39080. protocol: "visiting",
  39081. args: ["aNode"],
  39082. 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",
  39083. referencedClasses: [],
  39084. pragmas: [],
  39085. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  39086. }, function ($methodClass){ return function (aNode){
  39087. var self=this,$self=this;
  39088. return $core.withContext(function($ctx1) {
  39089. $recv(aNode)._scope_($self.currentScope);
  39090. if($core.assert($recv($self.currentScope)._isMethodScope())){
  39091. $recv($self.currentScope)._localReturn_(true);
  39092. } else {
  39093. $recv($recv($self.currentScope)._methodScope())._addNonLocalReturn_($self.currentScope);
  39094. }
  39095. [(
  39096. $ctx1.supercall = true,
  39097. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.call($self,aNode))
  39098. ,$ctx1.supercall = false
  39099. ][0];
  39100. return self;
  39101. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode})});
  39102. }; }),
  39103. $globals.SemanticAnalyzer);
  39104. $core.addMethod(
  39105. $core.method({
  39106. selector: "visitSendNode:",
  39107. protocol: "visiting",
  39108. args: ["aNode"],
  39109. 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",
  39110. referencedClasses: ["OrderedCollection"],
  39111. pragmas: [],
  39112. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  39113. }, function ($methodClass){ return function (aNode){
  39114. var self=this,$self=this;
  39115. var sends;
  39116. return $core.withContext(function($ctx1) {
  39117. sends=$recv($self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  39118. return $core.withContext(function($ctx2) {
  39119. return $recv($globals.OrderedCollection)._new();
  39120. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39121. }));
  39122. $recv(sends)._add_(aNode);
  39123. $recv(aNode)._index_($recv(sends)._size());
  39124. [(
  39125. $ctx1.supercall = true,
  39126. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.call($self,aNode))
  39127. ,$ctx1.supercall = false
  39128. ][0];
  39129. return self;
  39130. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends})});
  39131. }; }),
  39132. $globals.SemanticAnalyzer);
  39133. $core.addMethod(
  39134. $core.method({
  39135. selector: "visitSequenceNode:",
  39136. protocol: "visiting",
  39137. args: ["aNode"],
  39138. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  39139. referencedClasses: [],
  39140. pragmas: [],
  39141. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  39142. }, function ($methodClass){ return function (aNode){
  39143. var self=this,$self=this;
  39144. return $core.withContext(function($ctx1) {
  39145. $recv($recv(aNode)._temps())._do_((function(each){
  39146. return $core.withContext(function($ctx2) {
  39147. $self._validateVariableScope_(each);
  39148. return $recv($self.currentScope)._addTemp_(each);
  39149. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39150. }));
  39151. [(
  39152. $ctx1.supercall = true,
  39153. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.call($self,aNode))
  39154. ,$ctx1.supercall = false
  39155. ][0];
  39156. return self;
  39157. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode})});
  39158. }; }),
  39159. $globals.SemanticAnalyzer);
  39160. $core.addMethod(
  39161. $core.method({
  39162. selector: "visitVariableNode:",
  39163. protocol: "visiting",
  39164. args: ["aNode"],
  39165. source: "visitVariableNode: aNode\x0a\x09\x22Bind a ScopeVar to aNode by doing a lookup in the current scope.\x0a\x09If no var is found in scope, represent an externally known variable or throw an error.\x22\x0a\x0a\x09aNode binding:\x0a\x09\x09((currentScope lookupVariable: aNode identifier) ifNil: [ self bindUnscopedVariable: aNode identifier ])",
  39166. referencedClasses: [],
  39167. pragmas: [],
  39168. messageSends: ["binding:", "ifNil:", "lookupVariable:", "identifier", "bindUnscopedVariable:"]
  39169. }, function ($methodClass){ return function (aNode){
  39170. var self=this,$self=this;
  39171. return $core.withContext(function($ctx1) {
  39172. var $1,$2;
  39173. $1=$recv($self.currentScope)._lookupVariable_([$recv(aNode)._identifier()
  39174. ,$ctx1.sendIdx["identifier"]=1
  39175. ][0]);
  39176. if($1 == null || $1.a$nil){
  39177. $2=$self._bindUnscopedVariable_($recv(aNode)._identifier());
  39178. } else {
  39179. $2=$1;
  39180. }
  39181. $recv(aNode)._binding_($2);
  39182. return self;
  39183. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode})});
  39184. }; }),
  39185. $globals.SemanticAnalyzer);
  39186. $core.addMethod(
  39187. $core.method({
  39188. selector: "on:",
  39189. protocol: "instance creation",
  39190. args: ["aClass"],
  39191. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  39192. referencedClasses: [],
  39193. pragmas: [],
  39194. messageSends: ["theClass:", "new", "yourself"]
  39195. }, function ($methodClass){ return function (aClass){
  39196. var self=this,$self=this;
  39197. return $core.withContext(function($ctx1) {
  39198. var $1;
  39199. $1=$self._new();
  39200. $recv($1)._theClass_(aClass);
  39201. return $recv($1)._yourself();
  39202. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass})});
  39203. }; }),
  39204. $globals.SemanticAnalyzer.a$cls);
  39205. $core.addClass("SemanticError", $globals.CompilerError, [], "Compiler-Semantic");
  39206. $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";
  39207. $core.addClass("InvalidAssignmentError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  39208. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  39209. $core.addMethod(
  39210. $core.method({
  39211. selector: "messageText",
  39212. protocol: "accessing",
  39213. args: [],
  39214. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  39215. referencedClasses: [],
  39216. pragmas: [],
  39217. messageSends: [",", "variableName"]
  39218. }, function ($methodClass){ return function (){
  39219. var self=this,$self=this;
  39220. return $core.withContext(function($ctx1) {
  39221. return " Invalid assignment to variable: ".__comma($self._variableName());
  39222. }, function($ctx1) {$ctx1.fill(self,"messageText",{})});
  39223. }; }),
  39224. $globals.InvalidAssignmentError);
  39225. $core.addMethod(
  39226. $core.method({
  39227. selector: "variableName",
  39228. protocol: "accessing",
  39229. args: [],
  39230. source: "variableName\x0a\x09^ variableName",
  39231. referencedClasses: [],
  39232. pragmas: [],
  39233. messageSends: []
  39234. }, function ($methodClass){ return function (){
  39235. var self=this,$self=this;
  39236. return $self.variableName;
  39237. }; }),
  39238. $globals.InvalidAssignmentError);
  39239. $core.addMethod(
  39240. $core.method({
  39241. selector: "variableName:",
  39242. protocol: "accessing",
  39243. args: ["aString"],
  39244. source: "variableName: aString\x0a\x09variableName := aString",
  39245. referencedClasses: [],
  39246. pragmas: [],
  39247. messageSends: []
  39248. }, function ($methodClass){ return function (aString){
  39249. var self=this,$self=this;
  39250. $self.variableName=aString;
  39251. return self;
  39252. }; }),
  39253. $globals.InvalidAssignmentError);
  39254. $core.addClass("ShadowingVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  39255. $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.";
  39256. $core.addMethod(
  39257. $core.method({
  39258. selector: "messageText",
  39259. protocol: "accessing",
  39260. args: [],
  39261. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  39262. referencedClasses: [],
  39263. pragmas: [],
  39264. messageSends: [",", "variableName"]
  39265. }, function ($methodClass){ return function (){
  39266. var self=this,$self=this;
  39267. return $core.withContext(function($ctx1) {
  39268. return [$recv("Variable shadowing error: ".__comma($self._variableName())).__comma(" is already defined")
  39269. ,$ctx1.sendIdx[","]=1
  39270. ][0];
  39271. }, function($ctx1) {$ctx1.fill(self,"messageText",{})});
  39272. }; }),
  39273. $globals.ShadowingVariableError);
  39274. $core.addMethod(
  39275. $core.method({
  39276. selector: "variableName",
  39277. protocol: "accessing",
  39278. args: [],
  39279. source: "variableName\x0a\x09^ variableName",
  39280. referencedClasses: [],
  39281. pragmas: [],
  39282. messageSends: []
  39283. }, function ($methodClass){ return function (){
  39284. var self=this,$self=this;
  39285. return $self.variableName;
  39286. }; }),
  39287. $globals.ShadowingVariableError);
  39288. $core.addMethod(
  39289. $core.method({
  39290. selector: "variableName:",
  39291. protocol: "accessing",
  39292. args: ["aString"],
  39293. source: "variableName: aString\x0a\x09variableName := aString",
  39294. referencedClasses: [],
  39295. pragmas: [],
  39296. messageSends: []
  39297. }, function ($methodClass){ return function (aString){
  39298. var self=this,$self=this;
  39299. $self.variableName=aString;
  39300. return self;
  39301. }; }),
  39302. $globals.ShadowingVariableError);
  39303. $core.addClass("UnknownVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  39304. $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.";
  39305. $core.addMethod(
  39306. $core.method({
  39307. selector: "messageText",
  39308. protocol: "accessing",
  39309. args: [],
  39310. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  39311. referencedClasses: [],
  39312. pragmas: [],
  39313. messageSends: [",", "variableName"]
  39314. }, function ($methodClass){ return function (){
  39315. var self=this,$self=this;
  39316. return $core.withContext(function($ctx1) {
  39317. return [$recv("Unknown Variable error: ".__comma($self._variableName())).__comma(" is not defined")
  39318. ,$ctx1.sendIdx[","]=1
  39319. ][0];
  39320. }, function($ctx1) {$ctx1.fill(self,"messageText",{})});
  39321. }; }),
  39322. $globals.UnknownVariableError);
  39323. $core.addMethod(
  39324. $core.method({
  39325. selector: "variableName",
  39326. protocol: "accessing",
  39327. args: [],
  39328. source: "variableName\x0a\x09^ variableName",
  39329. referencedClasses: [],
  39330. pragmas: [],
  39331. messageSends: []
  39332. }, function ($methodClass){ return function (){
  39333. var self=this,$self=this;
  39334. return $self.variableName;
  39335. }; }),
  39336. $globals.UnknownVariableError);
  39337. $core.addMethod(
  39338. $core.method({
  39339. selector: "variableName:",
  39340. protocol: "accessing",
  39341. args: ["aString"],
  39342. source: "variableName: aString\x0a\x09variableName := aString",
  39343. referencedClasses: [],
  39344. pragmas: [],
  39345. messageSends: []
  39346. }, function ($methodClass){ return function (aString){
  39347. var self=this,$self=this;
  39348. $self.variableName=aString;
  39349. return self;
  39350. }; }),
  39351. $globals.UnknownVariableError);
  39352. $core.addMethod(
  39353. $core.method({
  39354. selector: "jsOverride:",
  39355. protocol: "*Compiler-Semantic",
  39356. args: ["aString"],
  39357. source: "jsOverride: aString\x0a\x09(JSSuperSendVisitor new property: aString; yourself)\x0a\x09\x09visit: self methodNode",
  39358. referencedClasses: ["JSSuperSendVisitor"],
  39359. pragmas: [],
  39360. messageSends: ["visit:", "property:", "new", "yourself", "methodNode"]
  39361. }, function ($methodClass){ return function (aString){
  39362. var self=this,$self=this;
  39363. return $core.withContext(function($ctx1) {
  39364. var $1;
  39365. $1=$recv($globals.JSSuperSendVisitor)._new();
  39366. $recv($1)._property_(aString);
  39367. $recv($recv($1)._yourself())._visit_($self._methodNode());
  39368. return self;
  39369. }, function($ctx1) {$ctx1.fill(self,"jsOverride:",{aString:aString})});
  39370. }; }),
  39371. $globals.AstSemanticPragmator);
  39372. $core.addMethod(
  39373. $core.method({
  39374. selector: "jsOverride:args:",
  39375. protocol: "*Compiler-Semantic",
  39376. args: ["aString", "aCollection"],
  39377. source: "jsOverride: aString args: aCollection\x0a\x09(JSSuperSendVisitor new property: aString; args: aCollection; yourself)\x0a\x09\x09visit: self methodNode",
  39378. referencedClasses: ["JSSuperSendVisitor"],
  39379. pragmas: [],
  39380. messageSends: ["visit:", "property:", "new", "args:", "yourself", "methodNode"]
  39381. }, function ($methodClass){ return function (aString,aCollection){
  39382. var self=this,$self=this;
  39383. return $core.withContext(function($ctx1) {
  39384. var $1;
  39385. $1=$recv($globals.JSSuperSendVisitor)._new();
  39386. $recv($1)._property_(aString);
  39387. $recv($1)._args_(aCollection);
  39388. $recv($recv($1)._yourself())._visit_($self._methodNode());
  39389. return self;
  39390. }, function($ctx1) {$ctx1.fill(self,"jsOverride:args:",{aString:aString,aCollection:aCollection})});
  39391. }; }),
  39392. $globals.AstSemanticPragmator);
  39393. });
  39394. define('amber/core/Compiler-IR',["amber/boot", "require", "amber/core/Compiler-AST", "amber/core/Compiler-Core", "amber/core/Compiler-Semantic", "amber/core/Kernel-Dag", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  39395. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  39396. var $pkg = $core.addPackage("Compiler-IR");
  39397. $pkg.innerEval = function (expr) { return eval(expr); };
  39398. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  39399. $core.addClass("IRASTTranslator", $globals.NodeVisitor, ["source", "theClass", "method", "sequence"], "Compiler-IR");
  39400. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  39401. $core.addMethod(
  39402. $core.method({
  39403. selector: "addToSequence:",
  39404. protocol: "visiting",
  39405. args: ["anInstruction"],
  39406. source: "addToSequence: anInstruction\x0a\x09anInstruction ifNotNil: [\x0a\x09\x09anInstruction isVariable ifFalse: [\x0a\x09\x09\x09self sequence add: anInstruction ] ].\x0a\x09^ anInstruction",
  39407. referencedClasses: [],
  39408. pragmas: [],
  39409. messageSends: ["ifNotNil:", "ifFalse:", "isVariable", "add:", "sequence"]
  39410. }, function ($methodClass){ return function (anInstruction){
  39411. var self=this,$self=this;
  39412. return $core.withContext(function($ctx1) {
  39413. if(anInstruction == null || anInstruction.a$nil){
  39414. anInstruction;
  39415. } else {
  39416. if(!$core.assert($recv(anInstruction)._isVariable())){
  39417. $recv($self._sequence())._add_(anInstruction);
  39418. }
  39419. }
  39420. return anInstruction;
  39421. }, function($ctx1) {$ctx1.fill(self,"addToSequence:",{anInstruction:anInstruction})});
  39422. }; }),
  39423. $globals.IRASTTranslator);
  39424. $core.addMethod(
  39425. $core.method({
  39426. selector: "alias:",
  39427. protocol: "visiting",
  39428. args: ["anExpressionNode"],
  39429. source: "alias: anExpressionNode\x0a\x09| assignment |\x0a\x0a\x09anExpressionNode isIdempotent ifTrue: [ ^ self visit: anExpressionNode ].\x0a\x0a\x09assignment := self method newAliasingOf: (self visit: anExpressionNode).\x0a\x09self addToSequence: assignment.\x0a\x0a\x09^ assignment left",
  39430. referencedClasses: [],
  39431. pragmas: [],
  39432. messageSends: ["ifTrue:", "isIdempotent", "visit:", "newAliasingOf:", "method", "addToSequence:", "left"]
  39433. }, function ($methodClass){ return function (anExpressionNode){
  39434. var self=this,$self=this;
  39435. var assignment;
  39436. return $core.withContext(function($ctx1) {
  39437. if($core.assert($recv(anExpressionNode)._isIdempotent())){
  39438. return [$self._visit_(anExpressionNode)
  39439. ,$ctx1.sendIdx["visit:"]=1
  39440. ][0];
  39441. }
  39442. assignment=$recv($self._method())._newAliasingOf_($self._visit_(anExpressionNode));
  39443. $self._addToSequence_(assignment);
  39444. return $recv(assignment)._left();
  39445. }, function($ctx1) {$ctx1.fill(self,"alias:",{anExpressionNode:anExpressionNode,assignment:assignment})});
  39446. }; }),
  39447. $globals.IRASTTranslator);
  39448. $core.addMethod(
  39449. $core.method({
  39450. selector: "aliasTemporally:",
  39451. protocol: "visiting",
  39452. args: ["aCollection"],
  39453. 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 shouldAlias |\x0a\x09shouldAlias := false.\x0a\x09threshold := aCollection reversed\x0a\x09\x09detect: [ :each |\x0a\x09\x09\x09shouldAlias ifTrue: [ true ] ifFalse: [\x0a\x09\x09\x09\x09each shouldBeAliased ifTrue: [ true ] ifFalse: [\x0a\x09\x09\x09\x09\x09(each hasOpeningStatements ifTrue: [ true ] ifFalse: [ each subtreeNeedsAliasing ]) ifTrue: [ shouldAlias := true ].\x0a\x09\x09\x09\x09\x09false ] ] ]\x0a\x09\x09ifNone: [ nil ].\x0a\x09threshold ifNil: [ ^ self visitAll: aCollection ].\x0a\x0a\x09shouldAlias := true.\x0a\x09^ aCollection collect: [ :each |\x0a\x09\x09shouldAlias\x0a\x09\x09\x09ifTrue: [ each == threshold ifTrue: [ shouldAlias := false ]. self alias: each ]\x0a\x09\x09\x09ifFalse: [ self visit: each ] ]",
  39454. referencedClasses: [],
  39455. pragmas: [],
  39456. messageSends: ["detect:ifNone:", "reversed", "ifTrue:ifFalse:", "shouldBeAliased", "ifTrue:", "hasOpeningStatements", "subtreeNeedsAliasing", "ifNil:", "visitAll:", "collect:", "==", "alias:", "visit:"]
  39457. }, function ($methodClass){ return function (aCollection){
  39458. var self=this,$self=this;
  39459. var threshold,shouldAlias;
  39460. return $core.withContext(function($ctx1) {
  39461. var $1,$2;
  39462. shouldAlias=false;
  39463. threshold=$recv($recv(aCollection)._reversed())._detect_ifNone_((function(each){
  39464. return $core.withContext(function($ctx2) {
  39465. if($core.assert(shouldAlias)){
  39466. return true;
  39467. } else {
  39468. if($core.assert($recv(each)._shouldBeAliased())){
  39469. return true;
  39470. } else {
  39471. if($core.assert($recv(each)._hasOpeningStatements())){
  39472. $1=true;
  39473. } else {
  39474. $1=$recv(each)._subtreeNeedsAliasing();
  39475. }
  39476. if($core.assert($1)){
  39477. shouldAlias=true;
  39478. shouldAlias;
  39479. }
  39480. return false;
  39481. }
  39482. }
  39483. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39484. }),(function(){
  39485. return nil;
  39486. }));
  39487. $2=threshold;
  39488. if($2 == null || $2.a$nil){
  39489. return $self._visitAll_(aCollection);
  39490. } else {
  39491. $2;
  39492. }
  39493. shouldAlias=true;
  39494. return $recv(aCollection)._collect_((function(each){
  39495. return $core.withContext(function($ctx2) {
  39496. if($core.assert(shouldAlias)){
  39497. if($core.assert($recv(each).__eq_eq(threshold))){
  39498. shouldAlias=false;
  39499. shouldAlias;
  39500. }
  39501. return $self._alias_(each);
  39502. } else {
  39503. return $self._visit_(each);
  39504. }
  39505. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,11)});
  39506. }));
  39507. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,shouldAlias:shouldAlias})});
  39508. }; }),
  39509. $globals.IRASTTranslator);
  39510. $core.addMethod(
  39511. $core.method({
  39512. selector: "method",
  39513. protocol: "accessing",
  39514. args: [],
  39515. source: "method\x0a\x09^ method",
  39516. referencedClasses: [],
  39517. pragmas: [],
  39518. messageSends: []
  39519. }, function ($methodClass){ return function (){
  39520. var self=this,$self=this;
  39521. return $self.method;
  39522. }; }),
  39523. $globals.IRASTTranslator);
  39524. $core.addMethod(
  39525. $core.method({
  39526. selector: "method:",
  39527. protocol: "accessing",
  39528. args: ["anIRMethod"],
  39529. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  39530. referencedClasses: [],
  39531. pragmas: [],
  39532. messageSends: []
  39533. }, function ($methodClass){ return function (anIRMethod){
  39534. var self=this,$self=this;
  39535. $self.method=anIRMethod;
  39536. return self;
  39537. }; }),
  39538. $globals.IRASTTranslator);
  39539. $core.addMethod(
  39540. $core.method({
  39541. selector: "sequence",
  39542. protocol: "accessing",
  39543. args: [],
  39544. source: "sequence\x0a\x09^ sequence",
  39545. referencedClasses: [],
  39546. pragmas: [],
  39547. messageSends: []
  39548. }, function ($methodClass){ return function (){
  39549. var self=this,$self=this;
  39550. return $self.sequence;
  39551. }; }),
  39552. $globals.IRASTTranslator);
  39553. $core.addMethod(
  39554. $core.method({
  39555. selector: "sequence:",
  39556. protocol: "accessing",
  39557. args: ["anIRSequence"],
  39558. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  39559. referencedClasses: [],
  39560. pragmas: [],
  39561. messageSends: []
  39562. }, function ($methodClass){ return function (anIRSequence){
  39563. var self=this,$self=this;
  39564. $self.sequence=anIRSequence;
  39565. return self;
  39566. }; }),
  39567. $globals.IRASTTranslator);
  39568. $core.addMethod(
  39569. $core.method({
  39570. selector: "source",
  39571. protocol: "accessing",
  39572. args: [],
  39573. source: "source\x0a\x09^ source",
  39574. referencedClasses: [],
  39575. pragmas: [],
  39576. messageSends: []
  39577. }, function ($methodClass){ return function (){
  39578. var self=this,$self=this;
  39579. return $self.source;
  39580. }; }),
  39581. $globals.IRASTTranslator);
  39582. $core.addMethod(
  39583. $core.method({
  39584. selector: "source:",
  39585. protocol: "accessing",
  39586. args: ["aString"],
  39587. source: "source: aString\x0a\x09source := aString",
  39588. referencedClasses: [],
  39589. pragmas: [],
  39590. messageSends: []
  39591. }, function ($methodClass){ return function (aString){
  39592. var self=this,$self=this;
  39593. $self.source=aString;
  39594. return self;
  39595. }; }),
  39596. $globals.IRASTTranslator);
  39597. $core.addMethod(
  39598. $core.method({
  39599. selector: "theClass",
  39600. protocol: "accessing",
  39601. args: [],
  39602. source: "theClass\x0a\x09^ theClass",
  39603. referencedClasses: [],
  39604. pragmas: [],
  39605. messageSends: []
  39606. }, function ($methodClass){ return function (){
  39607. var self=this,$self=this;
  39608. return $self.theClass;
  39609. }; }),
  39610. $globals.IRASTTranslator);
  39611. $core.addMethod(
  39612. $core.method({
  39613. selector: "theClass:",
  39614. protocol: "accessing",
  39615. args: ["aClass"],
  39616. source: "theClass: aClass\x0a\x09theClass := aClass",
  39617. referencedClasses: [],
  39618. pragmas: [],
  39619. messageSends: []
  39620. }, function ($methodClass){ return function (aClass){
  39621. var self=this,$self=this;
  39622. $self.theClass=aClass;
  39623. return self;
  39624. }; }),
  39625. $globals.IRASTTranslator);
  39626. $core.addMethod(
  39627. $core.method({
  39628. selector: "visitAssignmentNode:",
  39629. protocol: "visiting",
  39630. args: ["aNode"],
  39631. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self addToSequence: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  39632. referencedClasses: ["IRAssignment"],
  39633. pragmas: [],
  39634. messageSends: ["visit:", "right", "left", "addToSequence:", "add:", "new", "yourself"]
  39635. }, function ($methodClass){ return function (aNode){
  39636. var self=this,$self=this;
  39637. var left,right,assignment;
  39638. return $core.withContext(function($ctx1) {
  39639. var $1;
  39640. right=[$self._visit_($recv(aNode)._right())
  39641. ,$ctx1.sendIdx["visit:"]=1
  39642. ][0];
  39643. left=$self._visit_($recv(aNode)._left());
  39644. $1=$recv($globals.IRAssignment)._new();
  39645. [$recv($1)._add_(left)
  39646. ,$ctx1.sendIdx["add:"]=1
  39647. ][0];
  39648. $recv($1)._add_(right);
  39649. $self._addToSequence_($recv($1)._yourself());
  39650. return left;
  39651. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment})});
  39652. }; }),
  39653. $globals.IRASTTranslator);
  39654. $core.addMethod(
  39655. $core.method({
  39656. selector: "visitBlockNode:",
  39657. protocol: "visiting",
  39658. args: ["aNode"],
  39659. 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\x09closure add: (self visit: aNode sequenceNode).\x0a\x09^ closure",
  39660. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  39661. pragmas: [],
  39662. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "visit:", "sequenceNode"]
  39663. }, function ($methodClass){ return function (aNode){
  39664. var self=this,$self=this;
  39665. var closure;
  39666. return $core.withContext(function($ctx1) {
  39667. var $1,$2,$3;
  39668. $1=[$recv($globals.IRClosure)._new()
  39669. ,$ctx1.sendIdx["new"]=1
  39670. ][0];
  39671. $recv($1)._arguments_($recv(aNode)._parameters());
  39672. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39673. [$recv($1)._scope_([$recv(aNode)._scope()
  39674. ,$ctx1.sendIdx["scope"]=1
  39675. ][0])
  39676. ,$ctx1.sendIdx["scope:"]=1
  39677. ][0];
  39678. closure=[$recv($1)._yourself()
  39679. ,$ctx1.sendIdx["yourself"]=1
  39680. ][0];
  39681. $recv($recv([$recv(aNode)._scope()
  39682. ,$ctx1.sendIdx["scope"]=2
  39683. ][0])._temps())._do_((function(each){
  39684. return $core.withContext(function($ctx2) {
  39685. $2=closure;
  39686. $3=$recv($globals.IRTempDeclaration)._new();
  39687. $recv($3)._name_($recv(each)._name());
  39688. $recv($3)._scope_($recv(aNode)._scope());
  39689. return [$recv($2)._add_($recv($3)._yourself())
  39690. ,$ctx2.sendIdx["add:"]=1
  39691. ][0];
  39692. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39693. }));
  39694. $recv(closure)._add_($self._visit_($recv(aNode)._sequenceNode()));
  39695. return closure;
  39696. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure})});
  39697. }; }),
  39698. $globals.IRASTTranslator);
  39699. $core.addMethod(
  39700. $core.method({
  39701. selector: "visitBlockSequenceNode:",
  39702. protocol: "visiting",
  39703. args: ["aNode"],
  39704. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren ifNotEmpty: [\x0a\x09\x09\x09\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self addToSequence: (self visit: each) ].\x0a\x09\x09\x09\x09aNode dagChildren last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self addToSequence: (IRBlockReturn new add: (self visit: aNode dagChildren last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self addToSequence: (self visit: aNode dagChildren last) ] ]]",
  39705. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  39706. pragmas: [],
  39707. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "addToSequence:", "visit:", "ifFalse:ifTrue:", "isReturnNode", "last", "add:", "yourself"]
  39708. }, function ($methodClass){ return function (aNode){
  39709. var self=this,$self=this;
  39710. return $core.withContext(function($ctx1) {
  39711. var $1;
  39712. return $self._withSequence_do_([$recv($globals.IRBlockSequence)._new()
  39713. ,$ctx1.sendIdx["new"]=1
  39714. ][0],(function(){
  39715. return $core.withContext(function($ctx2) {
  39716. return $recv([$recv(aNode)._dagChildren()
  39717. ,$ctx2.sendIdx["dagChildren"]=1
  39718. ][0])._ifNotEmpty_((function(){
  39719. return $core.withContext(function($ctx3) {
  39720. $recv($recv([$recv(aNode)._dagChildren()
  39721. ,$ctx3.sendIdx["dagChildren"]=2
  39722. ][0])._allButLast())._do_((function(each){
  39723. return $core.withContext(function($ctx4) {
  39724. return [$self._addToSequence_([$self._visit_(each)
  39725. ,$ctx4.sendIdx["visit:"]=1
  39726. ][0])
  39727. ,$ctx4.sendIdx["addToSequence:"]=1
  39728. ][0];
  39729. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  39730. }));
  39731. if($core.assert($recv([$recv([$recv(aNode)._dagChildren()
  39732. ,$ctx3.sendIdx["dagChildren"]=3
  39733. ][0])._last()
  39734. ,$ctx3.sendIdx["last"]=1
  39735. ][0])._isReturnNode())){
  39736. return $self._addToSequence_($self._visit_($recv($recv(aNode)._dagChildren())._last()));
  39737. } else {
  39738. $1=$recv($globals.IRBlockReturn)._new();
  39739. $recv($1)._add_([$self._visit_([$recv([$recv(aNode)._dagChildren()
  39740. ,$ctx3.sendIdx["dagChildren"]=4
  39741. ][0])._last()
  39742. ,$ctx3.sendIdx["last"]=2
  39743. ][0])
  39744. ,$ctx3.sendIdx["visit:"]=2
  39745. ][0]);
  39746. return [$self._addToSequence_($recv($1)._yourself())
  39747. ,$ctx3.sendIdx["addToSequence:"]=2
  39748. ][0];
  39749. }
  39750. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39751. }));
  39752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39753. }));
  39754. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode})});
  39755. }; }),
  39756. $globals.IRASTTranslator);
  39757. $core.addMethod(
  39758. $core.method({
  39759. selector: "visitCascadeNode:",
  39760. protocol: "visiting",
  39761. args: ["aNode"],
  39762. source: "visitCascadeNode: aNode\x0a\x09| receiver |\x0a\x09receiver := aNode receiver.\x0a\x09receiver isIdempotent ifFalse: [\x0a\x09\x09| alias |\x0a\x09\x09alias := self alias: receiver.\x0a\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09aNode dagChildren do: [ :each | each receiver: receiver ].\x0a\x0a\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09self addToSequence: (self visit: each) ].\x0a\x0a\x09^ self visit: aNode dagChildren last",
  39763. referencedClasses: ["VariableNode"],
  39764. pragmas: [],
  39765. messageSends: ["receiver", "ifFalse:", "isIdempotent", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "addToSequence:", "visit:", "last"]
  39766. }, function ($methodClass){ return function (aNode){
  39767. var self=this,$self=this;
  39768. var receiver;
  39769. return $core.withContext(function($ctx1) {
  39770. receiver=$recv(aNode)._receiver();
  39771. if(!$core.assert($recv(receiver)._isIdempotent())){
  39772. var alias;
  39773. alias=$self._alias_(receiver);
  39774. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  39775. receiver;
  39776. }
  39777. [$recv([$recv(aNode)._dagChildren()
  39778. ,$ctx1.sendIdx["dagChildren"]=1
  39779. ][0])._do_((function(each){
  39780. return $core.withContext(function($ctx2) {
  39781. return $recv(each)._receiver_(receiver);
  39782. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39783. }))
  39784. ,$ctx1.sendIdx["do:"]=1
  39785. ][0];
  39786. $recv($recv([$recv(aNode)._dagChildren()
  39787. ,$ctx1.sendIdx["dagChildren"]=2
  39788. ][0])._allButLast())._do_((function(each){
  39789. return $core.withContext(function($ctx2) {
  39790. return $self._addToSequence_([$self._visit_(each)
  39791. ,$ctx2.sendIdx["visit:"]=1
  39792. ][0]);
  39793. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39794. }));
  39795. return $self._visit_($recv($recv(aNode)._dagChildren())._last());
  39796. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver})});
  39797. }; }),
  39798. $globals.IRASTTranslator);
  39799. $core.addMethod(
  39800. $core.method({
  39801. selector: "visitDynamicArrayNode:",
  39802. protocol: "visiting",
  39803. args: ["aNode"],
  39804. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  39805. referencedClasses: ["IRDynamicArray"],
  39806. pragmas: [],
  39807. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39808. }, function ($methodClass){ return function (aNode){
  39809. var self=this,$self=this;
  39810. var array;
  39811. return $core.withContext(function($ctx1) {
  39812. array=$recv($globals.IRDynamicArray)._new();
  39813. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39814. return $core.withContext(function($ctx2) {
  39815. return $recv(array)._add_(each);
  39816. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39817. }));
  39818. return array;
  39819. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array})});
  39820. }; }),
  39821. $globals.IRASTTranslator);
  39822. $core.addMethod(
  39823. $core.method({
  39824. selector: "visitDynamicDictionaryNode:",
  39825. protocol: "visiting",
  39826. args: ["aNode"],
  39827. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  39828. referencedClasses: ["IRDynamicDictionary"],
  39829. pragmas: [],
  39830. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39831. }, function ($methodClass){ return function (aNode){
  39832. var self=this,$self=this;
  39833. var dictionary;
  39834. return $core.withContext(function($ctx1) {
  39835. dictionary=$recv($globals.IRDynamicDictionary)._new();
  39836. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39837. return $core.withContext(function($ctx2) {
  39838. return $recv(dictionary)._add_(each);
  39839. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39840. }));
  39841. return dictionary;
  39842. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary})});
  39843. }; }),
  39844. $globals.IRASTTranslator);
  39845. $core.addMethod(
  39846. $core.method({
  39847. selector: "visitJSStatementNode:",
  39848. protocol: "visiting",
  39849. args: ["aNode"],
  39850. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  39851. referencedClasses: ["IRVerbatim"],
  39852. pragmas: [],
  39853. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  39854. }, function ($methodClass){ return function (aNode){
  39855. var self=this,$self=this;
  39856. return $core.withContext(function($ctx1) {
  39857. var $1;
  39858. $1=$recv($globals.IRVerbatim)._new();
  39859. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  39860. return $recv($1)._yourself();
  39861. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode})});
  39862. }; }),
  39863. $globals.IRASTTranslator);
  39864. $core.addMethod(
  39865. $core.method({
  39866. selector: "visitMethodNode:",
  39867. protocol: "visiting",
  39868. args: ["aNode"],
  39869. source: "visitMethodNode: aNode\x0a\x09| irSequence |\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source;\x0a\x09\x09pragmas: (aNode pragmas collect: [ :each |\x0a\x09\x09\x09Message\x0a\x09\x09\x09\x09selector: each selector\x0a\x09\x09\x09\x09arguments: (each arguments collect: [ :eachArg |\x0a\x09\x09\x09\x09\x09eachArg isString ifTrue: [ eachArg crlfSanitized ] ifFalse: [ eachArg ]])]);\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\x09self method add: (irSequence := self visit: aNode sequenceNode).\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [ irSequence\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\x0a\x09^ self method",
  39870. referencedClasses: ["IRMethod", "Message", "IRTempDeclaration", "IRReturn", "IRVariable"],
  39871. pragmas: [],
  39872. messageSends: ["method:", "source:", "new", "source", "pragmas:", "collect:", "pragmas", "selector:arguments:", "selector", "arguments", "ifTrue:ifFalse:", "isString", "crlfSanitized", "theClass:", "theClass", "arguments:", "selector:", "sendIndexes:", "sendIndexes", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "visit:", "sequenceNode", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"]
  39873. }, function ($methodClass){ return function (aNode){
  39874. var self=this,$self=this;
  39875. var irSequence;
  39876. return $core.withContext(function($ctx1) {
  39877. var $1,$2,$3,$4,$5,$6,$7;
  39878. $1=[$recv($globals.IRMethod)._new()
  39879. ,$ctx1.sendIdx["new"]=1
  39880. ][0];
  39881. $recv($1)._source_($self._source());
  39882. $recv($1)._pragmas_([$recv($recv(aNode)._pragmas())._collect_((function(each){
  39883. return $core.withContext(function($ctx2) {
  39884. return $recv($globals.Message)._selector_arguments_([$recv(each)._selector()
  39885. ,$ctx2.sendIdx["selector"]=1
  39886. ][0],$recv([$recv(each)._arguments()
  39887. ,$ctx2.sendIdx["arguments"]=1
  39888. ][0])._collect_((function(eachArg){
  39889. return $core.withContext(function($ctx3) {
  39890. if($core.assert($recv(eachArg)._isString())){
  39891. return $recv(eachArg)._crlfSanitized();
  39892. } else {
  39893. return eachArg;
  39894. }
  39895. }, function($ctx3) {$ctx3.fillBlock({eachArg:eachArg},$ctx2,2)});
  39896. })));
  39897. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39898. }))
  39899. ,$ctx1.sendIdx["collect:"]=1
  39900. ][0]);
  39901. $recv($1)._theClass_($self._theClass());
  39902. $recv($1)._arguments_($recv(aNode)._arguments());
  39903. $recv($1)._selector_($recv(aNode)._selector());
  39904. $recv($1)._sendIndexes_($recv(aNode)._sendIndexes());
  39905. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39906. $recv($1)._classReferences_($recv(aNode)._classReferences());
  39907. [$recv($1)._scope_([$recv(aNode)._scope()
  39908. ,$ctx1.sendIdx["scope"]=1
  39909. ][0])
  39910. ,$ctx1.sendIdx["scope:"]=1
  39911. ][0];
  39912. $self._method_([$recv($1)._yourself()
  39913. ,$ctx1.sendIdx["yourself"]=1
  39914. ][0]);
  39915. $recv($recv([$recv(aNode)._scope()
  39916. ,$ctx1.sendIdx["scope"]=2
  39917. ][0])._temps())._do_((function(each){
  39918. return $core.withContext(function($ctx2) {
  39919. $2=[$self._method()
  39920. ,$ctx2.sendIdx["method"]=1
  39921. ][0];
  39922. $3=[$recv($globals.IRTempDeclaration)._new()
  39923. ,$ctx2.sendIdx["new"]=2
  39924. ][0];
  39925. $recv($3)._name_($recv(each)._name());
  39926. $recv($3)._scope_([$recv(aNode)._scope()
  39927. ,$ctx2.sendIdx["scope"]=3
  39928. ][0]);
  39929. return [$recv($2)._add_([$recv($3)._yourself()
  39930. ,$ctx2.sendIdx["yourself"]=2
  39931. ][0])
  39932. ,$ctx2.sendIdx["add:"]=1
  39933. ][0];
  39934. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  39935. }));
  39936. $4=[$self._method()
  39937. ,$ctx1.sendIdx["method"]=2
  39938. ][0];
  39939. irSequence=$self._visit_($recv(aNode)._sequenceNode());
  39940. [$recv($4)._add_(irSequence)
  39941. ,$ctx1.sendIdx["add:"]=2
  39942. ][0];
  39943. if(!$core.assert($recv([$recv(aNode)._scope()
  39944. ,$ctx1.sendIdx["scope"]=4
  39945. ][0])._hasLocalReturn())){
  39946. $5=irSequence;
  39947. $6=[$recv($globals.IRReturn)._new()
  39948. ,$ctx1.sendIdx["new"]=3
  39949. ][0];
  39950. $7=$recv($globals.IRVariable)._new();
  39951. $recv($7)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  39952. $recv($6)._add_([$recv($7)._yourself()
  39953. ,$ctx1.sendIdx["yourself"]=3
  39954. ][0]);
  39955. [$recv($5)._add_($recv($6)._yourself())
  39956. ,$ctx1.sendIdx["add:"]=3
  39957. ][0];
  39958. }
  39959. return $self._method();
  39960. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode,irSequence:irSequence})});
  39961. }; }),
  39962. $globals.IRASTTranslator);
  39963. $core.addMethod(
  39964. $core.method({
  39965. selector: "visitReturnNode:",
  39966. protocol: "visiting",
  39967. args: ["aNode"],
  39968. source: "visitReturnNode: aNode\x0a\x09^ (aNode nonLocalReturn\x0a\x09\x09ifTrue: [ IRNonLocalReturn new ]\x0a\x09\x09ifFalse: [ IRReturn new ])\x0a\x09\x09scope: aNode scope;\x0a\x09\x09add: (self visit: aNode expression);\x0a\x09\x09yourself",
  39969. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  39970. pragmas: [],
  39971. messageSends: ["scope:", "ifTrue:ifFalse:", "nonLocalReturn", "new", "scope", "add:", "visit:", "expression", "yourself"]
  39972. }, function ($methodClass){ return function (aNode){
  39973. var self=this,$self=this;
  39974. return $core.withContext(function($ctx1) {
  39975. var $1;
  39976. if($core.assert($recv(aNode)._nonLocalReturn())){
  39977. $1=[$recv($globals.IRNonLocalReturn)._new()
  39978. ,$ctx1.sendIdx["new"]=1
  39979. ][0];
  39980. } else {
  39981. $1=$recv($globals.IRReturn)._new();
  39982. }
  39983. $recv($1)._scope_($recv(aNode)._scope());
  39984. $recv($1)._add_($self._visit_($recv(aNode)._expression()));
  39985. return $recv($1)._yourself();
  39986. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode})});
  39987. }; }),
  39988. $globals.IRASTTranslator);
  39989. $core.addMethod(
  39990. $core.method({
  39991. selector: "visitSendNode:",
  39992. protocol: "visiting",
  39993. args: ["aNode"],
  39994. source: "visitSendNode: aNode\x0a\x09| send |\x0a\x09send := IRSend new.\x0a\x09send\x0a\x09\x09selector: aNode selector;\x0a\x09\x09javaScriptSelector: aNode javaScriptSelector;\x0a\x09\x09argumentSwitcher: aNode argumentSwitcher;\x0a\x09\x09index: aNode index.\x0a\x09\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  39995. referencedClasses: ["IRSend"],
  39996. pragmas: [],
  39997. messageSends: ["new", "selector:", "selector", "javaScriptSelector:", "javaScriptSelector", "argumentSwitcher:", "argumentSwitcher", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39998. }, function ($methodClass){ return function (aNode){
  39999. var self=this,$self=this;
  40000. var send;
  40001. return $core.withContext(function($ctx1) {
  40002. var $1;
  40003. send=$recv($globals.IRSend)._new();
  40004. $1=send;
  40005. $recv($1)._selector_($recv(aNode)._selector());
  40006. $recv($1)._javaScriptSelector_($recv(aNode)._javaScriptSelector());
  40007. $recv($1)._argumentSwitcher_($recv(aNode)._argumentSwitcher());
  40008. $recv($1)._index_($recv(aNode)._index());
  40009. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  40010. return $core.withContext(function($ctx2) {
  40011. return $recv(send)._add_(each);
  40012. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40013. }));
  40014. return send;
  40015. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send})});
  40016. }; }),
  40017. $globals.IRASTTranslator);
  40018. $core.addMethod(
  40019. $core.method({
  40020. selector: "visitSequenceNode:",
  40021. protocol: "visiting",
  40022. args: ["aNode"],
  40023. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [ aNode dagChildren do: [ :each |\x0a\x09\x09\x09self addToSequence: (self visit: each) ] ]",
  40024. referencedClasses: ["IRSequence"],
  40025. pragmas: [],
  40026. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "addToSequence:", "visit:"]
  40027. }, function ($methodClass){ return function (aNode){
  40028. var self=this,$self=this;
  40029. return $core.withContext(function($ctx1) {
  40030. return $self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  40031. return $core.withContext(function($ctx2) {
  40032. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  40033. return $core.withContext(function($ctx3) {
  40034. return $self._addToSequence_($self._visit_(each));
  40035. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  40036. }));
  40037. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40038. }));
  40039. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode})});
  40040. }; }),
  40041. $globals.IRASTTranslator);
  40042. $core.addMethod(
  40043. $core.method({
  40044. selector: "visitValueNode:",
  40045. protocol: "visiting",
  40046. args: ["aNode"],
  40047. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  40048. referencedClasses: ["IRValue"],
  40049. pragmas: [],
  40050. messageSends: ["value:", "new", "value", "yourself"]
  40051. }, function ($methodClass){ return function (aNode){
  40052. var self=this,$self=this;
  40053. return $core.withContext(function($ctx1) {
  40054. var $1;
  40055. $1=$recv($globals.IRValue)._new();
  40056. $recv($1)._value_($recv(aNode)._value());
  40057. return $recv($1)._yourself();
  40058. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode})});
  40059. }; }),
  40060. $globals.IRASTTranslator);
  40061. $core.addMethod(
  40062. $core.method({
  40063. selector: "visitVariableNode:",
  40064. protocol: "visiting",
  40065. args: ["aNode"],
  40066. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  40067. referencedClasses: ["IRVariable"],
  40068. pragmas: [],
  40069. messageSends: ["variable:", "new", "binding", "yourself"]
  40070. }, function ($methodClass){ return function (aNode){
  40071. var self=this,$self=this;
  40072. return $core.withContext(function($ctx1) {
  40073. var $1;
  40074. $1=$recv($globals.IRVariable)._new();
  40075. $recv($1)._variable_($recv(aNode)._binding());
  40076. return $recv($1)._yourself();
  40077. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode})});
  40078. }; }),
  40079. $globals.IRASTTranslator);
  40080. $core.addMethod(
  40081. $core.method({
  40082. selector: "withSequence:do:",
  40083. protocol: "accessing",
  40084. args: ["aSequence", "aBlock"],
  40085. 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",
  40086. referencedClasses: [],
  40087. pragmas: [],
  40088. messageSends: ["sequence", "sequence:", "value"]
  40089. }, function ($methodClass){ return function (aSequence,aBlock){
  40090. var self=this,$self=this;
  40091. var outerSequence;
  40092. return $core.withContext(function($ctx1) {
  40093. outerSequence=$self._sequence();
  40094. [$self._sequence_(aSequence)
  40095. ,$ctx1.sendIdx["sequence:"]=1
  40096. ][0];
  40097. $recv(aBlock)._value();
  40098. $self._sequence_(outerSequence);
  40099. return aSequence;
  40100. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence})});
  40101. }; }),
  40102. $globals.IRASTTranslator);
  40103. $core.addClass("IRAliasFactory", $globals.Object, ["counter"], "Compiler-IR");
  40104. $core.addMethod(
  40105. $core.method({
  40106. selector: "initialize",
  40107. protocol: "initialization",
  40108. args: [],
  40109. source: "initialize\x0a\x09super initialize.\x0a\x09counter := 0",
  40110. referencedClasses: [],
  40111. pragmas: [],
  40112. messageSends: ["initialize"]
  40113. }, function ($methodClass){ return function (){
  40114. var self=this,$self=this;
  40115. return $core.withContext(function($ctx1) {
  40116. [(
  40117. $ctx1.supercall = true,
  40118. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  40119. ,$ctx1.supercall = false
  40120. ][0];
  40121. $self.counter=(0);
  40122. return self;
  40123. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  40124. }; }),
  40125. $globals.IRAliasFactory);
  40126. $core.addMethod(
  40127. $core.method({
  40128. selector: "next",
  40129. protocol: "accessing",
  40130. args: [],
  40131. source: "next\x0a\x09counter := counter + 1.\x0a\x09^ AliasVar new\x0a\x09\x09name: '$', counter asString;\x0a\x09\x09yourself",
  40132. referencedClasses: ["AliasVar"],
  40133. pragmas: [],
  40134. messageSends: ["+", "name:", "new", ",", "asString", "yourself"]
  40135. }, function ($methodClass){ return function (){
  40136. var self=this,$self=this;
  40137. return $core.withContext(function($ctx1) {
  40138. var $1;
  40139. $self.counter=$recv($self.counter).__plus((1));
  40140. $1=$recv($globals.AliasVar)._new();
  40141. $recv($1)._name_("$".__comma($recv($self.counter)._asString()));
  40142. return $recv($1)._yourself();
  40143. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  40144. }; }),
  40145. $globals.IRAliasFactory);
  40146. $core.addClass("IRInstruction", $globals.DagParentNode, ["parent"], "Compiler-IR");
  40147. $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.";
  40148. $core.addMethod(
  40149. $core.method({
  40150. selector: "add:",
  40151. protocol: "building",
  40152. args: ["anObject"],
  40153. source: "add: anObject\x0a\x09^ self addDagChild: anObject",
  40154. referencedClasses: [],
  40155. pragmas: [],
  40156. messageSends: ["addDagChild:"]
  40157. }, function ($methodClass){ return function (anObject){
  40158. var self=this,$self=this;
  40159. return $core.withContext(function($ctx1) {
  40160. return $self._addDagChild_(anObject);
  40161. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  40162. }; }),
  40163. $globals.IRInstruction);
  40164. $core.addMethod(
  40165. $core.method({
  40166. selector: "asReceiver",
  40167. protocol: "converting",
  40168. args: [],
  40169. source: "asReceiver\x0a\x09\x22Return customized form to act as receiver.\x0a\x09Return self to use standard $recv(...) boxing.\x22\x0a\x09^ nil",
  40170. referencedClasses: [],
  40171. pragmas: [],
  40172. messageSends: []
  40173. }, function ($methodClass){ return function (){
  40174. var self=this,$self=this;
  40175. return nil;
  40176. }; }),
  40177. $globals.IRInstruction);
  40178. $core.addMethod(
  40179. $core.method({
  40180. selector: "isClosure",
  40181. protocol: "testing",
  40182. args: [],
  40183. source: "isClosure\x0a\x09^ false",
  40184. referencedClasses: [],
  40185. pragmas: [],
  40186. messageSends: []
  40187. }, function ($methodClass){ return function (){
  40188. var self=this,$self=this;
  40189. return false;
  40190. }; }),
  40191. $globals.IRInstruction);
  40192. $core.addMethod(
  40193. $core.method({
  40194. selector: "isInlined",
  40195. protocol: "testing",
  40196. args: [],
  40197. source: "isInlined\x0a\x09^ false",
  40198. referencedClasses: [],
  40199. pragmas: [],
  40200. messageSends: []
  40201. }, function ($methodClass){ return function (){
  40202. var self=this,$self=this;
  40203. return false;
  40204. }; }),
  40205. $globals.IRInstruction);
  40206. $core.addMethod(
  40207. $core.method({
  40208. selector: "isMethod",
  40209. protocol: "testing",
  40210. args: [],
  40211. source: "isMethod\x0a\x09^ false",
  40212. referencedClasses: [],
  40213. pragmas: [],
  40214. messageSends: []
  40215. }, function ($methodClass){ return function (){
  40216. var self=this,$self=this;
  40217. return false;
  40218. }; }),
  40219. $globals.IRInstruction);
  40220. $core.addMethod(
  40221. $core.method({
  40222. selector: "isSend",
  40223. protocol: "testing",
  40224. args: [],
  40225. source: "isSend\x0a\x09^ false",
  40226. referencedClasses: [],
  40227. pragmas: [],
  40228. messageSends: []
  40229. }, function ($methodClass){ return function (){
  40230. var self=this,$self=this;
  40231. return false;
  40232. }; }),
  40233. $globals.IRInstruction);
  40234. $core.addMethod(
  40235. $core.method({
  40236. selector: "isSequence",
  40237. protocol: "testing",
  40238. args: [],
  40239. source: "isSequence\x0a\x09^ false",
  40240. referencedClasses: [],
  40241. pragmas: [],
  40242. messageSends: []
  40243. }, function ($methodClass){ return function (){
  40244. var self=this,$self=this;
  40245. return false;
  40246. }; }),
  40247. $globals.IRInstruction);
  40248. $core.addMethod(
  40249. $core.method({
  40250. selector: "isSuper",
  40251. protocol: "testing",
  40252. args: [],
  40253. source: "isSuper\x0a\x09^ false",
  40254. referencedClasses: [],
  40255. pragmas: [],
  40256. messageSends: []
  40257. }, function ($methodClass){ return function (){
  40258. var self=this,$self=this;
  40259. return false;
  40260. }; }),
  40261. $globals.IRInstruction);
  40262. $core.addMethod(
  40263. $core.method({
  40264. selector: "isTempDeclaration",
  40265. protocol: "testing",
  40266. args: [],
  40267. source: "isTempDeclaration\x0a\x09^ false",
  40268. referencedClasses: [],
  40269. pragmas: [],
  40270. messageSends: []
  40271. }, function ($methodClass){ return function (){
  40272. var self=this,$self=this;
  40273. return false;
  40274. }; }),
  40275. $globals.IRInstruction);
  40276. $core.addMethod(
  40277. $core.method({
  40278. selector: "isVariable",
  40279. protocol: "testing",
  40280. args: [],
  40281. source: "isVariable\x0a\x09^ false",
  40282. referencedClasses: [],
  40283. pragmas: [],
  40284. messageSends: []
  40285. }, function ($methodClass){ return function (){
  40286. var self=this,$self=this;
  40287. return false;
  40288. }; }),
  40289. $globals.IRInstruction);
  40290. $core.addMethod(
  40291. $core.method({
  40292. selector: "method",
  40293. protocol: "accessing",
  40294. args: [],
  40295. source: "method\x0a\x09^ self parent method",
  40296. referencedClasses: [],
  40297. pragmas: [],
  40298. messageSends: ["method", "parent"]
  40299. }, function ($methodClass){ return function (){
  40300. var self=this,$self=this;
  40301. return $core.withContext(function($ctx1) {
  40302. return $recv($self._parent())._method();
  40303. }, function($ctx1) {$ctx1.fill(self,"method",{})});
  40304. }; }),
  40305. $globals.IRInstruction);
  40306. $core.addMethod(
  40307. $core.method({
  40308. selector: "needsBoxingAsReceiver",
  40309. protocol: "testing",
  40310. args: [],
  40311. source: "needsBoxingAsReceiver\x0a\x09self deprecatedAPI: 'Use asReceiver isNil instead.'.\x0a\x09^ self asReceiver isNil",
  40312. referencedClasses: [],
  40313. pragmas: [],
  40314. messageSends: ["deprecatedAPI:", "isNil", "asReceiver"]
  40315. }, function ($methodClass){ return function (){
  40316. var self=this,$self=this;
  40317. return $core.withContext(function($ctx1) {
  40318. $self._deprecatedAPI_("Use asReceiver isNil instead.");
  40319. return $recv($self._asReceiver())._isNil();
  40320. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{})});
  40321. }; }),
  40322. $globals.IRInstruction);
  40323. $core.addMethod(
  40324. $core.method({
  40325. selector: "parent",
  40326. protocol: "accessing",
  40327. args: [],
  40328. source: "parent\x0a\x09^ parent",
  40329. referencedClasses: [],
  40330. pragmas: [],
  40331. messageSends: []
  40332. }, function ($methodClass){ return function (){
  40333. var self=this,$self=this;
  40334. return $self.parent;
  40335. }; }),
  40336. $globals.IRInstruction);
  40337. $core.addMethod(
  40338. $core.method({
  40339. selector: "parent:",
  40340. protocol: "accessing",
  40341. args: ["anIRInstruction"],
  40342. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  40343. referencedClasses: [],
  40344. pragmas: [],
  40345. messageSends: []
  40346. }, function ($methodClass){ return function (anIRInstruction){
  40347. var self=this,$self=this;
  40348. $self.parent=anIRInstruction;
  40349. return self;
  40350. }; }),
  40351. $globals.IRInstruction);
  40352. $core.addMethod(
  40353. $core.method({
  40354. selector: "remove:",
  40355. protocol: "building",
  40356. args: ["anIRInstruction"],
  40357. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  40358. referencedClasses: [],
  40359. pragmas: [],
  40360. messageSends: ["remove:", "dagChildren"]
  40361. }, function ($methodClass){ return function (anIRInstruction){
  40362. var self=this,$self=this;
  40363. return $core.withContext(function($ctx1) {
  40364. $recv($self._dagChildren())._remove_(anIRInstruction);
  40365. return self;
  40366. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction})});
  40367. }; }),
  40368. $globals.IRInstruction);
  40369. $core.addMethod(
  40370. $core.method({
  40371. selector: "replace:with:",
  40372. protocol: "building",
  40373. args: ["anIRInstruction", "anotherIRInstruction"],
  40374. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  40375. referencedClasses: [],
  40376. pragmas: [],
  40377. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  40378. }, function ($methodClass){ return function (anIRInstruction,anotherIRInstruction){
  40379. var self=this,$self=this;
  40380. return $core.withContext(function($ctx1) {
  40381. $recv(anotherIRInstruction)._parent_(self);
  40382. $recv([$self._dagChildren()
  40383. ,$ctx1.sendIdx["dagChildren"]=1
  40384. ][0])._at_put_($recv($self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  40385. return self;
  40386. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction})});
  40387. }; }),
  40388. $globals.IRInstruction);
  40389. $core.addMethod(
  40390. $core.method({
  40391. selector: "replaceWith:",
  40392. protocol: "building",
  40393. args: ["anIRInstruction"],
  40394. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  40395. referencedClasses: [],
  40396. pragmas: [],
  40397. messageSends: ["replace:with:", "parent"]
  40398. }, function ($methodClass){ return function (anIRInstruction){
  40399. var self=this,$self=this;
  40400. return $core.withContext(function($ctx1) {
  40401. $recv($self._parent())._replace_with_(self,anIRInstruction);
  40402. return self;
  40403. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction})});
  40404. }; }),
  40405. $globals.IRInstruction);
  40406. $core.addMethod(
  40407. $core.method({
  40408. selector: "scope",
  40409. protocol: "accessing",
  40410. args: [],
  40411. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  40412. referencedClasses: [],
  40413. pragmas: [],
  40414. messageSends: ["ifNotNil:", "parent", "scope"]
  40415. }, function ($methodClass){ return function (){
  40416. var self=this,$self=this;
  40417. return $core.withContext(function($ctx1) {
  40418. var $1;
  40419. $1=$self._parent();
  40420. if($1 == null || $1.a$nil){
  40421. return $1;
  40422. } else {
  40423. var node;
  40424. node=$1;
  40425. return $recv(node)._scope();
  40426. }
  40427. }, function($ctx1) {$ctx1.fill(self,"scope",{})});
  40428. }; }),
  40429. $globals.IRInstruction);
  40430. $core.addMethod(
  40431. $core.method({
  40432. selector: "yieldsValue",
  40433. protocol: "testing",
  40434. args: [],
  40435. source: "yieldsValue\x0a\x09^ true",
  40436. referencedClasses: [],
  40437. pragmas: [],
  40438. messageSends: []
  40439. }, function ($methodClass){ return function (){
  40440. var self=this,$self=this;
  40441. return true;
  40442. }; }),
  40443. $globals.IRInstruction);
  40444. $core.addMethod(
  40445. $core.method({
  40446. selector: "on:",
  40447. protocol: "instance creation",
  40448. args: ["aBuilder"],
  40449. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  40450. referencedClasses: [],
  40451. pragmas: [],
  40452. messageSends: ["builder:", "new", "yourself"]
  40453. }, function ($methodClass){ return function (aBuilder){
  40454. var self=this,$self=this;
  40455. return $core.withContext(function($ctx1) {
  40456. var $1;
  40457. $1=$self._new();
  40458. $recv($1)._builder_(aBuilder);
  40459. return $recv($1)._yourself();
  40460. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder})});
  40461. }; }),
  40462. $globals.IRInstruction.a$cls);
  40463. $core.addClass("IRAssignment", $globals.IRInstruction, [], "Compiler-IR");
  40464. $core.addMethod(
  40465. $core.method({
  40466. selector: "acceptDagVisitor:",
  40467. protocol: "visiting",
  40468. args: ["aVisitor"],
  40469. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  40470. referencedClasses: [],
  40471. pragmas: [],
  40472. messageSends: ["visitIRAssignment:"]
  40473. }, function ($methodClass){ return function (aVisitor){
  40474. var self=this,$self=this;
  40475. return $core.withContext(function($ctx1) {
  40476. return $recv(aVisitor)._visitIRAssignment_(self);
  40477. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  40478. }; }),
  40479. $globals.IRAssignment);
  40480. $core.addMethod(
  40481. $core.method({
  40482. selector: "left",
  40483. protocol: "accessing",
  40484. args: [],
  40485. source: "left\x0a\x09^ self dagChildren first",
  40486. referencedClasses: [],
  40487. pragmas: [],
  40488. messageSends: ["first", "dagChildren"]
  40489. }, function ($methodClass){ return function (){
  40490. var self=this,$self=this;
  40491. return $core.withContext(function($ctx1) {
  40492. return $recv($self._dagChildren())._first();
  40493. }, function($ctx1) {$ctx1.fill(self,"left",{})});
  40494. }; }),
  40495. $globals.IRAssignment);
  40496. $core.addMethod(
  40497. $core.method({
  40498. selector: "right",
  40499. protocol: "accessing",
  40500. args: [],
  40501. source: "right\x0a\x09^ self dagChildren last",
  40502. referencedClasses: [],
  40503. pragmas: [],
  40504. messageSends: ["last", "dagChildren"]
  40505. }, function ($methodClass){ return function (){
  40506. var self=this,$self=this;
  40507. return $core.withContext(function($ctx1) {
  40508. return $recv($self._dagChildren())._last();
  40509. }, function($ctx1) {$ctx1.fill(self,"right",{})});
  40510. }; }),
  40511. $globals.IRAssignment);
  40512. $core.addClass("IRDynamicArray", $globals.IRInstruction, [], "Compiler-IR");
  40513. $core.addMethod(
  40514. $core.method({
  40515. selector: "acceptDagVisitor:",
  40516. protocol: "visiting",
  40517. args: ["aVisitor"],
  40518. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  40519. referencedClasses: [],
  40520. pragmas: [],
  40521. messageSends: ["visitIRDynamicArray:"]
  40522. }, function ($methodClass){ return function (aVisitor){
  40523. var self=this,$self=this;
  40524. return $core.withContext(function($ctx1) {
  40525. return $recv(aVisitor)._visitIRDynamicArray_(self);
  40526. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  40527. }; }),
  40528. $globals.IRDynamicArray);
  40529. $core.addClass("IRDynamicDictionary", $globals.IRInstruction, [], "Compiler-IR");
  40530. $core.addMethod(
  40531. $core.method({
  40532. selector: "acceptDagVisitor:",
  40533. protocol: "visiting",
  40534. args: ["aVisitor"],
  40535. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  40536. referencedClasses: [],
  40537. pragmas: [],
  40538. messageSends: ["visitIRDynamicDictionary:"]
  40539. }, function ($methodClass){ return function (aVisitor){
  40540. var self=this,$self=this;
  40541. return $core.withContext(function($ctx1) {
  40542. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  40543. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  40544. }; }),
  40545. $globals.IRDynamicDictionary);
  40546. $core.addClass("IRScopedInstruction", $globals.IRInstruction, ["scope"], "Compiler-IR");
  40547. $core.addMethod(
  40548. $core.method({
  40549. selector: "scope",
  40550. protocol: "accessing",
  40551. args: [],
  40552. source: "scope\x0a\x09^ scope",
  40553. referencedClasses: [],
  40554. pragmas: [],
  40555. messageSends: []
  40556. }, function ($methodClass){ return function (){
  40557. var self=this,$self=this;
  40558. return $self.scope;
  40559. }; }),
  40560. $globals.IRScopedInstruction);
  40561. $core.addMethod(
  40562. $core.method({
  40563. selector: "scope:",
  40564. protocol: "accessing",
  40565. args: ["aScope"],
  40566. source: "scope: aScope\x0a\x09scope := aScope",
  40567. referencedClasses: [],
  40568. pragmas: [],
  40569. messageSends: []
  40570. }, function ($methodClass){ return function (aScope){
  40571. var self=this,$self=this;
  40572. $self.scope=aScope;
  40573. return self;
  40574. }; }),
  40575. $globals.IRScopedInstruction);
  40576. $core.addClass("IRClosureInstruction", $globals.IRScopedInstruction, ["arguments", "requiresSmalltalkContext"], "Compiler-IR");
  40577. $core.addMethod(
  40578. $core.method({
  40579. selector: "arguments",
  40580. protocol: "accessing",
  40581. args: [],
  40582. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  40583. referencedClasses: [],
  40584. pragmas: [],
  40585. messageSends: ["ifNil:"]
  40586. }, function ($methodClass){ return function (){
  40587. var self=this,$self=this;
  40588. return $core.withContext(function($ctx1) {
  40589. var $1;
  40590. $1=$self.arguments;
  40591. if($1 == null || $1.a$nil){
  40592. return [];
  40593. } else {
  40594. return $1;
  40595. }
  40596. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  40597. }; }),
  40598. $globals.IRClosureInstruction);
  40599. $core.addMethod(
  40600. $core.method({
  40601. selector: "arguments:",
  40602. protocol: "accessing",
  40603. args: ["aCollection"],
  40604. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  40605. referencedClasses: [],
  40606. pragmas: [],
  40607. messageSends: []
  40608. }, function ($methodClass){ return function (aCollection){
  40609. var self=this,$self=this;
  40610. $self.arguments=aCollection;
  40611. return self;
  40612. }; }),
  40613. $globals.IRClosureInstruction);
  40614. $core.addMethod(
  40615. $core.method({
  40616. selector: "locals",
  40617. protocol: "accessing",
  40618. args: [],
  40619. source: "locals\x0a\x09^ self arguments, (self tempDeclarations collect: [ :each | each name ])",
  40620. referencedClasses: [],
  40621. pragmas: [],
  40622. messageSends: [",", "arguments", "collect:", "tempDeclarations", "name"]
  40623. }, function ($methodClass){ return function (){
  40624. var self=this,$self=this;
  40625. return $core.withContext(function($ctx1) {
  40626. return $recv($self._arguments()).__comma($recv($self._tempDeclarations())._collect_((function(each){
  40627. return $core.withContext(function($ctx2) {
  40628. return $recv(each)._name();
  40629. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40630. })));
  40631. }, function($ctx1) {$ctx1.fill(self,"locals",{})});
  40632. }; }),
  40633. $globals.IRClosureInstruction);
  40634. $core.addMethod(
  40635. $core.method({
  40636. selector: "requiresSmalltalkContext",
  40637. protocol: "accessing",
  40638. args: [],
  40639. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  40640. referencedClasses: [],
  40641. pragmas: [],
  40642. messageSends: ["ifNil:"]
  40643. }, function ($methodClass){ return function (){
  40644. var self=this,$self=this;
  40645. return $core.withContext(function($ctx1) {
  40646. var $1;
  40647. $1=$self.requiresSmalltalkContext;
  40648. if($1 == null || $1.a$nil){
  40649. return false;
  40650. } else {
  40651. return $1;
  40652. }
  40653. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{})});
  40654. }; }),
  40655. $globals.IRClosureInstruction);
  40656. $core.addMethod(
  40657. $core.method({
  40658. selector: "requiresSmalltalkContext:",
  40659. protocol: "accessing",
  40660. args: ["anObject"],
  40661. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  40662. referencedClasses: [],
  40663. pragmas: [],
  40664. messageSends: []
  40665. }, function ($methodClass){ return function (anObject){
  40666. var self=this,$self=this;
  40667. $self.requiresSmalltalkContext=anObject;
  40668. return self;
  40669. }; }),
  40670. $globals.IRClosureInstruction);
  40671. $core.addMethod(
  40672. $core.method({
  40673. selector: "scope:",
  40674. protocol: "accessing",
  40675. args: ["aScope"],
  40676. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  40677. referencedClasses: [],
  40678. pragmas: [],
  40679. messageSends: ["scope:", "instruction:"]
  40680. }, function ($methodClass){ return function (aScope){
  40681. var self=this,$self=this;
  40682. return $core.withContext(function($ctx1) {
  40683. [(
  40684. $ctx1.supercall = true,
  40685. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._scope_.call($self,aScope))
  40686. ,$ctx1.supercall = false
  40687. ][0];
  40688. $recv(aScope)._instruction_(self);
  40689. return self;
  40690. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope})});
  40691. }; }),
  40692. $globals.IRClosureInstruction);
  40693. $core.addMethod(
  40694. $core.method({
  40695. selector: "tempDeclarations",
  40696. protocol: "accessing",
  40697. args: [],
  40698. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  40699. referencedClasses: [],
  40700. pragmas: [],
  40701. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  40702. }, function ($methodClass){ return function (){
  40703. var self=this,$self=this;
  40704. return $core.withContext(function($ctx1) {
  40705. return $recv($self._dagChildren())._select_((function(each){
  40706. return $core.withContext(function($ctx2) {
  40707. return $recv(each)._isTempDeclaration();
  40708. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40709. }));
  40710. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{})});
  40711. }; }),
  40712. $globals.IRClosureInstruction);
  40713. $core.addClass("IRClosure", $globals.IRClosureInstruction, [], "Compiler-IR");
  40714. $core.addMethod(
  40715. $core.method({
  40716. selector: "acceptDagVisitor:",
  40717. protocol: "visiting",
  40718. args: ["aVisitor"],
  40719. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  40720. referencedClasses: [],
  40721. pragmas: [],
  40722. messageSends: ["visitIRClosure:"]
  40723. }, function ($methodClass){ return function (aVisitor){
  40724. var self=this,$self=this;
  40725. return $core.withContext(function($ctx1) {
  40726. return $recv(aVisitor)._visitIRClosure_(self);
  40727. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  40728. }; }),
  40729. $globals.IRClosure);
  40730. $core.addMethod(
  40731. $core.method({
  40732. selector: "isClosure",
  40733. protocol: "testing",
  40734. args: [],
  40735. source: "isClosure\x0a\x09^ true",
  40736. referencedClasses: [],
  40737. pragmas: [],
  40738. messageSends: []
  40739. }, function ($methodClass){ return function (){
  40740. var self=this,$self=this;
  40741. return true;
  40742. }; }),
  40743. $globals.IRClosure);
  40744. $core.addMethod(
  40745. $core.method({
  40746. selector: "sequence",
  40747. protocol: "accessing",
  40748. args: [],
  40749. source: "sequence\x0a\x09^ self dagChildren last",
  40750. referencedClasses: [],
  40751. pragmas: [],
  40752. messageSends: ["last", "dagChildren"]
  40753. }, function ($methodClass){ return function (){
  40754. var self=this,$self=this;
  40755. return $core.withContext(function($ctx1) {
  40756. return $recv($self._dagChildren())._last();
  40757. }, function($ctx1) {$ctx1.fill(self,"sequence",{})});
  40758. }; }),
  40759. $globals.IRClosure);
  40760. $core.addClass("IRMethod", $globals.IRClosureInstruction, ["theClass", "source", "compiledSource", "attachments", "selector", "pragmas", "classReferences", "sendIndexes", "internalVariables", "aliasFactory"], "Compiler-IR");
  40761. $globals.IRMethod.comment="I am a method instruction";
  40762. $core.addMethod(
  40763. $core.method({
  40764. selector: "acceptDagVisitor:",
  40765. protocol: "visiting",
  40766. args: ["aVisitor"],
  40767. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  40768. referencedClasses: [],
  40769. pragmas: [],
  40770. messageSends: ["visitIRMethod:"]
  40771. }, function ($methodClass){ return function (aVisitor){
  40772. var self=this,$self=this;
  40773. return $core.withContext(function($ctx1) {
  40774. return $recv(aVisitor)._visitIRMethod_(self);
  40775. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  40776. }; }),
  40777. $globals.IRMethod);
  40778. $core.addMethod(
  40779. $core.method({
  40780. selector: "aliasFactory",
  40781. protocol: "accessing",
  40782. args: [],
  40783. source: "aliasFactory\x0a\x09^ aliasFactory ifNil: [ aliasFactory := IRAliasFactory new ]",
  40784. referencedClasses: ["IRAliasFactory"],
  40785. pragmas: [],
  40786. messageSends: ["ifNil:", "new"]
  40787. }, function ($methodClass){ return function (){
  40788. var self=this,$self=this;
  40789. return $core.withContext(function($ctx1) {
  40790. var $1;
  40791. $1=$self.aliasFactory;
  40792. if($1 == null || $1.a$nil){
  40793. $self.aliasFactory=$recv($globals.IRAliasFactory)._new();
  40794. return $self.aliasFactory;
  40795. } else {
  40796. return $1;
  40797. }
  40798. }, function($ctx1) {$ctx1.fill(self,"aliasFactory",{})});
  40799. }; }),
  40800. $globals.IRMethod);
  40801. $core.addMethod(
  40802. $core.method({
  40803. selector: "attachments",
  40804. protocol: "accessing",
  40805. args: [],
  40806. source: "attachments\x0a\x09^ attachments ifNil: [ attachments := #{} ]",
  40807. referencedClasses: [],
  40808. pragmas: [],
  40809. messageSends: ["ifNil:"]
  40810. }, function ($methodClass){ return function (){
  40811. var self=this,$self=this;
  40812. return $core.withContext(function($ctx1) {
  40813. var $1;
  40814. $1=$self.attachments;
  40815. if($1 == null || $1.a$nil){
  40816. $self.attachments=$globals.HashedCollection._newFromPairs_([]);
  40817. return $self.attachments;
  40818. } else {
  40819. return $1;
  40820. }
  40821. }, function($ctx1) {$ctx1.fill(self,"attachments",{})});
  40822. }; }),
  40823. $globals.IRMethod);
  40824. $core.addMethod(
  40825. $core.method({
  40826. selector: "classReferences",
  40827. protocol: "accessing",
  40828. args: [],
  40829. source: "classReferences\x0a\x09^ classReferences",
  40830. referencedClasses: [],
  40831. pragmas: [],
  40832. messageSends: []
  40833. }, function ($methodClass){ return function (){
  40834. var self=this,$self=this;
  40835. return $self.classReferences;
  40836. }; }),
  40837. $globals.IRMethod);
  40838. $core.addMethod(
  40839. $core.method({
  40840. selector: "classReferences:",
  40841. protocol: "accessing",
  40842. args: ["aCollection"],
  40843. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  40844. referencedClasses: [],
  40845. pragmas: [],
  40846. messageSends: []
  40847. }, function ($methodClass){ return function (aCollection){
  40848. var self=this,$self=this;
  40849. $self.classReferences=aCollection;
  40850. return self;
  40851. }; }),
  40852. $globals.IRMethod);
  40853. $core.addMethod(
  40854. $core.method({
  40855. selector: "compiledSource",
  40856. protocol: "accessing",
  40857. args: [],
  40858. source: "compiledSource\x0a\x09^ compiledSource",
  40859. referencedClasses: [],
  40860. pragmas: [],
  40861. messageSends: []
  40862. }, function ($methodClass){ return function (){
  40863. var self=this,$self=this;
  40864. return $self.compiledSource;
  40865. }; }),
  40866. $globals.IRMethod);
  40867. $core.addMethod(
  40868. $core.method({
  40869. selector: "compiledSource:",
  40870. protocol: "accessing",
  40871. args: ["anObject"],
  40872. source: "compiledSource: anObject\x0a\x09compiledSource := anObject",
  40873. referencedClasses: [],
  40874. pragmas: [],
  40875. messageSends: []
  40876. }, function ($methodClass){ return function (anObject){
  40877. var self=this,$self=this;
  40878. $self.compiledSource=anObject;
  40879. return self;
  40880. }; }),
  40881. $globals.IRMethod);
  40882. $core.addMethod(
  40883. $core.method({
  40884. selector: "internalVariables",
  40885. protocol: "accessing",
  40886. args: [],
  40887. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  40888. referencedClasses: ["Set"],
  40889. pragmas: [],
  40890. messageSends: ["ifNil:", "new"]
  40891. }, function ($methodClass){ return function (){
  40892. var self=this,$self=this;
  40893. return $core.withContext(function($ctx1) {
  40894. var $1;
  40895. $1=$self.internalVariables;
  40896. if($1 == null || $1.a$nil){
  40897. $self.internalVariables=$recv($globals.Set)._new();
  40898. return $self.internalVariables;
  40899. } else {
  40900. return $1;
  40901. }
  40902. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{})});
  40903. }; }),
  40904. $globals.IRMethod);
  40905. $core.addMethod(
  40906. $core.method({
  40907. selector: "isMethod",
  40908. protocol: "testing",
  40909. args: [],
  40910. source: "isMethod\x0a\x09^ true",
  40911. referencedClasses: [],
  40912. pragmas: [],
  40913. messageSends: []
  40914. }, function ($methodClass){ return function (){
  40915. var self=this,$self=this;
  40916. return true;
  40917. }; }),
  40918. $globals.IRMethod);
  40919. $core.addMethod(
  40920. $core.method({
  40921. selector: "messageSends",
  40922. protocol: "accessing",
  40923. args: [],
  40924. source: "messageSends\x0a\x09^ self sendIndexes keys",
  40925. referencedClasses: [],
  40926. pragmas: [],
  40927. messageSends: ["keys", "sendIndexes"]
  40928. }, function ($methodClass){ return function (){
  40929. var self=this,$self=this;
  40930. return $core.withContext(function($ctx1) {
  40931. return $recv($self._sendIndexes())._keys();
  40932. }, function($ctx1) {$ctx1.fill(self,"messageSends",{})});
  40933. }; }),
  40934. $globals.IRMethod);
  40935. $core.addMethod(
  40936. $core.method({
  40937. selector: "method",
  40938. protocol: "accessing",
  40939. args: [],
  40940. source: "method\x0a\x09^ self",
  40941. referencedClasses: [],
  40942. pragmas: [],
  40943. messageSends: []
  40944. }, function ($methodClass){ return function (){
  40945. var self=this,$self=this;
  40946. return self;
  40947. }; }),
  40948. $globals.IRMethod);
  40949. $core.addMethod(
  40950. $core.method({
  40951. selector: "newAliasingOf:",
  40952. protocol: "accessing",
  40953. args: ["anIRInstruction"],
  40954. source: "newAliasingOf: anIRInstruction\x0a\x09| variable |\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: self aliasFactory next;\x0a\x09\x09yourself.\x0a\x0a\x09self internalVariables add: variable.\x0a\x0a\x09^ IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: anIRInstruction;\x0a\x09\x09yourself",
  40955. referencedClasses: ["IRVariable", "IRAssignment"],
  40956. pragmas: [],
  40957. messageSends: ["variable:", "new", "next", "aliasFactory", "yourself", "add:", "internalVariables"]
  40958. }, function ($methodClass){ return function (anIRInstruction){
  40959. var self=this,$self=this;
  40960. var variable;
  40961. return $core.withContext(function($ctx1) {
  40962. var $1,$2;
  40963. $1=[$recv($globals.IRVariable)._new()
  40964. ,$ctx1.sendIdx["new"]=1
  40965. ][0];
  40966. $recv($1)._variable_($recv($self._aliasFactory())._next());
  40967. variable=[$recv($1)._yourself()
  40968. ,$ctx1.sendIdx["yourself"]=1
  40969. ][0];
  40970. [$recv($self._internalVariables())._add_(variable)
  40971. ,$ctx1.sendIdx["add:"]=1
  40972. ][0];
  40973. $2=$recv($globals.IRAssignment)._new();
  40974. [$recv($2)._add_(variable)
  40975. ,$ctx1.sendIdx["add:"]=2
  40976. ][0];
  40977. $recv($2)._add_(anIRInstruction);
  40978. return $recv($2)._yourself();
  40979. }, function($ctx1) {$ctx1.fill(self,"newAliasingOf:",{anIRInstruction:anIRInstruction,variable:variable})});
  40980. }; }),
  40981. $globals.IRMethod);
  40982. $core.addMethod(
  40983. $core.method({
  40984. selector: "pragmas",
  40985. protocol: "accessing",
  40986. args: [],
  40987. source: "pragmas\x0a\x09^ pragmas",
  40988. referencedClasses: [],
  40989. pragmas: [],
  40990. messageSends: []
  40991. }, function ($methodClass){ return function (){
  40992. var self=this,$self=this;
  40993. return $self.pragmas;
  40994. }; }),
  40995. $globals.IRMethod);
  40996. $core.addMethod(
  40997. $core.method({
  40998. selector: "pragmas:",
  40999. protocol: "accessing",
  41000. args: ["aCollection"],
  41001. source: "pragmas: aCollection\x0a\x09pragmas := aCollection",
  41002. referencedClasses: [],
  41003. pragmas: [],
  41004. messageSends: []
  41005. }, function ($methodClass){ return function (aCollection){
  41006. var self=this,$self=this;
  41007. $self.pragmas=aCollection;
  41008. return self;
  41009. }; }),
  41010. $globals.IRMethod);
  41011. $core.addMethod(
  41012. $core.method({
  41013. selector: "selector",
  41014. protocol: "accessing",
  41015. args: [],
  41016. source: "selector\x0a\x09^ selector",
  41017. referencedClasses: [],
  41018. pragmas: [],
  41019. messageSends: []
  41020. }, function ($methodClass){ return function (){
  41021. var self=this,$self=this;
  41022. return $self.selector;
  41023. }; }),
  41024. $globals.IRMethod);
  41025. $core.addMethod(
  41026. $core.method({
  41027. selector: "selector:",
  41028. protocol: "accessing",
  41029. args: ["aString"],
  41030. source: "selector: aString\x0a\x09selector := aString",
  41031. referencedClasses: [],
  41032. pragmas: [],
  41033. messageSends: []
  41034. }, function ($methodClass){ return function (aString){
  41035. var self=this,$self=this;
  41036. $self.selector=aString;
  41037. return self;
  41038. }; }),
  41039. $globals.IRMethod);
  41040. $core.addMethod(
  41041. $core.method({
  41042. selector: "sendIndexes",
  41043. protocol: "accessing",
  41044. args: [],
  41045. source: "sendIndexes\x0a\x09^ sendIndexes",
  41046. referencedClasses: [],
  41047. pragmas: [],
  41048. messageSends: []
  41049. }, function ($methodClass){ return function (){
  41050. var self=this,$self=this;
  41051. return $self.sendIndexes;
  41052. }; }),
  41053. $globals.IRMethod);
  41054. $core.addMethod(
  41055. $core.method({
  41056. selector: "sendIndexes:",
  41057. protocol: "accessing",
  41058. args: ["aDictionary"],
  41059. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  41060. referencedClasses: [],
  41061. pragmas: [],
  41062. messageSends: []
  41063. }, function ($methodClass){ return function (aDictionary){
  41064. var self=this,$self=this;
  41065. $self.sendIndexes=aDictionary;
  41066. return self;
  41067. }; }),
  41068. $globals.IRMethod);
  41069. $core.addMethod(
  41070. $core.method({
  41071. selector: "source",
  41072. protocol: "accessing",
  41073. args: [],
  41074. source: "source\x0a\x09^ source",
  41075. referencedClasses: [],
  41076. pragmas: [],
  41077. messageSends: []
  41078. }, function ($methodClass){ return function (){
  41079. var self=this,$self=this;
  41080. return $self.source;
  41081. }; }),
  41082. $globals.IRMethod);
  41083. $core.addMethod(
  41084. $core.method({
  41085. selector: "source:",
  41086. protocol: "accessing",
  41087. args: ["aString"],
  41088. source: "source: aString\x0a\x09source := aString",
  41089. referencedClasses: [],
  41090. pragmas: [],
  41091. messageSends: []
  41092. }, function ($methodClass){ return function (aString){
  41093. var self=this,$self=this;
  41094. $self.source=aString;
  41095. return self;
  41096. }; }),
  41097. $globals.IRMethod);
  41098. $core.addMethod(
  41099. $core.method({
  41100. selector: "theClass",
  41101. protocol: "accessing",
  41102. args: [],
  41103. source: "theClass\x0a\x09^ theClass",
  41104. referencedClasses: [],
  41105. pragmas: [],
  41106. messageSends: []
  41107. }, function ($methodClass){ return function (){
  41108. var self=this,$self=this;
  41109. return $self.theClass;
  41110. }; }),
  41111. $globals.IRMethod);
  41112. $core.addMethod(
  41113. $core.method({
  41114. selector: "theClass:",
  41115. protocol: "accessing",
  41116. args: ["aClass"],
  41117. source: "theClass: aClass\x0a\x09theClass := aClass",
  41118. referencedClasses: [],
  41119. pragmas: [],
  41120. messageSends: []
  41121. }, function ($methodClass){ return function (aClass){
  41122. var self=this,$self=this;
  41123. $self.theClass=aClass;
  41124. return self;
  41125. }; }),
  41126. $globals.IRMethod);
  41127. $core.addClass("IRReturn", $globals.IRScopedInstruction, [], "Compiler-IR");
  41128. $globals.IRReturn.comment="I am a local return instruction.";
  41129. $core.addMethod(
  41130. $core.method({
  41131. selector: "acceptDagVisitor:",
  41132. protocol: "visiting",
  41133. args: ["aVisitor"],
  41134. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  41135. referencedClasses: [],
  41136. pragmas: [],
  41137. messageSends: ["visitIRReturn:"]
  41138. }, function ($methodClass){ return function (aVisitor){
  41139. var self=this,$self=this;
  41140. return $core.withContext(function($ctx1) {
  41141. return $recv(aVisitor)._visitIRReturn_(self);
  41142. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  41143. }; }),
  41144. $globals.IRReturn);
  41145. $core.addMethod(
  41146. $core.method({
  41147. selector: "expression",
  41148. protocol: "accessing",
  41149. args: [],
  41150. source: "expression\x0a\x09^ self dagChildren single",
  41151. referencedClasses: [],
  41152. pragmas: [],
  41153. messageSends: ["single", "dagChildren"]
  41154. }, function ($methodClass){ return function (){
  41155. var self=this,$self=this;
  41156. return $core.withContext(function($ctx1) {
  41157. return $recv($self._dagChildren())._single();
  41158. }, function($ctx1) {$ctx1.fill(self,"expression",{})});
  41159. }; }),
  41160. $globals.IRReturn);
  41161. $core.addMethod(
  41162. $core.method({
  41163. selector: "scope",
  41164. protocol: "accessing",
  41165. args: [],
  41166. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  41167. referencedClasses: [],
  41168. pragmas: [],
  41169. messageSends: ["ifNil:", "scope", "parent"]
  41170. }, function ($methodClass){ return function (){
  41171. var self=this,$self=this;
  41172. return $core.withContext(function($ctx1) {
  41173. var $1;
  41174. $1=$self.scope;
  41175. if($1 == null || $1.a$nil){
  41176. return $recv($self._parent())._scope();
  41177. } else {
  41178. return $1;
  41179. }
  41180. }, function($ctx1) {$ctx1.fill(self,"scope",{})});
  41181. }; }),
  41182. $globals.IRReturn);
  41183. $core.addMethod(
  41184. $core.method({
  41185. selector: "yieldsValue",
  41186. protocol: "testing",
  41187. args: [],
  41188. source: "yieldsValue\x0a\x09^ false",
  41189. referencedClasses: [],
  41190. pragmas: [],
  41191. messageSends: []
  41192. }, function ($methodClass){ return function (){
  41193. var self=this,$self=this;
  41194. return false;
  41195. }; }),
  41196. $globals.IRReturn);
  41197. $core.addClass("IRBlockReturn", $globals.IRReturn, [], "Compiler-IR");
  41198. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  41199. $core.addMethod(
  41200. $core.method({
  41201. selector: "acceptDagVisitor:",
  41202. protocol: "visiting",
  41203. args: ["aVisitor"],
  41204. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  41205. referencedClasses: [],
  41206. pragmas: [],
  41207. messageSends: ["visitIRBlockReturn:"]
  41208. }, function ($methodClass){ return function (aVisitor){
  41209. var self=this,$self=this;
  41210. return $core.withContext(function($ctx1) {
  41211. return $recv(aVisitor)._visitIRBlockReturn_(self);
  41212. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  41213. }; }),
  41214. $globals.IRBlockReturn);
  41215. $core.addClass("IRNonLocalReturn", $globals.IRReturn, [], "Compiler-IR");
  41216. $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.";
  41217. $core.addMethod(
  41218. $core.method({
  41219. selector: "acceptDagVisitor:",
  41220. protocol: "visiting",
  41221. args: ["aVisitor"],
  41222. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  41223. referencedClasses: [],
  41224. pragmas: [],
  41225. messageSends: ["visitIRNonLocalReturn:"]
  41226. }, function ($methodClass){ return function (aVisitor){
  41227. var self=this,$self=this;
  41228. return $core.withContext(function($ctx1) {
  41229. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  41230. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  41231. }; }),
  41232. $globals.IRNonLocalReturn);
  41233. $core.addClass("IRTempDeclaration", $globals.IRScopedInstruction, ["name"], "Compiler-IR");
  41234. $core.addMethod(
  41235. $core.method({
  41236. selector: "acceptDagVisitor:",
  41237. protocol: "visiting",
  41238. args: ["aVisitor"],
  41239. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  41240. referencedClasses: [],
  41241. pragmas: [],
  41242. messageSends: ["visitIRTempDeclaration:"]
  41243. }, function ($methodClass){ return function (aVisitor){
  41244. var self=this,$self=this;
  41245. return $core.withContext(function($ctx1) {
  41246. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  41247. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  41248. }; }),
  41249. $globals.IRTempDeclaration);
  41250. $core.addMethod(
  41251. $core.method({
  41252. selector: "isTempDeclaration",
  41253. protocol: "testing",
  41254. args: [],
  41255. source: "isTempDeclaration\x0a\x09^ true",
  41256. referencedClasses: [],
  41257. pragmas: [],
  41258. messageSends: []
  41259. }, function ($methodClass){ return function (){
  41260. var self=this,$self=this;
  41261. return true;
  41262. }; }),
  41263. $globals.IRTempDeclaration);
  41264. $core.addMethod(
  41265. $core.method({
  41266. selector: "name",
  41267. protocol: "accessing",
  41268. args: [],
  41269. source: "name\x0a\x09^ name",
  41270. referencedClasses: [],
  41271. pragmas: [],
  41272. messageSends: []
  41273. }, function ($methodClass){ return function (){
  41274. var self=this,$self=this;
  41275. return $self.name;
  41276. }; }),
  41277. $globals.IRTempDeclaration);
  41278. $core.addMethod(
  41279. $core.method({
  41280. selector: "name:",
  41281. protocol: "accessing",
  41282. args: ["aString"],
  41283. source: "name: aString\x0a\x09name := aString",
  41284. referencedClasses: [],
  41285. pragmas: [],
  41286. messageSends: []
  41287. }, function ($methodClass){ return function (aString){
  41288. var self=this,$self=this;
  41289. $self.name=aString;
  41290. return self;
  41291. }; }),
  41292. $globals.IRTempDeclaration);
  41293. $core.addClass("IRSend", $globals.IRInstruction, ["selector", "javaScriptSelector", "argumentSwitcher", "index"], "Compiler-IR");
  41294. $globals.IRSend.comment="I am a message send instruction.";
  41295. $core.addMethod(
  41296. $core.method({
  41297. selector: "acceptDagVisitor:",
  41298. protocol: "visiting",
  41299. args: ["aVisitor"],
  41300. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  41301. referencedClasses: [],
  41302. pragmas: [],
  41303. messageSends: ["visitIRSend:"]
  41304. }, function ($methodClass){ return function (aVisitor){
  41305. var self=this,$self=this;
  41306. return $core.withContext(function($ctx1) {
  41307. return $recv(aVisitor)._visitIRSend_(self);
  41308. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  41309. }; }),
  41310. $globals.IRSend);
  41311. $core.addMethod(
  41312. $core.method({
  41313. selector: "argumentSwitcher",
  41314. protocol: "accessing",
  41315. args: [],
  41316. source: "argumentSwitcher\x0a\x09^ argumentSwitcher",
  41317. referencedClasses: [],
  41318. pragmas: [],
  41319. messageSends: []
  41320. }, function ($methodClass){ return function (){
  41321. var self=this,$self=this;
  41322. return $self.argumentSwitcher;
  41323. }; }),
  41324. $globals.IRSend);
  41325. $core.addMethod(
  41326. $core.method({
  41327. selector: "argumentSwitcher:",
  41328. protocol: "accessing",
  41329. args: ["aJSFunction"],
  41330. source: "argumentSwitcher: aJSFunction\x0a\x09argumentSwitcher := aJSFunction",
  41331. referencedClasses: [],
  41332. pragmas: [],
  41333. messageSends: []
  41334. }, function ($methodClass){ return function (aJSFunction){
  41335. var self=this,$self=this;
  41336. $self.argumentSwitcher=aJSFunction;
  41337. return self;
  41338. }; }),
  41339. $globals.IRSend);
  41340. $core.addMethod(
  41341. $core.method({
  41342. selector: "arguments",
  41343. protocol: "accessing",
  41344. args: [],
  41345. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  41346. referencedClasses: [],
  41347. pragmas: [],
  41348. messageSends: ["allButFirst", "dagChildren"]
  41349. }, function ($methodClass){ return function (){
  41350. var self=this,$self=this;
  41351. return $core.withContext(function($ctx1) {
  41352. return $recv($self._dagChildren())._allButFirst();
  41353. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  41354. }; }),
  41355. $globals.IRSend);
  41356. $core.addMethod(
  41357. $core.method({
  41358. selector: "index",
  41359. protocol: "accessing",
  41360. args: [],
  41361. source: "index\x0a\x09^ index",
  41362. referencedClasses: [],
  41363. pragmas: [],
  41364. messageSends: []
  41365. }, function ($methodClass){ return function (){
  41366. var self=this,$self=this;
  41367. return $self.index;
  41368. }; }),
  41369. $globals.IRSend);
  41370. $core.addMethod(
  41371. $core.method({
  41372. selector: "index:",
  41373. protocol: "accessing",
  41374. args: ["anInteger"],
  41375. source: "index: anInteger\x0a\x09index := anInteger",
  41376. referencedClasses: [],
  41377. pragmas: [],
  41378. messageSends: []
  41379. }, function ($methodClass){ return function (anInteger){
  41380. var self=this,$self=this;
  41381. $self.index=anInteger;
  41382. return self;
  41383. }; }),
  41384. $globals.IRSend);
  41385. $core.addMethod(
  41386. $core.method({
  41387. selector: "isSend",
  41388. protocol: "testing",
  41389. args: [],
  41390. source: "isSend\x0a\x09^ true",
  41391. referencedClasses: [],
  41392. pragmas: [],
  41393. messageSends: []
  41394. }, function ($methodClass){ return function (){
  41395. var self=this,$self=this;
  41396. return true;
  41397. }; }),
  41398. $globals.IRSend);
  41399. $core.addMethod(
  41400. $core.method({
  41401. selector: "javaScriptSelector",
  41402. protocol: "accessing",
  41403. args: [],
  41404. source: "javaScriptSelector\x0a\x09^ javaScriptSelector ifNil: [ javaScriptSelector := self selector asJavaScriptMethodName ]",
  41405. referencedClasses: [],
  41406. pragmas: [],
  41407. messageSends: ["ifNil:", "asJavaScriptMethodName", "selector"]
  41408. }, function ($methodClass){ return function (){
  41409. var self=this,$self=this;
  41410. return $core.withContext(function($ctx1) {
  41411. var $1;
  41412. $1=$self.javaScriptSelector;
  41413. if($1 == null || $1.a$nil){
  41414. $self.javaScriptSelector=$recv($self._selector())._asJavaScriptMethodName();
  41415. return $self.javaScriptSelector;
  41416. } else {
  41417. return $1;
  41418. }
  41419. }, function($ctx1) {$ctx1.fill(self,"javaScriptSelector",{})});
  41420. }; }),
  41421. $globals.IRSend);
  41422. $core.addMethod(
  41423. $core.method({
  41424. selector: "javaScriptSelector:",
  41425. protocol: "accessing",
  41426. args: ["aString"],
  41427. source: "javaScriptSelector: aString\x0a\x09javaScriptSelector := aString",
  41428. referencedClasses: [],
  41429. pragmas: [],
  41430. messageSends: []
  41431. }, function ($methodClass){ return function (aString){
  41432. var self=this,$self=this;
  41433. $self.javaScriptSelector=aString;
  41434. return self;
  41435. }; }),
  41436. $globals.IRSend);
  41437. $core.addMethod(
  41438. $core.method({
  41439. selector: "receiver",
  41440. protocol: "accessing",
  41441. args: [],
  41442. source: "receiver\x0a\x09^ self dagChildren first",
  41443. referencedClasses: [],
  41444. pragmas: [],
  41445. messageSends: ["first", "dagChildren"]
  41446. }, function ($methodClass){ return function (){
  41447. var self=this,$self=this;
  41448. return $core.withContext(function($ctx1) {
  41449. return $recv($self._dagChildren())._first();
  41450. }, function($ctx1) {$ctx1.fill(self,"receiver",{})});
  41451. }; }),
  41452. $globals.IRSend);
  41453. $core.addMethod(
  41454. $core.method({
  41455. selector: "selector",
  41456. protocol: "accessing",
  41457. args: [],
  41458. source: "selector\x0a\x09^ selector",
  41459. referencedClasses: [],
  41460. pragmas: [],
  41461. messageSends: []
  41462. }, function ($methodClass){ return function (){
  41463. var self=this,$self=this;
  41464. return $self.selector;
  41465. }; }),
  41466. $globals.IRSend);
  41467. $core.addMethod(
  41468. $core.method({
  41469. selector: "selector:",
  41470. protocol: "accessing",
  41471. args: ["aString"],
  41472. source: "selector: aString\x0a\x09selector := aString",
  41473. referencedClasses: [],
  41474. pragmas: [],
  41475. messageSends: []
  41476. }, function ($methodClass){ return function (aString){
  41477. var self=this,$self=this;
  41478. $self.selector=aString;
  41479. return self;
  41480. }; }),
  41481. $globals.IRSend);
  41482. $core.addClass("IRSequence", $globals.IRInstruction, [], "Compiler-IR");
  41483. $core.addMethod(
  41484. $core.method({
  41485. selector: "acceptDagVisitor:",
  41486. protocol: "visiting",
  41487. args: ["aVisitor"],
  41488. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  41489. referencedClasses: [],
  41490. pragmas: [],
  41491. messageSends: ["visitIRSequence:"]
  41492. }, function ($methodClass){ return function (aVisitor){
  41493. var self=this,$self=this;
  41494. return $core.withContext(function($ctx1) {
  41495. return $recv(aVisitor)._visitIRSequence_(self);
  41496. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  41497. }; }),
  41498. $globals.IRSequence);
  41499. $core.addMethod(
  41500. $core.method({
  41501. selector: "isSequence",
  41502. protocol: "testing",
  41503. args: [],
  41504. source: "isSequence\x0a\x09^ true",
  41505. referencedClasses: [],
  41506. pragmas: [],
  41507. messageSends: []
  41508. }, function ($methodClass){ return function (){
  41509. var self=this,$self=this;
  41510. return true;
  41511. }; }),
  41512. $globals.IRSequence);
  41513. $core.addClass("IRBlockSequence", $globals.IRSequence, [], "Compiler-IR");
  41514. $core.addMethod(
  41515. $core.method({
  41516. selector: "acceptDagVisitor:",
  41517. protocol: "visiting",
  41518. args: ["aVisitor"],
  41519. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  41520. referencedClasses: [],
  41521. pragmas: [],
  41522. messageSends: ["visitIRBlockSequence:"]
  41523. }, function ($methodClass){ return function (aVisitor){
  41524. var self=this,$self=this;
  41525. return $core.withContext(function($ctx1) {
  41526. return $recv(aVisitor)._visitIRBlockSequence_(self);
  41527. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  41528. }; }),
  41529. $globals.IRBlockSequence);
  41530. $core.addClass("IRValue", $globals.IRInstruction, ["value"], "Compiler-IR");
  41531. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  41532. $core.addMethod(
  41533. $core.method({
  41534. selector: "acceptDagVisitor:",
  41535. protocol: "visiting",
  41536. args: ["aVisitor"],
  41537. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  41538. referencedClasses: [],
  41539. pragmas: [],
  41540. messageSends: ["visitIRValue:"]
  41541. }, function ($methodClass){ return function (aVisitor){
  41542. var self=this,$self=this;
  41543. return $core.withContext(function($ctx1) {
  41544. return $recv(aVisitor)._visitIRValue_(self);
  41545. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  41546. }; }),
  41547. $globals.IRValue);
  41548. $core.addMethod(
  41549. $core.method({
  41550. selector: "asReceiver",
  41551. protocol: "converting",
  41552. args: [],
  41553. source: "asReceiver\x0a\x09^ self",
  41554. referencedClasses: [],
  41555. pragmas: [],
  41556. messageSends: []
  41557. }, function ($methodClass){ return function (){
  41558. var self=this,$self=this;
  41559. return self;
  41560. }; }),
  41561. $globals.IRValue);
  41562. $core.addMethod(
  41563. $core.method({
  41564. selector: "value",
  41565. protocol: "accessing",
  41566. args: [],
  41567. source: "value\x0a\x09^ value",
  41568. referencedClasses: [],
  41569. pragmas: [],
  41570. messageSends: []
  41571. }, function ($methodClass){ return function (){
  41572. var self=this,$self=this;
  41573. return $self.value;
  41574. }; }),
  41575. $globals.IRValue);
  41576. $core.addMethod(
  41577. $core.method({
  41578. selector: "value:",
  41579. protocol: "accessing",
  41580. args: ["aString"],
  41581. source: "value: aString\x0a\x09value := aString",
  41582. referencedClasses: [],
  41583. pragmas: [],
  41584. messageSends: []
  41585. }, function ($methodClass){ return function (aString){
  41586. var self=this,$self=this;
  41587. $self.value=aString;
  41588. return self;
  41589. }; }),
  41590. $globals.IRValue);
  41591. $core.addClass("IRVariable", $globals.IRInstruction, ["variable"], "Compiler-IR");
  41592. $globals.IRVariable.comment="I am a variable instruction.";
  41593. $core.addMethod(
  41594. $core.method({
  41595. selector: "acceptDagVisitor:",
  41596. protocol: "visiting",
  41597. args: ["aVisitor"],
  41598. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  41599. referencedClasses: [],
  41600. pragmas: [],
  41601. messageSends: ["visitIRVariable:"]
  41602. }, function ($methodClass){ return function (aVisitor){
  41603. var self=this,$self=this;
  41604. return $core.withContext(function($ctx1) {
  41605. return $recv(aVisitor)._visitIRVariable_(self);
  41606. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  41607. }; }),
  41608. $globals.IRVariable);
  41609. $core.addMethod(
  41610. $core.method({
  41611. selector: "asReceiver",
  41612. protocol: "converting",
  41613. args: [],
  41614. source: "asReceiver\x0a\x09self variable asReceiver\x0a\x09\x09ifNil: [ ^ super asReceiver ]\x0a\x09\x09ifNotNil: [ :receiverVar |\x0a\x09\x09\x09self variable == receiverVar ifTrue: [ ^ self ].\x0a\x09\x09\x09^ self copy variable: receiverVar; yourself ]",
  41615. referencedClasses: [],
  41616. pragmas: [],
  41617. messageSends: ["ifNil:ifNotNil:", "asReceiver", "variable", "ifTrue:", "==", "variable:", "copy", "yourself"]
  41618. }, function ($methodClass){ return function (){
  41619. var self=this,$self=this;
  41620. return $core.withContext(function($ctx1) {
  41621. var $1,$2;
  41622. $1=[$recv([$self._variable()
  41623. ,$ctx1.sendIdx["variable"]=1
  41624. ][0])._asReceiver()
  41625. ,$ctx1.sendIdx["asReceiver"]=1
  41626. ][0];
  41627. if($1 == null || $1.a$nil){
  41628. return [(
  41629. $ctx1.supercall = true,
  41630. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._asReceiver.call($self))
  41631. ,$ctx1.supercall = false
  41632. ][0];
  41633. } else {
  41634. var receiverVar;
  41635. receiverVar=$1;
  41636. if($core.assert($recv($self._variable()).__eq_eq(receiverVar))){
  41637. return self;
  41638. }
  41639. $2=$self._copy();
  41640. $recv($2)._variable_(receiverVar);
  41641. return $recv($2)._yourself();
  41642. }
  41643. return self;
  41644. }, function($ctx1) {$ctx1.fill(self,"asReceiver",{})});
  41645. }; }),
  41646. $globals.IRVariable);
  41647. $core.addMethod(
  41648. $core.method({
  41649. selector: "isSuper",
  41650. protocol: "testing",
  41651. args: [],
  41652. source: "isSuper\x0a\x09^ self variable isSuper",
  41653. referencedClasses: [],
  41654. pragmas: [],
  41655. messageSends: ["isSuper", "variable"]
  41656. }, function ($methodClass){ return function (){
  41657. var self=this,$self=this;
  41658. return $core.withContext(function($ctx1) {
  41659. return $recv($self._variable())._isSuper();
  41660. }, function($ctx1) {$ctx1.fill(self,"isSuper",{})});
  41661. }; }),
  41662. $globals.IRVariable);
  41663. $core.addMethod(
  41664. $core.method({
  41665. selector: "isVariable",
  41666. protocol: "testing",
  41667. args: [],
  41668. source: "isVariable\x0a\x09^ true",
  41669. referencedClasses: [],
  41670. pragmas: [],
  41671. messageSends: []
  41672. }, function ($methodClass){ return function (){
  41673. var self=this,$self=this;
  41674. return true;
  41675. }; }),
  41676. $globals.IRVariable);
  41677. $core.addMethod(
  41678. $core.method({
  41679. selector: "variable",
  41680. protocol: "accessing",
  41681. args: [],
  41682. source: "variable\x0a\x09^ variable",
  41683. referencedClasses: [],
  41684. pragmas: [],
  41685. messageSends: []
  41686. }, function ($methodClass){ return function (){
  41687. var self=this,$self=this;
  41688. return $self.variable;
  41689. }; }),
  41690. $globals.IRVariable);
  41691. $core.addMethod(
  41692. $core.method({
  41693. selector: "variable:",
  41694. protocol: "accessing",
  41695. args: ["aScopeVariable"],
  41696. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  41697. referencedClasses: [],
  41698. pragmas: [],
  41699. messageSends: []
  41700. }, function ($methodClass){ return function (aScopeVariable){
  41701. var self=this,$self=this;
  41702. $self.variable=aScopeVariable;
  41703. return self;
  41704. }; }),
  41705. $globals.IRVariable);
  41706. $core.addClass("IRVerbatim", $globals.IRInstruction, ["source"], "Compiler-IR");
  41707. $core.addMethod(
  41708. $core.method({
  41709. selector: "acceptDagVisitor:",
  41710. protocol: "visiting",
  41711. args: ["aVisitor"],
  41712. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  41713. referencedClasses: [],
  41714. pragmas: [],
  41715. messageSends: ["visitIRVerbatim:"]
  41716. }, function ($methodClass){ return function (aVisitor){
  41717. var self=this,$self=this;
  41718. return $core.withContext(function($ctx1) {
  41719. return $recv(aVisitor)._visitIRVerbatim_(self);
  41720. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  41721. }; }),
  41722. $globals.IRVerbatim);
  41723. $core.addMethod(
  41724. $core.method({
  41725. selector: "source",
  41726. protocol: "accessing",
  41727. args: [],
  41728. source: "source\x0a\x09^ source",
  41729. referencedClasses: [],
  41730. pragmas: [],
  41731. messageSends: []
  41732. }, function ($methodClass){ return function (){
  41733. var self=this,$self=this;
  41734. return $self.source;
  41735. }; }),
  41736. $globals.IRVerbatim);
  41737. $core.addMethod(
  41738. $core.method({
  41739. selector: "source:",
  41740. protocol: "accessing",
  41741. args: ["aString"],
  41742. source: "source: aString\x0a\x09source := aString",
  41743. referencedClasses: [],
  41744. pragmas: [],
  41745. messageSends: []
  41746. }, function ($methodClass){ return function (aString){
  41747. var self=this,$self=this;
  41748. $self.source=aString;
  41749. return self;
  41750. }; }),
  41751. $globals.IRVerbatim);
  41752. $core.addClass("IRPragmator", $globals.Object, ["irMethod"], "Compiler-IR");
  41753. $core.addMethod(
  41754. $core.method({
  41755. selector: "irMethod",
  41756. protocol: "accessing",
  41757. args: [],
  41758. source: "irMethod\x0a\x09^ irMethod",
  41759. referencedClasses: [],
  41760. pragmas: [],
  41761. messageSends: []
  41762. }, function ($methodClass){ return function (){
  41763. var self=this,$self=this;
  41764. return $self.irMethod;
  41765. }; }),
  41766. $globals.IRPragmator);
  41767. $core.addMethod(
  41768. $core.method({
  41769. selector: "irMethod:",
  41770. protocol: "accessing",
  41771. args: ["anObject"],
  41772. source: "irMethod: anObject\x0a\x09irMethod := anObject",
  41773. referencedClasses: [],
  41774. pragmas: [],
  41775. messageSends: []
  41776. }, function ($methodClass){ return function (anObject){
  41777. var self=this,$self=this;
  41778. $self.irMethod=anObject;
  41779. return self;
  41780. }; }),
  41781. $globals.IRPragmator);
  41782. $core.addMethod(
  41783. $core.method({
  41784. selector: "value:",
  41785. protocol: "visiting",
  41786. args: ["anIRMethod"],
  41787. source: "value: anIRMethod\x0a\x09self irMethod: anIRMethod.\x0a\x09self processPragmas: anIRMethod pragmas.\x0a\x09^ anIRMethod",
  41788. referencedClasses: [],
  41789. pragmas: [],
  41790. messageSends: ["irMethod:", "processPragmas:", "pragmas"]
  41791. }, function ($methodClass){ return function (anIRMethod){
  41792. var self=this,$self=this;
  41793. return $core.withContext(function($ctx1) {
  41794. $self._irMethod_(anIRMethod);
  41795. $self._processPragmas_($recv(anIRMethod)._pragmas());
  41796. return anIRMethod;
  41797. }, function($ctx1) {$ctx1.fill(self,"value:",{anIRMethod:anIRMethod})});
  41798. }; }),
  41799. $globals.IRPragmator);
  41800. $core.addClass("IRLatePragmator", $globals.IRPragmator, [], "Compiler-IR");
  41801. $core.addMethod(
  41802. $core.method({
  41803. selector: "jsOverride:",
  41804. protocol: "pragmas",
  41805. args: ["aString"],
  41806. source: "jsOverride: aString\x0a\x09self irMethod arguments ifNotEmpty: [\x0a\x09\x09CompilerError signal: 'Must use <jsOverride:> in unary method.' ].\x0a\x09self irMethod attachments\x0a\x09\x09at: aString\x0a\x09\x09put: (NativeFunction\x0a\x09\x09\x09constructorNamed: #Function\x0a\x09\x09\x09value: 'return this.', irMethod selector asJavaScriptMethodName, '()')",
  41807. referencedClasses: ["CompilerError", "NativeFunction"],
  41808. pragmas: [],
  41809. messageSends: ["ifNotEmpty:", "arguments", "irMethod", "signal:", "at:put:", "attachments", "constructorNamed:value:", ",", "asJavaScriptMethodName", "selector"]
  41810. }, function ($methodClass){ return function (aString){
  41811. var self=this,$self=this;
  41812. return $core.withContext(function($ctx1) {
  41813. $recv($recv([$self._irMethod()
  41814. ,$ctx1.sendIdx["irMethod"]=1
  41815. ][0])._arguments())._ifNotEmpty_((function(){
  41816. return $core.withContext(function($ctx2) {
  41817. return $recv($globals.CompilerError)._signal_("Must use <jsOverride:> in unary method.");
  41818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41819. }));
  41820. $recv($recv($self._irMethod())._attachments())._at_put_(aString,$recv($globals.NativeFunction)._constructorNamed_value_("Function",[$recv("return this.".__comma($recv($recv($self.irMethod)._selector())._asJavaScriptMethodName())).__comma("()")
  41821. ,$ctx1.sendIdx[","]=1
  41822. ][0]));
  41823. return self;
  41824. }, function($ctx1) {$ctx1.fill(self,"jsOverride:",{aString:aString})});
  41825. }; }),
  41826. $globals.IRLatePragmator);
  41827. $core.addMethod(
  41828. $core.method({
  41829. selector: "jsOverride:args:",
  41830. protocol: "pragmas",
  41831. args: ["aString", "aCollection"],
  41832. source: "jsOverride: aString args: aCollection\x0a\x09| myArgs |\x0a\x09myArgs := self irMethod arguments.\x0a\x09myArgs size = aCollection size ifFalse: [\x0a\x09\x09CompilerError signal: 'Should have ', self irMethod arguments size, ' args in <jsOverride:args:>.' ].\x0a\x09myArgs asSet = aCollection asSet ifFalse: [\x0a\x09\x09CompilerError signal: 'Argument mismatch in <jsOverride:args:>.' ].\x0a\x09self irMethod attachments\x0a\x09\x09at: aString\x0a\x09\x09put: (NativeFunction\x0a\x09\x09\x09constructorNamed: #Function\x0a\x09\x09\x09value: (',' join: aCollection)\x0a\x09\x09\x09value: 'return this.', irMethod selector asJavaScriptMethodName, '(', (',' join: myArgs), ')')",
  41833. referencedClasses: ["CompilerError", "NativeFunction"],
  41834. pragmas: [],
  41835. messageSends: ["arguments", "irMethod", "ifFalse:", "=", "size", "signal:", ",", "asSet", "at:put:", "attachments", "constructorNamed:value:value:", "join:", "asJavaScriptMethodName", "selector"]
  41836. }, function ($methodClass){ return function (aString,aCollection){
  41837. var self=this,$self=this;
  41838. var myArgs;
  41839. return $core.withContext(function($ctx1) {
  41840. myArgs=[$recv([$self._irMethod()
  41841. ,$ctx1.sendIdx["irMethod"]=1
  41842. ][0])._arguments()
  41843. ,$ctx1.sendIdx["arguments"]=1
  41844. ][0];
  41845. if(!$core.assert([$recv([$recv(myArgs)._size()
  41846. ,$ctx1.sendIdx["size"]=1
  41847. ][0]).__eq([$recv(aCollection)._size()
  41848. ,$ctx1.sendIdx["size"]=2
  41849. ][0])
  41850. ,$ctx1.sendIdx["="]=1
  41851. ][0])){
  41852. [$recv($globals.CompilerError)._signal_([$recv(["Should have ".__comma($recv($recv([$self._irMethod()
  41853. ,$ctx1.sendIdx["irMethod"]=2
  41854. ][0])._arguments())._size())
  41855. ,$ctx1.sendIdx[","]=2
  41856. ][0]).__comma(" args in <jsOverride:args:>.")
  41857. ,$ctx1.sendIdx[","]=1
  41858. ][0])
  41859. ,$ctx1.sendIdx["signal:"]=1
  41860. ][0];
  41861. }
  41862. if(!$core.assert($recv([$recv(myArgs)._asSet()
  41863. ,$ctx1.sendIdx["asSet"]=1
  41864. ][0]).__eq($recv(aCollection)._asSet()))){
  41865. $recv($globals.CompilerError)._signal_("Argument mismatch in <jsOverride:args:>.");
  41866. }
  41867. $recv($recv($self._irMethod())._attachments())._at_put_(aString,$recv($globals.NativeFunction)._constructorNamed_value_value_("Function",[","._join_(aCollection)
  41868. ,$ctx1.sendIdx["join:"]=1
  41869. ][0],[$recv([$recv([$recv("return this.".__comma($recv($recv($self.irMethod)._selector())._asJavaScriptMethodName())).__comma("(")
  41870. ,$ctx1.sendIdx[","]=5
  41871. ][0]).__comma(","._join_(myArgs))
  41872. ,$ctx1.sendIdx[","]=4
  41873. ][0]).__comma(")")
  41874. ,$ctx1.sendIdx[","]=3
  41875. ][0]));
  41876. return self;
  41877. }, function($ctx1) {$ctx1.fill(self,"jsOverride:args:",{aString:aString,aCollection:aCollection,myArgs:myArgs})});
  41878. }; }),
  41879. $globals.IRLatePragmator);
  41880. $core.addClass("IRVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-IR");
  41881. $core.addMethod(
  41882. $core.method({
  41883. selector: "visitDagNode:",
  41884. protocol: "visiting",
  41885. args: ["aNode"],
  41886. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  41887. referencedClasses: [],
  41888. pragmas: [],
  41889. messageSends: ["visitDagNodeVariantSimple:"]
  41890. }, function ($methodClass){ return function (aNode){
  41891. var self=this,$self=this;
  41892. return $core.withContext(function($ctx1) {
  41893. return $self._visitDagNodeVariantSimple_(aNode);
  41894. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode})});
  41895. }; }),
  41896. $globals.IRVisitor);
  41897. $core.addMethod(
  41898. $core.method({
  41899. selector: "visitIRAssignment:",
  41900. protocol: "visiting",
  41901. args: ["anIRAssignment"],
  41902. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  41903. referencedClasses: [],
  41904. pragmas: [],
  41905. messageSends: ["visitDagNode:"]
  41906. }, function ($methodClass){ return function (anIRAssignment){
  41907. var self=this,$self=this;
  41908. return $core.withContext(function($ctx1) {
  41909. return $self._visitDagNode_(anIRAssignment);
  41910. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment})});
  41911. }; }),
  41912. $globals.IRVisitor);
  41913. $core.addMethod(
  41914. $core.method({
  41915. selector: "visitIRBlockReturn:",
  41916. protocol: "visiting",
  41917. args: ["anIRBlockReturn"],
  41918. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  41919. referencedClasses: [],
  41920. pragmas: [],
  41921. messageSends: ["visitIRReturn:"]
  41922. }, function ($methodClass){ return function (anIRBlockReturn){
  41923. var self=this,$self=this;
  41924. return $core.withContext(function($ctx1) {
  41925. return $self._visitIRReturn_(anIRBlockReturn);
  41926. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn})});
  41927. }; }),
  41928. $globals.IRVisitor);
  41929. $core.addMethod(
  41930. $core.method({
  41931. selector: "visitIRBlockSequence:",
  41932. protocol: "visiting",
  41933. args: ["anIRBlockSequence"],
  41934. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  41935. referencedClasses: [],
  41936. pragmas: [],
  41937. messageSends: ["visitIRSequence:"]
  41938. }, function ($methodClass){ return function (anIRBlockSequence){
  41939. var self=this,$self=this;
  41940. return $core.withContext(function($ctx1) {
  41941. return $self._visitIRSequence_(anIRBlockSequence);
  41942. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence})});
  41943. }; }),
  41944. $globals.IRVisitor);
  41945. $core.addMethod(
  41946. $core.method({
  41947. selector: "visitIRClosure:",
  41948. protocol: "visiting",
  41949. args: ["anIRClosure"],
  41950. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  41951. referencedClasses: [],
  41952. pragmas: [],
  41953. messageSends: ["visitDagNode:"]
  41954. }, function ($methodClass){ return function (anIRClosure){
  41955. var self=this,$self=this;
  41956. return $core.withContext(function($ctx1) {
  41957. return $self._visitDagNode_(anIRClosure);
  41958. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure})});
  41959. }; }),
  41960. $globals.IRVisitor);
  41961. $core.addMethod(
  41962. $core.method({
  41963. selector: "visitIRDynamicArray:",
  41964. protocol: "visiting",
  41965. args: ["anIRDynamicArray"],
  41966. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  41967. referencedClasses: [],
  41968. pragmas: [],
  41969. messageSends: ["visitDagNode:"]
  41970. }, function ($methodClass){ return function (anIRDynamicArray){
  41971. var self=this,$self=this;
  41972. return $core.withContext(function($ctx1) {
  41973. return $self._visitDagNode_(anIRDynamicArray);
  41974. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray})});
  41975. }; }),
  41976. $globals.IRVisitor);
  41977. $core.addMethod(
  41978. $core.method({
  41979. selector: "visitIRDynamicDictionary:",
  41980. protocol: "visiting",
  41981. args: ["anIRDynamicDictionary"],
  41982. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  41983. referencedClasses: [],
  41984. pragmas: [],
  41985. messageSends: ["visitDagNode:"]
  41986. }, function ($methodClass){ return function (anIRDynamicDictionary){
  41987. var self=this,$self=this;
  41988. return $core.withContext(function($ctx1) {
  41989. return $self._visitDagNode_(anIRDynamicDictionary);
  41990. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary})});
  41991. }; }),
  41992. $globals.IRVisitor);
  41993. $core.addMethod(
  41994. $core.method({
  41995. selector: "visitIRMethod:",
  41996. protocol: "visiting",
  41997. args: ["anIRMethod"],
  41998. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  41999. referencedClasses: [],
  42000. pragmas: [],
  42001. messageSends: ["visitDagNode:"]
  42002. }, function ($methodClass){ return function (anIRMethod){
  42003. var self=this,$self=this;
  42004. return $core.withContext(function($ctx1) {
  42005. return $self._visitDagNode_(anIRMethod);
  42006. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod})});
  42007. }; }),
  42008. $globals.IRVisitor);
  42009. $core.addMethod(
  42010. $core.method({
  42011. selector: "visitIRNonLocalReturn:",
  42012. protocol: "visiting",
  42013. args: ["anIRNonLocalReturn"],
  42014. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  42015. referencedClasses: [],
  42016. pragmas: [],
  42017. messageSends: ["visitDagNode:"]
  42018. }, function ($methodClass){ return function (anIRNonLocalReturn){
  42019. var self=this,$self=this;
  42020. return $core.withContext(function($ctx1) {
  42021. return $self._visitDagNode_(anIRNonLocalReturn);
  42022. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn})});
  42023. }; }),
  42024. $globals.IRVisitor);
  42025. $core.addMethod(
  42026. $core.method({
  42027. selector: "visitIRNonLocalReturnHandling:",
  42028. protocol: "visiting",
  42029. args: ["anIRNonLocalReturnHandling"],
  42030. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  42031. referencedClasses: [],
  42032. pragmas: [],
  42033. messageSends: ["visitDagNode:"]
  42034. }, function ($methodClass){ return function (anIRNonLocalReturnHandling){
  42035. var self=this,$self=this;
  42036. return $core.withContext(function($ctx1) {
  42037. return $self._visitDagNode_(anIRNonLocalReturnHandling);
  42038. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling})});
  42039. }; }),
  42040. $globals.IRVisitor);
  42041. $core.addMethod(
  42042. $core.method({
  42043. selector: "visitIRReturn:",
  42044. protocol: "visiting",
  42045. args: ["anIRReturn"],
  42046. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  42047. referencedClasses: [],
  42048. pragmas: [],
  42049. messageSends: ["visitDagNode:"]
  42050. }, function ($methodClass){ return function (anIRReturn){
  42051. var self=this,$self=this;
  42052. return $core.withContext(function($ctx1) {
  42053. return $self._visitDagNode_(anIRReturn);
  42054. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn})});
  42055. }; }),
  42056. $globals.IRVisitor);
  42057. $core.addMethod(
  42058. $core.method({
  42059. selector: "visitIRSend:",
  42060. protocol: "visiting",
  42061. args: ["anIRSend"],
  42062. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  42063. referencedClasses: [],
  42064. pragmas: [],
  42065. messageSends: ["visitDagNode:"]
  42066. }, function ($methodClass){ return function (anIRSend){
  42067. var self=this,$self=this;
  42068. return $core.withContext(function($ctx1) {
  42069. return $self._visitDagNode_(anIRSend);
  42070. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend})});
  42071. }; }),
  42072. $globals.IRVisitor);
  42073. $core.addMethod(
  42074. $core.method({
  42075. selector: "visitIRSequence:",
  42076. protocol: "visiting",
  42077. args: ["anIRSequence"],
  42078. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  42079. referencedClasses: [],
  42080. pragmas: [],
  42081. messageSends: ["visitDagNode:"]
  42082. }, function ($methodClass){ return function (anIRSequence){
  42083. var self=this,$self=this;
  42084. return $core.withContext(function($ctx1) {
  42085. return $self._visitDagNode_(anIRSequence);
  42086. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence})});
  42087. }; }),
  42088. $globals.IRVisitor);
  42089. $core.addMethod(
  42090. $core.method({
  42091. selector: "visitIRTempDeclaration:",
  42092. protocol: "visiting",
  42093. args: ["anIRTempDeclaration"],
  42094. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  42095. referencedClasses: [],
  42096. pragmas: [],
  42097. messageSends: ["visitDagNode:"]
  42098. }, function ($methodClass){ return function (anIRTempDeclaration){
  42099. var self=this,$self=this;
  42100. return $core.withContext(function($ctx1) {
  42101. return $self._visitDagNode_(anIRTempDeclaration);
  42102. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration})});
  42103. }; }),
  42104. $globals.IRVisitor);
  42105. $core.addMethod(
  42106. $core.method({
  42107. selector: "visitIRValue:",
  42108. protocol: "visiting",
  42109. args: ["anIRValue"],
  42110. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  42111. referencedClasses: [],
  42112. pragmas: [],
  42113. messageSends: ["visitDagNode:"]
  42114. }, function ($methodClass){ return function (anIRValue){
  42115. var self=this,$self=this;
  42116. return $core.withContext(function($ctx1) {
  42117. return $self._visitDagNode_(anIRValue);
  42118. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue})});
  42119. }; }),
  42120. $globals.IRVisitor);
  42121. $core.addMethod(
  42122. $core.method({
  42123. selector: "visitIRVariable:",
  42124. protocol: "visiting",
  42125. args: ["anIRVariable"],
  42126. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  42127. referencedClasses: [],
  42128. pragmas: [],
  42129. messageSends: ["visitDagNode:"]
  42130. }, function ($methodClass){ return function (anIRVariable){
  42131. var self=this,$self=this;
  42132. return $core.withContext(function($ctx1) {
  42133. return $self._visitDagNode_(anIRVariable);
  42134. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable})});
  42135. }; }),
  42136. $globals.IRVisitor);
  42137. $core.addMethod(
  42138. $core.method({
  42139. selector: "visitIRVerbatim:",
  42140. protocol: "visiting",
  42141. args: ["anIRVerbatim"],
  42142. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  42143. referencedClasses: [],
  42144. pragmas: [],
  42145. messageSends: ["visitDagNode:"]
  42146. }, function ($methodClass){ return function (anIRVerbatim){
  42147. var self=this,$self=this;
  42148. return $core.withContext(function($ctx1) {
  42149. return $self._visitDagNode_(anIRVerbatim);
  42150. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim})});
  42151. }; }),
  42152. $globals.IRVisitor);
  42153. $core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
  42154. $core.addMethod(
  42155. $core.method({
  42156. selector: "contents",
  42157. protocol: "accessing",
  42158. args: [],
  42159. source: "contents\x0a\x09^ self stream contents",
  42160. referencedClasses: [],
  42161. pragmas: [],
  42162. messageSends: ["contents", "stream"]
  42163. }, function ($methodClass){ return function (){
  42164. var self=this,$self=this;
  42165. return $core.withContext(function($ctx1) {
  42166. return $recv($self._stream())._contents();
  42167. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  42168. }; }),
  42169. $globals.IRJSTranslator);
  42170. $core.addMethod(
  42171. $core.method({
  42172. selector: "currentClass",
  42173. protocol: "accessing",
  42174. args: [],
  42175. source: "currentClass\x0a\x09^ currentClass",
  42176. referencedClasses: [],
  42177. pragmas: [],
  42178. messageSends: []
  42179. }, function ($methodClass){ return function (){
  42180. var self=this,$self=this;
  42181. return $self.currentClass;
  42182. }; }),
  42183. $globals.IRJSTranslator);
  42184. $core.addMethod(
  42185. $core.method({
  42186. selector: "currentClass:",
  42187. protocol: "accessing",
  42188. args: ["aClass"],
  42189. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  42190. referencedClasses: [],
  42191. pragmas: [],
  42192. messageSends: []
  42193. }, function ($methodClass){ return function (aClass){
  42194. var self=this,$self=this;
  42195. $self.currentClass=aClass;
  42196. return self;
  42197. }; }),
  42198. $globals.IRJSTranslator);
  42199. $core.addMethod(
  42200. $core.method({
  42201. selector: "initialize",
  42202. protocol: "initialization",
  42203. args: [],
  42204. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  42205. referencedClasses: ["JSStream"],
  42206. pragmas: [],
  42207. messageSends: ["initialize", "new"]
  42208. }, function ($methodClass){ return function (){
  42209. var self=this,$self=this;
  42210. return $core.withContext(function($ctx1) {
  42211. [(
  42212. $ctx1.supercall = true,
  42213. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  42214. ,$ctx1.supercall = false
  42215. ][0];
  42216. $self.stream=$recv($globals.JSStream)._new();
  42217. return self;
  42218. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  42219. }; }),
  42220. $globals.IRJSTranslator);
  42221. $core.addMethod(
  42222. $core.method({
  42223. selector: "stream",
  42224. protocol: "accessing",
  42225. args: [],
  42226. source: "stream\x0a\x09^ stream",
  42227. referencedClasses: [],
  42228. pragmas: [],
  42229. messageSends: []
  42230. }, function ($methodClass){ return function (){
  42231. var self=this,$self=this;
  42232. return $self.stream;
  42233. }; }),
  42234. $globals.IRJSTranslator);
  42235. $core.addMethod(
  42236. $core.method({
  42237. selector: "stream:",
  42238. protocol: "accessing",
  42239. args: ["aStream"],
  42240. source: "stream: aStream\x0a\x09stream := aStream",
  42241. referencedClasses: [],
  42242. pragmas: [],
  42243. messageSends: []
  42244. }, function ($methodClass){ return function (aStream){
  42245. var self=this,$self=this;
  42246. $self.stream=aStream;
  42247. return self;
  42248. }; }),
  42249. $globals.IRJSTranslator);
  42250. $core.addMethod(
  42251. $core.method({
  42252. selector: "visitIRAssignment:",
  42253. protocol: "visiting",
  42254. args: ["anIRAssignment"],
  42255. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  42256. referencedClasses: [],
  42257. pragmas: [],
  42258. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  42259. }, function ($methodClass){ return function (anIRAssignment){
  42260. var self=this,$self=this;
  42261. return $core.withContext(function($ctx1) {
  42262. $recv($self._stream())._nextPutAssignLhs_rhs_((function(){
  42263. return $core.withContext(function($ctx2) {
  42264. return [$self._visit_($recv(anIRAssignment)._left())
  42265. ,$ctx2.sendIdx["visit:"]=1
  42266. ][0];
  42267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42268. }),(function(){
  42269. return $core.withContext(function($ctx2) {
  42270. return $self._visit_($recv(anIRAssignment)._right());
  42271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42272. }));
  42273. return self;
  42274. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment})});
  42275. }; }),
  42276. $globals.IRJSTranslator);
  42277. $core.addMethod(
  42278. $core.method({
  42279. selector: "visitIRClosure:",
  42280. protocol: "visiting",
  42281. args: ["anIRClosure"],
  42282. 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",
  42283. referencedClasses: [],
  42284. pragmas: [],
  42285. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  42286. }, function ($methodClass){ return function (anIRClosure){
  42287. var self=this,$self=this;
  42288. return $core.withContext(function($ctx1) {
  42289. $recv([$self._stream()
  42290. ,$ctx1.sendIdx["stream"]=1
  42291. ][0])._nextPutClosureWith_arguments_((function(){
  42292. return $core.withContext(function($ctx2) {
  42293. $recv([$self._stream()
  42294. ,$ctx2.sendIdx["stream"]=2
  42295. ][0])._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  42296. return $core.withContext(function($ctx3) {
  42297. return $recv($recv(each)._name())._asVariableName();
  42298. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42299. })));
  42300. return $recv($self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  42301. return $core.withContext(function($ctx3) {
  42302. return [(
  42303. $ctx3.supercall = true,
  42304. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.call($self,anIRClosure))
  42305. ,$ctx3.supercall = false
  42306. ][0];
  42307. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42308. }));
  42309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42310. }),$recv(anIRClosure)._arguments());
  42311. return self;
  42312. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure})});
  42313. }; }),
  42314. $globals.IRJSTranslator);
  42315. $core.addMethod(
  42316. $core.method({
  42317. selector: "visitIRDynamicArray:",
  42318. protocol: "visiting",
  42319. args: ["anIRDynamicArray"],
  42320. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  42321. referencedClasses: [],
  42322. pragmas: [],
  42323. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  42324. }, function ($methodClass){ return function (anIRDynamicArray){
  42325. var self=this,$self=this;
  42326. return $core.withContext(function($ctx1) {
  42327. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  42328. return self;
  42329. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray})});
  42330. }; }),
  42331. $globals.IRJSTranslator);
  42332. $core.addMethod(
  42333. $core.method({
  42334. selector: "visitIRDynamicDictionary:",
  42335. protocol: "visiting",
  42336. args: ["anIRDynamicDictionary"],
  42337. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  42338. referencedClasses: [],
  42339. pragmas: [],
  42340. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  42341. }, function ($methodClass){ return function (anIRDynamicDictionary){
  42342. var self=this,$self=this;
  42343. return $core.withContext(function($ctx1) {
  42344. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  42345. return self;
  42346. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary})});
  42347. }; }),
  42348. $globals.IRJSTranslator);
  42349. $core.addMethod(
  42350. $core.method({
  42351. selector: "visitIRMethod:",
  42352. protocol: "visiting",
  42353. args: ["anIRMethod"],
  42354. source: "visitIRMethod: anIRMethod\x0a\x0a\x09self 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 collect: [ :each | each variable alias ]) asSet ].\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\x09\x09\x0a\x09^ anIRMethod compiledSource: self contents; yourself",
  42355. referencedClasses: [],
  42356. pragmas: [],
  42357. messageSends: ["nextPutFunctionWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutContextFor:during:", "ifNotEmpty:", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments", "compiledSource:", "contents", "yourself"]
  42358. }, function ($methodClass){ return function (anIRMethod){
  42359. var self=this,$self=this;
  42360. return $core.withContext(function($ctx1) {
  42361. $recv([$self._stream()
  42362. ,$ctx1.sendIdx["stream"]=1
  42363. ][0])._nextPutFunctionWith_arguments_((function(){
  42364. return $core.withContext(function($ctx2) {
  42365. [$recv([$self._stream()
  42366. ,$ctx2.sendIdx["stream"]=2
  42367. ][0])._nextPutVars_([$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  42368. return $core.withContext(function($ctx3) {
  42369. return $recv($recv(each)._name())._asVariableName();
  42370. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42371. }))
  42372. ,$ctx2.sendIdx["collect:"]=1
  42373. ][0])
  42374. ,$ctx2.sendIdx["nextPutVars:"]=1
  42375. ][0];
  42376. return $recv([$self._stream()
  42377. ,$ctx2.sendIdx["stream"]=3
  42378. ][0])._nextPutContextFor_during_(anIRMethod,(function(){
  42379. return $core.withContext(function($ctx3) {
  42380. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  42381. return $core.withContext(function($ctx4) {
  42382. return $recv([$self._stream()
  42383. ,$ctx4.sendIdx["stream"]=4
  42384. ][0])._nextPutVars_($recv($recv(internalVars)._collect_((function(each){
  42385. return $core.withContext(function($ctx5) {
  42386. return $recv($recv(each)._variable())._alias();
  42387. }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,5)});
  42388. })))._asSet());
  42389. }, function($ctx4) {$ctx4.fillBlock({internalVars:internalVars},$ctx3,4)});
  42390. }));
  42391. if($core.assert($recv($recv(anIRMethod)._scope())._hasNonLocalReturn())){
  42392. return $recv($self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  42393. return $core.withContext(function($ctx4) {
  42394. return [(
  42395. $ctx4.supercall = true,
  42396. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.call($self,anIRMethod))
  42397. ,$ctx4.sendIdx["visitIRMethod:"]=1,$ctx4.supercall = false
  42398. ][0];
  42399. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  42400. }));
  42401. } else {
  42402. return [(
  42403. $ctx3.supercall = true,
  42404. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.call($self,anIRMethod))
  42405. ,$ctx3.supercall = false
  42406. ][0];
  42407. }
  42408. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42409. }));
  42410. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42411. }),$recv(anIRMethod)._arguments());
  42412. $recv(anIRMethod)._compiledSource_($self._contents());
  42413. return $recv(anIRMethod)._yourself();
  42414. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod})});
  42415. }; }),
  42416. $globals.IRJSTranslator);
  42417. $core.addMethod(
  42418. $core.method({
  42419. selector: "visitIRNonLocalReturn:",
  42420. protocol: "visiting",
  42421. args: ["anIRNonLocalReturn"],
  42422. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  42423. referencedClasses: [],
  42424. pragmas: [],
  42425. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  42426. }, function ($methodClass){ return function (anIRNonLocalReturn){
  42427. var self=this,$self=this;
  42428. return $core.withContext(function($ctx1) {
  42429. $recv($self._stream())._nextPutNonLocalReturnWith_((function(){
  42430. return $core.withContext(function($ctx2) {
  42431. return [(
  42432. $ctx2.supercall = true,
  42433. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.call($self,anIRNonLocalReturn))
  42434. ,$ctx2.supercall = false
  42435. ][0];
  42436. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42437. }));
  42438. return self;
  42439. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn})});
  42440. }; }),
  42441. $globals.IRJSTranslator);
  42442. $core.addMethod(
  42443. $core.method({
  42444. selector: "visitIRReturn:",
  42445. protocol: "visiting",
  42446. args: ["anIRReturn"],
  42447. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  42448. referencedClasses: [],
  42449. pragmas: [],
  42450. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  42451. }, function ($methodClass){ return function (anIRReturn){
  42452. var self=this,$self=this;
  42453. return $core.withContext(function($ctx1) {
  42454. $recv($self._stream())._nextPutReturnWith_((function(){
  42455. return $core.withContext(function($ctx2) {
  42456. return [(
  42457. $ctx2.supercall = true,
  42458. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.call($self,anIRReturn))
  42459. ,$ctx2.supercall = false
  42460. ][0];
  42461. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42462. }));
  42463. return self;
  42464. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn})});
  42465. }; }),
  42466. $globals.IRJSTranslator);
  42467. $core.addMethod(
  42468. $core.method({
  42469. selector: "visitIRSend:",
  42470. protocol: "visiting",
  42471. args: ["anIRSend"],
  42472. source: "visitIRSend: anIRSend\x0a\x09| prefixes suffixes workBlock |\x0a\x09prefixes := #().\x0a\x09suffixes := #().\x0a\x09workBlock := [ self visitSend: anIRSend ].\x0a\x09\x0a\x09anIRSend index < (anIRSend method sendIndexes at: anIRSend selector) size ifTrue: [\x0a\x09\x09suffixes add:\x0a\x09\x09\x09anIRSend scope alias,\x0a\x09\x09\x09'.sendIdx[',\x0a\x09\x09\x09anIRSend selector asJavaScriptSource,\x0a\x09\x09\x09']=',\x0a\x09\x09\x09anIRSend index asString ].\x0a\x09\x0a\x09anIRSend receiver isSuper ifTrue: [\x0a\x09\x09prefixes add: anIRSend scope alias, '.supercall = true'.\x0a\x09\x09suffixes add: anIRSend scope alias, '.supercall = false'.\x0a\x09\x09workBlock := [ self visitSuperSend: anIRSend ] ].\x0a\x0a\x09self stream nextPutBefore: prefixes after: suffixes with: workBlock",
  42473. referencedClasses: [],
  42474. pragmas: [],
  42475. messageSends: ["visitSend:", "ifTrue:", "<", "index", "size", "at:", "sendIndexes", "method", "selector", "add:", ",", "alias", "scope", "asJavaScriptSource", "asString", "isSuper", "receiver", "visitSuperSend:", "nextPutBefore:after:with:", "stream"]
  42476. }, function ($methodClass){ return function (anIRSend){
  42477. var self=this,$self=this;
  42478. var prefixes,suffixes,workBlock;
  42479. return $core.withContext(function($ctx1) {
  42480. prefixes=[];
  42481. suffixes=[];
  42482. workBlock=(function(){
  42483. return $core.withContext(function($ctx2) {
  42484. return $self._visitSend_(anIRSend);
  42485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42486. });
  42487. if($core.assert($recv([$recv(anIRSend)._index()
  42488. ,$ctx1.sendIdx["index"]=1
  42489. ][0]).__lt($recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_([$recv(anIRSend)._selector()
  42490. ,$ctx1.sendIdx["selector"]=1
  42491. ][0]))._size()))){
  42492. [$recv(suffixes)._add_([$recv([$recv([$recv([$recv([$recv([$recv(anIRSend)._scope()
  42493. ,$ctx1.sendIdx["scope"]=1
  42494. ][0])._alias()
  42495. ,$ctx1.sendIdx["alias"]=1
  42496. ][0]).__comma(".sendIdx[")
  42497. ,$ctx1.sendIdx[","]=4
  42498. ][0]).__comma($recv($recv(anIRSend)._selector())._asJavaScriptSource())
  42499. ,$ctx1.sendIdx[","]=3
  42500. ][0]).__comma("]=")
  42501. ,$ctx1.sendIdx[","]=2
  42502. ][0]).__comma($recv($recv(anIRSend)._index())._asString())
  42503. ,$ctx1.sendIdx[","]=1
  42504. ][0])
  42505. ,$ctx1.sendIdx["add:"]=1
  42506. ][0];
  42507. }
  42508. if($core.assert($recv($recv(anIRSend)._receiver())._isSuper())){
  42509. [$recv(prefixes)._add_([$recv([$recv([$recv(anIRSend)._scope()
  42510. ,$ctx1.sendIdx["scope"]=2
  42511. ][0])._alias()
  42512. ,$ctx1.sendIdx["alias"]=2
  42513. ][0]).__comma(".supercall = true")
  42514. ,$ctx1.sendIdx[","]=5
  42515. ][0])
  42516. ,$ctx1.sendIdx["add:"]=2
  42517. ][0];
  42518. $recv(suffixes)._add_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false"));
  42519. workBlock=(function(){
  42520. return $core.withContext(function($ctx2) {
  42521. return $self._visitSuperSend_(anIRSend);
  42522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  42523. });
  42524. workBlock;
  42525. }
  42526. $recv($self._stream())._nextPutBefore_after_with_(prefixes,suffixes,workBlock);
  42527. return self;
  42528. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,prefixes:prefixes,suffixes:suffixes,workBlock:workBlock})});
  42529. }; }),
  42530. $globals.IRJSTranslator);
  42531. $core.addMethod(
  42532. $core.method({
  42533. selector: "visitIRSequence:",
  42534. protocol: "visiting",
  42535. args: ["anIRSequence"],
  42536. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  42537. referencedClasses: [],
  42538. pragmas: [],
  42539. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  42540. }, function ($methodClass){ return function (anIRSequence){
  42541. var self=this,$self=this;
  42542. return $core.withContext(function($ctx1) {
  42543. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  42544. return $core.withContext(function($ctx2) {
  42545. return $recv($self._stream())._nextPutStatementWith_((function(){
  42546. return $core.withContext(function($ctx3) {
  42547. return $self._visit_(each);
  42548. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42549. }));
  42550. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42551. }));
  42552. return self;
  42553. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence})});
  42554. }; }),
  42555. $globals.IRJSTranslator);
  42556. $core.addMethod(
  42557. $core.method({
  42558. selector: "visitIRTempDeclaration:",
  42559. protocol: "visiting",
  42560. args: ["anIRTempDeclaration"],
  42561. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  42562. referencedClasses: [],
  42563. pragmas: [],
  42564. messageSends: []
  42565. }, function ($methodClass){ return function (anIRTempDeclaration){
  42566. var self=this,$self=this;
  42567. return self;
  42568. }; }),
  42569. $globals.IRJSTranslator);
  42570. $core.addMethod(
  42571. $core.method({
  42572. selector: "visitIRValue:",
  42573. protocol: "visiting",
  42574. args: ["anIRValue"],
  42575. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavaScriptSource",
  42576. referencedClasses: [],
  42577. pragmas: [],
  42578. messageSends: ["nextPutAll:", "stream", "asJavaScriptSource", "value"]
  42579. }, function ($methodClass){ return function (anIRValue){
  42580. var self=this,$self=this;
  42581. return $core.withContext(function($ctx1) {
  42582. $recv($self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavaScriptSource());
  42583. return self;
  42584. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue})});
  42585. }; }),
  42586. $globals.IRJSTranslator);
  42587. $core.addMethod(
  42588. $core.method({
  42589. selector: "visitIRVariable:",
  42590. protocol: "visiting",
  42591. args: ["anIRVariable"],
  42592. source: "visitIRVariable: anIRVariable\x0a\x09self stream nextPutAll: anIRVariable variable alias",
  42593. referencedClasses: [],
  42594. pragmas: [],
  42595. messageSends: ["nextPutAll:", "stream", "alias", "variable"]
  42596. }, function ($methodClass){ return function (anIRVariable){
  42597. var self=this,$self=this;
  42598. return $core.withContext(function($ctx1) {
  42599. $recv($self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  42600. return self;
  42601. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable})});
  42602. }; }),
  42603. $globals.IRJSTranslator);
  42604. $core.addMethod(
  42605. $core.method({
  42606. selector: "visitIRVerbatim:",
  42607. protocol: "visiting",
  42608. args: ["anIRVerbatim"],
  42609. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutAll: anIRVerbatim source",
  42610. referencedClasses: [],
  42611. pragmas: [],
  42612. messageSends: ["nextPutAll:", "stream", "source"]
  42613. }, function ($methodClass){ return function (anIRVerbatim){
  42614. var self=this,$self=this;
  42615. return $core.withContext(function($ctx1) {
  42616. $recv($self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  42617. return self;
  42618. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim})});
  42619. }; }),
  42620. $globals.IRJSTranslator);
  42621. $core.addMethod(
  42622. $core.method({
  42623. selector: "visitInstructionList:enclosedBetween:and:",
  42624. protocol: "visiting",
  42625. args: ["anArray", "aString", "anotherString"],
  42626. 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",
  42627. referencedClasses: [],
  42628. pragmas: [],
  42629. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  42630. }, function ($methodClass){ return function (anArray,aString,anotherString){
  42631. var self=this,$self=this;
  42632. return $core.withContext(function($ctx1) {
  42633. [$recv([$self._stream()
  42634. ,$ctx1.sendIdx["stream"]=1
  42635. ][0])._nextPutAll_(aString)
  42636. ,$ctx1.sendIdx["nextPutAll:"]=1
  42637. ][0];
  42638. $recv(anArray)._do_separatedBy_((function(each){
  42639. return $core.withContext(function($ctx2) {
  42640. return $self._visit_(each);
  42641. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42642. }),(function(){
  42643. return $core.withContext(function($ctx2) {
  42644. return [$recv($self._stream())._nextPutAll_(",")
  42645. ,$ctx2.sendIdx["nextPutAll:"]=2
  42646. ][0];
  42647. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42648. }));
  42649. $recv($self.stream)._nextPutAll_(anotherString);
  42650. return self;
  42651. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString})});
  42652. }; }),
  42653. $globals.IRJSTranslator);
  42654. $core.addMethod(
  42655. $core.method({
  42656. selector: "visitReceiver:",
  42657. protocol: "visiting",
  42658. args: ["anIRInstruction"],
  42659. source: "visitReceiver: anIRInstruction\x0a\x09anIRInstruction asReceiver\x0a\x09\x09ifNotNil: [ :instr | self visit: instr ]\x0a\x09\x09ifNil: [\x0a\x09\x09\x09self stream nextPutAll: '$recv('.\x0a\x09\x09\x09self visit: anIRInstruction.\x0a\x09\x09\x09self stream nextPutAll: ')' ]",
  42660. referencedClasses: [],
  42661. pragmas: [],
  42662. messageSends: ["ifNotNil:ifNil:", "asReceiver", "visit:", "nextPutAll:", "stream"]
  42663. }, function ($methodClass){ return function (anIRInstruction){
  42664. var self=this,$self=this;
  42665. return $core.withContext(function($ctx1) {
  42666. var $1;
  42667. $1=$recv(anIRInstruction)._asReceiver();
  42668. if($1 == null || $1.a$nil){
  42669. [$recv([$self._stream()
  42670. ,$ctx1.sendIdx["stream"]=1
  42671. ][0])._nextPutAll_("$recv(")
  42672. ,$ctx1.sendIdx["nextPutAll:"]=1
  42673. ][0];
  42674. $self._visit_(anIRInstruction);
  42675. $recv($self._stream())._nextPutAll_(")");
  42676. } else {
  42677. var instr;
  42678. instr=$1;
  42679. [$self._visit_(instr)
  42680. ,$ctx1.sendIdx["visit:"]=1
  42681. ][0];
  42682. }
  42683. return self;
  42684. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction})});
  42685. }; }),
  42686. $globals.IRJSTranslator);
  42687. $core.addMethod(
  42688. $core.method({
  42689. selector: "visitSend:",
  42690. protocol: "visiting",
  42691. args: ["anIRSend"],
  42692. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend receiver.\x0a\x09self stream nextPutAll: '.', anIRSend javaScriptSelector.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend arguments\x0a\x09\x09enclosedBetween: '(' and: ')'",
  42693. referencedClasses: [],
  42694. pragmas: [],
  42695. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "javaScriptSelector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  42696. }, function ($methodClass){ return function (anIRSend){
  42697. var self=this,$self=this;
  42698. return $core.withContext(function($ctx1) {
  42699. $self._visitReceiver_($recv(anIRSend)._receiver());
  42700. $recv($self._stream())._nextPutAll_(".".__comma($recv(anIRSend)._javaScriptSelector()));
  42701. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  42702. return self;
  42703. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend})});
  42704. }; }),
  42705. $globals.IRJSTranslator);
  42706. $core.addMethod(
  42707. $core.method({
  42708. selector: "visitSuperSend:",
  42709. protocol: "visiting",
  42710. args: ["anIRSend"],
  42711. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: anIRSend receiver variable lookupAsJavaScriptSource, '.';\x0a\x09\x09nextPutAll: anIRSend javaScriptSelector.\x0a\x09anIRSend arguments\x0a\x09\x09ifEmpty: [\x0a\x09\x09\x09self stream nextPutAll: '.call('.\x0a\x09\x09\x09self visitReceiver: anIRSend receiver.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09ifNotEmpty: [\x0a\x09\x09\x09anIRSend argumentSwitcher\x0a\x09\x09\x09\x09ifNil: [\x0a\x09\x09\x09\x09\x09self stream nextPutAll: '.call('.\x0a\x09\x09\x09\x09\x09self visitReceiver: anIRSend receiver.\x0a\x09\x09\x09\x09\x09self\x0a\x09\x09\x09\x09\x09\x09visitInstructionList: anIRSend arguments\x0a\x09\x09\x09\x09\x09\x09enclosedBetween: ',' and: ')' ]\x0a\x09\x09\x09\x09ifNotNil: [ :switcher |\x0a\x09\x09\x09\x09\x09self stream nextPutAll: '.apply('.\x0a\x09\x09\x09\x09\x09self visitReceiver: anIRSend receiver.\x0a\x09\x09\x09\x09\x09self\x0a\x09\x09\x09\x09\x09\x09visitInstructionList: anIRSend arguments\x0a\x09\x09\x09\x09\x09\x09enclosedBetween: ',(', switcher asJavaScriptSource, ')('\x0a\x09\x09\x09\x09\x09\x09and: '))' ] ]",
  42712. referencedClasses: [],
  42713. pragmas: [],
  42714. messageSends: ["nextPutAll:", "stream", ",", "lookupAsJavaScriptSource", "variable", "receiver", "javaScriptSelector", "ifEmpty:ifNotEmpty:", "arguments", "visitReceiver:", "ifNil:ifNotNil:", "argumentSwitcher", "visitInstructionList:enclosedBetween:and:", "asJavaScriptSource"]
  42715. }, function ($methodClass){ return function (anIRSend){
  42716. var self=this,$self=this;
  42717. return $core.withContext(function($ctx1) {
  42718. var $1,$2;
  42719. $1=[$self._stream()
  42720. ,$ctx1.sendIdx["stream"]=1
  42721. ][0];
  42722. [$recv($1)._nextPutAll_([$recv($recv($recv([$recv(anIRSend)._receiver()
  42723. ,$ctx1.sendIdx["receiver"]=1
  42724. ][0])._variable())._lookupAsJavaScriptSource()).__comma(".")
  42725. ,$ctx1.sendIdx[","]=1
  42726. ][0])
  42727. ,$ctx1.sendIdx["nextPutAll:"]=1
  42728. ][0];
  42729. [$recv($1)._nextPutAll_($recv(anIRSend)._javaScriptSelector())
  42730. ,$ctx1.sendIdx["nextPutAll:"]=2
  42731. ][0];
  42732. $recv([$recv(anIRSend)._arguments()
  42733. ,$ctx1.sendIdx["arguments"]=1
  42734. ][0])._ifEmpty_ifNotEmpty_((function(){
  42735. return $core.withContext(function($ctx2) {
  42736. [$recv([$self._stream()
  42737. ,$ctx2.sendIdx["stream"]=2
  42738. ][0])._nextPutAll_(".call(")
  42739. ,$ctx2.sendIdx["nextPutAll:"]=3
  42740. ][0];
  42741. [$self._visitReceiver_([$recv(anIRSend)._receiver()
  42742. ,$ctx2.sendIdx["receiver"]=2
  42743. ][0])
  42744. ,$ctx2.sendIdx["visitReceiver:"]=1
  42745. ][0];
  42746. return [$recv([$self._stream()
  42747. ,$ctx2.sendIdx["stream"]=3
  42748. ][0])._nextPutAll_(")")
  42749. ,$ctx2.sendIdx["nextPutAll:"]=4
  42750. ][0];
  42751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42752. }),(function(){
  42753. return $core.withContext(function($ctx2) {
  42754. $2=$recv(anIRSend)._argumentSwitcher();
  42755. if($2 == null || $2.a$nil){
  42756. [$recv([$self._stream()
  42757. ,$ctx2.sendIdx["stream"]=4
  42758. ][0])._nextPutAll_(".call(")
  42759. ,$ctx2.sendIdx["nextPutAll:"]=5
  42760. ][0];
  42761. [$self._visitReceiver_([$recv(anIRSend)._receiver()
  42762. ,$ctx2.sendIdx["receiver"]=3
  42763. ][0])
  42764. ,$ctx2.sendIdx["visitReceiver:"]=2
  42765. ][0];
  42766. return [$self._visitInstructionList_enclosedBetween_and_([$recv(anIRSend)._arguments()
  42767. ,$ctx2.sendIdx["arguments"]=2
  42768. ][0],",",")")
  42769. ,$ctx2.sendIdx["visitInstructionList:enclosedBetween:and:"]=1
  42770. ][0];
  42771. } else {
  42772. var switcher;
  42773. switcher=$2;
  42774. $recv($self._stream())._nextPutAll_(".apply(");
  42775. $self._visitReceiver_($recv(anIRSend)._receiver());
  42776. return $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),[$recv(",(".__comma($recv(switcher)._asJavaScriptSource())).__comma(")(")
  42777. ,$ctx2.sendIdx[","]=2
  42778. ][0],"))");
  42779. }
  42780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42781. }));
  42782. return self;
  42783. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend})});
  42784. }; }),
  42785. $globals.IRJSTranslator);
  42786. $core.addClass("JSStream", $globals.Object, ["stream", "omitSemicolon"], "Compiler-IR");
  42787. $core.addMethod(
  42788. $core.method({
  42789. selector: "contents",
  42790. protocol: "accessing",
  42791. args: [],
  42792. source: "contents\x0a\x09^ stream contents",
  42793. referencedClasses: [],
  42794. pragmas: [],
  42795. messageSends: ["contents"]
  42796. }, function ($methodClass){ return function (){
  42797. var self=this,$self=this;
  42798. return $core.withContext(function($ctx1) {
  42799. return $recv($self.stream)._contents();
  42800. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  42801. }; }),
  42802. $globals.JSStream);
  42803. $core.addMethod(
  42804. $core.method({
  42805. selector: "initialize",
  42806. protocol: "initialization",
  42807. args: [],
  42808. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  42809. referencedClasses: [],
  42810. pragmas: [],
  42811. messageSends: ["initialize", "writeStream"]
  42812. }, function ($methodClass){ return function (){
  42813. var self=this,$self=this;
  42814. return $core.withContext(function($ctx1) {
  42815. [(
  42816. $ctx1.supercall = true,
  42817. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  42818. ,$ctx1.supercall = false
  42819. ][0];
  42820. $self.stream=""._writeStream();
  42821. return self;
  42822. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  42823. }; }),
  42824. $globals.JSStream);
  42825. $core.addMethod(
  42826. $core.method({
  42827. selector: "lf",
  42828. protocol: "streaming",
  42829. args: [],
  42830. source: "lf\x0a\x09stream lf",
  42831. referencedClasses: [],
  42832. pragmas: [],
  42833. messageSends: ["lf"]
  42834. }, function ($methodClass){ return function (){
  42835. var self=this,$self=this;
  42836. return $core.withContext(function($ctx1) {
  42837. $recv($self.stream)._lf();
  42838. return self;
  42839. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  42840. }; }),
  42841. $globals.JSStream);
  42842. $core.addMethod(
  42843. $core.method({
  42844. selector: "nextPut:",
  42845. protocol: "streaming",
  42846. args: ["aString"],
  42847. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  42848. referencedClasses: [],
  42849. pragmas: [],
  42850. messageSends: ["nextPut:"]
  42851. }, function ($methodClass){ return function (aString){
  42852. var self=this,$self=this;
  42853. return $core.withContext(function($ctx1) {
  42854. $recv($self.stream)._nextPut_(aString);
  42855. return self;
  42856. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString})});
  42857. }; }),
  42858. $globals.JSStream);
  42859. $core.addMethod(
  42860. $core.method({
  42861. selector: "nextPutAll:",
  42862. protocol: "streaming",
  42863. args: ["aString"],
  42864. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  42865. referencedClasses: [],
  42866. pragmas: [],
  42867. messageSends: ["nextPutAll:"]
  42868. }, function ($methodClass){ return function (aString){
  42869. var self=this,$self=this;
  42870. return $core.withContext(function($ctx1) {
  42871. $recv($self.stream)._nextPutAll_(aString);
  42872. return self;
  42873. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString})});
  42874. }; }),
  42875. $globals.JSStream);
  42876. $core.addMethod(
  42877. $core.method({
  42878. selector: "nextPutAssignLhs:rhs:",
  42879. protocol: "streaming",
  42880. args: ["aBlock", "anotherBlock"],
  42881. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  42882. referencedClasses: [],
  42883. pragmas: [],
  42884. messageSends: ["value", "nextPutAll:"]
  42885. }, function ($methodClass){ return function (aBlock,anotherBlock){
  42886. var self=this,$self=this;
  42887. return $core.withContext(function($ctx1) {
  42888. [$recv(aBlock)._value()
  42889. ,$ctx1.sendIdx["value"]=1
  42890. ][0];
  42891. $recv($self.stream)._nextPutAll_("=");
  42892. $recv(anotherBlock)._value();
  42893. return self;
  42894. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  42895. }; }),
  42896. $globals.JSStream);
  42897. $core.addMethod(
  42898. $core.method({
  42899. selector: "nextPutBefore:after:with:",
  42900. protocol: "streaming",
  42901. args: ["prefixCollection", "suffixCollection", "aBlock"],
  42902. source: "nextPutBefore: prefixCollection after: suffixCollection with: aBlock\x0a\x09suffixCollection isEmpty\x0a\x09\x09ifTrue: [ self nextPutBefore: prefixCollection with: aBlock ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: '['; nextPutBefore: prefixCollection with: aBlock; lf;\x0a\x09\x09\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf.\x0a\x09\x09\x09suffixCollection do: [ :each | self nextPutAll: ','; nextPutAll: each ].\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09lf;\x0a\x09\x09\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'; lf;\x0a\x09\x09\x09\x09nextPutAll: '][0]' ]",
  42903. referencedClasses: [],
  42904. pragmas: [],
  42905. messageSends: ["ifTrue:ifFalse:", "isEmpty", "nextPutBefore:with:", "nextPutAll:", "lf", "do:"]
  42906. }, function ($methodClass){ return function (prefixCollection,suffixCollection,aBlock){
  42907. var self=this,$self=this;
  42908. return $core.withContext(function($ctx1) {
  42909. if($core.assert($recv(suffixCollection)._isEmpty())){
  42910. [$self._nextPutBefore_with_(prefixCollection,aBlock)
  42911. ,$ctx1.sendIdx["nextPutBefore:with:"]=1
  42912. ][0];
  42913. } else {
  42914. [$self._nextPutAll_("[")
  42915. ,$ctx1.sendIdx["nextPutAll:"]=1
  42916. ][0];
  42917. $self._nextPutBefore_with_(prefixCollection,aBlock);
  42918. [$self._lf()
  42919. ,$ctx1.sendIdx["lf"]=1
  42920. ][0];
  42921. [$self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);")
  42922. ,$ctx1.sendIdx["nextPutAll:"]=2
  42923. ][0];
  42924. [$self._lf()
  42925. ,$ctx1.sendIdx["lf"]=2
  42926. ][0];
  42927. $recv(suffixCollection)._do_((function(each){
  42928. return $core.withContext(function($ctx2) {
  42929. [$self._nextPutAll_(",")
  42930. ,$ctx2.sendIdx["nextPutAll:"]=3
  42931. ][0];
  42932. return [$self._nextPutAll_(each)
  42933. ,$ctx2.sendIdx["nextPutAll:"]=4
  42934. ][0];
  42935. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  42936. }));
  42937. [$self._lf()
  42938. ,$ctx1.sendIdx["lf"]=3
  42939. ][0];
  42940. [$self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);")
  42941. ,$ctx1.sendIdx["nextPutAll:"]=5
  42942. ][0];
  42943. $self._lf();
  42944. $self._nextPutAll_("][0]");
  42945. }
  42946. return self;
  42947. }, function($ctx1) {$ctx1.fill(self,"nextPutBefore:after:with:",{prefixCollection:prefixCollection,suffixCollection:suffixCollection,aBlock:aBlock})});
  42948. }; }),
  42949. $globals.JSStream);
  42950. $core.addMethod(
  42951. $core.method({
  42952. selector: "nextPutBefore:with:",
  42953. protocol: "streaming",
  42954. args: ["aCollection", "aBlock"],
  42955. source: "nextPutBefore: aCollection with: aBlock\x0a\x09aCollection isEmpty ifTrue: [ aBlock value ] ifFalse: [\x0a\x09\x09self nextPutAll: '('; lf; nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf.\x0a\x09\x09aCollection do: [ :each | self nextPutAll: each; nextPutAll: ',' ].\x0a\x09\x09self lf; nextPutAll: '//>>excludeEnd(\x22ctx\x22);'; lf.\x0a\x09\x09aBlock value.\x0a\x09\x09self nextPutAll: ')' ]",
  42956. referencedClasses: [],
  42957. pragmas: [],
  42958. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "nextPutAll:", "lf", "do:"]
  42959. }, function ($methodClass){ return function (aCollection,aBlock){
  42960. var self=this,$self=this;
  42961. return $core.withContext(function($ctx1) {
  42962. if($core.assert($recv(aCollection)._isEmpty())){
  42963. [$recv(aBlock)._value()
  42964. ,$ctx1.sendIdx["value"]=1
  42965. ][0];
  42966. } else {
  42967. [$self._nextPutAll_("(")
  42968. ,$ctx1.sendIdx["nextPutAll:"]=1
  42969. ][0];
  42970. [$self._lf()
  42971. ,$ctx1.sendIdx["lf"]=1
  42972. ][0];
  42973. [$self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);")
  42974. ,$ctx1.sendIdx["nextPutAll:"]=2
  42975. ][0];
  42976. [$self._lf()
  42977. ,$ctx1.sendIdx["lf"]=2
  42978. ][0];
  42979. $recv(aCollection)._do_((function(each){
  42980. return $core.withContext(function($ctx2) {
  42981. [$self._nextPutAll_(each)
  42982. ,$ctx2.sendIdx["nextPutAll:"]=3
  42983. ][0];
  42984. return [$self._nextPutAll_(",")
  42985. ,$ctx2.sendIdx["nextPutAll:"]=4
  42986. ][0];
  42987. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  42988. }));
  42989. [$self._lf()
  42990. ,$ctx1.sendIdx["lf"]=3
  42991. ][0];
  42992. [$self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);")
  42993. ,$ctx1.sendIdx["nextPutAll:"]=5
  42994. ][0];
  42995. $self._lf();
  42996. $recv(aBlock)._value();
  42997. $self._nextPutAll_(")");
  42998. }
  42999. return self;
  43000. }, function($ctx1) {$ctx1.fill(self,"nextPutBefore:with:",{aCollection:aCollection,aBlock:aBlock})});
  43001. }; }),
  43002. $globals.JSStream);
  43003. $core.addMethod(
  43004. $core.method({
  43005. selector: "nextPutBlockContextFor:during:",
  43006. protocol: "streaming",
  43007. args: ["anIRClosure", "aBlock"],
  43008. 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);'",
  43009. referencedClasses: [],
  43010. pragmas: [],
  43011. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  43012. }, function ($methodClass){ return function (anIRClosure,aBlock){
  43013. var self=this,$self=this;
  43014. return $core.withContext(function($ctx1) {
  43015. if(!$core.assert($recv(anIRClosure)._requiresSmalltalkContext())){
  43016. return [$recv(aBlock)._value()
  43017. ,$ctx1.sendIdx["value"]=1
  43018. ][0];
  43019. }
  43020. [$self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);")
  43021. ,$ctx1.sendIdx["nextPutAll:"]=1
  43022. ][0];
  43023. [$self._lf()
  43024. ,$ctx1.sendIdx["lf"]=1
  43025. ][0];
  43026. [$self._nextPutAll_([$recv(["return $core.withContext(function(".__comma([$recv([$recv(anIRClosure)._scope()
  43027. ,$ctx1.sendIdx["scope"]=1
  43028. ][0])._alias()
  43029. ,$ctx1.sendIdx["alias"]=1
  43030. ][0])
  43031. ,$ctx1.sendIdx[","]=2
  43032. ][0]).__comma(") {")
  43033. ,$ctx1.sendIdx[","]=1
  43034. ][0])
  43035. ,$ctx1.sendIdx["nextPutAll:"]=2
  43036. ][0];
  43037. [$self._lf()
  43038. ,$ctx1.sendIdx["lf"]=2
  43039. ][0];
  43040. [$self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);")
  43041. ,$ctx1.sendIdx["nextPutAll:"]=3
  43042. ][0];
  43043. [$self._lf()
  43044. ,$ctx1.sendIdx["lf"]=3
  43045. ][0];
  43046. $recv(aBlock)._value();
  43047. [$self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);")
  43048. ,$ctx1.sendIdx["nextPutAll:"]=4
  43049. ][0];
  43050. [$self._lf()
  43051. ,$ctx1.sendIdx["lf"]=4
  43052. ][0];
  43053. [$self._nextPutAll_([$recv(["}, function(".__comma([$recv([$recv(anIRClosure)._scope()
  43054. ,$ctx1.sendIdx["scope"]=2
  43055. ][0])._alias()
  43056. ,$ctx1.sendIdx["alias"]=2
  43057. ][0])
  43058. ,$ctx1.sendIdx[","]=4
  43059. ][0]).__comma(") {")
  43060. ,$ctx1.sendIdx[","]=3
  43061. ][0])
  43062. ,$ctx1.sendIdx["nextPutAll:"]=5
  43063. ][0];
  43064. [$self._nextPutAll_([$recv([$recv([$recv(anIRClosure)._scope()
  43065. ,$ctx1.sendIdx["scope"]=3
  43066. ][0])._alias()
  43067. ,$ctx1.sendIdx["alias"]=3
  43068. ][0]).__comma(".fillBlock({")
  43069. ,$ctx1.sendIdx[","]=5
  43070. ][0])
  43071. ,$ctx1.sendIdx["nextPutAll:"]=6
  43072. ][0];
  43073. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  43074. return $core.withContext(function($ctx2) {
  43075. [$self._nextPutAll_([$recv(each)._asVariableName()
  43076. ,$ctx2.sendIdx["asVariableName"]=1
  43077. ][0])
  43078. ,$ctx2.sendIdx["nextPutAll:"]=7
  43079. ][0];
  43080. [$self._nextPutAll_(":")
  43081. ,$ctx2.sendIdx["nextPutAll:"]=8
  43082. ][0];
  43083. return [$self._nextPutAll_($recv(each)._asVariableName())
  43084. ,$ctx2.sendIdx["nextPutAll:"]=9
  43085. ][0];
  43086. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43087. }),(function(){
  43088. return $core.withContext(function($ctx2) {
  43089. return [$self._nextPutAll_(",")
  43090. ,$ctx2.sendIdx["nextPutAll:"]=10
  43091. ][0];
  43092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43093. }));
  43094. [$self._nextPutAll_("},")
  43095. ,$ctx1.sendIdx["nextPutAll:"]=11
  43096. ][0];
  43097. [$self._nextPutAll_([$recv([$recv($recv($recv($recv([$recv(anIRClosure)._scope()
  43098. ,$ctx1.sendIdx["scope"]=4
  43099. ][0])._outerScope())._alias()).__comma(",")).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString())
  43100. ,$ctx1.sendIdx[","]=7
  43101. ][0]).__comma(")});")
  43102. ,$ctx1.sendIdx[","]=6
  43103. ][0])
  43104. ,$ctx1.sendIdx["nextPutAll:"]=12
  43105. ][0];
  43106. $self._lf();
  43107. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  43108. return self;
  43109. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock})});
  43110. }; }),
  43111. $globals.JSStream);
  43112. $core.addMethod(
  43113. $core.method({
  43114. selector: "nextPutClosureWith:arguments:",
  43115. protocol: "streaming",
  43116. args: ["aBlock", "anArray"],
  43117. 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: '})'",
  43118. referencedClasses: [],
  43119. pragmas: [],
  43120. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  43121. }, function ($methodClass){ return function (aBlock,anArray){
  43122. var self=this,$self=this;
  43123. return $core.withContext(function($ctx1) {
  43124. var $1,$2;
  43125. [$recv($self.stream)._nextPutAll_("(function(")
  43126. ,$ctx1.sendIdx["nextPutAll:"]=1
  43127. ][0];
  43128. $recv(anArray)._do_separatedBy_((function(each){
  43129. return $core.withContext(function($ctx2) {
  43130. return [$recv($self.stream)._nextPutAll_($recv(each)._asVariableName())
  43131. ,$ctx2.sendIdx["nextPutAll:"]=2
  43132. ][0];
  43133. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43134. }),(function(){
  43135. return $core.withContext(function($ctx2) {
  43136. return $recv($self.stream)._nextPut_(",");
  43137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43138. }));
  43139. $1=$self.stream;
  43140. [$recv($1)._nextPutAll_("){")
  43141. ,$ctx1.sendIdx["nextPutAll:"]=3
  43142. ][0];
  43143. [$recv($1)._lf()
  43144. ,$ctx1.sendIdx["lf"]=1
  43145. ][0];
  43146. $recv(aBlock)._value();
  43147. $2=$self.stream;
  43148. $recv($2)._lf();
  43149. $recv($2)._nextPutAll_("})");
  43150. return self;
  43151. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray})});
  43152. }; }),
  43153. $globals.JSStream);
  43154. $core.addMethod(
  43155. $core.method({
  43156. selector: "nextPutContextFor:during:",
  43157. protocol: "streaming",
  43158. args: ["aMethod", "aBlock"],
  43159. 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\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  43160. referencedClasses: [],
  43161. pragmas: [],
  43162. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavaScriptSource", "selector", "do:separatedBy:", "locals", "asVariableName"]
  43163. }, function ($methodClass){ return function (aMethod,aBlock){
  43164. var self=this,$self=this;
  43165. return $core.withContext(function($ctx1) {
  43166. if(!$core.assert($recv(aMethod)._requiresSmalltalkContext())){
  43167. return [$recv(aBlock)._value()
  43168. ,$ctx1.sendIdx["value"]=1
  43169. ][0];
  43170. }
  43171. [$self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);")
  43172. ,$ctx1.sendIdx["nextPutAll:"]=1
  43173. ][0];
  43174. [$self._lf()
  43175. ,$ctx1.sendIdx["lf"]=1
  43176. ][0];
  43177. [$self._nextPutAll_([$recv(["return $core.withContext(function(".__comma([$recv([$recv(aMethod)._scope()
  43178. ,$ctx1.sendIdx["scope"]=1
  43179. ][0])._alias()
  43180. ,$ctx1.sendIdx["alias"]=1
  43181. ][0])
  43182. ,$ctx1.sendIdx[","]=2
  43183. ][0]).__comma(") {")
  43184. ,$ctx1.sendIdx[","]=1
  43185. ][0])
  43186. ,$ctx1.sendIdx["nextPutAll:"]=2
  43187. ][0];
  43188. [$self._lf()
  43189. ,$ctx1.sendIdx["lf"]=2
  43190. ][0];
  43191. [$self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);")
  43192. ,$ctx1.sendIdx["nextPutAll:"]=3
  43193. ][0];
  43194. [$self._lf()
  43195. ,$ctx1.sendIdx["lf"]=3
  43196. ][0];
  43197. $recv(aBlock)._value();
  43198. [$self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);")
  43199. ,$ctx1.sendIdx["nextPutAll:"]=4
  43200. ][0];
  43201. [$self._lf()
  43202. ,$ctx1.sendIdx["lf"]=4
  43203. ][0];
  43204. [$self._nextPutAll_([$recv([$recv(["}, function(".__comma([$recv([$recv(aMethod)._scope()
  43205. ,$ctx1.sendIdx["scope"]=2
  43206. ][0])._alias()
  43207. ,$ctx1.sendIdx["alias"]=2
  43208. ][0])
  43209. ,$ctx1.sendIdx[","]=5
  43210. ][0]).__comma(") {")
  43211. ,$ctx1.sendIdx[","]=4
  43212. ][0]).__comma($recv($recv(aMethod)._scope())._alias())
  43213. ,$ctx1.sendIdx[","]=3
  43214. ][0])
  43215. ,$ctx1.sendIdx["nextPutAll:"]=5
  43216. ][0];
  43217. [$self._nextPutAll_([$recv(".fill(self,".__comma($recv($recv(aMethod)._selector())._asJavaScriptSource())).__comma(",{")
  43218. ,$ctx1.sendIdx[","]=6
  43219. ][0])
  43220. ,$ctx1.sendIdx["nextPutAll:"]=6
  43221. ][0];
  43222. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  43223. return $core.withContext(function($ctx2) {
  43224. [$self._nextPutAll_([$recv(each)._asVariableName()
  43225. ,$ctx2.sendIdx["asVariableName"]=1
  43226. ][0])
  43227. ,$ctx2.sendIdx["nextPutAll:"]=7
  43228. ][0];
  43229. [$self._nextPutAll_(":")
  43230. ,$ctx2.sendIdx["nextPutAll:"]=8
  43231. ][0];
  43232. return [$self._nextPutAll_($recv(each)._asVariableName())
  43233. ,$ctx2.sendIdx["nextPutAll:"]=9
  43234. ][0];
  43235. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43236. }),(function(){
  43237. return $core.withContext(function($ctx2) {
  43238. return [$self._nextPutAll_(",")
  43239. ,$ctx2.sendIdx["nextPutAll:"]=10
  43240. ][0];
  43241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43242. }));
  43243. [$self._nextPutAll_("})});")
  43244. ,$ctx1.sendIdx["nextPutAll:"]=11
  43245. ][0];
  43246. $self._lf();
  43247. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  43248. return self;
  43249. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock})});
  43250. }; }),
  43251. $globals.JSStream);
  43252. $core.addMethod(
  43253. $core.method({
  43254. selector: "nextPutFunctionWith:arguments:",
  43255. protocol: "streaming",
  43256. args: ["aBlock", "anArray"],
  43257. source: "nextPutFunctionWith: 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\x09stream nextPutAll: 'var self=this,$self=this;'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '}'",
  43258. referencedClasses: [],
  43259. pragmas: [],
  43260. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  43261. }, function ($methodClass){ return function (aBlock,anArray){
  43262. var self=this,$self=this;
  43263. return $core.withContext(function($ctx1) {
  43264. var $1,$2,$3;
  43265. [$recv($self.stream)._nextPutAll_("function (")
  43266. ,$ctx1.sendIdx["nextPutAll:"]=1
  43267. ][0];
  43268. $recv(anArray)._do_separatedBy_((function(each){
  43269. return $core.withContext(function($ctx2) {
  43270. return [$recv($self.stream)._nextPutAll_($recv(each)._asVariableName())
  43271. ,$ctx2.sendIdx["nextPutAll:"]=2
  43272. ][0];
  43273. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43274. }),(function(){
  43275. return $core.withContext(function($ctx2) {
  43276. return $recv($self.stream)._nextPut_(",");
  43277. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43278. }));
  43279. $1=$self.stream;
  43280. [$recv($1)._nextPutAll_("){")
  43281. ,$ctx1.sendIdx["nextPutAll:"]=3
  43282. ][0];
  43283. [$recv($1)._lf()
  43284. ,$ctx1.sendIdx["lf"]=1
  43285. ][0];
  43286. $2=$self.stream;
  43287. [$recv($2)._nextPutAll_("var self=this,$self=this;")
  43288. ,$ctx1.sendIdx["nextPutAll:"]=4
  43289. ][0];
  43290. [$recv($2)._lf()
  43291. ,$ctx1.sendIdx["lf"]=2
  43292. ][0];
  43293. $recv(aBlock)._value();
  43294. $3=$self.stream;
  43295. $recv($3)._lf();
  43296. $recv($3)._nextPutAll_("}");
  43297. return self;
  43298. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray})});
  43299. }; }),
  43300. $globals.JSStream);
  43301. $core.addMethod(
  43302. $core.method({
  43303. selector: "nextPutIf:then:",
  43304. protocol: "streaming",
  43305. args: ["aBlock", "anotherBlock"],
  43306. 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",
  43307. referencedClasses: [],
  43308. pragmas: [],
  43309. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  43310. }, function ($methodClass){ return function (aBlock,anotherBlock){
  43311. var self=this,$self=this;
  43312. return $core.withContext(function($ctx1) {
  43313. var $1;
  43314. [$recv($self.stream)._nextPutAll_("if(")
  43315. ,$ctx1.sendIdx["nextPutAll:"]=1
  43316. ][0];
  43317. [$recv(aBlock)._value()
  43318. ,$ctx1.sendIdx["value"]=1
  43319. ][0];
  43320. $1=$self.stream;
  43321. [$recv($1)._nextPutAll_("){")
  43322. ,$ctx1.sendIdx["nextPutAll:"]=2
  43323. ][0];
  43324. $recv($1)._lf();
  43325. $recv(anotherBlock)._value();
  43326. $recv($self.stream)._nextPutAll_("}");
  43327. $self._omitSemicolon_(true);
  43328. return self;
  43329. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  43330. }; }),
  43331. $globals.JSStream);
  43332. $core.addMethod(
  43333. $core.method({
  43334. selector: "nextPutIf:then:else:",
  43335. protocol: "streaming",
  43336. args: ["aBlock", "ifBlock", "elseBlock"],
  43337. 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",
  43338. referencedClasses: [],
  43339. pragmas: [],
  43340. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  43341. }, function ($methodClass){ return function (aBlock,ifBlock,elseBlock){
  43342. var self=this,$self=this;
  43343. return $core.withContext(function($ctx1) {
  43344. var $1,$2;
  43345. [$recv($self.stream)._nextPutAll_("if(")
  43346. ,$ctx1.sendIdx["nextPutAll:"]=1
  43347. ][0];
  43348. [$recv(aBlock)._value()
  43349. ,$ctx1.sendIdx["value"]=1
  43350. ][0];
  43351. $1=$self.stream;
  43352. [$recv($1)._nextPutAll_("){")
  43353. ,$ctx1.sendIdx["nextPutAll:"]=2
  43354. ][0];
  43355. [$recv($1)._lf()
  43356. ,$ctx1.sendIdx["lf"]=1
  43357. ][0];
  43358. [$recv(ifBlock)._value()
  43359. ,$ctx1.sendIdx["value"]=2
  43360. ][0];
  43361. $2=$self.stream;
  43362. [$recv($2)._nextPutAll_("} else {")
  43363. ,$ctx1.sendIdx["nextPutAll:"]=3
  43364. ][0];
  43365. $recv($2)._lf();
  43366. $recv(elseBlock)._value();
  43367. $recv($self.stream)._nextPutAll_("}");
  43368. $self._omitSemicolon_(true);
  43369. return self;
  43370. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock})});
  43371. }; }),
  43372. $globals.JSStream);
  43373. $core.addMethod(
  43374. $core.method({
  43375. selector: "nextPutNonLocalReturnHandlingWith:",
  43376. protocol: "streaming",
  43377. args: ["aBlock"],
  43378. 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",
  43379. referencedClasses: [],
  43380. pragmas: [],
  43381. messageSends: ["nextPutAll:", "lf", "value"]
  43382. }, function ($methodClass){ return function (aBlock){
  43383. var self=this,$self=this;
  43384. return $core.withContext(function($ctx1) {
  43385. var $1,$2;
  43386. $1=$self.stream;
  43387. [$recv($1)._nextPutAll_("var $early={};")
  43388. ,$ctx1.sendIdx["nextPutAll:"]=1
  43389. ][0];
  43390. [$recv($1)._lf()
  43391. ,$ctx1.sendIdx["lf"]=1
  43392. ][0];
  43393. [$recv($1)._nextPutAll_("try {")
  43394. ,$ctx1.sendIdx["nextPutAll:"]=2
  43395. ][0];
  43396. [$recv($1)._lf()
  43397. ,$ctx1.sendIdx["lf"]=2
  43398. ][0];
  43399. $recv(aBlock)._value();
  43400. $2=$self.stream;
  43401. [$recv($2)._nextPutAll_("}")
  43402. ,$ctx1.sendIdx["nextPutAll:"]=3
  43403. ][0];
  43404. [$recv($2)._lf()
  43405. ,$ctx1.sendIdx["lf"]=3
  43406. ][0];
  43407. $recv($2)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  43408. $recv($2)._lf();
  43409. return self;
  43410. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock})});
  43411. }; }),
  43412. $globals.JSStream);
  43413. $core.addMethod(
  43414. $core.method({
  43415. selector: "nextPutNonLocalReturnWith:",
  43416. protocol: "streaming",
  43417. args: ["aBlock"],
  43418. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  43419. referencedClasses: [],
  43420. pragmas: [],
  43421. messageSends: ["nextPutAll:", "value"]
  43422. }, function ($methodClass){ return function (aBlock){
  43423. var self=this,$self=this;
  43424. return $core.withContext(function($ctx1) {
  43425. [$recv($self.stream)._nextPutAll_("throw $early=[")
  43426. ,$ctx1.sendIdx["nextPutAll:"]=1
  43427. ][0];
  43428. $recv(aBlock)._value();
  43429. $recv($self.stream)._nextPutAll_("]");
  43430. return self;
  43431. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock})});
  43432. }; }),
  43433. $globals.JSStream);
  43434. $core.addMethod(
  43435. $core.method({
  43436. selector: "nextPutReturnWith:",
  43437. protocol: "streaming",
  43438. args: ["aBlock"],
  43439. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  43440. referencedClasses: [],
  43441. pragmas: [],
  43442. messageSends: ["nextPutAll:", "value"]
  43443. }, function ($methodClass){ return function (aBlock){
  43444. var self=this,$self=this;
  43445. return $core.withContext(function($ctx1) {
  43446. $recv($self.stream)._nextPutAll_("return ");
  43447. $recv(aBlock)._value();
  43448. return self;
  43449. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock})});
  43450. }; }),
  43451. $globals.JSStream);
  43452. $core.addMethod(
  43453. $core.method({
  43454. selector: "nextPutStatementWith:",
  43455. protocol: "streaming",
  43456. args: ["aBlock"],
  43457. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  43458. referencedClasses: [],
  43459. pragmas: [],
  43460. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  43461. }, function ($methodClass){ return function (aBlock){
  43462. var self=this,$self=this;
  43463. return $core.withContext(function($ctx1) {
  43464. [$self._omitSemicolon_(false)
  43465. ,$ctx1.sendIdx["omitSemicolon:"]=1
  43466. ][0];
  43467. $recv(aBlock)._value();
  43468. if(!$core.assert($self._omitSemicolon())){
  43469. $recv($self.stream)._nextPutAll_(";");
  43470. }
  43471. $self._omitSemicolon_(false);
  43472. $recv($self.stream)._lf();
  43473. return self;
  43474. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock})});
  43475. }; }),
  43476. $globals.JSStream);
  43477. $core.addMethod(
  43478. $core.method({
  43479. selector: "nextPutVars:",
  43480. protocol: "streaming",
  43481. args: ["aCollection"],
  43482. 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 ]",
  43483. referencedClasses: [],
  43484. pragmas: [],
  43485. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  43486. }, function ($methodClass){ return function (aCollection){
  43487. var self=this,$self=this;
  43488. return $core.withContext(function($ctx1) {
  43489. var $1;
  43490. $recv(aCollection)._ifNotEmpty_((function(){
  43491. return $core.withContext(function($ctx2) {
  43492. [$recv($self.stream)._nextPutAll_("var ")
  43493. ,$ctx2.sendIdx["nextPutAll:"]=1
  43494. ][0];
  43495. $recv(aCollection)._do_separatedBy_((function(each){
  43496. return $core.withContext(function($ctx3) {
  43497. return [$recv($self.stream)._nextPutAll_(each)
  43498. ,$ctx3.sendIdx["nextPutAll:"]=2
  43499. ][0];
  43500. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  43501. }),(function(){
  43502. return $core.withContext(function($ctx3) {
  43503. return [$recv($self.stream)._nextPutAll_(",")
  43504. ,$ctx3.sendIdx["nextPutAll:"]=3
  43505. ][0];
  43506. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  43507. }));
  43508. $1=$self.stream;
  43509. $recv($1)._nextPutAll_(";");
  43510. return $recv($1)._lf();
  43511. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43512. }));
  43513. return self;
  43514. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection})});
  43515. }; }),
  43516. $globals.JSStream);
  43517. $core.addMethod(
  43518. $core.method({
  43519. selector: "omitSemicolon",
  43520. protocol: "accessing",
  43521. args: [],
  43522. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  43523. referencedClasses: [],
  43524. pragmas: [],
  43525. messageSends: []
  43526. }, function ($methodClass){ return function (){
  43527. var self=this,$self=this;
  43528. return $self.omitSemicolon;
  43529. }; }),
  43530. $globals.JSStream);
  43531. $core.addMethod(
  43532. $core.method({
  43533. selector: "omitSemicolon:",
  43534. protocol: "accessing",
  43535. args: ["aBoolean"],
  43536. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  43537. referencedClasses: [],
  43538. pragmas: [],
  43539. messageSends: []
  43540. }, function ($methodClass){ return function (aBoolean){
  43541. var self=this,$self=this;
  43542. $self.omitSemicolon=aBoolean;
  43543. return self;
  43544. }; }),
  43545. $globals.JSStream);
  43546. $core.setTraitComposition([{trait: $globals.TPragmator}], $globals.IRPragmator);
  43547. $core.addMethod(
  43548. $core.method({
  43549. selector: "requiresSmalltalkContext",
  43550. protocol: "*Compiler-IR",
  43551. args: [],
  43552. 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 anySatisfy: [ :each | each requiresSmalltalkContext ]",
  43553. referencedClasses: [],
  43554. pragmas: [],
  43555. messageSends: ["anySatisfy:", "dagChildren", "requiresSmalltalkContext"]
  43556. }, function ($methodClass){ return function (){
  43557. var self=this,$self=this;
  43558. return $core.withContext(function($ctx1) {
  43559. return $recv($self._dagChildren())._anySatisfy_((function(each){
  43560. return $core.withContext(function($ctx2) {
  43561. return $recv(each)._requiresSmalltalkContext();
  43562. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43563. }));
  43564. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{})});
  43565. }; }),
  43566. $globals.ASTNode);
  43567. $core.addMethod(
  43568. $core.method({
  43569. selector: "hasOpeningStatements",
  43570. protocol: "*Compiler-IR",
  43571. args: [],
  43572. source: "hasOpeningStatements\x0a\x09^ true",
  43573. referencedClasses: [],
  43574. pragmas: [],
  43575. messageSends: []
  43576. }, function ($methodClass){ return function (){
  43577. var self=this,$self=this;
  43578. return true;
  43579. }; }),
  43580. $globals.AssignmentNode);
  43581. $core.addMethod(
  43582. $core.method({
  43583. selector: "subtreeNeedsAliasing",
  43584. protocol: "*Compiler-IR",
  43585. args: [],
  43586. source: "subtreeNeedsAliasing\x0a\x09^ false",
  43587. referencedClasses: [],
  43588. pragmas: [],
  43589. messageSends: []
  43590. }, function ($methodClass){ return function (){
  43591. var self=this,$self=this;
  43592. return false;
  43593. }; }),
  43594. $globals.BlockNode);
  43595. $core.addMethod(
  43596. $core.method({
  43597. selector: "hasOpeningStatements",
  43598. protocol: "*Compiler-IR",
  43599. args: [],
  43600. source: "hasOpeningStatements\x0a\x09^ true",
  43601. referencedClasses: [],
  43602. pragmas: [],
  43603. messageSends: []
  43604. }, function ($methodClass){ return function (){
  43605. var self=this,$self=this;
  43606. return true;
  43607. }; }),
  43608. $globals.CascadeNode);
  43609. $core.addMethod(
  43610. $core.method({
  43611. selector: "hasOpeningStatements",
  43612. protocol: "*Compiler-IR",
  43613. args: [],
  43614. source: "hasOpeningStatements\x0a\x09^ false",
  43615. referencedClasses: [],
  43616. pragmas: [],
  43617. messageSends: []
  43618. }, function ($methodClass){ return function (){
  43619. var self=this,$self=this;
  43620. return false;
  43621. }; }),
  43622. $globals.ExpressionNode);
  43623. $core.addMethod(
  43624. $core.method({
  43625. selector: "subtreeNeedsAliasing",
  43626. protocol: "*Compiler-IR",
  43627. args: [],
  43628. source: "subtreeNeedsAliasing\x0a\x09^ self dagChildren anySatisfy: [ :each |\x0a\x09\x09each shouldBeAliased ifTrue: [ true ] ifFalse: [\x0a\x09\x09\x09each hasOpeningStatements ifTrue: [ true ] ifFalse: [\x0a\x09\x09\x09\x09each subtreeNeedsAliasing ] ] ]",
  43629. referencedClasses: [],
  43630. pragmas: [],
  43631. messageSends: ["anySatisfy:", "dagChildren", "ifTrue:ifFalse:", "shouldBeAliased", "hasOpeningStatements", "subtreeNeedsAliasing"]
  43632. }, function ($methodClass){ return function (){
  43633. var self=this,$self=this;
  43634. return $core.withContext(function($ctx1) {
  43635. return $recv($self._dagChildren())._anySatisfy_((function(each){
  43636. return $core.withContext(function($ctx2) {
  43637. if($core.assert($recv(each)._shouldBeAliased())){
  43638. return true;
  43639. } else {
  43640. if($core.assert($recv(each)._hasOpeningStatements())){
  43641. return true;
  43642. } else {
  43643. return $recv(each)._subtreeNeedsAliasing();
  43644. }
  43645. }
  43646. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43647. }));
  43648. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{})});
  43649. }; }),
  43650. $globals.ExpressionNode);
  43651. $core.addMethod(
  43652. $core.method({
  43653. selector: "requiresSmalltalkContext",
  43654. protocol: "*Compiler-IR",
  43655. args: [],
  43656. source: "requiresSmalltalkContext\x0a\x09^ true",
  43657. referencedClasses: [],
  43658. pragmas: [],
  43659. messageSends: []
  43660. }, function ($methodClass){ return function (){
  43661. var self=this,$self=this;
  43662. return true;
  43663. }; }),
  43664. $globals.JSStatementNode);
  43665. $core.addMethod(
  43666. $core.method({
  43667. selector: "asReceiver",
  43668. protocol: "*Compiler-IR",
  43669. args: [],
  43670. source: "asReceiver\x0a\x09^ self class receiverNames\x0a\x09\x09at: self name\x0a\x09\x09ifPresent: [ :newName | self copy name: newName; yourself ]\x0a\x09\x09ifAbsent: [ self ]",
  43671. referencedClasses: [],
  43672. pragmas: [],
  43673. messageSends: ["at:ifPresent:ifAbsent:", "receiverNames", "class", "name", "name:", "copy", "yourself"]
  43674. }, function ($methodClass){ return function (){
  43675. var self=this,$self=this;
  43676. return $core.withContext(function($ctx1) {
  43677. var $1;
  43678. return $recv($recv($self._class())._receiverNames())._at_ifPresent_ifAbsent_($self._name(),(function(newName){
  43679. return $core.withContext(function($ctx2) {
  43680. $1=$self._copy();
  43681. $recv($1)._name_(newName);
  43682. return $recv($1)._yourself();
  43683. }, function($ctx2) {$ctx2.fillBlock({newName:newName},$ctx1,1)});
  43684. }),(function(){
  43685. return self;
  43686. }));
  43687. }, function($ctx1) {$ctx1.fill(self,"asReceiver",{})});
  43688. }; }),
  43689. $globals.PseudoVar);
  43690. $core.addMethod(
  43691. $core.method({
  43692. selector: "asReceiver",
  43693. protocol: "*Compiler-IR",
  43694. args: [],
  43695. source: "asReceiver\x0a\x09\x22Return customized copy to use as receiver,\x0a\x09or self if suffices.\x22\x0a\x09^ nil",
  43696. referencedClasses: [],
  43697. pragmas: [],
  43698. messageSends: []
  43699. }, function ($methodClass){ return function (){
  43700. var self=this,$self=this;
  43701. return nil;
  43702. }; }),
  43703. $globals.ScopeVar);
  43704. $core.addMethod(
  43705. $core.method({
  43706. selector: "requiresSmalltalkContext",
  43707. protocol: "*Compiler-IR",
  43708. args: [],
  43709. source: "requiresSmalltalkContext\x0a\x09^ true",
  43710. referencedClasses: [],
  43711. pragmas: [],
  43712. messageSends: []
  43713. }, function ($methodClass){ return function (){
  43714. var self=this,$self=this;
  43715. return true;
  43716. }; }),
  43717. $globals.SendNode);
  43718. });
  43719. define('amber/core/Compiler-Inlining',["amber/boot", "require", "amber/core/Compiler-AST", "amber/core/Compiler-Core", "amber/core/Compiler-IR", "amber/core/Compiler-Semantic", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  43720. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  43721. var $pkg = $core.addPackage("Compiler-Inlining");
  43722. $pkg.innerEval = function (expr) { return eval(expr); };
  43723. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  43724. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  43725. $core.addMethod(
  43726. $core.method({
  43727. selector: "visitSendNode:",
  43728. protocol: "visiting",
  43729. args: ["aNode"],
  43730. source: "visitSendNode: aNode\x0a\x0a\x09aNode superSend ifFalse: [ \x0a\x09\x09(IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeAliased: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09(IRSendInliner inlinedSelectorsNeedingIdempotentReceiver includes: aNode selector) ifTrue: [\x0a\x09\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ] ].\x0a\x0a\x09^ super visitSendNode: aNode",
  43731. referencedClasses: ["IRSendInliner"],
  43732. pragmas: [],
  43733. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeAliased:", "ifNotNil:", "receiver", "inlinedSelectorsNeedingIdempotentReceiver", "visitSendNode:"]
  43734. }, function ($methodClass){ return function (aNode){
  43735. var self=this,$self=this;
  43736. return $core.withContext(function($ctx1) {
  43737. var $1;
  43738. if(!$core.assert($recv(aNode)._superSend())){
  43739. if($core.assert([$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_([$recv(aNode)._selector()
  43740. ,$ctx1.sendIdx["selector"]=1
  43741. ][0])
  43742. ,$ctx1.sendIdx["includes:"]=1
  43743. ][0])){
  43744. [$recv(aNode)._shouldBeAliased_(true)
  43745. ,$ctx1.sendIdx["shouldBeAliased:"]=1
  43746. ][0];
  43747. $1=$recv(aNode)._receiver();
  43748. if($1 == null || $1.a$nil){
  43749. $1;
  43750. } else {
  43751. var receiver;
  43752. receiver=$1;
  43753. if($core.assert($recv($recv($globals.IRSendInliner)._inlinedSelectorsNeedingIdempotentReceiver())._includes_($recv(aNode)._selector()))){
  43754. $recv(receiver)._shouldBeAliased_(true);
  43755. }
  43756. }
  43757. }
  43758. }
  43759. return [(
  43760. $ctx1.supercall = true,
  43761. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.call($self,aNode))
  43762. ,$ctx1.supercall = false
  43763. ][0];
  43764. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode})});
  43765. }; }),
  43766. $globals.ASTPreInliner);
  43767. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  43768. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  43769. $core.addMethod(
  43770. $core.method({
  43771. selector: "acceptDagVisitor:",
  43772. protocol: "visiting",
  43773. args: ["aVisitor"],
  43774. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  43775. referencedClasses: [],
  43776. pragmas: [],
  43777. messageSends: ["visitIRInlinedClosure:"]
  43778. }, function ($methodClass){ return function (aVisitor){
  43779. var self=this,$self=this;
  43780. return $core.withContext(function($ctx1) {
  43781. $recv(aVisitor)._visitIRInlinedClosure_(self);
  43782. return self;
  43783. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  43784. }; }),
  43785. $globals.IRInlinedClosure);
  43786. $core.addMethod(
  43787. $core.method({
  43788. selector: "isInlined",
  43789. protocol: "testing",
  43790. args: [],
  43791. source: "isInlined\x0a\x09^ true",
  43792. referencedClasses: [],
  43793. pragmas: [],
  43794. messageSends: []
  43795. }, function ($methodClass){ return function (){
  43796. var self=this,$self=this;
  43797. return true;
  43798. }; }),
  43799. $globals.IRInlinedClosure);
  43800. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  43801. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  43802. $core.addMethod(
  43803. $core.method({
  43804. selector: "acceptDagVisitor:",
  43805. protocol: "visiting",
  43806. args: ["aVisitor"],
  43807. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  43808. referencedClasses: [],
  43809. pragmas: [],
  43810. messageSends: ["visitInlinedSend:"]
  43811. }, function ($methodClass){ return function (aVisitor){
  43812. var self=this,$self=this;
  43813. return $core.withContext(function($ctx1) {
  43814. $recv(aVisitor)._visitInlinedSend_(self);
  43815. return self;
  43816. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  43817. }; }),
  43818. $globals.IRInlinedSend);
  43819. $core.addMethod(
  43820. $core.method({
  43821. selector: "internalVariables",
  43822. protocol: "accessing",
  43823. args: [],
  43824. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  43825. referencedClasses: [],
  43826. pragmas: [],
  43827. messageSends: []
  43828. }, function ($methodClass){ return function (){
  43829. var self=this,$self=this;
  43830. return [];
  43831. }; }),
  43832. $globals.IRInlinedSend);
  43833. $core.addMethod(
  43834. $core.method({
  43835. selector: "isInlined",
  43836. protocol: "testing",
  43837. args: [],
  43838. source: "isInlined\x0a\x09^ true",
  43839. referencedClasses: [],
  43840. pragmas: [],
  43841. messageSends: []
  43842. }, function ($methodClass){ return function (){
  43843. var self=this,$self=this;
  43844. return true;
  43845. }; }),
  43846. $globals.IRInlinedSend);
  43847. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  43848. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  43849. $core.addMethod(
  43850. $core.method({
  43851. selector: "acceptDagVisitor:",
  43852. protocol: "visiting",
  43853. args: ["aVisitor"],
  43854. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  43855. referencedClasses: [],
  43856. pragmas: [],
  43857. messageSends: ["visitIRInlinedIfFalse:"]
  43858. }, function ($methodClass){ return function (aVisitor){
  43859. var self=this,$self=this;
  43860. return $core.withContext(function($ctx1) {
  43861. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  43862. return self;
  43863. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  43864. }; }),
  43865. $globals.IRInlinedIfFalse);
  43866. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  43867. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  43868. $core.addMethod(
  43869. $core.method({
  43870. selector: "acceptDagVisitor:",
  43871. protocol: "visiting",
  43872. args: ["aVisitor"],
  43873. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  43874. referencedClasses: [],
  43875. pragmas: [],
  43876. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  43877. }, function ($methodClass){ return function (aVisitor){
  43878. var self=this,$self=this;
  43879. return $core.withContext(function($ctx1) {
  43880. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  43881. return self;
  43882. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  43883. }; }),
  43884. $globals.IRInlinedIfNilIfNotNil);
  43885. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  43886. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  43887. $core.addMethod(
  43888. $core.method({
  43889. selector: "acceptDagVisitor:",
  43890. protocol: "visiting",
  43891. args: ["aVisitor"],
  43892. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  43893. referencedClasses: [],
  43894. pragmas: [],
  43895. messageSends: ["visitIRInlinedIfTrue:"]
  43896. }, function ($methodClass){ return function (aVisitor){
  43897. var self=this,$self=this;
  43898. return $core.withContext(function($ctx1) {
  43899. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  43900. return self;
  43901. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  43902. }; }),
  43903. $globals.IRInlinedIfTrue);
  43904. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  43905. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  43906. $core.addMethod(
  43907. $core.method({
  43908. selector: "acceptDagVisitor:",
  43909. protocol: "visiting",
  43910. args: ["aVisitor"],
  43911. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  43912. referencedClasses: [],
  43913. pragmas: [],
  43914. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  43915. }, function ($methodClass){ return function (aVisitor){
  43916. var self=this,$self=this;
  43917. return $core.withContext(function($ctx1) {
  43918. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  43919. return self;
  43920. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  43921. }; }),
  43922. $globals.IRInlinedIfTrueIfFalse);
  43923. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  43924. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  43925. $core.addMethod(
  43926. $core.method({
  43927. selector: "acceptDagVisitor:",
  43928. protocol: "visiting",
  43929. args: ["aVisitor"],
  43930. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  43931. referencedClasses: [],
  43932. pragmas: [],
  43933. messageSends: ["visitIRInlinedSequence:"]
  43934. }, function ($methodClass){ return function (aVisitor){
  43935. var self=this,$self=this;
  43936. return $core.withContext(function($ctx1) {
  43937. $recv(aVisitor)._visitIRInlinedSequence_(self);
  43938. return self;
  43939. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  43940. }; }),
  43941. $globals.IRInlinedSequence);
  43942. $core.addMethod(
  43943. $core.method({
  43944. selector: "isInlined",
  43945. protocol: "testing",
  43946. args: [],
  43947. source: "isInlined\x0a\x09^ true",
  43948. referencedClasses: [],
  43949. pragmas: [],
  43950. messageSends: []
  43951. }, function ($methodClass){ return function (){
  43952. var self=this,$self=this;
  43953. return true;
  43954. }; }),
  43955. $globals.IRInlinedSequence);
  43956. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  43957. $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`";
  43958. $core.addMethod(
  43959. $core.method({
  43960. selector: "assignmentInliner",
  43961. protocol: "factory",
  43962. args: [],
  43963. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43964. referencedClasses: ["IRAssignmentInliner"],
  43965. pragmas: [],
  43966. messageSends: ["translator:", "new", "yourself"]
  43967. }, function ($methodClass){ return function (){
  43968. var self=this,$self=this;
  43969. return $core.withContext(function($ctx1) {
  43970. var $1;
  43971. $1=$recv($globals.IRAssignmentInliner)._new();
  43972. $recv($1)._translator_(self);
  43973. return $recv($1)._yourself();
  43974. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{})});
  43975. }; }),
  43976. $globals.IRInliner);
  43977. $core.addMethod(
  43978. $core.method({
  43979. selector: "flattenedReturn:",
  43980. protocol: "visiting",
  43981. args: ["anIRNonLocalReturn"],
  43982. source: "flattenedReturn: anIRNonLocalReturn\x0a\x09| localReturn |\x0a\x09localReturn := IRReturn new\x0a\x09\x09scope: anIRNonLocalReturn scope;\x0a\x09\x09yourself.\x0a\x09anIRNonLocalReturn dagChildren do: [ :each | localReturn add: each ].\x0a\x09^ localReturn",
  43983. referencedClasses: ["IRReturn"],
  43984. pragmas: [],
  43985. messageSends: ["scope:", "new", "scope", "yourself", "do:", "dagChildren", "add:"]
  43986. }, function ($methodClass){ return function (anIRNonLocalReturn){
  43987. var self=this,$self=this;
  43988. var localReturn;
  43989. return $core.withContext(function($ctx1) {
  43990. var $1;
  43991. $1=$recv($globals.IRReturn)._new();
  43992. $recv($1)._scope_($recv(anIRNonLocalReturn)._scope());
  43993. localReturn=$recv($1)._yourself();
  43994. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  43995. return $core.withContext(function($ctx2) {
  43996. return $recv(localReturn)._add_(each);
  43997. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43998. }));
  43999. return localReturn;
  44000. }, function($ctx1) {$ctx1.fill(self,"flattenedReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn})});
  44001. }; }),
  44002. $globals.IRInliner);
  44003. $core.addMethod(
  44004. $core.method({
  44005. selector: "nonLocalReturnInliner",
  44006. protocol: "factory",
  44007. args: [],
  44008. source: "nonLocalReturnInliner\x0a\x09^ IRNonLocalReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  44009. referencedClasses: ["IRNonLocalReturnInliner"],
  44010. pragmas: [],
  44011. messageSends: ["translator:", "new", "yourself"]
  44012. }, function ($methodClass){ return function (){
  44013. var self=this,$self=this;
  44014. return $core.withContext(function($ctx1) {
  44015. var $1;
  44016. $1=$recv($globals.IRNonLocalReturnInliner)._new();
  44017. $recv($1)._translator_(self);
  44018. return $recv($1)._yourself();
  44019. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturnInliner",{})});
  44020. }; }),
  44021. $globals.IRInliner);
  44022. $core.addMethod(
  44023. $core.method({
  44024. selector: "returnInliner",
  44025. protocol: "factory",
  44026. args: [],
  44027. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  44028. referencedClasses: ["IRReturnInliner"],
  44029. pragmas: [],
  44030. messageSends: ["translator:", "new", "yourself"]
  44031. }, function ($methodClass){ return function (){
  44032. var self=this,$self=this;
  44033. return $core.withContext(function($ctx1) {
  44034. var $1;
  44035. $1=$recv($globals.IRReturnInliner)._new();
  44036. $recv($1)._translator_(self);
  44037. return $recv($1)._yourself();
  44038. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{})});
  44039. }; }),
  44040. $globals.IRInliner);
  44041. $core.addMethod(
  44042. $core.method({
  44043. selector: "sendInliner",
  44044. protocol: "factory",
  44045. args: [],
  44046. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  44047. referencedClasses: ["IRSendInliner"],
  44048. pragmas: [],
  44049. messageSends: ["translator:", "new", "yourself"]
  44050. }, function ($methodClass){ return function (){
  44051. var self=this,$self=this;
  44052. return $core.withContext(function($ctx1) {
  44053. var $1;
  44054. $1=$recv($globals.IRSendInliner)._new();
  44055. $recv($1)._translator_(self);
  44056. return $recv($1)._yourself();
  44057. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{})});
  44058. }; }),
  44059. $globals.IRInliner);
  44060. $core.addMethod(
  44061. $core.method({
  44062. selector: "shouldInlineAssignment:",
  44063. protocol: "testing",
  44064. args: ["anIRAssignment"],
  44065. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  44066. referencedClasses: [],
  44067. pragmas: [],
  44068. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  44069. }, function ($methodClass){ return function (anIRAssignment){
  44070. var self=this,$self=this;
  44071. return $core.withContext(function($ctx1) {
  44072. return [$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  44073. return $core.withContext(function($ctx2) {
  44074. return $recv($recv([$recv(anIRAssignment)._right()
  44075. ,$ctx2.sendIdx["right"]=1
  44076. ][0])._isSend())._and_((function(){
  44077. return $core.withContext(function($ctx3) {
  44078. return $self._shouldInlineSend_($recv(anIRAssignment)._right());
  44079. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44080. }));
  44081. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44082. }))
  44083. ,$ctx1.sendIdx["and:"]=1
  44084. ][0];
  44085. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment})});
  44086. }; }),
  44087. $globals.IRInliner);
  44088. $core.addMethod(
  44089. $core.method({
  44090. selector: "shouldInlineReturn:",
  44091. protocol: "testing",
  44092. args: ["anIRReturn"],
  44093. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  44094. referencedClasses: [],
  44095. pragmas: [],
  44096. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  44097. }, function ($methodClass){ return function (anIRReturn){
  44098. var self=this,$self=this;
  44099. return $core.withContext(function($ctx1) {
  44100. return [$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  44101. return $core.withContext(function($ctx2) {
  44102. return $recv($recv([$recv(anIRReturn)._expression()
  44103. ,$ctx2.sendIdx["expression"]=1
  44104. ][0])._isSend())._and_((function(){
  44105. return $core.withContext(function($ctx3) {
  44106. return $self._shouldInlineSend_($recv(anIRReturn)._expression());
  44107. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44108. }));
  44109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44110. }))
  44111. ,$ctx1.sendIdx["and:"]=1
  44112. ][0];
  44113. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn})});
  44114. }; }),
  44115. $globals.IRInliner);
  44116. $core.addMethod(
  44117. $core.method({
  44118. selector: "shouldInlineSend:",
  44119. protocol: "testing",
  44120. args: ["anIRSend"],
  44121. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  44122. referencedClasses: ["IRSendInliner"],
  44123. pragmas: [],
  44124. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  44125. }, function ($methodClass){ return function (anIRSend){
  44126. var self=this,$self=this;
  44127. return $core.withContext(function($ctx1) {
  44128. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  44129. return $core.withContext(function($ctx2) {
  44130. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  44131. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44132. }));
  44133. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend})});
  44134. }; }),
  44135. $globals.IRInliner);
  44136. $core.addMethod(
  44137. $core.method({
  44138. selector: "visitIRAssignment:",
  44139. protocol: "visiting",
  44140. args: ["anIRAssignment"],
  44141. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  44142. referencedClasses: [],
  44143. pragmas: [],
  44144. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  44145. }, function ($methodClass){ return function (anIRAssignment){
  44146. var self=this,$self=this;
  44147. return $core.withContext(function($ctx1) {
  44148. if($core.assert($self._shouldInlineAssignment_(anIRAssignment))){
  44149. return $recv($self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  44150. } else {
  44151. return [(
  44152. $ctx1.supercall = true,
  44153. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.call($self,anIRAssignment))
  44154. ,$ctx1.supercall = false
  44155. ][0];
  44156. }
  44157. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment})});
  44158. }; }),
  44159. $globals.IRInliner);
  44160. $core.addMethod(
  44161. $core.method({
  44162. selector: "visitIRNonLocalReturn:",
  44163. protocol: "visiting",
  44164. args: ["anIRNonLocalReturn"],
  44165. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09anIRNonLocalReturn scope canFlattenNonLocalReturns ifTrue: [\x0a\x09\x09| localReturn |\x0a\x09\x09anIRNonLocalReturn scope methodScope removeNonLocalReturn: anIRNonLocalReturn scope.\x0a\x09\x09localReturn := self flattenedReturn: anIRNonLocalReturn.\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ self visitIRReturn: localReturn ].\x0a\x09^ (self shouldInlineReturn: anIRNonLocalReturn)\x0a\x09\x09ifTrue: [ self nonLocalReturnInliner inlineReturn: anIRNonLocalReturn ]\x0a\x09\x09ifFalse: [ super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  44166. referencedClasses: [],
  44167. pragmas: [],
  44168. messageSends: ["ifTrue:", "canFlattenNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "flattenedReturn:", "replaceWith:", "visitIRReturn:", "ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "nonLocalReturnInliner", "visitIRNonLocalReturn:"]
  44169. }, function ($methodClass){ return function (anIRNonLocalReturn){
  44170. var self=this,$self=this;
  44171. return $core.withContext(function($ctx1) {
  44172. if($core.assert($recv([$recv(anIRNonLocalReturn)._scope()
  44173. ,$ctx1.sendIdx["scope"]=1
  44174. ][0])._canFlattenNonLocalReturns())){
  44175. var localReturn;
  44176. $recv($recv([$recv(anIRNonLocalReturn)._scope()
  44177. ,$ctx1.sendIdx["scope"]=2
  44178. ][0])._methodScope())._removeNonLocalReturn_($recv(anIRNonLocalReturn)._scope());
  44179. localReturn=$self._flattenedReturn_(anIRNonLocalReturn);
  44180. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  44181. return $self._visitIRReturn_(localReturn);
  44182. }
  44183. if($core.assert($self._shouldInlineReturn_(anIRNonLocalReturn))){
  44184. return $recv($self._nonLocalReturnInliner())._inlineReturn_(anIRNonLocalReturn);
  44185. } else {
  44186. return [(
  44187. $ctx1.supercall = true,
  44188. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.call($self,anIRNonLocalReturn))
  44189. ,$ctx1.supercall = false
  44190. ][0];
  44191. }
  44192. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn})});
  44193. }; }),
  44194. $globals.IRInliner);
  44195. $core.addMethod(
  44196. $core.method({
  44197. selector: "visitIRReturn:",
  44198. protocol: "visiting",
  44199. args: ["anIRReturn"],
  44200. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  44201. referencedClasses: [],
  44202. pragmas: [],
  44203. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  44204. }, function ($methodClass){ return function (anIRReturn){
  44205. var self=this,$self=this;
  44206. return $core.withContext(function($ctx1) {
  44207. if($core.assert($self._shouldInlineReturn_(anIRReturn))){
  44208. return $recv($self._returnInliner())._inlineReturn_(anIRReturn);
  44209. } else {
  44210. return [(
  44211. $ctx1.supercall = true,
  44212. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.call($self,anIRReturn))
  44213. ,$ctx1.supercall = false
  44214. ][0];
  44215. }
  44216. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn})});
  44217. }; }),
  44218. $globals.IRInliner);
  44219. $core.addMethod(
  44220. $core.method({
  44221. selector: "visitIRSend:",
  44222. protocol: "visiting",
  44223. args: ["anIRSend"],
  44224. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  44225. referencedClasses: [],
  44226. pragmas: [],
  44227. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  44228. }, function ($methodClass){ return function (anIRSend){
  44229. var self=this,$self=this;
  44230. return $core.withContext(function($ctx1) {
  44231. if($core.assert($self._shouldInlineSend_(anIRSend))){
  44232. return $recv($self._sendInliner())._inlineSend_(anIRSend);
  44233. } else {
  44234. return [(
  44235. $ctx1.supercall = true,
  44236. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.call($self,anIRSend))
  44237. ,$ctx1.supercall = false
  44238. ][0];
  44239. }
  44240. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend})});
  44241. }; }),
  44242. $globals.IRInliner);
  44243. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  44244. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  44245. $core.addMethod(
  44246. $core.method({
  44247. selector: "visitIRInlinedClosure:",
  44248. protocol: "visiting",
  44249. args: ["anIRInlinedClosure"],
  44250. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAllChildren: anIRInlinedClosure",
  44251. referencedClasses: [],
  44252. pragmas: [],
  44253. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAllChildren:"]
  44254. }, function ($methodClass){ return function (anIRInlinedClosure){
  44255. var self=this,$self=this;
  44256. return $core.withContext(function($ctx1) {
  44257. $recv($self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  44258. return $core.withContext(function($ctx2) {
  44259. return $recv($recv(each)._name())._asVariableName();
  44260. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44261. })));
  44262. $self._visitAllChildren_(anIRInlinedClosure);
  44263. return self;
  44264. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure})});
  44265. }; }),
  44266. $globals.IRInliningJSTranslator);
  44267. $core.addMethod(
  44268. $core.method({
  44269. selector: "visitIRInlinedIfFalse:",
  44270. protocol: "visiting",
  44271. args: ["anIRInlinedIfFalse"],
  44272. 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 ]",
  44273. referencedClasses: [],
  44274. pragmas: [],
  44275. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  44276. }, function ($methodClass){ return function (anIRInlinedIfFalse){
  44277. var self=this,$self=this;
  44278. return $core.withContext(function($ctx1) {
  44279. $recv([$self._stream()
  44280. ,$ctx1.sendIdx["stream"]=1
  44281. ][0])._nextPutIf_then_((function(){
  44282. return $core.withContext(function($ctx2) {
  44283. [$recv([$self._stream()
  44284. ,$ctx2.sendIdx["stream"]=2
  44285. ][0])._nextPutAll_("!$core.assert(")
  44286. ,$ctx2.sendIdx["nextPutAll:"]=1
  44287. ][0];
  44288. [$self._visit_($recv([$recv(anIRInlinedIfFalse)._dagChildren()
  44289. ,$ctx2.sendIdx["dagChildren"]=1
  44290. ][0])._first())
  44291. ,$ctx2.sendIdx["visit:"]=1
  44292. ][0];
  44293. return $recv($self._stream())._nextPutAll_(")");
  44294. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44295. }),(function(){
  44296. return $core.withContext(function($ctx2) {
  44297. return $self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  44298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44299. }));
  44300. return self;
  44301. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse})});
  44302. }; }),
  44303. $globals.IRInliningJSTranslator);
  44304. $core.addMethod(
  44305. $core.method({
  44306. selector: "visitIRInlinedIfNilIfNotNil:",
  44307. protocol: "visiting",
  44308. args: ["anIRInlinedIfNilIfNotNil"],
  44309. source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: ' == null || '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: '.a$nil' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfNilIfNotNil dagChildren second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfNilIfNotNil dagChildren third ]",
  44310. referencedClasses: [],
  44311. pragmas: [],
  44312. messageSends: ["nextPutIf:then:else:", "stream", "visit:", "first", "dagChildren", "nextPutAll:", "second", "third"]
  44313. }, function ($methodClass){ return function (anIRInlinedIfNilIfNotNil){
  44314. var self=this,$self=this;
  44315. return $core.withContext(function($ctx1) {
  44316. $recv([$self._stream()
  44317. ,$ctx1.sendIdx["stream"]=1
  44318. ][0])._nextPutIf_then_else_((function(){
  44319. return $core.withContext(function($ctx2) {
  44320. [$self._visit_([$recv([$recv(anIRInlinedIfNilIfNotNil)._dagChildren()
  44321. ,$ctx2.sendIdx["dagChildren"]=1
  44322. ][0])._first()
  44323. ,$ctx2.sendIdx["first"]=1
  44324. ][0])
  44325. ,$ctx2.sendIdx["visit:"]=1
  44326. ][0];
  44327. [$recv([$self._stream()
  44328. ,$ctx2.sendIdx["stream"]=2
  44329. ][0])._nextPutAll_(" == null || ")
  44330. ,$ctx2.sendIdx["nextPutAll:"]=1
  44331. ][0];
  44332. [$self._visit_($recv([$recv(anIRInlinedIfNilIfNotNil)._dagChildren()
  44333. ,$ctx2.sendIdx["dagChildren"]=2
  44334. ][0])._first())
  44335. ,$ctx2.sendIdx["visit:"]=2
  44336. ][0];
  44337. return $recv($self._stream())._nextPutAll_(".a$nil");
  44338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44339. }),(function(){
  44340. return $core.withContext(function($ctx2) {
  44341. return [$self._visit_($recv([$recv(anIRInlinedIfNilIfNotNil)._dagChildren()
  44342. ,$ctx2.sendIdx["dagChildren"]=3
  44343. ][0])._second())
  44344. ,$ctx2.sendIdx["visit:"]=3
  44345. ][0];
  44346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44347. }),(function(){
  44348. return $core.withContext(function($ctx2) {
  44349. return $self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  44350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44351. }));
  44352. return self;
  44353. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil})});
  44354. }; }),
  44355. $globals.IRInliningJSTranslator);
  44356. $core.addMethod(
  44357. $core.method({
  44358. selector: "visitIRInlinedIfTrue:",
  44359. protocol: "visiting",
  44360. args: ["anIRInlinedIfTrue"],
  44361. 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 ]",
  44362. referencedClasses: [],
  44363. pragmas: [],
  44364. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  44365. }, function ($methodClass){ return function (anIRInlinedIfTrue){
  44366. var self=this,$self=this;
  44367. return $core.withContext(function($ctx1) {
  44368. $recv([$self._stream()
  44369. ,$ctx1.sendIdx["stream"]=1
  44370. ][0])._nextPutIf_then_((function(){
  44371. return $core.withContext(function($ctx2) {
  44372. [$recv([$self._stream()
  44373. ,$ctx2.sendIdx["stream"]=2
  44374. ][0])._nextPutAll_("$core.assert(")
  44375. ,$ctx2.sendIdx["nextPutAll:"]=1
  44376. ][0];
  44377. [$self._visit_($recv([$recv(anIRInlinedIfTrue)._dagChildren()
  44378. ,$ctx2.sendIdx["dagChildren"]=1
  44379. ][0])._first())
  44380. ,$ctx2.sendIdx["visit:"]=1
  44381. ][0];
  44382. return $recv($self._stream())._nextPutAll_(")");
  44383. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44384. }),(function(){
  44385. return $core.withContext(function($ctx2) {
  44386. return $self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  44387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44388. }));
  44389. return self;
  44390. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue})});
  44391. }; }),
  44392. $globals.IRInliningJSTranslator);
  44393. $core.addMethod(
  44394. $core.method({
  44395. selector: "visitIRInlinedIfTrueIfFalse:",
  44396. protocol: "visiting",
  44397. args: ["anIRInlinedIfTrueIfFalse"],
  44398. 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 ]",
  44399. referencedClasses: [],
  44400. pragmas: [],
  44401. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  44402. }, function ($methodClass){ return function (anIRInlinedIfTrueIfFalse){
  44403. var self=this,$self=this;
  44404. return $core.withContext(function($ctx1) {
  44405. $recv([$self._stream()
  44406. ,$ctx1.sendIdx["stream"]=1
  44407. ][0])._nextPutIf_then_else_((function(){
  44408. return $core.withContext(function($ctx2) {
  44409. [$recv([$self._stream()
  44410. ,$ctx2.sendIdx["stream"]=2
  44411. ][0])._nextPutAll_("$core.assert(")
  44412. ,$ctx2.sendIdx["nextPutAll:"]=1
  44413. ][0];
  44414. [$self._visit_($recv([$recv(anIRInlinedIfTrueIfFalse)._dagChildren()
  44415. ,$ctx2.sendIdx["dagChildren"]=1
  44416. ][0])._first())
  44417. ,$ctx2.sendIdx["visit:"]=1
  44418. ][0];
  44419. return $recv($self._stream())._nextPutAll_(")");
  44420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44421. }),(function(){
  44422. return $core.withContext(function($ctx2) {
  44423. return [$self._visit_($recv([$recv(anIRInlinedIfTrueIfFalse)._dagChildren()
  44424. ,$ctx2.sendIdx["dagChildren"]=2
  44425. ][0])._second())
  44426. ,$ctx2.sendIdx["visit:"]=2
  44427. ][0];
  44428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44429. }),(function(){
  44430. return $core.withContext(function($ctx2) {
  44431. return $self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  44432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44433. }));
  44434. return self;
  44435. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse})});
  44436. }; }),
  44437. $globals.IRInliningJSTranslator);
  44438. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  44439. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  44440. $core.addMethod(
  44441. $core.method({
  44442. selector: "ifFalse:",
  44443. protocol: "inlining",
  44444. args: ["anIRInstruction"],
  44445. source: "ifFalse: anIRInstruction\x0a\x09self mustBeNiladicClosure: anIRInstruction.\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  44446. referencedClasses: ["IRInlinedIfFalse"],
  44447. pragmas: [],
  44448. messageSends: ["mustBeNiladicClosure:", "inlinedSend:withBlock:", "new"]
  44449. }, function ($methodClass){ return function (anIRInstruction){
  44450. var self=this,$self=this;
  44451. return $core.withContext(function($ctx1) {
  44452. $self._mustBeNiladicClosure_(anIRInstruction);
  44453. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  44454. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction})});
  44455. }; }),
  44456. $globals.IRSendInliner);
  44457. $core.addMethod(
  44458. $core.method({
  44459. selector: "ifFalse:ifTrue:",
  44460. protocol: "inlining",
  44461. args: ["anIRInstruction", "anotherIRInstruction"],
  44462. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09self mustBeNiladicClosure: anIRInstruction.\x0a\x09self mustBeNiladicClosure: anotherIRInstruction.\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  44463. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  44464. pragmas: [],
  44465. messageSends: ["mustBeNiladicClosure:", "inlinedSend:withBlock:withBlock:", "new"]
  44466. }, function ($methodClass){ return function (anIRInstruction,anotherIRInstruction){
  44467. var self=this,$self=this;
  44468. return $core.withContext(function($ctx1) {
  44469. [$self._mustBeNiladicClosure_(anIRInstruction)
  44470. ,$ctx1.sendIdx["mustBeNiladicClosure:"]=1
  44471. ][0];
  44472. $self._mustBeNiladicClosure_(anotherIRInstruction);
  44473. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anotherIRInstruction,anIRInstruction);
  44474. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction})});
  44475. }; }),
  44476. $globals.IRSendInliner);
  44477. $core.addMethod(
  44478. $core.method({
  44479. selector: "ifNil:",
  44480. protocol: "inlining",
  44481. args: ["anIRInstruction"],
  44482. source: "ifNil: anIRInstruction\x0a\x09self mustBeNiladicClosure: 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)",
  44483. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  44484. pragmas: [],
  44485. messageSends: ["mustBeNiladicClosure:", "inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  44486. }, function ($methodClass){ return function (anIRInstruction){
  44487. var self=this,$self=this;
  44488. return $core.withContext(function($ctx1) {
  44489. var $1,$2,$3;
  44490. $self._mustBeNiladicClosure_(anIRInstruction);
  44491. $1=[$recv($globals.IRInlinedIfNilIfNotNil)._new()
  44492. ,$ctx1.sendIdx["new"]=1
  44493. ][0];
  44494. $2=[$recv($globals.IRClosure)._new()
  44495. ,$ctx1.sendIdx["new"]=2
  44496. ][0];
  44497. $recv($2)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  44498. $3=$recv($globals.IRBlockSequence)._new();
  44499. $recv($3)._add_($recv($self._send())._receiver());
  44500. [$recv($2)._add_([$recv($3)._yourself()
  44501. ,$ctx1.sendIdx["yourself"]=1
  44502. ][0])
  44503. ,$ctx1.sendIdx["add:"]=1
  44504. ][0];
  44505. return $self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$recv($2)._yourself());
  44506. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction})});
  44507. }; }),
  44508. $globals.IRSendInliner);
  44509. $core.addMethod(
  44510. $core.method({
  44511. selector: "ifNil:ifNotNil:",
  44512. protocol: "inlining",
  44513. args: ["anIRInstruction", "anotherIRInstruction"],
  44514. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09self mustBeNiladicClosure: anIRInstruction.\x0a\x09self mustBeNiladicOrUnaryClosure: anotherIRInstruction.\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  44515. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  44516. pragmas: [],
  44517. messageSends: ["mustBeNiladicClosure:", "mustBeNiladicOrUnaryClosure:", "inlinedSend:withBlock:withBlock:", "new"]
  44518. }, function ($methodClass){ return function (anIRInstruction,anotherIRInstruction){
  44519. var self=this,$self=this;
  44520. return $core.withContext(function($ctx1) {
  44521. $self._mustBeNiladicClosure_(anIRInstruction);
  44522. $self._mustBeNiladicOrUnaryClosure_(anotherIRInstruction);
  44523. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  44524. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction})});
  44525. }; }),
  44526. $globals.IRSendInliner);
  44527. $core.addMethod(
  44528. $core.method({
  44529. selector: "ifNotNil:",
  44530. protocol: "inlining",
  44531. args: ["anIRInstruction"],
  44532. source: "ifNotNil: anIRInstruction\x0a\x09self mustBeNiladicOrUnaryClosure: 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",
  44533. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  44534. pragmas: [],
  44535. messageSends: ["mustBeNiladicOrUnaryClosure:", "inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  44536. }, function ($methodClass){ return function (anIRInstruction){
  44537. var self=this,$self=this;
  44538. return $core.withContext(function($ctx1) {
  44539. var $1,$2,$3;
  44540. $self._mustBeNiladicOrUnaryClosure_(anIRInstruction);
  44541. $1=[$recv($globals.IRInlinedIfNilIfNotNil)._new()
  44542. ,$ctx1.sendIdx["new"]=1
  44543. ][0];
  44544. $2=[$recv($globals.IRClosure)._new()
  44545. ,$ctx1.sendIdx["new"]=2
  44546. ][0];
  44547. $recv($2)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  44548. $3=$recv($globals.IRBlockSequence)._new();
  44549. $recv($3)._add_($recv($self._send())._receiver());
  44550. [$recv($2)._add_([$recv($3)._yourself()
  44551. ,$ctx1.sendIdx["yourself"]=1
  44552. ][0])
  44553. ,$ctx1.sendIdx["add:"]=1
  44554. ][0];
  44555. return $self._inlinedSend_withBlock_withBlock_($1,$recv($2)._yourself(),anIRInstruction);
  44556. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction})});
  44557. }; }),
  44558. $globals.IRSendInliner);
  44559. $core.addMethod(
  44560. $core.method({
  44561. selector: "ifNotNil:ifNil:",
  44562. protocol: "inlining",
  44563. args: ["anIRInstruction", "anotherIRInstruction"],
  44564. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09self mustBeNiladicOrUnaryClosure: anIRInstruction.\x0a\x09self mustBeNiladicClosure: anotherIRInstruction.\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  44565. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  44566. pragmas: [],
  44567. messageSends: ["mustBeNiladicOrUnaryClosure:", "mustBeNiladicClosure:", "inlinedSend:withBlock:withBlock:", "new"]
  44568. }, function ($methodClass){ return function (anIRInstruction,anotherIRInstruction){
  44569. var self=this,$self=this;
  44570. return $core.withContext(function($ctx1) {
  44571. $self._mustBeNiladicOrUnaryClosure_(anIRInstruction);
  44572. $self._mustBeNiladicClosure_(anotherIRInstruction);
  44573. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  44574. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction})});
  44575. }; }),
  44576. $globals.IRSendInliner);
  44577. $core.addMethod(
  44578. $core.method({
  44579. selector: "ifTrue:",
  44580. protocol: "inlining",
  44581. args: ["anIRInstruction"],
  44582. source: "ifTrue: anIRInstruction\x0a\x09self mustBeNiladicClosure: anIRInstruction.\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  44583. referencedClasses: ["IRInlinedIfTrue"],
  44584. pragmas: [],
  44585. messageSends: ["mustBeNiladicClosure:", "inlinedSend:withBlock:", "new"]
  44586. }, function ($methodClass){ return function (anIRInstruction){
  44587. var self=this,$self=this;
  44588. return $core.withContext(function($ctx1) {
  44589. $self._mustBeNiladicClosure_(anIRInstruction);
  44590. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  44591. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction})});
  44592. }; }),
  44593. $globals.IRSendInliner);
  44594. $core.addMethod(
  44595. $core.method({
  44596. selector: "ifTrue:ifFalse:",
  44597. protocol: "inlining",
  44598. args: ["anIRInstruction", "anotherIRInstruction"],
  44599. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09self mustBeNiladicClosure: anIRInstruction.\x0a\x09self mustBeNiladicClosure: anotherIRInstruction.\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  44600. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  44601. pragmas: [],
  44602. messageSends: ["mustBeNiladicClosure:", "inlinedSend:withBlock:withBlock:", "new"]
  44603. }, function ($methodClass){ return function (anIRInstruction,anotherIRInstruction){
  44604. var self=this,$self=this;
  44605. return $core.withContext(function($ctx1) {
  44606. [$self._mustBeNiladicClosure_(anIRInstruction)
  44607. ,$ctx1.sendIdx["mustBeNiladicClosure:"]=1
  44608. ][0];
  44609. $self._mustBeNiladicClosure_(anotherIRInstruction);
  44610. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  44611. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction})});
  44612. }; }),
  44613. $globals.IRSendInliner);
  44614. $core.addMethod(
  44615. $core.method({
  44616. selector: "inlineClosure:",
  44617. protocol: "inlining",
  44618. args: ["anIRClosure"],
  44619. 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: (ArgVar new scope: inlinedClosure scope; name: each; yourself));\x0a\x09\x09\x09add: self send receiver;\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",
  44620. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "ArgVar"],
  44621. pragmas: [],
  44622. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "receiver", "send", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  44623. }, function ($methodClass){ return function (anIRClosure){
  44624. var self=this,$self=this;
  44625. var inlinedClosure,sequence,statements;
  44626. return $core.withContext(function($ctx1) {
  44627. var $1,$2,$3,$4,$5,$6,$7;
  44628. inlinedClosure=$self._inlinedClosure();
  44629. $1=inlinedClosure;
  44630. [$recv($1)._scope_([$recv(anIRClosure)._scope()
  44631. ,$ctx1.sendIdx["scope"]=1
  44632. ][0])
  44633. ,$ctx1.sendIdx["scope:"]=1
  44634. ][0];
  44635. $recv($1)._parent_($recv(anIRClosure)._parent());
  44636. [$recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  44637. return $core.withContext(function($ctx2) {
  44638. return [$recv(inlinedClosure)._add_(each)
  44639. ,$ctx2.sendIdx["add:"]=1
  44640. ][0];
  44641. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44642. }))
  44643. ,$ctx1.sendIdx["do:"]=1
  44644. ][0];
  44645. sequence=$self._inlinedSequence();
  44646. [$recv($recv(anIRClosure)._arguments())._do_((function(each){
  44647. return $core.withContext(function($ctx2) {
  44648. $2=inlinedClosure;
  44649. $3=[$recv($globals.IRTempDeclaration)._new()
  44650. ,$ctx2.sendIdx["new"]=1
  44651. ][0];
  44652. [$recv($3)._name_(each)
  44653. ,$ctx2.sendIdx["name:"]=1
  44654. ][0];
  44655. [$recv($2)._add_([$recv($3)._yourself()
  44656. ,$ctx2.sendIdx["yourself"]=1
  44657. ][0])
  44658. ,$ctx2.sendIdx["add:"]=2
  44659. ][0];
  44660. $4=sequence;
  44661. $5=[$recv($globals.IRAssignment)._new()
  44662. ,$ctx2.sendIdx["new"]=2
  44663. ][0];
  44664. $6=[$recv($globals.IRVariable)._new()
  44665. ,$ctx2.sendIdx["new"]=3
  44666. ][0];
  44667. $7=$recv($globals.ArgVar)._new();
  44668. $recv($7)._scope_($recv(inlinedClosure)._scope());
  44669. $recv($7)._name_(each);
  44670. [$recv($5)._add_($recv($6)._variable_([$recv($7)._yourself()
  44671. ,$ctx2.sendIdx["yourself"]=2
  44672. ][0]))
  44673. ,$ctx2.sendIdx["add:"]=4
  44674. ][0];
  44675. [$recv($5)._add_($recv($self._send())._receiver())
  44676. ,$ctx2.sendIdx["add:"]=5
  44677. ][0];
  44678. return [$recv($4)._add_($recv($5)._yourself())
  44679. ,$ctx2.sendIdx["add:"]=3
  44680. ][0];
  44681. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  44682. }))
  44683. ,$ctx1.sendIdx["do:"]=2
  44684. ][0];
  44685. [$recv(inlinedClosure)._add_(sequence)
  44686. ,$ctx1.sendIdx["add:"]=6
  44687. ][0];
  44688. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  44689. $recv(statements)._ifNotEmpty_((function(){
  44690. return $core.withContext(function($ctx2) {
  44691. $recv($recv(statements)._allButLast())._do_((function(each){
  44692. return $core.withContext(function($ctx3) {
  44693. return [$recv(sequence)._add_(each)
  44694. ,$ctx3.sendIdx["add:"]=7
  44695. ][0];
  44696. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  44697. }));
  44698. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  44699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44700. }));
  44701. return inlinedClosure;
  44702. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements})});
  44703. }; }),
  44704. $globals.IRSendInliner);
  44705. $core.addMethod(
  44706. $core.method({
  44707. selector: "inlineSend:",
  44708. protocol: "inlining",
  44709. args: ["anIRSend"],
  44710. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  44711. referencedClasses: [],
  44712. pragmas: [],
  44713. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  44714. }, function ($methodClass){ return function (anIRSend){
  44715. var self=this,$self=this;
  44716. return $core.withContext(function($ctx1) {
  44717. $self._send_(anIRSend);
  44718. return $self._perform_withArguments_($recv([$self._send()
  44719. ,$ctx1.sendIdx["send"]=1
  44720. ][0])._selector(),$recv($self._send())._arguments());
  44721. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend})});
  44722. }; }),
  44723. $globals.IRSendInliner);
  44724. $core.addMethod(
  44725. $core.method({
  44726. selector: "inlineSend:andReplace:",
  44727. protocol: "private",
  44728. args: ["anIRSend", "anIRInstruction"],
  44729. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  44730. referencedClasses: [],
  44731. pragmas: [],
  44732. messageSends: ["replaceWith:", "inlineSend:"]
  44733. }, function ($methodClass){ return function (anIRSend,anIRInstruction){
  44734. var self=this,$self=this;
  44735. return $core.withContext(function($ctx1) {
  44736. $recv(anIRInstruction)._replaceWith_(anIRSend);
  44737. return $self._inlineSend_(anIRSend);
  44738. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction})});
  44739. }; }),
  44740. $globals.IRSendInliner);
  44741. $core.addMethod(
  44742. $core.method({
  44743. selector: "inlinedClosure",
  44744. protocol: "factory",
  44745. args: [],
  44746. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  44747. referencedClasses: ["IRInlinedClosure"],
  44748. pragmas: [],
  44749. messageSends: ["new"]
  44750. }, function ($methodClass){ return function (){
  44751. var self=this,$self=this;
  44752. return $core.withContext(function($ctx1) {
  44753. return $recv($globals.IRInlinedClosure)._new();
  44754. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{})});
  44755. }; }),
  44756. $globals.IRSendInliner);
  44757. $core.addMethod(
  44758. $core.method({
  44759. selector: "inlinedClosure:wrapFinalValueIn:",
  44760. protocol: "inlining",
  44761. args: ["closure", "aBlock"],
  44762. source: "inlinedClosure: closure wrapFinalValueIn: aBlock\x0a\x09| sequence final |\x0a\x0a\x09sequence := closure sequence.\x0a\x09\x0a\x09sequence dagChildren ifEmpty: [ sequence add: (IRVariable new\x0a\x09\x09variable: (closure scope pseudoVars at: 'nil');\x0a\x09\x09yourself) ].\x0a\x09final := sequence dagChildren last.\x0a\x09final yieldsValue ifTrue: [ sequence replace: final with: (aBlock value: final) ].\x0a\x0a\x09^ closure",
  44763. referencedClasses: ["IRVariable"],
  44764. pragmas: [],
  44765. messageSends: ["sequence", "ifEmpty:", "dagChildren", "add:", "variable:", "new", "at:", "pseudoVars", "scope", "yourself", "last", "ifTrue:", "yieldsValue", "replace:with:", "value:"]
  44766. }, function ($methodClass){ return function (closure,aBlock){
  44767. var self=this,$self=this;
  44768. var sequence,final;
  44769. return $core.withContext(function($ctx1) {
  44770. var $1,$2;
  44771. sequence=$recv(closure)._sequence();
  44772. $recv([$recv(sequence)._dagChildren()
  44773. ,$ctx1.sendIdx["dagChildren"]=1
  44774. ][0])._ifEmpty_((function(){
  44775. return $core.withContext(function($ctx2) {
  44776. $1=sequence;
  44777. $2=$recv($globals.IRVariable)._new();
  44778. $recv($2)._variable_($recv($recv($recv(closure)._scope())._pseudoVars())._at_("nil"));
  44779. return $recv($1)._add_($recv($2)._yourself());
  44780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44781. }));
  44782. final=$recv($recv(sequence)._dagChildren())._last();
  44783. if($core.assert($recv(final)._yieldsValue())){
  44784. $recv(sequence)._replace_with_(final,$recv(aBlock)._value_(final));
  44785. }
  44786. return closure;
  44787. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure:wrapFinalValueIn:",{closure:closure,aBlock:aBlock,sequence:sequence,final:final})});
  44788. }; }),
  44789. $globals.IRSendInliner);
  44790. $core.addMethod(
  44791. $core.method({
  44792. selector: "inlinedSend:withBlock:",
  44793. protocol: "private",
  44794. args: ["inlinedSend", "anIRInstruction"],
  44795. source: "inlinedSend: inlinedSend withBlock: anIRInstruction\x0a\x09| inlinedClosure |\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",
  44796. referencedClasses: [],
  44797. pragmas: [],
  44798. messageSends: ["visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  44799. }, function ($methodClass){ return function (inlinedSend,anIRInstruction){
  44800. var self=this,$self=this;
  44801. var inlinedClosure;
  44802. return $core.withContext(function($ctx1) {
  44803. inlinedClosure=$recv($self._translator())._visit_($self._inlineClosure_(anIRInstruction));
  44804. [$recv(inlinedSend)._add_($recv([$self._send()
  44805. ,$ctx1.sendIdx["send"]=1
  44806. ][0])._receiver())
  44807. ,$ctx1.sendIdx["add:"]=1
  44808. ][0];
  44809. $recv(inlinedSend)._add_(inlinedClosure);
  44810. $recv($self._send())._replaceWith_(inlinedSend);
  44811. $recv([$recv($recv(inlinedSend)._method())._internalVariables()
  44812. ,$ctx1.sendIdx["internalVariables"]=1
  44813. ][0])._addAll_($recv(inlinedSend)._internalVariables());
  44814. return inlinedSend;
  44815. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure})});
  44816. }; }),
  44817. $globals.IRSendInliner);
  44818. $core.addMethod(
  44819. $core.method({
  44820. selector: "inlinedSend:withBlock:withBlock:",
  44821. protocol: "private",
  44822. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  44823. source: "inlinedSend: inlinedSend withBlock: anIRInstruction withBlock: anotherIRInstruction\x0a\x09| inlinedClosure1 inlinedClosure2 |\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",
  44824. referencedClasses: [],
  44825. pragmas: [],
  44826. messageSends: ["visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  44827. }, function ($methodClass){ return function (inlinedSend,anIRInstruction,anotherIRInstruction){
  44828. var self=this,$self=this;
  44829. var inlinedClosure1,inlinedClosure2;
  44830. return $core.withContext(function($ctx1) {
  44831. inlinedClosure1=[$recv([$self._translator()
  44832. ,$ctx1.sendIdx["translator"]=1
  44833. ][0])._visit_([$self._inlineClosure_(anIRInstruction)
  44834. ,$ctx1.sendIdx["inlineClosure:"]=1
  44835. ][0])
  44836. ,$ctx1.sendIdx["visit:"]=1
  44837. ][0];
  44838. inlinedClosure2=$recv($self._translator())._visit_($self._inlineClosure_(anotherIRInstruction));
  44839. [$recv(inlinedSend)._add_($recv([$self._send()
  44840. ,$ctx1.sendIdx["send"]=1
  44841. ][0])._receiver())
  44842. ,$ctx1.sendIdx["add:"]=1
  44843. ][0];
  44844. [$recv(inlinedSend)._add_(inlinedClosure1)
  44845. ,$ctx1.sendIdx["add:"]=2
  44846. ][0];
  44847. $recv(inlinedSend)._add_(inlinedClosure2);
  44848. $recv($self._send())._replaceWith_(inlinedSend);
  44849. $recv([$recv($recv(inlinedSend)._method())._internalVariables()
  44850. ,$ctx1.sendIdx["internalVariables"]=1
  44851. ][0])._addAll_($recv(inlinedSend)._internalVariables());
  44852. return inlinedSend;
  44853. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2})});
  44854. }; }),
  44855. $globals.IRSendInliner);
  44856. $core.addMethod(
  44857. $core.method({
  44858. selector: "inlinedSequence",
  44859. protocol: "factory",
  44860. args: [],
  44861. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  44862. referencedClasses: ["IRInlinedSequence"],
  44863. pragmas: [],
  44864. messageSends: ["new"]
  44865. }, function ($methodClass){ return function (){
  44866. var self=this,$self=this;
  44867. return $core.withContext(function($ctx1) {
  44868. return $recv($globals.IRInlinedSequence)._new();
  44869. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{})});
  44870. }; }),
  44871. $globals.IRSendInliner);
  44872. $core.addMethod(
  44873. $core.method({
  44874. selector: "inliningError:",
  44875. protocol: "error handling",
  44876. args: ["aString"],
  44877. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  44878. referencedClasses: ["InliningError"],
  44879. pragmas: [],
  44880. messageSends: ["signal:"]
  44881. }, function ($methodClass){ return function (aString){
  44882. var self=this,$self=this;
  44883. return $core.withContext(function($ctx1) {
  44884. $recv($globals.InliningError)._signal_(aString);
  44885. return self;
  44886. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString})});
  44887. }; }),
  44888. $globals.IRSendInliner);
  44889. $core.addMethod(
  44890. $core.method({
  44891. selector: "mustBeNiladicClosure:",
  44892. protocol: "testing",
  44893. args: ["anIRInstruction"],
  44894. source: "mustBeNiladicClosure: anIRInstruction\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' ]",
  44895. referencedClasses: [],
  44896. pragmas: [],
  44897. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments"]
  44898. }, function ($methodClass){ return function (anIRInstruction){
  44899. var self=this,$self=this;
  44900. return $core.withContext(function($ctx1) {
  44901. if(!$core.assert($recv(anIRInstruction)._isClosure())){
  44902. [$self._inliningError_("Message argument should be a block")
  44903. ,$ctx1.sendIdx["inliningError:"]=1
  44904. ][0];
  44905. }
  44906. if(!$core.assert($recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0)))){
  44907. $self._inliningError_("Inlined block should have zero argument");
  44908. }
  44909. return self;
  44910. }, function($ctx1) {$ctx1.fill(self,"mustBeNiladicClosure:",{anIRInstruction:anIRInstruction})});
  44911. }; }),
  44912. $globals.IRSendInliner);
  44913. $core.addMethod(
  44914. $core.method({
  44915. selector: "mustBeNiladicOrUnaryClosure:",
  44916. protocol: "testing",
  44917. args: ["anIRInstruction"],
  44918. source: "mustBeNiladicOrUnaryClosure: anIRInstruction\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size <= 1 ifFalse: [ self inliningError: 'Inlined block should have at most one argument' ]",
  44919. referencedClasses: [],
  44920. pragmas: [],
  44921. messageSends: ["ifFalse:", "isClosure", "inliningError:", "<=", "size", "arguments"]
  44922. }, function ($methodClass){ return function (anIRInstruction){
  44923. var self=this,$self=this;
  44924. return $core.withContext(function($ctx1) {
  44925. if(!$core.assert($recv(anIRInstruction)._isClosure())){
  44926. [$self._inliningError_("Message argument should be a block")
  44927. ,$ctx1.sendIdx["inliningError:"]=1
  44928. ][0];
  44929. }
  44930. if(!$core.assert($recv($recv($recv(anIRInstruction)._arguments())._size()).__lt_eq((1)))){
  44931. $self._inliningError_("Inlined block should have at most one argument");
  44932. }
  44933. return self;
  44934. }, function($ctx1) {$ctx1.fill(self,"mustBeNiladicOrUnaryClosure:",{anIRInstruction:anIRInstruction})});
  44935. }; }),
  44936. $globals.IRSendInliner);
  44937. $core.addMethod(
  44938. $core.method({
  44939. selector: "send",
  44940. protocol: "accessing",
  44941. args: [],
  44942. source: "send\x0a\x09^ send",
  44943. referencedClasses: [],
  44944. pragmas: [],
  44945. messageSends: []
  44946. }, function ($methodClass){ return function (){
  44947. var self=this,$self=this;
  44948. return $self.send;
  44949. }; }),
  44950. $globals.IRSendInliner);
  44951. $core.addMethod(
  44952. $core.method({
  44953. selector: "send:",
  44954. protocol: "accessing",
  44955. args: ["anIRSend"],
  44956. source: "send: anIRSend\x0a\x09send := anIRSend",
  44957. referencedClasses: [],
  44958. pragmas: [],
  44959. messageSends: []
  44960. }, function ($methodClass){ return function (anIRSend){
  44961. var self=this,$self=this;
  44962. $self.send=anIRSend;
  44963. return self;
  44964. }; }),
  44965. $globals.IRSendInliner);
  44966. $core.addMethod(
  44967. $core.method({
  44968. selector: "translator",
  44969. protocol: "accessing",
  44970. args: [],
  44971. source: "translator\x0a\x09^ translator",
  44972. referencedClasses: [],
  44973. pragmas: [],
  44974. messageSends: []
  44975. }, function ($methodClass){ return function (){
  44976. var self=this,$self=this;
  44977. return $self.translator;
  44978. }; }),
  44979. $globals.IRSendInliner);
  44980. $core.addMethod(
  44981. $core.method({
  44982. selector: "translator:",
  44983. protocol: "accessing",
  44984. args: ["anASTTranslator"],
  44985. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  44986. referencedClasses: [],
  44987. pragmas: [],
  44988. messageSends: []
  44989. }, function ($methodClass){ return function (anASTTranslator){
  44990. var self=this,$self=this;
  44991. $self.translator=anASTTranslator;
  44992. return self;
  44993. }; }),
  44994. $globals.IRSendInliner);
  44995. $core.addMethod(
  44996. $core.method({
  44997. selector: "inlinedSelectors",
  44998. protocol: "accessing",
  44999. args: [],
  45000. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  45001. referencedClasses: [],
  45002. pragmas: [],
  45003. messageSends: []
  45004. }, function ($methodClass){ return function (){
  45005. var self=this,$self=this;
  45006. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  45007. }; }),
  45008. $globals.IRSendInliner.a$cls);
  45009. $core.addMethod(
  45010. $core.method({
  45011. selector: "inlinedSelectorsNeedingIdempotentReceiver",
  45012. protocol: "accessing",
  45013. args: [],
  45014. source: "inlinedSelectorsNeedingIdempotentReceiver\x0a\x09^ #('ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  45015. referencedClasses: [],
  45016. pragmas: [],
  45017. messageSends: []
  45018. }, function ($methodClass){ return function (){
  45019. var self=this,$self=this;
  45020. return ["ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  45021. }; }),
  45022. $globals.IRSendInliner.a$cls);
  45023. $core.addMethod(
  45024. $core.method({
  45025. selector: "shouldInline:",
  45026. protocol: "accessing",
  45027. args: ["anIRSend"],
  45028. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09anIRSend receiver isSuper ifTrue: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  45029. referencedClasses: [],
  45030. pragmas: [],
  45031. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "ifTrue:", "isSuper", "receiver", "allSatisfy:", "arguments", "isClosure"]
  45032. }, function ($methodClass){ return function (anIRSend){
  45033. var self=this,$self=this;
  45034. return $core.withContext(function($ctx1) {
  45035. if(!$core.assert($recv($self._inlinedSelectors())._includes_($recv(anIRSend)._selector()))){
  45036. return false;
  45037. }
  45038. if($core.assert($recv($recv(anIRSend)._receiver())._isSuper())){
  45039. return false;
  45040. }
  45041. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  45042. return $core.withContext(function($ctx2) {
  45043. return $recv(each)._isClosure();
  45044. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  45045. }));
  45046. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend})});
  45047. }; }),
  45048. $globals.IRSendInliner.a$cls);
  45049. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  45050. $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};";
  45051. $core.addMethod(
  45052. $core.method({
  45053. selector: "inlineAssignment:",
  45054. protocol: "inlining",
  45055. args: ["anIRAssignment"],
  45056. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  45057. referencedClasses: [],
  45058. pragmas: [],
  45059. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  45060. }, function ($methodClass){ return function (anIRAssignment){
  45061. var self=this,$self=this;
  45062. return $core.withContext(function($ctx1) {
  45063. $self._target_($recv(anIRAssignment)._left());
  45064. return $self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  45065. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment})});
  45066. }; }),
  45067. $globals.IRAssignmentInliner);
  45068. $core.addMethod(
  45069. $core.method({
  45070. selector: "inlineClosure:",
  45071. protocol: "inlining",
  45072. args: ["anIRClosure"],
  45073. source: "inlineClosure: anIRClosure\x0a\x09^ self\x0a\x09\x09inlinedClosure: (super inlineClosure: anIRClosure)\x0a\x09\x09wrapFinalValueIn: [ :final |\x0a\x09\x09\x09IRAssignment new\x0a\x09\x09\x09\x09add: self target;\x0a\x09\x09\x09\x09add: final copy;\x0a\x09\x09\x09\x09yourself ]",
  45074. referencedClasses: ["IRAssignment"],
  45075. pragmas: [],
  45076. messageSends: ["inlinedClosure:wrapFinalValueIn:", "inlineClosure:", "add:", "new", "target", "copy", "yourself"]
  45077. }, function ($methodClass){ return function (anIRClosure){
  45078. var self=this,$self=this;
  45079. return $core.withContext(function($ctx1) {
  45080. var $1;
  45081. return $self._inlinedClosure_wrapFinalValueIn_([(
  45082. $ctx1.supercall = true,
  45083. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.call($self,anIRClosure))
  45084. ,$ctx1.supercall = false
  45085. ][0],(function(final){
  45086. return $core.withContext(function($ctx2) {
  45087. $1=$recv($globals.IRAssignment)._new();
  45088. [$recv($1)._add_($self._target())
  45089. ,$ctx2.sendIdx["add:"]=1
  45090. ][0];
  45091. $recv($1)._add_($recv(final)._copy());
  45092. return $recv($1)._yourself();
  45093. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  45094. }));
  45095. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure})});
  45096. }; }),
  45097. $globals.IRAssignmentInliner);
  45098. $core.addMethod(
  45099. $core.method({
  45100. selector: "target",
  45101. protocol: "accessing",
  45102. args: [],
  45103. source: "target\x0a\x09^ target",
  45104. referencedClasses: [],
  45105. pragmas: [],
  45106. messageSends: []
  45107. }, function ($methodClass){ return function (){
  45108. var self=this,$self=this;
  45109. return $self.target;
  45110. }; }),
  45111. $globals.IRAssignmentInliner);
  45112. $core.addMethod(
  45113. $core.method({
  45114. selector: "target:",
  45115. protocol: "accessing",
  45116. args: ["anObject"],
  45117. source: "target: anObject\x0a\x09target := anObject",
  45118. referencedClasses: [],
  45119. pragmas: [],
  45120. messageSends: []
  45121. }, function ($methodClass){ return function (anObject){
  45122. var self=this,$self=this;
  45123. $self.target=anObject;
  45124. return self;
  45125. }; }),
  45126. $globals.IRAssignmentInliner);
  45127. $core.addClass("IRNonLocalReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  45128. $globals.IRNonLocalReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  45129. $core.addMethod(
  45130. $core.method({
  45131. selector: "inlineClosure:",
  45132. protocol: "inlining",
  45133. args: ["anIRClosure"],
  45134. source: "inlineClosure: anIRClosure\x0a\x09^ self\x0a\x09\x09inlinedClosure: (super inlineClosure: anIRClosure)\x0a\x09\x09wrapFinalValueIn: [ :final |\x0a\x09\x09\x09IRNonLocalReturn new\x0a\x09\x09\x09\x09add: final copy;\x0a\x09\x09\x09\x09yourself ]",
  45135. referencedClasses: ["IRNonLocalReturn"],
  45136. pragmas: [],
  45137. messageSends: ["inlinedClosure:wrapFinalValueIn:", "inlineClosure:", "add:", "new", "copy", "yourself"]
  45138. }, function ($methodClass){ return function (anIRClosure){
  45139. var self=this,$self=this;
  45140. return $core.withContext(function($ctx1) {
  45141. var $1;
  45142. return $self._inlinedClosure_wrapFinalValueIn_([(
  45143. $ctx1.supercall = true,
  45144. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.call($self,anIRClosure))
  45145. ,$ctx1.supercall = false
  45146. ][0],(function(final){
  45147. return $core.withContext(function($ctx2) {
  45148. $1=$recv($globals.IRNonLocalReturn)._new();
  45149. $recv($1)._add_($recv(final)._copy());
  45150. return $recv($1)._yourself();
  45151. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  45152. }));
  45153. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure})});
  45154. }; }),
  45155. $globals.IRNonLocalReturnInliner);
  45156. $core.addMethod(
  45157. $core.method({
  45158. selector: "inlineReturn:",
  45159. protocol: "inlining",
  45160. args: ["anIRReturn"],
  45161. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  45162. referencedClasses: [],
  45163. pragmas: [],
  45164. messageSends: ["inlineSend:andReplace:", "expression"]
  45165. }, function ($methodClass){ return function (anIRReturn){
  45166. var self=this,$self=this;
  45167. return $core.withContext(function($ctx1) {
  45168. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  45169. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn})});
  45170. }; }),
  45171. $globals.IRNonLocalReturnInliner);
  45172. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  45173. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  45174. $core.addMethod(
  45175. $core.method({
  45176. selector: "inlineClosure:",
  45177. protocol: "inlining",
  45178. args: ["anIRClosure"],
  45179. source: "inlineClosure: anIRClosure\x0a\x09^ self\x0a\x09\x09inlinedClosure: (super inlineClosure: anIRClosure)\x0a\x09\x09wrapFinalValueIn: [ :final |\x0a\x09\x09\x09IRReturn new\x0a\x09\x09\x09\x09add: final copy;\x0a\x09\x09\x09\x09yourself ]",
  45180. referencedClasses: ["IRReturn"],
  45181. pragmas: [],
  45182. messageSends: ["inlinedClosure:wrapFinalValueIn:", "inlineClosure:", "add:", "new", "copy", "yourself"]
  45183. }, function ($methodClass){ return function (anIRClosure){
  45184. var self=this,$self=this;
  45185. return $core.withContext(function($ctx1) {
  45186. var $1;
  45187. return $self._inlinedClosure_wrapFinalValueIn_([(
  45188. $ctx1.supercall = true,
  45189. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.call($self,anIRClosure))
  45190. ,$ctx1.supercall = false
  45191. ][0],(function(final){
  45192. return $core.withContext(function($ctx2) {
  45193. $1=$recv($globals.IRReturn)._new();
  45194. $recv($1)._add_($recv(final)._copy());
  45195. return $recv($1)._yourself();
  45196. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  45197. }));
  45198. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure})});
  45199. }; }),
  45200. $globals.IRReturnInliner);
  45201. $core.addMethod(
  45202. $core.method({
  45203. selector: "inlineReturn:",
  45204. protocol: "inlining",
  45205. args: ["anIRReturn"],
  45206. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  45207. referencedClasses: [],
  45208. pragmas: [],
  45209. messageSends: ["inlineSend:andReplace:", "expression"]
  45210. }, function ($methodClass){ return function (anIRReturn){
  45211. var self=this,$self=this;
  45212. return $core.withContext(function($ctx1) {
  45213. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  45214. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn})});
  45215. }; }),
  45216. $globals.IRReturnInliner);
  45217. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  45218. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  45219. $core.addMethod(
  45220. $core.method({
  45221. selector: "inliner",
  45222. protocol: "compiling",
  45223. args: [],
  45224. source: "inliner\x0a\x09^ IRInliner new",
  45225. referencedClasses: ["IRInliner"],
  45226. pragmas: [],
  45227. messageSends: ["new"]
  45228. }, function ($methodClass){ return function (){
  45229. var self=this,$self=this;
  45230. return $core.withContext(function($ctx1) {
  45231. return $recv($globals.IRInliner)._new();
  45232. }, function($ctx1) {$ctx1.fill(self,"inliner",{})});
  45233. }; }),
  45234. $globals.InliningCodeGenerator);
  45235. $core.addMethod(
  45236. $core.method({
  45237. selector: "irTranslatorClass",
  45238. protocol: "compiling",
  45239. args: [],
  45240. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  45241. referencedClasses: ["IRInliningJSTranslator"],
  45242. pragmas: [],
  45243. messageSends: []
  45244. }, function ($methodClass){ return function (){
  45245. var self=this,$self=this;
  45246. return $globals.IRInliningJSTranslator;
  45247. }; }),
  45248. $globals.InliningCodeGenerator);
  45249. $core.addMethod(
  45250. $core.method({
  45251. selector: "preInliner",
  45252. protocol: "compiling",
  45253. args: [],
  45254. source: "preInliner\x0a\x09^ ASTPreInliner new",
  45255. referencedClasses: ["ASTPreInliner"],
  45256. pragmas: [],
  45257. messageSends: ["new"]
  45258. }, function ($methodClass){ return function (){
  45259. var self=this,$self=this;
  45260. return $core.withContext(function($ctx1) {
  45261. return $recv($globals.ASTPreInliner)._new();
  45262. }, function($ctx1) {$ctx1.fill(self,"preInliner",{})});
  45263. }; }),
  45264. $globals.InliningCodeGenerator);
  45265. $core.addMethod(
  45266. $core.method({
  45267. selector: "transformersDictionary",
  45268. protocol: "compiling",
  45269. args: [],
  45270. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := super transformersDictionary\x0a\x09\x09at: '3000-inlinerTagging' put: self preInliner;\x0a\x09\x09at: '6000-inliner' put: self inliner;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself ]",
  45271. referencedClasses: [],
  45272. pragmas: [],
  45273. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  45274. }, function ($methodClass){ return function (){
  45275. var self=this,$self=this;
  45276. return $core.withContext(function($ctx1) {
  45277. var $1,$2;
  45278. $1=$self.transformersDictionary;
  45279. if($1 == null || $1.a$nil){
  45280. $2=[(
  45281. $ctx1.supercall = true,
  45282. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.call($self))
  45283. ,$ctx1.supercall = false
  45284. ][0];
  45285. [$recv($2)._at_put_("3000-inlinerTagging",$self._preInliner())
  45286. ,$ctx1.sendIdx["at:put:"]=1
  45287. ][0];
  45288. [$recv($2)._at_put_("6000-inliner",$self._inliner())
  45289. ,$ctx1.sendIdx["at:put:"]=2
  45290. ][0];
  45291. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  45292. $self.transformersDictionary=$recv($2)._yourself();
  45293. return $self.transformersDictionary;
  45294. } else {
  45295. return $1;
  45296. }
  45297. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{})});
  45298. }; }),
  45299. $globals.InliningCodeGenerator);
  45300. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  45301. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  45302. $core.addTrait("TIRInlinedVisitor", "Compiler-Inlining");
  45303. $core.addMethod(
  45304. $core.method({
  45305. selector: "visitIRInlinedClosure:",
  45306. protocol: "visiting",
  45307. args: ["anIRInlinedClosure"],
  45308. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  45309. referencedClasses: [],
  45310. pragmas: [],
  45311. messageSends: ["visitIRClosure:"]
  45312. }, function ($methodClass){ return function (anIRInlinedClosure){
  45313. var self=this,$self=this;
  45314. return $core.withContext(function($ctx1) {
  45315. return $self._visitIRClosure_(anIRInlinedClosure);
  45316. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure})});
  45317. }; }),
  45318. $globals.TIRInlinedVisitor);
  45319. $core.addMethod(
  45320. $core.method({
  45321. selector: "visitIRInlinedSequence:",
  45322. protocol: "visiting",
  45323. args: ["anIRInlinedSequence"],
  45324. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  45325. referencedClasses: [],
  45326. pragmas: [],
  45327. messageSends: ["visitIRSequence:"]
  45328. }, function ($methodClass){ return function (anIRInlinedSequence){
  45329. var self=this,$self=this;
  45330. return $core.withContext(function($ctx1) {
  45331. return $self._visitIRSequence_(anIRInlinedSequence);
  45332. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence})});
  45333. }; }),
  45334. $globals.TIRInlinedVisitor);
  45335. $core.setTraitComposition([{trait: $globals.TIRInlinedVisitor}], $globals.IRInliner);
  45336. $core.setTraitComposition([{trait: $globals.TIRInlinedVisitor}], $globals.IRInliningJSTranslator);
  45337. $core.addMethod(
  45338. $core.method({
  45339. selector: "asInlinedBlockResult",
  45340. protocol: "*Compiler-Inlining",
  45341. args: [],
  45342. source: "asInlinedBlockResult\x0a\x09^ self expression",
  45343. referencedClasses: [],
  45344. pragmas: [],
  45345. messageSends: ["expression"]
  45346. }, function ($methodClass){ return function (){
  45347. var self=this,$self=this;
  45348. return $core.withContext(function($ctx1) {
  45349. return $self._expression();
  45350. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{})});
  45351. }; }),
  45352. $globals.IRBlockReturn);
  45353. $core.addMethod(
  45354. $core.method({
  45355. selector: "asInlinedBlockResult",
  45356. protocol: "*Compiler-Inlining",
  45357. args: [],
  45358. source: "asInlinedBlockResult\x0a\x09^ self",
  45359. referencedClasses: [],
  45360. pragmas: [],
  45361. messageSends: []
  45362. }, function ($methodClass){ return function (){
  45363. var self=this,$self=this;
  45364. return self;
  45365. }; }),
  45366. $globals.IRInstruction);
  45367. });
  45368. define('amber/core/Compiler-Interpreter',["amber/boot", "require", "amber/core/Compiler-AST", "amber/core/Compiler-Core", "amber/core/Compiler-Semantic", "amber/core/Kernel-Exceptions", "amber/core/Kernel-Methods", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  45369. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  45370. var $pkg = $core.addPackage("Compiler-Interpreter");
  45371. $pkg.innerEval = function (expr) { return eval(expr); };
  45372. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  45373. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  45374. $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`).";
  45375. $core.addMethod(
  45376. $core.method({
  45377. selector: "applyTo:arguments:",
  45378. protocol: "evaluating",
  45379. args: ["anObject", "aCollection"],
  45380. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  45381. referencedClasses: [],
  45382. pragmas: [],
  45383. messageSends: ["interpreterError"]
  45384. }, function ($methodClass){ return function (anObject,aCollection){
  45385. var self=this,$self=this;
  45386. return $core.withContext(function($ctx1) {
  45387. $self._interpreterError();
  45388. return self;
  45389. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection})});
  45390. }; }),
  45391. $globals.AIBlockClosure);
  45392. $core.addMethod(
  45393. $core.method({
  45394. selector: "compiledSource",
  45395. protocol: "accessing",
  45396. args: [],
  45397. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  45398. referencedClasses: [],
  45399. pragmas: [],
  45400. messageSends: []
  45401. }, function ($methodClass){ return function (){
  45402. var self=this,$self=this;
  45403. return "[ AST Block closure ]";
  45404. }; }),
  45405. $globals.AIBlockClosure);
  45406. $core.addMethod(
  45407. $core.method({
  45408. selector: "currySelf",
  45409. protocol: "converting",
  45410. args: [],
  45411. source: "currySelf\x0a\x09self interpreterError",
  45412. referencedClasses: [],
  45413. pragmas: [],
  45414. messageSends: ["interpreterError"]
  45415. }, function ($methodClass){ return function (){
  45416. var self=this,$self=this;
  45417. return $core.withContext(function($ctx1) {
  45418. $self._interpreterError();
  45419. return self;
  45420. }, function($ctx1) {$ctx1.fill(self,"currySelf",{})});
  45421. }; }),
  45422. $globals.AIBlockClosure);
  45423. $core.addMethod(
  45424. $core.method({
  45425. selector: "initializeWithContext:node:",
  45426. protocol: "initialization",
  45427. args: ["aContext", "aNode"],
  45428. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  45429. referencedClasses: [],
  45430. pragmas: [],
  45431. messageSends: []
  45432. }, function ($methodClass){ return function (aContext,aNode){
  45433. var self=this,$self=this;
  45434. $self.node=aNode;
  45435. $self.outerContext=aContext;
  45436. return self;
  45437. }; }),
  45438. $globals.AIBlockClosure);
  45439. $core.addMethod(
  45440. $core.method({
  45441. selector: "interpreterError",
  45442. protocol: "error handling",
  45443. args: [],
  45444. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  45445. referencedClasses: ["ASTInterpreterError"],
  45446. pragmas: [],
  45447. messageSends: ["signal:"]
  45448. }, function ($methodClass){ return function (){
  45449. var self=this,$self=this;
  45450. return $core.withContext(function($ctx1) {
  45451. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  45452. return self;
  45453. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{})});
  45454. }; }),
  45455. $globals.AIBlockClosure);
  45456. $core.addMethod(
  45457. $core.method({
  45458. selector: "numArgs",
  45459. protocol: "accessing",
  45460. args: [],
  45461. source: "numArgs\x0a\x09^ node temps size",
  45462. referencedClasses: [],
  45463. pragmas: [],
  45464. messageSends: ["size", "temps"]
  45465. }, function ($methodClass){ return function (){
  45466. var self=this,$self=this;
  45467. return $core.withContext(function($ctx1) {
  45468. return $recv($recv($self.node)._temps())._size();
  45469. }, function($ctx1) {$ctx1.fill(self,"numArgs",{})});
  45470. }; }),
  45471. $globals.AIBlockClosure);
  45472. $core.addMethod(
  45473. $core.method({
  45474. selector: "value",
  45475. protocol: "evaluating",
  45476. args: [],
  45477. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  45478. referencedClasses: [],
  45479. pragmas: [],
  45480. messageSends: ["valueWithPossibleArguments:"]
  45481. }, function ($methodClass){ return function (){
  45482. var self=this,$self=this;
  45483. return $core.withContext(function($ctx1) {
  45484. return $self._valueWithPossibleArguments_([]);
  45485. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  45486. }; }),
  45487. $globals.AIBlockClosure);
  45488. $core.addMethod(
  45489. $core.method({
  45490. selector: "value:",
  45491. protocol: "evaluating",
  45492. args: ["anArgument"],
  45493. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  45494. referencedClasses: [],
  45495. pragmas: [],
  45496. messageSends: ["valueWithPossibleArguments:"]
  45497. }, function ($methodClass){ return function (anArgument){
  45498. var self=this,$self=this;
  45499. return $core.withContext(function($ctx1) {
  45500. return $self._valueWithPossibleArguments_([anArgument]);
  45501. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument})});
  45502. }; }),
  45503. $globals.AIBlockClosure);
  45504. $core.addMethod(
  45505. $core.method({
  45506. selector: "value:value:",
  45507. protocol: "evaluating",
  45508. args: ["firstArgument", "secondArgument"],
  45509. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  45510. referencedClasses: [],
  45511. pragmas: [],
  45512. messageSends: ["valueWithPossibleArguments:"]
  45513. }, function ($methodClass){ return function (firstArgument,secondArgument){
  45514. var self=this,$self=this;
  45515. return $core.withContext(function($ctx1) {
  45516. return $self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  45517. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument})});
  45518. }; }),
  45519. $globals.AIBlockClosure);
  45520. $core.addMethod(
  45521. $core.method({
  45522. selector: "value:value:value:",
  45523. protocol: "evaluating",
  45524. args: ["firstArgument", "secondArgument", "thirdArgument"],
  45525. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  45526. referencedClasses: [],
  45527. pragmas: [],
  45528. messageSends: ["valueWithPossibleArguments:"]
  45529. }, function ($methodClass){ return function (firstArgument,secondArgument,thirdArgument){
  45530. var self=this,$self=this;
  45531. return $core.withContext(function($ctx1) {
  45532. return $self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  45533. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument})});
  45534. }; }),
  45535. $globals.AIBlockClosure);
  45536. $core.addMethod(
  45537. $core.method({
  45538. selector: "valueWithPossibleArguments:",
  45539. protocol: "evaluating",
  45540. args: ["aCollection"],
  45541. 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 sequenceNode 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",
  45542. referencedClasses: [],
  45543. pragmas: [],
  45544. messageSends: ["newInnerContext", "parent:", "copy", "sequenceNode", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  45545. }, function ($methodClass){ return function (aCollection){
  45546. var self=this,$self=this;
  45547. var context,sequenceNode;
  45548. return $core.withContext(function($ctx1) {
  45549. var $1,$2;
  45550. context=$recv($self.outerContext)._newInnerContext();
  45551. $1=$recv($recv($self.node)._sequenceNode())._copy();
  45552. $recv($1)._parent_(nil);
  45553. sequenceNode=$recv($1)._yourself();
  45554. $recv($recv(sequenceNode)._temps())._do_((function(each){
  45555. return $core.withContext(function($ctx2) {
  45556. return [$recv(context)._defineLocal_(each)
  45557. ,$ctx2.sendIdx["defineLocal:"]=1
  45558. ][0];
  45559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45560. }));
  45561. $recv($recv($self.node)._parameters())._withIndexDo_((function(each,index){
  45562. return $core.withContext(function($ctx2) {
  45563. $recv(context)._defineLocal_(each);
  45564. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  45565. return nil;
  45566. })));
  45567. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  45568. }));
  45569. $2=[$recv(context)._interpreter()
  45570. ,$ctx1.sendIdx["interpreter"]=1
  45571. ][0];
  45572. $recv($2)._node_(sequenceNode);
  45573. $recv($2)._enterNode();
  45574. $recv($2)._proceed();
  45575. $recv([$recv($self.outerContext)._interpreter()
  45576. ,$ctx1.sendIdx["interpreter"]=2
  45577. ][0])._setNonLocalReturnFromContext_(context);
  45578. return $recv($recv(context)._interpreter())._pop();
  45579. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode})});
  45580. }; }),
  45581. $globals.AIBlockClosure);
  45582. $core.addMethod(
  45583. $core.method({
  45584. selector: "forContext:node:",
  45585. protocol: "instance creation",
  45586. args: ["aContext", "aNode"],
  45587. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  45588. referencedClasses: [],
  45589. pragmas: [],
  45590. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  45591. }, function ($methodClass){ return function (aContext,aNode){
  45592. var self=this,$self=this;
  45593. return $core.withContext(function($ctx1) {
  45594. var $1;
  45595. $1=$self._new();
  45596. $recv($1)._initializeWithContext_node_(aContext,aNode);
  45597. return $recv($1)._yourself();
  45598. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode})});
  45599. }; }),
  45600. $globals.AIBlockClosure.a$cls);
  45601. $core.addClass("AIContext", $globals.Object, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  45602. $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)";
  45603. $core.addMethod(
  45604. $core.method({
  45605. selector: "arguments",
  45606. protocol: "interpreting",
  45607. args: [],
  45608. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  45609. referencedClasses: [],
  45610. pragmas: [],
  45611. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  45612. }, function ($methodClass){ return function (){
  45613. var self=this,$self=this;
  45614. return $core.withContext(function($ctx1) {
  45615. return $recv($recv($self._ast())._arguments())._collect_((function(each){
  45616. return $core.withContext(function($ctx2) {
  45617. return $self._localAt_ifAbsent_(each,(function(){
  45618. return $core.withContext(function($ctx3) {
  45619. return $self._error_("Argument not in context");
  45620. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45621. }));
  45622. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45623. }));
  45624. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  45625. }; }),
  45626. $globals.AIContext);
  45627. $core.addMethod(
  45628. $core.method({
  45629. selector: "ast",
  45630. protocol: "interpreting",
  45631. args: [],
  45632. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  45633. referencedClasses: [],
  45634. pragmas: [],
  45635. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  45636. }, function ($methodClass){ return function (){
  45637. var self=this,$self=this;
  45638. return $core.withContext(function($ctx1) {
  45639. var $1,$2;
  45640. if($core.assert($self._isBlockContext())){
  45641. $1=$self._outerContext();
  45642. if($1 == null || $1.a$nil){
  45643. return $1;
  45644. } else {
  45645. var context;
  45646. context=$1;
  45647. return $recv(context)._ast();
  45648. }
  45649. }
  45650. $2=$self.ast;
  45651. if($2 == null || $2.a$nil){
  45652. $self._initializeAST();
  45653. } else {
  45654. $2;
  45655. }
  45656. return $self.ast;
  45657. }, function($ctx1) {$ctx1.fill(self,"ast",{})});
  45658. }; }),
  45659. $globals.AIContext);
  45660. $core.addMethod(
  45661. $core.method({
  45662. selector: "basicLocalAt:",
  45663. protocol: "private",
  45664. args: ["aString"],
  45665. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  45666. referencedClasses: [],
  45667. pragmas: [],
  45668. messageSends: ["at:", "locals"]
  45669. }, function ($methodClass){ return function (aString){
  45670. var self=this,$self=this;
  45671. return $core.withContext(function($ctx1) {
  45672. return $recv($self._locals())._at_(aString);
  45673. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString})});
  45674. }; }),
  45675. $globals.AIContext);
  45676. $core.addMethod(
  45677. $core.method({
  45678. selector: "basicLocalAt:put:",
  45679. protocol: "private",
  45680. args: ["aString", "anObject"],
  45681. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  45682. referencedClasses: [],
  45683. pragmas: [],
  45684. messageSends: ["at:put:", "locals"]
  45685. }, function ($methodClass){ return function (aString,anObject){
  45686. var self=this,$self=this;
  45687. return $core.withContext(function($ctx1) {
  45688. $recv($self._locals())._at_put_(aString,anObject);
  45689. return self;
  45690. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject})});
  45691. }; }),
  45692. $globals.AIContext);
  45693. $core.addMethod(
  45694. $core.method({
  45695. selector: "basicReceiver",
  45696. protocol: "interpreting",
  45697. args: [],
  45698. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  45699. referencedClasses: [],
  45700. pragmas: [],
  45701. messageSends: ["localAt:"]
  45702. }, function ($methodClass){ return function (){
  45703. var self=this,$self=this;
  45704. return $core.withContext(function($ctx1) {
  45705. return $self._localAt_("self");
  45706. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{})});
  45707. }; }),
  45708. $globals.AIContext);
  45709. $core.addMethod(
  45710. $core.method({
  45711. selector: "defineLocal:",
  45712. protocol: "accessing",
  45713. args: ["aString"],
  45714. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  45715. referencedClasses: [],
  45716. pragmas: [],
  45717. messageSends: ["at:put:", "locals"]
  45718. }, function ($methodClass){ return function (aString){
  45719. var self=this,$self=this;
  45720. return $core.withContext(function($ctx1) {
  45721. $recv($self._locals())._at_put_(aString,nil);
  45722. return self;
  45723. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString})});
  45724. }; }),
  45725. $globals.AIContext);
  45726. $core.addMethod(
  45727. $core.method({
  45728. selector: "evaluate:on:",
  45729. protocol: "evaluating",
  45730. args: ["aString", "anEvaluator"],
  45731. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  45732. referencedClasses: [],
  45733. pragmas: [],
  45734. messageSends: ["evaluate:context:"]
  45735. }, function ($methodClass){ return function (aString,anEvaluator){
  45736. var self=this,$self=this;
  45737. return $core.withContext(function($ctx1) {
  45738. return $recv(anEvaluator)._evaluate_context_(aString,self);
  45739. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator})});
  45740. }; }),
  45741. $globals.AIContext);
  45742. $core.addMethod(
  45743. $core.method({
  45744. selector: "evaluateNode:",
  45745. protocol: "evaluating",
  45746. args: ["aNode"],
  45747. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  45748. referencedClasses: ["ASTInterpreter"],
  45749. pragmas: [],
  45750. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  45751. }, function ($methodClass){ return function (aNode){
  45752. var self=this,$self=this;
  45753. return $core.withContext(function($ctx1) {
  45754. var $1;
  45755. $1=$recv($globals.ASTInterpreter)._new();
  45756. $recv($1)._context_(self);
  45757. $recv($1)._node_(aNode);
  45758. $recv($1)._enterNode();
  45759. $recv($1)._proceed();
  45760. return $recv($1)._result();
  45761. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode})});
  45762. }; }),
  45763. $globals.AIContext);
  45764. $core.addMethod(
  45765. $core.method({
  45766. selector: "evaluatedSelector",
  45767. protocol: "accessing",
  45768. args: [],
  45769. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  45770. referencedClasses: [],
  45771. pragmas: [],
  45772. messageSends: []
  45773. }, function ($methodClass){ return function (){
  45774. var self=this,$self=this;
  45775. return $self.evaluatedSelector;
  45776. }; }),
  45777. $globals.AIContext);
  45778. $core.addMethod(
  45779. $core.method({
  45780. selector: "evaluatedSelector:",
  45781. protocol: "accessing",
  45782. args: ["aString"],
  45783. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  45784. referencedClasses: [],
  45785. pragmas: [],
  45786. messageSends: []
  45787. }, function ($methodClass){ return function (aString){
  45788. var self=this,$self=this;
  45789. $self.evaluatedSelector=aString;
  45790. return self;
  45791. }; }),
  45792. $globals.AIContext);
  45793. $core.addMethod(
  45794. $core.method({
  45795. selector: "home",
  45796. protocol: "accessing",
  45797. args: [],
  45798. source: "home\x0a\x09^ nil",
  45799. referencedClasses: [],
  45800. pragmas: [],
  45801. messageSends: []
  45802. }, function ($methodClass){ return function (){
  45803. var self=this,$self=this;
  45804. return nil;
  45805. }; }),
  45806. $globals.AIContext);
  45807. $core.addMethod(
  45808. $core.method({
  45809. selector: "index",
  45810. protocol: "accessing",
  45811. args: [],
  45812. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  45813. referencedClasses: [],
  45814. pragmas: [],
  45815. messageSends: ["ifNil:"]
  45816. }, function ($methodClass){ return function (){
  45817. var self=this,$self=this;
  45818. return $core.withContext(function($ctx1) {
  45819. var $1;
  45820. $1=$self.index;
  45821. if($1 == null || $1.a$nil){
  45822. return (0);
  45823. } else {
  45824. return $1;
  45825. }
  45826. }, function($ctx1) {$ctx1.fill(self,"index",{})});
  45827. }; }),
  45828. $globals.AIContext);
  45829. $core.addMethod(
  45830. $core.method({
  45831. selector: "index:",
  45832. protocol: "accessing",
  45833. args: ["anInteger"],
  45834. source: "index: anInteger\x0a\x09index := anInteger",
  45835. referencedClasses: [],
  45836. pragmas: [],
  45837. messageSends: []
  45838. }, function ($methodClass){ return function (anInteger){
  45839. var self=this,$self=this;
  45840. $self.index=anInteger;
  45841. return self;
  45842. }; }),
  45843. $globals.AIContext);
  45844. $core.addMethod(
  45845. $core.method({
  45846. selector: "initializeAST",
  45847. protocol: "initialization",
  45848. args: [],
  45849. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method origin)\x0a\x09\x09visit: ast",
  45850. referencedClasses: ["SemanticAnalyzer"],
  45851. pragmas: [],
  45852. messageSends: ["ast", "method", "visit:", "on:", "origin"]
  45853. }, function ($methodClass){ return function (){
  45854. var self=this,$self=this;
  45855. return $core.withContext(function($ctx1) {
  45856. $self.ast=$recv([$self._method()
  45857. ,$ctx1.sendIdx["method"]=1
  45858. ][0])._ast();
  45859. $recv($recv($globals.SemanticAnalyzer)._on_($recv($self._method())._origin()))._visit_($self.ast);
  45860. return self;
  45861. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{})});
  45862. }; }),
  45863. $globals.AIContext);
  45864. $core.addMethod(
  45865. $core.method({
  45866. selector: "initializeFromMethodContext:",
  45867. protocol: "initialization",
  45868. args: ["aMethodContext"],
  45869. 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 ] ]",
  45870. referencedClasses: [],
  45871. pragmas: [],
  45872. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  45873. }, function ($methodClass){ return function (aMethodContext){
  45874. var self=this,$self=this;
  45875. return $core.withContext(function($ctx1) {
  45876. var $1,$2;
  45877. $self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  45878. $self._index_($recv(aMethodContext)._index());
  45879. $self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  45880. $self._receiver_($recv(aMethodContext)._receiver());
  45881. $self._supercall_($recv(aMethodContext)._supercall());
  45882. $self._selector_($recv(aMethodContext)._selector());
  45883. $1=[$recv(aMethodContext)._outerContext()
  45884. ,$ctx1.sendIdx["outerContext"]=1
  45885. ][0];
  45886. if($1 == null || $1.a$nil){
  45887. $1;
  45888. } else {
  45889. var outer;
  45890. outer=$1;
  45891. $2=$recv(outer)._methodContext();
  45892. if($2 == null || $2.a$nil){
  45893. $2;
  45894. } else {
  45895. $self._outerContext_($recv($self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  45896. }
  45897. $recv([$recv(aMethodContext)._locals()
  45898. ,$ctx1.sendIdx["locals"]=1
  45899. ][0])._keysAndValuesDo_((function(key,value){
  45900. return $core.withContext(function($ctx2) {
  45901. return $recv($self._locals())._at_put_(key,value);
  45902. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  45903. }));
  45904. }
  45905. return self;
  45906. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext})});
  45907. }; }),
  45908. $globals.AIContext);
  45909. $core.addMethod(
  45910. $core.method({
  45911. selector: "initializeInterpreter",
  45912. protocol: "initialization",
  45913. args: [],
  45914. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  45915. referencedClasses: ["ASTInterpreter"],
  45916. pragmas: [],
  45917. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  45918. }, function ($methodClass){ return function (){
  45919. var self=this,$self=this;
  45920. return $core.withContext(function($ctx1) {
  45921. var $1,$2;
  45922. $1=$recv($globals.ASTInterpreter)._new();
  45923. $recv($1)._context_(self);
  45924. $self.interpreter=$recv($1)._yourself();
  45925. $2=$self._innerContext();
  45926. if($2 == null || $2.a$nil){
  45927. $2;
  45928. } else {
  45929. $self._setupInterpreter_($self.interpreter);
  45930. }
  45931. return self;
  45932. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{})});
  45933. }; }),
  45934. $globals.AIContext);
  45935. $core.addMethod(
  45936. $core.method({
  45937. selector: "initializeLocals",
  45938. protocol: "initialization",
  45939. args: [],
  45940. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  45941. referencedClasses: ["Dictionary"],
  45942. pragmas: [],
  45943. messageSends: ["new", "at:put:"]
  45944. }, function ($methodClass){ return function (){
  45945. var self=this,$self=this;
  45946. return $core.withContext(function($ctx1) {
  45947. $self.locals=$recv($globals.Dictionary)._new();
  45948. $recv($self.locals)._at_put_("thisContext",self);
  45949. return self;
  45950. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{})});
  45951. }; }),
  45952. $globals.AIContext);
  45953. $core.addMethod(
  45954. $core.method({
  45955. selector: "innerContext",
  45956. protocol: "accessing",
  45957. args: [],
  45958. source: "innerContext\x0a\x09^ innerContext",
  45959. referencedClasses: [],
  45960. pragmas: [],
  45961. messageSends: []
  45962. }, function ($methodClass){ return function (){
  45963. var self=this,$self=this;
  45964. return $self.innerContext;
  45965. }; }),
  45966. $globals.AIContext);
  45967. $core.addMethod(
  45968. $core.method({
  45969. selector: "innerContext:",
  45970. protocol: "accessing",
  45971. args: ["anAIContext"],
  45972. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  45973. referencedClasses: [],
  45974. pragmas: [],
  45975. messageSends: []
  45976. }, function ($methodClass){ return function (anAIContext){
  45977. var self=this,$self=this;
  45978. $self.innerContext=anAIContext;
  45979. return self;
  45980. }; }),
  45981. $globals.AIContext);
  45982. $core.addMethod(
  45983. $core.method({
  45984. selector: "interpreter",
  45985. protocol: "interpreting",
  45986. args: [],
  45987. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  45988. referencedClasses: [],
  45989. pragmas: [],
  45990. messageSends: ["ifNil:", "initializeInterpreter"]
  45991. }, function ($methodClass){ return function (){
  45992. var self=this,$self=this;
  45993. return $core.withContext(function($ctx1) {
  45994. var $1;
  45995. $1=$self.interpreter;
  45996. if($1 == null || $1.a$nil){
  45997. $self._initializeInterpreter();
  45998. } else {
  45999. $1;
  46000. }
  46001. return $self.interpreter;
  46002. }, function($ctx1) {$ctx1.fill(self,"interpreter",{})});
  46003. }; }),
  46004. $globals.AIContext);
  46005. $core.addMethod(
  46006. $core.method({
  46007. selector: "interpreter:",
  46008. protocol: "interpreting",
  46009. args: ["anInterpreter"],
  46010. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  46011. referencedClasses: [],
  46012. pragmas: [],
  46013. messageSends: []
  46014. }, function ($methodClass){ return function (anInterpreter){
  46015. var self=this,$self=this;
  46016. $self.interpreter=anInterpreter;
  46017. return self;
  46018. }; }),
  46019. $globals.AIContext);
  46020. $core.addMethod(
  46021. $core.method({
  46022. selector: "isTopContext",
  46023. protocol: "testing",
  46024. args: [],
  46025. source: "isTopContext\x0a\x09^ self innerContext isNil",
  46026. referencedClasses: [],
  46027. pragmas: [],
  46028. messageSends: ["isNil", "innerContext"]
  46029. }, function ($methodClass){ return function (){
  46030. var self=this,$self=this;
  46031. return $core.withContext(function($ctx1) {
  46032. return $recv($self._innerContext())._isNil();
  46033. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{})});
  46034. }; }),
  46035. $globals.AIContext);
  46036. $core.addMethod(
  46037. $core.method({
  46038. selector: "localAt:",
  46039. protocol: "accessing",
  46040. args: ["aString"],
  46041. 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",
  46042. referencedClasses: [],
  46043. pragmas: [],
  46044. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  46045. }, function ($methodClass){ return function (aString){
  46046. var self=this,$self=this;
  46047. var context;
  46048. return $core.withContext(function($ctx1) {
  46049. context=$self._lookupContextForLocal_(aString);
  46050. return $recv(context)._basicLocalAt_(aString);
  46051. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context})});
  46052. }; }),
  46053. $globals.AIContext);
  46054. $core.addMethod(
  46055. $core.method({
  46056. selector: "localAt:ifAbsent:",
  46057. protocol: "accessing",
  46058. args: ["aString", "aBlock"],
  46059. 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",
  46060. referencedClasses: [],
  46061. pragmas: [],
  46062. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  46063. }, function ($methodClass){ return function (aString,aBlock){
  46064. var self=this,$self=this;
  46065. var context;
  46066. return $core.withContext(function($ctx1) {
  46067. var $early={};
  46068. try {
  46069. context=$self._lookupContextForLocal_ifNone_(aString,(function(){
  46070. return $core.withContext(function($ctx2) {
  46071. throw $early=[$recv(aBlock)._value()];
  46072. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46073. }));
  46074. return $recv(context)._basicLocalAt_(aString);
  46075. }
  46076. catch(e) {if(e===$early)return e[0]; throw e}
  46077. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context})});
  46078. }; }),
  46079. $globals.AIContext);
  46080. $core.addMethod(
  46081. $core.method({
  46082. selector: "localAt:put:",
  46083. protocol: "accessing",
  46084. args: ["aString", "anObject"],
  46085. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  46086. referencedClasses: [],
  46087. pragmas: [],
  46088. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  46089. }, function ($methodClass){ return function (aString,anObject){
  46090. var self=this,$self=this;
  46091. var context;
  46092. return $core.withContext(function($ctx1) {
  46093. context=$self._lookupContextForLocal_(aString);
  46094. $recv(context)._basicLocalAt_put_(aString,anObject);
  46095. return self;
  46096. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context})});
  46097. }; }),
  46098. $globals.AIContext);
  46099. $core.addMethod(
  46100. $core.method({
  46101. selector: "locals",
  46102. protocol: "accessing",
  46103. args: [],
  46104. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  46105. referencedClasses: [],
  46106. pragmas: [],
  46107. messageSends: ["ifNil:", "initializeLocals"]
  46108. }, function ($methodClass){ return function (){
  46109. var self=this,$self=this;
  46110. return $core.withContext(function($ctx1) {
  46111. var $1;
  46112. $1=$self.locals;
  46113. if($1 == null || $1.a$nil){
  46114. $self._initializeLocals();
  46115. } else {
  46116. $1;
  46117. }
  46118. return $self.locals;
  46119. }, function($ctx1) {$ctx1.fill(self,"locals",{})});
  46120. }; }),
  46121. $globals.AIContext);
  46122. $core.addMethod(
  46123. $core.method({
  46124. selector: "lookupContextForLocal:",
  46125. protocol: "private",
  46126. args: ["aString"],
  46127. 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 ]",
  46128. referencedClasses: [],
  46129. pragmas: [],
  46130. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  46131. }, function ($methodClass){ return function (aString){
  46132. var self=this,$self=this;
  46133. return $core.withContext(function($ctx1) {
  46134. return $self._lookupContextForLocal_ifNone_(aString,(function(){
  46135. return $core.withContext(function($ctx2) {
  46136. return $self._variableNotFound();
  46137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46138. }));
  46139. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString})});
  46140. }; }),
  46141. $globals.AIContext);
  46142. $core.addMethod(
  46143. $core.method({
  46144. selector: "lookupContextForLocal:ifNone:",
  46145. protocol: "private",
  46146. args: ["aString", "aBlock"],
  46147. 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 ifNone: aBlock ] ]",
  46148. referencedClasses: [],
  46149. pragmas: [],
  46150. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:ifNone:"]
  46151. }, function ($methodClass){ return function (aString,aBlock){
  46152. var self=this,$self=this;
  46153. return $core.withContext(function($ctx1) {
  46154. var $1;
  46155. return $recv($self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  46156. return self;
  46157. }),(function(){
  46158. return $core.withContext(function($ctx2) {
  46159. $1=$self._outerContext();
  46160. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  46161. return $core.withContext(function($ctx3) {
  46162. return $recv(context)._lookupContextForLocal_ifNone_(aString,aBlock);
  46163. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  46164. }));
  46165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46166. }));
  46167. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock})});
  46168. }; }),
  46169. $globals.AIContext);
  46170. $core.addMethod(
  46171. $core.method({
  46172. selector: "newInnerContext",
  46173. protocol: "factory",
  46174. args: [],
  46175. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  46176. referencedClasses: [],
  46177. pragmas: [],
  46178. messageSends: ["outerContext:", "new", "class", "yourself"]
  46179. }, function ($methodClass){ return function (){
  46180. var self=this,$self=this;
  46181. return $core.withContext(function($ctx1) {
  46182. var $1;
  46183. $1=$recv($self._class())._new();
  46184. $recv($1)._outerContext_(self);
  46185. return $recv($1)._yourself();
  46186. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{})});
  46187. }; }),
  46188. $globals.AIContext);
  46189. $core.addMethod(
  46190. $core.method({
  46191. selector: "outerContext",
  46192. protocol: "accessing",
  46193. args: [],
  46194. source: "outerContext\x0a\x09^ outerContext",
  46195. referencedClasses: [],
  46196. pragmas: [],
  46197. messageSends: []
  46198. }, function ($methodClass){ return function (){
  46199. var self=this,$self=this;
  46200. return $self.outerContext;
  46201. }; }),
  46202. $globals.AIContext);
  46203. $core.addMethod(
  46204. $core.method({
  46205. selector: "outerContext:",
  46206. protocol: "accessing",
  46207. args: ["anAIContext"],
  46208. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  46209. referencedClasses: [],
  46210. pragmas: [],
  46211. messageSends: ["ifNotNil:", "innerContext:"]
  46212. }, function ($methodClass){ return function (anAIContext){
  46213. var self=this,$self=this;
  46214. return $core.withContext(function($ctx1) {
  46215. var $1;
  46216. $self.outerContext=anAIContext;
  46217. $1=$self.outerContext;
  46218. if($1 == null || $1.a$nil){
  46219. $1;
  46220. } else {
  46221. var context;
  46222. context=$1;
  46223. $recv(context)._innerContext_(self);
  46224. }
  46225. return self;
  46226. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext})});
  46227. }; }),
  46228. $globals.AIContext);
  46229. $core.addMethod(
  46230. $core.method({
  46231. selector: "receiver:",
  46232. protocol: "interpreting",
  46233. args: ["anObject"],
  46234. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  46235. referencedClasses: [],
  46236. pragmas: [],
  46237. messageSends: ["at:put:", "locals"]
  46238. }, function ($methodClass){ return function (anObject){
  46239. var self=this,$self=this;
  46240. return $core.withContext(function($ctx1) {
  46241. $recv($self._locals())._at_put_("self",anObject);
  46242. return self;
  46243. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject})});
  46244. }; }),
  46245. $globals.AIContext);
  46246. $core.addMethod(
  46247. $core.method({
  46248. selector: "selector",
  46249. protocol: "accessing",
  46250. args: [],
  46251. source: "selector\x0a\x09^ selector",
  46252. referencedClasses: [],
  46253. pragmas: [],
  46254. messageSends: []
  46255. }, function ($methodClass){ return function (){
  46256. var self=this,$self=this;
  46257. return $self.selector;
  46258. }; }),
  46259. $globals.AIContext);
  46260. $core.addMethod(
  46261. $core.method({
  46262. selector: "selector:",
  46263. protocol: "accessing",
  46264. args: ["aString"],
  46265. source: "selector: aString\x0a\x09selector := aString",
  46266. referencedClasses: [],
  46267. pragmas: [],
  46268. messageSends: []
  46269. }, function ($methodClass){ return function (aString){
  46270. var self=this,$self=this;
  46271. $self.selector=aString;
  46272. return self;
  46273. }; }),
  46274. $globals.AIContext);
  46275. $core.addMethod(
  46276. $core.method({
  46277. selector: "sendIndexAt:",
  46278. protocol: "accessing",
  46279. args: ["aString"],
  46280. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  46281. referencedClasses: [],
  46282. pragmas: [],
  46283. messageSends: ["at:ifAbsent:", "sendIndexes"]
  46284. }, function ($methodClass){ return function (aString){
  46285. var self=this,$self=this;
  46286. return $core.withContext(function($ctx1) {
  46287. return $recv($self._sendIndexes())._at_ifAbsent_(aString,(function(){
  46288. return (0);
  46289. }));
  46290. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString})});
  46291. }; }),
  46292. $globals.AIContext);
  46293. $core.addMethod(
  46294. $core.method({
  46295. selector: "sendIndexes",
  46296. protocol: "accessing",
  46297. args: [],
  46298. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  46299. referencedClasses: ["Dictionary"],
  46300. pragmas: [],
  46301. messageSends: ["ifNil:", "new"]
  46302. }, function ($methodClass){ return function (){
  46303. var self=this,$self=this;
  46304. return $core.withContext(function($ctx1) {
  46305. var $1;
  46306. $1=$self.sendIndexes;
  46307. if($1 == null || $1.a$nil){
  46308. return $recv($globals.Dictionary)._new();
  46309. } else {
  46310. return $1;
  46311. }
  46312. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{})});
  46313. }; }),
  46314. $globals.AIContext);
  46315. $core.addMethod(
  46316. $core.method({
  46317. selector: "sendIndexes:",
  46318. protocol: "accessing",
  46319. args: ["aDictionary"],
  46320. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  46321. referencedClasses: [],
  46322. pragmas: [],
  46323. messageSends: []
  46324. }, function ($methodClass){ return function (aDictionary){
  46325. var self=this,$self=this;
  46326. $self.sendIndexes=aDictionary;
  46327. return self;
  46328. }; }),
  46329. $globals.AIContext);
  46330. $core.addMethod(
  46331. $core.method({
  46332. selector: "setupInterpreter:",
  46333. protocol: "interpreting",
  46334. args: ["anInterpreter"],
  46335. 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)",
  46336. referencedClasses: ["ASTPCNodeVisitor"],
  46337. pragmas: [],
  46338. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  46339. }, function ($methodClass){ return function (anInterpreter){
  46340. var self=this,$self=this;
  46341. var currentNode;
  46342. return $core.withContext(function($ctx1) {
  46343. var $1,$2;
  46344. $1=$recv($globals.ASTPCNodeVisitor)._new();
  46345. $recv($1)._selector_([$self._evaluatedSelector()
  46346. ,$ctx1.sendIdx["evaluatedSelector"]=1
  46347. ][0]);
  46348. $recv($1)._index_($self._sendIndexAt_($self._evaluatedSelector()));
  46349. $recv($1)._visit_([$self._ast()
  46350. ,$ctx1.sendIdx["ast"]=1
  46351. ][0]);
  46352. currentNode=$recv($1)._currentNode();
  46353. $2=$recv($self._ast())._sequenceNode();
  46354. if($2 == null || $2.a$nil){
  46355. $2;
  46356. } else {
  46357. var sequence;
  46358. sequence=$2;
  46359. [$recv($recv(sequence)._temps())._do_((function(each){
  46360. return $core.withContext(function($ctx2) {
  46361. return $self._defineLocal_(each);
  46362. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  46363. }))
  46364. ,$ctx1.sendIdx["do:"]=1
  46365. ][0];
  46366. }
  46367. $recv(anInterpreter)._node_(currentNode);
  46368. $recv($recv($recv([$self._innerContext()
  46369. ,$ctx1.sendIdx["innerContext"]=1
  46370. ][0])._arguments())._reversed())._do_((function(each){
  46371. return $core.withContext(function($ctx2) {
  46372. return [$recv(anInterpreter)._push_(each)
  46373. ,$ctx2.sendIdx["push:"]=1
  46374. ][0];
  46375. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  46376. }));
  46377. $recv(anInterpreter)._push_($recv($self._innerContext())._receiver());
  46378. return self;
  46379. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode})});
  46380. }; }),
  46381. $globals.AIContext);
  46382. $core.addMethod(
  46383. $core.method({
  46384. selector: "supercall",
  46385. protocol: "interpreting",
  46386. args: [],
  46387. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  46388. referencedClasses: [],
  46389. pragmas: [],
  46390. messageSends: ["ifNil:"]
  46391. }, function ($methodClass){ return function (){
  46392. var self=this,$self=this;
  46393. return $core.withContext(function($ctx1) {
  46394. var $1;
  46395. $1=$self.supercall;
  46396. if($1 == null || $1.a$nil){
  46397. return false;
  46398. } else {
  46399. return $1;
  46400. }
  46401. }, function($ctx1) {$ctx1.fill(self,"supercall",{})});
  46402. }; }),
  46403. $globals.AIContext);
  46404. $core.addMethod(
  46405. $core.method({
  46406. selector: "supercall:",
  46407. protocol: "interpreting",
  46408. args: ["aBoolean"],
  46409. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  46410. referencedClasses: [],
  46411. pragmas: [],
  46412. messageSends: []
  46413. }, function ($methodClass){ return function (aBoolean){
  46414. var self=this,$self=this;
  46415. $self.supercall=aBoolean;
  46416. return self;
  46417. }; }),
  46418. $globals.AIContext);
  46419. $core.addMethod(
  46420. $core.method({
  46421. selector: "variableNotFound",
  46422. protocol: "error handling",
  46423. args: [],
  46424. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  46425. referencedClasses: [],
  46426. pragmas: [],
  46427. messageSends: ["error:"]
  46428. }, function ($methodClass){ return function (){
  46429. var self=this,$self=this;
  46430. return $core.withContext(function($ctx1) {
  46431. $self._error_("Variable missing");
  46432. return self;
  46433. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{})});
  46434. }; }),
  46435. $globals.AIContext);
  46436. $core.addMethod(
  46437. $core.method({
  46438. selector: "fromMethodContext:",
  46439. protocol: "instance creation",
  46440. args: ["aMethodContext"],
  46441. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  46442. referencedClasses: [],
  46443. pragmas: [],
  46444. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  46445. }, function ($methodClass){ return function (aMethodContext){
  46446. var self=this,$self=this;
  46447. return $core.withContext(function($ctx1) {
  46448. var $1;
  46449. $1=$self._new();
  46450. $recv($1)._initializeFromMethodContext_(aMethodContext);
  46451. return $recv($1)._yourself();
  46452. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext})});
  46453. }; }),
  46454. $globals.AIContext.a$cls);
  46455. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  46456. $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.";
  46457. $core.addMethod(
  46458. $core.method({
  46459. selector: "context",
  46460. protocol: "accessing",
  46461. args: [],
  46462. source: "context\x0a\x09^ context",
  46463. referencedClasses: [],
  46464. pragmas: [],
  46465. messageSends: []
  46466. }, function ($methodClass){ return function (){
  46467. var self=this,$self=this;
  46468. return $self.context;
  46469. }; }),
  46470. $globals.AISemanticAnalyzer);
  46471. $core.addMethod(
  46472. $core.method({
  46473. selector: "context:",
  46474. protocol: "accessing",
  46475. args: ["anAIContext"],
  46476. source: "context: anAIContext\x0a\x09context := anAIContext",
  46477. referencedClasses: [],
  46478. pragmas: [],
  46479. messageSends: []
  46480. }, function ($methodClass){ return function (anAIContext){
  46481. var self=this,$self=this;
  46482. $self.context=anAIContext;
  46483. return self;
  46484. }; }),
  46485. $globals.AISemanticAnalyzer);
  46486. $core.addMethod(
  46487. $core.method({
  46488. selector: "visitVariableNode:",
  46489. protocol: "visiting",
  46490. args: ["aNode"],
  46491. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode identifier \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  46492. referencedClasses: ["ASTContextVar"],
  46493. pragmas: [],
  46494. messageSends: ["localAt:ifAbsent:", "context", "identifier", "visitVariableNode:", "binding:", "new"]
  46495. }, function ($methodClass){ return function (aNode){
  46496. var self=this,$self=this;
  46497. return $core.withContext(function($ctx1) {
  46498. var $early={};
  46499. try {
  46500. $recv($self._context())._localAt_ifAbsent_($recv(aNode)._identifier(),(function(){
  46501. return $core.withContext(function($ctx2) {
  46502. throw $early=[[(
  46503. $ctx2.supercall = true,
  46504. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.call($self,aNode))
  46505. ,$ctx2.supercall = false
  46506. ][0]];
  46507. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46508. }));
  46509. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  46510. return self;
  46511. }
  46512. catch(e) {if(e===$early)return e[0]; throw e}
  46513. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode})});
  46514. }; }),
  46515. $globals.AISemanticAnalyzer);
  46516. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  46517. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  46518. $core.addMethod(
  46519. $core.method({
  46520. selector: "context",
  46521. protocol: "accessing",
  46522. args: [],
  46523. source: "context\x0a\x09^ context",
  46524. referencedClasses: [],
  46525. pragmas: [],
  46526. messageSends: []
  46527. }, function ($methodClass){ return function (){
  46528. var self=this,$self=this;
  46529. return $self.context;
  46530. }; }),
  46531. $globals.ASTContextVar);
  46532. $core.addMethod(
  46533. $core.method({
  46534. selector: "context:",
  46535. protocol: "accessing",
  46536. args: ["anObject"],
  46537. source: "context: anObject\x0a\x09context := anObject",
  46538. referencedClasses: [],
  46539. pragmas: [],
  46540. messageSends: []
  46541. }, function ($methodClass){ return function (anObject){
  46542. var self=this,$self=this;
  46543. $self.context=anObject;
  46544. return self;
  46545. }; }),
  46546. $globals.ASTContextVar);
  46547. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  46548. $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.";
  46549. $core.addMethod(
  46550. $core.method({
  46551. selector: "atEnd",
  46552. protocol: "testing",
  46553. args: [],
  46554. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  46555. referencedClasses: [],
  46556. pragmas: [],
  46557. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  46558. }, function ($methodClass){ return function (){
  46559. var self=this,$self=this;
  46560. return $core.withContext(function($ctx1) {
  46561. var $1;
  46562. $1=[$self._context()
  46563. ,$ctx1.sendIdx["context"]=1
  46564. ][0];
  46565. if($1 == null || $1.a$nil){
  46566. return true;
  46567. } else {
  46568. $1;
  46569. }
  46570. return $recv($recv($self._interpreter())._atEnd())._and_((function(){
  46571. return $core.withContext(function($ctx2) {
  46572. return $recv($self._context())._isTopContext();
  46573. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46574. }));
  46575. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  46576. }; }),
  46577. $globals.ASTDebugger);
  46578. $core.addMethod(
  46579. $core.method({
  46580. selector: "context",
  46581. protocol: "accessing",
  46582. args: [],
  46583. source: "context\x0a\x09^ context",
  46584. referencedClasses: [],
  46585. pragmas: [],
  46586. messageSends: []
  46587. }, function ($methodClass){ return function (){
  46588. var self=this,$self=this;
  46589. return $self.context;
  46590. }; }),
  46591. $globals.ASTDebugger);
  46592. $core.addMethod(
  46593. $core.method({
  46594. selector: "context:",
  46595. protocol: "accessing",
  46596. args: ["aContext"],
  46597. source: "context: aContext\x0a\x09context := aContext",
  46598. referencedClasses: [],
  46599. pragmas: [],
  46600. messageSends: []
  46601. }, function ($methodClass){ return function (aContext){
  46602. var self=this,$self=this;
  46603. $self.context=aContext;
  46604. return self;
  46605. }; }),
  46606. $globals.ASTDebugger);
  46607. $core.addMethod(
  46608. $core.method({
  46609. selector: "flushInnerContexts",
  46610. protocol: "actions",
  46611. args: [],
  46612. 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 ]",
  46613. referencedClasses: [],
  46614. pragmas: [],
  46615. messageSends: ["ifNotNil:", "context", "innerContext:"]
  46616. }, function ($methodClass){ return function (){
  46617. var self=this,$self=this;
  46618. return $core.withContext(function($ctx1) {
  46619. var $1;
  46620. $1=$self._context();
  46621. if($1 == null || $1.a$nil){
  46622. $1;
  46623. } else {
  46624. var cxt;
  46625. cxt=$1;
  46626. $recv(cxt)._innerContext_(nil);
  46627. }
  46628. return self;
  46629. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{})});
  46630. }; }),
  46631. $globals.ASTDebugger);
  46632. $core.addMethod(
  46633. $core.method({
  46634. selector: "interpreter",
  46635. protocol: "accessing",
  46636. args: [],
  46637. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  46638. referencedClasses: [],
  46639. pragmas: [],
  46640. messageSends: ["ifNotNil:", "context", "interpreter"]
  46641. }, function ($methodClass){ return function (){
  46642. var self=this,$self=this;
  46643. return $core.withContext(function($ctx1) {
  46644. var $1;
  46645. $1=$self._context();
  46646. if($1 == null || $1.a$nil){
  46647. return $1;
  46648. } else {
  46649. var ctx;
  46650. ctx=$1;
  46651. return $recv(ctx)._interpreter();
  46652. }
  46653. }, function($ctx1) {$ctx1.fill(self,"interpreter",{})});
  46654. }; }),
  46655. $globals.ASTDebugger);
  46656. $core.addMethod(
  46657. $core.method({
  46658. selector: "node",
  46659. protocol: "accessing",
  46660. args: [],
  46661. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  46662. referencedClasses: [],
  46663. pragmas: [],
  46664. messageSends: ["ifNotNil:", "interpreter", "node"]
  46665. }, function ($methodClass){ return function (){
  46666. var self=this,$self=this;
  46667. return $core.withContext(function($ctx1) {
  46668. var $1;
  46669. $1=[$self._interpreter()
  46670. ,$ctx1.sendIdx["interpreter"]=1
  46671. ][0];
  46672. if($1 == null || $1.a$nil){
  46673. return $1;
  46674. } else {
  46675. return $recv($self._interpreter())._node();
  46676. }
  46677. }, function($ctx1) {$ctx1.fill(self,"node",{})});
  46678. }; }),
  46679. $globals.ASTDebugger);
  46680. $core.addMethod(
  46681. $core.method({
  46682. selector: "onStep",
  46683. protocol: "private",
  46684. args: [],
  46685. 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",
  46686. referencedClasses: [],
  46687. pragmas: [],
  46688. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  46689. }, function ($methodClass){ return function (){
  46690. var self=this,$self=this;
  46691. return $core.withContext(function($ctx1) {
  46692. var $1;
  46693. $self.result=$recv([$self._interpreter()
  46694. ,$ctx1.sendIdx["interpreter"]=1
  46695. ][0])._result();
  46696. if($core.assert([$recv([$self._interpreter()
  46697. ,$ctx1.sendIdx["interpreter"]=2
  46698. ][0])._atEnd()
  46699. ,$ctx1.sendIdx["atEnd"]=1
  46700. ][0])){
  46701. $1=$recv($self._context())._outerContext();
  46702. if($1 == null || $1.a$nil){
  46703. $1;
  46704. } else {
  46705. var outerContext;
  46706. outerContext=$1;
  46707. $self._context_(outerContext);
  46708. }
  46709. if(!$core.assert($recv([$self._interpreter()
  46710. ,$ctx1.sendIdx["interpreter"]=3
  46711. ][0])._atEnd())){
  46712. $recv($self._interpreter())._skip();
  46713. }
  46714. }
  46715. $self._flushInnerContexts();
  46716. return self;
  46717. }, function($ctx1) {$ctx1.fill(self,"onStep",{})});
  46718. }; }),
  46719. $globals.ASTDebugger);
  46720. $core.addMethod(
  46721. $core.method({
  46722. selector: "proceed",
  46723. protocol: "stepping",
  46724. args: [],
  46725. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  46726. referencedClasses: [],
  46727. pragmas: [],
  46728. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  46729. }, function ($methodClass){ return function (){
  46730. var self=this,$self=this;
  46731. return $core.withContext(function($ctx1) {
  46732. $recv((function(){
  46733. return $core.withContext(function($ctx2) {
  46734. return $self._atEnd();
  46735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46736. }))._whileFalse_((function(){
  46737. return $core.withContext(function($ctx2) {
  46738. return $self._stepOver();
  46739. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46740. }));
  46741. return self;
  46742. }, function($ctx1) {$ctx1.fill(self,"proceed",{})});
  46743. }; }),
  46744. $globals.ASTDebugger);
  46745. $core.addMethod(
  46746. $core.method({
  46747. selector: "restart",
  46748. protocol: "stepping",
  46749. args: [],
  46750. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  46751. referencedClasses: [],
  46752. pragmas: [],
  46753. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  46754. }, function ($methodClass){ return function (){
  46755. var self=this,$self=this;
  46756. return $core.withContext(function($ctx1) {
  46757. $recv($self._interpreter())._restart();
  46758. $self._flushInnerContexts();
  46759. return self;
  46760. }, function($ctx1) {$ctx1.fill(self,"restart",{})});
  46761. }; }),
  46762. $globals.ASTDebugger);
  46763. $core.addMethod(
  46764. $core.method({
  46765. selector: "result",
  46766. protocol: "accessing",
  46767. args: [],
  46768. source: "result\x0a\x09^ result",
  46769. referencedClasses: [],
  46770. pragmas: [],
  46771. messageSends: []
  46772. }, function ($methodClass){ return function (){
  46773. var self=this,$self=this;
  46774. return $self.result;
  46775. }; }),
  46776. $globals.ASTDebugger);
  46777. $core.addMethod(
  46778. $core.method({
  46779. selector: "stepInto",
  46780. protocol: "stepping",
  46781. args: [],
  46782. source: "stepInto\x0a\x09self shouldBeImplemented",
  46783. referencedClasses: [],
  46784. pragmas: [],
  46785. messageSends: ["shouldBeImplemented"]
  46786. }, function ($methodClass){ return function (){
  46787. var self=this,$self=this;
  46788. return $core.withContext(function($ctx1) {
  46789. $self._shouldBeImplemented();
  46790. return self;
  46791. }, function($ctx1) {$ctx1.fill(self,"stepInto",{})});
  46792. }; }),
  46793. $globals.ASTDebugger);
  46794. $core.addMethod(
  46795. $core.method({
  46796. selector: "stepOver",
  46797. protocol: "stepping",
  46798. args: [],
  46799. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  46800. referencedClasses: [],
  46801. pragmas: [],
  46802. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  46803. }, function ($methodClass){ return function (){
  46804. var self=this,$self=this;
  46805. return $core.withContext(function($ctx1) {
  46806. if($core.assert($recv($self._context())._isTopContext())){
  46807. $recv($self._interpreter())._stepOver();
  46808. } else {
  46809. $recv([$self._interpreter()
  46810. ,$ctx1.sendIdx["interpreter"]=1
  46811. ][0])._skip();
  46812. }
  46813. $self._onStep();
  46814. return self;
  46815. }, function($ctx1) {$ctx1.fill(self,"stepOver",{})});
  46816. }; }),
  46817. $globals.ASTDebugger);
  46818. $core.addMethod(
  46819. $core.method({
  46820. selector: "context:",
  46821. protocol: "instance creation",
  46822. args: ["aContext"],
  46823. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  46824. referencedClasses: [],
  46825. pragmas: [],
  46826. messageSends: ["context:", "new", "yourself"]
  46827. }, function ($methodClass){ return function (aContext){
  46828. var self=this,$self=this;
  46829. return $core.withContext(function($ctx1) {
  46830. var $1;
  46831. $1=$self._new();
  46832. $recv($1)._context_(aContext);
  46833. return $recv($1)._yourself();
  46834. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext})});
  46835. }; }),
  46836. $globals.ASTDebugger.a$cls);
  46837. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  46838. $core.addMethod(
  46839. $core.method({
  46840. selector: "interpreter",
  46841. protocol: "accessing",
  46842. args: [],
  46843. source: "interpreter\x0a\x09^ interpreter",
  46844. referencedClasses: [],
  46845. pragmas: [],
  46846. messageSends: []
  46847. }, function ($methodClass){ return function (){
  46848. var self=this,$self=this;
  46849. return $self.interpreter;
  46850. }; }),
  46851. $globals.ASTEnterNode);
  46852. $core.addMethod(
  46853. $core.method({
  46854. selector: "interpreter:",
  46855. protocol: "accessing",
  46856. args: ["anObject"],
  46857. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  46858. referencedClasses: [],
  46859. pragmas: [],
  46860. messageSends: []
  46861. }, function ($methodClass){ return function (anObject){
  46862. var self=this,$self=this;
  46863. $self.interpreter=anObject;
  46864. return self;
  46865. }; }),
  46866. $globals.ASTEnterNode);
  46867. $core.addMethod(
  46868. $core.method({
  46869. selector: "visitBlockNode:",
  46870. protocol: "visiting",
  46871. args: ["aNode"],
  46872. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  46873. referencedClasses: [],
  46874. pragmas: [],
  46875. messageSends: []
  46876. }, function ($methodClass){ return function (aNode){
  46877. var self=this,$self=this;
  46878. return aNode;
  46879. }; }),
  46880. $globals.ASTEnterNode);
  46881. $core.addMethod(
  46882. $core.method({
  46883. selector: "visitDagNode:",
  46884. protocol: "visiting",
  46885. args: ["aNode"],
  46886. source: "visitDagNode: aNode\x0a\x09^ aNode dagChildren\x0a\x09\x09ifEmpty: [ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | self visit: nodes first ]",
  46887. referencedClasses: [],
  46888. pragmas: [],
  46889. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  46890. }, function ($methodClass){ return function (aNode){
  46891. var self=this,$self=this;
  46892. return $core.withContext(function($ctx1) {
  46893. return $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  46894. return aNode;
  46895. }),(function(nodes){
  46896. return $core.withContext(function($ctx2) {
  46897. return $self._visit_($recv(nodes)._first());
  46898. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  46899. }));
  46900. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode})});
  46901. }; }),
  46902. $globals.ASTEnterNode);
  46903. $core.addMethod(
  46904. $core.method({
  46905. selector: "visitSequenceNode:",
  46906. protocol: "visiting",
  46907. args: ["aNode"],
  46908. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  46909. referencedClasses: [],
  46910. pragmas: [],
  46911. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  46912. }, function ($methodClass){ return function (aNode){
  46913. var self=this,$self=this;
  46914. return $core.withContext(function($ctx1) {
  46915. $recv($recv(aNode)._temps())._do_((function(each){
  46916. return $core.withContext(function($ctx2) {
  46917. return $recv($recv($self._interpreter())._context())._defineLocal_(each);
  46918. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46919. }));
  46920. return [(
  46921. $ctx1.supercall = true,
  46922. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.call($self,aNode))
  46923. ,$ctx1.supercall = false
  46924. ][0];
  46925. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode})});
  46926. }; }),
  46927. $globals.ASTEnterNode);
  46928. $core.addMethod(
  46929. $core.method({
  46930. selector: "on:",
  46931. protocol: "instance creation",
  46932. args: ["anInterpreter"],
  46933. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  46934. referencedClasses: [],
  46935. pragmas: [],
  46936. messageSends: ["interpreter:", "new", "yourself"]
  46937. }, function ($methodClass){ return function (anInterpreter){
  46938. var self=this,$self=this;
  46939. return $core.withContext(function($ctx1) {
  46940. var $1;
  46941. $1=$self._new();
  46942. $recv($1)._interpreter_(anInterpreter);
  46943. return $recv($1)._yourself();
  46944. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter})});
  46945. }; }),
  46946. $globals.ASTEnterNode.a$cls);
  46947. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  46948. $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";
  46949. $core.addMethod(
  46950. $core.method({
  46951. selector: "assign:to:",
  46952. protocol: "private",
  46953. args: ["aNode", "anObject"],
  46954. source: "assign: aNode to: anObject\x0a\x09aNode binding inContext: self context put: anObject",
  46955. referencedClasses: [],
  46956. pragmas: [],
  46957. messageSends: ["inContext:put:", "binding", "context"]
  46958. }, function ($methodClass){ return function (aNode,anObject){
  46959. var self=this,$self=this;
  46960. return $core.withContext(function($ctx1) {
  46961. $recv($recv(aNode)._binding())._inContext_put_($self._context(),anObject);
  46962. return self;
  46963. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject})});
  46964. }; }),
  46965. $globals.ASTInterpreter);
  46966. $core.addMethod(
  46967. $core.method({
  46968. selector: "atEnd",
  46969. protocol: "testing",
  46970. args: [],
  46971. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  46972. referencedClasses: [],
  46973. pragmas: [],
  46974. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  46975. }, function ($methodClass){ return function (){
  46976. var self=this,$self=this;
  46977. return $core.withContext(function($ctx1) {
  46978. if($core.assert($self.forceAtEnd)){
  46979. return true;
  46980. }
  46981. return $recv($self._hasReturned())._or_((function(){
  46982. return $core.withContext(function($ctx2) {
  46983. return $recv($self._node())._isNil();
  46984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46985. }));
  46986. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  46987. }; }),
  46988. $globals.ASTInterpreter);
  46989. $core.addMethod(
  46990. $core.method({
  46991. selector: "context",
  46992. protocol: "accessing",
  46993. args: [],
  46994. source: "context\x0a\x09^ context",
  46995. referencedClasses: [],
  46996. pragmas: [],
  46997. messageSends: []
  46998. }, function ($methodClass){ return function (){
  46999. var self=this,$self=this;
  47000. return $self.context;
  47001. }; }),
  47002. $globals.ASTInterpreter);
  47003. $core.addMethod(
  47004. $core.method({
  47005. selector: "context:",
  47006. protocol: "accessing",
  47007. args: ["aContext"],
  47008. source: "context: aContext\x0a\x09context := aContext",
  47009. referencedClasses: [],
  47010. pragmas: [],
  47011. messageSends: []
  47012. }, function ($methodClass){ return function (aContext){
  47013. var self=this,$self=this;
  47014. $self.context=aContext;
  47015. return self;
  47016. }; }),
  47017. $globals.ASTInterpreter);
  47018. $core.addMethod(
  47019. $core.method({
  47020. selector: "enterNode",
  47021. protocol: "interpreting",
  47022. args: [],
  47023. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  47024. referencedClasses: ["ASTEnterNode"],
  47025. pragmas: [],
  47026. messageSends: ["node:", "visit:", "on:", "node"]
  47027. }, function ($methodClass){ return function (){
  47028. var self=this,$self=this;
  47029. return $core.withContext(function($ctx1) {
  47030. $self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_($self._node()));
  47031. return self;
  47032. }, function($ctx1) {$ctx1.fill(self,"enterNode",{})});
  47033. }; }),
  47034. $globals.ASTInterpreter);
  47035. $core.addMethod(
  47036. $core.method({
  47037. selector: "eval:",
  47038. protocol: "private",
  47039. args: ["aString"],
  47040. source: "eval: aString\x0a\x09\x22Evaluate aString as JS source inside an JS function.\x0a\x09aString is not sandboxed.\x22\x0a\x09\x0a\x09| source function |\x0a\x09\x0a\x09source := String streamContents: [ :str |\x0a\x09\x09str nextPutAll: '0,(function('.\x0a\x09\x09self context locals keys\x0a\x09\x09\x09do: [ :each | str nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ str nextPutAll: ',' ].\x0a\x09\x09str\x0a\x09\x09\x09nextPutAll: '){ return (function() {';\x0a\x09\x09\x09nextPutAll: aString;\x0a\x09\x09\x09nextPutAll: '})()})' ].\x0a\x09\x09\x09\x0a\x09function := Compiler eval: source.\x0a\x09\x0a\x09^ function valueWithPossibleArguments: self context locals values",
  47041. referencedClasses: ["String", "Compiler"],
  47042. pragmas: [],
  47043. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "valueWithPossibleArguments:", "values"]
  47044. }, function ($methodClass){ return function (aString){
  47045. var self=this,$self=this;
  47046. var source,function_;
  47047. return $core.withContext(function($ctx1) {
  47048. source=$recv($globals.String)._streamContents_((function(str){
  47049. return $core.withContext(function($ctx2) {
  47050. [$recv(str)._nextPutAll_("0,(function(")
  47051. ,$ctx2.sendIdx["nextPutAll:"]=1
  47052. ][0];
  47053. $recv($recv([$recv([$self._context()
  47054. ,$ctx2.sendIdx["context"]=1
  47055. ][0])._locals()
  47056. ,$ctx2.sendIdx["locals"]=1
  47057. ][0])._keys())._do_separatedBy_((function(each){
  47058. return $core.withContext(function($ctx3) {
  47059. return [$recv(str)._nextPutAll_(each)
  47060. ,$ctx3.sendIdx["nextPutAll:"]=2
  47061. ][0];
  47062. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  47063. }),(function(){
  47064. return $core.withContext(function($ctx3) {
  47065. return [$recv(str)._nextPutAll_(",")
  47066. ,$ctx3.sendIdx["nextPutAll:"]=3
  47067. ][0];
  47068. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  47069. }));
  47070. [$recv(str)._nextPutAll_("){ return (function() {")
  47071. ,$ctx2.sendIdx["nextPutAll:"]=4
  47072. ][0];
  47073. [$recv(str)._nextPutAll_(aString)
  47074. ,$ctx2.sendIdx["nextPutAll:"]=5
  47075. ][0];
  47076. return $recv(str)._nextPutAll_("})()})");
  47077. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  47078. }));
  47079. function_=$recv($globals.Compiler)._eval_(source);
  47080. return $recv(function_)._valueWithPossibleArguments_($recv($recv($self._context())._locals())._values());
  47081. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_})});
  47082. }; }),
  47083. $globals.ASTInterpreter);
  47084. $core.addMethod(
  47085. $core.method({
  47086. selector: "hasReturned",
  47087. protocol: "testing",
  47088. args: [],
  47089. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  47090. referencedClasses: [],
  47091. pragmas: [],
  47092. messageSends: ["ifNil:"]
  47093. }, function ($methodClass){ return function (){
  47094. var self=this,$self=this;
  47095. return $core.withContext(function($ctx1) {
  47096. var $1;
  47097. $1=$self.returned;
  47098. if($1 == null || $1.a$nil){
  47099. return false;
  47100. } else {
  47101. return $1;
  47102. }
  47103. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{})});
  47104. }; }),
  47105. $globals.ASTInterpreter);
  47106. $core.addMethod(
  47107. $core.method({
  47108. selector: "initialize",
  47109. protocol: "initialization",
  47110. args: [],
  47111. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  47112. referencedClasses: [],
  47113. pragmas: [],
  47114. messageSends: ["initialize"]
  47115. }, function ($methodClass){ return function (){
  47116. var self=this,$self=this;
  47117. return $core.withContext(function($ctx1) {
  47118. [(
  47119. $ctx1.supercall = true,
  47120. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  47121. ,$ctx1.supercall = false
  47122. ][0];
  47123. $self.forceAtEnd=false;
  47124. return self;
  47125. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  47126. }; }),
  47127. $globals.ASTInterpreter);
  47128. $core.addMethod(
  47129. $core.method({
  47130. selector: "interpret",
  47131. protocol: "interpreting",
  47132. args: [],
  47133. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  47134. referencedClasses: [],
  47135. pragmas: [],
  47136. messageSends: ["visit:", "node"]
  47137. }, function ($methodClass){ return function (){
  47138. var self=this,$self=this;
  47139. return $core.withContext(function($ctx1) {
  47140. $self._visit_($self._node());
  47141. return self;
  47142. }, function($ctx1) {$ctx1.fill(self,"interpret",{})});
  47143. }; }),
  47144. $globals.ASTInterpreter);
  47145. $core.addMethod(
  47146. $core.method({
  47147. selector: "messageFromSendNode:arguments:",
  47148. protocol: "private",
  47149. args: ["aSendNode", "anArray"],
  47150. source: "messageFromSendNode: aSendNode arguments: anArray\x0a\x09^ Message selector: aSendNode selector arguments: anArray",
  47151. referencedClasses: ["Message"],
  47152. pragmas: [],
  47153. messageSends: ["selector:arguments:", "selector"]
  47154. }, function ($methodClass){ return function (aSendNode,anArray){
  47155. var self=this,$self=this;
  47156. return $core.withContext(function($ctx1) {
  47157. return $recv($globals.Message)._selector_arguments_($recv(aSendNode)._selector(),anArray);
  47158. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,anArray:anArray})});
  47159. }; }),
  47160. $globals.ASTInterpreter);
  47161. $core.addMethod(
  47162. $core.method({
  47163. selector: "messageNotUnderstood:receiver:",
  47164. protocol: "private",
  47165. args: ["aMessage", "anObject"],
  47166. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  47167. referencedClasses: ["MessageNotUnderstood"],
  47168. pragmas: [],
  47169. messageSends: ["message:", "new", "receiver:", "signal"]
  47170. }, function ($methodClass){ return function (aMessage,anObject){
  47171. var self=this,$self=this;
  47172. return $core.withContext(function($ctx1) {
  47173. var $1;
  47174. $1=$recv($globals.MessageNotUnderstood)._new();
  47175. $recv($1)._message_(aMessage);
  47176. $recv($1)._receiver_(anObject);
  47177. $recv($1)._signal();
  47178. return self;
  47179. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject})});
  47180. }; }),
  47181. $globals.ASTInterpreter);
  47182. $core.addMethod(
  47183. $core.method({
  47184. selector: "next",
  47185. protocol: "interpreting",
  47186. args: [],
  47187. source: "next\x0a\x09| nd parent |\x0a\x09nd := self node.\x0a\x09parent := nd parent.\x0a\x09(parent ifNotNil: [ parent nextSiblingNode: nd ])\x0a\x09\x09ifNil: [ self node: parent ]\x0a\x09\x09ifNotNil: [ :sibling | self node: sibling; enterNode ]",
  47188. referencedClasses: [],
  47189. pragmas: [],
  47190. messageSends: ["node", "parent", "ifNil:ifNotNil:", "ifNotNil:", "nextSiblingNode:", "node:", "enterNode"]
  47191. }, function ($methodClass){ return function (){
  47192. var self=this,$self=this;
  47193. var nd,parent;
  47194. return $core.withContext(function($ctx1) {
  47195. var $1,$2;
  47196. nd=$self._node();
  47197. parent=$recv(nd)._parent();
  47198. $1=parent;
  47199. if($1 == null || $1.a$nil){
  47200. $2=$1;
  47201. } else {
  47202. $2=$recv(parent)._nextSiblingNode_(nd);
  47203. }
  47204. if($2 == null || $2.a$nil){
  47205. [$self._node_(parent)
  47206. ,$ctx1.sendIdx["node:"]=1
  47207. ][0];
  47208. } else {
  47209. var sibling;
  47210. sibling=$2;
  47211. $self._node_(sibling);
  47212. $self._enterNode();
  47213. }
  47214. return self;
  47215. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,parent:parent})});
  47216. }; }),
  47217. $globals.ASTInterpreter);
  47218. $core.addMethod(
  47219. $core.method({
  47220. selector: "node",
  47221. protocol: "accessing",
  47222. args: [],
  47223. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  47224. referencedClasses: [],
  47225. pragmas: [],
  47226. messageSends: []
  47227. }, function ($methodClass){ return function (){
  47228. var self=this,$self=this;
  47229. return $self.node;
  47230. }; }),
  47231. $globals.ASTInterpreter);
  47232. $core.addMethod(
  47233. $core.method({
  47234. selector: "node:",
  47235. protocol: "accessing",
  47236. args: ["aNode"],
  47237. source: "node: aNode\x0a\x09node := aNode",
  47238. referencedClasses: [],
  47239. pragmas: [],
  47240. messageSends: []
  47241. }, function ($methodClass){ return function (aNode){
  47242. var self=this,$self=this;
  47243. $self.node=aNode;
  47244. return self;
  47245. }; }),
  47246. $globals.ASTInterpreter);
  47247. $core.addMethod(
  47248. $core.method({
  47249. selector: "peek",
  47250. protocol: "stack",
  47251. args: [],
  47252. 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",
  47253. referencedClasses: [],
  47254. pragmas: [],
  47255. messageSends: ["ifEmpty:", "stack", "last"]
  47256. }, function ($methodClass){ return function (){
  47257. var self=this,$self=this;
  47258. return $core.withContext(function($ctx1) {
  47259. var $early={};
  47260. try {
  47261. $recv([$self._stack()
  47262. ,$ctx1.sendIdx["stack"]=1
  47263. ][0])._ifEmpty_((function(){
  47264. throw $early=[nil];
  47265. }));
  47266. return $recv($self._stack())._last();
  47267. }
  47268. catch(e) {if(e===$early)return e[0]; throw e}
  47269. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  47270. }; }),
  47271. $globals.ASTInterpreter);
  47272. $core.addMethod(
  47273. $core.method({
  47274. selector: "pop",
  47275. protocol: "stack",
  47276. args: [],
  47277. 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",
  47278. referencedClasses: [],
  47279. pragmas: [],
  47280. messageSends: ["peek", "removeLast", "stack"]
  47281. }, function ($methodClass){ return function (){
  47282. var self=this,$self=this;
  47283. var peekedValue;
  47284. return $core.withContext(function($ctx1) {
  47285. peekedValue=$self._peek();
  47286. $recv($self._stack())._removeLast();
  47287. return peekedValue;
  47288. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue})});
  47289. }; }),
  47290. $globals.ASTInterpreter);
  47291. $core.addMethod(
  47292. $core.method({
  47293. selector: "proceed",
  47294. protocol: "interpreting",
  47295. args: [],
  47296. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  47297. referencedClasses: [],
  47298. pragmas: [],
  47299. messageSends: ["whileFalse:", "atEnd", "step"]
  47300. }, function ($methodClass){ return function (){
  47301. var self=this,$self=this;
  47302. return $core.withContext(function($ctx1) {
  47303. $recv((function(){
  47304. return $core.withContext(function($ctx2) {
  47305. return $self._atEnd();
  47306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47307. }))._whileFalse_((function(){
  47308. return $core.withContext(function($ctx2) {
  47309. return $self._step();
  47310. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47311. }));
  47312. return self;
  47313. }, function($ctx1) {$ctx1.fill(self,"proceed",{})});
  47314. }; }),
  47315. $globals.ASTInterpreter);
  47316. $core.addMethod(
  47317. $core.method({
  47318. selector: "push:",
  47319. protocol: "stack",
  47320. args: ["anObject"],
  47321. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  47322. referencedClasses: [],
  47323. pragmas: [],
  47324. messageSends: ["add:", "stack"]
  47325. }, function ($methodClass){ return function (anObject){
  47326. var self=this,$self=this;
  47327. return $core.withContext(function($ctx1) {
  47328. return $recv($self._stack())._add_(anObject);
  47329. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject})});
  47330. }; }),
  47331. $globals.ASTInterpreter);
  47332. $core.addMethod(
  47333. $core.method({
  47334. selector: "restart",
  47335. protocol: "interpreting",
  47336. args: [],
  47337. source: "restart\x0a\x09self node: self context ast; enterNode",
  47338. referencedClasses: [],
  47339. pragmas: [],
  47340. messageSends: ["node:", "ast", "context", "enterNode"]
  47341. }, function ($methodClass){ return function (){
  47342. var self=this,$self=this;
  47343. return $core.withContext(function($ctx1) {
  47344. $self._node_($recv($self._context())._ast());
  47345. $self._enterNode();
  47346. return self;
  47347. }, function($ctx1) {$ctx1.fill(self,"restart",{})});
  47348. }; }),
  47349. $globals.ASTInterpreter);
  47350. $core.addMethod(
  47351. $core.method({
  47352. selector: "result",
  47353. protocol: "accessing",
  47354. args: [],
  47355. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  47356. referencedClasses: [],
  47357. pragmas: [],
  47358. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  47359. }, function ($methodClass){ return function (){
  47360. var self=this,$self=this;
  47361. return $core.withContext(function($ctx1) {
  47362. if($core.assert($self._hasReturned())){
  47363. return $self._returnValue();
  47364. } else {
  47365. return $recv($self._context())._receiver();
  47366. }
  47367. }, function($ctx1) {$ctx1.fill(self,"result",{})});
  47368. }; }),
  47369. $globals.ASTInterpreter);
  47370. $core.addMethod(
  47371. $core.method({
  47372. selector: "returnValue",
  47373. protocol: "accessing",
  47374. args: [],
  47375. source: "returnValue\x0a\x09^ returnValue",
  47376. referencedClasses: [],
  47377. pragmas: [],
  47378. messageSends: []
  47379. }, function ($methodClass){ return function (){
  47380. var self=this,$self=this;
  47381. return $self.returnValue;
  47382. }; }),
  47383. $globals.ASTInterpreter);
  47384. $core.addMethod(
  47385. $core.method({
  47386. selector: "returnValue:",
  47387. protocol: "accessing",
  47388. args: ["anObject"],
  47389. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  47390. referencedClasses: [],
  47391. pragmas: [],
  47392. messageSends: []
  47393. }, function ($methodClass){ return function (anObject){
  47394. var self=this,$self=this;
  47395. $self.returnValue=anObject;
  47396. return self;
  47397. }; }),
  47398. $globals.ASTInterpreter);
  47399. $core.addMethod(
  47400. $core.method({
  47401. selector: "sendJavaScript:superMessage:switcher:to:",
  47402. protocol: "private",
  47403. args: ["aString", "aMessage", "aJSFunction", "anObject"],
  47404. source: "sendJavaScript: aString superMessage: aMessage switcher: aJSFunction to: anObject\x0a\x09| methodBlock parent |\x0a\x09\x0a\x09parent := self context method methodClass superPrototype.\x0a\x09parent ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x0a\x09methodBlock := (parent at: aString)\x0a\x09\x09ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x09\x0a\x09^ methodBlock applyTo: anObject arguments: (aJSFunction applyTo: nil arguments: aMessage arguments)",
  47405. referencedClasses: [],
  47406. pragmas: [],
  47407. messageSends: ["superPrototype", "methodClass", "method", "context", "ifNil:", "messageNotUnderstood:receiver:", "at:", "applyTo:arguments:", "arguments"]
  47408. }, function ($methodClass){ return function (aString,aMessage,aJSFunction,anObject){
  47409. var self=this,$self=this;
  47410. var methodBlock,parent;
  47411. return $core.withContext(function($ctx1) {
  47412. var $1,$2;
  47413. parent=$recv($recv($recv($self._context())._method())._methodClass())._superPrototype();
  47414. $1=parent;
  47415. if($1 == null || $1.a$nil){
  47416. return [$self._messageNotUnderstood_receiver_(aMessage,anObject)
  47417. ,$ctx1.sendIdx["messageNotUnderstood:receiver:"]=1
  47418. ][0];
  47419. } else {
  47420. $1;
  47421. }
  47422. $2=$recv(parent)._at_(aString);
  47423. if($2 == null || $2.a$nil){
  47424. return $self._messageNotUnderstood_receiver_(aMessage,anObject);
  47425. } else {
  47426. methodBlock=$2;
  47427. }
  47428. return [$recv(methodBlock)._applyTo_arguments_(anObject,$recv(aJSFunction)._applyTo_arguments_(nil,$recv(aMessage)._arguments()))
  47429. ,$ctx1.sendIdx["applyTo:arguments:"]=1
  47430. ][0];
  47431. }, function($ctx1) {$ctx1.fill(self,"sendJavaScript:superMessage:switcher:to:",{aString:aString,aMessage:aMessage,aJSFunction:aJSFunction,anObject:anObject,methodBlock:methodBlock,parent:parent})});
  47432. }; }),
  47433. $globals.ASTInterpreter);
  47434. $core.addMethod(
  47435. $core.method({
  47436. selector: "sendJavaScript:superMessage:to:",
  47437. protocol: "private",
  47438. args: ["aString", "aMessage", "anObject"],
  47439. source: "sendJavaScript: aString superMessage: aMessage to: anObject\x0a\x09| methodBlock parent |\x0a\x09\x0a\x09parent := self context method methodClass superPrototype.\x0a\x09parent ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x0a\x09methodBlock := (parent at: aString)\x0a\x09\x09ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x09\x0a\x09^ methodBlock applyTo: anObject arguments: aMessage arguments",
  47440. referencedClasses: [],
  47441. pragmas: [],
  47442. messageSends: ["superPrototype", "methodClass", "method", "context", "ifNil:", "messageNotUnderstood:receiver:", "at:", "applyTo:arguments:", "arguments"]
  47443. }, function ($methodClass){ return function (aString,aMessage,anObject){
  47444. var self=this,$self=this;
  47445. var methodBlock,parent;
  47446. return $core.withContext(function($ctx1) {
  47447. var $1,$2;
  47448. parent=$recv($recv($recv($self._context())._method())._methodClass())._superPrototype();
  47449. $1=parent;
  47450. if($1 == null || $1.a$nil){
  47451. return [$self._messageNotUnderstood_receiver_(aMessage,anObject)
  47452. ,$ctx1.sendIdx["messageNotUnderstood:receiver:"]=1
  47453. ][0];
  47454. } else {
  47455. $1;
  47456. }
  47457. $2=$recv(parent)._at_(aString);
  47458. if($2 == null || $2.a$nil){
  47459. return $self._messageNotUnderstood_receiver_(aMessage,anObject);
  47460. } else {
  47461. methodBlock=$2;
  47462. }
  47463. return $recv(methodBlock)._applyTo_arguments_(anObject,$recv(aMessage)._arguments());
  47464. }, function($ctx1) {$ctx1.fill(self,"sendJavaScript:superMessage:to:",{aString:aString,aMessage:aMessage,anObject:anObject,methodBlock:methodBlock,parent:parent})});
  47465. }; }),
  47466. $globals.ASTInterpreter);
  47467. $core.addMethod(
  47468. $core.method({
  47469. selector: "sendSuperMessage:to:",
  47470. protocol: "private",
  47471. args: ["aMessage", "anObject"],
  47472. source: "sendSuperMessage: aMessage to: anObject\x0a\x09| method parent |\x0a\x09\x0a\x09parent := self context method methodClass superclass.\x0a\x09parent ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x0a\x09method := (parent lookupSelector: aMessage selector)\x0a\x09\x09ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x09\x0a\x09^ method sendTo: anObject arguments: aMessage arguments",
  47473. referencedClasses: [],
  47474. pragmas: [],
  47475. messageSends: ["superclass", "methodClass", "method", "context", "ifNil:", "messageNotUnderstood:receiver:", "lookupSelector:", "selector", "sendTo:arguments:", "arguments"]
  47476. }, function ($methodClass){ return function (aMessage,anObject){
  47477. var self=this,$self=this;
  47478. var method,parent;
  47479. return $core.withContext(function($ctx1) {
  47480. var $1,$2;
  47481. parent=$recv($recv($recv($self._context())._method())._methodClass())._superclass();
  47482. $1=parent;
  47483. if($1 == null || $1.a$nil){
  47484. return [$self._messageNotUnderstood_receiver_(aMessage,anObject)
  47485. ,$ctx1.sendIdx["messageNotUnderstood:receiver:"]=1
  47486. ][0];
  47487. } else {
  47488. $1;
  47489. }
  47490. $2=$recv(parent)._lookupSelector_($recv(aMessage)._selector());
  47491. if($2 == null || $2.a$nil){
  47492. return $self._messageNotUnderstood_receiver_(aMessage,anObject);
  47493. } else {
  47494. method=$2;
  47495. }
  47496. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  47497. }, function($ctx1) {$ctx1.fill(self,"sendSuperMessage:to:",{aMessage:aMessage,anObject:anObject,method:method,parent:parent})});
  47498. }; }),
  47499. $globals.ASTInterpreter);
  47500. $core.addMethod(
  47501. $core.method({
  47502. selector: "setNonLocalReturnFromContext:",
  47503. protocol: "interpreting",
  47504. args: ["aContext"],
  47505. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  47506. referencedClasses: [],
  47507. pragmas: [],
  47508. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  47509. }, function ($methodClass){ return function (aContext){
  47510. var self=this,$self=this;
  47511. return $core.withContext(function($ctx1) {
  47512. if($core.assert($recv([$recv(aContext)._interpreter()
  47513. ,$ctx1.sendIdx["interpreter"]=1
  47514. ][0])._hasReturned())){
  47515. $self.returned=true;
  47516. $self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  47517. }
  47518. return self;
  47519. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext})});
  47520. }; }),
  47521. $globals.ASTInterpreter);
  47522. $core.addMethod(
  47523. $core.method({
  47524. selector: "skip",
  47525. protocol: "interpreting",
  47526. args: [],
  47527. source: "skip\x0a\x09self next",
  47528. referencedClasses: [],
  47529. pragmas: [],
  47530. messageSends: ["next"]
  47531. }, function ($methodClass){ return function (){
  47532. var self=this,$self=this;
  47533. return $core.withContext(function($ctx1) {
  47534. $self._next();
  47535. return self;
  47536. }, function($ctx1) {$ctx1.fill(self,"skip",{})});
  47537. }; }),
  47538. $globals.ASTInterpreter);
  47539. $core.addMethod(
  47540. $core.method({
  47541. selector: "stack",
  47542. protocol: "accessing",
  47543. args: [],
  47544. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  47545. referencedClasses: ["OrderedCollection"],
  47546. pragmas: [],
  47547. messageSends: ["ifNil:", "new"]
  47548. }, function ($methodClass){ return function (){
  47549. var self=this,$self=this;
  47550. return $core.withContext(function($ctx1) {
  47551. var $1;
  47552. $1=$self.stack;
  47553. if($1 == null || $1.a$nil){
  47554. $self.stack=$recv($globals.OrderedCollection)._new();
  47555. return $self.stack;
  47556. } else {
  47557. return $1;
  47558. }
  47559. }, function($ctx1) {$ctx1.fill(self,"stack",{})});
  47560. }; }),
  47561. $globals.ASTInterpreter);
  47562. $core.addMethod(
  47563. $core.method({
  47564. selector: "step",
  47565. protocol: "interpreting",
  47566. args: [],
  47567. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  47568. referencedClasses: [],
  47569. pragmas: [],
  47570. messageSends: ["interpret", "next"]
  47571. }, function ($methodClass){ return function (){
  47572. var self=this,$self=this;
  47573. return $core.withContext(function($ctx1) {
  47574. $self._interpret();
  47575. $self._next();
  47576. return self;
  47577. }, function($ctx1) {$ctx1.fill(self,"step",{})});
  47578. }; }),
  47579. $globals.ASTInterpreter);
  47580. $core.addMethod(
  47581. $core.method({
  47582. selector: "stepOver",
  47583. protocol: "interpreting",
  47584. args: [],
  47585. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  47586. referencedClasses: [],
  47587. pragmas: [],
  47588. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  47589. }, function ($methodClass){ return function (){
  47590. var self=this,$self=this;
  47591. return $core.withContext(function($ctx1) {
  47592. [$self._step()
  47593. ,$ctx1.sendIdx["step"]=1
  47594. ][0];
  47595. $recv((function(){
  47596. return $core.withContext(function($ctx2) {
  47597. return $recv($recv([$self._node()
  47598. ,$ctx2.sendIdx["node"]=1
  47599. ][0])._isNil())._or_((function(){
  47600. return $core.withContext(function($ctx3) {
  47601. return $recv($self._node())._isSteppingNode();
  47602. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47603. }));
  47604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47605. }))._whileFalse_((function(){
  47606. return $core.withContext(function($ctx2) {
  47607. return $self._step();
  47608. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47609. }));
  47610. return self;
  47611. }, function($ctx1) {$ctx1.fill(self,"stepOver",{})});
  47612. }; }),
  47613. $globals.ASTInterpreter);
  47614. $core.addMethod(
  47615. $core.method({
  47616. selector: "visit:",
  47617. protocol: "visiting",
  47618. args: ["aNode"],
  47619. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  47620. referencedClasses: [],
  47621. pragmas: [],
  47622. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  47623. }, function ($methodClass){ return function (aNode){
  47624. var self=this,$self=this;
  47625. return $core.withContext(function($ctx1) {
  47626. if(!$core.assert($self._hasReturned())){
  47627. [(
  47628. $ctx1.supercall = true,
  47629. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visit_.call($self,aNode))
  47630. ,$ctx1.supercall = false
  47631. ][0];
  47632. }
  47633. return self;
  47634. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode})});
  47635. }; }),
  47636. $globals.ASTInterpreter);
  47637. $core.addMethod(
  47638. $core.method({
  47639. selector: "visitAssignmentNode:",
  47640. protocol: "visiting",
  47641. args: ["aNode"],
  47642. 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",
  47643. referencedClasses: [],
  47644. pragmas: [],
  47645. messageSends: ["pop", "push:", "assign:to:", "left"]
  47646. }, function ($methodClass){ return function (aNode){
  47647. var self=this,$self=this;
  47648. var poppedValue;
  47649. return $core.withContext(function($ctx1) {
  47650. poppedValue=[$self._pop()
  47651. ,$ctx1.sendIdx["pop"]=1
  47652. ][0];
  47653. $self._pop();
  47654. $self._push_(poppedValue);
  47655. $self._assign_to_($recv(aNode)._left(),poppedValue);
  47656. return self;
  47657. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue})});
  47658. }; }),
  47659. $globals.ASTInterpreter);
  47660. $core.addMethod(
  47661. $core.method({
  47662. selector: "visitBlockNode:",
  47663. protocol: "visiting",
  47664. args: ["aNode"],
  47665. 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",
  47666. referencedClasses: ["AIBlockClosure"],
  47667. pragmas: [],
  47668. messageSends: ["forContext:node:", "context", "push:"]
  47669. }, function ($methodClass){ return function (aNode){
  47670. var self=this,$self=this;
  47671. var block;
  47672. return $core.withContext(function($ctx1) {
  47673. block=$recv($globals.AIBlockClosure)._forContext_node_($self._context(),aNode);
  47674. $self._push_(block);
  47675. return self;
  47676. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block})});
  47677. }; }),
  47678. $globals.ASTInterpreter);
  47679. $core.addMethod(
  47680. $core.method({
  47681. selector: "visitBlockSequenceNode:",
  47682. protocol: "visiting",
  47683. args: ["aNode"],
  47684. 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",
  47685. referencedClasses: [],
  47686. pragmas: [],
  47687. messageSends: ["visitBlockSequenceNode:"]
  47688. }, function ($methodClass){ return function (aNode){
  47689. var self=this,$self=this;
  47690. return $core.withContext(function($ctx1) {
  47691. [(
  47692. $ctx1.supercall = true,
  47693. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.call($self,aNode))
  47694. ,$ctx1.supercall = false
  47695. ][0];
  47696. $self.forceAtEnd=true;
  47697. return self;
  47698. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode})});
  47699. }; }),
  47700. $globals.ASTInterpreter);
  47701. $core.addMethod(
  47702. $core.method({
  47703. selector: "visitDagNode:",
  47704. protocol: "visiting",
  47705. args: ["aNode"],
  47706. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  47707. referencedClasses: [],
  47708. pragmas: [],
  47709. messageSends: []
  47710. }, function ($methodClass){ return function (aNode){
  47711. var self=this,$self=this;
  47712. return self;
  47713. }; }),
  47714. $globals.ASTInterpreter);
  47715. $core.addMethod(
  47716. $core.method({
  47717. selector: "visitDynamicArrayNode:",
  47718. protocol: "visiting",
  47719. args: ["aNode"],
  47720. 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",
  47721. referencedClasses: [],
  47722. pragmas: [],
  47723. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  47724. }, function ($methodClass){ return function (aNode){
  47725. var self=this,$self=this;
  47726. var array;
  47727. return $core.withContext(function($ctx1) {
  47728. array=[];
  47729. $recv($recv(aNode)._dagChildren())._do_((function(each){
  47730. return $core.withContext(function($ctx2) {
  47731. return $recv(array)._addFirst_($self._pop());
  47732. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47733. }));
  47734. $self._push_(array);
  47735. return self;
  47736. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array})});
  47737. }; }),
  47738. $globals.ASTInterpreter);
  47739. $core.addMethod(
  47740. $core.method({
  47741. selector: "visitDynamicDictionaryNode:",
  47742. protocol: "visiting",
  47743. args: ["aNode"],
  47744. 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)",
  47745. referencedClasses: ["OrderedCollection", "HashedCollection"],
  47746. pragmas: [],
  47747. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  47748. }, function ($methodClass){ return function (aNode){
  47749. var self=this,$self=this;
  47750. var keyValueList;
  47751. return $core.withContext(function($ctx1) {
  47752. keyValueList=$recv($globals.OrderedCollection)._new();
  47753. $recv($recv(aNode)._dagChildren())._do_((function(each){
  47754. return $core.withContext(function($ctx2) {
  47755. return $recv(keyValueList)._add_($self._pop());
  47756. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47757. }));
  47758. $self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  47759. return self;
  47760. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList})});
  47761. }; }),
  47762. $globals.ASTInterpreter);
  47763. $core.addMethod(
  47764. $core.method({
  47765. selector: "visitJSStatementNode:",
  47766. protocol: "visiting",
  47767. args: ["aNode"],
  47768. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  47769. referencedClasses: [],
  47770. pragmas: [],
  47771. messageSends: ["returnValue:", "eval:", "source"]
  47772. }, function ($methodClass){ return function (aNode){
  47773. var self=this,$self=this;
  47774. return $core.withContext(function($ctx1) {
  47775. $self.returned=true;
  47776. $self._returnValue_($self._eval_($recv(aNode)._source()));
  47777. return self;
  47778. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode})});
  47779. }; }),
  47780. $globals.ASTInterpreter);
  47781. $core.addMethod(
  47782. $core.method({
  47783. selector: "visitReturnNode:",
  47784. protocol: "visiting",
  47785. args: ["aNode"],
  47786. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  47787. referencedClasses: [],
  47788. pragmas: [],
  47789. messageSends: ["returnValue:", "pop"]
  47790. }, function ($methodClass){ return function (aNode){
  47791. var self=this,$self=this;
  47792. return $core.withContext(function($ctx1) {
  47793. $self.returned=true;
  47794. $self._returnValue_($self._pop());
  47795. return self;
  47796. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode})});
  47797. }; }),
  47798. $globals.ASTInterpreter);
  47799. $core.addMethod(
  47800. $core.method({
  47801. selector: "visitSendNode:",
  47802. protocol: "visiting",
  47803. args: ["aNode"],
  47804. 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 := aNode superSend\x0a\x09\x09ifFalse: [ message sendTo: receiver ]\x0a\x09\x09ifTrue: [ aNode receiver binding isJavaScriptSuper\x0a\x09\x09\x09ifFalse: [ self sendSuperMessage: message to: receiver ]\x0a\x09\x09\x09ifTrue: [ aNode argumentSwitcher\x0a\x09\x09\x09\x09ifNil: [ self sendJavaScript: aNode javaScriptSelector superMessage: message to: receiver ]\x0a\x09\x09\x09\x09ifNotNil: [ :switcher | self sendJavaScript: aNode javaScriptSelector superMessage: message switcher: switcher to: receiver ] ] ].\x0a\x09\x0a\x09\x22For cascade sends, push the reciever if the send is not the last one\x22\x0a\x09aNode isSideEffect ifFalse: [ self pop; push: result ]",
  47805. referencedClasses: [],
  47806. pragmas: [],
  47807. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "ifFalse:ifTrue:", "superSend", "sendTo:", "isJavaScriptSuper", "binding", "receiver", "sendSuperMessage:to:", "ifNil:ifNotNil:", "argumentSwitcher", "sendJavaScript:superMessage:to:", "javaScriptSelector", "sendJavaScript:superMessage:switcher:to:", "ifFalse:", "isSideEffect", "push:"]
  47808. }, function ($methodClass){ return function (aNode){
  47809. var self=this,$self=this;
  47810. var receiver,args,message,result;
  47811. return $core.withContext(function($ctx1) {
  47812. var $1;
  47813. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  47814. return $core.withContext(function($ctx2) {
  47815. return [$self._pop()
  47816. ,$ctx2.sendIdx["pop"]=1
  47817. ][0];
  47818. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47819. }));
  47820. receiver=$self._peek();
  47821. message=$self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  47822. if($core.assert($recv(aNode)._superSend())){
  47823. if($core.assert($recv($recv($recv(aNode)._receiver())._binding())._isJavaScriptSuper())){
  47824. $1=$recv(aNode)._argumentSwitcher();
  47825. if($1 == null || $1.a$nil){
  47826. result=$self._sendJavaScript_superMessage_to_([$recv(aNode)._javaScriptSelector()
  47827. ,$ctx1.sendIdx["javaScriptSelector"]=1
  47828. ][0],message,receiver);
  47829. } else {
  47830. var switcher;
  47831. switcher=$1;
  47832. result=$self._sendJavaScript_superMessage_switcher_to_($recv(aNode)._javaScriptSelector(),message,switcher,receiver);
  47833. }
  47834. } else {
  47835. result=$self._sendSuperMessage_to_(message,receiver);
  47836. }
  47837. } else {
  47838. result=$recv(message)._sendTo_(receiver);
  47839. }
  47840. if(!$core.assert($recv(aNode)._isSideEffect())){
  47841. $self._pop();
  47842. $self._push_(result);
  47843. }
  47844. return self;
  47845. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result})});
  47846. }; }),
  47847. $globals.ASTInterpreter);
  47848. $core.addMethod(
  47849. $core.method({
  47850. selector: "visitValueNode:",
  47851. protocol: "visiting",
  47852. args: ["aNode"],
  47853. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  47854. referencedClasses: [],
  47855. pragmas: [],
  47856. messageSends: ["push:", "value"]
  47857. }, function ($methodClass){ return function (aNode){
  47858. var self=this,$self=this;
  47859. return $core.withContext(function($ctx1) {
  47860. $self._push_($recv(aNode)._value());
  47861. return self;
  47862. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode})});
  47863. }; }),
  47864. $globals.ASTInterpreter);
  47865. $core.addMethod(
  47866. $core.method({
  47867. selector: "visitVariableNode:",
  47868. protocol: "visiting",
  47869. args: ["aNode"],
  47870. source: "visitVariableNode: aNode\x0a\x09self push: (aNode binding inContext: self context)",
  47871. referencedClasses: [],
  47872. pragmas: [],
  47873. messageSends: ["push:", "inContext:", "binding", "context"]
  47874. }, function ($methodClass){ return function (aNode){
  47875. var self=this,$self=this;
  47876. return $core.withContext(function($ctx1) {
  47877. $self._push_($recv($recv(aNode)._binding())._inContext_($self._context()));
  47878. return self;
  47879. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode})});
  47880. }; }),
  47881. $globals.ASTInterpreter);
  47882. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  47883. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  47884. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  47885. $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`";
  47886. $core.addMethod(
  47887. $core.method({
  47888. selector: "currentNode",
  47889. protocol: "accessing",
  47890. args: [],
  47891. source: "currentNode\x0a\x09^ currentNode",
  47892. referencedClasses: [],
  47893. pragmas: [],
  47894. messageSends: []
  47895. }, function ($methodClass){ return function (){
  47896. var self=this,$self=this;
  47897. return $self.currentNode;
  47898. }; }),
  47899. $globals.ASTPCNodeVisitor);
  47900. $core.addMethod(
  47901. $core.method({
  47902. selector: "increaseTrackedIndex",
  47903. protocol: "accessing",
  47904. args: [],
  47905. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  47906. referencedClasses: [],
  47907. pragmas: [],
  47908. messageSends: ["+", "trackedIndex"]
  47909. }, function ($methodClass){ return function (){
  47910. var self=this,$self=this;
  47911. return $core.withContext(function($ctx1) {
  47912. $self.trackedIndex=$recv($self._trackedIndex()).__plus((1));
  47913. return self;
  47914. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{})});
  47915. }; }),
  47916. $globals.ASTPCNodeVisitor);
  47917. $core.addMethod(
  47918. $core.method({
  47919. selector: "index",
  47920. protocol: "accessing",
  47921. args: [],
  47922. source: "index\x0a\x09^ index",
  47923. referencedClasses: [],
  47924. pragmas: [],
  47925. messageSends: []
  47926. }, function ($methodClass){ return function (){
  47927. var self=this,$self=this;
  47928. return $self.index;
  47929. }; }),
  47930. $globals.ASTPCNodeVisitor);
  47931. $core.addMethod(
  47932. $core.method({
  47933. selector: "index:",
  47934. protocol: "accessing",
  47935. args: ["aNumber"],
  47936. source: "index: aNumber\x0a\x09index := aNumber",
  47937. referencedClasses: [],
  47938. pragmas: [],
  47939. messageSends: []
  47940. }, function ($methodClass){ return function (aNumber){
  47941. var self=this,$self=this;
  47942. $self.index=aNumber;
  47943. return self;
  47944. }; }),
  47945. $globals.ASTPCNodeVisitor);
  47946. $core.addMethod(
  47947. $core.method({
  47948. selector: "selector",
  47949. protocol: "accessing",
  47950. args: [],
  47951. source: "selector\x0a\x09^ selector",
  47952. referencedClasses: [],
  47953. pragmas: [],
  47954. messageSends: []
  47955. }, function ($methodClass){ return function (){
  47956. var self=this,$self=this;
  47957. return $self.selector;
  47958. }; }),
  47959. $globals.ASTPCNodeVisitor);
  47960. $core.addMethod(
  47961. $core.method({
  47962. selector: "selector:",
  47963. protocol: "accessing",
  47964. args: ["aString"],
  47965. source: "selector: aString\x0a\x09selector := aString",
  47966. referencedClasses: [],
  47967. pragmas: [],
  47968. messageSends: []
  47969. }, function ($methodClass){ return function (aString){
  47970. var self=this,$self=this;
  47971. $self.selector=aString;
  47972. return self;
  47973. }; }),
  47974. $globals.ASTPCNodeVisitor);
  47975. $core.addMethod(
  47976. $core.method({
  47977. selector: "trackedIndex",
  47978. protocol: "accessing",
  47979. args: [],
  47980. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  47981. referencedClasses: [],
  47982. pragmas: [],
  47983. messageSends: ["ifNil:"]
  47984. }, function ($methodClass){ return function (){
  47985. var self=this,$self=this;
  47986. return $core.withContext(function($ctx1) {
  47987. var $1;
  47988. $1=$self.trackedIndex;
  47989. if($1 == null || $1.a$nil){
  47990. $self.trackedIndex=(0);
  47991. return $self.trackedIndex;
  47992. } else {
  47993. return $1;
  47994. }
  47995. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{})});
  47996. }; }),
  47997. $globals.ASTPCNodeVisitor);
  47998. $core.addMethod(
  47999. $core.method({
  48000. selector: "visitJSStatementNode:",
  48001. protocol: "visiting",
  48002. args: ["aNode"],
  48003. 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",
  48004. referencedClasses: [],
  48005. pragmas: [],
  48006. messageSends: []
  48007. }, function ($methodClass){ return function (aNode){
  48008. var self=this,$self=this;
  48009. $self.currentNode=aNode;
  48010. return self;
  48011. }; }),
  48012. $globals.ASTPCNodeVisitor);
  48013. $core.addMethod(
  48014. $core.method({
  48015. selector: "visitSendNode:",
  48016. protocol: "visiting",
  48017. args: ["aNode"],
  48018. 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 ]",
  48019. referencedClasses: [],
  48020. pragmas: [],
  48021. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  48022. }, function ($methodClass){ return function (aNode){
  48023. var self=this,$self=this;
  48024. return $core.withContext(function($ctx1) {
  48025. [(
  48026. $ctx1.supercall = true,
  48027. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.call($self,aNode))
  48028. ,$ctx1.supercall = false
  48029. ][0];
  48030. if($core.assert([$recv([$self._selector()
  48031. ,$ctx1.sendIdx["selector"]=1
  48032. ][0]).__eq($recv(aNode)._selector())
  48033. ,$ctx1.sendIdx["="]=1
  48034. ][0])){
  48035. if($core.assert($recv($self._trackedIndex()).__eq($self._index()))){
  48036. $self.currentNode=aNode;
  48037. $self.currentNode;
  48038. }
  48039. $self._increaseTrackedIndex();
  48040. }
  48041. return self;
  48042. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode})});
  48043. }; }),
  48044. $globals.ASTPCNodeVisitor);
  48045. $core.setTraitComposition([{trait: $globals.TMethodContext}], $globals.AIContext);
  48046. $core.addMethod(
  48047. $core.method({
  48048. selector: "isSteppingNode",
  48049. protocol: "*Compiler-Interpreter",
  48050. args: [],
  48051. source: "isSteppingNode\x0a\x09^ false",
  48052. referencedClasses: [],
  48053. pragmas: [],
  48054. messageSends: []
  48055. }, function ($methodClass){ return function (){
  48056. var self=this,$self=this;
  48057. return false;
  48058. }; }),
  48059. $globals.ASTNode);
  48060. $core.addMethod(
  48061. $core.method({
  48062. selector: "nextSiblingNode:",
  48063. protocol: "*Compiler-Interpreter",
  48064. args: ["aNode"],
  48065. 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 ]",
  48066. referencedClasses: [],
  48067. pragmas: [],
  48068. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  48069. }, function ($methodClass){ return function (aNode){
  48070. var self=this,$self=this;
  48071. return $core.withContext(function($ctx1) {
  48072. return $recv([$self._dagChildren()
  48073. ,$ctx1.sendIdx["dagChildren"]=1
  48074. ][0])._at_ifAbsent_($recv($recv($self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  48075. return nil;
  48076. }));
  48077. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode})});
  48078. }; }),
  48079. $globals.ASTNode);
  48080. $core.addMethod(
  48081. $core.method({
  48082. selector: "inContext:",
  48083. protocol: "*Compiler-Interpreter",
  48084. args: ["aContext"],
  48085. source: "inContext: aContext\x0a\x09self error: 'Alias variable is internal, it should never appear in normal variable context.'",
  48086. referencedClasses: [],
  48087. pragmas: [],
  48088. messageSends: ["error:"]
  48089. }, function ($methodClass){ return function (aContext){
  48090. var self=this,$self=this;
  48091. return $core.withContext(function($ctx1) {
  48092. $self._error_("Alias variable is internal, it should never appear in normal variable context.");
  48093. return self;
  48094. }, function($ctx1) {$ctx1.fill(self,"inContext:",{aContext:aContext})});
  48095. }; }),
  48096. $globals.AliasVar);
  48097. $core.addMethod(
  48098. $core.method({
  48099. selector: "isSteppingNode",
  48100. protocol: "*Compiler-Interpreter",
  48101. args: [],
  48102. source: "isSteppingNode\x0a\x09^ true",
  48103. referencedClasses: [],
  48104. pragmas: [],
  48105. messageSends: []
  48106. }, function ($methodClass){ return function (){
  48107. var self=this,$self=this;
  48108. return true;
  48109. }; }),
  48110. $globals.AssignmentNode);
  48111. $core.addMethod(
  48112. $core.method({
  48113. selector: "isSteppingNode",
  48114. protocol: "*Compiler-Interpreter",
  48115. args: [],
  48116. source: "isSteppingNode\x0a\x09^ true",
  48117. referencedClasses: [],
  48118. pragmas: [],
  48119. messageSends: []
  48120. }, function ($methodClass){ return function (){
  48121. var self=this,$self=this;
  48122. return true;
  48123. }; }),
  48124. $globals.BlockNode);
  48125. $core.addMethod(
  48126. $core.method({
  48127. selector: "nextSiblingNode:",
  48128. protocol: "*Compiler-Interpreter",
  48129. args: ["aNode"],
  48130. 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",
  48131. referencedClasses: [],
  48132. pragmas: [],
  48133. messageSends: []
  48134. }, function ($methodClass){ return function (aNode){
  48135. var self=this,$self=this;
  48136. return nil;
  48137. }; }),
  48138. $globals.BlockNode);
  48139. $core.addMethod(
  48140. $core.method({
  48141. selector: "inContext:",
  48142. protocol: "*Compiler-Interpreter",
  48143. args: ["aContext"],
  48144. source: "inContext: aContext\x0a\x09^ Smalltalk globals \x0a\x09\x09at: self name \x0a\x09\x09ifAbsent: [ Platform globals at: self name ]",
  48145. referencedClasses: ["Smalltalk", "Platform"],
  48146. pragmas: [],
  48147. messageSends: ["at:ifAbsent:", "globals", "name", "at:"]
  48148. }, function ($methodClass){ return function (aContext){
  48149. var self=this,$self=this;
  48150. return $core.withContext(function($ctx1) {
  48151. return $recv([$recv($globals.Smalltalk)._globals()
  48152. ,$ctx1.sendIdx["globals"]=1
  48153. ][0])._at_ifAbsent_([$self._name()
  48154. ,$ctx1.sendIdx["name"]=1
  48155. ][0],(function(){
  48156. return $core.withContext(function($ctx2) {
  48157. return $recv($recv($globals.Platform)._globals())._at_($self._name());
  48158. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48159. }));
  48160. }, function($ctx1) {$ctx1.fill(self,"inContext:",{aContext:aContext})});
  48161. }; }),
  48162. $globals.ClassRefVar);
  48163. $core.addMethod(
  48164. $core.method({
  48165. selector: "isSteppingNode",
  48166. protocol: "*Compiler-Interpreter",
  48167. args: [],
  48168. source: "isSteppingNode\x0a\x09^ true",
  48169. referencedClasses: [],
  48170. pragmas: [],
  48171. messageSends: []
  48172. }, function ($methodClass){ return function (){
  48173. var self=this,$self=this;
  48174. return true;
  48175. }; }),
  48176. $globals.DynamicArrayNode);
  48177. $core.addMethod(
  48178. $core.method({
  48179. selector: "isSteppingNode",
  48180. protocol: "*Compiler-Interpreter",
  48181. args: [],
  48182. source: "isSteppingNode\x0a\x09^ true",
  48183. referencedClasses: [],
  48184. pragmas: [],
  48185. messageSends: []
  48186. }, function ($methodClass){ return function (){
  48187. var self=this,$self=this;
  48188. return true;
  48189. }; }),
  48190. $globals.DynamicDictionaryNode);
  48191. $core.addMethod(
  48192. $core.method({
  48193. selector: "evaluate:context:",
  48194. protocol: "*Compiler-Interpreter",
  48195. args: ["aString", "aContext"],
  48196. 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",
  48197. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  48198. pragmas: [],
  48199. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  48200. }, function ($methodClass){ return function (aString,aContext){
  48201. var self=this,$self=this;
  48202. var compiler,ast;
  48203. return $core.withContext(function($ctx1) {
  48204. var $1;
  48205. var $early={};
  48206. try {
  48207. compiler=$recv($globals.Compiler)._new();
  48208. $recv((function(){
  48209. return $core.withContext(function($ctx2) {
  48210. ast=$recv(compiler)._parseExpression_(aString);
  48211. return ast;
  48212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48213. }))._on_do_($globals.Error,(function(ex){
  48214. return $core.withContext(function($ctx2) {
  48215. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  48216. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  48217. }));
  48218. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  48219. $recv($1)._context_(aContext);
  48220. $recv($1)._visit_(ast);
  48221. return $recv(aContext)._evaluateNode_(ast);
  48222. }
  48223. catch(e) {if(e===$early)return e[0]; throw e}
  48224. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast})});
  48225. }; }),
  48226. $globals.Evaluator);
  48227. $core.addMethod(
  48228. $core.method({
  48229. selector: "inContext:",
  48230. protocol: "*Compiler-Interpreter",
  48231. args: ["aContext"],
  48232. source: "inContext: aContext\x0a\x09^ Platform globals at: self name ifAbsent: [ self error: 'Unknown variable' ]",
  48233. referencedClasses: ["Platform"],
  48234. pragmas: [],
  48235. messageSends: ["at:ifAbsent:", "globals", "name", "error:"]
  48236. }, function ($methodClass){ return function (aContext){
  48237. var self=this,$self=this;
  48238. return $core.withContext(function($ctx1) {
  48239. return $recv($recv($globals.Platform)._globals())._at_ifAbsent_($self._name(),(function(){
  48240. return $core.withContext(function($ctx2) {
  48241. return $self._error_("Unknown variable");
  48242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48243. }));
  48244. }, function($ctx1) {$ctx1.fill(self,"inContext:",{aContext:aContext})});
  48245. }; }),
  48246. $globals.ExternallyKnownVar);
  48247. $core.addMethod(
  48248. $core.method({
  48249. selector: "inContext:",
  48250. protocol: "*Compiler-Interpreter",
  48251. args: ["aContext"],
  48252. source: "inContext: aContext\x0a\x09^ aContext receiver instVarNamed: self name",
  48253. referencedClasses: [],
  48254. pragmas: [],
  48255. messageSends: ["instVarNamed:", "receiver", "name"]
  48256. }, function ($methodClass){ return function (aContext){
  48257. var self=this,$self=this;
  48258. return $core.withContext(function($ctx1) {
  48259. return $recv($recv(aContext)._receiver())._instVarNamed_($self._name());
  48260. }, function($ctx1) {$ctx1.fill(self,"inContext:",{aContext:aContext})});
  48261. }; }),
  48262. $globals.InstanceVar);
  48263. $core.addMethod(
  48264. $core.method({
  48265. selector: "inContext:put:",
  48266. protocol: "*Compiler-Interpreter",
  48267. args: ["aContext", "anObject"],
  48268. source: "inContext: aContext put: anObject\x0a\x09aContext receiver instVarNamed: self name put: anObject",
  48269. referencedClasses: [],
  48270. pragmas: [],
  48271. messageSends: ["instVarNamed:put:", "receiver", "name"]
  48272. }, function ($methodClass){ return function (aContext,anObject){
  48273. var self=this,$self=this;
  48274. return $core.withContext(function($ctx1) {
  48275. $recv($recv(aContext)._receiver())._instVarNamed_put_($self._name(),anObject);
  48276. return self;
  48277. }, function($ctx1) {$ctx1.fill(self,"inContext:put:",{aContext:aContext,anObject:anObject})});
  48278. }; }),
  48279. $globals.InstanceVar);
  48280. $core.addMethod(
  48281. $core.method({
  48282. selector: "isSteppingNode",
  48283. protocol: "*Compiler-Interpreter",
  48284. args: [],
  48285. source: "isSteppingNode\x0a\x09^ true",
  48286. referencedClasses: [],
  48287. pragmas: [],
  48288. messageSends: []
  48289. }, function ($methodClass){ return function (){
  48290. var self=this,$self=this;
  48291. return true;
  48292. }; }),
  48293. $globals.JSStatementNode);
  48294. $core.addMethod(
  48295. $core.method({
  48296. selector: "isJavaScriptSuper",
  48297. protocol: "*Compiler-Interpreter",
  48298. args: [],
  48299. source: "isJavaScriptSuper\x0a\x09^ true",
  48300. referencedClasses: [],
  48301. pragmas: [],
  48302. messageSends: []
  48303. }, function ($methodClass){ return function (){
  48304. var self=this,$self=this;
  48305. return true;
  48306. }; }),
  48307. $globals.JavaScriptSuperVar);
  48308. $core.addMethod(
  48309. $core.method({
  48310. selector: "inContext:",
  48311. protocol: "*Compiler-Interpreter",
  48312. args: ["aContext"],
  48313. source: "inContext: aContext\x0a\x09^ #{'nil'->nil. 'true'->true. 'false'->false}\x0a\x09\x09at: self name\x0a\x09\x09ifAbsent: [ super inContext: aContext ]",
  48314. referencedClasses: [],
  48315. pragmas: [],
  48316. messageSends: ["at:ifAbsent:", "name", "inContext:"]
  48317. }, function ($methodClass){ return function (aContext){
  48318. var self=this,$self=this;
  48319. return $core.withContext(function($ctx1) {
  48320. return $recv($globals.HashedCollection._newFromPairs_(["nil",nil,"true",true,"false",false]))._at_ifAbsent_($self._name(),(function(){
  48321. return $core.withContext(function($ctx2) {
  48322. return [(
  48323. $ctx2.supercall = true,
  48324. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._inContext_.call($self,aContext))
  48325. ,$ctx2.supercall = false
  48326. ][0];
  48327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48328. }));
  48329. }, function($ctx1) {$ctx1.fill(self,"inContext:",{aContext:aContext})});
  48330. }; }),
  48331. $globals.PseudoVar);
  48332. $core.addMethod(
  48333. $core.method({
  48334. selector: "inContext:",
  48335. protocol: "*Compiler-Interpreter",
  48336. args: ["aContext"],
  48337. source: "inContext: aContext\x0a\x09^ aContext localAt: self name",
  48338. referencedClasses: [],
  48339. pragmas: [],
  48340. messageSends: ["localAt:", "name"]
  48341. }, function ($methodClass){ return function (aContext){
  48342. var self=this,$self=this;
  48343. return $core.withContext(function($ctx1) {
  48344. return $recv(aContext)._localAt_($self._name());
  48345. }, function($ctx1) {$ctx1.fill(self,"inContext:",{aContext:aContext})});
  48346. }; }),
  48347. $globals.ScopeVar);
  48348. $core.addMethod(
  48349. $core.method({
  48350. selector: "inContext:put:",
  48351. protocol: "*Compiler-Interpreter",
  48352. args: ["aContext", "anObject"],
  48353. source: "inContext: aContext put: anObject\x0a\x09self error: 'Non-assignable variables should not be changed.'",
  48354. referencedClasses: [],
  48355. pragmas: [],
  48356. messageSends: ["error:"]
  48357. }, function ($methodClass){ return function (aContext,anObject){
  48358. var self=this,$self=this;
  48359. return $core.withContext(function($ctx1) {
  48360. $self._error_("Non-assignable variables should not be changed.");
  48361. return self;
  48362. }, function($ctx1) {$ctx1.fill(self,"inContext:put:",{aContext:aContext,anObject:anObject})});
  48363. }; }),
  48364. $globals.ScopeVar);
  48365. $core.addMethod(
  48366. $core.method({
  48367. selector: "isSteppingNode",
  48368. protocol: "*Compiler-Interpreter",
  48369. args: [],
  48370. source: "isSteppingNode\x0a\x09^ true",
  48371. referencedClasses: [],
  48372. pragmas: [],
  48373. messageSends: []
  48374. }, function ($methodClass){ return function (){
  48375. var self=this,$self=this;
  48376. return true;
  48377. }; }),
  48378. $globals.SendNode);
  48379. $core.addMethod(
  48380. $core.method({
  48381. selector: "inContext:",
  48382. protocol: "*Compiler-Interpreter",
  48383. args: ["aContext"],
  48384. source: "inContext: aContext\x0a\x09^ aContext localAt: 'self'",
  48385. referencedClasses: [],
  48386. pragmas: [],
  48387. messageSends: ["localAt:"]
  48388. }, function ($methodClass){ return function (aContext){
  48389. var self=this,$self=this;
  48390. return $core.withContext(function($ctx1) {
  48391. return $recv(aContext)._localAt_("self");
  48392. }, function($ctx1) {$ctx1.fill(self,"inContext:",{aContext:aContext})});
  48393. }; }),
  48394. $globals.SuperVar);
  48395. $core.addMethod(
  48396. $core.method({
  48397. selector: "isJavaScriptSuper",
  48398. protocol: "*Compiler-Interpreter",
  48399. args: [],
  48400. source: "isJavaScriptSuper\x0a\x09^ false",
  48401. referencedClasses: [],
  48402. pragmas: [],
  48403. messageSends: []
  48404. }, function ($methodClass){ return function (){
  48405. var self=this,$self=this;
  48406. return false;
  48407. }; }),
  48408. $globals.SuperVar);
  48409. $core.addMethod(
  48410. $core.method({
  48411. selector: "inContext:put:",
  48412. protocol: "*Compiler-Interpreter",
  48413. args: ["aContext", "anObject"],
  48414. source: "inContext: aContext put: anObject\x0a\x09aContext localAt: self name put: anObject",
  48415. referencedClasses: [],
  48416. pragmas: [],
  48417. messageSends: ["localAt:put:", "name"]
  48418. }, function ($methodClass){ return function (aContext,anObject){
  48419. var self=this,$self=this;
  48420. return $core.withContext(function($ctx1) {
  48421. $recv(aContext)._localAt_put_($self._name(),anObject);
  48422. return self;
  48423. }, function($ctx1) {$ctx1.fill(self,"inContext:put:",{aContext:aContext,anObject:anObject})});
  48424. }; }),
  48425. $globals.TempVar);
  48426. });
  48427. define('amber/lang',[
  48428. './deploy',
  48429. './boot', // pre-fetch, dep of ./helpers
  48430. './helpers', // pre-fetch, dep of ./deploy
  48431. './parser',
  48432. // --- packages for the Amber reflection begin here ---
  48433. 'amber/core/Platform-ImportExport',
  48434. 'amber/core/Compiler-Core',
  48435. 'amber/core/Compiler-AST',
  48436. 'amber/core/Compiler-Semantic',
  48437. 'amber/core/Compiler-IR',
  48438. 'amber/core/Compiler-Inlining',
  48439. 'amber/core/Compiler-Interpreter'
  48440. // --- packages for the Amber reflection end here ---
  48441. ], function (amber) {
  48442. return amber;
  48443. });
  48444. define('amber/core/Platform-DOM',["amber/boot", "require", "amber/core/Kernel-Collections", "amber/core/Kernel-Infrastructure", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  48445. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  48446. var $pkg = $core.addPackage("Platform-DOM");
  48447. $pkg.innerEval = function (expr) { return eval(expr); };
  48448. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  48449. $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM");
  48450. $core.addMethod(
  48451. $core.method({
  48452. selector: "isDomNode:",
  48453. protocol: "testing",
  48454. args: ["anObject"],
  48455. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  48456. referencedClasses: [],
  48457. pragmas: [["inlineJS:", ["\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22"]]],
  48458. messageSends: []
  48459. }, function ($methodClass){ return function (anObject){
  48460. var self=this,$self=this;
  48461. return $core.withContext(function($ctx1) {
  48462. return anObject.nodeType > 0 &&
  48463. Object.prototype.toString.call(anObject) !== "[object Object]";
  48464. return self;
  48465. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject})});
  48466. }; }),
  48467. $globals.PlatformDom.a$cls);
  48468. $core.addMethod(
  48469. $core.method({
  48470. selector: "isFeasible",
  48471. protocol: "testing",
  48472. args: [],
  48473. 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'>",
  48474. referencedClasses: [],
  48475. pragmas: [["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 }"]]],
  48476. messageSends: []
  48477. }, function ($methodClass){ return function (){
  48478. var self=this,$self=this;
  48479. return $core.withContext(function($ctx1) {
  48480. if (typeof document === "undefined") return false;
  48481. try {
  48482. var d = document.createElement("div"),
  48483. f = document.createDocumentFragment(),
  48484. t = document.createTextNode("Hello, Amber!");
  48485. f.appendChild(t);
  48486. d.insertBefore(f, null);
  48487. return d.innerHTML === "Hello, Amber!";
  48488. } catch (e) {
  48489. return false;
  48490. };
  48491. return self;
  48492. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{})});
  48493. }; }),
  48494. $globals.PlatformDom.a$cls);
  48495. $core.addMethod(
  48496. $core.method({
  48497. selector: "newCustomEvent:detail:",
  48498. protocol: "creation",
  48499. args: ["aString", "anObject"],
  48500. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  48501. referencedClasses: [],
  48502. pragmas: [["inlineJS:", ["return new CustomEvent(aString, {detail: anObject})"]]],
  48503. messageSends: []
  48504. }, function ($methodClass){ return function (aString,anObject){
  48505. var self=this,$self=this;
  48506. return $core.withContext(function($ctx1) {
  48507. return new CustomEvent(aString, {detail: anObject});
  48508. return self;
  48509. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject})});
  48510. }; }),
  48511. $globals.PlatformDom.a$cls);
  48512. $core.addMethod(
  48513. $core.method({
  48514. selector: "toArray:",
  48515. protocol: "converting",
  48516. args: ["aDomList"],
  48517. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  48518. referencedClasses: [],
  48519. pragmas: [["inlineJS:", ["return Array.prototype.slice.call(aDomList)"]]],
  48520. messageSends: []
  48521. }, function ($methodClass){ return function (aDomList){
  48522. var self=this,$self=this;
  48523. return $core.withContext(function($ctx1) {
  48524. return Array.prototype.slice.call(aDomList);
  48525. return self;
  48526. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList})});
  48527. }; }),
  48528. $globals.PlatformDom.a$cls);
  48529. $core.addMethod(
  48530. $core.method({
  48531. selector: "asDomNode",
  48532. protocol: "*Platform-DOM",
  48533. args: [],
  48534. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  48535. referencedClasses: [],
  48536. pragmas: [],
  48537. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  48538. }, function ($methodClass){ return function (){
  48539. var self=this,$self=this;
  48540. var fragment;
  48541. return $core.withContext(function($ctx1) {
  48542. fragment=$recv(document)._createDocumentFragment();
  48543. $self._do_((function(each){
  48544. return $core.withContext(function($ctx2) {
  48545. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  48546. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48547. }));
  48548. return fragment;
  48549. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment})});
  48550. }; }),
  48551. $globals.Collection);
  48552. $core.addMethod(
  48553. $core.method({
  48554. selector: "asDomNode",
  48555. protocol: "*Platform-DOM",
  48556. args: [],
  48557. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  48558. referencedClasses: ["PlatformDom"],
  48559. pragmas: [],
  48560. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  48561. }, function ($methodClass){ return function (){
  48562. var self=this,$self=this;
  48563. return $core.withContext(function($ctx1) {
  48564. if($core.assert($recv($globals.PlatformDom)._isDomNode_($self.jsObject))){
  48565. return $self.jsObject;
  48566. } else {
  48567. return [(
  48568. $ctx1.supercall = true,
  48569. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._asDomNode.call($self))
  48570. ,$ctx1.supercall = false
  48571. ][0];
  48572. }
  48573. return self;
  48574. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{})});
  48575. }; }),
  48576. $globals.JSObjectProxy);
  48577. $core.addMethod(
  48578. $core.method({
  48579. selector: "asDomNode",
  48580. protocol: "*Platform-DOM",
  48581. args: [],
  48582. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  48583. referencedClasses: [],
  48584. pragmas: [],
  48585. messageSends: ["createTextNode:", "asString"]
  48586. }, function ($methodClass){ return function (){
  48587. var self=this,$self=this;
  48588. return $core.withContext(function($ctx1) {
  48589. return $recv(document)._createTextNode_($self._asString());
  48590. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{})});
  48591. }; }),
  48592. $globals.String);
  48593. $core.addMethod(
  48594. $core.method({
  48595. selector: "htmlTextContent",
  48596. protocol: "*Platform-DOM",
  48597. args: [],
  48598. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  48599. referencedClasses: [],
  48600. pragmas: [["inlineJS:", ["var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;"]]],
  48601. messageSends: []
  48602. }, function ($methodClass){ return function (){
  48603. var self=this,$self=this;
  48604. return $core.withContext(function($ctx1) {
  48605. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  48606. return self;
  48607. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{})});
  48608. }; }),
  48609. $globals.String);
  48610. });
  48611. define('amber/core/SUnit',["amber/boot", "require", "amber/core/Kernel-Classes", "amber/core/Kernel-Exceptions", "amber/core/Kernel-Infrastructure", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  48612. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  48613. var $pkg = $core.addPackage("SUnit");
  48614. $pkg.innerEval = function (expr) { return eval(expr); };
  48615. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  48616. $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
  48617. $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.";
  48618. $core.addMethod(
  48619. $core.method({
  48620. selector: "result",
  48621. protocol: "accessing",
  48622. args: [],
  48623. source: "result\x0a\x09^ result",
  48624. referencedClasses: [],
  48625. pragmas: [],
  48626. messageSends: []
  48627. }, function ($methodClass){ return function (){
  48628. var self=this,$self=this;
  48629. return $self.result;
  48630. }; }),
  48631. $globals.ResultAnnouncement);
  48632. $core.addMethod(
  48633. $core.method({
  48634. selector: "result:",
  48635. protocol: "accessing",
  48636. args: ["aTestResult"],
  48637. source: "result: aTestResult\x0a\x09result := aTestResult",
  48638. referencedClasses: [],
  48639. pragmas: [],
  48640. messageSends: []
  48641. }, function ($methodClass){ return function (aTestResult){
  48642. var self=this,$self=this;
  48643. $self.result=aTestResult;
  48644. return self;
  48645. }; }),
  48646. $globals.ResultAnnouncement);
  48647. $core.addClass("Teachable", $globals.Object, ["learnings"], "SUnit");
  48648. $globals.Teachable.comment="An object you can teach how to behave. Have a look at the \x0aclass side for an example.\x0a\x0aFor more infos have a look at: http://lists.squeakfoundation.org/pipermail/squeak-dev/2002-April/038170.html";
  48649. $core.addMethod(
  48650. $core.method({
  48651. selector: "acceptSend:",
  48652. protocol: "teaching",
  48653. args: ["aSymbol"],
  48654. source: "acceptSend: aSymbol\x0a\x0a\x09self whenSend: aSymbol return: self",
  48655. referencedClasses: [],
  48656. pragmas: [],
  48657. messageSends: ["whenSend:return:"]
  48658. }, function ($methodClass){ return function (aSymbol){
  48659. var self=this,$self=this;
  48660. return $core.withContext(function($ctx1) {
  48661. $self._whenSend_return_(aSymbol,self);
  48662. return self;
  48663. }, function($ctx1) {$ctx1.fill(self,"acceptSend:",{aSymbol:aSymbol})});
  48664. }; }),
  48665. $globals.Teachable);
  48666. $core.addMethod(
  48667. $core.method({
  48668. selector: "doesNotUnderstand:",
  48669. protocol: "private",
  48670. args: ["aMessage"],
  48671. source: "doesNotUnderstand: aMessage\x0a\x0a\x09| learning |\x0a\x09learning := self learnings \x0a\x09\x09at: aMessage selector \x0a\x09\x09ifAbsent:[ ^super doesNotUnderstand: aMessage ].\x0a\x09^ learning class == Association\x0a\x09\x09ifTrue: [learning value]\x0a\x09\x09ifFalse: [learning valueWithPossibleArguments: aMessage arguments]",
  48672. referencedClasses: ["Association"],
  48673. pragmas: [],
  48674. messageSends: ["at:ifAbsent:", "learnings", "selector", "doesNotUnderstand:", "ifTrue:ifFalse:", "==", "class", "value", "valueWithPossibleArguments:", "arguments"]
  48675. }, function ($methodClass){ return function (aMessage){
  48676. var self=this,$self=this;
  48677. var learning;
  48678. return $core.withContext(function($ctx1) {
  48679. var $early={};
  48680. try {
  48681. learning=$recv($self._learnings())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  48682. return $core.withContext(function($ctx2) {
  48683. throw $early=[[(
  48684. $ctx2.supercall = true,
  48685. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.call($self,aMessage))
  48686. ,$ctx2.supercall = false
  48687. ][0]];
  48688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48689. }));
  48690. if($core.assert($recv($recv(learning)._class()).__eq_eq($globals.Association))){
  48691. return $recv(learning)._value();
  48692. } else {
  48693. return $recv(learning)._valueWithPossibleArguments_($recv(aMessage)._arguments());
  48694. }
  48695. }
  48696. catch(e) {if(e===$early)return e[0]; throw e}
  48697. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage,learning:learning})});
  48698. }; }),
  48699. $globals.Teachable);
  48700. $core.addMethod(
  48701. $core.method({
  48702. selector: "learnings",
  48703. protocol: "private",
  48704. args: [],
  48705. source: "learnings\x0a\x0a\x09learnings isNil ifTrue: [learnings := Dictionary new].\x0a\x09^learnings",
  48706. referencedClasses: ["Dictionary"],
  48707. pragmas: [],
  48708. messageSends: ["ifTrue:", "isNil", "new"]
  48709. }, function ($methodClass){ return function (){
  48710. var self=this,$self=this;
  48711. return $core.withContext(function($ctx1) {
  48712. if($core.assert($recv($self.learnings)._isNil())){
  48713. $self.learnings=$recv($globals.Dictionary)._new();
  48714. $self.learnings;
  48715. }
  48716. return $self.learnings;
  48717. }, function($ctx1) {$ctx1.fill(self,"learnings",{})});
  48718. }; }),
  48719. $globals.Teachable);
  48720. $core.addMethod(
  48721. $core.method({
  48722. selector: "whenSend:evaluate:",
  48723. protocol: "teaching",
  48724. args: ["aSymbol", "aBlock"],
  48725. source: "whenSend: aSymbol evaluate: aBlock\x0a\x0a\x09self learnings at: aSymbol put: aBlock",
  48726. referencedClasses: [],
  48727. pragmas: [],
  48728. messageSends: ["at:put:", "learnings"]
  48729. }, function ($methodClass){ return function (aSymbol,aBlock){
  48730. var self=this,$self=this;
  48731. return $core.withContext(function($ctx1) {
  48732. $recv($self._learnings())._at_put_(aSymbol,aBlock);
  48733. return self;
  48734. }, function($ctx1) {$ctx1.fill(self,"whenSend:evaluate:",{aSymbol:aSymbol,aBlock:aBlock})});
  48735. }; }),
  48736. $globals.Teachable);
  48737. $core.addMethod(
  48738. $core.method({
  48739. selector: "whenSend:return:",
  48740. protocol: "teaching",
  48741. args: ["aSymbol", "anObject"],
  48742. source: "whenSend: aSymbol return: anObject\x0a\x0a\x09self learnings at: aSymbol put: (#return -> anObject)",
  48743. referencedClasses: [],
  48744. pragmas: [],
  48745. messageSends: ["at:put:", "learnings", "->"]
  48746. }, function ($methodClass){ return function (aSymbol,anObject){
  48747. var self=this,$self=this;
  48748. return $core.withContext(function($ctx1) {
  48749. $recv($self._learnings())._at_put_(aSymbol,"return".__minus_gt(anObject));
  48750. return self;
  48751. }, function($ctx1) {$ctx1.fill(self,"whenSend:return:",{aSymbol:aSymbol,anObject:anObject})});
  48752. }; }),
  48753. $globals.Teachable);
  48754. $core.addMethod(
  48755. $core.method({
  48756. selector: "example",
  48757. protocol: "examples",
  48758. args: [],
  48759. source: "example\x0a\x09| teachable |\x0a\x09teachable := self new.\x0a\x09teachable \x0a\x09\x09whenSend: #help return: 'ok';\x0a\x09\x09whenSend: #doit evaluate: [1 inspect];\x0a\x09\x09acceptSend: #noDebugger;\x0a\x09\x09whenSend: #negate: evaluate: [:num | num negated].\x0a\x09teachable help.\x0a\x09teachable doit.\x0a\x09teachable noDebugger.\x0a\x09teachable negate: 120",
  48760. referencedClasses: [],
  48761. pragmas: [],
  48762. messageSends: ["new", "whenSend:return:", "whenSend:evaluate:", "inspect", "acceptSend:", "negated", "help", "doit", "noDebugger", "negate:"]
  48763. }, function ($methodClass){ return function (){
  48764. var self=this,$self=this;
  48765. var teachable;
  48766. return $core.withContext(function($ctx1) {
  48767. var $1;
  48768. teachable=$self._new();
  48769. $1=teachable;
  48770. $recv($1)._whenSend_return_("help","ok");
  48771. [$recv($1)._whenSend_evaluate_("doit",(function(){
  48772. return $core.withContext(function($ctx2) {
  48773. return (1)._inspect();
  48774. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48775. }))
  48776. ,$ctx1.sendIdx["whenSend:evaluate:"]=1
  48777. ][0];
  48778. $recv($1)._acceptSend_("noDebugger");
  48779. $recv($1)._whenSend_evaluate_("negate:",(function(num){
  48780. return $core.withContext(function($ctx2) {
  48781. return $recv(num)._negated();
  48782. }, function($ctx2) {$ctx2.fillBlock({num:num},$ctx1,2)});
  48783. }));
  48784. $recv(teachable)._help();
  48785. $recv(teachable)._doit();
  48786. $recv(teachable)._noDebugger();
  48787. $recv(teachable)._negate_((120));
  48788. return self;
  48789. }, function($ctx1) {$ctx1.fill(self,"example",{teachable:teachable})});
  48790. }; }),
  48791. $globals.Teachable.a$cls);
  48792. $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
  48793. $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.";
  48794. $core.addMethod(
  48795. $core.method({
  48796. selector: "assert:",
  48797. protocol: "testing",
  48798. args: ["aBoolean"],
  48799. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  48800. referencedClasses: [],
  48801. pragmas: [],
  48802. messageSends: ["assert:description:"]
  48803. }, function ($methodClass){ return function (aBoolean){
  48804. var self=this,$self=this;
  48805. return $core.withContext(function($ctx1) {
  48806. $self._assert_description_(aBoolean,"Assertion failed");
  48807. return self;
  48808. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean})});
  48809. }; }),
  48810. $globals.TestCase);
  48811. $core.addMethod(
  48812. $core.method({
  48813. selector: "assert:description:",
  48814. protocol: "testing",
  48815. args: ["aBoolean", "aString"],
  48816. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  48817. referencedClasses: [],
  48818. pragmas: [],
  48819. messageSends: ["ifFalse:", "signalFailure:"]
  48820. }, function ($methodClass){ return function (aBoolean,aString){
  48821. var self=this,$self=this;
  48822. return $core.withContext(function($ctx1) {
  48823. if(!$core.assert(aBoolean)){
  48824. $self._signalFailure_(aString);
  48825. }
  48826. return self;
  48827. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString})});
  48828. }; }),
  48829. $globals.TestCase);
  48830. $core.addMethod(
  48831. $core.method({
  48832. selector: "assert:equals:",
  48833. protocol: "testing",
  48834. args: ["actual", "expected"],
  48835. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  48836. referencedClasses: [],
  48837. pragmas: [],
  48838. messageSends: ["assert:description:", "=", ",", "printString"]
  48839. }, function ($methodClass){ return function (actual,expected){
  48840. var self=this,$self=this;
  48841. return $core.withContext(function($ctx1) {
  48842. return $self._assert_description_($recv(actual).__eq(expected),[$recv([$recv("Expected: ".__comma([$recv(expected)._printString()
  48843. ,$ctx1.sendIdx["printString"]=1
  48844. ][0])).__comma(" but was: ")
  48845. ,$ctx1.sendIdx[","]=2
  48846. ][0]).__comma($recv(actual)._printString())
  48847. ,$ctx1.sendIdx[","]=1
  48848. ][0]);
  48849. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected})});
  48850. }; }),
  48851. $globals.TestCase);
  48852. $core.addMethod(
  48853. $core.method({
  48854. selector: "async:",
  48855. protocol: "async",
  48856. args: ["aBlock"],
  48857. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  48858. referencedClasses: [],
  48859. pragmas: [],
  48860. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  48861. }, function ($methodClass){ return function (aBlock){
  48862. var self=this,$self=this;
  48863. var c;
  48864. return $core.withContext(function($ctx1) {
  48865. $self._errorIfNotAsync_("#async");
  48866. c=$self.context;
  48867. return (function(){
  48868. return $core.withContext(function($ctx2) {
  48869. if($core.assert($self._isAsync())){
  48870. return $recv(c)._execute_(aBlock);
  48871. }
  48872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48873. });
  48874. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c})});
  48875. }; }),
  48876. $globals.TestCase);
  48877. $core.addMethod(
  48878. $core.method({
  48879. selector: "context:",
  48880. protocol: "accessing",
  48881. args: ["aRunningTestContext"],
  48882. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  48883. referencedClasses: [],
  48884. pragmas: [],
  48885. messageSends: []
  48886. }, function ($methodClass){ return function (aRunningTestContext){
  48887. var self=this,$self=this;
  48888. $self.context=aRunningTestContext;
  48889. return self;
  48890. }; }),
  48891. $globals.TestCase);
  48892. $core.addMethod(
  48893. $core.method({
  48894. selector: "debugCase",
  48895. protocol: "running",
  48896. args: [],
  48897. source: "debugCase\x0a\x09\x22Runs a test case in isolated context, debugging all errors.\x22\x0a\x0a\x09(DebugTestContext testCase: self) start",
  48898. referencedClasses: ["DebugTestContext"],
  48899. pragmas: [],
  48900. messageSends: ["start", "testCase:"]
  48901. }, function ($methodClass){ return function (){
  48902. var self=this,$self=this;
  48903. return $core.withContext(function($ctx1) {
  48904. $recv($recv($globals.DebugTestContext)._testCase_(self))._start();
  48905. return self;
  48906. }, function($ctx1) {$ctx1.fill(self,"debugCase",{})});
  48907. }; }),
  48908. $globals.TestCase);
  48909. $core.addMethod(
  48910. $core.method({
  48911. selector: "deny:",
  48912. protocol: "testing",
  48913. args: ["aBoolean"],
  48914. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  48915. referencedClasses: [],
  48916. pragmas: [],
  48917. messageSends: ["assert:", "not"]
  48918. }, function ($methodClass){ return function (aBoolean){
  48919. var self=this,$self=this;
  48920. return $core.withContext(function($ctx1) {
  48921. $self._assert_($recv(aBoolean)._not());
  48922. return self;
  48923. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean})});
  48924. }; }),
  48925. $globals.TestCase);
  48926. $core.addMethod(
  48927. $core.method({
  48928. selector: "errorIfNotAsync:",
  48929. protocol: "error handling",
  48930. args: ["aString"],
  48931. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  48932. referencedClasses: [],
  48933. pragmas: [],
  48934. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  48935. }, function ($methodClass){ return function (aString){
  48936. var self=this,$self=this;
  48937. return $core.withContext(function($ctx1) {
  48938. if(!$core.assert($self._isAsync())){
  48939. $self._error_($recv(aString).__comma(" used without prior #timeout:"));
  48940. }
  48941. return self;
  48942. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString})});
  48943. }; }),
  48944. $globals.TestCase);
  48945. $core.addMethod(
  48946. $core.method({
  48947. selector: "finished",
  48948. protocol: "async",
  48949. args: [],
  48950. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  48951. referencedClasses: [],
  48952. pragmas: [],
  48953. messageSends: ["errorIfNotAsync:"]
  48954. }, function ($methodClass){ return function (){
  48955. var self=this,$self=this;
  48956. return $core.withContext(function($ctx1) {
  48957. $self._errorIfNotAsync_("#finished");
  48958. $self.asyncTimeout=nil;
  48959. return self;
  48960. }, function($ctx1) {$ctx1.fill(self,"finished",{})});
  48961. }; }),
  48962. $globals.TestCase);
  48963. $core.addMethod(
  48964. $core.method({
  48965. selector: "isAsync",
  48966. protocol: "testing",
  48967. args: [],
  48968. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  48969. referencedClasses: [],
  48970. pragmas: [],
  48971. messageSends: ["notNil"]
  48972. }, function ($methodClass){ return function (){
  48973. var self=this,$self=this;
  48974. return $core.withContext(function($ctx1) {
  48975. return $recv($self.asyncTimeout)._notNil();
  48976. }, function($ctx1) {$ctx1.fill(self,"isAsync",{})});
  48977. }; }),
  48978. $globals.TestCase);
  48979. $core.addMethod(
  48980. $core.method({
  48981. selector: "performTest",
  48982. protocol: "running",
  48983. args: [],
  48984. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  48985. referencedClasses: [],
  48986. pragmas: [],
  48987. messageSends: ["perform:", "selector"]
  48988. }, function ($methodClass){ return function (){
  48989. var self=this,$self=this;
  48990. return $core.withContext(function($ctx1) {
  48991. $self.asyncTimeout=nil;
  48992. $self._perform_($self._selector());
  48993. return self;
  48994. }, function($ctx1) {$ctx1.fill(self,"performTest",{})});
  48995. }; }),
  48996. $globals.TestCase);
  48997. $core.addMethod(
  48998. $core.method({
  48999. selector: "runCase",
  49000. protocol: "running",
  49001. args: [],
  49002. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  49003. referencedClasses: ["TestContext"],
  49004. pragmas: [],
  49005. messageSends: ["start", "testCase:"]
  49006. }, function ($methodClass){ return function (){
  49007. var self=this,$self=this;
  49008. return $core.withContext(function($ctx1) {
  49009. $recv($recv($globals.TestContext)._testCase_(self))._start();
  49010. return self;
  49011. }, function($ctx1) {$ctx1.fill(self,"runCase",{})});
  49012. }; }),
  49013. $globals.TestCase);
  49014. $core.addMethod(
  49015. $core.method({
  49016. selector: "selector",
  49017. protocol: "accessing",
  49018. args: [],
  49019. source: "selector\x0a\x09^ testSelector",
  49020. referencedClasses: [],
  49021. pragmas: [],
  49022. messageSends: []
  49023. }, function ($methodClass){ return function (){
  49024. var self=this,$self=this;
  49025. return $self.testSelector;
  49026. }; }),
  49027. $globals.TestCase);
  49028. $core.addMethod(
  49029. $core.method({
  49030. selector: "setTestSelector:",
  49031. protocol: "accessing",
  49032. args: ["aSelector"],
  49033. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  49034. referencedClasses: [],
  49035. pragmas: [],
  49036. messageSends: []
  49037. }, function ($methodClass){ return function (aSelector){
  49038. var self=this,$self=this;
  49039. $self.testSelector=aSelector;
  49040. return self;
  49041. }; }),
  49042. $globals.TestCase);
  49043. $core.addMethod(
  49044. $core.method({
  49045. selector: "setUp",
  49046. protocol: "running",
  49047. args: [],
  49048. source: "setUp",
  49049. referencedClasses: [],
  49050. pragmas: [],
  49051. messageSends: []
  49052. }, function ($methodClass){ return function (){
  49053. var self=this,$self=this;
  49054. return self;
  49055. }; }),
  49056. $globals.TestCase);
  49057. $core.addMethod(
  49058. $core.method({
  49059. selector: "should:",
  49060. protocol: "testing",
  49061. args: ["aBlock"],
  49062. source: "should: aBlock\x0a\x09self assert: aBlock value",
  49063. referencedClasses: [],
  49064. pragmas: [],
  49065. messageSends: ["assert:", "value"]
  49066. }, function ($methodClass){ return function (aBlock){
  49067. var self=this,$self=this;
  49068. return $core.withContext(function($ctx1) {
  49069. $self._assert_($recv(aBlock)._value());
  49070. return self;
  49071. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock})});
  49072. }; }),
  49073. $globals.TestCase);
  49074. $core.addMethod(
  49075. $core.method({
  49076. selector: "should:raise:",
  49077. protocol: "testing",
  49078. args: ["aBlock", "anExceptionClass"],
  49079. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  49080. referencedClasses: [],
  49081. pragmas: [],
  49082. messageSends: ["assert:", "on:do:", "value"]
  49083. }, function ($methodClass){ return function (aBlock,anExceptionClass){
  49084. var self=this,$self=this;
  49085. return $core.withContext(function($ctx1) {
  49086. $self._assert_($recv((function(){
  49087. return $core.withContext(function($ctx2) {
  49088. $recv(aBlock)._value();
  49089. return false;
  49090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49091. }))._on_do_(anExceptionClass,(function(ex){
  49092. return true;
  49093. })));
  49094. return self;
  49095. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass})});
  49096. }; }),
  49097. $globals.TestCase);
  49098. $core.addMethod(
  49099. $core.method({
  49100. selector: "shouldnt:raise:",
  49101. protocol: "testing",
  49102. args: ["aBlock", "anExceptionClass"],
  49103. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  49104. referencedClasses: [],
  49105. pragmas: [],
  49106. messageSends: ["assert:", "on:do:", "value"]
  49107. }, function ($methodClass){ return function (aBlock,anExceptionClass){
  49108. var self=this,$self=this;
  49109. return $core.withContext(function($ctx1) {
  49110. $self._assert_($recv((function(){
  49111. return $core.withContext(function($ctx2) {
  49112. $recv(aBlock)._value();
  49113. return true;
  49114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49115. }))._on_do_(anExceptionClass,(function(ex){
  49116. return false;
  49117. })));
  49118. return self;
  49119. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass})});
  49120. }; }),
  49121. $globals.TestCase);
  49122. $core.addMethod(
  49123. $core.method({
  49124. selector: "signalFailure:",
  49125. protocol: "private",
  49126. args: ["aString"],
  49127. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  49128. referencedClasses: ["TestFailure"],
  49129. pragmas: [],
  49130. messageSends: ["messageText:", "new", "signal"]
  49131. }, function ($methodClass){ return function (aString){
  49132. var self=this,$self=this;
  49133. return $core.withContext(function($ctx1) {
  49134. var $1;
  49135. $1=$recv($globals.TestFailure)._new();
  49136. $recv($1)._messageText_(aString);
  49137. $recv($1)._signal();
  49138. return self;
  49139. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString})});
  49140. }; }),
  49141. $globals.TestCase);
  49142. $core.addMethod(
  49143. $core.method({
  49144. selector: "tearDown",
  49145. protocol: "running",
  49146. args: [],
  49147. source: "tearDown",
  49148. referencedClasses: [],
  49149. pragmas: [],
  49150. messageSends: []
  49151. }, function ($methodClass){ return function (){
  49152. var self=this,$self=this;
  49153. return self;
  49154. }; }),
  49155. $globals.TestCase);
  49156. $core.addMethod(
  49157. $core.method({
  49158. selector: "timeout:",
  49159. protocol: "async",
  49160. args: ["aNumber"],
  49161. 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",
  49162. referencedClasses: [],
  49163. pragmas: [],
  49164. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  49165. }, function ($methodClass){ return function (aNumber){
  49166. var self=this,$self=this;
  49167. return $core.withContext(function($ctx1) {
  49168. var $1;
  49169. $1=$self.asyncTimeout;
  49170. if($1 == null || $1.a$nil){
  49171. $1;
  49172. } else {
  49173. $recv($self.asyncTimeout)._clearTimeout();
  49174. }
  49175. $self.asyncTimeout=(0);
  49176. $self.asyncTimeout=$recv($self._async_((function(){
  49177. return $core.withContext(function($ctx2) {
  49178. return $self._assert_description_(false,"SUnit grace time exhausted");
  49179. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49180. })))._valueWithTimeout_(aNumber);
  49181. return self;
  49182. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber})});
  49183. }; }),
  49184. $globals.TestCase);
  49185. $core.addMethod(
  49186. $core.method({
  49187. selector: "allTestSelectors",
  49188. protocol: "accessing",
  49189. args: [],
  49190. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  49191. referencedClasses: [],
  49192. pragmas: [],
  49193. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  49194. }, function ($methodClass){ return function (){
  49195. var self=this,$self=this;
  49196. var selectors;
  49197. return $core.withContext(function($ctx1) {
  49198. selectors=$self._testSelectors();
  49199. if($core.assert($self._shouldInheritSelectors())){
  49200. $recv(selectors)._addAll_($recv($self._superclass())._allTestSelectors());
  49201. }
  49202. return selectors;
  49203. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors})});
  49204. }; }),
  49205. $globals.TestCase.a$cls);
  49206. $core.addMethod(
  49207. $core.method({
  49208. selector: "buildSuite",
  49209. protocol: "accessing",
  49210. args: [],
  49211. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  49212. referencedClasses: [],
  49213. pragmas: [],
  49214. messageSends: ["collect:", "allTestSelectors", "selector:"]
  49215. }, function ($methodClass){ return function (){
  49216. var self=this,$self=this;
  49217. return $core.withContext(function($ctx1) {
  49218. return $recv($self._allTestSelectors())._collect_((function(each){
  49219. return $core.withContext(function($ctx2) {
  49220. return $self._selector_(each);
  49221. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49222. }));
  49223. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{})});
  49224. }; }),
  49225. $globals.TestCase.a$cls);
  49226. $core.addMethod(
  49227. $core.method({
  49228. selector: "classTag",
  49229. protocol: "accessing",
  49230. args: [],
  49231. 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'",
  49232. referencedClasses: [],
  49233. pragmas: [],
  49234. messageSends: []
  49235. }, function ($methodClass){ return function (){
  49236. var self=this,$self=this;
  49237. return "test";
  49238. }; }),
  49239. $globals.TestCase.a$cls);
  49240. $core.addMethod(
  49241. $core.method({
  49242. selector: "isAbstract",
  49243. protocol: "testing",
  49244. args: [],
  49245. source: "isAbstract\x0a\x09^ self name = TestCase name",
  49246. referencedClasses: ["TestCase"],
  49247. pragmas: [],
  49248. messageSends: ["=", "name"]
  49249. }, function ($methodClass){ return function (){
  49250. var self=this,$self=this;
  49251. return $core.withContext(function($ctx1) {
  49252. return $recv([$self._name()
  49253. ,$ctx1.sendIdx["name"]=1
  49254. ][0]).__eq($recv($globals.TestCase)._name());
  49255. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{})});
  49256. }; }),
  49257. $globals.TestCase.a$cls);
  49258. $core.addMethod(
  49259. $core.method({
  49260. selector: "isTestClass",
  49261. protocol: "testing",
  49262. args: [],
  49263. source: "isTestClass\x0a\x09^ self isAbstract not",
  49264. referencedClasses: [],
  49265. pragmas: [],
  49266. messageSends: ["not", "isAbstract"]
  49267. }, function ($methodClass){ return function (){
  49268. var self=this,$self=this;
  49269. return $core.withContext(function($ctx1) {
  49270. return $recv($self._isAbstract())._not();
  49271. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{})});
  49272. }; }),
  49273. $globals.TestCase.a$cls);
  49274. $core.addMethod(
  49275. $core.method({
  49276. selector: "lookupHierarchyRoot",
  49277. protocol: "accessing",
  49278. args: [],
  49279. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  49280. referencedClasses: ["TestCase"],
  49281. pragmas: [],
  49282. messageSends: []
  49283. }, function ($methodClass){ return function (){
  49284. var self=this,$self=this;
  49285. return $globals.TestCase;
  49286. }; }),
  49287. $globals.TestCase.a$cls);
  49288. $core.addMethod(
  49289. $core.method({
  49290. selector: "selector:",
  49291. protocol: "accessing",
  49292. args: ["aSelector"],
  49293. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  49294. referencedClasses: [],
  49295. pragmas: [],
  49296. messageSends: ["setTestSelector:", "new", "yourself"]
  49297. }, function ($methodClass){ return function (aSelector){
  49298. var self=this,$self=this;
  49299. return $core.withContext(function($ctx1) {
  49300. var $1;
  49301. $1=$self._new();
  49302. $recv($1)._setTestSelector_(aSelector);
  49303. return $recv($1)._yourself();
  49304. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector})});
  49305. }; }),
  49306. $globals.TestCase.a$cls);
  49307. $core.addMethod(
  49308. $core.method({
  49309. selector: "shouldInheritSelectors",
  49310. protocol: "testing",
  49311. args: [],
  49312. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  49313. referencedClasses: [],
  49314. pragmas: [],
  49315. messageSends: ["~=", "lookupHierarchyRoot"]
  49316. }, function ($methodClass){ return function (){
  49317. var self=this,$self=this;
  49318. return $core.withContext(function($ctx1) {
  49319. return $self.__tild_eq($self._lookupHierarchyRoot());
  49320. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{})});
  49321. }; }),
  49322. $globals.TestCase.a$cls);
  49323. $core.addMethod(
  49324. $core.method({
  49325. selector: "testSelectors",
  49326. protocol: "accessing",
  49327. args: [],
  49328. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  49329. referencedClasses: [],
  49330. pragmas: [],
  49331. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  49332. }, function ($methodClass){ return function (){
  49333. var self=this,$self=this;
  49334. return $core.withContext(function($ctx1) {
  49335. return $recv($recv($self._methodDictionary())._keys())._select_((function(each){
  49336. return $core.withContext(function($ctx2) {
  49337. return $recv(each)._match_("^test");
  49338. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49339. }));
  49340. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{})});
  49341. }; }),
  49342. $globals.TestCase.a$cls);
  49343. $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
  49344. $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).";
  49345. $core.addMethod(
  49346. $core.method({
  49347. selector: "execute:",
  49348. protocol: "running",
  49349. args: ["aBlock"],
  49350. 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 ] ]",
  49351. referencedClasses: [],
  49352. pragmas: [],
  49353. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  49354. }, function ($methodClass){ return function (aBlock){
  49355. var self=this,$self=this;
  49356. var failed;
  49357. return $core.withContext(function($ctx1) {
  49358. [$recv($self.testCase)._context_(self)
  49359. ,$ctx1.sendIdx["context:"]=1
  49360. ][0];
  49361. $recv((function(){
  49362. return $core.withContext(function($ctx2) {
  49363. failed=true;
  49364. $recv(aBlock)._value();
  49365. failed=false;
  49366. return failed;
  49367. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49368. }))._ensure_((function(){
  49369. return $core.withContext(function($ctx2) {
  49370. $recv($self.testCase)._context_(nil);
  49371. if($core.assert($recv(failed)._and_((function(){
  49372. return $core.withContext(function($ctx3) {
  49373. return [$recv($self.testCase)._isAsync()
  49374. ,$ctx3.sendIdx["isAsync"]=1
  49375. ][0];
  49376. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  49377. })))){
  49378. $recv($self.testCase)._finished();
  49379. }
  49380. if(!$core.assert($recv($self.testCase)._isAsync())){
  49381. return $recv($self.testCase)._tearDown();
  49382. }
  49383. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49384. }));
  49385. return self;
  49386. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed})});
  49387. }; }),
  49388. $globals.TestContext);
  49389. $core.addMethod(
  49390. $core.method({
  49391. selector: "start",
  49392. protocol: "running",
  49393. args: [],
  49394. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  49395. referencedClasses: [],
  49396. pragmas: [],
  49397. messageSends: ["execute:", "setUp", "performTest"]
  49398. }, function ($methodClass){ return function (){
  49399. var self=this,$self=this;
  49400. return $core.withContext(function($ctx1) {
  49401. $self._execute_((function(){
  49402. return $core.withContext(function($ctx2) {
  49403. $recv($self.testCase)._setUp();
  49404. return $recv($self.testCase)._performTest();
  49405. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49406. }));
  49407. return self;
  49408. }, function($ctx1) {$ctx1.fill(self,"start",{})});
  49409. }; }),
  49410. $globals.TestContext);
  49411. $core.addMethod(
  49412. $core.method({
  49413. selector: "testCase:",
  49414. protocol: "accessing",
  49415. args: ["aTestCase"],
  49416. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  49417. referencedClasses: [],
  49418. pragmas: [],
  49419. messageSends: []
  49420. }, function ($methodClass){ return function (aTestCase){
  49421. var self=this,$self=this;
  49422. $self.testCase=aTestCase;
  49423. return self;
  49424. }; }),
  49425. $globals.TestContext);
  49426. $core.addMethod(
  49427. $core.method({
  49428. selector: "testCase:",
  49429. protocol: "instance creation",
  49430. args: ["aTestCase"],
  49431. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  49432. referencedClasses: [],
  49433. pragmas: [],
  49434. messageSends: ["testCase:", "new", "yourself"]
  49435. }, function ($methodClass){ return function (aTestCase){
  49436. var self=this,$self=this;
  49437. return $core.withContext(function($ctx1) {
  49438. var $1;
  49439. $1=$self._new();
  49440. $recv($1)._testCase_(aTestCase);
  49441. return $recv($1)._yourself();
  49442. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase})});
  49443. }; }),
  49444. $globals.TestContext.a$cls);
  49445. $core.addClass("DebugTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  49446. $globals.DebugTestContext.comment="I add error debugging to `TestContext`.\x0a\x0aErrors are caught and explicitly passed to `ErrorHandler`.\x0aI am used in `TestCase >> debugCase`.";
  49447. $core.addMethod(
  49448. $core.method({
  49449. selector: "execute:",
  49450. protocol: "running",
  49451. args: ["aBlock"],
  49452. source: "execute: aBlock\x0a\x09self withErrorDebugging: [ super execute: aBlock ]",
  49453. referencedClasses: [],
  49454. pragmas: [],
  49455. messageSends: ["withErrorDebugging:", "execute:"]
  49456. }, function ($methodClass){ return function (aBlock){
  49457. var self=this,$self=this;
  49458. return $core.withContext(function($ctx1) {
  49459. $self._withErrorDebugging_((function(){
  49460. return $core.withContext(function($ctx2) {
  49461. return [(
  49462. $ctx2.supercall = true,
  49463. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._execute_.call($self,aBlock))
  49464. ,$ctx2.supercall = false
  49465. ][0];
  49466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49467. }));
  49468. return self;
  49469. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock})});
  49470. }; }),
  49471. $globals.DebugTestContext);
  49472. $core.addMethod(
  49473. $core.method({
  49474. selector: "withErrorDebugging:",
  49475. protocol: "private",
  49476. args: ["aBlock"],
  49477. source: "withErrorDebugging: aBlock\x0a\x09aBlock\x0a\x09\x09on: Error\x0a\x09\x09do: [ :ex | ErrorHandler handleError: ex ]",
  49478. referencedClasses: ["Error", "ErrorHandler"],
  49479. pragmas: [],
  49480. messageSends: ["on:do:", "handleError:"]
  49481. }, function ($methodClass){ return function (aBlock){
  49482. var self=this,$self=this;
  49483. return $core.withContext(function($ctx1) {
  49484. $recv(aBlock)._on_do_($globals.Error,(function(ex){
  49485. return $core.withContext(function($ctx2) {
  49486. return $recv($globals.ErrorHandler)._handleError_(ex);
  49487. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,1)});
  49488. }));
  49489. return self;
  49490. }, function($ctx1) {$ctx1.fill(self,"withErrorDebugging:",{aBlock:aBlock})});
  49491. }; }),
  49492. $globals.DebugTestContext);
  49493. $core.addMethod(
  49494. $core.method({
  49495. selector: "testCase:result:finished:",
  49496. protocol: "instance creation",
  49497. args: ["aTestCase", "aTestResult", "aBlock"],
  49498. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  49499. referencedClasses: [],
  49500. pragmas: [],
  49501. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  49502. }, function ($methodClass){ return function (aTestCase,aTestResult,aBlock){
  49503. var self=this,$self=this;
  49504. return $core.withContext(function($ctx1) {
  49505. var $1;
  49506. $1=[(
  49507. $ctx1.supercall = true,
  49508. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._testCase_.call($self,aTestCase))
  49509. ,$ctx1.supercall = false
  49510. ][0];
  49511. $recv($1)._result_(aTestResult);
  49512. $recv($1)._finished_(aBlock);
  49513. return $recv($1)._yourself();
  49514. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock})});
  49515. }; }),
  49516. $globals.DebugTestContext.a$cls);
  49517. $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  49518. $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`.";
  49519. $core.addMethod(
  49520. $core.method({
  49521. selector: "execute:",
  49522. protocol: "running",
  49523. args: ["aBlock"],
  49524. 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 ] ]",
  49525. referencedClasses: [],
  49526. pragmas: [],
  49527. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  49528. }, function ($methodClass){ return function (aBlock){
  49529. var self=this,$self=this;
  49530. return $core.withContext(function($ctx1) {
  49531. $recv((function(){
  49532. return $core.withContext(function($ctx2) {
  49533. return $self._withErrorReporting_((function(){
  49534. return $core.withContext(function($ctx3) {
  49535. return [(
  49536. $ctx3.supercall = true,
  49537. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._execute_.call($self,aBlock))
  49538. ,$ctx3.supercall = false
  49539. ][0];
  49540. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49541. }));
  49542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49543. }))._ensure_((function(){
  49544. return $core.withContext(function($ctx2) {
  49545. if(!$core.assert($recv($self.testCase)._isAsync())){
  49546. $recv($self.result)._increaseRuns();
  49547. return $recv($self.finished)._value();
  49548. }
  49549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49550. }));
  49551. return self;
  49552. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock})});
  49553. }; }),
  49554. $globals.ReportingTestContext);
  49555. $core.addMethod(
  49556. $core.method({
  49557. selector: "finished:",
  49558. protocol: "accessing",
  49559. args: ["aBlock"],
  49560. source: "finished: aBlock\x0a\x09finished := aBlock",
  49561. referencedClasses: [],
  49562. pragmas: [],
  49563. messageSends: []
  49564. }, function ($methodClass){ return function (aBlock){
  49565. var self=this,$self=this;
  49566. $self.finished=aBlock;
  49567. return self;
  49568. }; }),
  49569. $globals.ReportingTestContext);
  49570. $core.addMethod(
  49571. $core.method({
  49572. selector: "result:",
  49573. protocol: "accessing",
  49574. args: ["aTestResult"],
  49575. source: "result: aTestResult\x0a\x09result := aTestResult",
  49576. referencedClasses: [],
  49577. pragmas: [],
  49578. messageSends: []
  49579. }, function ($methodClass){ return function (aTestResult){
  49580. var self=this,$self=this;
  49581. $self.result=aTestResult;
  49582. return self;
  49583. }; }),
  49584. $globals.ReportingTestContext);
  49585. $core.addMethod(
  49586. $core.method({
  49587. selector: "withErrorReporting:",
  49588. protocol: "private",
  49589. args: ["aBlock"],
  49590. 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 ]",
  49591. referencedClasses: ["TestFailure", "Error"],
  49592. pragmas: [],
  49593. messageSends: ["on:do:", "addFailure:", "addError:"]
  49594. }, function ($methodClass){ return function (aBlock){
  49595. var self=this,$self=this;
  49596. return $core.withContext(function($ctx1) {
  49597. [$recv((function(){
  49598. return $core.withContext(function($ctx2) {
  49599. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  49600. return $core.withContext(function($ctx3) {
  49601. return $recv($self.result)._addFailure_($self.testCase);
  49602. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  49603. }));
  49604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49605. }))._on_do_($globals.Error,(function(ex){
  49606. return $core.withContext(function($ctx2) {
  49607. return $recv($self.result)._addError_($self.testCase);
  49608. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  49609. }))
  49610. ,$ctx1.sendIdx["on:do:"]=1
  49611. ][0];
  49612. return self;
  49613. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock})});
  49614. }; }),
  49615. $globals.ReportingTestContext);
  49616. $core.addMethod(
  49617. $core.method({
  49618. selector: "testCase:result:finished:",
  49619. protocol: "instance creation",
  49620. args: ["aTestCase", "aTestResult", "aBlock"],
  49621. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  49622. referencedClasses: [],
  49623. pragmas: [],
  49624. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  49625. }, function ($methodClass){ return function (aTestCase,aTestResult,aBlock){
  49626. var self=this,$self=this;
  49627. return $core.withContext(function($ctx1) {
  49628. var $1;
  49629. $1=[(
  49630. $ctx1.supercall = true,
  49631. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._testCase_.call($self,aTestCase))
  49632. ,$ctx1.supercall = false
  49633. ][0];
  49634. $recv($1)._result_(aTestResult);
  49635. $recv($1)._finished_(aBlock);
  49636. return $recv($1)._yourself();
  49637. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock})});
  49638. }; }),
  49639. $globals.ReportingTestContext.a$cls);
  49640. $core.addClass("TestFailure", $globals.Error, [], "SUnit");
  49641. $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.";
  49642. $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
  49643. $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";
  49644. $core.addMethod(
  49645. $core.method({
  49646. selector: "addError:",
  49647. protocol: "accessing",
  49648. args: ["anError"],
  49649. source: "addError: anError\x0a\x09self errors add: anError",
  49650. referencedClasses: [],
  49651. pragmas: [],
  49652. messageSends: ["add:", "errors"]
  49653. }, function ($methodClass){ return function (anError){
  49654. var self=this,$self=this;
  49655. return $core.withContext(function($ctx1) {
  49656. $recv($self._errors())._add_(anError);
  49657. return self;
  49658. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError})});
  49659. }; }),
  49660. $globals.TestResult);
  49661. $core.addMethod(
  49662. $core.method({
  49663. selector: "addFailure:",
  49664. protocol: "accessing",
  49665. args: ["aFailure"],
  49666. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  49667. referencedClasses: [],
  49668. pragmas: [],
  49669. messageSends: ["add:", "failures"]
  49670. }, function ($methodClass){ return function (aFailure){
  49671. var self=this,$self=this;
  49672. return $core.withContext(function($ctx1) {
  49673. $recv($self._failures())._add_(aFailure);
  49674. return self;
  49675. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure})});
  49676. }; }),
  49677. $globals.TestResult);
  49678. $core.addMethod(
  49679. $core.method({
  49680. selector: "errors",
  49681. protocol: "accessing",
  49682. args: [],
  49683. source: "errors\x0a\x09^ errors",
  49684. referencedClasses: [],
  49685. pragmas: [],
  49686. messageSends: []
  49687. }, function ($methodClass){ return function (){
  49688. var self=this,$self=this;
  49689. return $self.errors;
  49690. }; }),
  49691. $globals.TestResult);
  49692. $core.addMethod(
  49693. $core.method({
  49694. selector: "failures",
  49695. protocol: "accessing",
  49696. args: [],
  49697. source: "failures\x0a\x09^ failures",
  49698. referencedClasses: [],
  49699. pragmas: [],
  49700. messageSends: []
  49701. }, function ($methodClass){ return function (){
  49702. var self=this,$self=this;
  49703. return $self.failures;
  49704. }; }),
  49705. $globals.TestResult);
  49706. $core.addMethod(
  49707. $core.method({
  49708. selector: "increaseRuns",
  49709. protocol: "accessing",
  49710. args: [],
  49711. source: "increaseRuns\x0a\x09runs := runs + 1",
  49712. referencedClasses: [],
  49713. pragmas: [],
  49714. messageSends: ["+"]
  49715. }, function ($methodClass){ return function (){
  49716. var self=this,$self=this;
  49717. return $core.withContext(function($ctx1) {
  49718. $self.runs=$recv($self.runs).__plus((1));
  49719. return self;
  49720. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{})});
  49721. }; }),
  49722. $globals.TestResult);
  49723. $core.addMethod(
  49724. $core.method({
  49725. selector: "initialize",
  49726. protocol: "initialization",
  49727. args: [],
  49728. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  49729. referencedClasses: ["Date", "Array"],
  49730. pragmas: [],
  49731. messageSends: ["initialize", "now", "new"]
  49732. }, function ($methodClass){ return function (){
  49733. var self=this,$self=this;
  49734. return $core.withContext(function($ctx1) {
  49735. [(
  49736. $ctx1.supercall = true,
  49737. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  49738. ,$ctx1.supercall = false
  49739. ][0];
  49740. $self.timestamp=$recv($globals.Date)._now();
  49741. $self.runs=(0);
  49742. $self.errors=[$recv($globals.Array)._new()
  49743. ,$ctx1.sendIdx["new"]=1
  49744. ][0];
  49745. $self.failures=$recv($globals.Array)._new();
  49746. $self.total=(0);
  49747. return self;
  49748. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  49749. }; }),
  49750. $globals.TestResult);
  49751. $core.addMethod(
  49752. $core.method({
  49753. selector: "nextRunDo:",
  49754. protocol: "running",
  49755. args: ["aBlock"],
  49756. 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 ]",
  49757. referencedClasses: [],
  49758. pragmas: [],
  49759. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  49760. }, function ($methodClass){ return function (aBlock){
  49761. var self=this,$self=this;
  49762. return $core.withContext(function($ctx1) {
  49763. if(!$core.assert($recv([$self._runs()
  49764. ,$ctx1.sendIdx["runs"]=1
  49765. ][0]).__eq_eq($self._total()))){
  49766. return $recv(aBlock)._value_($recv($self._runs()).__plus((1)));
  49767. }
  49768. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock})});
  49769. }; }),
  49770. $globals.TestResult);
  49771. $core.addMethod(
  49772. $core.method({
  49773. selector: "runCase:",
  49774. protocol: "running",
  49775. args: ["aTestCase"],
  49776. 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 ]",
  49777. referencedClasses: ["TestFailure", "Error"],
  49778. pragmas: [],
  49779. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  49780. }, function ($methodClass){ return function (aTestCase){
  49781. var self=this,$self=this;
  49782. return $core.withContext(function($ctx1) {
  49783. [$recv((function(){
  49784. return $core.withContext(function($ctx2) {
  49785. return $recv((function(){
  49786. return $core.withContext(function($ctx3) {
  49787. $self._increaseRuns();
  49788. return $recv(aTestCase)._runCase();
  49789. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49790. }))._on_do_($globals.TestFailure,(function(ex){
  49791. return $core.withContext(function($ctx3) {
  49792. return $self._addFailure_(aTestCase);
  49793. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  49794. }));
  49795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49796. }))._on_do_($globals.Error,(function(ex){
  49797. return $core.withContext(function($ctx2) {
  49798. return $self._addError_(aTestCase);
  49799. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  49800. }))
  49801. ,$ctx1.sendIdx["on:do:"]=1
  49802. ][0];
  49803. return self;
  49804. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase})});
  49805. }; }),
  49806. $globals.TestResult);
  49807. $core.addMethod(
  49808. $core.method({
  49809. selector: "runs",
  49810. protocol: "accessing",
  49811. args: [],
  49812. source: "runs\x0a\x09^ runs",
  49813. referencedClasses: [],
  49814. pragmas: [],
  49815. messageSends: []
  49816. }, function ($methodClass){ return function (){
  49817. var self=this,$self=this;
  49818. return $self.runs;
  49819. }; }),
  49820. $globals.TestResult);
  49821. $core.addMethod(
  49822. $core.method({
  49823. selector: "status",
  49824. protocol: "accessing",
  49825. args: [],
  49826. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  49827. referencedClasses: [],
  49828. pragmas: [],
  49829. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  49830. }, function ($methodClass){ return function (){
  49831. var self=this,$self=this;
  49832. return $core.withContext(function($ctx1) {
  49833. return [$recv($self._errors())._ifNotEmpty_ifEmpty_((function(){
  49834. return "error";
  49835. }),(function(){
  49836. return $core.withContext(function($ctx2) {
  49837. return $recv($self._failures())._ifNotEmpty_ifEmpty_((function(){
  49838. return "failure";
  49839. }),(function(){
  49840. return "success";
  49841. }));
  49842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49843. }))
  49844. ,$ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1
  49845. ][0];
  49846. }, function($ctx1) {$ctx1.fill(self,"status",{})});
  49847. }; }),
  49848. $globals.TestResult);
  49849. $core.addMethod(
  49850. $core.method({
  49851. selector: "timestamp",
  49852. protocol: "accessing",
  49853. args: [],
  49854. source: "timestamp\x0a\x09^ timestamp",
  49855. referencedClasses: [],
  49856. pragmas: [],
  49857. messageSends: []
  49858. }, function ($methodClass){ return function (){
  49859. var self=this,$self=this;
  49860. return $self.timestamp;
  49861. }; }),
  49862. $globals.TestResult);
  49863. $core.addMethod(
  49864. $core.method({
  49865. selector: "total",
  49866. protocol: "accessing",
  49867. args: [],
  49868. source: "total\x0a\x09^ total",
  49869. referencedClasses: [],
  49870. pragmas: [],
  49871. messageSends: []
  49872. }, function ($methodClass){ return function (){
  49873. var self=this,$self=this;
  49874. return $self.total;
  49875. }; }),
  49876. $globals.TestResult);
  49877. $core.addMethod(
  49878. $core.method({
  49879. selector: "total:",
  49880. protocol: "accessing",
  49881. args: ["aNumber"],
  49882. source: "total: aNumber\x0a\x09total := aNumber",
  49883. referencedClasses: [],
  49884. pragmas: [],
  49885. messageSends: []
  49886. }, function ($methodClass){ return function (aNumber){
  49887. var self=this,$self=this;
  49888. $self.total=aNumber;
  49889. return self;
  49890. }; }),
  49891. $globals.TestResult);
  49892. $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
  49893. $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`.";
  49894. $core.addMethod(
  49895. $core.method({
  49896. selector: "announcer",
  49897. protocol: "accessing",
  49898. args: [],
  49899. source: "announcer\x0a\x09^ announcer",
  49900. referencedClasses: [],
  49901. pragmas: [],
  49902. messageSends: []
  49903. }, function ($methodClass){ return function (){
  49904. var self=this,$self=this;
  49905. return $self.announcer;
  49906. }; }),
  49907. $globals.TestSuiteRunner);
  49908. $core.addMethod(
  49909. $core.method({
  49910. selector: "contextOf:",
  49911. protocol: "private",
  49912. args: ["anInteger"],
  49913. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  49914. referencedClasses: ["ReportingTestContext"],
  49915. pragmas: [],
  49916. messageSends: ["testCase:result:finished:", "at:", "resume"]
  49917. }, function ($methodClass){ return function (anInteger){
  49918. var self=this,$self=this;
  49919. return $core.withContext(function($ctx1) {
  49920. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv($self.suite)._at_(anInteger),$self.result,(function(){
  49921. return $core.withContext(function($ctx2) {
  49922. return $self._resume();
  49923. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49924. }));
  49925. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger})});
  49926. }; }),
  49927. $globals.TestSuiteRunner);
  49928. $core.addMethod(
  49929. $core.method({
  49930. selector: "initialize",
  49931. protocol: "initialization",
  49932. args: [],
  49933. 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 ] ].",
  49934. referencedClasses: ["Announcer", "TestResult"],
  49935. pragmas: [],
  49936. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  49937. }, function ($methodClass){ return function (){
  49938. var self=this,$self=this;
  49939. return $core.withContext(function($ctx1) {
  49940. [(
  49941. $ctx1.supercall = true,
  49942. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  49943. ,$ctx1.supercall = false
  49944. ][0];
  49945. $self.announcer=[$recv($globals.Announcer)._new()
  49946. ,$ctx1.sendIdx["new"]=1
  49947. ][0];
  49948. $self.result=$recv($globals.TestResult)._new();
  49949. $self.runNextTest=(function(){
  49950. var runs;
  49951. return $core.withContext(function($ctx2) {
  49952. runs=$recv($self.result)._runs();
  49953. if($core.assert($recv(runs).__lt($recv($self.result)._total()))){
  49954. return $recv($self._contextOf_($recv(runs).__plus((1))))._start();
  49955. }
  49956. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  49957. });
  49958. return self;
  49959. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  49960. }; }),
  49961. $globals.TestSuiteRunner);
  49962. $core.addMethod(
  49963. $core.method({
  49964. selector: "result",
  49965. protocol: "accessing",
  49966. args: [],
  49967. source: "result\x0a\x09^ result",
  49968. referencedClasses: [],
  49969. pragmas: [],
  49970. messageSends: []
  49971. }, function ($methodClass){ return function (){
  49972. var self=this,$self=this;
  49973. return $self.result;
  49974. }; }),
  49975. $globals.TestSuiteRunner);
  49976. $core.addMethod(
  49977. $core.method({
  49978. selector: "resume",
  49979. protocol: "actions",
  49980. args: [],
  49981. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  49982. referencedClasses: ["ResultAnnouncement"],
  49983. pragmas: [],
  49984. messageSends: ["fork", "announce:", "result:", "new"]
  49985. }, function ($methodClass){ return function (){
  49986. var self=this,$self=this;
  49987. return $core.withContext(function($ctx1) {
  49988. $recv($self.runNextTest)._fork();
  49989. $recv($self.announcer)._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_($self.result));
  49990. return self;
  49991. }, function($ctx1) {$ctx1.fill(self,"resume",{})});
  49992. }; }),
  49993. $globals.TestSuiteRunner);
  49994. $core.addMethod(
  49995. $core.method({
  49996. selector: "run",
  49997. protocol: "actions",
  49998. args: [],
  49999. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  50000. referencedClasses: [],
  50001. pragmas: [],
  50002. messageSends: ["total:", "size", "resume"]
  50003. }, function ($methodClass){ return function (){
  50004. var self=this,$self=this;
  50005. return $core.withContext(function($ctx1) {
  50006. $recv($self.result)._total_($recv($self.suite)._size());
  50007. $self._resume();
  50008. return self;
  50009. }, function($ctx1) {$ctx1.fill(self,"run",{})});
  50010. }; }),
  50011. $globals.TestSuiteRunner);
  50012. $core.addMethod(
  50013. $core.method({
  50014. selector: "suite:",
  50015. protocol: "accessing",
  50016. args: ["aCollection"],
  50017. source: "suite: aCollection\x0a\x09suite := aCollection",
  50018. referencedClasses: [],
  50019. pragmas: [],
  50020. messageSends: []
  50021. }, function ($methodClass){ return function (aCollection){
  50022. var self=this,$self=this;
  50023. $self.suite=aCollection;
  50024. return self;
  50025. }; }),
  50026. $globals.TestSuiteRunner);
  50027. $core.addMethod(
  50028. $core.method({
  50029. selector: "new",
  50030. protocol: "instance creation",
  50031. args: [],
  50032. source: "new\x0a\x09self shouldNotImplement",
  50033. referencedClasses: [],
  50034. pragmas: [],
  50035. messageSends: ["shouldNotImplement"]
  50036. }, function ($methodClass){ return function (){
  50037. var self=this,$self=this;
  50038. return $core.withContext(function($ctx1) {
  50039. $self._shouldNotImplement();
  50040. return self;
  50041. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  50042. }; }),
  50043. $globals.TestSuiteRunner.a$cls);
  50044. $core.addMethod(
  50045. $core.method({
  50046. selector: "on:",
  50047. protocol: "instance creation",
  50048. args: ["aCollection"],
  50049. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  50050. referencedClasses: [],
  50051. pragmas: [],
  50052. messageSends: ["suite:", "new"]
  50053. }, function ($methodClass){ return function (aCollection){
  50054. var self=this,$self=this;
  50055. return $core.withContext(function($ctx1) {
  50056. return $recv([(
  50057. $ctx1.supercall = true,
  50058. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._new.call($self))
  50059. ,$ctx1.supercall = false
  50060. ][0])._suite_(aCollection);
  50061. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  50062. }; }),
  50063. $globals.TestSuiteRunner.a$cls);
  50064. $core.addMethod(
  50065. $core.method({
  50066. selector: "isTestPackage",
  50067. protocol: "*SUnit",
  50068. args: [],
  50069. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  50070. referencedClasses: [],
  50071. pragmas: [],
  50072. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  50073. }, function ($methodClass){ return function (){
  50074. var self=this,$self=this;
  50075. return $core.withContext(function($ctx1) {
  50076. return $recv($self._classes())._anySatisfy_((function(each){
  50077. return $core.withContext(function($ctx2) {
  50078. return $recv(each)._isTestClass();
  50079. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50080. }));
  50081. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{})});
  50082. }; }),
  50083. $globals.Package);
  50084. $core.addMethod(
  50085. $core.method({
  50086. selector: "isTestClass",
  50087. protocol: "*SUnit",
  50088. args: [],
  50089. source: "isTestClass\x0a\x09^ false",
  50090. referencedClasses: [],
  50091. pragmas: [],
  50092. messageSends: []
  50093. }, function ($methodClass){ return function (){
  50094. var self=this,$self=this;
  50095. return false;
  50096. }; }),
  50097. $globals.TBehaviorDefaults);
  50098. });
  50099. define('amber/core/Kernel-Tests',["amber/boot", "require", "amber/core/Kernel-Objects", "amber/core/SUnit"], function($boot,requirejs){"use strict";
  50100. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  50101. var $pkg = $core.addPackage("Kernel-Tests");
  50102. $pkg.innerEval = function (expr) { return eval(expr); };
  50103. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  50104. $core.addClass("AnnouncementSubscriptionTest", $globals.TestCase, [], "Kernel-Tests");
  50105. $core.addMethod(
  50106. $core.method({
  50107. selector: "testAddExtensionMethod",
  50108. protocol: "tests",
  50109. args: [],
  50110. 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 ]",
  50111. referencedClasses: [],
  50112. pragmas: [],
  50113. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  50114. }, function ($methodClass){ return function (){
  50115. var self=this,$self=this;
  50116. var method,dirty;
  50117. return $core.withContext(function($ctx1) {
  50118. dirty=[$recv([$recv([$self._class()
  50119. ,$ctx1.sendIdx["class"]=1
  50120. ][0])._package()
  50121. ,$ctx1.sendIdx["package"]=1
  50122. ][0])._isDirty()
  50123. ,$ctx1.sendIdx["isDirty"]=1
  50124. ][0];
  50125. $recv([$recv([$self._class()
  50126. ,$ctx1.sendIdx["class"]=2
  50127. ][0])._package()
  50128. ,$ctx1.sendIdx["package"]=2
  50129. ][0])._beClean();
  50130. method=$recv([$self._class()
  50131. ,$ctx1.sendIdx["class"]=3
  50132. ][0])._compile_protocol_("doNothing","**not-a-package");
  50133. $self._deny_($recv([$recv([$self._class()
  50134. ,$ctx1.sendIdx["class"]=4
  50135. ][0])._package()
  50136. ,$ctx1.sendIdx["package"]=3
  50137. ][0])._isDirty());
  50138. $recv([$self._class()
  50139. ,$ctx1.sendIdx["class"]=5
  50140. ][0])._removeCompiledMethod_(method);
  50141. if($core.assert(dirty)){
  50142. $recv($recv($self._class())._package())._beDirty();
  50143. }
  50144. return self;
  50145. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty})});
  50146. }; }),
  50147. $globals.AnnouncementSubscriptionTest);
  50148. $core.addMethod(
  50149. $core.method({
  50150. selector: "testHandlesAnnouncement",
  50151. protocol: "tests",
  50152. args: [],
  50153. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement new) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1 new) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object new) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  50154. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  50155. pragmas: [],
  50156. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  50157. }, function ($methodClass){ return function (){
  50158. var self=this,$self=this;
  50159. var subscription,announcementClass1,announcementClass2,classBuilder;
  50160. return $core.withContext(function($ctx1) {
  50161. classBuilder=[$recv($globals.ClassBuilder)._new()
  50162. ,$ctx1.sendIdx["new"]=1
  50163. ][0];
  50164. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  50165. subscription=$recv([$recv($globals.AnnouncementSubscription)._new()
  50166. ,$ctx1.sendIdx["new"]=2
  50167. ][0])._announcementClass_($globals.SystemAnnouncement);
  50168. [$self._assert_equals_([$recv(subscription)._handlesAnnouncement_([$recv($globals.SystemAnnouncement)._new()
  50169. ,$ctx1.sendIdx["new"]=3
  50170. ][0])
  50171. ,$ctx1.sendIdx["handlesAnnouncement:"]=1
  50172. ][0],true)
  50173. ,$ctx1.sendIdx["assert:equals:"]=1
  50174. ][0];
  50175. [$self._assert_equals_([$recv(subscription)._handlesAnnouncement_([$recv(announcementClass1)._new()
  50176. ,$ctx1.sendIdx["new"]=4
  50177. ][0])
  50178. ,$ctx1.sendIdx["handlesAnnouncement:"]=2
  50179. ][0],true)
  50180. ,$ctx1.sendIdx["assert:equals:"]=2
  50181. ][0];
  50182. $self._assert_equals_($recv(subscription)._handlesAnnouncement_($recv($globals.Object)._new()),false);
  50183. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  50184. return self;
  50185. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder})});
  50186. }; }),
  50187. $globals.AnnouncementSubscriptionTest);
  50188. $core.addClass("AnnouncerTest", $globals.TestCase, [], "Kernel-Tests");
  50189. $core.addMethod(
  50190. $core.method({
  50191. selector: "testOnDo",
  50192. protocol: "tests",
  50193. args: [],
  50194. 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.",
  50195. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50196. pragmas: [],
  50197. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  50198. }, function ($methodClass){ return function (){
  50199. var self=this,$self=this;
  50200. var counter,announcer;
  50201. return $core.withContext(function($ctx1) {
  50202. counter=(0);
  50203. announcer=[$recv($globals.Announcer)._new()
  50204. ,$ctx1.sendIdx["new"]=1
  50205. ][0];
  50206. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  50207. return $core.withContext(function($ctx2) {
  50208. counter=$recv(counter).__plus((1));
  50209. return counter;
  50210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50211. }));
  50212. [$recv(announcer)._announce_([$recv($globals.SystemAnnouncement)._new()
  50213. ,$ctx1.sendIdx["new"]=2
  50214. ][0])
  50215. ,$ctx1.sendIdx["announce:"]=1
  50216. ][0];
  50217. [$self._assert_equals_(counter,(1))
  50218. ,$ctx1.sendIdx["assert:equals:"]=1
  50219. ][0];
  50220. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50221. $self._assert_equals_(counter,(2));
  50222. return self;
  50223. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer})});
  50224. }; }),
  50225. $globals.AnnouncerTest);
  50226. $core.addMethod(
  50227. $core.method({
  50228. selector: "testOnDoFor",
  50229. protocol: "tests",
  50230. args: [],
  50231. 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.",
  50232. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50233. pragmas: [],
  50234. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  50235. }, function ($methodClass){ return function (){
  50236. var self=this,$self=this;
  50237. var counter,announcer;
  50238. return $core.withContext(function($ctx1) {
  50239. counter=(0);
  50240. announcer=[$recv($globals.Announcer)._new()
  50241. ,$ctx1.sendIdx["new"]=1
  50242. ][0];
  50243. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  50244. return $core.withContext(function($ctx2) {
  50245. counter=$recv(counter).__plus((1));
  50246. return counter;
  50247. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50248. }),self);
  50249. [$recv(announcer)._announce_([$recv($globals.SystemAnnouncement)._new()
  50250. ,$ctx1.sendIdx["new"]=2
  50251. ][0])
  50252. ,$ctx1.sendIdx["announce:"]=1
  50253. ][0];
  50254. [$self._assert_equals_(counter,(1))
  50255. ,$ctx1.sendIdx["assert:equals:"]=1
  50256. ][0];
  50257. [$recv(announcer)._announce_([$recv($globals.SystemAnnouncement)._new()
  50258. ,$ctx1.sendIdx["new"]=3
  50259. ][0])
  50260. ,$ctx1.sendIdx["announce:"]=2
  50261. ][0];
  50262. [$self._assert_equals_(counter,(2))
  50263. ,$ctx1.sendIdx["assert:equals:"]=2
  50264. ][0];
  50265. $recv(announcer)._unsubscribe_(self);
  50266. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50267. $self._assert_equals_(counter,(2));
  50268. return self;
  50269. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer})});
  50270. }; }),
  50271. $globals.AnnouncerTest);
  50272. $core.addMethod(
  50273. $core.method({
  50274. selector: "testOnDoOnce",
  50275. protocol: "tests",
  50276. args: [],
  50277. 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.",
  50278. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50279. pragmas: [],
  50280. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  50281. }, function ($methodClass){ return function (){
  50282. var self=this,$self=this;
  50283. var counter,announcer;
  50284. return $core.withContext(function($ctx1) {
  50285. counter=(0);
  50286. announcer=[$recv($globals.Announcer)._new()
  50287. ,$ctx1.sendIdx["new"]=1
  50288. ][0];
  50289. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  50290. return $core.withContext(function($ctx2) {
  50291. counter=$recv(counter).__plus((1));
  50292. return counter;
  50293. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50294. }));
  50295. [$recv(announcer)._announce_([$recv($globals.SystemAnnouncement)._new()
  50296. ,$ctx1.sendIdx["new"]=2
  50297. ][0])
  50298. ,$ctx1.sendIdx["announce:"]=1
  50299. ][0];
  50300. [$self._assert_equals_(counter,(1))
  50301. ,$ctx1.sendIdx["assert:equals:"]=1
  50302. ][0];
  50303. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50304. $self._assert_equals_(counter,(1));
  50305. return self;
  50306. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer})});
  50307. }; }),
  50308. $globals.AnnouncerTest);
  50309. $core.addClass("BlockClosureTest", $globals.TestCase, [], "Kernel-Tests");
  50310. $core.addMethod(
  50311. $core.method({
  50312. selector: "localReturnOnDoCatch",
  50313. protocol: "fixture",
  50314. args: [],
  50315. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  50316. referencedClasses: ["Error"],
  50317. pragmas: [],
  50318. messageSends: ["on:do:"]
  50319. }, function ($methodClass){ return function (){
  50320. var self=this,$self=this;
  50321. return $core.withContext(function($ctx1) {
  50322. var $early={};
  50323. try {
  50324. $recv((function(){
  50325. throw $early=[(2)];
  50326. }))._on_do_($globals.Error,(function(){
  50327. }));
  50328. return (3);
  50329. }
  50330. catch(e) {if(e===$early)return e[0]; throw e}
  50331. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{})});
  50332. }; }),
  50333. $globals.BlockClosureTest);
  50334. $core.addMethod(
  50335. $core.method({
  50336. selector: "localReturnOnDoMiss",
  50337. protocol: "fixture",
  50338. args: [],
  50339. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  50340. referencedClasses: ["Class"],
  50341. pragmas: [],
  50342. messageSends: ["on:do:"]
  50343. }, function ($methodClass){ return function (){
  50344. var self=this,$self=this;
  50345. return $core.withContext(function($ctx1) {
  50346. var $early={};
  50347. try {
  50348. $recv((function(){
  50349. throw $early=[(2)];
  50350. }))._on_do_($globals.Class,(function(){
  50351. }));
  50352. return (3);
  50353. }
  50354. catch(e) {if(e===$early)return e[0]; throw e}
  50355. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{})});
  50356. }; }),
  50357. $globals.BlockClosureTest);
  50358. $core.addMethod(
  50359. $core.method({
  50360. selector: "testCanClearInterval",
  50361. protocol: "tests",
  50362. args: [],
  50363. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  50364. referencedClasses: ["Error"],
  50365. pragmas: [],
  50366. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  50367. }, function ($methodClass){ return function (){
  50368. var self=this,$self=this;
  50369. return $core.withContext(function($ctx1) {
  50370. $self._shouldnt_raise_((function(){
  50371. return $core.withContext(function($ctx2) {
  50372. return $recv($recv((function(){
  50373. return $core.withContext(function($ctx3) {
  50374. return $recv($recv($globals.Error)._new())._signal();
  50375. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50376. }))._valueWithInterval_((0)))._clearInterval();
  50377. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50378. }),$globals.Error);
  50379. return self;
  50380. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{})});
  50381. }; }),
  50382. $globals.BlockClosureTest);
  50383. $core.addMethod(
  50384. $core.method({
  50385. selector: "testCanClearTimeout",
  50386. protocol: "tests",
  50387. args: [],
  50388. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  50389. referencedClasses: ["Error"],
  50390. pragmas: [],
  50391. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  50392. }, function ($methodClass){ return function (){
  50393. var self=this,$self=this;
  50394. return $core.withContext(function($ctx1) {
  50395. $self._shouldnt_raise_((function(){
  50396. return $core.withContext(function($ctx2) {
  50397. return $recv($recv((function(){
  50398. return $core.withContext(function($ctx3) {
  50399. return $recv($recv($globals.Error)._new())._signal();
  50400. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50401. }))._valueWithTimeout_((0)))._clearTimeout();
  50402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50403. }),$globals.Error);
  50404. return self;
  50405. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{})});
  50406. }; }),
  50407. $globals.BlockClosureTest);
  50408. $core.addMethod(
  50409. $core.method({
  50410. selector: "testCompiledSource",
  50411. protocol: "tests",
  50412. args: [],
  50413. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  50414. referencedClasses: [],
  50415. pragmas: [],
  50416. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  50417. }, function ($methodClass){ return function (){
  50418. var self=this,$self=this;
  50419. return $core.withContext(function($ctx1) {
  50420. $self._assert_($recv($recv((function(){
  50421. return $core.withContext(function($ctx2) {
  50422. return (1).__plus((1));
  50423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50424. }))._compiledSource())._includesSubString_("function"));
  50425. return self;
  50426. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{})});
  50427. }; }),
  50428. $globals.BlockClosureTest);
  50429. $core.addMethod(
  50430. $core.method({
  50431. selector: "testCurrySelf",
  50432. protocol: "tests",
  50433. args: [],
  50434. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09curriedMethod protocol: '**test helper'.\x0a\x09array := #(3 1 4).\x0a\x09Array addCompiledMethod: curriedMethod.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  50435. referencedClasses: ["Array"],
  50436. pragmas: [],
  50437. messageSends: ["asCompiledMethod:", "currySelf", "at:", "protocol:", "addCompiledMethod:", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  50438. }, function ($methodClass){ return function (){
  50439. var self=this,$self=this;
  50440. var curriedMethod,array;
  50441. return $core.withContext(function($ctx1) {
  50442. curriedMethod=$recv($recv((function(selfarg,x){
  50443. return $core.withContext(function($ctx2) {
  50444. return $recv(selfarg)._at_(x);
  50445. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  50446. }))._currySelf())._asCompiledMethod_("foo:");
  50447. $recv(curriedMethod)._protocol_("**test helper");
  50448. array=[(3), (1), (4)];
  50449. $recv($globals.Array)._addCompiledMethod_(curriedMethod);
  50450. $recv((function(){
  50451. return $core.withContext(function($ctx2) {
  50452. return $self._assert_equals_($recv(array)._foo_((2)),(1));
  50453. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50454. }))._ensure_((function(){
  50455. return $core.withContext(function($ctx2) {
  50456. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  50457. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50458. }));
  50459. return self;
  50460. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array})});
  50461. }; }),
  50462. $globals.BlockClosureTest);
  50463. $core.addMethod(
  50464. $core.method({
  50465. selector: "testEnsure",
  50466. protocol: "tests",
  50467. args: [],
  50468. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  50469. referencedClasses: [],
  50470. pragmas: [],
  50471. messageSends: ["assert:equals:", "ensure:"]
  50472. }, function ($methodClass){ return function (){
  50473. var self=this,$self=this;
  50474. return $core.withContext(function($ctx1) {
  50475. $self._assert_equals_($recv((function(){
  50476. return (3);
  50477. }))._ensure_((function(){
  50478. return (4);
  50479. })),(3));
  50480. return self;
  50481. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{})});
  50482. }; }),
  50483. $globals.BlockClosureTest);
  50484. $core.addMethod(
  50485. $core.method({
  50486. selector: "testEnsureRaises",
  50487. protocol: "tests",
  50488. args: [],
  50489. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  50490. referencedClasses: ["Error"],
  50491. pragmas: [],
  50492. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  50493. }, function ($methodClass){ return function (){
  50494. var self=this,$self=this;
  50495. return $core.withContext(function($ctx1) {
  50496. $self._should_raise_((function(){
  50497. return $core.withContext(function($ctx2) {
  50498. return $recv((function(){
  50499. return $core.withContext(function($ctx3) {
  50500. return $recv($recv($globals.Error)._new())._signal();
  50501. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50502. }))._ensure_((function(){
  50503. return true;
  50504. }));
  50505. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50506. }),$globals.Error);
  50507. return self;
  50508. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{})});
  50509. }; }),
  50510. $globals.BlockClosureTest);
  50511. $core.addMethod(
  50512. $core.method({
  50513. selector: "testExceptionSemantics",
  50514. protocol: "tests",
  50515. args: [],
  50516. 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",
  50517. referencedClasses: ["Error"],
  50518. pragmas: [],
  50519. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  50520. }, function ($methodClass){ return function (){
  50521. var self=this,$self=this;
  50522. return $core.withContext(function($ctx1) {
  50523. $self._timeout_((100));
  50524. $recv($self._async_((function(){
  50525. return $core.withContext(function($ctx2) {
  50526. return $recv((function(){
  50527. return $core.withContext(function($ctx3) {
  50528. $self._assert_(true);
  50529. $recv($globals.Error)._signal();
  50530. $self._deny_(true);
  50531. return [$self._finished()
  50532. ,$ctx3.sendIdx["finished"]=1
  50533. ][0];
  50534. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50535. }))._on_do_($globals.Error,(function(ex){
  50536. return $core.withContext(function($ctx3) {
  50537. return $self._finished();
  50538. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  50539. }));
  50540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50541. })))._valueWithTimeout_((0));
  50542. return self;
  50543. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{})});
  50544. }; }),
  50545. $globals.BlockClosureTest);
  50546. $core.addMethod(
  50547. $core.method({
  50548. selector: "testLocalReturnOnDoCatch",
  50549. protocol: "tests",
  50550. args: [],
  50551. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  50552. referencedClasses: [],
  50553. pragmas: [],
  50554. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  50555. }, function ($methodClass){ return function (){
  50556. var self=this,$self=this;
  50557. return $core.withContext(function($ctx1) {
  50558. $self._assert_equals_($self._localReturnOnDoCatch(),(2));
  50559. return self;
  50560. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{})});
  50561. }; }),
  50562. $globals.BlockClosureTest);
  50563. $core.addMethod(
  50564. $core.method({
  50565. selector: "testLocalReturnOnDoMiss",
  50566. protocol: "tests",
  50567. args: [],
  50568. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  50569. referencedClasses: [],
  50570. pragmas: [],
  50571. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  50572. }, function ($methodClass){ return function (){
  50573. var self=this,$self=this;
  50574. return $core.withContext(function($ctx1) {
  50575. $self._assert_equals_($self._localReturnOnDoMiss(),(2));
  50576. return self;
  50577. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{})});
  50578. }; }),
  50579. $globals.BlockClosureTest);
  50580. $core.addMethod(
  50581. $core.method({
  50582. selector: "testNewWithValues",
  50583. protocol: "tests",
  50584. args: [],
  50585. source: "testNewWithValues\x0a<inlineJS: '\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = \x22theTestPrototype\x22;\x0a\x0a\x09var wrappedConstructor = $recv(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3]);\x0a\x09$self._assert_(result instanceof TestConstructor);\x0a\x09$self._assert_equals_(result.name, \x22theTestPrototype\x22);\x0a\x0a\x09/* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */\x0a\x09$self._should_raise_(function () {wrappedConstructor._newWithValues_(\x22single argument\x22);}, $globals.Error);\x0a'>",
  50586. referencedClasses: [],
  50587. pragmas: [["inlineJS:", ["\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = \x22theTestPrototype\x22;\x0a\x0a\x09var wrappedConstructor = $recv(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3]);\x0a\x09$self._assert_(result instanceof TestConstructor);\x0a\x09$self._assert_equals_(result.name, \x22theTestPrototype\x22);\x0a\x0a\x09/* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */\x0a\x09$self._should_raise_(function () {wrappedConstructor._newWithValues_(\x22single argument\x22);}, $globals.Error);"]]],
  50588. messageSends: []
  50589. }, function ($methodClass){ return function (){
  50590. var self=this,$self=this;
  50591. return $core.withContext(function($ctx1) {
  50592. function TestConstructor(arg1, arg2, arg3) {}
  50593. TestConstructor.prototype.name = "theTestPrototype";
  50594. var wrappedConstructor = $recv(TestConstructor);
  50595. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  50596. $self._assert_(result instanceof TestConstructor);
  50597. $self._assert_equals_(result.name, "theTestPrototype");
  50598. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  50599. $self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  50600. return self;
  50601. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{})});
  50602. }; }),
  50603. $globals.BlockClosureTest);
  50604. $core.addMethod(
  50605. $core.method({
  50606. selector: "testNumArgs",
  50607. protocol: "tests",
  50608. args: [],
  50609. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  50610. referencedClasses: [],
  50611. pragmas: [],
  50612. messageSends: ["assert:equals:", "numArgs"]
  50613. }, function ($methodClass){ return function (){
  50614. var self=this,$self=this;
  50615. return $core.withContext(function($ctx1) {
  50616. [$self._assert_equals_([$recv((function(){
  50617. }))._numArgs()
  50618. ,$ctx1.sendIdx["numArgs"]=1
  50619. ][0],(0))
  50620. ,$ctx1.sendIdx["assert:equals:"]=1
  50621. ][0];
  50622. $self._assert_equals_($recv((function(a,b){
  50623. }))._numArgs(),(2));
  50624. return self;
  50625. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{})});
  50626. }; }),
  50627. $globals.BlockClosureTest);
  50628. $core.addMethod(
  50629. $core.method({
  50630. selector: "testOnDo",
  50631. protocol: "tests",
  50632. args: [],
  50633. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  50634. referencedClasses: ["Error"],
  50635. pragmas: [],
  50636. messageSends: ["assert:", "on:do:", "signal", "new"]
  50637. }, function ($methodClass){ return function (){
  50638. var self=this,$self=this;
  50639. return $core.withContext(function($ctx1) {
  50640. $self._assert_($recv((function(){
  50641. return $core.withContext(function($ctx2) {
  50642. return $recv($recv($globals.Error)._new())._signal();
  50643. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50644. }))._on_do_($globals.Error,(function(ex){
  50645. return true;
  50646. })));
  50647. return self;
  50648. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{})});
  50649. }; }),
  50650. $globals.BlockClosureTest);
  50651. $core.addMethod(
  50652. $core.method({
  50653. selector: "testValue",
  50654. protocol: "tests",
  50655. args: [],
  50656. 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",
  50657. referencedClasses: [],
  50658. pragmas: [],
  50659. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  50660. }, function ($methodClass){ return function (){
  50661. var self=this,$self=this;
  50662. return $core.withContext(function($ctx1) {
  50663. [$self._assert_equals_([$recv((function(){
  50664. return $core.withContext(function($ctx2) {
  50665. return [(1).__plus((1))
  50666. ,$ctx2.sendIdx["+"]=1
  50667. ][0];
  50668. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50669. }))._value()
  50670. ,$ctx1.sendIdx["value"]=1
  50671. ][0],(2))
  50672. ,$ctx1.sendIdx["assert:equals:"]=1
  50673. ][0];
  50674. [$self._assert_equals_($recv((function(x){
  50675. return $core.withContext(function($ctx2) {
  50676. return $recv(x).__plus((1));
  50677. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  50678. }))._value_((2)),(3))
  50679. ,$ctx1.sendIdx["assert:equals:"]=2
  50680. ][0];
  50681. [$self._assert_equals_($recv((function(x,y){
  50682. return $core.withContext(function($ctx2) {
  50683. return $recv(x).__star(y);
  50684. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  50685. }))._value_value_((2),(4)),(8))
  50686. ,$ctx1.sendIdx["assert:equals:"]=3
  50687. ][0];
  50688. $self._assert_equals_($recv((function(a,b,c){
  50689. return (1);
  50690. }))._value(),(1));
  50691. return self;
  50692. }, function($ctx1) {$ctx1.fill(self,"testValue",{})});
  50693. }; }),
  50694. $globals.BlockClosureTest);
  50695. $core.addMethod(
  50696. $core.method({
  50697. selector: "testValueWithPossibleArguments",
  50698. protocol: "tests",
  50699. args: [],
  50700. 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.",
  50701. referencedClasses: [],
  50702. pragmas: [],
  50703. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  50704. }, function ($methodClass){ return function (){
  50705. var self=this,$self=this;
  50706. return $core.withContext(function($ctx1) {
  50707. [$self._assert_equals_([$recv((function(){
  50708. return (1);
  50709. }))._valueWithPossibleArguments_([(3), (4)])
  50710. ,$ctx1.sendIdx["valueWithPossibleArguments:"]=1
  50711. ][0],(1))
  50712. ,$ctx1.sendIdx["assert:equals:"]=1
  50713. ][0];
  50714. [$self._assert_equals_([$recv((function(a){
  50715. return $core.withContext(function($ctx2) {
  50716. return [$recv(a).__plus((4))
  50717. ,$ctx2.sendIdx["+"]=1
  50718. ][0];
  50719. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  50720. }))._valueWithPossibleArguments_([(3), (4)])
  50721. ,$ctx1.sendIdx["valueWithPossibleArguments:"]=2
  50722. ][0],(7))
  50723. ,$ctx1.sendIdx["assert:equals:"]=2
  50724. ][0];
  50725. $self._assert_equals_($recv((function(a,b){
  50726. return $core.withContext(function($ctx2) {
  50727. return $recv(a).__plus(b);
  50728. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  50729. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  50730. return self;
  50731. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{})});
  50732. }; }),
  50733. $globals.BlockClosureTest);
  50734. $core.addMethod(
  50735. $core.method({
  50736. selector: "testWhileFalse",
  50737. protocol: "tests",
  50738. args: [],
  50739. 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",
  50740. referencedClasses: [],
  50741. pragmas: [],
  50742. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  50743. }, function ($methodClass){ return function (){
  50744. var self=this,$self=this;
  50745. var i;
  50746. return $core.withContext(function($ctx1) {
  50747. i=(0);
  50748. $recv((function(){
  50749. return $core.withContext(function($ctx2) {
  50750. return [$recv(i).__gt((5))
  50751. ,$ctx2.sendIdx[">"]=1
  50752. ][0];
  50753. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50754. }))._whileFalse_((function(){
  50755. return $core.withContext(function($ctx2) {
  50756. i=[$recv(i).__plus((1))
  50757. ,$ctx2.sendIdx["+"]=1
  50758. ][0];
  50759. return i;
  50760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50761. }));
  50762. [$self._assert_equals_(i,(6))
  50763. ,$ctx1.sendIdx["assert:equals:"]=1
  50764. ][0];
  50765. i=(0);
  50766. $recv((function(){
  50767. return $core.withContext(function($ctx2) {
  50768. i=$recv(i).__plus((1));
  50769. return $recv(i).__gt((5));
  50770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50771. }))._whileFalse();
  50772. $self._assert_equals_(i,(6));
  50773. return self;
  50774. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i})});
  50775. }; }),
  50776. $globals.BlockClosureTest);
  50777. $core.addMethod(
  50778. $core.method({
  50779. selector: "testWhileTrue",
  50780. protocol: "tests",
  50781. args: [],
  50782. 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",
  50783. referencedClasses: [],
  50784. pragmas: [],
  50785. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  50786. }, function ($methodClass){ return function (){
  50787. var self=this,$self=this;
  50788. var i;
  50789. return $core.withContext(function($ctx1) {
  50790. i=(0);
  50791. $recv((function(){
  50792. return $core.withContext(function($ctx2) {
  50793. return [$recv(i).__lt((5))
  50794. ,$ctx2.sendIdx["<"]=1
  50795. ][0];
  50796. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50797. }))._whileTrue_((function(){
  50798. return $core.withContext(function($ctx2) {
  50799. i=[$recv(i).__plus((1))
  50800. ,$ctx2.sendIdx["+"]=1
  50801. ][0];
  50802. return i;
  50803. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50804. }));
  50805. [$self._assert_equals_(i,(5))
  50806. ,$ctx1.sendIdx["assert:equals:"]=1
  50807. ][0];
  50808. i=(0);
  50809. $recv((function(){
  50810. return $core.withContext(function($ctx2) {
  50811. i=$recv(i).__plus((1));
  50812. return $recv(i).__lt((5));
  50813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50814. }))._whileTrue();
  50815. $self._assert_equals_(i,(5));
  50816. return self;
  50817. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i})});
  50818. }; }),
  50819. $globals.BlockClosureTest);
  50820. $core.addClass("BooleanTest", $globals.TestCase, [], "Kernel-Tests");
  50821. $core.addMethod(
  50822. $core.method({
  50823. selector: "testEquality",
  50824. protocol: "tests",
  50825. args: [],
  50826. 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)",
  50827. referencedClasses: [],
  50828. pragmas: [],
  50829. messageSends: ["deny:", "=", "assert:", "yourself"]
  50830. }, function ($methodClass){ return function (){
  50831. var self=this,$self=this;
  50832. return $core.withContext(function($ctx1) {
  50833. [$self._deny_([(0).__eq(false)
  50834. ,$ctx1.sendIdx["="]=1
  50835. ][0])
  50836. ,$ctx1.sendIdx["deny:"]=1
  50837. ][0];
  50838. [$self._deny_([false.__eq((0))
  50839. ,$ctx1.sendIdx["="]=2
  50840. ][0])
  50841. ,$ctx1.sendIdx["deny:"]=2
  50842. ][0];
  50843. [$self._deny_(["".__eq(false)
  50844. ,$ctx1.sendIdx["="]=3
  50845. ][0])
  50846. ,$ctx1.sendIdx["deny:"]=3
  50847. ][0];
  50848. [$self._deny_([false.__eq("")
  50849. ,$ctx1.sendIdx["="]=4
  50850. ][0])
  50851. ,$ctx1.sendIdx["deny:"]=4
  50852. ][0];
  50853. [$self._assert_([true.__eq(true)
  50854. ,$ctx1.sendIdx["="]=5
  50855. ][0])
  50856. ,$ctx1.sendIdx["assert:"]=1
  50857. ][0];
  50858. [$self._deny_([false.__eq(true)
  50859. ,$ctx1.sendIdx["="]=6
  50860. ][0])
  50861. ,$ctx1.sendIdx["deny:"]=5
  50862. ][0];
  50863. $self._deny_([true.__eq(false)
  50864. ,$ctx1.sendIdx["="]=7
  50865. ][0]);
  50866. [$self._assert_([false.__eq(false)
  50867. ,$ctx1.sendIdx["="]=8
  50868. ][0])
  50869. ,$ctx1.sendIdx["assert:"]=2
  50870. ][0];
  50871. [$self._assert_([$recv([true._yourself()
  50872. ,$ctx1.sendIdx["yourself"]=1
  50873. ][0]).__eq(true)
  50874. ,$ctx1.sendIdx["="]=9
  50875. ][0])
  50876. ,$ctx1.sendIdx["assert:"]=3
  50877. ][0];
  50878. $self._assert_($recv([true._yourself()
  50879. ,$ctx1.sendIdx["yourself"]=2
  50880. ][0]).__eq(true._yourself()));
  50881. return self;
  50882. }, function($ctx1) {$ctx1.fill(self,"testEquality",{})});
  50883. }; }),
  50884. $globals.BooleanTest);
  50885. $core.addMethod(
  50886. $core.method({
  50887. selector: "testIdentity",
  50888. protocol: "tests",
  50889. args: [],
  50890. 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",
  50891. referencedClasses: [],
  50892. pragmas: [],
  50893. messageSends: ["deny:", "==", "assert:", "yourself"]
  50894. }, function ($methodClass){ return function (){
  50895. var self=this,$self=this;
  50896. return $core.withContext(function($ctx1) {
  50897. [$self._deny_([(0).__eq_eq(false)
  50898. ,$ctx1.sendIdx["=="]=1
  50899. ][0])
  50900. ,$ctx1.sendIdx["deny:"]=1
  50901. ][0];
  50902. [$self._deny_([false.__eq_eq((0))
  50903. ,$ctx1.sendIdx["=="]=2
  50904. ][0])
  50905. ,$ctx1.sendIdx["deny:"]=2
  50906. ][0];
  50907. [$self._deny_(["".__eq_eq(false)
  50908. ,$ctx1.sendIdx["=="]=3
  50909. ][0])
  50910. ,$ctx1.sendIdx["deny:"]=3
  50911. ][0];
  50912. [$self._deny_([false.__eq_eq("")
  50913. ,$ctx1.sendIdx["=="]=4
  50914. ][0])
  50915. ,$ctx1.sendIdx["deny:"]=4
  50916. ][0];
  50917. [$self._assert_([true.__eq_eq(true)
  50918. ,$ctx1.sendIdx["=="]=5
  50919. ][0])
  50920. ,$ctx1.sendIdx["assert:"]=1
  50921. ][0];
  50922. [$self._deny_([false.__eq_eq(true)
  50923. ,$ctx1.sendIdx["=="]=6
  50924. ][0])
  50925. ,$ctx1.sendIdx["deny:"]=5
  50926. ][0];
  50927. $self._deny_([true.__eq_eq(false)
  50928. ,$ctx1.sendIdx["=="]=7
  50929. ][0]);
  50930. [$self._assert_([false.__eq_eq(false)
  50931. ,$ctx1.sendIdx["=="]=8
  50932. ][0])
  50933. ,$ctx1.sendIdx["assert:"]=2
  50934. ][0];
  50935. [$self._assert_([$recv([true._yourself()
  50936. ,$ctx1.sendIdx["yourself"]=1
  50937. ][0]).__eq_eq(true)
  50938. ,$ctx1.sendIdx["=="]=9
  50939. ][0])
  50940. ,$ctx1.sendIdx["assert:"]=3
  50941. ][0];
  50942. $self._assert_($recv([true._yourself()
  50943. ,$ctx1.sendIdx["yourself"]=2
  50944. ][0]).__eq_eq(true._yourself()));
  50945. return self;
  50946. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{})});
  50947. }; }),
  50948. $globals.BooleanTest);
  50949. $core.addMethod(
  50950. $core.method({
  50951. selector: "testIfTrueIfFalse",
  50952. protocol: "tests",
  50953. args: [],
  50954. 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'.",
  50955. referencedClasses: [],
  50956. pragmas: [],
  50957. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  50958. }, function ($methodClass){ return function (){
  50959. var self=this,$self=this;
  50960. return $core.withContext(function($ctx1) {
  50961. var $1,$2,$3,$4,$5,$6,$7,$8;
  50962. if($core.assert(true)){
  50963. $1="alternative block";
  50964. }
  50965. [$self._assert_equals_($1,"alternative block")
  50966. ,$ctx1.sendIdx["assert:equals:"]=1
  50967. ][0];
  50968. if(!$core.assert(true)){
  50969. $2="alternative block";
  50970. }
  50971. [$self._assert_equals_($2,nil)
  50972. ,$ctx1.sendIdx["assert:equals:"]=2
  50973. ][0];
  50974. if($core.assert(false)){
  50975. $3="alternative block";
  50976. }
  50977. [$self._assert_equals_($3,nil)
  50978. ,$ctx1.sendIdx["assert:equals:"]=3
  50979. ][0];
  50980. if(!$core.assert(false)){
  50981. $4="alternative block";
  50982. }
  50983. [$self._assert_equals_($4,"alternative block")
  50984. ,$ctx1.sendIdx["assert:equals:"]=4
  50985. ][0];
  50986. if($core.assert(false)){
  50987. $5="alternative block";
  50988. } else {
  50989. $5="alternative block2";
  50990. }
  50991. [$self._assert_equals_($5,"alternative block2")
  50992. ,$ctx1.sendIdx["assert:equals:"]=5
  50993. ][0];
  50994. if($core.assert(false)){
  50995. $6="alternative block2";
  50996. } else {
  50997. $6="alternative block";
  50998. }
  50999. [$self._assert_equals_($6,"alternative block")
  51000. ,$ctx1.sendIdx["assert:equals:"]=6
  51001. ][0];
  51002. if($core.assert(true)){
  51003. $7="alternative block";
  51004. } else {
  51005. $7="alternative block2";
  51006. }
  51007. [$self._assert_equals_($7,"alternative block")
  51008. ,$ctx1.sendIdx["assert:equals:"]=7
  51009. ][0];
  51010. if($core.assert(true)){
  51011. $8="alternative block2";
  51012. } else {
  51013. $8="alternative block";
  51014. }
  51015. $self._assert_equals_($8,"alternative block2");
  51016. return self;
  51017. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{})});
  51018. }; }),
  51019. $globals.BooleanTest);
  51020. $core.addMethod(
  51021. $core.method({
  51022. selector: "testIfTrueIfFalseWithBoxing",
  51023. protocol: "tests",
  51024. args: [],
  51025. 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'.",
  51026. referencedClasses: [],
  51027. pragmas: [],
  51028. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51029. }, function ($methodClass){ return function (){
  51030. var self=this,$self=this;
  51031. return $core.withContext(function($ctx1) {
  51032. var $1,$2,$3,$4,$5,$6,$7,$8;
  51033. if($core.assert([true._yourself()
  51034. ,$ctx1.sendIdx["yourself"]=1
  51035. ][0])){
  51036. $1="alternative block";
  51037. }
  51038. [$self._assert_equals_($1,"alternative block")
  51039. ,$ctx1.sendIdx["assert:equals:"]=1
  51040. ][0];
  51041. if(!$core.assert([true._yourself()
  51042. ,$ctx1.sendIdx["yourself"]=2
  51043. ][0])){
  51044. $2="alternative block";
  51045. }
  51046. [$self._assert_equals_($2,nil)
  51047. ,$ctx1.sendIdx["assert:equals:"]=2
  51048. ][0];
  51049. if($core.assert([false._yourself()
  51050. ,$ctx1.sendIdx["yourself"]=3
  51051. ][0])){
  51052. $3="alternative block";
  51053. }
  51054. [$self._assert_equals_($3,nil)
  51055. ,$ctx1.sendIdx["assert:equals:"]=3
  51056. ][0];
  51057. if(!$core.assert([false._yourself()
  51058. ,$ctx1.sendIdx["yourself"]=4
  51059. ][0])){
  51060. $4="alternative block";
  51061. }
  51062. [$self._assert_equals_($4,"alternative block")
  51063. ,$ctx1.sendIdx["assert:equals:"]=4
  51064. ][0];
  51065. if($core.assert([false._yourself()
  51066. ,$ctx1.sendIdx["yourself"]=5
  51067. ][0])){
  51068. $5="alternative block";
  51069. } else {
  51070. $5="alternative block2";
  51071. }
  51072. [$self._assert_equals_($5,"alternative block2")
  51073. ,$ctx1.sendIdx["assert:equals:"]=5
  51074. ][0];
  51075. if($core.assert([false._yourself()
  51076. ,$ctx1.sendIdx["yourself"]=6
  51077. ][0])){
  51078. $6="alternative block2";
  51079. } else {
  51080. $6="alternative block";
  51081. }
  51082. [$self._assert_equals_($6,"alternative block")
  51083. ,$ctx1.sendIdx["assert:equals:"]=6
  51084. ][0];
  51085. if($core.assert([true._yourself()
  51086. ,$ctx1.sendIdx["yourself"]=7
  51087. ][0])){
  51088. $7="alternative block";
  51089. } else {
  51090. $7="alternative block2";
  51091. }
  51092. [$self._assert_equals_($7,"alternative block")
  51093. ,$ctx1.sendIdx["assert:equals:"]=7
  51094. ][0];
  51095. if($core.assert(true._yourself())){
  51096. $8="alternative block2";
  51097. } else {
  51098. $8="alternative block";
  51099. }
  51100. $self._assert_equals_($8,"alternative block2");
  51101. return self;
  51102. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{})});
  51103. }; }),
  51104. $globals.BooleanTest);
  51105. $core.addMethod(
  51106. $core.method({
  51107. selector: "testLogic",
  51108. protocol: "tests",
  51109. args: [],
  51110. 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))",
  51111. referencedClasses: [],
  51112. pragmas: [],
  51113. messageSends: ["assert:", "&", "deny:", "|", ">"]
  51114. }, function ($methodClass){ return function (){
  51115. var self=this,$self=this;
  51116. return $core.withContext(function($ctx1) {
  51117. [$self._assert_([true.__and(true)
  51118. ,$ctx1.sendIdx["&"]=1
  51119. ][0])
  51120. ,$ctx1.sendIdx["assert:"]=1
  51121. ][0];
  51122. [$self._deny_([true.__and(false)
  51123. ,$ctx1.sendIdx["&"]=2
  51124. ][0])
  51125. ,$ctx1.sendIdx["deny:"]=1
  51126. ][0];
  51127. [$self._deny_([false.__and(true)
  51128. ,$ctx1.sendIdx["&"]=3
  51129. ][0])
  51130. ,$ctx1.sendIdx["deny:"]=2
  51131. ][0];
  51132. [$self._deny_([false.__and(false)
  51133. ,$ctx1.sendIdx["&"]=4
  51134. ][0])
  51135. ,$ctx1.sendIdx["deny:"]=3
  51136. ][0];
  51137. [$self._assert_([true.__or(true)
  51138. ,$ctx1.sendIdx["|"]=1
  51139. ][0])
  51140. ,$ctx1.sendIdx["assert:"]=2
  51141. ][0];
  51142. [$self._assert_([true.__or(false)
  51143. ,$ctx1.sendIdx["|"]=2
  51144. ][0])
  51145. ,$ctx1.sendIdx["assert:"]=3
  51146. ][0];
  51147. [$self._assert_([false.__or(true)
  51148. ,$ctx1.sendIdx["|"]=3
  51149. ][0])
  51150. ,$ctx1.sendIdx["assert:"]=4
  51151. ][0];
  51152. [$self._deny_([false.__or(false)
  51153. ,$ctx1.sendIdx["|"]=4
  51154. ][0])
  51155. ,$ctx1.sendIdx["deny:"]=4
  51156. ][0];
  51157. [$self._assert_([true.__and([(1).__gt((0))
  51158. ,$ctx1.sendIdx[">"]=1
  51159. ][0])
  51160. ,$ctx1.sendIdx["&"]=5
  51161. ][0])
  51162. ,$ctx1.sendIdx["assert:"]=5
  51163. ][0];
  51164. [$self._deny_([$recv([(1).__gt((0))
  51165. ,$ctx1.sendIdx[">"]=2
  51166. ][0]).__and(false)
  51167. ,$ctx1.sendIdx["&"]=6
  51168. ][0])
  51169. ,$ctx1.sendIdx["deny:"]=5
  51170. ][0];
  51171. $self._deny_($recv([(1).__gt((0))
  51172. ,$ctx1.sendIdx[">"]=3
  51173. ][0]).__and([(1).__gt((2))
  51174. ,$ctx1.sendIdx[">"]=4
  51175. ][0]));
  51176. [$self._assert_([false.__or([(1).__gt((0))
  51177. ,$ctx1.sendIdx[">"]=5
  51178. ][0])
  51179. ,$ctx1.sendIdx["|"]=5
  51180. ][0])
  51181. ,$ctx1.sendIdx["assert:"]=6
  51182. ][0];
  51183. [$self._assert_([$recv([(1).__gt((0))
  51184. ,$ctx1.sendIdx[">"]=6
  51185. ][0]).__or(false)
  51186. ,$ctx1.sendIdx["|"]=6
  51187. ][0])
  51188. ,$ctx1.sendIdx["assert:"]=7
  51189. ][0];
  51190. $self._assert_($recv([(1).__gt((0))
  51191. ,$ctx1.sendIdx[">"]=7
  51192. ][0]).__or((1).__gt((2))));
  51193. return self;
  51194. }, function($ctx1) {$ctx1.fill(self,"testLogic",{})});
  51195. }; }),
  51196. $globals.BooleanTest);
  51197. $core.addMethod(
  51198. $core.method({
  51199. selector: "testLogicKeywords",
  51200. protocol: "tests",
  51201. args: [],
  51202. 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 ])",
  51203. referencedClasses: [],
  51204. pragmas: [],
  51205. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  51206. }, function ($methodClass){ return function (){
  51207. var self=this,$self=this;
  51208. return $core.withContext(function($ctx1) {
  51209. [$self._assert_([true._and_((function(){
  51210. return true;
  51211. }))
  51212. ,$ctx1.sendIdx["and:"]=1
  51213. ][0])
  51214. ,$ctx1.sendIdx["assert:"]=1
  51215. ][0];
  51216. [$self._deny_([true._and_((function(){
  51217. return false;
  51218. }))
  51219. ,$ctx1.sendIdx["and:"]=2
  51220. ][0])
  51221. ,$ctx1.sendIdx["deny:"]=1
  51222. ][0];
  51223. [$self._deny_([false._and_((function(){
  51224. return true;
  51225. }))
  51226. ,$ctx1.sendIdx["and:"]=3
  51227. ][0])
  51228. ,$ctx1.sendIdx["deny:"]=2
  51229. ][0];
  51230. [$self._deny_([false._and_((function(){
  51231. return false;
  51232. }))
  51233. ,$ctx1.sendIdx["and:"]=4
  51234. ][0])
  51235. ,$ctx1.sendIdx["deny:"]=3
  51236. ][0];
  51237. [$self._assert_([true._or_((function(){
  51238. return true;
  51239. }))
  51240. ,$ctx1.sendIdx["or:"]=1
  51241. ][0])
  51242. ,$ctx1.sendIdx["assert:"]=2
  51243. ][0];
  51244. [$self._assert_([true._or_((function(){
  51245. return false;
  51246. }))
  51247. ,$ctx1.sendIdx["or:"]=2
  51248. ][0])
  51249. ,$ctx1.sendIdx["assert:"]=3
  51250. ][0];
  51251. [$self._assert_([false._or_((function(){
  51252. return true;
  51253. }))
  51254. ,$ctx1.sendIdx["or:"]=3
  51255. ][0])
  51256. ,$ctx1.sendIdx["assert:"]=4
  51257. ][0];
  51258. [$self._deny_([false._or_((function(){
  51259. return false;
  51260. }))
  51261. ,$ctx1.sendIdx["or:"]=4
  51262. ][0])
  51263. ,$ctx1.sendIdx["deny:"]=4
  51264. ][0];
  51265. [$self._assert_([true._and_((function(){
  51266. return $core.withContext(function($ctx2) {
  51267. return [(1).__gt((0))
  51268. ,$ctx2.sendIdx[">"]=1
  51269. ][0];
  51270. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  51271. }))
  51272. ,$ctx1.sendIdx["and:"]=5
  51273. ][0])
  51274. ,$ctx1.sendIdx["assert:"]=5
  51275. ][0];
  51276. [$self._deny_([$recv([(1).__gt((0))
  51277. ,$ctx1.sendIdx[">"]=2
  51278. ][0])._and_((function(){
  51279. return false;
  51280. }))
  51281. ,$ctx1.sendIdx["and:"]=6
  51282. ][0])
  51283. ,$ctx1.sendIdx["deny:"]=5
  51284. ][0];
  51285. $self._deny_($recv([(1).__gt((0))
  51286. ,$ctx1.sendIdx[">"]=3
  51287. ][0])._and_((function(){
  51288. return $core.withContext(function($ctx2) {
  51289. return [(1).__gt((2))
  51290. ,$ctx2.sendIdx[">"]=4
  51291. ][0];
  51292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  51293. })));
  51294. [$self._assert_([false._or_((function(){
  51295. return $core.withContext(function($ctx2) {
  51296. return [(1).__gt((0))
  51297. ,$ctx2.sendIdx[">"]=5
  51298. ][0];
  51299. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  51300. }))
  51301. ,$ctx1.sendIdx["or:"]=5
  51302. ][0])
  51303. ,$ctx1.sendIdx["assert:"]=6
  51304. ][0];
  51305. [$self._assert_([$recv([(1).__gt((0))
  51306. ,$ctx1.sendIdx[">"]=6
  51307. ][0])._or_((function(){
  51308. return false;
  51309. }))
  51310. ,$ctx1.sendIdx["or:"]=6
  51311. ][0])
  51312. ,$ctx1.sendIdx["assert:"]=7
  51313. ][0];
  51314. $self._assert_($recv([(1).__gt((0))
  51315. ,$ctx1.sendIdx[">"]=7
  51316. ][0])._or_((function(){
  51317. return $core.withContext(function($ctx2) {
  51318. return (1).__gt((2));
  51319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  51320. })));
  51321. return self;
  51322. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{})});
  51323. }; }),
  51324. $globals.BooleanTest);
  51325. $core.addMethod(
  51326. $core.method({
  51327. selector: "testNonBooleanError",
  51328. protocol: "tests",
  51329. args: [],
  51330. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  51331. referencedClasses: ["NonBooleanReceiver"],
  51332. pragmas: [],
  51333. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  51334. }, function ($methodClass){ return function (){
  51335. var self=this,$self=this;
  51336. return $core.withContext(function($ctx1) {
  51337. $self._should_raise_((function(){
  51338. return $core.withContext(function($ctx2) {
  51339. if($core.assert("")){
  51340. return nil;
  51341. } else {
  51342. return nil;
  51343. }
  51344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51345. }),$globals.NonBooleanReceiver);
  51346. return self;
  51347. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{})});
  51348. }; }),
  51349. $globals.BooleanTest);
  51350. $core.addClass("ClassBuilderTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  51351. $core.addMethod(
  51352. $core.method({
  51353. selector: "setUp",
  51354. protocol: "running",
  51355. args: [],
  51356. source: "setUp\x0a\x09builder := ClassBuilder new",
  51357. referencedClasses: ["ClassBuilder"],
  51358. pragmas: [],
  51359. messageSends: ["new"]
  51360. }, function ($methodClass){ return function (){
  51361. var self=this,$self=this;
  51362. return $core.withContext(function($ctx1) {
  51363. $self.builder=$recv($globals.ClassBuilder)._new();
  51364. return self;
  51365. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  51366. }; }),
  51367. $globals.ClassBuilderTest);
  51368. $core.addMethod(
  51369. $core.method({
  51370. selector: "tearDown",
  51371. protocol: "running",
  51372. args: [],
  51373. source: "tearDown\x0a\x09self tearDownTheClass.\x0a\x09theClass ifNotNil: [\x0a\x09\x09self deny: (theClass package classes includes: theClass).\x0a\x09\x09self assert: (Smalltalk globals at: theClass name) equals: nil ]",
  51374. referencedClasses: ["Smalltalk"],
  51375. pragmas: [],
  51376. messageSends: ["tearDownTheClass", "ifNotNil:", "deny:", "includes:", "classes", "package", "assert:equals:", "at:", "globals", "name"]
  51377. }, function ($methodClass){ return function (){
  51378. var self=this,$self=this;
  51379. return $core.withContext(function($ctx1) {
  51380. var $1;
  51381. $self._tearDownTheClass();
  51382. $1=$self.theClass;
  51383. if($1 == null || $1.a$nil){
  51384. $1;
  51385. } else {
  51386. $self._deny_($recv($recv($recv($self.theClass)._package())._classes())._includes_($self.theClass));
  51387. $self._assert_equals_($recv($recv($globals.Smalltalk)._globals())._at_($recv($self.theClass)._name()),nil);
  51388. }
  51389. return self;
  51390. }, function($ctx1) {$ctx1.fill(self,"tearDown",{})});
  51391. }; }),
  51392. $globals.ClassBuilderTest);
  51393. $core.addMethod(
  51394. $core.method({
  51395. selector: "testAddTrait",
  51396. protocol: "tests",
  51397. args: [],
  51398. source: "testAddTrait\x0a\x09theClass := builder addTraitNamed: 'ObjectMock2' package: 'Kernel-Tests'.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: (theClass package classes occurrencesOf: theClass) equals: 1.\x0a\x09self assert: theClass package equals: ObjectMock package",
  51399. referencedClasses: ["ObjectMock"],
  51400. pragmas: [],
  51401. messageSends: ["addTraitNamed:package:", "assert:equals:", "name", "occurrencesOf:", "classes", "package"]
  51402. }, function ($methodClass){ return function (){
  51403. var self=this,$self=this;
  51404. return $core.withContext(function($ctx1) {
  51405. $self.theClass=$recv($self.builder)._addTraitNamed_package_("ObjectMock2","Kernel-Tests");
  51406. [$self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2")
  51407. ,$ctx1.sendIdx["assert:equals:"]=1
  51408. ][0];
  51409. [$self._assert_equals_($recv($recv([$recv($self.theClass)._package()
  51410. ,$ctx1.sendIdx["package"]=1
  51411. ][0])._classes())._occurrencesOf_($self.theClass),(1))
  51412. ,$ctx1.sendIdx["assert:equals:"]=2
  51413. ][0];
  51414. $self._assert_equals_([$recv($self.theClass)._package()
  51415. ,$ctx1.sendIdx["package"]=2
  51416. ][0],$recv($globals.ObjectMock)._package());
  51417. return self;
  51418. }, function($ctx1) {$ctx1.fill(self,"testAddTrait",{})});
  51419. }; }),
  51420. $globals.ClassBuilderTest);
  51421. $core.addMethod(
  51422. $core.method({
  51423. selector: "testClassCopy",
  51424. protocol: "tests",
  51425. args: [],
  51426. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass isClassCopyOf: ObjectMock",
  51427. referencedClasses: ["ObjectMock"],
  51428. pragmas: [],
  51429. messageSends: ["copyClass:named:", "assert:equals:", "name", "assert:isClassCopyOf:"]
  51430. }, function ($methodClass){ return function (){
  51431. var self=this,$self=this;
  51432. return $core.withContext(function($ctx1) {
  51433. $self.theClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51434. $self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2");
  51435. $self._assert_isClassCopyOf_($self.theClass,$globals.ObjectMock);
  51436. return self;
  51437. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{})});
  51438. }; }),
  51439. $globals.ClassBuilderTest);
  51440. $core.addMethod(
  51441. $core.method({
  51442. selector: "testClassMigration",
  51443. protocol: "tests",
  51444. args: [],
  51445. 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\x09theClass := ObjectMock subclass: #ObjectMock2\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09self assert: (ObjectMock2 package classes includes: ObjectMock2).\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x0a\x09self assert: (Smalltalk globals at: instance class name) isNil",
  51446. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  51447. pragmas: [],
  51448. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "includes:", "classes", "class", "isNil"]
  51449. }, function ($methodClass){ return function (){
  51450. var self=this,$self=this;
  51451. var instance,oldClass;
  51452. return $core.withContext(function($ctx1) {
  51453. oldClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51454. instance=$recv([$recv([$recv($globals.Smalltalk)._globals()
  51455. ,$ctx1.sendIdx["globals"]=1
  51456. ][0])._at_("ObjectMock2")
  51457. ,$ctx1.sendIdx["at:"]=1
  51458. ][0])._new();
  51459. $self.theClass=$recv($globals.ObjectMock)._subclass_instanceVariableNames_package_("ObjectMock2","","Kernel-Tests");
  51460. [$self._deny_([$recv(oldClass).__eq_eq($globals.ObjectMock2)
  51461. ,$ctx1.sendIdx["=="]=1
  51462. ][0])
  51463. ,$ctx1.sendIdx["deny:"]=1
  51464. ][0];
  51465. [$self._assert_([$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock)
  51466. ,$ctx1.sendIdx["=="]=2
  51467. ][0])
  51468. ,$ctx1.sendIdx["assert:"]=1
  51469. ][0];
  51470. [$self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty())
  51471. ,$ctx1.sendIdx["assert:"]=2
  51472. ][0];
  51473. [$self._assert_equals_([$recv($globals.ObjectMock2)._selectors()
  51474. ,$ctx1.sendIdx["selectors"]=1
  51475. ][0],$recv(oldClass)._selectors())
  51476. ,$ctx1.sendIdx["assert:equals:"]=1
  51477. ][0];
  51478. [$self._assert_equals_([$recv($globals.ObjectMock2)._comment()
  51479. ,$ctx1.sendIdx["comment"]=1
  51480. ][0],$recv(oldClass)._comment())
  51481. ,$ctx1.sendIdx["assert:equals:"]=2
  51482. ][0];
  51483. $self._assert_equals_([$recv([$recv($globals.ObjectMock2)._package()
  51484. ,$ctx1.sendIdx["package"]=1
  51485. ][0])._name()
  51486. ,$ctx1.sendIdx["name"]=1
  51487. ][0],"Kernel-Tests");
  51488. [$self._assert_($recv($recv($recv($globals.ObjectMock2)._package())._classes())._includes_($globals.ObjectMock2))
  51489. ,$ctx1.sendIdx["assert:"]=3
  51490. ][0];
  51491. $self._deny_($recv([$recv(instance)._class()
  51492. ,$ctx1.sendIdx["class"]=1
  51493. ][0]).__eq_eq($globals.ObjectMock2));
  51494. $self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  51495. return self;
  51496. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass})});
  51497. }; }),
  51498. $globals.ClassBuilderTest);
  51499. $core.addMethod(
  51500. $core.method({
  51501. selector: "testClassMigrationWithClassInstanceVariables",
  51502. protocol: "tests",
  51503. args: [],
  51504. 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\x09theClass := ObjectMock subclass: #ObjectMock2\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar')",
  51505. referencedClasses: ["ObjectMock", "ObjectMock2"],
  51506. pragmas: [],
  51507. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "assert:equals:", "instanceVariableNames"]
  51508. }, function ($methodClass){ return function (){
  51509. var self=this,$self=this;
  51510. return $core.withContext(function($ctx1) {
  51511. $recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51512. $recv([$recv($globals.ObjectMock2)._class()
  51513. ,$ctx1.sendIdx["class"]=1
  51514. ][0])._instanceVariableNames_(" foo bar ");
  51515. $self.theClass=$recv($globals.ObjectMock)._subclass_instanceVariableNames_package_("ObjectMock2","","Kernel-Tests");
  51516. $self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  51517. return self;
  51518. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{})});
  51519. }; }),
  51520. $globals.ClassBuilderTest);
  51521. $core.addMethod(
  51522. $core.method({
  51523. selector: "testClassMigrationWithSubclasses",
  51524. protocol: "tests",
  51525. args: [],
  51526. 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\x09theClass := ObjectMock subclass: #ObjectMock2\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock subclasses equals: {ObjectMock2}.\x0a\x09self assert: ObjectMock2 subclasses equals: {ObjectMock3}.\x0a\x09self assert: ObjectMock3 subclasses equals: {ObjectMock4}",
  51527. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "ObjectMock4"],
  51528. pragmas: [],
  51529. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "assert:equals:", "subclasses"]
  51530. }, function ($methodClass){ return function (){
  51531. var self=this,$self=this;
  51532. return $core.withContext(function($ctx1) {
  51533. $recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51534. [$recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests")
  51535. ,$ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1
  51536. ][0];
  51537. [$recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests")
  51538. ,$ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2
  51539. ][0];
  51540. $self.theClass=$recv($globals.ObjectMock)._subclass_instanceVariableNames_package_("ObjectMock2","","Kernel-Tests");
  51541. [$self._assert_equals_([$recv($globals.ObjectMock)._subclasses()
  51542. ,$ctx1.sendIdx["subclasses"]=1
  51543. ][0],[$globals.ObjectMock2])
  51544. ,$ctx1.sendIdx["assert:equals:"]=1
  51545. ][0];
  51546. [$self._assert_equals_([$recv($globals.ObjectMock2)._subclasses()
  51547. ,$ctx1.sendIdx["subclasses"]=2
  51548. ][0],[$globals.ObjectMock3])
  51549. ,$ctx1.sendIdx["assert:equals:"]=2
  51550. ][0];
  51551. $self._assert_equals_($recv($globals.ObjectMock3)._subclasses(),[$globals.ObjectMock4]);
  51552. return self;
  51553. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{})});
  51554. }; }),
  51555. $globals.ClassBuilderTest);
  51556. $core.addMethod(
  51557. $core.method({
  51558. selector: "testSubclass",
  51559. protocol: "tests",
  51560. args: [],
  51561. source: "testSubclass\x0a\x09theClass := builder addSubclassOf: ObjectMock named: 'ObjectMock2' instanceVariableNames: #(foo bar) package: 'Kernel-Tests'.\x0a\x09self assert: theClass superclass equals: ObjectMock.\x0a\x09self assert: theClass instanceVariableNames equals: #(foo bar).\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: (theClass package classes occurrencesOf: theClass) equals: 1.\x0a\x09self assert: theClass package equals: ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys size equals: 0",
  51562. referencedClasses: ["ObjectMock"],
  51563. pragmas: [],
  51564. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "assert:equals:", "superclass", "instanceVariableNames", "name", "occurrencesOf:", "classes", "package", "size", "keys", "methodDictionary"]
  51565. }, function ($methodClass){ return function (){
  51566. var self=this,$self=this;
  51567. return $core.withContext(function($ctx1) {
  51568. $self.theClass=$recv($self.builder)._addSubclassOf_named_instanceVariableNames_package_($globals.ObjectMock,"ObjectMock2",["foo", "bar"],"Kernel-Tests");
  51569. [$self._assert_equals_($recv($self.theClass)._superclass(),$globals.ObjectMock)
  51570. ,$ctx1.sendIdx["assert:equals:"]=1
  51571. ][0];
  51572. [$self._assert_equals_($recv($self.theClass)._instanceVariableNames(),["foo", "bar"])
  51573. ,$ctx1.sendIdx["assert:equals:"]=2
  51574. ][0];
  51575. [$self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2")
  51576. ,$ctx1.sendIdx["assert:equals:"]=3
  51577. ][0];
  51578. [$self._assert_equals_($recv($recv([$recv($self.theClass)._package()
  51579. ,$ctx1.sendIdx["package"]=1
  51580. ][0])._classes())._occurrencesOf_($self.theClass),(1))
  51581. ,$ctx1.sendIdx["assert:equals:"]=4
  51582. ][0];
  51583. [$self._assert_equals_([$recv($self.theClass)._package()
  51584. ,$ctx1.sendIdx["package"]=2
  51585. ][0],$recv($globals.ObjectMock)._package())
  51586. ,$ctx1.sendIdx["assert:equals:"]=5
  51587. ][0];
  51588. $self._assert_equals_($recv($recv($recv($self.theClass)._methodDictionary())._keys())._size(),(0));
  51589. return self;
  51590. }, function($ctx1) {$ctx1.fill(self,"testSubclass",{})});
  51591. }; }),
  51592. $globals.ClassBuilderTest);
  51593. $core.addMethod(
  51594. $core.method({
  51595. selector: "theClass",
  51596. protocol: "accessing",
  51597. args: [],
  51598. source: "theClass\x0a\x09^ theClass",
  51599. referencedClasses: [],
  51600. pragmas: [],
  51601. messageSends: []
  51602. }, function ($methodClass){ return function (){
  51603. var self=this,$self=this;
  51604. return $self.theClass;
  51605. }; }),
  51606. $globals.ClassBuilderTest);
  51607. $core.addClass("ClassTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  51608. $core.addMethod(
  51609. $core.method({
  51610. selector: "augmentMethodInstantiationOf:withAttachments:",
  51611. protocol: "running",
  51612. args: ["aMethod", "aHashedCollection"],
  51613. source: "augmentMethodInstantiationOf: aMethod withAttachments: aHashedCollection\x0a\x09| plain |\x0a\x09plain := aMethod instantiateFn.\x0a\x09aMethod instantiateFn: [ :arg |\x0a\x09\x09(plain value: arg)\x0a\x09\x09\x09basicAt: 'a$atx' put: aHashedCollection;\x0a\x09\x09\x09yourself ]",
  51614. referencedClasses: [],
  51615. pragmas: [],
  51616. messageSends: ["instantiateFn", "instantiateFn:", "basicAt:put:", "value:", "yourself"]
  51617. }, function ($methodClass){ return function (aMethod,aHashedCollection){
  51618. var self=this,$self=this;
  51619. var plain;
  51620. return $core.withContext(function($ctx1) {
  51621. var $1;
  51622. plain=$recv(aMethod)._instantiateFn();
  51623. $recv(aMethod)._instantiateFn_((function(arg){
  51624. return $core.withContext(function($ctx2) {
  51625. $1=$recv(plain)._value_(arg);
  51626. $recv($1)._basicAt_put_("a$atx",aHashedCollection);
  51627. return $recv($1)._yourself();
  51628. }, function($ctx2) {$ctx2.fillBlock({arg:arg},$ctx1,1)});
  51629. }));
  51630. return self;
  51631. }, function($ctx1) {$ctx1.fill(self,"augmentMethodInstantiationOf:withAttachments:",{aMethod:aMethod,aHashedCollection:aHashedCollection,plain:plain})});
  51632. }; }),
  51633. $globals.ClassTest);
  51634. $core.addMethod(
  51635. $core.method({
  51636. selector: "jsConstructor",
  51637. protocol: "running",
  51638. args: [],
  51639. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  51640. referencedClasses: [],
  51641. pragmas: [["inlineJS:", ["\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09"]]],
  51642. messageSends: []
  51643. }, function ($methodClass){ return function (){
  51644. var self=this,$self=this;
  51645. return $core.withContext(function($ctx1) {
  51646. function Foo(){}
  51647. Foo.prototype.valueOf = function () {return 4;};
  51648. return Foo;
  51649. ;
  51650. return self;
  51651. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{})});
  51652. }; }),
  51653. $globals.ClassTest);
  51654. $core.addMethod(
  51655. $core.method({
  51656. selector: "jsConstructorWithAction",
  51657. protocol: "running",
  51658. args: [],
  51659. source: "jsConstructorWithAction\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(aFoo){this.foo = aFoo;}\x0a\x09\x09return Foo;\x0a\x09'>",
  51660. referencedClasses: [],
  51661. pragmas: [["inlineJS:", ["\x0a\x09\x09function Foo(aFoo){this.foo = aFoo;}\x0a\x09\x09return Foo;\x0a\x09"]]],
  51662. messageSends: []
  51663. }, function ($methodClass){ return function (){
  51664. var self=this,$self=this;
  51665. return $core.withContext(function($ctx1) {
  51666. function Foo(aFoo){this.foo = aFoo;}
  51667. return Foo;
  51668. ;
  51669. return self;
  51670. }, function($ctx1) {$ctx1.fill(self,"jsConstructorWithAction",{})});
  51671. }; }),
  51672. $globals.ClassTest);
  51673. $core.addMethod(
  51674. $core.method({
  51675. selector: "setUp",
  51676. protocol: "running",
  51677. args: [],
  51678. source: "setUp\x0a\x09builder := ClassBuilder new",
  51679. referencedClasses: ["ClassBuilder"],
  51680. pragmas: [],
  51681. messageSends: ["new"]
  51682. }, function ($methodClass){ return function (){
  51683. var self=this,$self=this;
  51684. return $core.withContext(function($ctx1) {
  51685. $self.builder=$recv($globals.ClassBuilder)._new();
  51686. return self;
  51687. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  51688. }; }),
  51689. $globals.ClassTest);
  51690. $core.addMethod(
  51691. $core.method({
  51692. selector: "testAllSubclasses",
  51693. protocol: "tests",
  51694. args: [],
  51695. 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",
  51696. referencedClasses: ["Object"],
  51697. pragmas: [],
  51698. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  51699. }, function ($methodClass){ return function (){
  51700. var self=this,$self=this;
  51701. var subclasses,index;
  51702. return $core.withContext(function($ctx1) {
  51703. subclasses=[$recv($globals.Object)._subclasses()
  51704. ,$ctx1.sendIdx["subclasses"]=1
  51705. ][0];
  51706. index=(1);
  51707. $recv((function(){
  51708. return $core.withContext(function($ctx2) {
  51709. return $recv(index).__gt($recv(subclasses)._size());
  51710. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51711. }))._whileFalse_((function(){
  51712. return $core.withContext(function($ctx2) {
  51713. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  51714. index=$recv(index).__plus((1));
  51715. return index;
  51716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51717. }));
  51718. $self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  51719. return self;
  51720. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index})});
  51721. }; }),
  51722. $globals.ClassTest);
  51723. $core.addMethod(
  51724. $core.method({
  51725. selector: "testAlternateConstructorViaSelector",
  51726. protocol: "tests",
  51727. args: [],
  51728. source: "testAlternateConstructorViaSelector\x0a\x09| instance block |\x0a\x09block := ObjectMock alternateConstructorViaSelector: #foo:.\x0a\x0a\x09instance := block newValue: 4.\x0a\x09self assert: instance class == ObjectMock.\x0a\x09self assert: instance foo equals: 4.\x0a\x09self shouldnt: [ instance foo: 9 ] raise: Error.\x0a\x09self assert: instance foo equals: 9",
  51729. referencedClasses: ["ObjectMock", "Error"],
  51730. pragmas: [],
  51731. messageSends: ["alternateConstructorViaSelector:", "newValue:", "assert:", "==", "class", "assert:equals:", "foo", "shouldnt:raise:", "foo:"]
  51732. }, function ($methodClass){ return function (){
  51733. var self=this,$self=this;
  51734. var instance,block;
  51735. return $core.withContext(function($ctx1) {
  51736. block=$recv($globals.ObjectMock)._alternateConstructorViaSelector_("foo:");
  51737. instance=$recv(block)._newValue_((4));
  51738. $self._assert_($recv($recv(instance)._class()).__eq_eq($globals.ObjectMock));
  51739. [$self._assert_equals_([$recv(instance)._foo()
  51740. ,$ctx1.sendIdx["foo"]=1
  51741. ][0],(4))
  51742. ,$ctx1.sendIdx["assert:equals:"]=1
  51743. ][0];
  51744. $self._shouldnt_raise_((function(){
  51745. return $core.withContext(function($ctx2) {
  51746. return $recv(instance)._foo_((9));
  51747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51748. }),$globals.Error);
  51749. $self._assert_equals_($recv(instance)._foo(),(9));
  51750. return self;
  51751. }, function($ctx1) {$ctx1.fill(self,"testAlternateConstructorViaSelector",{instance:instance,block:block})});
  51752. }; }),
  51753. $globals.ClassTest);
  51754. $core.addMethod(
  51755. $core.method({
  51756. selector: "testApplySuperConstructor",
  51757. protocol: "tests",
  51758. args: [],
  51759. source: "testApplySuperConstructor\x0a\x09| instance constructor |\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09constructor := self jsConstructorWithAction.\x0a\x09theClass beJavaScriptSubclassOf: constructor.\x0a\x09Compiler new\x0a\x09\x09install: 'bar: anObject\x0a\x09\x09\x09ObjectMock2\x0a\x09\x09\x09\x09applySuperConstructorOn: self\x0a\x09\x09\x09\x09withArguments: {anObject}'\x0a\x09\x09forClass: theClass\x0a\x09\x09protocol: 'tests'.\x0a\x09\x22testing specific to late-coupled detached root class\x22\x0a\x09instance := (theClass alternateConstructorViaSelector: #bar:) newValue: 7.\x0a\x09self assert: instance class == theClass.\x0a\x09self assert: instance isJavaScriptInstanceOf: constructor.\x0a\x09self assert: instance foo equals: 7",
  51760. referencedClasses: ["ObjectMock", "Compiler"],
  51761. pragmas: [],
  51762. messageSends: ["copyClass:named:", "jsConstructorWithAction", "beJavaScriptSubclassOf:", "install:forClass:protocol:", "new", "newValue:", "alternateConstructorViaSelector:", "assert:", "==", "class", "assert:isJavaScriptInstanceOf:", "assert:equals:", "foo"]
  51763. }, function ($methodClass){ return function (){
  51764. var self=this,$self=this;
  51765. var instance,constructor;
  51766. return $core.withContext(function($ctx1) {
  51767. $self.theClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51768. constructor=$self._jsConstructorWithAction();
  51769. $recv($self.theClass)._beJavaScriptSubclassOf_(constructor);
  51770. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_("bar: anObject\x0a\x09\x09\x09ObjectMock2\x0a\x09\x09\x09\x09applySuperConstructorOn: self\x0a\x09\x09\x09\x09withArguments: {anObject}",$self.theClass,"tests");
  51771. instance=$recv($recv($self.theClass)._alternateConstructorViaSelector_("bar:"))._newValue_((7));
  51772. $self._assert_($recv($recv(instance)._class()).__eq_eq($self.theClass));
  51773. $self._assert_isJavaScriptInstanceOf_(instance,constructor);
  51774. $self._assert_equals_($recv(instance)._foo(),(7));
  51775. return self;
  51776. }, function($ctx1) {$ctx1.fill(self,"testApplySuperConstructor",{instance:instance,constructor:constructor})});
  51777. }; }),
  51778. $globals.ClassTest);
  51779. $core.addMethod(
  51780. $core.method({
  51781. selector: "testBeJavaScriptSubclassOf",
  51782. protocol: "tests",
  51783. args: [],
  51784. source: "testBeJavaScriptSubclassOf\x0a\x09| instance constructor |\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09constructor := self jsConstructor.\x0a\x09theClass beJavaScriptSubclassOf: constructor.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass isClassCopyOf: ObjectMock.\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 isJavaScriptInstanceOf: constructor.\x0a\x09self assert: instance value equals: 4.\x0a\x09self shouldnt: [ instance foo: 9 ] raise: Error.\x0a\x09self assert: instance foo equals: 9",
  51785. referencedClasses: ["ObjectMock", "Error"],
  51786. pragmas: [],
  51787. messageSends: ["copyClass:named:", "jsConstructor", "beJavaScriptSubclassOf:", "assert:equals:", "name", "assert:isClassCopyOf:", "new", "assert:", "==", "class", "assert:isJavaScriptInstanceOf:", "value", "shouldnt:raise:", "foo:", "foo"]
  51788. }, function ($methodClass){ return function (){
  51789. var self=this,$self=this;
  51790. var instance,constructor;
  51791. return $core.withContext(function($ctx1) {
  51792. $self.theClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51793. constructor=$self._jsConstructor();
  51794. $recv($self.theClass)._beJavaScriptSubclassOf_(constructor);
  51795. [$self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2")
  51796. ,$ctx1.sendIdx["assert:equals:"]=1
  51797. ][0];
  51798. $self._assert_isClassCopyOf_($self.theClass,$globals.ObjectMock);
  51799. instance=$recv($self.theClass)._new();
  51800. $self._assert_($recv($recv(instance)._class()).__eq_eq($self.theClass));
  51801. $self._assert_isJavaScriptInstanceOf_(instance,constructor);
  51802. [$self._assert_equals_($recv(instance)._value(),(4))
  51803. ,$ctx1.sendIdx["assert:equals:"]=2
  51804. ][0];
  51805. $self._shouldnt_raise_((function(){
  51806. return $core.withContext(function($ctx2) {
  51807. return $recv(instance)._foo_((9));
  51808. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51809. }),$globals.Error);
  51810. $self._assert_equals_($recv(instance)._foo(),(9));
  51811. return self;
  51812. }, function($ctx1) {$ctx1.fill(self,"testBeJavaScriptSubclassOf",{instance:instance,constructor:constructor})});
  51813. }; }),
  51814. $globals.ClassTest);
  51815. $core.addMethod(
  51816. $core.method({
  51817. selector: "testMetaclassSubclasses",
  51818. protocol: "tests",
  51819. args: [],
  51820. 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",
  51821. referencedClasses: ["Object"],
  51822. pragmas: [],
  51823. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  51824. }, function ($methodClass){ return function (){
  51825. var self=this,$self=this;
  51826. var subclasses;
  51827. return $core.withContext(function($ctx1) {
  51828. subclasses=$recv($recv([$recv($recv([$recv($globals.Object)._class()
  51829. ,$ctx1.sendIdx["class"]=1
  51830. ][0])._instanceClass())._subclasses()
  51831. ,$ctx1.sendIdx["subclasses"]=1
  51832. ][0])._select_((function(each){
  51833. return $core.withContext(function($ctx2) {
  51834. return $recv($recv(each)._isMetaclass())._not();
  51835. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51836. })))._collect_((function(each){
  51837. return $core.withContext(function($ctx2) {
  51838. return $recv(each)._theMetaClass();
  51839. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  51840. }));
  51841. $self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  51842. return self;
  51843. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses})});
  51844. }; }),
  51845. $globals.ClassTest);
  51846. $core.addMethod(
  51847. $core.method({
  51848. selector: "testMethodAttachmentsAreAdded",
  51849. protocol: "tests",
  51850. args: [],
  51851. source: "testMethodAttachmentsAreAdded\x0a\x09| instance theMethod anObject |\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09anObject := #{#foo -> 'oof'}.\x0a\x09theMethod := Compiler new\x0a\x09\x09compile: 'bar' forClass: ObjectMock2 protocol: '**test'.\x0a\x09self\x0a\x09\x09augmentMethodInstantiationOf: theMethod\x0a\x09\x09withAttachments: #{#a -> 42. #b -> anObject}.\x0a\x09ObjectMock2 addCompiledMethod: theMethod.\x0a\x09self assert: (ObjectMock2 new basicAt: #a) equals: 42.\x0a\x09self assert: (ObjectMock2 new basicAt: #b) equals: anObject",
  51852. referencedClasses: ["ObjectMock", "Compiler", "ObjectMock2"],
  51853. pragmas: [],
  51854. messageSends: ["copyClass:named:", "compile:forClass:protocol:", "new", "augmentMethodInstantiationOf:withAttachments:", "addCompiledMethod:", "assert:equals:", "basicAt:"]
  51855. }, function ($methodClass){ return function (){
  51856. var self=this,$self=this;
  51857. var instance,theMethod,anObject;
  51858. return $core.withContext(function($ctx1) {
  51859. $self.theClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51860. anObject=$globals.HashedCollection._newFromPairs_(["foo","oof"]);
  51861. theMethod=$recv([$recv($globals.Compiler)._new()
  51862. ,$ctx1.sendIdx["new"]=1
  51863. ][0])._compile_forClass_protocol_("bar",$globals.ObjectMock2,"**test");
  51864. $self._augmentMethodInstantiationOf_withAttachments_(theMethod,$globals.HashedCollection._newFromPairs_(["a",(42),"b",anObject]));
  51865. $recv($globals.ObjectMock2)._addCompiledMethod_(theMethod);
  51866. [$self._assert_equals_([$recv([$recv($globals.ObjectMock2)._new()
  51867. ,$ctx1.sendIdx["new"]=2
  51868. ][0])._basicAt_("a")
  51869. ,$ctx1.sendIdx["basicAt:"]=1
  51870. ][0],(42))
  51871. ,$ctx1.sendIdx["assert:equals:"]=1
  51872. ][0];
  51873. $self._assert_equals_($recv($recv($globals.ObjectMock2)._new())._basicAt_("b"),anObject);
  51874. return self;
  51875. }, function($ctx1) {$ctx1.fill(self,"testMethodAttachmentsAreAdded",{instance:instance,theMethod:theMethod,anObject:anObject})});
  51876. }; }),
  51877. $globals.ClassTest);
  51878. $core.addMethod(
  51879. $core.method({
  51880. selector: "testMethodAttachmentsAreRemoved",
  51881. protocol: "tests",
  51882. args: [],
  51883. source: "testMethodAttachmentsAreRemoved\x0a\x09| instance theMethod anObject |\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09anObject := #{#foo -> 'oof'}.\x0a\x09theMethod := Compiler new\x0a\x09\x09compile: 'bar' forClass: ObjectMock2 protocol: '**test'.\x0a\x09self\x0a\x09\x09augmentMethodInstantiationOf: theMethod\x0a\x09\x09withAttachments: #{#a -> 42. #b -> anObject}.\x0a\x09ObjectMock2 addCompiledMethod: theMethod.\x0a\x09theMethod := Compiler new\x0a\x09\x09compile: 'bar' forClass: ObjectMock2 protocol: '**test'.\x0a\x09ObjectMock2 addCompiledMethod: theMethod.\x0a\x09self assert: (ObjectMock2 new basicAt: #a) equals: nil.\x0a\x09self assert: (ObjectMock2 new basicAt: #b) equals: nil",
  51884. referencedClasses: ["ObjectMock", "Compiler", "ObjectMock2"],
  51885. pragmas: [],
  51886. messageSends: ["copyClass:named:", "compile:forClass:protocol:", "new", "augmentMethodInstantiationOf:withAttachments:", "addCompiledMethod:", "assert:equals:", "basicAt:"]
  51887. }, function ($methodClass){ return function (){
  51888. var self=this,$self=this;
  51889. var instance,theMethod,anObject;
  51890. return $core.withContext(function($ctx1) {
  51891. $self.theClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51892. anObject=$globals.HashedCollection._newFromPairs_(["foo","oof"]);
  51893. theMethod=[$recv([$recv($globals.Compiler)._new()
  51894. ,$ctx1.sendIdx["new"]=1
  51895. ][0])._compile_forClass_protocol_("bar",$globals.ObjectMock2,"**test")
  51896. ,$ctx1.sendIdx["compile:forClass:protocol:"]=1
  51897. ][0];
  51898. $self._augmentMethodInstantiationOf_withAttachments_(theMethod,$globals.HashedCollection._newFromPairs_(["a",(42),"b",anObject]));
  51899. [$recv($globals.ObjectMock2)._addCompiledMethod_(theMethod)
  51900. ,$ctx1.sendIdx["addCompiledMethod:"]=1
  51901. ][0];
  51902. theMethod=$recv([$recv($globals.Compiler)._new()
  51903. ,$ctx1.sendIdx["new"]=2
  51904. ][0])._compile_forClass_protocol_("bar",$globals.ObjectMock2,"**test");
  51905. $recv($globals.ObjectMock2)._addCompiledMethod_(theMethod);
  51906. [$self._assert_equals_([$recv([$recv($globals.ObjectMock2)._new()
  51907. ,$ctx1.sendIdx["new"]=3
  51908. ][0])._basicAt_("a")
  51909. ,$ctx1.sendIdx["basicAt:"]=1
  51910. ][0],nil)
  51911. ,$ctx1.sendIdx["assert:equals:"]=1
  51912. ][0];
  51913. $self._assert_equals_($recv($recv($globals.ObjectMock2)._new())._basicAt_("b"),nil);
  51914. return self;
  51915. }, function($ctx1) {$ctx1.fill(self,"testMethodAttachmentsAreRemoved",{instance:instance,theMethod:theMethod,anObject:anObject})});
  51916. }; }),
  51917. $globals.ClassTest);
  51918. $core.addMethod(
  51919. $core.method({
  51920. selector: "testMethodAttachmentsAreRemoved2",
  51921. protocol: "tests",
  51922. args: [],
  51923. source: "testMethodAttachmentsAreRemoved2\x0a\x09| instance theMethod anObject |\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09anObject := #{#foo -> 'oof'}.\x0a\x09theMethod := Compiler new\x0a\x09\x09compile: 'bar' forClass: ObjectMock2 protocol: '**test'.\x0a\x09self\x0a\x09\x09augmentMethodInstantiationOf: theMethod\x0a\x09\x09withAttachments: #{#a -> 42. #b -> anObject}.\x0a\x09ObjectMock2 addCompiledMethod: theMethod.\x0a\x09ObjectMock2 new bar.\x0a\x09ObjectMock2 removeCompiledMethod: theMethod.\x0a\x09self assert: (ObjectMock2 new basicAt: #a) equals: nil.\x0a\x09self assert: (ObjectMock2 new basicAt: #b) equals: nil",
  51924. referencedClasses: ["ObjectMock", "Compiler", "ObjectMock2"],
  51925. pragmas: [],
  51926. messageSends: ["copyClass:named:", "compile:forClass:protocol:", "new", "augmentMethodInstantiationOf:withAttachments:", "addCompiledMethod:", "bar", "removeCompiledMethod:", "assert:equals:", "basicAt:"]
  51927. }, function ($methodClass){ return function (){
  51928. var self=this,$self=this;
  51929. var instance,theMethod,anObject;
  51930. return $core.withContext(function($ctx1) {
  51931. $self.theClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51932. anObject=$globals.HashedCollection._newFromPairs_(["foo","oof"]);
  51933. theMethod=$recv([$recv($globals.Compiler)._new()
  51934. ,$ctx1.sendIdx["new"]=1
  51935. ][0])._compile_forClass_protocol_("bar",$globals.ObjectMock2,"**test");
  51936. $self._augmentMethodInstantiationOf_withAttachments_(theMethod,$globals.HashedCollection._newFromPairs_(["a",(42),"b",anObject]));
  51937. $recv($globals.ObjectMock2)._addCompiledMethod_(theMethod);
  51938. $recv([$recv($globals.ObjectMock2)._new()
  51939. ,$ctx1.sendIdx["new"]=2
  51940. ][0])._bar();
  51941. $recv($globals.ObjectMock2)._removeCompiledMethod_(theMethod);
  51942. [$self._assert_equals_([$recv([$recv($globals.ObjectMock2)._new()
  51943. ,$ctx1.sendIdx["new"]=3
  51944. ][0])._basicAt_("a")
  51945. ,$ctx1.sendIdx["basicAt:"]=1
  51946. ][0],nil)
  51947. ,$ctx1.sendIdx["assert:equals:"]=1
  51948. ][0];
  51949. $self._assert_equals_($recv($recv($globals.ObjectMock2)._new())._basicAt_("b"),nil);
  51950. return self;
  51951. }, function($ctx1) {$ctx1.fill(self,"testMethodAttachmentsAreRemoved2",{instance:instance,theMethod:theMethod,anObject:anObject})});
  51952. }; }),
  51953. $globals.ClassTest);
  51954. $core.addMethod(
  51955. $core.method({
  51956. selector: "testMethodAttachmentsAreReplaced",
  51957. protocol: "tests",
  51958. args: [],
  51959. source: "testMethodAttachmentsAreReplaced\x0a\x09| instance theMethod anObject |\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09anObject := #{#foo -> 'oof'}.\x0a\x09theMethod := Compiler new\x0a\x09\x09compile: 'bar' forClass: ObjectMock2 protocol: '**test'.\x0a\x09self\x0a\x09\x09augmentMethodInstantiationOf: theMethod\x0a\x09\x09withAttachments: #{#a -> 42. #b -> anObject}.\x0a\x09ObjectMock2 addCompiledMethod: theMethod.\x0a\x09theMethod := Compiler new\x0a\x09\x09compile: 'bar' forClass: ObjectMock2 protocol: '**test'.\x0a\x09self\x0a\x09\x09augmentMethodInstantiationOf: theMethod\x0a\x09\x09withAttachments: #{#a -> 6. #c -> [^9]}.\x0a\x09ObjectMock2 addCompiledMethod: theMethod.\x0a\x09self assert: (ObjectMock2 new basicAt: #a) equals: 6.\x0a\x09self assert: (ObjectMock2 new basicAt: #b) equals: nil.\x0a\x09self assert: (ObjectMock2 new basicPerform: #c) equals: 9",
  51960. referencedClasses: ["ObjectMock", "Compiler", "ObjectMock2"],
  51961. pragmas: [],
  51962. messageSends: ["copyClass:named:", "compile:forClass:protocol:", "new", "augmentMethodInstantiationOf:withAttachments:", "addCompiledMethod:", "assert:equals:", "basicAt:", "basicPerform:"]
  51963. }, function ($methodClass){ return function (){
  51964. var self=this,$self=this;
  51965. var instance,theMethod,anObject;
  51966. return $core.withContext(function($ctx1) {
  51967. var $early={};
  51968. try {
  51969. $self.theClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51970. anObject=$globals.HashedCollection._newFromPairs_(["foo","oof"]);
  51971. theMethod=[$recv([$recv($globals.Compiler)._new()
  51972. ,$ctx1.sendIdx["new"]=1
  51973. ][0])._compile_forClass_protocol_("bar",$globals.ObjectMock2,"**test")
  51974. ,$ctx1.sendIdx["compile:forClass:protocol:"]=1
  51975. ][0];
  51976. [$self._augmentMethodInstantiationOf_withAttachments_(theMethod,$globals.HashedCollection._newFromPairs_(["a",(42),"b",anObject]))
  51977. ,$ctx1.sendIdx["augmentMethodInstantiationOf:withAttachments:"]=1
  51978. ][0];
  51979. [$recv($globals.ObjectMock2)._addCompiledMethod_(theMethod)
  51980. ,$ctx1.sendIdx["addCompiledMethod:"]=1
  51981. ][0];
  51982. theMethod=$recv([$recv($globals.Compiler)._new()
  51983. ,$ctx1.sendIdx["new"]=2
  51984. ][0])._compile_forClass_protocol_("bar",$globals.ObjectMock2,"**test");
  51985. $self._augmentMethodInstantiationOf_withAttachments_(theMethod,$globals.HashedCollection._newFromPairs_(["a",(6),"c",(function(){
  51986. throw $early=[(9)];
  51987. })]));
  51988. $recv($globals.ObjectMock2)._addCompiledMethod_(theMethod);
  51989. [$self._assert_equals_([$recv([$recv($globals.ObjectMock2)._new()
  51990. ,$ctx1.sendIdx["new"]=3
  51991. ][0])._basicAt_("a")
  51992. ,$ctx1.sendIdx["basicAt:"]=1
  51993. ][0],(6))
  51994. ,$ctx1.sendIdx["assert:equals:"]=1
  51995. ][0];
  51996. [$self._assert_equals_($recv([$recv($globals.ObjectMock2)._new()
  51997. ,$ctx1.sendIdx["new"]=4
  51998. ][0])._basicAt_("b"),nil)
  51999. ,$ctx1.sendIdx["assert:equals:"]=2
  52000. ][0];
  52001. $self._assert_equals_($recv($recv($globals.ObjectMock2)._new())._basicPerform_("c"),(9));
  52002. return self;
  52003. }
  52004. catch(e) {if(e===$early)return e[0]; throw e}
  52005. }, function($ctx1) {$ctx1.fill(self,"testMethodAttachmentsAreReplaced",{instance:instance,theMethod:theMethod,anObject:anObject})});
  52006. }; }),
  52007. $globals.ClassTest);
  52008. $core.addMethod(
  52009. $core.method({
  52010. selector: "testSetJavaScriptConstructor",
  52011. protocol: "tests",
  52012. args: [],
  52013. source: "testSetJavaScriptConstructor\x0a\x09| instance |\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09theClass javaScriptConstructor: self jsConstructor.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass isClassCopyOf: ObjectMock.\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",
  52014. referencedClasses: ["ObjectMock", "Error"],
  52015. pragmas: [],
  52016. messageSends: ["copyClass:named:", "javaScriptConstructor:", "jsConstructor", "assert:equals:", "name", "assert:isClassCopyOf:", "new", "assert:", "==", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52017. }, function ($methodClass){ return function (){
  52018. var self=this,$self=this;
  52019. var instance;
  52020. return $core.withContext(function($ctx1) {
  52021. $self.theClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52022. $recv($self.theClass)._javaScriptConstructor_($self._jsConstructor());
  52023. [$self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2")
  52024. ,$ctx1.sendIdx["assert:equals:"]=1
  52025. ][0];
  52026. $self._assert_isClassCopyOf_($self.theClass,$globals.ObjectMock);
  52027. instance=$recv($self.theClass)._new();
  52028. $self._assert_($recv($recv(instance)._class()).__eq_eq($self.theClass));
  52029. [$self._assert_equals_($recv(instance)._value(),(4))
  52030. ,$ctx1.sendIdx["assert:equals:"]=2
  52031. ][0];
  52032. $self._shouldnt_raise_((function(){
  52033. return $core.withContext(function($ctx2) {
  52034. return $recv(instance)._foo_((9));
  52035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52036. }),$globals.Error);
  52037. $self._assert_equals_($recv(instance)._foo(),(9));
  52038. return self;
  52039. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance})});
  52040. }; }),
  52041. $globals.ClassTest);
  52042. $core.addMethod(
  52043. $core.method({
  52044. selector: "testTrickySetJavaScriptConstructor",
  52045. protocol: "tests",
  52046. args: [],
  52047. source: "testTrickySetJavaScriptConstructor\x0a\x09| instance |\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09theClass javaScriptConstructor: self trickyJsConstructor.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass isClassCopyOf: ObjectMock.\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",
  52048. referencedClasses: ["ObjectMock", "Error"],
  52049. pragmas: [],
  52050. messageSends: ["copyClass:named:", "javaScriptConstructor:", "trickyJsConstructor", "assert:equals:", "name", "assert:isClassCopyOf:", "new", "assert:", "==", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52051. }, function ($methodClass){ return function (){
  52052. var self=this,$self=this;
  52053. var instance;
  52054. return $core.withContext(function($ctx1) {
  52055. $self.theClass=$recv($self.builder)._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52056. $recv($self.theClass)._javaScriptConstructor_($self._trickyJsConstructor());
  52057. [$self._assert_equals_($recv($self.theClass)._name(),"ObjectMock2")
  52058. ,$ctx1.sendIdx["assert:equals:"]=1
  52059. ][0];
  52060. $self._assert_isClassCopyOf_($self.theClass,$globals.ObjectMock);
  52061. instance=$recv($self.theClass)._new();
  52062. $self._assert_($recv($recv(instance)._class()).__eq_eq($self.theClass));
  52063. [$self._assert_equals_($recv(instance)._value(),(4))
  52064. ,$ctx1.sendIdx["assert:equals:"]=2
  52065. ][0];
  52066. $self._shouldnt_raise_((function(){
  52067. return $core.withContext(function($ctx2) {
  52068. return $recv(instance)._foo_((9));
  52069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52070. }),$globals.Error);
  52071. $self._assert_equals_($recv(instance)._foo(),(9));
  52072. return self;
  52073. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance})});
  52074. }; }),
  52075. $globals.ClassTest);
  52076. $core.addMethod(
  52077. $core.method({
  52078. selector: "theClass",
  52079. protocol: "accessing",
  52080. args: [],
  52081. source: "theClass\x0a\x09^ theClass",
  52082. referencedClasses: [],
  52083. pragmas: [],
  52084. messageSends: []
  52085. }, function ($methodClass){ return function (){
  52086. var self=this,$self=this;
  52087. return $self.theClass;
  52088. }; }),
  52089. $globals.ClassTest);
  52090. $core.addMethod(
  52091. $core.method({
  52092. selector: "trickyJsConstructor",
  52093. protocol: "running",
  52094. args: [],
  52095. 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'>",
  52096. referencedClasses: [],
  52097. pragmas: [["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"]]],
  52098. messageSends: []
  52099. }, function ($methodClass){ return function (){
  52100. var self=this,$self=this;
  52101. return $core.withContext(function($ctx1) {
  52102. function Foo(){}
  52103. Foo.prototype.valueOf = function () {return 4;};
  52104. Foo.prototype._foo = function () {return "bar";};
  52105. return Foo;
  52106. ;
  52107. return self;
  52108. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{})});
  52109. }; }),
  52110. $globals.ClassTest);
  52111. $core.addClass("CollectionTest", $globals.TestCase, ["sampleBlock"], "Kernel-Tests");
  52112. $core.addMethod(
  52113. $core.method({
  52114. selector: "assertSameContents:as:",
  52115. protocol: "convenience",
  52116. args: ["aCollection", "anotherCollection"],
  52117. 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)) ]",
  52118. referencedClasses: [],
  52119. pragmas: [],
  52120. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  52121. }, function ($methodClass){ return function (aCollection,anotherCollection){
  52122. var self=this,$self=this;
  52123. return $core.withContext(function($ctx1) {
  52124. [$self._assert_([$recv([$recv(aCollection)._size()
  52125. ,$ctx1.sendIdx["size"]=1
  52126. ][0]).__eq($recv(anotherCollection)._size())
  52127. ,$ctx1.sendIdx["="]=1
  52128. ][0])
  52129. ,$ctx1.sendIdx["assert:"]=1
  52130. ][0];
  52131. $recv(aCollection)._do_((function(each){
  52132. return $core.withContext(function($ctx2) {
  52133. return $self._assert_($recv([$recv(aCollection)._occurrencesOf_(each)
  52134. ,$ctx2.sendIdx["occurrencesOf:"]=1
  52135. ][0]).__eq($recv(anotherCollection)._occurrencesOf_(each)));
  52136. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52137. }));
  52138. return self;
  52139. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection})});
  52140. }; }),
  52141. $globals.CollectionTest);
  52142. $core.addMethod(
  52143. $core.method({
  52144. selector: "collection",
  52145. protocol: "fixture",
  52146. args: [],
  52147. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  52148. referencedClasses: [],
  52149. pragmas: [],
  52150. messageSends: ["subclassResponsibility"]
  52151. }, function ($methodClass){ return function (){
  52152. var self=this,$self=this;
  52153. return $core.withContext(function($ctx1) {
  52154. $self._subclassResponsibility();
  52155. return self;
  52156. }, function($ctx1) {$ctx1.fill(self,"collection",{})});
  52157. }; }),
  52158. $globals.CollectionTest);
  52159. $core.addMethod(
  52160. $core.method({
  52161. selector: "collectionClass",
  52162. protocol: "fixture",
  52163. args: [],
  52164. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  52165. referencedClasses: [],
  52166. pragmas: [],
  52167. messageSends: ["collectionClass", "class"]
  52168. }, function ($methodClass){ return function (){
  52169. var self=this,$self=this;
  52170. return $core.withContext(function($ctx1) {
  52171. return $recv($self._class())._collectionClass();
  52172. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{})});
  52173. }; }),
  52174. $globals.CollectionTest);
  52175. $core.addMethod(
  52176. $core.method({
  52177. selector: "collectionOfPrintStrings",
  52178. protocol: "fixture",
  52179. args: [],
  52180. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  52181. referencedClasses: [],
  52182. pragmas: [],
  52183. messageSends: ["subclassResponsibility"]
  52184. }, function ($methodClass){ return function (){
  52185. var self=this,$self=this;
  52186. return $core.withContext(function($ctx1) {
  52187. $self._subclassResponsibility();
  52188. return self;
  52189. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{})});
  52190. }; }),
  52191. $globals.CollectionTest);
  52192. $core.addMethod(
  52193. $core.method({
  52194. selector: "collectionSize",
  52195. protocol: "fixture",
  52196. args: [],
  52197. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  52198. referencedClasses: [],
  52199. pragmas: [],
  52200. messageSends: ["subclassResponsibility"]
  52201. }, function ($methodClass){ return function (){
  52202. var self=this,$self=this;
  52203. return $core.withContext(function($ctx1) {
  52204. $self._subclassResponsibility();
  52205. return self;
  52206. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{})});
  52207. }; }),
  52208. $globals.CollectionTest);
  52209. $core.addMethod(
  52210. $core.method({
  52211. selector: "collectionWithDuplicates",
  52212. protocol: "fixture",
  52213. args: [],
  52214. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly six distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  52215. referencedClasses: [],
  52216. pragmas: [],
  52217. messageSends: ["subclassResponsibility"]
  52218. }, function ($methodClass){ return function (){
  52219. var self=this,$self=this;
  52220. return $core.withContext(function($ctx1) {
  52221. $self._subclassResponsibility();
  52222. return self;
  52223. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{})});
  52224. }; }),
  52225. $globals.CollectionTest);
  52226. $core.addMethod(
  52227. $core.method({
  52228. selector: "collectionWithNewValue",
  52229. protocol: "fixture",
  52230. args: [],
  52231. 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",
  52232. referencedClasses: [],
  52233. pragmas: [],
  52234. messageSends: ["subclassResponsibility"]
  52235. }, function ($methodClass){ return function (){
  52236. var self=this,$self=this;
  52237. return $core.withContext(function($ctx1) {
  52238. $self._subclassResponsibility();
  52239. return self;
  52240. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{})});
  52241. }; }),
  52242. $globals.CollectionTest);
  52243. $core.addMethod(
  52244. $core.method({
  52245. selector: "initialize",
  52246. protocol: "initialization",
  52247. args: [],
  52248. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  52249. referencedClasses: [],
  52250. pragmas: [],
  52251. messageSends: ["initialize"]
  52252. }, function ($methodClass){ return function (){
  52253. var self=this,$self=this;
  52254. return $core.withContext(function($ctx1) {
  52255. [(
  52256. $ctx1.supercall = true,
  52257. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  52258. ,$ctx1.supercall = false
  52259. ][0];
  52260. $self.sampleBlock=(function(){
  52261. });
  52262. return self;
  52263. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  52264. }; }),
  52265. $globals.CollectionTest);
  52266. $core.addMethod(
  52267. $core.method({
  52268. selector: "sampleNewValue",
  52269. protocol: "fixture",
  52270. args: [],
  52271. 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'",
  52272. referencedClasses: [],
  52273. pragmas: [],
  52274. messageSends: []
  52275. }, function ($methodClass){ return function (){
  52276. var self=this,$self=this;
  52277. return "N";
  52278. }; }),
  52279. $globals.CollectionTest);
  52280. $core.addMethod(
  52281. $core.method({
  52282. selector: "sampleNewValueAsCollection",
  52283. protocol: "fixture",
  52284. args: [],
  52285. 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",
  52286. referencedClasses: [],
  52287. pragmas: [],
  52288. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  52289. }, function ($methodClass){ return function (){
  52290. var self=this,$self=this;
  52291. return $core.withContext(function($ctx1) {
  52292. return $recv($self._collectionClass())._with_($self._sampleNewValue());
  52293. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{})});
  52294. }; }),
  52295. $globals.CollectionTest);
  52296. $core.addMethod(
  52297. $core.method({
  52298. selector: "testAddAll",
  52299. protocol: "tests",
  52300. args: [],
  52301. 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",
  52302. referencedClasses: [],
  52303. pragmas: [],
  52304. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52305. }, function ($methodClass){ return function (){
  52306. var self=this,$self=this;
  52307. return $core.withContext(function($ctx1) {
  52308. var $1,$2,$3,$4,$5;
  52309. $1=[$self._collection()
  52310. ,$ctx1.sendIdx["collection"]=1
  52311. ][0];
  52312. [$recv($1)._addAll_([$recv([$self._collectionClass()
  52313. ,$ctx1.sendIdx["collectionClass"]=1
  52314. ][0])._new()
  52315. ,$ctx1.sendIdx["new"]=1
  52316. ][0])
  52317. ,$ctx1.sendIdx["addAll:"]=1
  52318. ][0];
  52319. [$self._assert_equals_([$recv($1)._yourself()
  52320. ,$ctx1.sendIdx["yourself"]=1
  52321. ][0],[$self._collection()
  52322. ,$ctx1.sendIdx["collection"]=2
  52323. ][0])
  52324. ,$ctx1.sendIdx["assert:equals:"]=1
  52325. ][0];
  52326. $2=[$recv([$self._collectionClass()
  52327. ,$ctx1.sendIdx["collectionClass"]=2
  52328. ][0])._new()
  52329. ,$ctx1.sendIdx["new"]=2
  52330. ][0];
  52331. [$recv($2)._addAll_([$self._collection()
  52332. ,$ctx1.sendIdx["collection"]=3
  52333. ][0])
  52334. ,$ctx1.sendIdx["addAll:"]=2
  52335. ][0];
  52336. [$self._assert_equals_([$recv($2)._yourself()
  52337. ,$ctx1.sendIdx["yourself"]=2
  52338. ][0],[$self._collection()
  52339. ,$ctx1.sendIdx["collection"]=4
  52340. ][0])
  52341. ,$ctx1.sendIdx["assert:equals:"]=2
  52342. ][0];
  52343. $3=[$recv([$self._collectionClass()
  52344. ,$ctx1.sendIdx["collectionClass"]=3
  52345. ][0])._new()
  52346. ,$ctx1.sendIdx["new"]=3
  52347. ][0];
  52348. [$recv($3)._addAll_([$recv([$self._collectionClass()
  52349. ,$ctx1.sendIdx["collectionClass"]=4
  52350. ][0])._new()
  52351. ,$ctx1.sendIdx["new"]=4
  52352. ][0])
  52353. ,$ctx1.sendIdx["addAll:"]=3
  52354. ][0];
  52355. [$self._assert_equals_([$recv($3)._yourself()
  52356. ,$ctx1.sendIdx["yourself"]=3
  52357. ][0],$recv($self._collectionClass())._new())
  52358. ,$ctx1.sendIdx["assert:equals:"]=3
  52359. ][0];
  52360. $4=[$self._collection()
  52361. ,$ctx1.sendIdx["collection"]=5
  52362. ][0];
  52363. [$recv($4)._addAll_([$self._sampleNewValueAsCollection()
  52364. ,$ctx1.sendIdx["sampleNewValueAsCollection"]=1
  52365. ][0])
  52366. ,$ctx1.sendIdx["addAll:"]=4
  52367. ][0];
  52368. $self._assert_equals_([$recv($4)._yourself()
  52369. ,$ctx1.sendIdx["yourself"]=4
  52370. ][0],[$self._collectionWithNewValue()
  52371. ,$ctx1.sendIdx["collectionWithNewValue"]=1
  52372. ][0]);
  52373. $5=$self._sampleNewValueAsCollection();
  52374. $recv($5)._addAll_($self._collection());
  52375. $self._assertSameContents_as_($recv($5)._yourself(),$self._collectionWithNewValue());
  52376. return self;
  52377. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{})});
  52378. }; }),
  52379. $globals.CollectionTest);
  52380. $core.addMethod(
  52381. $core.method({
  52382. selector: "testAllSatisfy",
  52383. protocol: "tests",
  52384. args: [],
  52385. 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 ])",
  52386. referencedClasses: [],
  52387. pragmas: [],
  52388. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  52389. }, function ($methodClass){ return function (){
  52390. var self=this,$self=this;
  52391. var collection,anyOne;
  52392. return $core.withContext(function($ctx1) {
  52393. collection=$self._collection();
  52394. anyOne=$recv(collection)._anyOne();
  52395. $self._assert_([$recv(collection)._allSatisfy_((function(each){
  52396. return $core.withContext(function($ctx2) {
  52397. return $recv(collection)._includes_(each);
  52398. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52399. }))
  52400. ,$ctx1.sendIdx["allSatisfy:"]=1
  52401. ][0]);
  52402. $self._deny_($recv(collection)._allSatisfy_((function(each){
  52403. return $core.withContext(function($ctx2) {
  52404. return $recv(each).__tild_eq(anyOne);
  52405. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52406. })));
  52407. return self;
  52408. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne})});
  52409. }; }),
  52410. $globals.CollectionTest);
  52411. $core.addMethod(
  52412. $core.method({
  52413. selector: "testAnyOne",
  52414. protocol: "tests",
  52415. args: [],
  52416. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  52417. referencedClasses: ["Error"],
  52418. pragmas: [],
  52419. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  52420. }, function ($methodClass){ return function (){
  52421. var self=this,$self=this;
  52422. return $core.withContext(function($ctx1) {
  52423. $self._should_raise_((function(){
  52424. return $core.withContext(function($ctx2) {
  52425. return [$recv($recv($self._collectionClass())._new())._anyOne()
  52426. ,$ctx2.sendIdx["anyOne"]=1
  52427. ][0];
  52428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52429. }),$globals.Error);
  52430. $self._assert_($recv([$self._collection()
  52431. ,$ctx1.sendIdx["collection"]=1
  52432. ][0])._includes_($recv($self._collection())._anyOne()));
  52433. return self;
  52434. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{})});
  52435. }; }),
  52436. $globals.CollectionTest);
  52437. $core.addMethod(
  52438. $core.method({
  52439. selector: "testAnySatisfy",
  52440. protocol: "tests",
  52441. args: [],
  52442. 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 ])",
  52443. referencedClasses: ["Object"],
  52444. pragmas: [],
  52445. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  52446. }, function ($methodClass){ return function (){
  52447. var self=this,$self=this;
  52448. var anyOne;
  52449. return $core.withContext(function($ctx1) {
  52450. anyOne=$recv([$self._collection()
  52451. ,$ctx1.sendIdx["collection"]=1
  52452. ][0])._anyOne();
  52453. $self._assert_([$recv([$self._collection()
  52454. ,$ctx1.sendIdx["collection"]=2
  52455. ][0])._anySatisfy_((function(each){
  52456. return $core.withContext(function($ctx2) {
  52457. return [$recv(each).__eq(anyOne)
  52458. ,$ctx2.sendIdx["="]=1
  52459. ][0];
  52460. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52461. }))
  52462. ,$ctx1.sendIdx["anySatisfy:"]=1
  52463. ][0]);
  52464. $self._deny_($recv($self._collection())._anySatisfy_((function(each){
  52465. return $core.withContext(function($ctx2) {
  52466. return $recv(each).__eq($recv($globals.Object)._new());
  52467. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52468. })));
  52469. return self;
  52470. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne})});
  52471. }; }),
  52472. $globals.CollectionTest);
  52473. $core.addMethod(
  52474. $core.method({
  52475. selector: "testAsArray",
  52476. protocol: "tests",
  52477. args: [],
  52478. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  52479. referencedClasses: [],
  52480. pragmas: [],
  52481. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  52482. }, function ($methodClass){ return function (){
  52483. var self=this,$self=this;
  52484. return $core.withContext(function($ctx1) {
  52485. $self._assertSameContents_as_([$self._collection()
  52486. ,$ctx1.sendIdx["collection"]=1
  52487. ][0],$recv($self._collection())._asArray());
  52488. return self;
  52489. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{})});
  52490. }; }),
  52491. $globals.CollectionTest);
  52492. $core.addMethod(
  52493. $core.method({
  52494. selector: "testAsOrderedCollection",
  52495. protocol: "tests",
  52496. args: [],
  52497. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  52498. referencedClasses: [],
  52499. pragmas: [],
  52500. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  52501. }, function ($methodClass){ return function (){
  52502. var self=this,$self=this;
  52503. return $core.withContext(function($ctx1) {
  52504. $self._assertSameContents_as_([$self._collection()
  52505. ,$ctx1.sendIdx["collection"]=1
  52506. ][0],$recv($self._collection())._asOrderedCollection());
  52507. return self;
  52508. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{})});
  52509. }; }),
  52510. $globals.CollectionTest);
  52511. $core.addMethod(
  52512. $core.method({
  52513. selector: "testAsSet",
  52514. protocol: "tests",
  52515. args: [],
  52516. 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) ]",
  52517. referencedClasses: [],
  52518. pragmas: [],
  52519. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  52520. }, function ($methodClass){ return function (){
  52521. var self=this,$self=this;
  52522. var c,set;
  52523. return $core.withContext(function($ctx1) {
  52524. c=$self._collectionWithDuplicates();
  52525. set=$recv(c)._asSet();
  52526. $self._assert_equals_($recv(set)._size(),(6));
  52527. $recv(c)._do_((function(each){
  52528. return $core.withContext(function($ctx2) {
  52529. return $self._assert_($recv(set)._includes_(each));
  52530. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52531. }));
  52532. return self;
  52533. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set})});
  52534. }; }),
  52535. $globals.CollectionTest);
  52536. $core.addMethod(
  52537. $core.method({
  52538. selector: "testCollect",
  52539. protocol: "tests",
  52540. args: [],
  52541. 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",
  52542. referencedClasses: [],
  52543. pragmas: [],
  52544. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  52545. }, function ($methodClass){ return function (){
  52546. var self=this,$self=this;
  52547. return $core.withContext(function($ctx1) {
  52548. [$self._assert_equals_([$recv([$self._collection()
  52549. ,$ctx1.sendIdx["collection"]=1
  52550. ][0])._collect_((function(each){
  52551. return each;
  52552. }))
  52553. ,$ctx1.sendIdx["collect:"]=1
  52554. ][0],[$self._collection()
  52555. ,$ctx1.sendIdx["collection"]=2
  52556. ][0])
  52557. ,$ctx1.sendIdx["assert:equals:"]=1
  52558. ][0];
  52559. [$self._assert_equals_([$recv([$self._collectionWithNewValue()
  52560. ,$ctx1.sendIdx["collectionWithNewValue"]=1
  52561. ][0])._collect_((function(each){
  52562. return each;
  52563. }))
  52564. ,$ctx1.sendIdx["collect:"]=2
  52565. ][0],$self._collectionWithNewValue())
  52566. ,$ctx1.sendIdx["assert:equals:"]=2
  52567. ][0];
  52568. [$self._assert_equals_([$recv([$recv([$self._collectionClass()
  52569. ,$ctx1.sendIdx["collectionClass"]=1
  52570. ][0])._new()
  52571. ,$ctx1.sendIdx["new"]=1
  52572. ][0])._collect_((function(each){
  52573. return $core.withContext(function($ctx2) {
  52574. return [$recv(each)._printString()
  52575. ,$ctx2.sendIdx["printString"]=1
  52576. ][0];
  52577. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  52578. }))
  52579. ,$ctx1.sendIdx["collect:"]=3
  52580. ][0],$recv($self._collectionClass())._new())
  52581. ,$ctx1.sendIdx["assert:equals:"]=3
  52582. ][0];
  52583. [$self._assert_equals_($recv([$recv([$self._collection()
  52584. ,$ctx1.sendIdx["collection"]=3
  52585. ][0])._collect_((function(){
  52586. return $core.withContext(function($ctx2) {
  52587. return [$self._sampleNewValue()
  52588. ,$ctx2.sendIdx["sampleNewValue"]=1
  52589. ][0];
  52590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  52591. }))
  52592. ,$ctx1.sendIdx["collect:"]=4
  52593. ][0])._detect_((function(){
  52594. return true;
  52595. })),$self._sampleNewValue())
  52596. ,$ctx1.sendIdx["assert:equals:"]=4
  52597. ][0];
  52598. $self._assert_equals_($recv($self._collection())._collect_((function(each){
  52599. return $core.withContext(function($ctx2) {
  52600. return $recv(each)._printString();
  52601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52602. })),$self._collectionOfPrintStrings());
  52603. return self;
  52604. }, function($ctx1) {$ctx1.fill(self,"testCollect",{})});
  52605. }; }),
  52606. $globals.CollectionTest);
  52607. $core.addMethod(
  52608. $core.method({
  52609. selector: "testComma",
  52610. protocol: "tests",
  52611. args: [],
  52612. 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",
  52613. referencedClasses: [],
  52614. pragmas: [],
  52615. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52616. }, function ($methodClass){ return function (){
  52617. var self=this,$self=this;
  52618. return $core.withContext(function($ctx1) {
  52619. [$self._assert_equals_([$recv([$self._collection()
  52620. ,$ctx1.sendIdx["collection"]=1
  52621. ][0]).__comma([$recv([$self._collectionClass()
  52622. ,$ctx1.sendIdx["collectionClass"]=1
  52623. ][0])._new()
  52624. ,$ctx1.sendIdx["new"]=1
  52625. ][0])
  52626. ,$ctx1.sendIdx[","]=1
  52627. ][0],[$self._collection()
  52628. ,$ctx1.sendIdx["collection"]=2
  52629. ][0])
  52630. ,$ctx1.sendIdx["assert:equals:"]=1
  52631. ][0];
  52632. [$self._assert_equals_([$recv([$recv([$self._collectionClass()
  52633. ,$ctx1.sendIdx["collectionClass"]=2
  52634. ][0])._new()
  52635. ,$ctx1.sendIdx["new"]=2
  52636. ][0]).__comma([$self._collection()
  52637. ,$ctx1.sendIdx["collection"]=3
  52638. ][0])
  52639. ,$ctx1.sendIdx[","]=2
  52640. ][0],[$self._collection()
  52641. ,$ctx1.sendIdx["collection"]=4
  52642. ][0])
  52643. ,$ctx1.sendIdx["assert:equals:"]=2
  52644. ][0];
  52645. [$self._assert_equals_([$recv([$recv([$self._collectionClass()
  52646. ,$ctx1.sendIdx["collectionClass"]=3
  52647. ][0])._new()
  52648. ,$ctx1.sendIdx["new"]=3
  52649. ][0]).__comma([$recv([$self._collectionClass()
  52650. ,$ctx1.sendIdx["collectionClass"]=4
  52651. ][0])._new()
  52652. ,$ctx1.sendIdx["new"]=4
  52653. ][0])
  52654. ,$ctx1.sendIdx[","]=3
  52655. ][0],$recv($self._collectionClass())._new())
  52656. ,$ctx1.sendIdx["assert:equals:"]=3
  52657. ][0];
  52658. $self._assert_equals_([$recv([$self._collection()
  52659. ,$ctx1.sendIdx["collection"]=5
  52660. ][0]).__comma([$self._sampleNewValueAsCollection()
  52661. ,$ctx1.sendIdx["sampleNewValueAsCollection"]=1
  52662. ][0])
  52663. ,$ctx1.sendIdx[","]=4
  52664. ][0],[$self._collectionWithNewValue()
  52665. ,$ctx1.sendIdx["collectionWithNewValue"]=1
  52666. ][0]);
  52667. $self._assertSameContents_as_($recv($self._sampleNewValueAsCollection()).__comma($self._collection()),$self._collectionWithNewValue());
  52668. return self;
  52669. }, function($ctx1) {$ctx1.fill(self,"testComma",{})});
  52670. }; }),
  52671. $globals.CollectionTest);
  52672. $core.addMethod(
  52673. $core.method({
  52674. selector: "testCopy",
  52675. protocol: "tests",
  52676. args: [],
  52677. 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",
  52678. referencedClasses: [],
  52679. pragmas: [],
  52680. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  52681. }, function ($methodClass){ return function (){
  52682. var self=this,$self=this;
  52683. return $core.withContext(function($ctx1) {
  52684. [$self._assert_equals_([$recv([$recv([$self._collectionClass()
  52685. ,$ctx1.sendIdx["collectionClass"]=1
  52686. ][0])._new()
  52687. ,$ctx1.sendIdx["new"]=1
  52688. ][0])._copy()
  52689. ,$ctx1.sendIdx["copy"]=1
  52690. ][0],[$recv([$self._collectionClass()
  52691. ,$ctx1.sendIdx["collectionClass"]=2
  52692. ][0])._new()
  52693. ,$ctx1.sendIdx["new"]=2
  52694. ][0])
  52695. ,$ctx1.sendIdx["assert:equals:"]=1
  52696. ][0];
  52697. [$self._assert_equals_([$recv([$self._collection()
  52698. ,$ctx1.sendIdx["collection"]=1
  52699. ][0])._copy()
  52700. ,$ctx1.sendIdx["copy"]=2
  52701. ][0],[$self._collection()
  52702. ,$ctx1.sendIdx["collection"]=2
  52703. ][0])
  52704. ,$ctx1.sendIdx["assert:equals:"]=2
  52705. ][0];
  52706. $self._assert_equals_([$recv([$self._collectionWithNewValue()
  52707. ,$ctx1.sendIdx["collectionWithNewValue"]=1
  52708. ][0])._copy()
  52709. ,$ctx1.sendIdx["copy"]=3
  52710. ][0],[$self._collectionWithNewValue()
  52711. ,$ctx1.sendIdx["collectionWithNewValue"]=2
  52712. ][0]);
  52713. [$self._deny_([$recv([$recv([$recv([$self._collectionClass()
  52714. ,$ctx1.sendIdx["collectionClass"]=3
  52715. ][0])._new()
  52716. ,$ctx1.sendIdx["new"]=3
  52717. ][0])._copy()
  52718. ,$ctx1.sendIdx["copy"]=4
  52719. ][0]).__eq([$self._collection()
  52720. ,$ctx1.sendIdx["collection"]=3
  52721. ][0])
  52722. ,$ctx1.sendIdx["="]=1
  52723. ][0])
  52724. ,$ctx1.sendIdx["deny:"]=1
  52725. ][0];
  52726. [$self._deny_([$recv([$recv([$self._collection()
  52727. ,$ctx1.sendIdx["collection"]=4
  52728. ][0])._copy()
  52729. ,$ctx1.sendIdx["copy"]=5
  52730. ][0]).__eq($recv($self._collectionClass())._new())
  52731. ,$ctx1.sendIdx["="]=2
  52732. ][0])
  52733. ,$ctx1.sendIdx["deny:"]=2
  52734. ][0];
  52735. $self._deny_($recv($recv($self._collection())._copy()).__eq($self._collectionWithNewValue()));
  52736. return self;
  52737. }, function($ctx1) {$ctx1.fill(self,"testCopy",{})});
  52738. }; }),
  52739. $globals.CollectionTest);
  52740. $core.addMethod(
  52741. $core.method({
  52742. selector: "testCopyEmpty",
  52743. protocol: "tests",
  52744. args: [],
  52745. source: "testCopyEmpty\x0a\x09self assert: self collectionClass new copyEmpty equals: self collectionClass new.\x0a\x09self assert: self collection copyEmpty equals: self collectionClass new.\x0a\x09self assert: self collectionWithNewValue copyEmpty equals: self collectionClass new",
  52746. referencedClasses: [],
  52747. pragmas: [],
  52748. messageSends: ["assert:equals:", "copyEmpty", "new", "collectionClass", "collection", "collectionWithNewValue"]
  52749. }, function ($methodClass){ return function (){
  52750. var self=this,$self=this;
  52751. return $core.withContext(function($ctx1) {
  52752. [$self._assert_equals_([$recv([$recv([$self._collectionClass()
  52753. ,$ctx1.sendIdx["collectionClass"]=1
  52754. ][0])._new()
  52755. ,$ctx1.sendIdx["new"]=1
  52756. ][0])._copyEmpty()
  52757. ,$ctx1.sendIdx["copyEmpty"]=1
  52758. ][0],[$recv([$self._collectionClass()
  52759. ,$ctx1.sendIdx["collectionClass"]=2
  52760. ][0])._new()
  52761. ,$ctx1.sendIdx["new"]=2
  52762. ][0])
  52763. ,$ctx1.sendIdx["assert:equals:"]=1
  52764. ][0];
  52765. [$self._assert_equals_([$recv($self._collection())._copyEmpty()
  52766. ,$ctx1.sendIdx["copyEmpty"]=2
  52767. ][0],[$recv([$self._collectionClass()
  52768. ,$ctx1.sendIdx["collectionClass"]=3
  52769. ][0])._new()
  52770. ,$ctx1.sendIdx["new"]=3
  52771. ][0])
  52772. ,$ctx1.sendIdx["assert:equals:"]=2
  52773. ][0];
  52774. $self._assert_equals_($recv($self._collectionWithNewValue())._copyEmpty(),$recv($self._collectionClass())._new());
  52775. return self;
  52776. }, function($ctx1) {$ctx1.fill(self,"testCopyEmpty",{})});
  52777. }; }),
  52778. $globals.CollectionTest);
  52779. $core.addMethod(
  52780. $core.method({
  52781. selector: "testCopySeparates",
  52782. protocol: "tests",
  52783. args: [],
  52784. 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",
  52785. referencedClasses: [],
  52786. pragmas: [],
  52787. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  52788. }, function ($methodClass){ return function (){
  52789. var self=this,$self=this;
  52790. var original,copy;
  52791. return $core.withContext(function($ctx1) {
  52792. original=[$self._collection()
  52793. ,$ctx1.sendIdx["collection"]=1
  52794. ][0];
  52795. copy=$recv(original)._copy();
  52796. $recv(copy)._addAll_($self._sampleNewValueAsCollection());
  52797. $self._assert_($recv(original).__eq($self._collection()));
  52798. return self;
  52799. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy})});
  52800. }; }),
  52801. $globals.CollectionTest);
  52802. $core.addMethod(
  52803. $core.method({
  52804. selector: "testDetect",
  52805. protocol: "tests",
  52806. args: [],
  52807. 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",
  52808. referencedClasses: ["Error"],
  52809. pragmas: [],
  52810. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  52811. }, function ($methodClass){ return function (){
  52812. var self=this,$self=this;
  52813. return $core.withContext(function($ctx1) {
  52814. $self._shouldnt_raise_((function(){
  52815. return $core.withContext(function($ctx2) {
  52816. return [$recv([$self._collection()
  52817. ,$ctx2.sendIdx["collection"]=1
  52818. ][0])._detect_((function(){
  52819. return true;
  52820. }))
  52821. ,$ctx2.sendIdx["detect:"]=1
  52822. ][0];
  52823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52824. }),$globals.Error);
  52825. [$self._should_raise_((function(){
  52826. return $core.withContext(function($ctx2) {
  52827. return [$recv([$self._collection()
  52828. ,$ctx2.sendIdx["collection"]=2
  52829. ][0])._detect_((function(){
  52830. return false;
  52831. }))
  52832. ,$ctx2.sendIdx["detect:"]=2
  52833. ][0];
  52834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  52835. }),$globals.Error)
  52836. ,$ctx1.sendIdx["should:raise:"]=1
  52837. ][0];
  52838. [$self._assert_equals_([$recv($self._sampleNewValueAsCollection())._detect_((function(){
  52839. return true;
  52840. }))
  52841. ,$ctx1.sendIdx["detect:"]=3
  52842. ][0],[$self._sampleNewValue()
  52843. ,$ctx1.sendIdx["sampleNewValue"]=1
  52844. ][0])
  52845. ,$ctx1.sendIdx["assert:equals:"]=1
  52846. ][0];
  52847. $self._assert_equals_([$recv($self._collectionWithNewValue())._detect_((function(each){
  52848. return $core.withContext(function($ctx2) {
  52849. return [$recv(each).__eq([$self._sampleNewValue()
  52850. ,$ctx2.sendIdx["sampleNewValue"]=2
  52851. ][0])
  52852. ,$ctx2.sendIdx["="]=1
  52853. ][0];
  52854. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52855. }))
  52856. ,$ctx1.sendIdx["detect:"]=4
  52857. ][0],[$self._sampleNewValue()
  52858. ,$ctx1.sendIdx["sampleNewValue"]=3
  52859. ][0]);
  52860. $self._should_raise_((function(){
  52861. return $core.withContext(function($ctx2) {
  52862. return $recv($self._collection())._detect_((function(each){
  52863. return $core.withContext(function($ctx3) {
  52864. return $recv(each).__eq($self._sampleNewValue());
  52865. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  52866. }));
  52867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  52868. }),$globals.Error);
  52869. return self;
  52870. }, function($ctx1) {$ctx1.fill(self,"testDetect",{})});
  52871. }; }),
  52872. $globals.CollectionTest);
  52873. $core.addMethod(
  52874. $core.method({
  52875. selector: "testDetectIfNone",
  52876. protocol: "tests",
  52877. args: [],
  52878. 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",
  52879. referencedClasses: ["Object"],
  52880. pragmas: [],
  52881. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  52882. }, function ($methodClass){ return function (){
  52883. var self=this,$self=this;
  52884. var sentinel;
  52885. return $core.withContext(function($ctx1) {
  52886. sentinel=$recv($globals.Object)._new();
  52887. $self._assert_($recv([$recv([$self._collection()
  52888. ,$ctx1.sendIdx["collection"]=1
  52889. ][0])._detect_ifNone_((function(){
  52890. return true;
  52891. }),(function(){
  52892. return sentinel;
  52893. }))
  52894. ,$ctx1.sendIdx["detect:ifNone:"]=1
  52895. ][0]).__tild_eq(sentinel));
  52896. [$self._assert_equals_([$recv([$self._collection()
  52897. ,$ctx1.sendIdx["collection"]=2
  52898. ][0])._detect_ifNone_((function(){
  52899. return false;
  52900. }),(function(){
  52901. return sentinel;
  52902. }))
  52903. ,$ctx1.sendIdx["detect:ifNone:"]=2
  52904. ][0],sentinel)
  52905. ,$ctx1.sendIdx["assert:equals:"]=1
  52906. ][0];
  52907. [$self._assert_equals_([$recv($self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  52908. return true;
  52909. }),(function(){
  52910. return sentinel;
  52911. }))
  52912. ,$ctx1.sendIdx["detect:ifNone:"]=3
  52913. ][0],[$self._sampleNewValue()
  52914. ,$ctx1.sendIdx["sampleNewValue"]=1
  52915. ][0])
  52916. ,$ctx1.sendIdx["assert:equals:"]=2
  52917. ][0];
  52918. [$self._assert_equals_([$recv($self._collectionWithNewValue())._detect_ifNone_((function(each){
  52919. return $core.withContext(function($ctx2) {
  52920. return [$recv(each).__eq([$self._sampleNewValue()
  52921. ,$ctx2.sendIdx["sampleNewValue"]=2
  52922. ][0])
  52923. ,$ctx2.sendIdx["="]=1
  52924. ][0];
  52925. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  52926. }),(function(){
  52927. return sentinel;
  52928. }))
  52929. ,$ctx1.sendIdx["detect:ifNone:"]=4
  52930. ][0],[$self._sampleNewValue()
  52931. ,$ctx1.sendIdx["sampleNewValue"]=3
  52932. ][0])
  52933. ,$ctx1.sendIdx["assert:equals:"]=3
  52934. ][0];
  52935. $self._assert_equals_($recv($self._collection())._detect_ifNone_((function(each){
  52936. return $core.withContext(function($ctx2) {
  52937. return $recv(each).__eq($self._sampleNewValue());
  52938. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  52939. }),(function(){
  52940. return sentinel;
  52941. })),sentinel);
  52942. return self;
  52943. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel})});
  52944. }; }),
  52945. $globals.CollectionTest);
  52946. $core.addMethod(
  52947. $core.method({
  52948. selector: "testDo",
  52949. protocol: "tests",
  52950. args: [],
  52951. 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",
  52952. referencedClasses: ["OrderedCollection"],
  52953. pragmas: [],
  52954. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  52955. }, function ($methodClass){ return function (){
  52956. var self=this,$self=this;
  52957. var newCollection;
  52958. return $core.withContext(function($ctx1) {
  52959. newCollection=[$recv($globals.OrderedCollection)._new()
  52960. ,$ctx1.sendIdx["new"]=1
  52961. ][0];
  52962. [$recv([$self._collection()
  52963. ,$ctx1.sendIdx["collection"]=1
  52964. ][0])._do_((function(each){
  52965. return $core.withContext(function($ctx2) {
  52966. return [$recv(newCollection)._add_(each)
  52967. ,$ctx2.sendIdx["add:"]=1
  52968. ][0];
  52969. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52970. }))
  52971. ,$ctx1.sendIdx["do:"]=1
  52972. ][0];
  52973. [$self._assertSameContents_as_($self._collection(),newCollection)
  52974. ,$ctx1.sendIdx["assertSameContents:as:"]=1
  52975. ][0];
  52976. newCollection=$recv($globals.OrderedCollection)._new();
  52977. $recv([$self._collectionWithDuplicates()
  52978. ,$ctx1.sendIdx["collectionWithDuplicates"]=1
  52979. ][0])._do_((function(each){
  52980. return $core.withContext(function($ctx2) {
  52981. return $recv(newCollection)._add_(each);
  52982. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52983. }));
  52984. $self._assertSameContents_as_($self._collectionWithDuplicates(),newCollection);
  52985. return self;
  52986. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection})});
  52987. }; }),
  52988. $globals.CollectionTest);
  52989. $core.addMethod(
  52990. $core.method({
  52991. selector: "testEquality",
  52992. protocol: "tests",
  52993. args: [],
  52994. 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",
  52995. referencedClasses: [],
  52996. pragmas: [],
  52997. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  52998. }, function ($methodClass){ return function (){
  52999. var self=this,$self=this;
  53000. return $core.withContext(function($ctx1) {
  53001. [$self._assert_equals_([$recv([$self._collectionClass()
  53002. ,$ctx1.sendIdx["collectionClass"]=1
  53003. ][0])._new()
  53004. ,$ctx1.sendIdx["new"]=1
  53005. ][0],[$recv([$self._collectionClass()
  53006. ,$ctx1.sendIdx["collectionClass"]=2
  53007. ][0])._new()
  53008. ,$ctx1.sendIdx["new"]=2
  53009. ][0])
  53010. ,$ctx1.sendIdx["assert:equals:"]=1
  53011. ][0];
  53012. [$self._assert_equals_([$self._collection()
  53013. ,$ctx1.sendIdx["collection"]=1
  53014. ][0],[$self._collection()
  53015. ,$ctx1.sendIdx["collection"]=2
  53016. ][0])
  53017. ,$ctx1.sendIdx["assert:equals:"]=2
  53018. ][0];
  53019. $self._assert_equals_([$self._collectionWithNewValue()
  53020. ,$ctx1.sendIdx["collectionWithNewValue"]=1
  53021. ][0],[$self._collectionWithNewValue()
  53022. ,$ctx1.sendIdx["collectionWithNewValue"]=2
  53023. ][0]);
  53024. [$self._deny_([$recv([$recv([$self._collectionClass()
  53025. ,$ctx1.sendIdx["collectionClass"]=3
  53026. ][0])._new()
  53027. ,$ctx1.sendIdx["new"]=3
  53028. ][0]).__eq([$self._collection()
  53029. ,$ctx1.sendIdx["collection"]=3
  53030. ][0])
  53031. ,$ctx1.sendIdx["="]=1
  53032. ][0])
  53033. ,$ctx1.sendIdx["deny:"]=1
  53034. ][0];
  53035. [$self._deny_([$recv([$self._collection()
  53036. ,$ctx1.sendIdx["collection"]=4
  53037. ][0]).__eq($recv($self._collectionClass())._new())
  53038. ,$ctx1.sendIdx["="]=2
  53039. ][0])
  53040. ,$ctx1.sendIdx["deny:"]=2
  53041. ][0];
  53042. $self._deny_($recv($self._collection()).__eq($self._collectionWithNewValue()));
  53043. return self;
  53044. }, function($ctx1) {$ctx1.fill(self,"testEquality",{})});
  53045. }; }),
  53046. $globals.CollectionTest);
  53047. $core.addMethod(
  53048. $core.method({
  53049. selector: "testIfEmptyFamily",
  53050. protocol: "tests",
  53051. args: [],
  53052. 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.",
  53053. referencedClasses: [],
  53054. pragmas: [],
  53055. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  53056. }, function ($methodClass){ return function (){
  53057. var self=this,$self=this;
  53058. return $core.withContext(function($ctx1) {
  53059. [$self._assert_equals_([$recv([$recv([$self._collectionClass()
  53060. ,$ctx1.sendIdx["collectionClass"]=1
  53061. ][0])._new()
  53062. ,$ctx1.sendIdx["new"]=1
  53063. ][0])._ifEmpty_((function(){
  53064. return (42);
  53065. }))
  53066. ,$ctx1.sendIdx["ifEmpty:"]=1
  53067. ][0],(42))
  53068. ,$ctx1.sendIdx["assert:equals:"]=1
  53069. ][0];
  53070. [$self._assert_equals_($recv([$self._collection()
  53071. ,$ctx1.sendIdx["collection"]=1
  53072. ][0])._ifEmpty_((function(){
  53073. return (42);
  53074. })),[$self._collection()
  53075. ,$ctx1.sendIdx["collection"]=2
  53076. ][0])
  53077. ,$ctx1.sendIdx["assert:equals:"]=2
  53078. ][0];
  53079. [$self._assert_equals_([$recv([$recv([$self._collectionClass()
  53080. ,$ctx1.sendIdx["collectionClass"]=2
  53081. ][0])._new()
  53082. ,$ctx1.sendIdx["new"]=2
  53083. ][0])._ifNotEmpty_((function(){
  53084. return (42);
  53085. }))
  53086. ,$ctx1.sendIdx["ifNotEmpty:"]=1
  53087. ][0],[$recv([$self._collectionClass()
  53088. ,$ctx1.sendIdx["collectionClass"]=3
  53089. ][0])._new()
  53090. ,$ctx1.sendIdx["new"]=3
  53091. ][0])
  53092. ,$ctx1.sendIdx["assert:equals:"]=3
  53093. ][0];
  53094. [$self._assert_equals_([$recv([$self._collection()
  53095. ,$ctx1.sendIdx["collection"]=3
  53096. ][0])._ifNotEmpty_((function(){
  53097. return (42);
  53098. }))
  53099. ,$ctx1.sendIdx["ifNotEmpty:"]=2
  53100. ][0],(42))
  53101. ,$ctx1.sendIdx["assert:equals:"]=4
  53102. ][0];
  53103. [$self._assert_equals_($recv([$self._collection()
  53104. ,$ctx1.sendIdx["collection"]=4
  53105. ][0])._ifNotEmpty_((function(col){
  53106. return col;
  53107. })),[$self._collection()
  53108. ,$ctx1.sendIdx["collection"]=5
  53109. ][0])
  53110. ,$ctx1.sendIdx["assert:equals:"]=5
  53111. ][0];
  53112. [$self._assert_equals_([$recv([$recv([$self._collectionClass()
  53113. ,$ctx1.sendIdx["collectionClass"]=4
  53114. ][0])._new()
  53115. ,$ctx1.sendIdx["new"]=4
  53116. ][0])._ifEmpty_ifNotEmpty_((function(){
  53117. return (42);
  53118. }),(function(){
  53119. return (999);
  53120. }))
  53121. ,$ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1
  53122. ][0],(42))
  53123. ,$ctx1.sendIdx["assert:equals:"]=6
  53124. ][0];
  53125. [$self._assert_equals_([$recv([$self._collection()
  53126. ,$ctx1.sendIdx["collection"]=6
  53127. ][0])._ifEmpty_ifNotEmpty_((function(){
  53128. return (42);
  53129. }),(function(){
  53130. return (999);
  53131. }))
  53132. ,$ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2
  53133. ][0],(999))
  53134. ,$ctx1.sendIdx["assert:equals:"]=7
  53135. ][0];
  53136. [$self._assert_equals_($recv([$self._collection()
  53137. ,$ctx1.sendIdx["collection"]=7
  53138. ][0])._ifEmpty_ifNotEmpty_((function(){
  53139. return (42);
  53140. }),(function(col){
  53141. return col;
  53142. })),[$self._collection()
  53143. ,$ctx1.sendIdx["collection"]=8
  53144. ][0])
  53145. ,$ctx1.sendIdx["assert:equals:"]=8
  53146. ][0];
  53147. [$self._assert_equals_([$recv($recv($self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  53148. return (42);
  53149. }),(function(){
  53150. return (999);
  53151. }))
  53152. ,$ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1
  53153. ][0],(999))
  53154. ,$ctx1.sendIdx["assert:equals:"]=9
  53155. ][0];
  53156. [$self._assert_equals_([$recv([$self._collection()
  53157. ,$ctx1.sendIdx["collection"]=9
  53158. ][0])._ifNotEmpty_ifEmpty_((function(){
  53159. return (42);
  53160. }),(function(){
  53161. return (999);
  53162. }))
  53163. ,$ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2
  53164. ][0],(42))
  53165. ,$ctx1.sendIdx["assert:equals:"]=10
  53166. ][0];
  53167. $self._assert_equals_($recv([$self._collection()
  53168. ,$ctx1.sendIdx["collection"]=10
  53169. ][0])._ifNotEmpty_ifEmpty_((function(col){
  53170. return col;
  53171. }),(function(){
  53172. return (999);
  53173. })),$self._collection());
  53174. return self;
  53175. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{})});
  53176. }; }),
  53177. $globals.CollectionTest);
  53178. $core.addMethod(
  53179. $core.method({
  53180. selector: "testIsEmpty",
  53181. protocol: "tests",
  53182. args: [],
  53183. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  53184. referencedClasses: [],
  53185. pragmas: [],
  53186. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  53187. }, function ($methodClass){ return function (){
  53188. var self=this,$self=this;
  53189. return $core.withContext(function($ctx1) {
  53190. $self._assert_([$recv($recv($self._collectionClass())._new())._isEmpty()
  53191. ,$ctx1.sendIdx["isEmpty"]=1
  53192. ][0]);
  53193. $self._deny_($recv($self._collection())._isEmpty());
  53194. return self;
  53195. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{})});
  53196. }; }),
  53197. $globals.CollectionTest);
  53198. $core.addMethod(
  53199. $core.method({
  53200. selector: "testNoneSatisfy",
  53201. protocol: "tests",
  53202. args: [],
  53203. 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 ])",
  53204. referencedClasses: ["Object"],
  53205. pragmas: [],
  53206. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  53207. }, function ($methodClass){ return function (){
  53208. var self=this,$self=this;
  53209. var anyOne;
  53210. return $core.withContext(function($ctx1) {
  53211. anyOne=$recv([$self._collection()
  53212. ,$ctx1.sendIdx["collection"]=1
  53213. ][0])._anyOne();
  53214. $self._deny_([$recv([$self._collection()
  53215. ,$ctx1.sendIdx["collection"]=2
  53216. ][0])._noneSatisfy_((function(each){
  53217. return $core.withContext(function($ctx2) {
  53218. return [$recv(each).__eq(anyOne)
  53219. ,$ctx2.sendIdx["="]=1
  53220. ][0];
  53221. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53222. }))
  53223. ,$ctx1.sendIdx["noneSatisfy:"]=1
  53224. ][0]);
  53225. $self._assert_($recv($self._collection())._noneSatisfy_((function(each){
  53226. return $core.withContext(function($ctx2) {
  53227. return $recv(each).__eq($recv($globals.Object)._new());
  53228. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53229. })));
  53230. return self;
  53231. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne})});
  53232. }; }),
  53233. $globals.CollectionTest);
  53234. $core.addMethod(
  53235. $core.method({
  53236. selector: "testRegression1224",
  53237. protocol: "tests",
  53238. args: [],
  53239. source: "testRegression1224\x0a\x09self assert: (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size equals: 0",
  53240. referencedClasses: [],
  53241. pragmas: [],
  53242. messageSends: ["assert:equals:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  53243. }, function ($methodClass){ return function (){
  53244. var self=this,$self=this;
  53245. return $core.withContext(function($ctx1) {
  53246. var $1;
  53247. $1=$recv($self._collectionClass())._new();
  53248. $recv($1)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  53249. }));
  53250. $self._assert_equals_($recv($recv($1)._yourself())._size(),(0));
  53251. return self;
  53252. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{})});
  53253. }; }),
  53254. $globals.CollectionTest);
  53255. $core.addMethod(
  53256. $core.method({
  53257. selector: "testRemoveAll",
  53258. protocol: "tests",
  53259. args: [],
  53260. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  53261. referencedClasses: [],
  53262. pragmas: [],
  53263. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  53264. }, function ($methodClass){ return function (){
  53265. var self=this,$self=this;
  53266. return $core.withContext(function($ctx1) {
  53267. var $1;
  53268. $1=$self._collection();
  53269. $recv($1)._removeAll();
  53270. $self._assert_equals_($recv($1)._yourself(),$recv($self._collectionClass())._new());
  53271. return self;
  53272. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{})});
  53273. }; }),
  53274. $globals.CollectionTest);
  53275. $core.addMethod(
  53276. $core.method({
  53277. selector: "testSelect",
  53278. protocol: "tests",
  53279. args: [],
  53280. 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",
  53281. referencedClasses: [],
  53282. pragmas: [],
  53283. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  53284. }, function ($methodClass){ return function (){
  53285. var self=this,$self=this;
  53286. return $core.withContext(function($ctx1) {
  53287. [$self._assert_equals_([$recv([$self._collection()
  53288. ,$ctx1.sendIdx["collection"]=1
  53289. ][0])._select_((function(){
  53290. return false;
  53291. }))
  53292. ,$ctx1.sendIdx["select:"]=1
  53293. ][0],[$recv([$self._collectionClass()
  53294. ,$ctx1.sendIdx["collectionClass"]=1
  53295. ][0])._new()
  53296. ,$ctx1.sendIdx["new"]=1
  53297. ][0])
  53298. ,$ctx1.sendIdx["assert:equals:"]=1
  53299. ][0];
  53300. [$self._assert_equals_([$recv([$self._collection()
  53301. ,$ctx1.sendIdx["collection"]=2
  53302. ][0])._select_((function(){
  53303. return true;
  53304. }))
  53305. ,$ctx1.sendIdx["select:"]=2
  53306. ][0],[$self._collection()
  53307. ,$ctx1.sendIdx["collection"]=3
  53308. ][0])
  53309. ,$ctx1.sendIdx["assert:equals:"]=2
  53310. ][0];
  53311. [$self._assert_equals_([$recv([$self._collectionWithNewValue()
  53312. ,$ctx1.sendIdx["collectionWithNewValue"]=1
  53313. ][0])._select_((function(each){
  53314. return $core.withContext(function($ctx2) {
  53315. return [$recv(each).__eq([$self._sampleNewValue()
  53316. ,$ctx2.sendIdx["sampleNewValue"]=1
  53317. ][0])
  53318. ,$ctx2.sendIdx["="]=1
  53319. ][0];
  53320. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  53321. }))
  53322. ,$ctx1.sendIdx["select:"]=3
  53323. ][0],$self._sampleNewValueAsCollection())
  53324. ,$ctx1.sendIdx["assert:equals:"]=3
  53325. ][0];
  53326. [$self._assert_equals_([$recv([$self._collectionWithNewValue()
  53327. ,$ctx1.sendIdx["collectionWithNewValue"]=2
  53328. ][0])._select_((function(each){
  53329. return $core.withContext(function($ctx2) {
  53330. return [$recv(each).__tild_eq([$self._sampleNewValue()
  53331. ,$ctx2.sendIdx["sampleNewValue"]=2
  53332. ][0])
  53333. ,$ctx2.sendIdx["~="]=1
  53334. ][0];
  53335. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53336. }))
  53337. ,$ctx1.sendIdx["select:"]=4
  53338. ][0],[$self._collection()
  53339. ,$ctx1.sendIdx["collection"]=4
  53340. ][0])
  53341. ,$ctx1.sendIdx["assert:equals:"]=4
  53342. ][0];
  53343. [$self._assert_equals_([$recv([$self._collection()
  53344. ,$ctx1.sendIdx["collection"]=5
  53345. ][0])._select_((function(each){
  53346. return $core.withContext(function($ctx2) {
  53347. return $recv(each).__eq([$self._sampleNewValue()
  53348. ,$ctx2.sendIdx["sampleNewValue"]=3
  53349. ][0]);
  53350. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  53351. }))
  53352. ,$ctx1.sendIdx["select:"]=5
  53353. ][0],$recv($self._collectionClass())._new())
  53354. ,$ctx1.sendIdx["assert:equals:"]=5
  53355. ][0];
  53356. $self._assert_equals_($recv($self._collectionWithNewValue())._select_((function(each){
  53357. return $core.withContext(function($ctx2) {
  53358. return $recv(each).__tild_eq($self._sampleNewValue());
  53359. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53360. })),$self._collection());
  53361. return self;
  53362. }, function($ctx1) {$ctx1.fill(self,"testSelect",{})});
  53363. }; }),
  53364. $globals.CollectionTest);
  53365. $core.addMethod(
  53366. $core.method({
  53367. selector: "testSelectThenCollect",
  53368. protocol: "tests",
  53369. args: [],
  53370. 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",
  53371. referencedClasses: [],
  53372. pragmas: [],
  53373. messageSends: ["assert:equals:", "select:thenCollect:", "collection", "new", "collectionClass", "=", "sampleNewValue", "collectionWithNewValue", "~=", "collectionOfPrintStrings"]
  53374. }, function ($methodClass){ return function (){
  53375. var self=this,$self=this;
  53376. return $core.withContext(function($ctx1) {
  53377. [$self._assert_equals_([$recv([$self._collection()
  53378. ,$ctx1.sendIdx["collection"]=1
  53379. ][0])._select_thenCollect_((function(){
  53380. return false;
  53381. }),"isString")
  53382. ,$ctx1.sendIdx["select:thenCollect:"]=1
  53383. ][0],[$recv([$self._collectionClass()
  53384. ,$ctx1.sendIdx["collectionClass"]=1
  53385. ][0])._new()
  53386. ,$ctx1.sendIdx["new"]=1
  53387. ][0])
  53388. ,$ctx1.sendIdx["assert:equals:"]=1
  53389. ][0];
  53390. [$self._assert_equals_([$recv([$self._collection()
  53391. ,$ctx1.sendIdx["collection"]=2
  53392. ][0])._select_thenCollect_((function(){
  53393. return true;
  53394. }),(function(x){
  53395. return x;
  53396. }))
  53397. ,$ctx1.sendIdx["select:thenCollect:"]=2
  53398. ][0],[$self._collection()
  53399. ,$ctx1.sendIdx["collection"]=3
  53400. ][0])
  53401. ,$ctx1.sendIdx["assert:equals:"]=2
  53402. ][0];
  53403. [$self._assert_equals_([$recv($self._collection())._select_thenCollect_((function(each){
  53404. return $core.withContext(function($ctx2) {
  53405. return $recv(each).__eq([$self._sampleNewValue()
  53406. ,$ctx2.sendIdx["sampleNewValue"]=1
  53407. ][0]);
  53408. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53409. }),(function(x){
  53410. return x;
  53411. }))
  53412. ,$ctx1.sendIdx["select:thenCollect:"]=3
  53413. ][0],$recv($self._collectionClass())._new())
  53414. ,$ctx1.sendIdx["assert:equals:"]=3
  53415. ][0];
  53416. $self._assert_equals_($recv($self._collectionWithNewValue())._select_thenCollect_((function(each){
  53417. return $core.withContext(function($ctx2) {
  53418. return $recv(each).__tild_eq($self._sampleNewValue());
  53419. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53420. }),"printString"),$self._collectionOfPrintStrings());
  53421. return self;
  53422. }, function($ctx1) {$ctx1.fill(self,"testSelectThenCollect",{})});
  53423. }; }),
  53424. $globals.CollectionTest);
  53425. $core.addMethod(
  53426. $core.method({
  53427. selector: "testSingle",
  53428. protocol: "tests",
  53429. args: [],
  53430. 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",
  53431. referencedClasses: ["Error"],
  53432. pragmas: [],
  53433. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  53434. }, function ($methodClass){ return function (){
  53435. var self=this,$self=this;
  53436. return $core.withContext(function($ctx1) {
  53437. [$self._should_raise_((function(){
  53438. return $core.withContext(function($ctx2) {
  53439. return [$recv($recv($self._collectionClass())._new())._single()
  53440. ,$ctx2.sendIdx["single"]=1
  53441. ][0];
  53442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53443. }),$globals.Error)
  53444. ,$ctx1.sendIdx["should:raise:"]=1
  53445. ][0];
  53446. $self._should_raise_((function(){
  53447. return $core.withContext(function($ctx2) {
  53448. return [$recv($self._collection())._single()
  53449. ,$ctx2.sendIdx["single"]=2
  53450. ][0];
  53451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53452. }),$globals.Error);
  53453. $self._assert_equals_($recv($self._sampleNewValueAsCollection())._single(),$self._sampleNewValue());
  53454. return self;
  53455. }, function($ctx1) {$ctx1.fill(self,"testSingle",{})});
  53456. }; }),
  53457. $globals.CollectionTest);
  53458. $core.addMethod(
  53459. $core.method({
  53460. selector: "testSize",
  53461. protocol: "tests",
  53462. args: [],
  53463. 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",
  53464. referencedClasses: [],
  53465. pragmas: [],
  53466. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  53467. }, function ($methodClass){ return function (){
  53468. var self=this,$self=this;
  53469. return $core.withContext(function($ctx1) {
  53470. [$self._assert_equals_([$recv($recv($self._collectionClass())._new())._size()
  53471. ,$ctx1.sendIdx["size"]=1
  53472. ][0],(0))
  53473. ,$ctx1.sendIdx["assert:equals:"]=1
  53474. ][0];
  53475. [$self._assert_equals_([$recv($self._sampleNewValueAsCollection())._size()
  53476. ,$ctx1.sendIdx["size"]=2
  53477. ][0],(1))
  53478. ,$ctx1.sendIdx["assert:equals:"]=2
  53479. ][0];
  53480. $self._assert_equals_($recv($self._collection())._size(),$self._collectionSize());
  53481. return self;
  53482. }, function($ctx1) {$ctx1.fill(self,"testSize",{})});
  53483. }; }),
  53484. $globals.CollectionTest);
  53485. $core.addMethod(
  53486. $core.method({
  53487. selector: "collectionClass",
  53488. protocol: "fixture",
  53489. args: [],
  53490. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  53491. referencedClasses: [],
  53492. pragmas: [],
  53493. messageSends: []
  53494. }, function ($methodClass){ return function (){
  53495. var self=this,$self=this;
  53496. return nil;
  53497. }; }),
  53498. $globals.CollectionTest.a$cls);
  53499. $core.addMethod(
  53500. $core.method({
  53501. selector: "isAbstract",
  53502. protocol: "testing",
  53503. args: [],
  53504. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  53505. referencedClasses: [],
  53506. pragmas: [],
  53507. messageSends: ["isNil", "collectionClass"]
  53508. }, function ($methodClass){ return function (){
  53509. var self=this,$self=this;
  53510. return $core.withContext(function($ctx1) {
  53511. return $recv($self._collectionClass())._isNil();
  53512. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{})});
  53513. }; }),
  53514. $globals.CollectionTest.a$cls);
  53515. $core.addClass("AssociativeCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  53516. $core.addMethod(
  53517. $core.method({
  53518. selector: "collectionKeys",
  53519. protocol: "fixture",
  53520. args: [],
  53521. source: "collectionKeys\x0a\x09self subclassResponsibility",
  53522. referencedClasses: [],
  53523. pragmas: [],
  53524. messageSends: ["subclassResponsibility"]
  53525. }, function ($methodClass){ return function (){
  53526. var self=this,$self=this;
  53527. return $core.withContext(function($ctx1) {
  53528. $self._subclassResponsibility();
  53529. return self;
  53530. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{})});
  53531. }; }),
  53532. $globals.AssociativeCollectionTest);
  53533. $core.addMethod(
  53534. $core.method({
  53535. selector: "collectionValues",
  53536. protocol: "fixture",
  53537. args: [],
  53538. source: "collectionValues\x0a\x09self subclassResponsibility",
  53539. referencedClasses: [],
  53540. pragmas: [],
  53541. messageSends: ["subclassResponsibility"]
  53542. }, function ($methodClass){ return function (){
  53543. var self=this,$self=this;
  53544. return $core.withContext(function($ctx1) {
  53545. $self._subclassResponsibility();
  53546. return self;
  53547. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{})});
  53548. }; }),
  53549. $globals.AssociativeCollectionTest);
  53550. $core.addMethod(
  53551. $core.method({
  53552. selector: "nonIndexesDo:",
  53553. protocol: "fixture",
  53554. args: ["aBlock"],
  53555. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  53556. referencedClasses: ["Object"],
  53557. pragmas: [],
  53558. messageSends: ["value:", "new"]
  53559. }, function ($methodClass){ return function (aBlock){
  53560. var self=this,$self=this;
  53561. return $core.withContext(function($ctx1) {
  53562. [$recv(aBlock)._value_((5))
  53563. ,$ctx1.sendIdx["value:"]=1
  53564. ][0];
  53565. [$recv(aBlock)._value_((function(){
  53566. }))
  53567. ,$ctx1.sendIdx["value:"]=2
  53568. ][0];
  53569. [$recv(aBlock)._value_($recv($globals.Object)._new())
  53570. ,$ctx1.sendIdx["value:"]=3
  53571. ][0];
  53572. $recv(aBlock)._value_("z");
  53573. return self;
  53574. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock})});
  53575. }; }),
  53576. $globals.AssociativeCollectionTest);
  53577. $core.addMethod(
  53578. $core.method({
  53579. selector: "sampleNewIndex",
  53580. protocol: "fixture",
  53581. args: [],
  53582. source: "sampleNewIndex\x0a\x09^ 'new'",
  53583. referencedClasses: [],
  53584. pragmas: [],
  53585. messageSends: []
  53586. }, function ($methodClass){ return function (){
  53587. var self=this,$self=this;
  53588. return "new";
  53589. }; }),
  53590. $globals.AssociativeCollectionTest);
  53591. $core.addMethod(
  53592. $core.method({
  53593. selector: "samplesDo:",
  53594. protocol: "fixture",
  53595. args: ["aBlock"],
  53596. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  53597. referencedClasses: [],
  53598. pragmas: [],
  53599. messageSends: ["value:value:"]
  53600. }, function ($methodClass){ return function (aBlock){
  53601. var self=this,$self=this;
  53602. return $core.withContext(function($ctx1) {
  53603. $recv(aBlock)._value_value_("a",(2));
  53604. return self;
  53605. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock})});
  53606. }; }),
  53607. $globals.AssociativeCollectionTest);
  53608. $core.addMethod(
  53609. $core.method({
  53610. selector: "testAddAll",
  53611. protocol: "tests",
  53612. args: [],
  53613. 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",
  53614. referencedClasses: [],
  53615. pragmas: [],
  53616. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  53617. }, function ($methodClass){ return function (){
  53618. var self=this,$self=this;
  53619. return $core.withContext(function($ctx1) {
  53620. var $1,$2,$3;
  53621. [(
  53622. $ctx1.supercall = true,
  53623. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._testAddAll.call($self))
  53624. ,$ctx1.supercall = false
  53625. ][0];
  53626. $1=[$self._collection()
  53627. ,$ctx1.sendIdx["collection"]=1
  53628. ][0];
  53629. [$recv($1)._addAll_([$self._collection()
  53630. ,$ctx1.sendIdx["collection"]=2
  53631. ][0])
  53632. ,$ctx1.sendIdx["addAll:"]=1
  53633. ][0];
  53634. [$self._assert_equals_([$recv($1)._yourself()
  53635. ,$ctx1.sendIdx["yourself"]=1
  53636. ][0],[$self._collection()
  53637. ,$ctx1.sendIdx["collection"]=3
  53638. ][0])
  53639. ,$ctx1.sendIdx["assert:equals:"]=1
  53640. ][0];
  53641. $2=[$self._collection()
  53642. ,$ctx1.sendIdx["collection"]=4
  53643. ][0];
  53644. [$recv($2)._addAll_([$self._collectionWithNewValue()
  53645. ,$ctx1.sendIdx["collectionWithNewValue"]=1
  53646. ][0])
  53647. ,$ctx1.sendIdx["addAll:"]=2
  53648. ][0];
  53649. [$self._assert_equals_([$recv($2)._yourself()
  53650. ,$ctx1.sendIdx["yourself"]=2
  53651. ][0],[$self._collectionWithNewValue()
  53652. ,$ctx1.sendIdx["collectionWithNewValue"]=2
  53653. ][0])
  53654. ,$ctx1.sendIdx["assert:equals:"]=2
  53655. ][0];
  53656. $3=[$self._collectionWithNewValue()
  53657. ,$ctx1.sendIdx["collectionWithNewValue"]=3
  53658. ][0];
  53659. $recv($3)._addAll_($self._collection());
  53660. $self._assert_equals_($recv($3)._yourself(),$self._collectionWithNewValue());
  53661. return self;
  53662. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{})});
  53663. }; }),
  53664. $globals.AssociativeCollectionTest);
  53665. $core.addMethod(
  53666. $core.method({
  53667. selector: "testAsDictionary",
  53668. protocol: "tests",
  53669. args: [],
  53670. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  53671. referencedClasses: ["Dictionary"],
  53672. pragmas: [],
  53673. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  53674. }, function ($methodClass){ return function (){
  53675. var self=this,$self=this;
  53676. return $core.withContext(function($ctx1) {
  53677. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  53678. return self;
  53679. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{})});
  53680. }; }),
  53681. $globals.AssociativeCollectionTest);
  53682. $core.addMethod(
  53683. $core.method({
  53684. selector: "testAsHashedCollection",
  53685. protocol: "tests",
  53686. args: [],
  53687. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  53688. referencedClasses: ["HashedCollection"],
  53689. pragmas: [],
  53690. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  53691. }, function ($methodClass){ return function (){
  53692. var self=this,$self=this;
  53693. return $core.withContext(function($ctx1) {
  53694. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  53695. return self;
  53696. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{})});
  53697. }; }),
  53698. $globals.AssociativeCollectionTest);
  53699. $core.addMethod(
  53700. $core.method({
  53701. selector: "testComma",
  53702. protocol: "tests",
  53703. args: [],
  53704. 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",
  53705. referencedClasses: [],
  53706. pragmas: [],
  53707. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  53708. }, function ($methodClass){ return function (){
  53709. var self=this,$self=this;
  53710. return $core.withContext(function($ctx1) {
  53711. [(
  53712. $ctx1.supercall = true,
  53713. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._testComma.call($self))
  53714. ,$ctx1.supercall = false
  53715. ][0];
  53716. [$self._assert_equals_([$recv([$self._collection()
  53717. ,$ctx1.sendIdx["collection"]=1
  53718. ][0]).__comma([$self._collection()
  53719. ,$ctx1.sendIdx["collection"]=2
  53720. ][0])
  53721. ,$ctx1.sendIdx[","]=1
  53722. ][0],[$self._collection()
  53723. ,$ctx1.sendIdx["collection"]=3
  53724. ][0])
  53725. ,$ctx1.sendIdx["assert:equals:"]=1
  53726. ][0];
  53727. [$self._assert_equals_([$recv([$self._collection()
  53728. ,$ctx1.sendIdx["collection"]=4
  53729. ][0]).__comma([$self._collectionWithNewValue()
  53730. ,$ctx1.sendIdx["collectionWithNewValue"]=1
  53731. ][0])
  53732. ,$ctx1.sendIdx[","]=2
  53733. ][0],[$self._collectionWithNewValue()
  53734. ,$ctx1.sendIdx["collectionWithNewValue"]=2
  53735. ][0])
  53736. ,$ctx1.sendIdx["assert:equals:"]=2
  53737. ][0];
  53738. $self._assert_equals_($recv([$self._collectionWithNewValue()
  53739. ,$ctx1.sendIdx["collectionWithNewValue"]=3
  53740. ][0]).__comma($self._collection()),$self._collectionWithNewValue());
  53741. return self;
  53742. }, function($ctx1) {$ctx1.fill(self,"testComma",{})});
  53743. }; }),
  53744. $globals.AssociativeCollectionTest);
  53745. $core.addMethod(
  53746. $core.method({
  53747. selector: "testFrom",
  53748. protocol: "tests",
  53749. args: [],
  53750. 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 }.",
  53751. referencedClasses: [],
  53752. pragmas: [],
  53753. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  53754. }, function ($methodClass){ return function (){
  53755. var self=this,$self=this;
  53756. var associations;
  53757. return $core.withContext(function($ctx1) {
  53758. associations=[["a".__minus_gt((1))
  53759. ,$ctx1.sendIdx["->"]=1
  53760. ][0],"b".__minus_gt((2))];
  53761. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  53762. return self;
  53763. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations})});
  53764. }; }),
  53765. $globals.AssociativeCollectionTest);
  53766. $core.addMethod(
  53767. $core.method({
  53768. selector: "testKeys",
  53769. protocol: "tests",
  53770. args: [],
  53771. 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 }",
  53772. referencedClasses: [],
  53773. pragmas: [],
  53774. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  53775. }, function ($methodClass){ return function (){
  53776. var self=this,$self=this;
  53777. return $core.withContext(function($ctx1) {
  53778. $self._assert_($recv([$recv($recv($self._collectionClass())._new())._keys()
  53779. ,$ctx1.sendIdx["keys"]=1
  53780. ][0])._isEmpty());
  53781. [$self._assertSameContents_as_([$recv($self._collection())._keys()
  53782. ,$ctx1.sendIdx["keys"]=2
  53783. ][0],[$self._collectionKeys()
  53784. ,$ctx1.sendIdx["collectionKeys"]=1
  53785. ][0])
  53786. ,$ctx1.sendIdx["assertSameContents:as:"]=1
  53787. ][0];
  53788. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._keys(),$recv($self._collectionKeys()).__comma([$self._sampleNewIndex()]));
  53789. return self;
  53790. }, function($ctx1) {$ctx1.fill(self,"testKeys",{})});
  53791. }; }),
  53792. $globals.AssociativeCollectionTest);
  53793. $core.addMethod(
  53794. $core.method({
  53795. selector: "testNewFromPairs",
  53796. protocol: "tests",
  53797. args: [],
  53798. 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 }.",
  53799. referencedClasses: [],
  53800. pragmas: [],
  53801. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  53802. }, function ($methodClass){ return function (){
  53803. var self=this,$self=this;
  53804. var flattenedAssociations;
  53805. return $core.withContext(function($ctx1) {
  53806. flattenedAssociations=["a",(1),"b",(2)];
  53807. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  53808. return self;
  53809. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations})});
  53810. }; }),
  53811. $globals.AssociativeCollectionTest);
  53812. $core.addMethod(
  53813. $core.method({
  53814. selector: "testPrintString",
  53815. protocol: "tests",
  53816. args: [],
  53817. 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'')'",
  53818. referencedClasses: [],
  53819. pragmas: [],
  53820. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  53821. }, function ($methodClass){ return function (){
  53822. var self=this,$self=this;
  53823. return $core.withContext(function($ctx1) {
  53824. var $1;
  53825. $1=$recv([$self._collectionClass()
  53826. ,$ctx1.sendIdx["collectionClass"]=1
  53827. ][0])._new();
  53828. [$recv($1)._at_put_("firstname","James")
  53829. ,$ctx1.sendIdx["at:put:"]=1
  53830. ][0];
  53831. $recv($1)._at_put_("lastname","Bond");
  53832. $self._assert_equals_($recv($1)._printString(),[$recv("a ".__comma($recv($self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')")
  53833. ,$ctx1.sendIdx[","]=1
  53834. ][0]);
  53835. return self;
  53836. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{})});
  53837. }; }),
  53838. $globals.AssociativeCollectionTest);
  53839. $core.addMethod(
  53840. $core.method({
  53841. selector: "testRemoveKey",
  53842. protocol: "tests",
  53843. args: [],
  53844. 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",
  53845. referencedClasses: ["Error"],
  53846. pragmas: [],
  53847. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  53848. }, function ($methodClass){ return function (){
  53849. var self=this,$self=this;
  53850. return $core.withContext(function($ctx1) {
  53851. var $1;
  53852. $self._nonIndexesDo_((function(each){
  53853. var collection;
  53854. return $core.withContext(function($ctx2) {
  53855. collection=[$self._collection()
  53856. ,$ctx2.sendIdx["collection"]=1
  53857. ][0];
  53858. $self._should_raise_((function(){
  53859. return $core.withContext(function($ctx3) {
  53860. return [$recv(collection)._removeKey_(each)
  53861. ,$ctx3.sendIdx["removeKey:"]=1
  53862. ][0];
  53863. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53864. }),$globals.Error);
  53865. return [$self._assert_equals_(collection,[$self._collection()
  53866. ,$ctx2.sendIdx["collection"]=2
  53867. ][0])
  53868. ,$ctx2.sendIdx["assert:equals:"]=1
  53869. ][0];
  53870. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  53871. }));
  53872. $self._samplesDo_((function(index,value){
  53873. var collection;
  53874. return $core.withContext(function($ctx2) {
  53875. collection=[$self._collection()
  53876. ,$ctx2.sendIdx["collection"]=3
  53877. ][0];
  53878. [$self._assert_equals_([$recv(collection)._removeKey_(index)
  53879. ,$ctx2.sendIdx["removeKey:"]=2
  53880. ][0],value)
  53881. ,$ctx2.sendIdx["assert:equals:"]=2
  53882. ][0];
  53883. return $self._deny_($recv(collection).__eq([$self._collection()
  53884. ,$ctx2.sendIdx["collection"]=4
  53885. ][0]));
  53886. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  53887. }));
  53888. $1=$self._collectionWithNewValue();
  53889. $recv($1)._removeKey_($self._sampleNewIndex());
  53890. $self._assert_equals_($recv($1)._yourself(),$self._collection());
  53891. return self;
  53892. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{})});
  53893. }; }),
  53894. $globals.AssociativeCollectionTest);
  53895. $core.addMethod(
  53896. $core.method({
  53897. selector: "testRemoveKeyIfAbsent",
  53898. protocol: "tests",
  53899. args: [],
  53900. 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",
  53901. referencedClasses: [],
  53902. pragmas: [],
  53903. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  53904. }, function ($methodClass){ return function (){
  53905. var self=this,$self=this;
  53906. return $core.withContext(function($ctx1) {
  53907. var $1;
  53908. $self._nonIndexesDo_((function(each){
  53909. var collection;
  53910. return $core.withContext(function($ctx2) {
  53911. collection=[$self._collection()
  53912. ,$ctx2.sendIdx["collection"]=1
  53913. ][0];
  53914. [$self._assert_equals_([$recv(collection)._removeKey_ifAbsent_(each,(function(){
  53915. return $core.withContext(function($ctx3) {
  53916. return [$self._sampleNewValue()
  53917. ,$ctx3.sendIdx["sampleNewValue"]=1
  53918. ][0];
  53919. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53920. }))
  53921. ,$ctx2.sendIdx["removeKey:ifAbsent:"]=1
  53922. ][0],[$self._sampleNewValue()
  53923. ,$ctx2.sendIdx["sampleNewValue"]=2
  53924. ][0])
  53925. ,$ctx2.sendIdx["assert:equals:"]=1
  53926. ][0];
  53927. return [$self._assert_equals_(collection,[$self._collection()
  53928. ,$ctx2.sendIdx["collection"]=2
  53929. ][0])
  53930. ,$ctx2.sendIdx["assert:equals:"]=2
  53931. ][0];
  53932. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  53933. }));
  53934. $self._samplesDo_((function(index,value){
  53935. var collection;
  53936. return $core.withContext(function($ctx2) {
  53937. collection=[$self._collection()
  53938. ,$ctx2.sendIdx["collection"]=3
  53939. ][0];
  53940. [$self._assert_equals_([$recv(collection)._removeKey_ifAbsent_(index,(function(){
  53941. return $core.withContext(function($ctx3) {
  53942. return $self._sampleNewValue();
  53943. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  53944. }))
  53945. ,$ctx2.sendIdx["removeKey:ifAbsent:"]=2
  53946. ][0],value)
  53947. ,$ctx2.sendIdx["assert:equals:"]=3
  53948. ][0];
  53949. return $self._deny_($recv(collection).__eq([$self._collection()
  53950. ,$ctx2.sendIdx["collection"]=4
  53951. ][0]));
  53952. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  53953. }));
  53954. $1=$self._collectionWithNewValue();
  53955. $recv($1)._removeKey_ifAbsent_($self._sampleNewIndex(),(function(){
  53956. return $core.withContext(function($ctx2) {
  53957. return $self._assert_(false);
  53958. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  53959. }));
  53960. $self._assert_equals_($recv($1)._yourself(),$self._collection());
  53961. return self;
  53962. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{})});
  53963. }; }),
  53964. $globals.AssociativeCollectionTest);
  53965. $core.addMethod(
  53966. $core.method({
  53967. selector: "testValues",
  53968. protocol: "tests",
  53969. args: [],
  53970. 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 }",
  53971. referencedClasses: [],
  53972. pragmas: [],
  53973. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  53974. }, function ($methodClass){ return function (){
  53975. var self=this,$self=this;
  53976. return $core.withContext(function($ctx1) {
  53977. $self._assert_($recv([$recv($recv($self._collectionClass())._new())._values()
  53978. ,$ctx1.sendIdx["values"]=1
  53979. ][0])._isEmpty());
  53980. [$self._assertSameContents_as_([$recv($self._collection())._values()
  53981. ,$ctx1.sendIdx["values"]=2
  53982. ][0],[$self._collectionValues()
  53983. ,$ctx1.sendIdx["collectionValues"]=1
  53984. ][0])
  53985. ,$ctx1.sendIdx["assertSameContents:as:"]=1
  53986. ][0];
  53987. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._values(),$recv($self._collectionValues()).__comma([$self._sampleNewValue()]));
  53988. return self;
  53989. }, function($ctx1) {$ctx1.fill(self,"testValues",{})});
  53990. }; }),
  53991. $globals.AssociativeCollectionTest);
  53992. $core.addClass("DictionaryTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  53993. $core.addMethod(
  53994. $core.method({
  53995. selector: "collection",
  53996. protocol: "fixture",
  53997. args: [],
  53998. 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",
  53999. referencedClasses: ["Dictionary"],
  54000. pragmas: [],
  54001. messageSends: ["at:put:", "new", "@", "yourself"]
  54002. }, function ($methodClass){ return function (){
  54003. var self=this,$self=this;
  54004. return $core.withContext(function($ctx1) {
  54005. var $1;
  54006. $1=$recv($globals.Dictionary)._new();
  54007. [$recv($1)._at_put_((1),(1))
  54008. ,$ctx1.sendIdx["at:put:"]=1
  54009. ][0];
  54010. [$recv($1)._at_put_("a",(2))
  54011. ,$ctx1.sendIdx["at:put:"]=2
  54012. ][0];
  54013. [$recv($1)._at_put_(true,(3))
  54014. ,$ctx1.sendIdx["at:put:"]=3
  54015. ][0];
  54016. [$recv($1)._at_put_((1).__at((3)),(-4))
  54017. ,$ctx1.sendIdx["at:put:"]=4
  54018. ][0];
  54019. $recv($1)._at_put_($self.sampleBlock,(9));
  54020. return $recv($1)._yourself();
  54021. }, function($ctx1) {$ctx1.fill(self,"collection",{})});
  54022. }; }),
  54023. $globals.DictionaryTest);
  54024. $core.addMethod(
  54025. $core.method({
  54026. selector: "collectionKeys",
  54027. protocol: "fixture",
  54028. args: [],
  54029. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  54030. referencedClasses: [],
  54031. pragmas: [],
  54032. messageSends: ["@"]
  54033. }, function ($methodClass){ return function (){
  54034. var self=this,$self=this;
  54035. return $core.withContext(function($ctx1) {
  54036. return [(1),"a",true,(1).__at((3)),$self.sampleBlock];
  54037. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{})});
  54038. }; }),
  54039. $globals.DictionaryTest);
  54040. $core.addMethod(
  54041. $core.method({
  54042. selector: "collectionOfPrintStrings",
  54043. protocol: "fixture",
  54044. args: [],
  54045. 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",
  54046. referencedClasses: ["Dictionary"],
  54047. pragmas: [],
  54048. messageSends: ["at:put:", "new", "@", "yourself"]
  54049. }, function ($methodClass){ return function (){
  54050. var self=this,$self=this;
  54051. return $core.withContext(function($ctx1) {
  54052. var $1;
  54053. $1=$recv($globals.Dictionary)._new();
  54054. [$recv($1)._at_put_((1),"1")
  54055. ,$ctx1.sendIdx["at:put:"]=1
  54056. ][0];
  54057. [$recv($1)._at_put_("a","2")
  54058. ,$ctx1.sendIdx["at:put:"]=2
  54059. ][0];
  54060. [$recv($1)._at_put_(true,"3")
  54061. ,$ctx1.sendIdx["at:put:"]=3
  54062. ][0];
  54063. [$recv($1)._at_put_((1).__at((3)),"-4")
  54064. ,$ctx1.sendIdx["at:put:"]=4
  54065. ][0];
  54066. $recv($1)._at_put_($self.sampleBlock,"9");
  54067. return $recv($1)._yourself();
  54068. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{})});
  54069. }; }),
  54070. $globals.DictionaryTest);
  54071. $core.addMethod(
  54072. $core.method({
  54073. selector: "collectionSize",
  54074. protocol: "fixture",
  54075. args: [],
  54076. source: "collectionSize\x0a\x09^ 5",
  54077. referencedClasses: [],
  54078. pragmas: [],
  54079. messageSends: []
  54080. }, function ($methodClass){ return function (){
  54081. var self=this,$self=this;
  54082. return (5);
  54083. }; }),
  54084. $globals.DictionaryTest);
  54085. $core.addMethod(
  54086. $core.method({
  54087. selector: "collectionValues",
  54088. protocol: "fixture",
  54089. args: [],
  54090. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  54091. referencedClasses: [],
  54092. pragmas: [],
  54093. messageSends: []
  54094. }, function ($methodClass){ return function (){
  54095. var self=this,$self=this;
  54096. return [(1),(2),(3),(-4),(9)];
  54097. }; }),
  54098. $globals.DictionaryTest);
  54099. $core.addMethod(
  54100. $core.method({
  54101. selector: "collectionWithDuplicates",
  54102. protocol: "fixture",
  54103. args: [],
  54104. 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",
  54105. referencedClasses: ["Dictionary"],
  54106. pragmas: [],
  54107. messageSends: ["at:put:", "new", "yourself"]
  54108. }, function ($methodClass){ return function (){
  54109. var self=this,$self=this;
  54110. return $core.withContext(function($ctx1) {
  54111. var $1;
  54112. $1=$recv($globals.Dictionary)._new();
  54113. [$recv($1)._at_put_((1),(1))
  54114. ,$ctx1.sendIdx["at:put:"]=1
  54115. ][0];
  54116. [$recv($1)._at_put_("a",(2))
  54117. ,$ctx1.sendIdx["at:put:"]=2
  54118. ][0];
  54119. [$recv($1)._at_put_(true,(3))
  54120. ,$ctx1.sendIdx["at:put:"]=3
  54121. ][0];
  54122. [$recv($1)._at_put_((4),(-4))
  54123. ,$ctx1.sendIdx["at:put:"]=4
  54124. ][0];
  54125. [$recv($1)._at_put_($self.sampleBlock,(9))
  54126. ,$ctx1.sendIdx["at:put:"]=5
  54127. ][0];
  54128. [$recv($1)._at_put_("b",(1))
  54129. ,$ctx1.sendIdx["at:put:"]=6
  54130. ][0];
  54131. [$recv($1)._at_put_((3),(3))
  54132. ,$ctx1.sendIdx["at:put:"]=7
  54133. ][0];
  54134. $recv($1)._at_put_(false,(12));
  54135. return $recv($1)._yourself();
  54136. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{})});
  54137. }; }),
  54138. $globals.DictionaryTest);
  54139. $core.addMethod(
  54140. $core.method({
  54141. selector: "collectionWithNewValue",
  54142. protocol: "fixture",
  54143. args: [],
  54144. 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",
  54145. referencedClasses: ["Dictionary"],
  54146. pragmas: [],
  54147. messageSends: ["at:put:", "new", "@", "yourself"]
  54148. }, function ($methodClass){ return function (){
  54149. var self=this,$self=this;
  54150. return $core.withContext(function($ctx1) {
  54151. var $1;
  54152. $1=$recv($globals.Dictionary)._new();
  54153. [$recv($1)._at_put_((1),(1))
  54154. ,$ctx1.sendIdx["at:put:"]=1
  54155. ][0];
  54156. [$recv($1)._at_put_("a",(2))
  54157. ,$ctx1.sendIdx["at:put:"]=2
  54158. ][0];
  54159. [$recv($1)._at_put_(true,(3))
  54160. ,$ctx1.sendIdx["at:put:"]=3
  54161. ][0];
  54162. [$recv($1)._at_put_((1).__at((3)),(-4))
  54163. ,$ctx1.sendIdx["at:put:"]=4
  54164. ][0];
  54165. [$recv($1)._at_put_($self.sampleBlock,(9))
  54166. ,$ctx1.sendIdx["at:put:"]=5
  54167. ][0];
  54168. $recv($1)._at_put_("new","N");
  54169. return $recv($1)._yourself();
  54170. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{})});
  54171. }; }),
  54172. $globals.DictionaryTest);
  54173. $core.addMethod(
  54174. $core.method({
  54175. selector: "sampleNewValueAsCollection",
  54176. protocol: "fixture",
  54177. args: [],
  54178. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  54179. referencedClasses: ["Dictionary"],
  54180. pragmas: [],
  54181. messageSends: ["at:put:", "new", "yourself"]
  54182. }, function ($methodClass){ return function (){
  54183. var self=this,$self=this;
  54184. return $core.withContext(function($ctx1) {
  54185. var $1;
  54186. $1=$recv($globals.Dictionary)._new();
  54187. $recv($1)._at_put_("new","N");
  54188. return $recv($1)._yourself();
  54189. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{})});
  54190. }; }),
  54191. $globals.DictionaryTest);
  54192. $core.addMethod(
  54193. $core.method({
  54194. selector: "samplesDo:",
  54195. protocol: "fixture",
  54196. args: ["aBlock"],
  54197. 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",
  54198. referencedClasses: [],
  54199. pragmas: [],
  54200. messageSends: ["samplesDo:", "value:value:", "@"]
  54201. }, function ($methodClass){ return function (aBlock){
  54202. var self=this,$self=this;
  54203. return $core.withContext(function($ctx1) {
  54204. [(
  54205. $ctx1.supercall = true,
  54206. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.call($self,aBlock))
  54207. ,$ctx1.supercall = false
  54208. ][0];
  54209. [$recv(aBlock)._value_value_(true,(3))
  54210. ,$ctx1.sendIdx["value:value:"]=1
  54211. ][0];
  54212. [$recv(aBlock)._value_value_((1).__at((3)),(-4))
  54213. ,$ctx1.sendIdx["value:value:"]=2
  54214. ][0];
  54215. $recv(aBlock)._value_value_($self.sampleBlock,(9));
  54216. return self;
  54217. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock})});
  54218. }; }),
  54219. $globals.DictionaryTest);
  54220. $core.addMethod(
  54221. $core.method({
  54222. selector: "testAccessing",
  54223. protocol: "tests",
  54224. args: [],
  54225. 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)",
  54226. referencedClasses: ["Dictionary"],
  54227. pragmas: [],
  54228. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  54229. }, function ($methodClass){ return function (){
  54230. var self=this,$self=this;
  54231. var d;
  54232. return $core.withContext(function($ctx1) {
  54233. d=$recv($globals.Dictionary)._new();
  54234. [$recv(d)._at_put_("hello","world")
  54235. ,$ctx1.sendIdx["at:put:"]=1
  54236. ][0];
  54237. [$self._assert_equals_([$recv(d)._at_("hello")
  54238. ,$ctx1.sendIdx["at:"]=1
  54239. ][0],"world")
  54240. ,$ctx1.sendIdx["assert:equals:"]=1
  54241. ][0];
  54242. [$self._assert_equals_([$recv(d)._at_ifAbsent_("hello",(function(){
  54243. return nil;
  54244. }))
  54245. ,$ctx1.sendIdx["at:ifAbsent:"]=1
  54246. ][0],"world")
  54247. ,$ctx1.sendIdx["assert:equals:"]=2
  54248. ][0];
  54249. [$self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  54250. return nil;
  54251. }))).__eq("world"))
  54252. ,$ctx1.sendIdx["deny:"]=1
  54253. ][0];
  54254. [$self._assert_([$recv(d)._includesKey_("hello")
  54255. ,$ctx1.sendIdx["includesKey:"]=1
  54256. ][0])
  54257. ,$ctx1.sendIdx["assert:"]=1
  54258. ][0];
  54259. [$self._deny_([$recv(d)._includesKey_("foo")
  54260. ,$ctx1.sendIdx["includesKey:"]=2
  54261. ][0])
  54262. ,$ctx1.sendIdx["deny:"]=2
  54263. ][0];
  54264. [$recv(d)._at_put_((1),(2))
  54265. ,$ctx1.sendIdx["at:put:"]=2
  54266. ][0];
  54267. [$self._assert_equals_([$recv(d)._at_((1))
  54268. ,$ctx1.sendIdx["at:"]=2
  54269. ][0],(2))
  54270. ,$ctx1.sendIdx["assert:equals:"]=3
  54271. ][0];
  54272. $recv(d)._at_put_([(1).__at((3))
  54273. ,$ctx1.sendIdx["@"]=1
  54274. ][0],(3));
  54275. $self._assert_equals_($recv(d)._at_([(1).__at((3))
  54276. ,$ctx1.sendIdx["@"]=2
  54277. ][0]),(3));
  54278. $self._assert_([$recv(d)._includesKey_([(1).__at((3))
  54279. ,$ctx1.sendIdx["@"]=3
  54280. ][0])
  54281. ,$ctx1.sendIdx["includesKey:"]=3
  54282. ][0]);
  54283. $self._deny_($recv(d)._includesKey_((3).__at((1))));
  54284. return self;
  54285. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d})});
  54286. }; }),
  54287. $globals.DictionaryTest);
  54288. $core.addMethod(
  54289. $core.method({
  54290. selector: "testDynamicDictionaries",
  54291. protocol: "tests",
  54292. args: [],
  54293. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  54294. referencedClasses: ["Dictionary"],
  54295. pragmas: [],
  54296. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  54297. }, function ($methodClass){ return function (){
  54298. var self=this,$self=this;
  54299. return $core.withContext(function($ctx1) {
  54300. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  54301. return self;
  54302. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{})});
  54303. }; }),
  54304. $globals.DictionaryTest);
  54305. $core.addMethod(
  54306. $core.method({
  54307. selector: "collectionClass",
  54308. protocol: "fixture",
  54309. args: [],
  54310. source: "collectionClass\x0a\x09^ Dictionary",
  54311. referencedClasses: ["Dictionary"],
  54312. pragmas: [],
  54313. messageSends: []
  54314. }, function ($methodClass){ return function (){
  54315. var self=this,$self=this;
  54316. return $globals.Dictionary;
  54317. }; }),
  54318. $globals.DictionaryTest.a$cls);
  54319. $core.addClass("HashedCollectionTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54320. $core.addMethod(
  54321. $core.method({
  54322. selector: "collection",
  54323. protocol: "fixture",
  54324. args: [],
  54325. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  54326. referencedClasses: [],
  54327. pragmas: [],
  54328. messageSends: []
  54329. }, function ($methodClass){ return function (){
  54330. var self=this,$self=this;
  54331. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  54332. }; }),
  54333. $globals.HashedCollectionTest);
  54334. $core.addMethod(
  54335. $core.method({
  54336. selector: "collectionKeys",
  54337. protocol: "fixture",
  54338. args: [],
  54339. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  54340. referencedClasses: [],
  54341. pragmas: [],
  54342. messageSends: []
  54343. }, function ($methodClass){ return function (){
  54344. var self=this,$self=this;
  54345. return ["b","a","c","d"];
  54346. }; }),
  54347. $globals.HashedCollectionTest);
  54348. $core.addMethod(
  54349. $core.method({
  54350. selector: "collectionOfPrintStrings",
  54351. protocol: "fixture",
  54352. args: [],
  54353. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  54354. referencedClasses: [],
  54355. pragmas: [],
  54356. messageSends: []
  54357. }, function ($methodClass){ return function (){
  54358. var self=this,$self=this;
  54359. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  54360. }; }),
  54361. $globals.HashedCollectionTest);
  54362. $core.addMethod(
  54363. $core.method({
  54364. selector: "collectionSize",
  54365. protocol: "fixture",
  54366. args: [],
  54367. source: "collectionSize\x0a\x09^ 4",
  54368. referencedClasses: [],
  54369. pragmas: [],
  54370. messageSends: []
  54371. }, function ($methodClass){ return function (){
  54372. var self=this,$self=this;
  54373. return (4);
  54374. }; }),
  54375. $globals.HashedCollectionTest);
  54376. $core.addMethod(
  54377. $core.method({
  54378. selector: "collectionValues",
  54379. protocol: "fixture",
  54380. args: [],
  54381. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  54382. referencedClasses: [],
  54383. pragmas: [],
  54384. messageSends: []
  54385. }, function ($methodClass){ return function (){
  54386. var self=this,$self=this;
  54387. return [(1),(2),(3),(-4)];
  54388. }; }),
  54389. $globals.HashedCollectionTest);
  54390. $core.addMethod(
  54391. $core.method({
  54392. selector: "collectionWithDuplicates",
  54393. protocol: "fixture",
  54394. args: [],
  54395. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  54396. referencedClasses: [],
  54397. pragmas: [],
  54398. messageSends: []
  54399. }, function ($methodClass){ return function (){
  54400. var self=this,$self=this;
  54401. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  54402. }; }),
  54403. $globals.HashedCollectionTest);
  54404. $core.addMethod(
  54405. $core.method({
  54406. selector: "collectionWithNewValue",
  54407. protocol: "fixture",
  54408. args: [],
  54409. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  54410. referencedClasses: [],
  54411. pragmas: [],
  54412. messageSends: []
  54413. }, function ($methodClass){ return function (){
  54414. var self=this,$self=this;
  54415. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  54416. }; }),
  54417. $globals.HashedCollectionTest);
  54418. $core.addMethod(
  54419. $core.method({
  54420. selector: "sampleNewValueAsCollection",
  54421. protocol: "fixture",
  54422. args: [],
  54423. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  54424. referencedClasses: [],
  54425. pragmas: [],
  54426. messageSends: []
  54427. }, function ($methodClass){ return function (){
  54428. var self=this,$self=this;
  54429. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  54430. }; }),
  54431. $globals.HashedCollectionTest);
  54432. $core.addMethod(
  54433. $core.method({
  54434. selector: "testDynamicDictionaries",
  54435. protocol: "tests",
  54436. args: [],
  54437. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  54438. referencedClasses: ["HashedCollection"],
  54439. pragmas: [],
  54440. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  54441. }, function ($methodClass){ return function (){
  54442. var self=this,$self=this;
  54443. return $core.withContext(function($ctx1) {
  54444. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  54445. return self;
  54446. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{})});
  54447. }; }),
  54448. $globals.HashedCollectionTest);
  54449. $core.addMethod(
  54450. $core.method({
  54451. selector: "collectionClass",
  54452. protocol: "fixture",
  54453. args: [],
  54454. source: "collectionClass\x0a\x09^ HashedCollection",
  54455. referencedClasses: ["HashedCollection"],
  54456. pragmas: [],
  54457. messageSends: []
  54458. }, function ($methodClass){ return function (){
  54459. var self=this,$self=this;
  54460. return $globals.HashedCollection;
  54461. }; }),
  54462. $globals.HashedCollectionTest.a$cls);
  54463. $core.addClass("SequenceableCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  54464. $core.addMethod(
  54465. $core.method({
  54466. selector: "collectionFirst",
  54467. protocol: "fixture",
  54468. args: [],
  54469. source: "collectionFirst\x0a\x09self subclassResponsibility",
  54470. referencedClasses: [],
  54471. pragmas: [],
  54472. messageSends: ["subclassResponsibility"]
  54473. }, function ($methodClass){ return function (){
  54474. var self=this,$self=this;
  54475. return $core.withContext(function($ctx1) {
  54476. $self._subclassResponsibility();
  54477. return self;
  54478. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{})});
  54479. }; }),
  54480. $globals.SequenceableCollectionTest);
  54481. $core.addMethod(
  54482. $core.method({
  54483. selector: "collectionFirstTwo",
  54484. protocol: "fixture",
  54485. args: [],
  54486. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  54487. referencedClasses: [],
  54488. pragmas: [],
  54489. messageSends: ["subclassResponsibility"]
  54490. }, function ($methodClass){ return function (){
  54491. var self=this,$self=this;
  54492. return $core.withContext(function($ctx1) {
  54493. $self._subclassResponsibility();
  54494. return self;
  54495. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{})});
  54496. }; }),
  54497. $globals.SequenceableCollectionTest);
  54498. $core.addMethod(
  54499. $core.method({
  54500. selector: "collectionLast",
  54501. protocol: "fixture",
  54502. args: [],
  54503. source: "collectionLast\x0a\x09self subclassResponsibility",
  54504. referencedClasses: [],
  54505. pragmas: [],
  54506. messageSends: ["subclassResponsibility"]
  54507. }, function ($methodClass){ return function (){
  54508. var self=this,$self=this;
  54509. return $core.withContext(function($ctx1) {
  54510. $self._subclassResponsibility();
  54511. return self;
  54512. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{})});
  54513. }; }),
  54514. $globals.SequenceableCollectionTest);
  54515. $core.addMethod(
  54516. $core.method({
  54517. selector: "collectionLastTwo",
  54518. protocol: "fixture",
  54519. args: [],
  54520. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  54521. referencedClasses: [],
  54522. pragmas: [],
  54523. messageSends: ["subclassResponsibility"]
  54524. }, function ($methodClass){ return function (){
  54525. var self=this,$self=this;
  54526. return $core.withContext(function($ctx1) {
  54527. $self._subclassResponsibility();
  54528. return self;
  54529. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{})});
  54530. }; }),
  54531. $globals.SequenceableCollectionTest);
  54532. $core.addMethod(
  54533. $core.method({
  54534. selector: "nonIndexesDo:",
  54535. protocol: "fixture",
  54536. args: ["aBlock"],
  54537. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  54538. referencedClasses: [],
  54539. pragmas: [],
  54540. messageSends: ["value:", "+", "collectionSize"]
  54541. }, function ($methodClass){ return function (aBlock){
  54542. var self=this,$self=this;
  54543. return $core.withContext(function($ctx1) {
  54544. [$recv(aBlock)._value_((0))
  54545. ,$ctx1.sendIdx["value:"]=1
  54546. ][0];
  54547. [$recv(aBlock)._value_($recv($self._collectionSize()).__plus((1)))
  54548. ,$ctx1.sendIdx["value:"]=2
  54549. ][0];
  54550. $recv(aBlock)._value_("z");
  54551. return self;
  54552. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock})});
  54553. }; }),
  54554. $globals.SequenceableCollectionTest);
  54555. $core.addMethod(
  54556. $core.method({
  54557. selector: "samplesDo:",
  54558. protocol: "fixture",
  54559. args: ["aBlock"],
  54560. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  54561. referencedClasses: [],
  54562. pragmas: [],
  54563. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  54564. }, function ($methodClass){ return function (aBlock){
  54565. var self=this,$self=this;
  54566. return $core.withContext(function($ctx1) {
  54567. [$recv(aBlock)._value_value_((1),$self._collectionFirst())
  54568. ,$ctx1.sendIdx["value:value:"]=1
  54569. ][0];
  54570. $recv(aBlock)._value_value_($self._collectionSize(),$self._collectionLast());
  54571. return self;
  54572. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock})});
  54573. }; }),
  54574. $globals.SequenceableCollectionTest);
  54575. $core.addMethod(
  54576. $core.method({
  54577. selector: "testBeginsWith",
  54578. protocol: "tests",
  54579. args: [],
  54580. 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)",
  54581. referencedClasses: [],
  54582. pragmas: [],
  54583. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  54584. }, function ($methodClass){ return function (){
  54585. var self=this,$self=this;
  54586. return $core.withContext(function($ctx1) {
  54587. [$self._assert_([$recv([$self._collection()
  54588. ,$ctx1.sendIdx["collection"]=1
  54589. ][0])._beginsWith_($recv($self._collectionClass())._new())
  54590. ,$ctx1.sendIdx["beginsWith:"]=1
  54591. ][0])
  54592. ,$ctx1.sendIdx["assert:"]=1
  54593. ][0];
  54594. [$self._assert_([$recv([$self._collection()
  54595. ,$ctx1.sendIdx["collection"]=2
  54596. ][0])._beginsWith_([$self._collection()
  54597. ,$ctx1.sendIdx["collection"]=3
  54598. ][0])
  54599. ,$ctx1.sendIdx["beginsWith:"]=2
  54600. ][0])
  54601. ,$ctx1.sendIdx["assert:"]=2
  54602. ][0];
  54603. $self._assert_([$recv([$self._collection()
  54604. ,$ctx1.sendIdx["collection"]=4
  54605. ][0])._beginsWith_($self._collectionFirstTwo())
  54606. ,$ctx1.sendIdx["beginsWith:"]=3
  54607. ][0]);
  54608. $self._deny_($recv($self._collection())._beginsWith_($self._collectionLastTwo()));
  54609. return self;
  54610. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{})});
  54611. }; }),
  54612. $globals.SequenceableCollectionTest);
  54613. $core.addMethod(
  54614. $core.method({
  54615. selector: "testEndsWith",
  54616. protocol: "tests",
  54617. args: [],
  54618. 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)",
  54619. referencedClasses: [],
  54620. pragmas: [],
  54621. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  54622. }, function ($methodClass){ return function (){
  54623. var self=this,$self=this;
  54624. return $core.withContext(function($ctx1) {
  54625. [$self._assert_([$recv([$self._collection()
  54626. ,$ctx1.sendIdx["collection"]=1
  54627. ][0])._endsWith_($recv($self._collectionClass())._new())
  54628. ,$ctx1.sendIdx["endsWith:"]=1
  54629. ][0])
  54630. ,$ctx1.sendIdx["assert:"]=1
  54631. ][0];
  54632. [$self._assert_([$recv([$self._collection()
  54633. ,$ctx1.sendIdx["collection"]=2
  54634. ][0])._endsWith_([$self._collection()
  54635. ,$ctx1.sendIdx["collection"]=3
  54636. ][0])
  54637. ,$ctx1.sendIdx["endsWith:"]=2
  54638. ][0])
  54639. ,$ctx1.sendIdx["assert:"]=2
  54640. ][0];
  54641. $self._assert_([$recv([$self._collection()
  54642. ,$ctx1.sendIdx["collection"]=4
  54643. ][0])._endsWith_($self._collectionLastTwo())
  54644. ,$ctx1.sendIdx["endsWith:"]=3
  54645. ][0]);
  54646. $self._deny_($recv($self._collection())._endsWith_($self._collectionFirstTwo()));
  54647. return self;
  54648. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{})});
  54649. }; }),
  54650. $globals.SequenceableCollectionTest);
  54651. $core.addMethod(
  54652. $core.method({
  54653. selector: "testFirst",
  54654. protocol: "tests",
  54655. args: [],
  54656. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  54657. referencedClasses: [],
  54658. pragmas: [],
  54659. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  54660. }, function ($methodClass){ return function (){
  54661. var self=this,$self=this;
  54662. return $core.withContext(function($ctx1) {
  54663. $self._assert_equals_($recv($self._collection())._first(),$self._collectionFirst());
  54664. return self;
  54665. }, function($ctx1) {$ctx1.fill(self,"testFirst",{})});
  54666. }; }),
  54667. $globals.SequenceableCollectionTest);
  54668. $core.addMethod(
  54669. $core.method({
  54670. selector: "testFirstN",
  54671. protocol: "tests",
  54672. args: [],
  54673. 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",
  54674. referencedClasses: ["Error"],
  54675. pragmas: [],
  54676. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  54677. }, function ($methodClass){ return function (){
  54678. var self=this,$self=this;
  54679. return $core.withContext(function($ctx1) {
  54680. [$self._assert_equals_([$recv([$self._collection()
  54681. ,$ctx1.sendIdx["collection"]=1
  54682. ][0])._first_((2))
  54683. ,$ctx1.sendIdx["first:"]=1
  54684. ][0],$self._collectionFirstTwo())
  54685. ,$ctx1.sendIdx["assert:equals:"]=1
  54686. ][0];
  54687. [$self._assert_equals_([$recv([$self._collection()
  54688. ,$ctx1.sendIdx["collection"]=2
  54689. ][0])._first_((0))
  54690. ,$ctx1.sendIdx["first:"]=2
  54691. ][0],$recv($self._collectionClass())._new())
  54692. ,$ctx1.sendIdx["assert:equals:"]=2
  54693. ][0];
  54694. $self._assert_equals_([$recv([$self._collection()
  54695. ,$ctx1.sendIdx["collection"]=3
  54696. ][0])._first_($self._collectionSize())
  54697. ,$ctx1.sendIdx["first:"]=3
  54698. ][0],[$self._collection()
  54699. ,$ctx1.sendIdx["collection"]=4
  54700. ][0]);
  54701. $self._should_raise_((function(){
  54702. return $core.withContext(function($ctx2) {
  54703. return $recv($self._collection())._first_((33));
  54704. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54705. }),$globals.Error);
  54706. return self;
  54707. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{})});
  54708. }; }),
  54709. $globals.SequenceableCollectionTest);
  54710. $core.addMethod(
  54711. $core.method({
  54712. selector: "testFourth",
  54713. protocol: "tests",
  54714. args: [],
  54715. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  54716. referencedClasses: [],
  54717. pragmas: [],
  54718. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  54719. }, function ($methodClass){ return function (){
  54720. var self=this,$self=this;
  54721. return $core.withContext(function($ctx1) {
  54722. $self._assert_equals_($recv([$self._collection()
  54723. ,$ctx1.sendIdx["collection"]=1
  54724. ][0])._fourth(),$recv($self._collection())._at_((4)));
  54725. return self;
  54726. }, function($ctx1) {$ctx1.fill(self,"testFourth",{})});
  54727. }; }),
  54728. $globals.SequenceableCollectionTest);
  54729. $core.addMethod(
  54730. $core.method({
  54731. selector: "testIndexOfStartingAt",
  54732. protocol: "tests",
  54733. args: [],
  54734. 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 ]",
  54735. referencedClasses: ["JSON"],
  54736. pragmas: [],
  54737. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  54738. }, function ($methodClass){ return function (){
  54739. var self=this,$self=this;
  54740. var jsNull;
  54741. return $core.withContext(function($ctx1) {
  54742. jsNull=$recv($globals.JSON)._parse_("null");
  54743. $self._samplesDo_((function(index,value){
  54744. return $core.withContext(function($ctx2) {
  54745. [$self._assert_equals_([$recv([$self._collection()
  54746. ,$ctx2.sendIdx["collection"]=1
  54747. ][0])._indexOf_startingAt_(value,(1))
  54748. ,$ctx2.sendIdx["indexOf:startingAt:"]=1
  54749. ][0],index)
  54750. ,$ctx2.sendIdx["assert:equals:"]=1
  54751. ][0];
  54752. [$self._assert_equals_([$recv([$self._collection()
  54753. ,$ctx2.sendIdx["collection"]=2
  54754. ][0])._indexOf_startingAt_(value,index)
  54755. ,$ctx2.sendIdx["indexOf:startingAt:"]=2
  54756. ][0],index)
  54757. ,$ctx2.sendIdx["assert:equals:"]=2
  54758. ][0];
  54759. return $self._assert_equals_($recv($self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  54760. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  54761. }));
  54762. return self;
  54763. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull})});
  54764. }; }),
  54765. $globals.SequenceableCollectionTest);
  54766. $core.addMethod(
  54767. $core.method({
  54768. selector: "testIndexOfStartingAtWithNull",
  54769. protocol: "tests",
  54770. args: [],
  54771. 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 ]",
  54772. referencedClasses: ["JSON"],
  54773. pragmas: [],
  54774. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  54775. }, function ($methodClass){ return function (){
  54776. var self=this,$self=this;
  54777. var jsNull;
  54778. return $core.withContext(function($ctx1) {
  54779. jsNull=$recv($globals.JSON)._parse_("null");
  54780. $self._samplesDo_((function(index,value){
  54781. var collection;
  54782. return $core.withContext(function($ctx2) {
  54783. collection=$self._collection();
  54784. $recv(collection)._at_put_(index,jsNull);
  54785. [$self._assert_equals_([$recv(collection)._indexOf_startingAt_(jsNull,(1))
  54786. ,$ctx2.sendIdx["indexOf:startingAt:"]=1
  54787. ][0],index)
  54788. ,$ctx2.sendIdx["assert:equals:"]=1
  54789. ][0];
  54790. [$self._assert_equals_([$recv(collection)._indexOf_startingAt_(jsNull,index)
  54791. ,$ctx2.sendIdx["indexOf:startingAt:"]=2
  54792. ][0],index)
  54793. ,$ctx2.sendIdx["assert:equals:"]=2
  54794. ][0];
  54795. return $self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  54796. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  54797. }));
  54798. return self;
  54799. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull})});
  54800. }; }),
  54801. $globals.SequenceableCollectionTest);
  54802. $core.addMethod(
  54803. $core.method({
  54804. selector: "testLast",
  54805. protocol: "tests",
  54806. args: [],
  54807. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  54808. referencedClasses: [],
  54809. pragmas: [],
  54810. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  54811. }, function ($methodClass){ return function (){
  54812. var self=this,$self=this;
  54813. return $core.withContext(function($ctx1) {
  54814. $self._assert_equals_($recv($self._collection())._last(),$self._collectionLast());
  54815. return self;
  54816. }, function($ctx1) {$ctx1.fill(self,"testLast",{})});
  54817. }; }),
  54818. $globals.SequenceableCollectionTest);
  54819. $core.addMethod(
  54820. $core.method({
  54821. selector: "testLastN",
  54822. protocol: "tests",
  54823. args: [],
  54824. 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",
  54825. referencedClasses: ["Error"],
  54826. pragmas: [],
  54827. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  54828. }, function ($methodClass){ return function (){
  54829. var self=this,$self=this;
  54830. return $core.withContext(function($ctx1) {
  54831. [$self._assert_equals_([$recv([$self._collection()
  54832. ,$ctx1.sendIdx["collection"]=1
  54833. ][0])._last_((2))
  54834. ,$ctx1.sendIdx["last:"]=1
  54835. ][0],$self._collectionLastTwo())
  54836. ,$ctx1.sendIdx["assert:equals:"]=1
  54837. ][0];
  54838. [$self._assert_equals_([$recv([$self._collection()
  54839. ,$ctx1.sendIdx["collection"]=2
  54840. ][0])._last_((0))
  54841. ,$ctx1.sendIdx["last:"]=2
  54842. ][0],$recv($self._collectionClass())._new())
  54843. ,$ctx1.sendIdx["assert:equals:"]=2
  54844. ][0];
  54845. $self._assert_equals_([$recv([$self._collection()
  54846. ,$ctx1.sendIdx["collection"]=3
  54847. ][0])._last_($self._collectionSize())
  54848. ,$ctx1.sendIdx["last:"]=3
  54849. ][0],[$self._collection()
  54850. ,$ctx1.sendIdx["collection"]=4
  54851. ][0]);
  54852. $self._should_raise_((function(){
  54853. return $core.withContext(function($ctx2) {
  54854. return $recv($self._collection())._last_((33));
  54855. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54856. }),$globals.Error);
  54857. return self;
  54858. }, function($ctx1) {$ctx1.fill(self,"testLastN",{})});
  54859. }; }),
  54860. $globals.SequenceableCollectionTest);
  54861. $core.addMethod(
  54862. $core.method({
  54863. selector: "testSecond",
  54864. protocol: "tests",
  54865. args: [],
  54866. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  54867. referencedClasses: [],
  54868. pragmas: [],
  54869. messageSends: ["assert:equals:", "second", "collection", "at:"]
  54870. }, function ($methodClass){ return function (){
  54871. var self=this,$self=this;
  54872. return $core.withContext(function($ctx1) {
  54873. $self._assert_equals_($recv([$self._collection()
  54874. ,$ctx1.sendIdx["collection"]=1
  54875. ][0])._second(),$recv($self._collection())._at_((2)));
  54876. return self;
  54877. }, function($ctx1) {$ctx1.fill(self,"testSecond",{})});
  54878. }; }),
  54879. $globals.SequenceableCollectionTest);
  54880. $core.addMethod(
  54881. $core.method({
  54882. selector: "testThird",
  54883. protocol: "tests",
  54884. args: [],
  54885. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  54886. referencedClasses: [],
  54887. pragmas: [],
  54888. messageSends: ["assert:equals:", "third", "collection", "at:"]
  54889. }, function ($methodClass){ return function (){
  54890. var self=this,$self=this;
  54891. return $core.withContext(function($ctx1) {
  54892. $self._assert_equals_($recv([$self._collection()
  54893. ,$ctx1.sendIdx["collection"]=1
  54894. ][0])._third(),$recv($self._collection())._at_((3)));
  54895. return self;
  54896. }, function($ctx1) {$ctx1.fill(self,"testThird",{})});
  54897. }; }),
  54898. $globals.SequenceableCollectionTest);
  54899. $core.addClass("ArrayTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  54900. $core.addMethod(
  54901. $core.method({
  54902. selector: "collection",
  54903. protocol: "fixture",
  54904. args: [],
  54905. source: "collection\x0a\x09^ #(1 2 3 -4)",
  54906. referencedClasses: [],
  54907. pragmas: [],
  54908. messageSends: []
  54909. }, function ($methodClass){ return function (){
  54910. var self=this,$self=this;
  54911. return [(1), (2), (3), (-4)];
  54912. }; }),
  54913. $globals.ArrayTest);
  54914. $core.addMethod(
  54915. $core.method({
  54916. selector: "collectionFirst",
  54917. protocol: "fixture",
  54918. args: [],
  54919. source: "collectionFirst\x0a\x09^ 1",
  54920. referencedClasses: [],
  54921. pragmas: [],
  54922. messageSends: []
  54923. }, function ($methodClass){ return function (){
  54924. var self=this,$self=this;
  54925. return (1);
  54926. }; }),
  54927. $globals.ArrayTest);
  54928. $core.addMethod(
  54929. $core.method({
  54930. selector: "collectionFirstTwo",
  54931. protocol: "fixture",
  54932. args: [],
  54933. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  54934. referencedClasses: [],
  54935. pragmas: [],
  54936. messageSends: []
  54937. }, function ($methodClass){ return function (){
  54938. var self=this,$self=this;
  54939. return [(1), (2)];
  54940. }; }),
  54941. $globals.ArrayTest);
  54942. $core.addMethod(
  54943. $core.method({
  54944. selector: "collectionLast",
  54945. protocol: "fixture",
  54946. args: [],
  54947. source: "collectionLast\x0a\x09^ -4",
  54948. referencedClasses: [],
  54949. pragmas: [],
  54950. messageSends: []
  54951. }, function ($methodClass){ return function (){
  54952. var self=this,$self=this;
  54953. return (-4);
  54954. }; }),
  54955. $globals.ArrayTest);
  54956. $core.addMethod(
  54957. $core.method({
  54958. selector: "collectionLastTwo",
  54959. protocol: "fixture",
  54960. args: [],
  54961. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  54962. referencedClasses: [],
  54963. pragmas: [],
  54964. messageSends: []
  54965. }, function ($methodClass){ return function (){
  54966. var self=this,$self=this;
  54967. return [(3), (-4)];
  54968. }; }),
  54969. $globals.ArrayTest);
  54970. $core.addMethod(
  54971. $core.method({
  54972. selector: "collectionOfPrintStrings",
  54973. protocol: "fixture",
  54974. args: [],
  54975. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  54976. referencedClasses: [],
  54977. pragmas: [],
  54978. messageSends: []
  54979. }, function ($methodClass){ return function (){
  54980. var self=this,$self=this;
  54981. return ["1", "2", "3", "-4"];
  54982. }; }),
  54983. $globals.ArrayTest);
  54984. $core.addMethod(
  54985. $core.method({
  54986. selector: "collectionSize",
  54987. protocol: "fixture",
  54988. args: [],
  54989. source: "collectionSize\x0a\x09^ 4",
  54990. referencedClasses: [],
  54991. pragmas: [],
  54992. messageSends: []
  54993. }, function ($methodClass){ return function (){
  54994. var self=this,$self=this;
  54995. return (4);
  54996. }; }),
  54997. $globals.ArrayTest);
  54998. $core.addMethod(
  54999. $core.method({
  55000. selector: "collectionWithDuplicates",
  55001. protocol: "fixture",
  55002. args: [],
  55003. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  55004. referencedClasses: [],
  55005. pragmas: [],
  55006. messageSends: []
  55007. }, function ($methodClass){ return function (){
  55008. var self=this,$self=this;
  55009. return ["a", "b", "c", (1), (2), (1), "a", []];
  55010. }; }),
  55011. $globals.ArrayTest);
  55012. $core.addMethod(
  55013. $core.method({
  55014. selector: "collectionWithNewValue",
  55015. protocol: "fixture",
  55016. args: [],
  55017. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  55018. referencedClasses: [],
  55019. pragmas: [],
  55020. messageSends: []
  55021. }, function ($methodClass){ return function (){
  55022. var self=this,$self=this;
  55023. return [(1), (2), (3), (-4), "N"];
  55024. }; }),
  55025. $globals.ArrayTest);
  55026. $core.addMethod(
  55027. $core.method({
  55028. selector: "sampleNewIndex",
  55029. protocol: "fixture",
  55030. args: [],
  55031. source: "sampleNewIndex\x0a\x09^ 5",
  55032. referencedClasses: [],
  55033. pragmas: [],
  55034. messageSends: []
  55035. }, function ($methodClass){ return function (){
  55036. var self=this,$self=this;
  55037. return (5);
  55038. }; }),
  55039. $globals.ArrayTest);
  55040. $core.addMethod(
  55041. $core.method({
  55042. selector: "samplesDo:",
  55043. protocol: "fixture",
  55044. args: ["aBlock"],
  55045. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  55046. referencedClasses: [],
  55047. pragmas: [],
  55048. messageSends: ["samplesDo:", "value:value:"]
  55049. }, function ($methodClass){ return function (aBlock){
  55050. var self=this,$self=this;
  55051. return $core.withContext(function($ctx1) {
  55052. [(
  55053. $ctx1.supercall = true,
  55054. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.call($self,aBlock))
  55055. ,$ctx1.supercall = false
  55056. ][0];
  55057. $recv(aBlock)._value_value_((3),(3));
  55058. return self;
  55059. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock})});
  55060. }; }),
  55061. $globals.ArrayTest);
  55062. $core.addMethod(
  55063. $core.method({
  55064. selector: "testAdd",
  55065. protocol: "tests",
  55066. args: [],
  55067. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  55068. referencedClasses: [],
  55069. pragmas: [],
  55070. messageSends: ["collection", "add:", "assert:equals:", "last"]
  55071. }, function ($methodClass){ return function (){
  55072. var self=this,$self=this;
  55073. var array;
  55074. return $core.withContext(function($ctx1) {
  55075. array=$self._collection();
  55076. $recv(array)._add_((6));
  55077. $self._assert_equals_($recv(array)._last(),(6));
  55078. return self;
  55079. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array})});
  55080. }; }),
  55081. $globals.ArrayTest);
  55082. $core.addMethod(
  55083. $core.method({
  55084. selector: "testAddFirst",
  55085. protocol: "tests",
  55086. args: [],
  55087. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  55088. referencedClasses: [],
  55089. pragmas: [],
  55090. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  55091. }, function ($methodClass){ return function (){
  55092. var self=this,$self=this;
  55093. return $core.withContext(function($ctx1) {
  55094. var $1;
  55095. $1=$self._collection();
  55096. $recv($1)._addFirst_((0));
  55097. $self._assert_equals_($recv($recv($1)._yourself())._first(),(0));
  55098. return self;
  55099. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{})});
  55100. }; }),
  55101. $globals.ArrayTest);
  55102. $core.addMethod(
  55103. $core.method({
  55104. selector: "testPrintString",
  55105. protocol: "tests",
  55106. args: [],
  55107. 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)'.",
  55108. referencedClasses: ["Array"],
  55109. pragmas: [],
  55110. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  55111. }, function ($methodClass){ return function (){
  55112. var self=this,$self=this;
  55113. var array;
  55114. return $core.withContext(function($ctx1) {
  55115. var $1,$2;
  55116. array=$recv($globals.Array)._new();
  55117. [$self._assert_equals_([$recv(array)._printString()
  55118. ,$ctx1.sendIdx["printString"]=1
  55119. ][0],"an Array ()")
  55120. ,$ctx1.sendIdx["assert:equals:"]=1
  55121. ][0];
  55122. $1=array;
  55123. [$recv($1)._add_((1))
  55124. ,$ctx1.sendIdx["add:"]=1
  55125. ][0];
  55126. [$recv($1)._add_((3))
  55127. ,$ctx1.sendIdx["add:"]=2
  55128. ][0];
  55129. [$self._assert_equals_([$recv(array)._printString()
  55130. ,$ctx1.sendIdx["printString"]=2
  55131. ][0],"an Array (1 3)")
  55132. ,$ctx1.sendIdx["assert:equals:"]=2
  55133. ][0];
  55134. $recv(array)._add_("foo");
  55135. [$self._assert_equals_([$recv(array)._printString()
  55136. ,$ctx1.sendIdx["printString"]=3
  55137. ][0],"an Array (1 3 'foo')")
  55138. ,$ctx1.sendIdx["assert:equals:"]=3
  55139. ][0];
  55140. $2=array;
  55141. [$recv($2)._remove_((1))
  55142. ,$ctx1.sendIdx["remove:"]=1
  55143. ][0];
  55144. $recv($2)._remove_((3));
  55145. [$self._assert_equals_([$recv(array)._printString()
  55146. ,$ctx1.sendIdx["printString"]=4
  55147. ][0],"an Array ('foo')")
  55148. ,$ctx1.sendIdx["assert:equals:"]=4
  55149. ][0];
  55150. [$recv(array)._addLast_((3))
  55151. ,$ctx1.sendIdx["addLast:"]=1
  55152. ][0];
  55153. [$self._assert_equals_([$recv(array)._printString()
  55154. ,$ctx1.sendIdx["printString"]=5
  55155. ][0],"an Array ('foo' 3)")
  55156. ,$ctx1.sendIdx["assert:equals:"]=5
  55157. ][0];
  55158. $recv(array)._addLast_((3));
  55159. $self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  55160. return self;
  55161. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array})});
  55162. }; }),
  55163. $globals.ArrayTest);
  55164. $core.addMethod(
  55165. $core.method({
  55166. selector: "testRemove",
  55167. protocol: "tests",
  55168. args: [],
  55169. 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",
  55170. referencedClasses: ["Error"],
  55171. pragmas: [],
  55172. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  55173. }, function ($methodClass){ return function (){
  55174. var self=this,$self=this;
  55175. var array;
  55176. return $core.withContext(function($ctx1) {
  55177. array=[(1), (2), (3), (4), (5)];
  55178. [$recv(array)._remove_((3))
  55179. ,$ctx1.sendIdx["remove:"]=1
  55180. ][0];
  55181. $self._assert_equals_(array,[(1), (2), (4), (5)]);
  55182. $self._should_raise_((function(){
  55183. return $core.withContext(function($ctx2) {
  55184. return $recv(array)._remove_((3));
  55185. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55186. }),$globals.Error);
  55187. return self;
  55188. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array})});
  55189. }; }),
  55190. $globals.ArrayTest);
  55191. $core.addMethod(
  55192. $core.method({
  55193. selector: "testRemoveFromTo",
  55194. protocol: "tests",
  55195. args: [],
  55196. 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)",
  55197. referencedClasses: [],
  55198. pragmas: [],
  55199. messageSends: ["assert:equals:", "removeFrom:to:"]
  55200. }, function ($methodClass){ return function (){
  55201. var self=this,$self=this;
  55202. return $core.withContext(function($ctx1) {
  55203. [$self._assert_equals_([[(1), (2), (3), (4)]._removeFrom_to_((1),(3))
  55204. ,$ctx1.sendIdx["removeFrom:to:"]=1
  55205. ][0],[(4)])
  55206. ,$ctx1.sendIdx["assert:equals:"]=1
  55207. ][0];
  55208. [$self._assert_equals_([[(1), (2), (3), (4)]._removeFrom_to_((2),(3))
  55209. ,$ctx1.sendIdx["removeFrom:to:"]=2
  55210. ][0],[(1), (4)])
  55211. ,$ctx1.sendIdx["assert:equals:"]=2
  55212. ][0];
  55213. $self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  55214. return self;
  55215. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{})});
  55216. }; }),
  55217. $globals.ArrayTest);
  55218. $core.addMethod(
  55219. $core.method({
  55220. selector: "testRemoveIndex",
  55221. protocol: "tests",
  55222. args: [],
  55223. 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: #()",
  55224. referencedClasses: [],
  55225. pragmas: [],
  55226. messageSends: ["assert:equals:", "removeIndex:"]
  55227. }, function ($methodClass){ return function (){
  55228. var self=this,$self=this;
  55229. return $core.withContext(function($ctx1) {
  55230. [$self._assert_equals_([[(1), (2), (3), (4)]._removeIndex_((2))
  55231. ,$ctx1.sendIdx["removeIndex:"]=1
  55232. ][0],[(1), (3), (4)])
  55233. ,$ctx1.sendIdx["assert:equals:"]=1
  55234. ][0];
  55235. [$self._assert_equals_([[(1), (2), (3), (4)]._removeIndex_((1))
  55236. ,$ctx1.sendIdx["removeIndex:"]=2
  55237. ][0],[(2), (3), (4)])
  55238. ,$ctx1.sendIdx["assert:equals:"]=2
  55239. ][0];
  55240. $self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  55241. return self;
  55242. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{})});
  55243. }; }),
  55244. $globals.ArrayTest);
  55245. $core.addMethod(
  55246. $core.method({
  55247. selector: "testRemoveLast",
  55248. protocol: "tests",
  55249. args: [],
  55250. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  55251. referencedClasses: [],
  55252. pragmas: [],
  55253. messageSends: ["removeLast", "assert:equals:", "last"]
  55254. }, function ($methodClass){ return function (){
  55255. var self=this,$self=this;
  55256. var array;
  55257. return $core.withContext(function($ctx1) {
  55258. array=[(1), (2)];
  55259. $recv(array)._removeLast();
  55260. $self._assert_equals_($recv(array)._last(),(1));
  55261. return self;
  55262. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array})});
  55263. }; }),
  55264. $globals.ArrayTest);
  55265. $core.addMethod(
  55266. $core.method({
  55267. selector: "testReversed",
  55268. protocol: "tests",
  55269. args: [],
  55270. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  55271. referencedClasses: [],
  55272. pragmas: [],
  55273. messageSends: ["assert:equals:", "reversed"]
  55274. }, function ($methodClass){ return function (){
  55275. var self=this,$self=this;
  55276. var array;
  55277. return $core.withContext(function($ctx1) {
  55278. array=[(5), (4), (3), (2), (1)];
  55279. $self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  55280. return self;
  55281. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array})});
  55282. }; }),
  55283. $globals.ArrayTest);
  55284. $core.addMethod(
  55285. $core.method({
  55286. selector: "testSort",
  55287. protocol: "tests",
  55288. args: [],
  55289. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  55290. referencedClasses: [],
  55291. pragmas: [],
  55292. messageSends: ["sort", "assert:equals:"]
  55293. }, function ($methodClass){ return function (){
  55294. var self=this,$self=this;
  55295. var array;
  55296. return $core.withContext(function($ctx1) {
  55297. array=[(10), (1), (5)];
  55298. $recv(array)._sort();
  55299. $self._assert_equals_(array,[(1), (5), (10)]);
  55300. return self;
  55301. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array})});
  55302. }; }),
  55303. $globals.ArrayTest);
  55304. $core.addMethod(
  55305. $core.method({
  55306. selector: "collectionClass",
  55307. protocol: "fixture",
  55308. args: [],
  55309. source: "collectionClass\x0a\x09^ Array",
  55310. referencedClasses: ["Array"],
  55311. pragmas: [],
  55312. messageSends: []
  55313. }, function ($methodClass){ return function (){
  55314. var self=this,$self=this;
  55315. return $globals.Array;
  55316. }; }),
  55317. $globals.ArrayTest.a$cls);
  55318. $core.addClass("StringTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55319. $core.addMethod(
  55320. $core.method({
  55321. selector: "collection",
  55322. protocol: "fixture",
  55323. args: [],
  55324. source: "collection\x0a\x09^ 'helLo'",
  55325. referencedClasses: [],
  55326. pragmas: [],
  55327. messageSends: []
  55328. }, function ($methodClass){ return function (){
  55329. var self=this,$self=this;
  55330. return "helLo";
  55331. }; }),
  55332. $globals.StringTest);
  55333. $core.addMethod(
  55334. $core.method({
  55335. selector: "collectionFirst",
  55336. protocol: "fixture",
  55337. args: [],
  55338. source: "collectionFirst\x0a\x09^ 'h'",
  55339. referencedClasses: [],
  55340. pragmas: [],
  55341. messageSends: []
  55342. }, function ($methodClass){ return function (){
  55343. var self=this,$self=this;
  55344. return "h";
  55345. }; }),
  55346. $globals.StringTest);
  55347. $core.addMethod(
  55348. $core.method({
  55349. selector: "collectionFirstTwo",
  55350. protocol: "fixture",
  55351. args: [],
  55352. source: "collectionFirstTwo\x0a\x09^ 'he'",
  55353. referencedClasses: [],
  55354. pragmas: [],
  55355. messageSends: []
  55356. }, function ($methodClass){ return function (){
  55357. var self=this,$self=this;
  55358. return "he";
  55359. }; }),
  55360. $globals.StringTest);
  55361. $core.addMethod(
  55362. $core.method({
  55363. selector: "collectionLast",
  55364. protocol: "fixture",
  55365. args: [],
  55366. source: "collectionLast\x0a\x09^ 'o'",
  55367. referencedClasses: [],
  55368. pragmas: [],
  55369. messageSends: []
  55370. }, function ($methodClass){ return function (){
  55371. var self=this,$self=this;
  55372. return "o";
  55373. }; }),
  55374. $globals.StringTest);
  55375. $core.addMethod(
  55376. $core.method({
  55377. selector: "collectionLastTwo",
  55378. protocol: "fixture",
  55379. args: [],
  55380. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  55381. referencedClasses: [],
  55382. pragmas: [],
  55383. messageSends: []
  55384. }, function ($methodClass){ return function (){
  55385. var self=this,$self=this;
  55386. return "Lo";
  55387. }; }),
  55388. $globals.StringTest);
  55389. $core.addMethod(
  55390. $core.method({
  55391. selector: "collectionOfPrintStrings",
  55392. protocol: "fixture",
  55393. args: [],
  55394. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  55395. referencedClasses: [],
  55396. pragmas: [],
  55397. messageSends: []
  55398. }, function ($methodClass){ return function (){
  55399. var self=this,$self=this;
  55400. return "'h''e''l''L''o'";
  55401. }; }),
  55402. $globals.StringTest);
  55403. $core.addMethod(
  55404. $core.method({
  55405. selector: "collectionSize",
  55406. protocol: "fixture",
  55407. args: [],
  55408. source: "collectionSize\x0a\x09^ 5",
  55409. referencedClasses: [],
  55410. pragmas: [],
  55411. messageSends: []
  55412. }, function ($methodClass){ return function (){
  55413. var self=this,$self=this;
  55414. return (5);
  55415. }; }),
  55416. $globals.StringTest);
  55417. $core.addMethod(
  55418. $core.method({
  55419. selector: "collectionWithDuplicates",
  55420. protocol: "fixture",
  55421. args: [],
  55422. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  55423. referencedClasses: [],
  55424. pragmas: [],
  55425. messageSends: []
  55426. }, function ($methodClass){ return function (){
  55427. var self=this,$self=this;
  55428. return "abbaerten";
  55429. }; }),
  55430. $globals.StringTest);
  55431. $core.addMethod(
  55432. $core.method({
  55433. selector: "collectionWithNewValue",
  55434. protocol: "fixture",
  55435. args: [],
  55436. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  55437. referencedClasses: [],
  55438. pragmas: [],
  55439. messageSends: []
  55440. }, function ($methodClass){ return function (){
  55441. var self=this,$self=this;
  55442. return "helLoN";
  55443. }; }),
  55444. $globals.StringTest);
  55445. $core.addMethod(
  55446. $core.method({
  55447. selector: "sampleNewValueAsCollection",
  55448. protocol: "fixture",
  55449. args: [],
  55450. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  55451. referencedClasses: [],
  55452. pragmas: [],
  55453. messageSends: []
  55454. }, function ($methodClass){ return function (){
  55455. var self=this,$self=this;
  55456. return "N";
  55457. }; }),
  55458. $globals.StringTest);
  55459. $core.addMethod(
  55460. $core.method({
  55461. selector: "samplesDo:",
  55462. protocol: "fixture",
  55463. args: ["aBlock"],
  55464. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  55465. referencedClasses: [],
  55466. pragmas: [],
  55467. messageSends: ["samplesDo:", "value:value:"]
  55468. }, function ($methodClass){ return function (aBlock){
  55469. var self=this,$self=this;
  55470. return $core.withContext(function($ctx1) {
  55471. [(
  55472. $ctx1.supercall = true,
  55473. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.call($self,aBlock))
  55474. ,$ctx1.supercall = false
  55475. ][0];
  55476. $recv(aBlock)._value_value_((3),"l");
  55477. return self;
  55478. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock})});
  55479. }; }),
  55480. $globals.StringTest);
  55481. $core.addMethod(
  55482. $core.method({
  55483. selector: "testAddAll",
  55484. protocol: "tests",
  55485. args: [],
  55486. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  55487. referencedClasses: ["Error"],
  55488. pragmas: [],
  55489. messageSends: ["should:raise:", "addAll:", "collection"]
  55490. }, function ($methodClass){ return function (){
  55491. var self=this,$self=this;
  55492. return $core.withContext(function($ctx1) {
  55493. $self._should_raise_((function(){
  55494. return $core.withContext(function($ctx2) {
  55495. return $recv([$self._collection()
  55496. ,$ctx2.sendIdx["collection"]=1
  55497. ][0])._addAll_($self._collection());
  55498. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55499. }),$globals.Error);
  55500. return self;
  55501. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{})});
  55502. }; }),
  55503. $globals.StringTest);
  55504. $core.addMethod(
  55505. $core.method({
  55506. selector: "testAddRemove",
  55507. protocol: "tests",
  55508. args: [],
  55509. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  55510. referencedClasses: ["Error"],
  55511. pragmas: [],
  55512. messageSends: ["should:raise:", "add:", "remove:"]
  55513. }, function ($methodClass){ return function (){
  55514. var self=this,$self=this;
  55515. return $core.withContext(function($ctx1) {
  55516. [$self._should_raise_((function(){
  55517. return $core.withContext(function($ctx2) {
  55518. return "hello"._add_("a");
  55519. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55520. }),$globals.Error)
  55521. ,$ctx1.sendIdx["should:raise:"]=1
  55522. ][0];
  55523. $self._should_raise_((function(){
  55524. return $core.withContext(function($ctx2) {
  55525. return "hello"._remove_("h");
  55526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55527. }),$globals.Error);
  55528. return self;
  55529. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{})});
  55530. }; }),
  55531. $globals.StringTest);
  55532. $core.addMethod(
  55533. $core.method({
  55534. selector: "testAsArray",
  55535. protocol: "tests",
  55536. args: [],
  55537. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  55538. referencedClasses: [],
  55539. pragmas: [],
  55540. messageSends: ["assert:equals:", "asArray"]
  55541. }, function ($methodClass){ return function (){
  55542. var self=this,$self=this;
  55543. return $core.withContext(function($ctx1) {
  55544. $self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  55545. return self;
  55546. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{})});
  55547. }; }),
  55548. $globals.StringTest);
  55549. $core.addMethod(
  55550. $core.method({
  55551. selector: "testAsLowerCase",
  55552. protocol: "tests",
  55553. args: [],
  55554. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  55555. referencedClasses: [],
  55556. pragmas: [],
  55557. messageSends: ["assert:equals:", "asLowercase"]
  55558. }, function ($methodClass){ return function (){
  55559. var self=this,$self=this;
  55560. return $core.withContext(function($ctx1) {
  55561. $self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  55562. return self;
  55563. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{})});
  55564. }; }),
  55565. $globals.StringTest);
  55566. $core.addMethod(
  55567. $core.method({
  55568. selector: "testAsNumber",
  55569. protocol: "tests",
  55570. args: [],
  55571. 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.",
  55572. referencedClasses: [],
  55573. pragmas: [],
  55574. messageSends: ["assert:equals:", "asNumber"]
  55575. }, function ($methodClass){ return function (){
  55576. var self=this,$self=this;
  55577. return $core.withContext(function($ctx1) {
  55578. [$self._assert_equals_(["3"._asNumber()
  55579. ,$ctx1.sendIdx["asNumber"]=1
  55580. ][0],(3))
  55581. ,$ctx1.sendIdx["assert:equals:"]=1
  55582. ][0];
  55583. [$self._assert_equals_(["-3"._asNumber()
  55584. ,$ctx1.sendIdx["asNumber"]=2
  55585. ][0],(-3))
  55586. ,$ctx1.sendIdx["assert:equals:"]=2
  55587. ][0];
  55588. $self._assert_equals_("-1.5"._asNumber(),(-1.5));
  55589. return self;
  55590. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{})});
  55591. }; }),
  55592. $globals.StringTest);
  55593. $core.addMethod(
  55594. $core.method({
  55595. selector: "testAsUpperCase",
  55596. protocol: "tests",
  55597. args: [],
  55598. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  55599. referencedClasses: [],
  55600. pragmas: [],
  55601. messageSends: ["assert:equals:", "asUppercase"]
  55602. }, function ($methodClass){ return function (){
  55603. var self=this,$self=this;
  55604. return $core.withContext(function($ctx1) {
  55605. $self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  55606. return self;
  55607. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{})});
  55608. }; }),
  55609. $globals.StringTest);
  55610. $core.addMethod(
  55611. $core.method({
  55612. selector: "testAsciiValue",
  55613. protocol: "tests",
  55614. args: [],
  55615. 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",
  55616. referencedClasses: [],
  55617. pragmas: [],
  55618. messageSends: ["assert:equals:", "asciiValue"]
  55619. }, function ($methodClass){ return function (){
  55620. var self=this,$self=this;
  55621. var characterA,characterU;
  55622. return $core.withContext(function($ctx1) {
  55623. characterA="A";
  55624. characterU="U";
  55625. [$self._assert_equals_([$recv(characterA)._asciiValue()
  55626. ,$ctx1.sendIdx["asciiValue"]=1
  55627. ][0],(65))
  55628. ,$ctx1.sendIdx["assert:equals:"]=1
  55629. ][0];
  55630. $self._assert_equals_($recv(characterU)._asciiValue(),(85));
  55631. return self;
  55632. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU})});
  55633. }; }),
  55634. $globals.StringTest);
  55635. $core.addMethod(
  55636. $core.method({
  55637. selector: "testAtIfAbsentPut",
  55638. protocol: "tests",
  55639. args: [],
  55640. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  55641. referencedClasses: ["Error"],
  55642. pragmas: [],
  55643. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  55644. }, function ($methodClass){ return function (){
  55645. var self=this,$self=this;
  55646. return $core.withContext(function($ctx1) {
  55647. $self._should_raise_((function(){
  55648. return $core.withContext(function($ctx2) {
  55649. return "hello"._at_ifAbsentPut_((6),(function(){
  55650. return "a";
  55651. }));
  55652. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55653. }),$globals.Error);
  55654. return self;
  55655. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{})});
  55656. }; }),
  55657. $globals.StringTest);
  55658. $core.addMethod(
  55659. $core.method({
  55660. selector: "testAtPut",
  55661. protocol: "tests",
  55662. args: [],
  55663. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  55664. referencedClasses: ["Error"],
  55665. pragmas: [],
  55666. messageSends: ["should:raise:", "at:put:"]
  55667. }, function ($methodClass){ return function (){
  55668. var self=this,$self=this;
  55669. return $core.withContext(function($ctx1) {
  55670. $self._should_raise_((function(){
  55671. return $core.withContext(function($ctx2) {
  55672. return "hello"._at_put_((1),"a");
  55673. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55674. }),$globals.Error);
  55675. return self;
  55676. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{})});
  55677. }; }),
  55678. $globals.StringTest);
  55679. $core.addMethod(
  55680. $core.method({
  55681. selector: "testCapitalized",
  55682. protocol: "tests",
  55683. args: [],
  55684. 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.",
  55685. referencedClasses: [],
  55686. pragmas: [],
  55687. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  55688. }, function ($methodClass){ return function (){
  55689. var self=this,$self=this;
  55690. return $core.withContext(function($ctx1) {
  55691. [$self._assert_equals_(["test"._capitalized()
  55692. ,$ctx1.sendIdx["capitalized"]=1
  55693. ][0],"Test")
  55694. ,$ctx1.sendIdx["assert:equals:"]=1
  55695. ][0];
  55696. [$self._assert_equals_(["Test"._capitalized()
  55697. ,$ctx1.sendIdx["capitalized"]=2
  55698. ][0],"Test")
  55699. ,$ctx1.sendIdx["assert:equals:"]=2
  55700. ][0];
  55701. [$self._assert_equals_(""._capitalized(),"")
  55702. ,$ctx1.sendIdx["assert:equals:"]=3
  55703. ][0];
  55704. [$self._assert_equals_(["Test"._isCapitalized()
  55705. ,$ctx1.sendIdx["isCapitalized"]=1
  55706. ][0],true)
  55707. ,$ctx1.sendIdx["assert:equals:"]=4
  55708. ][0];
  55709. $self._assert_equals_("test"._isCapitalized(),false);
  55710. return self;
  55711. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{})});
  55712. }; }),
  55713. $globals.StringTest);
  55714. $core.addMethod(
  55715. $core.method({
  55716. selector: "testCharCodeAt",
  55717. protocol: "tests",
  55718. args: [],
  55719. 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",
  55720. referencedClasses: [],
  55721. pragmas: [],
  55722. messageSends: ["assert:equals:", "charCodeAt:"]
  55723. }, function ($methodClass){ return function (){
  55724. var self=this,$self=this;
  55725. return $core.withContext(function($ctx1) {
  55726. [$self._assert_equals_(["jackie"._charCodeAt_((1))
  55727. ,$ctx1.sendIdx["charCodeAt:"]=1
  55728. ][0],(106))
  55729. ,$ctx1.sendIdx["assert:equals:"]=1
  55730. ][0];
  55731. [$self._assert_equals_(["jackie"._charCodeAt_((2))
  55732. ,$ctx1.sendIdx["charCodeAt:"]=2
  55733. ][0],(97))
  55734. ,$ctx1.sendIdx["assert:equals:"]=2
  55735. ][0];
  55736. [$self._assert_equals_(["jackie"._charCodeAt_((3))
  55737. ,$ctx1.sendIdx["charCodeAt:"]=3
  55738. ][0],(99))
  55739. ,$ctx1.sendIdx["assert:equals:"]=3
  55740. ][0];
  55741. [$self._assert_equals_(["jackie"._charCodeAt_((4))
  55742. ,$ctx1.sendIdx["charCodeAt:"]=4
  55743. ][0],(107))
  55744. ,$ctx1.sendIdx["assert:equals:"]=4
  55745. ][0];
  55746. [$self._assert_equals_(["jackie"._charCodeAt_((5))
  55747. ,$ctx1.sendIdx["charCodeAt:"]=5
  55748. ][0],(105))
  55749. ,$ctx1.sendIdx["assert:equals:"]=5
  55750. ][0];
  55751. $self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  55752. return self;
  55753. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{})});
  55754. }; }),
  55755. $globals.StringTest);
  55756. $core.addMethod(
  55757. $core.method({
  55758. selector: "testCopyFromTo",
  55759. protocol: "tests",
  55760. args: [],
  55761. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  55762. referencedClasses: [],
  55763. pragmas: [],
  55764. messageSends: ["assert:equals:", "copyFrom:to:"]
  55765. }, function ($methodClass){ return function (){
  55766. var self=this,$self=this;
  55767. return $core.withContext(function($ctx1) {
  55768. [$self._assert_equals_(["jackie"._copyFrom_to_((1),(3))
  55769. ,$ctx1.sendIdx["copyFrom:to:"]=1
  55770. ][0],"jac")
  55771. ,$ctx1.sendIdx["assert:equals:"]=1
  55772. ][0];
  55773. $self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  55774. return self;
  55775. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{})});
  55776. }; }),
  55777. $globals.StringTest);
  55778. $core.addMethod(
  55779. $core.method({
  55780. selector: "testCopySeparates",
  55781. protocol: "tests",
  55782. args: [],
  55783. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  55784. referencedClasses: [],
  55785. pragmas: [],
  55786. messageSends: ["assert:", "==", "copy", "collection"]
  55787. }, function ($methodClass){ return function (){
  55788. var self=this,$self=this;
  55789. return $core.withContext(function($ctx1) {
  55790. $self._assert_($recv($recv([$self._collection()
  55791. ,$ctx1.sendIdx["collection"]=1
  55792. ][0])._copy()).__eq_eq($self._collection()));
  55793. return self;
  55794. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{})});
  55795. }; }),
  55796. $globals.StringTest);
  55797. $core.addMethod(
  55798. $core.method({
  55799. selector: "testCopyWithoutAll",
  55800. protocol: "tests",
  55801. args: [],
  55802. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  55803. referencedClasses: [],
  55804. pragmas: [],
  55805. messageSends: ["assert:equals:", "copyWithoutAll:"]
  55806. }, function ($methodClass){ return function (){
  55807. var self=this,$self=this;
  55808. return $core.withContext(function($ctx1) {
  55809. $self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  55810. return self;
  55811. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{})});
  55812. }; }),
  55813. $globals.StringTest);
  55814. $core.addMethod(
  55815. $core.method({
  55816. selector: "testEquality",
  55817. protocol: "tests",
  55818. args: [],
  55819. 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",
  55820. referencedClasses: [],
  55821. pragmas: [],
  55822. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  55823. }, function ($methodClass){ return function (){
  55824. var self=this,$self=this;
  55825. return $core.withContext(function($ctx1) {
  55826. [$self._assert_equals_("hello","hello")
  55827. ,$ctx1.sendIdx["assert:equals:"]=1
  55828. ][0];
  55829. [$self._deny_(["hello".__eq("world")
  55830. ,$ctx1.sendIdx["="]=1
  55831. ][0])
  55832. ,$ctx1.sendIdx["deny:"]=1
  55833. ][0];
  55834. [$self._deny_(["hello".__eq([]._at_ifAbsent_((1),(function(){
  55835. })))
  55836. ,$ctx1.sendIdx["="]=2
  55837. ][0])
  55838. ,$ctx1.sendIdx["deny:"]=2
  55839. ][0];
  55840. [$self._assert_equals_("hello",["hello"._yourself()
  55841. ,$ctx1.sendIdx["yourself"]=1
  55842. ][0])
  55843. ,$ctx1.sendIdx["assert:equals:"]=2
  55844. ][0];
  55845. $self._assert_equals_("hello"._yourself(),"hello");
  55846. $self._deny_("".__eq((0)));
  55847. return self;
  55848. }, function($ctx1) {$ctx1.fill(self,"testEquality",{})});
  55849. }; }),
  55850. $globals.StringTest);
  55851. $core.addMethod(
  55852. $core.method({
  55853. selector: "testIdentity",
  55854. protocol: "tests",
  55855. args: [],
  55856. 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",
  55857. referencedClasses: [],
  55858. pragmas: [],
  55859. messageSends: ["assert:", "==", "deny:", "yourself"]
  55860. }, function ($methodClass){ return function (){
  55861. var self=this,$self=this;
  55862. return $core.withContext(function($ctx1) {
  55863. [$self._assert_(["hello".__eq_eq("hello")
  55864. ,$ctx1.sendIdx["=="]=1
  55865. ][0])
  55866. ,$ctx1.sendIdx["assert:"]=1
  55867. ][0];
  55868. [$self._deny_(["hello".__eq_eq("world")
  55869. ,$ctx1.sendIdx["=="]=2
  55870. ][0])
  55871. ,$ctx1.sendIdx["deny:"]=1
  55872. ][0];
  55873. [$self._assert_(["hello".__eq_eq(["hello"._yourself()
  55874. ,$ctx1.sendIdx["yourself"]=1
  55875. ][0])
  55876. ,$ctx1.sendIdx["=="]=3
  55877. ][0])
  55878. ,$ctx1.sendIdx["assert:"]=2
  55879. ][0];
  55880. $self._assert_([$recv("hello"._yourself()).__eq_eq("hello")
  55881. ,$ctx1.sendIdx["=="]=4
  55882. ][0]);
  55883. $self._deny_("".__eq_eq((0)));
  55884. return self;
  55885. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{})});
  55886. }; }),
  55887. $globals.StringTest);
  55888. $core.addMethod(
  55889. $core.method({
  55890. selector: "testIncludesSubString",
  55891. protocol: "tests",
  55892. args: [],
  55893. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  55894. referencedClasses: [],
  55895. pragmas: [],
  55896. messageSends: ["assert:", "includesSubString:", "deny:"]
  55897. }, function ($methodClass){ return function (){
  55898. var self=this,$self=this;
  55899. return $core.withContext(function($ctx1) {
  55900. $self._assert_(["amber"._includesSubString_("ber")
  55901. ,$ctx1.sendIdx["includesSubString:"]=1
  55902. ][0]);
  55903. $self._deny_("amber"._includesSubString_("zork"));
  55904. return self;
  55905. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{})});
  55906. }; }),
  55907. $globals.StringTest);
  55908. $core.addMethod(
  55909. $core.method({
  55910. selector: "testIndexOfStartingAtWithNull",
  55911. protocol: "tests",
  55912. args: [],
  55913. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  55914. referencedClasses: [],
  55915. pragmas: [],
  55916. messageSends: []
  55917. }, function ($methodClass){ return function (){
  55918. var self=this,$self=this;
  55919. return self;
  55920. }; }),
  55921. $globals.StringTest);
  55922. $core.addMethod(
  55923. $core.method({
  55924. selector: "testIndexOfWithNull",
  55925. protocol: "tests",
  55926. args: [],
  55927. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  55928. referencedClasses: [],
  55929. pragmas: [],
  55930. messageSends: []
  55931. }, function ($methodClass){ return function (){
  55932. var self=this,$self=this;
  55933. return self;
  55934. }; }),
  55935. $globals.StringTest);
  55936. $core.addMethod(
  55937. $core.method({
  55938. selector: "testIsVowel",
  55939. protocol: "tests",
  55940. args: [],
  55941. 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",
  55942. referencedClasses: [],
  55943. pragmas: [],
  55944. messageSends: ["assert:equals:", "isVowel"]
  55945. }, function ($methodClass){ return function (){
  55946. var self=this,$self=this;
  55947. var vowel,consonant;
  55948. return $core.withContext(function($ctx1) {
  55949. vowel="u";
  55950. consonant="z";
  55951. [$self._assert_equals_([$recv(vowel)._isVowel()
  55952. ,$ctx1.sendIdx["isVowel"]=1
  55953. ][0],true)
  55954. ,$ctx1.sendIdx["assert:equals:"]=1
  55955. ][0];
  55956. $self._assert_equals_($recv(consonant)._isVowel(),false);
  55957. return self;
  55958. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant})});
  55959. }; }),
  55960. $globals.StringTest);
  55961. $core.addMethod(
  55962. $core.method({
  55963. selector: "testJoin",
  55964. protocol: "tests",
  55965. args: [],
  55966. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  55967. referencedClasses: [],
  55968. pragmas: [],
  55969. messageSends: ["assert:equals:", "join:"]
  55970. }, function ($methodClass){ return function (){
  55971. var self=this,$self=this;
  55972. return $core.withContext(function($ctx1) {
  55973. $self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  55974. return self;
  55975. }, function($ctx1) {$ctx1.fill(self,"testJoin",{})});
  55976. }; }),
  55977. $globals.StringTest);
  55978. $core.addMethod(
  55979. $core.method({
  55980. selector: "testRegression1224",
  55981. protocol: "tests",
  55982. args: [],
  55983. source: "testRegression1224\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size ] raise: Error",
  55984. referencedClasses: ["Error"],
  55985. pragmas: [],
  55986. messageSends: ["should:raise:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  55987. }, function ($methodClass){ return function (){
  55988. var self=this,$self=this;
  55989. return $core.withContext(function($ctx1) {
  55990. var $1;
  55991. $self._should_raise_((function(){
  55992. return $core.withContext(function($ctx2) {
  55993. $1=$recv($self._collectionClass())._new();
  55994. $recv($1)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  55995. }));
  55996. return $recv($recv($1)._yourself())._size();
  55997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55998. }),$globals.Error);
  55999. return self;
  56000. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{})});
  56001. }; }),
  56002. $globals.StringTest);
  56003. $core.addMethod(
  56004. $core.method({
  56005. selector: "testRemoveAll",
  56006. protocol: "tests",
  56007. args: [],
  56008. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  56009. referencedClasses: ["Error"],
  56010. pragmas: [],
  56011. messageSends: ["should:raise:", "removeAll", "collection"]
  56012. }, function ($methodClass){ return function (){
  56013. var self=this,$self=this;
  56014. return $core.withContext(function($ctx1) {
  56015. $self._should_raise_((function(){
  56016. return $core.withContext(function($ctx2) {
  56017. return $recv($self._collection())._removeAll();
  56018. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56019. }),$globals.Error);
  56020. return self;
  56021. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{})});
  56022. }; }),
  56023. $globals.StringTest);
  56024. $core.addMethod(
  56025. $core.method({
  56026. selector: "testReversed",
  56027. protocol: "tests",
  56028. args: [],
  56029. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  56030. referencedClasses: [],
  56031. pragmas: [],
  56032. messageSends: ["assert:equals:", "reversed"]
  56033. }, function ($methodClass){ return function (){
  56034. var self=this,$self=this;
  56035. return $core.withContext(function($ctx1) {
  56036. $self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  56037. return self;
  56038. }, function($ctx1) {$ctx1.fill(self,"testReversed",{})});
  56039. }; }),
  56040. $globals.StringTest);
  56041. $core.addMethod(
  56042. $core.method({
  56043. selector: "testStreamContents",
  56044. protocol: "tests",
  56045. args: [],
  56046. 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'",
  56047. referencedClasses: ["String"],
  56048. pragmas: [],
  56049. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  56050. }, function ($methodClass){ return function (){
  56051. var self=this,$self=this;
  56052. return $core.withContext(function($ctx1) {
  56053. $self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  56054. return $core.withContext(function($ctx2) {
  56055. [$recv(aStream)._nextPutAll_("hello")
  56056. ,$ctx2.sendIdx["nextPutAll:"]=1
  56057. ][0];
  56058. $recv(aStream)._space();
  56059. return $recv(aStream)._nextPutAll_("world");
  56060. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  56061. })),"hello world");
  56062. return self;
  56063. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{})});
  56064. }; }),
  56065. $globals.StringTest);
  56066. $core.addMethod(
  56067. $core.method({
  56068. selector: "testSubStrings",
  56069. protocol: "tests",
  56070. args: [],
  56071. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  56072. referencedClasses: [],
  56073. pragmas: [],
  56074. messageSends: ["assert:equals:", "subStrings:"]
  56075. }, function ($methodClass){ return function (){
  56076. var self=this,$self=this;
  56077. return $core.withContext(function($ctx1) {
  56078. $self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  56079. return self;
  56080. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{})});
  56081. }; }),
  56082. $globals.StringTest);
  56083. $core.addMethod(
  56084. $core.method({
  56085. selector: "testTrim",
  56086. protocol: "tests",
  56087. args: [],
  56088. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  56089. referencedClasses: [],
  56090. pragmas: [],
  56091. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  56092. }, function ($methodClass){ return function (){
  56093. var self=this,$self=this;
  56094. return $core.withContext(function($ctx1) {
  56095. [$self._assert_equals_(" jackie"._trimLeft(),"jackie")
  56096. ,$ctx1.sendIdx["assert:equals:"]=1
  56097. ][0];
  56098. $self._assert_equals_("jackie "._trimRight(),"jackie");
  56099. return self;
  56100. }, function($ctx1) {$ctx1.fill(self,"testTrim",{})});
  56101. }; }),
  56102. $globals.StringTest);
  56103. $core.addMethod(
  56104. $core.method({
  56105. selector: "testValue",
  56106. protocol: "tests",
  56107. args: [],
  56108. 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')",
  56109. referencedClasses: [],
  56110. pragmas: [],
  56111. messageSends: ["assert:equals:", "value:", "collect:"]
  56112. }, function ($methodClass){ return function (){
  56113. var self=this,$self=this;
  56114. return $core.withContext(function($ctx1) {
  56115. [$self._assert_equals_("asString"._value_((1)),"1")
  56116. ,$ctx1.sendIdx["assert:equals:"]=1
  56117. ][0];
  56118. $self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  56119. return self;
  56120. }, function($ctx1) {$ctx1.fill(self,"testValue",{})});
  56121. }; }),
  56122. $globals.StringTest);
  56123. $core.addMethod(
  56124. $core.method({
  56125. selector: "collectionClass",
  56126. protocol: "fixture",
  56127. args: [],
  56128. source: "collectionClass\x0a\x09^ String",
  56129. referencedClasses: ["String"],
  56130. pragmas: [],
  56131. messageSends: []
  56132. }, function ($methodClass){ return function (){
  56133. var self=this,$self=this;
  56134. return $globals.String;
  56135. }; }),
  56136. $globals.StringTest.a$cls);
  56137. $core.addClass("SetTest", $globals.CollectionTest, [], "Kernel-Tests");
  56138. $core.addMethod(
  56139. $core.method({
  56140. selector: "collection",
  56141. protocol: "fixture",
  56142. args: [],
  56143. 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",
  56144. referencedClasses: ["Set", "Smalltalk"],
  56145. pragmas: [],
  56146. messageSends: ["add:", "new", "@", "yourself"]
  56147. }, function ($methodClass){ return function (){
  56148. var self=this,$self=this;
  56149. return $core.withContext(function($ctx1) {
  56150. var $1;
  56151. $1=$recv($globals.Set)._new();
  56152. [$recv($1)._add_($globals.Smalltalk)
  56153. ,$ctx1.sendIdx["add:"]=1
  56154. ][0];
  56155. [$recv($1)._add_(nil)
  56156. ,$ctx1.sendIdx["add:"]=2
  56157. ][0];
  56158. [$recv($1)._add_((3).__at((3)))
  56159. ,$ctx1.sendIdx["add:"]=3
  56160. ][0];
  56161. [$recv($1)._add_(false)
  56162. ,$ctx1.sendIdx["add:"]=4
  56163. ][0];
  56164. $recv($1)._add_($self.sampleBlock);
  56165. return $recv($1)._yourself();
  56166. }, function($ctx1) {$ctx1.fill(self,"collection",{})});
  56167. }; }),
  56168. $globals.SetTest);
  56169. $core.addMethod(
  56170. $core.method({
  56171. selector: "collectionOfPrintStrings",
  56172. protocol: "fixture",
  56173. args: [],
  56174. 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",
  56175. referencedClasses: ["Set"],
  56176. pragmas: [],
  56177. messageSends: ["add:", "new", "yourself"]
  56178. }, function ($methodClass){ return function (){
  56179. var self=this,$self=this;
  56180. return $core.withContext(function($ctx1) {
  56181. var $1;
  56182. $1=$recv($globals.Set)._new();
  56183. [$recv($1)._add_("a SmalltalkImage")
  56184. ,$ctx1.sendIdx["add:"]=1
  56185. ][0];
  56186. [$recv($1)._add_("nil")
  56187. ,$ctx1.sendIdx["add:"]=2
  56188. ][0];
  56189. [$recv($1)._add_("3@3")
  56190. ,$ctx1.sendIdx["add:"]=3
  56191. ][0];
  56192. [$recv($1)._add_("false")
  56193. ,$ctx1.sendIdx["add:"]=4
  56194. ][0];
  56195. $recv($1)._add_("a BlockClosure");
  56196. return $recv($1)._yourself();
  56197. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{})});
  56198. }; }),
  56199. $globals.SetTest);
  56200. $core.addMethod(
  56201. $core.method({
  56202. selector: "collectionSize",
  56203. protocol: "fixture",
  56204. args: [],
  56205. source: "collectionSize\x0a\x09^ 5",
  56206. referencedClasses: [],
  56207. pragmas: [],
  56208. messageSends: []
  56209. }, function ($methodClass){ return function (){
  56210. var self=this,$self=this;
  56211. return (5);
  56212. }; }),
  56213. $globals.SetTest);
  56214. $core.addMethod(
  56215. $core.method({
  56216. selector: "collectionWithDuplicates",
  56217. protocol: "fixture",
  56218. args: [],
  56219. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  56220. referencedClasses: [],
  56221. pragmas: [],
  56222. messageSends: ["add:", "collection", "yourself"]
  56223. }, function ($methodClass){ return function (){
  56224. var self=this,$self=this;
  56225. return $core.withContext(function($ctx1) {
  56226. var $1;
  56227. $1=$self._collection();
  56228. $recv($1)._add_((0));
  56229. return $recv($1)._yourself();
  56230. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{})});
  56231. }; }),
  56232. $globals.SetTest);
  56233. $core.addMethod(
  56234. $core.method({
  56235. selector: "collectionWithNewValue",
  56236. protocol: "fixture",
  56237. args: [],
  56238. 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",
  56239. referencedClasses: ["Set", "Smalltalk"],
  56240. pragmas: [],
  56241. messageSends: ["add:", "new", "@", "yourself"]
  56242. }, function ($methodClass){ return function (){
  56243. var self=this,$self=this;
  56244. return $core.withContext(function($ctx1) {
  56245. var $1;
  56246. $1=$recv($globals.Set)._new();
  56247. [$recv($1)._add_($globals.Smalltalk)
  56248. ,$ctx1.sendIdx["add:"]=1
  56249. ][0];
  56250. [$recv($1)._add_(nil)
  56251. ,$ctx1.sendIdx["add:"]=2
  56252. ][0];
  56253. [$recv($1)._add_((3).__at((3)))
  56254. ,$ctx1.sendIdx["add:"]=3
  56255. ][0];
  56256. [$recv($1)._add_("N")
  56257. ,$ctx1.sendIdx["add:"]=4
  56258. ][0];
  56259. [$recv($1)._add_(false)
  56260. ,$ctx1.sendIdx["add:"]=5
  56261. ][0];
  56262. $recv($1)._add_($self.sampleBlock);
  56263. return $recv($1)._yourself();
  56264. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{})});
  56265. }; }),
  56266. $globals.SetTest);
  56267. $core.addMethod(
  56268. $core.method({
  56269. selector: "testAddAll",
  56270. protocol: "tests",
  56271. args: [],
  56272. 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",
  56273. referencedClasses: [],
  56274. pragmas: [],
  56275. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  56276. }, function ($methodClass){ return function (){
  56277. var self=this,$self=this;
  56278. return $core.withContext(function($ctx1) {
  56279. var $1,$2,$3;
  56280. [(
  56281. $ctx1.supercall = true,
  56282. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._testAddAll.call($self))
  56283. ,$ctx1.supercall = false
  56284. ][0];
  56285. $1=[$self._collection()
  56286. ,$ctx1.sendIdx["collection"]=1
  56287. ][0];
  56288. [$recv($1)._addAll_([$self._collection()
  56289. ,$ctx1.sendIdx["collection"]=2
  56290. ][0])
  56291. ,$ctx1.sendIdx["addAll:"]=1
  56292. ][0];
  56293. [$self._assert_equals_([$recv($1)._yourself()
  56294. ,$ctx1.sendIdx["yourself"]=1
  56295. ][0],[$self._collection()
  56296. ,$ctx1.sendIdx["collection"]=3
  56297. ][0])
  56298. ,$ctx1.sendIdx["assert:equals:"]=1
  56299. ][0];
  56300. $2=[$self._collection()
  56301. ,$ctx1.sendIdx["collection"]=4
  56302. ][0];
  56303. [$recv($2)._addAll_([$self._collectionWithNewValue()
  56304. ,$ctx1.sendIdx["collectionWithNewValue"]=1
  56305. ][0])
  56306. ,$ctx1.sendIdx["addAll:"]=2
  56307. ][0];
  56308. [$self._assert_equals_([$recv($2)._yourself()
  56309. ,$ctx1.sendIdx["yourself"]=2
  56310. ][0],[$self._collectionWithNewValue()
  56311. ,$ctx1.sendIdx["collectionWithNewValue"]=2
  56312. ][0])
  56313. ,$ctx1.sendIdx["assert:equals:"]=2
  56314. ][0];
  56315. $3=[$self._collectionWithNewValue()
  56316. ,$ctx1.sendIdx["collectionWithNewValue"]=3
  56317. ][0];
  56318. $recv($3)._addAll_($self._collection());
  56319. $self._assert_equals_($recv($3)._yourself(),$self._collectionWithNewValue());
  56320. return self;
  56321. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{})});
  56322. }; }),
  56323. $globals.SetTest);
  56324. $core.addMethod(
  56325. $core.method({
  56326. selector: "testAddRemove",
  56327. protocol: "tests",
  56328. args: [],
  56329. 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)",
  56330. referencedClasses: ["Set"],
  56331. pragmas: [],
  56332. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  56333. }, function ($methodClass){ return function (){
  56334. var self=this,$self=this;
  56335. var set;
  56336. return $core.withContext(function($ctx1) {
  56337. set=$recv($globals.Set)._new();
  56338. [$self._assert_($recv(set)._isEmpty())
  56339. ,$ctx1.sendIdx["assert:"]=1
  56340. ][0];
  56341. [$recv(set)._add_((3))
  56342. ,$ctx1.sendIdx["add:"]=1
  56343. ][0];
  56344. [$self._assert_([$recv(set)._includes_((3))
  56345. ,$ctx1.sendIdx["includes:"]=1
  56346. ][0])
  56347. ,$ctx1.sendIdx["assert:"]=2
  56348. ][0];
  56349. $recv(set)._add_((5));
  56350. $self._assert_([$recv(set)._includes_((5))
  56351. ,$ctx1.sendIdx["includes:"]=2
  56352. ][0]);
  56353. $recv(set)._remove_((3));
  56354. $self._deny_($recv(set)._includes_((3)));
  56355. return self;
  56356. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set})});
  56357. }; }),
  56358. $globals.SetTest);
  56359. $core.addMethod(
  56360. $core.method({
  56361. selector: "testAt",
  56362. protocol: "tests",
  56363. args: [],
  56364. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  56365. referencedClasses: ["Set", "Error"],
  56366. pragmas: [],
  56367. messageSends: ["should:raise:", "at:put:", "new"]
  56368. }, function ($methodClass){ return function (){
  56369. var self=this,$self=this;
  56370. return $core.withContext(function($ctx1) {
  56371. $self._should_raise_((function(){
  56372. return $core.withContext(function($ctx2) {
  56373. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  56374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56375. }),$globals.Error);
  56376. return self;
  56377. }, function($ctx1) {$ctx1.fill(self,"testAt",{})});
  56378. }; }),
  56379. $globals.SetTest);
  56380. $core.addMethod(
  56381. $core.method({
  56382. selector: "testCollect",
  56383. protocol: "tests",
  56384. args: [],
  56385. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  56386. referencedClasses: [],
  56387. pragmas: [],
  56388. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  56389. }, function ($methodClass){ return function (){
  56390. var self=this,$self=this;
  56391. return $core.withContext(function($ctx1) {
  56392. [(
  56393. $ctx1.supercall = true,
  56394. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._testCollect.call($self))
  56395. ,$ctx1.supercall = false
  56396. ][0];
  56397. $self._assert_equals_($recv([[(5), (6), (8)]._asSet()
  56398. ,$ctx1.sendIdx["asSet"]=1
  56399. ][0])._collect_((function(x){
  56400. return $core.withContext(function($ctx2) {
  56401. return $recv(x).__backslash_backslash((3));
  56402. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56403. })),[(0), (2)]._asSet());
  56404. return self;
  56405. }, function($ctx1) {$ctx1.fill(self,"testCollect",{})});
  56406. }; }),
  56407. $globals.SetTest);
  56408. $core.addMethod(
  56409. $core.method({
  56410. selector: "testComma",
  56411. protocol: "tests",
  56412. args: [],
  56413. 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",
  56414. referencedClasses: [],
  56415. pragmas: [],
  56416. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  56417. }, function ($methodClass){ return function (){
  56418. var self=this,$self=this;
  56419. return $core.withContext(function($ctx1) {
  56420. [(
  56421. $ctx1.supercall = true,
  56422. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._testComma.call($self))
  56423. ,$ctx1.supercall = false
  56424. ][0];
  56425. [$self._assert_equals_([$recv([$self._collection()
  56426. ,$ctx1.sendIdx["collection"]=1
  56427. ][0]).__comma([$self._collection()
  56428. ,$ctx1.sendIdx["collection"]=2
  56429. ][0])
  56430. ,$ctx1.sendIdx[","]=1
  56431. ][0],[$self._collection()
  56432. ,$ctx1.sendIdx["collection"]=3
  56433. ][0])
  56434. ,$ctx1.sendIdx["assert:equals:"]=1
  56435. ][0];
  56436. [$self._assert_equals_([$recv([$self._collection()
  56437. ,$ctx1.sendIdx["collection"]=4
  56438. ][0]).__comma([$self._collectionWithNewValue()
  56439. ,$ctx1.sendIdx["collectionWithNewValue"]=1
  56440. ][0])
  56441. ,$ctx1.sendIdx[","]=2
  56442. ][0],[$self._collectionWithNewValue()
  56443. ,$ctx1.sendIdx["collectionWithNewValue"]=2
  56444. ][0])
  56445. ,$ctx1.sendIdx["assert:equals:"]=2
  56446. ][0];
  56447. $self._assert_equals_($recv([$self._collectionWithNewValue()
  56448. ,$ctx1.sendIdx["collectionWithNewValue"]=3
  56449. ][0]).__comma($self._collection()),$self._collectionWithNewValue());
  56450. return self;
  56451. }, function($ctx1) {$ctx1.fill(self,"testComma",{})});
  56452. }; }),
  56453. $globals.SetTest);
  56454. $core.addMethod(
  56455. $core.method({
  56456. selector: "testComparing",
  56457. protocol: "tests",
  56458. args: [],
  56459. 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",
  56460. referencedClasses: [],
  56461. pragmas: [],
  56462. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  56463. }, function ($methodClass){ return function (){
  56464. var self=this,$self=this;
  56465. return $core.withContext(function($ctx1) {
  56466. [$self._assert_equals_([[(0), (2)]._asSet()
  56467. ,$ctx1.sendIdx["asSet"]=1
  56468. ][0],[[(0), (2)]._asSet()
  56469. ,$ctx1.sendIdx["asSet"]=2
  56470. ][0])
  56471. ,$ctx1.sendIdx["assert:equals:"]=1
  56472. ][0];
  56473. $self._assert_equals_([[(2), (0)]._asSet()
  56474. ,$ctx1.sendIdx["asSet"]=3
  56475. ][0],[[(0), (2)]._asSet()
  56476. ,$ctx1.sendIdx["asSet"]=4
  56477. ][0]);
  56478. [$self._deny_([$recv([[(0), (2), (3)]._asSet()
  56479. ,$ctx1.sendIdx["asSet"]=5
  56480. ][0]).__eq([[(0), (2)]._asSet()
  56481. ,$ctx1.sendIdx["asSet"]=6
  56482. ][0])
  56483. ,$ctx1.sendIdx["="]=1
  56484. ][0])
  56485. ,$ctx1.sendIdx["deny:"]=1
  56486. ][0];
  56487. $self._deny_($recv([[(1), (2)]._asSet()
  56488. ,$ctx1.sendIdx["asSet"]=7
  56489. ][0]).__eq([(0), (2)]._asSet()));
  56490. return self;
  56491. }, function($ctx1) {$ctx1.fill(self,"testComparing",{})});
  56492. }; }),
  56493. $globals.SetTest);
  56494. $core.addMethod(
  56495. $core.method({
  56496. selector: "testPrintString",
  56497. protocol: "tests",
  56498. args: [],
  56499. 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'')'",
  56500. referencedClasses: ["Set"],
  56501. pragmas: [],
  56502. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  56503. }, function ($methodClass){ return function (){
  56504. var self=this,$self=this;
  56505. var set;
  56506. return $core.withContext(function($ctx1) {
  56507. var $1,$2;
  56508. set=$recv($globals.Set)._new();
  56509. [$self._assert_equals_([$recv(set)._printString()
  56510. ,$ctx1.sendIdx["printString"]=1
  56511. ][0],"a Set ()")
  56512. ,$ctx1.sendIdx["assert:equals:"]=1
  56513. ][0];
  56514. $1=set;
  56515. [$recv($1)._add_((1))
  56516. ,$ctx1.sendIdx["add:"]=1
  56517. ][0];
  56518. [$recv($1)._add_((3))
  56519. ,$ctx1.sendIdx["add:"]=2
  56520. ][0];
  56521. [$self._assert_equals_([$recv(set)._printString()
  56522. ,$ctx1.sendIdx["printString"]=2
  56523. ][0],"a Set (1 3)")
  56524. ,$ctx1.sendIdx["assert:equals:"]=2
  56525. ][0];
  56526. [$recv(set)._add_("foo")
  56527. ,$ctx1.sendIdx["add:"]=3
  56528. ][0];
  56529. [$self._assert_equals_([$recv(set)._printString()
  56530. ,$ctx1.sendIdx["printString"]=3
  56531. ][0],"a Set (1 3 'foo')")
  56532. ,$ctx1.sendIdx["assert:equals:"]=3
  56533. ][0];
  56534. $2=set;
  56535. [$recv($2)._remove_((1))
  56536. ,$ctx1.sendIdx["remove:"]=1
  56537. ][0];
  56538. $recv($2)._remove_((3));
  56539. [$self._assert_equals_([$recv(set)._printString()
  56540. ,$ctx1.sendIdx["printString"]=4
  56541. ][0],"a Set ('foo')")
  56542. ,$ctx1.sendIdx["assert:equals:"]=4
  56543. ][0];
  56544. [$recv(set)._add_((3))
  56545. ,$ctx1.sendIdx["add:"]=4
  56546. ][0];
  56547. [$self._assert_equals_([$recv(set)._printString()
  56548. ,$ctx1.sendIdx["printString"]=5
  56549. ][0],"a Set (3 'foo')")
  56550. ,$ctx1.sendIdx["assert:equals:"]=5
  56551. ][0];
  56552. $recv(set)._add_((3));
  56553. $self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  56554. return self;
  56555. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set})});
  56556. }; }),
  56557. $globals.SetTest);
  56558. $core.addMethod(
  56559. $core.method({
  56560. selector: "testRegression1225",
  56561. protocol: "tests",
  56562. args: [],
  56563. source: "testRegression1225\x0a\x09self assert: (#(1 2 3) asSet add: 3) equals: 3",
  56564. referencedClasses: [],
  56565. pragmas: [],
  56566. messageSends: ["assert:equals:", "add:", "asSet"]
  56567. }, function ($methodClass){ return function (){
  56568. var self=this,$self=this;
  56569. return $core.withContext(function($ctx1) {
  56570. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._add_((3)),(3));
  56571. return self;
  56572. }, function($ctx1) {$ctx1.fill(self,"testRegression1225",{})});
  56573. }; }),
  56574. $globals.SetTest);
  56575. $core.addMethod(
  56576. $core.method({
  56577. selector: "testRegression1226",
  56578. protocol: "tests",
  56579. args: [],
  56580. source: "testRegression1226\x0a\x09self assert: (#(1 2 3) asSet remove: 3) equals: 3",
  56581. referencedClasses: [],
  56582. pragmas: [],
  56583. messageSends: ["assert:equals:", "remove:", "asSet"]
  56584. }, function ($methodClass){ return function (){
  56585. var self=this,$self=this;
  56586. return $core.withContext(function($ctx1) {
  56587. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._remove_((3)),(3));
  56588. return self;
  56589. }, function($ctx1) {$ctx1.fill(self,"testRegression1226",{})});
  56590. }; }),
  56591. $globals.SetTest);
  56592. $core.addMethod(
  56593. $core.method({
  56594. selector: "testRegression1227",
  56595. protocol: "tests",
  56596. args: [],
  56597. source: "testRegression1227\x0a\x09self assert: (#(1 2 3) asSet remove: 4 ifAbsent: [5]) equals: 5",
  56598. referencedClasses: [],
  56599. pragmas: [],
  56600. messageSends: ["assert:equals:", "remove:ifAbsent:", "asSet"]
  56601. }, function ($methodClass){ return function (){
  56602. var self=this,$self=this;
  56603. return $core.withContext(function($ctx1) {
  56604. $self._assert_equals_($recv([(1), (2), (3)]._asSet())._remove_ifAbsent_((4),(function(){
  56605. return (5);
  56606. })),(5));
  56607. return self;
  56608. }, function($ctx1) {$ctx1.fill(self,"testRegression1227",{})});
  56609. }; }),
  56610. $globals.SetTest);
  56611. $core.addMethod(
  56612. $core.method({
  56613. selector: "testRegression1228",
  56614. protocol: "tests",
  56615. args: [],
  56616. source: "testRegression1228\x0a\x09self should: [#(1 2 3) asSet remove: 4] raise: Error",
  56617. referencedClasses: ["Error"],
  56618. pragmas: [],
  56619. messageSends: ["should:raise:", "remove:", "asSet"]
  56620. }, function ($methodClass){ return function (){
  56621. var self=this,$self=this;
  56622. return $core.withContext(function($ctx1) {
  56623. $self._should_raise_((function(){
  56624. return $core.withContext(function($ctx2) {
  56625. return $recv([(1), (2), (3)]._asSet())._remove_((4));
  56626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56627. }),$globals.Error);
  56628. return self;
  56629. }, function($ctx1) {$ctx1.fill(self,"testRegression1228",{})});
  56630. }; }),
  56631. $globals.SetTest);
  56632. $core.addMethod(
  56633. $core.method({
  56634. selector: "testRegression1245",
  56635. protocol: "tests",
  56636. args: [],
  56637. source: "testRegression1245\x0a\x09self assert: ({Object. String} asSet remove: String) equals: String",
  56638. referencedClasses: ["Object", "String"],
  56639. pragmas: [],
  56640. messageSends: ["assert:equals:", "remove:", "asSet"]
  56641. }, function ($methodClass){ return function (){
  56642. var self=this,$self=this;
  56643. return $core.withContext(function($ctx1) {
  56644. $self._assert_equals_($recv($recv([$globals.Object,$globals.String])._asSet())._remove_($globals.String),$globals.String);
  56645. return self;
  56646. }, function($ctx1) {$ctx1.fill(self,"testRegression1245",{})});
  56647. }; }),
  56648. $globals.SetTest);
  56649. $core.addMethod(
  56650. $core.method({
  56651. selector: "testUnboxedObjects",
  56652. protocol: "tests",
  56653. args: [],
  56654. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  56655. referencedClasses: [],
  56656. pragmas: [],
  56657. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  56658. }, function ($methodClass){ return function (){
  56659. var self=this,$self=this;
  56660. return $core.withContext(function($ctx1) {
  56661. $self._assert_equals_($recv($recv([["foo"._yourself()
  56662. ,$ctx1.sendIdx["yourself"]=1
  56663. ][0],"foo"._yourself()])._asSet())._asArray(),["foo"]);
  56664. return self;
  56665. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{})});
  56666. }; }),
  56667. $globals.SetTest);
  56668. $core.addMethod(
  56669. $core.method({
  56670. selector: "testUnicity",
  56671. protocol: "tests",
  56672. args: [],
  56673. 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')",
  56674. referencedClasses: ["Set"],
  56675. pragmas: [],
  56676. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  56677. }, function ($methodClass){ return function (){
  56678. var self=this,$self=this;
  56679. var set;
  56680. return $core.withContext(function($ctx1) {
  56681. set=$recv($globals.Set)._new();
  56682. [$recv(set)._add_((21))
  56683. ,$ctx1.sendIdx["add:"]=1
  56684. ][0];
  56685. [$recv(set)._add_("hello")
  56686. ,$ctx1.sendIdx["add:"]=2
  56687. ][0];
  56688. [$recv(set)._add_((21))
  56689. ,$ctx1.sendIdx["add:"]=3
  56690. ][0];
  56691. [$self._assert_equals_([$recv(set)._size()
  56692. ,$ctx1.sendIdx["size"]=1
  56693. ][0],(2))
  56694. ,$ctx1.sendIdx["assert:equals:"]=1
  56695. ][0];
  56696. $recv(set)._add_("hello");
  56697. [$self._assert_equals_($recv(set)._size(),(2))
  56698. ,$ctx1.sendIdx["assert:equals:"]=2
  56699. ][0];
  56700. $self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  56701. return self;
  56702. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set})});
  56703. }; }),
  56704. $globals.SetTest);
  56705. $core.addMethod(
  56706. $core.method({
  56707. selector: "collectionClass",
  56708. protocol: "fixture",
  56709. args: [],
  56710. source: "collectionClass\x0a\x09^ Set",
  56711. referencedClasses: ["Set"],
  56712. pragmas: [],
  56713. messageSends: []
  56714. }, function ($methodClass){ return function (){
  56715. var self=this,$self=this;
  56716. return $globals.Set;
  56717. }; }),
  56718. $globals.SetTest.a$cls);
  56719. $core.addClass("ConsoleTranscriptTest", $globals.TestCase, [], "Kernel-Tests");
  56720. $core.addMethod(
  56721. $core.method({
  56722. selector: "testShow",
  56723. protocol: "tests",
  56724. args: [],
  56725. 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.",
  56726. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  56727. pragmas: [],
  56728. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  56729. }, function ($methodClass){ return function (){
  56730. var self=this,$self=this;
  56731. var originalTranscript;
  56732. return $core.withContext(function($ctx1) {
  56733. originalTranscript=$recv($globals.Transcript)._current();
  56734. [$recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new())
  56735. ,$ctx1.sendIdx["register:"]=1
  56736. ][0];
  56737. [$self._shouldnt_raise_((function(){
  56738. return $core.withContext(function($ctx2) {
  56739. return [$recv($globals.Transcript)._show_("Hello console!")
  56740. ,$ctx2.sendIdx["show:"]=1
  56741. ][0];
  56742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56743. }),$globals.Error)
  56744. ,$ctx1.sendIdx["shouldnt:raise:"]=1
  56745. ][0];
  56746. $self._shouldnt_raise_((function(){
  56747. return $core.withContext(function($ctx2) {
  56748. return $recv($globals.Transcript)._show_(console);
  56749. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56750. }),$globals.Error);
  56751. $recv($globals.Transcript)._register_(originalTranscript);
  56752. return self;
  56753. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript})});
  56754. }; }),
  56755. $globals.ConsoleTranscriptTest);
  56756. $core.addClass("DateTest", $globals.TestCase, [], "Kernel-Tests");
  56757. $core.addMethod(
  56758. $core.method({
  56759. selector: "testEquality",
  56760. protocol: "tests",
  56761. args: [],
  56762. 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",
  56763. referencedClasses: ["Date"],
  56764. pragmas: [],
  56765. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  56766. }, function ($methodClass){ return function (){
  56767. var self=this,$self=this;
  56768. var now;
  56769. return $core.withContext(function($ctx1) {
  56770. now=$recv($globals.Date)._new();
  56771. [$self._assert_([$recv(now).__eq(now)
  56772. ,$ctx1.sendIdx["="]=1
  56773. ][0])
  56774. ,$ctx1.sendIdx["assert:"]=1
  56775. ][0];
  56776. $self._deny_([$recv(now).__eq([$recv($globals.Date)._fromMilliseconds_((0))
  56777. ,$ctx1.sendIdx["fromMilliseconds:"]=1
  56778. ][0])
  56779. ,$ctx1.sendIdx["="]=2
  56780. ][0]);
  56781. [$self._assert_([$recv([$recv($globals.Date)._fromMilliseconds_((12345678))
  56782. ,$ctx1.sendIdx["fromMilliseconds:"]=2
  56783. ][0]).__eq([$recv($globals.Date)._fromMilliseconds_((12345678))
  56784. ,$ctx1.sendIdx["fromMilliseconds:"]=3
  56785. ][0])
  56786. ,$ctx1.sendIdx["="]=3
  56787. ][0])
  56788. ,$ctx1.sendIdx["assert:"]=2
  56789. ][0];
  56790. [$self._assert_([$recv(now).__eq([$recv($globals.Date)._fromMilliseconds_([$recv(now)._asMilliseconds()
  56791. ,$ctx1.sendIdx["asMilliseconds"]=1
  56792. ][0])
  56793. ,$ctx1.sendIdx["fromMilliseconds:"]=4
  56794. ][0])
  56795. ,$ctx1.sendIdx["="]=4
  56796. ][0])
  56797. ,$ctx1.sendIdx["assert:"]=3
  56798. ][0];
  56799. $self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  56800. return self;
  56801. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now})});
  56802. }; }),
  56803. $globals.DateTest);
  56804. $core.addMethod(
  56805. $core.method({
  56806. selector: "testIdentity",
  56807. protocol: "tests",
  56808. args: [],
  56809. 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",
  56810. referencedClasses: ["Date"],
  56811. pragmas: [],
  56812. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  56813. }, function ($methodClass){ return function (){
  56814. var self=this,$self=this;
  56815. var now;
  56816. return $core.withContext(function($ctx1) {
  56817. now=$recv($globals.Date)._new();
  56818. $self._assert_([$recv(now).__eq_eq(now)
  56819. ,$ctx1.sendIdx["=="]=1
  56820. ][0]);
  56821. [$self._deny_([$recv(now).__eq_eq([$recv($globals.Date)._fromMilliseconds_((0))
  56822. ,$ctx1.sendIdx["fromMilliseconds:"]=1
  56823. ][0])
  56824. ,$ctx1.sendIdx["=="]=2
  56825. ][0])
  56826. ,$ctx1.sendIdx["deny:"]=1
  56827. ][0];
  56828. [$self._deny_([$recv([$recv($globals.Date)._fromMilliseconds_((12345678))
  56829. ,$ctx1.sendIdx["fromMilliseconds:"]=2
  56830. ][0]).__eq_eq([$recv($globals.Date)._fromMilliseconds_((12345678))
  56831. ,$ctx1.sendIdx["fromMilliseconds:"]=3
  56832. ][0])
  56833. ,$ctx1.sendIdx["=="]=3
  56834. ][0])
  56835. ,$ctx1.sendIdx["deny:"]=2
  56836. ][0];
  56837. [$self._deny_([$recv(now).__eq_eq([$recv($globals.Date)._fromMilliseconds_([$recv(now)._asMilliseconds()
  56838. ,$ctx1.sendIdx["asMilliseconds"]=1
  56839. ][0])
  56840. ,$ctx1.sendIdx["fromMilliseconds:"]=4
  56841. ][0])
  56842. ,$ctx1.sendIdx["=="]=4
  56843. ][0])
  56844. ,$ctx1.sendIdx["deny:"]=3
  56845. ][0];
  56846. $self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  56847. return self;
  56848. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now})});
  56849. }; }),
  56850. $globals.DateTest);
  56851. $core.addMethod(
  56852. $core.method({
  56853. selector: "testPlusAndMinus",
  56854. protocol: "tests",
  56855. args: [],
  56856. source: "testPlusAndMinus\x0a\x09| a b now zeroDuration |\x0a\x09a := Date fromString: '1974-07-12 14:30'.\x0a\x09now := Date now.\x0a\x09b := Date fromString: '2616-03-06'.\x0a\x09zeroDuration := 0.\x0a\x0a\x09self assert: {a-a. now-now. b-b} asSet equals: (Set with: zeroDuration).\x0a\x09self assert: now + (b - now) equals: b.\x0a\x09self assert: a + (b - a) equals: b.\x0a\x09self assert: now + (a - now) equals: a.\x0a\x09self assert: a + ((now - a) + (b - now)) equals: b",
  56857. referencedClasses: ["Date", "Set"],
  56858. pragmas: [],
  56859. messageSends: ["fromString:", "now", "assert:equals:", "asSet", "-", "with:", "+"]
  56860. }, function ($methodClass){ return function (){
  56861. var self=this,$self=this;
  56862. var a,b,now,zeroDuration;
  56863. return $core.withContext(function($ctx1) {
  56864. a=[$recv($globals.Date)._fromString_("1974-07-12 14:30")
  56865. ,$ctx1.sendIdx["fromString:"]=1
  56866. ][0];
  56867. now=$recv($globals.Date)._now();
  56868. b=$recv($globals.Date)._fromString_("2616-03-06");
  56869. zeroDuration=(0);
  56870. [$self._assert_equals_($recv([[$recv(a).__minus(a)
  56871. ,$ctx1.sendIdx["-"]=1
  56872. ][0],[$recv(now).__minus(now)
  56873. ,$ctx1.sendIdx["-"]=2
  56874. ][0],[$recv(b).__minus(b)
  56875. ,$ctx1.sendIdx["-"]=3
  56876. ][0]])._asSet(),$recv($globals.Set)._with_(zeroDuration))
  56877. ,$ctx1.sendIdx["assert:equals:"]=1
  56878. ][0];
  56879. [$self._assert_equals_([$recv(now).__plus([$recv(b).__minus(now)
  56880. ,$ctx1.sendIdx["-"]=4
  56881. ][0])
  56882. ,$ctx1.sendIdx["+"]=1
  56883. ][0],b)
  56884. ,$ctx1.sendIdx["assert:equals:"]=2
  56885. ][0];
  56886. [$self._assert_equals_([$recv(a).__plus([$recv(b).__minus(a)
  56887. ,$ctx1.sendIdx["-"]=5
  56888. ][0])
  56889. ,$ctx1.sendIdx["+"]=2
  56890. ][0],b)
  56891. ,$ctx1.sendIdx["assert:equals:"]=3
  56892. ][0];
  56893. [$self._assert_equals_([$recv(now).__plus([$recv(a).__minus(now)
  56894. ,$ctx1.sendIdx["-"]=6
  56895. ][0])
  56896. ,$ctx1.sendIdx["+"]=3
  56897. ][0],a)
  56898. ,$ctx1.sendIdx["assert:equals:"]=4
  56899. ][0];
  56900. $self._assert_equals_([$recv(a).__plus($recv([$recv(now).__minus(a)
  56901. ,$ctx1.sendIdx["-"]=7
  56902. ][0]).__plus($recv(b).__minus(now)))
  56903. ,$ctx1.sendIdx["+"]=4
  56904. ][0],b);
  56905. return self;
  56906. }, function($ctx1) {$ctx1.fill(self,"testPlusAndMinus",{a:a,b:b,now:now,zeroDuration:zeroDuration})});
  56907. }; }),
  56908. $globals.DateTest);
  56909. $core.addClass("JSObjectProxyTest", $globals.TestCase, [], "Kernel-Tests");
  56910. $core.addMethod(
  56911. $core.method({
  56912. selector: "jsObject",
  56913. protocol: "accessing",
  56914. args: [],
  56915. 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}'>",
  56916. referencedClasses: [],
  56917. pragmas: [["inlineJS:", ["return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: \x22\x22, \x22e\x22: null, \x22f\x22: void 0}"]]],
  56918. messageSends: []
  56919. }, function ($methodClass){ return function (){
  56920. var self=this,$self=this;
  56921. return $core.withContext(function($ctx1) {
  56922. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  56923. return self;
  56924. }, function($ctx1) {$ctx1.fill(self,"jsObject",{})});
  56925. }; }),
  56926. $globals.JSObjectProxyTest);
  56927. $core.addMethod(
  56928. $core.method({
  56929. selector: "jsUndefined",
  56930. protocol: "accessing",
  56931. args: [],
  56932. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  56933. referencedClasses: [],
  56934. pragmas: [["inlineJS:", ["return"]]],
  56935. messageSends: []
  56936. }, function ($methodClass){ return function (){
  56937. var self=this,$self=this;
  56938. return $core.withContext(function($ctx1) {
  56939. return;
  56940. return self;
  56941. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{})});
  56942. }; }),
  56943. $globals.JSObjectProxyTest);
  56944. $core.addMethod(
  56945. $core.method({
  56946. selector: "testAtIfAbsent",
  56947. protocol: "tests",
  56948. args: [],
  56949. 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.",
  56950. referencedClasses: [],
  56951. pragmas: [],
  56952. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  56953. }, function ($methodClass){ return function (){
  56954. var self=this,$self=this;
  56955. var testObject;
  56956. return $core.withContext(function($ctx1) {
  56957. testObject=$self._jsObject();
  56958. [$self._assert_equals_([$recv(testObject)._at_ifAbsent_("abc",(function(){
  56959. return "Property does not exist";
  56960. }))
  56961. ,$ctx1.sendIdx["at:ifAbsent:"]=1
  56962. ][0],"Property does not exist")
  56963. ,$ctx1.sendIdx["assert:equals:"]=1
  56964. ][0];
  56965. [$self._assert_equals_([$recv(testObject)._at_ifAbsent_("e",(function(){
  56966. return "Property does not exist";
  56967. }))
  56968. ,$ctx1.sendIdx["at:ifAbsent:"]=2
  56969. ][0],nil)
  56970. ,$ctx1.sendIdx["assert:equals:"]=2
  56971. ][0];
  56972. [$self._assert_equals_([$recv(testObject)._at_ifAbsent_("a",(function(){
  56973. return "Property does not exist";
  56974. }))
  56975. ,$ctx1.sendIdx["at:ifAbsent:"]=3
  56976. ][0],(1))
  56977. ,$ctx1.sendIdx["assert:equals:"]=3
  56978. ][0];
  56979. $self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  56980. return "Property does not exist";
  56981. })),nil);
  56982. return self;
  56983. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject})});
  56984. }; }),
  56985. $globals.JSObjectProxyTest);
  56986. $core.addMethod(
  56987. $core.method({
  56988. selector: "testAtIfPresent",
  56989. protocol: "tests",
  56990. args: [],
  56991. 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'.",
  56992. referencedClasses: [],
  56993. pragmas: [],
  56994. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  56995. }, function ($methodClass){ return function (){
  56996. var self=this,$self=this;
  56997. var testObject;
  56998. return $core.withContext(function($ctx1) {
  56999. testObject=$self._jsObject();
  57000. [$self._assert_equals_([$recv(testObject)._at_ifPresent_("abc",(function(x){
  57001. return $core.withContext(function($ctx2) {
  57002. return ["hello ".__comma([$recv(x)._asString()
  57003. ,$ctx2.sendIdx["asString"]=1
  57004. ][0])
  57005. ,$ctx2.sendIdx[","]=1
  57006. ][0];
  57007. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57008. }))
  57009. ,$ctx1.sendIdx["at:ifPresent:"]=1
  57010. ][0],nil)
  57011. ,$ctx1.sendIdx["assert:equals:"]=1
  57012. ][0];
  57013. [$self._assert_equals_([$recv(testObject)._at_ifPresent_("e",(function(x){
  57014. return $core.withContext(function($ctx2) {
  57015. return ["hello ".__comma([$recv(x)._asString()
  57016. ,$ctx2.sendIdx["asString"]=2
  57017. ][0])
  57018. ,$ctx2.sendIdx[","]=2
  57019. ][0];
  57020. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  57021. }))
  57022. ,$ctx1.sendIdx["at:ifPresent:"]=2
  57023. ][0],"hello nil")
  57024. ,$ctx1.sendIdx["assert:equals:"]=2
  57025. ][0];
  57026. [$self._assert_equals_([$recv(testObject)._at_ifPresent_("a",(function(x){
  57027. return $core.withContext(function($ctx2) {
  57028. return ["hello ".__comma([$recv(x)._asString()
  57029. ,$ctx2.sendIdx["asString"]=3
  57030. ][0])
  57031. ,$ctx2.sendIdx[","]=3
  57032. ][0];
  57033. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57034. }))
  57035. ,$ctx1.sendIdx["at:ifPresent:"]=3
  57036. ][0],"hello 1")
  57037. ,$ctx1.sendIdx["assert:equals:"]=3
  57038. ][0];
  57039. $self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  57040. return $core.withContext(function($ctx2) {
  57041. return "hello ".__comma($recv(x)._asString());
  57042. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  57043. })),"hello nil");
  57044. return self;
  57045. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject})});
  57046. }; }),
  57047. $globals.JSObjectProxyTest);
  57048. $core.addMethod(
  57049. $core.method({
  57050. selector: "testAtIfPresentIfAbsent",
  57051. protocol: "tests",
  57052. args: [],
  57053. 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'.",
  57054. referencedClasses: [],
  57055. pragmas: [],
  57056. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  57057. }, function ($methodClass){ return function (){
  57058. var self=this,$self=this;
  57059. var testObject;
  57060. return $core.withContext(function($ctx1) {
  57061. testObject=$self._jsObject();
  57062. [$self._assert_equals_([$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  57063. return $core.withContext(function($ctx2) {
  57064. return ["hello ".__comma([$recv(x)._asString()
  57065. ,$ctx2.sendIdx["asString"]=1
  57066. ][0])
  57067. ,$ctx2.sendIdx[","]=1
  57068. ][0];
  57069. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57070. }),(function(){
  57071. return "not present";
  57072. }))
  57073. ,$ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1
  57074. ][0],"not present")
  57075. ,$ctx1.sendIdx["assert:equals:"]=1
  57076. ][0];
  57077. [$self._assert_equals_([$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  57078. return $core.withContext(function($ctx2) {
  57079. return ["hello ".__comma([$recv(x)._asString()
  57080. ,$ctx2.sendIdx["asString"]=2
  57081. ][0])
  57082. ,$ctx2.sendIdx[","]=2
  57083. ][0];
  57084. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57085. }),(function(){
  57086. return "not present";
  57087. }))
  57088. ,$ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2
  57089. ][0],"hello nil")
  57090. ,$ctx1.sendIdx["assert:equals:"]=2
  57091. ][0];
  57092. [$self._assert_equals_([$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  57093. return $core.withContext(function($ctx2) {
  57094. return ["hello ".__comma([$recv(x)._asString()
  57095. ,$ctx2.sendIdx["asString"]=3
  57096. ][0])
  57097. ,$ctx2.sendIdx[","]=3
  57098. ][0];
  57099. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  57100. }),(function(){
  57101. return "not present";
  57102. }))
  57103. ,$ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3
  57104. ][0],"hello 1")
  57105. ,$ctx1.sendIdx["assert:equals:"]=3
  57106. ][0];
  57107. $self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  57108. return $core.withContext(function($ctx2) {
  57109. return "hello ".__comma($recv(x)._asString());
  57110. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  57111. }),(function(){
  57112. return "not present";
  57113. })),"hello nil");
  57114. return self;
  57115. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject})});
  57116. }; }),
  57117. $globals.JSObjectProxyTest);
  57118. $core.addMethod(
  57119. $core.method({
  57120. selector: "testAtPut",
  57121. protocol: "tests",
  57122. args: [],
  57123. 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'",
  57124. referencedClasses: [],
  57125. pragmas: [],
  57126. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  57127. }, function ($methodClass){ return function (){
  57128. var self=this,$self=this;
  57129. var testObject;
  57130. return $core.withContext(function($ctx1) {
  57131. testObject=$self._jsObject();
  57132. $self._assert_($recv([$recv(testObject)._at_("abc")
  57133. ,$ctx1.sendIdx["at:"]=1
  57134. ][0]).__tild_eq("xyz"));
  57135. [$self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz")
  57136. ,$ctx1.sendIdx["assert:equals:"]=1
  57137. ][0];
  57138. $self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  57139. return self;
  57140. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject})});
  57141. }; }),
  57142. $globals.JSObjectProxyTest);
  57143. $core.addMethod(
  57144. $core.method({
  57145. selector: "testComparison",
  57146. protocol: "tests",
  57147. args: [],
  57148. 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",
  57149. referencedClasses: ["Object"],
  57150. pragmas: [],
  57151. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  57152. }, function ($methodClass){ return function (){
  57153. var self=this,$self=this;
  57154. return $core.withContext(function($ctx1) {
  57155. $self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  57156. $self._assert_([$recv(console).__eq(console)
  57157. ,$ctx1.sendIdx["="]=1
  57158. ][0]);
  57159. [$self._deny_([$recv(console).__eq($recv($globals.Object)._new())
  57160. ,$ctx1.sendIdx["="]=2
  57161. ][0])
  57162. ,$ctx1.sendIdx["deny:"]=1
  57163. ][0];
  57164. $self._deny_($recv(console).__eq($self._jsObject()));
  57165. return self;
  57166. }, function($ctx1) {$ctx1.fill(self,"testComparison",{})});
  57167. }; }),
  57168. $globals.JSObjectProxyTest);
  57169. $core.addMethod(
  57170. $core.method({
  57171. selector: "testDNU",
  57172. protocol: "tests",
  57173. args: [],
  57174. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  57175. referencedClasses: ["MessageNotUnderstood"],
  57176. pragmas: [],
  57177. messageSends: ["should:raise:", "foo", "jsObject"]
  57178. }, function ($methodClass){ return function (){
  57179. var self=this,$self=this;
  57180. return $core.withContext(function($ctx1) {
  57181. $self._should_raise_((function(){
  57182. return $core.withContext(function($ctx2) {
  57183. return $recv($self._jsObject())._foo();
  57184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57185. }),$globals.MessageNotUnderstood);
  57186. return self;
  57187. }, function($ctx1) {$ctx1.fill(self,"testDNU",{})});
  57188. }; }),
  57189. $globals.JSObjectProxyTest);
  57190. $core.addMethod(
  57191. $core.method({
  57192. selector: "testDNUWithAllowJavaScriptCalls",
  57193. protocol: "tests",
  57194. args: [],
  57195. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  57196. referencedClasses: ["MessageNotUnderstood"],
  57197. pragmas: [],
  57198. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  57199. }, function ($methodClass){ return function (){
  57200. var self=this,$self=this;
  57201. var jsObject;
  57202. return $core.withContext(function($ctx1) {
  57203. jsObject=[];
  57204. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  57205. $self._should_raise_((function(){
  57206. return $core.withContext(function($ctx2) {
  57207. return $recv(jsObject)._foo();
  57208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57209. }),$globals.MessageNotUnderstood);
  57210. return self;
  57211. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject})});
  57212. }; }),
  57213. $globals.JSObjectProxyTest);
  57214. $core.addMethod(
  57215. $core.method({
  57216. selector: "testMessageSend",
  57217. protocol: "tests",
  57218. args: [],
  57219. 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",
  57220. referencedClasses: [],
  57221. pragmas: [],
  57222. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  57223. }, function ($methodClass){ return function (){
  57224. var self=this,$self=this;
  57225. return $core.withContext(function($ctx1) {
  57226. [$self._assert_equals_($recv([$self._jsObject()
  57227. ,$ctx1.sendIdx["jsObject"]=1
  57228. ][0])._a(),(1))
  57229. ,$ctx1.sendIdx["assert:equals:"]=1
  57230. ][0];
  57231. [$self._assert_equals_($recv([$self._jsObject()
  57232. ,$ctx1.sendIdx["jsObject"]=2
  57233. ][0])._b(),(2))
  57234. ,$ctx1.sendIdx["assert:equals:"]=2
  57235. ][0];
  57236. $self._assert_equals_($recv($self._jsObject())._c_((3)),(3));
  57237. return self;
  57238. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{})});
  57239. }; }),
  57240. $globals.JSObjectProxyTest);
  57241. $core.addMethod(
  57242. $core.method({
  57243. selector: "testMethodWithArguments",
  57244. protocol: "tests",
  57245. args: [],
  57246. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  57247. referencedClasses: [],
  57248. pragmas: [],
  57249. messageSends: ["assert:equals:", "c:", "jsObject"]
  57250. }, function ($methodClass){ return function (){
  57251. var self=this,$self=this;
  57252. return $core.withContext(function($ctx1) {
  57253. $self._assert_equals_($recv($self._jsObject())._c_((1)),(1));
  57254. return self;
  57255. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{})});
  57256. }; }),
  57257. $globals.JSObjectProxyTest);
  57258. $core.addMethod(
  57259. $core.method({
  57260. selector: "testNull",
  57261. protocol: "tests",
  57262. args: [],
  57263. source: "testNull\x0a\x09self assert: JSObjectProxy null isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy null})\x0a\x09\x09equals: '{\x22foo\x22:null}'",
  57264. referencedClasses: ["JSObjectProxy", "JSON"],
  57265. pragmas: [],
  57266. messageSends: ["assert:", "isNil", "null", "assert:equals:", "stringify:"]
  57267. }, function ($methodClass){ return function (){
  57268. var self=this,$self=this;
  57269. return $core.withContext(function($ctx1) {
  57270. $self._assert_($recv([$recv($globals.JSObjectProxy)._null()
  57271. ,$ctx1.sendIdx["null"]=1
  57272. ][0])._isNil());
  57273. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._null()])),"{\x22foo\x22:null}");
  57274. return self;
  57275. }, function($ctx1) {$ctx1.fill(self,"testNull",{})});
  57276. }; }),
  57277. $globals.JSObjectProxyTest);
  57278. $core.addMethod(
  57279. $core.method({
  57280. selector: "testPrinting",
  57281. protocol: "tests",
  57282. args: [],
  57283. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  57284. referencedClasses: [],
  57285. pragmas: [],
  57286. messageSends: ["assert:equals:", "printString", "jsObject"]
  57287. }, function ($methodClass){ return function (){
  57288. var self=this,$self=this;
  57289. return $core.withContext(function($ctx1) {
  57290. $self._assert_equals_($recv($self._jsObject())._printString(),"[object Object]");
  57291. return self;
  57292. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{})});
  57293. }; }),
  57294. $globals.JSObjectProxyTest);
  57295. $core.addMethod(
  57296. $core.method({
  57297. selector: "testPropertyThatReturnsEmptyString",
  57298. protocol: "tests",
  57299. args: [],
  57300. 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'",
  57301. referencedClasses: [],
  57302. pragmas: [],
  57303. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  57304. }, function ($methodClass){ return function (){
  57305. var self=this,$self=this;
  57306. var object;
  57307. return $core.withContext(function($ctx1) {
  57308. object=$self._jsObject();
  57309. [$self._assert_equals_([$recv(object)._d()
  57310. ,$ctx1.sendIdx["d"]=1
  57311. ][0],"")
  57312. ,$ctx1.sendIdx["assert:equals:"]=1
  57313. ][0];
  57314. $recv(object)._d_("hello");
  57315. $self._assert_equals_($recv(object)._d(),"hello");
  57316. return self;
  57317. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object})});
  57318. }; }),
  57319. $globals.JSObjectProxyTest);
  57320. $core.addMethod(
  57321. $core.method({
  57322. selector: "testPropertyThatReturnsUndefined",
  57323. protocol: "tests",
  57324. args: [],
  57325. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  57326. referencedClasses: ["MessageNotUnderstood"],
  57327. pragmas: [],
  57328. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  57329. }, function ($methodClass){ return function (){
  57330. var self=this,$self=this;
  57331. var object;
  57332. return $core.withContext(function($ctx1) {
  57333. object=$self._jsObject();
  57334. $self._shouldnt_raise_((function(){
  57335. return $core.withContext(function($ctx2) {
  57336. return [$recv(object)._e()
  57337. ,$ctx2.sendIdx["e"]=1
  57338. ][0];
  57339. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57340. }),$globals.MessageNotUnderstood);
  57341. $self._assert_($recv($recv(object)._e())._isNil());
  57342. return self;
  57343. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object})});
  57344. }; }),
  57345. $globals.JSObjectProxyTest);
  57346. $core.addMethod(
  57347. $core.method({
  57348. selector: "testSetPropertyWithFalsyValue",
  57349. protocol: "tests",
  57350. args: [],
  57351. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: JSObjectProxy null.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  57352. referencedClasses: ["JSObjectProxy"],
  57353. pragmas: [],
  57354. messageSends: ["jsObject", "assert:equals:", "a", "a:", "null", "jsUndefined"]
  57355. }, function ($methodClass){ return function (){
  57356. var self=this,$self=this;
  57357. var jsObject;
  57358. return $core.withContext(function($ctx1) {
  57359. jsObject=$self._jsObject();
  57360. [$self._assert_equals_([$recv(jsObject)._a()
  57361. ,$ctx1.sendIdx["a"]=1
  57362. ][0],(1))
  57363. ,$ctx1.sendIdx["assert:equals:"]=1
  57364. ][0];
  57365. [$recv(jsObject)._a_($recv($globals.JSObjectProxy)._null())
  57366. ,$ctx1.sendIdx["a:"]=1
  57367. ][0];
  57368. [$self._assert_equals_([$recv(jsObject)._a()
  57369. ,$ctx1.sendIdx["a"]=2
  57370. ][0],nil)
  57371. ,$ctx1.sendIdx["assert:equals:"]=2
  57372. ][0];
  57373. [$recv(jsObject)._a_((0))
  57374. ,$ctx1.sendIdx["a:"]=2
  57375. ][0];
  57376. [$self._assert_equals_([$recv(jsObject)._a()
  57377. ,$ctx1.sendIdx["a"]=3
  57378. ][0],(0))
  57379. ,$ctx1.sendIdx["assert:equals:"]=3
  57380. ][0];
  57381. [$recv(jsObject)._a_($self._jsUndefined())
  57382. ,$ctx1.sendIdx["a:"]=3
  57383. ][0];
  57384. [$self._assert_equals_([$recv(jsObject)._a()
  57385. ,$ctx1.sendIdx["a"]=4
  57386. ][0],nil)
  57387. ,$ctx1.sendIdx["assert:equals:"]=4
  57388. ][0];
  57389. [$recv(jsObject)._a_("")
  57390. ,$ctx1.sendIdx["a:"]=4
  57391. ][0];
  57392. [$self._assert_equals_([$recv(jsObject)._a()
  57393. ,$ctx1.sendIdx["a"]=5
  57394. ][0],"")
  57395. ,$ctx1.sendIdx["assert:equals:"]=5
  57396. ][0];
  57397. $recv(jsObject)._a_(false);
  57398. $self._assert_equals_($recv(jsObject)._a(),false);
  57399. return self;
  57400. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject})});
  57401. }; }),
  57402. $globals.JSObjectProxyTest);
  57403. $core.addMethod(
  57404. $core.method({
  57405. selector: "testUndefined",
  57406. protocol: "tests",
  57407. args: [],
  57408. source: "testUndefined\x0a\x09self assert: JSObjectProxy undefined isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy undefined})\x0a\x09\x09equals: '{}'",
  57409. referencedClasses: ["JSObjectProxy", "JSON"],
  57410. pragmas: [],
  57411. messageSends: ["assert:", "isNil", "undefined", "assert:equals:", "stringify:"]
  57412. }, function ($methodClass){ return function (){
  57413. var self=this,$self=this;
  57414. return $core.withContext(function($ctx1) {
  57415. $self._assert_($recv([$recv($globals.JSObjectProxy)._undefined()
  57416. ,$ctx1.sendIdx["undefined"]=1
  57417. ][0])._isNil());
  57418. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._undefined()])),"{}");
  57419. return self;
  57420. }, function($ctx1) {$ctx1.fill(self,"testUndefined",{})});
  57421. }; }),
  57422. $globals.JSObjectProxyTest);
  57423. $core.addMethod(
  57424. $core.method({
  57425. selector: "testValue",
  57426. protocol: "tests",
  57427. args: [],
  57428. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  57429. referencedClasses: [],
  57430. pragmas: [],
  57431. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  57432. }, function ($methodClass){ return function (){
  57433. var self=this,$self=this;
  57434. var testObject;
  57435. return $core.withContext(function($ctx1) {
  57436. testObject=$self._jsObject();
  57437. $recv(testObject)._at_put_("value","aValue");
  57438. $self._assert_equals_($recv(testObject)._value(),"aValue");
  57439. return self;
  57440. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject})});
  57441. }; }),
  57442. $globals.JSObjectProxyTest);
  57443. $core.addMethod(
  57444. $core.method({
  57445. selector: "testYourself",
  57446. protocol: "tests",
  57447. args: [],
  57448. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  57449. referencedClasses: [],
  57450. pragmas: [],
  57451. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  57452. }, function ($methodClass){ return function (){
  57453. var self=this,$self=this;
  57454. var object;
  57455. return $core.withContext(function($ctx1) {
  57456. var $1;
  57457. $1=$self._jsObject();
  57458. $recv($1)._d_("test");
  57459. object=$recv($1)._yourself();
  57460. $self._assert_equals_($recv(object)._d(),"test");
  57461. return self;
  57462. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object})});
  57463. }; }),
  57464. $globals.JSObjectProxyTest);
  57465. $core.addClass("JavaScriptExceptionTest", $globals.TestCase, [], "Kernel-Tests");
  57466. $core.addMethod(
  57467. $core.method({
  57468. selector: "testCatchingException",
  57469. protocol: "tests",
  57470. args: [],
  57471. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  57472. referencedClasses: ["Error"],
  57473. pragmas: [],
  57474. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  57475. }, function ($methodClass){ return function (){
  57476. var self=this,$self=this;
  57477. return $core.withContext(function($ctx1) {
  57478. $recv((function(){
  57479. return $core.withContext(function($ctx2) {
  57480. return $self._throwException();
  57481. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57482. }))._on_do_($globals.Error,(function(error){
  57483. return $core.withContext(function($ctx2) {
  57484. return $self._assert_($recv($recv(error)._exception()).__eq("test"));
  57485. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  57486. }));
  57487. return self;
  57488. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{})});
  57489. }; }),
  57490. $globals.JavaScriptExceptionTest);
  57491. $core.addMethod(
  57492. $core.method({
  57493. selector: "testRaisingException",
  57494. protocol: "tests",
  57495. args: [],
  57496. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  57497. referencedClasses: ["JavaScriptException"],
  57498. pragmas: [],
  57499. messageSends: ["should:raise:", "throwException"]
  57500. }, function ($methodClass){ return function (){
  57501. var self=this,$self=this;
  57502. return $core.withContext(function($ctx1) {
  57503. $self._should_raise_((function(){
  57504. return $core.withContext(function($ctx2) {
  57505. return $self._throwException();
  57506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57507. }),$globals.JavaScriptException);
  57508. return self;
  57509. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{})});
  57510. }; }),
  57511. $globals.JavaScriptExceptionTest);
  57512. $core.addMethod(
  57513. $core.method({
  57514. selector: "throwException",
  57515. protocol: "helpers",
  57516. args: [],
  57517. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  57518. referencedClasses: [],
  57519. pragmas: [["inlineJS:", ["throw \x22test\x22"]]],
  57520. messageSends: []
  57521. }, function ($methodClass){ return function (){
  57522. var self=this,$self=this;
  57523. return $core.withContext(function($ctx1) {
  57524. throw "test";
  57525. return self;
  57526. }, function($ctx1) {$ctx1.fill(self,"throwException",{})});
  57527. }; }),
  57528. $globals.JavaScriptExceptionTest);
  57529. $core.addClass("MessageSendTest", $globals.TestCase, [], "Kernel-Tests");
  57530. $core.addMethod(
  57531. $core.method({
  57532. selector: "testValue",
  57533. protocol: "tests",
  57534. args: [],
  57535. 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'",
  57536. referencedClasses: ["MessageSend", "Object"],
  57537. pragmas: [],
  57538. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  57539. }, function ($methodClass){ return function (){
  57540. var self=this,$self=this;
  57541. var messageSend;
  57542. return $core.withContext(function($ctx1) {
  57543. var $1;
  57544. $1=[$recv($globals.MessageSend)._new()
  57545. ,$ctx1.sendIdx["new"]=1
  57546. ][0];
  57547. $recv($1)._receiver_($recv($globals.Object)._new());
  57548. $recv($1)._selector_("asString");
  57549. messageSend=$recv($1)._yourself();
  57550. $self._assert_equals_($recv(messageSend)._value(),"an Object");
  57551. return self;
  57552. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend})});
  57553. }; }),
  57554. $globals.MessageSendTest);
  57555. $core.addMethod(
  57556. $core.method({
  57557. selector: "testValueWithArguments",
  57558. protocol: "tests",
  57559. args: [],
  57560. 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",
  57561. referencedClasses: ["MessageSend"],
  57562. pragmas: [],
  57563. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  57564. }, function ($methodClass){ return function (){
  57565. var self=this,$self=this;
  57566. var messageSend;
  57567. return $core.withContext(function($ctx1) {
  57568. var $1;
  57569. $1=$recv($globals.MessageSend)._new();
  57570. $recv($1)._receiver_((2));
  57571. $recv($1)._selector_("+");
  57572. messageSend=$recv($1)._yourself();
  57573. [$self._assert_equals_($recv(messageSend)._value_((3)),(5))
  57574. ,$ctx1.sendIdx["assert:equals:"]=1
  57575. ][0];
  57576. $self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  57577. return self;
  57578. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend})});
  57579. }; }),
  57580. $globals.MessageSendTest);
  57581. $core.addClass("MethodInheritanceTest", $globals.TestCase, ["receiverTop", "receiverMiddle", "receiverBottom", "method", "performBlock"], "Kernel-Tests");
  57582. $core.addMethod(
  57583. $core.method({
  57584. selector: "codeGeneratorClass",
  57585. protocol: "accessing",
  57586. args: [],
  57587. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  57588. referencedClasses: ["CodeGenerator"],
  57589. pragmas: [],
  57590. messageSends: []
  57591. }, function ($methodClass){ return function (){
  57592. var self=this,$self=this;
  57593. return $globals.CodeGenerator;
  57594. }; }),
  57595. $globals.MethodInheritanceTest);
  57596. $core.addMethod(
  57597. $core.method({
  57598. selector: "compiler",
  57599. protocol: "factory",
  57600. args: [],
  57601. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  57602. referencedClasses: ["Compiler"],
  57603. pragmas: [],
  57604. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  57605. }, function ($methodClass){ return function (){
  57606. var self=this,$self=this;
  57607. return $core.withContext(function($ctx1) {
  57608. var $1;
  57609. $1=$recv($globals.Compiler)._new();
  57610. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  57611. return $recv($1)._yourself();
  57612. }, function($ctx1) {$ctx1.fill(self,"compiler",{})});
  57613. }; }),
  57614. $globals.MethodInheritanceTest);
  57615. $core.addMethod(
  57616. $core.method({
  57617. selector: "deinstallBottom",
  57618. protocol: "testing",
  57619. args: [],
  57620. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  57621. referencedClasses: [],
  57622. pragmas: [],
  57623. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  57624. }, function ($methodClass){ return function (){
  57625. var self=this,$self=this;
  57626. return $core.withContext(function($ctx1) {
  57627. $recv($self._targetClassBottom())._removeCompiledMethod_($self.method);
  57628. return self;
  57629. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{})});
  57630. }; }),
  57631. $globals.MethodInheritanceTest);
  57632. $core.addMethod(
  57633. $core.method({
  57634. selector: "deinstallMiddle",
  57635. protocol: "testing",
  57636. args: [],
  57637. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  57638. referencedClasses: [],
  57639. pragmas: [],
  57640. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  57641. }, function ($methodClass){ return function (){
  57642. var self=this,$self=this;
  57643. return $core.withContext(function($ctx1) {
  57644. $recv($self._targetClassMiddle())._removeCompiledMethod_($self.method);
  57645. return self;
  57646. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{})});
  57647. }; }),
  57648. $globals.MethodInheritanceTest);
  57649. $core.addMethod(
  57650. $core.method({
  57651. selector: "deinstallTop",
  57652. protocol: "testing",
  57653. args: [],
  57654. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  57655. referencedClasses: [],
  57656. pragmas: [],
  57657. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  57658. }, function ($methodClass){ return function (){
  57659. var self=this,$self=this;
  57660. return $core.withContext(function($ctx1) {
  57661. $recv($self._targetClassTop())._removeCompiledMethod_($self.method);
  57662. return self;
  57663. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{})});
  57664. }; }),
  57665. $globals.MethodInheritanceTest);
  57666. $core.addMethod(
  57667. $core.method({
  57668. selector: "installBottom:",
  57669. protocol: "testing",
  57670. args: ["aString"],
  57671. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  57672. referencedClasses: [],
  57673. pragmas: [],
  57674. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  57675. }, function ($methodClass){ return function (aString){
  57676. var self=this,$self=this;
  57677. return $core.withContext(function($ctx1) {
  57678. $self.method=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassBottom(),"tests");
  57679. return self;
  57680. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString})});
  57681. }; }),
  57682. $globals.MethodInheritanceTest);
  57683. $core.addMethod(
  57684. $core.method({
  57685. selector: "installMiddle:",
  57686. protocol: "testing",
  57687. args: ["aString"],
  57688. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  57689. referencedClasses: [],
  57690. pragmas: [],
  57691. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  57692. }, function ($methodClass){ return function (aString){
  57693. var self=this,$self=this;
  57694. return $core.withContext(function($ctx1) {
  57695. $self.method=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassMiddle(),"tests");
  57696. return self;
  57697. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString})});
  57698. }; }),
  57699. $globals.MethodInheritanceTest);
  57700. $core.addMethod(
  57701. $core.method({
  57702. selector: "installTop:",
  57703. protocol: "testing",
  57704. args: ["aString"],
  57705. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  57706. referencedClasses: [],
  57707. pragmas: [],
  57708. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  57709. }, function ($methodClass){ return function (aString){
  57710. var self=this,$self=this;
  57711. return $core.withContext(function($ctx1) {
  57712. $self.method=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassTop(),"tests");
  57713. return self;
  57714. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString})});
  57715. }; }),
  57716. $globals.MethodInheritanceTest);
  57717. $core.addMethod(
  57718. $core.method({
  57719. selector: "setUp",
  57720. protocol: "initialization",
  57721. args: [],
  57722. 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' ]",
  57723. referencedClasses: [],
  57724. pragmas: [],
  57725. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  57726. }, function ($methodClass){ return function (){
  57727. var self=this,$self=this;
  57728. return $core.withContext(function($ctx1) {
  57729. $self.receiverTop=[$recv($self._targetClassTop())._new()
  57730. ,$ctx1.sendIdx["new"]=1
  57731. ][0];
  57732. $self.receiverMiddle=[$recv($self._targetClassMiddle())._new()
  57733. ,$ctx1.sendIdx["new"]=2
  57734. ][0];
  57735. $self.receiverBottom=$recv($self._targetClassBottom())._new();
  57736. $self.method=nil;
  57737. $self.performBlock=(function(){
  57738. return $core.withContext(function($ctx2) {
  57739. return $self._error_("performBlock not initialized");
  57740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57741. });
  57742. return self;
  57743. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  57744. }; }),
  57745. $globals.MethodInheritanceTest);
  57746. $core.addMethod(
  57747. $core.method({
  57748. selector: "shouldMNU",
  57749. protocol: "testing",
  57750. args: [],
  57751. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  57752. referencedClasses: [],
  57753. pragmas: [],
  57754. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  57755. }, function ($methodClass){ return function (){
  57756. var self=this,$self=this;
  57757. return $core.withContext(function($ctx1) {
  57758. $self._shouldMNUTop();
  57759. $self._shouldMNUMiddle();
  57760. $self._shouldMNUBottom();
  57761. return self;
  57762. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{})});
  57763. }; }),
  57764. $globals.MethodInheritanceTest);
  57765. $core.addMethod(
  57766. $core.method({
  57767. selector: "shouldMNUBottom",
  57768. protocol: "testing",
  57769. args: [],
  57770. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  57771. referencedClasses: ["MessageNotUnderstood"],
  57772. pragmas: [],
  57773. messageSends: ["should:raise:", "value:"]
  57774. }, function ($methodClass){ return function (){
  57775. var self=this,$self=this;
  57776. return $core.withContext(function($ctx1) {
  57777. $self._should_raise_((function(){
  57778. return $core.withContext(function($ctx2) {
  57779. return $recv($self.performBlock)._value_($self.receiverBottom);
  57780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57781. }),$globals.MessageNotUnderstood);
  57782. return self;
  57783. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{})});
  57784. }; }),
  57785. $globals.MethodInheritanceTest);
  57786. $core.addMethod(
  57787. $core.method({
  57788. selector: "shouldMNUMiddle",
  57789. protocol: "testing",
  57790. args: [],
  57791. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  57792. referencedClasses: ["MessageNotUnderstood"],
  57793. pragmas: [],
  57794. messageSends: ["should:raise:", "value:"]
  57795. }, function ($methodClass){ return function (){
  57796. var self=this,$self=this;
  57797. return $core.withContext(function($ctx1) {
  57798. $self._should_raise_((function(){
  57799. return $core.withContext(function($ctx2) {
  57800. return $recv($self.performBlock)._value_($self.receiverMiddle);
  57801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57802. }),$globals.MessageNotUnderstood);
  57803. return self;
  57804. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{})});
  57805. }; }),
  57806. $globals.MethodInheritanceTest);
  57807. $core.addMethod(
  57808. $core.method({
  57809. selector: "shouldMNUTop",
  57810. protocol: "testing",
  57811. args: [],
  57812. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  57813. referencedClasses: ["MessageNotUnderstood"],
  57814. pragmas: [],
  57815. messageSends: ["should:raise:", "value:"]
  57816. }, function ($methodClass){ return function (){
  57817. var self=this,$self=this;
  57818. return $core.withContext(function($ctx1) {
  57819. $self._should_raise_((function(){
  57820. return $core.withContext(function($ctx2) {
  57821. return $recv($self.performBlock)._value_($self.receiverTop);
  57822. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57823. }),$globals.MessageNotUnderstood);
  57824. return self;
  57825. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{})});
  57826. }; }),
  57827. $globals.MethodInheritanceTest);
  57828. $core.addMethod(
  57829. $core.method({
  57830. selector: "shouldReturn:",
  57831. protocol: "testing",
  57832. args: ["anObject"],
  57833. 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 }",
  57834. referencedClasses: [],
  57835. pragmas: [],
  57836. messageSends: ["value:", "assert:equals:"]
  57837. }, function ($methodClass){ return function (anObject){
  57838. var self=this,$self=this;
  57839. var result;
  57840. return $core.withContext(function($ctx1) {
  57841. result=[$recv($self.performBlock)._value_($self.receiverTop)
  57842. ,$ctx1.sendIdx["value:"]=1
  57843. ][0];
  57844. [$self._assert_equals_(["top",anObject],["top",result])
  57845. ,$ctx1.sendIdx["assert:equals:"]=1
  57846. ][0];
  57847. result=[$recv($self.performBlock)._value_($self.receiverMiddle)
  57848. ,$ctx1.sendIdx["value:"]=2
  57849. ][0];
  57850. [$self._assert_equals_(["middle",anObject],["middle",result])
  57851. ,$ctx1.sendIdx["assert:equals:"]=2
  57852. ][0];
  57853. result=$recv($self.performBlock)._value_($self.receiverBottom);
  57854. $self._assert_equals_(["bottom",anObject],["bottom",result]);
  57855. return self;
  57856. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result})});
  57857. }; }),
  57858. $globals.MethodInheritanceTest);
  57859. $core.addMethod(
  57860. $core.method({
  57861. selector: "shouldReturn:and:and:",
  57862. protocol: "testing",
  57863. args: ["anObject", "anObject2", "anObject3"],
  57864. 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 }",
  57865. referencedClasses: [],
  57866. pragmas: [],
  57867. messageSends: ["value:", "assert:equals:"]
  57868. }, function ($methodClass){ return function (anObject,anObject2,anObject3){
  57869. var self=this,$self=this;
  57870. var result;
  57871. return $core.withContext(function($ctx1) {
  57872. result=[$recv($self.performBlock)._value_($self.receiverTop)
  57873. ,$ctx1.sendIdx["value:"]=1
  57874. ][0];
  57875. [$self._assert_equals_(["top",anObject],["top",result])
  57876. ,$ctx1.sendIdx["assert:equals:"]=1
  57877. ][0];
  57878. result=[$recv($self.performBlock)._value_($self.receiverMiddle)
  57879. ,$ctx1.sendIdx["value:"]=2
  57880. ][0];
  57881. [$self._assert_equals_(["middle",anObject2],["middle",result])
  57882. ,$ctx1.sendIdx["assert:equals:"]=2
  57883. ][0];
  57884. result=$recv($self.performBlock)._value_($self.receiverBottom);
  57885. $self._assert_equals_(["bottom",anObject3],["bottom",result]);
  57886. return self;
  57887. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result})});
  57888. }; }),
  57889. $globals.MethodInheritanceTest);
  57890. $core.addMethod(
  57891. $core.method({
  57892. selector: "targetClassBottom",
  57893. protocol: "accessing",
  57894. args: [],
  57895. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  57896. referencedClasses: ["JavaScriptException"],
  57897. pragmas: [],
  57898. messageSends: []
  57899. }, function ($methodClass){ return function (){
  57900. var self=this,$self=this;
  57901. return $globals.JavaScriptException;
  57902. }; }),
  57903. $globals.MethodInheritanceTest);
  57904. $core.addMethod(
  57905. $core.method({
  57906. selector: "targetClassMiddle",
  57907. protocol: "accessing",
  57908. args: [],
  57909. source: "targetClassMiddle\x0a\x09^ Error",
  57910. referencedClasses: ["Error"],
  57911. pragmas: [],
  57912. messageSends: []
  57913. }, function ($methodClass){ return function (){
  57914. var self=this,$self=this;
  57915. return $globals.Error;
  57916. }; }),
  57917. $globals.MethodInheritanceTest);
  57918. $core.addMethod(
  57919. $core.method({
  57920. selector: "targetClassTop",
  57921. protocol: "accessing",
  57922. args: [],
  57923. source: "targetClassTop\x0a\x09^ Object",
  57924. referencedClasses: ["Object"],
  57925. pragmas: [],
  57926. messageSends: []
  57927. }, function ($methodClass){ return function (){
  57928. var self=this,$self=this;
  57929. return $globals.Object;
  57930. }; }),
  57931. $globals.MethodInheritanceTest);
  57932. $core.addMethod(
  57933. $core.method({
  57934. selector: "tearDown",
  57935. protocol: "initialization",
  57936. args: [],
  57937. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  57938. referencedClasses: ["Error"],
  57939. pragmas: [],
  57940. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  57941. }, function ($methodClass){ return function (){
  57942. var self=this,$self=this;
  57943. return $core.withContext(function($ctx1) {
  57944. [$recv((function(){
  57945. return $core.withContext(function($ctx2) {
  57946. return $self._deinstallTop();
  57947. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57948. }))._on_do_($globals.Error,(function(){
  57949. }))
  57950. ,$ctx1.sendIdx["on:do:"]=1
  57951. ][0];
  57952. [$recv((function(){
  57953. return $core.withContext(function($ctx2) {
  57954. return $self._deinstallMiddle();
  57955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  57956. }))._on_do_($globals.Error,(function(){
  57957. }))
  57958. ,$ctx1.sendIdx["on:do:"]=2
  57959. ][0];
  57960. $recv((function(){
  57961. return $core.withContext(function($ctx2) {
  57962. return $self._deinstallBottom();
  57963. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  57964. }))._on_do_($globals.Error,(function(){
  57965. }));
  57966. return self;
  57967. }, function($ctx1) {$ctx1.fill(self,"tearDown",{})});
  57968. }; }),
  57969. $globals.MethodInheritanceTest);
  57970. $core.addMethod(
  57971. $core.method({
  57972. selector: "testMNU11",
  57973. protocol: "tests",
  57974. args: [],
  57975. 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",
  57976. referencedClasses: [],
  57977. pragmas: [],
  57978. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  57979. }, function ($methodClass){ return function (){
  57980. var self=this,$self=this;
  57981. return $core.withContext(function($ctx1) {
  57982. $self.performBlock=(function(x){
  57983. return $core.withContext(function($ctx2) {
  57984. return $recv(x)._foo();
  57985. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57986. });
  57987. [$self._shouldMNU()
  57988. ,$ctx1.sendIdx["shouldMNU"]=1
  57989. ][0];
  57990. [$self._installTop_("foo ^ false")
  57991. ,$ctx1.sendIdx["installTop:"]=1
  57992. ][0];
  57993. $self._installTop_("foo ^ true");
  57994. $self._deinstallTop();
  57995. $self._shouldMNU();
  57996. return self;
  57997. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{})});
  57998. }; }),
  57999. $globals.MethodInheritanceTest);
  58000. $core.addMethod(
  58001. $core.method({
  58002. selector: "testMNU22",
  58003. protocol: "tests",
  58004. args: [],
  58005. 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",
  58006. referencedClasses: [],
  58007. pragmas: [],
  58008. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  58009. }, function ($methodClass){ return function (){
  58010. var self=this,$self=this;
  58011. return $core.withContext(function($ctx1) {
  58012. $self.performBlock=(function(x){
  58013. return $core.withContext(function($ctx2) {
  58014. return $recv(x)._foo();
  58015. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58016. });
  58017. [$self._shouldMNU()
  58018. ,$ctx1.sendIdx["shouldMNU"]=1
  58019. ][0];
  58020. [$self._installMiddle_("foo ^ false")
  58021. ,$ctx1.sendIdx["installMiddle:"]=1
  58022. ][0];
  58023. $self._installMiddle_("foo ^ true");
  58024. $self._deinstallMiddle();
  58025. $self._shouldMNU();
  58026. return self;
  58027. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{})});
  58028. }; }),
  58029. $globals.MethodInheritanceTest);
  58030. $core.addMethod(
  58031. $core.method({
  58032. selector: "testReturns1",
  58033. protocol: "tests",
  58034. args: [],
  58035. 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",
  58036. referencedClasses: [],
  58037. pragmas: [],
  58038. messageSends: ["foo", "installTop:", "shouldReturn:"]
  58039. }, function ($methodClass){ return function (){
  58040. var self=this,$self=this;
  58041. return $core.withContext(function($ctx1) {
  58042. $self.performBlock=(function(x){
  58043. return $core.withContext(function($ctx2) {
  58044. return $recv(x)._foo();
  58045. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58046. });
  58047. [$self._installTop_("foo ^ false")
  58048. ,$ctx1.sendIdx["installTop:"]=1
  58049. ][0];
  58050. [$self._shouldReturn_(false)
  58051. ,$ctx1.sendIdx["shouldReturn:"]=1
  58052. ][0];
  58053. $self._installTop_("foo ^ true");
  58054. $self._shouldReturn_(true);
  58055. return self;
  58056. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{})});
  58057. }; }),
  58058. $globals.MethodInheritanceTest);
  58059. $core.addClass("NumberTest", $globals.TestCase, [], "Kernel-Tests");
  58060. $core.addMethod(
  58061. $core.method({
  58062. selector: "testAbs",
  58063. protocol: "tests",
  58064. args: [],
  58065. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  58066. referencedClasses: [],
  58067. pragmas: [],
  58068. messageSends: ["assert:equals:", "abs"]
  58069. }, function ($methodClass){ return function (){
  58070. var self=this,$self=this;
  58071. return $core.withContext(function($ctx1) {
  58072. [$self._assert_equals_([(4)._abs()
  58073. ,$ctx1.sendIdx["abs"]=1
  58074. ][0],(4))
  58075. ,$ctx1.sendIdx["assert:equals:"]=1
  58076. ][0];
  58077. $self._assert_equals_((-4)._abs(),(4));
  58078. return self;
  58079. }, function($ctx1) {$ctx1.fill(self,"testAbs",{})});
  58080. }; }),
  58081. $globals.NumberTest);
  58082. $core.addMethod(
  58083. $core.method({
  58084. selector: "testArithmetic",
  58085. protocol: "tests",
  58086. args: [],
  58087. 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",
  58088. referencedClasses: [],
  58089. pragmas: [],
  58090. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  58091. }, function ($methodClass){ return function (){
  58092. var self=this,$self=this;
  58093. return $core.withContext(function($ctx1) {
  58094. [$self._assert_equals_([(1.5).__plus((1))
  58095. ,$ctx1.sendIdx["+"]=1
  58096. ][0],(2.5))
  58097. ,$ctx1.sendIdx["assert:equals:"]=1
  58098. ][0];
  58099. [$self._assert_equals_([(2).__minus((1))
  58100. ,$ctx1.sendIdx["-"]=1
  58101. ][0],(1))
  58102. ,$ctx1.sendIdx["assert:equals:"]=2
  58103. ][0];
  58104. [$self._assert_equals_((-2).__minus((1)),(-3))
  58105. ,$ctx1.sendIdx["assert:equals:"]=3
  58106. ][0];
  58107. [$self._assert_equals_((12).__slash((2)),(6))
  58108. ,$ctx1.sendIdx["assert:equals:"]=4
  58109. ][0];
  58110. [$self._assert_equals_([(3).__star((4))
  58111. ,$ctx1.sendIdx["*"]=1
  58112. ][0],(12))
  58113. ,$ctx1.sendIdx["assert:equals:"]=5
  58114. ][0];
  58115. [$self._assert_equals_((7).__slash_slash((2)),(3))
  58116. ,$ctx1.sendIdx["assert:equals:"]=6
  58117. ][0];
  58118. [$self._assert_equals_((7).__backslash_backslash((2)),(1))
  58119. ,$ctx1.sendIdx["assert:equals:"]=7
  58120. ][0];
  58121. [$self._assert_equals_([$recv([(1).__plus((2))
  58122. ,$ctx1.sendIdx["+"]=2
  58123. ][0]).__star((3))
  58124. ,$ctx1.sendIdx["*"]=2
  58125. ][0],(9))
  58126. ,$ctx1.sendIdx["assert:equals:"]=8
  58127. ][0];
  58128. $self._assert_equals_((1).__plus((2).__star((3))),(7));
  58129. return self;
  58130. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{})});
  58131. }; }),
  58132. $globals.NumberTest);
  58133. $core.addMethod(
  58134. $core.method({
  58135. selector: "testAsNumber",
  58136. protocol: "tests",
  58137. args: [],
  58138. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  58139. referencedClasses: [],
  58140. pragmas: [],
  58141. messageSends: ["assert:equals:", "asNumber"]
  58142. }, function ($methodClass){ return function (){
  58143. var self=this,$self=this;
  58144. return $core.withContext(function($ctx1) {
  58145. $self._assert_equals_((3)._asNumber(),(3));
  58146. return self;
  58147. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{})});
  58148. }; }),
  58149. $globals.NumberTest);
  58150. $core.addMethod(
  58151. $core.method({
  58152. selector: "testBetweenAnd",
  58153. protocol: "tests",
  58154. args: [],
  58155. source: "testBetweenAnd\x0a\x09self assert: (4 between: 3 and: 5).\x0a\x09self assert: (1 between: 5 and: 6) not.\x0a\x09self assert: (90 between: 67 and: 87) not.\x0a\x09self assert: (1 between: 1 and: 1).",
  58156. referencedClasses: [],
  58157. pragmas: [],
  58158. messageSends: ["assert:", "between:and:", "not"]
  58159. }, function ($methodClass){ return function (){
  58160. var self=this,$self=this;
  58161. return $core.withContext(function($ctx1) {
  58162. [$self._assert_([(4)._between_and_((3),(5))
  58163. ,$ctx1.sendIdx["between:and:"]=1
  58164. ][0])
  58165. ,$ctx1.sendIdx["assert:"]=1
  58166. ][0];
  58167. [$self._assert_([$recv([(1)._between_and_((5),(6))
  58168. ,$ctx1.sendIdx["between:and:"]=2
  58169. ][0])._not()
  58170. ,$ctx1.sendIdx["not"]=1
  58171. ][0])
  58172. ,$ctx1.sendIdx["assert:"]=2
  58173. ][0];
  58174. [$self._assert_($recv([(90)._between_and_((67),(87))
  58175. ,$ctx1.sendIdx["between:and:"]=3
  58176. ][0])._not())
  58177. ,$ctx1.sendIdx["assert:"]=3
  58178. ][0];
  58179. $self._assert_((1)._between_and_((1),(1)));
  58180. return self;
  58181. }, function($ctx1) {$ctx1.fill(self,"testBetweenAnd",{})});
  58182. }; }),
  58183. $globals.NumberTest);
  58184. $core.addMethod(
  58185. $core.method({
  58186. selector: "testBitAnd",
  58187. protocol: "tests",
  58188. args: [],
  58189. source: "testBitAnd\x0a\x09self assert: (15 bitAnd: 2) equals: 2.\x0a\x09self assert: (15 bitAnd: 15) equals: 15.\x0a\x09self assert: (-1 bitAnd: 1021) equals: 1021",
  58190. referencedClasses: [],
  58191. pragmas: [],
  58192. messageSends: ["assert:equals:", "bitAnd:"]
  58193. }, function ($methodClass){ return function (){
  58194. var self=this,$self=this;
  58195. return $core.withContext(function($ctx1) {
  58196. [$self._assert_equals_([(15)._bitAnd_((2))
  58197. ,$ctx1.sendIdx["bitAnd:"]=1
  58198. ][0],(2))
  58199. ,$ctx1.sendIdx["assert:equals:"]=1
  58200. ][0];
  58201. [$self._assert_equals_([(15)._bitAnd_((15))
  58202. ,$ctx1.sendIdx["bitAnd:"]=2
  58203. ][0],(15))
  58204. ,$ctx1.sendIdx["assert:equals:"]=2
  58205. ][0];
  58206. $self._assert_equals_((-1)._bitAnd_((1021)),(1021));
  58207. return self;
  58208. }, function($ctx1) {$ctx1.fill(self,"testBitAnd",{})});
  58209. }; }),
  58210. $globals.NumberTest);
  58211. $core.addMethod(
  58212. $core.method({
  58213. selector: "testBitNot",
  58214. protocol: "tests",
  58215. args: [],
  58216. source: "testBitNot\x0a\x09self assert: 2 bitNot equals: -3.\x0a\x09self assert: -1 bitNot equals: 0.\x0a\x09self assert: -1022 bitNot equals: 1021",
  58217. referencedClasses: [],
  58218. pragmas: [],
  58219. messageSends: ["assert:equals:", "bitNot"]
  58220. }, function ($methodClass){ return function (){
  58221. var self=this,$self=this;
  58222. return $core.withContext(function($ctx1) {
  58223. [$self._assert_equals_([(2)._bitNot()
  58224. ,$ctx1.sendIdx["bitNot"]=1
  58225. ][0],(-3))
  58226. ,$ctx1.sendIdx["assert:equals:"]=1
  58227. ][0];
  58228. [$self._assert_equals_([(-1)._bitNot()
  58229. ,$ctx1.sendIdx["bitNot"]=2
  58230. ][0],(0))
  58231. ,$ctx1.sendIdx["assert:equals:"]=2
  58232. ][0];
  58233. $self._assert_equals_((-1022)._bitNot(),(1021));
  58234. return self;
  58235. }, function($ctx1) {$ctx1.fill(self,"testBitNot",{})});
  58236. }; }),
  58237. $globals.NumberTest);
  58238. $core.addMethod(
  58239. $core.method({
  58240. selector: "testBitOr",
  58241. protocol: "tests",
  58242. args: [],
  58243. source: "testBitOr\x0a\x09self assert: (2 bitOr: 4) equals: 6.\x0a\x09self assert: (7 bitOr: 2) equals: 7.\x0a\x09self assert: (-1 bitOr: 1021) equals: -1",
  58244. referencedClasses: [],
  58245. pragmas: [],
  58246. messageSends: ["assert:equals:", "bitOr:"]
  58247. }, function ($methodClass){ return function (){
  58248. var self=this,$self=this;
  58249. return $core.withContext(function($ctx1) {
  58250. [$self._assert_equals_([(2)._bitOr_((4))
  58251. ,$ctx1.sendIdx["bitOr:"]=1
  58252. ][0],(6))
  58253. ,$ctx1.sendIdx["assert:equals:"]=1
  58254. ][0];
  58255. [$self._assert_equals_([(7)._bitOr_((2))
  58256. ,$ctx1.sendIdx["bitOr:"]=2
  58257. ][0],(7))
  58258. ,$ctx1.sendIdx["assert:equals:"]=2
  58259. ][0];
  58260. $self._assert_equals_((-1)._bitOr_((1021)),(-1));
  58261. return self;
  58262. }, function($ctx1) {$ctx1.fill(self,"testBitOr",{})});
  58263. }; }),
  58264. $globals.NumberTest);
  58265. $core.addMethod(
  58266. $core.method({
  58267. selector: "testBitXor",
  58268. protocol: "tests",
  58269. args: [],
  58270. source: "testBitXor\x0a\x09self assert: (2 bitXor: 4) equals: 6.\x0a\x09self assert: (7 bitXor: 2) equals: 5.\x0a\x09self assert: (-1 bitXor: 1021) equals: -1022.\x0a\x09self assert: (91 bitXor: 91) equals: 0",
  58271. referencedClasses: [],
  58272. pragmas: [],
  58273. messageSends: ["assert:equals:", "bitXor:"]
  58274. }, function ($methodClass){ return function (){
  58275. var self=this,$self=this;
  58276. return $core.withContext(function($ctx1) {
  58277. [$self._assert_equals_([(2)._bitXor_((4))
  58278. ,$ctx1.sendIdx["bitXor:"]=1
  58279. ][0],(6))
  58280. ,$ctx1.sendIdx["assert:equals:"]=1
  58281. ][0];
  58282. [$self._assert_equals_([(7)._bitXor_((2))
  58283. ,$ctx1.sendIdx["bitXor:"]=2
  58284. ][0],(5))
  58285. ,$ctx1.sendIdx["assert:equals:"]=2
  58286. ][0];
  58287. [$self._assert_equals_([(-1)._bitXor_((1021))
  58288. ,$ctx1.sendIdx["bitXor:"]=3
  58289. ][0],(-1022))
  58290. ,$ctx1.sendIdx["assert:equals:"]=3
  58291. ][0];
  58292. $self._assert_equals_((91)._bitXor_((91)),(0));
  58293. return self;
  58294. }, function($ctx1) {$ctx1.fill(self,"testBitXor",{})});
  58295. }; }),
  58296. $globals.NumberTest);
  58297. $core.addMethod(
  58298. $core.method({
  58299. selector: "testCeiling",
  58300. protocol: "tests",
  58301. args: [],
  58302. 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.",
  58303. referencedClasses: [],
  58304. pragmas: [],
  58305. messageSends: ["assert:equals:", "ceiling"]
  58306. }, function ($methodClass){ return function (){
  58307. var self=this,$self=this;
  58308. return $core.withContext(function($ctx1) {
  58309. [$self._assert_equals_([(1.2)._ceiling()
  58310. ,$ctx1.sendIdx["ceiling"]=1
  58311. ][0],(2))
  58312. ,$ctx1.sendIdx["assert:equals:"]=1
  58313. ][0];
  58314. [$self._assert_equals_([(-1.2)._ceiling()
  58315. ,$ctx1.sendIdx["ceiling"]=2
  58316. ][0],(-1))
  58317. ,$ctx1.sendIdx["assert:equals:"]=2
  58318. ][0];
  58319. $self._assert_equals_((1)._ceiling(),(1));
  58320. return self;
  58321. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{})});
  58322. }; }),
  58323. $globals.NumberTest);
  58324. $core.addMethod(
  58325. $core.method({
  58326. selector: "testComparison",
  58327. protocol: "tests",
  58328. args: [],
  58329. 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",
  58330. referencedClasses: [],
  58331. pragmas: [],
  58332. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  58333. }, function ($methodClass){ return function (){
  58334. var self=this,$self=this;
  58335. return $core.withContext(function($ctx1) {
  58336. [$self._assert_([(3).__gt((2))
  58337. ,$ctx1.sendIdx[">"]=1
  58338. ][0])
  58339. ,$ctx1.sendIdx["assert:"]=1
  58340. ][0];
  58341. [$self._assert_([(2).__lt((3))
  58342. ,$ctx1.sendIdx["<"]=1
  58343. ][0])
  58344. ,$ctx1.sendIdx["assert:"]=2
  58345. ][0];
  58346. [$self._deny_((3).__lt((2)))
  58347. ,$ctx1.sendIdx["deny:"]=1
  58348. ][0];
  58349. $self._deny_((2).__gt((3)));
  58350. [$self._assert_([(3).__gt_eq((3))
  58351. ,$ctx1.sendIdx[">="]=1
  58352. ][0])
  58353. ,$ctx1.sendIdx["assert:"]=3
  58354. ][0];
  58355. [$self._assert_((3.1).__gt_eq((3)))
  58356. ,$ctx1.sendIdx["assert:"]=4
  58357. ][0];
  58358. [$self._assert_([(3).__lt_eq((3))
  58359. ,$ctx1.sendIdx["<="]=1
  58360. ][0])
  58361. ,$ctx1.sendIdx["assert:"]=5
  58362. ][0];
  58363. $self._assert_((3).__lt_eq((3.1)));
  58364. return self;
  58365. }, function($ctx1) {$ctx1.fill(self,"testComparison",{})});
  58366. }; }),
  58367. $globals.NumberTest);
  58368. $core.addMethod(
  58369. $core.method({
  58370. selector: "testCopying",
  58371. protocol: "tests",
  58372. args: [],
  58373. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  58374. referencedClasses: [],
  58375. pragmas: [],
  58376. messageSends: ["assert:", "==", "copy", "deepCopy"]
  58377. }, function ($methodClass){ return function (){
  58378. var self=this,$self=this;
  58379. return $core.withContext(function($ctx1) {
  58380. [$self._assert_([$recv((1)._copy()).__eq_eq((1))
  58381. ,$ctx1.sendIdx["=="]=1
  58382. ][0])
  58383. ,$ctx1.sendIdx["assert:"]=1
  58384. ][0];
  58385. $self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  58386. return self;
  58387. }, function($ctx1) {$ctx1.fill(self,"testCopying",{})});
  58388. }; }),
  58389. $globals.NumberTest);
  58390. $core.addMethod(
  58391. $core.method({
  58392. selector: "testDegreesToRadians",
  58393. protocol: "tests",
  58394. args: [],
  58395. source: "testDegreesToRadians\x0a\x09self assert: (180 degreesToRadians - Number pi) abs <= 0.01.",
  58396. referencedClasses: ["Number"],
  58397. pragmas: [],
  58398. messageSends: ["assert:", "<=", "abs", "-", "degreesToRadians", "pi"]
  58399. }, function ($methodClass){ return function (){
  58400. var self=this,$self=this;
  58401. return $core.withContext(function($ctx1) {
  58402. $self._assert_($recv($recv($recv((180)._degreesToRadians()).__minus($recv($globals.Number)._pi()))._abs()).__lt_eq((0.01)));
  58403. return self;
  58404. }, function($ctx1) {$ctx1.fill(self,"testDegreesToRadians",{})});
  58405. }; }),
  58406. $globals.NumberTest);
  58407. $core.addMethod(
  58408. $core.method({
  58409. selector: "testEquality",
  58410. protocol: "tests",
  58411. args: [],
  58412. 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 = ''",
  58413. referencedClasses: [],
  58414. pragmas: [],
  58415. messageSends: ["assert:", "=", "deny:", "yourself"]
  58416. }, function ($methodClass){ return function (){
  58417. var self=this,$self=this;
  58418. return $core.withContext(function($ctx1) {
  58419. [$self._assert_([(1).__eq((1))
  58420. ,$ctx1.sendIdx["="]=1
  58421. ][0])
  58422. ,$ctx1.sendIdx["assert:"]=1
  58423. ][0];
  58424. [$self._assert_([(0).__eq((0))
  58425. ,$ctx1.sendIdx["="]=2
  58426. ][0])
  58427. ,$ctx1.sendIdx["assert:"]=2
  58428. ][0];
  58429. [$self._deny_([(1).__eq((0))
  58430. ,$ctx1.sendIdx["="]=3
  58431. ][0])
  58432. ,$ctx1.sendIdx["deny:"]=1
  58433. ][0];
  58434. [$self._assert_([$recv([(1)._yourself()
  58435. ,$ctx1.sendIdx["yourself"]=1
  58436. ][0]).__eq((1))
  58437. ,$ctx1.sendIdx["="]=4
  58438. ][0])
  58439. ,$ctx1.sendIdx["assert:"]=3
  58440. ][0];
  58441. [$self._assert_([(1).__eq([(1)._yourself()
  58442. ,$ctx1.sendIdx["yourself"]=2
  58443. ][0])
  58444. ,$ctx1.sendIdx["="]=5
  58445. ][0])
  58446. ,$ctx1.sendIdx["assert:"]=4
  58447. ][0];
  58448. $self._assert_([$recv([(1)._yourself()
  58449. ,$ctx1.sendIdx["yourself"]=3
  58450. ][0]).__eq((1)._yourself())
  58451. ,$ctx1.sendIdx["="]=6
  58452. ][0]);
  58453. [$self._deny_([(0).__eq(false)
  58454. ,$ctx1.sendIdx["="]=7
  58455. ][0])
  58456. ,$ctx1.sendIdx["deny:"]=2
  58457. ][0];
  58458. [$self._deny_([false.__eq((0))
  58459. ,$ctx1.sendIdx["="]=8
  58460. ][0])
  58461. ,$ctx1.sendIdx["deny:"]=3
  58462. ][0];
  58463. [$self._deny_(["".__eq((0))
  58464. ,$ctx1.sendIdx["="]=9
  58465. ][0])
  58466. ,$ctx1.sendIdx["deny:"]=4
  58467. ][0];
  58468. $self._deny_((0).__eq(""));
  58469. return self;
  58470. }, function($ctx1) {$ctx1.fill(self,"testEquality",{})});
  58471. }; }),
  58472. $globals.NumberTest);
  58473. $core.addMethod(
  58474. $core.method({
  58475. selector: "testFloor",
  58476. protocol: "tests",
  58477. args: [],
  58478. 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.",
  58479. referencedClasses: [],
  58480. pragmas: [],
  58481. messageSends: ["assert:equals:", "floor"]
  58482. }, function ($methodClass){ return function (){
  58483. var self=this,$self=this;
  58484. return $core.withContext(function($ctx1) {
  58485. [$self._assert_equals_([(1.2)._floor()
  58486. ,$ctx1.sendIdx["floor"]=1
  58487. ][0],(1))
  58488. ,$ctx1.sendIdx["assert:equals:"]=1
  58489. ][0];
  58490. [$self._assert_equals_([(-1.2)._floor()
  58491. ,$ctx1.sendIdx["floor"]=2
  58492. ][0],(-2))
  58493. ,$ctx1.sendIdx["assert:equals:"]=2
  58494. ][0];
  58495. $self._assert_equals_((1)._floor(),(1));
  58496. return self;
  58497. }, function($ctx1) {$ctx1.fill(self,"testFloor",{})});
  58498. }; }),
  58499. $globals.NumberTest);
  58500. $core.addMethod(
  58501. $core.method({
  58502. selector: "testHexNumbers",
  58503. protocol: "tests",
  58504. args: [],
  58505. 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",
  58506. referencedClasses: [],
  58507. pragmas: [],
  58508. messageSends: ["assert:equals:", "truncated"]
  58509. }, function ($methodClass){ return function (){
  58510. var self=this,$self=this;
  58511. return $core.withContext(function($ctx1) {
  58512. [$self._assert_equals_((9),(9))
  58513. ,$ctx1.sendIdx["assert:equals:"]=1
  58514. ][0];
  58515. [$self._assert_equals_([(10)._truncated()
  58516. ,$ctx1.sendIdx["truncated"]=1
  58517. ][0],(10))
  58518. ,$ctx1.sendIdx["assert:equals:"]=2
  58519. ][0];
  58520. [$self._assert_equals_([(11)._truncated()
  58521. ,$ctx1.sendIdx["truncated"]=2
  58522. ][0],(11))
  58523. ,$ctx1.sendIdx["assert:equals:"]=3
  58524. ][0];
  58525. [$self._assert_equals_([(12)._truncated()
  58526. ,$ctx1.sendIdx["truncated"]=3
  58527. ][0],(12))
  58528. ,$ctx1.sendIdx["assert:equals:"]=4
  58529. ][0];
  58530. [$self._assert_equals_([(13)._truncated()
  58531. ,$ctx1.sendIdx["truncated"]=4
  58532. ][0],(13))
  58533. ,$ctx1.sendIdx["assert:equals:"]=5
  58534. ][0];
  58535. [$self._assert_equals_([(14)._truncated()
  58536. ,$ctx1.sendIdx["truncated"]=5
  58537. ][0],(14))
  58538. ,$ctx1.sendIdx["assert:equals:"]=6
  58539. ][0];
  58540. $self._assert_equals_((15)._truncated(),(15));
  58541. return self;
  58542. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{})});
  58543. }; }),
  58544. $globals.NumberTest);
  58545. $core.addMethod(
  58546. $core.method({
  58547. selector: "testIdentity",
  58548. protocol: "tests",
  58549. args: [],
  58550. 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",
  58551. referencedClasses: [],
  58552. pragmas: [],
  58553. messageSends: ["assert:", "==", "deny:", "yourself"]
  58554. }, function ($methodClass){ return function (){
  58555. var self=this,$self=this;
  58556. return $core.withContext(function($ctx1) {
  58557. [$self._assert_([(1).__eq_eq((1))
  58558. ,$ctx1.sendIdx["=="]=1
  58559. ][0])
  58560. ,$ctx1.sendIdx["assert:"]=1
  58561. ][0];
  58562. [$self._assert_([(0).__eq_eq((0))
  58563. ,$ctx1.sendIdx["=="]=2
  58564. ][0])
  58565. ,$ctx1.sendIdx["assert:"]=2
  58566. ][0];
  58567. [$self._deny_([(1).__eq_eq((0))
  58568. ,$ctx1.sendIdx["=="]=3
  58569. ][0])
  58570. ,$ctx1.sendIdx["deny:"]=1
  58571. ][0];
  58572. [$self._assert_([$recv([(1)._yourself()
  58573. ,$ctx1.sendIdx["yourself"]=1
  58574. ][0]).__eq_eq((1))
  58575. ,$ctx1.sendIdx["=="]=4
  58576. ][0])
  58577. ,$ctx1.sendIdx["assert:"]=3
  58578. ][0];
  58579. [$self._assert_([(1).__eq_eq([(1)._yourself()
  58580. ,$ctx1.sendIdx["yourself"]=2
  58581. ][0])
  58582. ,$ctx1.sendIdx["=="]=5
  58583. ][0])
  58584. ,$ctx1.sendIdx["assert:"]=4
  58585. ][0];
  58586. $self._assert_([$recv([(1)._yourself()
  58587. ,$ctx1.sendIdx["yourself"]=3
  58588. ][0]).__eq_eq((1)._yourself())
  58589. ,$ctx1.sendIdx["=="]=6
  58590. ][0]);
  58591. $self._deny_((1).__eq_eq((2)));
  58592. return self;
  58593. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{})});
  58594. }; }),
  58595. $globals.NumberTest);
  58596. $core.addMethod(
  58597. $core.method({
  58598. selector: "testInvalidHexNumbers",
  58599. protocol: "tests",
  58600. args: [],
  58601. 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.",
  58602. referencedClasses: ["MessageNotUnderstood"],
  58603. pragmas: [],
  58604. 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"]
  58605. }, function ($methodClass){ return function (){
  58606. var self=this,$self=this;
  58607. return $core.withContext(function($ctx1) {
  58608. [$self._should_raise_((function(){
  58609. return $core.withContext(function($ctx2) {
  58610. return (16)._rG();
  58611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58612. }),$globals.MessageNotUnderstood)
  58613. ,$ctx1.sendIdx["should:raise:"]=1
  58614. ][0];
  58615. [$self._should_raise_((function(){
  58616. return $core.withContext(function($ctx2) {
  58617. return (16)._rg();
  58618. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58619. }),$globals.MessageNotUnderstood)
  58620. ,$ctx1.sendIdx["should:raise:"]=2
  58621. ][0];
  58622. [$self._should_raise_((function(){
  58623. return $core.withContext(function($ctx2) {
  58624. return (16)._rH();
  58625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58626. }),$globals.MessageNotUnderstood)
  58627. ,$ctx1.sendIdx["should:raise:"]=3
  58628. ][0];
  58629. [$self._should_raise_((function(){
  58630. return $core.withContext(function($ctx2) {
  58631. return (16)._rh();
  58632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  58633. }),$globals.MessageNotUnderstood)
  58634. ,$ctx1.sendIdx["should:raise:"]=4
  58635. ][0];
  58636. [$self._should_raise_((function(){
  58637. return $core.withContext(function($ctx2) {
  58638. return (16)._rI();
  58639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58640. }),$globals.MessageNotUnderstood)
  58641. ,$ctx1.sendIdx["should:raise:"]=5
  58642. ][0];
  58643. [$self._should_raise_((function(){
  58644. return $core.withContext(function($ctx2) {
  58645. return (16)._ri();
  58646. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  58647. }),$globals.MessageNotUnderstood)
  58648. ,$ctx1.sendIdx["should:raise:"]=6
  58649. ][0];
  58650. [$self._should_raise_((function(){
  58651. return $core.withContext(function($ctx2) {
  58652. return (16)._rJ();
  58653. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  58654. }),$globals.MessageNotUnderstood)
  58655. ,$ctx1.sendIdx["should:raise:"]=7
  58656. ][0];
  58657. [$self._should_raise_((function(){
  58658. return $core.withContext(function($ctx2) {
  58659. return (16)._rj();
  58660. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  58661. }),$globals.MessageNotUnderstood)
  58662. ,$ctx1.sendIdx["should:raise:"]=8
  58663. ][0];
  58664. [$self._should_raise_((function(){
  58665. return $core.withContext(function($ctx2) {
  58666. return (16)._rK();
  58667. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  58668. }),$globals.MessageNotUnderstood)
  58669. ,$ctx1.sendIdx["should:raise:"]=9
  58670. ][0];
  58671. [$self._should_raise_((function(){
  58672. return $core.withContext(function($ctx2) {
  58673. return (16)._rk();
  58674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  58675. }),$globals.MessageNotUnderstood)
  58676. ,$ctx1.sendIdx["should:raise:"]=10
  58677. ][0];
  58678. [$self._should_raise_((function(){
  58679. return $core.withContext(function($ctx2) {
  58680. return (16)._rL();
  58681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  58682. }),$globals.MessageNotUnderstood)
  58683. ,$ctx1.sendIdx["should:raise:"]=11
  58684. ][0];
  58685. [$self._should_raise_((function(){
  58686. return $core.withContext(function($ctx2) {
  58687. return (16)._rl();
  58688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  58689. }),$globals.MessageNotUnderstood)
  58690. ,$ctx1.sendIdx["should:raise:"]=12
  58691. ][0];
  58692. [$self._should_raise_((function(){
  58693. return $core.withContext(function($ctx2) {
  58694. return (16)._rM();
  58695. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  58696. }),$globals.MessageNotUnderstood)
  58697. ,$ctx1.sendIdx["should:raise:"]=13
  58698. ][0];
  58699. [$self._should_raise_((function(){
  58700. return $core.withContext(function($ctx2) {
  58701. return (16)._rm();
  58702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  58703. }),$globals.MessageNotUnderstood)
  58704. ,$ctx1.sendIdx["should:raise:"]=14
  58705. ][0];
  58706. [$self._should_raise_((function(){
  58707. return $core.withContext(function($ctx2) {
  58708. return (16)._rN();
  58709. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  58710. }),$globals.MessageNotUnderstood)
  58711. ,$ctx1.sendIdx["should:raise:"]=15
  58712. ][0];
  58713. [$self._should_raise_((function(){
  58714. return $core.withContext(function($ctx2) {
  58715. return (16)._rn();
  58716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  58717. }),$globals.MessageNotUnderstood)
  58718. ,$ctx1.sendIdx["should:raise:"]=16
  58719. ][0];
  58720. [$self._should_raise_((function(){
  58721. return $core.withContext(function($ctx2) {
  58722. return (16)._rO();
  58723. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  58724. }),$globals.MessageNotUnderstood)
  58725. ,$ctx1.sendIdx["should:raise:"]=17
  58726. ][0];
  58727. [$self._should_raise_((function(){
  58728. return $core.withContext(function($ctx2) {
  58729. return (16)._ro();
  58730. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  58731. }),$globals.MessageNotUnderstood)
  58732. ,$ctx1.sendIdx["should:raise:"]=18
  58733. ][0];
  58734. [$self._should_raise_((function(){
  58735. return $core.withContext(function($ctx2) {
  58736. return (16)._rP();
  58737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  58738. }),$globals.MessageNotUnderstood)
  58739. ,$ctx1.sendIdx["should:raise:"]=19
  58740. ][0];
  58741. [$self._should_raise_((function(){
  58742. return $core.withContext(function($ctx2) {
  58743. return (16)._rp();
  58744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  58745. }),$globals.MessageNotUnderstood)
  58746. ,$ctx1.sendIdx["should:raise:"]=20
  58747. ][0];
  58748. [$self._should_raise_((function(){
  58749. return $core.withContext(function($ctx2) {
  58750. return (16)._rQ();
  58751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  58752. }),$globals.MessageNotUnderstood)
  58753. ,$ctx1.sendIdx["should:raise:"]=21
  58754. ][0];
  58755. [$self._should_raise_((function(){
  58756. return $core.withContext(function($ctx2) {
  58757. return (16)._rq();
  58758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  58759. }),$globals.MessageNotUnderstood)
  58760. ,$ctx1.sendIdx["should:raise:"]=22
  58761. ][0];
  58762. [$self._should_raise_((function(){
  58763. return $core.withContext(function($ctx2) {
  58764. return (16)._rR();
  58765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  58766. }),$globals.MessageNotUnderstood)
  58767. ,$ctx1.sendIdx["should:raise:"]=23
  58768. ][0];
  58769. [$self._should_raise_((function(){
  58770. return $core.withContext(function($ctx2) {
  58771. return (16)._rr();
  58772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  58773. }),$globals.MessageNotUnderstood)
  58774. ,$ctx1.sendIdx["should:raise:"]=24
  58775. ][0];
  58776. [$self._should_raise_((function(){
  58777. return $core.withContext(function($ctx2) {
  58778. return (16)._rS();
  58779. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  58780. }),$globals.MessageNotUnderstood)
  58781. ,$ctx1.sendIdx["should:raise:"]=25
  58782. ][0];
  58783. [$self._should_raise_((function(){
  58784. return $core.withContext(function($ctx2) {
  58785. return (16)._rs();
  58786. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  58787. }),$globals.MessageNotUnderstood)
  58788. ,$ctx1.sendIdx["should:raise:"]=26
  58789. ][0];
  58790. [$self._should_raise_((function(){
  58791. return $core.withContext(function($ctx2) {
  58792. return (16)._rT();
  58793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  58794. }),$globals.MessageNotUnderstood)
  58795. ,$ctx1.sendIdx["should:raise:"]=27
  58796. ][0];
  58797. [$self._should_raise_((function(){
  58798. return $core.withContext(function($ctx2) {
  58799. return (16)._rt();
  58800. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  58801. }),$globals.MessageNotUnderstood)
  58802. ,$ctx1.sendIdx["should:raise:"]=28
  58803. ][0];
  58804. [$self._should_raise_((function(){
  58805. return $core.withContext(function($ctx2) {
  58806. return (16)._rU();
  58807. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  58808. }),$globals.MessageNotUnderstood)
  58809. ,$ctx1.sendIdx["should:raise:"]=29
  58810. ][0];
  58811. [$self._should_raise_((function(){
  58812. return $core.withContext(function($ctx2) {
  58813. return (16)._ru();
  58814. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  58815. }),$globals.MessageNotUnderstood)
  58816. ,$ctx1.sendIdx["should:raise:"]=30
  58817. ][0];
  58818. [$self._should_raise_((function(){
  58819. return $core.withContext(function($ctx2) {
  58820. return (16)._rV();
  58821. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  58822. }),$globals.MessageNotUnderstood)
  58823. ,$ctx1.sendIdx["should:raise:"]=31
  58824. ][0];
  58825. [$self._should_raise_((function(){
  58826. return $core.withContext(function($ctx2) {
  58827. return (16)._rv();
  58828. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  58829. }),$globals.MessageNotUnderstood)
  58830. ,$ctx1.sendIdx["should:raise:"]=32
  58831. ][0];
  58832. [$self._should_raise_((function(){
  58833. return $core.withContext(function($ctx2) {
  58834. return (16)._rW();
  58835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  58836. }),$globals.MessageNotUnderstood)
  58837. ,$ctx1.sendIdx["should:raise:"]=33
  58838. ][0];
  58839. [$self._should_raise_((function(){
  58840. return $core.withContext(function($ctx2) {
  58841. return (16)._rw();
  58842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  58843. }),$globals.MessageNotUnderstood)
  58844. ,$ctx1.sendIdx["should:raise:"]=34
  58845. ][0];
  58846. [$self._should_raise_((function(){
  58847. return $core.withContext(function($ctx2) {
  58848. return (16)._rX();
  58849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  58850. }),$globals.MessageNotUnderstood)
  58851. ,$ctx1.sendIdx["should:raise:"]=35
  58852. ][0];
  58853. [$self._should_raise_((function(){
  58854. return $core.withContext(function($ctx2) {
  58855. return (16)._rx();
  58856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  58857. }),$globals.MessageNotUnderstood)
  58858. ,$ctx1.sendIdx["should:raise:"]=36
  58859. ][0];
  58860. [$self._should_raise_((function(){
  58861. return $core.withContext(function($ctx2) {
  58862. return (16)._rY();
  58863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  58864. }),$globals.MessageNotUnderstood)
  58865. ,$ctx1.sendIdx["should:raise:"]=37
  58866. ][0];
  58867. [$self._should_raise_((function(){
  58868. return $core.withContext(function($ctx2) {
  58869. return (16)._ry();
  58870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  58871. }),$globals.MessageNotUnderstood)
  58872. ,$ctx1.sendIdx["should:raise:"]=38
  58873. ][0];
  58874. [$self._should_raise_((function(){
  58875. return $core.withContext(function($ctx2) {
  58876. return (16)._rZ();
  58877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  58878. }),$globals.MessageNotUnderstood)
  58879. ,$ctx1.sendIdx["should:raise:"]=39
  58880. ][0];
  58881. [$self._should_raise_((function(){
  58882. return $core.withContext(function($ctx2) {
  58883. return (16)._rz();
  58884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  58885. }),$globals.MessageNotUnderstood)
  58886. ,$ctx1.sendIdx["should:raise:"]=40
  58887. ][0];
  58888. $self._should_raise_((function(){
  58889. return $core.withContext(function($ctx2) {
  58890. return (11259375)._Z();
  58891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  58892. }),$globals.MessageNotUnderstood);
  58893. return self;
  58894. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{})});
  58895. }; }),
  58896. $globals.NumberTest);
  58897. $core.addMethod(
  58898. $core.method({
  58899. selector: "testLog",
  58900. protocol: "tests",
  58901. args: [],
  58902. 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.",
  58903. referencedClasses: ["Number"],
  58904. pragmas: [],
  58905. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  58906. }, function ($methodClass){ return function (){
  58907. var self=this,$self=this;
  58908. return $core.withContext(function($ctx1) {
  58909. [$self._assert_equals_((10000)._log(),(4))
  58910. ,$ctx1.sendIdx["assert:equals:"]=1
  58911. ][0];
  58912. [$self._assert_equals_((512)._log_((2)),(9))
  58913. ,$ctx1.sendIdx["assert:equals:"]=2
  58914. ][0];
  58915. $self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  58916. return self;
  58917. }, function($ctx1) {$ctx1.fill(self,"testLog",{})});
  58918. }; }),
  58919. $globals.NumberTest);
  58920. $core.addMethod(
  58921. $core.method({
  58922. selector: "testMinMax",
  58923. protocol: "tests",
  58924. args: [],
  58925. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2.\x0a\x09self assert: (2 min: 5 max: 3) equals: 3.\x0a\x09self assert: (7 min: 5 max: 3) equals: 5.\x0a\x09self assert: (4 min: 5 max: 3) equals: 4.",
  58926. referencedClasses: [],
  58927. pragmas: [],
  58928. messageSends: ["assert:equals:", "max:", "min:", "min:max:"]
  58929. }, function ($methodClass){ return function (){
  58930. var self=this,$self=this;
  58931. return $core.withContext(function($ctx1) {
  58932. [$self._assert_equals_((2)._max_((5)),(5))
  58933. ,$ctx1.sendIdx["assert:equals:"]=1
  58934. ][0];
  58935. [$self._assert_equals_((2)._min_((5)),(2))
  58936. ,$ctx1.sendIdx["assert:equals:"]=2
  58937. ][0];
  58938. [$self._assert_equals_([(2)._min_max_((5),(3))
  58939. ,$ctx1.sendIdx["min:max:"]=1
  58940. ][0],(3))
  58941. ,$ctx1.sendIdx["assert:equals:"]=3
  58942. ][0];
  58943. [$self._assert_equals_([(7)._min_max_((5),(3))
  58944. ,$ctx1.sendIdx["min:max:"]=2
  58945. ][0],(5))
  58946. ,$ctx1.sendIdx["assert:equals:"]=4
  58947. ][0];
  58948. $self._assert_equals_((4)._min_max_((5),(3)),(4));
  58949. return self;
  58950. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{})});
  58951. }; }),
  58952. $globals.NumberTest);
  58953. $core.addMethod(
  58954. $core.method({
  58955. selector: "testNegated",
  58956. protocol: "tests",
  58957. args: [],
  58958. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  58959. referencedClasses: [],
  58960. pragmas: [],
  58961. messageSends: ["assert:equals:", "negated"]
  58962. }, function ($methodClass){ return function (){
  58963. var self=this,$self=this;
  58964. return $core.withContext(function($ctx1) {
  58965. [$self._assert_equals_([(3)._negated()
  58966. ,$ctx1.sendIdx["negated"]=1
  58967. ][0],(-3))
  58968. ,$ctx1.sendIdx["assert:equals:"]=1
  58969. ][0];
  58970. $self._assert_equals_((-3)._negated(),(3));
  58971. return self;
  58972. }, function($ctx1) {$ctx1.fill(self,"testNegated",{})});
  58973. }; }),
  58974. $globals.NumberTest);
  58975. $core.addMethod(
  58976. $core.method({
  58977. selector: "testPrintShowingDecimalPlaces",
  58978. protocol: "tests",
  58979. args: [],
  58980. 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'.",
  58981. referencedClasses: [],
  58982. pragmas: [],
  58983. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  58984. }, function ($methodClass){ return function (){
  58985. var self=this,$self=this;
  58986. return $core.withContext(function($ctx1) {
  58987. [$self._assert_equals_([(23)._printShowingDecimalPlaces_((2))
  58988. ,$ctx1.sendIdx["printShowingDecimalPlaces:"]=1
  58989. ][0],"23.00")
  58990. ,$ctx1.sendIdx["assert:equals:"]=1
  58991. ][0];
  58992. [$self._assert_equals_([(23.5698)._printShowingDecimalPlaces_((2))
  58993. ,$ctx1.sendIdx["printShowingDecimalPlaces:"]=2
  58994. ][0],"23.57")
  58995. ,$ctx1.sendIdx["assert:equals:"]=2
  58996. ][0];
  58997. [$self._assert_equals_([$recv([(234.567)._negated()
  58998. ,$ctx1.sendIdx["negated"]=1
  58999. ][0])._printShowingDecimalPlaces_((5))
  59000. ,$ctx1.sendIdx["printShowingDecimalPlaces:"]=3
  59001. ][0],"-234.56700")
  59002. ,$ctx1.sendIdx["assert:equals:"]=3
  59003. ][0];
  59004. [$self._assert_equals_([(23.4567)._printShowingDecimalPlaces_((0))
  59005. ,$ctx1.sendIdx["printShowingDecimalPlaces:"]=4
  59006. ][0],"23")
  59007. ,$ctx1.sendIdx["assert:equals:"]=4
  59008. ][0];
  59009. [$self._assert_equals_([(23.5567)._printShowingDecimalPlaces_((0))
  59010. ,$ctx1.sendIdx["printShowingDecimalPlaces:"]=5
  59011. ][0],"24")
  59012. ,$ctx1.sendIdx["assert:equals:"]=5
  59013. ][0];
  59014. [$self._assert_equals_([$recv([(23.4567)._negated()
  59015. ,$ctx1.sendIdx["negated"]=2
  59016. ][0])._printShowingDecimalPlaces_((0))
  59017. ,$ctx1.sendIdx["printShowingDecimalPlaces:"]=6
  59018. ][0],"-23")
  59019. ,$ctx1.sendIdx["assert:equals:"]=6
  59020. ][0];
  59021. [$self._assert_equals_([$recv([(23.5567)._negated()
  59022. ,$ctx1.sendIdx["negated"]=3
  59023. ][0])._printShowingDecimalPlaces_((0))
  59024. ,$ctx1.sendIdx["printShowingDecimalPlaces:"]=7
  59025. ][0],"-24")
  59026. ,$ctx1.sendIdx["assert:equals:"]=7
  59027. ][0];
  59028. [$self._assert_equals_([(100000000)._printShowingDecimalPlaces_((1))
  59029. ,$ctx1.sendIdx["printShowingDecimalPlaces:"]=8
  59030. ][0],"100000000.0")
  59031. ,$ctx1.sendIdx["assert:equals:"]=8
  59032. ][0];
  59033. [$self._assert_equals_([(0.98)._printShowingDecimalPlaces_((5))
  59034. ,$ctx1.sendIdx["printShowingDecimalPlaces:"]=9
  59035. ][0],"0.98000")
  59036. ,$ctx1.sendIdx["assert:equals:"]=9
  59037. ][0];
  59038. [$self._assert_equals_([$recv((0.98)._negated())._printShowingDecimalPlaces_((2))
  59039. ,$ctx1.sendIdx["printShowingDecimalPlaces:"]=10
  59040. ][0],"-0.98")
  59041. ,$ctx1.sendIdx["assert:equals:"]=10
  59042. ][0];
  59043. [$self._assert_equals_([(2.567)._printShowingDecimalPlaces_((2))
  59044. ,$ctx1.sendIdx["printShowingDecimalPlaces:"]=11
  59045. ][0],"2.57")
  59046. ,$ctx1.sendIdx["assert:equals:"]=11
  59047. ][0];
  59048. [$self._assert_equals_([(-2.567)._printShowingDecimalPlaces_((2))
  59049. ,$ctx1.sendIdx["printShowingDecimalPlaces:"]=12
  59050. ][0],"-2.57")
  59051. ,$ctx1.sendIdx["assert:equals:"]=12
  59052. ][0];
  59053. $self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  59054. return self;
  59055. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{})});
  59056. }; }),
  59057. $globals.NumberTest);
  59058. $core.addMethod(
  59059. $core.method({
  59060. selector: "testPrintStringBase",
  59061. protocol: "tests",
  59062. args: [],
  59063. source: "testPrintStringBase\x0a\x09self assert: (15 printStringBase: 2) equals: '1111'.\x0a\x09self assert: (15 printStringBase: 16) equals: 'f'.\x0a\x09self assert: (256 printStringBase: 16) equals: '100'.\x0a\x09self assert: (256 printStringBase: 2) equals: '100000000'",
  59064. referencedClasses: [],
  59065. pragmas: [],
  59066. messageSends: ["assert:equals:", "printStringBase:"]
  59067. }, function ($methodClass){ return function (){
  59068. var self=this,$self=this;
  59069. return $core.withContext(function($ctx1) {
  59070. [$self._assert_equals_([(15)._printStringBase_((2))
  59071. ,$ctx1.sendIdx["printStringBase:"]=1
  59072. ][0],"1111")
  59073. ,$ctx1.sendIdx["assert:equals:"]=1
  59074. ][0];
  59075. [$self._assert_equals_([(15)._printStringBase_((16))
  59076. ,$ctx1.sendIdx["printStringBase:"]=2
  59077. ][0],"f")
  59078. ,$ctx1.sendIdx["assert:equals:"]=2
  59079. ][0];
  59080. [$self._assert_equals_([(256)._printStringBase_((16))
  59081. ,$ctx1.sendIdx["printStringBase:"]=3
  59082. ][0],"100")
  59083. ,$ctx1.sendIdx["assert:equals:"]=3
  59084. ][0];
  59085. $self._assert_equals_((256)._printStringBase_((2)),"100000000");
  59086. return self;
  59087. }, function($ctx1) {$ctx1.fill(self,"testPrintStringBase",{})});
  59088. }; }),
  59089. $globals.NumberTest);
  59090. $core.addMethod(
  59091. $core.method({
  59092. selector: "testRadiansToDegrees",
  59093. protocol: "tests",
  59094. args: [],
  59095. source: "testRadiansToDegrees\x0a\x09self assert: (Number pi radiansToDegrees - 180) abs <= 0.01.",
  59096. referencedClasses: ["Number"],
  59097. pragmas: [],
  59098. messageSends: ["assert:", "<=", "abs", "-", "radiansToDegrees", "pi"]
  59099. }, function ($methodClass){ return function (){
  59100. var self=this,$self=this;
  59101. return $core.withContext(function($ctx1) {
  59102. $self._assert_($recv($recv($recv($recv($recv($globals.Number)._pi())._radiansToDegrees()).__minus((180)))._abs()).__lt_eq((0.01)));
  59103. return self;
  59104. }, function($ctx1) {$ctx1.fill(self,"testRadiansToDegrees",{})});
  59105. }; }),
  59106. $globals.NumberTest);
  59107. $core.addMethod(
  59108. $core.method({
  59109. selector: "testRaisedTo",
  59110. protocol: "tests",
  59111. args: [],
  59112. 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.",
  59113. referencedClasses: [],
  59114. pragmas: [],
  59115. messageSends: ["assert:equals:", "raisedTo:", "**"]
  59116. }, function ($methodClass){ return function (){
  59117. var self=this,$self=this;
  59118. return $core.withContext(function($ctx1) {
  59119. [$self._assert_equals_([(2)._raisedTo_((4))
  59120. ,$ctx1.sendIdx["raisedTo:"]=1
  59121. ][0],(16))
  59122. ,$ctx1.sendIdx["assert:equals:"]=1
  59123. ][0];
  59124. [$self._assert_equals_([(2)._raisedTo_((0))
  59125. ,$ctx1.sendIdx["raisedTo:"]=2
  59126. ][0],(1))
  59127. ,$ctx1.sendIdx["assert:equals:"]=2
  59128. ][0];
  59129. [$self._assert_equals_([(2)._raisedTo_((-3))
  59130. ,$ctx1.sendIdx["raisedTo:"]=3
  59131. ][0],(0.125))
  59132. ,$ctx1.sendIdx["assert:equals:"]=3
  59133. ][0];
  59134. [$self._assert_equals_((4)._raisedTo_((0.5)),(2))
  59135. ,$ctx1.sendIdx["assert:equals:"]=4
  59136. ][0];
  59137. $self._assert_equals_((2).__star_star((4)),(16));
  59138. return self;
  59139. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{})});
  59140. }; }),
  59141. $globals.NumberTest);
  59142. $core.addMethod(
  59143. $core.method({
  59144. selector: "testRounded",
  59145. protocol: "tests",
  59146. args: [],
  59147. 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",
  59148. referencedClasses: [],
  59149. pragmas: [],
  59150. messageSends: ["assert:equals:", "rounded"]
  59151. }, function ($methodClass){ return function (){
  59152. var self=this,$self=this;
  59153. return $core.withContext(function($ctx1) {
  59154. [$self._assert_equals_([(3)._rounded()
  59155. ,$ctx1.sendIdx["rounded"]=1
  59156. ][0],(3))
  59157. ,$ctx1.sendIdx["assert:equals:"]=1
  59158. ][0];
  59159. [$self._assert_equals_([(3.212)._rounded()
  59160. ,$ctx1.sendIdx["rounded"]=2
  59161. ][0],(3))
  59162. ,$ctx1.sendIdx["assert:equals:"]=2
  59163. ][0];
  59164. $self._assert_equals_((3.51)._rounded(),(4));
  59165. return self;
  59166. }, function($ctx1) {$ctx1.fill(self,"testRounded",{})});
  59167. }; }),
  59168. $globals.NumberTest);
  59169. $core.addMethod(
  59170. $core.method({
  59171. selector: "testSign",
  59172. protocol: "tests",
  59173. args: [],
  59174. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  59175. referencedClasses: [],
  59176. pragmas: [],
  59177. messageSends: ["assert:equals:", "sign"]
  59178. }, function ($methodClass){ return function (){
  59179. var self=this,$self=this;
  59180. return $core.withContext(function($ctx1) {
  59181. [$self._assert_equals_([(5)._sign()
  59182. ,$ctx1.sendIdx["sign"]=1
  59183. ][0],(1))
  59184. ,$ctx1.sendIdx["assert:equals:"]=1
  59185. ][0];
  59186. [$self._assert_equals_([(0)._sign()
  59187. ,$ctx1.sendIdx["sign"]=2
  59188. ][0],(0))
  59189. ,$ctx1.sendIdx["assert:equals:"]=2
  59190. ][0];
  59191. $self._assert_equals_((-1.4)._sign(),(-1));
  59192. return self;
  59193. }, function($ctx1) {$ctx1.fill(self,"testSign",{})});
  59194. }; }),
  59195. $globals.NumberTest);
  59196. $core.addMethod(
  59197. $core.method({
  59198. selector: "testSqrt",
  59199. protocol: "tests",
  59200. args: [],
  59201. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  59202. referencedClasses: [],
  59203. pragmas: [],
  59204. messageSends: ["assert:equals:", "sqrt"]
  59205. }, function ($methodClass){ return function (){
  59206. var self=this,$self=this;
  59207. return $core.withContext(function($ctx1) {
  59208. [$self._assert_equals_([(4)._sqrt()
  59209. ,$ctx1.sendIdx["sqrt"]=1
  59210. ][0],(2))
  59211. ,$ctx1.sendIdx["assert:equals:"]=1
  59212. ][0];
  59213. $self._assert_equals_((16)._sqrt(),(4));
  59214. return self;
  59215. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{})});
  59216. }; }),
  59217. $globals.NumberTest);
  59218. $core.addMethod(
  59219. $core.method({
  59220. selector: "testSquared",
  59221. protocol: "tests",
  59222. args: [],
  59223. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  59224. referencedClasses: [],
  59225. pragmas: [],
  59226. messageSends: ["assert:equals:", "squared"]
  59227. }, function ($methodClass){ return function (){
  59228. var self=this,$self=this;
  59229. return $core.withContext(function($ctx1) {
  59230. $self._assert_equals_((4)._squared(),(16));
  59231. return self;
  59232. }, function($ctx1) {$ctx1.fill(self,"testSquared",{})});
  59233. }; }),
  59234. $globals.NumberTest);
  59235. $core.addMethod(
  59236. $core.method({
  59237. selector: "testTimesRepeat",
  59238. protocol: "tests",
  59239. args: [],
  59240. 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",
  59241. referencedClasses: [],
  59242. pragmas: [],
  59243. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  59244. }, function ($methodClass){ return function (){
  59245. var self=this,$self=this;
  59246. var i;
  59247. return $core.withContext(function($ctx1) {
  59248. i=(0);
  59249. [(0)._timesRepeat_((function(){
  59250. return $core.withContext(function($ctx2) {
  59251. i=[$recv(i).__plus((1))
  59252. ,$ctx2.sendIdx["+"]=1
  59253. ][0];
  59254. return i;
  59255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59256. }))
  59257. ,$ctx1.sendIdx["timesRepeat:"]=1
  59258. ][0];
  59259. [$self._assert_equals_(i,(0))
  59260. ,$ctx1.sendIdx["assert:equals:"]=1
  59261. ][0];
  59262. (5)._timesRepeat_((function(){
  59263. return $core.withContext(function($ctx2) {
  59264. i=$recv(i).__plus((1));
  59265. return i;
  59266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59267. }));
  59268. $self._assert_equals_(i,(5));
  59269. return self;
  59270. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i})});
  59271. }; }),
  59272. $globals.NumberTest);
  59273. $core.addMethod(
  59274. $core.method({
  59275. selector: "testTo",
  59276. protocol: "tests",
  59277. args: [],
  59278. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  59279. referencedClasses: [],
  59280. pragmas: [],
  59281. messageSends: ["assert:equals:", "to:"]
  59282. }, function ($methodClass){ return function (){
  59283. var self=this,$self=this;
  59284. return $core.withContext(function($ctx1) {
  59285. $self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  59286. return self;
  59287. }, function($ctx1) {$ctx1.fill(self,"testTo",{})});
  59288. }; }),
  59289. $globals.NumberTest);
  59290. $core.addMethod(
  59291. $core.method({
  59292. selector: "testToBy",
  59293. protocol: "tests",
  59294. args: [],
  59295. 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",
  59296. referencedClasses: ["Error"],
  59297. pragmas: [],
  59298. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  59299. }, function ($methodClass){ return function (){
  59300. var self=this,$self=this;
  59301. return $core.withContext(function($ctx1) {
  59302. $self._assert_equals_([(0)._to_by_((6),(2))
  59303. ,$ctx1.sendIdx["to:by:"]=1
  59304. ][0],[(0), (2), (4), (6)]);
  59305. $self._should_raise_((function(){
  59306. return $core.withContext(function($ctx2) {
  59307. return (1)._to_by_((4),(0));
  59308. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59309. }),$globals.Error);
  59310. return self;
  59311. }, function($ctx1) {$ctx1.fill(self,"testToBy",{})});
  59312. }; }),
  59313. $globals.NumberTest);
  59314. $core.addMethod(
  59315. $core.method({
  59316. selector: "testTrigonometry",
  59317. protocol: "tests",
  59318. args: [],
  59319. source: "testTrigonometry\x0a\x09self assert: 0 cos equals: 1.\x0a\x09self assert: 0 sin equals: 0.\x0a\x09self assert: 0 tan equals: 0.\x0a\x09self assert: 1 arcCos equals: 0.\x0a\x09self assert: 0 arcSin equals: 0.\x0a\x09self assert: 0 arcTan equals: 0.\x0a\x09\x0a\x09self assert: (0 arcTan: 1) equals: 0.\x0a\x09self assert: (1 arcTan: 0) equals: (Number pi / 2)",
  59320. referencedClasses: ["Number"],
  59321. pragmas: [],
  59322. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan", "arcTan:", "/", "pi"]
  59323. }, function ($methodClass){ return function (){
  59324. var self=this,$self=this;
  59325. return $core.withContext(function($ctx1) {
  59326. [$self._assert_equals_((0)._cos(),(1))
  59327. ,$ctx1.sendIdx["assert:equals:"]=1
  59328. ][0];
  59329. [$self._assert_equals_((0)._sin(),(0))
  59330. ,$ctx1.sendIdx["assert:equals:"]=2
  59331. ][0];
  59332. [$self._assert_equals_((0)._tan(),(0))
  59333. ,$ctx1.sendIdx["assert:equals:"]=3
  59334. ][0];
  59335. [$self._assert_equals_((1)._arcCos(),(0))
  59336. ,$ctx1.sendIdx["assert:equals:"]=4
  59337. ][0];
  59338. [$self._assert_equals_((0)._arcSin(),(0))
  59339. ,$ctx1.sendIdx["assert:equals:"]=5
  59340. ][0];
  59341. [$self._assert_equals_((0)._arcTan(),(0))
  59342. ,$ctx1.sendIdx["assert:equals:"]=6
  59343. ][0];
  59344. [$self._assert_equals_([(0)._arcTan_((1))
  59345. ,$ctx1.sendIdx["arcTan:"]=1
  59346. ][0],(0))
  59347. ,$ctx1.sendIdx["assert:equals:"]=7
  59348. ][0];
  59349. $self._assert_equals_((1)._arcTan_((0)),$recv($recv($globals.Number)._pi()).__slash((2)));
  59350. return self;
  59351. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{})});
  59352. }; }),
  59353. $globals.NumberTest);
  59354. $core.addMethod(
  59355. $core.method({
  59356. selector: "testTruncated",
  59357. protocol: "tests",
  59358. args: [],
  59359. 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",
  59360. referencedClasses: [],
  59361. pragmas: [],
  59362. messageSends: ["assert:equals:", "truncated"]
  59363. }, function ($methodClass){ return function (){
  59364. var self=this,$self=this;
  59365. return $core.withContext(function($ctx1) {
  59366. [$self._assert_equals_([(3)._truncated()
  59367. ,$ctx1.sendIdx["truncated"]=1
  59368. ][0],(3))
  59369. ,$ctx1.sendIdx["assert:equals:"]=1
  59370. ][0];
  59371. [$self._assert_equals_([(3.212)._truncated()
  59372. ,$ctx1.sendIdx["truncated"]=2
  59373. ][0],(3))
  59374. ,$ctx1.sendIdx["assert:equals:"]=2
  59375. ][0];
  59376. $self._assert_equals_((3.51)._truncated(),(3));
  59377. return self;
  59378. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{})});
  59379. }; }),
  59380. $globals.NumberTest);
  59381. $core.addClass("ObjectMock", $globals.Object, ["foo", "bar"], "Kernel-Tests");
  59382. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  59383. $core.addMethod(
  59384. $core.method({
  59385. selector: "foo",
  59386. protocol: "not yet classified",
  59387. args: [],
  59388. source: "foo\x0a\x09^ foo",
  59389. referencedClasses: [],
  59390. pragmas: [],
  59391. messageSends: []
  59392. }, function ($methodClass){ return function (){
  59393. var self=this,$self=this;
  59394. return $self.foo;
  59395. }; }),
  59396. $globals.ObjectMock);
  59397. $core.addMethod(
  59398. $core.method({
  59399. selector: "foo:",
  59400. protocol: "not yet classified",
  59401. args: ["anObject"],
  59402. source: "foo: anObject\x0a\x09foo := anObject",
  59403. referencedClasses: [],
  59404. pragmas: [],
  59405. messageSends: []
  59406. }, function ($methodClass){ return function (anObject){
  59407. var self=this,$self=this;
  59408. $self.foo=anObject;
  59409. return self;
  59410. }; }),
  59411. $globals.ObjectMock);
  59412. $core.addClass("ObjectTest", $globals.TestCase, [], "Kernel-Tests");
  59413. $core.addMethod(
  59414. $core.method({
  59415. selector: "notDefined",
  59416. protocol: "tests",
  59417. args: [],
  59418. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  59419. referencedClasses: [],
  59420. pragmas: [["inlineJS:", ["return void 0;"]]],
  59421. messageSends: []
  59422. }, function ($methodClass){ return function (){
  59423. var self=this,$self=this;
  59424. return $core.withContext(function($ctx1) {
  59425. return void 0;;
  59426. return self;
  59427. }, function($ctx1) {$ctx1.fill(self,"notDefined",{})});
  59428. }; }),
  59429. $globals.ObjectTest);
  59430. $core.addMethod(
  59431. $core.method({
  59432. selector: "testBasicAccess",
  59433. protocol: "tests",
  59434. args: [],
  59435. 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",
  59436. referencedClasses: ["Object"],
  59437. pragmas: [],
  59438. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  59439. }, function ($methodClass){ return function (){
  59440. var self=this,$self=this;
  59441. var o;
  59442. return $core.withContext(function($ctx1) {
  59443. o=$recv($globals.Object)._new();
  59444. $recv(o)._basicAt_put_("a",(1));
  59445. [$self._assert_equals_([$recv(o)._basicAt_("a")
  59446. ,$ctx1.sendIdx["basicAt:"]=1
  59447. ][0],(1))
  59448. ,$ctx1.sendIdx["assert:equals:"]=1
  59449. ][0];
  59450. $self._assert_equals_($recv(o)._basicAt_("b"),nil);
  59451. return self;
  59452. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o})});
  59453. }; }),
  59454. $globals.ObjectTest);
  59455. $core.addMethod(
  59456. $core.method({
  59457. selector: "testBasicPerform",
  59458. protocol: "tests",
  59459. args: [],
  59460. 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",
  59461. referencedClasses: ["Object"],
  59462. pragmas: [],
  59463. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  59464. }, function ($methodClass){ return function (){
  59465. var self=this,$self=this;
  59466. var o;
  59467. return $core.withContext(function($ctx1) {
  59468. o=$recv($globals.Object)._new();
  59469. [$recv(o)._basicAt_put_("func",(function(){
  59470. return "hello";
  59471. }))
  59472. ,$ctx1.sendIdx["basicAt:put:"]=1
  59473. ][0];
  59474. $recv(o)._basicAt_put_("func2",(function(a){
  59475. return $core.withContext(function($ctx2) {
  59476. return $recv(a).__plus((1));
  59477. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  59478. }));
  59479. [$self._assert_equals_($recv(o)._basicPerform_("func"),"hello")
  59480. ,$ctx1.sendIdx["assert:equals:"]=1
  59481. ][0];
  59482. $self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  59483. return self;
  59484. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o})});
  59485. }; }),
  59486. $globals.ObjectTest);
  59487. $core.addMethod(
  59488. $core.method({
  59489. selector: "testDNU",
  59490. protocol: "tests",
  59491. args: [],
  59492. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  59493. referencedClasses: ["Object", "MessageNotUnderstood"],
  59494. pragmas: [],
  59495. messageSends: ["should:raise:", "foo", "new"]
  59496. }, function ($methodClass){ return function (){
  59497. var self=this,$self=this;
  59498. return $core.withContext(function($ctx1) {
  59499. $self._should_raise_((function(){
  59500. return $core.withContext(function($ctx2) {
  59501. return $recv($recv($globals.Object)._new())._foo();
  59502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59503. }),$globals.MessageNotUnderstood);
  59504. return self;
  59505. }, function($ctx1) {$ctx1.fill(self,"testDNU",{})});
  59506. }; }),
  59507. $globals.ObjectTest);
  59508. $core.addMethod(
  59509. $core.method({
  59510. selector: "testEquality",
  59511. protocol: "tests",
  59512. args: [],
  59513. 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)",
  59514. referencedClasses: ["Object"],
  59515. pragmas: [],
  59516. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  59517. }, function ($methodClass){ return function (){
  59518. var self=this,$self=this;
  59519. var o;
  59520. return $core.withContext(function($ctx1) {
  59521. o=[$recv($globals.Object)._new()
  59522. ,$ctx1.sendIdx["new"]=1
  59523. ][0];
  59524. $self._deny_([$recv(o).__eq($recv($globals.Object)._new())
  59525. ,$ctx1.sendIdx["="]=1
  59526. ][0]);
  59527. [$self._assert_([$recv(o).__eq(o)
  59528. ,$ctx1.sendIdx["="]=2
  59529. ][0])
  59530. ,$ctx1.sendIdx["assert:"]=1
  59531. ][0];
  59532. [$self._assert_([$recv([$recv(o)._yourself()
  59533. ,$ctx1.sendIdx["yourself"]=1
  59534. ][0]).__eq(o)
  59535. ,$ctx1.sendIdx["="]=3
  59536. ][0])
  59537. ,$ctx1.sendIdx["assert:"]=2
  59538. ][0];
  59539. $self._assert_($recv(o).__eq($recv(o)._yourself()));
  59540. return self;
  59541. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o})});
  59542. }; }),
  59543. $globals.ObjectTest);
  59544. $core.addMethod(
  59545. $core.method({
  59546. selector: "testHalt",
  59547. protocol: "tests",
  59548. args: [],
  59549. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  59550. referencedClasses: ["Object", "Error"],
  59551. pragmas: [],
  59552. messageSends: ["should:raise:", "halt", "new"]
  59553. }, function ($methodClass){ return function (){
  59554. var self=this,$self=this;
  59555. return $core.withContext(function($ctx1) {
  59556. $self._should_raise_((function(){
  59557. return $core.withContext(function($ctx2) {
  59558. return $recv($recv($globals.Object)._new())._halt();
  59559. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59560. }),$globals.Error);
  59561. return self;
  59562. }, function($ctx1) {$ctx1.fill(self,"testHalt",{})});
  59563. }; }),
  59564. $globals.ObjectTest);
  59565. $core.addMethod(
  59566. $core.method({
  59567. selector: "testIdentity",
  59568. protocol: "tests",
  59569. args: [],
  59570. 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",
  59571. referencedClasses: ["Object"],
  59572. pragmas: [],
  59573. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  59574. }, function ($methodClass){ return function (){
  59575. var self=this,$self=this;
  59576. var o;
  59577. return $core.withContext(function($ctx1) {
  59578. o=[$recv($globals.Object)._new()
  59579. ,$ctx1.sendIdx["new"]=1
  59580. ][0];
  59581. $self._deny_([$recv(o).__eq_eq($recv($globals.Object)._new())
  59582. ,$ctx1.sendIdx["=="]=1
  59583. ][0]);
  59584. [$self._assert_([$recv(o).__eq_eq(o)
  59585. ,$ctx1.sendIdx["=="]=2
  59586. ][0])
  59587. ,$ctx1.sendIdx["assert:"]=1
  59588. ][0];
  59589. [$self._assert_([$recv([$recv(o)._yourself()
  59590. ,$ctx1.sendIdx["yourself"]=1
  59591. ][0]).__eq_eq(o)
  59592. ,$ctx1.sendIdx["=="]=3
  59593. ][0])
  59594. ,$ctx1.sendIdx["assert:"]=2
  59595. ][0];
  59596. $self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  59597. return self;
  59598. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o})});
  59599. }; }),
  59600. $globals.ObjectTest);
  59601. $core.addMethod(
  59602. $core.method({
  59603. selector: "testIfNil",
  59604. protocol: "tests",
  59605. args: [],
  59606. 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",
  59607. referencedClasses: ["Object"],
  59608. pragmas: [],
  59609. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  59610. }, function ($methodClass){ return function (){
  59611. var self=this,$self=this;
  59612. return $core.withContext(function($ctx1) {
  59613. var $1,$2,$3,$4,$5,$6,$7,$8;
  59614. [$self._deny_($recv([$recv($globals.Object)._new()
  59615. ,$ctx1.sendIdx["new"]=1
  59616. ][0])._isNil())
  59617. ,$ctx1.sendIdx["deny:"]=1
  59618. ][0];
  59619. $1=[$recv($globals.Object)._new()
  59620. ,$ctx1.sendIdx["new"]=2
  59621. ][0];
  59622. if($1 == null || $1.a$nil){
  59623. $2=true;
  59624. } else {
  59625. $2=$1;
  59626. }
  59627. $self._deny_($recv($2).__eq(true));
  59628. $3=[$recv($globals.Object)._new()
  59629. ,$ctx1.sendIdx["new"]=3
  59630. ][0];
  59631. if($3 == null || $3.a$nil){
  59632. $4=$3;
  59633. } else {
  59634. $4=true;
  59635. }
  59636. [$self._assert_equals_($4,true)
  59637. ,$ctx1.sendIdx["assert:equals:"]=1
  59638. ][0];
  59639. $5=[$recv($globals.Object)._new()
  59640. ,$ctx1.sendIdx["new"]=4
  59641. ][0];
  59642. if($5 == null || $5.a$nil){
  59643. $6=false;
  59644. } else {
  59645. $6=true;
  59646. }
  59647. [$self._assert_equals_($6,true)
  59648. ,$ctx1.sendIdx["assert:equals:"]=2
  59649. ][0];
  59650. $7=$recv($globals.Object)._new();
  59651. if($7 == null || $7.a$nil){
  59652. $8=false;
  59653. } else {
  59654. $8=true;
  59655. }
  59656. $self._assert_equals_($8,true);
  59657. return self;
  59658. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{})});
  59659. }; }),
  59660. $globals.ObjectTest);
  59661. $core.addMethod(
  59662. $core.method({
  59663. selector: "testInstVars",
  59664. protocol: "tests",
  59665. args: [],
  59666. source: "testInstVars\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: (o instVarNamed: #foo) equals: nil.\x0a\x0a\x09o instVarNamed: #foo put: 1.\x0a\x09self assert: (o instVarNamed: #foo) equals: 1.\x0a\x09self assert: (o instVarNamed: 'foo') equals: 1",
  59667. referencedClasses: ["ObjectMock"],
  59668. pragmas: [],
  59669. messageSends: ["new", "assert:equals:", "instVarNamed:", "instVarNamed:put:"]
  59670. }, function ($methodClass){ return function (){
  59671. var self=this,$self=this;
  59672. var o;
  59673. return $core.withContext(function($ctx1) {
  59674. o=$recv($globals.ObjectMock)._new();
  59675. [$self._assert_equals_([$recv(o)._instVarNamed_("foo")
  59676. ,$ctx1.sendIdx["instVarNamed:"]=1
  59677. ][0],nil)
  59678. ,$ctx1.sendIdx["assert:equals:"]=1
  59679. ][0];
  59680. $recv(o)._instVarNamed_put_("foo",(1));
  59681. [$self._assert_equals_([$recv(o)._instVarNamed_("foo")
  59682. ,$ctx1.sendIdx["instVarNamed:"]=2
  59683. ][0],(1))
  59684. ,$ctx1.sendIdx["assert:equals:"]=2
  59685. ][0];
  59686. $self._assert_equals_($recv(o)._instVarNamed_("foo"),(1));
  59687. return self;
  59688. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o})});
  59689. }; }),
  59690. $globals.ObjectTest);
  59691. $core.addMethod(
  59692. $core.method({
  59693. selector: "testNilUndefined",
  59694. protocol: "tests",
  59695. args: [],
  59696. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  59697. referencedClasses: [],
  59698. pragmas: [],
  59699. messageSends: ["assert:equals:", "notDefined"]
  59700. }, function ($methodClass){ return function (){
  59701. var self=this,$self=this;
  59702. return $core.withContext(function($ctx1) {
  59703. $self._assert_equals_($self._notDefined(),nil);
  59704. return self;
  59705. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{})});
  59706. }; }),
  59707. $globals.ObjectTest);
  59708. $core.addMethod(
  59709. $core.method({
  59710. selector: "testYourself",
  59711. protocol: "tests",
  59712. args: [],
  59713. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  59714. referencedClasses: ["ObjectMock"],
  59715. pragmas: [],
  59716. messageSends: ["new", "assert:", "==", "yourself"]
  59717. }, function ($methodClass){ return function (){
  59718. var self=this,$self=this;
  59719. var o;
  59720. return $core.withContext(function($ctx1) {
  59721. o=$recv($globals.ObjectMock)._new();
  59722. $self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  59723. return self;
  59724. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o})});
  59725. }; }),
  59726. $globals.ObjectTest);
  59727. $core.addClass("PointTest", $globals.TestCase, [], "Kernel-Tests");
  59728. $core.addMethod(
  59729. $core.method({
  59730. selector: "testAccessing",
  59731. protocol: "tests",
  59732. args: [],
  59733. 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",
  59734. referencedClasses: ["Point"],
  59735. pragmas: [],
  59736. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  59737. }, function ($methodClass){ return function (){
  59738. var self=this,$self=this;
  59739. return $core.withContext(function($ctx1) {
  59740. [$self._assert_equals_([$recv([$recv($globals.Point)._x_y_((3),(4))
  59741. ,$ctx1.sendIdx["x:y:"]=1
  59742. ][0])._x()
  59743. ,$ctx1.sendIdx["x"]=1
  59744. ][0],(3))
  59745. ,$ctx1.sendIdx["assert:equals:"]=1
  59746. ][0];
  59747. [$self._assert_equals_([$recv($recv($globals.Point)._x_y_((3),(4)))._y()
  59748. ,$ctx1.sendIdx["y"]=1
  59749. ][0],(4))
  59750. ,$ctx1.sendIdx["assert:equals:"]=2
  59751. ][0];
  59752. [$self._assert_equals_($recv($recv([$recv($globals.Point)._new()
  59753. ,$ctx1.sendIdx["new"]=1
  59754. ][0])._x_((3)))._x(),(3))
  59755. ,$ctx1.sendIdx["assert:equals:"]=3
  59756. ][0];
  59757. $self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  59758. return self;
  59759. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{})});
  59760. }; }),
  59761. $globals.PointTest);
  59762. $core.addMethod(
  59763. $core.method({
  59764. selector: "testAngle",
  59765. protocol: "tests",
  59766. args: [],
  59767. source: "testAngle\x0a\x09self assert: (-1@0) angle equals: Number pi",
  59768. referencedClasses: ["Number"],
  59769. pragmas: [],
  59770. messageSends: ["assert:equals:", "angle", "@", "pi"]
  59771. }, function ($methodClass){ return function (){
  59772. var self=this,$self=this;
  59773. return $core.withContext(function($ctx1) {
  59774. $self._assert_equals_($recv((-1).__at((0)))._angle(),$recv($globals.Number)._pi());
  59775. return self;
  59776. }, function($ctx1) {$ctx1.fill(self,"testAngle",{})});
  59777. }; }),
  59778. $globals.PointTest);
  59779. $core.addMethod(
  59780. $core.method({
  59781. selector: "testArithmetic",
  59782. protocol: "tests",
  59783. args: [],
  59784. 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)",
  59785. referencedClasses: ["Point"],
  59786. pragmas: [],
  59787. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  59788. }, function ($methodClass){ return function (){
  59789. var self=this,$self=this;
  59790. return $core.withContext(function($ctx1) {
  59791. [$self._assert_equals_($recv([(3).__at((4))
  59792. ,$ctx1.sendIdx["@"]=1
  59793. ][0]).__star([(3).__at((4))
  59794. ,$ctx1.sendIdx["@"]=2
  59795. ][0]),[$recv($globals.Point)._x_y_((9),(16))
  59796. ,$ctx1.sendIdx["x:y:"]=1
  59797. ][0])
  59798. ,$ctx1.sendIdx["assert:equals:"]=1
  59799. ][0];
  59800. [$self._assert_equals_($recv([(3).__at((4))
  59801. ,$ctx1.sendIdx["@"]=3
  59802. ][0]).__plus([(3).__at((4))
  59803. ,$ctx1.sendIdx["@"]=4
  59804. ][0]),[$recv($globals.Point)._x_y_((6),(8))
  59805. ,$ctx1.sendIdx["x:y:"]=2
  59806. ][0])
  59807. ,$ctx1.sendIdx["assert:equals:"]=2
  59808. ][0];
  59809. [$self._assert_equals_($recv([(3).__at((4))
  59810. ,$ctx1.sendIdx["@"]=5
  59811. ][0]).__minus([(3).__at((4))
  59812. ,$ctx1.sendIdx["@"]=6
  59813. ][0]),[$recv($globals.Point)._x_y_((0),(0))
  59814. ,$ctx1.sendIdx["x:y:"]=3
  59815. ][0])
  59816. ,$ctx1.sendIdx["assert:equals:"]=3
  59817. ][0];
  59818. $self._assert_equals_($recv([(6).__at((8))
  59819. ,$ctx1.sendIdx["@"]=7
  59820. ][0]).__slash((3).__at((4))),$recv($globals.Point)._x_y_((2),(2)));
  59821. return self;
  59822. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{})});
  59823. }; }),
  59824. $globals.PointTest);
  59825. $core.addMethod(
  59826. $core.method({
  59827. selector: "testAt",
  59828. protocol: "tests",
  59829. args: [],
  59830. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  59831. referencedClasses: ["Point"],
  59832. pragmas: [],
  59833. messageSends: ["assert:equals:", "@", "x:y:"]
  59834. }, function ($methodClass){ return function (){
  59835. var self=this,$self=this;
  59836. return $core.withContext(function($ctx1) {
  59837. $self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  59838. return self;
  59839. }, function($ctx1) {$ctx1.fill(self,"testAt",{})});
  59840. }; }),
  59841. $globals.PointTest);
  59842. $core.addMethod(
  59843. $core.method({
  59844. selector: "testComparison",
  59845. protocol: "tests",
  59846. args: [],
  59847. 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)",
  59848. referencedClasses: [],
  59849. pragmas: [],
  59850. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  59851. }, function ($methodClass){ return function (){
  59852. var self=this,$self=this;
  59853. return $core.withContext(function($ctx1) {
  59854. [$self._assert_([$recv([(3).__at((4))
  59855. ,$ctx1.sendIdx["@"]=1
  59856. ][0]).__lt([(4).__at((5))
  59857. ,$ctx1.sendIdx["@"]=2
  59858. ][0])
  59859. ,$ctx1.sendIdx["<"]=1
  59860. ][0])
  59861. ,$ctx1.sendIdx["assert:"]=1
  59862. ][0];
  59863. [$self._deny_($recv([(3).__at((4))
  59864. ,$ctx1.sendIdx["@"]=3
  59865. ][0]).__lt([(4).__at((4))
  59866. ,$ctx1.sendIdx["@"]=4
  59867. ][0]))
  59868. ,$ctx1.sendIdx["deny:"]=1
  59869. ][0];
  59870. [$self._assert_([$recv([(4).__at((5))
  59871. ,$ctx1.sendIdx["@"]=5
  59872. ][0]).__lt_eq([(4).__at((5))
  59873. ,$ctx1.sendIdx["@"]=6
  59874. ][0])
  59875. ,$ctx1.sendIdx["<="]=1
  59876. ][0])
  59877. ,$ctx1.sendIdx["assert:"]=2
  59878. ][0];
  59879. [$self._deny_($recv([(4).__at((5))
  59880. ,$ctx1.sendIdx["@"]=7
  59881. ][0]).__lt_eq([(3).__at((5))
  59882. ,$ctx1.sendIdx["@"]=8
  59883. ][0]))
  59884. ,$ctx1.sendIdx["deny:"]=2
  59885. ][0];
  59886. [$self._assert_([$recv([(5).__at((6))
  59887. ,$ctx1.sendIdx["@"]=9
  59888. ][0]).__gt([(4).__at((5))
  59889. ,$ctx1.sendIdx["@"]=10
  59890. ][0])
  59891. ,$ctx1.sendIdx[">"]=1
  59892. ][0])
  59893. ,$ctx1.sendIdx["assert:"]=3
  59894. ][0];
  59895. [$self._deny_($recv([(5).__at((6))
  59896. ,$ctx1.sendIdx["@"]=11
  59897. ][0]).__gt([(6).__at((6))
  59898. ,$ctx1.sendIdx["@"]=12
  59899. ][0]))
  59900. ,$ctx1.sendIdx["deny:"]=3
  59901. ][0];
  59902. $self._assert_([$recv([(4).__at((5))
  59903. ,$ctx1.sendIdx["@"]=13
  59904. ][0]).__gt_eq([(4).__at((5))
  59905. ,$ctx1.sendIdx["@"]=14
  59906. ][0])
  59907. ,$ctx1.sendIdx[">="]=1
  59908. ][0]);
  59909. $self._deny_($recv([(4).__at((5))
  59910. ,$ctx1.sendIdx["@"]=15
  59911. ][0]).__gt_eq((5).__at((5))));
  59912. return self;
  59913. }, function($ctx1) {$ctx1.fill(self,"testComparison",{})});
  59914. }; }),
  59915. $globals.PointTest);
  59916. $core.addMethod(
  59917. $core.method({
  59918. selector: "testDotProduct",
  59919. protocol: "tests",
  59920. args: [],
  59921. source: "testDotProduct\x0a\x09self assert: (2@3 dotProduct: 3@7) equals: 27",
  59922. referencedClasses: [],
  59923. pragmas: [],
  59924. messageSends: ["assert:equals:", "dotProduct:", "@"]
  59925. }, function ($methodClass){ return function (){
  59926. var self=this,$self=this;
  59927. return $core.withContext(function($ctx1) {
  59928. $self._assert_equals_($recv([(2).__at((3))
  59929. ,$ctx1.sendIdx["@"]=1
  59930. ][0])._dotProduct_((3).__at((7))),(27));
  59931. return self;
  59932. }, function($ctx1) {$ctx1.fill(self,"testDotProduct",{})});
  59933. }; }),
  59934. $globals.PointTest);
  59935. $core.addMethod(
  59936. $core.method({
  59937. selector: "testEgality",
  59938. protocol: "tests",
  59939. args: [],
  59940. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  59941. referencedClasses: [],
  59942. pragmas: [],
  59943. messageSends: ["assert:", "=", "@", "deny:"]
  59944. }, function ($methodClass){ return function (){
  59945. var self=this,$self=this;
  59946. return $core.withContext(function($ctx1) {
  59947. $self._assert_([$recv([(3).__at((4))
  59948. ,$ctx1.sendIdx["@"]=1
  59949. ][0]).__eq([(3).__at((4))
  59950. ,$ctx1.sendIdx["@"]=2
  59951. ][0])
  59952. ,$ctx1.sendIdx["="]=1
  59953. ][0]);
  59954. $self._deny_($recv([(3).__at((5))
  59955. ,$ctx1.sendIdx["@"]=3
  59956. ][0]).__eq((3).__at((6))));
  59957. return self;
  59958. }, function($ctx1) {$ctx1.fill(self,"testEgality",{})});
  59959. }; }),
  59960. $globals.PointTest);
  59961. $core.addMethod(
  59962. $core.method({
  59963. selector: "testNew",
  59964. protocol: "tests",
  59965. args: [],
  59966. 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",
  59967. referencedClasses: ["Point"],
  59968. pragmas: [],
  59969. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  59970. }, function ($methodClass){ return function (){
  59971. var self=this,$self=this;
  59972. return $core.withContext(function($ctx1) {
  59973. [$self._assert_equals_([$recv([$recv([$recv($globals.Point)._new()
  59974. ,$ctx1.sendIdx["new"]=1
  59975. ][0])._x_((3))
  59976. ,$ctx1.sendIdx["x:"]=1
  59977. ][0])._y()
  59978. ,$ctx1.sendIdx["y"]=1
  59979. ][0],nil)
  59980. ,$ctx1.sendIdx["assert:equals:"]=1
  59981. ][0];
  59982. [$self._deny_([$recv([$recv($recv([$recv($globals.Point)._new()
  59983. ,$ctx1.sendIdx["new"]=2
  59984. ][0])._x_((3)))._x()
  59985. ,$ctx1.sendIdx["x"]=1
  59986. ][0]).__eq((0))
  59987. ,$ctx1.sendIdx["="]=1
  59988. ][0])
  59989. ,$ctx1.sendIdx["deny:"]=1
  59990. ][0];
  59991. $self._assert_equals_($recv([$recv([$recv($globals.Point)._new()
  59992. ,$ctx1.sendIdx["new"]=3
  59993. ][0])._y_((4))
  59994. ,$ctx1.sendIdx["y:"]=1
  59995. ][0])._x(),nil);
  59996. $self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  59997. return self;
  59998. }, function($ctx1) {$ctx1.fill(self,"testNew",{})});
  59999. }; }),
  60000. $globals.PointTest);
  60001. $core.addMethod(
  60002. $core.method({
  60003. selector: "testNormal",
  60004. protocol: "tests",
  60005. args: [],
  60006. source: "testNormal\x0a\x09self assert: (1@0) normal equals: 0@1",
  60007. referencedClasses: [],
  60008. pragmas: [],
  60009. messageSends: ["assert:equals:", "normal", "@"]
  60010. }, function ($methodClass){ return function (){
  60011. var self=this,$self=this;
  60012. return $core.withContext(function($ctx1) {
  60013. $self._assert_equals_($recv([(1).__at((0))
  60014. ,$ctx1.sendIdx["@"]=1
  60015. ][0])._normal(),(0).__at((1)));
  60016. return self;
  60017. }, function($ctx1) {$ctx1.fill(self,"testNormal",{})});
  60018. }; }),
  60019. $globals.PointTest);
  60020. $core.addMethod(
  60021. $core.method({
  60022. selector: "testNormalized",
  60023. protocol: "tests",
  60024. args: [],
  60025. source: "testNormalized\x0a\x09self assert: (0@2) normalized equals: 0@1.\x0a\x09self assert: (0@0) normalized equals: 0@0.",
  60026. referencedClasses: [],
  60027. pragmas: [],
  60028. messageSends: ["assert:equals:", "normalized", "@"]
  60029. }, function ($methodClass){ return function (){
  60030. var self=this,$self=this;
  60031. return $core.withContext(function($ctx1) {
  60032. [$self._assert_equals_([$recv([(0).__at((2))
  60033. ,$ctx1.sendIdx["@"]=1
  60034. ][0])._normalized()
  60035. ,$ctx1.sendIdx["normalized"]=1
  60036. ][0],[(0).__at((1))
  60037. ,$ctx1.sendIdx["@"]=2
  60038. ][0])
  60039. ,$ctx1.sendIdx["assert:equals:"]=1
  60040. ][0];
  60041. $self._assert_equals_($recv([(0).__at((0))
  60042. ,$ctx1.sendIdx["@"]=3
  60043. ][0])._normalized(),(0).__at((0)));
  60044. return self;
  60045. }, function($ctx1) {$ctx1.fill(self,"testNormalized",{})});
  60046. }; }),
  60047. $globals.PointTest);
  60048. $core.addMethod(
  60049. $core.method({
  60050. selector: "testPolarCoordinates",
  60051. protocol: "tests",
  60052. args: [],
  60053. source: "testPolarCoordinates\x0a\x09self assert: (1@0) r equals: 1.\x0a\x09self assert: (0@0) r equals: 0.",
  60054. referencedClasses: [],
  60055. pragmas: [],
  60056. messageSends: ["assert:equals:", "r", "@"]
  60057. }, function ($methodClass){ return function (){
  60058. var self=this,$self=this;
  60059. return $core.withContext(function($ctx1) {
  60060. [$self._assert_equals_([$recv([(1).__at((0))
  60061. ,$ctx1.sendIdx["@"]=1
  60062. ][0])._r()
  60063. ,$ctx1.sendIdx["r"]=1
  60064. ][0],(1))
  60065. ,$ctx1.sendIdx["assert:equals:"]=1
  60066. ][0];
  60067. $self._assert_equals_($recv((0).__at((0)))._r(),(0));
  60068. return self;
  60069. }, function($ctx1) {$ctx1.fill(self,"testPolarCoordinates",{})});
  60070. }; }),
  60071. $globals.PointTest);
  60072. $core.addMethod(
  60073. $core.method({
  60074. selector: "testRectangleCreation",
  60075. protocol: "tests",
  60076. args: [],
  60077. source: "testRectangleCreation\x0a\x09self assert: (1@1 corner: 2@2) equals: (Rectangle origin: 1@1 corner: 2@2).\x0a\x09self assert: (1@1 rectangle: 2@2) equals: (Rectangle point: 1@1 point: 2@2).\x0a\x09self assert: (1@1 extent: 2@2) equals: (Rectangle origin: 1@1 extent: 2@2)",
  60078. referencedClasses: ["Rectangle"],
  60079. pragmas: [],
  60080. messageSends: ["assert:equals:", "corner:", "@", "origin:corner:", "rectangle:", "point:point:", "extent:", "origin:extent:"]
  60081. }, function ($methodClass){ return function (){
  60082. var self=this,$self=this;
  60083. return $core.withContext(function($ctx1) {
  60084. [$self._assert_equals_($recv([(1).__at((1))
  60085. ,$ctx1.sendIdx["@"]=1
  60086. ][0])._corner_([(2).__at((2))
  60087. ,$ctx1.sendIdx["@"]=2
  60088. ][0]),$recv($globals.Rectangle)._origin_corner_([(1).__at((1))
  60089. ,$ctx1.sendIdx["@"]=3
  60090. ][0],[(2).__at((2))
  60091. ,$ctx1.sendIdx["@"]=4
  60092. ][0]))
  60093. ,$ctx1.sendIdx["assert:equals:"]=1
  60094. ][0];
  60095. [$self._assert_equals_($recv([(1).__at((1))
  60096. ,$ctx1.sendIdx["@"]=5
  60097. ][0])._rectangle_([(2).__at((2))
  60098. ,$ctx1.sendIdx["@"]=6
  60099. ][0]),$recv($globals.Rectangle)._point_point_([(1).__at((1))
  60100. ,$ctx1.sendIdx["@"]=7
  60101. ][0],[(2).__at((2))
  60102. ,$ctx1.sendIdx["@"]=8
  60103. ][0]))
  60104. ,$ctx1.sendIdx["assert:equals:"]=2
  60105. ][0];
  60106. $self._assert_equals_($recv([(1).__at((1))
  60107. ,$ctx1.sendIdx["@"]=9
  60108. ][0])._extent_([(2).__at((2))
  60109. ,$ctx1.sendIdx["@"]=10
  60110. ][0]),$recv($globals.Rectangle)._origin_extent_([(1).__at((1))
  60111. ,$ctx1.sendIdx["@"]=11
  60112. ][0],(2).__at((2))));
  60113. return self;
  60114. }, function($ctx1) {$ctx1.fill(self,"testRectangleCreation",{})});
  60115. }; }),
  60116. $globals.PointTest);
  60117. $core.addMethod(
  60118. $core.method({
  60119. selector: "testTranslateBy",
  60120. protocol: "tests",
  60121. args: [],
  60122. 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.",
  60123. referencedClasses: [],
  60124. pragmas: [],
  60125. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  60126. }, function ($methodClass){ return function (){
  60127. var self=this,$self=this;
  60128. return $core.withContext(function($ctx1) {
  60129. [$self._assert_equals_([$recv([(3).__at((3))
  60130. ,$ctx1.sendIdx["@"]=1
  60131. ][0])._translateBy_([(0).__at((1))
  60132. ,$ctx1.sendIdx["@"]=2
  60133. ][0])
  60134. ,$ctx1.sendIdx["translateBy:"]=1
  60135. ][0],[(3).__at((4))
  60136. ,$ctx1.sendIdx["@"]=3
  60137. ][0])
  60138. ,$ctx1.sendIdx["assert:equals:"]=1
  60139. ][0];
  60140. [$self._assert_equals_([$recv([(3).__at((3))
  60141. ,$ctx1.sendIdx["@"]=4
  60142. ][0])._translateBy_([(0).__at([(1)._negated()
  60143. ,$ctx1.sendIdx["negated"]=1
  60144. ][0])
  60145. ,$ctx1.sendIdx["@"]=5
  60146. ][0])
  60147. ,$ctx1.sendIdx["translateBy:"]=2
  60148. ][0],[(3).__at((2))
  60149. ,$ctx1.sendIdx["@"]=6
  60150. ][0])
  60151. ,$ctx1.sendIdx["assert:equals:"]=2
  60152. ][0];
  60153. [$self._assert_equals_([$recv([(3).__at((3))
  60154. ,$ctx1.sendIdx["@"]=7
  60155. ][0])._translateBy_([(2).__at((3))
  60156. ,$ctx1.sendIdx["@"]=8
  60157. ][0])
  60158. ,$ctx1.sendIdx["translateBy:"]=3
  60159. ][0],[(5).__at((6))
  60160. ,$ctx1.sendIdx["@"]=9
  60161. ][0])
  60162. ,$ctx1.sendIdx["assert:equals:"]=3
  60163. ][0];
  60164. $self._assert_equals_($recv([(3).__at((3))
  60165. ,$ctx1.sendIdx["@"]=10
  60166. ][0])._translateBy_([$recv((3)._negated()).__at((0))
  60167. ,$ctx1.sendIdx["@"]=11
  60168. ][0]),(0).__at((3)));
  60169. return self;
  60170. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{})});
  60171. }; }),
  60172. $globals.PointTest);
  60173. $core.addClass("QueueTest", $globals.TestCase, [], "Kernel-Tests");
  60174. $core.addMethod(
  60175. $core.method({
  60176. selector: "testNextIfAbsent",
  60177. protocol: "tests",
  60178. args: [],
  60179. 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'",
  60180. referencedClasses: ["Queue"],
  60181. pragmas: [],
  60182. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  60183. }, function ($methodClass){ return function (){
  60184. var self=this,$self=this;
  60185. var queue;
  60186. return $core.withContext(function($ctx1) {
  60187. queue=$recv($globals.Queue)._new();
  60188. $recv(queue)._nextPut_("index1");
  60189. $self._assert_([$recv([$recv(queue)._nextIfAbsent_("empty")
  60190. ,$ctx1.sendIdx["nextIfAbsent:"]=1
  60191. ][0]).__eq("index1")
  60192. ,$ctx1.sendIdx["="]=1
  60193. ][0]);
  60194. $self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  60195. return self;
  60196. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue})});
  60197. }; }),
  60198. $globals.QueueTest);
  60199. $core.addMethod(
  60200. $core.method({
  60201. selector: "testQueueNext",
  60202. protocol: "tests",
  60203. args: [],
  60204. 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",
  60205. referencedClasses: ["Queue", "Error"],
  60206. pragmas: [],
  60207. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  60208. }, function ($methodClass){ return function (){
  60209. var self=this,$self=this;
  60210. var queue;
  60211. return $core.withContext(function($ctx1) {
  60212. var $1;
  60213. queue=$recv($globals.Queue)._new();
  60214. $1=queue;
  60215. [$recv($1)._nextPut_("index1")
  60216. ,$ctx1.sendIdx["nextPut:"]=1
  60217. ][0];
  60218. $recv($1)._nextPut_("index2");
  60219. $self._assert_([$recv([$recv(queue)._next()
  60220. ,$ctx1.sendIdx["next"]=1
  60221. ][0]).__eq("index1")
  60222. ,$ctx1.sendIdx["="]=1
  60223. ][0]);
  60224. $self._deny_($recv([$recv(queue)._next()
  60225. ,$ctx1.sendIdx["next"]=2
  60226. ][0]).__eq("index"));
  60227. $self._should_raise_((function(){
  60228. return $core.withContext(function($ctx2) {
  60229. return $recv(queue)._next();
  60230. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60231. }),$globals.Error);
  60232. return self;
  60233. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue})});
  60234. }; }),
  60235. $globals.QueueTest);
  60236. $core.addClass("RandomTest", $globals.TestCase, [], "Kernel-Tests");
  60237. $core.addMethod(
  60238. $core.method({
  60239. selector: "testAtRandomNumber",
  60240. protocol: "tests",
  60241. args: [],
  60242. 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]",
  60243. referencedClasses: [],
  60244. pragmas: [],
  60245. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  60246. }, function ($methodClass){ return function (){
  60247. var self=this,$self=this;
  60248. var val;
  60249. return $core.withContext(function($ctx1) {
  60250. (100)._timesRepeat_((function(){
  60251. return $core.withContext(function($ctx2) {
  60252. val=(10)._atRandom();
  60253. [$self._assert_($recv(val).__gt((0)))
  60254. ,$ctx2.sendIdx["assert:"]=1
  60255. ][0];
  60256. return $self._assert_($recv(val).__lt((11)));
  60257. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60258. }));
  60259. return self;
  60260. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val})});
  60261. }; }),
  60262. $globals.RandomTest);
  60263. $core.addMethod(
  60264. $core.method({
  60265. selector: "testAtRandomSequenceableCollection",
  60266. protocol: "tests",
  60267. args: [],
  60268. 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].",
  60269. referencedClasses: [],
  60270. pragmas: [],
  60271. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  60272. }, function ($methodClass){ return function (){
  60273. var self=this,$self=this;
  60274. var val;
  60275. return $core.withContext(function($ctx1) {
  60276. (100)._timesRepeat_((function(){
  60277. return $core.withContext(function($ctx2) {
  60278. val="abc"._atRandom();
  60279. return $self._assert_([$recv($recv([$recv(val).__eq("a")
  60280. ,$ctx2.sendIdx["="]=1
  60281. ][0]).__or([$recv(val).__eq("b")
  60282. ,$ctx2.sendIdx["="]=2
  60283. ][0])).__or($recv(val).__eq("c"))
  60284. ,$ctx2.sendIdx["|"]=1
  60285. ][0]);
  60286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60287. }));
  60288. return self;
  60289. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val})});
  60290. }; }),
  60291. $globals.RandomTest);
  60292. $core.addMethod(
  60293. $core.method({
  60294. selector: "textNext",
  60295. protocol: "tests",
  60296. args: [],
  60297. 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 ]",
  60298. referencedClasses: ["Random"],
  60299. pragmas: [],
  60300. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  60301. }, function ($methodClass){ return function (){
  60302. var self=this,$self=this;
  60303. return $core.withContext(function($ctx1) {
  60304. (10000)._timesRepeat_((function(){
  60305. var current,next;
  60306. return $core.withContext(function($ctx2) {
  60307. next=$recv($recv($globals.Random)._new())._next();
  60308. [$self._assert_($recv(next).__gt_eq((0)))
  60309. ,$ctx2.sendIdx["assert:"]=1
  60310. ][0];
  60311. $self._assert_($recv(next).__lt((1)));
  60312. $self._deny_([$recv(current).__eq(next)
  60313. ,$ctx2.sendIdx["="]=1
  60314. ][0]);
  60315. return $recv(next).__eq(current);
  60316. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  60317. }));
  60318. return self;
  60319. }, function($ctx1) {$ctx1.fill(self,"textNext",{})});
  60320. }; }),
  60321. $globals.RandomTest);
  60322. $core.addClass("RectangleTest", $globals.TestCase, [], "Kernel-Tests");
  60323. $core.addMethod(
  60324. $core.method({
  60325. selector: "testContainsPoint",
  60326. protocol: "tests",
  60327. args: [],
  60328. source: "testContainsPoint\x0a\x09| rect |\x0a\x09rect := Rectangle origin: 0@0 corner: 4@4.\x0a\x09\x0a\x09self assert: (rect containsPoint: 1@2).\x0a\x09self assert: (rect containsPoint: 5@4) not.",
  60329. referencedClasses: ["Rectangle"],
  60330. pragmas: [],
  60331. messageSends: ["origin:corner:", "@", "assert:", "containsPoint:", "not"]
  60332. }, function ($methodClass){ return function (){
  60333. var self=this,$self=this;
  60334. var rect;
  60335. return $core.withContext(function($ctx1) {
  60336. rect=$recv($globals.Rectangle)._origin_corner_([(0).__at((0))
  60337. ,$ctx1.sendIdx["@"]=1
  60338. ][0],[(4).__at((4))
  60339. ,$ctx1.sendIdx["@"]=2
  60340. ][0]);
  60341. [$self._assert_([$recv(rect)._containsPoint_([(1).__at((2))
  60342. ,$ctx1.sendIdx["@"]=3
  60343. ][0])
  60344. ,$ctx1.sendIdx["containsPoint:"]=1
  60345. ][0])
  60346. ,$ctx1.sendIdx["assert:"]=1
  60347. ][0];
  60348. $self._assert_($recv($recv(rect)._containsPoint_((5).__at((4))))._not());
  60349. return self;
  60350. }, function($ctx1) {$ctx1.fill(self,"testContainsPoint",{rect:rect})});
  60351. }; }),
  60352. $globals.RectangleTest);
  60353. $core.addMethod(
  60354. $core.method({
  60355. selector: "testContainsRect",
  60356. protocol: "tests",
  60357. args: [],
  60358. source: "testContainsRect\x0a\x09self assert: ((Rectangle origin: 0@0 corner: 6@6) containsRect: (Rectangle origin: 1@1 corner: 5@5)).\x0a\x09self assert: ((Rectangle origin: 0@0 corner: 6@6) containsRect: (Rectangle origin: 1@(-1) corner: 5@5)) not.",
  60359. referencedClasses: ["Rectangle"],
  60360. pragmas: [],
  60361. messageSends: ["assert:", "containsRect:", "origin:corner:", "@", "not"]
  60362. }, function ($methodClass){ return function (){
  60363. var self=this,$self=this;
  60364. return $core.withContext(function($ctx1) {
  60365. [$self._assert_([$recv([$recv($globals.Rectangle)._origin_corner_([(0).__at((0))
  60366. ,$ctx1.sendIdx["@"]=1
  60367. ][0],[(6).__at((6))
  60368. ,$ctx1.sendIdx["@"]=2
  60369. ][0])
  60370. ,$ctx1.sendIdx["origin:corner:"]=1
  60371. ][0])._containsRect_([$recv($globals.Rectangle)._origin_corner_([(1).__at((1))
  60372. ,$ctx1.sendIdx["@"]=3
  60373. ][0],[(5).__at((5))
  60374. ,$ctx1.sendIdx["@"]=4
  60375. ][0])
  60376. ,$ctx1.sendIdx["origin:corner:"]=2
  60377. ][0])
  60378. ,$ctx1.sendIdx["containsRect:"]=1
  60379. ][0])
  60380. ,$ctx1.sendIdx["assert:"]=1
  60381. ][0];
  60382. $self._assert_($recv($recv([$recv($globals.Rectangle)._origin_corner_([(0).__at((0))
  60383. ,$ctx1.sendIdx["@"]=5
  60384. ][0],[(6).__at((6))
  60385. ,$ctx1.sendIdx["@"]=6
  60386. ][0])
  60387. ,$ctx1.sendIdx["origin:corner:"]=3
  60388. ][0])._containsRect_($recv($globals.Rectangle)._origin_corner_([(1).__at((-1))
  60389. ,$ctx1.sendIdx["@"]=7
  60390. ][0],(5).__at((5)))))._not());
  60391. return self;
  60392. }, function($ctx1) {$ctx1.fill(self,"testContainsRect",{})});
  60393. }; }),
  60394. $globals.RectangleTest);
  60395. $core.addMethod(
  60396. $core.method({
  60397. selector: "testOriginExtent",
  60398. protocol: "tests",
  60399. args: [],
  60400. source: "testOriginExtent\x0a\x09| rectangle |\x0a\x09rectangle := Rectangle origin: 3@4 extent: 7@8.\x0a\x09\x0a\x09self assert: rectangle origin equals: 3@4.\x0a\x09self assert: rectangle corner equals: 10@12.",
  60401. referencedClasses: ["Rectangle"],
  60402. pragmas: [],
  60403. messageSends: ["origin:extent:", "@", "assert:equals:", "origin", "corner"]
  60404. }, function ($methodClass){ return function (){
  60405. var self=this,$self=this;
  60406. var rectangle;
  60407. return $core.withContext(function($ctx1) {
  60408. rectangle=$recv($globals.Rectangle)._origin_extent_([(3).__at((4))
  60409. ,$ctx1.sendIdx["@"]=1
  60410. ][0],[(7).__at((8))
  60411. ,$ctx1.sendIdx["@"]=2
  60412. ][0]);
  60413. [$self._assert_equals_($recv(rectangle)._origin(),[(3).__at((4))
  60414. ,$ctx1.sendIdx["@"]=3
  60415. ][0])
  60416. ,$ctx1.sendIdx["assert:equals:"]=1
  60417. ][0];
  60418. $self._assert_equals_($recv(rectangle)._corner(),(10).__at((12)));
  60419. return self;
  60420. }, function($ctx1) {$ctx1.fill(self,"testOriginExtent",{rectangle:rectangle})});
  60421. }; }),
  60422. $globals.RectangleTest);
  60423. $core.addClass("StreamTest", $globals.TestCase, [], "Kernel-Tests");
  60424. $core.addMethod(
  60425. $core.method({
  60426. selector: "collectionClass",
  60427. protocol: "accessing",
  60428. args: [],
  60429. source: "collectionClass\x0a\x09^ self class collectionClass",
  60430. referencedClasses: [],
  60431. pragmas: [],
  60432. messageSends: ["collectionClass", "class"]
  60433. }, function ($methodClass){ return function (){
  60434. var self=this,$self=this;
  60435. return $core.withContext(function($ctx1) {
  60436. return $recv($self._class())._collectionClass();
  60437. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{})});
  60438. }; }),
  60439. $globals.StreamTest);
  60440. $core.addMethod(
  60441. $core.method({
  60442. selector: "newCollection",
  60443. protocol: "accessing",
  60444. args: [],
  60445. source: "newCollection\x0a\x09^ self collectionClass new",
  60446. referencedClasses: [],
  60447. pragmas: [],
  60448. messageSends: ["new", "collectionClass"]
  60449. }, function ($methodClass){ return function (){
  60450. var self=this,$self=this;
  60451. return $core.withContext(function($ctx1) {
  60452. return $recv($self._collectionClass())._new();
  60453. }, function($ctx1) {$ctx1.fill(self,"newCollection",{})});
  60454. }; }),
  60455. $globals.StreamTest);
  60456. $core.addMethod(
  60457. $core.method({
  60458. selector: "newStream",
  60459. protocol: "accessing",
  60460. args: [],
  60461. source: "newStream\x0a\x09^ self collectionClass new stream",
  60462. referencedClasses: [],
  60463. pragmas: [],
  60464. messageSends: ["stream", "new", "collectionClass"]
  60465. }, function ($methodClass){ return function (){
  60466. var self=this,$self=this;
  60467. return $core.withContext(function($ctx1) {
  60468. return $recv($recv($self._collectionClass())._new())._stream();
  60469. }, function($ctx1) {$ctx1.fill(self,"newStream",{})});
  60470. }; }),
  60471. $globals.StreamTest);
  60472. $core.addMethod(
  60473. $core.method({
  60474. selector: "testAtStartAtEnd",
  60475. protocol: "tests",
  60476. args: [],
  60477. 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",
  60478. referencedClasses: [],
  60479. pragmas: [],
  60480. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  60481. }, function ($methodClass){ return function (){
  60482. var self=this,$self=this;
  60483. var stream;
  60484. return $core.withContext(function($ctx1) {
  60485. stream=$self._newStream();
  60486. [$self._assert_([$recv(stream)._atStart()
  60487. ,$ctx1.sendIdx["atStart"]=1
  60488. ][0])
  60489. ,$ctx1.sendIdx["assert:"]=1
  60490. ][0];
  60491. [$self._assert_([$recv(stream)._atEnd()
  60492. ,$ctx1.sendIdx["atEnd"]=1
  60493. ][0])
  60494. ,$ctx1.sendIdx["assert:"]=2
  60495. ][0];
  60496. $recv(stream)._nextPutAll_($self._newCollection());
  60497. $self._assert_([$recv(stream)._atEnd()
  60498. ,$ctx1.sendIdx["atEnd"]=2
  60499. ][0]);
  60500. [$self._deny_([$recv(stream)._atStart()
  60501. ,$ctx1.sendIdx["atStart"]=2
  60502. ][0])
  60503. ,$ctx1.sendIdx["deny:"]=1
  60504. ][0];
  60505. $recv(stream)._position_((1));
  60506. [$self._deny_($recv(stream)._atEnd())
  60507. ,$ctx1.sendIdx["deny:"]=2
  60508. ][0];
  60509. $self._deny_($recv(stream)._atStart());
  60510. return self;
  60511. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream})});
  60512. }; }),
  60513. $globals.StreamTest);
  60514. $core.addMethod(
  60515. $core.method({
  60516. selector: "testContents",
  60517. protocol: "tests",
  60518. args: [],
  60519. 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",
  60520. referencedClasses: [],
  60521. pragmas: [],
  60522. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  60523. }, function ($methodClass){ return function (){
  60524. var self=this,$self=this;
  60525. var stream;
  60526. return $core.withContext(function($ctx1) {
  60527. stream=$self._newStream();
  60528. $recv(stream)._nextPutAll_([$self._newCollection()
  60529. ,$ctx1.sendIdx["newCollection"]=1
  60530. ][0]);
  60531. $self._assert_equals_($recv(stream)._contents(),$self._newCollection());
  60532. return self;
  60533. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream})});
  60534. }; }),
  60535. $globals.StreamTest);
  60536. $core.addMethod(
  60537. $core.method({
  60538. selector: "testIsEmpty",
  60539. protocol: "tests",
  60540. args: [],
  60541. 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",
  60542. referencedClasses: [],
  60543. pragmas: [],
  60544. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  60545. }, function ($methodClass){ return function (){
  60546. var self=this,$self=this;
  60547. var stream;
  60548. return $core.withContext(function($ctx1) {
  60549. stream=$self._newStream();
  60550. $self._assert_([$recv(stream)._isEmpty()
  60551. ,$ctx1.sendIdx["isEmpty"]=1
  60552. ][0]);
  60553. $recv(stream)._nextPutAll_($self._newCollection());
  60554. $self._deny_($recv(stream)._isEmpty());
  60555. return self;
  60556. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream})});
  60557. }; }),
  60558. $globals.StreamTest);
  60559. $core.addMethod(
  60560. $core.method({
  60561. selector: "testPosition",
  60562. protocol: "tests",
  60563. args: [],
  60564. 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",
  60565. referencedClasses: [],
  60566. pragmas: [],
  60567. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  60568. }, function ($methodClass){ return function (){
  60569. var self=this,$self=this;
  60570. var collection,stream;
  60571. return $core.withContext(function($ctx1) {
  60572. collection=$self._newCollection();
  60573. stream=$self._newStream();
  60574. $recv(stream)._nextPutAll_(collection);
  60575. [$self._assert_equals_([$recv(stream)._position()
  60576. ,$ctx1.sendIdx["position"]=1
  60577. ][0],$recv(collection)._size())
  60578. ,$ctx1.sendIdx["assert:equals:"]=1
  60579. ][0];
  60580. $recv(stream)._position_((0));
  60581. [$self._assert_equals_([$recv(stream)._position()
  60582. ,$ctx1.sendIdx["position"]=2
  60583. ][0],(0))
  60584. ,$ctx1.sendIdx["assert:equals:"]=2
  60585. ][0];
  60586. [$recv(stream)._next()
  60587. ,$ctx1.sendIdx["next"]=1
  60588. ][0];
  60589. [$self._assert_equals_([$recv(stream)._position()
  60590. ,$ctx1.sendIdx["position"]=3
  60591. ][0],(1))
  60592. ,$ctx1.sendIdx["assert:equals:"]=3
  60593. ][0];
  60594. $recv(stream)._next();
  60595. $self._assert_equals_($recv(stream)._position(),(2));
  60596. return self;
  60597. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream})});
  60598. }; }),
  60599. $globals.StreamTest);
  60600. $core.addMethod(
  60601. $core.method({
  60602. selector: "testReading",
  60603. protocol: "tests",
  60604. args: [],
  60605. 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",
  60606. referencedClasses: [],
  60607. pragmas: [],
  60608. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  60609. }, function ($methodClass){ return function (){
  60610. var self=this,$self=this;
  60611. var stream,collection;
  60612. return $core.withContext(function($ctx1) {
  60613. var $1;
  60614. collection=$self._newCollection();
  60615. stream=$self._newStream();
  60616. $1=stream;
  60617. $recv($1)._nextPutAll_(collection);
  60618. $recv($1)._position_((0));
  60619. $recv(collection)._do_((function(each){
  60620. return $core.withContext(function($ctx2) {
  60621. return $self._assert_equals_([$recv(stream)._next()
  60622. ,$ctx2.sendIdx["next"]=1
  60623. ][0],each);
  60624. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60625. }));
  60626. $self._assert_($recv($recv(stream)._next())._isNil());
  60627. return self;
  60628. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection})});
  60629. }; }),
  60630. $globals.StreamTest);
  60631. $core.addMethod(
  60632. $core.method({
  60633. selector: "testStreamContents",
  60634. protocol: "tests",
  60635. args: [],
  60636. source: "testStreamContents",
  60637. referencedClasses: [],
  60638. pragmas: [],
  60639. messageSends: []
  60640. }, function ($methodClass){ return function (){
  60641. var self=this,$self=this;
  60642. return self;
  60643. }; }),
  60644. $globals.StreamTest);
  60645. $core.addMethod(
  60646. $core.method({
  60647. selector: "testWrite",
  60648. protocol: "tests",
  60649. args: [],
  60650. 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",
  60651. referencedClasses: [],
  60652. pragmas: [],
  60653. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  60654. }, function ($methodClass){ return function (){
  60655. var self=this,$self=this;
  60656. var stream,collection;
  60657. return $core.withContext(function($ctx1) {
  60658. collection=$self._newCollection();
  60659. stream=$self._newStream();
  60660. $recv(collection)._do_((function(each){
  60661. return $core.withContext(function($ctx2) {
  60662. return $recv(stream).__lt_lt(each);
  60663. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60664. }));
  60665. $self._assert_equals_($recv(stream)._contents(),collection);
  60666. return self;
  60667. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection})});
  60668. }; }),
  60669. $globals.StreamTest);
  60670. $core.addMethod(
  60671. $core.method({
  60672. selector: "testWriting",
  60673. protocol: "tests",
  60674. args: [],
  60675. 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",
  60676. referencedClasses: [],
  60677. pragmas: [],
  60678. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  60679. }, function ($methodClass){ return function (){
  60680. var self=this,$self=this;
  60681. var stream,collection;
  60682. return $core.withContext(function($ctx1) {
  60683. collection=$self._newCollection();
  60684. stream=[$self._newStream()
  60685. ,$ctx1.sendIdx["newStream"]=1
  60686. ][0];
  60687. $recv(collection)._do_((function(each){
  60688. return $core.withContext(function($ctx2) {
  60689. return $recv(stream)._nextPut_(each);
  60690. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60691. }));
  60692. [$self._assert_equals_([$recv(stream)._contents()
  60693. ,$ctx1.sendIdx["contents"]=1
  60694. ][0],collection)
  60695. ,$ctx1.sendIdx["assert:equals:"]=1
  60696. ][0];
  60697. stream=$self._newStream();
  60698. $recv(stream)._nextPutAll_(collection);
  60699. $self._assert_equals_($recv(stream)._contents(),collection);
  60700. return self;
  60701. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection})});
  60702. }; }),
  60703. $globals.StreamTest);
  60704. $core.addMethod(
  60705. $core.method({
  60706. selector: "collectionClass",
  60707. protocol: "accessing",
  60708. args: [],
  60709. source: "collectionClass\x0a\x09^ nil",
  60710. referencedClasses: [],
  60711. pragmas: [],
  60712. messageSends: []
  60713. }, function ($methodClass){ return function (){
  60714. var self=this,$self=this;
  60715. return nil;
  60716. }; }),
  60717. $globals.StreamTest.a$cls);
  60718. $core.addMethod(
  60719. $core.method({
  60720. selector: "isAbstract",
  60721. protocol: "testing",
  60722. args: [],
  60723. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  60724. referencedClasses: [],
  60725. pragmas: [],
  60726. messageSends: ["isNil", "collectionClass"]
  60727. }, function ($methodClass){ return function (){
  60728. var self=this,$self=this;
  60729. return $core.withContext(function($ctx1) {
  60730. return $recv($self._collectionClass())._isNil();
  60731. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{})});
  60732. }; }),
  60733. $globals.StreamTest.a$cls);
  60734. $core.addClass("ArrayStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  60735. $core.addMethod(
  60736. $core.method({
  60737. selector: "newCollection",
  60738. protocol: "accessing",
  60739. args: [],
  60740. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  60741. referencedClasses: [],
  60742. pragmas: [],
  60743. messageSends: ["@"]
  60744. }, function ($methodClass){ return function (){
  60745. var self=this,$self=this;
  60746. return $core.withContext(function($ctx1) {
  60747. return [true,(1),(3).__at((4)),"foo"];
  60748. }, function($ctx1) {$ctx1.fill(self,"newCollection",{})});
  60749. }; }),
  60750. $globals.ArrayStreamTest);
  60751. $core.addMethod(
  60752. $core.method({
  60753. selector: "collectionClass",
  60754. protocol: "accessing",
  60755. args: [],
  60756. source: "collectionClass\x0a\x09^ Array",
  60757. referencedClasses: ["Array"],
  60758. pragmas: [],
  60759. messageSends: []
  60760. }, function ($methodClass){ return function (){
  60761. var self=this,$self=this;
  60762. return $globals.Array;
  60763. }; }),
  60764. $globals.ArrayStreamTest.a$cls);
  60765. $core.addClass("StringStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  60766. $core.addMethod(
  60767. $core.method({
  60768. selector: "newCollection",
  60769. protocol: "accessing",
  60770. args: [],
  60771. source: "newCollection\x0a\x09^ 'hello world'",
  60772. referencedClasses: [],
  60773. pragmas: [],
  60774. messageSends: []
  60775. }, function ($methodClass){ return function (){
  60776. var self=this,$self=this;
  60777. return "hello world";
  60778. }; }),
  60779. $globals.StringStreamTest);
  60780. $core.addMethod(
  60781. $core.method({
  60782. selector: "collectionClass",
  60783. protocol: "accessing",
  60784. args: [],
  60785. source: "collectionClass\x0a\x09^ String",
  60786. referencedClasses: ["String"],
  60787. pragmas: [],
  60788. messageSends: []
  60789. }, function ($methodClass){ return function (){
  60790. var self=this,$self=this;
  60791. return $globals.String;
  60792. }; }),
  60793. $globals.StringStreamTest.a$cls);
  60794. $core.addTrait("TClassBuildingTest", "Kernel-Tests");
  60795. $core.addMethod(
  60796. $core.method({
  60797. selector: "assert:isClassCopyOf:",
  60798. protocol: "running",
  60799. args: ["aClass", "anotherClass"],
  60800. source: "assert: aClass isClassCopyOf: anotherClass\x0a\x09self assert: aClass superclass == anotherClass superclass.\x0a\x09self assert: aClass instanceVariableNames == anotherClass instanceVariableNames.\x0a\x09self assert: aClass package == anotherClass package.\x0a\x09self assert: (aClass package classes includes: aClass).\x0a\x09self assert: aClass methodDictionary keys equals: anotherClass methodDictionary keys",
  60801. referencedClasses: [],
  60802. pragmas: [],
  60803. messageSends: ["assert:", "==", "superclass", "instanceVariableNames", "package", "includes:", "classes", "assert:equals:", "keys", "methodDictionary"]
  60804. }, function ($methodClass){ return function (aClass,anotherClass){
  60805. var self=this,$self=this;
  60806. return $core.withContext(function($ctx1) {
  60807. [$self._assert_([$recv([$recv(aClass)._superclass()
  60808. ,$ctx1.sendIdx["superclass"]=1
  60809. ][0]).__eq_eq($recv(anotherClass)._superclass())
  60810. ,$ctx1.sendIdx["=="]=1
  60811. ][0])
  60812. ,$ctx1.sendIdx["assert:"]=1
  60813. ][0];
  60814. [$self._assert_([$recv([$recv(aClass)._instanceVariableNames()
  60815. ,$ctx1.sendIdx["instanceVariableNames"]=1
  60816. ][0]).__eq_eq($recv(anotherClass)._instanceVariableNames())
  60817. ,$ctx1.sendIdx["=="]=2
  60818. ][0])
  60819. ,$ctx1.sendIdx["assert:"]=2
  60820. ][0];
  60821. [$self._assert_($recv([$recv(aClass)._package()
  60822. ,$ctx1.sendIdx["package"]=1
  60823. ][0]).__eq_eq([$recv(anotherClass)._package()
  60824. ,$ctx1.sendIdx["package"]=2
  60825. ][0]))
  60826. ,$ctx1.sendIdx["assert:"]=3
  60827. ][0];
  60828. $self._assert_($recv($recv($recv(aClass)._package())._classes())._includes_(aClass));
  60829. $self._assert_equals_([$recv([$recv(aClass)._methodDictionary()
  60830. ,$ctx1.sendIdx["methodDictionary"]=1
  60831. ][0])._keys()
  60832. ,$ctx1.sendIdx["keys"]=1
  60833. ][0],$recv($recv(anotherClass)._methodDictionary())._keys());
  60834. return self;
  60835. }, function($ctx1) {$ctx1.fill(self,"assert:isClassCopyOf:",{aClass:aClass,anotherClass:anotherClass})});
  60836. }; }),
  60837. $globals.TClassBuildingTest);
  60838. $core.addMethod(
  60839. $core.method({
  60840. selector: "assert:isJavaScriptInstanceOf:",
  60841. protocol: "running",
  60842. args: ["anObject", "aJavaScriptClass"],
  60843. source: "assert: anObject isJavaScriptInstanceOf: aJavaScriptClass\x0a\x09self assert: (self is: anObject javaScriptInstanceOf: aJavaScriptClass)",
  60844. referencedClasses: [],
  60845. pragmas: [],
  60846. messageSends: ["assert:", "is:javaScriptInstanceOf:"]
  60847. }, function ($methodClass){ return function (anObject,aJavaScriptClass){
  60848. var self=this,$self=this;
  60849. return $core.withContext(function($ctx1) {
  60850. $self._assert_($self._is_javaScriptInstanceOf_(anObject,aJavaScriptClass));
  60851. return self;
  60852. }, function($ctx1) {$ctx1.fill(self,"assert:isJavaScriptInstanceOf:",{anObject:anObject,aJavaScriptClass:aJavaScriptClass})});
  60853. }; }),
  60854. $globals.TClassBuildingTest);
  60855. $core.addMethod(
  60856. $core.method({
  60857. selector: "is:javaScriptInstanceOf:",
  60858. protocol: "private",
  60859. args: ["anObject", "aJavaScriptClass"],
  60860. source: "is: anObject javaScriptInstanceOf: aJavaScriptClass\x0a\x09<inlineJS: 'return anObject instanceof aJavaScriptClass'>",
  60861. referencedClasses: [],
  60862. pragmas: [["inlineJS:", ["return anObject instanceof aJavaScriptClass"]]],
  60863. messageSends: []
  60864. }, function ($methodClass){ return function (anObject,aJavaScriptClass){
  60865. var self=this,$self=this;
  60866. return $core.withContext(function($ctx1) {
  60867. return anObject instanceof aJavaScriptClass;
  60868. return self;
  60869. }, function($ctx1) {$ctx1.fill(self,"is:javaScriptInstanceOf:",{anObject:anObject,aJavaScriptClass:aJavaScriptClass})});
  60870. }; }),
  60871. $globals.TClassBuildingTest);
  60872. $core.addMethod(
  60873. $core.method({
  60874. selector: "tearDown",
  60875. protocol: "running",
  60876. args: [],
  60877. source: "tearDown\x0a\x09self theClass ifNotNil: [ :theClass |\x0a\x09\x09(Array streamContents: [ :s | theClass allSubclassesDo: [ :each | s nextPut: each ] ])\x0a\x09\x09\x09reverseDo: [ :each | Smalltalk removeClass: each ].\x0a\x09\x09Smalltalk removeClass: theClass ]",
  60878. referencedClasses: ["Array", "Smalltalk"],
  60879. pragmas: [],
  60880. messageSends: ["ifNotNil:", "theClass", "reverseDo:", "streamContents:", "allSubclassesDo:", "nextPut:", "removeClass:"]
  60881. }, function ($methodClass){ return function (){
  60882. var self=this,$self=this;
  60883. return $core.withContext(function($ctx1) {
  60884. var $1;
  60885. $1=$self._theClass();
  60886. if($1 == null || $1.a$nil){
  60887. $1;
  60888. } else {
  60889. var theClass;
  60890. theClass=$1;
  60891. $recv($recv($globals.Array)._streamContents_((function(s){
  60892. return $core.withContext(function($ctx2) {
  60893. return $recv(theClass)._allSubclassesDo_((function(each){
  60894. return $core.withContext(function($ctx3) {
  60895. return $recv(s)._nextPut_(each);
  60896. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  60897. }));
  60898. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,2)});
  60899. })))._reverseDo_((function(each){
  60900. return $core.withContext(function($ctx2) {
  60901. return [$recv($globals.Smalltalk)._removeClass_(each)
  60902. ,$ctx2.sendIdx["removeClass:"]=1
  60903. ][0];
  60904. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  60905. }));
  60906. $recv($globals.Smalltalk)._removeClass_(theClass);
  60907. }
  60908. return self;
  60909. }, function($ctx1) {$ctx1.fill(self,"tearDown",{})});
  60910. }; }),
  60911. $globals.TClassBuildingTest);
  60912. $core.addMethod(
  60913. $core.method({
  60914. selector: "theClass",
  60915. protocol: "accessing",
  60916. args: [],
  60917. source: "theClass\x0a\x09self subclassResponsibility",
  60918. referencedClasses: [],
  60919. pragmas: [],
  60920. messageSends: ["subclassResponsibility"]
  60921. }, function ($methodClass){ return function (){
  60922. var self=this,$self=this;
  60923. return $core.withContext(function($ctx1) {
  60924. $self._subclassResponsibility();
  60925. return self;
  60926. }, function($ctx1) {$ctx1.fill(self,"theClass",{})});
  60927. }; }),
  60928. $globals.TClassBuildingTest);
  60929. $core.addTrait("TKeyValueCollectionTest", "Kernel-Tests");
  60930. $core.addMethod(
  60931. $core.method({
  60932. selector: "nonIndexesDo:",
  60933. protocol: "fixture",
  60934. args: ["aBlock"],
  60935. source: "nonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility",
  60936. referencedClasses: [],
  60937. pragmas: [],
  60938. messageSends: ["subclassResponsibility"]
  60939. }, function ($methodClass){ return function (aBlock){
  60940. var self=this,$self=this;
  60941. return $core.withContext(function($ctx1) {
  60942. $self._subclassResponsibility();
  60943. return self;
  60944. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock})});
  60945. }; }),
  60946. $globals.TKeyValueCollectionTest);
  60947. $core.addMethod(
  60948. $core.method({
  60949. selector: "sampleNewIndex",
  60950. protocol: "fixture",
  60951. args: [],
  60952. 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",
  60953. referencedClasses: [],
  60954. pragmas: [],
  60955. messageSends: ["subclassResponsibility"]
  60956. }, function ($methodClass){ return function (){
  60957. var self=this,$self=this;
  60958. return $core.withContext(function($ctx1) {
  60959. $self._subclassResponsibility();
  60960. return self;
  60961. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{})});
  60962. }; }),
  60963. $globals.TKeyValueCollectionTest);
  60964. $core.addMethod(
  60965. $core.method({
  60966. selector: "samplesDo:",
  60967. protocol: "fixture",
  60968. args: ["aBlock"],
  60969. 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",
  60970. referencedClasses: [],
  60971. pragmas: [],
  60972. messageSends: ["subclassResponsibility"]
  60973. }, function ($methodClass){ return function (aBlock){
  60974. var self=this,$self=this;
  60975. return $core.withContext(function($ctx1) {
  60976. $self._subclassResponsibility();
  60977. return self;
  60978. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock})});
  60979. }; }),
  60980. $globals.TKeyValueCollectionTest);
  60981. $core.addMethod(
  60982. $core.method({
  60983. selector: "testAt",
  60984. protocol: "tests",
  60985. args: [],
  60986. 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 ]",
  60987. referencedClasses: ["Error"],
  60988. pragmas: [],
  60989. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  60990. }, function ($methodClass){ return function (){
  60991. var self=this,$self=this;
  60992. return $core.withContext(function($ctx1) {
  60993. $self._nonIndexesDo_((function(each){
  60994. return $core.withContext(function($ctx2) {
  60995. return $self._should_raise_((function(){
  60996. return $core.withContext(function($ctx3) {
  60997. return [$recv([$self._collection()
  60998. ,$ctx3.sendIdx["collection"]=1
  60999. ][0])._at_(each)
  61000. ,$ctx3.sendIdx["at:"]=1
  61001. ][0];
  61002. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61003. }),$globals.Error);
  61004. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61005. }));
  61006. $self._samplesDo_((function(index,value){
  61007. return $core.withContext(function($ctx2) {
  61008. return $self._assert_equals_($recv($self._collection())._at_(index),value);
  61009. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  61010. }));
  61011. return self;
  61012. }, function($ctx1) {$ctx1.fill(self,"testAt",{})});
  61013. }; }),
  61014. $globals.TKeyValueCollectionTest);
  61015. $core.addMethod(
  61016. $core.method({
  61017. selector: "testAtIfAbsent",
  61018. protocol: "tests",
  61019. args: [],
  61020. 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 ].",
  61021. referencedClasses: [],
  61022. pragmas: [],
  61023. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  61024. }, function ($methodClass){ return function (){
  61025. var self=this,$self=this;
  61026. return $core.withContext(function($ctx1) {
  61027. $self._nonIndexesDo_((function(each){
  61028. return $core.withContext(function($ctx2) {
  61029. return [$self._assert_equals_([$recv([$self._collection()
  61030. ,$ctx2.sendIdx["collection"]=1
  61031. ][0])._at_ifAbsent_(each,(function(){
  61032. return $core.withContext(function($ctx3) {
  61033. return [$self._sampleNewValue()
  61034. ,$ctx3.sendIdx["sampleNewValue"]=1
  61035. ][0];
  61036. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61037. }))
  61038. ,$ctx2.sendIdx["at:ifAbsent:"]=1
  61039. ][0],[$self._sampleNewValue()
  61040. ,$ctx2.sendIdx["sampleNewValue"]=2
  61041. ][0])
  61042. ,$ctx2.sendIdx["assert:equals:"]=1
  61043. ][0];
  61044. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61045. }));
  61046. $self._samplesDo_((function(index,value){
  61047. return $core.withContext(function($ctx2) {
  61048. return $self._assert_equals_($recv($self._collection())._at_ifAbsent_(index,(function(){
  61049. return $core.withContext(function($ctx3) {
  61050. return $self._sampleNewValue();
  61051. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  61052. })),value);
  61053. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  61054. }));
  61055. return self;
  61056. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{})});
  61057. }; }),
  61058. $globals.TKeyValueCollectionTest);
  61059. $core.addMethod(
  61060. $core.method({
  61061. selector: "testAtIfAbsentPut",
  61062. protocol: "tests",
  61063. args: [],
  61064. 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",
  61065. referencedClasses: [],
  61066. pragmas: [],
  61067. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  61068. }, function ($methodClass){ return function (){
  61069. var self=this,$self=this;
  61070. var newCollection;
  61071. return $core.withContext(function($ctx1) {
  61072. newCollection=[$self._collection()
  61073. ,$ctx1.sendIdx["collection"]=1
  61074. ][0];
  61075. $self._samplesDo_((function(index,value){
  61076. return $core.withContext(function($ctx2) {
  61077. return [$self._assert_equals_([$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  61078. return $core.withContext(function($ctx3) {
  61079. return [$self._sampleNewValue()
  61080. ,$ctx3.sendIdx["sampleNewValue"]=1
  61081. ][0];
  61082. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61083. }))
  61084. ,$ctx2.sendIdx["at:ifAbsentPut:"]=1
  61085. ][0],value)
  61086. ,$ctx2.sendIdx["assert:equals:"]=1
  61087. ][0];
  61088. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  61089. }));
  61090. [$self._assert_equals_(newCollection,$self._collection())
  61091. ,$ctx1.sendIdx["assert:equals:"]=2
  61092. ][0];
  61093. [$self._assert_equals_($recv(newCollection)._at_ifAbsentPut_($self._sampleNewIndex(),(function(){
  61094. return $core.withContext(function($ctx2) {
  61095. return [$self._sampleNewValue()
  61096. ,$ctx2.sendIdx["sampleNewValue"]=2
  61097. ][0];
  61098. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61099. })),$self._sampleNewValue())
  61100. ,$ctx1.sendIdx["assert:equals:"]=3
  61101. ][0];
  61102. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  61103. return self;
  61104. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection})});
  61105. }; }),
  61106. $globals.TKeyValueCollectionTest);
  61107. $core.addMethod(
  61108. $core.method({
  61109. selector: "testAtIfPresent",
  61110. protocol: "tests",
  61111. args: [],
  61112. 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) ]",
  61113. referencedClasses: ["Object"],
  61114. pragmas: [],
  61115. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  61116. }, function ($methodClass){ return function (){
  61117. var self=this,$self=this;
  61118. var visited,sentinel;
  61119. return $core.withContext(function($ctx1) {
  61120. sentinel=$recv($globals.Object)._new();
  61121. $self._nonIndexesDo_((function(each){
  61122. return $core.withContext(function($ctx2) {
  61123. visited=nil;
  61124. [$self._assert_equals_([$recv([$self._collection()
  61125. ,$ctx2.sendIdx["collection"]=1
  61126. ][0])._at_ifPresent_(each,(function(value1){
  61127. visited=value1;
  61128. return sentinel;
  61129. }))
  61130. ,$ctx2.sendIdx["at:ifPresent:"]=1
  61131. ][0],nil)
  61132. ,$ctx2.sendIdx["assert:equals:"]=1
  61133. ][0];
  61134. return $self._assert_($recv(visited)._isNil());
  61135. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61136. }));
  61137. $self._samplesDo_((function(index,value){
  61138. return $core.withContext(function($ctx2) {
  61139. visited=nil;
  61140. [$self._assert_equals_($recv([$self._collection()
  61141. ,$ctx2.sendIdx["collection"]=2
  61142. ][0])._at_ifPresent_(index,(function(value2){
  61143. visited=value2;
  61144. return sentinel;
  61145. })),sentinel)
  61146. ,$ctx2.sendIdx["assert:equals:"]=2
  61147. ][0];
  61148. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  61149. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  61150. }));
  61151. return self;
  61152. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel})});
  61153. }; }),
  61154. $globals.TKeyValueCollectionTest);
  61155. $core.addMethod(
  61156. $core.method({
  61157. selector: "testAtIfPresentIfAbsent",
  61158. protocol: "tests",
  61159. args: [],
  61160. 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) ]",
  61161. referencedClasses: ["Object"],
  61162. pragmas: [],
  61163. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  61164. }, function ($methodClass){ return function (){
  61165. var self=this,$self=this;
  61166. var visited,sentinel;
  61167. return $core.withContext(function($ctx1) {
  61168. sentinel=$recv($globals.Object)._new();
  61169. $self._nonIndexesDo_((function(each){
  61170. return $core.withContext(function($ctx2) {
  61171. visited=nil;
  61172. [$self._assert_equals_([$recv([$self._collection()
  61173. ,$ctx2.sendIdx["collection"]=1
  61174. ][0])._at_ifPresent_ifAbsent_(each,(function(value1){
  61175. visited=value1;
  61176. return sentinel;
  61177. }),(function(){
  61178. return $core.withContext(function($ctx3) {
  61179. return [$self._sampleNewValue()
  61180. ,$ctx3.sendIdx["sampleNewValue"]=1
  61181. ][0];
  61182. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  61183. }))
  61184. ,$ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1
  61185. ][0],[$self._sampleNewValue()
  61186. ,$ctx2.sendIdx["sampleNewValue"]=2
  61187. ][0])
  61188. ,$ctx2.sendIdx["assert:equals:"]=1
  61189. ][0];
  61190. return $self._assert_($recv(visited)._isNil());
  61191. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61192. }));
  61193. $self._samplesDo_((function(index,value){
  61194. return $core.withContext(function($ctx2) {
  61195. visited=nil;
  61196. [$self._assert_equals_($recv([$self._collection()
  61197. ,$ctx2.sendIdx["collection"]=2
  61198. ][0])._at_ifPresent_ifAbsent_(index,(function(value2){
  61199. visited=value2;
  61200. return sentinel;
  61201. }),(function(){
  61202. return $core.withContext(function($ctx3) {
  61203. return $self._sampleNewValue();
  61204. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  61205. })),sentinel)
  61206. ,$ctx2.sendIdx["assert:equals:"]=2
  61207. ][0];
  61208. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  61209. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  61210. }));
  61211. return self;
  61212. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel})});
  61213. }; }),
  61214. $globals.TKeyValueCollectionTest);
  61215. $core.addMethod(
  61216. $core.method({
  61217. selector: "testAtPut",
  61218. protocol: "tests",
  61219. args: [],
  61220. 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",
  61221. referencedClasses: [],
  61222. pragmas: [],
  61223. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  61224. }, function ($methodClass){ return function (){
  61225. var self=this,$self=this;
  61226. var newCollection;
  61227. return $core.withContext(function($ctx1) {
  61228. newCollection=[$self._collection()
  61229. ,$ctx1.sendIdx["collection"]=1
  61230. ][0];
  61231. $self._samplesDo_((function(index,value){
  61232. return $core.withContext(function($ctx2) {
  61233. return [$recv(newCollection)._at_put_(index,value)
  61234. ,$ctx2.sendIdx["at:put:"]=1
  61235. ][0];
  61236. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  61237. }));
  61238. [$self._assert_equals_(newCollection,$self._collection())
  61239. ,$ctx1.sendIdx["assert:equals:"]=1
  61240. ][0];
  61241. $recv(newCollection)._at_put_($self._sampleNewIndex(),$self._sampleNewValue());
  61242. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  61243. return self;
  61244. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection})});
  61245. }; }),
  61246. $globals.TKeyValueCollectionTest);
  61247. $core.addMethod(
  61248. $core.method({
  61249. selector: "testIndexOf",
  61250. protocol: "tests",
  61251. args: [],
  61252. 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 ]",
  61253. referencedClasses: ["Error"],
  61254. pragmas: [],
  61255. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  61256. }, function ($methodClass){ return function (){
  61257. var self=this,$self=this;
  61258. return $core.withContext(function($ctx1) {
  61259. $self._should_raise_((function(){
  61260. return $core.withContext(function($ctx2) {
  61261. return [$recv([$self._collection()
  61262. ,$ctx2.sendIdx["collection"]=1
  61263. ][0])._indexOf_($self._sampleNewValue())
  61264. ,$ctx2.sendIdx["indexOf:"]=1
  61265. ][0];
  61266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61267. }),$globals.Error);
  61268. $self._samplesDo_((function(index,value){
  61269. return $core.withContext(function($ctx2) {
  61270. return $self._assert_equals_($recv($self._collection())._indexOf_(value),index);
  61271. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  61272. }));
  61273. return self;
  61274. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{})});
  61275. }; }),
  61276. $globals.TKeyValueCollectionTest);
  61277. $core.addMethod(
  61278. $core.method({
  61279. selector: "testIndexOfWithNull",
  61280. protocol: "tests",
  61281. args: [],
  61282. 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 ]",
  61283. referencedClasses: ["JSON"],
  61284. pragmas: [],
  61285. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  61286. }, function ($methodClass){ return function (){
  61287. var self=this,$self=this;
  61288. var jsNull;
  61289. return $core.withContext(function($ctx1) {
  61290. var $1;
  61291. jsNull=$recv($globals.JSON)._parse_("null");
  61292. $self._samplesDo_((function(index,value){
  61293. return $core.withContext(function($ctx2) {
  61294. $1=$self._collection();
  61295. $recv($1)._at_put_(index,jsNull);
  61296. return $self._assert_equals_($recv($1)._indexOf_(jsNull),index);
  61297. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  61298. }));
  61299. return self;
  61300. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull})});
  61301. }; }),
  61302. $globals.TKeyValueCollectionTest);
  61303. $core.addMethod(
  61304. $core.method({
  61305. selector: "testWithIndexDo",
  61306. protocol: "tests",
  61307. args: [],
  61308. 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 ]",
  61309. referencedClasses: [],
  61310. pragmas: [],
  61311. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  61312. }, function ($methodClass){ return function (){
  61313. var self=this,$self=this;
  61314. var collection;
  61315. return $core.withContext(function($ctx1) {
  61316. collection=[$self._collection()
  61317. ,$ctx1.sendIdx["collection"]=1
  61318. ][0];
  61319. $recv($self._collection())._withIndexDo_((function(each,index){
  61320. return $core.withContext(function($ctx2) {
  61321. return $self._assert_equals_($recv(collection)._at_(index),each);
  61322. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  61323. }));
  61324. return self;
  61325. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection})});
  61326. }; }),
  61327. $globals.TKeyValueCollectionTest);
  61328. $core.addClass("UndefinedTest", $globals.TestCase, [], "Kernel-Tests");
  61329. $core.addMethod(
  61330. $core.method({
  61331. selector: "testCopying",
  61332. protocol: "tests",
  61333. args: [],
  61334. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  61335. referencedClasses: [],
  61336. pragmas: [],
  61337. messageSends: ["assert:equals:", "copy"]
  61338. }, function ($methodClass){ return function (){
  61339. var self=this,$self=this;
  61340. return $core.withContext(function($ctx1) {
  61341. $self._assert_equals_($nil._copy(),nil);
  61342. return self;
  61343. }, function($ctx1) {$ctx1.fill(self,"testCopying",{})});
  61344. }; }),
  61345. $globals.UndefinedTest);
  61346. $core.addMethod(
  61347. $core.method({
  61348. selector: "testDeepCopy",
  61349. protocol: "tests",
  61350. args: [],
  61351. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  61352. referencedClasses: [],
  61353. pragmas: [],
  61354. messageSends: ["assert:", "=", "deepCopy"]
  61355. }, function ($methodClass){ return function (){
  61356. var self=this,$self=this;
  61357. return $core.withContext(function($ctx1) {
  61358. $self._assert_($recv($nil._deepCopy()).__eq(nil));
  61359. return self;
  61360. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{})});
  61361. }; }),
  61362. $globals.UndefinedTest);
  61363. $core.addMethod(
  61364. $core.method({
  61365. selector: "testIfNil",
  61366. protocol: "tests",
  61367. args: [],
  61368. 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",
  61369. referencedClasses: [],
  61370. pragmas: [],
  61371. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  61372. }, function ($methodClass){ return function (){
  61373. var self=this,$self=this;
  61374. return $core.withContext(function($ctx1) {
  61375. var $1,$2,$3,$4;
  61376. if(nil == null || nil.a$nil){
  61377. $1=true;
  61378. } else {
  61379. $1=nil;
  61380. }
  61381. [$self._assert_equals_($1,true)
  61382. ,$ctx1.sendIdx["assert:equals:"]=1
  61383. ][0];
  61384. if(nil == null || nil.a$nil){
  61385. $2=nil;
  61386. } else {
  61387. $2=true;
  61388. }
  61389. [$self._deny_([$recv($2).__eq(true)
  61390. ,$ctx1.sendIdx["="]=1
  61391. ][0])
  61392. ,$ctx1.sendIdx["deny:"]=1
  61393. ][0];
  61394. if(nil == null || nil.a$nil){
  61395. $3=true;
  61396. } else {
  61397. $3=false;
  61398. }
  61399. $self._assert_equals_($3,true);
  61400. if(nil == null || nil.a$nil){
  61401. $4=false;
  61402. } else {
  61403. $4=true;
  61404. }
  61405. $self._deny_($recv($4).__eq(true));
  61406. return self;
  61407. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{})});
  61408. }; }),
  61409. $globals.UndefinedTest);
  61410. $core.addMethod(
  61411. $core.method({
  61412. selector: "testIsNil",
  61413. protocol: "tests",
  61414. args: [],
  61415. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  61416. referencedClasses: [],
  61417. pragmas: [],
  61418. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  61419. }, function ($methodClass){ return function (){
  61420. var self=this,$self=this;
  61421. return $core.withContext(function($ctx1) {
  61422. $self._assert_($nil._isNil());
  61423. $self._deny_($nil._notNil());
  61424. return self;
  61425. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{})});
  61426. }; }),
  61427. $globals.UndefinedTest);
  61428. $core.setTraitComposition([{trait: $globals.TClassBuildingTest, aliases: {"tearDownTheClass":"tearDown"}}], $globals.ClassBuilderTest);
  61429. $core.setTraitComposition([{trait: $globals.TClassBuildingTest}], $globals.ClassTest);
  61430. $core.setTraitComposition([{trait: $globals.TKeyValueCollectionTest}], $globals.AssociativeCollectionTest);
  61431. $core.setTraitComposition([{trait: $globals.TKeyValueCollectionTest}], $globals.SequenceableCollectionTest);
  61432. });
  61433. define('amber/core/Compiler-Tests',["amber/boot", "require", "amber/core/Kernel-Tests", "amber/core/SUnit"], function($boot,requirejs){"use strict";
  61434. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61435. var $pkg = $core.addPackage("Compiler-Tests");
  61436. $pkg.innerEval = function (expr) { return eval(expr); };
  61437. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  61438. $core.addClass("ASTMethodRunningTest", $globals.TestCase, ["receiver", "arguments"], "Compiler-Tests");
  61439. $core.addMethod(
  61440. $core.method({
  61441. selector: "arguments",
  61442. protocol: "accessing",
  61443. args: [],
  61444. source: "arguments\x0a\x09^ arguments",
  61445. referencedClasses: [],
  61446. pragmas: [],
  61447. messageSends: []
  61448. }, function ($methodClass){ return function (){
  61449. var self=this,$self=this;
  61450. return $self.arguments;
  61451. }; }),
  61452. $globals.ASTMethodRunningTest);
  61453. $core.addMethod(
  61454. $core.method({
  61455. selector: "receiver",
  61456. protocol: "accessing",
  61457. args: [],
  61458. source: "receiver\x0a\x09^ receiver",
  61459. referencedClasses: [],
  61460. pragmas: [],
  61461. messageSends: []
  61462. }, function ($methodClass){ return function (){
  61463. var self=this,$self=this;
  61464. return $self.receiver;
  61465. }; }),
  61466. $globals.ASTMethodRunningTest);
  61467. $core.addMethod(
  61468. $core.method({
  61469. selector: "setUp",
  61470. protocol: "initialization",
  61471. args: [],
  61472. source: "setUp\x0a\x09arguments := #().\x0a\x09receiver := DoIt new",
  61473. referencedClasses: ["DoIt"],
  61474. pragmas: [],
  61475. messageSends: ["new"]
  61476. }, function ($methodClass){ return function (){
  61477. var self=this,$self=this;
  61478. return $core.withContext(function($ctx1) {
  61479. $self.arguments=[];
  61480. $self.receiver=$recv($globals.DoIt)._new();
  61481. return self;
  61482. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  61483. }; }),
  61484. $globals.ASTMethodRunningTest);
  61485. $core.addMethod(
  61486. $core.method({
  61487. selector: "should:class:receiver:return:",
  61488. protocol: "testing",
  61489. args: ["aString", "aClass", "anObject", "aResult"],
  61490. source: "should: aString class: aClass receiver: anObject return: aResult\x0a\x09receiver := anObject.\x0a\x09self while: aString inClass: aClass should: [ :runBlock |\x0a\x09\x09self assert: runBlock value equals: aResult ]",
  61491. referencedClasses: [],
  61492. pragmas: [],
  61493. messageSends: ["while:inClass:should:", "assert:equals:", "value"]
  61494. }, function ($methodClass){ return function (aString,aClass,anObject,aResult){
  61495. var self=this,$self=this;
  61496. return $core.withContext(function($ctx1) {
  61497. $self.receiver=anObject;
  61498. $self._while_inClass_should_(aString,aClass,(function(runBlock){
  61499. return $core.withContext(function($ctx2) {
  61500. return $self._assert_equals_($recv(runBlock)._value(),aResult);
  61501. }, function($ctx2) {$ctx2.fillBlock({runBlock:runBlock},$ctx1,1)});
  61502. }));
  61503. return self;
  61504. }, function($ctx1) {$ctx1.fill(self,"should:class:receiver:return:",{aString:aString,aClass:aClass,anObject:anObject,aResult:aResult})});
  61505. }; }),
  61506. $globals.ASTMethodRunningTest);
  61507. $core.addMethod(
  61508. $core.method({
  61509. selector: "should:receiver:raise:",
  61510. protocol: "testing",
  61511. args: ["aString", "anObject", "anErrorClass"],
  61512. source: "should: aString receiver: anObject raise: anErrorClass\x0a\x09receiver := anObject.\x0a\x09self while: aString should: [ :runBlock |\x0a\x09\x09self should: runBlock raise: anErrorClass ]",
  61513. referencedClasses: [],
  61514. pragmas: [],
  61515. messageSends: ["while:should:", "should:raise:"]
  61516. }, function ($methodClass){ return function (aString,anObject,anErrorClass){
  61517. var self=this,$self=this;
  61518. return $core.withContext(function($ctx1) {
  61519. $self.receiver=anObject;
  61520. $self._while_should_(aString,(function(runBlock){
  61521. return $core.withContext(function($ctx2) {
  61522. return $self._should_raise_(runBlock,anErrorClass);
  61523. }, function($ctx2) {$ctx2.fillBlock({runBlock:runBlock},$ctx1,1)});
  61524. }));
  61525. return self;
  61526. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass})});
  61527. }; }),
  61528. $globals.ASTMethodRunningTest);
  61529. $core.addMethod(
  61530. $core.method({
  61531. selector: "should:receiver:return:",
  61532. protocol: "testing",
  61533. args: ["aString", "anObject", "aResult"],
  61534. source: "should: aString receiver: anObject return: aResult\x0a\x09receiver := anObject.\x0a\x09self should: aString return: aResult",
  61535. referencedClasses: [],
  61536. pragmas: [],
  61537. messageSends: ["should:return:"]
  61538. }, function ($methodClass){ return function (aString,anObject,aResult){
  61539. var self=this,$self=this;
  61540. return $core.withContext(function($ctx1) {
  61541. $self.receiver=anObject;
  61542. $self._should_return_(aString,aResult);
  61543. return self;
  61544. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult})});
  61545. }; }),
  61546. $globals.ASTMethodRunningTest);
  61547. $core.addMethod(
  61548. $core.method({
  61549. selector: "should:return:",
  61550. protocol: "testing",
  61551. args: ["aString", "anObject"],
  61552. source: "should: aString return: anObject\x0a\x09self while: aString should: [ :runBlock |\x0a\x09\x09self assert: runBlock value equals: anObject ]",
  61553. referencedClasses: [],
  61554. pragmas: [],
  61555. messageSends: ["while:should:", "assert:equals:", "value"]
  61556. }, function ($methodClass){ return function (aString,anObject){
  61557. var self=this,$self=this;
  61558. return $core.withContext(function($ctx1) {
  61559. $self._while_should_(aString,(function(runBlock){
  61560. return $core.withContext(function($ctx2) {
  61561. return $self._assert_equals_($recv(runBlock)._value(),anObject);
  61562. }, function($ctx2) {$ctx2.fillBlock({runBlock:runBlock},$ctx1,1)});
  61563. }));
  61564. return self;
  61565. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject})});
  61566. }; }),
  61567. $globals.ASTMethodRunningTest);
  61568. $core.addClass("AbstractCompilerTest", $globals.ASTMethodRunningTest, [], "Compiler-Tests");
  61569. $core.addMethod(
  61570. $core.method({
  61571. selector: "testAfterInliningNonLocalBlockReturnIndexSend",
  61572. protocol: "tests",
  61573. args: [],
  61574. source: "testAfterInliningNonLocalBlockReturnIndexSend\x0a\x09self should: 'foo [ ^ true ifTrue: [ self class ] ] value. self class' return: DoIt.",
  61575. referencedClasses: ["DoIt"],
  61576. pragmas: [],
  61577. messageSends: ["should:return:"]
  61578. }, function ($methodClass){ return function (){
  61579. var self=this,$self=this;
  61580. return $core.withContext(function($ctx1) {
  61581. $self._should_return_("foo [ ^ true ifTrue: [ self class ] ] value. self class",$globals.DoIt);
  61582. return self;
  61583. }, function($ctx1) {$ctx1.fill(self,"testAfterInliningNonLocalBlockReturnIndexSend",{})});
  61584. }; }),
  61585. $globals.AbstractCompilerTest);
  61586. $core.addMethod(
  61587. $core.method({
  61588. selector: "testAfterInliningNonLocalBlockReturnSuperSend",
  61589. protocol: "tests",
  61590. args: [],
  61591. source: "testAfterInliningNonLocalBlockReturnSuperSend\x0a\x09self should: 'foo [ ^ true ifTrue: [ super class ] ] value' return: DoIt.",
  61592. referencedClasses: ["DoIt"],
  61593. pragmas: [],
  61594. messageSends: ["should:return:"]
  61595. }, function ($methodClass){ return function (){
  61596. var self=this,$self=this;
  61597. return $core.withContext(function($ctx1) {
  61598. $self._should_return_("foo [ ^ true ifTrue: [ super class ] ] value",$globals.DoIt);
  61599. return self;
  61600. }, function($ctx1) {$ctx1.fill(self,"testAfterInliningNonLocalBlockReturnSuperSend",{})});
  61601. }; }),
  61602. $globals.AbstractCompilerTest);
  61603. $core.addMethod(
  61604. $core.method({
  61605. selector: "testAssignment",
  61606. protocol: "tests",
  61607. args: [],
  61608. 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",
  61609. referencedClasses: [],
  61610. pragmas: [],
  61611. messageSends: ["should:return:"]
  61612. }, function ($methodClass){ return function (){
  61613. var self=this,$self=this;
  61614. return $core.withContext(function($ctx1) {
  61615. [$self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1))
  61616. ,$ctx1.sendIdx["should:return:"]=1
  61617. ][0];
  61618. [$self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil)
  61619. ,$ctx1.sendIdx["should:return:"]=2
  61620. ][0];
  61621. $self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  61622. return self;
  61623. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{})});
  61624. }; }),
  61625. $globals.AbstractCompilerTest);
  61626. $core.addMethod(
  61627. $core.method({
  61628. selector: "testBackslashSelectors",
  61629. protocol: "tests",
  61630. args: [],
  61631. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  61632. referencedClasses: [],
  61633. pragmas: [],
  61634. messageSends: ["should:return:"]
  61635. }, function ($methodClass){ return function (){
  61636. var self=this,$self=this;
  61637. return $core.withContext(function($ctx1) {
  61638. [$self._should_return_("\x5c arg ^ 4",(4))
  61639. ,$ctx1.sendIdx["should:return:"]=1
  61640. ][0];
  61641. $self._should_return_("\x5c\x5c arg ^ 42",(42));
  61642. return self;
  61643. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{})});
  61644. }; }),
  61645. $globals.AbstractCompilerTest);
  61646. $core.addMethod(
  61647. $core.method({
  61648. selector: "testBlockReturn",
  61649. protocol: "tests",
  61650. args: [],
  61651. 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).",
  61652. referencedClasses: [],
  61653. pragmas: [],
  61654. messageSends: ["should:return:"]
  61655. }, function ($methodClass){ return function (){
  61656. var self=this,$self=this;
  61657. return $core.withContext(function($ctx1) {
  61658. [$self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)])
  61659. ,$ctx1.sendIdx["should:return:"]=1
  61660. ][0];
  61661. [$self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)])
  61662. ,$ctx1.sendIdx["should:return:"]=2
  61663. ][0];
  61664. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  61665. return self;
  61666. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{})});
  61667. }; }),
  61668. $globals.AbstractCompilerTest);
  61669. $core.addMethod(
  61670. $core.method({
  61671. selector: "testCascades",
  61672. protocol: "tests",
  61673. args: [],
  61674. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  61675. referencedClasses: [],
  61676. pragmas: [],
  61677. messageSends: ["should:return:"]
  61678. }, function ($methodClass){ return function (){
  61679. var self=this,$self=this;
  61680. return $core.withContext(function($ctx1) {
  61681. $self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  61682. return self;
  61683. }, function($ctx1) {$ctx1.fill(self,"testCascades",{})});
  61684. }; }),
  61685. $globals.AbstractCompilerTest);
  61686. $core.addMethod(
  61687. $core.method({
  61688. selector: "testCascadesInDynamicArray",
  61689. protocol: "tests",
  61690. args: [],
  61691. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  61692. referencedClasses: [],
  61693. pragmas: [],
  61694. messageSends: ["should:return:"]
  61695. }, function ($methodClass){ return function (){
  61696. var self=this,$self=this;
  61697. return $core.withContext(function($ctx1) {
  61698. $self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  61699. return self;
  61700. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{})});
  61701. }; }),
  61702. $globals.AbstractCompilerTest);
  61703. $core.addMethod(
  61704. $core.method({
  61705. selector: "testCascadesInDynamicDictioary",
  61706. protocol: "tests",
  61707. args: [],
  61708. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  61709. referencedClasses: [],
  61710. pragmas: [],
  61711. messageSends: ["should:return:"]
  61712. }, function ($methodClass){ return function (){
  61713. var self=this,$self=this;
  61714. return $core.withContext(function($ctx1) {
  61715. $self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  61716. return self;
  61717. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{})});
  61718. }; }),
  61719. $globals.AbstractCompilerTest);
  61720. $core.addMethod(
  61721. $core.method({
  61722. selector: "testCascadesInSend",
  61723. protocol: "tests",
  61724. args: [],
  61725. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  61726. referencedClasses: [],
  61727. pragmas: [],
  61728. messageSends: ["should:return:"]
  61729. }, function ($methodClass){ return function (){
  61730. var self=this,$self=this;
  61731. return $core.withContext(function($ctx1) {
  61732. $self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  61733. return self;
  61734. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{})});
  61735. }; }),
  61736. $globals.AbstractCompilerTest);
  61737. $core.addMethod(
  61738. $core.method({
  61739. selector: "testCascadesWithInlining",
  61740. protocol: "tests",
  61741. args: [],
  61742. 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",
  61743. referencedClasses: [],
  61744. pragmas: [],
  61745. messageSends: ["should:return:"]
  61746. }, function ($methodClass){ return function (){
  61747. var self=this,$self=this;
  61748. return $core.withContext(function($ctx1) {
  61749. [$self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1))
  61750. ,$ctx1.sendIdx["should:return:"]=1
  61751. ][0];
  61752. $self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  61753. return self;
  61754. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{})});
  61755. }; }),
  61756. $globals.AbstractCompilerTest);
  61757. $core.addMethod(
  61758. $core.method({
  61759. selector: "testDynamicArrayElementsOrdered",
  61760. protocol: "tests",
  61761. args: [],
  61762. 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).",
  61763. referencedClasses: [],
  61764. pragmas: [],
  61765. messageSends: ["should:return:"]
  61766. }, function ($methodClass){ return function (){
  61767. var self=this,$self=this;
  61768. return $core.withContext(function($ctx1) {
  61769. [$self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)])
  61770. ,$ctx1.sendIdx["should:return:"]=1
  61771. ][0];
  61772. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  61773. return self;
  61774. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{})});
  61775. }; }),
  61776. $globals.AbstractCompilerTest);
  61777. $core.addMethod(
  61778. $core.method({
  61779. selector: "testDynamicDictionaryElementsOrdered",
  61780. protocol: "tests",
  61781. args: [],
  61782. 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}.",
  61783. referencedClasses: [],
  61784. pragmas: [],
  61785. messageSends: ["should:return:"]
  61786. }, function ($methodClass){ return function (){
  61787. var self=this,$self=this;
  61788. return $core.withContext(function($ctx1) {
  61789. $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)]));
  61790. return self;
  61791. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{})});
  61792. }; }),
  61793. $globals.AbstractCompilerTest);
  61794. $core.addMethod(
  61795. $core.method({
  61796. selector: "testDynamicDictionaryWithMoreArrows",
  61797. protocol: "tests",
  61798. args: [],
  61799. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  61800. referencedClasses: ["HashedCollection"],
  61801. pragmas: [],
  61802. messageSends: ["should:return:", "with:", "->"]
  61803. }, function ($methodClass){ return function (){
  61804. var self=this,$self=this;
  61805. return $core.withContext(function($ctx1) {
  61806. $self._should_return_("foo ^ #{1->2->3}",$recv($globals.HashedCollection)._with_([$recv((1).__minus_gt((2))).__minus_gt((3))
  61807. ,$ctx1.sendIdx["->"]=1
  61808. ][0]));
  61809. return self;
  61810. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{})});
  61811. }; }),
  61812. $globals.AbstractCompilerTest);
  61813. $core.addMethod(
  61814. $core.method({
  61815. selector: "testGlobalVar",
  61816. protocol: "tests",
  61817. args: [],
  61818. 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",
  61819. referencedClasses: ["BlockClosure"],
  61820. pragmas: [],
  61821. messageSends: ["should:return:"]
  61822. }, function ($methodClass){ return function (){
  61823. var self=this,$self=this;
  61824. return $core.withContext(function($ctx1) {
  61825. [$self._should_return_("foo ^ eval class",$globals.BlockClosure)
  61826. ,$ctx1.sendIdx["should:return:"]=1
  61827. ][0];
  61828. [$self._should_return_("foo ^ Math cos: 0",(1))
  61829. ,$ctx1.sendIdx["should:return:"]=2
  61830. ][0];
  61831. $self._should_return_("foo ^ NonExistingVar",nil);
  61832. return self;
  61833. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{})});
  61834. }; }),
  61835. $globals.AbstractCompilerTest);
  61836. $core.addMethod(
  61837. $core.method({
  61838. selector: "testInnerTemporalDependentElementsOrdered",
  61839. protocol: "tests",
  61840. args: [],
  61841. 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}.",
  61842. referencedClasses: ["Array"],
  61843. pragmas: [],
  61844. messageSends: ["should:return:", "->"]
  61845. }, function ($methodClass){ return function (){
  61846. var self=this,$self=this;
  61847. return $core.withContext(function($ctx1) {
  61848. [$self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",[["foo".__minus_gt($globals.Array)
  61849. ,$ctx1.sendIdx["->"]=1
  61850. ][0],["bar".__minus_gt((2))
  61851. ,$ctx1.sendIdx["->"]=2
  61852. ][0]])
  61853. ,$ctx1.sendIdx["should:return:"]=1
  61854. ][0];
  61855. [$self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",[["foo".__minus_gt($globals.Array)
  61856. ,$ctx1.sendIdx["->"]=3
  61857. ][0],["bar".__minus_gt((2))
  61858. ,$ctx1.sendIdx["->"]=4
  61859. ][0]])
  61860. ,$ctx1.sendIdx["should:return:"]=2
  61861. ][0];
  61862. [$self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",[["foo".__minus_gt((1))
  61863. ,$ctx1.sendIdx["->"]=5
  61864. ][0],["bar".__minus_gt((2))
  61865. ,$ctx1.sendIdx["->"]=6
  61866. ][0]])
  61867. ,$ctx1.sendIdx["should:return:"]=3
  61868. ][0];
  61869. [$self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",[["foo".__minus_gt((1))
  61870. ,$ctx1.sendIdx["->"]=7
  61871. ][0],"bar".__minus_gt((2))])
  61872. ,$ctx1.sendIdx["should:return:"]=4
  61873. ][0];
  61874. $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)]));
  61875. return self;
  61876. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{})});
  61877. }; }),
  61878. $globals.AbstractCompilerTest);
  61879. $core.addMethod(
  61880. $core.method({
  61881. selector: "testLexicalScope",
  61882. protocol: "tests",
  61883. args: [],
  61884. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  61885. referencedClasses: [],
  61886. pragmas: [],
  61887. messageSends: ["should:return:"]
  61888. }, function ($methodClass){ return function (){
  61889. var self=this,$self=this;
  61890. return $core.withContext(function($ctx1) {
  61891. $self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  61892. return self;
  61893. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{})});
  61894. }; }),
  61895. $globals.AbstractCompilerTest);
  61896. $core.addMethod(
  61897. $core.method({
  61898. selector: "testLiterals",
  61899. protocol: "tests",
  61900. args: [],
  61901. 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.",
  61902. referencedClasses: [],
  61903. pragmas: [],
  61904. messageSends: ["should:return:"]
  61905. }, function ($methodClass){ return function (){
  61906. var self=this,$self=this;
  61907. return $core.withContext(function($ctx1) {
  61908. [$self._should_return_("foo ^ 1",(1))
  61909. ,$ctx1.sendIdx["should:return:"]=1
  61910. ][0];
  61911. [$self._should_return_("foo ^ 'hello'","hello")
  61912. ,$ctx1.sendIdx["should:return:"]=2
  61913. ][0];
  61914. [$self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)])
  61915. ,$ctx1.sendIdx["should:return:"]=3
  61916. ][0];
  61917. [$self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)])
  61918. ,$ctx1.sendIdx["should:return:"]=4
  61919. ][0];
  61920. [$self._should_return_("foo ^ true",true)
  61921. ,$ctx1.sendIdx["should:return:"]=5
  61922. ][0];
  61923. [$self._should_return_("foo ^ false",false)
  61924. ,$ctx1.sendIdx["should:return:"]=6
  61925. ][0];
  61926. [$self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]))
  61927. ,$ctx1.sendIdx["should:return:"]=7
  61928. ][0];
  61929. [$self._should_return_("foo ^ #hello","hello")
  61930. ,$ctx1.sendIdx["should:return:"]=8
  61931. ][0];
  61932. [$self._should_return_("foo ^ $h","h")
  61933. ,$ctx1.sendIdx["should:return:"]=9
  61934. ][0];
  61935. [$self._should_return_("foo ^ -123.456",(-123.456))
  61936. ,$ctx1.sendIdx["should:return:"]=10
  61937. ][0];
  61938. $self._should_return_("foo ^ -2.5e4",(-25000));
  61939. return self;
  61940. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{})});
  61941. }; }),
  61942. $globals.AbstractCompilerTest);
  61943. $core.addMethod(
  61944. $core.method({
  61945. selector: "testLocalReturn",
  61946. protocol: "tests",
  61947. args: [],
  61948. 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",
  61949. referencedClasses: [],
  61950. pragmas: [],
  61951. messageSends: ["should:return:"]
  61952. }, function ($methodClass){ return function (){
  61953. var self=this,$self=this;
  61954. return $core.withContext(function($ctx1) {
  61955. [$self._should_return_("foo ^ 1",(1))
  61956. ,$ctx1.sendIdx["should:return:"]=1
  61957. ][0];
  61958. [$self._should_return_("foo ^ 1 + 1",(2))
  61959. ,$ctx1.sendIdx["should:return:"]=2
  61960. ][0];
  61961. [$self._should_return_("foo ",$self.receiver)
  61962. ,$ctx1.sendIdx["should:return:"]=3
  61963. ][0];
  61964. [$self._should_return_("foo self asString",$self.receiver)
  61965. ,$ctx1.sendIdx["should:return:"]=4
  61966. ][0];
  61967. $self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  61968. return self;
  61969. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{})});
  61970. }; }),
  61971. $globals.AbstractCompilerTest);
  61972. $core.addMethod(
  61973. $core.method({
  61974. selector: "testMessageSends",
  61975. protocol: "tests",
  61976. args: [],
  61977. 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)",
  61978. referencedClasses: [],
  61979. pragmas: [],
  61980. messageSends: ["should:return:"]
  61981. }, function ($methodClass){ return function (){
  61982. var self=this,$self=this;
  61983. return $core.withContext(function($ctx1) {
  61984. [$self._should_return_("foo ^ 1 asString","1")
  61985. ,$ctx1.sendIdx["should:return:"]=1
  61986. ][0];
  61987. [$self._should_return_("foo ^ 1 + 1",(2))
  61988. ,$ctx1.sendIdx["should:return:"]=2
  61989. ][0];
  61990. [$self._should_return_("foo ^ 1 + 2 * 3",(9))
  61991. ,$ctx1.sendIdx["should:return:"]=3
  61992. ][0];
  61993. [$self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)])
  61994. ,$ctx1.sendIdx["should:return:"]=4
  61995. ][0];
  61996. $self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  61997. return self;
  61998. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{})});
  61999. }; }),
  62000. $globals.AbstractCompilerTest);
  62001. $core.addMethod(
  62002. $core.method({
  62003. selector: "testMultipleSequences",
  62004. protocol: "tests",
  62005. args: [],
  62006. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  62007. referencedClasses: [],
  62008. pragmas: [],
  62009. messageSends: ["should:return:"]
  62010. }, function ($methodClass){ return function (){
  62011. var self=this,$self=this;
  62012. return $core.withContext(function($ctx1) {
  62013. $self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  62014. return self;
  62015. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{})});
  62016. }; }),
  62017. $globals.AbstractCompilerTest);
  62018. $core.addMethod(
  62019. $core.method({
  62020. selector: "testMutableLiterals",
  62021. protocol: "tests",
  62022. args: [],
  62023. 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)",
  62024. referencedClasses: [],
  62025. pragmas: [],
  62026. messageSends: ["should:return:"]
  62027. }, function ($methodClass){ return function (){
  62028. var self=this,$self=this;
  62029. return $core.withContext(function($ctx1) {
  62030. $self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  62031. return self;
  62032. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{})});
  62033. }; }),
  62034. $globals.AbstractCompilerTest);
  62035. $core.addMethod(
  62036. $core.method({
  62037. selector: "testNestedIfTrue",
  62038. protocol: "tests",
  62039. args: [],
  62040. 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.",
  62041. referencedClasses: [],
  62042. pragmas: [],
  62043. messageSends: ["should:return:"]
  62044. }, function ($methodClass){ return function (){
  62045. var self=this,$self=this;
  62046. return $core.withContext(function($ctx1) {
  62047. [$self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1))
  62048. ,$ctx1.sendIdx["should:return:"]=1
  62049. ][0];
  62050. [$self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil)
  62051. ,$ctx1.sendIdx["should:return:"]=2
  62052. ][0];
  62053. [$self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1))
  62054. ,$ctx1.sendIdx["should:return:"]=3
  62055. ][0];
  62056. $self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",$self.receiver);
  62057. return self;
  62058. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{})});
  62059. }; }),
  62060. $globals.AbstractCompilerTest);
  62061. $core.addMethod(
  62062. $core.method({
  62063. selector: "testNestedSends",
  62064. protocol: "tests",
  62065. args: [],
  62066. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  62067. referencedClasses: ["Point"],
  62068. pragmas: [],
  62069. messageSends: ["should:return:", "asString", "x:y:", "@"]
  62070. }, function ($methodClass){ return function (){
  62071. var self=this,$self=this;
  62072. return $core.withContext(function($ctx1) {
  62073. $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());
  62074. return self;
  62075. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{})});
  62076. }; }),
  62077. $globals.AbstractCompilerTest);
  62078. $core.addMethod(
  62079. $core.method({
  62080. selector: "testNilPerform",
  62081. protocol: "tests",
  62082. args: [],
  62083. source: "testNilPerform\x0a\x09self should: 'foo ^ nil perform: #yourself' return: nil",
  62084. referencedClasses: [],
  62085. pragmas: [],
  62086. messageSends: ["should:return:"]
  62087. }, function ($methodClass){ return function (){
  62088. var self=this,$self=this;
  62089. return $core.withContext(function($ctx1) {
  62090. $self._should_return_("foo ^ nil perform: #yourself",nil);
  62091. return self;
  62092. }, function($ctx1) {$ctx1.fill(self,"testNilPerform",{})});
  62093. }; }),
  62094. $globals.AbstractCompilerTest);
  62095. $core.addMethod(
  62096. $core.method({
  62097. selector: "testNonLocalReturn",
  62098. protocol: "tests",
  62099. args: [],
  62100. 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",
  62101. referencedClasses: [],
  62102. pragmas: [],
  62103. messageSends: ["should:return:"]
  62104. }, function ($methodClass){ return function (){
  62105. var self=this,$self=this;
  62106. return $core.withContext(function($ctx1) {
  62107. [$self._should_return_("foo [ ^ 1 ] value",(1))
  62108. ,$ctx1.sendIdx["should:return:"]=1
  62109. ][0];
  62110. [$self._should_return_("foo [ ^ 1 + 1 ] value",(2))
  62111. ,$ctx1.sendIdx["should:return:"]=2
  62112. ][0];
  62113. [$self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3))
  62114. ,$ctx1.sendIdx["should:return:"]=3
  62115. ][0];
  62116. $self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  62117. return self;
  62118. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{})});
  62119. }; }),
  62120. $globals.AbstractCompilerTest);
  62121. $core.addMethod(
  62122. $core.method({
  62123. selector: "testPascalCaseGlobal",
  62124. protocol: "tests",
  62125. args: [],
  62126. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  62127. referencedClasses: ["Smalltalk"],
  62128. pragmas: [],
  62129. messageSends: ["should:return:", "at:", "globals"]
  62130. }, function ($methodClass){ return function (){
  62131. var self=this,$self=this;
  62132. return $core.withContext(function($ctx1) {
  62133. [$self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"))
  62134. ,$ctx1.sendIdx["should:return:"]=1
  62135. ][0];
  62136. $self._should_return_("foo ^NonExistent",nil);
  62137. return self;
  62138. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{})});
  62139. }; }),
  62140. $globals.AbstractCompilerTest);
  62141. $core.addMethod(
  62142. $core.method({
  62143. selector: "testPragmaJSStatement",
  62144. protocol: "tests",
  62145. args: [],
  62146. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  62147. referencedClasses: [],
  62148. pragmas: [],
  62149. messageSends: ["should:return:"]
  62150. }, function ($methodClass){ return function (){
  62151. var self=this,$self=this;
  62152. return $core.withContext(function($ctx1) {
  62153. $self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  62154. return self;
  62155. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{})});
  62156. }; }),
  62157. $globals.AbstractCompilerTest);
  62158. $core.addMethod(
  62159. $core.method({
  62160. selector: "testReceiverEvaluatedOnceInSpecials",
  62161. protocol: "tests",
  62162. args: [],
  62163. source: "testReceiverEvaluatedOnceInSpecials\x0a\x09self should: 'foo |x| x := 1. ^ {[ x := x+1 ] value ifNil: []. x}' return: {2. 2}.\x0a\x09self should: 'foo |xs| xs := {nil. nil}. ^ {[ xs removeLast ] value ifNotNil: []. xs}' return: {nil. {nil}}.",
  62164. referencedClasses: [],
  62165. pragmas: [],
  62166. messageSends: ["should:return:"]
  62167. }, function ($methodClass){ return function (){
  62168. var self=this,$self=this;
  62169. return $core.withContext(function($ctx1) {
  62170. [$self._should_return_("foo |x| x := 1. ^ {[ x := x+1 ] value ifNil: []. x}",[(2),(2)])
  62171. ,$ctx1.sendIdx["should:return:"]=1
  62172. ][0];
  62173. $self._should_return_("foo |xs| xs := {nil. nil}. ^ {[ xs removeLast ] value ifNotNil: []. xs}",[nil,[nil]]);
  62174. return self;
  62175. }, function($ctx1) {$ctx1.fill(self,"testReceiverEvaluatedOnceInSpecials",{})});
  62176. }; }),
  62177. $globals.AbstractCompilerTest);
  62178. $core.addMethod(
  62179. $core.method({
  62180. selector: "testRegression1242",
  62181. protocol: "tests",
  62182. args: [],
  62183. source: "testRegression1242\x0a\x09self should: '\x0a\x09\x09foo\x0a\x09\x09\x09|x|\x0a\x09\x09\x09x := 2.\x0a\x09\x09\x09x := nil ifNil: [].\x0a\x09\x09\x09^ x\x0a\x09' return: nil.\x0a\x09\x0a\x09self should: '\x0a\x09\x09foo\x0a\x09\x09\x09|x|\x0a\x09\x09\x09x := 2.\x0a\x09\x09\x09x := 1 ifNotNil: [].\x0a\x09\x09\x09^ x\x0a\x09' return: nil.\x0a\x09\x0a\x09self should: '\x0a\x09\x09foo\x0a\x09\x09\x09|x|\x0a\x09\x09\x09x := 2.\x0a\x09\x09\x09x := false ifFalse: [].\x0a\x09\x09\x09^ x\x0a\x09' return: nil.\x0a\x09\x0a\x09self should: '\x0a\x09\x09foo\x0a\x09\x09\x09|x|\x0a\x09\x09\x09x := 2.\x0a\x09\x09\x09x := true ifTrue: [].\x0a\x09\x09\x09^ x\x0a\x09' return: nil.",
  62184. referencedClasses: [],
  62185. pragmas: [],
  62186. messageSends: ["should:return:"]
  62187. }, function ($methodClass){ return function (){
  62188. var self=this,$self=this;
  62189. return $core.withContext(function($ctx1) {
  62190. [$self._should_return_("\x0a\x09\x09foo\x0a\x09\x09\x09|x|\x0a\x09\x09\x09x := 2.\x0a\x09\x09\x09x := nil ifNil: [].\x0a\x09\x09\x09^ x\x0a\x09",nil)
  62191. ,$ctx1.sendIdx["should:return:"]=1
  62192. ][0];
  62193. [$self._should_return_("\x0a\x09\x09foo\x0a\x09\x09\x09|x|\x0a\x09\x09\x09x := 2.\x0a\x09\x09\x09x := 1 ifNotNil: [].\x0a\x09\x09\x09^ x\x0a\x09",nil)
  62194. ,$ctx1.sendIdx["should:return:"]=2
  62195. ][0];
  62196. [$self._should_return_("\x0a\x09\x09foo\x0a\x09\x09\x09|x|\x0a\x09\x09\x09x := 2.\x0a\x09\x09\x09x := false ifFalse: [].\x0a\x09\x09\x09^ x\x0a\x09",nil)
  62197. ,$ctx1.sendIdx["should:return:"]=3
  62198. ][0];
  62199. $self._should_return_("\x0a\x09\x09foo\x0a\x09\x09\x09|x|\x0a\x09\x09\x09x := 2.\x0a\x09\x09\x09x := true ifTrue: [].\x0a\x09\x09\x09^ x\x0a\x09",nil);
  62200. return self;
  62201. }, function($ctx1) {$ctx1.fill(self,"testRegression1242",{})});
  62202. }; }),
  62203. $globals.AbstractCompilerTest);
  62204. $core.addMethod(
  62205. $core.method({
  62206. selector: "testRegression1242ForReturn",
  62207. protocol: "tests",
  62208. args: [],
  62209. source: "testRegression1242ForReturn\x0a\x09self should: 'foo [ ^ nil ifNil: [] ] value' return: nil.\x0a\x09self should: 'foo [ ^ 1 ifNotNil: [] ] value' return: nil.\x0a\x09self should: 'foo [ ^ false ifFalse: [] ] value' return: nil.\x0a\x09self should: 'foo [ ^ true ifTrue: [] ] value' return: nil.",
  62210. referencedClasses: [],
  62211. pragmas: [],
  62212. messageSends: ["should:return:"]
  62213. }, function ($methodClass){ return function (){
  62214. var self=this,$self=this;
  62215. return $core.withContext(function($ctx1) {
  62216. [$self._should_return_("foo [ ^ nil ifNil: [] ] value",nil)
  62217. ,$ctx1.sendIdx["should:return:"]=1
  62218. ][0];
  62219. [$self._should_return_("foo [ ^ 1 ifNotNil: [] ] value",nil)
  62220. ,$ctx1.sendIdx["should:return:"]=2
  62221. ][0];
  62222. [$self._should_return_("foo [ ^ false ifFalse: [] ] value",nil)
  62223. ,$ctx1.sendIdx["should:return:"]=3
  62224. ][0];
  62225. $self._should_return_("foo [ ^ true ifTrue: [] ] value",nil);
  62226. return self;
  62227. }, function($ctx1) {$ctx1.fill(self,"testRegression1242ForReturn",{})});
  62228. }; }),
  62229. $globals.AbstractCompilerTest);
  62230. $core.addMethod(
  62231. $core.method({
  62232. selector: "testRegression1244",
  62233. protocol: "tests",
  62234. args: [],
  62235. source: "testRegression1244\x0a\x09self should: 'foo [ ^ true ifTrue: [1] ifFalse: [2] ] value' return: 1",
  62236. referencedClasses: [],
  62237. pragmas: [],
  62238. messageSends: ["should:return:"]
  62239. }, function ($methodClass){ return function (){
  62240. var self=this,$self=this;
  62241. return $core.withContext(function($ctx1) {
  62242. $self._should_return_("foo [ ^ true ifTrue: [1] ifFalse: [2] ] value",(1));
  62243. return self;
  62244. }, function($ctx1) {$ctx1.fill(self,"testRegression1244",{})});
  62245. }; }),
  62246. $globals.AbstractCompilerTest);
  62247. $core.addMethod(
  62248. $core.method({
  62249. selector: "testRootSuperSend",
  62250. protocol: "tests",
  62251. args: [],
  62252. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  62253. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  62254. pragmas: [],
  62255. messageSends: ["should:receiver:raise:", "new"]
  62256. }, function ($methodClass){ return function (){
  62257. var self=this,$self=this;
  62258. return $core.withContext(function($ctx1) {
  62259. $self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  62260. return self;
  62261. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{})});
  62262. }; }),
  62263. $globals.AbstractCompilerTest);
  62264. $core.addMethod(
  62265. $core.method({
  62266. selector: "testSendReceiverAndArgumentsOrdered",
  62267. protocol: "tests",
  62268. args: [],
  62269. 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}.",
  62270. referencedClasses: ["Array"],
  62271. pragmas: [],
  62272. messageSends: ["should:return:"]
  62273. }, function ($methodClass){ return function (){
  62274. var self=this,$self=this;
  62275. return $core.withContext(function($ctx1) {
  62276. [$self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)])
  62277. ,$ctx1.sendIdx["should:return:"]=1
  62278. ][0];
  62279. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  62280. return self;
  62281. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{})});
  62282. }; }),
  62283. $globals.AbstractCompilerTest);
  62284. $core.addMethod(
  62285. $core.method({
  62286. selector: "testSuperSend",
  62287. protocol: "tests",
  62288. args: [],
  62289. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  62290. referencedClasses: [],
  62291. pragmas: [],
  62292. messageSends: ["should:receiver:return:"]
  62293. }, function ($methodClass){ return function (){
  62294. var self=this,$self=this;
  62295. return $core.withContext(function($ctx1) {
  62296. $self._should_receiver_return_("foo ^ super isBoolean",true,false);
  62297. return self;
  62298. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{})});
  62299. }; }),
  62300. $globals.AbstractCompilerTest);
  62301. $core.addMethod(
  62302. $core.method({
  62303. selector: "testSuperSend2",
  62304. protocol: "tests",
  62305. args: [],
  62306. source: "testSuperSend2\x0a\x09self \x0a\x09\x09should: 'foo ^ super isNil'\x0a\x09\x09receiver: nil\x0a\x09\x09return: false",
  62307. referencedClasses: [],
  62308. pragmas: [],
  62309. messageSends: ["should:receiver:return:"]
  62310. }, function ($methodClass){ return function (){
  62311. var self=this,$self=this;
  62312. return $core.withContext(function($ctx1) {
  62313. $self._should_receiver_return_("foo ^ super isNil",nil,false);
  62314. return self;
  62315. }, function($ctx1) {$ctx1.fill(self,"testSuperSend2",{})});
  62316. }; }),
  62317. $globals.AbstractCompilerTest);
  62318. $core.addMethod(
  62319. $core.method({
  62320. selector: "testSuperSend3",
  62321. protocol: "tests",
  62322. args: [],
  62323. source: "testSuperSend3\x0a\x09self \x0a\x09\x09should: 'doo ^ super isNil'\x0a\x09\x09class: Object\x0a\x09\x09receiver: nil\x0a\x09\x09return: false",
  62324. referencedClasses: ["Object"],
  62325. pragmas: [],
  62326. messageSends: ["should:class:receiver:return:"]
  62327. }, function ($methodClass){ return function (){
  62328. var self=this,$self=this;
  62329. return $core.withContext(function($ctx1) {
  62330. $self._should_class_receiver_return_("doo ^ super isNil",$globals.Object,nil,false);
  62331. return self;
  62332. }, function($ctx1) {$ctx1.fill(self,"testSuperSend3",{})});
  62333. }; }),
  62334. $globals.AbstractCompilerTest);
  62335. $core.addMethod(
  62336. $core.method({
  62337. selector: "testSuperSend4",
  62338. protocol: "tests",
  62339. args: [],
  62340. source: "testSuperSend4\x0a\x09self \x0a\x09\x09should: 'foo ^ super asJavaScriptObject'\x0a\x09\x09receiver: 'me'\x0a\x09\x09return: #('m' 'e')",
  62341. referencedClasses: [],
  62342. pragmas: [],
  62343. messageSends: ["should:receiver:return:"]
  62344. }, function ($methodClass){ return function (){
  62345. var self=this,$self=this;
  62346. return $core.withContext(function($ctx1) {
  62347. $self._should_receiver_return_("foo ^ super asJavaScriptObject","me",["m", "e"]);
  62348. return self;
  62349. }, function($ctx1) {$ctx1.fill(self,"testSuperSend4",{})});
  62350. }; }),
  62351. $globals.AbstractCompilerTest);
  62352. $core.addMethod(
  62353. $core.method({
  62354. selector: "testSuperSend5",
  62355. protocol: "tests",
  62356. args: [],
  62357. source: "testSuperSend5\x0a\x09self \x0a\x09\x09should: 'foo [super addLast: 4] on: Error do: [ self add: 5 ]. ^ self'\x0a\x09\x09class: SequenceableCollection\x0a\x09\x09receiver: #(1 2 3)\x0a\x09\x09return: #(1 2 3 5)",
  62358. referencedClasses: ["SequenceableCollection"],
  62359. pragmas: [],
  62360. messageSends: ["should:class:receiver:return:"]
  62361. }, function ($methodClass){ return function (){
  62362. var self=this,$self=this;
  62363. return $core.withContext(function($ctx1) {
  62364. $self._should_class_receiver_return_("foo [super addLast: 4] on: Error do: [ self add: 5 ]. ^ self",$globals.SequenceableCollection,[(1), (2), (3)],[(1), (2), (3), (5)]);
  62365. return self;
  62366. }, function($ctx1) {$ctx1.fill(self,"testSuperSend5",{})});
  62367. }; }),
  62368. $globals.AbstractCompilerTest);
  62369. $core.addMethod(
  62370. $core.method({
  62371. selector: "testSuperSend6",
  62372. protocol: "tests",
  62373. args: [],
  62374. source: "testSuperSend6\x0a\x09self \x0a\x09\x09should: 'foo ^ super ifTrue: [ true ] ifFalse: [ false ]' \x0a\x09\x09receiver: true\x0a\x09\x09raise: Error",
  62375. referencedClasses: ["Error"],
  62376. pragmas: [],
  62377. messageSends: ["should:receiver:raise:"]
  62378. }, function ($methodClass){ return function (){
  62379. var self=this,$self=this;
  62380. return $core.withContext(function($ctx1) {
  62381. $self._should_receiver_raise_("foo ^ super ifTrue: [ true ] ifFalse: [ false ]",true,$globals.Error);
  62382. return self;
  62383. }, function($ctx1) {$ctx1.fill(self,"testSuperSend6",{})});
  62384. }; }),
  62385. $globals.AbstractCompilerTest);
  62386. $core.addMethod(
  62387. $core.method({
  62388. selector: "testTempVariables",
  62389. protocol: "tests",
  62390. args: [],
  62391. 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.",
  62392. referencedClasses: [],
  62393. pragmas: [],
  62394. messageSends: ["should:return:"]
  62395. }, function ($methodClass){ return function (){
  62396. var self=this,$self=this;
  62397. return $core.withContext(function($ctx1) {
  62398. [$self._should_return_("foo | a | ^ a",nil)
  62399. ,$ctx1.sendIdx["should:return:"]=1
  62400. ][0];
  62401. [$self._should_return_("foo | AVariable | ^ AVariable",nil)
  62402. ,$ctx1.sendIdx["should:return:"]=2
  62403. ][0];
  62404. [$self._should_return_("foo | a b c | ^ c",nil)
  62405. ,$ctx1.sendIdx["should:return:"]=3
  62406. ][0];
  62407. [$self._should_return_("foo | a | [ | d | ^ d ] value",nil)
  62408. ,$ctx1.sendIdx["should:return:"]=4
  62409. ][0];
  62410. [$self._should_return_("foo | a | a:= 1. ^ a",(1))
  62411. ,$ctx1.sendIdx["should:return:"]=5
  62412. ][0];
  62413. $self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  62414. return self;
  62415. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{})});
  62416. }; }),
  62417. $globals.AbstractCompilerTest);
  62418. $core.addMethod(
  62419. $core.method({
  62420. selector: "testThisContext",
  62421. protocol: "tests",
  62422. args: [],
  62423. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  62424. referencedClasses: [],
  62425. pragmas: [],
  62426. messageSends: ["should:return:"]
  62427. }, function ($methodClass){ return function (){
  62428. var self=this,$self=this;
  62429. return $core.withContext(function($ctx1) {
  62430. $self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  62431. return self;
  62432. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{})});
  62433. }; }),
  62434. $globals.AbstractCompilerTest);
  62435. $core.addMethod(
  62436. $core.method({
  62437. selector: "testUnknownPragma",
  62438. protocol: "tests",
  62439. args: [],
  62440. source: "testUnknownPragma\x0a\x09self should: 'foo < fooBar: ''return 2+3'' > | x | ^ x := 6' return: 6.\x0a\x09self should: 'foo | x | < fooBar: ''return 2+3'' > ^ x := 6' return: 6",
  62441. referencedClasses: [],
  62442. pragmas: [],
  62443. messageSends: ["should:return:"]
  62444. }, function ($methodClass){ return function (){
  62445. var self=this,$self=this;
  62446. return $core.withContext(function($ctx1) {
  62447. [$self._should_return_("foo < fooBar: 'return 2+3' > | x | ^ x := 6",(6))
  62448. ,$ctx1.sendIdx["should:return:"]=1
  62449. ][0];
  62450. $self._should_return_("foo | x | < fooBar: 'return 2+3' > ^ x := 6",(6));
  62451. return self;
  62452. }, function($ctx1) {$ctx1.fill(self,"testUnknownPragma",{})});
  62453. }; }),
  62454. $globals.AbstractCompilerTest);
  62455. $core.addMethod(
  62456. $core.method({
  62457. selector: "testifFalse",
  62458. protocol: "tests",
  62459. args: [],
  62460. 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.",
  62461. referencedClasses: [],
  62462. pragmas: [],
  62463. messageSends: ["should:return:"]
  62464. }, function ($methodClass){ return function (){
  62465. var self=this,$self=this;
  62466. return $core.withContext(function($ctx1) {
  62467. [$self._should_return_("foo true ifFalse: [ ^ 1 ]",$self.receiver)
  62468. ,$ctx1.sendIdx["should:return:"]=1
  62469. ][0];
  62470. [$self._should_return_("foo false ifFalse: [ ^ 2 ]",(2))
  62471. ,$ctx1.sendIdx["should:return:"]=2
  62472. ][0];
  62473. [$self._should_return_("foo ^ true ifFalse: [ 1 ]",nil)
  62474. ,$ctx1.sendIdx["should:return:"]=3
  62475. ][0];
  62476. $self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  62477. return self;
  62478. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{})});
  62479. }; }),
  62480. $globals.AbstractCompilerTest);
  62481. $core.addMethod(
  62482. $core.method({
  62483. selector: "testifFalseIfTrue",
  62484. protocol: "tests",
  62485. args: [],
  62486. 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.",
  62487. referencedClasses: [],
  62488. pragmas: [],
  62489. messageSends: ["should:return:"]
  62490. }, function ($methodClass){ return function (){
  62491. var self=this,$self=this;
  62492. return $core.withContext(function($ctx1) {
  62493. [$self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2))
  62494. ,$ctx1.sendIdx["should:return:"]=1
  62495. ][0];
  62496. [$self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2))
  62497. ,$ctx1.sendIdx["should:return:"]=2
  62498. ][0];
  62499. [$self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2))
  62500. ,$ctx1.sendIdx["should:return:"]=3
  62501. ][0];
  62502. $self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  62503. return self;
  62504. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{})});
  62505. }; }),
  62506. $globals.AbstractCompilerTest);
  62507. $core.addMethod(
  62508. $core.method({
  62509. selector: "testifNil",
  62510. protocol: "tests",
  62511. args: [],
  62512. 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.",
  62513. referencedClasses: [],
  62514. pragmas: [],
  62515. messageSends: ["should:return:"]
  62516. }, function ($methodClass){ return function (){
  62517. var self=this,$self=this;
  62518. return $core.withContext(function($ctx1) {
  62519. [$self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1))
  62520. ,$ctx1.sendIdx["should:return:"]=1
  62521. ][0];
  62522. [$self._should_return_("foo ^ nil ifNil: [ 2 ]",(2))
  62523. ,$ctx1.sendIdx["should:return:"]=2
  62524. ][0];
  62525. [$self._should_return_("foo 1 ifNil: [ ^ 2 ]",$self.receiver)
  62526. ,$ctx1.sendIdx["should:return:"]=3
  62527. ][0];
  62528. $self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  62529. return self;
  62530. }, function($ctx1) {$ctx1.fill(self,"testifNil",{})});
  62531. }; }),
  62532. $globals.AbstractCompilerTest);
  62533. $core.addMethod(
  62534. $core.method({
  62535. selector: "testifNilIfNotNil",
  62536. protocol: "tests",
  62537. args: [],
  62538. 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.",
  62539. referencedClasses: [],
  62540. pragmas: [],
  62541. messageSends: ["should:return:"]
  62542. }, function ($methodClass){ return function (){
  62543. var self=this,$self=this;
  62544. return $core.withContext(function($ctx1) {
  62545. [$self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3))
  62546. ,$ctx1.sendIdx["should:return:"]=1
  62547. ][0];
  62548. [$self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2))
  62549. ,$ctx1.sendIdx["should:return:"]=2
  62550. ][0];
  62551. [$self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3))
  62552. ,$ctx1.sendIdx["should:return:"]=3
  62553. ][0];
  62554. $self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  62555. return self;
  62556. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{})});
  62557. }; }),
  62558. $globals.AbstractCompilerTest);
  62559. $core.addMethod(
  62560. $core.method({
  62561. selector: "testifNotNil",
  62562. protocol: "tests",
  62563. args: [],
  62564. 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.",
  62565. referencedClasses: [],
  62566. pragmas: [],
  62567. messageSends: ["should:return:"]
  62568. }, function ($methodClass){ return function (){
  62569. var self=this,$self=this;
  62570. return $core.withContext(function($ctx1) {
  62571. [$self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2))
  62572. ,$ctx1.sendIdx["should:return:"]=1
  62573. ][0];
  62574. [$self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil)
  62575. ,$ctx1.sendIdx["should:return:"]=2
  62576. ][0];
  62577. [$self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2))
  62578. ,$ctx1.sendIdx["should:return:"]=3
  62579. ][0];
  62580. $self._should_return_("foo nil ifNotNil: [ ^ 2 ]",$self.receiver);
  62581. return self;
  62582. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{})});
  62583. }; }),
  62584. $globals.AbstractCompilerTest);
  62585. $core.addMethod(
  62586. $core.method({
  62587. selector: "testifNotNilWithArgument",
  62588. protocol: "tests",
  62589. args: [],
  62590. 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",
  62591. referencedClasses: [],
  62592. pragmas: [],
  62593. messageSends: ["should:return:"]
  62594. }, function ($methodClass){ return function (){
  62595. var self=this,$self=this;
  62596. return $core.withContext(function($ctx1) {
  62597. [$self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3))
  62598. ,$ctx1.sendIdx["should:return:"]=1
  62599. ][0];
  62600. [$self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil)
  62601. ,$ctx1.sendIdx["should:return:"]=2
  62602. ][0];
  62603. [$self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3))
  62604. ,$ctx1.sendIdx["should:return:"]=3
  62605. ][0];
  62606. [$self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5))
  62607. ,$ctx1.sendIdx["should:return:"]=4
  62608. ][0];
  62609. [$self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3))
  62610. ,$ctx1.sendIdx["should:return:"]=5
  62611. ][0];
  62612. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  62613. return self;
  62614. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{})});
  62615. }; }),
  62616. $globals.AbstractCompilerTest);
  62617. $core.addMethod(
  62618. $core.method({
  62619. selector: "testifTrue",
  62620. protocol: "tests",
  62621. args: [],
  62622. 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.",
  62623. referencedClasses: [],
  62624. pragmas: [],
  62625. messageSends: ["should:return:"]
  62626. }, function ($methodClass){ return function (){
  62627. var self=this,$self=this;
  62628. return $core.withContext(function($ctx1) {
  62629. [$self._should_return_("foo false ifTrue: [ ^ 1 ]",$self.receiver)
  62630. ,$ctx1.sendIdx["should:return:"]=1
  62631. ][0];
  62632. [$self._should_return_("foo true ifTrue: [ ^ 2 ]",(2))
  62633. ,$ctx1.sendIdx["should:return:"]=2
  62634. ][0];
  62635. [$self._should_return_("foo ^ false ifTrue: [ 1 ]",nil)
  62636. ,$ctx1.sendIdx["should:return:"]=3
  62637. ][0];
  62638. $self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  62639. return self;
  62640. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{})});
  62641. }; }),
  62642. $globals.AbstractCompilerTest);
  62643. $core.addMethod(
  62644. $core.method({
  62645. selector: "testifTrueIfFalse",
  62646. protocol: "tests",
  62647. args: [],
  62648. 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.",
  62649. referencedClasses: [],
  62650. pragmas: [],
  62651. messageSends: ["should:return:"]
  62652. }, function ($methodClass){ return function (){
  62653. var self=this,$self=this;
  62654. return $core.withContext(function($ctx1) {
  62655. [$self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2))
  62656. ,$ctx1.sendIdx["should:return:"]=1
  62657. ][0];
  62658. [$self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1))
  62659. ,$ctx1.sendIdx["should:return:"]=2
  62660. ][0];
  62661. [$self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1))
  62662. ,$ctx1.sendIdx["should:return:"]=3
  62663. ][0];
  62664. $self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  62665. return self;
  62666. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{})});
  62667. }; }),
  62668. $globals.AbstractCompilerTest);
  62669. $core.addMethod(
  62670. $core.method({
  62671. selector: "isAbstract",
  62672. protocol: "testing",
  62673. args: [],
  62674. source: "isAbstract\x0a\x09^ self name = AbstractCompilerTest name",
  62675. referencedClasses: ["AbstractCompilerTest"],
  62676. pragmas: [],
  62677. messageSends: ["=", "name"]
  62678. }, function ($methodClass){ return function (){
  62679. var self=this,$self=this;
  62680. return $core.withContext(function($ctx1) {
  62681. return $recv([$self._name()
  62682. ,$ctx1.sendIdx["name"]=1
  62683. ][0]).__eq($recv($globals.AbstractCompilerTest)._name());
  62684. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{})});
  62685. }; }),
  62686. $globals.AbstractCompilerTest.a$cls);
  62687. $core.addClass("ASTDebuggerTest", $globals.AbstractCompilerTest, [], "Compiler-Tests");
  62688. $core.addClass("ASTInterpreterTest", $globals.AbstractCompilerTest, [], "Compiler-Tests");
  62689. $core.addClass("CodeGeneratorTest", $globals.AbstractCompilerTest, [], "Compiler-Tests");
  62690. $core.addClass("InliningCodeGeneratorTest", $globals.AbstractCompilerTest, [], "Compiler-Tests");
  62691. $core.addClass("AbstractJavaScriptGatewayTest", $globals.ASTMethodRunningTest, ["theClass"], "Compiler-Tests");
  62692. $core.addMethod(
  62693. $core.method({
  62694. selector: "jsConstructor",
  62695. protocol: "running",
  62696. args: [],
  62697. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09var ctr = function () {};\x0a\x09\x09ctr.prototype.foo = function (a,b) {return a+\x22,\x22+b};\x0a\x09\x09return ctr;\x0a\x09'>",
  62698. referencedClasses: [],
  62699. pragmas: [["inlineJS:", ["\x0a\x09\x09var ctr = function () {};\x0a\x09\x09ctr.prototype.foo = function (a,b) {return a+\x22,\x22+b};\x0a\x09\x09return ctr;\x0a\x09"]]],
  62700. messageSends: []
  62701. }, function ($methodClass){ return function (){
  62702. var self=this,$self=this;
  62703. return $core.withContext(function($ctx1) {
  62704. var ctr = function () {};
  62705. ctr.prototype.foo = function (a,b) {return a+","+b};
  62706. return ctr;
  62707. ;
  62708. return self;
  62709. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{})});
  62710. }; }),
  62711. $globals.AbstractJavaScriptGatewayTest);
  62712. $core.addMethod(
  62713. $core.method({
  62714. selector: "testDyadicSuperDifferentNames",
  62715. protocol: "tests",
  62716. args: [],
  62717. source: "testDyadicSuperDifferentNames\x0a\x09theClass := ObjectMock subclass: #ObjectMock2 slots: #() package: 'Compiler-Tests'.\x0a\x09theClass beJavaScriptSubclassOf: self jsConstructor.\x0a\x09receiver := ObjectMock2 new foo: 'should be shadowed'; yourself.\x0a\x09arguments := #(4 true).\x0a\x09self\x0a\x09\x09should: 'bar: anObject baz: anotherObject\x0a\x09\x09\x09<jsOverride: #foo args: #(anObject anotherObject)>\x0a\x09\x09\x09^ super bar: anObject baz: anotherObject'\x0a\x09\x09return: '4,true'",
  62718. referencedClasses: ["ObjectMock", "ObjectMock2"],
  62719. pragmas: [],
  62720. messageSends: ["subclass:slots:package:", "beJavaScriptSubclassOf:", "jsConstructor", "foo:", "new", "yourself", "should:return:"]
  62721. }, function ($methodClass){ return function (){
  62722. var self=this,$self=this;
  62723. return $core.withContext(function($ctx1) {
  62724. var $1;
  62725. $self.theClass=$recv($globals.ObjectMock)._subclass_slots_package_("ObjectMock2",[],"Compiler-Tests");
  62726. $recv($self.theClass)._beJavaScriptSubclassOf_($self._jsConstructor());
  62727. $1=$recv($globals.ObjectMock2)._new();
  62728. $recv($1)._foo_("should be shadowed");
  62729. $self.receiver=$recv($1)._yourself();
  62730. $self.arguments=[(4), true];
  62731. $self._should_return_("bar: anObject baz: anotherObject\x0a\x09\x09\x09<jsOverride: #foo args: #(anObject anotherObject)>\x0a\x09\x09\x09^ super bar: anObject baz: anotherObject","4,true");
  62732. return self;
  62733. }, function($ctx1) {$ctx1.fill(self,"testDyadicSuperDifferentNames",{})});
  62734. }; }),
  62735. $globals.AbstractJavaScriptGatewayTest);
  62736. $core.addMethod(
  62737. $core.method({
  62738. selector: "testDyadicSuperDifferentNamesNested",
  62739. protocol: "tests",
  62740. args: [],
  62741. source: "testDyadicSuperDifferentNamesNested\x0a\x09theClass := ObjectMock subclass: #ObjectMock2 slots: #() package: 'Compiler-Tests'.\x0a\x09theClass beJavaScriptSubclassOf: self jsConstructor.\x0a\x09receiver := ObjectMock2 new foo: 'should be shadowed'; yourself.\x0a\x09arguments := #(4 true).\x0a\x09self\x0a\x09\x09should: 'bar: anObject baz: anotherObject\x0a\x09\x09\x09<jsOverride: #foo args: #(anObject anotherObject)>\x0a\x09\x09\x09^ [ super bar: anObject baz: anotherObject ] value'\x0a\x09\x09return: '4,true'",
  62742. referencedClasses: ["ObjectMock", "ObjectMock2"],
  62743. pragmas: [],
  62744. messageSends: ["subclass:slots:package:", "beJavaScriptSubclassOf:", "jsConstructor", "foo:", "new", "yourself", "should:return:"]
  62745. }, function ($methodClass){ return function (){
  62746. var self=this,$self=this;
  62747. return $core.withContext(function($ctx1) {
  62748. var $1;
  62749. $self.theClass=$recv($globals.ObjectMock)._subclass_slots_package_("ObjectMock2",[],"Compiler-Tests");
  62750. $recv($self.theClass)._beJavaScriptSubclassOf_($self._jsConstructor());
  62751. $1=$recv($globals.ObjectMock2)._new();
  62752. $recv($1)._foo_("should be shadowed");
  62753. $self.receiver=$recv($1)._yourself();
  62754. $self.arguments=[(4), true];
  62755. $self._should_return_("bar: anObject baz: anotherObject\x0a\x09\x09\x09<jsOverride: #foo args: #(anObject anotherObject)>\x0a\x09\x09\x09^ [ super bar: anObject baz: anotherObject ] value","4,true");
  62756. return self;
  62757. }, function($ctx1) {$ctx1.fill(self,"testDyadicSuperDifferentNamesNested",{})});
  62758. }; }),
  62759. $globals.AbstractJavaScriptGatewayTest);
  62760. $core.addMethod(
  62761. $core.method({
  62762. selector: "testDyadicSuperDifferentNamesPermutated",
  62763. protocol: "tests",
  62764. args: [],
  62765. source: "testDyadicSuperDifferentNamesPermutated\x0a\x09theClass := ObjectMock subclass: #ObjectMock2 slots: #() package: 'Compiler-Tests'.\x0a\x09theClass beJavaScriptSubclassOf: self jsConstructor.\x0a\x09receiver := ObjectMock2 new foo: 'should be shadowed'; yourself.\x0a\x09arguments := #(4 true).\x0a\x09self\x0a\x09\x09should: 'bar: anObject baz: anotherObject\x0a\x09\x09\x09<jsOverride: #foo args: #(anotherObject anObject)>\x0a\x09\x09\x09^ super bar: anObject baz: anotherObject'\x0a\x09\x09return: 'true,4'",
  62766. referencedClasses: ["ObjectMock", "ObjectMock2"],
  62767. pragmas: [],
  62768. messageSends: ["subclass:slots:package:", "beJavaScriptSubclassOf:", "jsConstructor", "foo:", "new", "yourself", "should:return:"]
  62769. }, function ($methodClass){ return function (){
  62770. var self=this,$self=this;
  62771. return $core.withContext(function($ctx1) {
  62772. var $1;
  62773. $self.theClass=$recv($globals.ObjectMock)._subclass_slots_package_("ObjectMock2",[],"Compiler-Tests");
  62774. $recv($self.theClass)._beJavaScriptSubclassOf_($self._jsConstructor());
  62775. $1=$recv($globals.ObjectMock2)._new();
  62776. $recv($1)._foo_("should be shadowed");
  62777. $self.receiver=$recv($1)._yourself();
  62778. $self.arguments=[(4), true];
  62779. $self._should_return_("bar: anObject baz: anotherObject\x0a\x09\x09\x09<jsOverride: #foo args: #(anotherObject anObject)>\x0a\x09\x09\x09^ super bar: anObject baz: anotherObject","true,4");
  62780. return self;
  62781. }, function($ctx1) {$ctx1.fill(self,"testDyadicSuperDifferentNamesPermutated",{})});
  62782. }; }),
  62783. $globals.AbstractJavaScriptGatewayTest);
  62784. $core.addMethod(
  62785. $core.method({
  62786. selector: "testMonadicSuperDifferentNames",
  62787. protocol: "tests",
  62788. args: [],
  62789. source: "testMonadicSuperDifferentNames\x0a\x09theClass := ObjectMock subclass: #ObjectMock2 slots: #() package: 'Compiler-Tests'.\x0a\x09theClass beJavaScriptSubclassOf: self jsConstructor.\x0a\x09receiver := ObjectMock2 new foo: 'should be shadowed'; yourself.\x0a\x09arguments := #(4).\x0a\x09self\x0a\x09\x09should: 'bar: anObject <jsOverride: #foo args: #(anObject)> ^ super bar: anObject'\x0a\x09\x09return: '4,undefined'",
  62790. referencedClasses: ["ObjectMock", "ObjectMock2"],
  62791. pragmas: [],
  62792. messageSends: ["subclass:slots:package:", "beJavaScriptSubclassOf:", "jsConstructor", "foo:", "new", "yourself", "should:return:"]
  62793. }, function ($methodClass){ return function (){
  62794. var self=this,$self=this;
  62795. return $core.withContext(function($ctx1) {
  62796. var $1;
  62797. $self.theClass=$recv($globals.ObjectMock)._subclass_slots_package_("ObjectMock2",[],"Compiler-Tests");
  62798. $recv($self.theClass)._beJavaScriptSubclassOf_($self._jsConstructor());
  62799. $1=$recv($globals.ObjectMock2)._new();
  62800. $recv($1)._foo_("should be shadowed");
  62801. $self.receiver=$recv($1)._yourself();
  62802. $self.arguments=[(4)];
  62803. $self._should_return_("bar: anObject <jsOverride: #foo args: #(anObject)> ^ super bar: anObject","4,undefined");
  62804. return self;
  62805. }, function($ctx1) {$ctx1.fill(self,"testMonadicSuperDifferentNames",{})});
  62806. }; }),
  62807. $globals.AbstractJavaScriptGatewayTest);
  62808. $core.addMethod(
  62809. $core.method({
  62810. selector: "testNiladicSuper",
  62811. protocol: "tests",
  62812. args: [],
  62813. source: "testNiladicSuper\x0a\x09theClass := ObjectMock subclass: #ObjectMock2 slots: #() package: 'Compiler-Tests'.\x0a\x09theClass beJavaScriptSubclassOf: self jsConstructor.\x0a\x09self\x0a\x09\x09should: 'foo <jsOverride: #foo> ^ super foo'\x0a\x09\x09receiver: (ObjectMock2 new foo: 'should be shadowed'; yourself)\x0a\x09\x09return: 'undefined,undefined'",
  62814. referencedClasses: ["ObjectMock", "ObjectMock2"],
  62815. pragmas: [],
  62816. messageSends: ["subclass:slots:package:", "beJavaScriptSubclassOf:", "jsConstructor", "should:receiver:return:", "foo:", "new", "yourself"]
  62817. }, function ($methodClass){ return function (){
  62818. var self=this,$self=this;
  62819. return $core.withContext(function($ctx1) {
  62820. var $1;
  62821. $self.theClass=$recv($globals.ObjectMock)._subclass_slots_package_("ObjectMock2",[],"Compiler-Tests");
  62822. $recv($self.theClass)._beJavaScriptSubclassOf_($self._jsConstructor());
  62823. $1=$recv($globals.ObjectMock2)._new();
  62824. $recv($1)._foo_("should be shadowed");
  62825. $self._should_receiver_return_("foo <jsOverride: #foo> ^ super foo",$recv($1)._yourself(),"undefined,undefined");
  62826. return self;
  62827. }, function($ctx1) {$ctx1.fill(self,"testNiladicSuper",{})});
  62828. }; }),
  62829. $globals.AbstractJavaScriptGatewayTest);
  62830. $core.addMethod(
  62831. $core.method({
  62832. selector: "testNiladicSuperDifferentNames",
  62833. protocol: "tests",
  62834. args: [],
  62835. source: "testNiladicSuperDifferentNames\x0a\x09theClass := ObjectMock subclass: #ObjectMock2 slots: #() package: 'Compiler-Tests'.\x0a\x09theClass beJavaScriptSubclassOf: self jsConstructor.\x0a\x09self\x0a\x09\x09should: 'bar <jsOverride: #foo> ^ super bar'\x0a\x09\x09receiver: (ObjectMock2 new foo: 'should be shadowed'; yourself)\x0a\x09\x09return: 'undefined,undefined'",
  62836. referencedClasses: ["ObjectMock", "ObjectMock2"],
  62837. pragmas: [],
  62838. messageSends: ["subclass:slots:package:", "beJavaScriptSubclassOf:", "jsConstructor", "should:receiver:return:", "foo:", "new", "yourself"]
  62839. }, function ($methodClass){ return function (){
  62840. var self=this,$self=this;
  62841. return $core.withContext(function($ctx1) {
  62842. var $1;
  62843. $self.theClass=$recv($globals.ObjectMock)._subclass_slots_package_("ObjectMock2",[],"Compiler-Tests");
  62844. $recv($self.theClass)._beJavaScriptSubclassOf_($self._jsConstructor());
  62845. $1=$recv($globals.ObjectMock2)._new();
  62846. $recv($1)._foo_("should be shadowed");
  62847. $self._should_receiver_return_("bar <jsOverride: #foo> ^ super bar",$recv($1)._yourself(),"undefined,undefined");
  62848. return self;
  62849. }, function($ctx1) {$ctx1.fill(self,"testNiladicSuperDifferentNames",{})});
  62850. }; }),
  62851. $globals.AbstractJavaScriptGatewayTest);
  62852. $core.addMethod(
  62853. $core.method({
  62854. selector: "testNiladicSuperNested",
  62855. protocol: "tests",
  62856. args: [],
  62857. source: "testNiladicSuperNested\x0a\x09theClass := ObjectMock subclass: #ObjectMock2 slots: #() package: 'Compiler-Tests'.\x0a\x09theClass beJavaScriptSubclassOf: self jsConstructor.\x0a\x09self\x0a\x09\x09should: 'foo <jsOverride: #foo> ^ [ super foo ] value'\x0a\x09\x09receiver: (ObjectMock2 new foo: 'should be shadowed'; yourself)\x0a\x09\x09return: 'undefined,undefined'",
  62858. referencedClasses: ["ObjectMock", "ObjectMock2"],
  62859. pragmas: [],
  62860. messageSends: ["subclass:slots:package:", "beJavaScriptSubclassOf:", "jsConstructor", "should:receiver:return:", "foo:", "new", "yourself"]
  62861. }, function ($methodClass){ return function (){
  62862. var self=this,$self=this;
  62863. return $core.withContext(function($ctx1) {
  62864. var $1;
  62865. $self.theClass=$recv($globals.ObjectMock)._subclass_slots_package_("ObjectMock2",[],"Compiler-Tests");
  62866. $recv($self.theClass)._beJavaScriptSubclassOf_($self._jsConstructor());
  62867. $1=$recv($globals.ObjectMock2)._new();
  62868. $recv($1)._foo_("should be shadowed");
  62869. $self._should_receiver_return_("foo <jsOverride: #foo> ^ [ super foo ] value",$recv($1)._yourself(),"undefined,undefined");
  62870. return self;
  62871. }, function($ctx1) {$ctx1.fill(self,"testNiladicSuperNested",{})});
  62872. }; }),
  62873. $globals.AbstractJavaScriptGatewayTest);
  62874. $core.addMethod(
  62875. $core.method({
  62876. selector: "testTriadicSuperDifferentNamesPermutated",
  62877. protocol: "tests",
  62878. args: [],
  62879. source: "testTriadicSuperDifferentNamesPermutated\x0a\x09theClass := ObjectMock subclass: #ObjectMock2 slots: #() package: 'Compiler-Tests'.\x0a\x09theClass beJavaScriptSubclassOf: self jsConstructor.\x0a\x09receiver := ObjectMock2 new foo: 'should be shadowed'; yourself.\x0a\x09arguments := #(4 true 'hello').\x0a\x09self\x0a\x09\x09should: 'bar: anObject baz: anotherObject moo: yao\x0a\x09\x09\x09<jsOverride: #foo args: #(yao anObject anotherObject)>\x0a\x09\x09\x09^ super bar: anObject baz: anotherObject moo: yao'\x0a\x09\x09return: 'hello,4'",
  62880. referencedClasses: ["ObjectMock", "ObjectMock2"],
  62881. pragmas: [],
  62882. messageSends: ["subclass:slots:package:", "beJavaScriptSubclassOf:", "jsConstructor", "foo:", "new", "yourself", "should:return:"]
  62883. }, function ($methodClass){ return function (){
  62884. var self=this,$self=this;
  62885. return $core.withContext(function($ctx1) {
  62886. var $1;
  62887. $self.theClass=$recv($globals.ObjectMock)._subclass_slots_package_("ObjectMock2",[],"Compiler-Tests");
  62888. $recv($self.theClass)._beJavaScriptSubclassOf_($self._jsConstructor());
  62889. $1=$recv($globals.ObjectMock2)._new();
  62890. $recv($1)._foo_("should be shadowed");
  62891. $self.receiver=$recv($1)._yourself();
  62892. $self.arguments=[(4), true, "hello"];
  62893. $self._should_return_("bar: anObject baz: anotherObject moo: yao\x0a\x09\x09\x09<jsOverride: #foo args: #(yao anObject anotherObject)>\x0a\x09\x09\x09^ super bar: anObject baz: anotherObject moo: yao","hello,4");
  62894. return self;
  62895. }, function($ctx1) {$ctx1.fill(self,"testTriadicSuperDifferentNamesPermutated",{})});
  62896. }; }),
  62897. $globals.AbstractJavaScriptGatewayTest);
  62898. $core.addMethod(
  62899. $core.method({
  62900. selector: "theClass",
  62901. protocol: "accessing",
  62902. args: [],
  62903. source: "theClass\x0a\x09^ theClass",
  62904. referencedClasses: [],
  62905. pragmas: [],
  62906. messageSends: []
  62907. }, function ($methodClass){ return function (){
  62908. var self=this,$self=this;
  62909. return $self.theClass;
  62910. }; }),
  62911. $globals.AbstractJavaScriptGatewayTest);
  62912. $core.addMethod(
  62913. $core.method({
  62914. selector: "isAbstract",
  62915. protocol: "testing",
  62916. args: [],
  62917. source: "isAbstract\x0a\x09^ self name = AbstractJavaScriptGatewayTest name",
  62918. referencedClasses: ["AbstractJavaScriptGatewayTest"],
  62919. pragmas: [],
  62920. messageSends: ["=", "name"]
  62921. }, function ($methodClass){ return function (){
  62922. var self=this,$self=this;
  62923. return $core.withContext(function($ctx1) {
  62924. return $recv([$self._name()
  62925. ,$ctx1.sendIdx["name"]=1
  62926. ][0]).__eq($recv($globals.AbstractJavaScriptGatewayTest)._name());
  62927. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{})});
  62928. }; }),
  62929. $globals.AbstractJavaScriptGatewayTest.a$cls);
  62930. $core.addClass("DebuggedJSGTest", $globals.AbstractJavaScriptGatewayTest, [], "Compiler-Tests");
  62931. $core.addClass("InlinedJSGTest", $globals.AbstractJavaScriptGatewayTest, [], "Compiler-Tests");
  62932. $core.addClass("InterpretedJSGTest", $globals.AbstractJavaScriptGatewayTest, [], "Compiler-Tests");
  62933. $core.addClass("PlainJSGTest", $globals.AbstractJavaScriptGatewayTest, [], "Compiler-Tests");
  62934. $core.addClass("ASTPCNodeVisitorTest", $globals.TestCase, [], "Compiler-Tests");
  62935. $core.addMethod(
  62936. $core.method({
  62937. selector: "astPCNodeVisitor",
  62938. protocol: "factory",
  62939. args: [],
  62940. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  62941. referencedClasses: ["ASTPCNodeVisitor"],
  62942. pragmas: [],
  62943. messageSends: ["index:", "new", "yourself"]
  62944. }, function ($methodClass){ return function (){
  62945. var self=this,$self=this;
  62946. return $core.withContext(function($ctx1) {
  62947. var $1;
  62948. $1=$recv($globals.ASTPCNodeVisitor)._new();
  62949. $recv($1)._index_((0));
  62950. return $recv($1)._yourself();
  62951. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{})});
  62952. }; }),
  62953. $globals.ASTPCNodeVisitorTest);
  62954. $core.addMethod(
  62955. $core.method({
  62956. selector: "astPCNodeVisitorForSelector:",
  62957. protocol: "factory",
  62958. args: ["aString"],
  62959. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  62960. referencedClasses: ["ASTPCNodeVisitor"],
  62961. pragmas: [],
  62962. messageSends: ["selector:", "new", "index:", "yourself"]
  62963. }, function ($methodClass){ return function (aString){
  62964. var self=this,$self=this;
  62965. return $core.withContext(function($ctx1) {
  62966. var $1;
  62967. $1=$recv($globals.ASTPCNodeVisitor)._new();
  62968. $recv($1)._selector_(aString);
  62969. $recv($1)._index_((0));
  62970. return $recv($1)._yourself();
  62971. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString})});
  62972. }; }),
  62973. $globals.ASTPCNodeVisitorTest);
  62974. $core.addMethod(
  62975. $core.method({
  62976. selector: "newTeachableVisitor",
  62977. protocol: "factory",
  62978. args: [],
  62979. source: "newTeachableVisitor\x0a\x09| result |\x0a\x09result := Teachable new\x0a\x09\x09whenSend: #visit: evaluate: [ :one | one acceptDagVisitor: result ];\x0a\x09\x09acceptSend: #visitDagNode:.\x0a\x09^ result",
  62980. referencedClasses: ["Teachable"],
  62981. pragmas: [],
  62982. messageSends: ["whenSend:evaluate:", "new", "acceptDagVisitor:", "acceptSend:"]
  62983. }, function ($methodClass){ return function (){
  62984. var self=this,$self=this;
  62985. var result;
  62986. return $core.withContext(function($ctx1) {
  62987. var $1;
  62988. $1=$recv($globals.Teachable)._new();
  62989. $recv($1)._whenSend_evaluate_("visit:",(function(one){
  62990. return $core.withContext(function($ctx2) {
  62991. return $recv(one)._acceptDagVisitor_(result);
  62992. }, function($ctx2) {$ctx2.fillBlock({one:one},$ctx1,1)});
  62993. }));
  62994. result=$recv($1)._acceptSend_("visitDagNode:");
  62995. return result;
  62996. }, function($ctx1) {$ctx1.fill(self,"newTeachableVisitor",{result:result})});
  62997. }; }),
  62998. $globals.ASTPCNodeVisitorTest);
  62999. $core.addMethod(
  63000. $core.method({
  63001. selector: "testJSStatementNode",
  63002. protocol: "tests",
  63003. args: [],
  63004. source: "testJSStatementNode\x0a\x09| ast result |\x0a\x09\x0a\x09ast := self parse: 'foo <inlineJS: ''consolee.log(1)''>' forClass: Object.\x0a\x09result := self astPCNodeVisitor visit: ast; currentNode.\x0a\x09self\x0a\x09\x09assert: ((self newTeachableVisitor whenSend: #visitJSStatementNode: return: 'JS'; yourself) visit: result)\x0a\x09\x09equals: 'JS'",
  63005. referencedClasses: ["Object"],
  63006. pragmas: [],
  63007. messageSends: ["parse:forClass:", "visit:", "astPCNodeVisitor", "currentNode", "assert:equals:", "whenSend:return:", "newTeachableVisitor", "yourself"]
  63008. }, function ($methodClass){ return function (){
  63009. var self=this,$self=this;
  63010. var ast,result;
  63011. return $core.withContext(function($ctx1) {
  63012. var $1,$2;
  63013. ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  63014. $1=$self._astPCNodeVisitor();
  63015. [$recv($1)._visit_(ast)
  63016. ,$ctx1.sendIdx["visit:"]=1
  63017. ][0];
  63018. result=$recv($1)._currentNode();
  63019. $2=$self._newTeachableVisitor();
  63020. $recv($2)._whenSend_return_("visitJSStatementNode:","JS");
  63021. $self._assert_equals_($recv($recv($2)._yourself())._visit_(result),"JS");
  63022. return self;
  63023. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,result:result})});
  63024. }; }),
  63025. $globals.ASTPCNodeVisitorTest);
  63026. $core.addMethod(
  63027. $core.method({
  63028. selector: "testMessageSend",
  63029. protocol: "tests",
  63030. args: [],
  63031. 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'",
  63032. referencedClasses: ["Object"],
  63033. pragmas: [],
  63034. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  63035. }, function ($methodClass){ return function (){
  63036. var self=this,$self=this;
  63037. var ast;
  63038. return $core.withContext(function($ctx1) {
  63039. var $1;
  63040. ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  63041. $1=$self._astPCNodeVisitorForSelector_("yourself");
  63042. $recv($1)._visit_(ast);
  63043. $self._assert_equals_($recv($recv($1)._currentNode())._selector(),"yourself");
  63044. return self;
  63045. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast})});
  63046. }; }),
  63047. $globals.ASTPCNodeVisitorTest);
  63048. $core.addMethod(
  63049. $core.method({
  63050. selector: "testMessageSendWithBlocks",
  63051. protocol: "tests",
  63052. args: [],
  63053. 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'",
  63054. referencedClasses: ["Object"],
  63055. pragmas: [],
  63056. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  63057. }, function ($methodClass){ return function (){
  63058. var self=this,$self=this;
  63059. var ast;
  63060. return $core.withContext(function($ctx1) {
  63061. var $1;
  63062. ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  63063. $1=$self._astPCNodeVisitorForSelector_("yourself");
  63064. $recv($1)._visit_(ast);
  63065. $self._assert_equals_($recv($recv($1)._currentNode())._selector(),"yourself");
  63066. return self;
  63067. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast})});
  63068. }; }),
  63069. $globals.ASTPCNodeVisitorTest);
  63070. $core.addMethod(
  63071. $core.method({
  63072. selector: "testMessageSendWithInlining",
  63073. protocol: "tests",
  63074. args: [],
  63075. 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'",
  63076. referencedClasses: ["Object"],
  63077. pragmas: [],
  63078. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  63079. }, function ($methodClass){ return function (){
  63080. var self=this,$self=this;
  63081. var ast;
  63082. return $core.withContext(function($ctx1) {
  63083. var $1,$2;
  63084. ast=[$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object)
  63085. ,$ctx1.sendIdx["parse:forClass:"]=1
  63086. ][0];
  63087. $1=[$self._astPCNodeVisitorForSelector_("yourself")
  63088. ,$ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1
  63089. ][0];
  63090. [$recv($1)._visit_(ast)
  63091. ,$ctx1.sendIdx["visit:"]=1
  63092. ][0];
  63093. [$self._assert_equals_([$recv([$recv($1)._currentNode()
  63094. ,$ctx1.sendIdx["currentNode"]=1
  63095. ][0])._selector()
  63096. ,$ctx1.sendIdx["selector"]=1
  63097. ][0],"yourself")
  63098. ,$ctx1.sendIdx["assert:equals:"]=1
  63099. ][0];
  63100. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  63101. $2=$self._astPCNodeVisitorForSelector_("asBoolean");
  63102. $recv($2)._visit_(ast);
  63103. $self._assert_equals_($recv($recv($2)._currentNode())._selector(),"asBoolean");
  63104. return self;
  63105. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast})});
  63106. }; }),
  63107. $globals.ASTPCNodeVisitorTest);
  63108. $core.addMethod(
  63109. $core.method({
  63110. selector: "testNoMessageSend",
  63111. protocol: "tests",
  63112. args: [],
  63113. 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",
  63114. referencedClasses: ["Object"],
  63115. pragmas: [],
  63116. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  63117. }, function ($methodClass){ return function (){
  63118. var self=this,$self=this;
  63119. var ast;
  63120. return $core.withContext(function($ctx1) {
  63121. var $1;
  63122. ast=$self._parse_forClass_("foo ^ self",$globals.Object);
  63123. $1=$self._astPCNodeVisitor();
  63124. $recv($1)._visit_(ast);
  63125. $self._assert_($recv($recv($1)._currentNode())._isNil());
  63126. return self;
  63127. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast})});
  63128. }; }),
  63129. $globals.ASTPCNodeVisitorTest);
  63130. $core.addClass("ASTPositionTest", $globals.TestCase, [], "Compiler-Tests");
  63131. $core.addMethod(
  63132. $core.method({
  63133. selector: "testNodeAtPosition",
  63134. protocol: "tests",
  63135. args: [],
  63136. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  63137. referencedClasses: ["Object"],
  63138. pragmas: [],
  63139. messageSends: ["parse:forClass:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  63140. }, function ($methodClass){ return function (){
  63141. var self=this,$self=this;
  63142. var node;
  63143. return $core.withContext(function($ctx1) {
  63144. node=[$self._parse_forClass_("yourself\x0a\x09^ self",$globals.Object)
  63145. ,$ctx1.sendIdx["parse:forClass:"]=1
  63146. ][0];
  63147. [$self._assert_equals_($recv([$recv(node)._navigationNodeAt_ifAbsent_([(2).__at((4))
  63148. ,$ctx1.sendIdx["@"]=1
  63149. ][0],(function(){
  63150. return nil;
  63151. }))
  63152. ,$ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1
  63153. ][0])._source(),"self")
  63154. ,$ctx1.sendIdx["assert:equals:"]=1
  63155. ][0];
  63156. node=[$self._parse_forClass_("foo\x0a\x09true ifTrue: [ 1 ]",$globals.Object)
  63157. ,$ctx1.sendIdx["parse:forClass:"]=2
  63158. ][0];
  63159. [$self._assert_equals_([$recv([$recv(node)._navigationNodeAt_ifAbsent_([(2).__at((7))
  63160. ,$ctx1.sendIdx["@"]=2
  63161. ][0],(function(){
  63162. return nil;
  63163. }))
  63164. ,$ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2
  63165. ][0])._selector()
  63166. ,$ctx1.sendIdx["selector"]=1
  63167. ][0],"ifTrue:")
  63168. ,$ctx1.sendIdx["assert:equals:"]=2
  63169. ][0];
  63170. node=$self._parse_forClass_("foo\x0a\x09self foo; bar; baz",$globals.Object);
  63171. $self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  63172. return nil;
  63173. })))._selector(),"foo");
  63174. return self;
  63175. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node})});
  63176. }; }),
  63177. $globals.ASTPositionTest);
  63178. $core.addClass("AbstractCodeGeneratorInstallTest", $globals.TestCase, ["receiver"], "Compiler-Tests");
  63179. $core.addMethod(
  63180. $core.method({
  63181. selector: "receiver",
  63182. protocol: "accessing",
  63183. args: [],
  63184. source: "receiver\x0a\x09^ receiver",
  63185. referencedClasses: [],
  63186. pragmas: [],
  63187. messageSends: []
  63188. }, function ($methodClass){ return function (){
  63189. var self=this,$self=this;
  63190. return $self.receiver;
  63191. }; }),
  63192. $globals.AbstractCodeGeneratorInstallTest);
  63193. $core.addMethod(
  63194. $core.method({
  63195. selector: "shouldntInstall:andRaise:",
  63196. protocol: "testing",
  63197. args: ["aString", "anErrorClass"],
  63198. source: "shouldntInstall: aString andRaise: anErrorClass\x0a\x09| method |\x0a\x0a\x09[ self\x0a\x09\x09should: [ method := self install: aString forClass: receiver class ]\x0a\x09\x09raise: anErrorClass ]\x0a\x09ensure: [ method ifNotNil: [ receiver class removeCompiledMethod: method ] ]",
  63199. referencedClasses: [],
  63200. pragmas: [],
  63201. messageSends: ["ensure:", "should:raise:", "install:forClass:", "class", "ifNotNil:", "removeCompiledMethod:"]
  63202. }, function ($methodClass){ return function (aString,anErrorClass){
  63203. var self=this,$self=this;
  63204. var method;
  63205. return $core.withContext(function($ctx1) {
  63206. var $1;
  63207. $recv((function(){
  63208. return $core.withContext(function($ctx2) {
  63209. return $self._should_raise_((function(){
  63210. return $core.withContext(function($ctx3) {
  63211. method=$self._install_forClass_(aString,[$recv($self.receiver)._class()
  63212. ,$ctx3.sendIdx["class"]=1
  63213. ][0]);
  63214. return method;
  63215. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63216. }),anErrorClass);
  63217. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63218. }))._ensure_((function(){
  63219. return $core.withContext(function($ctx2) {
  63220. $1=method;
  63221. if($1 == null || $1.a$nil){
  63222. return $1;
  63223. } else {
  63224. return $recv($recv($self.receiver)._class())._removeCompiledMethod_(method);
  63225. }
  63226. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  63227. }));
  63228. return self;
  63229. }, function($ctx1) {$ctx1.fill(self,"shouldntInstall:andRaise:",{aString:aString,anErrorClass:anErrorClass,method:method})});
  63230. }; }),
  63231. $globals.AbstractCodeGeneratorInstallTest);
  63232. $core.addMethod(
  63233. $core.method({
  63234. selector: "testDyadicJSOverrideArgMismatch",
  63235. protocol: "tests",
  63236. args: [],
  63237. source: "testDyadicJSOverrideArgMismatch\x0a\x09receiver := ObjectMock new.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux: aNumber foo: anotherNumber\x0a\x09\x09<jsOverride: #mux args: #(anInteger anotherNumber)>\x0a\x09\x09^ (foo := foo * aNumber + anotherNumber)'\x0a\x09\x09andRaise: CompilerError.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux: aNumber foo: anotherNumber\x0a\x09\x09<jsOverride: #mux args: #(aNumber anotherInteger)>\x0a\x09\x09^ (foo := foo * aNumber + anotherNumber)'\x0a\x09\x09andRaise: CompilerError.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux: aNumber foo: anotherNumber\x0a\x09\x09<jsOverride: #mux args: #(anotherNumber anInteger)>\x0a\x09\x09^ (foo := foo * aNumber + anotherNumber)'\x0a\x09\x09andRaise: CompilerError",
  63238. referencedClasses: ["ObjectMock", "CompilerError"],
  63239. pragmas: [],
  63240. messageSends: ["new", "shouldntInstall:andRaise:"]
  63241. }, function ($methodClass){ return function (){
  63242. var self=this,$self=this;
  63243. return $core.withContext(function($ctx1) {
  63244. $self.receiver=$recv($globals.ObjectMock)._new();
  63245. [$self._shouldntInstall_andRaise_("quux: aNumber foo: anotherNumber\x0a\x09\x09<jsOverride: #mux args: #(anInteger anotherNumber)>\x0a\x09\x09^ (foo := foo * aNumber + anotherNumber)",$globals.CompilerError)
  63246. ,$ctx1.sendIdx["shouldntInstall:andRaise:"]=1
  63247. ][0];
  63248. [$self._shouldntInstall_andRaise_("quux: aNumber foo: anotherNumber\x0a\x09\x09<jsOverride: #mux args: #(aNumber anotherInteger)>\x0a\x09\x09^ (foo := foo * aNumber + anotherNumber)",$globals.CompilerError)
  63249. ,$ctx1.sendIdx["shouldntInstall:andRaise:"]=2
  63250. ][0];
  63251. $self._shouldntInstall_andRaise_("quux: aNumber foo: anotherNumber\x0a\x09\x09<jsOverride: #mux args: #(anotherNumber anInteger)>\x0a\x09\x09^ (foo := foo * aNumber + anotherNumber)",$globals.CompilerError);
  63252. return self;
  63253. }, function($ctx1) {$ctx1.fill(self,"testDyadicJSOverrideArgMismatch",{})});
  63254. }; }),
  63255. $globals.AbstractCodeGeneratorInstallTest);
  63256. $core.addMethod(
  63257. $core.method({
  63258. selector: "testDyadicJSOverrideDifferentNames",
  63259. protocol: "tests",
  63260. args: [],
  63261. source: "testDyadicJSOverrideDifferentNames\x0a\x09receiver := ObjectMock new.\x0a\x09receiver foo: 4.\x0a\x09self while: 'quux: anInteger foo: anotherInteger\x0a\x09\x09<jsOverride: #mux args: #(anInteger anotherInteger)>\x0a\x09\x09^ (foo := foo * anInteger + anotherInteger)' should: [\x0a\x09\x09self should: [ receiver mux ] raise: MessageNotUnderstood.\x0a\x09\x09self should: [ receiver mux: 2 and: -1 ] raise: MessageNotUnderstood.\x0a\x09\x09self assert: (receiver basicPerform: #mux withArguments: #(2 -2)) equals: 6.\x0a\x09\x09self assert: (receiver quux: 1 foo: 4) equals: 10.\x0a\x09\x09self should: [ receiver basicPerform: #quux ] raise: Error.\x0a\x09\x09self assert: receiver foo equals: 10 ]",
  63262. referencedClasses: ["ObjectMock", "MessageNotUnderstood", "Error"],
  63263. pragmas: [],
  63264. messageSends: ["new", "foo:", "while:should:", "should:raise:", "mux", "mux:and:", "assert:equals:", "basicPerform:withArguments:", "quux:foo:", "basicPerform:", "foo"]
  63265. }, function ($methodClass){ return function (){
  63266. var self=this,$self=this;
  63267. return $core.withContext(function($ctx1) {
  63268. $self.receiver=$recv($globals.ObjectMock)._new();
  63269. $recv($self.receiver)._foo_((4));
  63270. $self._while_should_("quux: anInteger foo: anotherInteger\x0a\x09\x09<jsOverride: #mux args: #(anInteger anotherInteger)>\x0a\x09\x09^ (foo := foo * anInteger + anotherInteger)",(function(){
  63271. return $core.withContext(function($ctx2) {
  63272. [$self._should_raise_((function(){
  63273. return $core.withContext(function($ctx3) {
  63274. return $recv($self.receiver)._mux();
  63275. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63276. }),$globals.MessageNotUnderstood)
  63277. ,$ctx2.sendIdx["should:raise:"]=1
  63278. ][0];
  63279. [$self._should_raise_((function(){
  63280. return $core.withContext(function($ctx3) {
  63281. return $recv($self.receiver)._mux_and_((2),(-1));
  63282. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  63283. }),$globals.MessageNotUnderstood)
  63284. ,$ctx2.sendIdx["should:raise:"]=2
  63285. ][0];
  63286. [$self._assert_equals_($recv($self.receiver)._basicPerform_withArguments_("mux",[(2), (-2)]),(6))
  63287. ,$ctx2.sendIdx["assert:equals:"]=1
  63288. ][0];
  63289. [$self._assert_equals_($recv($self.receiver)._quux_foo_((1),(4)),(10))
  63290. ,$ctx2.sendIdx["assert:equals:"]=2
  63291. ][0];
  63292. $self._should_raise_((function(){
  63293. return $core.withContext(function($ctx3) {
  63294. return $recv($self.receiver)._basicPerform_("quux");
  63295. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  63296. }),$globals.Error);
  63297. return $self._assert_equals_($recv($self.receiver)._foo(),(10));
  63298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63299. }));
  63300. return self;
  63301. }, function($ctx1) {$ctx1.fill(self,"testDyadicJSOverrideDifferentNames",{})});
  63302. }; }),
  63303. $globals.AbstractCodeGeneratorInstallTest);
  63304. $core.addMethod(
  63305. $core.method({
  63306. selector: "testDyadicJSOverrideDifferentNamesPermutated",
  63307. protocol: "tests",
  63308. args: [],
  63309. source: "testDyadicJSOverrideDifferentNamesPermutated\x0a\x09receiver := ObjectMock new.\x0a\x09receiver foo: 4.\x0a\x09self while: 'quux: anInteger foo: anotherInteger\x0a\x09\x09<jsOverride: #mux args: #(anotherInteger anInteger)>\x0a\x09\x09^ (foo := foo * anInteger + anotherInteger)' should: [\x0a\x09\x09self should: [ receiver mux ] raise: MessageNotUnderstood.\x0a\x09\x09self should: [ receiver mux: 2 and: -1 ] raise: MessageNotUnderstood.\x0a\x09\x09self assert: (receiver basicPerform: #mux withArguments: #(-2 2)) equals: 6.\x0a\x09\x09self assert: (receiver quux: 1 foo: 4) equals: 10.\x0a\x09\x09self should: [ receiver basicPerform: #quux ] raise: Error.\x0a\x09\x09self assert: receiver foo equals: 10 ]",
  63310. referencedClasses: ["ObjectMock", "MessageNotUnderstood", "Error"],
  63311. pragmas: [],
  63312. messageSends: ["new", "foo:", "while:should:", "should:raise:", "mux", "mux:and:", "assert:equals:", "basicPerform:withArguments:", "quux:foo:", "basicPerform:", "foo"]
  63313. }, function ($methodClass){ return function (){
  63314. var self=this,$self=this;
  63315. return $core.withContext(function($ctx1) {
  63316. $self.receiver=$recv($globals.ObjectMock)._new();
  63317. $recv($self.receiver)._foo_((4));
  63318. $self._while_should_("quux: anInteger foo: anotherInteger\x0a\x09\x09<jsOverride: #mux args: #(anotherInteger anInteger)>\x0a\x09\x09^ (foo := foo * anInteger + anotherInteger)",(function(){
  63319. return $core.withContext(function($ctx2) {
  63320. [$self._should_raise_((function(){
  63321. return $core.withContext(function($ctx3) {
  63322. return $recv($self.receiver)._mux();
  63323. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63324. }),$globals.MessageNotUnderstood)
  63325. ,$ctx2.sendIdx["should:raise:"]=1
  63326. ][0];
  63327. [$self._should_raise_((function(){
  63328. return $core.withContext(function($ctx3) {
  63329. return $recv($self.receiver)._mux_and_((2),(-1));
  63330. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  63331. }),$globals.MessageNotUnderstood)
  63332. ,$ctx2.sendIdx["should:raise:"]=2
  63333. ][0];
  63334. [$self._assert_equals_($recv($self.receiver)._basicPerform_withArguments_("mux",[(-2), (2)]),(6))
  63335. ,$ctx2.sendIdx["assert:equals:"]=1
  63336. ][0];
  63337. [$self._assert_equals_($recv($self.receiver)._quux_foo_((1),(4)),(10))
  63338. ,$ctx2.sendIdx["assert:equals:"]=2
  63339. ][0];
  63340. $self._should_raise_((function(){
  63341. return $core.withContext(function($ctx3) {
  63342. return $recv($self.receiver)._basicPerform_("quux");
  63343. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  63344. }),$globals.Error);
  63345. return $self._assert_equals_($recv($self.receiver)._foo(),(10));
  63346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63347. }));
  63348. return self;
  63349. }, function($ctx1) {$ctx1.fill(self,"testDyadicJSOverrideDifferentNamesPermutated",{})});
  63350. }; }),
  63351. $globals.AbstractCodeGeneratorInstallTest);
  63352. $core.addMethod(
  63353. $core.method({
  63354. selector: "testDyadicJSOverrideInOneArg",
  63355. protocol: "tests",
  63356. args: [],
  63357. source: "testDyadicJSOverrideInOneArg\x0a\x09receiver := ObjectMock new.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux: anInteger\x0a\x09\x09<jsOverride: #mux args: #(anInteger anotherInteger)>\x0a\x09\x09^ (foo := foo + anInteger)'\x0a\x09\x09andRaise: CompilerError.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux: anInteger\x0a\x09\x09<jsOverride: #mux args: #(anotherInteger anInteger)>\x0a\x09\x09^ (foo := foo + anInteger)'\x0a\x09\x09andRaise: CompilerError",
  63358. referencedClasses: ["ObjectMock", "CompilerError"],
  63359. pragmas: [],
  63360. messageSends: ["new", "shouldntInstall:andRaise:"]
  63361. }, function ($methodClass){ return function (){
  63362. var self=this,$self=this;
  63363. return $core.withContext(function($ctx1) {
  63364. $self.receiver=$recv($globals.ObjectMock)._new();
  63365. [$self._shouldntInstall_andRaise_("quux: anInteger\x0a\x09\x09<jsOverride: #mux args: #(anInteger anotherInteger)>\x0a\x09\x09^ (foo := foo + anInteger)",$globals.CompilerError)
  63366. ,$ctx1.sendIdx["shouldntInstall:andRaise:"]=1
  63367. ][0];
  63368. $self._shouldntInstall_andRaise_("quux: anInteger\x0a\x09\x09<jsOverride: #mux args: #(anotherInteger anInteger)>\x0a\x09\x09^ (foo := foo + anInteger)",$globals.CompilerError);
  63369. return self;
  63370. }, function($ctx1) {$ctx1.fill(self,"testDyadicJSOverrideInOneArg",{})});
  63371. }; }),
  63372. $globals.AbstractCodeGeneratorInstallTest);
  63373. $core.addMethod(
  63374. $core.method({
  63375. selector: "testDyadicJSOverrideInUnary",
  63376. protocol: "tests",
  63377. args: [],
  63378. source: "testDyadicJSOverrideInUnary\x0a\x09receiver := ObjectMock new.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux <jsOverride: #mux args: #(anInteger anotherInteger)> ^ (foo := foo + 3)'\x0a\x09\x09andRaise: CompilerError",
  63379. referencedClasses: ["ObjectMock", "CompilerError"],
  63380. pragmas: [],
  63381. messageSends: ["new", "shouldntInstall:andRaise:"]
  63382. }, function ($methodClass){ return function (){
  63383. var self=this,$self=this;
  63384. return $core.withContext(function($ctx1) {
  63385. $self.receiver=$recv($globals.ObjectMock)._new();
  63386. $self._shouldntInstall_andRaise_("quux <jsOverride: #mux args: #(anInteger anotherInteger)> ^ (foo := foo + 3)",$globals.CompilerError);
  63387. return self;
  63388. }, function($ctx1) {$ctx1.fill(self,"testDyadicJSOverrideInUnary",{})});
  63389. }; }),
  63390. $globals.AbstractCodeGeneratorInstallTest);
  63391. $core.addMethod(
  63392. $core.method({
  63393. selector: "testDyadicJSOverrideRepeatedArgs",
  63394. protocol: "tests",
  63395. args: [],
  63396. source: "testDyadicJSOverrideRepeatedArgs\x0a\x09receiver := ObjectMock new.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux: anInteger\x0a\x09\x09<jsOverride: #mux args: #(anInteger anInteger)>\x0a\x09\x09^ (foo := foo + anInteger)'\x0a\x09\x09andRaise: CompilerError.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux: anInteger foo: anotherInteger\x0a\x09\x09<jsOverride: #mux args: #(anInteger anInteger)>\x0a\x09\x09^ (foo := foo * anInteger + anotherInteger)'\x0a\x09\x09andRaise: CompilerError",
  63397. referencedClasses: ["ObjectMock", "CompilerError"],
  63398. pragmas: [],
  63399. messageSends: ["new", "shouldntInstall:andRaise:"]
  63400. }, function ($methodClass){ return function (){
  63401. var self=this,$self=this;
  63402. return $core.withContext(function($ctx1) {
  63403. $self.receiver=$recv($globals.ObjectMock)._new();
  63404. [$self._shouldntInstall_andRaise_("quux: anInteger\x0a\x09\x09<jsOverride: #mux args: #(anInteger anInteger)>\x0a\x09\x09^ (foo := foo + anInteger)",$globals.CompilerError)
  63405. ,$ctx1.sendIdx["shouldntInstall:andRaise:"]=1
  63406. ][0];
  63407. $self._shouldntInstall_andRaise_("quux: anInteger foo: anotherInteger\x0a\x09\x09<jsOverride: #mux args: #(anInteger anInteger)>\x0a\x09\x09^ (foo := foo * anInteger + anotherInteger)",$globals.CompilerError);
  63408. return self;
  63409. }, function($ctx1) {$ctx1.fill(self,"testDyadicJSOverrideRepeatedArgs",{})});
  63410. }; }),
  63411. $globals.AbstractCodeGeneratorInstallTest);
  63412. $core.addMethod(
  63413. $core.method({
  63414. selector: "testInvalidAssignment",
  63415. protocol: "tests",
  63416. args: [],
  63417. source: "testInvalidAssignment\x0a\x09self shouldntInstall: 'foo:a a:=1' andRaise: InvalidAssignmentError.\x0a\x09self shouldntInstall: 'foo false:=1' andRaise: InvalidAssignmentError.\x0a\x09self shouldntInstall: 'foo console:=1' andRaise: InvalidAssignmentError.\x0a\x09self shouldntInstall: 'foo Number:=1' andRaise: InvalidAssignmentError",
  63418. referencedClasses: ["InvalidAssignmentError"],
  63419. pragmas: [],
  63420. messageSends: ["shouldntInstall:andRaise:"]
  63421. }, function ($methodClass){ return function (){
  63422. var self=this,$self=this;
  63423. return $core.withContext(function($ctx1) {
  63424. [$self._shouldntInstall_andRaise_("foo:a a:=1",$globals.InvalidAssignmentError)
  63425. ,$ctx1.sendIdx["shouldntInstall:andRaise:"]=1
  63426. ][0];
  63427. [$self._shouldntInstall_andRaise_("foo false:=1",$globals.InvalidAssignmentError)
  63428. ,$ctx1.sendIdx["shouldntInstall:andRaise:"]=2
  63429. ][0];
  63430. [$self._shouldntInstall_andRaise_("foo console:=1",$globals.InvalidAssignmentError)
  63431. ,$ctx1.sendIdx["shouldntInstall:andRaise:"]=3
  63432. ][0];
  63433. $self._shouldntInstall_andRaise_("foo Number:=1",$globals.InvalidAssignmentError);
  63434. return self;
  63435. }, function($ctx1) {$ctx1.fill(self,"testInvalidAssignment",{})});
  63436. }; }),
  63437. $globals.AbstractCodeGeneratorInstallTest);
  63438. $core.addMethod(
  63439. $core.method({
  63440. selector: "testMistypedPragmaJSStatement",
  63441. protocol: "tests",
  63442. args: [],
  63443. source: "testMistypedPragmaJSStatement\x0a\x09self shouldntInstall: 'foo < inlineJS: ''return ''foo'''' >' andRaise: ParseError",
  63444. referencedClasses: ["ParseError"],
  63445. pragmas: [],
  63446. messageSends: ["shouldntInstall:andRaise:"]
  63447. }, function ($methodClass){ return function (){
  63448. var self=this,$self=this;
  63449. return $core.withContext(function($ctx1) {
  63450. $self._shouldntInstall_andRaise_("foo < inlineJS: 'return 'foo'' >",$globals.ParseError);
  63451. return self;
  63452. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{})});
  63453. }; }),
  63454. $globals.AbstractCodeGeneratorInstallTest);
  63455. $core.addMethod(
  63456. $core.method({
  63457. selector: "testMonadicJSOverrideArgMismatch",
  63458. protocol: "tests",
  63459. args: [],
  63460. source: "testMonadicJSOverrideArgMismatch\x0a\x09receiver := ObjectMock new.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux: aNumber <jsOverride: #mux args: #(anInteger)> ^ (foo := foo + aNumber)'\x0a\x09\x09andRaise: CompilerError",
  63461. referencedClasses: ["ObjectMock", "CompilerError"],
  63462. pragmas: [],
  63463. messageSends: ["new", "shouldntInstall:andRaise:"]
  63464. }, function ($methodClass){ return function (){
  63465. var self=this,$self=this;
  63466. return $core.withContext(function($ctx1) {
  63467. $self.receiver=$recv($globals.ObjectMock)._new();
  63468. $self._shouldntInstall_andRaise_("quux: aNumber <jsOverride: #mux args: #(anInteger)> ^ (foo := foo + aNumber)",$globals.CompilerError);
  63469. return self;
  63470. }, function($ctx1) {$ctx1.fill(self,"testMonadicJSOverrideArgMismatch",{})});
  63471. }; }),
  63472. $globals.AbstractCodeGeneratorInstallTest);
  63473. $core.addMethod(
  63474. $core.method({
  63475. selector: "testMonadicJSOverrideDifferentNames",
  63476. protocol: "tests",
  63477. args: [],
  63478. source: "testMonadicJSOverrideDifferentNames\x0a\x09receiver := ObjectMock new.\x0a\x09receiver foo: 4.\x0a\x09self while: 'quux: anInteger <jsOverride: #mux args: #(anInteger)> ^ (foo := foo + anInteger)' should: [\x0a\x09\x09self should: [ receiver mux ] raise: MessageNotUnderstood.\x0a\x09\x09self should: [ receiver mux: 2 ] raise: MessageNotUnderstood.\x0a\x09\x09self assert: (receiver basicPerform: #mux withArguments: #(2)) equals: 6.\x0a\x09\x09self assert: (receiver quux: 4) equals: 10.\x0a\x09\x09self should: [ receiver basicPerform: #quux ] raise: Error.\x0a\x09\x09self assert: receiver foo equals: 10 ]",
  63479. referencedClasses: ["ObjectMock", "MessageNotUnderstood", "Error"],
  63480. pragmas: [],
  63481. messageSends: ["new", "foo:", "while:should:", "should:raise:", "mux", "mux:", "assert:equals:", "basicPerform:withArguments:", "quux:", "basicPerform:", "foo"]
  63482. }, function ($methodClass){ return function (){
  63483. var self=this,$self=this;
  63484. return $core.withContext(function($ctx1) {
  63485. $self.receiver=$recv($globals.ObjectMock)._new();
  63486. $recv($self.receiver)._foo_((4));
  63487. $self._while_should_("quux: anInteger <jsOverride: #mux args: #(anInteger)> ^ (foo := foo + anInteger)",(function(){
  63488. return $core.withContext(function($ctx2) {
  63489. [$self._should_raise_((function(){
  63490. return $core.withContext(function($ctx3) {
  63491. return $recv($self.receiver)._mux();
  63492. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63493. }),$globals.MessageNotUnderstood)
  63494. ,$ctx2.sendIdx["should:raise:"]=1
  63495. ][0];
  63496. [$self._should_raise_((function(){
  63497. return $core.withContext(function($ctx3) {
  63498. return $recv($self.receiver)._mux_((2));
  63499. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  63500. }),$globals.MessageNotUnderstood)
  63501. ,$ctx2.sendIdx["should:raise:"]=2
  63502. ][0];
  63503. [$self._assert_equals_($recv($self.receiver)._basicPerform_withArguments_("mux",[(2)]),(6))
  63504. ,$ctx2.sendIdx["assert:equals:"]=1
  63505. ][0];
  63506. [$self._assert_equals_($recv($self.receiver)._quux_((4)),(10))
  63507. ,$ctx2.sendIdx["assert:equals:"]=2
  63508. ][0];
  63509. $self._should_raise_((function(){
  63510. return $core.withContext(function($ctx3) {
  63511. return $recv($self.receiver)._basicPerform_("quux");
  63512. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  63513. }),$globals.Error);
  63514. return $self._assert_equals_($recv($self.receiver)._foo(),(10));
  63515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63516. }));
  63517. return self;
  63518. }, function($ctx1) {$ctx1.fill(self,"testMonadicJSOverrideDifferentNames",{})});
  63519. }; }),
  63520. $globals.AbstractCodeGeneratorInstallTest);
  63521. $core.addMethod(
  63522. $core.method({
  63523. selector: "testMonadicJSOverrideInUnary",
  63524. protocol: "tests",
  63525. args: [],
  63526. source: "testMonadicJSOverrideInUnary\x0a\x09receiver := ObjectMock new.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux <jsOverride: #mux args: #(anInteger)> ^ (foo := foo + 3)'\x0a\x09\x09andRaise: CompilerError",
  63527. referencedClasses: ["ObjectMock", "CompilerError"],
  63528. pragmas: [],
  63529. messageSends: ["new", "shouldntInstall:andRaise:"]
  63530. }, function ($methodClass){ return function (){
  63531. var self=this,$self=this;
  63532. return $core.withContext(function($ctx1) {
  63533. $self.receiver=$recv($globals.ObjectMock)._new();
  63534. $self._shouldntInstall_andRaise_("quux <jsOverride: #mux args: #(anInteger)> ^ (foo := foo + 3)",$globals.CompilerError);
  63535. return self;
  63536. }, function($ctx1) {$ctx1.fill(self,"testMonadicJSOverrideInUnary",{})});
  63537. }; }),
  63538. $globals.AbstractCodeGeneratorInstallTest);
  63539. $core.addMethod(
  63540. $core.method({
  63541. selector: "testNiladicJSOverride",
  63542. protocol: "tests",
  63543. args: [],
  63544. source: "testNiladicJSOverride\x0a\x09receiver := ObjectMock new.\x0a\x09receiver foo: 4.\x0a\x09self while: 'baz <jsOverride: #baz> ^ (foo := foo + 3)' should: [\x0a\x09\x09self assert: receiver baz equals: 7.\x0a\x09\x09self assert: (receiver basicPerform: #baz) equals: 10.\x0a\x09\x09self assert: receiver baz equals: 13.\x0a\x09\x09self assert: receiver foo equals: 13 ]",
  63545. referencedClasses: ["ObjectMock"],
  63546. pragmas: [],
  63547. messageSends: ["new", "foo:", "while:should:", "assert:equals:", "baz", "basicPerform:", "foo"]
  63548. }, function ($methodClass){ return function (){
  63549. var self=this,$self=this;
  63550. return $core.withContext(function($ctx1) {
  63551. $self.receiver=$recv($globals.ObjectMock)._new();
  63552. $recv($self.receiver)._foo_((4));
  63553. $self._while_should_("baz <jsOverride: #baz> ^ (foo := foo + 3)",(function(){
  63554. return $core.withContext(function($ctx2) {
  63555. [$self._assert_equals_([$recv($self.receiver)._baz()
  63556. ,$ctx2.sendIdx["baz"]=1
  63557. ][0],(7))
  63558. ,$ctx2.sendIdx["assert:equals:"]=1
  63559. ][0];
  63560. [$self._assert_equals_($recv($self.receiver)._basicPerform_("baz"),(10))
  63561. ,$ctx2.sendIdx["assert:equals:"]=2
  63562. ][0];
  63563. [$self._assert_equals_($recv($self.receiver)._baz(),(13))
  63564. ,$ctx2.sendIdx["assert:equals:"]=3
  63565. ][0];
  63566. return $self._assert_equals_($recv($self.receiver)._foo(),(13));
  63567. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63568. }));
  63569. return self;
  63570. }, function($ctx1) {$ctx1.fill(self,"testNiladicJSOverride",{})});
  63571. }; }),
  63572. $globals.AbstractCodeGeneratorInstallTest);
  63573. $core.addMethod(
  63574. $core.method({
  63575. selector: "testNiladicJSOverrideDifferentNames",
  63576. protocol: "tests",
  63577. args: [],
  63578. source: "testNiladicJSOverrideDifferentNames\x0a\x09receiver := ObjectMock new.\x0a\x09receiver foo: 4.\x0a\x09self while: 'quux <jsOverride: #mux> ^ (foo := foo + 3)' should: [\x0a\x09\x09self should: [ receiver mux ] raise: MessageNotUnderstood.\x0a\x09\x09self assert: (receiver basicPerform: #mux) equals: 7.\x0a\x09\x09self assert: receiver quux equals: 10.\x0a\x09\x09self should: [ receiver basicPerform: #quux ] raise: Error.\x0a\x09\x09self assert: receiver foo equals: 10 ]",
  63579. referencedClasses: ["ObjectMock", "MessageNotUnderstood", "Error"],
  63580. pragmas: [],
  63581. messageSends: ["new", "foo:", "while:should:", "should:raise:", "mux", "assert:equals:", "basicPerform:", "quux", "foo"]
  63582. }, function ($methodClass){ return function (){
  63583. var self=this,$self=this;
  63584. return $core.withContext(function($ctx1) {
  63585. $self.receiver=$recv($globals.ObjectMock)._new();
  63586. $recv($self.receiver)._foo_((4));
  63587. $self._while_should_("quux <jsOverride: #mux> ^ (foo := foo + 3)",(function(){
  63588. return $core.withContext(function($ctx2) {
  63589. [$self._should_raise_((function(){
  63590. return $core.withContext(function($ctx3) {
  63591. return $recv($self.receiver)._mux();
  63592. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63593. }),$globals.MessageNotUnderstood)
  63594. ,$ctx2.sendIdx["should:raise:"]=1
  63595. ][0];
  63596. [$self._assert_equals_([$recv($self.receiver)._basicPerform_("mux")
  63597. ,$ctx2.sendIdx["basicPerform:"]=1
  63598. ][0],(7))
  63599. ,$ctx2.sendIdx["assert:equals:"]=1
  63600. ][0];
  63601. [$self._assert_equals_($recv($self.receiver)._quux(),(10))
  63602. ,$ctx2.sendIdx["assert:equals:"]=2
  63603. ][0];
  63604. $self._should_raise_((function(){
  63605. return $core.withContext(function($ctx3) {
  63606. return $recv($self.receiver)._basicPerform_("quux");
  63607. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  63608. }),$globals.Error);
  63609. return $self._assert_equals_($recv($self.receiver)._foo(),(10));
  63610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63611. }));
  63612. return self;
  63613. }, function($ctx1) {$ctx1.fill(self,"testNiladicJSOverrideDifferentNames",{})});
  63614. }; }),
  63615. $globals.AbstractCodeGeneratorInstallTest);
  63616. $core.addMethod(
  63617. $core.method({
  63618. selector: "testNiladicJSOverrideInOneArg",
  63619. protocol: "tests",
  63620. args: [],
  63621. source: "testNiladicJSOverrideInOneArg\x0a\x09receiver := ObjectMock new.\x0a\x09self\x0a\x09\x09shouldntInstall: 'quux: anInteger <jsOverride: #mux> ^ (foo := foo + anInteger)'\x0a\x09\x09andRaise: CompilerError",
  63622. referencedClasses: ["ObjectMock", "CompilerError"],
  63623. pragmas: [],
  63624. messageSends: ["new", "shouldntInstall:andRaise:"]
  63625. }, function ($methodClass){ return function (){
  63626. var self=this,$self=this;
  63627. return $core.withContext(function($ctx1) {
  63628. $self.receiver=$recv($globals.ObjectMock)._new();
  63629. $self._shouldntInstall_andRaise_("quux: anInteger <jsOverride: #mux> ^ (foo := foo + anInteger)",$globals.CompilerError);
  63630. return self;
  63631. }, function($ctx1) {$ctx1.fill(self,"testNiladicJSOverrideInOneArg",{})});
  63632. }; }),
  63633. $globals.AbstractCodeGeneratorInstallTest);
  63634. $core.addMethod(
  63635. $core.method({
  63636. selector: "testPragmaInBlock",
  63637. protocol: "tests",
  63638. args: [],
  63639. source: "testPragmaInBlock\x0a\x09self shouldntInstall: 'foo ^ [ < fooBar > 4 ] value' andRaise: ParseError",
  63640. referencedClasses: ["ParseError"],
  63641. pragmas: [],
  63642. messageSends: ["shouldntInstall:andRaise:"]
  63643. }, function ($methodClass){ return function (){
  63644. var self=this,$self=this;
  63645. return $core.withContext(function($ctx1) {
  63646. $self._shouldntInstall_andRaise_("foo ^ [ < fooBar > 4 ] value",$globals.ParseError);
  63647. return self;
  63648. }, function($ctx1) {$ctx1.fill(self,"testPragmaInBlock",{})});
  63649. }; }),
  63650. $globals.AbstractCodeGeneratorInstallTest);
  63651. $core.addMethod(
  63652. $core.method({
  63653. selector: "testTriadicJSOverrideDifferentNamesPermutated",
  63654. protocol: "tests",
  63655. args: [],
  63656. source: "testTriadicJSOverrideDifferentNamesPermutated\x0a\x09receiver := ObjectMock new.\x0a\x09receiver foo: 4.\x0a\x09self while: 'quux: anInteger foo: anotherInteger bar: yaInt\x0a\x09\x09<jsOverride: #mux args: #(yaInt anInteger anotherInteger)>\x0a\x09\x09^ (foo := foo * anInteger + anotherInteger - yaInt)' should: [\x0a\x09\x09self should: [ receiver mux ] raise: MessageNotUnderstood.\x0a\x09\x09self should: [ receiver mux: 2 and: -1 and: 0 ] raise: MessageNotUnderstood.\x0a\x09\x09self assert: (receiver basicPerform: #mux withArguments: #(5 2 3)) equals: 6.\x0a\x09\x09self assert: (receiver quux: 1 foo: 4 bar: 20) equals: -10.\x0a\x09\x09self should: [ receiver basicPerform: #quux ] raise: Error.\x0a\x09\x09self assert: receiver foo equals: -10 ]",
  63657. referencedClasses: ["ObjectMock", "MessageNotUnderstood", "Error"],
  63658. pragmas: [],
  63659. messageSends: ["new", "foo:", "while:should:", "should:raise:", "mux", "mux:and:and:", "assert:equals:", "basicPerform:withArguments:", "quux:foo:bar:", "basicPerform:", "foo"]
  63660. }, function ($methodClass){ return function (){
  63661. var self=this,$self=this;
  63662. return $core.withContext(function($ctx1) {
  63663. $self.receiver=$recv($globals.ObjectMock)._new();
  63664. $recv($self.receiver)._foo_((4));
  63665. $self._while_should_("quux: anInteger foo: anotherInteger bar: yaInt\x0a\x09\x09<jsOverride: #mux args: #(yaInt anInteger anotherInteger)>\x0a\x09\x09^ (foo := foo * anInteger + anotherInteger - yaInt)",(function(){
  63666. return $core.withContext(function($ctx2) {
  63667. [$self._should_raise_((function(){
  63668. return $core.withContext(function($ctx3) {
  63669. return $recv($self.receiver)._mux();
  63670. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63671. }),$globals.MessageNotUnderstood)
  63672. ,$ctx2.sendIdx["should:raise:"]=1
  63673. ][0];
  63674. [$self._should_raise_((function(){
  63675. return $core.withContext(function($ctx3) {
  63676. return $recv($self.receiver)._mux_and_and_((2),(-1),(0));
  63677. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  63678. }),$globals.MessageNotUnderstood)
  63679. ,$ctx2.sendIdx["should:raise:"]=2
  63680. ][0];
  63681. [$self._assert_equals_($recv($self.receiver)._basicPerform_withArguments_("mux",[(5), (2), (3)]),(6))
  63682. ,$ctx2.sendIdx["assert:equals:"]=1
  63683. ][0];
  63684. [$self._assert_equals_($recv($self.receiver)._quux_foo_bar_((1),(4),(20)),(-10))
  63685. ,$ctx2.sendIdx["assert:equals:"]=2
  63686. ][0];
  63687. $self._should_raise_((function(){
  63688. return $core.withContext(function($ctx3) {
  63689. return $recv($self.receiver)._basicPerform_("quux");
  63690. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  63691. }),$globals.Error);
  63692. return $self._assert_equals_($recv($self.receiver)._foo(),(-10));
  63693. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63694. }));
  63695. return self;
  63696. }, function($ctx1) {$ctx1.fill(self,"testTriadicJSOverrideDifferentNamesPermutated",{})});
  63697. }; }),
  63698. $globals.AbstractCodeGeneratorInstallTest);
  63699. $core.addMethod(
  63700. $core.method({
  63701. selector: "isAbstract",
  63702. protocol: "testing",
  63703. args: [],
  63704. source: "isAbstract\x0a\x09^ self name = AbstractCodeGeneratorInstallTest name",
  63705. referencedClasses: ["AbstractCodeGeneratorInstallTest"],
  63706. pragmas: [],
  63707. messageSends: ["=", "name"]
  63708. }, function ($methodClass){ return function (){
  63709. var self=this,$self=this;
  63710. return $core.withContext(function($ctx1) {
  63711. return $recv([$self._name()
  63712. ,$ctx1.sendIdx["name"]=1
  63713. ][0]).__eq($recv($globals.AbstractCodeGeneratorInstallTest)._name());
  63714. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{})});
  63715. }; }),
  63716. $globals.AbstractCodeGeneratorInstallTest.a$cls);
  63717. $core.addClass("CodeGeneratorInstallTest", $globals.AbstractCodeGeneratorInstallTest, [], "Compiler-Tests");
  63718. $core.addClass("InliningCodeGeneratorInstallTest", $globals.AbstractCodeGeneratorInstallTest, [], "Compiler-Tests");
  63719. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  63720. $core.addMethod(
  63721. $core.method({
  63722. selector: "testClassRefVar",
  63723. protocol: "tests",
  63724. args: [],
  63725. source: "testClassRefVar\x0a\x09| node binding |\x0a\x09node := VariableNode new\x0a\x09\x09identifier: 'Object';\x0a\x09\x09yourself.\x0a\x09SemanticAnalyzer new \x0a\x09\x09pushScope: MethodLexicalScope new;\x0a\x09\x09visit: node.\x0a\x09binding := node binding.\x0a\x09self deny: binding isAssignable.\x0a\x09self deny: binding isIdempotent.\x0a\x09self assert: (binding alias includesSubString: 'Object').\x0a\x09self assert: (binding alias ~= 'Object')",
  63726. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  63727. pragmas: [],
  63728. messageSends: ["identifier:", "new", "yourself", "pushScope:", "visit:", "binding", "deny:", "isAssignable", "isIdempotent", "assert:", "includesSubString:", "alias", "~="]
  63729. }, function ($methodClass){ return function (){
  63730. var self=this,$self=this;
  63731. var node,binding;
  63732. return $core.withContext(function($ctx1) {
  63733. var $1,$2;
  63734. $1=[$recv($globals.VariableNode)._new()
  63735. ,$ctx1.sendIdx["new"]=1
  63736. ][0];
  63737. $recv($1)._identifier_("Object");
  63738. node=$recv($1)._yourself();
  63739. $2=[$recv($globals.SemanticAnalyzer)._new()
  63740. ,$ctx1.sendIdx["new"]=2
  63741. ][0];
  63742. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  63743. $recv($2)._visit_(node);
  63744. binding=$recv(node)._binding();
  63745. [$self._deny_($recv(binding)._isAssignable())
  63746. ,$ctx1.sendIdx["deny:"]=1
  63747. ][0];
  63748. $self._deny_($recv(binding)._isIdempotent());
  63749. [$self._assert_($recv([$recv(binding)._alias()
  63750. ,$ctx1.sendIdx["alias"]=1
  63751. ][0])._includesSubString_("Object"))
  63752. ,$ctx1.sendIdx["assert:"]=1
  63753. ][0];
  63754. $self._assert_($recv($recv(binding)._alias()).__tild_eq("Object"));
  63755. return self;
  63756. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node,binding:binding})});
  63757. }; }),
  63758. $globals.ScopeVarTest);
  63759. $core.addMethod(
  63760. $core.method({
  63761. selector: "testExternallyKnownVar",
  63762. protocol: "tests",
  63763. args: [],
  63764. source: "testExternallyKnownVar\x0a\x09| node binding |\x0a\x09node := VariableNode new\x0a\x09\x09identifier: 'console';\x0a\x09\x09yourself.\x0a\x09SemanticAnalyzer new \x0a\x09\x09pushScope: MethodLexicalScope new;\x0a\x09\x09visit: node.\x0a\x09binding := node binding.\x0a\x09self deny: binding isAssignable.\x0a\x09self deny: binding isIdempotent.\x0a\x09self assert: binding alias equals: 'console'",
  63765. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  63766. pragmas: [],
  63767. messageSends: ["identifier:", "new", "yourself", "pushScope:", "visit:", "binding", "deny:", "isAssignable", "isIdempotent", "assert:equals:", "alias"]
  63768. }, function ($methodClass){ return function (){
  63769. var self=this,$self=this;
  63770. var node,binding;
  63771. return $core.withContext(function($ctx1) {
  63772. var $1,$2;
  63773. $1=[$recv($globals.VariableNode)._new()
  63774. ,$ctx1.sendIdx["new"]=1
  63775. ][0];
  63776. $recv($1)._identifier_("console");
  63777. node=$recv($1)._yourself();
  63778. $2=[$recv($globals.SemanticAnalyzer)._new()
  63779. ,$ctx1.sendIdx["new"]=2
  63780. ][0];
  63781. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  63782. $recv($2)._visit_(node);
  63783. binding=$recv(node)._binding();
  63784. [$self._deny_($recv(binding)._isAssignable())
  63785. ,$ctx1.sendIdx["deny:"]=1
  63786. ][0];
  63787. $self._deny_($recv(binding)._isIdempotent());
  63788. $self._assert_equals_($recv(binding)._alias(),"console");
  63789. return self;
  63790. }, function($ctx1) {$ctx1.fill(self,"testExternallyKnownVar",{node:node,binding:binding})});
  63791. }; }),
  63792. $globals.ScopeVarTest);
  63793. $core.addMethod(
  63794. $core.method({
  63795. selector: "testExternallyUnknownVar",
  63796. protocol: "tests",
  63797. args: [],
  63798. source: "testExternallyUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09identifier: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self \x0a\x09\x09should: [\x0a\x09\x09\x09SemanticAnalyzer new \x0a\x09\x09\x09pushScope: MethodLexicalScope new;\x0a\x09\x09\x09visit: node ]\x0a\x09\x09raise: UnknownVariableError",
  63799. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope", "UnknownVariableError"],
  63800. pragmas: [],
  63801. messageSends: ["identifier:", "new", "yourself", "should:raise:", "pushScope:", "visit:"]
  63802. }, function ($methodClass){ return function (){
  63803. var self=this,$self=this;
  63804. var node;
  63805. return $core.withContext(function($ctx1) {
  63806. var $1,$2;
  63807. $1=[$recv($globals.VariableNode)._new()
  63808. ,$ctx1.sendIdx["new"]=1
  63809. ][0];
  63810. $recv($1)._identifier_("bzzz");
  63811. node=$recv($1)._yourself();
  63812. $self._should_raise_((function(){
  63813. return $core.withContext(function($ctx2) {
  63814. $2=[$recv($globals.SemanticAnalyzer)._new()
  63815. ,$ctx2.sendIdx["new"]=2
  63816. ][0];
  63817. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  63818. return $recv($2)._visit_(node);
  63819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63820. }),$globals.UnknownVariableError);
  63821. return self;
  63822. }, function($ctx1) {$ctx1.fill(self,"testExternallyUnknownVar",{node:node})});
  63823. }; }),
  63824. $globals.ScopeVarTest);
  63825. $core.addMethod(
  63826. $core.method({
  63827. selector: "testInstanceVar",
  63828. protocol: "tests",
  63829. args: [],
  63830. source: "testInstanceVar\x0a\x09| binding |\x0a\x09binding := MethodLexicalScope new\x0a\x09\x09addIVar: 'bzzz';\x0a\x09\x09bindingFor: 'bzzz'.\x0a\x09self assert: binding isAssignable.\x0a\x09self deny: binding isIdempotent.\x0a\x09self assert: (binding alias includesSubString: 'bzzz').\x0a\x09self assert: (binding alias ~= 'bzzz')",
  63831. referencedClasses: ["MethodLexicalScope"],
  63832. pragmas: [],
  63833. messageSends: ["addIVar:", "new", "bindingFor:", "assert:", "isAssignable", "deny:", "isIdempotent", "includesSubString:", "alias", "~="]
  63834. }, function ($methodClass){ return function (){
  63835. var self=this,$self=this;
  63836. var binding;
  63837. return $core.withContext(function($ctx1) {
  63838. var $1;
  63839. $1=$recv($globals.MethodLexicalScope)._new();
  63840. $recv($1)._addIVar_("bzzz");
  63841. binding=$recv($1)._bindingFor_("bzzz");
  63842. [$self._assert_($recv(binding)._isAssignable())
  63843. ,$ctx1.sendIdx["assert:"]=1
  63844. ][0];
  63845. $self._deny_($recv(binding)._isIdempotent());
  63846. [$self._assert_($recv([$recv(binding)._alias()
  63847. ,$ctx1.sendIdx["alias"]=1
  63848. ][0])._includesSubString_("bzzz"))
  63849. ,$ctx1.sendIdx["assert:"]=2
  63850. ][0];
  63851. $self._assert_($recv($recv(binding)._alias()).__tild_eq("bzzz"));
  63852. return self;
  63853. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{binding:binding})});
  63854. }; }),
  63855. $globals.ScopeVarTest);
  63856. $core.addMethod(
  63857. $core.method({
  63858. selector: "testPseudoVar",
  63859. protocol: "tests",
  63860. args: [],
  63861. source: "testPseudoVar\x0a\x09#('self' 'super' 'true' 'false' 'nil' 'thisContext') do: [ :each |\x0a\x09\x09| binding |\x0a\x09\x09binding := MethodLexicalScope new bindingFor: each.\x0a\x09\x09self deny: binding isAssignable.\x0a\x09\x09self assert: binding isIdempotent ]",
  63862. referencedClasses: ["MethodLexicalScope"],
  63863. pragmas: [],
  63864. messageSends: ["do:", "bindingFor:", "new", "deny:", "isAssignable", "assert:", "isIdempotent"]
  63865. }, function ($methodClass){ return function (){
  63866. var self=this,$self=this;
  63867. return $core.withContext(function($ctx1) {
  63868. ["self", "super", "true", "false", "nil", "thisContext"]._do_((function(each){
  63869. var binding;
  63870. return $core.withContext(function($ctx2) {
  63871. binding=$recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(each);
  63872. $self._deny_($recv(binding)._isAssignable());
  63873. return $self._assert_($recv(binding)._isIdempotent());
  63874. }, function($ctx2) {$ctx2.fillBlock({each:each,binding:binding},$ctx1,1)});
  63875. }));
  63876. return self;
  63877. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{})});
  63878. }; }),
  63879. $globals.ScopeVarTest);
  63880. $core.addMethod(
  63881. $core.method({
  63882. selector: "testTempVar",
  63883. protocol: "tests",
  63884. args: [],
  63885. source: "testTempVar\x0a\x09| binding |\x0a\x09binding := MethodLexicalScope new\x0a\x09\x09addTemp: 'bzzz';\x0a\x09\x09bindingFor: 'bzzz'.\x0a\x09self assert: binding isAssignable.\x0a\x09self deny: binding isIdempotent.\x0a\x09self assert: binding alias equals: 'bzzz'",
  63886. referencedClasses: ["MethodLexicalScope"],
  63887. pragmas: [],
  63888. messageSends: ["addTemp:", "new", "bindingFor:", "assert:", "isAssignable", "deny:", "isIdempotent", "assert:equals:", "alias"]
  63889. }, function ($methodClass){ return function (){
  63890. var self=this,$self=this;
  63891. var binding;
  63892. return $core.withContext(function($ctx1) {
  63893. var $1;
  63894. $1=$recv($globals.MethodLexicalScope)._new();
  63895. $recv($1)._addTemp_("bzzz");
  63896. binding=$recv($1)._bindingFor_("bzzz");
  63897. $self._assert_($recv(binding)._isAssignable());
  63898. $self._deny_($recv(binding)._isIdempotent());
  63899. $self._assert_equals_($recv(binding)._alias(),"bzzz");
  63900. return self;
  63901. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{binding:binding})});
  63902. }; }),
  63903. $globals.ScopeVarTest);
  63904. $core.addMethod(
  63905. $core.method({
  63906. selector: "testUnknownVar",
  63907. protocol: "tests",
  63908. args: [],
  63909. source: "testUnknownVar\x0a\x09self assert: (MethodLexicalScope new bindingFor: 'bzzz') isNil",
  63910. referencedClasses: ["MethodLexicalScope"],
  63911. pragmas: [],
  63912. messageSends: ["assert:", "isNil", "bindingFor:", "new"]
  63913. }, function ($methodClass){ return function (){
  63914. var self=this,$self=this;
  63915. return $core.withContext(function($ctx1) {
  63916. $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_("bzzz"))._isNil());
  63917. return self;
  63918. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{})});
  63919. }; }),
  63920. $globals.ScopeVarTest);
  63921. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  63922. $core.addMethod(
  63923. $core.method({
  63924. selector: "setUp",
  63925. protocol: "running",
  63926. args: [],
  63927. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  63928. referencedClasses: ["SemanticAnalyzer", "Object"],
  63929. pragmas: [],
  63930. messageSends: ["on:"]
  63931. }, function ($methodClass){ return function (){
  63932. var self=this,$self=this;
  63933. return $core.withContext(function($ctx1) {
  63934. $self.analyzer=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  63935. return self;
  63936. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  63937. }; }),
  63938. $globals.SemanticAnalyzerTest);
  63939. $core.addMethod(
  63940. $core.method({
  63941. selector: "testAssignment",
  63942. protocol: "tests",
  63943. args: [],
  63944. 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",
  63945. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  63946. pragmas: [],
  63947. messageSends: ["parse:", "should:raise:", "visit:"]
  63948. }, function ($methodClass){ return function (){
  63949. var self=this,$self=this;
  63950. var src,ast;
  63951. return $core.withContext(function($ctx1) {
  63952. src="foo self := 1";
  63953. ast=$recv($globals.Smalltalk)._parse_(src);
  63954. $self._should_raise_((function(){
  63955. return $core.withContext(function($ctx2) {
  63956. return $recv($self.analyzer)._visit_(ast);
  63957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63958. }),$globals.InvalidAssignmentError);
  63959. return self;
  63960. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast})});
  63961. }; }),
  63962. $globals.SemanticAnalyzerTest);
  63963. $core.addMethod(
  63964. $core.method({
  63965. selector: "testNonLocalReturn",
  63966. protocol: "tests",
  63967. args: [],
  63968. 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",
  63969. referencedClasses: ["Smalltalk"],
  63970. pragmas: [],
  63971. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  63972. }, function ($methodClass){ return function (){
  63973. var self=this,$self=this;
  63974. var src,ast;
  63975. return $core.withContext(function($ctx1) {
  63976. src="foo | a | a + 1. ^ a";
  63977. ast=$recv($globals.Smalltalk)._parse_(src);
  63978. $recv($self.analyzer)._visit_(ast);
  63979. $self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  63980. return self;
  63981. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast})});
  63982. }; }),
  63983. $globals.SemanticAnalyzerTest);
  63984. $core.addMethod(
  63985. $core.method({
  63986. selector: "testNonLocalReturn2",
  63987. protocol: "tests",
  63988. args: [],
  63989. 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",
  63990. referencedClasses: ["Smalltalk"],
  63991. pragmas: [],
  63992. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  63993. }, function ($methodClass){ return function (){
  63994. var self=this,$self=this;
  63995. var src,ast;
  63996. return $core.withContext(function($ctx1) {
  63997. src="foo | a | a + 1. [ [ ^ a] ]";
  63998. ast=$recv($globals.Smalltalk)._parse_(src);
  63999. $recv($self.analyzer)._visit_(ast);
  64000. $self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  64001. return self;
  64002. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast})});
  64003. }; }),
  64004. $globals.SemanticAnalyzerTest);
  64005. $core.addMethod(
  64006. $core.method({
  64007. selector: "testScope",
  64008. protocol: "tests",
  64009. args: [],
  64010. 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 sequenceNode dagChildren last scope == ast scope.",
  64011. referencedClasses: ["Smalltalk"],
  64012. pragmas: [],
  64013. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "sequenceNode"]
  64014. }, function ($methodClass){ return function (){
  64015. var self=this,$self=this;
  64016. var src,ast;
  64017. return $core.withContext(function($ctx1) {
  64018. src="foo | a | a + 1. [ | b | b := a ]";
  64019. ast=$recv($globals.Smalltalk)._parse_(src);
  64020. $recv($self.analyzer)._visit_(ast);
  64021. $self._deny_($recv([$recv($recv($recv($recv(ast)._sequenceNode())._dagChildren())._last())._scope()
  64022. ,$ctx1.sendIdx["scope"]=1
  64023. ][0]).__eq_eq($recv(ast)._scope()));
  64024. return self;
  64025. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast})});
  64026. }; }),
  64027. $globals.SemanticAnalyzerTest);
  64028. $core.addMethod(
  64029. $core.method({
  64030. selector: "testScope2",
  64031. protocol: "tests",
  64032. args: [],
  64033. 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 sequenceNode dagChildren last sequenceNode dagChildren first scope == ast scope.",
  64034. referencedClasses: ["Smalltalk"],
  64035. pragmas: [],
  64036. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "sequenceNode", "last"]
  64037. }, function ($methodClass){ return function (){
  64038. var self=this,$self=this;
  64039. var src,ast;
  64040. return $core.withContext(function($ctx1) {
  64041. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  64042. ast=$recv($globals.Smalltalk)._parse_(src);
  64043. $recv($self.analyzer)._visit_(ast);
  64044. $self._deny_($recv([$recv($recv([$recv([$recv($recv($recv($recv(ast)._sequenceNode())._dagChildren())._last())._sequenceNode()
  64045. ,$ctx1.sendIdx["sequenceNode"]=1
  64046. ][0])._dagChildren()
  64047. ,$ctx1.sendIdx["dagChildren"]=1
  64048. ][0])._first())._scope()
  64049. ,$ctx1.sendIdx["scope"]=1
  64050. ][0]).__eq_eq($recv(ast)._scope()));
  64051. return self;
  64052. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast})});
  64053. }; }),
  64054. $globals.SemanticAnalyzerTest);
  64055. $core.addMethod(
  64056. $core.method({
  64057. selector: "testScopeLevel",
  64058. protocol: "tests",
  64059. args: [],
  64060. 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 sequenceNode dagChildren last sequenceNode dagChildren first scope scopeLevel equals: 3",
  64061. referencedClasses: ["Smalltalk"],
  64062. pragmas: [],
  64063. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "sequenceNode", "last"]
  64064. }, function ($methodClass){ return function (){
  64065. var self=this,$self=this;
  64066. var src,ast;
  64067. return $core.withContext(function($ctx1) {
  64068. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  64069. ast=$recv($globals.Smalltalk)._parse_(src);
  64070. $recv($self.analyzer)._visit_(ast);
  64071. [$self._assert_equals_([$recv([$recv(ast)._scope()
  64072. ,$ctx1.sendIdx["scope"]=1
  64073. ][0])._scopeLevel()
  64074. ,$ctx1.sendIdx["scopeLevel"]=1
  64075. ][0],(1))
  64076. ,$ctx1.sendIdx["assert:equals:"]=1
  64077. ][0];
  64078. $self._assert_equals_($recv($recv($recv([$recv([$recv($recv($recv($recv(ast)._sequenceNode())._dagChildren())._last())._sequenceNode()
  64079. ,$ctx1.sendIdx["sequenceNode"]=1
  64080. ][0])._dagChildren()
  64081. ,$ctx1.sendIdx["dagChildren"]=1
  64082. ][0])._first())._scope())._scopeLevel(),(3));
  64083. return self;
  64084. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast})});
  64085. }; }),
  64086. $globals.SemanticAnalyzerTest);
  64087. $core.addMethod(
  64088. $core.method({
  64089. selector: "testUnknownVariables",
  64090. protocol: "tests",
  64091. args: [],
  64092. 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",
  64093. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  64094. pragmas: [],
  64095. messageSends: ["parse:", "should:raise:", "visit:"]
  64096. }, function ($methodClass){ return function (){
  64097. var self=this,$self=this;
  64098. var src,ast;
  64099. return $core.withContext(function($ctx1) {
  64100. src="foo | a | b + a";
  64101. ast=$recv($globals.Smalltalk)._parse_(src);
  64102. $self._should_raise_((function(){
  64103. return $core.withContext(function($ctx2) {
  64104. return $recv($self.analyzer)._visit_(ast);
  64105. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64106. }),$globals.UnknownVariableError);
  64107. return self;
  64108. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast})});
  64109. }; }),
  64110. $globals.SemanticAnalyzerTest);
  64111. $core.addMethod(
  64112. $core.method({
  64113. selector: "testUnknownVariablesWithScope",
  64114. protocol: "tests",
  64115. args: [],
  64116. 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",
  64117. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  64118. pragmas: [],
  64119. messageSends: ["parse:", "should:raise:", "visit:"]
  64120. }, function ($methodClass){ return function (){
  64121. var self=this,$self=this;
  64122. var src,ast;
  64123. return $core.withContext(function($ctx1) {
  64124. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  64125. ast=$recv($globals.Smalltalk)._parse_(src);
  64126. $self._should_raise_((function(){
  64127. return $core.withContext(function($ctx2) {
  64128. return $recv($self.analyzer)._visit_(ast);
  64129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64130. }),$globals.UnknownVariableError);
  64131. return self;
  64132. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast})});
  64133. }; }),
  64134. $globals.SemanticAnalyzerTest);
  64135. $core.addMethod(
  64136. $core.method({
  64137. selector: "testVariableShadowing",
  64138. protocol: "tests",
  64139. args: [],
  64140. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  64141. referencedClasses: ["Smalltalk"],
  64142. pragmas: [],
  64143. messageSends: ["parse:", "visit:"]
  64144. }, function ($methodClass){ return function (){
  64145. var self=this,$self=this;
  64146. var src,ast;
  64147. return $core.withContext(function($ctx1) {
  64148. src="foo | a | a + 1";
  64149. ast=$recv($globals.Smalltalk)._parse_(src);
  64150. $recv($self.analyzer)._visit_(ast);
  64151. return self;
  64152. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast})});
  64153. }; }),
  64154. $globals.SemanticAnalyzerTest);
  64155. $core.addMethod(
  64156. $core.method({
  64157. selector: "testVariableShadowing2",
  64158. protocol: "tests",
  64159. args: [],
  64160. 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",
  64161. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  64162. pragmas: [],
  64163. messageSends: ["parse:", "should:raise:", "visit:"]
  64164. }, function ($methodClass){ return function (){
  64165. var self=this,$self=this;
  64166. var src,ast;
  64167. return $core.withContext(function($ctx1) {
  64168. src="foo | a | a + 1. [ | a | a := 2 ]";
  64169. ast=$recv($globals.Smalltalk)._parse_(src);
  64170. $self._should_raise_((function(){
  64171. return $core.withContext(function($ctx2) {
  64172. return $recv($self.analyzer)._visit_(ast);
  64173. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64174. }),$globals.ShadowingVariableError);
  64175. return self;
  64176. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast})});
  64177. }; }),
  64178. $globals.SemanticAnalyzerTest);
  64179. $core.addMethod(
  64180. $core.method({
  64181. selector: "testVariableShadowing3",
  64182. protocol: "tests",
  64183. args: [],
  64184. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  64185. referencedClasses: ["Smalltalk"],
  64186. pragmas: [],
  64187. messageSends: ["parse:", "visit:"]
  64188. }, function ($methodClass){ return function (){
  64189. var self=this,$self=this;
  64190. var src,ast;
  64191. return $core.withContext(function($ctx1) {
  64192. src="foo | a | a + 1. [ | b | b := 2 ]";
  64193. ast=$recv($globals.Smalltalk)._parse_(src);
  64194. $recv($self.analyzer)._visit_(ast);
  64195. return self;
  64196. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast})});
  64197. }; }),
  64198. $globals.SemanticAnalyzerTest);
  64199. $core.addMethod(
  64200. $core.method({
  64201. selector: "testVariableShadowing4",
  64202. protocol: "tests",
  64203. args: [],
  64204. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  64205. referencedClasses: ["Smalltalk"],
  64206. pragmas: [],
  64207. messageSends: ["parse:", "visit:"]
  64208. }, function ($methodClass){ return function (){
  64209. var self=this,$self=this;
  64210. var src,ast;
  64211. return $core.withContext(function($ctx1) {
  64212. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  64213. ast=$recv($globals.Smalltalk)._parse_(src);
  64214. $recv($self.analyzer)._visit_(ast);
  64215. return self;
  64216. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast})});
  64217. }; }),
  64218. $globals.SemanticAnalyzerTest);
  64219. $core.addMethod(
  64220. $core.method({
  64221. selector: "testVariableShadowing5",
  64222. protocol: "tests",
  64223. args: [],
  64224. 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",
  64225. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  64226. pragmas: [],
  64227. messageSends: ["parse:", "should:raise:", "visit:"]
  64228. }, function ($methodClass){ return function (){
  64229. var self=this,$self=this;
  64230. var src,ast;
  64231. return $core.withContext(function($ctx1) {
  64232. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  64233. ast=$recv($globals.Smalltalk)._parse_(src);
  64234. $self._should_raise_((function(){
  64235. return $core.withContext(function($ctx2) {
  64236. return $recv($self.analyzer)._visit_(ast);
  64237. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64238. }),$globals.ShadowingVariableError);
  64239. return self;
  64240. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast})});
  64241. }; }),
  64242. $globals.SemanticAnalyzerTest);
  64243. $core.addMethod(
  64244. $core.method({
  64245. selector: "testVariablesLookup",
  64246. protocol: "tests",
  64247. args: [],
  64248. 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 sequenceNode dagChildren first receiver binding isAssignable.\x0a\x09self assert: ast sequenceNode dagChildren first receiver binding alias equals: 'a'.\x0a\x09self assert: ast sequenceNode dagChildren first receiver binding scope == ast scope.\x0a\x0a\x09\x22Binding for `b`\x22\x0a\x09self assert: ast sequenceNode dagChildren last sequenceNode dagChildren first left binding isAssignable.\x0a\x09self assert: ast sequenceNode dagChildren last sequenceNode dagChildren first left binding alias equals: 'b'.\x0a\x09self assert: ast sequenceNode dagChildren last sequenceNode dagChildren first left binding scope == ast sequenceNode dagChildren last scope.",
  64249. referencedClasses: ["Smalltalk"],
  64250. pragmas: [],
  64251. messageSends: ["parse:", "visit:", "assert:", "isAssignable", "binding", "receiver", "first", "dagChildren", "sequenceNode", "assert:equals:", "alias", "==", "scope", "left", "last"]
  64252. }, function ($methodClass){ return function (){
  64253. var self=this,$self=this;
  64254. var src,ast;
  64255. return $core.withContext(function($ctx1) {
  64256. src="foo | a | a + 1. [ | b | b := a ]";
  64257. ast=$recv($globals.Smalltalk)._parse_(src);
  64258. $recv($self.analyzer)._visit_(ast);
  64259. [$self._assert_([$recv([$recv([$recv([$recv([$recv([$recv(ast)._sequenceNode()
  64260. ,$ctx1.sendIdx["sequenceNode"]=1
  64261. ][0])._dagChildren()
  64262. ,$ctx1.sendIdx["dagChildren"]=1
  64263. ][0])._first()
  64264. ,$ctx1.sendIdx["first"]=1
  64265. ][0])._receiver()
  64266. ,$ctx1.sendIdx["receiver"]=1
  64267. ][0])._binding()
  64268. ,$ctx1.sendIdx["binding"]=1
  64269. ][0])._isAssignable()
  64270. ,$ctx1.sendIdx["isAssignable"]=1
  64271. ][0])
  64272. ,$ctx1.sendIdx["assert:"]=1
  64273. ][0];
  64274. [$self._assert_equals_([$recv([$recv([$recv([$recv([$recv([$recv(ast)._sequenceNode()
  64275. ,$ctx1.sendIdx["sequenceNode"]=2
  64276. ][0])._dagChildren()
  64277. ,$ctx1.sendIdx["dagChildren"]=2
  64278. ][0])._first()
  64279. ,$ctx1.sendIdx["first"]=2
  64280. ][0])._receiver()
  64281. ,$ctx1.sendIdx["receiver"]=2
  64282. ][0])._binding()
  64283. ,$ctx1.sendIdx["binding"]=2
  64284. ][0])._alias()
  64285. ,$ctx1.sendIdx["alias"]=1
  64286. ][0],"a")
  64287. ,$ctx1.sendIdx["assert:equals:"]=1
  64288. ][0];
  64289. [$self._assert_([$recv([$recv([$recv($recv([$recv([$recv([$recv(ast)._sequenceNode()
  64290. ,$ctx1.sendIdx["sequenceNode"]=3
  64291. ][0])._dagChildren()
  64292. ,$ctx1.sendIdx["dagChildren"]=3
  64293. ][0])._first()
  64294. ,$ctx1.sendIdx["first"]=3
  64295. ][0])._receiver())._binding()
  64296. ,$ctx1.sendIdx["binding"]=3
  64297. ][0])._scope()
  64298. ,$ctx1.sendIdx["scope"]=1
  64299. ][0]).__eq_eq([$recv(ast)._scope()
  64300. ,$ctx1.sendIdx["scope"]=2
  64301. ][0])
  64302. ,$ctx1.sendIdx["=="]=1
  64303. ][0])
  64304. ,$ctx1.sendIdx["assert:"]=2
  64305. ][0];
  64306. [$self._assert_($recv([$recv([$recv([$recv([$recv([$recv([$recv([$recv([$recv(ast)._sequenceNode()
  64307. ,$ctx1.sendIdx["sequenceNode"]=5
  64308. ][0])._dagChildren()
  64309. ,$ctx1.sendIdx["dagChildren"]=5
  64310. ][0])._last()
  64311. ,$ctx1.sendIdx["last"]=1
  64312. ][0])._sequenceNode()
  64313. ,$ctx1.sendIdx["sequenceNode"]=4
  64314. ][0])._dagChildren()
  64315. ,$ctx1.sendIdx["dagChildren"]=4
  64316. ][0])._first()
  64317. ,$ctx1.sendIdx["first"]=4
  64318. ][0])._left()
  64319. ,$ctx1.sendIdx["left"]=1
  64320. ][0])._binding()
  64321. ,$ctx1.sendIdx["binding"]=4
  64322. ][0])._isAssignable())
  64323. ,$ctx1.sendIdx["assert:"]=3
  64324. ][0];
  64325. $self._assert_equals_($recv([$recv([$recv([$recv([$recv([$recv([$recv([$recv([$recv(ast)._sequenceNode()
  64326. ,$ctx1.sendIdx["sequenceNode"]=7
  64327. ][0])._dagChildren()
  64328. ,$ctx1.sendIdx["dagChildren"]=7
  64329. ][0])._last()
  64330. ,$ctx1.sendIdx["last"]=2
  64331. ][0])._sequenceNode()
  64332. ,$ctx1.sendIdx["sequenceNode"]=6
  64333. ][0])._dagChildren()
  64334. ,$ctx1.sendIdx["dagChildren"]=6
  64335. ][0])._first()
  64336. ,$ctx1.sendIdx["first"]=5
  64337. ][0])._left()
  64338. ,$ctx1.sendIdx["left"]=2
  64339. ][0])._binding()
  64340. ,$ctx1.sendIdx["binding"]=5
  64341. ][0])._alias(),"b");
  64342. $self._assert_($recv([$recv($recv($recv($recv([$recv([$recv([$recv([$recv([$recv(ast)._sequenceNode()
  64343. ,$ctx1.sendIdx["sequenceNode"]=9
  64344. ][0])._dagChildren()
  64345. ,$ctx1.sendIdx["dagChildren"]=9
  64346. ][0])._last()
  64347. ,$ctx1.sendIdx["last"]=3
  64348. ][0])._sequenceNode()
  64349. ,$ctx1.sendIdx["sequenceNode"]=8
  64350. ][0])._dagChildren()
  64351. ,$ctx1.sendIdx["dagChildren"]=8
  64352. ][0])._first())._left())._binding())._scope()
  64353. ,$ctx1.sendIdx["scope"]=3
  64354. ][0]).__eq_eq($recv($recv($recv($recv(ast)._sequenceNode())._dagChildren())._last())._scope()));
  64355. return self;
  64356. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast})});
  64357. }; }),
  64358. $globals.SemanticAnalyzerTest);
  64359. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  64360. $core.addMethod(
  64361. $core.method({
  64362. selector: "setUp",
  64363. protocol: "running",
  64364. args: [],
  64365. 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",
  64366. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  64367. pragmas: [],
  64368. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  64369. }, function ($methodClass){ return function (){
  64370. var self=this,$self=this;
  64371. return $core.withContext(function($ctx1) {
  64372. var $1,$2;
  64373. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  64374. $2=$recv($globals.AIContext)._new();
  64375. $recv($2)._defineLocal_("local");
  64376. $recv($2)._localAt_put_("local",(3));
  64377. $recv($1)._context_([$recv($2)._yourself()
  64378. ,$ctx1.sendIdx["yourself"]=1
  64379. ][0]);
  64380. $self.analyzer=$recv($1)._yourself();
  64381. return self;
  64382. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  64383. }; }),
  64384. $globals.AISemanticAnalyzerTest);
  64385. $core.addMethod(
  64386. $core.method({
  64387. selector: "testContextVariables",
  64388. protocol: "tests",
  64389. args: [],
  64390. 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",
  64391. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  64392. pragmas: [],
  64393. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  64394. }, function ($methodClass){ return function (){
  64395. var self=this,$self=this;
  64396. var src,ast;
  64397. return $core.withContext(function($ctx1) {
  64398. src="foo | a | local + a";
  64399. ast=$recv($globals.Smalltalk)._parse_(src);
  64400. $self._shouldnt_raise_((function(){
  64401. return $core.withContext(function($ctx2) {
  64402. return $recv($self.analyzer)._visit_(ast);
  64403. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64404. }),$globals.UnknownVariableError);
  64405. return self;
  64406. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast})});
  64407. }; }),
  64408. $globals.AISemanticAnalyzerTest);
  64409. $core.addTrait("TASTCompilingTest", "Compiler-Tests");
  64410. $core.addMethod(
  64411. $core.method({
  64412. selector: "codeGeneratorClass",
  64413. protocol: "accessing",
  64414. args: [],
  64415. source: "codeGeneratorClass\x0a\x09self subclassResponsibility",
  64416. referencedClasses: [],
  64417. pragmas: [],
  64418. messageSends: ["subclassResponsibility"]
  64419. }, function ($methodClass){ return function (){
  64420. var self=this,$self=this;
  64421. return $core.withContext(function($ctx1) {
  64422. $self._subclassResponsibility();
  64423. return self;
  64424. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{})});
  64425. }; }),
  64426. $globals.TASTCompilingTest);
  64427. $core.addMethod(
  64428. $core.method({
  64429. selector: "compiler",
  64430. protocol: "factory",
  64431. args: [],
  64432. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  64433. referencedClasses: ["Compiler"],
  64434. pragmas: [],
  64435. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  64436. }, function ($methodClass){ return function (){
  64437. var self=this,$self=this;
  64438. return $core.withContext(function($ctx1) {
  64439. var $1;
  64440. $1=$recv($globals.Compiler)._new();
  64441. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  64442. return $recv($1)._yourself();
  64443. }, function($ctx1) {$ctx1.fill(self,"compiler",{})});
  64444. }; }),
  64445. $globals.TASTCompilingTest);
  64446. $core.addMethod(
  64447. $core.method({
  64448. selector: "install:forClass:",
  64449. protocol: "compiling",
  64450. args: ["aString", "aClass"],
  64451. source: "install: aString forClass: aClass\x0a\x09^ self compiler\x0a\x09\x09install: aString\x0a\x09\x09forClass: aClass\x0a\x09\x09protocol: 'tests'",
  64452. referencedClasses: [],
  64453. pragmas: [],
  64454. messageSends: ["install:forClass:protocol:", "compiler"]
  64455. }, function ($methodClass){ return function (aString,aClass){
  64456. var self=this,$self=this;
  64457. return $core.withContext(function($ctx1) {
  64458. return $recv($self._compiler())._install_forClass_protocol_(aString,aClass,"tests");
  64459. }, function($ctx1) {$ctx1.fill(self,"install:forClass:",{aString:aString,aClass:aClass})});
  64460. }; }),
  64461. $globals.TASTCompilingTest);
  64462. $core.addMethod(
  64463. $core.method({
  64464. selector: "while:inClass:should:",
  64465. protocol: "testing",
  64466. args: ["aString", "aClass", "aBlock"],
  64467. source: "while: aString inClass: aClass should: aBlock\x0a\x09| method |\x0a\x0a\x09[\x0a\x09\x09method := self install: aString forClass: aClass.\x0a\x09\x09aBlock value: method ]\x0a\x09ensure: [ method ifNotNil: [ aClass removeCompiledMethod: method ] ]",
  64468. referencedClasses: [],
  64469. pragmas: [],
  64470. messageSends: ["ensure:", "install:forClass:", "value:", "ifNotNil:", "removeCompiledMethod:"]
  64471. }, function ($methodClass){ return function (aString,aClass,aBlock){
  64472. var self=this,$self=this;
  64473. var method;
  64474. return $core.withContext(function($ctx1) {
  64475. var $1;
  64476. $recv((function(){
  64477. return $core.withContext(function($ctx2) {
  64478. method=$self._install_forClass_(aString,aClass);
  64479. return $recv(aBlock)._value_(method);
  64480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64481. }))._ensure_((function(){
  64482. return $core.withContext(function($ctx2) {
  64483. $1=method;
  64484. if($1 == null || $1.a$nil){
  64485. return $1;
  64486. } else {
  64487. return $recv(aClass)._removeCompiledMethod_(method);
  64488. }
  64489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64490. }));
  64491. return self;
  64492. }, function($ctx1) {$ctx1.fill(self,"while:inClass:should:",{aString:aString,aClass:aClass,aBlock:aBlock,method:method})});
  64493. }; }),
  64494. $globals.TASTCompilingTest);
  64495. $core.addMethod(
  64496. $core.method({
  64497. selector: "while:should:",
  64498. protocol: "testing",
  64499. args: ["aString", "aBlock"],
  64500. source: "while: aString should: aBlock\x0a\x09self while: aString inClass: self receiver class should: aBlock",
  64501. referencedClasses: [],
  64502. pragmas: [],
  64503. messageSends: ["while:inClass:should:", "class", "receiver"]
  64504. }, function ($methodClass){ return function (aString,aBlock){
  64505. var self=this,$self=this;
  64506. return $core.withContext(function($ctx1) {
  64507. $self._while_inClass_should_(aString,$recv($self._receiver())._class(),aBlock);
  64508. return self;
  64509. }, function($ctx1) {$ctx1.fill(self,"while:should:",{aString:aString,aBlock:aBlock})});
  64510. }; }),
  64511. $globals.TASTCompilingTest);
  64512. $core.addTrait("TASTParsingTest", "Compiler-Tests");
  64513. $core.addMethod(
  64514. $core.method({
  64515. selector: "parse:forClass:",
  64516. protocol: "parsing",
  64517. args: ["aString", "aClass"],
  64518. source: "parse: aString forClass: aClass\x0a\x09^ Compiler new\x0a\x09\x09ast: aString\x0a\x09\x09forClass: aClass\x0a\x09\x09protocol: 'test'",
  64519. referencedClasses: ["Compiler"],
  64520. pragmas: [],
  64521. messageSends: ["ast:forClass:protocol:", "new"]
  64522. }, function ($methodClass){ return function (aString,aClass){
  64523. var self=this,$self=this;
  64524. return $core.withContext(function($ctx1) {
  64525. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_(aString,aClass,"test");
  64526. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass})});
  64527. }; }),
  64528. $globals.TASTParsingTest);
  64529. $core.addTrait("TCTDebugged", "Compiler-Tests");
  64530. $core.addMethod(
  64531. $core.method({
  64532. selector: "interpret:forClass:receiver:withArguments:",
  64533. protocol: "private",
  64534. args: ["aString", "aClass", "anObject", "aDictionary"],
  64535. source: "interpret: aString forClass: aClass receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx |\x0a\x09\x0a\x09ctx := self prepareContextFor: aString class: aClass receiver: anObject withArguments: aDictionary.\x0a\x09\x0a\x09^ (ASTDebugger context: ctx) proceed; result",
  64536. referencedClasses: ["ASTDebugger"],
  64537. pragmas: [],
  64538. messageSends: ["prepareContextFor:class:receiver:withArguments:", "proceed", "context:", "result"]
  64539. }, function ($methodClass){ return function (aString,aClass,anObject,aDictionary){
  64540. var self=this,$self=this;
  64541. var ctx;
  64542. return $core.withContext(function($ctx1) {
  64543. var $1;
  64544. ctx=$self._prepareContextFor_class_receiver_withArguments_(aString,aClass,anObject,aDictionary);
  64545. $1=$recv($globals.ASTDebugger)._context_(ctx);
  64546. $recv($1)._proceed();
  64547. return $recv($1)._result();
  64548. }, function($ctx1) {$ctx1.fill(self,"interpret:forClass:receiver:withArguments:",{aString:aString,aClass:aClass,anObject:anObject,aDictionary:aDictionary,ctx:ctx})});
  64549. }; }),
  64550. $globals.TCTDebugged);
  64551. $core.addTrait("TCTExecuted", "Compiler-Tests");
  64552. $core.addMethod(
  64553. $core.method({
  64554. selector: "while:inClass:should:",
  64555. protocol: "testing",
  64556. args: ["aString", "aClass", "aBlock"],
  64557. source: "while: aString inClass: aClass should: aBlock\x0a\x09super\x0a\x09\x09while: aString\x0a\x09\x09inClass: aClass\x0a\x09\x09should: [ :method | aBlock value: [\x0a\x09\x09\x09self receiver perform: method selector withArguments: self arguments ] ]",
  64558. referencedClasses: [],
  64559. pragmas: [],
  64560. messageSends: ["while:inClass:should:", "value:", "perform:withArguments:", "receiver", "selector", "arguments"]
  64561. }, function ($methodClass){ return function (aString,aClass,aBlock){
  64562. var self=this,$self=this;
  64563. return $core.withContext(function($ctx1) {
  64564. [(
  64565. $ctx1.supercall = true,
  64566. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._while_inClass_should_.call($self,aString,aClass,(function(method){
  64567. return $core.withContext(function($ctx2) {
  64568. return $recv(aBlock)._value_((function(){
  64569. return $core.withContext(function($ctx3) {
  64570. return $recv($self._receiver())._perform_withArguments_($recv(method)._selector(),$self._arguments());
  64571. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  64572. }));
  64573. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  64574. })))
  64575. ,$ctx1.supercall = false
  64576. ][0];
  64577. return self;
  64578. }, function($ctx1) {$ctx1.fill(self,"while:inClass:should:",{aString:aString,aClass:aClass,aBlock:aBlock})});
  64579. }; }),
  64580. $globals.TCTExecuted);
  64581. $core.addTrait("TCTInlined", "Compiler-Tests");
  64582. $core.addMethod(
  64583. $core.method({
  64584. selector: "codeGeneratorClass",
  64585. protocol: "accessing",
  64586. args: [],
  64587. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  64588. referencedClasses: ["InliningCodeGenerator"],
  64589. pragmas: [],
  64590. messageSends: []
  64591. }, function ($methodClass){ return function (){
  64592. var self=this,$self=this;
  64593. return $globals.InliningCodeGenerator;
  64594. }; }),
  64595. $globals.TCTInlined);
  64596. $core.addTrait("TCTInterpreted", "Compiler-Tests");
  64597. $core.addMethod(
  64598. $core.method({
  64599. selector: "interpret:forClass:receiver:withArguments:",
  64600. protocol: "private",
  64601. args: ["aString", "aClass", "anObject", "aDictionary"],
  64602. source: "interpret: aString forClass: aClass receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx |\x0a\x09\x0a\x09ctx := self prepareContextFor: aString class: aClass receiver: anObject withArguments: aDictionary.\x0a\x09\x0a\x09^ ctx interpreter proceed; result",
  64603. referencedClasses: [],
  64604. pragmas: [],
  64605. messageSends: ["prepareContextFor:class:receiver:withArguments:", "proceed", "interpreter", "result"]
  64606. }, function ($methodClass){ return function (aString,aClass,anObject,aDictionary){
  64607. var self=this,$self=this;
  64608. var ctx;
  64609. return $core.withContext(function($ctx1) {
  64610. var $1;
  64611. ctx=$self._prepareContextFor_class_receiver_withArguments_(aString,aClass,anObject,aDictionary);
  64612. $1=$recv(ctx)._interpreter();
  64613. $recv($1)._proceed();
  64614. return $recv($1)._result();
  64615. }, function($ctx1) {$ctx1.fill(self,"interpret:forClass:receiver:withArguments:",{aString:aString,aClass:aClass,anObject:anObject,aDictionary:aDictionary,ctx:ctx})});
  64616. }; }),
  64617. $globals.TCTInterpreted);
  64618. $core.addMethod(
  64619. $core.method({
  64620. selector: "prepareContextFor:class:receiver:withArguments:",
  64621. protocol: "private",
  64622. args: ["aString", "aClass", "anObject", "anArray"],
  64623. source: "prepareContextFor: aString class: aClass receiver: anObject withArguments: anArray\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx ast |\x0a\x09\x0a\x09ast := self parse: aString forClass: aClass.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09selector: ast selector;\x0a\x09\x09interpreter: ASTInterpreter new;\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\x0a\x09ast arguments with: anArray do: [ :key :value |\x0a\x09\x09ctx defineLocal: key; localAt: key put: value ].\x0a\x09\x0a\x09ctx interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09node: ast;\x0a\x09\x09enterNode.\x0a\x09\x0a\x09^ctx",
  64624. referencedClasses: ["AIContext", "ASTInterpreter"],
  64625. pragmas: [],
  64626. messageSends: ["parse:forClass:", "receiver:", "new", "selector:", "selector", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "with:do:", "arguments", "localAt:put:", "context:", "interpreter", "node:", "enterNode"]
  64627. }, function ($methodClass){ return function (aString,aClass,anObject,anArray){
  64628. var self=this,$self=this;
  64629. var ctx,ast;
  64630. return $core.withContext(function($ctx1) {
  64631. var $1,$2,$3,$4;
  64632. ast=$self._parse_forClass_(aString,aClass);
  64633. $1=[$recv($globals.AIContext)._new()
  64634. ,$ctx1.sendIdx["new"]=1
  64635. ][0];
  64636. $recv($1)._receiver_(anObject);
  64637. $recv($1)._selector_($recv(ast)._selector());
  64638. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  64639. ctx=$recv($1)._yourself();
  64640. $2=$recv(ast)._sequenceNode();
  64641. if($2 == null || $2.a$nil){
  64642. $2;
  64643. } else {
  64644. var sequence;
  64645. sequence=$2;
  64646. $recv($recv(sequence)._temps())._do_((function(each){
  64647. return $core.withContext(function($ctx2) {
  64648. return [$recv(ctx)._defineLocal_(each)
  64649. ,$ctx2.sendIdx["defineLocal:"]=1
  64650. ][0];
  64651. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  64652. }));
  64653. }
  64654. $recv($recv(ast)._arguments())._with_do_(anArray,(function(key,value){
  64655. return $core.withContext(function($ctx2) {
  64656. $3=ctx;
  64657. $recv($3)._defineLocal_(key);
  64658. return $recv($3)._localAt_put_(key,value);
  64659. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  64660. }));
  64661. $4=$recv(ctx)._interpreter();
  64662. $recv($4)._context_(ctx);
  64663. $recv($4)._node_(ast);
  64664. $recv($4)._enterNode();
  64665. return ctx;
  64666. }, function($ctx1) {$ctx1.fill(self,"prepareContextFor:class:receiver:withArguments:",{aString:aString,aClass:aClass,anObject:anObject,anArray:anArray,ctx:ctx,ast:ast})});
  64667. }; }),
  64668. $globals.TCTInterpreted);
  64669. $core.addMethod(
  64670. $core.method({
  64671. selector: "while:inClass:should:",
  64672. protocol: "testing",
  64673. args: ["aString", "aClass", "aBlock"],
  64674. source: "while: aString inClass: aClass should: aBlock\x0a\x09super\x0a\x09\x09while: aString\x0a\x09\x09inClass: aClass\x0a\x09\x09should: [ aBlock value: [\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09interpret: aString\x0a\x09\x09\x09\x09forClass: aClass\x0a\x09\x09\x09\x09receiver: self receiver\x0a\x09\x09\x09\x09withArguments: self arguments ] ]",
  64675. referencedClasses: [],
  64676. pragmas: [],
  64677. messageSends: ["while:inClass:should:", "value:", "interpret:forClass:receiver:withArguments:", "receiver", "arguments"]
  64678. }, function ($methodClass){ return function (aString,aClass,aBlock){
  64679. var self=this,$self=this;
  64680. return $core.withContext(function($ctx1) {
  64681. [(
  64682. $ctx1.supercall = true,
  64683. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._while_inClass_should_.call($self,aString,aClass,(function(){
  64684. return $core.withContext(function($ctx2) {
  64685. return $recv(aBlock)._value_((function(){
  64686. return $core.withContext(function($ctx3) {
  64687. return $self._interpret_forClass_receiver_withArguments_(aString,aClass,$self._receiver(),$self._arguments());
  64688. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  64689. }));
  64690. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64691. })))
  64692. ,$ctx1.supercall = false
  64693. ][0];
  64694. return self;
  64695. }, function($ctx1) {$ctx1.fill(self,"while:inClass:should:",{aString:aString,aClass:aClass,aBlock:aBlock})});
  64696. }; }),
  64697. $globals.TCTInterpreted);
  64698. $core.addTrait("TCTNonInlined", "Compiler-Tests");
  64699. $core.addMethod(
  64700. $core.method({
  64701. selector: "codeGeneratorClass",
  64702. protocol: "accessing",
  64703. args: [],
  64704. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  64705. referencedClasses: ["CodeGenerator"],
  64706. pragmas: [],
  64707. messageSends: []
  64708. }, function ($methodClass){ return function (){
  64709. var self=this,$self=this;
  64710. return $globals.CodeGenerator;
  64711. }; }),
  64712. $globals.TCTNonInlined);
  64713. $core.setTraitComposition([{trait: $globals.TASTParsingTest}], $globals.TASTCompilingTest);
  64714. $core.setTraitComposition([{trait: $globals.TCTInterpreted}], $globals.TCTDebugged);
  64715. $core.setTraitComposition([{trait: $globals.TASTCompilingTest}], $globals.ASTMethodRunningTest);
  64716. $core.setTraitComposition([{trait: $globals.TCTNonInlined}, {trait: $globals.TCTDebugged}], $globals.ASTDebuggerTest);
  64717. $core.setTraitComposition([{trait: $globals.TCTNonInlined}, {trait: $globals.TCTInterpreted}], $globals.ASTInterpreterTest);
  64718. $core.setTraitComposition([{trait: $globals.TCTNonInlined}, {trait: $globals.TCTExecuted}], $globals.CodeGeneratorTest);
  64719. $core.setTraitComposition([{trait: $globals.TCTInlined}, {trait: $globals.TCTExecuted}], $globals.InliningCodeGeneratorTest);
  64720. $core.setTraitComposition([{trait: $globals.TClassBuildingTest}], $globals.AbstractJavaScriptGatewayTest);
  64721. $core.setTraitComposition([{trait: $globals.TCTNonInlined}, {trait: $globals.TCTDebugged}], $globals.DebuggedJSGTest);
  64722. $core.setTraitComposition([{trait: $globals.TCTInlined}, {trait: $globals.TCTExecuted}], $globals.InlinedJSGTest);
  64723. $core.setTraitComposition([{trait: $globals.TCTNonInlined}, {trait: $globals.TCTInterpreted}], $globals.InterpretedJSGTest);
  64724. $core.setTraitComposition([{trait: $globals.TCTNonInlined}, {trait: $globals.TCTExecuted}], $globals.PlainJSGTest);
  64725. $core.setTraitComposition([{trait: $globals.TASTParsingTest}], $globals.ASTPCNodeVisitorTest);
  64726. $core.setTraitComposition([{trait: $globals.TASTParsingTest}], $globals.ASTPositionTest);
  64727. $core.setTraitComposition([{trait: $globals.TASTCompilingTest}], $globals.AbstractCodeGeneratorInstallTest);
  64728. $core.setTraitComposition([{trait: $globals.TCTNonInlined}], $globals.CodeGeneratorInstallTest);
  64729. $core.setTraitComposition([{trait: $globals.TCTInlined}], $globals.InliningCodeGeneratorInstallTest);
  64730. });
  64731. define('amber/core/Platform-DOM-Tests',["amber/boot", "require", "amber/core/SUnit"], function($boot,requirejs){"use strict";
  64732. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  64733. var $pkg = $core.addPackage("Platform-DOM-Tests");
  64734. $pkg.innerEval = function (expr) { return eval(expr); };
  64735. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  64736. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  64737. $core.addMethod(
  64738. $core.method({
  64739. selector: "testEntityConversion",
  64740. protocol: "testing",
  64741. args: [],
  64742. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  64743. referencedClasses: ["PlatformDom"],
  64744. pragmas: [],
  64745. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  64746. }, function ($methodClass){ return function (){
  64747. var self=this,$self=this;
  64748. return $core.withContext(function($ctx1) {
  64749. if($core.assert($recv($globals.PlatformDom)._isFeasible())){
  64750. $self._assert_equals_("&copy;"._htmlTextContent(),"©");
  64751. }
  64752. return self;
  64753. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{})});
  64754. }; }),
  64755. $globals.PlatformDomTest);
  64756. $core.addMethod(
  64757. $core.method({
  64758. selector: "testTextContentDoesNotRunScript",
  64759. protocol: "testing",
  64760. args: [],
  64761. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  64762. referencedClasses: ["PlatformDom", "Error"],
  64763. pragmas: [],
  64764. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  64765. }, function ($methodClass){ return function (){
  64766. var self=this,$self=this;
  64767. return $core.withContext(function($ctx1) {
  64768. if($core.assert($recv($globals.PlatformDom)._isFeasible())){
  64769. $self._shouldnt_raise_((function(){
  64770. return $core.withContext(function($ctx2) {
  64771. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  64772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64773. }),$globals.Error);
  64774. }
  64775. return self;
  64776. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{})});
  64777. }; }),
  64778. $globals.PlatformDomTest);
  64779. });
  64780. define('amber/core/SUnit-Tests',["amber/boot", "require", "amber/core/SUnit"], function($boot,requirejs){"use strict";
  64781. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  64782. var $pkg = $core.addPackage("SUnit-Tests");
  64783. $pkg.innerEval = function (expr) { return eval(expr); };
  64784. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  64785. $core.addClass("ExampleSetTest", $globals.TestCase, ["empty", "full"], "SUnit-Tests");
  64786. $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.";
  64787. $core.addMethod(
  64788. $core.method({
  64789. selector: "setUp",
  64790. protocol: "running",
  64791. args: [],
  64792. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  64793. referencedClasses: ["Set"],
  64794. pragmas: [],
  64795. messageSends: ["new", "with:with:"]
  64796. }, function ($methodClass){ return function (){
  64797. var self=this,$self=this;
  64798. return $core.withContext(function($ctx1) {
  64799. $self.empty=$recv($globals.Set)._new();
  64800. $self.full=$recv($globals.Set)._with_with_((5),"abc");
  64801. return self;
  64802. }, function($ctx1) {$ctx1.fill(self,"setUp",{})});
  64803. }; }),
  64804. $globals.ExampleSetTest);
  64805. $core.addMethod(
  64806. $core.method({
  64807. selector: "testAdd",
  64808. protocol: "tests",
  64809. args: [],
  64810. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  64811. referencedClasses: [],
  64812. pragmas: [],
  64813. messageSends: ["add:", "assert:", "includes:"]
  64814. }, function ($methodClass){ return function (){
  64815. var self=this,$self=this;
  64816. return $core.withContext(function($ctx1) {
  64817. $recv($self.empty)._add_((5));
  64818. $self._assert_($recv($self.empty)._includes_((5)));
  64819. return self;
  64820. }, function($ctx1) {$ctx1.fill(self,"testAdd",{})});
  64821. }; }),
  64822. $globals.ExampleSetTest);
  64823. $core.addMethod(
  64824. $core.method({
  64825. selector: "testGrow",
  64826. protocol: "tests",
  64827. args: [],
  64828. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  64829. referencedClasses: [],
  64830. pragmas: [],
  64831. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  64832. }, function ($methodClass){ return function (){
  64833. var self=this,$self=this;
  64834. return $core.withContext(function($ctx1) {
  64835. $recv($self.empty)._addAll_((1)._to_((100)));
  64836. $self._assert_equals_($recv($self.empty)._size(),(100));
  64837. return self;
  64838. }, function($ctx1) {$ctx1.fill(self,"testGrow",{})});
  64839. }; }),
  64840. $globals.ExampleSetTest);
  64841. $core.addMethod(
  64842. $core.method({
  64843. selector: "testIllegal",
  64844. protocol: "tests",
  64845. args: [],
  64846. 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",
  64847. referencedClasses: ["Error"],
  64848. pragmas: [],
  64849. messageSends: ["should:raise:", "at:", "at:put:"]
  64850. }, function ($methodClass){ return function (){
  64851. var self=this,$self=this;
  64852. return $core.withContext(function($ctx1) {
  64853. [$self._should_raise_((function(){
  64854. return $core.withContext(function($ctx2) {
  64855. return $recv($self.empty)._at_((5));
  64856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64857. }),$globals.Error)
  64858. ,$ctx1.sendIdx["should:raise:"]=1
  64859. ][0];
  64860. $self._should_raise_((function(){
  64861. return $core.withContext(function($ctx2) {
  64862. return $recv($self.empty)._at_put_((5),"abc");
  64863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64864. }),$globals.Error);
  64865. return self;
  64866. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{})});
  64867. }; }),
  64868. $globals.ExampleSetTest);
  64869. $core.addMethod(
  64870. $core.method({
  64871. selector: "testIncludes",
  64872. protocol: "tests",
  64873. args: [],
  64874. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  64875. referencedClasses: [],
  64876. pragmas: [],
  64877. messageSends: ["assert:", "includes:"]
  64878. }, function ($methodClass){ return function (){
  64879. var self=this,$self=this;
  64880. return $core.withContext(function($ctx1) {
  64881. [$self._assert_([$recv($self.full)._includes_((5))
  64882. ,$ctx1.sendIdx["includes:"]=1
  64883. ][0])
  64884. ,$ctx1.sendIdx["assert:"]=1
  64885. ][0];
  64886. $self._assert_($recv($self.full)._includes_("abc"));
  64887. return self;
  64888. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{})});
  64889. }; }),
  64890. $globals.ExampleSetTest);
  64891. $core.addMethod(
  64892. $core.method({
  64893. selector: "testOccurrences",
  64894. protocol: "tests",
  64895. args: [],
  64896. 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",
  64897. referencedClasses: [],
  64898. pragmas: [],
  64899. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  64900. }, function ($methodClass){ return function (){
  64901. var self=this,$self=this;
  64902. return $core.withContext(function($ctx1) {
  64903. [$self._assert_equals_([$recv($self.empty)._occurrencesOf_((0))
  64904. ,$ctx1.sendIdx["occurrencesOf:"]=1
  64905. ][0],(0))
  64906. ,$ctx1.sendIdx["assert:equals:"]=1
  64907. ][0];
  64908. [$self._assert_equals_([$recv($self.full)._occurrencesOf_((5))
  64909. ,$ctx1.sendIdx["occurrencesOf:"]=2
  64910. ][0],(1))
  64911. ,$ctx1.sendIdx["assert:equals:"]=2
  64912. ][0];
  64913. $recv($self.full)._add_((5));
  64914. $self._assert_equals_($recv($self.full)._occurrencesOf_((5)),(1));
  64915. return self;
  64916. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{})});
  64917. }; }),
  64918. $globals.ExampleSetTest);
  64919. $core.addMethod(
  64920. $core.method({
  64921. selector: "testRemove",
  64922. protocol: "tests",
  64923. args: [],
  64924. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  64925. referencedClasses: [],
  64926. pragmas: [],
  64927. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  64928. }, function ($methodClass){ return function (){
  64929. var self=this,$self=this;
  64930. return $core.withContext(function($ctx1) {
  64931. $recv($self.full)._remove_((5));
  64932. $self._assert_([$recv($self.full)._includes_("abc")
  64933. ,$ctx1.sendIdx["includes:"]=1
  64934. ][0]);
  64935. $self._deny_($recv($self.full)._includes_((5)));
  64936. return self;
  64937. }, function($ctx1) {$ctx1.fill(self,"testRemove",{})});
  64938. }; }),
  64939. $globals.ExampleSetTest);
  64940. $core.addClass("SUnitAsyncTest", $globals.TestCase, ["flag"], "SUnit-Tests");
  64941. $core.addMethod(
  64942. $core.method({
  64943. selector: "fakeError",
  64944. protocol: "helpers",
  64945. args: [],
  64946. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  64947. referencedClasses: [],
  64948. pragmas: [],
  64949. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  64950. }, function ($methodClass){ return function (){
  64951. var self=this,$self=this;
  64952. return $core.withContext(function($ctx1) {
  64953. $self.flag="bad";
  64954. $self._timeout_((30));
  64955. $self.flag=$recv($self._async_((function(){
  64956. return $core.withContext(function($ctx2) {
  64957. $self.flag="ok";
  64958. return $self._error_("Intentional");
  64959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64960. })))._valueWithTimeout_((20));
  64961. return self;
  64962. }, function($ctx1) {$ctx1.fill(self,"fakeError",{})});
  64963. }; }),
  64964. $globals.SUnitAsyncTest);
  64965. $core.addMethod(
  64966. $core.method({
  64967. selector: "fakeErrorFailingInTearDown",
  64968. protocol: "helpers",
  64969. args: [],
  64970. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  64971. referencedClasses: [],
  64972. pragmas: [],
  64973. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  64974. }, function ($methodClass){ return function (){
  64975. var self=this,$self=this;
  64976. return $core.withContext(function($ctx1) {
  64977. $self.flag="bad";
  64978. $self._timeout_((30));
  64979. $self.flag=$recv($self._async_((function(){
  64980. return $core.withContext(function($ctx2) {
  64981. return $self._error_("Intentional");
  64982. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64983. })))._valueWithTimeout_((20));
  64984. return self;
  64985. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{})});
  64986. }; }),
  64987. $globals.SUnitAsyncTest);
  64988. $core.addMethod(
  64989. $core.method({
  64990. selector: "fakeFailure",
  64991. protocol: "helpers",
  64992. args: [],
  64993. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  64994. referencedClasses: [],
  64995. pragmas: [],
  64996. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  64997. }, function ($methodClass){ return function (){
  64998. var self=this,$self=this;
  64999. return $core.withContext(function($ctx1) {
  65000. $self.flag="bad";
  65001. $self._timeout_((30));
  65002. $self.flag=$recv($self._async_((function(){
  65003. return $core.withContext(function($ctx2) {
  65004. $self.flag="ok";
  65005. return $self._assert_(false);
  65006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  65007. })))._valueWithTimeout_((20));
  65008. return self;
  65009. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{})});
  65010. }; }),
  65011. $globals.SUnitAsyncTest);
  65012. $core.addMethod(
  65013. $core.method({
  65014. selector: "fakeMultipleTimeoutFailing",
  65015. protocol: "helpers",
  65016. args: [],
  65017. 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",
  65018. referencedClasses: [],
  65019. pragmas: [],
  65020. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  65021. }, function ($methodClass){ return function (){
  65022. var self=this,$self=this;
  65023. return $core.withContext(function($ctx1) {
  65024. [$self._timeout_((100))
  65025. ,$ctx1.sendIdx["timeout:"]=1
  65026. ][0];
  65027. [$recv([$self._async_((function(){
  65028. return $core.withContext(function($ctx2) {
  65029. $self._timeout_((20));
  65030. return $recv($self._async_((function(){
  65031. return $core.withContext(function($ctx3) {
  65032. return $self._finished();
  65033. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  65034. })))._valueWithTimeout_((30));
  65035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  65036. }))
  65037. ,$ctx1.sendIdx["async:"]=1
  65038. ][0])._valueWithTimeout_((20))
  65039. ,$ctx1.sendIdx["valueWithTimeout:"]=1
  65040. ][0];
  65041. return self;
  65042. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{})});
  65043. }; }),
  65044. $globals.SUnitAsyncTest);
  65045. $core.addMethod(
  65046. $core.method({
  65047. selector: "fakeMultipleTimeoutPassing",
  65048. protocol: "helpers",
  65049. args: [],
  65050. 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",
  65051. referencedClasses: [],
  65052. pragmas: [],
  65053. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  65054. }, function ($methodClass){ return function (){
  65055. var self=this,$self=this;
  65056. return $core.withContext(function($ctx1) {
  65057. [$self._timeout_((20))
  65058. ,$ctx1.sendIdx["timeout:"]=1
  65059. ][0];
  65060. [$recv([$self._async_((function(){
  65061. return $core.withContext(function($ctx2) {
  65062. $self._timeout_((40));
  65063. return $recv($self._async_((function(){
  65064. return $core.withContext(function($ctx3) {
  65065. return $self._finished();
  65066. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  65067. })))._valueWithTimeout_((20));
  65068. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  65069. }))
  65070. ,$ctx1.sendIdx["async:"]=1
  65071. ][0])._valueWithTimeout_((10))
  65072. ,$ctx1.sendIdx["valueWithTimeout:"]=1
  65073. ][0];
  65074. return self;
  65075. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{})});
  65076. }; }),
  65077. $globals.SUnitAsyncTest);
  65078. $core.addMethod(
  65079. $core.method({
  65080. selector: "fakeTimeout",
  65081. protocol: "helpers",
  65082. args: [],
  65083. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  65084. referencedClasses: [],
  65085. pragmas: [],
  65086. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  65087. }, function ($methodClass){ return function (){
  65088. var self=this,$self=this;
  65089. return $core.withContext(function($ctx1) {
  65090. $self._timeout_((10));
  65091. $recv($self._async_((function(){
  65092. return $core.withContext(function($ctx2) {
  65093. return $self._finished();
  65094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  65095. })))._valueWithTimeout_((20));
  65096. return self;
  65097. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{})});
  65098. }; }),
  65099. $globals.SUnitAsyncTest);
  65100. $core.addMethod(
  65101. $core.method({
  65102. selector: "selectorSetOf:",
  65103. protocol: "private",
  65104. args: ["aCollection"],
  65105. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  65106. referencedClasses: [],
  65107. pragmas: [],
  65108. messageSends: ["asSet", "collect:", "selector"]
  65109. }, function ($methodClass){ return function (aCollection){
  65110. var self=this,$self=this;
  65111. return $core.withContext(function($ctx1) {
  65112. return $recv($recv(aCollection)._collect_((function(each){
  65113. return $core.withContext(function($ctx2) {
  65114. return $recv(each)._selector();
  65115. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  65116. })))._asSet();
  65117. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection})});
  65118. }; }),
  65119. $globals.SUnitAsyncTest);
  65120. $core.addMethod(
  65121. $core.method({
  65122. selector: "setUp",
  65123. protocol: "running",
  65124. args: [],
  65125. source: "setUp\x0a\x09flag := 'ok'",
  65126. referencedClasses: [],
  65127. pragmas: [],
  65128. messageSends: []
  65129. }, function ($methodClass){ return function (){
  65130. var self=this,$self=this;
  65131. $self.flag="ok";
  65132. return self;
  65133. }; }),
  65134. $globals.SUnitAsyncTest);
  65135. $core.addMethod(
  65136. $core.method({
  65137. selector: "tearDown",
  65138. protocol: "running",
  65139. args: [],
  65140. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  65141. referencedClasses: [],
  65142. pragmas: [],
  65143. messageSends: ["assert:equals:"]
  65144. }, function ($methodClass){ return function (){
  65145. var self=this,$self=this;
  65146. return $core.withContext(function($ctx1) {
  65147. $self._assert_equals_("ok",$self.flag);
  65148. return self;
  65149. }, function($ctx1) {$ctx1.fill(self,"tearDown",{})});
  65150. }; }),
  65151. $globals.SUnitAsyncTest);
  65152. $core.addMethod(
  65153. $core.method({
  65154. selector: "testAsyncErrorsAndFailures",
  65155. protocol: "tests",
  65156. args: [],
  65157. 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",
  65158. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  65159. pragmas: [],
  65160. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  65161. }, function ($methodClass){ return function (){
  65162. var self=this,$self=this;
  65163. var suite,runner,result,assertBlock;
  65164. return $core.withContext(function($ctx1) {
  65165. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  65166. return $core.withContext(function($ctx2) {
  65167. return $recv($self._class())._selector_(each);
  65168. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  65169. }));
  65170. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  65171. $self._timeout_((200));
  65172. result=[$recv(runner)._result()
  65173. ,$ctx1.sendIdx["result"]=1
  65174. ][0];
  65175. assertBlock=$self._async_((function(){
  65176. return $core.withContext(function($ctx2) {
  65177. [$self._assert_equals_([$self._selectorSetOf_($recv(result)._errors())
  65178. ,$ctx2.sendIdx["selectorSetOf:"]=1
  65179. ][0],[["fakeError"]._asSet()
  65180. ,$ctx2.sendIdx["asSet"]=1
  65181. ][0])
  65182. ,$ctx2.sendIdx["assert:equals:"]=1
  65183. ][0];
  65184. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  65185. return $self._finished();
  65186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  65187. }));
  65188. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  65189. return $core.withContext(function($ctx2) {
  65190. if($core.assert($recv($recv(ann)._result()).__eq_eq(result))){
  65191. return $recv($recv($recv(result)._runs()).__eq($recv(result)._total()))._ifTrue_(assertBlock);
  65192. }
  65193. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  65194. }));
  65195. $recv(runner)._run();
  65196. return self;
  65197. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock})});
  65198. }; }),
  65199. $globals.SUnitAsyncTest);
  65200. $core.addMethod(
  65201. $core.method({
  65202. selector: "testAsyncNeedsTimeout",
  65203. protocol: "tests",
  65204. args: [],
  65205. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  65206. referencedClasses: ["Error"],
  65207. pragmas: [],
  65208. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  65209. }, function ($methodClass){ return function (){
  65210. var self=this,$self=this;
  65211. return $core.withContext(function($ctx1) {
  65212. $self._should_raise_((function(){
  65213. return $core.withContext(function($ctx2) {
  65214. return [$self._async_((function(){
  65215. }))
  65216. ,$ctx2.sendIdx["async:"]=1
  65217. ][0];
  65218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  65219. }),$globals.Error);
  65220. $self._timeout_((0));
  65221. $self._shouldnt_raise_((function(){
  65222. return $core.withContext(function($ctx2) {
  65223. return $self._async_((function(){
  65224. }));
  65225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  65226. }),$globals.Error);
  65227. $self._finished();
  65228. return self;
  65229. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{})});
  65230. }; }),
  65231. $globals.SUnitAsyncTest);
  65232. $core.addMethod(
  65233. $core.method({
  65234. selector: "testFinishedNeedsTimeout",
  65235. protocol: "tests",
  65236. args: [],
  65237. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  65238. referencedClasses: ["Error"],
  65239. pragmas: [],
  65240. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  65241. }, function ($methodClass){ return function (){
  65242. var self=this,$self=this;
  65243. return $core.withContext(function($ctx1) {
  65244. $self._should_raise_((function(){
  65245. return $core.withContext(function($ctx2) {
  65246. return [$self._finished()
  65247. ,$ctx2.sendIdx["finished"]=1
  65248. ][0];
  65249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  65250. }),$globals.Error);
  65251. $self._timeout_((0));
  65252. $self._shouldnt_raise_((function(){
  65253. return $core.withContext(function($ctx2) {
  65254. return $self._finished();
  65255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  65256. }),$globals.Error);
  65257. return self;
  65258. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{})});
  65259. }; }),
  65260. $globals.SUnitAsyncTest);
  65261. $core.addMethod(
  65262. $core.method({
  65263. selector: "testIsAsyncReturnsCorrectValues",
  65264. protocol: "tests",
  65265. args: [],
  65266. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  65267. referencedClasses: [],
  65268. pragmas: [],
  65269. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  65270. }, function ($methodClass){ return function (){
  65271. var self=this,$self=this;
  65272. return $core.withContext(function($ctx1) {
  65273. [$self._deny_([$self._isAsync()
  65274. ,$ctx1.sendIdx["isAsync"]=1
  65275. ][0])
  65276. ,$ctx1.sendIdx["deny:"]=1
  65277. ][0];
  65278. $self._timeout_((0));
  65279. $self._assert_([$self._isAsync()
  65280. ,$ctx1.sendIdx["isAsync"]=2
  65281. ][0]);
  65282. $self._finished();
  65283. $self._deny_($self._isAsync());
  65284. return self;
  65285. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{})});
  65286. }; }),
  65287. $globals.SUnitAsyncTest);
  65288. $core.addMethod(
  65289. $core.method({
  65290. selector: "testPass",
  65291. protocol: "tests",
  65292. args: [],
  65293. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  65294. referencedClasses: [],
  65295. pragmas: [],
  65296. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  65297. }, function ($methodClass){ return function (){
  65298. var self=this,$self=this;
  65299. return $core.withContext(function($ctx1) {
  65300. $self.flag="bad";
  65301. $self._timeout_((10));
  65302. $self.flag=$recv($self._async_((function(){
  65303. return $core.withContext(function($ctx2) {
  65304. $self._assert_(true);
  65305. $self._finished();
  65306. $self.flag="ok";
  65307. return $self.flag;
  65308. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  65309. })))._valueWithTimeout_((5));
  65310. return self;
  65311. }, function($ctx1) {$ctx1.fill(self,"testPass",{})});
  65312. }; }),
  65313. $globals.SUnitAsyncTest);
  65314. $core.addMethod(
  65315. $core.method({
  65316. selector: "testTimeouts",
  65317. protocol: "tests",
  65318. args: [],
  65319. 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",
  65320. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  65321. pragmas: [],
  65322. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  65323. }, function ($methodClass){ return function (){
  65324. var self=this,$self=this;
  65325. var suite,runner,result,assertBlock;
  65326. return $core.withContext(function($ctx1) {
  65327. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  65328. return $core.withContext(function($ctx2) {
  65329. return $recv($self._class())._selector_(each);
  65330. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  65331. }));
  65332. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  65333. $self._timeout_((200));
  65334. result=[$recv(runner)._result()
  65335. ,$ctx1.sendIdx["result"]=1
  65336. ][0];
  65337. assertBlock=$self._async_((function(){
  65338. return $core.withContext(function($ctx2) {
  65339. [$self._assert_equals_([$self._selectorSetOf_($recv(result)._errors())
  65340. ,$ctx2.sendIdx["selectorSetOf:"]=1
  65341. ][0],$recv($globals.Set)._new())
  65342. ,$ctx2.sendIdx["assert:equals:"]=1
  65343. ][0];
  65344. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  65345. return $self._finished();
  65346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  65347. }));
  65348. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  65349. return $core.withContext(function($ctx2) {
  65350. if($core.assert($recv($recv(ann)._result()).__eq_eq(result))){
  65351. return $recv($recv($recv(result)._runs()).__eq($recv(result)._total()))._ifTrue_(assertBlock);
  65352. }
  65353. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  65354. }));
  65355. $recv(runner)._run();
  65356. return self;
  65357. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock})});
  65358. }; }),
  65359. $globals.SUnitAsyncTest);
  65360. $core.addMethod(
  65361. $core.method({
  65362. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  65363. protocol: "tests",
  65364. args: [],
  65365. 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.",
  65366. referencedClasses: [],
  65367. pragmas: [],
  65368. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  65369. }, function ($methodClass){ return function (){
  65370. var self=this,$self=this;
  65371. var x;
  65372. return $core.withContext(function($ctx1) {
  65373. $self.flag="bad";
  65374. $self._timeout_((10));
  65375. x=(0);
  65376. $self.flag=[$recv([$self._async_((function(){
  65377. return $core.withContext(function($ctx2) {
  65378. [$self._finished()
  65379. ,$ctx2.sendIdx["finished"]=1
  65380. ][0];
  65381. $self.flag="ok";
  65382. x=[$recv(x).__plus((1))
  65383. ,$ctx2.sendIdx["+"]=1
  65384. ][0];
  65385. return [$self._assert_equals_(x,(1))
  65386. ,$ctx2.sendIdx["assert:equals:"]=1
  65387. ][0];
  65388. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  65389. }))
  65390. ,$ctx1.sendIdx["async:"]=1
  65391. ][0])._valueWithTimeout_((0))
  65392. ,$ctx1.sendIdx["valueWithTimeout:"]=1
  65393. ][0];
  65394. $self.flag=$recv($self._async_((function(){
  65395. return $core.withContext(function($ctx2) {
  65396. $self._finished();
  65397. $self.flag="ok";
  65398. x=$recv(x).__plus((1));
  65399. return $self._assert_equals_(x,(1));
  65400. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  65401. })))._valueWithTimeout_((0));
  65402. return self;
  65403. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x})});
  65404. }; }),
  65405. $globals.SUnitAsyncTest);
  65406. });
  65407. define('amber/devel',[
  65408. './lang',
  65409. './brikz', // pre-fetch, dep of ./boot
  65410. './kernel-checks', // pre-fetch, dep of ./boot
  65411. './kernel-fundamentals', // pre-fetch, dep of ./boot
  65412. './kernel-language', // pre-fetch, dep of ./boot
  65413. './boot', // pre-fetch, class loader
  65414. './deploy', // pre-fetch, dep of ./lang
  65415. // --- packages of the development only Amber begin here ---
  65416. 'amber/core/Platform-DOM',
  65417. 'amber/core/SUnit',
  65418. 'amber/core/Compiler-Tests',
  65419. 'amber/core/Kernel-Tests',
  65420. 'amber/core/Platform-DOM-Tests',
  65421. 'amber/core/SUnit-Tests'
  65422. // --- packages of the development only Amber end here ---
  65423. ], function (amber) {
  65424. return amber;
  65425. });
  65426. define('amber/core/Platform-Node',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  65427. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  65428. var $pkg = $core.addPackage("Platform-Node");
  65429. $pkg.innerEval = function (expr) { return eval(expr); };
  65430. $pkg.imports = ["amber/core/Platform-Services"];
  65431. $pkg.isReady = new Promise(function (resolve, reject) { requirejs(["amber/core/Platform-Services"], function () {resolve();}, reject); });
  65432. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  65433. $core.addClass("NodePlatform", $globals.Object, [], "Platform-Node");
  65434. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  65435. $core.addMethod(
  65436. $core.method({
  65437. selector: "fetch:",
  65438. protocol: "public API",
  65439. args: ["aStringOrObject"],
  65440. source: "fetch: aStringOrObject\x0a\x09^ self globals at: #fetch\x0a\x09\x09ifPresent: [ :fetch | fetch value: aStringOrObject ]\x0a\x09\x09ifAbsent: [ Promise signal: 'fetch not available.' ]",
  65441. referencedClasses: ["Promise"],
  65442. pragmas: [],
  65443. messageSends: ["at:ifPresent:ifAbsent:", "globals", "value:", "signal:"]
  65444. }, function ($methodClass){ return function (aStringOrObject){
  65445. var self=this,$self=this;
  65446. return $core.withContext(function($ctx1) {
  65447. return $recv($self._globals())._at_ifPresent_ifAbsent_("fetch",(function(fetch){
  65448. return $core.withContext(function($ctx2) {
  65449. return $recv(fetch)._value_(aStringOrObject);
  65450. }, function($ctx2) {$ctx2.fillBlock({fetch:fetch},$ctx1,1)});
  65451. }),(function(){
  65452. return $core.withContext(function($ctx2) {
  65453. return $recv($globals.Promise)._signal_("fetch not available.");
  65454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  65455. }));
  65456. }, function($ctx1) {$ctx1.fill(self,"fetch:",{aStringOrObject:aStringOrObject})});
  65457. }; }),
  65458. $globals.NodePlatform);
  65459. $core.addMethod(
  65460. $core.method({
  65461. selector: "fetchUrl:options:",
  65462. protocol: "public API",
  65463. args: ["aString", "anObject"],
  65464. source: "fetchUrl: aString options: anObject\x0a\x09^ self globals at: #fetch\x0a\x09\x09ifPresent: [ :fetch | fetch value: aString value: anObject ]\x0a\x09\x09ifAbsent: [ Promise signal: 'fetch not available.' ]",
  65465. referencedClasses: ["Promise"],
  65466. pragmas: [],
  65467. messageSends: ["at:ifPresent:ifAbsent:", "globals", "value:value:", "signal:"]
  65468. }, function ($methodClass){ return function (aString,anObject){
  65469. var self=this,$self=this;
  65470. return $core.withContext(function($ctx1) {
  65471. return $recv($self._globals())._at_ifPresent_ifAbsent_("fetch",(function(fetch){
  65472. return $core.withContext(function($ctx2) {
  65473. return $recv(fetch)._value_value_(aString,anObject);
  65474. }, function($ctx2) {$ctx2.fillBlock({fetch:fetch},$ctx1,1)});
  65475. }),(function(){
  65476. return $core.withContext(function($ctx2) {
  65477. return $recv($globals.Promise)._signal_("fetch not available.");
  65478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  65479. }));
  65480. }, function($ctx1) {$ctx1.fill(self,"fetchUrl:options:",{aString:aString,anObject:anObject})});
  65481. }; }),
  65482. $globals.NodePlatform);
  65483. $core.addMethod(
  65484. $core.method({
  65485. selector: "globals",
  65486. protocol: "accessing",
  65487. args: [],
  65488. source: "globals\x0a\x09^ global",
  65489. referencedClasses: [],
  65490. pragmas: [],
  65491. messageSends: []
  65492. }, function ($methodClass){ return function (){
  65493. var self=this,$self=this;
  65494. return global;
  65495. }; }),
  65496. $globals.NodePlatform);
  65497. $core.addMethod(
  65498. $core.method({
  65499. selector: "newXhr",
  65500. protocol: "public API",
  65501. args: [],
  65502. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  65503. referencedClasses: ["XMLHttpRequest"],
  65504. pragmas: [],
  65505. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  65506. }, function ($methodClass){ return function (){
  65507. var self=this,$self=this;
  65508. return $core.withContext(function($ctx1) {
  65509. var $1;
  65510. $1=$globals.XMLHttpRequest;
  65511. if($1 == null || $1.a$nil){
  65512. $self._error_("XMLHttpRequest not available.");
  65513. } else {
  65514. return $recv($globals.XMLHttpRequest)._new();
  65515. }
  65516. return self;
  65517. }, function($ctx1) {$ctx1.fill(self,"newXhr",{})});
  65518. }; }),
  65519. $globals.NodePlatform);
  65520. $core.addMethod(
  65521. $core.method({
  65522. selector: "initialize",
  65523. protocol: "testing",
  65524. args: [],
  65525. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  65526. referencedClasses: ["Platform"],
  65527. pragmas: [],
  65528. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  65529. }, function ($methodClass){ return function (){
  65530. var self=this,$self=this;
  65531. return $core.withContext(function($ctx1) {
  65532. if($core.assert($self._isFeasible())){
  65533. $recv($globals.Platform)._registerIfNone_($self._new());
  65534. }
  65535. return self;
  65536. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  65537. }; }),
  65538. $globals.NodePlatform.a$cls);
  65539. $core.addMethod(
  65540. $core.method({
  65541. selector: "isFeasible",
  65542. protocol: "testing",
  65543. args: [],
  65544. source: "isFeasible\x0a<inlineJS: 'return typeof process !== \x22undefined\x22 && process && process.versions && process.versions.node != null'>",
  65545. referencedClasses: [],
  65546. pragmas: [["inlineJS:", ["return typeof process !== \x22undefined\x22 && process && process.versions && process.versions.node != null"]]],
  65547. messageSends: []
  65548. }, function ($methodClass){ return function (){
  65549. var self=this,$self=this;
  65550. return $core.withContext(function($ctx1) {
  65551. return typeof process !== "undefined" && process && process.versions && process.versions.node != null;
  65552. return self;
  65553. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{})});
  65554. }; }),
  65555. $globals.NodePlatform.a$cls);
  65556. });
  65557. define('amber_cli/AmberCli',["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  65558. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  65559. var $pkg = $core.addPackage("AmberCli");
  65560. $pkg.innerEval = function (expr) { return eval(expr); };
  65561. $pkg.transport = {"type":"amd","amdNamespace":"amber_cli"};
  65562. $core.addClass("AmberCli", $globals.Object, [], "AmberCli");
  65563. $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.";
  65564. $core.addMethod(
  65565. $core.method({
  65566. selector: "commandLineSwitches",
  65567. protocol: "commandline",
  65568. args: [],
  65569. 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",
  65570. referencedClasses: [],
  65571. pragmas: [],
  65572. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  65573. }, function ($methodClass){ return function (){
  65574. var self=this,$self=this;
  65575. var switches;
  65576. return $core.withContext(function($ctx1) {
  65577. switches=[$recv($recv($self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  65578. return $core.withContext(function($ctx2) {
  65579. return $recv(each)._selector();
  65580. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  65581. }))
  65582. ,$ctx1.sendIdx["collect:"]=1
  65583. ][0];
  65584. switches=$recv(switches)._select_((function(each){
  65585. return $core.withContext(function($ctx2) {
  65586. return $recv(each)._match_("^[^:]*:$");
  65587. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  65588. }));
  65589. switches=$recv(switches)._collect_((function(each){
  65590. return $core.withContext(function($ctx2) {
  65591. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  65592. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  65593. }));
  65594. return switches;
  65595. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches})});
  65596. }; }),
  65597. $globals.AmberCli.a$cls);
  65598. $core.addMethod(
  65599. $core.method({
  65600. selector: "config:",
  65601. protocol: "commands",
  65602. args: ["args"],
  65603. source: "config: args\x0a\x09Configurator new start",
  65604. referencedClasses: ["Configurator"],
  65605. pragmas: [],
  65606. messageSends: ["start", "new"]
  65607. }, function ($methodClass){ return function (args){
  65608. var self=this,$self=this;
  65609. return $core.withContext(function($ctx1) {
  65610. $recv($recv($globals.Configurator)._new())._start();
  65611. return self;
  65612. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args})});
  65613. }; }),
  65614. $globals.AmberCli.a$cls);
  65615. $core.addMethod(
  65616. $core.method({
  65617. selector: "handleArguments:",
  65618. protocol: "commandline",
  65619. args: ["args"],
  65620. source: "handleArguments: args\x0a\x09| selector |\x0a\x0a\x09selector := self selectorForCommandLineSwitch: (args first).\x0a\x09args remove: args first.\x0a\x09self perform: selector withArguments: { args }",
  65621. referencedClasses: [],
  65622. pragmas: [],
  65623. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:"]
  65624. }, function ($methodClass){ return function (args){
  65625. var self=this,$self=this;
  65626. var selector;
  65627. return $core.withContext(function($ctx1) {
  65628. selector=$self._selectorForCommandLineSwitch_([$recv(args)._first()
  65629. ,$ctx1.sendIdx["first"]=1
  65630. ][0]);
  65631. $recv(args)._remove_($recv(args)._first());
  65632. $self._perform_withArguments_(selector,[args]);
  65633. return self;
  65634. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector})});
  65635. }; }),
  65636. $globals.AmberCli.a$cls);
  65637. $core.addMethod(
  65638. $core.method({
  65639. selector: "help:",
  65640. protocol: "commands",
  65641. args: ["args"],
  65642. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  65643. referencedClasses: ["Transcript"],
  65644. pragmas: [],
  65645. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  65646. }, function ($methodClass){ return function (args){
  65647. var self=this,$self=this;
  65648. return $core.withContext(function($ctx1) {
  65649. $recv($globals.Transcript)._show_("Available commands");
  65650. $recv($self._commandLineSwitches())._do_((function(each){
  65651. return $core.withContext(function($ctx2) {
  65652. return $recv(console)._log_(each);
  65653. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  65654. }));
  65655. return self;
  65656. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args})});
  65657. }; }),
  65658. $globals.AmberCli.a$cls);
  65659. $core.addMethod(
  65660. $core.method({
  65661. selector: "init:",
  65662. protocol: "commands",
  65663. args: ["args"],
  65664. source: "init: args\x0a\x09Initer new start",
  65665. referencedClasses: ["Initer"],
  65666. pragmas: [],
  65667. messageSends: ["start", "new"]
  65668. }, function ($methodClass){ return function (args){
  65669. var self=this,$self=this;
  65670. return $core.withContext(function($ctx1) {
  65671. $recv($recv($globals.Initer)._new())._start();
  65672. return self;
  65673. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args})});
  65674. }; }),
  65675. $globals.AmberCli.a$cls);
  65676. $core.addMethod(
  65677. $core.method({
  65678. selector: "main",
  65679. protocol: "startup",
  65680. args: [],
  65681. 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]",
  65682. referencedClasses: ["Transcript", "Smalltalk"],
  65683. pragmas: [],
  65684. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  65685. }, function ($methodClass){ return function (){
  65686. var self=this,$self=this;
  65687. var args,packageJSON;
  65688. return $core.withContext(function($ctx1) {
  65689. var $early={};
  65690. try {
  65691. packageJSON=$recv(require)._value_("../package.json");
  65692. $recv($globals.Transcript)._show_([$recv([$recv([$recv([$recv([$recv("Welcome to Amber CLI version ".__comma([$recv(packageJSON)._version()
  65693. ,$ctx1.sendIdx["version"]=1
  65694. ][0])).__comma(" (Amber ")
  65695. ,$ctx1.sendIdx[","]=5
  65696. ][0]).__comma($recv($globals.Smalltalk)._version())
  65697. ,$ctx1.sendIdx[","]=4
  65698. ][0]).__comma(", NodeJS ")
  65699. ,$ctx1.sendIdx[","]=3
  65700. ][0]).__comma($recv($recv(process)._versions())._node())
  65701. ,$ctx1.sendIdx[","]=2
  65702. ][0]).__comma(").")
  65703. ,$ctx1.sendIdx[","]=1
  65704. ][0]);
  65705. args=$recv(process)._argv();
  65706. $recv(args)._removeFrom_to_((1),(2));
  65707. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  65708. return $core.withContext(function($ctx2) {
  65709. return $self._help_(nil);
  65710. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  65711. }),(function(){
  65712. return $core.withContext(function($ctx2) {
  65713. throw $early=[$self._handleArguments_(args)];
  65714. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  65715. }));
  65716. return self;
  65717. }
  65718. catch(e) {if(e===$early)return e[0]; throw e}
  65719. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON})});
  65720. }; }),
  65721. $globals.AmberCli.a$cls);
  65722. $core.addMethod(
  65723. $core.method({
  65724. selector: "repl:",
  65725. protocol: "commands",
  65726. args: ["args"],
  65727. source: "repl: args\x0a\x09^ Repl new createInterface",
  65728. referencedClasses: ["Repl"],
  65729. pragmas: [],
  65730. messageSends: ["createInterface", "new"]
  65731. }, function ($methodClass){ return function (args){
  65732. var self=this,$self=this;
  65733. return $core.withContext(function($ctx1) {
  65734. return $recv($recv($globals.Repl)._new())._createInterface();
  65735. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args})});
  65736. }; }),
  65737. $globals.AmberCli.a$cls);
  65738. $core.addMethod(
  65739. $core.method({
  65740. selector: "selectorForCommandLineSwitch:",
  65741. protocol: "commandline",
  65742. args: ["aSwitch"],
  65743. 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",
  65744. referencedClasses: [],
  65745. pragmas: [],
  65746. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  65747. }, function ($methodClass){ return function (aSwitch){
  65748. var self=this,$self=this;
  65749. var command,selector;
  65750. return $core.withContext(function($ctx1) {
  65751. if($core.assert($recv($self._commandLineSwitches())._includes_(aSwitch))){
  65752. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  65753. return $core.withContext(function($ctx2) {
  65754. return $recv($recv(each)._second())._asUppercase();
  65755. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  65756. }))).__comma(":");
  65757. selector;
  65758. } else {
  65759. selector="help:";
  65760. selector;
  65761. }
  65762. return selector;
  65763. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector})});
  65764. }; }),
  65765. $globals.AmberCli.a$cls);
  65766. $core.addMethod(
  65767. $core.method({
  65768. selector: "serve:",
  65769. protocol: "commands",
  65770. args: ["args"],
  65771. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  65772. referencedClasses: ["FileServer"],
  65773. pragmas: [],
  65774. messageSends: ["start", "createServerWithArguments:"]
  65775. }, function ($methodClass){ return function (args){
  65776. var self=this,$self=this;
  65777. return $core.withContext(function($ctx1) {
  65778. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  65779. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args})});
  65780. }; }),
  65781. $globals.AmberCli.a$cls);
  65782. $core.addMethod(
  65783. $core.method({
  65784. selector: "version:",
  65785. protocol: "commands",
  65786. args: ["arguments"],
  65787. source: "version: arguments",
  65788. referencedClasses: [],
  65789. pragmas: [],
  65790. messageSends: []
  65791. }, function ($methodClass){ return function (arguments_){
  65792. var self=this,$self=this;
  65793. return self;
  65794. }; }),
  65795. $globals.AmberCli.a$cls);
  65796. $core.addClass("BaseFileManipulator", $globals.Object, ["path", "fs"], "AmberCli");
  65797. $core.addMethod(
  65798. $core.method({
  65799. selector: "dirname",
  65800. protocol: "private",
  65801. args: [],
  65802. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  65803. referencedClasses: [],
  65804. pragmas: [["inlineJS:", ["return __dirname"]]],
  65805. messageSends: []
  65806. }, function ($methodClass){ return function (){
  65807. var self=this,$self=this;
  65808. return $core.withContext(function($ctx1) {
  65809. return __dirname;
  65810. return self;
  65811. }, function($ctx1) {$ctx1.fill(self,"dirname",{})});
  65812. }; }),
  65813. $globals.BaseFileManipulator);
  65814. $core.addMethod(
  65815. $core.method({
  65816. selector: "initialize",
  65817. protocol: "initialization",
  65818. args: [],
  65819. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  65820. referencedClasses: [],
  65821. pragmas: [],
  65822. messageSends: ["initialize", "value:"]
  65823. }, function ($methodClass){ return function (){
  65824. var self=this,$self=this;
  65825. return $core.withContext(function($ctx1) {
  65826. [(
  65827. $ctx1.supercall = true,
  65828. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  65829. ,$ctx1.supercall = false
  65830. ][0];
  65831. $self.path=[$recv(require)._value_("path")
  65832. ,$ctx1.sendIdx["value:"]=1
  65833. ][0];
  65834. $self.fs=$recv(require)._value_("fs");
  65835. return self;
  65836. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  65837. }; }),
  65838. $globals.BaseFileManipulator);
  65839. $core.addMethod(
  65840. $core.method({
  65841. selector: "rootDirname",
  65842. protocol: "private",
  65843. args: [],
  65844. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  65845. referencedClasses: [],
  65846. pragmas: [],
  65847. messageSends: ["join:with:", "dirname"]
  65848. }, function ($methodClass){ return function (){
  65849. var self=this,$self=this;
  65850. return $core.withContext(function($ctx1) {
  65851. return $recv($self.path)._join_with_($self._dirname(),"..");
  65852. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{})});
  65853. }; }),
  65854. $globals.BaseFileManipulator);
  65855. $core.addClass("Configurator", $globals.BaseFileManipulator, [], "AmberCli");
  65856. $core.addMethod(
  65857. $core.method({
  65858. selector: "initialize",
  65859. protocol: "initialization",
  65860. args: [],
  65861. source: "initialize\x0a\x09super initialize",
  65862. referencedClasses: [],
  65863. pragmas: [],
  65864. messageSends: ["initialize"]
  65865. }, function ($methodClass){ return function (){
  65866. var self=this,$self=this;
  65867. return $core.withContext(function($ctx1) {
  65868. [(
  65869. $ctx1.supercall = true,
  65870. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  65871. ,$ctx1.supercall = false
  65872. ][0];
  65873. return self;
  65874. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  65875. }; }),
  65876. $globals.Configurator);
  65877. $core.addMethod(
  65878. $core.method({
  65879. selector: "start",
  65880. protocol: "action",
  65881. args: [],
  65882. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  65883. referencedClasses: [],
  65884. pragmas: [],
  65885. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  65886. }, function ($methodClass){ return function (){
  65887. var self=this,$self=this;
  65888. return $core.withContext(function($ctx1) {
  65889. $self._writeConfigThenDo_((function(err){
  65890. return $core.withContext(function($ctx2) {
  65891. if(err == null || err.a$nil){
  65892. return $recv(process)._exit();
  65893. } else {
  65894. return $recv(process)._exit_((111));
  65895. }
  65896. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  65897. }));
  65898. return self;
  65899. }, function($ctx1) {$ctx1.fill(self,"start",{})});
  65900. }; }),
  65901. $globals.Configurator);
  65902. $core.addMethod(
  65903. $core.method({
  65904. selector: "writeConfigThenDo:",
  65905. protocol: "action",
  65906. args: ["aBlock"],
  65907. source: "writeConfigThenDo: aBlock\x0a\x09(require value: '@ambers/sdk') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  65908. referencedClasses: [],
  65909. pragmas: [],
  65910. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  65911. }, function ($methodClass){ return function (aBlock){
  65912. var self=this,$self=this;
  65913. return $core.withContext(function($ctx1) {
  65914. $recv($recv($recv(require)._value_("@ambers/sdk"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  65915. return self;
  65916. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock})});
  65917. }; }),
  65918. $globals.Configurator);
  65919. $core.addClass("FileServer", $globals.BaseFileManipulator, ["http", "url", "host", "port", "basePath", "util", "username", "password", "fallbackPage"], "AmberCli");
  65920. $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.";
  65921. $core.addMethod(
  65922. $core.method({
  65923. selector: "base64Decode:",
  65924. protocol: "private",
  65925. args: ["aString"],
  65926. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  65927. referencedClasses: [],
  65928. pragmas: [["inlineJS:", ["return (new Buffer(aString, \x22base64\x22).toString())"]]],
  65929. messageSends: []
  65930. }, function ($methodClass){ return function (aString){
  65931. var self=this,$self=this;
  65932. return $core.withContext(function($ctx1) {
  65933. return (new Buffer(aString, "base64").toString());
  65934. return self;
  65935. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString})});
  65936. }; }),
  65937. $globals.FileServer);
  65938. $core.addMethod(
  65939. $core.method({
  65940. selector: "basePath",
  65941. protocol: "accessing",
  65942. args: [],
  65943. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  65944. referencedClasses: [],
  65945. pragmas: [],
  65946. messageSends: ["ifNil:", "defaultBasePath", "class"]
  65947. }, function ($methodClass){ return function (){
  65948. var self=this,$self=this;
  65949. return $core.withContext(function($ctx1) {
  65950. var $1;
  65951. $1=$self.basePath;
  65952. if($1 == null || $1.a$nil){
  65953. return $recv($self._class())._defaultBasePath();
  65954. } else {
  65955. return $1;
  65956. }
  65957. }, function($ctx1) {$ctx1.fill(self,"basePath",{})});
  65958. }; }),
  65959. $globals.FileServer);
  65960. $core.addMethod(
  65961. $core.method({
  65962. selector: "basePath:",
  65963. protocol: "accessing",
  65964. args: ["aString"],
  65965. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  65966. referencedClasses: [],
  65967. pragmas: [],
  65968. messageSends: ["validateBasePath"]
  65969. }, function ($methodClass){ return function (aString){
  65970. var self=this,$self=this;
  65971. return $core.withContext(function($ctx1) {
  65972. $self.basePath=aString;
  65973. $self._validateBasePath();
  65974. return self;
  65975. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString})});
  65976. }; }),
  65977. $globals.FileServer);
  65978. $core.addMethod(
  65979. $core.method({
  65980. selector: "checkDirectoryLayout",
  65981. protocol: "initialization",
  65982. args: [],
  65983. 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.'].",
  65984. referencedClasses: [],
  65985. pragmas: [],
  65986. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  65987. }, function ($methodClass){ return function (){
  65988. var self=this,$self=this;
  65989. return $core.withContext(function($ctx1) {
  65990. if(!$core.assert($recv($self.fs)._existsSync_($self._withBasePath_("index.html")))){
  65991. [$recv(console)._warn_("Warning: project directory does not contain index.html.")
  65992. ,$ctx1.sendIdx["warn:"]=1
  65993. ][0];
  65994. [$recv(console)._warn_(" You can specify the directory containing index.html with --base-path.")
  65995. ,$ctx1.sendIdx["warn:"]=2
  65996. ][0];
  65997. [$recv(console)._warn_(" You can also specify a page to be served by default,")
  65998. ,$ctx1.sendIdx["warn:"]=3
  65999. ][0];
  66000. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  66001. }
  66002. return self;
  66003. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{})});
  66004. }; }),
  66005. $globals.FileServer);
  66006. $core.addMethod(
  66007. $core.method({
  66008. selector: "fallbackPage",
  66009. protocol: "accessing",
  66010. args: [],
  66011. source: "fallbackPage\x0a\x09^ fallbackPage",
  66012. referencedClasses: [],
  66013. pragmas: [],
  66014. messageSends: []
  66015. }, function ($methodClass){ return function (){
  66016. var self=this,$self=this;
  66017. return $self.fallbackPage;
  66018. }; }),
  66019. $globals.FileServer);
  66020. $core.addMethod(
  66021. $core.method({
  66022. selector: "fallbackPage:",
  66023. protocol: "accessing",
  66024. args: ["aString"],
  66025. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  66026. referencedClasses: [],
  66027. pragmas: [],
  66028. messageSends: []
  66029. }, function ($methodClass){ return function (aString){
  66030. var self=this,$self=this;
  66031. $self.fallbackPage=aString;
  66032. return self;
  66033. }; }),
  66034. $globals.FileServer);
  66035. $core.addMethod(
  66036. $core.method({
  66037. selector: "handleGETRequest:respondTo:",
  66038. protocol: "request handling",
  66039. args: ["aRequest", "aResponse"],
  66040. 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]]]",
  66041. referencedClasses: [],
  66042. pragmas: [],
  66043. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  66044. }, function ($methodClass){ return function (aRequest,aResponse){
  66045. var self=this,$self=this;
  66046. var uri,filename;
  66047. return $core.withContext(function($ctx1) {
  66048. uri=$recv($self.url)._parse_($recv(aRequest)._url());
  66049. filename=$recv($self.path)._join_with_($self._basePath(),$recv(uri)._pathname());
  66050. $recv($self.fs)._exists_do_(filename,(function(aBoolean){
  66051. return $core.withContext(function($ctx2) {
  66052. if($core.assert(aBoolean)){
  66053. if($core.assert($recv($recv($self.fs)._statSync_(filename))._isDirectory())){
  66054. return $self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  66055. } else {
  66056. return $self._respondFileNamed_to_(filename,aResponse);
  66057. }
  66058. } else {
  66059. return $self._respondNotFoundTo_(aResponse);
  66060. }
  66061. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  66062. }));
  66063. return self;
  66064. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename})});
  66065. }; }),
  66066. $globals.FileServer);
  66067. $core.addMethod(
  66068. $core.method({
  66069. selector: "handleOPTIONSRequest:respondTo:",
  66070. protocol: "request handling",
  66071. args: ["aRequest", "aResponse"],
  66072. 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",
  66073. referencedClasses: [],
  66074. pragmas: [],
  66075. messageSends: ["writeHead:options:", "end"]
  66076. }, function ($methodClass){ return function (aRequest,aResponse){
  66077. var self=this,$self=this;
  66078. return $core.withContext(function($ctx1) {
  66079. $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)]));
  66080. $recv(aResponse)._end();
  66081. return self;
  66082. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse})});
  66083. }; }),
  66084. $globals.FileServer);
  66085. $core.addMethod(
  66086. $core.method({
  66087. selector: "handlePUTRequest:respondTo:",
  66088. protocol: "request handling",
  66089. args: ["aRequest", "aResponse"],
  66090. 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]]",
  66091. referencedClasses: [],
  66092. pragmas: [],
  66093. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  66094. }, function ($methodClass){ return function (aRequest,aResponse){
  66095. var self=this,$self=this;
  66096. var file,stream;
  66097. return $core.withContext(function($ctx1) {
  66098. if(!$core.assert($self._isAuthenticated_(aRequest))){
  66099. $self._respondAuthenticationRequiredTo_(aResponse);
  66100. return nil;
  66101. }
  66102. file=[".".__comma($recv(aRequest)._url())
  66103. ,$ctx1.sendIdx[","]=1
  66104. ][0];
  66105. stream=$recv($self.fs)._createWriteStream_(file);
  66106. [$recv(stream)._on_do_("error",(function(error){
  66107. return $core.withContext(function($ctx2) {
  66108. [$recv(console)._warn_(["Error creating WriteStream for file ".__comma(file)
  66109. ,$ctx2.sendIdx[","]=2
  66110. ][0])
  66111. ,$ctx2.sendIdx["warn:"]=1
  66112. ][0];
  66113. [$recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?")
  66114. ,$ctx2.sendIdx["warn:"]=2
  66115. ][0];
  66116. $recv(console)._warn_(" The exact error is: ".__comma(error));
  66117. return $self._respondNotCreatedTo_(aResponse);
  66118. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  66119. }))
  66120. ,$ctx1.sendIdx["on:do:"]=1
  66121. ][0];
  66122. [$recv(stream)._on_do_("close",(function(){
  66123. return $core.withContext(function($ctx2) {
  66124. return $self._respondCreatedTo_(aResponse);
  66125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  66126. }))
  66127. ,$ctx1.sendIdx["on:do:"]=2
  66128. ][0];
  66129. $recv(aRequest)._setEncoding_("utf8");
  66130. [$recv(aRequest)._on_do_("data",(function(data){
  66131. return $core.withContext(function($ctx2) {
  66132. return $recv(stream)._write_(data);
  66133. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  66134. }))
  66135. ,$ctx1.sendIdx["on:do:"]=3
  66136. ][0];
  66137. $recv(aRequest)._on_do_("end",(function(){
  66138. return $core.withContext(function($ctx2) {
  66139. if($core.assert($recv(stream)._writable())){
  66140. return $recv(stream)._end();
  66141. }
  66142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  66143. }));
  66144. return self;
  66145. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream})});
  66146. }; }),
  66147. $globals.FileServer);
  66148. $core.addMethod(
  66149. $core.method({
  66150. selector: "handleRequest:respondTo:",
  66151. protocol: "request handling",
  66152. args: ["aRequest", "aResponse"],
  66153. 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]",
  66154. referencedClasses: [],
  66155. pragmas: [],
  66156. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  66157. }, function ($methodClass){ return function (aRequest,aResponse){
  66158. var self=this,$self=this;
  66159. return $core.withContext(function($ctx1) {
  66160. if($core.assert([$recv([$recv(aRequest)._method()
  66161. ,$ctx1.sendIdx["method"]=1
  66162. ][0]).__eq("PUT")
  66163. ,$ctx1.sendIdx["="]=1
  66164. ][0])){
  66165. $self._handlePUTRequest_respondTo_(aRequest,aResponse);
  66166. }
  66167. if($core.assert([$recv([$recv(aRequest)._method()
  66168. ,$ctx1.sendIdx["method"]=2
  66169. ][0]).__eq("GET")
  66170. ,$ctx1.sendIdx["="]=2
  66171. ][0])){
  66172. $self._handleGETRequest_respondTo_(aRequest,aResponse);
  66173. }
  66174. if($core.assert($recv($recv(aRequest)._method()).__eq("OPTIONS"))){
  66175. $self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  66176. }
  66177. return self;
  66178. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse})});
  66179. }; }),
  66180. $globals.FileServer);
  66181. $core.addMethod(
  66182. $core.method({
  66183. selector: "host",
  66184. protocol: "accessing",
  66185. args: [],
  66186. source: "host\x0a\x09^ host",
  66187. referencedClasses: [],
  66188. pragmas: [],
  66189. messageSends: []
  66190. }, function ($methodClass){ return function (){
  66191. var self=this,$self=this;
  66192. return $self.host;
  66193. }; }),
  66194. $globals.FileServer);
  66195. $core.addMethod(
  66196. $core.method({
  66197. selector: "host:",
  66198. protocol: "accessing",
  66199. args: ["hostname"],
  66200. source: "host: hostname\x0a\x09host := hostname",
  66201. referencedClasses: [],
  66202. pragmas: [],
  66203. messageSends: []
  66204. }, function ($methodClass){ return function (hostname){
  66205. var self=this,$self=this;
  66206. $self.host=hostname;
  66207. return self;
  66208. }; }),
  66209. $globals.FileServer);
  66210. $core.addMethod(
  66211. $core.method({
  66212. selector: "initialize",
  66213. protocol: "initialization",
  66214. args: [],
  66215. 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.",
  66216. referencedClasses: [],
  66217. pragmas: [],
  66218. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  66219. }, function ($methodClass){ return function (){
  66220. var self=this,$self=this;
  66221. return $core.withContext(function($ctx1) {
  66222. [(
  66223. $ctx1.supercall = true,
  66224. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  66225. ,$ctx1.supercall = false
  66226. ][0];
  66227. $self.http=[$self._require_("http")
  66228. ,$ctx1.sendIdx["require:"]=1
  66229. ][0];
  66230. $self.util=[$self._require_("util")
  66231. ,$ctx1.sendIdx["require:"]=2
  66232. ][0];
  66233. $self.url=$self._require_("url");
  66234. $self.host=$recv([$self._class()
  66235. ,$ctx1.sendIdx["class"]=1
  66236. ][0])._defaultHost();
  66237. $self.port=$recv($self._class())._defaultPort();
  66238. $self.username=nil;
  66239. $self.password=nil;
  66240. $self.fallbackPage=nil;
  66241. return self;
  66242. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  66243. }; }),
  66244. $globals.FileServer);
  66245. $core.addMethod(
  66246. $core.method({
  66247. selector: "isAuthenticated:",
  66248. protocol: "private",
  66249. args: ["aRequest"],
  66250. 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].",
  66251. referencedClasses: [],
  66252. pragmas: [],
  66253. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  66254. }, function ($methodClass){ return function (aRequest){
  66255. var self=this,$self=this;
  66256. var header,token,auth,parts;
  66257. return $core.withContext(function($ctx1) {
  66258. var $1,$2;
  66259. var $early={};
  66260. try {
  66261. if($core.assert([$recv([$recv($self.username)._isNil()
  66262. ,$ctx1.sendIdx["isNil"]=1
  66263. ][0])._and_((function(){
  66264. return $core.withContext(function($ctx2) {
  66265. return $recv($self.password)._isNil();
  66266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  66267. }))
  66268. ,$ctx1.sendIdx["and:"]=1
  66269. ][0])){
  66270. return true;
  66271. }
  66272. $1=[$recv($recv(aRequest)._headers())._at_("authorization")
  66273. ,$ctx1.sendIdx["at:"]=1
  66274. ][0];
  66275. if($1 == null || $1.a$nil){
  66276. header="";
  66277. } else {
  66278. header=$1;
  66279. }
  66280. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  66281. throw $early=[false];
  66282. }),(function(){
  66283. return $core.withContext(function($ctx2) {
  66284. $2=[$recv(header)._tokenize_(" ")
  66285. ,$ctx2.sendIdx["tokenize:"]=1
  66286. ][0];
  66287. if($2 == null || $2.a$nil){
  66288. token="";
  66289. } else {
  66290. token=$2;
  66291. }
  66292. auth=$self._base64Decode_([$recv(token)._at_((2))
  66293. ,$ctx2.sendIdx["at:"]=2
  66294. ][0]);
  66295. parts=$recv(auth)._tokenize_(":");
  66296. if($core.assert($recv([$recv($self.username).__eq([$recv(parts)._at_((1))
  66297. ,$ctx2.sendIdx["at:"]=3
  66298. ][0])
  66299. ,$ctx2.sendIdx["="]=1
  66300. ][0])._and_((function(){
  66301. return $core.withContext(function($ctx3) {
  66302. return $recv($self.password).__eq($recv(parts)._at_((2)));
  66303. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  66304. })))){
  66305. throw $early=[true];
  66306. } else {
  66307. throw $early=[false];
  66308. }
  66309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  66310. }));
  66311. return self;
  66312. }
  66313. catch(e) {if(e===$early)return e[0]; throw e}
  66314. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts})});
  66315. }; }),
  66316. $globals.FileServer);
  66317. $core.addMethod(
  66318. $core.method({
  66319. selector: "password:",
  66320. protocol: "accessing",
  66321. args: ["aPassword"],
  66322. source: "password: aPassword\x0a\x09password := aPassword.",
  66323. referencedClasses: [],
  66324. pragmas: [],
  66325. messageSends: []
  66326. }, function ($methodClass){ return function (aPassword){
  66327. var self=this,$self=this;
  66328. $self.password=aPassword;
  66329. return self;
  66330. }; }),
  66331. $globals.FileServer);
  66332. $core.addMethod(
  66333. $core.method({
  66334. selector: "port",
  66335. protocol: "accessing",
  66336. args: [],
  66337. source: "port\x0a\x09^ port",
  66338. referencedClasses: [],
  66339. pragmas: [],
  66340. messageSends: []
  66341. }, function ($methodClass){ return function (){
  66342. var self=this,$self=this;
  66343. return $self.port;
  66344. }; }),
  66345. $globals.FileServer);
  66346. $core.addMethod(
  66347. $core.method({
  66348. selector: "port:",
  66349. protocol: "accessing",
  66350. args: ["aNumber"],
  66351. source: "port: aNumber\x0a\x09port := aNumber",
  66352. referencedClasses: [],
  66353. pragmas: [],
  66354. messageSends: []
  66355. }, function ($methodClass){ return function (aNumber){
  66356. var self=this,$self=this;
  66357. $self.port=aNumber;
  66358. return self;
  66359. }; }),
  66360. $globals.FileServer);
  66361. $core.addMethod(
  66362. $core.method({
  66363. selector: "require:",
  66364. protocol: "private",
  66365. args: ["aModuleString"],
  66366. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  66367. referencedClasses: [],
  66368. pragmas: [],
  66369. messageSends: ["value:"]
  66370. }, function ($methodClass){ return function (aModuleString){
  66371. var self=this,$self=this;
  66372. return $core.withContext(function($ctx1) {
  66373. return $recv(require)._value_(aModuleString);
  66374. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString})});
  66375. }; }),
  66376. $globals.FileServer);
  66377. $core.addMethod(
  66378. $core.method({
  66379. selector: "respondAuthenticationRequiredTo:",
  66380. protocol: "request handling",
  66381. args: ["aResponse"],
  66382. 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.",
  66383. referencedClasses: [],
  66384. pragmas: [],
  66385. messageSends: ["writeHead:options:", "write:", "end"]
  66386. }, function ($methodClass){ return function (aResponse){
  66387. var self=this,$self=this;
  66388. return $core.withContext(function($ctx1) {
  66389. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  66390. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  66391. $recv(aResponse)._end();
  66392. return self;
  66393. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse})});
  66394. }; }),
  66395. $globals.FileServer);
  66396. $core.addMethod(
  66397. $core.method({
  66398. selector: "respondCreatedTo:",
  66399. protocol: "request handling",
  66400. args: ["aResponse"],
  66401. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  66402. referencedClasses: [],
  66403. pragmas: [],
  66404. messageSends: ["writeHead:options:", "end"]
  66405. }, function ($methodClass){ return function (aResponse){
  66406. var self=this,$self=this;
  66407. return $core.withContext(function($ctx1) {
  66408. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  66409. $recv(aResponse)._end();
  66410. return self;
  66411. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse})});
  66412. }; }),
  66413. $globals.FileServer);
  66414. $core.addMethod(
  66415. $core.method({
  66416. selector: "respondDirectoryNamed:from:to:",
  66417. protocol: "request handling",
  66418. args: ["aDirname", "aUrl", "aResponse"],
  66419. 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]",
  66420. referencedClasses: [],
  66421. pragmas: [],
  66422. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  66423. }, function ($methodClass){ return function (aDirname,aUrl,aResponse){
  66424. var self=this,$self=this;
  66425. return $core.withContext(function($ctx1) {
  66426. var $1,$2,$3;
  66427. if($core.assert($recv([$recv(aUrl)._pathname()
  66428. ,$ctx1.sendIdx["pathname"]=1
  66429. ][0])._endsWith_("/"))){
  66430. $self._respondFileNamed_to_([$recv(aDirname).__comma("index.html")
  66431. ,$ctx1.sendIdx[","]=1
  66432. ][0],aResponse);
  66433. } else {
  66434. $1=$recv($recv(aUrl)._pathname()).__comma("/");
  66435. $2=$recv(aUrl)._search();
  66436. if($2 == null || $2.a$nil){
  66437. $3="";
  66438. } else {
  66439. $3=$2;
  66440. }
  66441. $self._respondRedirect_to_([$recv($1).__comma($3)
  66442. ,$ctx1.sendIdx[","]=2
  66443. ][0],aResponse);
  66444. }
  66445. return self;
  66446. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse})});
  66447. }; }),
  66448. $globals.FileServer);
  66449. $core.addMethod(
  66450. $core.method({
  66451. selector: "respondFileNamed:to:",
  66452. protocol: "request handling",
  66453. args: ["aFilename", "aResponse"],
  66454. 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]]",
  66455. referencedClasses: [],
  66456. pragmas: [],
  66457. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  66458. }, function ($methodClass){ return function (aFilename,aResponse){
  66459. var self=this,$self=this;
  66460. var type,filename;
  66461. return $core.withContext(function($ctx1) {
  66462. filename=aFilename;
  66463. $recv($self.fs)._readFile_do_(filename,(function(ex,file){
  66464. return $core.withContext(function($ctx2) {
  66465. if($core.assert($recv(ex)._notNil())){
  66466. $recv(console)._log_([$recv(filename).__comma(" does not exist")
  66467. ,$ctx2.sendIdx[","]=1
  66468. ][0]);
  66469. return $self._respondNotFoundTo_(aResponse);
  66470. } else {
  66471. type=$recv($self._class())._mimeTypeFor_(filename);
  66472. if($core.assert($recv(type).__eq("application/javascript"))){
  66473. type=$recv(type).__comma(";charset=utf-8");
  66474. type;
  66475. }
  66476. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  66477. $recv(aResponse)._write_encoding_(file,"binary");
  66478. return $recv(aResponse)._end();
  66479. }
  66480. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  66481. }));
  66482. return self;
  66483. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename})});
  66484. }; }),
  66485. $globals.FileServer);
  66486. $core.addMethod(
  66487. $core.method({
  66488. selector: "respondInternalErrorTo:",
  66489. protocol: "request handling",
  66490. args: ["aResponse"],
  66491. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  66492. referencedClasses: [],
  66493. pragmas: [],
  66494. messageSends: ["writeHead:options:", "write:", "end"]
  66495. }, function ($methodClass){ return function (aResponse){
  66496. var self=this,$self=this;
  66497. return $core.withContext(function($ctx1) {
  66498. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  66499. $recv(aResponse)._write_("500 Internal server error");
  66500. $recv(aResponse)._end();
  66501. return self;
  66502. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse})});
  66503. }; }),
  66504. $globals.FileServer);
  66505. $core.addMethod(
  66506. $core.method({
  66507. selector: "respondNotCreatedTo:",
  66508. protocol: "request handling",
  66509. args: ["aResponse"],
  66510. 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.",
  66511. referencedClasses: [],
  66512. pragmas: [],
  66513. messageSends: ["writeHead:options:", "write:", "end"]
  66514. }, function ($methodClass){ return function (aResponse){
  66515. var self=this,$self=this;
  66516. return $core.withContext(function($ctx1) {
  66517. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  66518. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  66519. $recv(aResponse)._end();
  66520. return self;
  66521. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse})});
  66522. }; }),
  66523. $globals.FileServer);
  66524. $core.addMethod(
  66525. $core.method({
  66526. selector: "respondNotFoundTo:",
  66527. protocol: "request handling",
  66528. args: ["aResponse"],
  66529. 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",
  66530. referencedClasses: [],
  66531. pragmas: [],
  66532. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  66533. }, function ($methodClass){ return function (aResponse){
  66534. var self=this,$self=this;
  66535. return $core.withContext(function($ctx1) {
  66536. if(!$core.assert($recv([$self._fallbackPage()
  66537. ,$ctx1.sendIdx["fallbackPage"]=1
  66538. ][0])._isNil())){
  66539. return $self._respondFileNamed_to_($self._fallbackPage(),aResponse);
  66540. }
  66541. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  66542. [$recv(aResponse)._write_("<html><body><p>404 Not found</p>")
  66543. ,$ctx1.sendIdx["write:"]=1
  66544. ][0];
  66545. [$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>")
  66546. ,$ctx1.sendIdx["write:"]=2
  66547. ][0];
  66548. [$recv(aResponse)._write_("<li>create an index.html in the served directory.</li>")
  66549. ,$ctx1.sendIdx["write:"]=3
  66550. ][0];
  66551. [$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>")
  66552. ,$ctx1.sendIdx["write:"]=4
  66553. ][0];
  66554. [$recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>")
  66555. ,$ctx1.sendIdx["write:"]=5
  66556. ][0];
  66557. $recv(aResponse)._write_("</ul></p></body></html>");
  66558. $recv(aResponse)._end();
  66559. return self;
  66560. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse})});
  66561. }; }),
  66562. $globals.FileServer);
  66563. $core.addMethod(
  66564. $core.method({
  66565. selector: "respondOKTo:",
  66566. protocol: "request handling",
  66567. args: ["aResponse"],
  66568. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  66569. referencedClasses: [],
  66570. pragmas: [],
  66571. messageSends: ["writeHead:options:", "end"]
  66572. }, function ($methodClass){ return function (aResponse){
  66573. var self=this,$self=this;
  66574. return $core.withContext(function($ctx1) {
  66575. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  66576. $recv(aResponse)._end();
  66577. return self;
  66578. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse})});
  66579. }; }),
  66580. $globals.FileServer);
  66581. $core.addMethod(
  66582. $core.method({
  66583. selector: "respondRedirect:to:",
  66584. protocol: "request handling",
  66585. args: ["aString", "aResponse"],
  66586. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  66587. referencedClasses: [],
  66588. pragmas: [],
  66589. messageSends: ["writeHead:options:", "end"]
  66590. }, function ($methodClass){ return function (aString,aResponse){
  66591. var self=this,$self=this;
  66592. return $core.withContext(function($ctx1) {
  66593. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  66594. $recv(aResponse)._end();
  66595. return self;
  66596. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse})});
  66597. }; }),
  66598. $globals.FileServer);
  66599. $core.addMethod(
  66600. $core.method({
  66601. selector: "start",
  66602. protocol: "starting",
  66603. args: [],
  66604. 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.",
  66605. referencedClasses: [],
  66606. pragmas: [],
  66607. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  66608. }, function ($methodClass){ return function (){
  66609. var self=this,$self=this;
  66610. return $core.withContext(function($ctx1) {
  66611. var $1;
  66612. $self._checkDirectoryLayout();
  66613. $1=$recv($self.http)._createServer_((function(request,response){
  66614. return $core.withContext(function($ctx2) {
  66615. return $self._handleRequest_respondTo_(request,response);
  66616. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  66617. }));
  66618. [$recv($1)._on_do_("error",(function(error){
  66619. return $core.withContext(function($ctx2) {
  66620. return [$recv(console)._log_(["Error starting server: ".__comma(error)
  66621. ,$ctx2.sendIdx[","]=1
  66622. ][0])
  66623. ,$ctx2.sendIdx["log:"]=1
  66624. ][0];
  66625. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  66626. }))
  66627. ,$ctx1.sendIdx["on:do:"]=1
  66628. ][0];
  66629. $recv($1)._on_do_("listening",(function(){
  66630. return $core.withContext(function($ctx2) {
  66631. return $recv(console)._log_([$recv([$recv("Starting file server on http://".__comma([$self._host()
  66632. ,$ctx2.sendIdx["host"]=1
  66633. ][0])).__comma(":")
  66634. ,$ctx2.sendIdx[","]=3
  66635. ][0]).__comma($recv([$self._port()
  66636. ,$ctx2.sendIdx["port"]=1
  66637. ][0])._asString())
  66638. ,$ctx2.sendIdx[","]=2
  66639. ][0]);
  66640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  66641. }));
  66642. $recv($1)._listen_host_($self._port(),$self._host());
  66643. return self;
  66644. }, function($ctx1) {$ctx1.fill(self,"start",{})});
  66645. }; }),
  66646. $globals.FileServer);
  66647. $core.addMethod(
  66648. $core.method({
  66649. selector: "startOn:",
  66650. protocol: "starting",
  66651. args: ["aPort"],
  66652. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  66653. referencedClasses: [],
  66654. pragmas: [],
  66655. messageSends: ["port:", "start"]
  66656. }, function ($methodClass){ return function (aPort){
  66657. var self=this,$self=this;
  66658. return $core.withContext(function($ctx1) {
  66659. $self._port_(aPort);
  66660. $self._start();
  66661. return self;
  66662. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort})});
  66663. }; }),
  66664. $globals.FileServer);
  66665. $core.addMethod(
  66666. $core.method({
  66667. selector: "username:",
  66668. protocol: "accessing",
  66669. args: ["aUsername"],
  66670. source: "username: aUsername\x0a\x09username := aUsername.",
  66671. referencedClasses: [],
  66672. pragmas: [],
  66673. messageSends: []
  66674. }, function ($methodClass){ return function (aUsername){
  66675. var self=this,$self=this;
  66676. $self.username=aUsername;
  66677. return self;
  66678. }; }),
  66679. $globals.FileServer);
  66680. $core.addMethod(
  66681. $core.method({
  66682. selector: "validateBasePath",
  66683. protocol: "private",
  66684. args: [],
  66685. 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.' ]].",
  66686. referencedClasses: [],
  66687. pragmas: [],
  66688. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  66689. }, function ($methodClass){ return function (){
  66690. var self=this,$self=this;
  66691. return $core.withContext(function($ctx1) {
  66692. $recv($self.fs)._stat_then_([$self._basePath()
  66693. ,$ctx1.sendIdx["basePath"]=1
  66694. ][0],(function(err,stat){
  66695. return $core.withContext(function($ctx2) {
  66696. if(err == null || err.a$nil){
  66697. if(!$core.assert($recv(stat)._isDirectory())){
  66698. return [$recv(console)._warn_([$recv(["Warning: --base-path parameter ".__comma([$self._basePath()
  66699. ,$ctx2.sendIdx["basePath"]=2
  66700. ][0])
  66701. ,$ctx2.sendIdx[","]=2
  66702. ][0]).__comma(" is not a directory.")
  66703. ,$ctx2.sendIdx[","]=1
  66704. ][0])
  66705. ,$ctx2.sendIdx["warn:"]=1
  66706. ][0];
  66707. }
  66708. } else {
  66709. return $recv(console)._warn_([$recv("Warning: path at --base-path parameter ".__comma($self._basePath())).__comma(" does not exist.")
  66710. ,$ctx2.sendIdx[","]=3
  66711. ][0]);
  66712. }
  66713. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  66714. }));
  66715. return self;
  66716. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{})});
  66717. }; }),
  66718. $globals.FileServer);
  66719. $core.addMethod(
  66720. $core.method({
  66721. selector: "withBasePath:",
  66722. protocol: "private",
  66723. args: ["aBaseRelativePath"],
  66724. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  66725. referencedClasses: [],
  66726. pragmas: [],
  66727. messageSends: ["join:with:", "basePath"]
  66728. }, function ($methodClass){ return function (aBaseRelativePath){
  66729. var self=this,$self=this;
  66730. return $core.withContext(function($ctx1) {
  66731. return $recv($self.path)._join_with_($self._basePath(),aBaseRelativePath);
  66732. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath})});
  66733. }; }),
  66734. $globals.FileServer);
  66735. $core.addMethod(
  66736. $core.method({
  66737. selector: "writeData:toFileNamed:",
  66738. protocol: "private",
  66739. args: ["data", "aFilename"],
  66740. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  66741. referencedClasses: [],
  66742. pragmas: [],
  66743. messageSends: ["log:"]
  66744. }, function ($methodClass){ return function (data,aFilename){
  66745. var self=this,$self=this;
  66746. return $core.withContext(function($ctx1) {
  66747. $recv(console)._log_(aFilename);
  66748. return self;
  66749. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename})});
  66750. }; }),
  66751. $globals.FileServer);
  66752. $core.setSlots($globals.FileServer.a$cls, ["mimeTypes"]);
  66753. $core.addMethod(
  66754. $core.method({
  66755. selector: "commandLineSwitches",
  66756. protocol: "accessing",
  66757. args: [],
  66758. 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",
  66759. referencedClasses: [],
  66760. pragmas: [],
  66761. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  66762. }, function ($methodClass){ return function (){
  66763. var self=this,$self=this;
  66764. var switches;
  66765. return $core.withContext(function($ctx1) {
  66766. switches=[$recv($self._methodsInProtocol_("accessing"))._collect_((function(each){
  66767. return $core.withContext(function($ctx2) {
  66768. return $recv(each)._selector();
  66769. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  66770. }))
  66771. ,$ctx1.sendIdx["collect:"]=1
  66772. ][0];
  66773. switches=$recv(switches)._select_((function(each){
  66774. return $core.withContext(function($ctx2) {
  66775. return $recv(each)._match_("^[^:]*:$");
  66776. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  66777. }));
  66778. switches=$recv(switches)._collect_((function(each){
  66779. return $core.withContext(function($ctx2) {
  66780. return [$recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1")
  66781. ,$ctx2.sendIdx["replace:with:"]=1
  66782. ][0];
  66783. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  66784. }));
  66785. return switches;
  66786. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches})});
  66787. }; }),
  66788. $globals.FileServer.a$cls);
  66789. $core.addMethod(
  66790. $core.method({
  66791. selector: "createServerWithArguments:",
  66792. protocol: "initialization",
  66793. args: ["options"],
  66794. 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: { 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.",
  66795. referencedClasses: [],
  66796. pragmas: [],
  66797. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:"]
  66798. }, function ($methodClass){ return function (options){
  66799. var self=this,$self=this;
  66800. var server,popFront,front,optionName,optionValue,switches;
  66801. return $core.withContext(function($ctx1) {
  66802. var $early={};
  66803. try {
  66804. switches=$self._commandLineSwitches();
  66805. server=$self._new();
  66806. $recv(options)._ifEmpty_((function(){
  66807. throw $early=[server];
  66808. }));
  66809. if(!$core.assert($recv($recv(options)._size())._even())){
  66810. [$recv(console)._log_("Using default parameters.")
  66811. ,$ctx1.sendIdx["log:"]=1
  66812. ][0];
  66813. [$recv(console)._log_(["Wrong commandline options or not enough arguments for: ".__comma(options)
  66814. ,$ctx1.sendIdx[","]=1
  66815. ][0])
  66816. ,$ctx1.sendIdx["log:"]=2
  66817. ][0];
  66818. [$recv(console)._log_(["Use any of the following ones: ".__comma(switches)
  66819. ,$ctx1.sendIdx[","]=2
  66820. ][0])
  66821. ,$ctx1.sendIdx["log:"]=3
  66822. ][0];
  66823. return server;
  66824. }
  66825. popFront=(function(args){
  66826. return $core.withContext(function($ctx2) {
  66827. front=$recv(args)._first();
  66828. $recv(args)._remove_(front);
  66829. return front;
  66830. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  66831. });
  66832. $recv((function(){
  66833. return $core.withContext(function($ctx2) {
  66834. return $recv(options)._notEmpty();
  66835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  66836. }))._whileTrue_((function(){
  66837. return $core.withContext(function($ctx2) {
  66838. optionName=[$recv(popFront)._value_(options)
  66839. ,$ctx2.sendIdx["value:"]=1
  66840. ][0];
  66841. optionValue=$recv(popFront)._value_(options);
  66842. if($core.assert($recv(switches)._includes_(optionName))){
  66843. optionName=$self._selectorForCommandLineSwitch_(optionName);
  66844. return $recv(server)._perform_withArguments_(optionName,[optionValue]);
  66845. } else {
  66846. [$recv(console)._log_([$recv(optionName).__comma(" is not a valid commandline option")
  66847. ,$ctx2.sendIdx[","]=3
  66848. ][0])
  66849. ,$ctx2.sendIdx["log:"]=4
  66850. ][0];
  66851. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  66852. }
  66853. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  66854. }));
  66855. return server;
  66856. }
  66857. catch(e) {if(e===$early)return e[0]; throw e}
  66858. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches})});
  66859. }; }),
  66860. $globals.FileServer.a$cls);
  66861. $core.addMethod(
  66862. $core.method({
  66863. selector: "defaultBasePath",
  66864. protocol: "accessing",
  66865. args: [],
  66866. source: "defaultBasePath\x0a\x09^ './'",
  66867. referencedClasses: [],
  66868. pragmas: [],
  66869. messageSends: []
  66870. }, function ($methodClass){ return function (){
  66871. var self=this,$self=this;
  66872. return "./";
  66873. }; }),
  66874. $globals.FileServer.a$cls);
  66875. $core.addMethod(
  66876. $core.method({
  66877. selector: "defaultHost",
  66878. protocol: "accessing",
  66879. args: [],
  66880. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  66881. referencedClasses: [],
  66882. pragmas: [],
  66883. messageSends: []
  66884. }, function ($methodClass){ return function (){
  66885. var self=this,$self=this;
  66886. return "127.0.0.1";
  66887. }; }),
  66888. $globals.FileServer.a$cls);
  66889. $core.addMethod(
  66890. $core.method({
  66891. selector: "defaultMimeTypes",
  66892. protocol: "accessing",
  66893. args: [],
  66894. 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}",
  66895. referencedClasses: [],
  66896. pragmas: [],
  66897. messageSends: []
  66898. }, function ($methodClass){ return function (){
  66899. var self=this,$self=this;
  66900. 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"]);
  66901. }; }),
  66902. $globals.FileServer.a$cls);
  66903. $core.addMethod(
  66904. $core.method({
  66905. selector: "defaultPort",
  66906. protocol: "accessing",
  66907. args: [],
  66908. source: "defaultPort\x0a\x09^ 4000",
  66909. referencedClasses: [],
  66910. pragmas: [],
  66911. messageSends: []
  66912. }, function ($methodClass){ return function (){
  66913. var self=this,$self=this;
  66914. return (4000);
  66915. }; }),
  66916. $globals.FileServer.a$cls);
  66917. $core.addMethod(
  66918. $core.method({
  66919. selector: "main",
  66920. protocol: "initialization",
  66921. args: [],
  66922. 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]",
  66923. referencedClasses: ["FileServer"],
  66924. pragmas: [],
  66925. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  66926. }, function ($methodClass){ return function (){
  66927. var self=this,$self=this;
  66928. var fileServer,args;
  66929. return $core.withContext(function($ctx1) {
  66930. var $early={};
  66931. try {
  66932. args=$recv(process)._argv();
  66933. $recv(args)._removeFrom_to_((1),(3));
  66934. $recv(args)._detect_ifNone_((function(each){
  66935. return $core.withContext(function($ctx2) {
  66936. if($core.assert($recv(each).__eq("--help"))){
  66937. return $recv($globals.FileServer)._printHelp();
  66938. }
  66939. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  66940. }),(function(){
  66941. return $core.withContext(function($ctx2) {
  66942. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  66943. throw $early=[$recv(fileServer)._start()];
  66944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  66945. }));
  66946. return self;
  66947. }
  66948. catch(e) {if(e===$early)return e[0]; throw e}
  66949. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args})});
  66950. }; }),
  66951. $globals.FileServer.a$cls);
  66952. $core.addMethod(
  66953. $core.method({
  66954. selector: "mimeTypeFor:",
  66955. protocol: "accessing",
  66956. args: ["aString"],
  66957. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  66958. referencedClasses: [],
  66959. pragmas: [],
  66960. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  66961. }, function ($methodClass){ return function (aString){
  66962. var self=this,$self=this;
  66963. return $core.withContext(function($ctx1) {
  66964. return $recv($self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  66965. return "text/plain";
  66966. }));
  66967. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString})});
  66968. }; }),
  66969. $globals.FileServer.a$cls);
  66970. $core.addMethod(
  66971. $core.method({
  66972. selector: "mimeTypes",
  66973. protocol: "accessing",
  66974. args: [],
  66975. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  66976. referencedClasses: [],
  66977. pragmas: [],
  66978. messageSends: ["ifNil:", "defaultMimeTypes"]
  66979. }, function ($methodClass){ return function (){
  66980. var self=this,$self=this;
  66981. return $core.withContext(function($ctx1) {
  66982. var $1;
  66983. $1=$self.mimeTypes;
  66984. if($1 == null || $1.a$nil){
  66985. $self.mimeTypes=$self._defaultMimeTypes();
  66986. return $self.mimeTypes;
  66987. } else {
  66988. return $1;
  66989. }
  66990. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{})});
  66991. }; }),
  66992. $globals.FileServer.a$cls);
  66993. $core.addMethod(
  66994. $core.method({
  66995. selector: "printHelp",
  66996. protocol: "accessing",
  66997. args: [],
  66998. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  66999. referencedClasses: [],
  67000. pragmas: [],
  67001. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  67002. }, function ($methodClass){ return function (){
  67003. var self=this,$self=this;
  67004. return $core.withContext(function($ctx1) {
  67005. [$recv(console)._log_("Available commandline options are:")
  67006. ,$ctx1.sendIdx["log:"]=1
  67007. ][0];
  67008. [$recv(console)._log_("--help")
  67009. ,$ctx1.sendIdx["log:"]=2
  67010. ][0];
  67011. $recv($self._commandLineSwitches())._do_((function(each){
  67012. return $core.withContext(function($ctx2) {
  67013. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  67014. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  67015. }));
  67016. return self;
  67017. }, function($ctx1) {$ctx1.fill(self,"printHelp",{})});
  67018. }; }),
  67019. $globals.FileServer.a$cls);
  67020. $core.addMethod(
  67021. $core.method({
  67022. selector: "selectorForCommandLineSwitch:",
  67023. protocol: "accessing",
  67024. args: ["aSwitch"],
  67025. 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 ]), ':'",
  67026. referencedClasses: [],
  67027. pragmas: [],
  67028. messageSends: [",", "replace:with:", "asUppercase", "second"]
  67029. }, function ($methodClass){ return function (aSwitch){
  67030. var self=this,$self=this;
  67031. return $core.withContext(function($ctx1) {
  67032. return $recv([$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  67033. return $core.withContext(function($ctx2) {
  67034. return $recv($recv(each)._second())._asUppercase();
  67035. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  67036. }))
  67037. ,$ctx1.sendIdx["replace:with:"]=1
  67038. ][0]).__comma(":");
  67039. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch})});
  67040. }; }),
  67041. $globals.FileServer.a$cls);
  67042. $core.addClass("Initer", $globals.BaseFileManipulator, ["childProcess", "nmPath"], "AmberCli");
  67043. $core.addMethod(
  67044. $core.method({
  67045. selector: "finishMessage",
  67046. protocol: "action",
  67047. args: [],
  67048. 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",
  67049. referencedClasses: ["String"],
  67050. pragmas: [],
  67051. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  67052. }, function ($methodClass){ return function (){
  67053. var self=this,$self=this;
  67054. return $core.withContext(function($ctx1) {
  67055. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  67056. $recv((function(){
  67057. }))._valueWithTimeout_((600));
  67058. return self;
  67059. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{})});
  67060. }; }),
  67061. $globals.Initer);
  67062. $core.addMethod(
  67063. $core.method({
  67064. selector: "gruntInitThenDo:",
  67065. protocol: "action",
  67066. args: ["aBlock"],
  67067. source: "gruntInitThenDo: aBlock\x0a\x09| child sanitizedTemplatePath |\x0a\x09sanitizedTemplatePath := ((path join: nmPath with: '@ambers/grunt-init-amber-project')\x0a\x09\x09replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:'.\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-init' named: 'grunt-init')\x0a\x09\x09args: {sanitizedTemplatePath}.\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  67068. referencedClasses: [],
  67069. pragmas: [],
  67070. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  67071. }, function ($methodClass){ return function (aBlock){
  67072. var self=this,$self=this;
  67073. var child,sanitizedTemplatePath;
  67074. return $core.withContext(function($ctx1) {
  67075. var $1,$2;
  67076. sanitizedTemplatePath=[$recv($recv($recv($self.path)._join_with_($self.nmPath,"@ambers/grunt-init-amber-project"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:")
  67077. ,$ctx1.sendIdx["replace:with:"]=1
  67078. ][0];
  67079. child=$recv($self.childProcess)._fork_args_($self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  67080. $1=child;
  67081. [$recv($1)._on_do_("error",aBlock)
  67082. ,$ctx1.sendIdx["on:do:"]=1
  67083. ][0];
  67084. $recv($1)._on_do_("close",(function(code){
  67085. return $core.withContext(function($ctx2) {
  67086. if($core.assert($recv(code).__eq((0)))){
  67087. $2=nil;
  67088. } else {
  67089. $2=code;
  67090. }
  67091. return $recv(aBlock)._value_($2);
  67092. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  67093. }));
  67094. return self;
  67095. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath})});
  67096. }; }),
  67097. $globals.Initer);
  67098. $core.addMethod(
  67099. $core.method({
  67100. selector: "initProjectThenDo:",
  67101. protocol: "action",
  67102. args: ["aBlock"],
  67103. source: "initProjectThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: 'npm run init'\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
  67104. referencedClasses: [],
  67105. pragmas: [],
  67106. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  67107. }, function ($methodClass){ return function (aBlock){
  67108. var self=this,$self=this;
  67109. var child;
  67110. return $core.withContext(function($ctx1) {
  67111. child=$recv($self.childProcess)._exec_thenDo_("npm run init",aBlock);
  67112. $recv([$recv(child)._stdout()
  67113. ,$ctx1.sendIdx["stdout"]=1
  67114. ][0])._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  67115. return self;
  67116. }, function($ctx1) {$ctx1.fill(self,"initProjectThenDo:",{aBlock:aBlock,child:child})});
  67117. }; }),
  67118. $globals.Initer);
  67119. $core.addMethod(
  67120. $core.method({
  67121. selector: "initialize",
  67122. protocol: "initialization",
  67123. args: [],
  67124. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  67125. referencedClasses: [],
  67126. pragmas: [],
  67127. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  67128. }, function ($methodClass){ return function (){
  67129. var self=this,$self=this;
  67130. return $core.withContext(function($ctx1) {
  67131. [(
  67132. $ctx1.supercall = true,
  67133. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  67134. ,$ctx1.supercall = false
  67135. ][0];
  67136. $self.childProcess=$recv(require)._value_("child_process");
  67137. $self.nmPath=$recv($self.path)._join_with_($self._rootDirname(),"node_modules");
  67138. return self;
  67139. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  67140. }; }),
  67141. $globals.Initer);
  67142. $core.addMethod(
  67143. $core.method({
  67144. selector: "npmScriptForModule:named:",
  67145. protocol: "npm",
  67146. args: ["aString", "anotherString"],
  67147. source: "npmScriptForModule: aString named: anotherString\x0a\x09| modulePath packageJson binSection scriptPath |\x0a\x09modulePath := path dirname: (\x0a\x09\x09require provided resolve: aString, '/package.json').\x0a\x09packageJson := Smalltalk readJSObject: (\x0a\x09\x09require value: aString, '/package.json').\x0a\x09binSection := packageJson at: 'bin'.\x0a\x09scriptPath := binSection isString\x0a\x09\x09ifTrue: [ binSection ]\x0a\x09\x09ifFalse: [ binSection at: anotherString ].\x0a\x09^ path join: modulePath with: scriptPath",
  67148. referencedClasses: ["Smalltalk"],
  67149. pragmas: [],
  67150. messageSends: ["dirname:", "resolve:", "provided", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  67151. }, function ($methodClass){ return function (aString,anotherString){
  67152. var self=this,$self=this;
  67153. var modulePath,packageJson,binSection,scriptPath;
  67154. return $core.withContext(function($ctx1) {
  67155. modulePath=$recv($self.path)._dirname_($recv($recv(require)._provided())._resolve_([$recv(aString).__comma("/package.json")
  67156. ,$ctx1.sendIdx[","]=1
  67157. ][0]));
  67158. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  67159. binSection=[$recv(packageJson)._at_("bin")
  67160. ,$ctx1.sendIdx["at:"]=1
  67161. ][0];
  67162. if($core.assert($recv(binSection)._isString())){
  67163. scriptPath=binSection;
  67164. } else {
  67165. scriptPath=$recv(binSection)._at_(anotherString);
  67166. }
  67167. return $recv($self.path)._join_with_(modulePath,scriptPath);
  67168. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath})});
  67169. }; }),
  67170. $globals.Initer);
  67171. $core.addMethod(
  67172. $core.method({
  67173. selector: "start",
  67174. protocol: "action",
  67175. args: [],
  67176. source: "start\x0a\x09self gruntInitThenDo: [ :error | error\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt-init exec error:'; log: error.\x0a\x09\x09process exit: 101 ]\x0a\x09ifNil: [\x0a\x0a\x09self initProjectThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm run init exec error:'; log: error2.\x0a\x09\x09process exit: 105 ]\x0a\x09ifNil: [\x0a\x0a\x09self finishMessage.\x0a\x09process exit ]]]]",
  67177. referencedClasses: [],
  67178. pragmas: [],
  67179. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "initProjectThenDo:", "finishMessage", "exit"]
  67180. }, function ($methodClass){ return function (){
  67181. var self=this,$self=this;
  67182. return $core.withContext(function($ctx1) {
  67183. var $1,$2;
  67184. $self._gruntInitThenDo_((function(error){
  67185. return $core.withContext(function($ctx2) {
  67186. if(error == null || error.a$nil){
  67187. return $self._initProjectThenDo_((function(error2){
  67188. return $core.withContext(function($ctx3) {
  67189. if(error2 == null || error2.a$nil){
  67190. $self._finishMessage();
  67191. return $recv(process)._exit();
  67192. } else {
  67193. $2=console;
  67194. [$recv($2)._log_("npm run init exec error:")
  67195. ,$ctx3.sendIdx["log:"]=3
  67196. ][0];
  67197. $recv($2)._log_(error2);
  67198. return $recv(process)._exit_((105));
  67199. }
  67200. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  67201. }));
  67202. } else {
  67203. $1=console;
  67204. [$recv($1)._log_("grunt-init exec error:")
  67205. ,$ctx2.sendIdx["log:"]=1
  67206. ][0];
  67207. [$recv($1)._log_(error)
  67208. ,$ctx2.sendIdx["log:"]=2
  67209. ][0];
  67210. return [$recv(process)._exit_((101))
  67211. ,$ctx2.sendIdx["exit:"]=1
  67212. ][0];
  67213. }
  67214. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  67215. }));
  67216. return self;
  67217. }, function($ctx1) {$ctx1.fill(self,"start",{})});
  67218. }; }),
  67219. $globals.Initer);
  67220. $core.addClass("Repl", $globals.Object, ["readline", "interface", "util", "session", "resultCount", "commands"], "AmberCli");
  67221. $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.";
  67222. $core.addMethod(
  67223. $core.method({
  67224. selector: "addVariableNamed:to:",
  67225. protocol: "private",
  67226. args: ["aString", "anObject"],
  67227. 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",
  67228. referencedClasses: [],
  67229. pragmas: [],
  67230. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  67231. }, function ($methodClass){ return function (aString,anObject){
  67232. var self=this,$self=this;
  67233. var newClass,newObject;
  67234. return $core.withContext(function($ctx1) {
  67235. newClass=$self._subclass_withVariable_($recv(anObject)._class(),aString);
  67236. $self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  67237. newObject=$recv(newClass)._new();
  67238. $self._setPreviousVariablesFor_from_(newObject,anObject);
  67239. return newObject;
  67240. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject})});
  67241. }; }),
  67242. $globals.Repl);
  67243. $core.addMethod(
  67244. $core.method({
  67245. selector: "assignNewVariable:do:",
  67246. protocol: "private",
  67247. args: ["buffer", "aBlock"],
  67248. 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]",
  67249. referencedClasses: ["Error", "ConsoleErrorHandler"],
  67250. pragmas: [],
  67251. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  67252. }, function ($methodClass){ return function (buffer,aBlock){
  67253. var self=this,$self=this;
  67254. return $core.withContext(function($ctx1) {
  67255. var $1,$2;
  67256. return $self._parseAssignment_do_(buffer,(function(name,expr){
  67257. var varName,value;
  67258. return $core.withContext(function($ctx2) {
  67259. if(name == null || name.a$nil){
  67260. varName=$self._nextResultName();
  67261. } else {
  67262. varName=name;
  67263. }
  67264. $self.session=$self._addVariableNamed_to_(varName,$self.session);
  67265. $recv((function(){
  67266. return $core.withContext(function($ctx3) {
  67267. $1=$recv(varName).__comma(" := ");
  67268. if(expr == null || expr.a$nil){
  67269. $2=buffer;
  67270. } else {
  67271. $2=expr;
  67272. }
  67273. value=$self._eval_on_([$recv($1).__comma($2)
  67274. ,$ctx3.sendIdx[","]=1
  67275. ][0],$self.session);
  67276. return value;
  67277. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  67278. }))._on_do_($globals.Error,(function(e){
  67279. return $core.withContext(function($ctx3) {
  67280. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  67281. value=nil;
  67282. return value;
  67283. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  67284. }));
  67285. return $recv(aBlock)._value_value_(varName,value);
  67286. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  67287. }));
  67288. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock})});
  67289. }; }),
  67290. $globals.Repl);
  67291. $core.addMethod(
  67292. $core.method({
  67293. selector: "clearScreen",
  67294. protocol: "actions",
  67295. args: [],
  67296. 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",
  67297. referencedClasses: ["String"],
  67298. pragmas: [],
  67299. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  67300. }, function ($methodClass){ return function (){
  67301. var self=this,$self=this;
  67302. var esc,cls;
  67303. return $core.withContext(function($ctx1) {
  67304. esc=$recv($globals.String)._fromCharCode_((27));
  67305. cls=[$recv([$recv($recv(esc).__comma("[2J")).__comma(esc)
  67306. ,$ctx1.sendIdx[","]=2
  67307. ][0]).__comma("[0;0f")
  67308. ,$ctx1.sendIdx[","]=1
  67309. ][0];
  67310. $recv($recv(process)._stdout())._write_(cls);
  67311. $recv($self.interface)._prompt();
  67312. return self;
  67313. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls})});
  67314. }; }),
  67315. $globals.Repl);
  67316. $core.addMethod(
  67317. $core.method({
  67318. selector: "close",
  67319. protocol: "actions",
  67320. args: [],
  67321. source: "close\x0a\x09process stdin destroy",
  67322. referencedClasses: [],
  67323. pragmas: [],
  67324. messageSends: ["destroy", "stdin"]
  67325. }, function ($methodClass){ return function (){
  67326. var self=this,$self=this;
  67327. return $core.withContext(function($ctx1) {
  67328. $recv($recv(process)._stdin())._destroy();
  67329. return self;
  67330. }, function($ctx1) {$ctx1.fill(self,"close",{})});
  67331. }; }),
  67332. $globals.Repl);
  67333. $core.addMethod(
  67334. $core.method({
  67335. selector: "commands",
  67336. protocol: "accessing",
  67337. args: [],
  67338. source: "commands\x0a\x09^ commands",
  67339. referencedClasses: [],
  67340. pragmas: [],
  67341. messageSends: []
  67342. }, function ($methodClass){ return function (){
  67343. var self=this,$self=this;
  67344. return $self.commands;
  67345. }; }),
  67346. $globals.Repl);
  67347. $core.addMethod(
  67348. $core.method({
  67349. selector: "createInterface",
  67350. protocol: "actions",
  67351. args: [],
  67352. 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",
  67353. referencedClasses: [],
  67354. pragmas: [],
  67355. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  67356. }, function ($methodClass){ return function (){
  67357. var self=this,$self=this;
  67358. return $core.withContext(function($ctx1) {
  67359. $self.interface=$recv($self.readline)._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  67360. [$recv($self.interface)._on_do_("line",(function(buffer){
  67361. return $core.withContext(function($ctx2) {
  67362. return $self._processLine_(buffer);
  67363. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  67364. }))
  67365. ,$ctx1.sendIdx["on:do:"]=1
  67366. ][0];
  67367. $recv($self.interface)._on_do_("close",(function(){
  67368. return $core.withContext(function($ctx2) {
  67369. return $self._close();
  67370. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  67371. }));
  67372. $self._printWelcome();
  67373. $self._setupHotkeys();
  67374. $self._setPrompt();
  67375. $recv($self.interface)._prompt();
  67376. return self;
  67377. }, function($ctx1) {$ctx1.fill(self,"createInterface",{})});
  67378. }; }),
  67379. $globals.Repl);
  67380. $core.addMethod(
  67381. $core.method({
  67382. selector: "encapsulateVariable:withValue:in:",
  67383. protocol: "private",
  67384. args: ["aString", "anObject", "aClass"],
  67385. 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'.",
  67386. referencedClasses: ["Compiler"],
  67387. pragmas: [],
  67388. messageSends: ["new", "install:forClass:protocol:", ","]
  67389. }, function ($methodClass){ return function (aString,anObject,aClass){
  67390. var self=this,$self=this;
  67391. var compiler;
  67392. return $core.withContext(function($ctx1) {
  67393. compiler=$recv($globals.Compiler)._new();
  67394. [$recv(compiler)._install_forClass_protocol_([$recv([$recv([$recv(aString).__comma(": anObject ^ ")
  67395. ,$ctx1.sendIdx[","]=3
  67396. ][0]).__comma(aString)
  67397. ,$ctx1.sendIdx[","]=2
  67398. ][0]).__comma(" := anObject")
  67399. ,$ctx1.sendIdx[","]=1
  67400. ][0],aClass,"session")
  67401. ,$ctx1.sendIdx["install:forClass:protocol:"]=1
  67402. ][0];
  67403. $recv(compiler)._install_forClass_protocol_([$recv($recv(aString).__comma(" ^ ")).__comma(aString)
  67404. ,$ctx1.sendIdx[","]=4
  67405. ][0],aClass,"session");
  67406. return self;
  67407. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler})});
  67408. }; }),
  67409. $globals.Repl);
  67410. $core.addMethod(
  67411. $core.method({
  67412. selector: "eval:",
  67413. protocol: "actions",
  67414. args: ["buffer"],
  67415. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  67416. referencedClasses: ["DoIt"],
  67417. pragmas: [],
  67418. messageSends: ["eval:on:", "new"]
  67419. }, function ($methodClass){ return function (buffer){
  67420. var self=this,$self=this;
  67421. return $core.withContext(function($ctx1) {
  67422. return $self._eval_on_(buffer,$recv($globals.DoIt)._new());
  67423. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer})});
  67424. }; }),
  67425. $globals.Repl);
  67426. $core.addMethod(
  67427. $core.method({
  67428. selector: "eval:on:",
  67429. protocol: "actions",
  67430. args: ["buffer", "anObject"],
  67431. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer ifNotEmpty: [\x0a\x09\x09[result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09\x09tryIfTrue: [ :e | (Smalltalk isError: e) not or: [ e context isNil ] ]\x0a\x09\x09\x09catch: [ :e | process stdout write: e jsStack ]].\x0a\x09^ result",
  67432. referencedClasses: ["Compiler", "Smalltalk"],
  67433. pragmas: [],
  67434. messageSends: ["ifNotEmpty:", "tryIfTrue:catch:", "evaluateExpression:on:", "new", "or:", "not", "isError:", "isNil", "context", "write:", "stdout", "jsStack"]
  67435. }, function ($methodClass){ return function (buffer,anObject){
  67436. var self=this,$self=this;
  67437. var result;
  67438. return $core.withContext(function($ctx1) {
  67439. $recv(buffer)._ifNotEmpty_((function(){
  67440. return $core.withContext(function($ctx2) {
  67441. return $recv((function(){
  67442. return $core.withContext(function($ctx3) {
  67443. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  67444. return result;
  67445. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  67446. }))._tryIfTrue_catch_((function(e){
  67447. return $core.withContext(function($ctx3) {
  67448. return $recv($recv($recv($globals.Smalltalk)._isError_(e))._not())._or_((function(){
  67449. return $core.withContext(function($ctx4) {
  67450. return $recv($recv(e)._context())._isNil();
  67451. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  67452. }));
  67453. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  67454. }),(function(e){
  67455. return $core.withContext(function($ctx3) {
  67456. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  67457. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  67458. }));
  67459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  67460. }));
  67461. return result;
  67462. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result})});
  67463. }; }),
  67464. $globals.Repl);
  67465. $core.addMethod(
  67466. $core.method({
  67467. selector: "executeCommand:",
  67468. protocol: "private",
  67469. args: ["aString"],
  67470. 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",
  67471. referencedClasses: [],
  67472. pragmas: [],
  67473. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  67474. }, function ($methodClass){ return function (aString){
  67475. var self=this,$self=this;
  67476. return $core.withContext(function($ctx1) {
  67477. var $early={};
  67478. try {
  67479. $recv($self._commands())._keysAndValuesDo_((function(names,cmd){
  67480. return $core.withContext(function($ctx2) {
  67481. if($core.assert($recv(names)._includes_(aString))){
  67482. $recv(cmd)._value();
  67483. throw $early=[true];
  67484. }
  67485. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  67486. }));
  67487. return false;
  67488. }
  67489. catch(e) {if(e===$early)return e[0]; throw e}
  67490. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString})});
  67491. }; }),
  67492. $globals.Repl);
  67493. $core.addMethod(
  67494. $core.method({
  67495. selector: "initialize",
  67496. protocol: "initialization",
  67497. args: [],
  67498. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  67499. referencedClasses: ["DoIt"],
  67500. pragmas: [],
  67501. messageSends: ["initialize", "new", "value:", "setupCommands"]
  67502. }, function ($methodClass){ return function (){
  67503. var self=this,$self=this;
  67504. return $core.withContext(function($ctx1) {
  67505. [(
  67506. $ctx1.supercall = true,
  67507. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  67508. ,$ctx1.supercall = false
  67509. ][0];
  67510. $self.session=$recv($globals.DoIt)._new();
  67511. $self.readline=[$recv(require)._value_("readline")
  67512. ,$ctx1.sendIdx["value:"]=1
  67513. ][0];
  67514. $self.util=$recv(require)._value_("util");
  67515. $self._setupCommands();
  67516. return self;
  67517. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  67518. }; }),
  67519. $globals.Repl);
  67520. $core.addMethod(
  67521. $core.method({
  67522. selector: "instanceVariableNamesFor:",
  67523. protocol: "private",
  67524. args: ["aClass"],
  67525. 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]",
  67526. referencedClasses: [],
  67527. pragmas: [],
  67528. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  67529. }, function ($methodClass){ return function (aClass){
  67530. var self=this,$self=this;
  67531. return $core.withContext(function($ctx1) {
  67532. var $1;
  67533. $1=[$recv(aClass)._superclass()
  67534. ,$ctx1.sendIdx["superclass"]=1
  67535. ][0];
  67536. if($1 == null || $1.a$nil){
  67537. return $recv(aClass)._instanceVariableNames();
  67538. } else {
  67539. return $recv([$recv(aClass)._instanceVariableNames()
  67540. ,$ctx1.sendIdx["instanceVariableNames"]=1
  67541. ][0])._copyWithAll_($self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  67542. }
  67543. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass})});
  67544. }; }),
  67545. $globals.Repl);
  67546. $core.addMethod(
  67547. $core.method({
  67548. selector: "isIdentifier:",
  67549. protocol: "private",
  67550. args: ["aString"],
  67551. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  67552. referencedClasses: [],
  67553. pragmas: [],
  67554. messageSends: ["match:", "asRegexp"]
  67555. }, function ($methodClass){ return function (aString){
  67556. var self=this,$self=this;
  67557. return $core.withContext(function($ctx1) {
  67558. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  67559. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString})});
  67560. }; }),
  67561. $globals.Repl);
  67562. $core.addMethod(
  67563. $core.method({
  67564. selector: "isVariableDefined:",
  67565. protocol: "private",
  67566. args: ["aString"],
  67567. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  67568. referencedClasses: [],
  67569. pragmas: [],
  67570. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  67571. }, function ($methodClass){ return function (aString){
  67572. var self=this,$self=this;
  67573. return $core.withContext(function($ctx1) {
  67574. return $recv($self._instanceVariableNamesFor_($recv($self.session)._class()))._includes_(aString);
  67575. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString})});
  67576. }; }),
  67577. $globals.Repl);
  67578. $core.addMethod(
  67579. $core.method({
  67580. selector: "nextResultName",
  67581. protocol: "private",
  67582. args: [],
  67583. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  67584. referencedClasses: [],
  67585. pragmas: [],
  67586. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  67587. }, function ($methodClass){ return function (){
  67588. var self=this,$self=this;
  67589. return $core.withContext(function($ctx1) {
  67590. var $1;
  67591. $1=$self.resultCount;
  67592. if($1 == null || $1.a$nil){
  67593. $self.resultCount=(1);
  67594. } else {
  67595. $self.resultCount=$recv($self.resultCount).__plus((1));
  67596. }
  67597. return "res".__comma($recv($self.resultCount)._asString());
  67598. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{})});
  67599. }; }),
  67600. $globals.Repl);
  67601. $core.addMethod(
  67602. $core.method({
  67603. selector: "onKeyPress:",
  67604. protocol: "private",
  67605. args: ["key"],
  67606. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  67607. referencedClasses: [],
  67608. pragmas: [],
  67609. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  67610. }, function ($methodClass){ return function (key){
  67611. var self=this,$self=this;
  67612. return $core.withContext(function($ctx1) {
  67613. if($core.assert($recv($recv(key)._ctrl())._and_((function(){
  67614. return $core.withContext(function($ctx2) {
  67615. return $recv($recv(key)._name()).__eq("l");
  67616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  67617. })))){
  67618. $self._clearScreen();
  67619. }
  67620. return self;
  67621. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key})});
  67622. }; }),
  67623. $globals.Repl);
  67624. $core.addMethod(
  67625. $core.method({
  67626. selector: "parseAssignment:do:",
  67627. protocol: "private",
  67628. args: ["aString", "aBlock"],
  67629. 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 ]",
  67630. referencedClasses: [],
  67631. pragmas: [],
  67632. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  67633. }, function ($methodClass){ return function (aString,aBlock){
  67634. var self=this,$self=this;
  67635. var assignment;
  67636. return $core.withContext(function($ctx1) {
  67637. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  67638. return $core.withContext(function($ctx2) {
  67639. return $recv(s)._trimBoth();
  67640. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  67641. }));
  67642. if($core.assert($recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  67643. return $core.withContext(function($ctx2) {
  67644. return $self._isIdentifier_([$recv(assignment)._first()
  67645. ,$ctx2.sendIdx["first"]=1
  67646. ][0]);
  67647. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  67648. })))){
  67649. return [$recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last())
  67650. ,$ctx1.sendIdx["value:value:"]=1
  67651. ][0];
  67652. } else {
  67653. return $recv(aBlock)._value_value_(nil,nil);
  67654. }
  67655. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment})});
  67656. }; }),
  67657. $globals.Repl);
  67658. $core.addMethod(
  67659. $core.method({
  67660. selector: "presentResultNamed:withValue:",
  67661. protocol: "private",
  67662. args: ["varName", "value"],
  67663. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  67664. referencedClasses: ["Transcript"],
  67665. pragmas: [],
  67666. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  67667. }, function ($methodClass){ return function (varName,value){
  67668. var self=this,$self=this;
  67669. return $core.withContext(function($ctx1) {
  67670. var $1;
  67671. $1=$globals.Transcript;
  67672. $recv($1)._show_([$recv([$recv([$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name())
  67673. ,$ctx1.sendIdx[","]=3
  67674. ][0]).__comma(" = ")
  67675. ,$ctx1.sendIdx[","]=2
  67676. ][0]).__comma($recv(value)._asString())
  67677. ,$ctx1.sendIdx[","]=1
  67678. ][0]);
  67679. $recv($1)._cr();
  67680. $recv($self.interface)._prompt();
  67681. return self;
  67682. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value})});
  67683. }; }),
  67684. $globals.Repl);
  67685. $core.addMethod(
  67686. $core.method({
  67687. selector: "printWelcome",
  67688. protocol: "actions",
  67689. args: [],
  67690. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  67691. referencedClasses: ["Transcript"],
  67692. pragmas: [],
  67693. messageSends: ["show:", "cr"]
  67694. }, function ($methodClass){ return function (){
  67695. var self=this,$self=this;
  67696. return $core.withContext(function($ctx1) {
  67697. var $1;
  67698. $1=$globals.Transcript;
  67699. $recv($1)._show_("Type :q to exit.");
  67700. $recv($1)._cr();
  67701. return self;
  67702. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{})});
  67703. }; }),
  67704. $globals.Repl);
  67705. $core.addMethod(
  67706. $core.method({
  67707. selector: "processLine:",
  67708. protocol: "private",
  67709. args: ["buffer"],
  67710. 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]]",
  67711. referencedClasses: [],
  67712. pragmas: [],
  67713. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  67714. }, function ($methodClass){ return function (buffer){
  67715. var self=this,$self=this;
  67716. var show;
  67717. return $core.withContext(function($ctx1) {
  67718. show=(function(varName,value){
  67719. return $core.withContext(function($ctx2) {
  67720. return $self._presentResultNamed_withValue_(varName,value);
  67721. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  67722. });
  67723. if(!$core.assert($self._executeCommand_(buffer))){
  67724. if($core.assert($self._isVariableDefined_(buffer))){
  67725. $recv(show)._value_value_(buffer,$recv($self.session)._perform_(buffer));
  67726. } else {
  67727. $self._assignNewVariable_do_(buffer,show);
  67728. }
  67729. }
  67730. return self;
  67731. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show})});
  67732. }; }),
  67733. $globals.Repl);
  67734. $core.addMethod(
  67735. $core.method({
  67736. selector: "prompt",
  67737. protocol: "accessing",
  67738. args: [],
  67739. source: "prompt\x0a\x09^ 'amber >> '",
  67740. referencedClasses: [],
  67741. pragmas: [],
  67742. messageSends: []
  67743. }, function ($methodClass){ return function (){
  67744. var self=this,$self=this;
  67745. return "amber >> ";
  67746. }; }),
  67747. $globals.Repl);
  67748. $core.addMethod(
  67749. $core.method({
  67750. selector: "setPreviousVariablesFor:from:",
  67751. protocol: "private",
  67752. args: ["newObject", "oldObject"],
  67753. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  67754. referencedClasses: [],
  67755. pragmas: [],
  67756. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  67757. }, function ($methodClass){ return function (newObject,oldObject){
  67758. var self=this,$self=this;
  67759. return $core.withContext(function($ctx1) {
  67760. $recv($self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  67761. return $core.withContext(function($ctx2) {
  67762. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  67763. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  67764. }));
  67765. return self;
  67766. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject})});
  67767. }; }),
  67768. $globals.Repl);
  67769. $core.addMethod(
  67770. $core.method({
  67771. selector: "setPrompt",
  67772. protocol: "actions",
  67773. args: [],
  67774. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  67775. referencedClasses: [],
  67776. pragmas: [],
  67777. messageSends: ["setPrompt:", "prompt"]
  67778. }, function ($methodClass){ return function (){
  67779. var self=this,$self=this;
  67780. return $core.withContext(function($ctx1) {
  67781. $recv($self.interface)._setPrompt_($self._prompt());
  67782. return self;
  67783. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{})});
  67784. }; }),
  67785. $globals.Repl);
  67786. $core.addMethod(
  67787. $core.method({
  67788. selector: "setupCommands",
  67789. protocol: "initialization",
  67790. args: [],
  67791. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  67792. referencedClasses: ["Dictionary"],
  67793. pragmas: [],
  67794. messageSends: ["from:", "->", "exit", "prompt"]
  67795. }, function ($methodClass){ return function (){
  67796. var self=this,$self=this;
  67797. return $core.withContext(function($ctx1) {
  67798. $self.commands=$recv($globals.Dictionary)._from_([[$recv([":q"]).__minus_gt((function(){
  67799. return $core.withContext(function($ctx2) {
  67800. return $recv(process)._exit();
  67801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  67802. }))
  67803. ,$ctx1.sendIdx["->"]=1
  67804. ][0],$recv([""]).__minus_gt((function(){
  67805. return $core.withContext(function($ctx2) {
  67806. return $recv($self.interface)._prompt();
  67807. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  67808. }))]);
  67809. return self;
  67810. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{})});
  67811. }; }),
  67812. $globals.Repl);
  67813. $core.addMethod(
  67814. $core.method({
  67815. selector: "setupHotkeys",
  67816. protocol: "initialization",
  67817. args: [],
  67818. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  67819. referencedClasses: [],
  67820. pragmas: [],
  67821. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  67822. }, function ($methodClass){ return function (){
  67823. var self=this,$self=this;
  67824. return $core.withContext(function($ctx1) {
  67825. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  67826. return $core.withContext(function($ctx2) {
  67827. if(key == null || key.a$nil){
  67828. return key;
  67829. } else {
  67830. return $self._onKeyPress_(key);
  67831. }
  67832. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  67833. }));
  67834. return self;
  67835. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{})});
  67836. }; }),
  67837. $globals.Repl);
  67838. $core.addMethod(
  67839. $core.method({
  67840. selector: "subclass:withVariable:",
  67841. protocol: "private",
  67842. args: ["aClass", "varName"],
  67843. 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'",
  67844. referencedClasses: ["ClassBuilder"],
  67845. pragmas: [],
  67846. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  67847. }, function ($methodClass){ return function (aClass,varName){
  67848. var self=this,$self=this;
  67849. return $core.withContext(function($ctx1) {
  67850. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv($self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  67851. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName})});
  67852. }; }),
  67853. $globals.Repl);
  67854. $core.addMethod(
  67855. $core.method({
  67856. selector: "subclassNameFor:",
  67857. protocol: "private",
  67858. args: ["aClass"],
  67859. 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'].",
  67860. referencedClasses: [],
  67861. pragmas: [],
  67862. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  67863. }, function ($methodClass){ return function (aClass){
  67864. var self=this,$self=this;
  67865. return $core.withContext(function($ctx1) {
  67866. var $1;
  67867. $1=[$recv([$recv(aClass)._name()
  67868. ,$ctx1.sendIdx["name"]=1
  67869. ][0])._matchesOf_("\x5cd+$")
  67870. ,$ctx1.sendIdx["matchesOf:"]=1
  67871. ][0];
  67872. if($1 == null || $1.a$nil){
  67873. return $recv($recv(aClass)._name()).__comma("2");
  67874. } else {
  67875. var counter;
  67876. counter=$recv($recv($recv($recv([$recv(aClass)._name()
  67877. ,$ctx1.sendIdx["name"]=2
  67878. ][0])._matchesOf_("\x5cd+$"))._first())._asNumber()).__plus((1));
  67879. return $recv([$recv(aClass)._name()
  67880. ,$ctx1.sendIdx["name"]=3
  67881. ][0])._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  67882. }
  67883. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass})});
  67884. }; }),
  67885. $globals.Repl);
  67886. $core.addMethod(
  67887. $core.method({
  67888. selector: "main",
  67889. protocol: "initialization",
  67890. args: [],
  67891. source: "main\x0a\x09self new createInterface",
  67892. referencedClasses: [],
  67893. pragmas: [],
  67894. messageSends: ["createInterface", "new"]
  67895. }, function ($methodClass){ return function (){
  67896. var self=this,$self=this;
  67897. return $core.withContext(function($ctx1) {
  67898. $recv($self._new())._createInterface();
  67899. return self;
  67900. }, function($ctx1) {$ctx1.fill(self,"main",{})});
  67901. }; }),
  67902. $globals.Repl.a$cls);
  67903. });
  67904. (function () {
  67905. define('__app__',["amber/devel", "amber/core/Platform-Node", "amber_cli/AmberCli"], function (amber) {
  67906. amber.initialize().then(function () {
  67907. amber.globals.AmberCli._main();
  67908. });
  67909. });
  67910. }());
  67911. (function () {
  67912. define('app',["require", "amber/es6-promise"], function (require, promiseLib) {
  67913. promiseLib.polyfill();
  67914. return new Promise(function (resolve, reject) {
  67915. require(["__app__"], resolve, reject);
  67916. });
  67917. });
  67918. }());
  67919. require(["app"]);
  67920. });
  67921. }((function amdefine(module, requireFn) {
  67922. 'use strict';
  67923. var defineCache = {},
  67924. loaderCache = {},
  67925. alreadyCalled = false,
  67926. path = require('path'),
  67927. makeRequire, stringRequire;
  67928. /**
  67929. * Trims the . and .. from an array of path segments.
  67930. * It will keep a leading path segment if a .. will become
  67931. * the first path segment, to help with module name lookups,
  67932. * which act like paths, but can be remapped. But the end result,
  67933. * all paths that use this function should look normalized.
  67934. * NOTE: this method MODIFIES the input array.
  67935. * @param {Array} ary the array of path segments.
  67936. */
  67937. function trimDots(ary) {
  67938. var i, part;
  67939. for (i = 0; ary[i]; i+= 1) {
  67940. part = ary[i];
  67941. if (part === '.') {
  67942. ary.splice(i, 1);
  67943. i -= 1;
  67944. } else if (part === '..') {
  67945. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  67946. //End of the line. Keep at least one non-dot
  67947. //path segment at the front so it can be mapped
  67948. //correctly to disk. Otherwise, there is likely
  67949. //no path mapping for a path starting with '..'.
  67950. //This can still fail, but catches the most reasonable
  67951. //uses of ..
  67952. break;
  67953. } else if (i > 0) {
  67954. ary.splice(i - 1, 2);
  67955. i -= 2;
  67956. }
  67957. }
  67958. }
  67959. }
  67960. function normalize(name, baseName) {
  67961. var baseParts;
  67962. //Adjust any relative paths.
  67963. if (name && name.charAt(0) === '.') {
  67964. //If have a base name, try to normalize against it,
  67965. //otherwise, assume it is a top-level require that will
  67966. //be relative to baseUrl in the end.
  67967. if (baseName) {
  67968. baseParts = baseName.split('/');
  67969. baseParts = baseParts.slice(0, baseParts.length - 1);
  67970. baseParts = baseParts.concat(name.split('/'));
  67971. trimDots(baseParts);
  67972. name = baseParts.join('/');
  67973. }
  67974. }
  67975. return name;
  67976. }
  67977. /**
  67978. * Create the normalize() function passed to a loader plugin's
  67979. * normalize method.
  67980. */
  67981. function makeNormalize(relName) {
  67982. return function (name) {
  67983. return normalize(name, relName);
  67984. };
  67985. }
  67986. function makeLoad(id) {
  67987. function load(value) {
  67988. loaderCache[id] = value;
  67989. }
  67990. load.fromText = function (id, text) {
  67991. //This one is difficult because the text can/probably uses
  67992. //define, and any relative paths and requires should be relative
  67993. //to that id was it would be found on disk. But this would require
  67994. //bootstrapping a module/require fairly deeply from node core.
  67995. //Not sure how best to go about that yet.
  67996. throw new Error('amdefine does not implement load.fromText');
  67997. };
  67998. return load;
  67999. }
  68000. makeRequire = function (systemRequire, exports, module, relId) {
  68001. function requireInContext(depName) {
  68002. return stringRequire(systemRequire, exports, module, depName, relId);
  68003. }
  68004. function amdRequire(deps, callback) {
  68005. if (typeof deps === 'string') {
  68006. //Synchronous, single module require('')
  68007. return requireInContext(deps);
  68008. } else {
  68009. //Array of dependencies with a callback.
  68010. if (callback) {
  68011. //Wait for next tick to call back the require call.
  68012. process.nextTick(function () {
  68013. //Convert the dependencies to modules.
  68014. callback.apply(null, deps.map(requireInContext));
  68015. });
  68016. } else {
  68017. //Require the dependencies' moduies.
  68018. deps.forEach(requireInContext);
  68019. }
  68020. }
  68021. }
  68022. amdRequire.toUrl = function (filePath) {
  68023. if (filePath.indexOf('.') === 0) {
  68024. return normalize(filePath, path.dirname(module.filename));
  68025. } else {
  68026. return filePath;
  68027. }
  68028. };
  68029. return amdRequire;
  68030. };
  68031. //Favor explicit value, passed in if the module wants to support Node 0.4.
  68032. requireFn = requireFn || function req() {
  68033. return module.require.apply(module, arguments);
  68034. };
  68035. function runFactory(id, deps, factory) {
  68036. var r, e, m, result;
  68037. if (id) {
  68038. e = loaderCache[id] = {};
  68039. m = {
  68040. id: id,
  68041. uri: __filename,
  68042. exports: e
  68043. };
  68044. r = makeRequire(requireFn, e, m, id);
  68045. } else {
  68046. //Only support one define call per file
  68047. if (alreadyCalled) {
  68048. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  68049. }
  68050. alreadyCalled = true;
  68051. //Use the real variables from node
  68052. //Use module.exports for exports, since
  68053. //the exports in here is amdefine exports.
  68054. e = module.exports;
  68055. m = module;
  68056. r = makeRequire(requireFn, e, m, module.id);
  68057. }
  68058. //If there are dependencies, they are strings, so need
  68059. //to convert them to dependency values.
  68060. if (deps) {
  68061. deps = deps.map(function (depName) {
  68062. return r(depName);
  68063. });
  68064. }
  68065. //Call the factory with the right dependencies.
  68066. if (typeof factory === 'function') {
  68067. result = factory.apply(m.exports, deps);
  68068. } else {
  68069. result = factory;
  68070. }
  68071. if (result !== undefined) {
  68072. m.exports = result;
  68073. if (id) {
  68074. loaderCache[id] = m.exports;
  68075. }
  68076. }
  68077. }
  68078. stringRequire = function (systemRequire, exports, module, id, relId) {
  68079. //Split the ID by a ! so that
  68080. var index = id.indexOf('!'),
  68081. originalId = id,
  68082. prefix, plugin;
  68083. if (index === -1) {
  68084. id = normalize(id, relId);
  68085. //Straight module lookup. If it is one of the special dependencies,
  68086. //deal with it, otherwise, delegate to node.
  68087. if (id === 'require') {
  68088. return makeRequire(systemRequire, exports, module, relId);
  68089. } else if (id === 'exports') {
  68090. return exports;
  68091. } else if (id === 'module') {
  68092. return module;
  68093. } else if (loaderCache.hasOwnProperty(id)) {
  68094. return loaderCache[id];
  68095. } else if (defineCache[id]) {
  68096. runFactory.apply(null, defineCache[id]);
  68097. return loaderCache[id];
  68098. } else {
  68099. if(systemRequire) {
  68100. return systemRequire(originalId);
  68101. } else {
  68102. throw new Error('No module with ID: ' + id);
  68103. }
  68104. }
  68105. } else {
  68106. //There is a plugin in play.
  68107. prefix = id.substring(0, index);
  68108. id = id.substring(index + 1, id.length);
  68109. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  68110. if (plugin.normalize) {
  68111. id = plugin.normalize(id, makeNormalize(relId));
  68112. } else {
  68113. //Normalize the ID normally.
  68114. id = normalize(id, relId);
  68115. }
  68116. if (loaderCache[id]) {
  68117. return loaderCache[id];
  68118. } else {
  68119. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  68120. return loaderCache[id];
  68121. }
  68122. }
  68123. };
  68124. //Create a define function specific to the module asking for amdefine.
  68125. function define(id, deps, factory) {
  68126. if (Array.isArray(id)) {
  68127. factory = deps;
  68128. deps = id;
  68129. id = undefined;
  68130. } else if (typeof id !== 'string') {
  68131. factory = id;
  68132. id = deps = undefined;
  68133. }
  68134. if (deps && !Array.isArray(deps)) {
  68135. factory = deps;
  68136. deps = undefined;
  68137. }
  68138. if (!deps) {
  68139. deps = ['require', 'exports', 'module'];
  68140. }
  68141. //Set up properties for this module. If an ID, then use
  68142. //internal cache. If no ID, then use the external variables
  68143. //for this node module.
  68144. if (id) {
  68145. //Put the module in deep freeze until there is a
  68146. //require call for it.
  68147. defineCache[id] = [id, deps, factory];
  68148. } else {
  68149. runFactory(id, deps, factory);
  68150. }
  68151. }
  68152. //define.require, which has access to all the values in the
  68153. //cache. Useful for AMD modules that all have IDs in the file,
  68154. //but need to finally export a value to node based on one of those
  68155. //IDs.
  68156. define.require = function (id) {
  68157. if (loaderCache[id]) {
  68158. return loaderCache[id];
  68159. }
  68160. if (defineCache[id]) {
  68161. runFactory.apply(null, defineCache[id]);
  68162. return loaderCache[id];
  68163. }
  68164. };
  68165. define.amd = {};
  68166. return define;
  68167. }(module)), require));